- 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

@ -3,14 +3,18 @@
This file is parsed by SWIG before reading any other interface
file. */
%runtime %{
#define SWIGSTATIC static
%}
/* Insert common stuff */
%insert(runtime) "swigrun.swg"
%insert(runtime) "common.swg"
/* Include headers */
%insert(runtime) "ocamldec.swg"
/* Type registration */
%insert(init) "swiginit.swg"
%insert(init) "typeregister.swg"
%insert(mlitail) %{

View file

@ -58,8 +58,8 @@ extern "C" {
*ptr = source;
return 0;
} else {
swig_type_info *tc =
SWIG_TypeCheck( (char *)source_type->name, dest_type );
swig_cast_info *tc =
SWIG_TypeCheckStruct(source_type, dest_type );
#ifdef TYPE_CAST_VERBOSE
fprintf( stderr, "Typecheck -> %s\n",
tc ? tc->str : "<none>" );
@ -371,11 +371,12 @@ extern "C" {
CAMLreturn(vv);
}
SWIGSTATIC CAML_VALUE caml_val_obj( void *v, char *object_type ) {
#define caml_val_obj(v, name) caml_val_obj_helper(v, SWIG_TypeQuery((name)), name)
SWIGSTATIC CAML_VALUE caml_val_obj_helper( void *v, swig_type_info *type, char *name) {
CAMLparam0();
CAMLreturn(callback2(*caml_named_value("caml_create_object_fn"),
caml_val_ptr(v,SWIG_TypeQuery(object_type)),
copy_string(object_type)));
caml_val_ptr(v,type),
copy_string(name)));
}
SWIGSTATIC long caml_long_val_full( CAML_VALUE v, char *name ) {
@ -575,14 +576,21 @@ extern "C" {
}
}
static void SWIG_Ocaml_LookupTypePointer() {
CAML_VALUE mod_pointer, pointer;
static swig_module_info *SWIG_Ocaml_GetModule() {
CAML_VALUE pointer;
mod_pointer = caml_val_ptr(swig_type_list_handle, NULL);
pointer = callback(*caml_named_value("swig_find_type_info"), mod_pointer);
if (SWIG_Tag_val(pointer) == C_ptr) {
swig_type_list_handle = (swig_type_info **)(void *)(long)SWIG_Int64_val(SWIG_Field(pointer,0));
pointer = callback(*caml_named_value("swig_find_type_info"), caml_val_int(0));
if (Is_block(pointer) && SWIG_Tag_val(pointer) == C_ptr) {
return (swig_module_info *)(void *)(long)SWIG_Int64_val(SWIG_Field(pointer,0));
}
return 0;
}
static void SWIG_Ocaml_SetModule(swig_module_info *pointer) {
CAML_VALUE mod_pointer;
mod_pointer = caml_val_ptr(pointer, NULL);
callback(*caml_named_value("swig_set_type_info"), mod_pointer);
}
#ifdef __cplusplus
@ -590,7 +598,7 @@ extern "C" {
#endif
#undef value
/* ocaml keywords */
/* please test and activate */
/* There's no need to use this, because of my rewriting machinery. C++
* words never collide with ocaml keywords */
//%include "ocamlkw.swg"

View file

@ -81,14 +81,9 @@ CAMLextern int64 Int64_val(caml_value_t v);
#define SWIG_Int64_val(v) Int64_val(v)
#endif
#ifdef __GNUC__
# define SWIGSTATIC static inline
#else
# define SWIGSTATIC static
#endif
#define SWIG_NewPointerObj(p,type,flags) caml_val_ptr(p,type)
#define SWIG_GetModule(clientdata) SWIG_Ocaml_GetModule()
#define SWIG_SetModule(clientdata, pointer) SWIG_Ocaml_SetModule(pointer)
#define SWIG_contract_assert(expr, msg) if(!(expr)) {failwith(msg);} else

View file

@ -143,16 +143,14 @@ let new_derived_object cfun x_class args =
end
let swig_current_type_info = ref C_void
let find_type_info obj =
match obj with
C_ptr _ -> if !swig_current_type_info = C_void
then begin
swig_current_type_info := obj ;
obj
end else
!swig_current_type_info
| _ -> raise (Failure "Internal error: passed non pointer to find_type_info")
let find_type_info obj = !swig_current_type_info
let _ = Callback.register "swig_find_type_info" find_type_info
let set_type_info obj =
match obj with
C_ptr _ -> swig_current_type_info := obj ;
obj
| _ -> raise (Failure "Internal error: passed non pointer to set_type_info")
let _ = Callback.register "swig_set_type_info" set_type_info
let class_master_list = Hashtbl.create 20
let register_class_byname nm co =

View file

@ -1,12 +1,2 @@
/* Code ripped from python implementation */
{
static int typeinit = 0;
int i;
if (!typeinit) {
SWIG_Ocaml_LookupTypePointer();
for (i = 0; swig_types_initial[i]; i++) {
swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]);
}
typeinit = 1;
}
}
SWIGEXT void SWIG_init() {
SWIG_InitializeModule(0);