tools/genmodule: Remember and restore memory slots in resp. OpenLib, CloseLib.
[AROS.git] / tools / genmodule / functionhead.h
blob8b81d578d1b6ee5be54794ed64a3a133044061ea
1 /*
2 Copyright © 1995-2009, 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 { 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;
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 */
42 struct functionhead *newfunctionhead(const char *name, enum libcall libcall);
43 struct functionarg *funcaddarg
45 struct functionhead *funchead,
46 const char *arg, const char *reg
48 struct stringlist *funcaddalias(struct functionhead *funchead, const char *alias);
49 void funcsetinternalname(struct functionhead *funchead, const char *intername);
51 /* Write out the function prototypes for the functions in the given
52 * cfg may be NULL if the list only contains functions with STACK libcall
54 struct config;
55 void writefuncdefs(FILE *out, struct config *cfg, struct functionhead *funclist);
56 void writefuncprotos(FILE *out, struct config *cfg, struct functionhead *funclist);
57 void writefuncinlines(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