1 # Copyright (C) 2003,2004 Free Software Foundation, Inc.
2 # Contributed by Kelley Cook, June 2004.
3 # Original code from Neil Booth, May 2003.
5 # This program is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by the
7 # Free Software Foundation; either version 2, or (at your option) any
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 # Some common subroutines for use by opt[ch]-gen.awk.
21 function switch_flags
(flags
)
25 for (j =
0; j
< n_langs
; j
++) {
26 regex =
" " langs
[j
] " "
27 gsub ( "\\+", "\\+", regex
)
29 result = result
" | " macros
[j
]
31 if (flags ~
" Common ") result = result
" | CL_COMMON"
32 if (flags ~
" Joined ") result = result
" | CL_JOINED"
33 if (flags ~
" JoinedOrMissing ") \
34 result = result
" | CL_JOINED | CL_MISSING_OK"
35 if (flags ~
" Separate ") result = result
" | CL_SEPARATE"
36 if (flags ~
" RejectNegative ") result = result
" | CL_REJECT_NEGATIVE"
37 if (flags ~
" UInteger ") result = result
" | CL_UINTEGER"
38 if (flags ~
" Undocumented ") result = result
" | CL_UNDOCUMENTED"
39 if (flags ~
" Report ") result = result
" | CL_REPORT"
40 sub( "^0 \\| ", "", result
)
44 function var_args
(flags
)
46 if (flags !~
"Var\\(")
48 sub(".*Var\\(", "", flags
)
49 sub("\\).*", "", flags
)
53 function var_name
(flags
)
61 function var_set
(flags
)
69 function var_ref
(flags
)
71 name = var_name
(flags
)