remove Octave -api option and use new OCTAVE_API_VERSION_NUMBER instead

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11780 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2009-12-12 21:11:45 +00:00
commit 9354467b87
4 changed files with 21 additions and 38 deletions

View file

@ -1,6 +1,10 @@
Version 1.3.41 (in progress) Version 1.3.41 (in progress)
============================ ============================
2009-12-12: wsfulton
[Octave] Remove the -api option and use the new OCTAVE_API_VERSION_NUMBER
macro provided in the octave headers for determining the api version instead.
2009-12-04: olly 2009-12-04: olly
[Ruby] Improve support for Ruby 1.9 under GCC. Addresses part of [Ruby] Improve support for Ruby 1.9 under GCC. Addresses part of
SF#2859614. SF#2859614.

View file

@ -1,24 +1,16 @@
#if OCTAVE_API_VERSION_OPTION>0
#define USE_OCTAVE_API_VERSION OCTAVE_API_VERSION_OPTION
#else
#include <octave/version.h> #include <octave/version.h>
#ifdef OCTAVE_API_VERSION_N #ifndef OCTAVE_API_VERSION_NUMBER
#define USE_OCTAVE_API_VERSION OCTAVE_API_VERSION_N
#else // Interim hack to distinguish between Octave 3.2 and earlier versions. // Hack to distinguish between Octave 3.2 and earlier versions before OCTAVE_API_VERSION_NUMBER existed
#define ComplexLU __ignore
#define ComplexLU __ignore #include <octave/CmplxLU.h>
#include <octave/CmplxLU.h> #undef ComplexLU
#undef ComplexLU #ifdef octave_Complex_LU_h
#ifdef octave_Complex_LU_h # define OCTAVE_API_VERSION_NUMBER 36
#define USE_OCTAVE_API_VERSION 36 #else
#else # define OCTAVE_API_VERSION_NUMBER 37
#define USE_OCTAVE_API_VERSION 37 #endif
#endif
#endif
#endif #endif
@ -469,7 +461,7 @@ namespace Swig {
install_builtin_function(it->second.first->method, it->first, install_builtin_function(it->second.first->method, it->first,
it->second.first->doc?it->second.first->doc:std::string()); it->second.first->doc?it->second.first->doc:std::string());
else if (it->second.second.is_defined()) { else if (it->second.second.is_defined()) {
#if USE_OCTAVE_API_VERSION<37 #if OCTAVE_API_VERSION_NUMBER<37
link_to_global_variable(curr_sym_tab->lookup(it->first, true)); link_to_global_variable(curr_sym_tab->lookup(it->first, true));
#else #else
symbol_table::varref(it->first); symbol_table::varref(it->first);
@ -477,7 +469,7 @@ namespace Swig {
#endif #endif
set_global_value(it->first, it->second.second); set_global_value(it->first, it->second.second);
#if USE_OCTAVE_API_VERSION<37 #if OCTAVE_API_VERSION_NUMBER<37
octave_swig_type *ost = Swig::swig_value_deref(it->second.second); octave_swig_type *ost = Swig::swig_value_deref(it->second.second);
if (ost) { if (ost) {
const char* h = ost->help_text(); const char* h = ost->help_text();
@ -1389,7 +1381,7 @@ SWIGRUNTIME swig_module_info *SWIG_Octave_GetModule(void *clientdata) {
SWIGRUNTIME void SWIG_Octave_SetModule(void *clientdata, swig_module_info *pointer) { SWIGRUNTIME void SWIG_Octave_SetModule(void *clientdata, swig_module_info *pointer) {
octave_value ov = new octave_swig_packed(0, &pointer, sizeof(swig_module_info *)); octave_value ov = new octave_swig_packed(0, &pointer, sizeof(swig_module_info *));
const char *module_var = "__SWIG_MODULE__" SWIG_TYPE_TABLE_NAME SWIG_RUNTIME_VERSION; const char *module_var = "__SWIG_MODULE__" SWIG_TYPE_TABLE_NAME SWIG_RUNTIME_VERSION;
#if USE_OCTAVE_API_VERSION<37 #if OCTAVE_API_VERSION_NUMBER<37
link_to_global_variable(curr_sym_tab->lookup(module_var, true)); link_to_global_variable(curr_sym_tab->lookup(module_var, true));
#else #else
symbol_table::varref(module_var); symbol_table::varref(module_var);

View file

@ -72,7 +72,7 @@ DEFUN_DLD (SWIG_name,args,nargout,SWIG_name_d) {
module_ns->install_global(); module_ns->install_global();
module_ns->decref(); module_ns->decref();
#if USE_OCTAVE_API_VERSION<37 #if OCTAVE_API_VERSION_NUMBER<37
link_to_global_variable(curr_sym_tab->lookup(SWIG_name_d,true)); link_to_global_variable(curr_sym_tab->lookup(SWIG_name_d,true));
#else #else
symbol_table::varref(SWIG_name_d); symbol_table::varref(SWIG_name_d);
@ -80,7 +80,7 @@ DEFUN_DLD (SWIG_name,args,nargout,SWIG_name_d) {
#endif #endif
set_global_value(SWIG_name_d,Swig::swig_value_ref(module_ns)); set_global_value(SWIG_name_d,Swig::swig_value_ref(module_ns));
#if USE_OCTAVE_API_VERSION>=37 #if OCTAVE_API_VERSION_NUMBER>=37
mlock(); mlock();
#endif #endif
@ -89,7 +89,7 @@ DEFUN_DLD (SWIG_name,args,nargout,SWIG_name_d) {
// workaround bug in octave where installing global variable of custom type and then // workaround bug in octave where installing global variable of custom type and then
// exiting without explicitly clearing the variable causes octave to segfault. // exiting without explicitly clearing the variable causes octave to segfault.
#if USE_OCTAVE_API_VERSION>=37 #if OCTAVE_API_VERSION_NUMBER>=37
struct oct_file_unload { struct oct_file_unload {
~oct_file_unload() { ~oct_file_unload() {
string_vector vars = symbol_table::global_variable_names(); string_vector vars = symbol_table::global_variable_names();

View file

@ -13,7 +13,7 @@ char cvsroot_octave_cxx[] = "$Id$";
static const char *usage = (char *) "\ static const char *usage = (char *) "\
Octave Options (available with -octave)\n\ Octave Options (available with -octave)\n\
-api <N> - Generate code that assumes Octave API N [default: 37]\n\ [no additional options]\n\
\n"; \n";
@ -36,8 +36,6 @@ private:
int have_destructor; int have_destructor;
String *constructor_name; String *constructor_name;
int api_version;
Hash *docs; Hash *docs;
public: public:
@ -56,7 +54,6 @@ public:
director_multiple_inheritance = 1; director_multiple_inheritance = 1;
director_language = 1; director_language = 1;
docs = NewHash(); docs = NewHash();
api_version = 0;
} }
virtual void main(int argc, char *argv[]) { virtual void main(int argc, char *argv[]) {
@ -64,15 +61,6 @@ public:
if (argv[i]) { if (argv[i]) {
if (strcmp(argv[i], "-help") == 0) { if (strcmp(argv[i], "-help") == 0) {
fputs(usage, stderr); 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();
}
} }
} }
} }
@ -138,7 +126,6 @@ public:
Printf(f_runtime, "#define SWIGOCTAVE\n"); Printf(f_runtime, "#define SWIGOCTAVE\n");
Printf(f_runtime, "#define SWIG_name_d \"%s\"\n", module); Printf(f_runtime, "#define SWIG_name_d \"%s\"\n", module);
Printf(f_runtime, "#define SWIG_name %s\n", module); Printf(f_runtime, "#define SWIG_name %s\n", module);
Printf(f_runtime, "#define OCTAVE_API_VERSION_OPTION %i\n", api_version);
if (directorsEnabled()) { if (directorsEnabled()) {
Printf(f_runtime, "#define SWIG_DIRECTORS\n"); Printf(f_runtime, "#define SWIG_DIRECTORS\n");