logo

Grimgrains

Unnamed repository; edit this file 'description' to name the repository.
commit: 34b5b561e4d57fdb782ac958502c665e965a990f
parent f0d609e0b18a2ac22311d283044d526968b6bd1e
Author: neauoire <aliceffekt@gmail.com>
Date:   Thu, 19 Dec 2019 15:59:03 -0500

Progress on new site builder

Diffstat:

Msource/ingredients.c16++++++++++++++++
Asource/main0
Msource/recipe.c57++++++++++++++++++++++++++++++++++++++-------------------
Msource/recipes.c36+++++++++++++++++++-----------------
4 files changed, 73 insertions(+), 36 deletions(-)

diff --git a/source/ingredients.c b/source/ingredients.c @@ -6,4 +6,20 @@ Ingredient puffed_rice = create_ingredient("puffed_rice","descr"); Ingredient kinako = create_ingredient("kinako","descr"); Ingredient salt = create_ingredient("salt","descr"); +Ingredient soy_sauce = create_ingredient("soy_sauce","descr"); +Ingredient japanese_rice_vinegar = create_ingredient("japanese_rice_vinegar","descr"); +Ingredient chili_pepper_flakes = create_ingredient("chili_pepper_flakes","descr"); +Ingredient peanut_butter = create_ingredient("peanut_butter","descr"); +Ingredient maple_syrup = create_ingredient("maple_syrup","descr"); +Ingredient sesame_oil = create_ingredient("sesame_oil","descr"); +Ingredient garlic = create_ingredient("garlic","descr"); +Ingredient ginger_root = create_ingredient("ginger_root","descr"); +Ingredient arrowroot_starch = create_ingredient("arrowroot_starch","descr"); + +Ingredient brown_lentils = create_ingredient("brown_lentils","descr"); +Ingredient vegetable_bouillon = create_ingredient("vegetable_bouillon","descr"); +Ingredient carrots = create_ingredient("carrots","descr"); +Ingredient daikon = create_ingredient("daikon","descr"); +Ingredient chives = create_ingredient("chives","descr"); + // Ingredient *ingredients[] = {&pepper}; \ No newline at end of file diff --git a/source/main b/source/main Binary files differ. diff --git a/source/recipe.c b/source/recipe.c @@ -1,14 +1,20 @@ typedef struct { char *name; - char *portions; - char *description; - int date; - int time; int instructions_len; char *instructions[256]; int servings_len; Serving servings[10]; +} RecipePart; + +typedef struct { + char *name; + char *portions; + char *description; + int date; + int time; + int parts_len; + RecipePart *parts[10]; } Recipe; Recipe create_recipe(char *name, char *portions, int date, int time) { @@ -17,6 +23,14 @@ Recipe create_recipe(char *name, char *portions, int date, int time) { a.portions = portions; a.date = date; a.time = time; + a.parts_len = 0; + return a; +} + +RecipePart create_recipe_part(char *name) { + RecipePart a; + a.name = name; + a.instructions_len = 0; a.servings_len = 0; return a; } @@ -25,28 +39,33 @@ void add_recipe_description(Recipe *r, char *description){ r->description = description; } -void add_recipe_instruction(Recipe *r, char *instruction){ - r->instructions[r->instructions_len] = instruction; - r->instructions_len++; +void add_part_instruction(RecipePart *p, char *instruction){ + p->instructions[p->instructions_len] = instruction; + p->instructions_len++; } -void add_recipe_serving(Recipe *r, Ingredient *i, char *quantity){ - r->servings[r->servings_len] = create_serving(i,quantity); - r->servings_len++; +void add_part_serving(RecipePart *p, Ingredient *i, char *quantity){ + p->servings[p->servings_len] = create_serving(i,quantity); + p->servings_len++; } -void add_recipe_part(Recipe *r, Part *p) { - +void add_part(Recipe *r, RecipePart *p){ + r->parts[r->parts_len] = p; + r->parts_len++; } void print_recipe(Recipe recipe) { printf("name:%s, portions:%s date:%d time:%d\n",recipe.name,recipe.portions,recipe.date,recipe.time); - printf("===========\nInstructions:\n"); - for(int i = 0; i < recipe.instructions_len; ++i) { - printf("%s\n", recipe.instructions[i]); - } - printf("===========\nIngredients:\n"); - for(int i = 0; i < recipe.servings_len; ++i) { - printf("%s %s\n", recipe.servings[i].ingredient->name,recipe.servings[i].quantity); + printf("===========\nParts:\n"); + for(int i = 0; i < recipe.parts_len; ++i) { + printf("- %s(%d ingredients %d instructions)\n", recipe.parts[i]->name, recipe.parts[i]->servings_len, recipe.parts[i]->instructions_len); + // for(int i = 0; i < recipe.parts[i].servings_len; ++i) { + // printf("-- %s\n", recipe.parts[i].servings[i].ingredient->name); + + // } } + // printf("===========\nIngredients:\n"); + // for(int i = 0; i < recipe.servings_len; ++i) { + // printf("%s %s\n", recipe.servings[i].ingredient->name,recipe.servings[i].quantity); + // } } diff --git a/source/recipes.c b/source/recipes.c @@ -2,10 +2,10 @@ Recipe sweet_sour_lentils = create_recipe("sweet and sour lentils","2 servings",20190602,30); add_recipe_description(&sweet_sour_lentils, "In my galley I have a few recipes that I consider staples, that I'm always in the mood to eat. I usually rotate these throughout the week, adding maybe a new recipe or two to change things up. This sweet and sour lentils recipe is one of these, a favourite of ours."); -RecipePart sweet_sour_lentils_sauce = create_recipe_part(&sweet_sour_lentils,"sauce"); -add_part_instruction(&sweet_sour_lentils_sauce,"Mix all liquid ingredients together in a bowl, add {_1 tbsp_} of {{peanut butter}} and stir until dissolved."); -add_part_instruction(&sweet_sour_lentils_sauce,"Stir in {_1 tbsp_} of {{arrowroot starch}} (to help thicken sauce)."); -add_part_instruction(&sweet_sour_lentils_sauce,"Add {_2 tsp_} of {{chili pepper flakes}}, {_3_} minced {{garlic cloves}} and roughly {_1 inch_} of minced {{ginger root}}."); +RecipePart sweet_sour_lentils_sauce = create_recipe_part("sauce"); +add_part_instruction(&sweet_sour_lentils_sauce, "Mix all liquid ingredients together in a bowl, add {_1 tbsp_} of {{peanut butter}} and stir until dissolved."); +add_part_instruction(&sweet_sour_lentils_sauce, "Stir in {_1 tbsp_} of {{arrowroot starch}} (to help thicken sauce)."); +add_part_instruction(&sweet_sour_lentils_sauce, "Add {_2 tsp_} of {{chili pepper flakes}}, {_3_} minced {{garlic cloves}} and roughly {_1 inch_} of minced {{ginger root}}."); add_part_serving(&sweet_sour_lentils_sauce, &soy_sauce, "2 tbsp"); add_part_serving(&sweet_sour_lentils_sauce, &japanese_rice_vinegar, "2 tbsp"); add_part_serving(&sweet_sour_lentils_sauce, &chili_pepper_flakes, "2 tsp"); @@ -15,20 +15,22 @@ add_part_serving(&sweet_sour_lentils_sauce, &sesame_oil, "1 tsp"); add_part_serving(&sweet_sour_lentils_sauce, &garlic, "3 cloves, minced"); add_part_serving(&sweet_sour_lentils_sauce, &ginger_root, "1 root minced"); add_part_serving(&sweet_sour_lentils_sauce, &arrowroot_starch, "1 tbsp"); +add_part(&sweet_sour_lentils, &sweet_sour_lentils_sauce); -// RecipePart sweet_sour_lentils_main = create_recipe_part(&sweet_sour_lentils,"main"); -// add_part_instruction(&sweet_sour_lentils_main, "Rinse lentils. Transfer rinsed lentils to a pot and add {_1 1/2 cups_} of {{vegetable bouillon}}."); -// add_part_instruction(&sweet_sour_lentils_main, "Bring water to a rapid simmer, then reduce heat to medium."); -// add_part_instruction(&sweet_sour_lentils_main, "Simmer uncovered. After {#10 minutes#} add {_1_} cubed {{carrot}} and {_2 inches_} of cubed {{daikon}}."); -// add_part_instruction(&sweet_sour_lentils_main, "Let mixture simmer for an additional {#10-20 minutes#}, add extra water as needed."); -// add_part_instruction(&sweet_sour_lentils_main, "If lentils are tender, they are ready. Strain lentils and return to pot with {_1/4 tsp_} of {{salt}}."); -// add_part_instruction(&sweet_sour_lentils_main, "Pour sauce onto lentils, mix well. Serve into two bowls with some {{chives}}. Eat wrapped in salad or cabbage leaves, or with {{crackers}}."); -// add_part_serving(&sweet_sour_lentils_main, &brown_lentils, "1/2 cup"); -// add_part_serving(&sweet_sour_lentils_main, &vegetable_bouillon, "1 1/2 cups"); -// add_part_serving(&sweet_sour_lentils_main, &carrots, "1, cubed"); -// add_part_serving(&sweet_sour_lentils_main, &daikon, "2 cubed"); -// add_part_serving(&sweet_sour_lentils_main, &chives, "3 stalks"); -// add_part_serving(&sweet_sour_lentils_main, &salt, "1/4 tsp"); +RecipePart sweet_sour_lentils_main = create_recipe_part("main"); +add_part_instruction(&sweet_sour_lentils_main, "Rinse lentils. Transfer rinsed lentils to a pot and add {_1 1/2 cups_} of {{vegetable bouillon}}."); +add_part_instruction(&sweet_sour_lentils_main, "Bring water to a rapid simmer, then reduce heat to medium."); +add_part_instruction(&sweet_sour_lentils_main, "Simmer uncovered. After {#10 minutes#} add {_1_} cubed {{carrot}} and {_2 inches_} of cubed {{daikon}}."); +add_part_instruction(&sweet_sour_lentils_main, "Let mixture simmer for an additional {#10-20 minutes#}, add extra water as needed."); +add_part_instruction(&sweet_sour_lentils_main, "If lentils are tender, they are ready. Strain lentils and return to pot with {_1/4 tsp_} of {{salt}}."); +add_part_instruction(&sweet_sour_lentils_main, "Pour sauce onto lentils, mix well. Serve into two bowls with some {{chives}}. Eat wrapped in salad or cabbage leaves, or with {{crackers}}."); +add_part_serving(&sweet_sour_lentils_main, &brown_lentils, "1/2 cup"); +add_part_serving(&sweet_sour_lentils_main, &vegetable_bouillon, "1 1/2 cups"); +add_part_serving(&sweet_sour_lentils_main, &carrots, "1, cubed"); +add_part_serving(&sweet_sour_lentils_main, &daikon, "2 cubed"); +add_part_serving(&sweet_sour_lentils_main, &chives, "3 stalks"); +add_part_serving(&sweet_sour_lentils_main, &salt, "1/4 tsp"); +add_part(&sweet_sour_lentils, &sweet_sour_lentils_main); /*