~ubuntu-branches/ubuntu/oneiric/swig1.3/oneiric

« back to all changes in this revision

Viewing changes to Doc/Devel/cmdopt.html

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-12-06 10:27:08 UTC
  • mto: This revision was merged to the branch mainline in revision 13.
  • Revision ID: james.westby@ubuntu.com-20071206102708-27hhjpasolk3pnr1
Tags: upstream-1.3.33
ImportĀ upstreamĀ versionĀ 1.3.33

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<html>
 
2
<head>
 
3
<title>SWIG Command Line Handling</title>
 
4
</head>
 
5
 
 
6
<body>
 
7
<center>
 
8
<h1>SWIG Command Line Handling</h1>
 
9
 
 
10
<p>
 
11
David M. Beazley <br>
 
12
dave-swig@dabeaz.com<br>
 
13
December, 2006<br>
 
14
 
 
15
</b>
 
16
</center>
 
17
 
 
18
<h2>Introduction</h2>
 
19
 
 
20
This document describes the functions related to the handling of
 
21
command line options passed to SWIG. These functions are defined in
 
22
the header file <tt>Source/Swig/swigopt.h</tt>.  This API is
 
23
considered to be stable.
 
24
 
 
25
<h2>Initialization</h2>
 
26
 
 
27
Upon SWIG startup, the following function is called:
 
28
 
 
29
<p>
 
30
<b><tt>void Swig_init_args(int argc, char **argv_)</tt></b>
 
31
 
 
32
<blockquote>
 
33
Registers command line options with the SWIG core.  This creates an internal array that is used by other
 
34
functions to mark whether or not a particular command line option was used.  This is ultimately used to issue error messages about unused or unknown command line options.   This function is currently invoked in the SWIG main() function that is found in <tt>Source/Modules/swigmain.cxx</tt>.
 
35
</blockquote>
 
36
 
 
37
<h2>Argument Marking</h2>
 
38
 
 
39
As command line options are are processed by language modules, the following functions are used
 
40
to mark the arguments as used:
 
41
 
 
42
<p>
 
43
<b><tt>void Swig_mark_arg(int n)</tt></b>
 
44
<blockquote>
 
45
Mark argument number <tt>n</tt> as used. 
 
46
</blockquote>
 
47
 
 
48
<p>
 
49
<b><tt>int Swig_check_marked(int n)</tt></b>
 
50
<blockquote>
 
51
Check to see if argument <tt>n</tt> has been marked.  Returns 0 or 1.
 
52
</blockquote>
 
53
 
 
54
<h2>Argument Checking</h2>
 
55
 
 
56
The following function is used to check all of the command line options after parsing.  It looks at the marked list
 
57
and issues an error message if any unconsumed arguments are found.
 
58
 
 
59
<p>
 
60
<b><tt>void Swig_check_options()</tt></b>
 
61
<blockquote>
 
62
Checks all command line options to see if they have all been processed.  If not, an error message is generated and
 
63
execution terminates with a call to <tt>exit()</tt>.   This function is currently invoked in <tt>Source/Modules/main.cxx</tt> just before SWIG starts any processing of input files.
 
64
</blockquote>
 
65
 
 
66
<h2>Utility Function</h2>
 
67
<p>
 
68
<b><tt>void Swig_arg_error())</tt></b>
 
69
 
 
70
<blockquote>
 
71
A generic function that issues an error message about being unable to parse command line options.  SWIG is terminated by a call to <tt>exit()</tt>.
 
72
 
 
73
</body>
 
74
</html>
 
75
 
 
76
 
 
77
 
 
78
 
 
79