Attempting fixes for Octave shared_ptr support
This commit is contained in:
parent
aa4d034e8e
commit
e301457a43
6 changed files with 627 additions and 19 deletions
|
|
@ -90,6 +90,8 @@ public:
|
|||
}
|
||||
|
||||
virtual void main(int argc, char *argv[]) {
|
||||
int cppcast = 1;
|
||||
|
||||
for (int i = 1; i < argc; i++) {
|
||||
if (argv[i]) {
|
||||
if (strcmp(argv[i], "-help") == 0) {
|
||||
|
|
@ -112,6 +114,12 @@ public:
|
|||
} else {
|
||||
Swig_arg_error();
|
||||
}
|
||||
} else if (strcmp(argv[i], "-cppcast") == 0) {
|
||||
cppcast = 1;
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i], "-nocppcast") == 0) {
|
||||
cppcast = 0;
|
||||
Swig_mark_arg(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -120,6 +128,8 @@ public:
|
|||
global_name = NewString("cvar");
|
||||
if (!op_prefix)
|
||||
op_prefix = NewString("op_");
|
||||
if(cppcast)
|
||||
Preprocessor_define((DOH *) "SWIG_CPLUSPLUS_CAST", 0);
|
||||
|
||||
SWIG_library_directory("octave");
|
||||
Preprocessor_define("SWIGOCTAVE 1", 0);
|
||||
|
|
@ -952,7 +962,26 @@ public:
|
|||
SwigType *t = Copy(Getattr(n, "name"));
|
||||
SwigType_add_pointer(t);
|
||||
|
||||
String *smartptr = Getattr(n, "feature:smartptr"); // Replace storing a pointer to underlying class with a smart pointer (intended for use with non-intrusive smart pointers)
|
||||
SwigType *smart = 0;
|
||||
if (smartptr) {
|
||||
SwigType *cpt = Swig_cparse_type(smartptr);
|
||||
if (cpt) {
|
||||
smart = SwigType_typedef_resolve_all(cpt);
|
||||
Delete(cpt);
|
||||
} else {
|
||||
// TODO: report line number of where the feature comes from
|
||||
Swig_error(Getfile(n), Getline(n), "Invalid type (%s) in 'smartptr' feature for class %s.\n", smartptr, class_name);
|
||||
}
|
||||
}
|
||||
String *wrap_class = NewStringf("&_wrap_class_%s", class_name);
|
||||
if(smart){
|
||||
SwigType_add_pointer(smart);
|
||||
SwigType_remember_clientdata(smart, wrap_class);
|
||||
}
|
||||
Delete(smart);
|
||||
Delete(smartptr);
|
||||
//String *wrap_class = NewStringf("&_wrap_class_%s", class_name);
|
||||
SwigType_remember_clientdata(t, wrap_class);
|
||||
|
||||
int use_director = Swig_directorclass(n);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue