-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
_swig
329 lines (317 loc) · 16.6 KB
/
_swig
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
#compdef swig
# -----------------------------------------------------------------------------
# The BSD-3-Clause License
#
# Copyright (c) 2016, Koichi Shiraishi
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# * Neither the name of que nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# -----------------------------------------------------------------------------
# Target Language Options
# -allegrocl - Generate ALLEGROCL wrappers
# -chicken - Generate CHICKEN wrappers
# -clisp - Generate CLISP wrappers
# -cffi - Generate CFFI wrappers
# -csharp - Generate C# wrappers
# -d - Generate D wrappers
# -go - Generate Go wrappers
# -guile - Generate Guile wrappers
# -java - Generate Java wrappers
# -javascript - Generate Javascript wrappers
# -lua - Generate Lua wrappers
# -modula3 - Generate Modula 3 wrappers
# -mzscheme - Generate Mzscheme wrappers
# -ocaml - Generate Ocaml wrappers
# -octave - Generate Octave wrappers
# -perl - Generate Perl wrappers
# -php - Generate PHP wrappers
# -pike - Generate Pike wrappers
# -python - Generate Python wrappers
# -r - Generate R (aka GNU S) wrappers
# -ruby - Generate Ruby wrappers
# -scilab - Generate Scilab wrappers
# -sexp - Generate Lisp S-Expressions wrappers
# -tcl - Generate Tcl wrappers
# -uffi - Generate Common Lisp / UFFI wrappers
# -xml - Generate XML wrappers
#
# General Options
# -addextern - Add extra extern declarations
# -c++ - Enable C++ processing
# -co <file> - Check <file> out of the SWIG library
# -copyctor - Automatically generate copy constructors wherever possible
# -cpperraswarn - Treat the preprocessor #error statement as #warning (default)
# -cppext <ext> - Change file extension of generated C++ files to <ext>
# (default is cxx, except for PHP which uses cpp)
# -copyright - Display copyright notices
# -debug-classes - Display information about the classes found in the interface
# -debug-module <n>- Display module parse tree at stages 1-4, <n> is a csv list of stages
# -debug-symtabs - Display symbol tables information
# -debug-symbols - Display target language symbols in the symbol tables
# -debug-csymbols - Display C symbols in the symbol tables
# -debug-lsymbols - Display target language layer symbols
# -debug-tags - Display information about the tags found in the interface
# -debug-template - Display information for debugging templates
# -debug-top <n> - Display entire parse tree at stages 1-4, <n> is a csv list of stages
# -debug-typedef - Display information about the types and typedefs in the interface
# -debug-typemap - Display typemap debugging information
# -debug-tmsearch - Display typemap search debugging information
# -debug-tmused - Display typemaps used debugging information
# -directors - Turn on director mode for all the classes, mainly for testing
# -dirprot - Turn on wrapping of protected members for director classes (default)
# -D<symbol> - Define a symbol <symbol> (for conditional compilation)
# -E - Preprocess only, does not generate wrapper code
# -external-runtime [file] - Export the SWIG runtime stack
# -fakeversion <v>- Make SWIG fake the program version number to <v>
# -fcompact - Compile in compact mode
# -features <list>- Set global features, where <list> is a comma separated list of
# features, eg -features directors,autodoc=1
# If no explicit value is given to the feature, a default of 1 is used
# -fastdispatch - Enable fast dispatch mode to produce faster overload dispatcher code
# -Fmicrosoft - Display error/warning messages in Microsoft format
# -Fstandard - Display error/warning messages in commonly used format
# -fvirtual - Compile in virtual elimination mode
# -help - This output
# -I- - Don't search the current directory
# -I<dir> - Look for SWIG files in directory <dir>
# -ignoremissing - Ignore missing include files
# -importall - Follow all #include statements as imports
# -includeall - Follow all #include statements
# -l<ifile> - Include SWIG library file <ifile>
# -macroerrors - Report errors inside macros
# -makedefault - Create default constructors/destructors (the default)
# -M - List all dependencies
# -MD - Is equivalent to `-M -MF <file>', except `-E' is not implied
# -MF <file> - Generate dependencies into <file> and continue generating wrappers
# -MM - List dependencies, but omit files in SWIG library
# -MMD - Like `-MD', but omit files in SWIG library
# -module <name> - Set module name to <name>
# -MP - Generate phony targets for all dependencies
# -MT <target> - Set the target of the rule emitted by dependency generation
# -nocontract - Turn off contract checking
# -nocpperraswarn - Do not treat the preprocessor #error statement as #warning
# -nodefault - Do not generate default constructors nor default destructors
# -nodefaultctor - Do not generate implicit default constructors
# -nodefaultdtor - Do not generate implicit default destructors
# -nodirprot - Do not wrap director protected members
# -noexcept - Do not wrap exception specifiers
# -nofastdispatch - Disable fast dispatch mode (default)
# -nopreprocess - Skip the preprocessor step
# -notemplatereduce - Disable reduction of the typedefs in templates
# -O - Enable the optimization options:
# -fastdispatch -fvirtual
# -o <outfile> - Set name of C/C++ output file to <outfile>
# -oh <headfile> - Set name of C++ output header file for directors to <headfile>
# -outcurrentdir - Set default output dir to current dir instead of input file's path
# -outdir <dir> - Set language specific files output directory to <dir>
# -pcreversion - Display PCRE version information
# -small - Compile in virtual elimination & compact mode
# -swiglib - Report location of SWIG library and exit
# -templatereduce - Reduce all the typedefs in templates
# -v - Run in verbose mode
# -version - Display SWIG version number
# -Wall - Remove all warning suppression, also implies -Wextra
# -Wallkw - Enable keyword warnings for all the supported languages
# -Werror - Treat warnings as errors
# -Wextra - Adds the following additional warnings: 202,309,403,512,321,322
# -w<list> - Suppress/add warning messages, eg -w401,+321 - see Warnings.html
# -xmlout <file> - Write XML version of the parse tree to <file> after normal processing
#
# Options can also be defined using the SWIG_FEATURES environment variable, for example:
#
# $ SWIG_FEATURES="-Wall"
# $ export SWIG_FEATURES
# $ swig -python interface.i
#
# is equivalent to:
#
# $ swig -Wall -python interface.i
#
#
# Tcl 8 Options (available with -tcl)
# -itcl - Enable ITcl support
# -nosafe - Leave out SafeInit module function.
# -prefix <name> - Set a prefix <name> to be prepended to all names
# -namespace - Build module into a Tcl 8 namespace
# -pkgversion - Set package version
#
#
# Note: 'swig -<lang> -help' displays options for a specific target language.
function _swig() {
local context curcontext=$curcontext state line ret=1
declare -A opt_args
local -a _flag_languages
local -a _go_options
_flag_languages=(
'-allegrocl:Generate ALLEGROCL wrappers'
'-chicken:Generate CHICKEN wrappers'
'-clisp:Generate CLISP wrappers'
'-cffi:Generate CFFI wrappers'
'-csharp:Generate C# wrappers'
'-d:Generate D wrappers'
'-go:Generate Go wrappers'
'-guile:Generate Guile wrappers'
'-java:Generate Java wrappers'
'-javascript:Generate Javascript wrappers'
'-lua:Generate Lua wrappers'
'-modula3:Generate Modula 3 wrappers'
'-mzscheme:Generate Mzscheme wrappers'
'-ocaml:Generate Ocaml wrappers'
'-octave:Generate Octave wrappers'
'-perl:Generate Perl wrappers'
'-php:Generate PHP wrappers'
'-pike:Generate Pike wrappers'
'-python:Generate Python wrappers'
'-r:Generate R (aka GNU S) wrappers'
'-ruby:Generate Ruby wrappers'
'-scilab:Generate Scilab wrappers'
'-sexp:Generate Lisp S-Expressions wrappers'
'-tcl:Generate Tcl wrappers'
'-uffi:Generate Common Lisp / UFFI wrappers'
'-xml:Generate XML wrappers'
)
_go_options=(
'-cgo:Generate cgo input files'
'-gccgo:Generate code for gccgo rather than 6g/8g'
'-go-pkgpath:Like gccgo -fgo-pkgpath option:pkgpath'
'-go-prefix:Like gccgo -fgo-prefix option:prefix'
'-intgosize <s> :Set size of Go int type--32 or 64 bits:int size:(32 64)'
'-package:Set name of the Go package to <name>:package name'
'-use-shlib:Force use of a shared library'
'-soname:Set shared library holding C/C++ code to <name>:shared library name'
)
_arguments -C \
'-addextern[Add extra extern declarations]' \
'-c++[Enable C++ processing]' \
'-co[Check <file> out of the SWIG library]:file' \
'-copyctor[Automatically generate copy constructors wherever possible]' \
'-cpperraswarn[Treat the preprocessor #error statement as #warning (default)]' \
'-cppext[Change file extension of generated C++ files to <ext>]:ext' \
'-copyright[Display copyright notices]' \
'-debug-classes[Display information about the classes found in the interface]' \
'-debug-module<n>[Display module parse tree at stages 1-4, <n> is a csv list of stages]' \
'-debug-symtabs[Display symbol tables information]' \
'-debug-symbols[Display target language symbols in the symbol tables]' \
'-debug-csymbols[Display C symbols in the symbol tables]' \
'-debug-lsymbols[Display target language layer symbols]' \
'-debug-tags[Display information about the tags found in the interface]' \
'-debug-template[Display information for debugging templates]' \
'-debug-top <n>[Display entire parse tree at stages 1-4, <n> is a csv list of stages]' \
'-debug-typedef[Display information about the types and typedefs in the interface]' \
'-debug-typemap[Display typemap debugging information]' \
'-debug-tmsearch[Display typemap search debugging information]' \
'-debug-tmused[Display typemaps used debugging information]' \
'-directors[Turn on director mode for all the classes, mainly for testing]' \
'-dirprot[Turn on wrapping of protected members for director classes (default)]' \
'-D[Define a symbol <symbol> (for conditional compilation)]:symbol' \
'-E[Preprocess only, does not generate wrapper code]' \
'-external-runtim[Export the SWIG runtime stack]:file' \
'-fakeversion[Make SWIG fake the program version number to <v>]:version' \
'-fcompact[Compile in compact mode]' \
'-features[Set global features, where <list> is a comma separated list of features]:list' \
'-fastdispatch[Enable fast dispatch mode to produce faster overload dispatcher code]' \
'-Fmicrosoft[Display error/warning messages in Microsoft format]' \
'-Fstandard[Display error/warning messages in commonly used format]' \
'-fvirtual[Compile in virtual elimination mode]' \
'-help[This output]' \
"-I-[Don't search the current directory]" \
'-I[Look for SWIG files in directory <dir>]:dir' \
'-ignoremissing[Ignore missing include files]' \
'-importall[Follow all #include statements as imports]' \
'-includeall[Follow all #include statements]' \
'-l[Include SWIG library file <ifile>]:ifile' \
'-macroerrors[Report errors inside macros]' \
'-makedefault[Create default constructors/destructors (the default)]' \
'-M[List all dependencies]' \
"-MD[Is equivalent to '-M -MF <file>', except '-E' is not implied]" \
'-MF[Generate dependencies into <file> and continue generating wrappers]:file' \
'-MM[List dependencies, but omit files in SWIG library]' \
"-MMD[Like '-MD', but omit files in SWIG library]" \
'-module[Set module name to <name>]:module name' \
'-MP[Generate phony targets for all dependencies]' \
'-MT[Set the target of the rule emitted by dependency generation]:target' \
'-nocontract[Turn off contract checking]' \
'-nocpperraswarn[Do not treat the preprocessor #error statement as #warning]' \
'-nodefault[Do not generate default constructors nor default destructors]' \
'-nodefaultctor[Do not generate implicit default constructors]' \
'-nodefaultdtor[Do not generate implicit default destructors]' \
'-nodirprot[Do not wrap director protected members]' \
'-noexcept[Do not wrap exception specifiers]' \
'-nofastdispatch[Disable fast dispatch mode (default)]' \
'-nopreprocess[Skip the preprocessor step]' \
'-notemplatereduc[- Disable reduction of the typedefs in templates]' \
'-O[Enable the optimization options: -fastdispatch -fvirtual]' \
'-o[Set name of C/C++ output file to <outfile>]:outfile' \
'-oh[Set name of C++ output header file for directors to <headfile>]:headfile' \
"-outcurrentdir[Set default output dir to current dir instead of input file's path]" \
'-outdir[Set language specific files output directory to <dir>]:dir' \
'-pcreversion[Display PCRE version information]' \
'-small[Compile in virtual elimination & compact mode]' \
'-swiglib[Report location of SWIG library and exit]' \
'-templatereduce[Reduce all the typedefs in templates]' \
'-v[Run in verbose mode]' \
'-version[Display SWIG version number]' \
'-Wall[Remove all warning suppression, also implies -Wextra]' \
'-Wallkw[Enable keyword warnings for all the supported languages]' \
'-Werror[Treat warnings as errors]' \
'-Wextra[Adds the following additional warnings: 202,309,403,512,321,322]' \
'-w[Suppress/add warning messages, eg -w401,+321 - see Warnings.html]:list' \
'-xmlout[Write XML version of the parse tree to <file> after normal processing]:file' \
&& ret=0
_describe -t flag_languages "Target Language Options" _flag_language
_describe -t go_options "Go Options" _go_options
# case $state in
# (args)
# if (( CURRENT == 2 )); then
# _arguments '*:after the (( CURRENT == 2 )) comment:'
# return
# fi
# _arguments '*:before the (( CURRENT == 2 )) comment:_files'
# ;;
#
# case $words[1] in
# subcommand1)
# _arguments \
# '-foo[subcommand2 -foo argument comment]'
# '*:file:_files'
# ;;
# subcommand2)
# _arguments \
# '-bar[subcommand2 -bar argument comment]' \
# '-baz[subcommand2 -baz argument comment]'
# '*:devices:_devices'
# ;;
# subcommand3)
# _arguments \
# ;;
# esac
# ;;
# esac
return ret
}
_swig "$*"
# vim:ft=zsh:et:sts=2:sw=2