"Fossies" - the Fresh Open Source Software Archive

Member "swig-4.1.1/Doc/Devel/cmdopt.html" (30 Nov 2022, 2189 Bytes) of package /linux/misc/swig-4.1.1.tar.gz:

Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links. You can here alternatively try to browse the pure source code or just view or download the uninterpreted raw source code. If the rendering is insufficient you may try to find and view the page on the swig-4.1.1.tar.gz project site itself.

SWIG Command Line Handling

David M. Beazley
December, 2006


This document describes the functions related to the handling of command line options passed to SWIG. These functions are defined in the header file Source/Swig/swigopt.h. This API is considered to be stable.


Upon SWIG startup, the following function is called:

void Swig_init_args(int argc, char **argv_)

Registers command line options with the SWIG core. This creates an internal array that is used by other 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 Source/Modules/swigmain.cxx.

Argument Marking

As command line options are processed by language modules, the following functions are used to mark the arguments as used:

void Swig_mark_arg(int n)

Mark argument number n as used.

int Swig_check_marked(int n)

Check to see if argument n has been marked. Returns 0 or 1.

Argument Checking

The following function is used to check all of the command line options after parsing. It looks at the marked list and issues an error message if any unconsumed arguments are found.

void Swig_check_options()

Checks all command line options to see if they have all been processed. If not, an error message is generated and SWIG exits. This function is currently invoked in Source/Modules/main.cxx just before SWIG starts any processing of input files.

Utility Function

void Swig_arg_error())

A generic function that issues an error message about being unable to parse command line options and SWIG exits.