eliminate compilation warnings, add docs, and centralize the access to the unified typemap library

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7710 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-10-25 09:31:15 +00:00
commit 029ff00d77
31 changed files with 743 additions and 489 deletions

View file

@ -70,4 +70,10 @@
#ifdef rewind
#undef rewind
#endif
#ifdef free
#undef free
#endif
#ifdef malloc
#undef malloc
#endif

View file

@ -24,11 +24,6 @@
* ------------------------------------------------------------ */
%include <perluserdir.swg>
/* ------------------------------------------------------------
* Look for user fragments file.
* ------------------------------------------------------------ */
%include "perlfragments.swg"
/* ------------------------------------------------------------
* Typemap specializations
* ------------------------------------------------------------ */

View file

@ -1,17 +1,2 @@
/*
in Perl we need to pass the CPerl value, sometimes,
so, we define decl/call macros as needed.
*/
#define SWIG_ASPTR_DECL_ARGS SWIG_PERL_DECL_ARGS_2
#define SWIG_ASPTR_CALL_ARGS SWIG_PERL_CALL_ARGS_2
#define SWIG_ASVAL_DECL_ARGS SWIG_PERL_DECL_ARGS_2
#define SWIG_ASVAL_CALL_ARGS SWIG_PERL_CALL_ARGS_2
#define SWIG_FROM_DECL_ARGS SWIG_PERL_DECL_ARGS_1
#define SWIG_FROM_CALL_ARGS SWIG_PERL_CALL_ARGS_1
%include <typemaps/swigmacros.swg>

View file

@ -3,31 +3,6 @@
* ------------------------------------------------------------ */
/* boolean */
%fragment(SWIG_From_frag(bool),"header") {
SWIGINTERN SV *
SWIG_From_dec(bool)(bool value)
{
SV *obj = sv_newmortal();
sv_setiv(obj, value ? 1 : 0);
return obj;
}
}
%fragment(SWIG_AsVal_frag(bool),"header",fragment=SWIG_AsVal_frag(long)) {
SWIGINTERN int
SWIG_AsVal_dec(bool)(SV *obj, bool *val)
{
long v;
if (SWIG_AsVal(long)(obj, val ? &v : 0) == SWIG_OK) {
if (val) *val = v ? true : false;
return SWIG_OK;
}
return SWIG_TypeError;
}
}
/* long */
%fragment(SWIG_From_frag(long),"header") {
@ -40,7 +15,6 @@ SWIG_From_dec(long)(long value)
}
}
%fragment(SWIG_AsVal_frag(long),"header") {
SWIGINTERN int
SWIG_AsVal_dec(long)(SV *obj, long* val)
@ -65,7 +39,6 @@ SWIG_From_dec(unsigned long)(unsigned long value)
}
}
%fragment(SWIG_AsVal_frag(unsigned long),"header") {
SWIGINTERN int
SWIG_AsVal_dec(unsigned long)(SV *obj, unsigned long *val)
@ -133,7 +106,6 @@ SWIG_AsVal_dec(long long)(SV *obj, long long *val)
}
}
/* unsigned long long */
%fragment(SWIG_From_frag(unsigned long long),"header",
@ -205,5 +177,3 @@ SWIG_AsVal_dec(double)(SV *obj, double *val)
return SWIG_TypeError;
}
}

View file

@ -7,7 +7,7 @@
*
************************************************************************/
#ifdef PERL_OBJECT
#define SWIG_PERL_OBJECT_DECL CPerlObj *pPerl,
#define SWIG_PERL_OBJECT_DECL CPerlObj *pPerl SWIGUNUSED,
#define SWIG_PERL_OBJECT_CALL pPerl,
#else
#define SWIG_PERL_OBJECT_DECL

View file

@ -4,10 +4,6 @@
#include <perl.h>
#include <XSUB.h>
/* Get rid of free and malloc defined by perl */
#undef free
#undef malloc
#ifndef pTHX_
#define pTHX_
#endif
@ -44,7 +40,7 @@ typedef int (CPerlObj::*SwigMagicFuncHack)(SV *, MAGIC *);
#define SWIGCLASS_STATIC
#else
#define MAGIC_PPERL
#define SWIGCLASS_STATIC static
#define SWIGCLASS_STATIC static SWIGUNUSED
#ifndef MULTIPLICITY
#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
typedef int (*SwigMagicFunc)(SV *, MAGIC *);

View file

@ -42,7 +42,20 @@ SWIGINTERNINLINE SV *
SWIG_FromCharPtrAndSize(const char* carray, size_t size)
{
SV *obj = sv_newmortal();
sv_setpv(obj, carray);
if (size && carray) {
if (carray[size - 1] == 0) {
sv_setpv(obj, carray);
} else {
char *tmp = %new_array(size + 1, char);
memcpy(tmp, carray, size);
tmp[size] = 0;
sv_setpv(obj, tmp);
%delete(tmp);
}
} else {
sv_setpv(obj, 0);
}
return obj;
}
}

View file

@ -1,44 +1,85 @@
/* -----------------------------------------------------------------------------
* Typemap specializations
* ----------------------------------------------------------------------------- */
/* ------------------------------------------------------------
* Typemap specializations for Perl
* ------------------------------------------------------------ */
/* no director supported in Perl */
/* ------------------------------------------------------------
* Fragment section
* ------------------------------------------------------------ */
/*
in Perl we need to pass the CPerlObj value, sometimes, so, we define
the decl/call macros as needed.
*/
#define SWIG_ASPTR_DECL_ARGS SWIG_PERL_DECL_ARGS_2
#define SWIG_ASPTR_CALL_ARGS SWIG_PERL_CALL_ARGS_2
#define SWIG_ASVAL_DECL_ARGS SWIG_PERL_DECL_ARGS_2
#define SWIG_ASVAL_CALL_ARGS SWIG_PERL_CALL_ARGS_2
#define SWIG_FROM_DECL_ARGS SWIG_PERL_DECL_ARGS_1
#define SWIG_FROM_CALL_ARGS SWIG_PERL_CALL_ARGS_1
/* Include fundamental fragemt definitions */
%include <typemaps/fragments.swg>
/* Look for user fragments file. */
%include "perlfragments.swg"
/* Perl fragments for primitive types */
%include <perlprimtypes.swg>
/* Perl fragments for char* strings */
%include <perlstrings.swg>
/* ------------------------------------------------------------
* Unified typemap section
* ------------------------------------------------------------ */
/* No director supported in Perl */
#ifdef SWIG_DIRECTOR_TYPEMAPS
#undef SWIG_DIRECTOR_TYPEMAPS
#endif
/* Perl types */
#define SWIG_Object SV *
/* -----------------------------------------------------------------------------
* Basic definitions
*
* ----------------------------------------------------------------------------- */
/* Perl $shadow flag */
#define %newpointer_flags $shadow
#define %newinstance_flags $shadow
#define SWIG_Object SV *
#define VOID_Object $result; argvi=0
#define %set_output(obj) $result = obj; argvi++
#define %append_output(obj) if (argvi >= items) EXTEND(sp,1); %set_output(obj)
#define %set_varoutput(obj) sv_setsv($result,obj);
#define %raise(obj, type, desc) sv_setsv(perl_get_sv("@", TRUE), obj); croak(Nullch)
%define %set_constant(name, obj) {
/* Complete overload of the output/constant/exception macros */
/* output */
%define %set_output(obj)
$result = obj;
argvi++ %enddef
/* append output */
%define %append_output(obj)
if (argvi >= items) {
EXTEND(sp,1);
}
%set_output(obj) %enddef
/* variable output */
%define %set_varoutput(obj) sv_setsv($result,obj) %enddef
/* constant */
%define %set_constant(name, obj) %begin_block
SV *sv = get_sv((char*) SWIG_prefix name, TRUE | 0x2);
sv_setsv(sv, obj);
SvREADONLY_on(sv);
}
%enddef
%end_block %enddef
/* raise exception */
%define %raise(obj, type, desc)
sv_setsv(perl_get_sv("@", TRUE), obj);
croak(Nullch) %enddef
/* -----------------------------------------------------------------------------
* All the typemaps
* ----------------------------------------------------------------------------- */
%include <perlprimtypes.swg>
%include <perlstrings.swg>
/* Include the unified typemap library */
%include <typemaps/swigtypemaps.swg>

View file

@ -1,9 +0,0 @@
/* ------------------------------------------------------------
* --- Consttab --- needed for callbacks, it should be removed later.
* ------------------------------------------------------------ */
%typemap(consttab) SWIGTYPE ((*)(ANY))
{ SWIG_PY_POINTER, (char*)"$symname", 0, 0, (void *)($value), &$descriptor }
%typemap(constcode) SWIGTYPE ((*)(ANY)) "";

View file

@ -24,11 +24,6 @@
* ------------------------------------------------------------ */
%include <pyuserdir.swg>
/* ------------------------------------------------------------
* Look for user fragments file.
* ------------------------------------------------------------ */
%include "pyfragments.swg"
/* ------------------------------------------------------------
* Typemap specializations
* ------------------------------------------------------------ */

View file

@ -1,45 +1,79 @@
/* -----------------------------------------------------------------------------
* Typemap specializations
* ----------------------------------------------------------------------------- */
/* ------------------------------------------------------------
* Typemap specializations for Python
* ------------------------------------------------------------ */
/* ------------------------------------------------------------
* Fragment section
* ------------------------------------------------------------ */
/* bool is dangerous in Python, change precedence */
#undef SWIG_TYPECHECK_BOOL
%define SWIG_TYPECHECK_BOOL 10000 %enddef
/* Include fundamental fragemt definitions */
%include <typemaps/fragments.swg>
/* Look for user fragments file. */
%include "pyfragments.swg"
/* Python fragments for fundamental types */
%include <pyprimtypes.swg>
/* Python fragments for char* strings */
%include <pystrings.swg>
/* Backward compatibility output helper */
%fragment("t_output_helper","header") %{
#define t_output_helper SWIG_Python_AppendOutput
%}
/* ------------------------------------------------------------
* Unified typemap section
* ------------------------------------------------------------ */
/* directors are supported in Python */
#ifndef SWIG_DIRECTOR_TYPEMAPS
#define SWIG_DIRECTOR_TYPEMAPS
#endif
/* bool is dangerous in Python -> C++, change precedence */
#undef SWIG_TYPECHECK_BOOL
%define SWIG_TYPECHECK_BOOL 10000 %enddef
/* -----------------------------------------------------------------------------
* Basic definitions
* ----------------------------------------------------------------------------- */
/* Python types */
#define SWIG_Object PyObject *
#define VOID_Object (Py_INCREF(Py_None) ? Py_None : 0)
/* Overload of the output/constant/exception/dirout handling */
/* append output */
#define SWIG_AppendOutput(result,obj) SWIG_Python_AppendOutput(result, obj)
#define SWIG_SetConstant(name, obj) %block(PyObject *_obj = obj; PyDict_SetItemString(d, name, _obj); Py_DECREF(_obj))
#define SWIG_Raise(obj, type, desc) PyObject *_obj = obj; PyErr_SetObject(SWIG_Python_ExceptionType(desc), _obj); Py_DECREF(_obj)
#define SWIG_DirOutFail(code, msg) Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(code), msg)
/* set constant */
%define %set_constant(name, obj) %begin_block
PyObject *_obj = obj;
PyDict_SetItemString(d, name, _obj);
Py_DECREF(_obj);
%end_block %enddef
/* raise */
%define %raise(obj, type, desc)
PyObject *_obj = obj;
PyErr_SetObject(SWIG_Python_ExceptionType(desc), _obj);
Py_DECREF(_obj) %enddef
/* -----------------------------------------------------------------------------
* All the typemaps
* ----------------------------------------------------------------------------- */
%include <pyprimtypes.swg>
%include <pystrings.swg>
/* Include the unified typemap library */
%include <typemaps/swigtypemaps.swg>
/* fix for callbacks */
%include <pyswigtype.swg>
/* -----------------------------------------------------------------------------
* Backward compatibility output helper
* ----------------------------------------------------------------------------- */
%fragment("t_output_helper","header") %{
#define t_output_helper SWIG_Python_AppendOutput
%}
/* ------------------------------------------------------------
* Python extra typemaps
* ------------------------------------------------------------ */
/* Consttab, needed for callbacks, it should be removed later */
%typemap(consttab) SWIGTYPE ((*)(ANY))
{ SWIG_PY_POINTER, (char*)"$symname", 0, 0, (void *)($value), &$descriptor }
%typemap(constcode) SWIGTYPE ((*)(ANY)) "";

View file

@ -1,4 +1 @@
%include <typemaps/typemaps.swg>

View file

@ -24,11 +24,6 @@
* ------------------------------------------------------------ */
%include <rubyuserdir.swg>
/* ------------------------------------------------------------
* Look for user fragments file.
* ------------------------------------------------------------ */
%include "rubyfragments.swg"
/* ------------------------------------------------------------
* Typemap specializations
* ------------------------------------------------------------ */

View file

@ -30,7 +30,7 @@ SWIGINTERN VALUE SWIG_AUX_##Method##(VALUE *args)
%fragment(SWIG_From_frag(bool),"header") {
SWIGINTERNINLINE VALUE
SWIG_From_dec(bool)(bool value)
SWIG_From_dec(bool)(bool value)
{
return value ? Qtrue : Qfalse;
}

View file

@ -1,40 +1,51 @@
/* -----------------------------------------------------------------------------
* Typemap specializations
* ----------------------------------------------------------------------------- */
/* ------------------------------------------------------------
* Typemap specializations for Ruby
* ------------------------------------------------------------ */
/* ------------------------------------------------------------
* Fragment section
* ------------------------------------------------------------ */
/* directors are supported in Ruby */
/* Include fundamental fragemt definitions */
%include <typemaps/fragments.swg>
/* Look for user fragments file. */
%include "rubyfragments.swg"
/* Ruby fragments for primitive types */
%include <rubyprimtypes.swg>
/* Ruby fragments for char* strings */
%include <rubystrings.swg>
/* Backward compatibility output helper */
%fragment("output_helper","header") %{
#define output_helper SWIG_Ruby_AppendOutput
%}
/* ------------------------------------------------------------
* Unified typemap section
* ------------------------------------------------------------ */
/* Directors are supported in Ruby */
#ifndef SWIG_DIRECTOR_TYPEMAPS
#define SWIG_DIRECTOR_TYPEMAPS
#endif
/* -----------------------------------------------------------------------------
* Basic definitions
* ----------------------------------------------------------------------------- */
/* Ruby types */
#define SWIG_Object VALUE
#define VOID_Object Qnil
/* Ruby $track flag */
#define %convertptr_flags $track
#define %newpointer_flags $track
#define %newinstance_flags $track
#define SWIG_Object VALUE
#define VOID_Object Qnil
/* Simple overload of the output/constant/exception handling */
#define SWIG_AppendOutput(result,obj) SWIG_Ruby_AppendOutput(result, obj)
#define SWIG_SetConstant(name, obj) rb_define_const($module, name, obj)
#define SWIG_Raise(obj, type, desc) rb_exc_raise(rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj)))
#define SWIG_DirOutFail(code, msg) Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(code), msg)
/* -----------------------------------------------------------------------------
* All the typemaps
* ----------------------------------------------------------------------------- */
%include <rubyprimtypes.swg>
%include <rubystrings.swg>
/* Include the unified typemap library */
%include <typemaps/swigtypemaps.swg>
/* -----------------------------------------------------------------------------
* Backward compatibility output helper
* ----------------------------------------------------------------------------- */
%fragment("output_helper","header") %{
#define output_helper SWIG_Ruby_AppendOutput
%}

View file

@ -24,11 +24,6 @@
* ------------------------------------------------------------ */
%include <tcluserdir.swg>
/* ------------------------------------------------------------
* Look for user fragments file.
* ------------------------------------------------------------ */
%include "tclfragments.swg"
/* ------------------------------------------------------------
* Typemap specializations
* ------------------------------------------------------------ */

View file

@ -1,14 +1,3 @@
/*
in Tcl we need to pass the interp value, so, we
define decl/call macros as needed.
*/
#define SWIG_ASPTR_DECL_ARGS SWIG_TCL_DECL_ARGS_2
#define SWIG_ASPTR_CALL_ARGS SWIG_TCL_CALL_ARGS_2
#define SWIG_ASVAL_DECL_ARGS SWIG_TCL_DECL_ARGS_2
#define SWIG_ASVAL_CALL_ARGS SWIG_TCL_CALL_ARGS_2
%include <typemaps/swigmacros.swg>

View file

@ -58,7 +58,7 @@
#define SWIG_ObjectDelete SWIG_Tcl_ObjectDelete
#define SWIG_TCL_DECL_ARGS_2(arg1, arg2) (Tcl_Interp *interp, arg1, arg2)
#define SWIG_TCL_DECL_ARGS_2(arg1, arg2) (Tcl_Interp *interp SWIGUNUSED, arg1, arg2)
#define SWIG_TCL_CALL_ARGS_2(arg1, arg2) (interp, arg1, arg2)
/* -----------------------------------------------------------------------------
* pointers/data manipulation
@ -167,7 +167,7 @@ SWIG_Tcl_PointerTypeFromString(char *c) {
/* Convert a packed value value */
SWIGRUNTIME int
SWIG_Tcl_ConvertPacked(Tcl_Interp *interp, Tcl_Obj *obj, void *ptr, int sz, swig_type_info *ty) {
SWIG_Tcl_ConvertPacked(Tcl_Interp *interp SWIGUNUSED, Tcl_Obj *obj, void *ptr, int sz, swig_type_info *ty) {
swig_cast_info *tc;
const char *c;

View file

@ -1,11 +0,0 @@
%typemap(out) SWIGTYPE = SWIGTYPE INSTANCE;
%typemap(out) SWIGTYPE * = SWIGTYPE *INSTANCE;
%typemap(out) SWIGTYPE & = SWIGTYPE &INSTANCE;
%typemap(out) SWIGTYPE [] = SWIGTYPE INSTANCE[];
%typemap(varout) SWIGTYPE = SWIGTYPE INSTANCE;
%typemap(throws,noblock=1) SWIGTYPE CLASS {
SWIG_set_result(SWIG_NewInstanceObj(SWIG_as_voidptr(SWIG_new_copy($1, $1_ltype)), $&1_descriptor, 1));
SWIG_fail;
}

View file

@ -1,31 +1,70 @@
/* -----------------------------------------------------------------------------
* Typemap specializations
* ----------------------------------------------------------------------------- */
/* ------------------------------------------------------------
* Typemap specializations for Tcl
* ------------------------------------------------------------ */
/* no director supported in Tcl */
/* ------------------------------------------------------------
* Fragment section
* ------------------------------------------------------------ */
/*
in Tcl we need to pass the interp value, so, we define the decl/call
macros as needed.
*/
#define SWIG_ASPTR_DECL_ARGS SWIG_TCL_DECL_ARGS_2
#define SWIG_ASPTR_CALL_ARGS SWIG_TCL_CALL_ARGS_2
#define SWIG_ASVAL_DECL_ARGS SWIG_TCL_DECL_ARGS_2
#define SWIG_ASVAL_CALL_ARGS SWIG_TCL_CALL_ARGS_2
/* Include fundamental fragemt definitions */
%include <typemaps/fragments.swg>
/* Look for user fragments file. */
%include "tclfragments.swg"
/* Tcl fragments for primitve types */
%include <tclprimtypes.swg>
/* Tcl fragments for char* strings */
%include <tclstrings.swg>
/* ------------------------------------------------------------
* Unified typemap section
* ------------------------------------------------------------ */
/* No director supported in Tcl */
#ifdef SWIG_DIRECTOR_TYPEMAPS
#undef SWIG_DIRECTOR_TYPEMAPS
#endif
/* -----------------------------------------------------------------------------
* Basic definitions
* ----------------------------------------------------------------------------- */
/* Tcl types */
#define SWIG_Object Tcl_Obj *
#define VOID_Object NULL
/* Simple overload of the output/constant/exception handling */
#define SWIG_AppendOutput(result,obj) (Tcl_ListObjAppendElement(NULL,result,obj) == TCL_OK) ? result : NULL
#define SWIG_SetConstant(name, obj) SWIG_Tcl_SetConstantObj(interp, name, obj)
#define SWIG_Raise(obj,type,desc) SWIG_Tcl_SetErrorObj(interp,type,obj)
/* -----------------------------------------------------------------------------
* All the typemaps
* ----------------------------------------------------------------------------- */
%include <tclprimtypes.swg>
%include <tclstrings.swg>
/* Include the unified typemap library */
%include <typemaps/swigtypemaps.swg>
/* fix for instances */
%include <tclswigtype.swg>
/* ------------------------------------------------------------
* Tcl extra typemaps
* ------------------------------------------------------------ */
%typemap(out) SWIGTYPE = SWIGTYPE INSTANCE;
%typemap(out) SWIGTYPE * = SWIGTYPE *INSTANCE;
%typemap(out) SWIGTYPE & = SWIGTYPE &INSTANCE;
%typemap(out) SWIGTYPE [] = SWIGTYPE INSTANCE[];
%typemap(varout) SWIGTYPE = SWIGTYPE INSTANCE;
%typemap(throws,noblock=1) SWIGTYPE CLASS {
SWIG_set_result(SWIG_NewInstanceObj(SWIG_as_voidptr(SWIG_new_copy($1, $1_ltype)), $&1_descriptor, 1));
SWIG_fail;
}

Some files were not shown because too many files have changed in this diff Show more