Merge branch 'master' into directorargout_and_java_typemaps
This commit is contained in:
commit
c7adb7901d
68 changed files with 568 additions and 462 deletions
|
|
@ -130,6 +130,7 @@ static void failed(void)
|
|||
exit(1);
|
||||
}
|
||||
args_add_prefix(orig_args, p);
|
||||
free(p);
|
||||
}
|
||||
|
||||
if (ccache_verbose) {
|
||||
|
|
@ -490,7 +491,9 @@ static void find_hash(ARGS *args)
|
|||
/* also include the hash of the compiler name - as some compilers
|
||||
use hard links and behave differently depending on the real name */
|
||||
if (st.st_nlink > 1) {
|
||||
hash_string(str_basename(args->argv[0]));
|
||||
char *path = str_basename(args->argv[0]);
|
||||
hash_string(path);
|
||||
free(path);
|
||||
}
|
||||
|
||||
hash_int(st.st_size);
|
||||
|
|
@ -523,6 +526,7 @@ static void find_hash(ARGS *args)
|
|||
input_base, tmp_string(),
|
||||
i_extension);
|
||||
x_asprintf(&path_stderr, "%s/tmp.cpp_stderr.%s", temp_dir, tmp_string());
|
||||
free(input_base);
|
||||
|
||||
if (!direct_i_file) {
|
||||
/* run cpp on the input file to obtain the .i */
|
||||
|
|
@ -781,6 +785,7 @@ static void find_compiler(int argc, char **argv)
|
|||
|
||||
/* support user override of the compiler */
|
||||
if ((path=getenv("CCACHE_CC"))) {
|
||||
free(base);
|
||||
base = x_strdup(path);
|
||||
}
|
||||
|
||||
|
|
@ -791,8 +796,10 @@ static void find_compiler(int argc, char **argv)
|
|||
stats_update(STATS_COMPILER);
|
||||
cc_log("could not find compiler (%s)\n", base);
|
||||
perror(base);
|
||||
free(base);
|
||||
exit(1);
|
||||
}
|
||||
free(base);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1076,6 +1083,7 @@ static void process_args(int argc, char **argv)
|
|||
if (strlen(p) < 2) {
|
||||
cc_log("badly formed dependency file %s\n", output_file);
|
||||
stats_update(STATS_ARGS);
|
||||
free(default_depfile_name);
|
||||
failed();
|
||||
return;
|
||||
}
|
||||
|
|
@ -1093,6 +1101,7 @@ static void process_args(int argc, char **argv)
|
|||
strcat(default_depfile_name, ".d");
|
||||
args_add(stripped_args, "-MF");
|
||||
args_add(stripped_args, default_depfile_name);
|
||||
free(default_depfile_name);
|
||||
}
|
||||
|
||||
if (!dependency_target_specified) {
|
||||
|
|
@ -1117,6 +1126,7 @@ static void process_args(int argc, char **argv)
|
|||
exit(1);
|
||||
}
|
||||
args_add_prefix(stripped_args, p);
|
||||
free(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1305,6 +1315,7 @@ static void setup_uncached_err(void)
|
|||
|
||||
if (putenv(buf) == -1) {
|
||||
cc_log("putenv failed\n");
|
||||
close(uncached_fd);
|
||||
stats_update(STATS_ERROR);
|
||||
failed();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -267,6 +267,7 @@ char *find_executable(const char *name, const char *exclude_name)
|
|||
}
|
||||
free(fname);
|
||||
}
|
||||
free(path);
|
||||
|
||||
return NULL;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -138,7 +138,10 @@ static void stats_update_size(enum stats stat, size_t size, size_t numfiles)
|
|||
|
||||
memset(counters, 0, sizeof(counters));
|
||||
|
||||
if (lock_fd(fd) != 0) return;
|
||||
if (lock_fd(fd) != 0) {
|
||||
close(fd);
|
||||
return;
|
||||
}
|
||||
|
||||
/* read in the old stats */
|
||||
stats_read_fd(fd, counters);
|
||||
|
|
|
|||
|
|
@ -281,6 +281,7 @@ int unify_hash(const char *fname)
|
|||
fd = open(fname, O_RDONLY|O_BINARY);
|
||||
if (fd == -1 || fstat(fd, &st) != 0) {
|
||||
cc_log("Failed to open preprocessor output %s\n", fname);
|
||||
if (fd != -1) close(fd);
|
||||
stats_update(STATS_PREPROCESSOR);
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -289,12 +290,12 @@ int unify_hash(const char *fname)
|
|||
lines in preprocessor output. I have seen lines of over
|
||||
100k in length, so this is well worth it */
|
||||
map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||
close(fd);
|
||||
if (map == (char *)-1) {
|
||||
cc_log("Failed to mmap %s\n", fname);
|
||||
stats_update(STATS_PREPROCESSOR);
|
||||
return -1;
|
||||
}
|
||||
close(fd);
|
||||
|
||||
/* pass it through the unifier */
|
||||
unify((unsigned char *)map, st.st_size);
|
||||
|
|
|
|||
|
|
@ -189,9 +189,11 @@ void copy_fd(int fd_in, int fd_out) {
|
|||
|
||||
while ((n = gzread(gz_in, buf, sizeof(buf))) > 0) {
|
||||
if (write(fd_out, buf, n) != n) {
|
||||
gzclose(gz_in);
|
||||
fatal("Failed to copy fd");
|
||||
}
|
||||
}
|
||||
gzclose(gz_in);
|
||||
}
|
||||
|
||||
static int _copy_file(const char *src, const char *dest, int mode) {
|
||||
|
|
@ -248,9 +250,11 @@ static int _copy_file(const char *src, const char *dest, int mode) {
|
|||
}
|
||||
|
||||
if (mode == COPY_TO_CACHE) {
|
||||
gz_out = gzdopen(dup(fd_out), "wb");
|
||||
int dup_fd_out = dup(fd_out);
|
||||
gz_out = gzdopen(dup_fd_out, "wb");
|
||||
if (!gz_out) {
|
||||
gzclose(gz_in);
|
||||
close(dup_fd_out);
|
||||
close(fd_out);
|
||||
free(tmp_name);
|
||||
return -1;
|
||||
|
|
@ -459,6 +463,7 @@ int create_cachedirtag(const char *dir)
|
|||
f = fopen(filename, "w");
|
||||
if (!f) goto error;
|
||||
if (fwrite(CACHEDIR_TAG, sizeof(CACHEDIR_TAG)-1, 1, f) != 1) {
|
||||
fclose(f);
|
||||
goto error;
|
||||
}
|
||||
if (fclose(f)) goto error;
|
||||
|
|
@ -485,7 +490,7 @@ void x_asprintf(char **ptr, const char *format, ...)
|
|||
}
|
||||
va_end(ap);
|
||||
|
||||
if (!ptr) fatal("out of memory in x_asprintf");
|
||||
if (!*ptr) fatal("out of memory in x_asprintf");
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -4,3 +4,35 @@ See the RELEASENOTES file for a summary of changes in each release.
|
|||
|
||||
Version 3.0.11 (in progress)
|
||||
============================
|
||||
|
||||
2016-08-05: olly
|
||||
[xml] Fix how the output filename is built to avoid problems when
|
||||
it contains the embedded strings ".c", ".cpp" or ".cxx".
|
||||
Fixes #540 reported by djack42.
|
||||
|
||||
2016-07-01: wsfulton
|
||||
Fix corner case of wrapping std::vector of T pointers where a pointer to a pointer of T
|
||||
also exists in the wrapped code. SF Bug 2359417 (967).
|
||||
|
||||
2016-06-26: wkalinin
|
||||
[Java, C#] Patch #681 Fix seg fault when ignoring nested classes.
|
||||
|
||||
2016-06-25: mromberg
|
||||
[Python] #711 Fix -castmode and conversion of signed and unsigned integer types.
|
||||
See 2015-12-23 CHANGES entry for details of these improvements when they were
|
||||
implemented for the default options (ie not using -castmode).
|
||||
|
||||
2016-06-25: ahnolds
|
||||
Patch #730 - Fix %implicitconv for overloaded functions when using
|
||||
-castmode or -fastdispatch options.
|
||||
|
||||
The result is that in all overload cases where there are multiple possibilities
|
||||
with the same number of arguments, the dispatch function will first check for
|
||||
exact (aka non implicit) matches, and then subsequently check for implicit
|
||||
casting matches. This was already happening in the normal dispatch situation,
|
||||
and in the -fastdispatch case two passes through the candidates were happening,
|
||||
just with SWIG_POINTER_IMPLICIT_CONV always set. After this patch, it is not set
|
||||
on the first pass, and then set on the second pass.
|
||||
|
||||
2016-06-25: liorgold
|
||||
Patch #727 - Add support for C++11 type aliasing.
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
<li><a href="#CPlusPlus11_strongly_typed_enumerations">Strongly typed enumerations</a>
|
||||
<li><a href="#CPlusPlus11_double_angle_brackets">Double angle brackets</a>
|
||||
<li><a href="#CPlusPlus11_explicit_conversion_operators">Explicit conversion operators</a>
|
||||
<li><a href="#CPlusPlus11_alias_templates">Alias templates</a>
|
||||
<li><a href="#CPlusPlus11_alias_templates">Type alias and alias templates</a>
|
||||
<li><a href="#CPlusPlus11_unrestricted_unions">Unrestricted unions</a>
|
||||
<li><a href="#CPlusPlus11_variadic_templates">Variadic templates</a>
|
||||
<li><a href="#CPlusPlus11_new_string_literals">New string literals</a>
|
||||
|
|
@ -52,7 +52,7 @@
|
|||
<li><a href="#CPlusPlus11_general_purpose_smart_pointers">General-purpose smart pointers</a>
|
||||
<li><a href="#CPlusPlus11_extensible_random_number_facility">Extensible random number facility</a>
|
||||
<li><a href="#CPlusPlus11_wrapper_reference">Wrapper reference</a>
|
||||
<li><a href="#CPlusPlus11_polymorphous_wrappers_for_function_objects">Polymorphous wrappers for function objects</a>
|
||||
<li><a href="#CPlusPlus11_polymorphous_wrappers_for_function_objects">Polymorphic wrappers for function objects</a>
|
||||
<li><a href="#CPlusPlus11_type_traits_for_metaprogramming">Type traits for metaprogramming</a>
|
||||
<li><a href="#CPlusPlus11_uniform_method_for_computing_return_type_of_function_objects">Uniform method for computing return type of function objects</a>
|
||||
</ul>
|
||||
|
|
@ -603,9 +603,29 @@ Conversion operators either with or without <tt>explicit</tt> need renaming to a
|
|||
them available as a normal proxy method.
|
||||
</p>
|
||||
|
||||
<H3><a name="CPlusPlus11_alias_templates">7.2.16 Alias templates</a></H3>
|
||||
<H3><a name="CPlusPlus11_alias_templates">7.2.16 Type alias and alias templates</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
A type alias is a statement of the form:
|
||||
</p>
|
||||
|
||||
<div class="code"><pre>
|
||||
using PFD = void (*)(double); // New introduced syntax
|
||||
</pre></div>
|
||||
|
||||
<p>
|
||||
which is equivalent to the old style typedef:
|
||||
</p>
|
||||
|
||||
<div class="code"><pre>
|
||||
typedef void (*PFD)(double); // The old style
|
||||
</pre></div>
|
||||
|
||||
<p>
|
||||
SWIG supports type aliasing.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The following is an example of an alias template:
|
||||
|
||||
|
|
@ -632,31 +652,6 @@ example.i:13: Warning 342: The 'using' keyword in template aliasing is not fully
|
|||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Similarly for non-template type aliasing:
|
||||
</p>
|
||||
|
||||
<div class="code"><pre>
|
||||
using PFD = void (*)(double); // New introduced syntax
|
||||
</pre></div>
|
||||
|
||||
<p>
|
||||
A warning will be issued:
|
||||
</p>
|
||||
|
||||
<div class="shell">
|
||||
<pre>
|
||||
example.i:17: Warning 341: The 'using' keyword in type aliasing is not fully supported yet.
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
||||
<p>The equivalent old style typedefs can be used as a workaround:</p>
|
||||
|
||||
<div class="code"><pre>
|
||||
typedef void (*PFD)(double); // The old style
|
||||
</pre></div>
|
||||
|
||||
<H3><a name="CPlusPlus11_unrestricted_unions">7.2.17 Unrestricted unions</a></H3>
|
||||
|
||||
|
||||
|
|
@ -1034,7 +1029,7 @@ Users would need to write their own typemaps if wrapper references are being use
|
|||
</p>
|
||||
|
||||
|
||||
<H3><a name="CPlusPlus11_polymorphous_wrappers_for_function_objects">7.3.8 Polymorphous wrappers for function objects</a></H3>
|
||||
<H3><a name="CPlusPlus11_polymorphous_wrappers_for_function_objects">7.3.8 Polymorphic wrappers for function objects</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@
|
|||
<li><a href="CPlusPlus11.html#CPlusPlus11_strongly_typed_enumerations">Strongly typed enumerations</a>
|
||||
<li><a href="CPlusPlus11.html#CPlusPlus11_double_angle_brackets">Double angle brackets</a>
|
||||
<li><a href="CPlusPlus11.html#CPlusPlus11_explicit_conversion_operators">Explicit conversion operators</a>
|
||||
<li><a href="CPlusPlus11.html#CPlusPlus11_alias_templates">Alias templates</a>
|
||||
<li><a href="CPlusPlus11.html#CPlusPlus11_alias_templates">Type alias and alias templates</a>
|
||||
<li><a href="CPlusPlus11.html#CPlusPlus11_unrestricted_unions">Unrestricted unions</a>
|
||||
<li><a href="CPlusPlus11.html#CPlusPlus11_variadic_templates">Variadic templates</a>
|
||||
<li><a href="CPlusPlus11.html#CPlusPlus11_new_string_literals">New string literals</a>
|
||||
|
|
|
|||
|
|
@ -2534,7 +2534,7 @@ also return a pointer to the base class (<tt>Language</tt>) so that only the int
|
|||
</p>
|
||||
|
||||
<p>
|
||||
Save the code for your language module in a file named "<tt>python.cxx</tt>" and.
|
||||
Save the code for your language module in a file named "<tt>python.cxx</tt>" and
|
||||
place this file in the <tt>Source/Modules</tt> directory of the SWIG distribution.
|
||||
To ensure that your module is compiled into SWIG along with the other language modules,
|
||||
modify the file <tt>Source/Modules/Makefile.am</tt> to include the additional source
|
||||
|
|
|
|||
|
|
@ -3359,20 +3359,20 @@ There is more than one macro in order to provide a choice for choosing the Java
|
|||
</tr>
|
||||
<tr>
|
||||
<td><tt>%interface(CTYPE)</tt></td>
|
||||
<td>Proxy class name is unchanged, interface name has <tt>SwigInterface</tt> added as a suffix for C++ class <tt>CTYPE</tt>.</td>
|
||||
<td>For C++ class <tt>CTYPE</tt>, proxy class name is unchanged without any suffix added, interface name has <tt>SwigInterface</tt> added as a suffix.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><tt>%interface_impl(CTYPE)</tt></td>
|
||||
<td>Proxy class name has <tt>SwigImpl</tt> as a suffix, interface name has <tt>SwigInterface</tt> added as a suffix for C++ class <tt>CTYPE</tt>.</td>
|
||||
<td>For C++ class <tt>CTYPE</tt>, proxy class name has <tt>SwigImpl</tt> added as a suffix, interface name has no added suffix.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><tt>%interface_custom("PROXY", "INTERFACE", CTYPE)</tt></td>
|
||||
<td>Proxy class name is given by the string <tt>PROXY</tt>, interface name is given by the string <tt>INTERFACE</tt> for C++ class <tt>CTYPE</tt>. The <tt>PROXY</tt> and <tt>INTERFACE</tt> names can use the <a href="SWIG.html#SWIG_advanced_renaming">string formatting functions</a> used in <tt>%rename</tt>.</td>
|
||||
<td>For C++ class <tt>CTYPE</tt>, proxy class name is given by the string <tt>PROXY</tt>, interface name is given by the string <tt>INTERFACE</tt>. The <tt>PROXY</tt> and <tt>INTERFACE</tt> names can use the <a href="SWIG.html#SWIG_advanced_renaming">string formatting functions</a> used in <tt>%rename</tt>.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
The table below has a few examples showing the resulting proxy and interface names.
|
||||
The table below has a few examples showing the resulting proxy and interface names for a C++ class called <tt>Base</tt>.
|
||||
</p>
|
||||
|
||||
<table BORDER summary="Java interface macro examples">
|
||||
|
|
|
|||
|
|
@ -87,7 +87,6 @@ CPP_TEST_BROKEN += \
|
|||
director_nested_class \
|
||||
exception_partial_info \
|
||||
extend_variable \
|
||||
li_std_vector_ptr \
|
||||
li_boost_shared_ptr_template \
|
||||
nested_private \
|
||||
overload_complicated \
|
||||
|
|
@ -308,6 +307,7 @@ CPP_TEST_CASES += \
|
|||
nested_class \
|
||||
nested_directors \
|
||||
nested_comment \
|
||||
nested_ignore \
|
||||
nested_scope \
|
||||
nested_template_base \
|
||||
nested_workaround \
|
||||
|
|
@ -587,6 +587,7 @@ CPP_STD_TEST_CASES += \
|
|||
li_std_vector \
|
||||
li_std_vector_enum \
|
||||
li_std_vector_member_var\
|
||||
li_std_vector_ptr \
|
||||
smart_pointer_inherit \
|
||||
template_typedef_fnc \
|
||||
template_type_namespace \
|
||||
|
|
|
|||
|
|
@ -2,15 +2,6 @@
|
|||
|
||||
// Type aliasing seg fault : Github issue #424
|
||||
|
||||
%warnfilter(SWIGWARN_CPP11_ALIAS_DECLARATION) Target;
|
||||
%warnfilter(SWIGWARN_CPP11_ALIAS_DECLARATION) Int;
|
||||
%warnfilter(SWIGWARN_CPP11_ALIAS_DECLARATION) IntRef;
|
||||
%warnfilter(SWIGWARN_CPP11_ALIAS_DECLARATION) IntPtrRef;
|
||||
%warnfilter(SWIGWARN_CPP11_ALIAS_DECLARATION) IntRValueRef;
|
||||
%warnfilter(SWIGWARN_CPP11_ALIAS_DECLARATION) IntArray;
|
||||
%warnfilter(SWIGWARN_CPP11_ALIAS_DECLARATION) HalideTargetPtr1;
|
||||
%warnfilter(SWIGWARN_CPP11_ALIAS_DECLARATION) HalideTargetPtr2;
|
||||
|
||||
%inline %{
|
||||
namespace Halide {
|
||||
|
||||
|
|
@ -53,14 +44,69 @@ public:
|
|||
|
||||
|
||||
%inline %{
|
||||
using Int = int;
|
||||
using IntRef = int&;
|
||||
using IntPtrRef = int*&;
|
||||
using IntRValueRef = int&&;
|
||||
using IntArray = int[];
|
||||
|
||||
using HalideTargetPtr1 = Halide::Target*;
|
||||
namespace Halide {
|
||||
using HalideTargetPtr2 = Target*;
|
||||
}
|
||||
%}
|
||||
|
||||
// Define some types
|
||||
|
||||
%inline %{
|
||||
using Int = int;
|
||||
using IntPtr = Int*;
|
||||
using IntRef = Int&;
|
||||
using IntPtrRef = Int*&;
|
||||
using IntRValueRef = Int&&;
|
||||
using IntArray = Int[];
|
||||
%}
|
||||
|
||||
// Test that SWIG understands these new types
|
||||
|
||||
%callback("%s_cb");
|
||||
Int mult2(Int x);
|
||||
%nocallback;
|
||||
|
||||
%inline %{
|
||||
Int mult2(Int x) { return x * 2; }
|
||||
IntPtr allocate_int() { return new Int(12); }
|
||||
void free_int(int* ptr) { delete ptr; }
|
||||
void inplace_mult2(IntRef x) { x *= 2; }
|
||||
Int read_int(IntPtr ptr) { return *ptr; }
|
||||
|
||||
template <typename T> class Pair {
|
||||
public:
|
||||
using data_t = T;
|
||||
|
||||
data_t a, b;
|
||||
|
||||
Pair() : a(), b() { }
|
||||
Pair(data_t a, data_t b) : a(a), b(b) { }
|
||||
data_t first() { return a; }
|
||||
data_t second() { return b; }
|
||||
};
|
||||
%}
|
||||
|
||||
%template(int_pair) Pair<Int>;
|
||||
|
||||
%inline %{
|
||||
using PairInt = Pair<Int>;
|
||||
|
||||
class PairSubclass : public PairInt {
|
||||
public:
|
||||
PairSubclass(data_t a, data_t b) : PairInt(a, b) { }
|
||||
|
||||
using const_ref_data_t = const data_t&;
|
||||
};
|
||||
|
||||
PairSubclass::data_t plus1(PairSubclass::const_ref_data_t x) { return x + 1; }
|
||||
%}
|
||||
|
||||
// Test function pointers
|
||||
|
||||
%inline %{
|
||||
using callback_t = int(*)(int);
|
||||
|
||||
callback_t get_callback() { return mult2; }
|
||||
int call(callback_t func, int param) { return func(param); }
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,12 @@ The primary purpose of this testcase is to ensure that enums used along with the
|
|||
|
||||
%inline %{
|
||||
|
||||
#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
|
||||
/* for anonymous enums */
|
||||
/* dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] */
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#endif
|
||||
|
||||
enum SOME_ENUM {ENUM_ONE, ENUM_TWO};
|
||||
|
||||
struct StructWithEnums {
|
||||
|
|
|
|||
|
|
@ -47,6 +47,12 @@
|
|||
|
||||
%inline %{
|
||||
|
||||
#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
|
||||
/* for anonymous enums */
|
||||
/* dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] */
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#endif
|
||||
|
||||
enum { AnonEnum1, AnonEnum2 = 100 };
|
||||
enum { ReallyAnInteger = 200 };
|
||||
//enum { AnonEnum3, AnonEnum4 } instance;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,12 @@
|
|||
|
||||
%inline %{
|
||||
|
||||
#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
|
||||
/* for anonymous enums */
|
||||
/* dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] */
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
CSP_ITERATION_FWD,
|
||||
CSP_ITERATION_BWD = 11
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
cpp_using_type_aliasing.i:8: Warning 341: The 'using' keyword in type aliasing is not fully supported yet.
|
||||
cpp_using_type_aliasing.i:8: Warning 315: Nothing known about 'Okay< int >'.
|
||||
cpp_using_type_aliasing.i:8: Warning 315: Nothing known about 'Okay< int >'.
|
||||
|
|
@ -1,12 +1,19 @@
|
|||
package main
|
||||
|
||||
import . "./li_std_vector_ptr"
|
||||
import "fmt"
|
||||
|
||||
func check(val1 int, val2 int) {
|
||||
if val1 != val2 {
|
||||
panic(fmt.Sprintf("Values are not the same %d %d", val1, val2))
|
||||
}
|
||||
}
|
||||
func main() {
|
||||
ip1 := MakeIntPtr(11)
|
||||
ip2 := MakeIntPtr(22)
|
||||
vi := NewIntPtrVector()
|
||||
vi.Add(ip1)
|
||||
vi.Add(ip2)
|
||||
DisplayVector(vi)
|
||||
check(GetValueFromVector(vi, 0), 11)
|
||||
check(GetValueFromVector(vi, 1), 22)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ INTEGER bar_getter(Base<INTEGER>& foo) {
|
|||
// 2nd test - templates with default template parameters
|
||||
#if defined(SHARED_PTR_WRAPPERS_IMPLEMENTED)
|
||||
|
||||
%shared_ptr(Space::BaseDefault<short>)
|
||||
%shared_ptr(Space::BaseDefault<short, int>)
|
||||
%shared_ptr(Space::DerivedDefault<short>)
|
||||
%shared_ptr(Space::DerivedDefault2<short>)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Bug 2359417
|
||||
// SF Bug 2359417
|
||||
%module li_std_vector_ptr
|
||||
|
||||
%include "std_vector.i"
|
||||
|
|
@ -15,16 +15,76 @@ double* makeDoublePtr(double v) {
|
|||
return new double(v);
|
||||
}
|
||||
|
||||
#if 1
|
||||
// pointer to pointer in the wrappers was preventing a vector of pointers from working
|
||||
int** makeIntPtrPtr(int* v) {
|
||||
return new int*(v);
|
||||
}
|
||||
#endif
|
||||
|
||||
void displayVector(std::vector<int *> vpi) {
|
||||
cout << "displayVector..." << endl;
|
||||
for (int i=0; i<vpi.size(); ++i)
|
||||
for (size_t i=0; i<vpi.size(); ++i)
|
||||
cout << *vpi[i] << endl;
|
||||
}
|
||||
int getValueFromVector(std::vector<int *> vpi, size_t index) {
|
||||
return *vpi[index];
|
||||
}
|
||||
%}
|
||||
|
||||
// A not exposed to wrappers
|
||||
%{
|
||||
struct A {
|
||||
int val;
|
||||
A(int val) : val(val) {}
|
||||
};
|
||||
%}
|
||||
|
||||
%template(APtrVector) std::vector<A *>;
|
||||
|
||||
%inline %{
|
||||
A *makeA(int val) { return new A(val); }
|
||||
int getVal(A* a) { return a->val; }
|
||||
int getVectorValueA(std::vector<A *> vpi, size_t index) {
|
||||
return vpi[index]->val;
|
||||
}
|
||||
%}
|
||||
|
||||
// B is fully exposed to wrappers
|
||||
%inline %{
|
||||
struct B {
|
||||
int val;
|
||||
B(int val = 0) : val(val) {}
|
||||
};
|
||||
%}
|
||||
|
||||
%template(BPtrVector) std::vector<B *>;
|
||||
|
||||
%inline %{
|
||||
B *makeB(int val) { return new B(val); }
|
||||
int getVal(B* b) { return b->val; }
|
||||
int getVectorValueB(std::vector<B *> vpi, size_t index) {
|
||||
return vpi[index]->val;
|
||||
}
|
||||
%}
|
||||
|
||||
// C is fully exposed to wrappers (includes code using B **)
|
||||
%inline %{
|
||||
struct C {
|
||||
int val;
|
||||
C(int val = 0) : val(val) {}
|
||||
};
|
||||
%}
|
||||
|
||||
%template(CPtrVector) std::vector<C *>;
|
||||
|
||||
%inline %{
|
||||
// pointer to pointer in the wrappers was preventing a vector of pointers from working
|
||||
C** makeCIntPtrPtr(C* v) {
|
||||
return new C*(v);
|
||||
}
|
||||
C *makeC(int val) { return new C(val); }
|
||||
int getVal(C* b) { return b->val; }
|
||||
int getVectorValueC(std::vector<C *> vpi, size_t index) {
|
||||
return vpi[index]->val;
|
||||
}
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,18 @@ Also tests reported error when a #define placed in a deeply embedded struct/unio
|
|||
%rename(InUnNamed) OuterStructNamed::Inner_union_named;
|
||||
#endif
|
||||
|
||||
#if defined(SWIG_JAVASCRIPT_V8)
|
||||
|
||||
%inline %{
|
||||
#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
|
||||
/* for nested C class wrappers compiled as C++ code */
|
||||
/* dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] */
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#endif
|
||||
%}
|
||||
|
||||
#endif
|
||||
|
||||
%inline %{
|
||||
|
||||
struct TestStruct {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,17 @@
|
|||
%module nested_extend_c
|
||||
|
||||
#if defined(SWIG_JAVASCRIPT_V8)
|
||||
|
||||
%inline %{
|
||||
#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
|
||||
/* for nested C class wrappers compiled as C++ code */
|
||||
/* dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] */
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#endif
|
||||
%}
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(SWIGOCTAVE) && !defined(SWIG_JAVASCRIPT_V8)
|
||||
%extend hiA {
|
||||
hiA() {
|
||||
|
|
|
|||
24
Examples/test-suite/nested_ignore.i
Normal file
24
Examples/test-suite/nested_ignore.i
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
%module nested_ignore
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) B::C::D;
|
||||
|
||||
%rename($ignore) B::C;
|
||||
|
||||
%inline %{
|
||||
namespace B {
|
||||
class C {
|
||||
public:
|
||||
struct D {
|
||||
};
|
||||
};
|
||||
|
||||
class E {
|
||||
public:
|
||||
typedef C::D D;
|
||||
};
|
||||
|
||||
struct F
|
||||
{
|
||||
const E::D foo(){ return E::D(); }
|
||||
};
|
||||
}
|
||||
%}
|
||||
|
|
@ -1,5 +1,17 @@
|
|||
%module nested_structs
|
||||
|
||||
#if defined(SWIG_JAVASCRIPT_V8)
|
||||
|
||||
%inline %{
|
||||
#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
|
||||
/* for nested C class wrappers compiled as C++ code */
|
||||
/* dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] */
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#endif
|
||||
%}
|
||||
|
||||
#endif
|
||||
|
||||
// bug #491476
|
||||
%inline %{
|
||||
struct Outer {
|
||||
|
|
|
|||
|
|
@ -15,11 +15,19 @@ def check(got, expected, expected_builtin=None, skip=False):
|
|||
def is_new_style_class(cls):
|
||||
return hasattr(cls, "__class__")
|
||||
|
||||
def is_fastproxy(module):
|
||||
return "new_instancemethod" in module
|
||||
|
||||
if not is_new_style_class(A):
|
||||
# Missing static methods make this hard to test... skip if -classic is
|
||||
# used!
|
||||
sys.exit(0)
|
||||
|
||||
if is_fastproxy(dir()):
|
||||
# Detect when -fastproxy is specified and skip test as it changes the function names making it
|
||||
# hard to test... skip until the number of options are reduced in SWIG-3.1 and autodoc is improved
|
||||
sys.exit(0)
|
||||
|
||||
# skip builtin check - the autodoc is missing, but it probably should not be
|
||||
skip = True
|
||||
|
||||
|
|
|
|||
32
Examples/test-suite/python/cpp11_type_aliasing_runme.py
Normal file
32
Examples/test-suite/python/cpp11_type_aliasing_runme.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
from cpp11_type_aliasing import *
|
||||
|
||||
if get_host_target().bits != 32:
|
||||
raise RuntimeError("get_host_target().bits should return 32")
|
||||
|
||||
if mult2(10) != 20:
|
||||
raise RuntimeError("mult2(10) should return 20")
|
||||
|
||||
int_ptr = allocate_int()
|
||||
inplace_mult2(int_ptr)
|
||||
if read_int(int_ptr) != 24:
|
||||
raise RuntimeError("read_int should return 24")
|
||||
free_int(int_ptr)
|
||||
|
||||
pair = PairSubclass(3, 4)
|
||||
if pair.first() != 3:
|
||||
raise RuntimeError("pair.first() should return 3")
|
||||
|
||||
if pair.second() != 4:
|
||||
raise RuntimeError("pair.second() should return 4")
|
||||
|
||||
if pair.a != 3:
|
||||
raise RuntimeError("pair.a should be 3")
|
||||
|
||||
if plus1(5) != 6:
|
||||
raise RuntimeError("plus1(5) should return 6")
|
||||
|
||||
if call(mult2_cb, 7) != 14:
|
||||
raise RuntimeError("call(mult2_cb, 7) should return 14")
|
||||
|
||||
if call(get_callback(), 7) != 14:
|
||||
raise RuntimeError("call(get_callback(), 7) should return 14")
|
||||
|
|
@ -14,4 +14,5 @@ else:
|
|||
StaticFunctionTest().static_func_2(1)
|
||||
StaticFunctionTest().static_func_3(1, 2)
|
||||
StaticMemberTest.static_int = 10
|
||||
assert StaticMemberTest.static_int == 10
|
||||
if not StaticMemberTest.static_int == 10:
|
||||
raise RuntimeError("static_int not 10")
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import exception_classname
|
||||
|
||||
a = exception_classname.Exception()
|
||||
assert a.testfunc() == 42
|
||||
if a.testfunc() != 42:
|
||||
raise RuntimeError("Not 42!")
|
||||
|
|
|
|||
|
|
@ -8,9 +8,8 @@ if d.bar() != 2:
|
|||
raise RuntimeError
|
||||
if bar_getter(b) != 1:
|
||||
raise RuntimeError
|
||||
# Fix reverted in rev 12953
|
||||
# if bar_getter(d) != 2:
|
||||
# raise RuntimeError
|
||||
if bar_getter(d) != 2:
|
||||
raise RuntimeError
|
||||
|
||||
b = BaseDefaultInt()
|
||||
d = DerivedDefaultInt()
|
||||
|
|
@ -23,8 +22,11 @@ if d2.bar2() != 4:
|
|||
raise RuntimeError
|
||||
if bar2_getter(b) != 3:
|
||||
raise RuntimeError
|
||||
# Fix reverted in rev 12953
|
||||
# if bar2_getter(d) != 4:
|
||||
# raise RuntimeError
|
||||
# if bar2_getter(d2) != 4:
|
||||
# raise RuntimeError
|
||||
# SWIG fix reverted in Subversion rev 12953
|
||||
# Testcase has now been modified to mask the problem by providing the default parameter 'int' in:
|
||||
# %shared_ptr(Space::BaseDefault<short, int>)
|
||||
# If this is not done then d fails to convert to BaseDefault<short>&
|
||||
if bar2_getter(d) != 4:
|
||||
raise RuntimeError
|
||||
if bar2_getter(d2) != 4:
|
||||
raise RuntimeError
|
||||
|
|
|
|||
|
|
@ -1,7 +1,38 @@
|
|||
from li_std_vector_ptr import *
|
||||
|
||||
def check(val1, val2):
|
||||
if val1 != val2:
|
||||
raise RuntimeError("Values are not the same %s %s" % (val1, val2))
|
||||
ip1 = makeIntPtr(11)
|
||||
ip2 = makeIntPtr(22)
|
||||
|
||||
vi = IntPtrVector((ip1, ip2))
|
||||
displayVector(vi)
|
||||
check(getValueFromVector(vi, 0), 11)
|
||||
check(getValueFromVector(vi, 1), 22)
|
||||
|
||||
vA = APtrVector([makeA(33), makeA(34)])
|
||||
check(getVectorValueA(vA, 0), 33)
|
||||
|
||||
vB = BPtrVector([makeB(133), makeB(134)])
|
||||
check(getVectorValueB(vB, 0), 133)
|
||||
|
||||
vC = CPtrVector([makeC(1133), makeC(1134)])
|
||||
check(getVectorValueC(vC, 0), 1133)
|
||||
|
||||
|
||||
vA = [makeA(233), makeA(234)]
|
||||
check(getVectorValueA(vA, 0), 233)
|
||||
|
||||
vB = [makeB(333), makeB(334)]
|
||||
check(getVectorValueB(vB, 0), 333)
|
||||
|
||||
vC = [makeC(3333), makeC(3334)]
|
||||
check(getVectorValueC(vC, 0), 3333)
|
||||
|
||||
# mixed A and B should not be accepted
|
||||
vAB = [makeA(999), makeB(999)]
|
||||
try:
|
||||
check(getVectorValueA(vAB, 0), 999)
|
||||
raise RuntimeError("missed exception")
|
||||
except TypeError:
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
import operbool
|
||||
assert not operbool.Test()
|
||||
if operbool.Test():
|
||||
raise RuntimeError("operbool failed")
|
||||
|
|
|
|||
|
|
@ -26,8 +26,10 @@ def test1():
|
|||
sys.stderr.flush()
|
||||
sys.stderr = stderr_saved
|
||||
|
||||
assert attributeErrorOccurred
|
||||
assert buffer.getvalue().count("I am the ClassWithThrowingDestructor dtor doing bad things") >= 1
|
||||
if not attributeErrorOccurred:
|
||||
raise RuntimeError("attributeErrorOccurred failed")
|
||||
if not buffer.getvalue().count("I am the ClassWithThrowingDestructor dtor doing bad things") >= 1:
|
||||
raise RuntimeError("ClassWithThrowingDestructor dtor doing bad things failed")
|
||||
|
||||
class VectorHolder(object):
|
||||
def __init__(self, v):
|
||||
|
|
|
|||
|
|
@ -13,11 +13,15 @@ if sys.version_info[0:2] >= (3, 1):
|
|||
if unicode_strings.non_utf8_std_string() != test_string:
|
||||
raise ValueError('Test comparison mismatch')
|
||||
|
||||
def check(s1, s2):
|
||||
if s1 != s2:
|
||||
raise RuntimeError("{} != {}".format(s1, s2))
|
||||
|
||||
# Testing SWIG_PYTHON_2_UNICODE flag which allows unicode strings to be passed to C
|
||||
if sys.version_info[0:2] < (3, 0):
|
||||
assert unicode_strings.charstring("hello1") == "hello1"
|
||||
assert unicode_strings.charstring(str(u"hello2")) == "hello2"
|
||||
assert unicode_strings.charstring(u"hello3") == "hello3"
|
||||
assert unicode_strings.charstring(unicode("hello4")) == "hello4"
|
||||
check(unicode_strings.charstring("hello1"), "hello1")
|
||||
check(unicode_strings.charstring(str(u"hello2")), "hello2")
|
||||
check(unicode_strings.charstring(u"hello3"), "hello3")
|
||||
check(unicode_strings.charstring(unicode("hello4")), "hello4")
|
||||
unicode_strings.charstring(u"hell\xb05")
|
||||
unicode_strings.charstring(u"hell\u00f66")
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ top_builddir = ../@top_builddir@
|
|||
|
||||
C_TEST_CASES += \
|
||||
scilab_consts \
|
||||
scilab_enums \
|
||||
scilab_identifier_name \
|
||||
|
||||
CPP_TEST_CASES += \
|
||||
|
|
@ -21,6 +20,7 @@ CPP_TEST_CASES += \
|
|||
primitive_types \
|
||||
scilab_li_matrix \
|
||||
scilab_multivalue \
|
||||
scilab_enums \
|
||||
scilab_pointer_conversion_functions \
|
||||
|
||||
CPP_STD_TEST_CASES += \
|
||||
|
|
|
|||
|
|
@ -24,4 +24,13 @@ checkEnum(TYPEDEF_ENUM_1_2, 22);
|
|||
checkEnum(TYPEDEF_ENUM_2_1, 31);
|
||||
checkEnum(TYPEDEF_ENUM_2_2, 32);
|
||||
|
||||
checkEnum(ENUM_REF_1, 1);
|
||||
checkEnum(ENUM_REF_2, 10);
|
||||
|
||||
checkEnum(clsEnum_CLS_ENUM_1, 100);
|
||||
checkEnum(clsEnum_CLS_ENUM_2, 101);
|
||||
|
||||
checkEnum(clsEnum_CLS_ENUM_REF_1, 101);
|
||||
checkEnum(clsEnum_CLS_ENUM_REF_2, 110);
|
||||
|
||||
exec("swigtest.quit", -1);
|
||||
|
|
|
|||
|
|
@ -35,4 +35,21 @@ typedef enum TYPEDEF_ENUM_2 {
|
|||
TYPEDEF_ENUM_2_2 = 32
|
||||
} TYPEDEF_ENUM_2;
|
||||
|
||||
enum ENUM_REF {
|
||||
ENUM_REF_1 = 1,
|
||||
ENUM_REF_2 = ENUM_REF_1 + 9
|
||||
};
|
||||
|
||||
class clsEnum {
|
||||
public:
|
||||
enum CLS_ENUM {
|
||||
CLS_ENUM_1 = 100,
|
||||
CLS_ENUM_2 = 101
|
||||
};
|
||||
enum CLS_ENUM_REF {
|
||||
CLS_ENUM_REF_1 = 101,
|
||||
CLS_ENUM_REF_2 = CLS_ENUM_REF_1 + 9
|
||||
};
|
||||
};
|
||||
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
%module traits
|
||||
|
||||
%include typemaps/traits.swg
|
||||
|
||||
|
||||
%fragment("Traits");
|
||||
|
|
@ -1,6 +1,13 @@
|
|||
%module typedef_struct
|
||||
|
||||
%inline %{
|
||||
|
||||
#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
|
||||
/* for anonymous enums */
|
||||
/* dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] */
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
int numpoints;
|
||||
} LineObj;
|
||||
|
|
|
|||
|
|
@ -562,8 +562,8 @@ namespace swig {
|
|||
static int asptr(const octave_value& obj, sequence **seq) {
|
||||
if (!obj.is_defined() || Swig::swig_value_deref(obj)) {
|
||||
sequence *p;
|
||||
if (SWIG_ConvertPtr(obj,(void**)&p,
|
||||
swig::type_info<sequence>(),0) == SWIG_OK) {
|
||||
swig_type_info *descriptor = swig::type_info<sequence>();
|
||||
if (descriptor && SWIG_IsOK(SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0))) {
|
||||
if (seq) *seq = p;
|
||||
return SWIG_OLDOBJ;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,8 @@ namespace swig {
|
|||
struct traits_asptr {
|
||||
static int asptr(const octave_value& obj, Type **val) {
|
||||
Type *p;
|
||||
int res = SWIG_ConvertPtr(obj, (void**)&p, type_info<Type>(), 0);
|
||||
swig_type_info *descriptor = type_info<Type>();
|
||||
int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
|
||||
if (SWIG_IsOK(res)) {
|
||||
if (val) *val = p;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,8 @@
|
|||
res = traits_asptr_stdseq<std::map<K,T>, std::pair<K, T> >::asptr(items, val);
|
||||
} else {
|
||||
map_type *p;
|
||||
res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<map_type>(),0);
|
||||
swig_type_info *descriptor = swig::type_info<map_type>();
|
||||
res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
|
||||
if (SWIG_IsOK(res) && val) *val = p;
|
||||
}
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@
|
|||
return get_pair(c(0),c(1),val);
|
||||
} else {
|
||||
value_type *p;
|
||||
int res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<value_type>(),0);
|
||||
swig_type_info *descriptor = swig::type_info<value_type>();
|
||||
int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
|
||||
if (SWIG_IsOK(res) && val)
|
||||
*val = *p;
|
||||
return res;
|
||||
|
|
@ -100,7 +101,8 @@
|
|||
return get_pair(c(0),c(1),val);
|
||||
} else {
|
||||
value_type *p;
|
||||
int res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<value_type>(),0);
|
||||
swig_type_info *descriptor = swig::type_info<value_type>();
|
||||
int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
|
||||
if (SWIG_IsOK(res) && val)
|
||||
*val = p;
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -968,8 +968,8 @@ namespace swig {
|
|||
static int asptr(PyObject *obj, sequence **seq) {
|
||||
if (obj == Py_None || SWIG_Python_GetSwigThis(obj)) {
|
||||
sequence *p;
|
||||
if (::SWIG_ConvertPtr(obj,(void**)&p,
|
||||
swig::type_info<sequence>(),0) == SWIG_OK) {
|
||||
swig_type_info *descriptor = swig::type_info<sequence>();
|
||||
if (descriptor && SWIG_IsOK(::SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0))) {
|
||||
if (seq) *seq = p;
|
||||
return SWIG_OLDOBJ;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -223,6 +223,8 @@ SWIG_AsVal_dec(long long)(PyObject *obj, long long *val)
|
|||
const double mant_min = -mant_max;
|
||||
double d;
|
||||
res = SWIG_AsVal(double)(obj,&d);
|
||||
if (SWIG_IsOK(res) && !SWIG_CanCastAsInteger(&d, mant_min, mant_max))
|
||||
return SWIG_OverflowError;
|
||||
if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, mant_min, mant_max)) {
|
||||
if (val) *val = (long long)(d);
|
||||
return SWIG_AddCast(res);
|
||||
|
|
@ -280,6 +282,8 @@ SWIG_AsVal_dec(unsigned long long)(PyObject *obj, unsigned long long *val)
|
|||
const double mant_max = 1LL << DBL_MANT_DIG;
|
||||
double d;
|
||||
res = SWIG_AsVal(double)(obj,&d);
|
||||
if (SWIG_IsOK(res) && !SWIG_CanCastAsInteger(&d, 0, mant_max))
|
||||
return SWIG_OverflowError;
|
||||
if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, mant_max)) {
|
||||
if (val) *val = (unsigned long long)(d);
|
||||
return SWIG_AddCast(res);
|
||||
|
|
|
|||
|
|
@ -46,7 +46,8 @@ namespace swig {
|
|||
struct traits_asptr {
|
||||
static int asptr(PyObject *obj, Type **val) {
|
||||
Type *p;
|
||||
int res = SWIG_ConvertPtr(obj, (void**)&p, type_info<Type>(), 0);
|
||||
swig_type_info *descriptor = type_info<Type>();
|
||||
int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
|
||||
if (SWIG_IsOK(res)) {
|
||||
if (val) *val = p;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,7 +102,8 @@
|
|||
res = traits_asptr_stdseq<map_type, std::pair<K, T> >::asptr(items, val);
|
||||
} else {
|
||||
map_type *p;
|
||||
res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<map_type>(),0);
|
||||
swig_type_info *descriptor = swig::type_info<map_type>();
|
||||
res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
|
||||
if (SWIG_IsOK(res) && val) *val = p;
|
||||
}
|
||||
SWIG_PYTHON_THREAD_END_BLOCK;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@
|
|||
return traits_asptr_stdseq<std::multimap<K,T>, std::pair<K, T> >::asptr(items, val);
|
||||
} else {
|
||||
multimap_type *p;
|
||||
res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<multimap_type>(),0);
|
||||
swig_type_info *descriptor = swig::type_info<multimap_type>();
|
||||
res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
|
||||
if (SWIG_IsOK(res) && val) *val = p;
|
||||
}
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@
|
|||
}
|
||||
} else {
|
||||
value_type *p;
|
||||
res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<value_type>(),0);
|
||||
swig_type_info *descriptor = swig::type_info<value_type>();
|
||||
res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
|
||||
if (SWIG_IsOK(res) && val) *val = *p;
|
||||
}
|
||||
return res;
|
||||
|
|
@ -98,7 +99,8 @@
|
|||
}
|
||||
} else {
|
||||
value_type *p;
|
||||
res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<value_type>(),0);
|
||||
swig_type_info *descriptor = swig::type_info<value_type>();
|
||||
res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
|
||||
if (SWIG_IsOK(res) && val) *val = p;
|
||||
}
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,8 @@
|
|||
res = traits_asptr_stdseq<std::unordered_map<K,T>, std::pair<K, T> >::asptr(items, val);
|
||||
} else {
|
||||
unordered_map_type *p;
|
||||
res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<unordered_map_type>(),0);
|
||||
swig_type_info *descriptor = swig::type_info<unordered_map_type>();
|
||||
res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
|
||||
if (SWIG_IsOK(res) && val) *val = p;
|
||||
}
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@
|
|||
return traits_asptr_stdseq<std::unordered_multimap<K,T>, std::pair<K, T> >::asptr(items, val);
|
||||
} else {
|
||||
unordered_multimap_type *p;
|
||||
res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<unordered_multimap_type>(),0);
|
||||
swig_type_info *descriptor = swig::type_info<unordered_multimap_type>();
|
||||
res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
|
||||
if (SWIG_IsOK(res) && val) *val = p;
|
||||
}
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,8 @@ namespace swig {
|
|||
struct traits_asptr {
|
||||
static int asptr(SWIG_Object obj, Type **val) {
|
||||
Type *p;
|
||||
int res = SWIG_ConvertPtr(obj, (void**)&p, type_info<Type>(), 0);
|
||||
swig_type_info *descriptor = type_info<Type>();
|
||||
int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
|
||||
if (SWIG_IsOK(res)) {
|
||||
if (val) *val = p;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -464,8 +464,7 @@ namespace swig
|
|||
%typemap(in,noblock=1,fragment="RubySequence_Cont")
|
||||
const_iterator(swig::ConstIterator *iter = 0, int res),
|
||||
const_reverse_iterator(swig::ConstIterator *iter = 0, int res) {
|
||||
res = SWIG_ConvertPtr($input, %as_voidptrptr(&iter),
|
||||
swig::ConstIterator::descriptor(), 0);
|
||||
res = SWIG_ConvertPtr($input, %as_voidptrptr(&iter), swig::ConstIterator::descriptor(), 0);
|
||||
if (!SWIG_IsOK(res) || !iter) {
|
||||
%argument_fail(SWIG_TypeError, "$type", $symname, $argnum);
|
||||
} else {
|
||||
|
|
@ -497,16 +496,14 @@ namespace swig
|
|||
%typecheck(%checkcode(ITERATOR),noblock=1,fragment="RubySequence_Cont")
|
||||
const_iterator, const_reverse_iterator {
|
||||
swig::ConstIterator *iter = 0;
|
||||
int res = SWIG_ConvertPtr($input, %as_voidptrptr(&iter),
|
||||
swig::ConstIterator::descriptor(), 0);
|
||||
int res = SWIG_ConvertPtr($input, %as_voidptrptr(&iter), swig::ConstIterator::descriptor(), 0);
|
||||
$1 = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::ConstIterator_T<$type > *>(iter) != 0));
|
||||
}
|
||||
|
||||
%typecheck(%checkcode(ITERATOR),noblock=1,fragment="RubySequence_Cont")
|
||||
iterator, reverse_iterator {
|
||||
swig::ConstIterator *iter = 0;
|
||||
int res = SWIG_ConvertPtr($input, %as_voidptrptr(&iter),
|
||||
swig::Iterator::descriptor(), 0);
|
||||
int res = SWIG_ConvertPtr($input, %as_voidptrptr(&iter), swig::Iterator::descriptor(), 0);
|
||||
$1 = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<$type > *>(iter) != 0));
|
||||
}
|
||||
|
||||
|
|
@ -1037,8 +1034,8 @@ namespace swig {
|
|||
}
|
||||
} else {
|
||||
sequence *p;
|
||||
if (SWIG_ConvertPtr(obj,(void**)&p,
|
||||
swig::type_info<sequence>(),0) == SWIG_OK) {
|
||||
swig_type_info *descriptor = swig::type_info<sequence>();
|
||||
if (descriptor && SWIG_IsOK(SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0))) {
|
||||
if (seq) *seq = p;
|
||||
return SWIG_OLDOBJ;
|
||||
}
|
||||
|
|
@ -1077,8 +1074,8 @@ namespace swig {
|
|||
}
|
||||
} else {
|
||||
sequence *p;
|
||||
if (SWIG_ConvertPtr(obj,(void**)&p,
|
||||
swig::type_info<sequence>(),0) == SWIG_OK) {
|
||||
swig_type_info *descriptor = swig::type_info<sequence>();
|
||||
if (descriptor && SWIG_IsOK(SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0))) {
|
||||
if (seq) *seq = p;
|
||||
return SWIG_OLDOBJ;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,8 @@ namespace swig {
|
|||
struct traits_asptr {
|
||||
static int asptr(VALUE obj, Type **val) {
|
||||
Type *p;
|
||||
int res = SWIG_ConvertPtr(obj, (void**)&p, type_info<Type>(), 0);
|
||||
swig_type_info *descriptor = type_info<Type>();
|
||||
int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
|
||||
if (SWIG_IsOK(res)) {
|
||||
if (val) *val = p;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,7 +100,8 @@
|
|||
res = traits_asptr_stdseq<std::map<K,T>, std::pair<K, T> >::asptr(items, val);
|
||||
} else {
|
||||
map_type *p;
|
||||
res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<map_type>(),0);
|
||||
swig_type_info *descriptor = swig::type_info<map_type>();
|
||||
res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
|
||||
if (SWIG_IsOK(res) && val) *val = p;
|
||||
}
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@
|
|||
}
|
||||
} else {
|
||||
value_type *p;
|
||||
res = SWIG_ConvertPtr(obj,(void**)&p,
|
||||
swig::type_info<value_type>(),0);
|
||||
swig_type_info *descriptor = swig::type_info<value_type>();
|
||||
res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
|
||||
if (SWIG_IsOK(res) && val) *val = *p;
|
||||
}
|
||||
return res;
|
||||
|
|
@ -90,8 +90,8 @@
|
|||
}
|
||||
} else {
|
||||
value_type *p;
|
||||
res = SWIG_ConvertPtr(obj,(void**)&p,
|
||||
swig::type_info<value_type>(),0);
|
||||
swig_type_info *descriptor = swig::type_info<value_type>();
|
||||
res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
|
||||
if (SWIG_IsOK(res) && val) *val = p;
|
||||
}
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,8 @@ namespace swig {
|
|||
struct traits_asptr {
|
||||
static int asptr(const SwigSciObject& obj, Type **val) {
|
||||
Type *p;
|
||||
int res = SWIG_ConvertPtr(obj, (void**)&p, type_info<Type>(), 0);
|
||||
swig_type_info *descriptor = type_info<Type>();
|
||||
int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR;
|
||||
if (SWIG_IsOK(res)) {
|
||||
if (val) *val = p;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,8 +99,21 @@ namespace swig {
|
|||
return traits<typename noconst_traits<Type >::noconst_type >::type_name();
|
||||
}
|
||||
|
||||
template <class Type>
|
||||
struct traits_info {
|
||||
template <class Type> struct traits_info {
|
||||
static swig_type_info *type_query(std::string name) {
|
||||
name += " *";
|
||||
return SWIG_TypeQuery(name.c_str());
|
||||
}
|
||||
static swig_type_info *type_info() {
|
||||
static swig_type_info *info = type_query(type_name<Type>());
|
||||
return info;
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Partial specialization for pointers (traits_info)
|
||||
*/
|
||||
template <class Type> struct traits_info<Type *> {
|
||||
static swig_type_info *type_query(std::string name) {
|
||||
name += " *";
|
||||
return SWIG_TypeQuery(name.c_str());
|
||||
|
|
@ -117,7 +130,7 @@ namespace swig {
|
|||
}
|
||||
|
||||
/*
|
||||
Partial specialization for pointers
|
||||
Partial specialization for pointers (traits)
|
||||
*/
|
||||
template <class Type> struct traits <Type *> {
|
||||
typedef pointer_category category;
|
||||
|
|
|
|||
|
|
@ -73,8 +73,8 @@ namespace swig {
|
|||
typedef Type value_type;
|
||||
static int asptr(SWIG_Object obj, value_type **val) {
|
||||
Type *vptr;
|
||||
static swig_type_info* desc = SWIG_TypeQuery("Type *");
|
||||
int res = SWIG_ConvertPtr(obj, (void **)&vptr, desc, 0);
|
||||
static swig_type_info* descriptor = SWIG_TypeQuery("Type *");
|
||||
int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&vptr, descriptor, 0) : SWIG_ERROR;
|
||||
if (SWIG_IsOK(res)) {
|
||||
if (val) *val = vptr;
|
||||
return res;
|
||||
|
|
@ -109,8 +109,8 @@ namespace swig {
|
|||
typedef Type value_type;
|
||||
static int asptr(SWIG_Object obj, value_type **val) {
|
||||
Type *vptr;
|
||||
static swig_type_info* desc = SWIG_TypeQuery("Type *");
|
||||
int res = SWIG_ConvertPtr(obj, (void **)&vptr, desc, 0);
|
||||
static swig_type_info* descriptor = SWIG_TypeQuery("Type *");
|
||||
int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&vptr, descriptor, 0) : SWIG_ERROR;
|
||||
if (SWIG_IsOK(res)) {
|
||||
if (val) *val = vptr;
|
||||
return res;
|
||||
|
|
@ -147,8 +147,8 @@ namespace swig {
|
|||
typedef Type value_type;
|
||||
static int asptr(SWIG_Object obj, value_type **val) {
|
||||
Type *vptr;
|
||||
static swig_type_info* desc = SWIG_TypeQuery("Type *");
|
||||
int res = SWIG_ConvertPtr(obj, (void **)&vptr, desc, 0);
|
||||
static swig_type_info* descriptor = SWIG_TypeQuery("Type *");
|
||||
int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&vptr, descriptor, 0) : SWIG_ERROR;
|
||||
if (SWIG_IsOK(res)) {
|
||||
if (val) *val = vptr;
|
||||
return SWIG_OLDOBJ;
|
||||
|
|
@ -188,8 +188,8 @@ namespace swig {
|
|||
typedef Type value_type;
|
||||
static int asptr(SWIG_Object obj, value_type **val) {
|
||||
Type *vptr;
|
||||
static swig_type_info* desc = SWIG_TypeQuery("Type *");
|
||||
int res = SWIG_ConvertPtr(obj, (void **)&vptr, desc, 0);
|
||||
static swig_type_info* descriptor = SWIG_TypeQuery("Type *");
|
||||
int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&vptr, descriptor, 0) : SWIG_ERROR;
|
||||
if (SWIG_IsOK(res)) {
|
||||
if (val) *val = vptr;
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -1,305 +0,0 @@
|
|||
//
|
||||
// Use the following macro with modern STL implementations
|
||||
//
|
||||
//#define SWIG_STD_MODERN_STL
|
||||
//
|
||||
// Use this to deactive the previous definition, when using gcc-2.95
|
||||
// or similar old compilers.
|
||||
//
|
||||
//#define SWIG_STD_NOMODERN_STL
|
||||
|
||||
// Here, we identify compilers we now have problems with STL.
|
||||
%{
|
||||
#if defined(__GNUC__)
|
||||
# if __GNUC__ == 2 && __GNUC_MINOR <= 96
|
||||
# define SWIG_STD_NOMODERN_STL
|
||||
# endif
|
||||
#endif
|
||||
%}
|
||||
|
||||
//
|
||||
// Common code for supporting the STD C++ namespace
|
||||
//
|
||||
|
||||
%fragment("<string>");
|
||||
%fragment("<stdexcept>");
|
||||
|
||||
%fragment("Traits","header",fragment="<string>")
|
||||
{
|
||||
namespace swig {
|
||||
/*
|
||||
type categories
|
||||
*/
|
||||
struct pointer_category { };
|
||||
struct value_category { };
|
||||
|
||||
/*
|
||||
General traits that provides type_name and type_info
|
||||
*/
|
||||
template <class Type> struct traits { };
|
||||
|
||||
template <class Type>
|
||||
inline const char* type_name() {
|
||||
return traits<Type>::type_name();
|
||||
}
|
||||
|
||||
template <class Type>
|
||||
struct traits_info {
|
||||
static swig_type_info *type_query(std::string name) {
|
||||
name += " *";
|
||||
return SWIG_TypeQuery(name.c_str());
|
||||
}
|
||||
static swig_type_info *type_info() {
|
||||
static swig_type_info *info = type_query(type_name<Type>());
|
||||
return info;
|
||||
}
|
||||
};
|
||||
|
||||
template <class Type>
|
||||
inline swig_type_info *type_info() {
|
||||
return traits_info<Type>::type_info();
|
||||
}
|
||||
|
||||
/*
|
||||
Partial specialization for pointers
|
||||
*/
|
||||
template <class Type> struct traits <Type *> {
|
||||
typedef pointer_category category;
|
||||
static std::string make_ptr_name(const char* name) {
|
||||
std::string ptrname = name;
|
||||
ptrname += " *";
|
||||
return ptrname;
|
||||
}
|
||||
static const char* type_name() {
|
||||
static std::string name = make_ptr_name(swig::type_name<Type>());
|
||||
return name.c_str();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <class Type, class Category = typename traits<Type>::category >
|
||||
struct traits_check { };
|
||||
|
||||
/*
|
||||
Traits that provides the from method for an unknown type
|
||||
*/
|
||||
template <int flags, class Type> struct traits_from_ptr {
|
||||
static SWIG_Object from SWIG_FROM_DECL_ARGS(Type *val) {
|
||||
return SWIG_NewPointerObj(val, type_info<Type>(), flags);
|
||||
}
|
||||
};
|
||||
|
||||
template <class Type> struct traits_from {
|
||||
static SWIG_Object from SWIG_FROM_DECL_ARGS(const Type& val) {
|
||||
return traits_from_ptr<SWIG_POINTER_OWN, Type>::from(new Type(val));
|
||||
}
|
||||
};
|
||||
|
||||
template <class Type> struct traits_from<Type *> {
|
||||
static SWIG_Object from SWIG_FROM_DECL_ARGS(Type* val) {
|
||||
return traits_from_ptr<0, Type>::from(val);
|
||||
}
|
||||
};
|
||||
|
||||
template <class Type>
|
||||
inline SWIG_Object from SWIG_FROM_DECL_ARGS(const Type& val) {
|
||||
return traits_from<Type>::from(val);
|
||||
}
|
||||
|
||||
/*
|
||||
Traits that provides the asptr/asval method for an unknown type
|
||||
*/
|
||||
template <class Type>
|
||||
struct traits_asptr {
|
||||
static int asptr SWIG_AS_DECL_ARGS (SWIG_Object obj, Type **val) {
|
||||
Type *p;
|
||||
int res = SWIG_ConvertPtr(obj, %as_voidptrptr(&p), type_info<Type>(), 0);
|
||||
if (SWIG_IsOK(res) && val) *val = p;
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
template <class Type>
|
||||
inline int asptr SWIG_AS_DECL_ARGS(SWIG_Object obj, Type **vptr) {
|
||||
return traits_asptr<Type>::asptr SWIG_AS_CALL_ARGS(obj, vptr);
|
||||
}
|
||||
|
||||
template <class Type>
|
||||
struct traits_asval {
|
||||
static int asval SWIG_AS_DECL_ARGS(SWIG_Object obj, Type *val) {
|
||||
if (val) {
|
||||
Type *p = 0;
|
||||
int res = traits_asptr<Type>::asptr SWIG_AS_CALL_ARGS(obj, &p);
|
||||
if (SWIG_IsOK(res) && p) {
|
||||
*val = *p;
|
||||
if (SWIG_IsNewObj(res)) {
|
||||
%delete(p);
|
||||
res = SWIG_DelNewMask(res);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
} else {
|
||||
return traits_asptr<Type>::asptr SWIG_AS_CALL_ARGS(obj, (Type **)(0));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class Type>
|
||||
inline int asval SWIG_AS_DECL_ARGS (SWIG_Object obj, Type *val) {
|
||||
return traits_asval<Type>::asval SWIG_AS_CALL_ARGS(obj, val);
|
||||
}
|
||||
|
||||
/*
|
||||
Traits that provides the check method for an unknown type
|
||||
*/
|
||||
#define SWIG_CHECK_DECL_ARGS(obj) SWIG_AS_DECL_ARGS(obj, void * = 0)
|
||||
#define SWIG_CHECK_CALL_ARGS(obj) SWIG_AS_CALL_ARGS(obj, 0)
|
||||
|
||||
template <class Type>
|
||||
struct traits_checkval {
|
||||
static int check SWIG_CHECK_DECL_ARGS(SWIG_Object obj) {
|
||||
if (obj) {
|
||||
int res = asval SWIG_AS_CALL_ARGS(obj, (Type *)(0));
|
||||
return SWIG_CheckState(res);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class Type>
|
||||
struct traits_checkptr {
|
||||
static int check SWIG_CHECK_DECL_ARGS(SWIG_Object obj) {
|
||||
if (obj) {
|
||||
int res = asptr SWIG_AS_CALL_ARGS(obj, (Type **)(0));
|
||||
return SWIG_CheckState(res);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class Type>
|
||||
struct traits_check<Type, value_category> : traits_checkval<Type> {
|
||||
};
|
||||
|
||||
template <class Type>
|
||||
struct traits_check<Type, pointer_category> : traits_checkptr<Type> {
|
||||
};
|
||||
|
||||
template <class Type>
|
||||
inline int check SWIG_CHECK_DECL_ARGS(SWIG_Object obj) {
|
||||
return traits_check<Type>::check SWIG_CHECK_CALL_ARGS(obj);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Generate the traits for an unknown SWIGTYPE
|
||||
*/
|
||||
|
||||
%define %traits_swigtype(Type...)
|
||||
%fragment(SWIG_Traits_frag(Type),"header",fragment="Traits") {
|
||||
namespace swig {
|
||||
template <> struct traits<Type > {
|
||||
typedef pointer_category category;
|
||||
static const char* type_name() { return #Type; }
|
||||
};
|
||||
}
|
||||
}
|
||||
%enddef
|
||||
|
||||
|
||||
/*
|
||||
Generate the traits for a 'value' type, such as 'double',
|
||||
for which the SWIG_AsVal and SWIG_From methods are already defined.
|
||||
*/
|
||||
|
||||
%define %traits_value(Type...)
|
||||
%fragment(SWIG_Traits_frag(Type),"header",
|
||||
fragment=SWIG_AsVal_frag(Type),
|
||||
fragment=SWIG_From_frag(Type),
|
||||
fragment="Traits") {
|
||||
namespace swig {
|
||||
template <> struct traits<Type > {
|
||||
typedef value_category category;
|
||||
static const char* type_name() { return #Type; }
|
||||
};
|
||||
|
||||
template <> struct traits_asval<Type > {
|
||||
typedef Type value_type;
|
||||
static int asval SWIG_AS_DECL_ARGS (SWIG_Object obj, value_type *val) {
|
||||
return SWIG_AsVal(Type)(obj, val);
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct traits_from<Type > {
|
||||
typedef Type value_type;
|
||||
static SWIG_Object from SWIG_FROM_DECL_ARGS (const value_type& val) {
|
||||
return SWIG_From(Type)(val);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
%enddef
|
||||
|
||||
/*
|
||||
Generate the traits for a 'pointer' type, such as 'std::string',
|
||||
for which the SWIG_AsPtr and SWIG_From methods are already defined.
|
||||
*/
|
||||
|
||||
%define %traits_pointer(Type...)
|
||||
%fragment(SWIG_Traits_frag(Type),"header",
|
||||
fragment=SWIG_AsVal_frag(Type),
|
||||
fragment=SWIG_From_frag(Type),
|
||||
fragment="Traits") {
|
||||
namespace swig {
|
||||
template <> struct traits<Type > {
|
||||
typedef pointer_category category;
|
||||
static const char* type_name() { return #Type; }
|
||||
};
|
||||
|
||||
template <> struct traits_asptr<Type > {
|
||||
typedef Type value_type;
|
||||
static int asptr SWIG_AS_DECL_ARGS (SWIG_Object obj, value_type **val) {
|
||||
return SWIG_AsPtr(Type)(obj, val);
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct traits_from<Type > {
|
||||
typedef Type value_type;
|
||||
static SWIG_Object from SWIG_FROM_DECL_ARGS (const value_type& val) {
|
||||
return SWIG_From(Type)(val);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
%enddef
|
||||
|
||||
/*
|
||||
Generate the typemaps for a class that has 'value' traits
|
||||
*/
|
||||
|
||||
%define %typemap_traits_value(Code,Type...)
|
||||
%typemaps_asvalfrom(%arg(Code),
|
||||
%arg(swig::asval),
|
||||
%arg(swig::from),
|
||||
%arg(SWIG_Traits_frag(Type)),
|
||||
%arg(SWIG_Traits_frag(Type)),
|
||||
Type);
|
||||
%enddef
|
||||
|
||||
/*
|
||||
Generate the typemaps for a class that has 'pointer' traits
|
||||
*/
|
||||
|
||||
%define %typemap_traits_pointer(Code,Type...)
|
||||
%typemaps_asptrfrom(%arg(Code),
|
||||
%arg(swig::asptr),
|
||||
%arg(swig::from),
|
||||
%arg(SWIG_Traits_frag(Type)),
|
||||
%arg(SWIG_Traits_frag(Type)),
|
||||
Type);
|
||||
%enddef
|
||||
|
||||
|
|
@ -2899,16 +2899,15 @@ c_declaration : c_decl {
|
|||
SWIG_WARN_NODE_END($$);
|
||||
}
|
||||
| USING idcolon EQUAL type plain_declarator SEMI {
|
||||
$$ = new_node("using");
|
||||
Setattr($$,"name",$2);
|
||||
/* Convert using statement to a typedef statement */
|
||||
$$ = new_node("cdecl");
|
||||
SwigType_push($4,$5.type);
|
||||
Setattr($$,"uname",$4);
|
||||
Setattr($$,"type",$4);
|
||||
Setattr($$,"storage","typedef");
|
||||
Setattr($$,"name",$2);
|
||||
Setattr($$,"decl","");
|
||||
SetFlag($$,"typealias");
|
||||
add_symbols($$);
|
||||
SWIG_WARN_NODE_BEGIN($$);
|
||||
Swig_warning(WARN_CPP11_ALIAS_DECLARATION, cparse_file, cparse_line, "The 'using' keyword in type aliasing is not fully supported yet.\n");
|
||||
SWIG_WARN_NODE_END($$);
|
||||
|
||||
$$ = 0; /* TODO - ignored for now */
|
||||
}
|
||||
| TEMPLATE LESSTHAN template_parms GREATERTHAN USING idcolon EQUAL type plain_declarator SEMI {
|
||||
$$ = new_node("using");
|
||||
|
|
|
|||
|
|
@ -188,8 +188,12 @@ public:
|
|||
String *symname = Copy(Getattr(n, "sym:name"));
|
||||
if (symname && !GetFlag(n, "feature:flatnested")) {
|
||||
for (Node *outer_class = Getattr(n, "nested:outer"); outer_class; outer_class = Getattr(outer_class, "nested:outer")) {
|
||||
Push(symname, ".");
|
||||
Push(symname, Getattr(outer_class, "sym:name"));
|
||||
if (String* name = Getattr(outer_class, "sym:name")) {
|
||||
Push(symname, ".");
|
||||
Push(symname, name);
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (nspace) {
|
||||
|
|
|
|||
|
|
@ -4176,7 +4176,6 @@ private:
|
|||
|
||||
Wrapper *dummy = NewWrapper();
|
||||
emit_attach_parmmaps(parms, dummy);
|
||||
DelWrapper(dummy);
|
||||
|
||||
Swig_typemap_attach_parms("gotype", parms, NULL);
|
||||
Swig_typemap_attach_parms("imtype", parms, NULL);
|
||||
|
|
@ -4233,6 +4232,8 @@ private:
|
|||
Swig_typemap_attach_parms("goin", parms, dummy);
|
||||
Swig_typemap_attach_parms("goargout", parms, dummy);
|
||||
|
||||
DelWrapper(dummy);
|
||||
|
||||
if (!is_ignored) {
|
||||
// We use an interface to see if this method is defined in Go.
|
||||
Printv(f_go_wrappers, "type ", interface_name, " interface {\n", NULL);
|
||||
|
|
|
|||
|
|
@ -210,10 +210,14 @@ public:
|
|||
String *nspace = Getattr(n, "sym:nspace");
|
||||
String *symname = Copy(Getattr(n, "sym:name"));
|
||||
if (symname && !GetFlag(n, "feature:flatnested")) {
|
||||
for (Node *outer_class = Getattr(n, "nested:outer"); outer_class; outer_class = Getattr(outer_class, "nested:outer")) {
|
||||
Push(symname, jnidescriptor ? "$" : ".");
|
||||
Push(symname, Getattr(outer_class, "sym:name"));
|
||||
}
|
||||
for (Node *outer_class = Getattr(n, "nested:outer"); outer_class; outer_class = Getattr(outer_class, "nested:outer")) {
|
||||
if (String* name = Getattr(outer_class, "sym:name")) {
|
||||
Push(symname, jnidescriptor ? "$" : ".");
|
||||
Push(symname, name);
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (nspace) {
|
||||
if (package && !jnidescriptor)
|
||||
|
|
|
|||
|
|
@ -856,6 +856,9 @@ public:
|
|||
//Printf(stdout,"Swig_overload_dispatch %s %s '%s' %d\n",symname,wname,dispatch,maxargs);
|
||||
|
||||
if (!luaAddSymbol(lua_name, n)) {
|
||||
DelWrapper(f);
|
||||
Delete(dispatch);
|
||||
Delete(tmp);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -433,6 +433,7 @@ String *Swig_overload_dispatch_cast(Node *n, const_String_or_char_ptr fmt, int *
|
|||
int fn = 0;
|
||||
Node *ni = Getitem(dispatch, i);
|
||||
Parm *pi = Getattr(ni, "wrap:parms");
|
||||
bool implicitconvtypecheckoff = GetFlag(ni, "implicitconvtypecheckoff") != 0;
|
||||
int num_required = emit_num_required(pi);
|
||||
int num_arguments = emit_num_arguments(pi);
|
||||
if (num_arguments > *maxargs)
|
||||
|
|
@ -476,6 +477,7 @@ String *Swig_overload_dispatch_cast(Node *n, const_String_or_char_ptr fmt, int *
|
|||
|
||||
String *tm = Getattr(pj, "tmap:typecheck");
|
||||
if (tm) {
|
||||
tm = Copy(tm);
|
||||
/* normalise for comparison later */
|
||||
Replaceid(tm, Getattr(pj, "lname"), "_v");
|
||||
|
||||
|
|
@ -528,13 +530,14 @@ String *Swig_overload_dispatch_cast(Node *n, const_String_or_char_ptr fmt, int *
|
|||
String *tmp = NewStringf(argv_template_string, j);
|
||||
|
||||
String *conv = Getattr(pj, "implicitconv");
|
||||
if (conv) {
|
||||
if (conv && !implicitconvtypecheckoff) {
|
||||
Replaceall(tm, "$implicitconv", conv);
|
||||
} else {
|
||||
Replaceall(tm, "$implicitconv", "0");
|
||||
}
|
||||
Replaceall(tm, "$input", tmp);
|
||||
Printv(f, "{\n", tm, "}\n", NIL);
|
||||
Delete(tm);
|
||||
fn = i + 1;
|
||||
Printf(f, "if (!_v) goto check_%d;\n", fn);
|
||||
Printf(f, "_ranki += _v*_pi;\n");
|
||||
|
|
@ -574,6 +577,9 @@ String *Swig_overload_dispatch_cast(Node *n, const_String_or_char_ptr fmt, int *
|
|||
if (fn)
|
||||
Printf(f, "check_%d:\n\n", fn);
|
||||
|
||||
if (implicitconvtypecheckoff)
|
||||
Delattr(ni, "implicitconvtypecheckoff");
|
||||
|
||||
Delete(lfmt);
|
||||
Delete(coll);
|
||||
}
|
||||
|
|
@ -607,6 +613,7 @@ String *Swig_overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *
|
|||
int fn = 0;
|
||||
Node *ni = Getitem(dispatch, i);
|
||||
Parm *pi = Getattr(ni, "wrap:parms");
|
||||
bool implicitconvtypecheckoff = GetFlag(ni, "implicitconvtypecheckoff") != 0;
|
||||
int num_required = emit_num_required(pi);
|
||||
int num_arguments = emit_num_arguments(pi);
|
||||
if (num_arguments > *maxargs)
|
||||
|
|
@ -646,6 +653,7 @@ String *Swig_overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *
|
|||
|
||||
String *tm = Getattr(pj, "tmap:typecheck");
|
||||
if (tm) {
|
||||
tm = Copy(tm);
|
||||
/* normalise for comparison later */
|
||||
Replaceid(tm, Getattr(pj, "lname"), "_v");
|
||||
|
||||
|
|
@ -699,13 +707,14 @@ String *Swig_overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *
|
|||
String *tmp = NewStringf(argv_template_string, j);
|
||||
|
||||
String *conv = Getattr(pj, "implicitconv");
|
||||
if (conv) {
|
||||
if (conv && !implicitconvtypecheckoff) {
|
||||
Replaceall(tm, "$implicitconv", conv);
|
||||
} else {
|
||||
Replaceall(tm, "$implicitconv", "0");
|
||||
}
|
||||
Replaceall(tm, "$input", tmp);
|
||||
Printv(f, "{\n", tm, "}\n", NIL);
|
||||
Delete(tm);
|
||||
fn = i + 1;
|
||||
Printf(f, "if (!_v) goto check_%d;\n", fn);
|
||||
}
|
||||
|
|
@ -737,6 +746,9 @@ String *Swig_overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *
|
|||
if (fn)
|
||||
Printf(f, "check_%d:\n\n", fn);
|
||||
|
||||
if (implicitconvtypecheckoff)
|
||||
Delattr(ni, "implicitconvtypecheckoff");
|
||||
|
||||
Delete(lfmt);
|
||||
Delete(coll);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -326,6 +326,7 @@ public:
|
|||
bool isLastOverloaded = isOverloaded && !Getattr(node, "sym:nextSibling");
|
||||
|
||||
if (!isOverloaded && !addSymbol(functionName, node)) {
|
||||
DelWrapper(wrapper);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
|
|
@ -633,7 +634,10 @@ public:
|
|||
|
||||
/* Add function to builder table */
|
||||
addFunctionToScilab(scilabSetFunctionName, setFunctionName);
|
||||
|
||||
DelWrapper(setFunctionWrapper);
|
||||
}
|
||||
DelWrapper(getFunctionWrapper);
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
|
@ -660,7 +664,7 @@ public:
|
|||
if (isConstant || isEnum) {
|
||||
if (isEnum) {
|
||||
Setattr(node, "type", "double");
|
||||
constantValue = Getattr(node, "enumvalue");
|
||||
constantValue = Getattr(node, "value");
|
||||
}
|
||||
|
||||
constantTypemap = Swig_typemap_lookup("scilabconstcode", node, nodeName, 0);
|
||||
|
|
@ -1026,7 +1030,7 @@ public:
|
|||
Printf(gatewayHeaderV5, ",\n");
|
||||
Printf(gatewayHeaderV5, " {(Myinterfun)sci_gateway, (GT)%s, (char *)\"%s\"}", wrapperFunctionName, scilabFunctionName);
|
||||
|
||||
Printf(gatewayHeaderV6, "if (wcscmp(pwstFuncName, L\"%s\") == 0) { addCFunction((wchar_t *)L\"%s\", &%s, (wchar_t *)MODULE_NAME); }\n", scilabFunctionName, scilabFunctionName, wrapperFunctionName);
|
||||
Printf(gatewayHeaderV6, "if (wcscmp(pwstFuncName, L\"%s\") == 0) { addCStackFunction((wchar_t *)L\"%s\", &%s, (wchar_t *)MODULE_NAME); }\n", scilabFunctionName, scilabFunctionName, wrapperFunctionName);
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -265,7 +265,13 @@ class TypePass:private Dispatcher {
|
|||
SwigType *bsmart = Copy(smart);
|
||||
SwigType *rclsname = SwigType_typedef_resolve_all(clsname);
|
||||
SwigType *rbname = SwigType_typedef_resolve_all(bname);
|
||||
Replaceall(bsmart, rclsname, rbname);
|
||||
int replace_count = Replaceall(bsmart, rclsname, rbname);
|
||||
if (replace_count == 0) {
|
||||
// If no replacement made, it will be because rclsname is fully resolved, but the
|
||||
// type in the smartptr feature used a typedef or not fully resolved name.
|
||||
String *firstname = Getattr(first, "name");
|
||||
Replaceall(bsmart, firstname, rbname);
|
||||
}
|
||||
Delete(rclsname);
|
||||
Delete(rbname);
|
||||
String *smartnamestr = SwigType_namestr(smart);
|
||||
|
|
|
|||
|
|
@ -81,9 +81,11 @@ public:
|
|||
virtual int top(Node *n) {
|
||||
if (out == 0) {
|
||||
String *outfile = Getattr(n, "outfile");
|
||||
Replaceall(outfile, ".cxx", ".xml");
|
||||
Replaceall(outfile, ".cpp", ".xml");
|
||||
Replaceall(outfile, ".c", ".xml");
|
||||
String *ext = Swig_file_extension(outfile);
|
||||
// If there's an extension, ext will include the ".".
|
||||
Delslice(outfile, Len(outfile) - Len(ext), DOH_END);
|
||||
Delete(ext);
|
||||
Append(outfile, ".xml");
|
||||
out = NewFile(outfile, "w", SWIG_output_files());
|
||||
if (!out) {
|
||||
FileErrorDisplay(outfile);
|
||||
|
|
|
|||
|
|
@ -291,6 +291,7 @@ int Swig_insert_file(const_String_or_char_ptr filename, File *outfile) {
|
|||
while ((nbytes = Read(f, buffer, 4096)) > 0) {
|
||||
Write(outfile, buffer, nbytes);
|
||||
}
|
||||
fclose(f);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue