Change naming convention for wrapped ctors and dtor
Use Foo_{new,delete}() instead of {new,delete}_Foo() to ensure that all
methods of the class Foo start with the corresponding prefix.
This commit is contained in:
parent
b24665fa6a
commit
bda731cd8f
23 changed files with 95 additions and 87 deletions
|
|
@ -2,11 +2,11 @@
|
|||
#include <assert.h>
|
||||
|
||||
int main(int argc, const char *argv[]) {
|
||||
D *d = new_D();
|
||||
D *d = D_new();
|
||||
|
||||
assert(D_do_x(d) == 1);
|
||||
|
||||
delete_D(d);
|
||||
D_delete(d);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
#include <assert.h>
|
||||
|
||||
int main(int argc, const char *argv[]) {
|
||||
Base *ba = new_Base();
|
||||
Derived *d = new_Derived();
|
||||
Bottom *bo = new_Bottom();
|
||||
Base *ba = Base_new();
|
||||
Derived *d = Derived_new();
|
||||
Bottom *bo = Bottom_new();
|
||||
|
||||
assert(Base_PublicProtectedPublic1(ba) == 0);
|
||||
assert(Base_PublicProtectedPublic2(ba) == 0);
|
||||
|
|
@ -26,9 +26,9 @@ int main(int argc, const char *argv[]) {
|
|||
assert(Bottom_WasProtected3(ba) == 0);
|
||||
assert(Bottom_WasProtected4(ba) == 0);
|
||||
|
||||
delete_Base(ba);
|
||||
delete_Derived(d);
|
||||
delete_Bottom(bo);
|
||||
Base_delete(ba);
|
||||
Derived_delete(d);
|
||||
Bottom_delete(bo);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@
|
|||
#include <assert.h>
|
||||
|
||||
int main(int argc, const char *argv[]) {
|
||||
Engine *e = new_Engine();
|
||||
A *a = new_A();
|
||||
Engine *e = Engine_new();
|
||||
A *a = A_new();
|
||||
|
||||
assert(AbstractBaseClass_write(a, e) == true);
|
||||
|
||||
delete_A(a);
|
||||
delete_Engine(e);
|
||||
A_delete(a);
|
||||
Engine_delete(e);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,17 @@
|
|||
#include <assert.h>
|
||||
|
||||
int main(int argc, const char *argv[]) {
|
||||
B *b = new_B();
|
||||
D *d = new_D();
|
||||
E *e = new_E();
|
||||
B *b = B_new();
|
||||
D *d = D_new();
|
||||
E *e = E_new();
|
||||
|
||||
assert(B_foo(b) == 0);
|
||||
assert(D_foo(d) == 0);
|
||||
assert(E_foo(e) == 0);
|
||||
|
||||
delete_B(b);
|
||||
delete_D(d);
|
||||
delete_E(e);
|
||||
B_delete(b);
|
||||
D_delete(d);
|
||||
E_delete(e);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
#include <assert.h>
|
||||
|
||||
int main(int argc, const char *argv[]) {
|
||||
Foo *f = new_Foo();
|
||||
Foo *f = Foo_new();
|
||||
Foo *f2 = Foo_blah(f);
|
||||
|
||||
assert(f2 != 0);
|
||||
|
||||
delete_Foo(f);
|
||||
delete_Foo(f2);
|
||||
Foo_delete(f);
|
||||
Foo_delete(f2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include <assert.h>
|
||||
|
||||
int main(int argc, const char *argv[]) {
|
||||
Foo *f = new_Foo();
|
||||
Foo *f = Foo_new();
|
||||
|
||||
assert(f != 0);
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ int main(int argc, const char *argv[]) {
|
|||
Foo_seq_set(f, 1);
|
||||
assert(Foo_seq_get(f) == 1);
|
||||
|
||||
delete_Foo(f);
|
||||
Foo_delete(f);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
#include "cast_operator/cast_operator_wrap.h"
|
||||
|
||||
int main() {
|
||||
A *a = new_A();
|
||||
A *a = A_new();
|
||||
if (strcmp(A_tochar(a), "hi"))
|
||||
fprintf(stderr, "cast failed\n");
|
||||
delete_A(a);
|
||||
A_delete(a);
|
||||
SWIG_exit(0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
MyClass *mc = new_MyClass();
|
||||
MyClass *mc = MyClass_new();
|
||||
|
||||
assert(MyClass_someMethod(mc) == 42);
|
||||
|
||||
delete_MyClass(mc);
|
||||
MyClass_delete(mc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
int main(int argc, const char *argv[])
|
||||
{
|
||||
MyClass *mc;
|
||||
mc = new_MyClass();
|
||||
mc = MyClass_new();
|
||||
|
||||
delete_MyClass(mc);
|
||||
MyClass_delete(mc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@
|
|||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
MyClass *mc = new_MyClass();
|
||||
MyClass *mc = MyClass_new();
|
||||
|
||||
assert(MyClass_myPubInt_get(mc) == 42);
|
||||
MyClass_myPubInt_set(mc, 4711);
|
||||
assert(MyClass_myPubInt_get(mc) == 4711);
|
||||
|
||||
delete_MyClass(mc);
|
||||
MyClass_delete(mc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,15 +6,15 @@ int main(int argc, const char *argv[])
|
|||
MyClass *mc;
|
||||
MySecondClass *mc2;
|
||||
|
||||
mc2 = new_MySecondClass();
|
||||
mc = new_MyClass();
|
||||
mc2 = MySecondClass_new();
|
||||
mc = MyClass_new();
|
||||
|
||||
assert(MySecondClass_myPubClassInstance_get(mc2));
|
||||
MySecondClass_myPubClassInstance_set(mc2, mc);
|
||||
assert(MySecondClass_myPubClassInstance_get(mc2));
|
||||
|
||||
delete_MyClass(mc);
|
||||
delete_MySecondClass(mc2);
|
||||
MyClass_delete(mc);
|
||||
MySecondClass_delete(mc2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
|
||||
int main()
|
||||
{
|
||||
BaseClass *bc = new_BaseClass();
|
||||
NonMethodOverwritingClass *noc = new_NonMethodOverwritingClass();
|
||||
MethodOverwritingClass *oc = new_MethodOverwritingClass();
|
||||
BaseClass *inherited_bc = (BaseClass*)new_MethodOverwritingClass();
|
||||
BaseClass *bc = BaseClass_new();
|
||||
NonMethodOverwritingClass *noc = NonMethodOverwritingClass_new();
|
||||
MethodOverwritingClass *oc = MethodOverwritingClass_new();
|
||||
BaseClass *inherited_bc = (BaseClass*)MethodOverwritingClass_new();
|
||||
|
||||
assert(BaseClass_myInt(bc) == 0xba53);
|
||||
assert(NonMethodOverwritingClass_myInt(noc) == 0xba53);
|
||||
|
|
@ -15,10 +15,10 @@ int main()
|
|||
assert(BaseClass_myInt((BaseClass*)oc) == 0xa173123d);
|
||||
assert(BaseClass_myInt(inherited_bc) == 0xa173123d);
|
||||
|
||||
delete_BaseClass(bc);
|
||||
delete_NonMethodOverwritingClass(noc);
|
||||
delete_MethodOverwritingClass(oc);
|
||||
delete_BaseClass(inherited_bc);
|
||||
BaseClass_delete(bc);
|
||||
NonMethodOverwritingClass_delete(noc);
|
||||
MethodOverwritingClass_delete(oc);
|
||||
BaseClass_delete(inherited_bc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
int main(int argc, const char *argv[])
|
||||
{
|
||||
myNamespace_MyClass *mc;
|
||||
mc = new_myNamespace_MyClass();
|
||||
mc = myNamespace_MyClass_new();
|
||||
|
||||
delete_myNamespace_MyClass(mc);
|
||||
myNamespace_MyClass_delete(mc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int main(int argc, const char *argv[]) {
|
||||
Foo *f = new_Foo(5);
|
||||
Foo *f = Foo_new(5);
|
||||
|
||||
// test global static variables
|
||||
// TODO: Implement or document as not available
|
||||
|
|
@ -36,7 +36,7 @@ int main(int argc, const char *argv[]) {
|
|||
// because of unclear implementation details
|
||||
//assert(c_init_ref != 0);
|
||||
|
||||
Bar *b = new_Bar();
|
||||
Bar *b = Bar_new();
|
||||
|
||||
// check default value set by constructor
|
||||
assert(Bar_cint_get(b) == 3);
|
||||
|
|
@ -55,9 +55,9 @@ int main(int argc, const char *argv[]) {
|
|||
Foo_num_set(Bar_fref_get(b), 1);
|
||||
assert(Foo_num_get(Bar_fref_get(b)) == 1);
|
||||
// create new Bar instance and check static member value
|
||||
Bar *b2 = new_Bar();
|
||||
Bar *b2 = Bar_new();
|
||||
assert(Foo_num_get(Bar_fref_get(b2)) == 1);
|
||||
delete_Bar(b2);
|
||||
Bar_delete(b2);
|
||||
b2 = 0;
|
||||
|
||||
// Try to set a pointer
|
||||
|
|
@ -68,7 +68,7 @@ int main(int argc, const char *argv[]) {
|
|||
|
||||
Foo *f2 = Bar_testFoo(b, 2, f);
|
||||
assert(Foo_num_get(f2) == 11);
|
||||
delete_Foo(f2);
|
||||
Foo_delete(f2);
|
||||
f2 = 0;
|
||||
|
||||
// test static variables
|
||||
|
|
@ -93,16 +93,16 @@ int main(int argc, const char *argv[]) {
|
|||
assert(test_func_ptr(f, 2) == -14);
|
||||
#endif
|
||||
|
||||
delete_Bar(b);
|
||||
delete_Foo(f);
|
||||
Bar_delete(b);
|
||||
Foo_delete(f);
|
||||
|
||||
Fl_Window *w = new_Fl_Window();
|
||||
Fl_Window *w = Fl_Window_new();
|
||||
// Test whether macro worked for code extension
|
||||
// and test optional function parameters
|
||||
Fl_Window_show(w);
|
||||
Fl_Window_show_pv(w, 0);
|
||||
Fl_Window_show_pv_pv(w, 0, 0);
|
||||
delete_Fl_Window(w);
|
||||
Fl_Window_delete(w);
|
||||
w = 0;
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
#include "cpp_basic_template_class/cpp_basic_template_class_wrap.h"
|
||||
|
||||
int main() {
|
||||
MyTemplateClass_Int *ci = new_MyTemplateClass_Int();
|
||||
MyTemplateClass_Int *ci = MyTemplateClass_Int_new();
|
||||
|
||||
MyTemplateClass_Int_someMemberVariable_set(ci, 42);
|
||||
assert(MyTemplateClass_Int_someMemberVariable_get(ci) == 42);
|
||||
|
||||
delete_MyTemplateClass_Int(ci);
|
||||
MyTemplateClass_Int_delete(ci);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ int main(int argc, const char *argv[]) {
|
|||
int e = ENUM_ONE, *p;
|
||||
|
||||
// check the constructor's default value
|
||||
StructWithEnums *s = new_StructWithEnums();
|
||||
StructWithEnums *s = StructWithEnums_new();
|
||||
assert(StructWithEnums_some_enum_get(s) == ENUM_ONE);
|
||||
|
||||
// check setter
|
||||
|
|
@ -43,9 +43,9 @@ int main(int argc, const char *argv[]) {
|
|||
p = StructWithEnums_enum_test8(s);
|
||||
assert(*p == ENUM_TWO);
|
||||
|
||||
delete_StructWithEnums(s);
|
||||
StructWithEnums_delete(s);
|
||||
|
||||
Foo *f = new_Foo();
|
||||
Foo *f = Foo_new();
|
||||
|
||||
// check the constructor's default value
|
||||
assert(Foo_hola_get(f) == Foo_Hello);
|
||||
|
|
@ -53,7 +53,7 @@ int main(int argc, const char *argv[]) {
|
|||
Foo_hola_set(f, Foo_Hi);
|
||||
assert(Foo_hola_get(f) == Foo_Hi);
|
||||
|
||||
delete_Foo(f);
|
||||
Foo_delete(f);
|
||||
|
||||
//check C enum
|
||||
hi = Hi;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include "exception_order/exception_order_wrap.h"
|
||||
|
||||
int main() {
|
||||
A* a = new_A();
|
||||
A* a = A_new();
|
||||
|
||||
SWIG_try {
|
||||
A_foo(a);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
int main() {
|
||||
Op_sanity_check();
|
||||
|
||||
Op *op1 = new_Op_i(1), *op2 = new_Op_i(2), *op3 = copy_Op(op1);
|
||||
Op *op1 = Op_new_i(1), *op2 = Op_new_i(2), *op3 = Op_copy(op1);
|
||||
|
||||
assert(Op_NotEqual(op1, op2), "neq failed");
|
||||
Op_PlusPlusPrefix(op3);
|
||||
|
|
@ -18,8 +18,8 @@ int main() {
|
|||
assert(3 == *Op_IndexInto(op3, Op_IndexIntoConst(op2, Op_Functor(op1))), "[] or () failed");
|
||||
assert(5 == Op_Functor_i(op3, 2), "f(x) failed");
|
||||
|
||||
delete_Op(op1);
|
||||
delete_Op(op2);
|
||||
delete_Op(op3);
|
||||
Op_delete(op1);
|
||||
Op_delete(op2);
|
||||
Op_delete(op3);
|
||||
SWIG_exit(0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue