scilab: rename swig_this(), swig_ptr() to SWIG_this(), SWIG_ptr()

This commit is contained in:
Simon Marchetto 2014-06-26 09:44:49 +02:00
commit 821118de9b
7 changed files with 21 additions and 21 deletions

View file

@ -747,8 +747,8 @@ However, in some cases it can be useful, such as for testing or debugging.
<p> <p>
SWIG comes with two pointer utility functions: SWIG comes with two pointer utility functions:
<ul> <ul>
<li><tt>swig_this()</tt>: returns the address value of a pointer</li> <li><tt>SWIG_this()</tt>: returns the address value of a pointer</li>
<li><tt>swig_ptr()</tt>: creates a pointer from an address value</li> <li><tt>SWIG_ptr()</tt>: creates a pointer from an address value</li>
</ul> </ul>
</p> </p>
@ -757,12 +757,12 @@ SWIG comes with two pointer utility functions:
<div class="targetlang"><pre> <div class="targetlang"><pre>
--&gt; f = fopen("junk", "w"); --&gt; f = fopen("junk", "w");
--&gt; fputs("Hello", f); --&gt; fputs("Hello", f);
--&gt; addr = swig_this(f) --&gt; addr = SWIG_this(f)
ans = ans =
8219088. 8219088.
--&gt; p = swig_ptr(addr); --&gt; p = SWIG_ptr(addr);
--&gt; fputs(" World", p); --&gt; fputs(" World", p);
--&gt; fclose(f); --&gt; fclose(f);
</pre></div> </pre></div>
@ -770,12 +770,12 @@ SWIG comes with two pointer utility functions:
<H4><a name="Scilab_wrapping_pointers_null_pointers"></a>Null pointers</H4> <H4><a name="Scilab_wrapping_pointers_null_pointers"></a>Null pointers</H4>
<p>By default, Scilab does not provide a way to test or create null pointers. <p>By default, Scilab does not provide a way to test or create null pointers.
But it is possible to have a null pointer by using the previous functions <tt>swig_this()</tt> and <tt>swig_ptr()</tt>, like this: But it is possible to have a null pointer by using the previous functions <tt>SWIG_this()</tt> and <tt>SWIG_ptr()</tt>, like this:
</p> </p>
<div class="targetlang"><pre> <div class="targetlang"><pre>
--&gt; p = swig_ptr(0); --&gt; p = SWIG_ptr(0);
--&gt; swig_this(p) == 0 --&gt; SWIG_this(p) == 0
ans = ans =
T T

View file

@ -1,7 +1,7 @@
exec("swigtest.start", -1); exec("swigtest.start", -1);
p = getnull(); p = getnull();
checkequal(swig_this(p), 0, "swig_this(p)"); checkequal(SWIG_this(p), 0, "SWIG_this(p)");
checkequal(func(p), %T, "func(p)"); checkequal(func(p), %T, "func(p)");
exec("swigtest.quit", -1); exec("swigtest.quit", -1);

View file

@ -1,6 +1,6 @@
exec("swigtest.start", -1); exec("swigtest.start", -1);
NULL = swig_ptr(0); NULL = SWIG_ptr(0);
p = new_Pop(NULL); p = new_Pop(NULL);
p = new_Pop(NULL, %T); p = new_Pop(NULL, %T);

View file

@ -2,17 +2,17 @@ exec("swigtest.start", -1);
// Test on NULL // Test on NULL
null = getNull(); null = getNull();
checkequal(swig_this(null), 0, "swig_this(null)"); checkequal(SWIG_this(null), 0, "SWIG_this(null)");
null = swig_ptr(0); null = SWIG_ptr(0);
checkequal(isNull(null), %T, "func(null)"); checkequal(isNull(null), %T, "func(null)");
// Test on variable // Test on variable
expected_foo_addr = getFooAddress(); expected_foo_addr = getFooAddress();
foo_addr = swig_this(pfoo_get()); foo_addr = SWIG_this(pfoo_get());
checkequal(foo_addr, expected_foo_addr, "swig_this(pfoo_get())"); checkequal(foo_addr, expected_foo_addr, "SWIG_this(pfoo_get())");
pfoo = swig_ptr(foo_addr); pfoo = SWIG_ptr(foo_addr);
checkequal(equalFooPointer(pfoo), %T, "equalFooPointer(pfoo)"); checkequal(equalFooPointer(pfoo), %T, "equalFooPointer(pfoo)");
exec("swigtest.quit", -1); exec("swigtest.quit", -1);

View file

@ -8,13 +8,13 @@ Foo_memberfunc(f);
Foo_staticmemberfunc(); Foo_staticmemberfunc();
v1 = vfunc1(f); v1 = vfunc1(f);
checkequal(swig_this(v1), swig_this(f), "vfunc1(f) <> f"); checkequal(SWIG_this(v1), SWIG_this(f), "vfunc1(f) <> f");
v2 = vfunc2(f); v2 = vfunc2(f);
checkequal(swig_this(v2), swig_this(f), "vfunc2(f) <> f"); checkequal(SWIG_this(v2), SWIG_this(f), "vfunc2(f) <> f");
v3 = vfunc3(v1); v3 = vfunc3(v1);
checkequal(swig_this(v3), swig_this(f), "vfunc3(f) <> f"); checkequal(SWIG_this(v3), SWIG_this(f), "vfunc3(f) <> f");
Foo_memberfunc(v3); Foo_memberfunc(v3);

View file

@ -267,7 +267,7 @@ SWIG_Scilab_Raise(const int obj, const char *type, swig_type_info *descriptor) {
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
int swig_this(SWIG_GatewayParameters) { int SWIG_this(SWIG_GatewayParameters) {
void *ptrValue = NULL; void *ptrValue = NULL;
if (SwigScilabPtrToObject(pvApiCtx, 1, &ptrValue, NULL, 0, fname) == SWIG_OK) { if (SwigScilabPtrToObject(pvApiCtx, 1, &ptrValue, NULL, 0, fname) == SWIG_OK) {
SWIG_Scilab_SetOutputPosition(1); SWIG_Scilab_SetOutputPosition(1);
@ -284,7 +284,7 @@ int swig_this(SWIG_GatewayParameters) {
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
int swig_ptr(SWIG_GatewayParameters) { int SWIG_ptr(SWIG_GatewayParameters) {
double dValue = 0; double dValue = 0;
int *piAddr; int *piAddr;
SciErr sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); SciErr sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);

View file

@ -750,8 +750,8 @@ public:
* addHelperFunctions() * addHelperFunctions()
* ----------------------------------------------------------------------- */ * ----------------------------------------------------------------------- */
void addHelperFunctions() { void addHelperFunctions() {
addFunctionToScilab("swig_this", "swig_this"); addFunctionToScilab("SWIG_this", "SWIG_this");
addFunctionToScilab("swig_ptr", "swig_ptr"); addFunctionToScilab("SWIG_ptr", "SWIG_ptr");
} }
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------