1 # -*- C -*- --- well, not actually...
3 # Copyright (C) 1993 AmiTCP/IP Group, <amitcp-group@hut.fi>
4 # Helsinki University of Technology, Finland.
6 # Copyright (C) 2005 - 2007 The AROS Dev Team
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License version 2 as
10 # published by the Free Software Foundation.
12 # This program is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston,
29 GFN =
"kern/variables.src (" FILENAME ")";
30 TEXTARGET=
0;CTARGET=
0;TEXITARGET=
0
31 if (TARGETTI ==
"TEX") {
33 startcomment =
"% -*- LaTeX -*-";
36 }else if (TARGETTI ==
"TEXINFO") {
39 startcomment =
"@c -*- Texinfo -*-";
42 } else if (TARGETTI ==
"C") {
44 startcomment =
"/* -*- C -*-";
47 } else printf "Unknown target format '%s'\n",TARGETTI
> "/dev/stderr"
49 printf "%s This file is automatically generated from %s\n", comment
, GFN
;
51 printf "%s Do not change this file\n", comment
;
55 print "\#include <sys/param.h>";
56 print "\#include <netinet/in.h>";
57 print "\#include <kern/amiga_includes.h>";
58 print "\#include <kern/amiga_config.h>";
59 print "\#include <sys/socket.h>";
64 # skip comments and empty lines
67 # Collect global variables
70 globals = globals
"\n" $
0;
73 # Change _ to \_ in TeX
74 TEXTARGET
&& /_
/ { gsub("_","\\_") }
75 # Generate indentation, add environment parenthesis
76 level
!= $
2 && TEXTARGET
{
78 for(i=level
; i
< $
2; i
++) {
79 tab =
sprintf("%"2*i"s
", "");
80 print tab "\\begin{description
}";
83 for(i=level; i > $2; i--) {
84 tab = sprintf("%
"2*i "s
", "");
85 print tab "\\end{description
}";
88 tab = sprintf("%" 2*level
"s", "");
92 n =
split($
1,temp
,"=");
93 printf "%s\\item[\\code{%s}] %s\n",tab
,temp
[n
],$
3;
95 printf tab
" \\Alias%s{%s",(n
>2)?
"es":"",temp
[1];
97 printf "{\\rm ,} %s",temp
[i
];
102 # Skip C declarations
110 $
2 ==
2 && TEXITARGET
{
112 print "@table @code";
113 n =
split($
1,temp
,"=");print "level=" $
2, n
> "/dev/stderr"
114 printf "@item %s\n",temp
[n
];
116 printf "@itemx %s\n",temp
[i
];
118 gsub("\\\\n","\n",$
3) # replace with newlines
123 $
2 ==
1 && TEXITARGET
{
127 print "@end deffn\n";
128 n =
split($
1,temp
,"="); print "level=" $
2, n
> "/dev/stderr"
129 printf "@deffn {AREXX Variable} %s\n",temp
[n
];
131 printf "@deffnx {AREXX Variable} %s\n",temp
[i
];
133 gsub("\\\\n","\n",$
3) # replace with newlines
139 # Skip C declarations
144 ($
2 != 1 && $
2 != 2) && TEXITARGET
{
145 print FILENAME ":" FNR ": Invalid level: " $
2 > "/dev/stderr"
151 n =
split($
1, temp
, "=");
153 if (length(var2
) > 0) {
154 printf "/* %s */\n#define KW_%s \\\n \"", varcom
, curvar
;
155 n2 =
split(var2
, t2
, ",");
157 for (i =
1; i
< n2
; i
++) {
158 if ((cnt
+ length(t2
[i
])) > 60) {
162 cnt
+=
length(t2
[i
]);
165 if (length(t2
[n2
]) + cnt
> 60)
167 printf "%s\"\n\n", t2
[n2
];
171 if (length(vars
) > 0) {
179 externs = externs
"\n" extern
;
182 if (length(varlines
) > 0) {
183 varlines = varlines
",\n" varline
;
188 if(length(var2
) ==
0) {
198 for(i = level
; i
> 1; i
--)
199 print "\\end{description}";
200 } else if(TEXITARGET
) {
204 print "@end deffn\n";
206 if (length(var2
) > 0) {
207 printf "/* %s */\n#define KW_%s \\\n \"", varcom
, curvar
;
208 n2 =
split(var2
, t2
, ",");
211 if((cnt
+length(t2
[i
]))>60) {
215 cnt
+=
length(t2
[i
]);
218 if (length(t2
[n2
])+cnt
> 60) printf "\" \\\n \"";
219 printf "%s\"\n\n", t2
[n2
];
222 if (length(vars
) > 0) {
223 printf "/* %s */\nSTRPTR KW_%s =\n \"", "Level 1 variables", "VARS";
224 n2 =
split(vars
, t2
, ","); cnt=
0;
225 for(i=
1; i
<n2
; i
++) {
226 if(cnt
+ length(t2
[i
]) > 60) {
233 printf "%s\";\n\n", t2
[n2
];
235 if (length(externs
)) {
236 print "/* extern declarations */";
240 if (length(globals
)) {
241 printf "/* Global variables */";
245 if (length(varlines
)) {
246 print "struct cfg_variable variables[] = {";