small fixes to make octave module compatible with octave 3.2

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11388 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Xavier Delacour 2009-07-12 20:23:19 +00:00
commit cdc9de8210
4 changed files with 60 additions and 1 deletions

View file

@ -13,7 +13,8 @@ char cvsroot_octave_cxx[] = "$Id$";
static const char *usage = (char *) "\
Octave Options (available with -octave)\n\
(none yet)\n\n";
-api <N> - Generate code that assume octave API N [default: 37]\n\
\n";
class OCTAVE:public Language {
@ -35,6 +36,8 @@ private:
int have_destructor;
String *constructor_name;
int api_version;
Hash *docs;
public:
@ -53,6 +56,7 @@ public:
director_multiple_inheritance = 1;
director_language = 1;
docs = NewHash();
api_version = 37;
}
virtual void main(int argc, char *argv[]) {
@ -60,6 +64,15 @@ public:
if (argv[i]) {
if (strcmp(argv[i], "-help") == 0) {
fputs(usage, stderr);
} else if (strcmp(argv[i], "-api") == 0) {
if (argv[i + 1]) {
api_version = atoi(argv[i + 1]);
Swig_mark_arg(i);
Swig_mark_arg(i + 1);
i++;
} else {
Swig_arg_error();
}
}
}
}
@ -125,6 +138,7 @@ public:
Printf(f_runtime, "#define SWIGOCTAVE\n");
Printf(f_runtime, "#define SWIG_name_d \"%s\"\n", module);
Printf(f_runtime, "#define SWIG_name %s\n", module);
Printf(f_runtime, "#define USE_OCTAVE_API_VERSION %i\n", api_version);
if (directorsEnabled()) {
Printf(f_runtime, "#define SWIG_DIRECTORS\n");