New bitmap method SetRGBConversionFunction which can be used to
[tangerine.git] / workbench / c / shellcommands / shcommands_embedded.h
blob0c5de97e110cfb7e3182d4d4a616e347577f6d30
1 #ifndef SHCOMMANDS_EMBEDDED_H
2 #define SHCOMMANDS_EMBEDDED_H
4 /*
5 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
6 $Id$
7 */
9 #include <dos/dos.h>
10 #include <proto/dos.h>
11 #include <aros/symbolsets.h>
13 #define _stringify(x) #x
14 #define stringify(x) _stringify(x)
16 #define SHArg(name) __shargs[SHA_##name]
18 #define __SHA_ENUM(abbr, name, modf, def) SHA_##name
19 #define __SHA_DEF(abbr, name, modf, def) (IPTR)(def)
20 #define __SHA_OPT(abbr, name, modf, def) \
21 stringify(abbr) stringify(name) stringify(modf)
24 struct shcommand
26 STRPTR name;
27 ULONG (*command)();
28 ULONG numargs;
29 const IPTR *defaults;
30 STRPTR templ;
33 #define __AROS_SH_ARGS(name, numargs, defl, templ) \
34 static ULONG name##_main(IPTR *, struct ExecBase *SysBase, \
35 struct DosLibrary *); \
36 static const IPTR __##name##_##defaults[numargs] = defl; \
37 struct shcommand __##name##_##shcommand = \
38 { \
39 stringify(name), \
40 name##_main, \
41 numargs, \
42 __##name##_##defaults, \
43 templ \
44 }; \
46 ADD2SET(__##name##_##shcommand, __SHCOMMANDS__, 0); \
48 static ULONG name##_main(IPTR *__shargs, struct ExecBase *SysBase, \
49 struct DosLibrary *DOSBase) \
52 #define AROS_SHCOMMAND_INIT
54 #define AROS_SHCOMMAND_EXIT \
55 } \
56 return RETURN_OK; \
60 #define AROS_SH0(name, version) \
61 ULONG name##_main(struct DOSBase *DOSBase); \
62 struct struct shcommand __##name##_##shcommand = \
63 { \
64 stringify(name), \
65 name##_main, \
66 NULL, \
67 NULL \
68 }; \
70 ADD2SET(__##name##_##shcommand, __SHCOMMANDS__, 0); \
72 ULONG name##_main(struct DOSBase *DOSBase) \
75 #define __DEF(x...) {x}
77 #define AROS_SH1(name, version, a1) \
78 __AROS_SH_ARGS(name, 1, __DEF(__SHA_DEF(a1)), \
79 __SHA_OPT(a1)) \
80 { \
81 enum {__SHA_ENUM(a1)};
83 #define AROS_SH2(name, version, a1, a2) \
84 __AROS_SH_ARGS(name, 2, __DEF(__SHA_DEF(a1), __SHA_DEF(a2)), \
85 __SHA_OPT(a1) "," __SHA_OPT(a2)) \
86 { \
87 enum {__SHA_ENUM(a1), __SHA_ENUM(a2)};
89 #define AROS_SH3(name, version, a1, a2, a3) \
90 __AROS_SH_ARGS(name, 3, __DEF(__SHA_DEF(a1), __SHA_DEF(a2), \
91 __SHA_DEF(a3)), \
92 __SHA_OPT(a1) "," __SHA_OPT(a2) "," \
93 __SHA_OPT(a3)) \
94 { \
95 enum {__SHA_ENUM(a1), __SHA_ENUM(a2), \
96 __SHA_ENUM(a3)};
98 #define AROS_SH4(name, version, a1, a2, a3, a4) \
99 __AROS_SH_ARGS(name, 4, __DEF(__SHA_DEF(a1), __SHA_DEF(a2), \
100 __SHA_DEF(a3), __SHA_DEF(a4)), \
101 __SHA_OPT(a1) "," __SHA_OPT(a2) "," \
102 __SHA_OPT(a3) "," __SHA_OPT(a4)) \
104 enum {__SHA_ENUM(a1), __SHA_ENUM(a2), \
105 __SHA_ENUM(a3), __SHA_ENUM(a4)};
107 #define AROS_SH5(name, version, a1, a2, a3, a4, a5) \
108 __AROS_SH_ARGS(name, 5, __DEF(__SHA_DEF(a1), __SHA_DEF(a2), \
109 __SHA_DEF(a3), __SHA_DEF(a4), \
110 __SHA_DEF(a5)), \
111 __SHA_OPT(a1) "," __SHA_OPT(a2) "," \
112 __SHA_OPT(a3) "," __SHA_OPT(a4) "," \
113 __SHA_OPT(a5)) \
115 enum {__SHA_ENUM(a1), __SHA_ENUM(a2), __SHA_ENUM(a3), \
116 __SHA_ENUM(a4), __SHA_ENUM(a5)}; \
119 #define AROS_SHA(abbr, name, modf, def) abbr,name,modf,def
121 #endif