PageRenderTime 20ms CodeModel.GetById 16ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Lib/pike/pikerun.swg

#
Unknown | 70 lines | 60 code | 10 blank | 0 comment | 0 complexity | 9f8e107e161cc7855c41785c77cb9d3c MD5 | raw file
 1/* -----------------------------------------------------------------------------
 2 * pikerun.swg
 3 *
 4 * This file contains the runtime support for Pike modules
 5 * and includes code for managing global variables and pointer
 6 * type checking.
 7 * ----------------------------------------------------------------------------- */
 8
 9#ifdef __cplusplus
10extern "C" {
11#endif
12#include "object.h"
13#include "program.h"
14#ifdef __cplusplus
15}
16#endif
17
18/* Stores information about a wrapped object */
19typedef struct swig_object_wrapper {
20    void *self;
21    swig_type_info *type;
22} swig_object_wrapper;
23
24#ifdef THIS
25#undef THIS
26#endif
27#define THIS (((swig_object_wrapper *) Pike_fp->current_storage)->self)
28
29#define SWIG_ConvertPtr SWIG_Pike_ConvertPtr
30#define SWIG_NewPointerObj SWIG_Pike_NewPointerObj
31#define SWIG_GetModule(clientdata) SWIG_Pike_GetModule()
32#define SWIG_SetModule(clientdata, pointer) SWIG_Pike_SetModule(pointer)
33
34/* These need to be filled in before type sharing between modules will work */
35static swig_module_info *SWIG_Pike_GetModule() {
36  return 0;
37}
38
39static void SWIG_Pike_SetModule(swig_module_info *pointer) {
40
41}
42
43/* Convert a pointer value */
44static int
45SWIG_Pike_ConvertPtr(struct object *obj, void **ptr, swig_type_info *ty, int flags) {
46    struct program *pr;
47    swig_cast_info *tc;
48    swig_object_wrapper *obj_wrapper;
49    
50    if (ty) {
51        pr = (struct program *) ty->clientdata;
52        obj_wrapper = (swig_object_wrapper *) get_storage(obj, pr);
53        if (obj_wrapper && obj_wrapper->type) {
54            tc = SWIG_TypeCheckStruct(obj_wrapper->type, ty);
55            if (tc) {
56                int newmemory = 0;
57                *ptr = SWIG_TypeCast(tc, obj_wrapper->self, &newmemory);
58                assert(!newmemory); /* newmemory handling not yet implemented */
59                return 0;
60            }
61        }
62    }
63    return -1;
64}
65
66/* Create a new pointer object */
67static struct object *
68SWIG_Pike_NewPointerObj(void *ptr, swig_type_info *type, int own) {
69    return 0;
70}