summaryrefslogtreecommitdiffstats
path: root/mfpp.h
blob: 55f617088b2e151198b11763294646efa9898bae (plain)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
 * mfpp.h
 *
 * Header file for mfpp
 *
 * Copyright  1996 H. Peter Anvin
 */

/* List value structure */
struct listelm
{
  char *txt;
  struct listelm *next;
};

typedef struct
{
  int len;
  struct listelm *head, *tail;
} list;

/* Identifier structure */
struct identifier
{
  char *name;			/* name of identifier */
  list *val;			/* value of identifier */
};

/* Actions defined in mfppact.c */
void do_if(int);
void do_elif(int);
void do_else(void);
void do_endif(void);
void balance_blocks(void);
void do_define(char *, char *);
void do_copy(char *, char *);

/* Identifier manipulations */
void symtab_init(void);
void id_define(char *, list *);
struct identifier *id_lookup(char *);
char *id_ref(char *);
list *id_ref_list(char *);

/* List management */
list *makelist(char *);
list *nulllist(void);
list *listcat(list *, list *);
list *listapp(list *, char *);
list *listdup(list *);
void freelist(list *);

/* Memory management - string handling */
void *xmalloc(int);
char *xstrdup(char *);
char *xstrcat(char *, char *);

/* Set to nonzero if we are %if-ed out */
extern int killcount;

/* Debug level */
extern int debug;

/* Error routine */
void yyerror(char *msg, ...);

/* Main routine - defined in mfpp.y */
int ppfile(FILE *);