-
Notifications
You must be signed in to change notification settings - Fork 0
/
ecb_extract.h
41 lines (36 loc) · 934 Bytes
/
ecb_extract.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#pragma once
#include <stdio.h>
typedef struct Recipe {
/** Recipe/page number i.e. 00001 or 00001A, recipes ending in a letter are page 2, 3, 4, etc */
char* id;
char* category;
char* subcategory;
/** Where the recipe came from */
char* source;
char* title;
/** Number of ingredients in the recipe */
size_t n_ingredients;
char** ingredients;
/** Number of instructions in the recipe */
size_t n_instructions;
char** instructions;
} Recipe;
/**
* A function that does something with a recipe,
* like printing it to stdout.
*/
typedef void (*RecipeHandler)(Recipe);
/**
* Print the recipe to stdout
*/
void print_recipe(Recipe recipe);
/**
* Extracts all recipes from the given file pointer.
* This creates a bunch of text files with the extract
* recipes.
*/
int extract_recipes(FILE* fp, RecipeHandler recipe_fn);
/**
* Free memory for a recipe instance
*/
void free_recipe(Recipe recipe);