2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
4 Desc: Function to write proto/modulename(_rel).h. Part of genmodule.
8 void writeincproto(struct config
*cfg
, int is_rel
)
11 char line
[256], define
[256], *banner
;
12 struct linelist
*linelistit
;
14 snprintf(line
, 255, "%s/proto/%s%s.h",
15 cfg
->gendir
, cfg
->modulename
, is_rel
? "_rel" : ""
17 out
= fopen(line
, "w");
25 banner
= getBanner(cfg
);
27 "#ifndef PROTO_%s%s_H\n"
28 "#define PROTO_%s%s_H\n"
32 "#include <exec/types.h>\n"
33 "#include <aros/system.h>\n"
35 "#include <clib/%s_protos.h>\n"
37 cfg
->modulenameupper
, is_rel
? "_REL" : "",
38 cfg
->modulenameupper
, is_rel
? "_REL" : "",
46 "#if !defined(%s) && !defined(__NOLIBBASE__) && !defined(__%s_NOLIBBASE__)\n"
47 " #ifdef __%s_STDLIBBASE__\n"
48 " extern struct Library *%s;\n"
54 cfg
->libbase
, cfg
->modulenameupper
,
57 cfg
->libbasetypeptrextern
, cfg
->libbase
63 "#if !defined(%s) && !defined(__NOLIBBASE__) && !defined(__%s_NOLIBBASE__)\n"
64 " extern IPTR %s_offset;\n"
65 " #ifdef __%s_STDLIBBASE__\n"
66 " #define %s ((struct Library *)((char *)AROS_GET_LIBBASE+%s_offset))\n"
68 " #define %s ((%s)((char *)AROS_GET_LIBBASE+%s_offset))\n"
72 cfg
->libbase
, cfg
->modulenameupper
,
75 cfg
->libbase
, cfg
->libbase
,
76 cfg
->libbase
, cfg
->libbasetypeptrextern
, cfg
->libbase
80 // define name must not start with a digit
81 // this solves a problem with proto/8svx.h
82 if (isdigit(cfg
->modulenameupper
[0]))
84 snprintf(define
, sizeof define
, "X%s", cfg
->modulenameupper
);
88 strncpy(define
, cfg
->modulenameupper
, sizeof define
);
94 "#if !defined(NOLIBINLINE) && !defined(%s_NOLIBINLINE)\n"
95 "# include <inline/%s.h>\n",
96 define
, cfg
->modulename
101 "#%sif !defined(NOLIBDEFINES) && !defined(%s_NOLIBDEFINES)\n"
102 "# include <defines/%s.h>\n"
105 "#endif /* PROTO_%s_H */\n",
106 (is_rel
) ? "" : "el",
107 define
, cfg
->modulename
,