Skip to content

Commit

Permalink
Merge branch 'master' into doxygen
Browse files Browse the repository at this point in the history
  • Loading branch information
ojwb committed Mar 28, 2015
2 parents 6a892b3 + dba8d4a commit 2289f74
Show file tree
Hide file tree
Showing 31 changed files with 336 additions and 381 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ matrix:
# Not quite working yet
- compiler: gcc
env: SWIGLANG=python SWIG_FEATURES=-classic
# Lots of failing tests currently
- compiler: gcc
env: SWIGLANG=ocaml
before_install:
- date -u
- uname -a
Expand All @@ -80,6 +83,8 @@ before_install:
- if test "$SWIGLANG" = "javascript" -a "$ENGINE" = "v8"; then sudo apt-get install -qq libv8-dev; fi
- if test "$SWIGLANG" = "guile"; then sudo apt-get -qq install guile-2.0-dev; fi
- if test "$SWIGLANG" = "lua"; then sudo apt-get -qq install lua5.1 liblua5.1-dev; fi
# configure also looks for ocamldlgen, but this isn't packaged. But it isn't used by default so this doesn't matter.
- if test "$SWIGLANG" = "ocaml"; then sudo apt-get -qq install ocaml ocaml-findlib; fi
- if test "$SWIGLANG" = "octave" -a -z "$VER"; then sudo apt-get -qq install octave3.2 octave3.2-headers; fi
- if test "$SWIGLANG" = "octave" -a "$VER"; then sudo add-apt-repository -y ppa:kwwette/octaves && sudo apt-get -qq update && sudo apt-get -qq install liboctave${VER}-dev; fi
- if test "$SWIGLANG" = "php"; then sudo apt-get install php5-cli php5-dev; fi
Expand Down
6 changes: 3 additions & 3 deletions Doc/Manual/Javascript.html
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,10 @@ <H3><a name="Javascript_node_extensions"></a>26.3.1 Creating node.js Extensions<
<pre>
$ swig -javascript -node -c++ example.i</pre>
</div>
<p>Then run <code>node-gyp</code></p>
<p>Then run <code>node-gyp build</code> to actually create the module:</p>
<div class="shell">
<pre>
$ node-gyp</pre>
$ node-gyp build</pre>
</div>
<p>This will create a <code>build</code> folder containing the native module. To use the extension you need to 'require' it in your Javascript source file:</p>
<div class="code">
Expand Down Expand Up @@ -410,7 +410,7 @@ <H3><a name="Javascript_applications_webkit"></a>26.3.3 Creating Applications wi
};</pre>
</div>

<H2><a name="Javascript_nn14"></a>26.4 Examples</H2>
<H2><a id="Javascript_examples" name="Javascript_nn14"></a>26.4 Examples</H2>


<p>Some basic examples are shown here in more detail.</p>
Expand Down
2 changes: 1 addition & 1 deletion Doc/Manual/Lua.html
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ <H3><a name="Lua_nn17"></a>28.3.10 C++ overloaded functions</H3>
<p>
or
</p>
<DIV CLASS="CODE"><PRE>VOID FOO(bAR *B);
<div class="code"><pre>void foo(Bar *b);
void foo(Bar &amp;b);
</pre></div>
<p>
Expand Down
316 changes: 159 additions & 157 deletions Doc/Manual/Ocaml.html

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Doc/Manual/Python.html
Original file line number Diff line number Diff line change
Expand Up @@ -3404,7 +3404,7 @@ <H3><a name="Python_nn42"></a>36.6.2 Adding additional Python code</H3>
class Foo {
public:
int bar(int x);
}
};
</pre>
</div>

Expand Down Expand Up @@ -3441,7 +3441,7 @@ <H3><a name="Python_nn42"></a>36.6.2 Adding additional Python code</H3>
class Foo {
public:
int bar(int x);
}
};
</pre>
</div>

Expand Down Expand Up @@ -3470,7 +3470,7 @@ <H3><a name="Python_nn42"></a>36.6.2 Adding additional Python code</H3>
class Foo {
public:
int bar(int x);
}
};
</pre>
</div>

Expand Down Expand Up @@ -3500,7 +3500,7 @@ <H3><a name="Python_nn42"></a>36.6.2 Adding additional Python code</H3>
public:
int bar(int x);
int bar();
}
};
</pre>
</div>

Expand Down
6 changes: 3 additions & 3 deletions Doc/Manual/Scilab.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ <H1><a name="Scilab"></a>39 SWIG and Scilab</H1>
<li><a href="#Scilab_wrapping_pointers_null_pointers">Null pointers</a>
</ul>
<li><a href="#Scilab_wrapping_structs">Structures</a>
<li><a href="#Scilab_wrapping_cpp_classes">C++ Classes</a>
<li><a href="#Scilab_wrapping_cpp_classes">C++ classes</a>
<li><a href="#Scilab_wrapping_cpp_inheritance">C++ inheritance</a>
<li><a href="#Scilab_wrapping_pointers_references_values_arrays">Pointers, references, values, and arrays</a>
<li><a href="#Scilab_wrapping_cpp_templates">C++ templates</a>
Expand Down Expand Up @@ -931,7 +931,7 @@ <H3><a name="Scilab_wrapping_structs"></a>39.3.7 Structures</H3>
</pre></div>


<H3><a name="Scilab_wrapping_cpp_classes"></a>39.3.8 C++ Classes</H3>
<H3><a name="Scilab_wrapping_cpp_classes"></a>39.3.8 C++ classes</H3>


<p>
Expand Down Expand Up @@ -1365,7 +1365,7 @@ <H3><a name="Scilab_wrapping_cpp_exceptions"></a>39.3.14 C++ exceptions</H3>
}

void throw_stl_invalid_arg(int i) throw(std::invalid_argument) {
if (i &amp;lt 0)
if (i &lt; 0)
throw std::invalid_argument("argument is negative.");
}
%}
Expand Down
6 changes: 3 additions & 3 deletions Examples/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ OCAMLFIND=@OCAMLFIND@
OCAMLMKTOP=@OCAMLMKTOP@ $(SWIGWHERE)
NOLINK ?= false
OCAMLPP= -pp "camlp4o ./swigp4.cmo"
OCAMLP4WHERE=`$(COMPILETOOL) camlp4 -where`
OCAMLP4WHERE=`$(COMPILETOOL) @CAMLP4@ -where`
OCAMLCORE=\
rm -rf swig.mli swig.ml swigp4.ml && \
$(SWIG) -ocaml -co swig.mli 2>/dev/null && \
Expand Down Expand Up @@ -1710,7 +1710,7 @@ SCILAB_LIBPREFIX = lib

scilab:
$(SWIG) -scilab $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
$(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SCILAB_INC) $(INCLUDES) $(ISRCS) $(SRCDIR_SRCS) $(SRCDIR_CSRCS)
$(CC) -g -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SCILAB_INC) $(INCLUDES) $(ISRCS) $(SRCDIR_SRCS) $(SRCDIR_CSRCS)
$(LDSHARED) $(CFLAGS) $(LDFLAGS) $(IOBJS) $(OBJS) $(LIBS) -o $(SCILAB_LIBPREFIX)$(TARGET)$(SO)

# ----------------------------------------------------------------
Expand All @@ -1719,7 +1719,7 @@ scilab:

scilab_cpp:
$(SWIG) -c++ -scilab $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
$(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(SCILAB_INC) $(INCLUDES) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS)
$(CXX) -g -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(SCILAB_INC) $(INCLUDES) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS)
$(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(IOBJS) $(OBJS) $(LIBS) $(CPP_DLLIBS) -o $(SCILAB_LIBPREFIX)$(TARGET)$(SO)

# -----------------------------------------------------------------
Expand Down
5 changes: 5 additions & 0 deletions Examples/test-suite/errors/pp_unknowndirective.i
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
%module xxx

/* Regression test for bug introduced in 3.0.4 and fixed in 3.0.6 - the '%std'
* here led to SWIG calling abort().
*/
%typemap(jstype) std::vector<std::string>, const %std::vector<std::string>&, std::vector<std::string>& "List<String>"

/* This used to give the rather cryptic "Syntax error in input(1)." prior to
* SWIG 3.0.4. This testcase checks that the improved message is actually
* issued.
Expand Down
2 changes: 1 addition & 1 deletion Examples/test-suite/errors/pp_unknowndirective.stderr
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pp_unknowndirective.i:7: Error: Unknown directive '%remane'.
pp_unknowndirective.i:12: Error: Unknown directive '%remane'.
17 changes: 5 additions & 12 deletions Examples/test-suite/ocaml/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#######################################################################

LANGUAGE = ocaml
OCAMLC = ocamlc
OCAMLC = @OCAMLC@
VARIANT = _static
SCRIPTSUFFIX = _runme.ml

Expand All @@ -25,18 +25,11 @@ run_testcase = \
fi ;

check_quant:
cat /dev/null > testing
cat /dev/null > success
cat /dev/null > results
: > testing
: > success
$(MAKE) check
echo "Failed:" >> results
for element in `cat testing` ; do \
if grep $$element success >/dev/null 2>/dev/null ; then \
: ; \
else \
echo $$element >> results ; \
fi ; \
done
echo "Failed:" > results
diff testing success | sed 's/^< //p;d' >> results
echo "Success:" >> results
cat success >> results

Expand Down
4 changes: 1 addition & 3 deletions Lib/ocaml/ocamldec.swg
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ CAMLextern int64 Int64_val(caml_value_t v);
SWIGSTATIC CAML_VALUE caml_array_new( int n );
SWIGSTATIC void caml_array_set( CAML_VALUE arr, int n, CAML_VALUE item );
SWIGSTATIC CAML_VALUE caml_array_nth( CAML_VALUE arr, int n );
SWIGSTATIC int caml_array_length( CAML_VALUE arr );
SWIGSTATIC int caml_array_len( CAML_VALUE arr );

SWIGSTATIC CAML_VALUE caml_val_char( char c );
SWIGSTATIC CAML_VALUE caml_val_uchar( unsigned char c );
Expand Down Expand Up @@ -165,5 +165,3 @@ CAMLextern int64 Int64_val(caml_value_t v);
#ifdef __cplusplus
}
#endif

/* mzschemedec.swg ends here */
2 changes: 1 addition & 1 deletion Lib/python/pyabc.i
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%define %pythonabc(Type, Abc)
%feature("python:abc", #Abc) Type;
%enddef
%pythoncode {import collections};
%pythoncode %{import collections%}
%pythonabc(std::vector, collections.MutableSequence);
%pythonabc(std::list, collections.MutableSequence);
%pythonabc(std::map, collections.MutableMapping);
Expand Down
4 changes: 2 additions & 2 deletions Lib/python/pycontainer.swg
Original file line number Diff line number Diff line change
Expand Up @@ -710,8 +710,8 @@ namespace swig
#if defined(SWIGPYTHON_BUILTIN)
%feature("python:slot", "tp_iter", functype="getiterfunc") iterator;
#else
%pythoncode {def __iter__(self):
return self.iterator()}
%pythoncode %{def __iter__(self):
return self.iterator()%}
#endif
}

Expand Down
4 changes: 2 additions & 2 deletions Lib/python/pyiterators.swg
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,8 @@ namespace swig
%feature("python:slot", "tp_iternext", functype="iternextfunc") SwigPyIterator::__next__;
#else
%extend SwigPyIterator {
%pythoncode {def __iter__(self):
return self}
%pythoncode %{def __iter__(self):
return self%}
}
#endif

Expand Down
16 changes: 8 additions & 8 deletions Lib/python/std_map.i
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,14 @@

#else
%extend {
%pythoncode {def __iter__(self):
return self.key_iterator()}
%pythoncode {def iterkeys(self):
return self.key_iterator()}
%pythoncode {def itervalues(self):
return self.value_iterator()}
%pythoncode {def iteritems(self):
return self.iterator()}
%pythoncode %{def __iter__(self):
return self.key_iterator()%}
%pythoncode %{def iterkeys(self):
return self.key_iterator()%}
%pythoncode %{def itervalues(self):
return self.value_iterator()%}
%pythoncode %{def iteritems(self):
return self.iterator()%}
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions Lib/python/std_pair.i
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ SwigPython_std_pair_setitem (PyObject *a, Py_ssize_t b, PyObject *c)
%define %swig_pair_methods(pair...)
#if !defined(SWIGPYTHON_BUILTIN)
%extend {
%pythoncode {def __len__(self):
%pythoncode %{def __len__(self):
return 2
def __repr__(self):
return str((self.first, self.second))
Expand All @@ -189,7 +189,7 @@ def __setitem__(self, index, val):
if not (index % 2):
self.first = val
else:
self.second = val}
self.second = val%}
}
#endif
%enddef
Expand Down
16 changes: 8 additions & 8 deletions Lib/python/std_unordered_map.i
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,14 @@
return swig::make_output_value_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
}

%pythoncode {def __iter__(self):
return self.key_iterator()}
%pythoncode {def iterkeys(self):
return self.key_iterator()}
%pythoncode {def itervalues(self):
return self.value_iterator()}
%pythoncode {def iteritems(self):
return self.iterator()}
%pythoncode %{def __iter__(self):
return self.key_iterator()%}
%pythoncode %{def iterkeys(self):
return self.key_iterator()%}
%pythoncode %{def itervalues(self):
return self.value_iterator()%}
%pythoncode %{def iteritems(self):
return self.iterator()%}
}
%enddef

Expand Down
33 changes: 26 additions & 7 deletions Lib/scilab/scichar.swg
Original file line number Diff line number Diff line change
Expand Up @@ -117,31 +117,50 @@ SWIGINTERN int
SWIG_SciString_AsCharPtrAndSize(void *pvApiCtx, int iVar, char **pcValue, size_t *piLength, int *alloc, char *fname) {
SciErr sciErr;
int *piAddrVar = NULL;
int iRet;
char *pstStrings = NULL;
char *pstString = NULL;
int iRows = 0;
int iCols = 0;
int iLen = 0;

sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar);
if (sciErr.iErr) {
printError(&sciErr, 0);
return SWIG_ERROR;
}

iRet = getAllocatedSingleString(pvApiCtx, piAddrVar, &pstStrings);
if (iRet) {
return SWIG_ERROR;
if (isScalar(pvApiCtx, piAddrVar) == 0 || isStringType(pvApiCtx, piAddrVar) == 0)
{
Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A single string expected.\n"), fname, iVar);
return SWIG_TypeError;
}

sciErr = getMatrixOfString(pvApiCtx, piAddrVar, &iRows, &iCols, &iLen, NULL);
if (sciErr.iErr)
{
printError(&sciErr, 0);
return SWIG_ERROR;
}

pstString = %new_array(iLen + 1, char);

sciErr = getMatrixOfString(pvApiCtx, piAddrVar, &iRows, &iCols, &iLen, &pstString);
if (sciErr.iErr)
{
printError(&sciErr, 0);
return SWIG_ERROR;
}

// TODO: return SWIG_ERROR if pcValue NULL (now returning SWIG_ERROR fails some typechecks)
if (pcValue) {
*pcValue = pstStrings;
*pcValue = pstString;
}

if (alloc != NULL) {
*alloc = SWIG_NEWOBJ;
}

if (piLength != NULL) {
*piLength = strlen(*pcValue);
*piLength = strlen(pstString);
}

return SWIG_OK;
Expand Down
9 changes: 9 additions & 0 deletions Lib/swiglabels.swg
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,12 @@
#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
#endif

/* Intel's compiler complains if a variable which was never initialised is
* cast to void, which is a common idiom which we use to indicate that we
* are aware a variable isn't used. So we just silence that warning.
* See: https://github.com/swig/swig/issues/192 for more discussion.
*/
#ifdef __INTEL_COMPILER
# pragma warning disable 592
#endif
2 changes: 1 addition & 1 deletion RELEASENOTES
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ SWIG-1.3.22 summary:
exceptions into target language exceptions.
- Improved enum support, mapping to built-in Java 1.5 enums and C#
enums or the typesafe enum pattern for these two languages.
- Python - much better STL suppport and support for std::wstring,
- Python - much better STL support and support for std::wstring,
wchar_t and FILE *.
- Initial support for Modula3 and Allegro CL.
- 64 bit TCL support.
Expand Down
2 changes: 1 addition & 1 deletion Source/CParse/cscanner.c
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ int yylex(void) {
return (WARN);

/* Note down the apparently unknown directive for error reporting. */
cparse_unknown_directive = Swig_copy_string(yytext);
cparse_unknown_directive = NewString(yytext);
}
/* Have an unknown identifier, as a last step, we'll do a typedef lookup on it. */

Expand Down
2 changes: 1 addition & 1 deletion Source/Modules/csharp.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1642,7 +1642,7 @@ class CSHARP:public Language {
String *proxyclassname = Getattr(n, "classtypeobj");
String *baseclassname = Getattr(base.item, "name");
Swig_warning(WARN_CSHARP_MULTIPLE_INHERITANCE, Getfile(n), Getline(n),
"Warning for %s proxy: Base %s ignored. Multiple inheritance is not supported in Java.\n", SwigType_namestr(proxyclassname), SwigType_namestr(baseclassname));
"Warning for %s proxy: Base %s ignored. Multiple inheritance is not supported in C#.\n", SwigType_namestr(proxyclassname), SwigType_namestr(baseclassname));
base = Next(base);
}
}
Expand Down
Loading

0 comments on commit 2289f74

Please sign in to comment.