summaryrefslogtreecommitdiffstats
path: root/types.h
blob: ea8fa476600e355f3931c55855a573a87975ca71 (plain) (blame)
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
42
43
44
45
46
47
48
49
50
51
#ifndef __TYPES_H
#define __TYPES_H

typedef struct item_t {
  char *name;
  char *qty;
} item;

enum step_type {
  PREP = 0,
  COOK,
  SERVE,
};

typedef struct step_t {
  char *inst;
  char *duration;
  char *result;
  enum step_type type;
} step;

typedef struct recipe_t {
  char * filename;
  char * path;
  char * title;
  int n;
  item **i;
  int in;
  step **s;
  int sn;
  struct recipe_t **r;
  int rn;
} recipe;

recipe * new_recipe();
void new_subrecipe(recipe * r, recipe * src);
void new_item(recipe * r);
void new_step(recipe * r);

void free_recipe(recipe * r);
void free_item(item * i);
void free_step(step * s);

void show(recipe * r);
void tojson(recipe * r);
void tohtml(recipe * r);
void torcp(recipe * r);

void copy_items(recipe * dst, recipe * src);

#endif /* __TYPES_H */