1 #ifndef SHCOMMANDS_EMBEDDED_H
2 #define SHCOMMANDS_EMBEDDED_H
5 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
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)
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 = \
42 __##name##_##defaults, \
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 \
60 #define AROS_SH0(name, version) \
61 ULONG name##_main(struct DOSBase *DOSBase); \
62 struct struct shcommand __##name##_##shcommand = \
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)), \
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)) \
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), \
92 __SHA_OPT(a1) "," __SHA_OPT(a2) "," \
95 enum {__SHA_ENUM(a1), __SHA_ENUM(a2), \
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), \
111 __SHA_OPT(a1) "," __SHA_OPT(a2) "," \
112 __SHA_OPT(a3) "," __SHA_OPT(a4) "," \
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