grub2: bring back build of aros-side grub2 tools
[AROS.git] / tools / genmodule / functionhead.h
blob313354404fdc4533e0b4fa534f4f7e4cbff728b8
1 /*
2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: global include for genmodule. Defines global variables and
6 the function prototypes.
7 */
8 #ifndef FUNCTIONHEAD_H
9 #define FUNCTIONHEAD_H
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <string.h>
14 #include <ctype.h>
16 #include "stringlist.h"
18 enum libcall { INVALID, STACK, REGISTER, MIXED, REGISTERMACRO, AUTOREGISTER };
20 struct functionarg {
21 struct functionarg *next;
22 char *arg;
23 char *reg;
26 struct functionhead {
27 struct functionhead *next;
28 char *name, *internalname;
29 char *type, *comment;
30 enum libcall libcall;
31 unsigned int argcount;
32 struct functionarg *arguments;
33 struct stringlist *aliases;
34 unsigned int lvo; /* Only for library functions, not methods */
35 struct stringlist *interface; /* Only for HIDD class */
36 char *method; /* Only for HIID class */
37 int version; /* First library version number this appeared in*/
38 int novararg : 1; /* Are varargs allowed for this function ? */
39 int priv : 1; /* Is function private */
40 int unusedlibbase : 1; /* Libbase must no be made available internally */
43 struct functionhead *newfunctionhead(const char *name, enum libcall libcall);
44 struct functionarg *funcaddarg
46 struct functionhead *funchead,
47 const char *arg, const char *reg
49 struct stringlist *funcaddalias(struct functionhead *funchead, const char *alias);
50 void funcsetinternalname(struct functionhead *funchead, const char *intername);
52 /* Write out the function prototypes for the functions in the given
53 * cfg may be NULL if the list only contains functions with STACK libcall
55 struct config;
56 void writefuncdefs(FILE *out, struct config *cfg, struct functionhead *funclist);
57 void writefuncprotos(FILE *out, struct config *cfg, struct functionhead *funclist);
58 void writefuncinternalstubs(FILE *out, struct config *cfg, struct functionhead *funclist);
60 /* getargtype remove the variable name from a variable definition and leave return
61 * the type of the variable
62 * [] at the end will be added as * in the variable type
63 * e.g. char *var[] => type: char **, name: var
64 * This is a destructive function and will change to string pointed to by def
65 * to only contain the type afterwards.
66 * Function return 0 when it did not understand the input, 1 otherwise
68 char *getargtype(const struct functionarg *funcarg);
69 char *getargname(const struct functionarg *funcarg);
71 #endif //FUNCTIONHEAD_H