[Modula3] Remove code for Modula3
We dropped support for it in SWIG 4.0.0 and nobody has stepped forward to revive it in over 2 years. See #2009.
This commit is contained in:
parent
f3ba54c3bb
commit
12f3a85916
29 changed files with 6 additions and 6521 deletions
|
|
@ -7,6 +7,11 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
|||
Version 4.1.0 (in progress)
|
||||
===========================
|
||||
|
||||
2021-05-13: olly
|
||||
[Modula3] #2009 Remove code for Modula3. We dropped support for it
|
||||
in SWIG 4.0.0 and nobody has stepped forward to revive it in over 2
|
||||
years.
|
||||
|
||||
2021-05-13: olly
|
||||
[CLISP] #2009 Remove code for GNU Common Lisp. We dropped support
|
||||
for it in SWIG 4.0.0 and nobody has stepped forward to revive it in
|
||||
|
|
|
|||
|
|
@ -1,942 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>SWIG and Modula-3</title>
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
</head>
|
||||
<body bgcolor="#FFFFFF">
|
||||
<H1><a name="Modula3">31 SWIG and Modula-3</a></H1>
|
||||
<!-- INDEX -->
|
||||
<div class="sectiontoc">
|
||||
<ul>
|
||||
<li><a href="#Modula3_modula3_overview">Overview</a>
|
||||
<ul>
|
||||
<li><a href="#Modula3_motivation">Motivation</a>
|
||||
</ul>
|
||||
<li><a href="#Modula3_conception">Conception</a>
|
||||
<ul>
|
||||
<li><a href="#Modula3_cinterface">Interfaces to C libraries</a>
|
||||
<li><a href="#Modula3_cppinterface">Interfaces to C++ libraries</a>
|
||||
</ul>
|
||||
<li><a href="#Modula3_preliminaries">Preliminaries</a>
|
||||
<ul>
|
||||
<li><a href="#Modula3_compilers">Compilers</a>
|
||||
<li><a href="#Modula3_commandline">Additional Commandline Options</a>
|
||||
</ul>
|
||||
<li><a href="#Modula3_typemaps">Modula-3 typemaps</a>
|
||||
<ul>
|
||||
<li><a href="#Modula3_inoutparam">Inputs and outputs</a>
|
||||
<li><a href="#Modula3_ordinals">Subranges, Enumerations, Sets</a>
|
||||
<li><a href="#Modula3_class">Objects</a>
|
||||
<li><a href="#Modula3_imports">Imports</a>
|
||||
<li><a href="#Modula3_exceptions">Exceptions</a>
|
||||
<li><a href="#Modula3_typemap_example">Example</a>
|
||||
</ul>
|
||||
<li><a href="#Modula3_hints">More hints to the generator</a>
|
||||
<ul>
|
||||
<li><a href="#Modula3_features">Features</a>
|
||||
<li><a href="#Modula3_pragmas">Pragmas</a>
|
||||
</ul>
|
||||
<li><a href="#Modula3_remarks">Remarks</a>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- INDEX -->
|
||||
|
||||
|
||||
|
||||
<p>
|
||||
This chapter describes SWIG's support for
|
||||
<a href="http://modula3.org/">Modula-3</a>.
|
||||
You should be familiar with the
|
||||
<a href="SWIG.html#SWIG">basics</a>
|
||||
of SWIG,
|
||||
especially
|
||||
<a href="Typemaps.html#Typemaps">typemaps</a>.
|
||||
</p>
|
||||
|
||||
<H2><a name="Modula3_modula3_overview">31.1 Overview</a></H2>
|
||||
|
||||
|
||||
<p>
|
||||
Modula-3 is a compiled language in the tradition of Niklaus Wirth's Modula 2,
|
||||
which is in turn a successor to Pascal.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
SWIG's Modula-3 support is currently very basic and highly experimental!
|
||||
Many features are still not designed satisfyingly
|
||||
and I need more discussion about the odds and ends.
|
||||
Don't rely on any feature, incompatible changes are likely in the future!
|
||||
However, the Modula-3 generator was already useful for interfacing
|
||||
to the libraries:
|
||||
</p>
|
||||
|
||||
<ol>
|
||||
<li>
|
||||
<a href="http://www.elegosoft.com/cgi-bin/cvsweb.cgi/cm3/m3-libs/plplot/">
|
||||
PLPlot
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.elegosoft.com/cgi-bin/cvsweb.cgi/cm3/m3-libs/fftw/">
|
||||
FFTW
|
||||
</a>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<H3><a name="Modula3_motivation">31.1.1 Motivation</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
Although it is possible to write Modula-3 code that performs as well as C/C++
|
||||
most existing libraries are not written in Modula-3 but in C or C++, and
|
||||
even libraries in other languages may provide C header files.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Fortunately Modula-3 can call C functions, but you have to write Modula-3
|
||||
interfaces to them, and to make things comfortable you will also need
|
||||
wrappers that convert between high-level features of Modula-3 (garbage
|
||||
collecting, exceptions) and the explicit tracking of allocated memory and
|
||||
exception codes used by C APIs.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
SWIG converts C headers to Modula-3 interfaces for you, and using typemaps
|
||||
you can pass <tt>TEXT</tt>s or open arrays, and convert error return codes
|
||||
into exceptions.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If the library API is ill designed
|
||||
writing appropriate typemaps can still be time-consuming.
|
||||
E.g. C programmers are very creative to work-around
|
||||
missing data types like (real) enumerations and sets.
|
||||
You should turn such work-arounds back to the Modula-3 way
|
||||
otherwise you lose static safety and consistency.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Without SWIG you would probably never consider trying to call C++ libraries
|
||||
from Modula-3, but with SWIG this is becomes feasible.
|
||||
SWIG can generate C wrappers to C++ functions and object methods
|
||||
that may throw exceptions, and then wrap these C wrappers for Modula-3.
|
||||
To make it complete you can then hide the C interface with Modula-3 classes and
|
||||
exceptions.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
SWIG allows you to call C and C++ libraries from Modula-3 (even with call back
|
||||
functions), but it doesn't allow you to easily integrate a Modula-3 module into
|
||||
a C/C++ project.
|
||||
</p>
|
||||
|
||||
<H2><a name="Modula3_conception">31.2 Conception</a></H2>
|
||||
|
||||
|
||||
<H3><a name="Modula3_cinterface">31.2.1 Interfaces to C libraries</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
Modula-3 has integrated support for calling C functions.
|
||||
This is also extensively used by the standard Modula-3 libraries
|
||||
to call OS functions.
|
||||
The Modula-3 part of SWIG and the corresponding SWIG library
|
||||
modula3.swg
|
||||
contain code that uses these features.
|
||||
Because of the built-in support there is no need
|
||||
for calling the SWIG kernel to generate wrappers written in C.
|
||||
All conversion and argument checking can be done in Modula-3
|
||||
and the interfacing is quite efficient.
|
||||
All you have to do is to write pieces of Modula-3 code
|
||||
that SWIG puts together.
|
||||
</p>
|
||||
|
||||
<table border summary="Modula-3 C library support">
|
||||
<tr><th colspan=2>C library support integrated in Modula-3<th></tr>
|
||||
<tr>
|
||||
<td>Pragma <tt><* EXTERNAL *></tt></td>
|
||||
<td>Precedes a declaration of a PROCEDURE that is implemented
|
||||
in an external library instead of a Modula-3 module.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Pragma <tt><* CALLBACK *></tt></td>
|
||||
<td>Precedes a declaration of a PROCEDURE that should be called
|
||||
by external library code.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Module <tt>Ctypes</tt></td>
|
||||
<td>Contains Modula-3 types that match some basic C types.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Module <tt>M3toC</tt></td>
|
||||
<td>Contains routines that convert between Modula-3's <tt>TEXT</tt> type
|
||||
and C's <tt>char *</tt> type.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
In each run of SWIG the Modula-3 part
|
||||
generates several files:
|
||||
</p>
|
||||
<table border summary="Modula-3 generated files">
|
||||
<tr>
|
||||
<th>Module name scheme</th>
|
||||
<th>Identifier for <tt>%insert</tt></th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Module<tt>Raw.i3</tt></td>
|
||||
<td><tt>m3rawintf</tt></td>
|
||||
<td>Declaration of types that are equivalent to those of the C library,
|
||||
<tt>EXTERNAL</tt> procedures as interface to the C library functions</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Module<tt>Raw.m3</tt></td>
|
||||
<td><tt>m3rawimpl</tt></td>
|
||||
<td>Almost empty.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Module<tt>.i3</tt></td>
|
||||
<td><tt>m3wrapintf</tt></td>
|
||||
<td>Declaration of comfortable wrappers to the C library functions.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Module<tt>.m3</tt></td>
|
||||
<td><tt>m3wrapimpl</tt></td>
|
||||
<td>Implementation of the wrappers that
|
||||
convert between Modula-3 and C types,
|
||||
check for validity of values,
|
||||
hand-over resource management to the garbage collector using <tt>WeakRef</tt>s
|
||||
and raises exceptions.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><tt>m3makefile</tt></td>
|
||||
<td><tt>m3makefile</tt></td>
|
||||
<td>Add the modules above to the Modula-3 project and
|
||||
specify the name of the Modula-3 wrapper library
|
||||
to be generated.
|
||||
|
||||
Today I'm not sure if it is a good idea
|
||||
to create a <tt>m3makefile</tt> in each run,
|
||||
because SWIG must be started for each Modula-3 module it creates.
|
||||
Thus the m3makefile is overwritten each time. :-(
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
Here's a scheme of how the function calls to Modula-3 wrappers
|
||||
are redirected to C library functions:
|
||||
</p>
|
||||
|
||||
<table summary="Modula-3 C library">
|
||||
<tr>
|
||||
<td align=center>
|
||||
Modula-3 wrapper<br>
|
||||
Module<tt>.i3</tt><br>
|
||||
generated by Modula-3 part of SWIG
|
||||
</td>
|
||||
<td></td>
|
||||
<td align=center></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center>
|
||||
<!-- pre tag overrides centering -->
|
||||
|<br>
|
||||
v
|
||||
</td>
|
||||
<td></td>
|
||||
<td align=center></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center>
|
||||
Modula-3 interface to C<br>
|
||||
Module<tt>Raw.i3</tt><br>
|
||||
generated by Modula-3 part of SWIG
|
||||
</td>
|
||||
<td>--></td>
|
||||
<td align=center>
|
||||
C library
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
<p>
|
||||
I have still no good conception how one can split C library interfaces
|
||||
into type oriented interfaces.
|
||||
A Module in Modula-3 represents an Abstract DataType
|
||||
(or call it a static classes, i.e. a class without virtual methods).
|
||||
E.g. if you have a principal type, say <tt>Database</tt>,
|
||||
it is good Modula-3 style to set up one Module with the name <tt>Database</tt>
|
||||
where the database type is declared with the name <tt>T</tt>
|
||||
and where all functions are declared that operates on it.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The normal operation of SWIG is to generate a fixed set of files per call.
|
||||
To generate multiple modules one has to write one SWIG interface
|
||||
(different SWIG interfaces can share common data) per module.
|
||||
Identifiers belonging to a different module may ignored (<tt>%ignore</tt>)
|
||||
and the principal type must be renamed (<tt>%typemap</tt>).
|
||||
</p>
|
||||
|
||||
|
||||
<H3><a name="Modula3_cppinterface">31.2.2 Interfaces to C++ libraries</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
Interfaces to C++ files are much more complicated and
|
||||
there are some more design decisions that are not made, yet.
|
||||
Modula-3 has no support for C++ functions
|
||||
but C++ compilers should support generating C++ functions
|
||||
with a C interface.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Here's a scheme of how the function calls to Modula-3 wrappers
|
||||
are redirected to C library functions:
|
||||
</p>
|
||||
|
||||
<table summary="Modula-3 C++ library">
|
||||
<tr>
|
||||
<td align=center>
|
||||
Modula-3 wrapper<br>
|
||||
Module<tt>.i3</tt><br>
|
||||
generated by Modula-3 part of SWIG
|
||||
</td>
|
||||
<td></td>
|
||||
<td align=center>C++ library</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center>
|
||||
<!-- pre tag overrides centering -->
|
||||
|<br>
|
||||
v
|
||||
</td>
|
||||
<td></td>
|
||||
<td align=center>
|
||||
^<br>
|
||||
|
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center>
|
||||
Modula-3 interface to C<br>
|
||||
Module<tt>Raw.i3</tt><br>
|
||||
generated by Modula-3 part of SWIG
|
||||
</td>
|
||||
<td>--></td>
|
||||
<td align=center>
|
||||
C interface to C++<br>
|
||||
module<tt>_wrap.cxx</tt><br>
|
||||
generated by the SWIG core
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
Wrapping C++ libraries arises additional problems:
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
Is it sensible to wrap C++ classes with Modula-3 classes?
|
||||
</li>
|
||||
<li>
|
||||
How to find the wrapping Modula-3 class
|
||||
for a class pointer that is returned by a C++ routine?
|
||||
</li>
|
||||
<li>
|
||||
How to deal with multiple inheritance
|
||||
which was neglected for Modula-3 for good reasons?
|
||||
</li>
|
||||
<li>
|
||||
Is it possible to sub-class C++ classes with Modula-3 code?
|
||||
This issue is addressed by directors,
|
||||
a feature that was experimentally added to some Language modules
|
||||
like
|
||||
<a href="Java.html#Java_directors">Java</a> and
|
||||
<a href="Python.html#Python_directors">Python</a>.
|
||||
</li>
|
||||
<li>
|
||||
How to manage storage with the garbage collector of Modula-3?
|
||||
Support for
|
||||
<a href="Customization.html#Customization_ownership">
|
||||
<tt>%newobject</tt> and <tt>%typemap(newfree)</tt></a>
|
||||
isn't implemented, yet.
|
||||
What's about resources that are managed by the garbage collector
|
||||
but shall be passed back to the storage management of the C++ library?
|
||||
This is a general issue which is not solved in a satisfying fashion
|
||||
as far as I know.
|
||||
</li>
|
||||
<li>
|
||||
How to turn C++ exceptions into Modula-3 exceptions?
|
||||
There's also no support for
|
||||
<a href="Customization.html#Customization_exception">
|
||||
<tt>%exception</tt></a>, yet.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
Be warned:
|
||||
There is no C++ library I wrote a SWIG interface for,
|
||||
so I'm not sure if this is possible or sensible, yet.
|
||||
</p>
|
||||
|
||||
<H2><a name="Modula3_preliminaries">31.3 Preliminaries</a></H2>
|
||||
|
||||
|
||||
<H3><a name="Modula3_compilers">31.3.1 Compilers</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
There are different Modula-3 compilers around:
|
||||
cm3, pm3, ezm3, Klagenfurth Modula-3, Cambridge Modula-3.
|
||||
SWIG itself does not contain compiler specific code
|
||||
but the modula3.swg library file
|
||||
may do so.
|
||||
For testing examples I use Critical Mass cm3.
|
||||
</p>
|
||||
|
||||
|
||||
<H3><a name="Modula3_commandline">31.3.2 Additional Commandline Options</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
There are some experimental command line options
|
||||
that prevent SWIG from generating interface files.
|
||||
Instead files are emitted that may assist you
|
||||
when writing SWIG interface files.
|
||||
</p>
|
||||
|
||||
<table border summary="Modula-3 specific options">
|
||||
<tr>
|
||||
<th>Modula-3 specific options</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign=top>-generateconst <file></td>
|
||||
<td>
|
||||
Disable generation of interfaces and wrappers.
|
||||
Instead write code for computing numeric values of constants
|
||||
to the specified file.
|
||||
<br>
|
||||
C code may contain several constant definitions
|
||||
written as preprocessor macros.
|
||||
Other language modules of SWIG use
|
||||
compute-once-use-readonly variables or
|
||||
functions to wrap such definitions.
|
||||
All of them can invoke C code dynamically
|
||||
for computing the macro values.
|
||||
But if one wants to turn them into Modula-3
|
||||
integer constants, enumerations or set types,
|
||||
the values of these expressions has to be known statically.
|
||||
Although definitions like <tt>(1 << FLAG_MAXIMIZEWINDOW)</tt>
|
||||
must be considered as good C style
|
||||
they are hard to convert to Modula-3
|
||||
since the value computation can use every feature of C.
|
||||
<br>
|
||||
Thus I implemented these switch
|
||||
to extract all constant definitions
|
||||
and write a C program that output the values of them.
|
||||
It works for numeric constants only
|
||||
and treats all of them as <tt>double</tt>.
|
||||
Future versions may generate a C++ program
|
||||
that can detect the type of the macros
|
||||
by overloaded output functions.
|
||||
Then strings can also be processed.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign=top>-generaterename <file></td>
|
||||
<td>
|
||||
Disable generation of interfaces and wrappers.
|
||||
Instead generate suggestions for <tt>%rename</tt>.
|
||||
<br>
|
||||
C libraries use a naming style
|
||||
that is neither homogeneous nor similar to that of Modula-3.
|
||||
C function names often contain a prefix denoting the library
|
||||
and some name components separated by underscores
|
||||
or capitalization changes.
|
||||
To get library interfaces that are really Modula-3 like
|
||||
you should rename the function names with the <tt>%rename</tt> directive.
|
||||
This switch outputs a list of such directives
|
||||
with a name suggestion generated by a simple heuristic.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign=top>-generatetypemap <file></td>
|
||||
<td>
|
||||
Disable generation of interfaces and wrappers.
|
||||
Instead generate templates for some basic typemaps.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<H2><a name="Modula3_typemaps">31.4 Modula-3 typemaps</a></H2>
|
||||
|
||||
|
||||
<H3><a name="Modula3_inoutparam">31.4.1 Inputs and outputs</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
Each C procedure has a bunch of inputs and outputs.
|
||||
Inputs are passed as function arguments,
|
||||
outputs are updated referential arguments and
|
||||
the function value.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Each C type can have several typemaps
|
||||
that apply only in case if a type is used
|
||||
for an input argument, for an output argument,
|
||||
or for a return value.
|
||||
A further typemap may specify
|
||||
the direction that is used for certain parameters.
|
||||
I have chosen this separation
|
||||
in order to be able to write general typemaps for the modula3.swg typemap library.
|
||||
In the library code the final usage of the type is not known.
|
||||
Using separate typemaps for each possible use
|
||||
allows appropriate definitions for each case.
|
||||
If these pre-definitions are fine
|
||||
then the direction of the function parameter
|
||||
is the only hint the user must give.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The typemaps specific to Modula-3 have a common name scheme:
|
||||
A typemap name starts with "m3",
|
||||
followed by "raw" or "wrap"
|
||||
depending on whether it controls the generation
|
||||
of the Module<tt>Raw.i3</tt> or the Module<tt>.i3</tt>, respectively.
|
||||
It follows an "in" for typemaps applied to input argument,
|
||||
"out" for output arguments, "arg" for all kind of arguments,
|
||||
"ret" for returned values.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The main task of SWIG is to build wrapper function,
|
||||
i.e. functions that convert values between C and Modula-3
|
||||
and call the corresponding C function.
|
||||
Modula-3 wrapper functions generated by SWIG
|
||||
consist of the following parts:
|
||||
</p>
|
||||
<ul>
|
||||
<li>Generate <tt>PROCEDURE</tt> signature.</li>
|
||||
<li>Declare local variables.</li>
|
||||
<li>Convert input values from Modula-3 to C.</li>
|
||||
<li>Check for input value integrity.</li>
|
||||
<li>Call the C function.</li>
|
||||
<li>Check returned values, e.g. error codes.</li>
|
||||
<li>Convert and write back values into Modula-3 records.</li>
|
||||
<li>Free temporary storage.</li>
|
||||
<li>Return values.</li>
|
||||
</ul>
|
||||
|
||||
<table border summary="Modula-3 typemaps">
|
||||
<tr>
|
||||
<th>Typemap</th>
|
||||
<th>Example</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>m3wrapargvar</td>
|
||||
<td><tt>$1: INTEGER := $1_name;</tt></td>
|
||||
<td>
|
||||
Declaration of some variables needed for temporary results.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>m3wrapargconst</td>
|
||||
<td><tt>$1 = "$1_name";</tt></td>
|
||||
<td>
|
||||
Declaration of some constant, maybe for debug purposes.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>m3wrapargraw</td>
|
||||
<td><tt>ORD($1_name)</tt></td>
|
||||
<td>
|
||||
The expression that should be passed as argument to the raw Modula-3 interface function.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>m3wrapargdir</td>
|
||||
<td><tt>out</tt></td>
|
||||
<td>
|
||||
Referential arguments can be used for input, output, update.
|
||||
???
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>m3wrapinmode</td>
|
||||
<td><tt>READONLY</tt></td>
|
||||
<td>
|
||||
One of Modula-3 parameter modes
|
||||
<tt>VALUE</tt> (or empty),
|
||||
<tt>VAR</tt>,
|
||||
<tt>READONLY</tt>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>m3wrapinname</td>
|
||||
<td></td>
|
||||
<td>
|
||||
New name of the input argument.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>m3wrapintype</td>
|
||||
<td></td>
|
||||
<td>
|
||||
Modula-3 type of the input argument.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>m3wrapindefault</td>
|
||||
<td></td>
|
||||
<td>
|
||||
Default value of the input argument
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>m3wrapinconv</td>
|
||||
<td><tt>$1 := M3toC.SharedTtoS($1_name);</tt></td>
|
||||
<td>
|
||||
Statement for converting the Modula-3 input value to C compliant value.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>m3wrapincheck</td>
|
||||
<td><tt>IF Text.Length($1_name) > 10 THEN RAISE E("str too long"); END;</tt></td>
|
||||
<td>
|
||||
Check the integrity of the input value.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>m3wrapoutname</td>
|
||||
<td></td>
|
||||
<td>
|
||||
Name of the <tt>RECORD</tt> field to be used for returning multiple values.
|
||||
This applies to referential output arguments that shall be turned
|
||||
into return values.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>m3wrapouttype</td>
|
||||
<td></td>
|
||||
<td>
|
||||
Type of the value that is returned instead of a referential output argument.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>m3wrapoutconv</td>
|
||||
<td></td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>m3wrapoutcheck</td>
|
||||
<td></td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>m3wrapretraw</td>
|
||||
<td></td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>m3wrapretname</td>
|
||||
<td></td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>m3wraprettype</td>
|
||||
<td></td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>m3wrapretvar</td>
|
||||
<td></td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>m3wrapretconv</td>
|
||||
<td></td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>m3wrapretcheck</td>
|
||||
<td></td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>m3wrapfreearg</td>
|
||||
<td><tt>M3toC.FreeSharedS(str, arg1);</tt></td>
|
||||
<td>
|
||||
Free resources that were temporarily used in the wrapper.
|
||||
Since this step should never be skipped,
|
||||
SWIG will put it in the <tt>FINALLY</tt> branch
|
||||
of a <tt>TRY .. FINALLY</tt> structure.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
<H3><a name="Modula3_ordinals">31.4.2 Subranges, Enumerations, Sets</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
Subranges, enumerations, and sets are machine oriented types
|
||||
that make Modula very strong and expressive compared
|
||||
with the type systems of many other languages.
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
Subranges are used for statically restricted choices of integers.
|
||||
</li>
|
||||
<li>
|
||||
Enumerations are used for named choices.
|
||||
</li>
|
||||
<li>
|
||||
Sets are commonly used for flag (option) sets.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
Using them extensively makes Modula code very safe and readable.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
C supports enumerations, too, but they are not as safe as the ones of Modula.
|
||||
Thus they are abused for many things:
|
||||
For named choices, for integer constant definitions, for sets.
|
||||
To make it complete every way of defining a value in C
|
||||
(<tt>#define</tt>, <tt>const int</tt>, <tt>enum</tt>)
|
||||
is somewhere used for defining something
|
||||
that must be handled completely different in Modula-3
|
||||
(<tt>INTEGER</tt>, enumeration, <tt>SET</tt>).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
I played around with several <tt>%feature</tt>s and <tt>%pragma</tt>s
|
||||
that split the task up into converting
|
||||
the C bit patterns (integer or bit set)
|
||||
into Modula-3 bit patterns (integer or bit set)
|
||||
and change the type as requested.
|
||||
See the corresponding example in the
|
||||
Examples/modula3/enum/example.i file.
|
||||
This is quite messy and not satisfying.
|
||||
So the best what you can currently do is
|
||||
to rewrite constant definitions manually.
|
||||
Though this is a tedious work
|
||||
that I'd like to automate.
|
||||
</p>
|
||||
|
||||
|
||||
<H3><a name="Modula3_class">31.4.3 Objects</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
Declarations of C++ classes are mapped to <tt>OBJECT</tt> types
|
||||
while it is tried to retain the access hierarchy
|
||||
"public - protected - private" using partial revelation.
|
||||
Though the example in
|
||||
Examples/modula3/class/example.i
|
||||
is not really useful, yet.
|
||||
</p>
|
||||
|
||||
|
||||
<H3><a name="Modula3_imports">31.4.4 Imports</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
Pieces of Modula-3 code provided by typemaps
|
||||
may contain identifiers from foreign modules.
|
||||
If the typemap <tt>m3wrapinconv</tt> for <tt>blah *</tt>
|
||||
contains code using the function <tt>M3toC.SharedTtoS</tt>
|
||||
you may declare <tt>%typemap("m3wrapinconv:import") blah * %{M3toC%}</tt>.
|
||||
Then the module <tt>M3toC</tt> is imported
|
||||
if the <tt>m3wrapinconv</tt> typemap for <tt>blah *</tt>
|
||||
is used at least once.
|
||||
Use <tt>%typemap("m3wrapinconv:import") blah * %{MyConversions AS M3toC%}</tt>
|
||||
if you need module renaming.
|
||||
Unqualified import is not supported.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
It is cumbersome to add this typemap to each piece of Modula-3 code.
|
||||
It is especially useful when writing general typemaps
|
||||
for the modula3.swg typemap library.
|
||||
For a monolithic module you might be better off
|
||||
if you add the imports directly:
|
||||
</p>
|
||||
|
||||
<div class="code">
|
||||
<pre>
|
||||
%insert(m3rawintf) %{
|
||||
IMPORT M3toC;
|
||||
%}
|
||||
</pre></div>
|
||||
|
||||
|
||||
<H3><a name="Modula3_exceptions">31.4.5 Exceptions</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
Modula-3 provides another possibility
|
||||
of an output of a function: exceptions.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Any piece of Modula-3 code that SWIG inserts
|
||||
due to a typemap can raise an exception.
|
||||
This way you can also convert an error code
|
||||
from a C function into a Modula-3 exception.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The <tt>RAISES</tt> clause is controlled
|
||||
by typemaps with the <tt>throws</tt> extension.
|
||||
If the typemap <tt>m3wrapinconv</tt> for <tt>blah *</tt>
|
||||
contains code that may raise the exceptions <tt>OSError.E</tt>
|
||||
you should declare
|
||||
<tt>%typemap("m3wrapinconv:throws") blah * %{OSError.E%}</tt>.
|
||||
</p>
|
||||
|
||||
<H3><a name="Modula3_typemap_example">31.4.6 Example</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
The generation of wrappers in Modula-3 needs very fine control
|
||||
to take advantage of the language features.
|
||||
Here is an example of a generated wrapper
|
||||
where almost everything is generated by a typemap:
|
||||
</p>
|
||||
|
||||
<div class="code"><pre>
|
||||
<I> (* %relabel m3wrapinmode m3wrapinname m3wrapintype m3wrapindefault *)</I>
|
||||
PROCEDURE Name (READONLY str : TEXT := "" )
|
||||
<I> (* m3wrapoutcheck:throws *)</I>
|
||||
: NameResult RAISES {E} =
|
||||
CONST
|
||||
arg1name = "str"; <I>(* m3wrapargconst *)</I>
|
||||
VAR
|
||||
arg0 : C.char_star; <I>(* m3wrapretvar *)</I>
|
||||
arg1 : C.char_star; <I>(* m3wrapargvar *)</I>
|
||||
arg2 : C.int;
|
||||
result : RECORD
|
||||
<I> (*m3wrapretname m3wraprettype*)</I>
|
||||
unixPath : TEXT;
|
||||
<I> (*m3wrapoutname m3wrapouttype*)</I>
|
||||
checksum : CARDINAL;
|
||||
END;
|
||||
BEGIN
|
||||
TRY
|
||||
arg1 := M3toC.SharedTtoS(str); <I>(* m3wrapinconv *)</I>
|
||||
IF Text.Length(arg1) > 10 THEN <I>(* m3wrapincheck *)</I>
|
||||
RAISE E("str too long");
|
||||
END;
|
||||
<I> (* m3wrapretraw m3wrapargraw *)</I>
|
||||
arg0 := MessyToUnix (arg1, arg2);
|
||||
result.unixPath := M3toC.CopyStoT(arg0); <I>(* m3wrapretconv *)</I>
|
||||
result.checksum := arg2; <I>(* m3wrapoutconv *)</I>
|
||||
IF result.checksum = 0 THEN <I>(* m3wrapoutcheck *)</I>
|
||||
RAISE E("invalid checksum");
|
||||
END;
|
||||
FINALLY
|
||||
M3toC.FreeSharedS(str, arg1); <I>(* m3wrapfreearg *)</I>
|
||||
END;
|
||||
END Name;
|
||||
</pre></div>
|
||||
|
||||
|
||||
<H2><a name="Modula3_hints">31.5 More hints to the generator</a></H2>
|
||||
|
||||
|
||||
<H3><a name="Modula3_features">31.5.1 Features</a></H3>
|
||||
|
||||
|
||||
<table border summary="Modula-3 features">
|
||||
<tr>
|
||||
<th>Feature</th>
|
||||
<th>Example</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>multiretval</td>
|
||||
<td><tt>%m3multiretval get_box;</tt> or
|
||||
<tt>%feature("modula3:multiretval") get_box;</tt></td>
|
||||
<td>Let the denoted function return a <tt>RECORD</tt>
|
||||
rather than a plain value.
|
||||
This <tt>RECORD</tt> contains all arguments with "out" direction
|
||||
including the return value of the C function (if there is one).
|
||||
If more than one argument is "out"
|
||||
then the function <b>must</b> have the <tt>multiretval</tt> feature activated,
|
||||
but it is explicitly requested from the user to prevent mistakes.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>constnumeric</td>
|
||||
<td><tt>%constnumeric(12) twelve;</tt> or
|
||||
<tt>%feature("constnumeric", "12") twelve;</tt></td>
|
||||
<td>This feature can be used to tell Modula-3's back-end of SWIG
|
||||
the value of an identifier.
|
||||
This is necessary in the cases
|
||||
where it was defined by a non-trivial C expression.
|
||||
This feature is used by the
|
||||
<tt>-generateconst</tt> <a href="#Modula3_commandline">option</a>.
|
||||
In future it may be generalized to other kind of values
|
||||
such as strings.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<H3><a name="Modula3_pragmas">31.5.2 Pragmas</a></H3>
|
||||
|
||||
|
||||
<table border summary="Modula-3 pragmas">
|
||||
<tr>
|
||||
<th>Pragma</th>
|
||||
<th>Example</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>unsafe</td>
|
||||
<td><tt>%pragma(modula3) unsafe="true";</tt></td>
|
||||
<td>Mark the raw interface modules as <tt>UNSAFE</tt>.
|
||||
This will be necessary in many cases.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>library</td>
|
||||
<td><tt>%pragma(modula3) library="m3fftw";</tt></td>
|
||||
<td>Specifies the library name for the wrapper library to be created.
|
||||
It should be distinct from the name of the library to be wrapped.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<H2><a name="Modula3_remarks">31.6 Remarks</a></H2>
|
||||
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
The Modula-3 part of SWIG doesn't try to generate nicely formatted code.
|
||||
If you need to read the generated code, use <tt>m3pp</tt> to postprocess the
|
||||
Modula files.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
# see top-level Makefile.in
|
||||
class
|
||||
enum
|
||||
exception
|
||||
reference
|
||||
simple
|
||||
typemap
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
TOP = ../..
|
||||
SWIGEXE = $(TOP)/../swig
|
||||
SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
|
||||
SRCS =
|
||||
TARGET = example
|
||||
PLATFORM = LINUXLIBC6
|
||||
INTERFACE = example.i
|
||||
SWIGOPT = -c++
|
||||
MODULA3SRCS = *.[im]3
|
||||
|
||||
check: build
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_run
|
||||
|
||||
build:
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
|
||||
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
|
||||
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' modula3
|
||||
m3ppinplace $(MODULA3SRCS)
|
||||
# compilation of example_wrap.cxx is started by cm3
|
||||
# $(CXX) -c $(TARGET)_wrap.cxx
|
||||
mv example_wrap.cxx m3makefile $(MODULA3SRCS) src/
|
||||
ln -sf ../example.h src/example.h
|
||||
cm3
|
||||
|
||||
clean:
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_clean
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
/* File : example.cxx */
|
||||
|
||||
#include "example.h"
|
||||
#define M_PI 3.14159265358979323846
|
||||
|
||||
/* Move the shape to a new location */
|
||||
void Shape::move(double dx, double dy) {
|
||||
x += dx;
|
||||
y += dy;
|
||||
}
|
||||
|
||||
int Shape::nshapes = 0;
|
||||
|
||||
double Circle::area() {
|
||||
return M_PI*radius*radius;
|
||||
}
|
||||
|
||||
double Circle::perimeter() {
|
||||
return 2*M_PI*radius;
|
||||
}
|
||||
|
||||
double Square::area() {
|
||||
return width*width;
|
||||
}
|
||||
|
||||
double Square::perimeter() {
|
||||
return 4*width;
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
/* File : example.h */
|
||||
|
||||
class Shape {
|
||||
public:
|
||||
Shape() {
|
||||
nshapes++;
|
||||
}
|
||||
virtual ~Shape() {
|
||||
nshapes--;
|
||||
}
|
||||
double x, y;
|
||||
void move(double dx, double dy);
|
||||
virtual double area() = 0;
|
||||
virtual double perimeter() = 0;
|
||||
static int nshapes;
|
||||
};
|
||||
|
||||
class Circle : public Shape {
|
||||
private:
|
||||
double radius;
|
||||
public:
|
||||
Circle(double r) : radius(r) { }
|
||||
virtual double area();
|
||||
virtual double perimeter();
|
||||
};
|
||||
|
||||
class Square : public Shape {
|
||||
private:
|
||||
double width;
|
||||
public:
|
||||
Square(double w) : width(w) { }
|
||||
virtual double area();
|
||||
virtual double perimeter();
|
||||
};
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
/* File : example.i */
|
||||
%module Example
|
||||
|
||||
%{
|
||||
#include "example.h"
|
||||
%}
|
||||
|
||||
%insert(m3makefile) %{template("../swig")
|
||||
cxx_source("example_wrap")%}
|
||||
|
||||
%typemap(m3rawinmode) Shape *, Circle *, Square * ""
|
||||
%typemap(m3rawrettype) Shape *, Circle *, Square * "$1_basetype"
|
||||
|
||||
%typemap(m3wrapinmode) Shape *, Circle *, Square * ""
|
||||
%typemap(m3wrapargraw) Shape *, Circle *, Square * "self.cxxObj"
|
||||
|
||||
%typemap(m3wrapretvar) Circle *, Square * "cxxObj : ExampleRaw.$1_basetype;"
|
||||
%typemap(m3wrapretraw) Circle *, Square * "cxxObj"
|
||||
%typemap(m3wrapretconv) Circle *, Square * "NEW($1_basetype,cxxObj:=cxxObj)"
|
||||
%typemap(m3wraprettype) Circle *, Square * "$1_basetype"
|
||||
|
||||
/* Should work with and without renaming
|
||||
%rename(M3Shape) Shape;
|
||||
%rename(M3Circle) Circle;
|
||||
%rename(M3Square) Square;
|
||||
%typemap(m3wrapintype) Shape *, Circle *, Square * "M3$1_basetype"
|
||||
%typemap(m3wraprettype) Shape *, Circle *, Square * "M3$1_basetype"
|
||||
%typemap(m3wrapretconv) Circle *, Square * "NEW(M3$1_basetype,cxxObj:=cxxObj)"
|
||||
*/
|
||||
|
||||
/* Let's just grab the original header file here */
|
||||
%include "example.h"
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
|
||||
readonly proc cxx_source (X) is
|
||||
local cxxfile = X&".cxx"
|
||||
local objfile = X&".o"
|
||||
%exec("echo $PWD")
|
||||
if stale(objfile,cxxfile)
|
||||
exec("cd",path(),"; g++ -I.. -c -o",objfile,cxxfile)
|
||||
end
|
||||
import_obj(X)
|
||||
%unlink_file(path()&SL&objfile)
|
||||
end
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
TOP = ../..
|
||||
SWIGEXE = $(TOP)/../swig
|
||||
SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
|
||||
SRCS =
|
||||
TARGET = example
|
||||
INTERFACE = example.i
|
||||
CONSTNUMERIC = example_const
|
||||
SWIGOPT = -c++
|
||||
MODULA3SRCS = *.[im]3
|
||||
|
||||
check: build
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_run
|
||||
|
||||
build:
|
||||
$(SWIGEXE) -modula3 $(SWIGOPT) -module Example -generateconst $(CONSTNUMERIC) $(TARGET).h
|
||||
$(CXX) -Wall $(CONSTNUMERIC).c -o $(CONSTNUMERIC)
|
||||
$(CONSTNUMERIC) >$(CONSTNUMERIC).i
|
||||
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
|
||||
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
|
||||
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' modula3
|
||||
m3ppinplace $(MODULA3SRCS)
|
||||
mv m3makefile $(MODULA3SRCS) src/
|
||||
cm3
|
||||
|
||||
clean:
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_clean
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
/* File : example.cxx */
|
||||
|
||||
#include "example.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void Foo::enum_test(speed s) {
|
||||
if (s == IMPULSE) {
|
||||
printf("IMPULSE speed\n");
|
||||
} else if (s == WARP) {
|
||||
printf("WARP speed\n");
|
||||
} else if (s == LUDICROUS) {
|
||||
printf("LUDICROUS speed\n");
|
||||
} else if (s == HYPER) {
|
||||
printf("HYPER speed\n");
|
||||
} else {
|
||||
printf("Unknown speed\n");
|
||||
}
|
||||
}
|
||||
|
||||
void enum_test(color c, Foo::speed s) {
|
||||
if (c == RED) {
|
||||
printf("color = RED, ");
|
||||
} else if (c == BLUE) {
|
||||
printf("color = BLUE, ");
|
||||
} else if (c == GREEN) {
|
||||
printf("color = GREEN, ");
|
||||
} else {
|
||||
printf("color = Unknown color!, ");
|
||||
}
|
||||
Foo obj;
|
||||
obj.enum_test(s);
|
||||
}
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
/* File : example.h */
|
||||
|
||||
#define PI 3.141
|
||||
|
||||
#define DAY_MONDAY 0
|
||||
#define DAY_TUESDAY 1
|
||||
#define DAY_WEDNESDAY 2
|
||||
#define DAY_THURSDAY 3
|
||||
#define DAY_FRIDAY 4
|
||||
#define DAY_SATURDAY 5
|
||||
#define DAY_SUNDAY 6
|
||||
|
||||
enum color { BLUE, RED, GREEN };
|
||||
|
||||
#define CLB_BLACK 0
|
||||
#define CLB_BLUE 1
|
||||
#define CLB_RED 2
|
||||
#define CLB_MAGENTA 3
|
||||
#define CLB_GREEN 4
|
||||
#define CLB_CYAN 5
|
||||
#define CLB_YELLOW 6
|
||||
#define CLB_WHITE 7
|
||||
|
||||
/* Using this would be good style
|
||||
which cannot be expected for general C header files.
|
||||
Instead I want to demonstrate how to live without it.
|
||||
enum month {
|
||||
MTHF_JANUARY,
|
||||
MTHF_FEBRUARY,
|
||||
MTHF_MARCH,
|
||||
MTHF_APRIL,
|
||||
MTHF_MAY,
|
||||
MTHF_JUNE,
|
||||
MTHF_JULY,
|
||||
MTHF_AUGUST,
|
||||
MTHF_SEPTEMBER,
|
||||
MTHF_OCTOBER,
|
||||
MTHF_NOVEMBER,
|
||||
MTHF_DECEMBER,
|
||||
}
|
||||
*/
|
||||
|
||||
/* Since there are no compile time constants in C / C++
|
||||
it is a common abuse
|
||||
to declare bit set (flag) constants
|
||||
as enumerations. */
|
||||
enum calendar {
|
||||
MTHB_JANUARY = 1 << 0, /* 1 << MTHF_JANUARY, */
|
||||
MTHB_FEBRUARY = 1 << 1, /* 1 << MTHF_FEBRUARY, */
|
||||
MTHB_MARCH = 1 << 2, /* 1 << MTHF_MARCH, */
|
||||
MTHB_APRIL = 1 << 3, /* 1 << MTHF_APRIL, */
|
||||
MTHB_MAY = 1 << 4, /* 1 << MTHF_MAY, */
|
||||
MTHB_JUNE = 1 << 5, /* 1 << MTHF_JUNE, */
|
||||
MTHB_JULY = 1 << 6, /* 1 << MTHF_JULY, */
|
||||
MTHB_AUGUST = 1 << 7, /* 1 << MTHF_AUGUST, */
|
||||
MTHB_SEPTEMBER = 1 << 8, /* 1 << MTHF_SEPTEMBER, */
|
||||
MTHB_OCTOBER = 1 << 9, /* 1 << MTHF_OCTOBER, */
|
||||
MTHB_NOVEMBER = 1 << 10, /* 1 << MTHF_NOVEMBER, */
|
||||
MTHB_DECEMBER = 1 << 11, /* 1 << MTHF_DECEMBER, */
|
||||
|
||||
MTHB_SPRING = MTHB_MARCH | MTHB_APRIL | MTHB_MAY,
|
||||
MTHB_SUMMER = MTHB_JUNE | MTHB_JULY | MTHB_AUGUST,
|
||||
MTHB_AUTUMN = MTHB_SEPTEMBER | MTHB_OCTOBER | MTHB_NOVEMBER,
|
||||
MTHB_WINTER = MTHB_DECEMBER | MTHB_JANUARY | MTHB_FEBRUARY,
|
||||
};
|
||||
|
||||
|
||||
namespace Answer {
|
||||
enum {
|
||||
UNIVERSE_AND_EVERYTHING = 42,
|
||||
SEVENTEEN_AND_FOUR = 21,
|
||||
TWOHUNDRED_PERCENT_OF_NOTHING = 0,
|
||||
};
|
||||
|
||||
class Foo {
|
||||
public:
|
||||
Foo() { }
|
||||
enum speed { IMPULSE = -2, WARP = 0, HYPER, LUDICROUS = 3};
|
||||
void enum_test(speed s);
|
||||
};
|
||||
};
|
||||
|
||||
void enum_test(color c, Answer::Foo::speed s);
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
/* File : example.i */
|
||||
%module Example
|
||||
|
||||
%{
|
||||
#include "example.h"
|
||||
%}
|
||||
|
||||
%include "example_const.i"
|
||||
|
||||
// such features are generated by the following pragmas
|
||||
#if 0
|
||||
%feature("modula3:enumitem:enum","Days") DAY_MONDAY;
|
||||
%feature("modula3:enumitem:name","monday") DAY_MONDAY;
|
||||
%feature("modula3:enumitem:conv","int:int") DAY_MONDAY;
|
||||
|
||||
%feature("modula3:enumitem:enum","Month") MTHB_JANUARY;
|
||||
%feature("modula3:enumitem:name","january") MTHB_JANUARY;
|
||||
%feature("modula3:enumitem:conv","set:int") MTHB_JANUARY;
|
||||
//%feature("modula3:constset:type","MonthSet") MTHB_JANUARY; /*type in the constant definition*/
|
||||
%feature("modula3:constset:set", "MonthSet") MTHB_JANUARY; /*remarks that the 'type' is a set type*/
|
||||
%feature("modula3:constset:base","Month") MTHB_JANUARY;
|
||||
%feature("modula3:constset:name","monthsJanuary") MTHB_JANUARY;
|
||||
%feature("modula3:constset:conv","set:set") MTHB_JANUARY; /*conversion of the bit pattern: no change*/
|
||||
|
||||
%feature("modula3:enumitem:enum","Color") BLUE;
|
||||
%feature("modula3:enumitem:name","blue") BLUE;
|
||||
%feature("modula3:enumitem:conv","int:int") BLUE;
|
||||
|
||||
%feature("modula3:constint:type","INTEGER") Foo::IMPULSE;
|
||||
%feature("modula3:constint:name","impulse") Foo::IMPULSE;
|
||||
%feature("modula3:constint:conv","int:int") Foo::IMPULSE;
|
||||
#endif
|
||||
|
||||
%rename(pi) PI;
|
||||
|
||||
%pragma(modula3) enumitem="prefix=DAY_;int;srcstyle=underscore;Day";
|
||||
|
||||
%pragma(modula3) enumitem="enum=color;int;srcstyle=underscore;Color";
|
||||
%pragma(modula3) makesetofenum="Color";
|
||||
%pragma(modula3) constset="prefix=CLB_;set;srcstyle=underscore,prefix=clb;ColorSet,Color";
|
||||
|
||||
%pragma(modula3) enumitem="prefix=MTHB_,enum=calendar;set;srcstyle=underscore;Month";
|
||||
%pragma(modula3) makesetofenum="Month";
|
||||
%pragma(modula3) constset="prefix=MTHB_,enum=calendar;set;srcstyle=underscore,prefix=monthset;MonthSet,Month";
|
||||
|
||||
%pragma(modula3) constint="prefix=Answer::Foo::,enum=Answer::Foo::speed;int;srcstyle=underscore,prefix=speed;INTEGER";
|
||||
|
||||
%pragma(modula3) constint="prefix=Answer::,enum=Answer::;int;srcstyle=underscore,prefix=answer;CARDINAL";
|
||||
|
||||
%rename(AnswerFoo) Answer::Foo;
|
||||
%typemap("m3rawrettype") Answer::Foo * %{AnswerFoo%}
|
||||
%typemap("m3rawintype") Answer::Foo * %{AnswerFoo%}
|
||||
%typemap("m3rawinmode") Answer::Foo * %{%}
|
||||
%typemap("m3wraprettype") Answer::Foo * %{AnswerFoo%}
|
||||
%typemap("m3wrapintype") Answer::Foo * %{AnswerFoo%}
|
||||
%typemap("m3wrapinmode") Answer::Foo * %{%}
|
||||
%typemap("m3wrapargraw") Answer::Foo * %{self.cxxObj%}
|
||||
|
||||
%typemap("m3wrapretvar") Answer::Foo * %{cxxObj : ExampleRaw.AnswerFoo;%}
|
||||
%typemap("m3wrapretraw") Answer::Foo * %{cxxObj%}
|
||||
%typemap("m3wrapretconv") Answer::Foo * %{NEW(AnswerFoo,cxxObj:=cxxObj)%}
|
||||
|
||||
|
||||
%typemap("m3rawintype") Answer::Foo::speed %{C.int%};
|
||||
%typemap("m3rawintype:import") Answer::Foo::speed %{Ctypes AS C%};
|
||||
%typemap("m3wrapintype") Answer::Foo::speed %{[-2..3]%};
|
||||
|
||||
%typemap("m3wrapintype") color %{Color%};
|
||||
%typemap("m3wrapargraw") color %{ORD($1_name)%};
|
||||
|
||||
/* Let's just grab the original header file here */
|
||||
%include "example.h"
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
TOP = ../..
|
||||
SWIGEXE = $(TOP)/../swig
|
||||
SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
|
||||
CXXSRCS = example.cxx
|
||||
TARGET = example
|
||||
INTERFACE = example.i
|
||||
SWIGOPT =
|
||||
MODULA3SRCS = *.[im]3
|
||||
MODULA3FLAGS= -o runme
|
||||
|
||||
check: build
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_run
|
||||
|
||||
build:
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
|
||||
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
|
||||
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' modula3_cpp
|
||||
# $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' MODULA3SRCS='$(MODULA3SRCS)' MODULA3FLAGS='$(MODULA3FLAGS)' modula3_compile
|
||||
m3ppinplace $(MODULA3SRCS)
|
||||
mv m3makefile $(MODULA3SRCS) src/
|
||||
cm3
|
||||
|
||||
clean:
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_clean
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
/* File : example.h */
|
||||
|
||||
enum error {OK, OVERFLOW, DIVISION_BY_ZERO, NEGATIVE_RADICAND, NEGATIVE_BASE};
|
||||
typedef error errorstate; /* just to separate the typemaps */
|
||||
|
||||
error acc_add (double &x, double y);
|
||||
error acc_sub (double &x, double y);
|
||||
error acc_mul (double &x, double y);
|
||||
error acc_div (double &x, double y);
|
||||
|
||||
double op_add (double x, double y, errorstate &err);
|
||||
double op_sub (double x, double y, errorstate &err);
|
||||
double op_mul (double x, double y, errorstate &err);
|
||||
double op_div (double x, double y, errorstate &err);
|
||||
double op_sqrt (double x, errorstate &err);
|
||||
double op_pow (double x, double y, errorstate &err);
|
||||
|
||||
double op_noexc (double x, double y);
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
/* File : example.i */
|
||||
%module Example
|
||||
|
||||
%{
|
||||
#include "example.h"
|
||||
%}
|
||||
|
||||
%insert(m3wrapintf) %{
|
||||
EXCEPTION E(Error);
|
||||
%}
|
||||
%insert(m3wrapimpl) %{
|
||||
IMPORT Ctypes AS C;
|
||||
%}
|
||||
|
||||
%pragma(modula3) enumitem="enum=error;int;srcstyle=underscore;Error";
|
||||
|
||||
%typemap("m3rawintype") double & %{C.double%};
|
||||
%typemap("m3wrapintype") double & %{LONGREAL%};
|
||||
|
||||
%typemap("m3wraprettype") error ""
|
||||
%typemap("m3wrapretvar") error "rawerr: C.int;"
|
||||
%typemap("m3wrapretraw") error "rawerr"
|
||||
%typemap("m3wrapretcheck:throws") error "E"
|
||||
%typemap("m3wrapretcheck") error
|
||||
%{VAR err := VAL(rawerr, Error);
|
||||
BEGIN
|
||||
IF err # Error.ok THEN
|
||||
RAISE E(err);
|
||||
END;
|
||||
END;%}
|
||||
|
||||
%typemap("m3rawintype") errorstate & %{C.int%};
|
||||
%typemap("m3wrapintype",numinputs=0) errorstate & %{%};
|
||||
%typemap("m3wrapargvar") errorstate & %{err:C.int:=ORD(Error.ok);%};
|
||||
%typemap("m3wrapoutcheck:throws") errorstate & "E";
|
||||
%typemap("m3wrapoutcheck") errorstate &
|
||||
%{IF VAL(err,Error) # Error.ok THEN
|
||||
RAISE E(VAL(err,Error));
|
||||
END;%}
|
||||
|
||||
/* Let's just grab the original header file here */
|
||||
|
||||
%include "example.h"
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
TOP = ../..
|
||||
SWIGEXE = $(TOP)/../swig
|
||||
SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
|
||||
SRCS =
|
||||
TARGET = example
|
||||
INTERFACE = example.i
|
||||
SWIGOPT = -c++
|
||||
MODULA3SRCS = *.[im]3
|
||||
|
||||
check: build
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_run
|
||||
|
||||
build:
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
|
||||
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
|
||||
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' modula3
|
||||
m3ppinplace $(MODULA3SRCS)
|
||||
mv m3makefile $(MODULA3SRCS) src/
|
||||
cm3
|
||||
|
||||
clean:
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_clean
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
/* File : example.cxx */
|
||||
|
||||
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
|
||||
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER)
|
||||
# define _CRT_SECURE_NO_DEPRECATE
|
||||
#endif
|
||||
|
||||
#include "example.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
Vector operator+(const Vector &a, const Vector &b) {
|
||||
Vector r;
|
||||
r.x = a.x + b.x;
|
||||
r.y = a.y + b.y;
|
||||
r.z = a.z + b.z;
|
||||
return r;
|
||||
}
|
||||
|
||||
char *Vector::print() {
|
||||
static char temp[512];
|
||||
sprintf(temp,"Vector %p (%g,%g,%g)", (void *)this, x,y,z);
|
||||
return temp;
|
||||
}
|
||||
|
||||
VectorArray::VectorArray(int size) {
|
||||
items = new Vector[size];
|
||||
maxsize = size;
|
||||
}
|
||||
|
||||
VectorArray::~VectorArray() {
|
||||
delete [] items;
|
||||
}
|
||||
|
||||
Vector &VectorArray::operator[](int index) {
|
||||
if ((index < 0) || (index >= maxsize)) {
|
||||
printf("Panic! Array index out of bounds.\n");
|
||||
exit(1);
|
||||
}
|
||||
return items[index];
|
||||
}
|
||||
|
||||
int VectorArray::size() {
|
||||
return maxsize;
|
||||
}
|
||||
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
/* File : example.h */
|
||||
|
||||
struct Vector {
|
||||
private:
|
||||
double x,y,z;
|
||||
public:
|
||||
Vector() : x(0), y(0), z(0) { }
|
||||
Vector(double x, double y, double z) : x(x), y(y), z(z) { }
|
||||
Vector operator+(const Vector &b) const;
|
||||
char *print();
|
||||
};
|
||||
|
||||
struct VectorArray {
|
||||
private:
|
||||
Vector *items;
|
||||
int maxsize;
|
||||
public:
|
||||
VectorArray(int maxsize);
|
||||
~VectorArray();
|
||||
Vector &operator[](int);
|
||||
int size();
|
||||
};
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
/* File : example.i */
|
||||
|
||||
/* This file has a few "typical" uses of C++ references. */
|
||||
|
||||
%module Example
|
||||
|
||||
%{
|
||||
#include "example.h"
|
||||
%}
|
||||
|
||||
%pragma(modula3) unsafe="1";
|
||||
|
||||
%insert(m3wrapintf) %{FROM ExampleRaw IMPORT Vector, VectorArray;%}
|
||||
%insert(m3wrapimpl) %{FROM ExampleRaw IMPORT Vector, VectorArray;%}
|
||||
|
||||
%typemap(m3wrapretvar) Vector %{vec: UNTRACED REF Vector;%}
|
||||
%typemap(m3wrapretraw) Vector %{vec%}
|
||||
%typemap(m3wrapretconv) Vector %{vec^%}
|
||||
|
||||
|
||||
/* This helper function calls an overloaded operator */
|
||||
%inline %{
|
||||
Vector addv(const Vector &a, const Vector &b) {
|
||||
return a+b;
|
||||
}
|
||||
%}
|
||||
|
||||
%rename(Vector_Clear) Vector::Vector();
|
||||
%rename(Add) Vector::operator+;
|
||||
%rename(GetItem) VectorArray::operator[];
|
||||
|
||||
%include "example.h"
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
TOP = ../..
|
||||
SWIGEXE = $(TOP)/../swig
|
||||
SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
|
||||
SRCS =
|
||||
TARGET = example
|
||||
INTERFACE = example.i
|
||||
SWIGOPT =
|
||||
MODULA3SRCS = *.[im]3
|
||||
|
||||
check: build
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_run
|
||||
|
||||
build:
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
|
||||
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
|
||||
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' modula3
|
||||
m3ppinplace $(MODULA3SRCS)
|
||||
mv m3makefile $(MODULA3SRCS) src/
|
||||
cm3
|
||||
|
||||
clean:
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_clean
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
/* File : example.c */
|
||||
|
||||
/* A global variable */
|
||||
double Foo = 3.0;
|
||||
|
||||
/* Compute the greatest common divisor of positive integers */
|
||||
int gcd(int x, int y) {
|
||||
int g;
|
||||
g = y;
|
||||
while (x > 0) {
|
||||
g = x;
|
||||
x = y % x;
|
||||
y = g;
|
||||
}
|
||||
return g;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
/* File : example.i */
|
||||
%module Example
|
||||
|
||||
%inline %{
|
||||
extern int gcd(int x, int y);
|
||||
extern double Foo;
|
||||
%}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
TOP = ../..
|
||||
SWIGEXE = $(TOP)/../swig
|
||||
SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
|
||||
SRCS =
|
||||
TARGET = example
|
||||
INTERFACE = example.i
|
||||
SWIGOPT =
|
||||
MODULA3SRCS = *.[im]3
|
||||
|
||||
check: build
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_run
|
||||
|
||||
build:
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
|
||||
SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
|
||||
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' modula3
|
||||
m3ppinplace $(MODULA3SRCS)
|
||||
mv m3makefile $(MODULA3SRCS) src/
|
||||
cm3
|
||||
|
||||
clean:
|
||||
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_clean
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
/* File : example.i */
|
||||
%module Example
|
||||
|
||||
%pragma(modula3) unsafe="true";
|
||||
|
||||
%insert(m3wrapintf) %{FROM ExampleRaw IMPORT Window, Point;
|
||||
%}
|
||||
%insert(m3wrapimpl) %{FROM ExampleRaw IMPORT Window, Point;
|
||||
IMPORT M3toC;
|
||||
IMPORT Ctypes AS C;
|
||||
%}
|
||||
|
||||
/* Typemap applied to patterns of multiple arguments */
|
||||
|
||||
%typemap(m3rawinmode) (char *outstr) %{VAR%}
|
||||
%typemap(m3rawintype) (char *outstr) %{CHAR%}
|
||||
%typemap(m3wrapinmode) (char *outstr, int size) %{VAR%}
|
||||
%typemap(m3wrapintype) (char *outstr, int size) %{ARRAY OF CHAR%}
|
||||
%typemap(m3wrapargraw) (char *outstr, int size) %{$1_name[0], NUMBER($1_name)%}
|
||||
|
||||
|
||||
%typemap(m3rawinmode) (const struct Window *) %{READONLY%}
|
||||
%typemap(m3wrapinmode) (const struct Window *) %{READONLY%}
|
||||
%typemap(m3rawintype) ( struct Window *) %{Window%}
|
||||
%typemap(m3wrapintype) ( struct Window *) %{Window%}
|
||||
|
||||
%typemap(m3rawinmode) (const char *str []) %{READONLY%}
|
||||
%typemap(m3wrapinmode) (const char *str []) %{READONLY%}
|
||||
%typemap(m3rawintype) (const char *str []) %{(*ARRAY OF*) C.char_star%}
|
||||
%typemap(m3wrapintype) (const char *str []) %{ARRAY OF TEXT%}
|
||||
%typemap(m3wrapargvar) (const char *str []) %{$1: REF ARRAY OF C.char_star;%}
|
||||
%typemap(m3wrapargraw) (const char *str []) %{$1[0]%}
|
||||
%typemap(m3wrapinconv) (const char *str []) %{$1:= NEW(REF ARRAY OF C.char_star,NUMBER($1_name));
|
||||
FOR i:=FIRST($1_name) TO LAST($1_name) DO
|
||||
$1[i]:=M3toC.SharedTtoS($1_name[i]);
|
||||
END;%}
|
||||
%typemap(m3wrapfreearg) (const char *str [])
|
||||
%{FOR i:=FIRST($1_name) TO LAST($1_name) DO
|
||||
M3toC.FreeSharedS($1_name[i],$1[i]);
|
||||
END;%}
|
||||
|
||||
%typemap(m3wraprettype) char * %{TEXT%}
|
||||
%typemap(m3wrapretvar) char * %{result_string: C.char_star;%}
|
||||
%typemap(m3wrapretraw) char * %{result_string%}
|
||||
%typemap(m3wrapretconv) char * %{M3toC.CopyStoT(result_string)%}
|
||||
|
||||
struct Window {
|
||||
char *label;
|
||||
int left,top,width,height;
|
||||
};
|
||||
|
||||
|
||||
%typemap(m3wrapinname) (int x, int y) %{p%}
|
||||
%typemap(m3wrapinmode) (int x, int y) %{READONLY%}
|
||||
%typemap(m3wrapintype) (int x, int y) %{Point%}
|
||||
%typemap(m3wrapargraw) (int x, int y) %{p.$1_name, p.$2_name%}
|
||||
|
||||
%typemap(m3wrapargraw) (int &x, int &y) %{p.$1_name, p.$2_name%}
|
||||
%typemap(m3wrapintype) (int &x, int &y) %{Point%}
|
||||
%typemap(m3wrapoutname) (int &x, int &y) %{p%}
|
||||
%typemap(m3wrapouttype) (int &x, int &y) %{Point%}
|
||||
%typemap(m3wrapargdir) (int &x, int &y) "out"
|
||||
|
||||
|
||||
%typemap(m3wrapargvar) int &left, int &top, int &width, int &height "$1:C.int;"
|
||||
%typemap(m3wrapargraw) int &left, int &top, int &width, int &height "$1"
|
||||
%typemap(m3wrapoutconv) int &left, int &top, int &width, int &height "$1"
|
||||
|
||||
%typemap(m3wrapargdir) int &left, int &top "out"
|
||||
|
||||
%typemap(m3wrapouttype) int &width, int &height "CARDINAL"
|
||||
%typemap(m3wrapargdir) int &width, int &height "out"
|
||||
|
||||
struct Point {
|
||||
int x,y;
|
||||
};
|
||||
|
||||
%m3multiretval get_box;
|
||||
|
||||
void set_label ( struct Window *win, const char *str, bool activate);
|
||||
void set_multi_label ( struct Window *win, const char *str []);
|
||||
void write_label (const struct Window *win, char *outstr, int size);
|
||||
int get_label (const struct Window *win, char *outstr, int size);
|
||||
char *get_label_ptr (const struct Window *win);
|
||||
void move(struct Window *win, int x, int y);
|
||||
int get_area(const struct Window *win);
|
||||
void get_box(const struct Window *win, int &left, int &top, int &width, int &height);
|
||||
void get_left(const struct Window *win, int &left);
|
||||
void get_mouse(const struct Window *win, int &x, int &y);
|
||||
int get_attached_data(const struct Window *win, const char *id);
|
||||
|
|
@ -1,787 +0,0 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* modula3.swg
|
||||
*
|
||||
* Modula3 typemaps
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%include <modula3head.swg>
|
||||
|
||||
/* The ctype, m3rawtype and m3wraptype typemaps work together and so there should be one of each.
|
||||
* The ctype typemap contains the C type used in the signature of C wrappers for C++ functions.
|
||||
* The m3rawtype typemap contains the M3 type used in the raw interface.
|
||||
* The m3rawintype typemap contains the M3 type used as function argument.
|
||||
* The m3rawrettype typemap contains the M3 type used as return value.
|
||||
* The m3wraptype typemap contains the M3 type used in the M3 type wrapper classes and module class. */
|
||||
|
||||
/* Primitive types */
|
||||
%typemap(ctype) bool, const bool & "bool"
|
||||
%typemap(ctype) char, const char & "char"
|
||||
%typemap(ctype) signed char, const signed char & "signed char"
|
||||
%typemap(ctype) unsigned char, const unsigned char & "unsigned short"
|
||||
%typemap(ctype) short, const short & "short"
|
||||
%typemap(ctype) unsigned short, const unsigned short & "unsigned short"
|
||||
%typemap(ctype) int, const int & "int"
|
||||
%typemap(ctype) unsigned int, const unsigned int & "unsigned int"
|
||||
%typemap(ctype) long, const long & "long"
|
||||
%typemap(ctype) unsigned long, const unsigned long & "unsigned long"
|
||||
%typemap(ctype) long long, const long long & "long long"
|
||||
%typemap(ctype) unsigned long long, const unsigned long long & "unsigned long long"
|
||||
%typemap(ctype) float, const float & "float"
|
||||
%typemap(ctype) double, const double & "double"
|
||||
%typemap(ctype) char * "char *"
|
||||
%typemap(ctype) void "void"
|
||||
|
||||
%typemap(m3rawtype) bool, const bool & "BOOLEAN"
|
||||
%typemap(m3rawtype) char, const char & "C.char"
|
||||
%typemap(m3rawtype) signed char, const signed char & "C.signed_char"
|
||||
%typemap(m3rawtype) unsigned char, const unsigned char & "C.unsigned_char"
|
||||
%typemap(m3rawtype) short, const short & "C.short"
|
||||
%typemap(m3rawtype) unsigned short, const unsigned short & "C.unsigned_short"
|
||||
%typemap(m3rawtype) int, const int & "C.int"
|
||||
%typemap(m3rawtype) unsigned int, const unsigned int & "C.unsigned_int"
|
||||
%typemap(m3rawtype) long, const long & "C.long"
|
||||
%typemap(m3rawtype) unsigned long, const unsigned long & "C.unsigned_long"
|
||||
%typemap(m3rawtype) long long, const long long & "C.long_long"
|
||||
%typemap(m3rawtype) unsigned long long, const unsigned long long & "C.unsigned_long_long"
|
||||
%typemap(m3rawtype) float, const float & "C.float"
|
||||
%typemap(m3rawtype) double, const double & "C.double"
|
||||
%typemap(m3rawtype) long double, const long double & "C.long_double"
|
||||
%typemap(m3rawtype) char * "C.char_star"
|
||||
%typemap(m3rawtype) void ""
|
||||
%typemap(m3rawtype) FILE "Cstdio.FILE";
|
||||
%typemap(m3rawtype) FILE * "Cstdio.FILE_star";
|
||||
|
||||
|
||||
%typemap(m3rawintype) bool *, bool &, bool "BOOLEAN"
|
||||
%typemap(m3rawintype) char *, char &, char "C.char"
|
||||
%typemap(m3rawintype) signed char *, signed char &, signed char "C.signed_char"
|
||||
%typemap(m3rawintype) unsigned char *, unsigned char &, unsigned char "C.unsigned_char"
|
||||
%typemap(m3rawintype) short *, short &, short "C.short"
|
||||
%typemap(m3rawintype) unsigned short *, unsigned short &, unsigned short "C.unsigned_short"
|
||||
%typemap(m3rawintype) int *, int &, int "C.int"
|
||||
%typemap(m3rawintype) unsigned int *, unsigned int &, unsigned int "C.unsigned_int"
|
||||
%typemap(m3rawintype) long *, long &, long "C.long"
|
||||
%typemap(m3rawintype) unsigned long *, unsigned long &, unsigned long "C.unsigned_long"
|
||||
%typemap(m3rawintype) long long *, long long &, long long "C.long_long"
|
||||
%typemap(m3rawintype) unsigned long long *, unsigned long long &, unsigned long long "C.unsigned_long_long"
|
||||
%typemap(m3rawintype) float *, float &, float "C.float"
|
||||
%typemap(m3rawintype) double *, double &, double "C.double"
|
||||
%typemap(m3rawintype) long double *, long double &, long double "C.long_double"
|
||||
%typemap(m3rawintype) char * "C.char_star"
|
||||
%typemap(m3rawintype) void ""
|
||||
%typemap(m3rawintype) void * "ADDRESS"
|
||||
%typemap(m3rawintype) FILE "Cstdio.FILE";
|
||||
%typemap(m3rawintype) FILE * "Cstdio.FILE_star";
|
||||
|
||||
%typemap(m3rawinmode) char *, void *, FILE * ""
|
||||
|
||||
|
||||
%typemap(m3rawrettype) bool, const bool & "BOOLEAN"
|
||||
%typemap(m3rawrettype) char, const char & "C.char"
|
||||
%typemap(m3rawrettype) signed char, const signed char & "C.signed_char"
|
||||
%typemap(m3rawrettype) unsigned char, const unsigned char & "C.unsigned_char"
|
||||
%typemap(m3rawrettype) short, const short & "C.short"
|
||||
%typemap(m3rawrettype) unsigned short, const unsigned short & "C.unsigned_short"
|
||||
%typemap(m3rawrettype) int, const int & "C.int"
|
||||
%typemap(m3rawrettype) unsigned int, const unsigned int & "C.unsigned_int"
|
||||
%typemap(m3rawrettype) long, const long & "C.long"
|
||||
%typemap(m3rawrettype) unsigned long, const unsigned long & "C.unsigned_long"
|
||||
%typemap(m3rawrettype) long long, const long long & "C.long_long"
|
||||
%typemap(m3rawrettype) unsigned long long, const unsigned long long & "C.unsigned_long_long"
|
||||
%typemap(m3rawrettype) float, const float & "C.float"
|
||||
%typemap(m3rawrettype) double, const double & "C.double"
|
||||
%typemap(m3rawrettype) long double, const long double & "C.long_double"
|
||||
%typemap(m3rawrettype) char * "C.char_star"
|
||||
%typemap(m3rawrettype) void ""
|
||||
%typemap(m3rawrettype) void * "ADDRESS"
|
||||
%typemap(m3rawrettype) FILE "Cstdio.FILE";
|
||||
%typemap(m3rawrettype) FILE * "Cstdio.FILE_star";
|
||||
|
||||
|
||||
%typemap("m3rawtype:import")
|
||||
char, const char &,
|
||||
signed char, const signed char &,
|
||||
unsigned char, const unsigned char &,
|
||||
short, const short &,
|
||||
unsigned short, const unsigned short &,
|
||||
int, const int &,
|
||||
unsigned int, const unsigned int &,
|
||||
long, const long &,
|
||||
unsigned long, const unsigned long &,
|
||||
long long, const long long &,
|
||||
unsigned long long, const unsigned long long &,
|
||||
float, const float &,
|
||||
double, const double &,
|
||||
long double, const long double &,
|
||||
char *
|
||||
"Ctypes AS C"
|
||||
|
||||
%typemap("m3rawintype:import")
|
||||
char, const char &,
|
||||
signed char, const signed char &,
|
||||
unsigned char, const unsigned char &,
|
||||
short, const short &,
|
||||
unsigned short, const unsigned short &,
|
||||
int, const int &,
|
||||
unsigned int, const unsigned int &,
|
||||
long, const long &,
|
||||
unsigned long, const unsigned long &,
|
||||
long long, const long long &,
|
||||
unsigned long long, const unsigned long long &,
|
||||
float, const float &,
|
||||
double, const double &,
|
||||
long double, const long double &,
|
||||
char *
|
||||
"Ctypes AS C"
|
||||
|
||||
%typemap("m3rawrettype:import")
|
||||
char, const char &,
|
||||
signed char, const signed char &,
|
||||
unsigned char, const unsigned char &,
|
||||
short, const short &,
|
||||
unsigned short, const unsigned short &,
|
||||
int, const int &,
|
||||
unsigned int, const unsigned int &,
|
||||
long, const long &,
|
||||
unsigned long, const unsigned long &,
|
||||
long long, const long long &,
|
||||
unsigned long long, const unsigned long long &,
|
||||
float, const float &,
|
||||
double, const double &,
|
||||
long double, const long double &,
|
||||
char *
|
||||
"Ctypes AS C"
|
||||
|
||||
%typemap("m3rawtype:import")
|
||||
FILE, FILE *
|
||||
"Cstdio";
|
||||
|
||||
%typemap("m3rawintype:import")
|
||||
FILE, FILE *
|
||||
"Cstdio";
|
||||
|
||||
%typemap("m3rawrettype:import")
|
||||
FILE, FILE *
|
||||
"Cstdio";
|
||||
|
||||
%typemap(m3wraptype) bool, const bool & "BOOLEAN"
|
||||
%typemap(m3wraptype) char, const char & "CHAR"
|
||||
%typemap(m3wraptype) signed char, const signed char & "CHAR"
|
||||
%typemap(m3wraptype) unsigned char, const unsigned char & "CHAR"
|
||||
%typemap(m3wraptype) short, const short & "Integer16.T"
|
||||
%typemap(m3wraptype) unsigned short, const unsigned short & "Cardinal16.T"
|
||||
%typemap(m3wraptype) int, const int & "INTEGER"
|
||||
%typemap(m3wraptype) unsigned int, const unsigned int & "CARDINAL"
|
||||
%typemap(m3wraptype) long, const long & "Integer32.T"
|
||||
%typemap(m3wraptype) unsigned long, const unsigned long & "Cardinal32.T"
|
||||
%typemap(m3wraptype) long long, const long long & "Integer64.T"
|
||||
%typemap(m3wraptype) unsigned long long, const unsigned long long & "Cardinal64.T"
|
||||
%typemap(m3wraptype) float, const float & "REAL"
|
||||
%typemap(m3wraptype) double, const double & "LONGREAL"
|
||||
%typemap(m3wraptype) long double, const long double & "EXTENDED"
|
||||
%typemap(m3wraptype) char * "TEXT"
|
||||
%typemap(m3wraptype) void ""
|
||||
%typemap(m3wraptype) FILE "Cstdio.FILE";
|
||||
%typemap(m3wraptype) FILE * "Cstdio.FILE_star";
|
||||
|
||||
%typemap(m3wrapintype) bool, const bool *, const bool & "BOOLEAN"
|
||||
%typemap(m3wrapintype) char, const char *, const char & "CHAR"
|
||||
%typemap(m3wrapintype) signed char, const signed char *, const signed char & "CHAR"
|
||||
%typemap(m3wrapintype) unsigned char, const unsigned char *, const unsigned char & "CHAR"
|
||||
%typemap(m3wrapintype) short, const short *, const short & "INTEGER"
|
||||
%typemap(m3wrapintype) unsigned short, const unsigned short *, const unsigned short & "CARDINAL"
|
||||
%typemap(m3wrapintype) int, const int *, const int & "INTEGER"
|
||||
%typemap(m3wrapintype) unsigned int, const unsigned int *, const unsigned int & "CARDINAL"
|
||||
%typemap(m3wrapintype) long, const long *, const long & "INTEGER"
|
||||
%typemap(m3wrapintype) unsigned long, const unsigned long *, const unsigned long & "CARDINAL"
|
||||
%typemap(m3wrapintype) long long, const long long *, const long long & "INTEGER"
|
||||
%typemap(m3wrapintype) unsigned long long, const unsigned long long *, const unsigned long long & "CARDINAL"
|
||||
%typemap(m3wrapintype) float, const float *, const float & "REAL"
|
||||
%typemap(m3wrapintype) double, const double *, const double & "LONGREAL"
|
||||
%typemap(m3wrapintype) long double, const long double *, const long double & "EXTENDED"
|
||||
%typemap(m3wrapintype) const char *, const char [] "TEXT"
|
||||
%typemap(m3wrapintype,numinputs=0) void ""
|
||||
%typemap(m3wrapintype) FILE "Cstdio.FILE";
|
||||
%typemap(m3wrapintype) FILE * "Cstdio.FILE_star";
|
||||
|
||||
|
||||
%typemap(m3wrapouttype) bool, bool *, bool & "BOOLEAN"
|
||||
%typemap(m3wrapouttype) char, char *, char & "CHAR"
|
||||
%typemap(m3wrapouttype) signed char, signed char *, signed char & "CHAR"
|
||||
%typemap(m3wrapouttype) unsigned char, unsigned char *, unsigned char & "CHAR"
|
||||
%typemap(m3wrapouttype) short, short *, short & "INTEGER"
|
||||
%typemap(m3wrapouttype) unsigned short, unsigned short *, unsigned short & "CARDINAL"
|
||||
%typemap(m3wrapouttype) int, int *, int & "INTEGER"
|
||||
%typemap(m3wrapouttype) unsigned int, unsigned int *, unsigned int & "CARDINAL"
|
||||
%typemap(m3wrapouttype) long, long *, long & "INTEGER"
|
||||
%typemap(m3wrapouttype) unsigned long, unsigned long *, unsigned long & "CARDINAL"
|
||||
%typemap(m3wrapouttype) long long, long long *, long long & "INTEGER"
|
||||
%typemap(m3wrapouttype) unsigned long long, unsigned long long *, unsigned long long & "CARDINAL"
|
||||
%typemap(m3wrapouttype) float, float *, float & "REAL"
|
||||
%typemap(m3wrapouttype) double, double *, double & "LONGREAL"
|
||||
%typemap(m3wrapouttype) long double, long double *, long double & "EXTENDED"
|
||||
%typemap(m3wrapouttype) char *, char [] "TEXT"
|
||||
%typemap(m3wrapouttype,numinputs=0) void ""
|
||||
|
||||
%typemap(m3wraprettype) bool, const bool & "BOOLEAN"
|
||||
%typemap(m3wraprettype) char, const char & "CHAR"
|
||||
%typemap(m3wraprettype) signed char, const signed char & "CHAR"
|
||||
%typemap(m3wraprettype) unsigned char, const unsigned char & "CHAR"
|
||||
%typemap(m3wraprettype) short, const short & "INTEGER"
|
||||
%typemap(m3wraprettype) unsigned short, const unsigned short & "CARDINAL"
|
||||
%typemap(m3wraprettype) int, const int & "INTEGER"
|
||||
%typemap(m3wraprettype) unsigned int, const unsigned int & "CARDINAL"
|
||||
%typemap(m3wraprettype) long, const long & "INTEGER"
|
||||
%typemap(m3wraprettype) unsigned long, const unsigned long & "CARDINAL"
|
||||
%typemap(m3wraprettype) long long, const long long & "INTEGER"
|
||||
%typemap(m3wraprettype) unsigned long long, const unsigned long long & "CARDINAL"
|
||||
%typemap(m3wraprettype) float, const float & "REAL"
|
||||
%typemap(m3wraprettype) double, const double & "LONGREAL"
|
||||
%typemap(m3wraprettype) long double, const long double & "EXTENDED"
|
||||
%typemap(m3wraprettype) char * "TEXT"
|
||||
%typemap(m3wraprettype) void ""
|
||||
%typemap(m3wraprettype) FILE "Cstdio.FILE";
|
||||
%typemap(m3wraprettype) FILE * "Cstdio.FILE_star";
|
||||
|
||||
|
||||
%typemap(ctype) char[ANY] "char *"
|
||||
%typemap(m3rawtype) char[ANY] "C.char_star"
|
||||
%typemap(m3rawintype) char[ANY] "C.char_star"
|
||||
%typemap(m3rawrettype) char[ANY] "C.char_star"
|
||||
%typemap(m3wraptype) char[ANY] "TEXT"
|
||||
%typemap(m3wrapintype) char[ANY] "TEXT"
|
||||
%typemap(m3wrapouttype) char[ANY] "TEXT"
|
||||
%typemap(m3wraprettype) char[ANY] "TEXT"
|
||||
|
||||
%typemap(m3wrapinmode) const char * %{%}
|
||||
%typemap(m3wrapargvar) const char * %{$1 : C.char_star;%}
|
||||
%typemap(m3wrapinconv) const char * %{$1 := M3toC.SharedTtoS($1_name);%}
|
||||
%typemap(m3wrapfreearg) const char * %{M3toC.FreeSharedS($1_name,$1);%}
|
||||
%typemap(m3wrapargraw) const char * %{$1%}
|
||||
%typemap("m3wrapargvar:import") const char * "Ctypes AS C"
|
||||
%typemap("m3wrapinconv:import") const char * "M3toC"
|
||||
%typemap("m3wrapfreearg:import") const char * "M3toC"
|
||||
|
||||
%typemap(m3wrapretvar) char * %{result : C.char_star;%}
|
||||
%typemap(m3wrapretraw) char * %{result%}
|
||||
%typemap(m3wrapretconv) char * %{M3toC.CopyStoT(result)%}
|
||||
%typemap("m3wrapretvar:import") char * "Ctypes AS C"
|
||||
%typemap("m3wrapretconv:import") char * "M3toC"
|
||||
|
||||
%typemap(m3wrapinmode) FILE * %{%}
|
||||
|
||||
|
||||
%typemap("m3wraptype:import")
|
||||
FILE, FILE *
|
||||
"Cstdio";
|
||||
|
||||
%typemap("m3wrapintype:import")
|
||||
FILE, FILE *
|
||||
"Cstdio";
|
||||
|
||||
%typemap("m3wraprettype:import")
|
||||
FILE, FILE *
|
||||
"Cstdio";
|
||||
|
||||
|
||||
/* Composed types */
|
||||
%typemap(ctype) SWIGTYPE "$1_type"
|
||||
%typemap(m3rawtype) SWIGTYPE "$1_basetype"
|
||||
%typemap(m3rawrettype) SWIGTYPE "UNTRACED REF $1_basetype"
|
||||
%typemap(m3wraptype) SWIGTYPE "$1_basetype"
|
||||
%typemap(m3wrapintype) SWIGTYPE "$1_basetype"
|
||||
%typemap(m3wrapouttype) SWIGTYPE "$1_basetype"
|
||||
%typemap(m3wraprettype) SWIGTYPE "$1_basetype"
|
||||
|
||||
%typemap(ctype) SWIGTYPE [] "$1_type"
|
||||
%typemap(m3rawtype) const SWIGTYPE [] "UNTRACED REF ARRAY INTEGER OF $1_basetype"
|
||||
%typemap(m3rawtype) SWIGTYPE [] "UNTRACED REF ARRAY INTEGER OF $1_basetype"
|
||||
%typemap(m3rawintype) const SWIGTYPE [] "(*ARRAY OF*) $1_basetype"
|
||||
%typemap(m3rawinmode) const SWIGTYPE [] "READONLY"
|
||||
%typemap(m3rawintype) SWIGTYPE [] "(*ARRAY OF*) $1_basetype"
|
||||
%typemap(m3rawinmode) SWIGTYPE [] "VAR"
|
||||
%typemap(m3rawrettype) const SWIGTYPE [] "UNTRACED REF ARRAY INTEGER OF $1_basetype"
|
||||
%typemap(m3rawrettype) SWIGTYPE [] "UNTRACED REF ARRAY INTEGER OF $1_basetype"
|
||||
%typemap(m3wraptype) SWIGTYPE [] "$1_basetype"
|
||||
%typemap(m3wrapintype) const SWIGTYPE [] "ARRAY OF $1_basetype"
|
||||
%typemap(m3wrapinmode) const SWIGTYPE [] "READONLY"
|
||||
%typemap(m3wrapintype) SWIGTYPE [] "ARRAY OF $1_basetype"
|
||||
%typemap(m3wrapinmode) SWIGTYPE [] "VAR"
|
||||
%typemap(m3wrapouttype) SWIGTYPE [] "ARRAY OF $1_basetype"
|
||||
%typemap(m3wraprettype) SWIGTYPE [] "REF ARRAY OF $1_basetype"
|
||||
|
||||
%typemap(ctype) SWIGTYPE * "$1_type"
|
||||
%typemap(m3rawtype) const SWIGTYPE * "UNTRACED REF $1_basetype"
|
||||
%typemap(m3rawtype) SWIGTYPE * "UNTRACED REF $1_basetype"
|
||||
%typemap(m3rawintype) const SWIGTYPE * "$1_basetype"
|
||||
%typemap(m3rawinmode) const SWIGTYPE * "READONLY"
|
||||
%typemap(m3rawintype) SWIGTYPE * "$1_basetype"
|
||||
%typemap(m3rawinmode) SWIGTYPE * "VAR"
|
||||
%typemap(m3rawrettype) const SWIGTYPE * "UNTRACED REF $1_basetype"
|
||||
%typemap(m3rawrettype) SWIGTYPE * "UNTRACED REF $1_basetype"
|
||||
%typemap(m3wraptype) SWIGTYPE * "$1_basetype"
|
||||
%typemap(m3wrapintype) const SWIGTYPE * "$1_basetype"
|
||||
%typemap(m3wrapinmode) const SWIGTYPE * "READONLY"
|
||||
%typemap(m3wrapintype) SWIGTYPE * "$1_basetype"
|
||||
%typemap(m3wrapinmode) SWIGTYPE * "VAR"
|
||||
%typemap(m3wrapouttype) SWIGTYPE * "$1_basetype"
|
||||
%typemap(m3wraprettype) SWIGTYPE * "UNTRACED REF $1_basetype"
|
||||
|
||||
%typemap(ctype) SWIGTYPE & "$1_type"
|
||||
%typemap(m3rawtype) const SWIGTYPE & "UNTRACED REF $1_basetype"
|
||||
%typemap(m3rawtype) SWIGTYPE & "UNTRACED REF $1_basetype"
|
||||
%typemap(m3rawintype) const SWIGTYPE & "$1_basetype"
|
||||
%typemap(m3rawinmode) const SWIGTYPE & "READONLY"
|
||||
%typemap(m3rawintype) SWIGTYPE & "$1_basetype"
|
||||
%typemap(m3rawinmode) SWIGTYPE & "VAR"
|
||||
%typemap(m3rawrettype) const SWIGTYPE & "UNTRACED REF $1_basetype"
|
||||
%typemap(m3rawrettype) SWIGTYPE & "UNTRACED REF $1_basetype"
|
||||
%typemap(m3wraptype) SWIGTYPE & "$1_basetype"
|
||||
%typemap(m3wrapintype) const SWIGTYPE & "$1_basetype"
|
||||
%typemap(m3wrapinmode) const SWIGTYPE & "READONLY"
|
||||
%typemap(m3wrapintype) SWIGTYPE & "$1_basetype"
|
||||
%typemap(m3wrapinmode) SWIGTYPE & "VAR"
|
||||
%typemap(m3wrapouttype) SWIGTYPE & "$1_basetype"
|
||||
%typemap(m3wraprettype) SWIGTYPE & "UNTRACED REF $1_basetype"
|
||||
|
||||
%typemap(ctype) SWIGTYPE && "$1_type"
|
||||
%typemap(m3rawtype) const SWIGTYPE && "UNTRACED REF $1_basetype"
|
||||
%typemap(m3rawtype) SWIGTYPE && "UNTRACED REF $1_basetype"
|
||||
%typemap(m3rawintype) const SWIGTYPE && "$1_basetype"
|
||||
%typemap(m3rawinmode) const SWIGTYPE && "READONLY"
|
||||
%typemap(m3rawintype) SWIGTYPE && "$1_basetype"
|
||||
%typemap(m3rawinmode) SWIGTYPE && "VAR"
|
||||
%typemap(m3rawrettype) const SWIGTYPE && "UNTRACED REF $1_basetype"
|
||||
%typemap(m3rawrettype) SWIGTYPE && "UNTRACED REF $1_basetype"
|
||||
%typemap(m3wraptype) SWIGTYPE && "$1_basetype"
|
||||
%typemap(m3wrapintype) const SWIGTYPE && "$1_basetype"
|
||||
%typemap(m3wrapinmode) const SWIGTYPE && "READONLY"
|
||||
%typemap(m3wrapintype) SWIGTYPE && "$1_basetype"
|
||||
%typemap(m3wrapinmode) SWIGTYPE && "VAR"
|
||||
%typemap(m3wrapouttype) SWIGTYPE && "$1_basetype"
|
||||
%typemap(m3wraprettype) SWIGTYPE && "UNTRACED REF $1_basetype"
|
||||
|
||||
%typemap(ctype) enum SWIGTYPE "$1_type"
|
||||
%typemap(m3rawtype) enum SWIGTYPE "C.int"
|
||||
%typemap(m3rawintype) enum SWIGTYPE "C.int (* $1_type *)"
|
||||
%typemap(m3rawrettype) enum SWIGTYPE "C.int"
|
||||
%typemap(m3wraptype) enum SWIGTYPE "$*1_type"
|
||||
%typemap(m3wrapintype) enum SWIGTYPE "$1_type"
|
||||
%typemap(m3wrapouttype) enum SWIGTYPE "$1_type"
|
||||
%typemap(m3wraprettype) enum SWIGTYPE "$*1_type"
|
||||
|
||||
/* pointer to a class member */
|
||||
%typemap(ctype) SWIGTYPE (CLASS::*) "$1_type"
|
||||
%typemap(m3rawtype) SWIGTYPE (CLASS::*) "REFANY"
|
||||
%typemap(m3wraptype) SWIGTYPE (CLASS::*) "$1_basetype"
|
||||
|
||||
/* The following are the in, out, freearg, argout typemaps.
|
||||
These are the PInvoke code generating typemaps for converting from C# to C and visa versa. */
|
||||
|
||||
/* primitive types */
|
||||
%typemap(in) bool
|
||||
%{ $1 = $input ? true : false; %}
|
||||
|
||||
%typemap(in) char,
|
||||
signed char,
|
||||
unsigned char,
|
||||
short,
|
||||
unsigned short,
|
||||
int,
|
||||
unsigned int,
|
||||
long,
|
||||
unsigned long,
|
||||
long long,
|
||||
unsigned long long,
|
||||
float,
|
||||
double,
|
||||
enum SWIGTYPE
|
||||
%{ $1 = ($1_ltype)$input; %}
|
||||
|
||||
%typemap(out) bool %{ $result = $1; %}
|
||||
%typemap(out) char %{ $result = $1; %}
|
||||
%typemap(out) signed char %{ $result = $1; %}
|
||||
%typemap(out) unsigned char %{ $result = $1; %}
|
||||
%typemap(out) short %{ $result = $1; %}
|
||||
%typemap(out) unsigned short %{ $result = $1; %}
|
||||
%typemap(out) int %{ $result = $1; %}
|
||||
%typemap(out) unsigned int %{ $result = $1; %}
|
||||
%typemap(out) long %{ $result = $1; %}
|
||||
%typemap(out) unsigned long %{ $result = $1; %}
|
||||
%typemap(out) long long %{ $result = $1; %}
|
||||
%typemap(out) unsigned long long %{ $result = $1; %}
|
||||
%typemap(out) float %{ $result = $1; %}
|
||||
%typemap(out) double %{ $result = $1; %}
|
||||
%typemap(out) enum SWIGTYPE %{ $result = $1; %}
|
||||
|
||||
/* char * - treat as String */
|
||||
%typemap(in) char * {
|
||||
$1 = $input;
|
||||
}
|
||||
//%typemap(freearg) char * { if ($1) JCALL2(ReleaseStringUTFChars, jenv, $input, $1); }
|
||||
//%typemap(out) char * { if($1) $result = JCALL1(NewStringUTF, jenv, $1); }
|
||||
|
||||
%typemap(out) void ""
|
||||
|
||||
/* primitive types by const reference */
|
||||
%typemap(in) const bool & (bool temp)
|
||||
%{ temp = $input ? true : false;
|
||||
$1 = &temp; %}
|
||||
|
||||
%typemap(in) const char & (char temp),
|
||||
const signed char & (signed char temp),
|
||||
const unsigned char & (unsigned char temp),
|
||||
const short & (short temp),
|
||||
const unsigned short & (unsigned short temp),
|
||||
const int & (int temp),
|
||||
const unsigned int & (unsigned int temp),
|
||||
const long & (long temp),
|
||||
const unsigned long & (unsigned long temp),
|
||||
const long long & ($*1_ltype temp),
|
||||
const unsigned long long & ($*1_ltype temp),
|
||||
const float & (float temp),
|
||||
const double & (double temp)
|
||||
%{ temp = ($*1_ltype)$input;
|
||||
$1 = &temp; %}
|
||||
|
||||
%typemap(out) const bool & %{ $result = *$1; %}
|
||||
%typemap(out) const char & %{ $result = *$1; %}
|
||||
%typemap(out) const signed char & %{ $result = *$1; %}
|
||||
%typemap(out) const unsigned char & %{ $result = *$1; %}
|
||||
%typemap(out) const short & %{ $result = *$1; %}
|
||||
%typemap(out) const unsigned short & %{ $result = *$1; %}
|
||||
%typemap(out) const int & %{ $result = *$1; %}
|
||||
%typemap(out) const unsigned int & %{ $result = *$1; %}
|
||||
%typemap(out) const long & %{ $result = *$1; %}
|
||||
%typemap(out) const unsigned long & %{ $result = *$1; %}
|
||||
%typemap(out) const long long & %{ $result = *$1; %}
|
||||
%typemap(out) const unsigned long long & %{ $result = *$1; %}
|
||||
%typemap(out) const float & %{ $result = *$1; %}
|
||||
%typemap(out) const double & %{ $result = *$1; %}
|
||||
|
||||
/* Default handling. Object passed by value. Convert to a pointer */
|
||||
%typemap(in) SWIGTYPE ($&1_type argp)
|
||||
%{ argp = *($&1_ltype*)&$input;
|
||||
if (!argp) {
|
||||
// SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null $1_type");
|
||||
RETURN $null;
|
||||
}
|
||||
$1 = *argp; %}
|
||||
%typemap(out) SWIGTYPE
|
||||
#ifdef __cplusplus
|
||||
%{*($&1_ltype*)&$result = new $1_ltype((const $1_ltype &)$1); %}
|
||||
#else
|
||||
{
|
||||
$&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype));
|
||||
memmove($1ptr, &$1, sizeof($1_type));
|
||||
*($&1_ltype*)&$result = $1ptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Generic pointers and references */
|
||||
%typemap(in) SWIGTYPE *, SWIGTYPE (CLASS::*) %{ $1 = *($&1_ltype)&$input; %}
|
||||
%typemap(in) SWIGTYPE & %{ $1 = *($&1_ltype)&$input;
|
||||
if(!$1) {
|
||||
//SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type reference is null");
|
||||
RETURN $null;
|
||||
} %}
|
||||
%typemap(in) SWIGTYPE && %{ $1 = *($&1_ltype)&$input;
|
||||
if(!$1) {
|
||||
//SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type reference is null");
|
||||
RETURN $null;
|
||||
} %}
|
||||
%typemap(out) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE (CLASS::*) %{ *($&1_ltype)&$result = $1; %}
|
||||
|
||||
|
||||
/* Default array handling */
|
||||
%typemap(in) SWIGTYPE [] %{ $1 = *($&1_ltype)&$input; %}
|
||||
%typemap(out) SWIGTYPE [] %{ *($&1_ltype)&$result = $1; %}
|
||||
|
||||
/* char[ANY] - treat as String */
|
||||
%typemap(in) char[ANY] {
|
||||
$1 = $input;
|
||||
}
|
||||
|
||||
%typemap(argout) char[ANY] ""
|
||||
%typemap(freearg) char[ANY] ""//{ if ($1) JCALL2(ReleaseStringUTFChars, jenv, $input, $1); }
|
||||
%typemap(out) char[ANY] { if($1) $result = $1; }
|
||||
|
||||
|
||||
/* Typecheck typemaps - The purpose of these is merely to issue a warning for overloaded C++ functions
|
||||
* that cannot be overloaded in C# as more than one C++ type maps to a single C# type */
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_BOOL) /* Java boolean */
|
||||
bool,
|
||||
const bool &
|
||||
""
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_CHAR) /* Java char */
|
||||
char,
|
||||
const char &
|
||||
""
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_INT8) /* Java byte */
|
||||
signed char,
|
||||
const signed char &
|
||||
""
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_INT16) /* Java short */
|
||||
unsigned char,
|
||||
short,
|
||||
const unsigned char &,
|
||||
const short &
|
||||
""
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_INT32) /* Java int */
|
||||
unsigned short,
|
||||
int,
|
||||
long,
|
||||
const unsigned short &,
|
||||
const int &,
|
||||
const long &,
|
||||
enum SWIGTYPE
|
||||
""
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_INT64) /* Java long */
|
||||
unsigned int,
|
||||
unsigned long,
|
||||
long long,
|
||||
const unsigned int &,
|
||||
const unsigned long &,
|
||||
const long long &
|
||||
""
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_INT128) /* Java BigInteger */
|
||||
unsigned long long
|
||||
""
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_FLOAT) /* Java float */
|
||||
float,
|
||||
const float &
|
||||
""
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_DOUBLE) /* Java double */
|
||||
double,
|
||||
const double &
|
||||
""
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_STRING) /* Java String */
|
||||
char *,
|
||||
char[ANY]
|
||||
""
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) /* Default */
|
||||
SWIGTYPE,
|
||||
SWIGTYPE *,
|
||||
SWIGTYPE &,
|
||||
SWIGTYPE &&,
|
||||
SWIGTYPE [],
|
||||
SWIGTYPE (CLASS::*)
|
||||
""
|
||||
|
||||
/* Exception handling */
|
||||
|
||||
%typemap(throws) int,
|
||||
long,
|
||||
short,
|
||||
unsigned int,
|
||||
unsigned long,
|
||||
unsigned short {
|
||||
char error_msg[256];
|
||||
sprintf(error_msg, "C++ $1_type exception thrown, value: %d", $1);
|
||||
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, error_msg);
|
||||
RETURN $null;
|
||||
}
|
||||
|
||||
%typemap(throws) SWIGTYPE {
|
||||
(void)$1;
|
||||
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ $1_type exception thrown");
|
||||
RETURN $null;
|
||||
}
|
||||
|
||||
%typemap(throws) char * {
|
||||
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1);
|
||||
RETURN $null;
|
||||
}
|
||||
|
||||
|
||||
/* Typemaps for code generation in proxy classes and C# type wrapper classes */
|
||||
|
||||
/* The in typemap is used for converting function parameter types from the type
|
||||
* used in the proxy, module or type wrapper class to the type used in the PInvoke class. */
|
||||
%typemap(m3in) bool, const bool &,
|
||||
char, const char &,
|
||||
signed char, const signed char &,
|
||||
unsigned char, const unsigned char &,
|
||||
short, const short &,
|
||||
unsigned short, const unsigned short &,
|
||||
int, const int &,
|
||||
unsigned int, const unsigned int &,
|
||||
long, const long &,
|
||||
unsigned long, const unsigned long &,
|
||||
long long, const long long &,
|
||||
unsigned long long, const unsigned long long &,
|
||||
float, const float &,
|
||||
double, const double &,
|
||||
char *,
|
||||
char[ANY],
|
||||
enum SWIGTYPE
|
||||
"$input"
|
||||
%typemap(m3in) SWIGTYPE "$&*1_type.getCPtr($input)"
|
||||
%typemap(m3in) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "$1_basetype.getCPtr($input)"
|
||||
|
||||
/* The m3out typemap is used for converting function return types from the return type
|
||||
* used in the PInvoke class to the type returned by the proxy, module or type wrapper class. */
|
||||
%typemap(m3out) bool, const bool &,
|
||||
char, const char &,
|
||||
signed char, const signed char &,
|
||||
unsigned char, const unsigned char &,
|
||||
short, const short &,
|
||||
unsigned short, const unsigned short &,
|
||||
int, const int &,
|
||||
unsigned int, const unsigned int &,
|
||||
long, const long &,
|
||||
unsigned long, const unsigned long &,
|
||||
long long, const long long &,
|
||||
unsigned long long, const unsigned long long &,
|
||||
float, const float &,
|
||||
double, const double &,
|
||||
char *,
|
||||
char[ANY],
|
||||
enum SWIGTYPE
|
||||
%{$imcall%}
|
||||
|
||||
%typemap(m3out) void %{$imcall%}
|
||||
|
||||
%typemap(m3out) SWIGTYPE %{
|
||||
RETURN NEW(REF $1_basetype, $imcall);
|
||||
%}
|
||||
%typemap(m3out) SWIGTYPE & %{
|
||||
RETURN NEW($1_basetype, $imcall, $owner);
|
||||
%}
|
||||
%typemap(m3out) SWIGTYPE && %{
|
||||
RETURN NEW($1_basetype, $imcall, $owner);
|
||||
%}
|
||||
%typemap(m3out) SWIGTYPE *, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
|
||||
cPtr := $imcall;
|
||||
RETURN (cPtr = IntPtr.Zero) ? null : NEW($1_basetype, cPtr, $owner);
|
||||
%}
|
||||
|
||||
/* Properties */
|
||||
%typemap(m3varin) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
|
||||
PROCEDURE Set$var (value: $vartype) =
|
||||
BEGIN
|
||||
$imcall;
|
||||
END Set$var;
|
||||
%}
|
||||
|
||||
%typemap(m3varout) bool, const bool &,
|
||||
char, const char &,
|
||||
signed char, const signed char &,
|
||||
unsigned char, const unsigned char &,
|
||||
short, const short &,
|
||||
unsigned short, const unsigned short &,
|
||||
int, const int &,
|
||||
unsigned int, const unsigned int &,
|
||||
long, const long &,
|
||||
unsigned long, const unsigned long &,
|
||||
long long, const long long &,
|
||||
unsigned long long, const unsigned long long &,
|
||||
float, const float &,
|
||||
double, const double &,
|
||||
char *,
|
||||
char[ANY],
|
||||
enum SWIGTYPE %{
|
||||
PROCEDURE Get$var (): $vartype =
|
||||
BEGIN
|
||||
RETURN $imcall;
|
||||
END Get$var;
|
||||
%}
|
||||
|
||||
%typemap(m3varout) void %{
|
||||
get {
|
||||
$imcall;
|
||||
} %}
|
||||
%typemap(m3varout) SWIGTYPE %{
|
||||
get {
|
||||
RETURN new $&*1_mangle($imcall, true);
|
||||
} %}
|
||||
%typemap(m3varout) SWIGTYPE & %{
|
||||
get {
|
||||
RETURN new $1_basetype($imcall, $owner);
|
||||
} %}
|
||||
%typemap(m3varout) SWIGTYPE && %{
|
||||
get {
|
||||
RETURN new $1_basetype($imcall, $owner);
|
||||
} %}
|
||||
%typemap(m3varout) SWIGTYPE *, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
|
||||
get {
|
||||
IntPtr cPtr = $imcall;
|
||||
RETURN (cPtr == IntPtr.Zero) ? null : new $1_basetype(cPtr, $owner);
|
||||
} %}
|
||||
|
||||
/* Typemaps used for the generation of proxy and type wrapper class code */
|
||||
%typemap(m3base) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(m3classmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "public"
|
||||
%typemap(m3code) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(m3imports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "using System;"
|
||||
%typemap(m3interfaces) SWIGTYPE "IDisposable"
|
||||
%typemap(m3interfaces_derived) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(m3ptrconstructormodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "internal"
|
||||
|
||||
%typemap(m3finalize) SWIGTYPE %{
|
||||
~$1_basetype() {
|
||||
Dispose();
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap(m3destruct, methodname="Dispose") SWIGTYPE {
|
||||
if(swigCPtr != IntPtr.Zero && swigCMemOwn) {
|
||||
$imcall;
|
||||
swigCMemOwn = false;
|
||||
}
|
||||
swigCPtr = IntPtr.Zero;
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
%typemap(m3destruct_derived, methodname="Dispose") SWIGTYPE {
|
||||
if(swigCPtr != IntPtr.Zero && swigCMemOwn) {
|
||||
$imcall;
|
||||
swigCMemOwn = false;
|
||||
}
|
||||
swigCPtr = IntPtr.Zero;
|
||||
GC.SuppressFinalize(this);
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
%typemap(m3getcptr) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
|
||||
internal static IntPtr getCPtr($1_basetype obj) {
|
||||
RETURN (obj == null) ? IntPtr.Zero : obj.swigCPtr;
|
||||
}
|
||||
%}
|
||||
|
||||
/* M3 specific directives */
|
||||
#define %m3multiretval %feature("modula3:multiretval")
|
||||
#define %constnumeric(num) %feature("constnumeric","num")
|
||||
|
||||
%pragma(modula3) moduleimports=%{
|
||||
IMPORT BlaBla;
|
||||
%}
|
||||
|
||||
%pragma(modula3) imclassimports=%{
|
||||
FROM BlaBla IMPORT Bla;
|
||||
%}
|
||||
|
||||
/* Some ANSI C typemaps */
|
||||
|
||||
%apply unsigned long { size_t };
|
||||
|
||||
/* Array reference typemaps */
|
||||
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
|
||||
%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) }
|
||||
|
||||
/* const pointers */
|
||||
%apply SWIGTYPE * { SWIGTYPE *const }
|
||||
%apply SWIGTYPE (CLASS::*) { SWIGTYPE (CLASS::*const) }
|
||||
%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
|
||||
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* modula3head.swg
|
||||
*
|
||||
* Modula3 support code
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%insert(runtime) %{
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
%}
|
||||
|
||||
#if 0
|
||||
%insert(runtime) %{
|
||||
/* Support for throwing Modula3 exceptions */
|
||||
typedef enum {
|
||||
SWIG_JavaOutOfMemoryError = 1,
|
||||
SWIG_JavaIOException,
|
||||
SWIG_JavaRuntimeException,
|
||||
SWIG_JavaIndexOutOfBoundsException,
|
||||
SWIG_JavaArithmeticException,
|
||||
SWIG_JavaIllegalArgumentException,
|
||||
SWIG_JavaNullPointerException,
|
||||
SWIG_JavaUnknownError
|
||||
} SWIG_JavaExceptionCodes;
|
||||
|
||||
typedef struct {
|
||||
SWIG_JavaExceptionCodes code;
|
||||
const char *java_exception;
|
||||
} SWIG_JavaExceptions_t;
|
||||
|
||||
#if defined(SWIG_NOINCLUDE)
|
||||
void SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg);
|
||||
#else
|
||||
%}
|
||||
%insert(runtime) {
|
||||
void SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg) {
|
||||
jclass excep;
|
||||
static const SWIG_JavaExceptions_t java_exceptions[] = {
|
||||
{ SWIG_JavaOutOfMemoryError, "java/lang/OutOfMemoryError" },
|
||||
{ SWIG_JavaIOException, "java/io/IOException" },
|
||||
{ SWIG_JavaRuntimeException, "java/lang/RuntimeException" },
|
||||
{ SWIG_JavaIndexOutOfBoundsException, "java/lang/IndexOutOfBoundsException" },
|
||||
{ SWIG_JavaArithmeticException, "java/lang/ArithmeticException" },
|
||||
{ SWIG_JavaIllegalArgumentException, "java/lang/IllegalArgumentException" },
|
||||
{ SWIG_JavaNullPointerException, "java/lang/NullPointerException" },
|
||||
{ SWIG_JavaUnknownError, "java/lang/UnknownError" },
|
||||
{ (SWIG_JavaExceptionCodes)0, "java/lang/UnknownError" } };
|
||||
const SWIG_JavaExceptions_t *except_ptr = java_exceptions;
|
||||
|
||||
while (except_ptr->code != code && except_ptr->code)
|
||||
except_ptr++;
|
||||
|
||||
JCALL0(ExceptionClear, jenv);
|
||||
excep = JCALL1(FindClass, jenv, except_ptr->java_exception);
|
||||
if (excep)
|
||||
JCALL2(ThrowNew, jenv, excep, msg);
|
||||
}
|
||||
}
|
||||
%insert(runtime) %{
|
||||
#endif
|
||||
%}
|
||||
#endif
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* typemaps.i
|
||||
*
|
||||
* Pointer and reference handling typemap library
|
||||
*
|
||||
* These mappings provide support for input/output arguments and common
|
||||
* uses for C/C++ pointers and C++ references.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* These typemaps will eventually probably maybe make their way into named typemaps
|
||||
* OUTPUT * and OUTPUT & as they currently break functions that return a pointer or
|
||||
* reference. */
|
||||
|
||||
%typemap(ctype) bool *, bool & "bool *"
|
||||
%typemap(ctype) char & "char *"
|
||||
%typemap(ctype) signed char *, signed char & "signed char *"
|
||||
%typemap(ctype) unsigned char *, unsigned char & "unsigned short *"
|
||||
%typemap(ctype) short *, short & "short *"
|
||||
%typemap(ctype) unsigned short *, unsigned short & "unsigned short *"
|
||||
%typemap(ctype) int *, int & "int *"
|
||||
%typemap(ctype) unsigned int *, unsigned int & "unsigned int *"
|
||||
%typemap(ctype) long *, long & "long *"
|
||||
%typemap(ctype) unsigned long *, unsigned long & "unsigned long *"
|
||||
%typemap(ctype) long long *, long long & "long long *"
|
||||
%typemap(ctype) unsigned long long *, unsigned long long & "unsigned long long *"
|
||||
%typemap(ctype) float *, float & "float *"
|
||||
%typemap(ctype) double *, double & "double *"
|
||||
|
||||
%typemap(imtype) bool *, bool & "ref bool"
|
||||
%typemap(imtype) char & "ref char"
|
||||
%typemap(imtype) signed char *, signed char & "ref sbyte"
|
||||
%typemap(imtype) unsigned char *, unsigned char & "ref byte"
|
||||
%typemap(imtype) short *, short & "ref short"
|
||||
%typemap(imtype) unsigned short *, unsigned short & "ref ushort"
|
||||
%typemap(imtype) int *, int & "ref int"
|
||||
%typemap(imtype) unsigned int *, unsigned int & "ref uint"
|
||||
%typemap(imtype) long *, long & "ref int"
|
||||
%typemap(imtype) unsigned long *, unsigned long & "ref uint"
|
||||
%typemap(imtype) long long *, long long & "ref long"
|
||||
%typemap(imtype) unsigned long long *, unsigned long long & "ref ulong"
|
||||
%typemap(imtype) float *, float & "ref float"
|
||||
%typemap(imtype) double *, double & "ref double"
|
||||
|
||||
%typemap(cstype) bool *, bool & "ref bool"
|
||||
%typemap(cstype) char & "ref char"
|
||||
%typemap(cstype) signed char *, signed char & "ref sbyte"
|
||||
%typemap(cstype) unsigned char *, unsigned char & "ref byte"
|
||||
%typemap(cstype) short *, short & "ref short"
|
||||
%typemap(cstype) unsigned short *, unsigned short & "ref ushort"
|
||||
%typemap(cstype) int *, int & "ref int"
|
||||
%typemap(cstype) unsigned int *, unsigned int & "ref uint"
|
||||
%typemap(cstype) long *, long & "ref int"
|
||||
%typemap(cstype) unsigned long *, unsigned long & "ref uint"
|
||||
%typemap(cstype) long long *, long long & "ref long"
|
||||
%typemap(cstype) unsigned long long *, unsigned long long & "ref ulong"
|
||||
%typemap(cstype) float *, float & "ref float"
|
||||
%typemap(cstype) double *, double & "ref double"
|
||||
|
||||
%typemap(csin) bool *, bool &,
|
||||
char &,
|
||||
signed char *, signed char &,
|
||||
unsigned char *, unsigned char &,
|
||||
short *, short &,
|
||||
unsigned short *, unsigned short &,
|
||||
int *, int &,
|
||||
unsigned int *, unsigned int &,
|
||||
long *, long &,
|
||||
unsigned long *, unsigned long &,
|
||||
long long *, long long &,
|
||||
unsigned long long *, unsigned long long &,
|
||||
float *, float &,
|
||||
double *, double &
|
||||
"ref $csinput"
|
||||
|
||||
|
|
@ -302,19 +302,7 @@
|
|||
|
||||
/* please leave 830-849 free for C# */
|
||||
|
||||
#define WARN_MODULA3_TYPEMAP_TYPE_UNDEF 850
|
||||
#define WARN_MODULA3_TYPEMAP_GETCPTR_UNDEF 851
|
||||
#define WARN_MODULA3_TYPEMAP_CLASSMOD_UNDEF 852
|
||||
#define WARN_MODULA3_TYPEMAP_PTRCONSTMOD_UNDEF 853
|
||||
#define WARN_MODULA3_TYPEMAP_MULTIPLE_RETURN 854
|
||||
#define WARN_MODULA3_MULTIPLE_INHERITANCE 855
|
||||
#define WARN_MODULA3_TYPECONSTRUCTOR_UNKNOWN 856
|
||||
#define WARN_MODULA3_UNKNOWN_PRAGMA 857
|
||||
#define WARN_MODULA3_BAD_ENUMERATION 858
|
||||
#define WARN_MODULA3_DOUBLE_ID 859
|
||||
#define WARN_MODULA3_BAD_IMPORT 860
|
||||
|
||||
/* please leave 850-869 free for Modula 3 */
|
||||
/* 850-860 were used by Modula 3 (removed in SWIG 4.1.0) - avoid reusing for now */
|
||||
|
||||
#define WARN_PHP_MULTIPLE_INHERITANCE 870
|
||||
#define WARN_PHP_UNKNOWN_PRAGMA 871
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue