octave: export function swig_octave_prereq() for easily testing Octave version

This commit is contained in:
Karl Wette 2016-02-07 18:20:56 +01:00
commit b93b1871a9
2 changed files with 23 additions and 4 deletions

View file

@ -61,9 +61,8 @@ testme
testme
clear all
# octave 3.0.5 randomly crashes on the remaining tests, so skip them
api_version = sscanf(octave_config_info("api_version"), "api-v%i");
if api_version < 37
# octave 3.0.5 randomly crashes on the remaining tests
if !swig_octave_prereq(3,2,0)
exit
endif

View file

@ -182,6 +182,23 @@ DEFUN_DLD( swig_this, args, nargout, swig_this_usage ) {
return octave_value(octave_uint64((unsigned long long) ost->swig_this()));
}
static const char *const swig_octave_prereq_usage = "-*- texinfo -*- \n\
@deftypefn {Loadable Function} {} swig_octave_prereq(@var{major}, @var{minor}, @var{patch})\n\
Return true if the version of Octave is at least @var{major}.@var{minor}.@var{patch}.\n\
@end deftypefn";
DEFUN_DLD( swig_octave_prereq, args, nargout, swig_octave_prereq_usage ) {
if (args.length() != 3) {
error("swig_octave_prereq: must be called with 3 arguments");
return octave_value_list();
}
const int major = args(0).int_value();
const int minor = args(1).int_value();
const int patch = args(2).int_value();
const bool prereq = SWIG_OCTAVE_PREREQ(major, minor, patch);
return octave_value(prereq);
}
static const char *const SWIG_name_usage = "-*- texinfo -*- \n\
@deftypefn {Loadable Module} {} " SWIG_name_d "\n\
Loads the SWIG-generated module `" SWIG_name_d "'.\n\
@ -235,6 +252,9 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) {
octave_function *me = octave_call_stack::current();
if (!SWIG_Octave_InstallFunction(me, "subclass")) {
return octave_value_list();
}
if (!SWIG_Octave_InstallFunction(me, "swig_type")) {
return octave_value_list();
}
@ -244,7 +264,7 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) {
if (!SWIG_Octave_InstallFunction(me, "swig_this")) {
return octave_value_list();
}
if (!SWIG_Octave_InstallFunction(me, "subclass")) {
if (!SWIG_Octave_InstallFunction(me, "swig_octave_prereq")) {
return octave_value_list();
}