File: defuns.h

package info (click to toggle)
oleo 1.6-16
  • links: PTS
  • area: main
  • in suites: potato
  • size: 2,640 kB
  • ctags: 3,139
  • sloc: ansic: 39,221; yacc: 1,737; sh: 362; makefile: 88
file content (120 lines) | stat: -rw-r--r-- 2,011 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120

/* This file repeatedly includes tahe contents of defun.h which contains
 * doc strings and FUNC_ARGS structures for all of the interactive
 * built-ins.
 * 
 * It uses ugly preprocessor magic to build various tables.
 */


/* First, build arrays containing FUNC_ARG strings. */

#define DEFUN_5(Sname, FDname, FAname, DFname, Cname) \
0, \
}; \
\
static char * FAname [] = \
{

#define DEFUN(Sname, FDname, FAname, Cname) \
	DEFUN_5(Sname, FDname, FAname, 0, Cname)

#define DEFUN_3(Sname, FDname, Cname)

#define FUNC_ARG_STRINGS	1

static char * FAfnord[] = 
{
#include "defun.h"
0,
};



/* Docstrings */

#undef DEFUN
#undef DEFUN_3
#undef DEFUN_5
#undef FUNC_ARG_STRINGS
#undef DOC_STRINGS
#undef FUNC_INIT_CODE

#define DEFUN_5(Sname, FDname, FAname, DFname, Cname) \
0, \
}; \
\
static char * FDname [] = \
{

#define DEFUN(Sname, FDname, FAname, Cname) \
	DEFUN_5(Sname, FDname, FAname, 0, Cname)
#define DEFUN_3(Sname, FDname, Cname) DEFUN(Sname, FDname, 0, Cname)

#define DOC_STRINGS	1

static char * FDfnord[] = 
{
  "Well, you know.",
#include "defun.h"
0,
};




/* init_code */

#undef DEFUN
#undef DEFUN_3
#undef DEFUN_5
#undef FUNC_ARG_STRINGS
#undef DOC_STRINGS
#undef FUNC_INIT_CODE

#define DEFUN_5(Sname, FDname, FAname, DFname, Cname) \
0, \
}; \
\
static char * DFname [] = \
{

#define DEFUN(Sname, FDname, FAname, Cname)
#define DEFUN_3(Sname, FDname, Cname) 

#define FUNC_INIT_CODE	1

static char * DFfnord[] = 
{
#include "defun.h"
0,
};





/* Building the function table. */

#undef DEFUN
#undef DEFUN_3
#undef DEFUN_5
#undef FUNC_ARG_STRINGS
#undef DOC_STRINGS
#undef FUNC_INIT_CODE

#define DEFUN_5(Sname, FDname, FAname, DFname, Cname) \
	{ Sname, FDname, FAname, DFname, Cname },

#define DEFUN(Sname, FDname, FAname, Cname) \
	DEFUN_5(Sname, FDname, FAname, 0, Cname)
#define DEFUN_3(Sname, FDname, Cname) \
	DEFUN_5(Sname, FDname, 0, 0, Cname)

struct cmd_func cmd_funcs[] =
{
  { "fnord", FDfnord, FAfnord, DFfnord, fnord },
#include "defun.h"
  { 0, 0, 0, 0, 0 }
};