- Improve the runtime type sytesm

- Update all languages to new type system
- Add DohSortList function
- Fix mzscheme Examples/Makefile


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6930 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
John Lenz 2005-02-01 00:08:24 +00:00
commit f6964f285f
48 changed files with 1383 additions and 1021 deletions

View file

@ -64,6 +64,7 @@ typedef struct swig_class {
swig_attribute *attributes;
struct swig_class **bases;
char **base_names;
swig_module_info *module;
} swig_class;
typedef struct swig_instance {
@ -105,22 +106,10 @@ typedef struct swig_instance {
#define SWIG_MethodCommand SWIG_Tcl_MethodCommand
#define SWIG_ObjectDelete SWIG_Tcl_ObjectDelete
static void
SWIG_Tcl_LookupTypePointer(Tcl_Interp *interp) {
char buf[512];
char *data;
/* first check if pointer already created */
data = (char *) Tcl_GetVar(interp, "swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TCL_GLOBAL_ONLY);
if (data) {
SWIG_UnpackData(data, &swig_type_list_handle, sizeof(swig_type_info **));
} else {
/* create a new pointer */
data = SWIG_PackData(buf, &swig_type_list_handle, sizeof(swig_type_info **));
*data = 0;
Tcl_SetVar(interp, "swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, buf, 0);
}
}
/* Runtime API */
#define SWIG_GetModule(clientdata) SWIG_Tcl_GetModule((Tcl_Interp *) (clientdata))
#define SWIG_SetModule(clientdata, pointer) SWIG_Tcl_SetModule((Tcl_Interp *) (clientdata), pointer)
#define SWIG_MODULE_CLIENTDATA_TYPE Tcl_Interp *
/* Object support */
static Tcl_HashTable swigobjectTable;
@ -163,7 +152,7 @@ SWIG_Tcl_Thisown(void *ptr) {
/* Convert a pointer value */
static int
SWIG_Tcl_ConvertPtrFromString(Tcl_Interp *interp, const char *c, void **ptr, swig_type_info *ty, int flags) {
swig_type_info *tc;
swig_cast_info *tc;
/* Pointer values must start with leading underscore */
while (*c != '_') {
*ptr = (void *) 0;
@ -225,7 +214,7 @@ SWIG_Tcl_PointerTypeFromString(char *c) {
/* Convert a packed value value */
static int
SWIG_Tcl_ConvertPacked(Tcl_Interp *interp, Tcl_Obj *obj, void *ptr, int sz, swig_type_info *ty, int flags) {
swig_type_info *tc;
swig_cast_info *tc;
const char *c;
if (!obj) goto type_error;
@ -505,7 +494,7 @@ SWIG_Tcl_MethodCommand(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_
if (bi != -1) {
if (!cls->bases[bi] && cls->base_names[bi]) {
/* lookup and cache the base class */
swig_type_info *info = SWIG_TypeQuery(cls->base_names[bi]);
swig_type_info *info = SWIG_TypeQueryModule(cls->module, cls->module, cls->base_names[bi]);
if (info) cls->bases[bi] = (swig_class *) info->clientdata;
}
cls = cls->bases[bi];
@ -750,6 +739,31 @@ typedef struct {
#define SWIG_contract_assert(expr, msg) if (!(expr)) { Tcl_SetResult(interp, (char *) msg, TCL_STATIC ); goto fail; } else
static swig_module_info *
SWIG_Tcl_GetModule(Tcl_Interp *interp) {
char *data;
swig_module_info *ret = 0;
/* first check if pointer already created */
data = (char *) Tcl_GetVar(interp, "swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TCL_GLOBAL_ONLY);
if (data) {
SWIG_UnpackData(data, &ret, sizeof(swig_type_info **));
}
return ret;
}
static void
SWIG_Tcl_SetModule(Tcl_Interp *interp, swig_module_info *module) {
char buf[512];
char *data;
/* create a new pointer */
data = SWIG_PackData(buf, &module, sizeof(swig_type_info **));
*data = 0;
Tcl_SetVar(interp, "swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, buf, 0);
}
#ifdef __cplusplus
}
#endif

View file

@ -5,7 +5,6 @@
* ----------------------------------------------------------------------------- */
%runtime "swigrun.swg" // Common C API type-checking code
%runtime "common.swg"
%runtime "swigtcl8.swg"
/* -----------------------------------------------------------------------------
@ -632,10 +631,11 @@ SWIGEXPORT(int) SWIG_init(Tcl_Interp *);
/* Start the initialization function */
%insert(init) "swiginit.swg"
%init %{
SWIGEXPORT(int) SWIG_init(Tcl_Interp *interp) {
int i;
static int _init = 0;
if (interp == 0) return TCL_ERROR;
#ifdef USE_TCL_STUBS
if (Tcl_InitStubs(interp, (char*)"8.1", 0) == NULL) {
@ -648,16 +648,10 @@ SWIGEXPORT(int) SWIG_init(Tcl_Interp *interp) {
#ifdef SWIG_namespace
Tcl_Eval(interp, "namespace eval " SWIG_namespace " { }");
#endif
if (!_init) {
SWIG_Tcl_LookupTypePointer(interp);
for (i = 0; swig_types_initial[i]; i++) {
swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]);
}
for (i = 0; swig_types_initial[i]; i++) {
SWIG_PropagateClientData(swig_types[i]);
}
_init = 1;
}
SWIG_InitializeModule((void *) interp);
SWIG_PropagateClientData();
for (i = 0; swig_commands[i].name; i++) {
Tcl_CreateObjCommand(interp, (char *) swig_commands[i].name, (swig_wrapper_func) swig_commands[i].wrapper, swig_commands[i].clientdata, NULL);
}