Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Octave: cleanup/restructure library files"
This reverts commit bf12d76. Reverting a series of Octave commits for re-applying again without incorrect whitespace changes.
- Loading branch information
Showing
42 changed files
with
3,601 additions
and
4,187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
// | ||
// attribute.i - Attribute support | ||
// | ||
|
||
%include <typemaps/attribute.swg> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
// | ||
// carrays.i - Manipulate simple pointers as arrays | ||
// | ||
|
||
%define %array_class(TYPE,NAME) | ||
%array_class_wrap(TYPE,NAME,__paren__,__paren_asgn__) | ||
%array_class_wrap(TYPE,NAME,__paren__,__paren_asgn__) | ||
%enddef | ||
|
||
%include <typemaps/carrays.swg> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
// | ||
// cdata.i - Manipulate raw C data as strings | ||
// | ||
|
||
%include <typemaps/cdata.swg> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
// | ||
// cmalloc.i - Object creation using C malloc() | ||
// | ||
|
||
%include <typemaps/cmalloc.swg> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
/* ----------------------------------------------------------------------------- | ||
* director.swg | ||
* | ||
* This file contains support for director classes so that D proxy | ||
* methods can be called from C++. | ||
* ----------------------------------------------------------------------------- */ | ||
|
||
# define SWIG_DIRECTOR_CAST(ARG) dynamic_cast<Swig::Director *>(ARG) | ||
|
||
#include <exception> | ||
|
||
namespace Swig { | ||
|
||
class Director { | ||
octave_swig_type *self; | ||
bool swig_disowned; | ||
|
||
Director(const Director &x); | ||
Director &operator=(const Director &rhs); | ||
public: | ||
|
||
Director(void *vptr):self(0), swig_disowned(false) { | ||
set_rtdir(vptr, this); | ||
} | ||
|
||
~Director() { | ||
swig_director_destroyed(self, this); | ||
if (swig_disowned) | ||
self->decref(); | ||
} | ||
|
||
void swig_set_self(octave_swig_type *new_self) { | ||
assert(!swig_disowned); | ||
self = new_self; | ||
} | ||
|
||
octave_swig_type *swig_get_self() const { | ||
return self; | ||
} | ||
|
||
void swig_disown() { | ||
if (swig_disowned) | ||
return; | ||
swig_disowned = true; | ||
self->incref(); | ||
} | ||
}; | ||
|
||
struct DirectorTypeMismatchException { | ||
static void raise(const char *msg) { | ||
// ... todo | ||
throw(DirectorTypeMismatchException()); | ||
} | ||
|
||
static void raise(const octave_value &ov, const char *msg) { | ||
// ... todo | ||
raise(msg); | ||
} | ||
}; | ||
|
||
struct DirectorPureVirtualException { | ||
static void raise(const char *msg) { | ||
// ... todo | ||
throw(DirectorPureVirtualException()); | ||
} | ||
|
||
static void raise(const octave_value &ov, const char *msg) { | ||
// ... todo | ||
raise(msg); | ||
} | ||
}; | ||
|
||
SWIGINTERN rtdir_map *get_rtdir_map() { | ||
static swig_module_info *module = 0; | ||
if (!module) | ||
module = SWIG_GetModule(0); | ||
if (!module) | ||
return 0; | ||
if (!module->clientdata) | ||
module->clientdata = new rtdir_map; | ||
return (rtdir_map *) module->clientdata; | ||
} | ||
|
||
SWIGINTERNINLINE void set_rtdir(void *vptr, Director *d) { | ||
rtdir_map *rm = get_rtdir_map(); | ||
if (rm) | ||
(*rm)[vptr] = d; | ||
} | ||
|
||
SWIGINTERNINLINE void erase_rtdir(void *vptr) { | ||
rtdir_map *rm = get_rtdir_map(); | ||
if (rm) | ||
(*rm).erase(vptr); | ||
} | ||
|
||
SWIGINTERNINLINE Director *get_rtdir(void *vptr) { | ||
rtdir_map *rm = get_rtdir_map(); | ||
if (!rm) | ||
return 0; | ||
rtdir_map::const_iterator pos = rm->find(vptr); | ||
Director *rtdir = (pos != rm->end())? pos->second : 0; | ||
return rtdir; | ||
} | ||
|
||
SWIGRUNTIME void swig_director_destroyed(octave_swig_type *self, Director *d) { | ||
self->director_destroyed(d); | ||
} | ||
|
||
SWIGRUNTIME octave_swig_type *swig_director_get_self(Director *d) { | ||
return d->swig_get_self(); | ||
} | ||
|
||
SWIGRUNTIME void swig_director_set_self(Director *d, octave_swig_type *self) { | ||
d->swig_set_self(self); | ||
} | ||
|
||
} | ||
|
||
SWIGRUNTIME void swig_acquire_ownership(void *vptr) { | ||
// assert(0); | ||
// ... todo | ||
} | ||
|
||
SWIGRUNTIME void swig_acquire_ownership_array(void *vptr) { | ||
// assert(0); | ||
// ... todo | ||
} | ||
|
||
SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own) { | ||
// assert(0); | ||
// ... todo | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
// | ||
// exception.i - C++ exception support | ||
// | ||
|
||
%include <typemaps/exception.swg> | ||
|
||
|
||
%insert("runtime") { | ||
%define_as(SWIG_exception(code, msg), %block(%error(code, msg); SWIG_fail; )) | ||
%define_as(SWIG_exception(code, msg), %block(%error(code, msg); SWIG_fail; )) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
// | ||
// factory.i - Factory method wrapping | ||
// | ||
|
||
%include <typemaps/factory.swg> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
// | ||
// implicit.i - %implicit directive | ||
// | ||
|
||
%include <std_common.i> | ||
%include <typemaps/implicit.swg> | ||
|
||
#warning "This file provides the %implicit directive, which is an old and fragile" | ||
#warning "way to implement the C++ implicit conversion mechanism." | ||
#warning "Try using the more robust '%implicitconv Type;' directive instead." | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,8 @@ | ||
// | ||
// octave.swg - Octave configuration module | ||
// | ||
|
||
// Include standard SWIG macros and fragments | ||
%include <typemaps/swigmacros.swg> | ||
%include <typemaps/fragments.swg> | ||
|
||
// Include Octave runtime code | ||
%include <octruntime.swg> | ||
|
||
// Include Octave typemaps | ||
%include <octuserdir.swg> | ||
%include <octtypemaps.swg> | ||
|
||
// Include Octave overloaded operator support | ||
%include <octopers.swg> | ||
|
||
// Include Octave special user directives | ||
%include <octuserdir.swg> | ||
%define %docstring %feature("docstring") %enddef |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,92 @@ | ||
// | ||
// octcomplex.swg - Octave complex number support | ||
// | ||
/* | ||
Defines the As/From conversors for double/float complex, you need to | ||
provide complex Type, the Name you want to use in the conversors, | ||
the complex Constructor method, and the Real and Imag complex | ||
accesor methods. | ||
|
||
// Defines the As/From conversors for double/float complex, you need to | ||
// provide complex Type, the Name you want to use in the conversors, | ||
// the complex Constructor method, and the Real and Imag complex accessor | ||
// methods. See the std_complex.i and ccomplex.i for concrete examples. | ||
See the std_complex.i and ccomplex.i for concrete examples. | ||
*/ | ||
|
||
// Common 'from' conversor | ||
/* the common from conversor */ | ||
%define %swig_fromcplx_conv(Type, OctConstructor, Real, Imag) | ||
%fragment(SWIG_From_frag(Type), "header") | ||
%fragment(SWIG_From_frag(Type),"header") | ||
{ | ||
SWIGINTERNINLINE octave_value SWIG_From(Type)(const Type & c) { | ||
return octave_value(OctConstructor(Real(c), Imag(c))); | ||
} | ||
SWIGINTERNINLINE octave_value | ||
SWIG_From(Type)(const Type& c) | ||
{ | ||
return octave_value(OctConstructor(Real(c), Imag(c))); | ||
} | ||
} | ||
%enddef | ||
|
||
// Double-precision 'as' conversor | ||
// the double case | ||
%define %swig_cplxdbl_conv(Type, Constructor, Real, Imag) | ||
%fragment(SWIG_AsVal_frag(Type), "header", fragment = SWIG_AsVal_frag(double)) | ||
%fragment(SWIG_AsVal_frag(Type),"header", | ||
fragment=SWIG_AsVal_frag(double)) | ||
{ | ||
SWIGINTERN int SWIG_AsVal(Type)(const octave_value & ov, Type * val) { | ||
if (ov.is_complex_scalar()) { | ||
if (val) { | ||
Complex c(ov.complex_value()); | ||
*val = Constructor(c.real(), c.imag()); | ||
} | ||
return SWIG_OK; | ||
} else { | ||
double d; | ||
int res = SWIG_AddCast(SWIG_AsVal(double)(ov, &d)); | ||
if (SWIG_IsOK(res)) { | ||
if (val) { | ||
*val = Constructor(d, 0.0); | ||
} | ||
return res; | ||
SWIGINTERN int | ||
SWIG_AsVal(Type) (const octave_value& ov, Type* val) | ||
{ | ||
if (ov.is_complex_scalar()) { | ||
if (val) { | ||
Complex c(ov.complex_value()); | ||
*val=Constructor(c.real(),c.imag()); | ||
} | ||
return SWIG_OK; | ||
} else { | ||
double d; | ||
int res = SWIG_AddCast(SWIG_AsVal(double)(ov, &d)); | ||
if (SWIG_IsOK(res)) { | ||
if (val) | ||
*val = Constructor(d, 0.0); | ||
return res; | ||
} | ||
} | ||
return SWIG_TypeError; | ||
} | ||
return SWIG_TypeError; | ||
} | ||
} | ||
%swig_fromcplx_conv(Type, Complex, Real, Imag); | ||
%enddef | ||
|
||
// Single-precision 'as' conversor | ||
// the float case | ||
%define %swig_cplxflt_conv(Type, Constructor, Real, Imag) | ||
%fragment(SWIG_AsVal_frag(Type), "header", fragment = SWIG_AsVal_frag(float)) | ||
{ | ||
SWIGINTERN int SWIG_AsVal(Type)(const octave_value & ov, Type * val) { | ||
if (ov.is_complex_scalar()) { | ||
if (val) { | ||
Complex c(ov.complex_value()); | ||
double re = c.real(); | ||
double im = c.imag(); | ||
if ((-FLT_MAX <= re && re <= FLT_MAX) && (-FLT_MAX <= im && im <= FLT_MAX)) { | ||
if (val) | ||
*val = Constructor(%numeric_cast(re, float), %numeric_cast(im, float)); | ||
return SWIG_OK; | ||
} else { | ||
return SWIG_OverflowError; | ||
} | ||
} | ||
} else { | ||
float d; | ||
int res = SWIG_AddCast(SWIG_AsVal(float)(ov, &d)); | ||
if (SWIG_IsOK(res)) { | ||
if (val) { | ||
*val = Constructor(d, 0.0); | ||
} | ||
return res; | ||
%fragment(SWIG_AsVal_frag(Type),"header", | ||
fragment=SWIG_AsVal_frag(float)) { | ||
SWIGINTERN int | ||
SWIG_AsVal(Type) (const octave_value& ov, Type* val) | ||
{ | ||
if (ov.is_complex_scalar()) { | ||
if (val) { | ||
Complex c(ov.complex_value()); | ||
double re = c.real(); | ||
double im = c.imag(); | ||
if ((-FLT_MAX <= re && re <= FLT_MAX) && (-FLT_MAX <= im && im <= FLT_MAX)) { | ||
if (val) | ||
*val = Constructor(%numeric_cast(re, float), | ||
%numeric_cast(im, float)); | ||
return SWIG_OK; | ||
} else | ||
return SWIG_OverflowError; | ||
} | ||
} else { | ||
float d; | ||
int res = SWIG_AddCast(SWIG_AsVal(float)(ov, &d)); | ||
if (SWIG_IsOK(res)) { | ||
if (val) | ||
*val = Constructor(d, 0.0); | ||
return res; | ||
} | ||
} | ||
return SWIG_TypeError; | ||
} | ||
return SWIG_TypeError; | ||
} | ||
} | ||
|
||
%swig_fromcplx_conv(Type, FloatComplex, Real, Imag); | ||
%enddef | ||
|
||
#define %swig_cplxflt_convn(Type, Constructor, Real, Imag) %swig_cplxflt_conv(Type, Constructor, Real, Imag) | ||
#define %swig_cplxdbl_convn(Type, Constructor, Real, Imag) %swig_cplxdbl_conv(Type, Constructor, Real, Imag) | ||
#define %swig_cplxflt_convn(Type, Constructor, Real, Imag) \ | ||
%swig_cplxflt_conv(Type, Constructor, Real, Imag) | ||
|
||
|
||
#define %swig_cplxdbl_convn(Type, Constructor, Real, Imag) \ | ||
%swig_cplxdbl_conv(Type, Constructor, Real, Imag) |
Oops, something went wrong.