Exemplo n.º 1
0
PyObject * swig_int::__lshift__( PyObject * obj1 ) {
    swig_int * result ;
    PyObject * ret = NULL ;
    void * argp2 ;

    result = new swig_int() ;

    if ( PyFloat_Check(obj1) ) {
        PyErr_SetString(PyExc_TypeError,"Shift value must be integer");
        return NULL ;
    } else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
        swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
        if ( !temp_m->units.compare("1")) {
            result->value = value << temp_m->value ;
        } else {
            PyErr_SetString(PyExc_TypeError,"Shift value must be unitless.");
            return NULL ;
        }
    } else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
        PyErr_SetString(PyExc_TypeError,"Shift value must be integer");
        return NULL ;
    } else if ( PyInt_Check(obj1) ) {
        result->value = value << PyInt_AsLong(obj1) ;
    }
    result->units = units ;

    ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_int *"), SWIG_POINTER_OWN);

    return ret ;
}
Exemplo n.º 2
0
PyObject * swig_int::__div__( PyObject * obj1 ) {
    swig_double * result ;
    PyObject * ret = NULL ;
    void * argp2 ;

    result = new swig_double() ;

    if ( PyFloat_Check(obj1) ) {
        result->value = value / PyFloat_AsDouble(obj1) ;
        result->units = units ;
    } else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
        swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
        result->value = value / temp_m->value ;
        result->units = units + "/(" + temp_m->units + ")";
    } else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
        swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
        result->value = value / temp_m->value ;
        result->units = units + "/(" + temp_m->units + ")";
    } else if ( PyInt_Check(obj1) ) {
        result->value = value / PyInt_AsLong(obj1) ;
        result->units = units ;
    }
    ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_double *"), SWIG_POINTER_OWN);
    return ret ;
}
Exemplo n.º 3
0
PyObject * swig_int::__pow__( PyObject * obj1 ) {
    PyObject * ret = NULL ;
    void * argp2 ;

    if ( units.compare("1")) {
        PyErr_SetString(PyExc_TypeError,"Both arguments must be unitless. Cannot create new unit-ed type.");
        return NULL ;
    }

    if ( PyFloat_Check(obj1) ) {
        swig_double * result = new swig_double() ;
        result->value = pow(value , PyFloat_AsDouble(obj1)) ;
        result->units = units ;
        ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_double *"), SWIG_POINTER_OWN);
    } else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
        swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
        swig_int * result = new swig_int() ;
        if ( !temp_m->units.compare("1")) {
            result->value = (long long)(pow(value , temp_m->value)) ;
        } else {
            PyErr_SetString(PyExc_TypeError,"Both arguments must be unitless. Cannot create new unit-ed type.");
            return NULL ;
        }
        ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_int *"), SWIG_POINTER_OWN);
    } else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
        swig_double * result = new swig_double() ;
        swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
        if ( !temp_m->units.compare("1")) {
            result->value = pow(value , temp_m->value) ;
        } else {
            PyErr_SetString(PyExc_TypeError,"Both arguments must be unitless. Cannot create new unit-ed type.");
            return NULL ;
        }
        result->units = units ;
        ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_double *"), SWIG_POINTER_OWN);
    } else if ( PyInt_Check(obj1) ) {
        swig_int * result = new swig_int() ;
        int power = PyInt_AsLong(obj1) ;
        result->value = (long long)(pow(value , power)) ;
        result->units = units ;
        for ( int ii = 1 ; ii < power ; ii++ ) {
            result->units = result->units + "*(" + units + ")";
        }
        ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_int *"), SWIG_POINTER_OWN);
    }

    return ret ;
}
Exemplo n.º 4
0
MyPaintSurface *
mypaint_python_surface_factory(gpointer user_data)
{
    PyObject *module = get_module("lib.tiledsurface");
    PyObject *instance = new_py_tiled_surface(module);
    assert(instance != NULL);
    // Py_DECREF(module);

    static const char *type_str = "TiledSurface *";
    swig_type_info *info = SWIG_TypeQuery(type_str);
    if (! info) {
        fprintf(stderr, "SWIG_TypeQuery failed to look up '%s'", type_str);
        return NULL;
    }
    TiledSurface *surf;
    if (SWIG_ConvertPtr(instance, (void **)&surf, info, SWIG_POINTER_EXCEPTION) == -1) {
        fprintf(stderr, "SWIG_ConvertPtr failed\n");
        return NULL;
    }
    MyPaintSurface *interface = surf->get_surface_interface();

    // Py_DECREF(instance);

    return interface;
}
Exemplo n.º 5
0
static PyObject *_wrap_iff_put_array(PyObject *self, PyObject *args) {
    PyObject *resultobj;
    char *arg1 ;
    int *arg2 = (int *) 0 ;
    double *arg3 = (double *) 0 ;
    int result;
    PyObject * obj1  = 0 ;
    PyObject * obj2  = 0 ;
    
    if(!PyArg_ParseTuple(args,(char *)"sOO:iff_put_array",&arg1,&obj1,&obj2)) goto fail;
    if ((SWIG_ConvertPtr(obj1,(void **) &arg2, SWIGTYPE_p_int,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
    if ((SWIG_ConvertPtr(obj2,(void **) &arg3, SWIGTYPE_p_double,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
    result = (int)iff_put_array(arg1,arg2,arg3);
    
    resultobj = PyInt_FromLong((long)result);
    return resultobj;
    fail:
    return NULL;
}
Exemplo n.º 6
0
PyObject * swig_int::__mod__( PyObject * obj1 ) {
    PyObject * ret = NULL ;
    void * argp2 ;

    if ( PyFloat_Check(obj1) ) {
        swig_double * result = new swig_double() ;
        result->value = fmod(value , PyFloat_AsDouble(obj1)) ;
        result->units = units ;
        ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_double *"), SWIG_POINTER_OWN);
    } else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
        swig_int * result = new swig_int() ;
        swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
        if ( !temp_m->units.compare("1")) {
            result->value = value % temp_m->value ;
        } else {
            PyErr_SetString(PyExc_TypeError,"Divisor must be unitless.  Cannot create new unit-ed type.");
            return NULL ;
        }
        result->units = units ;
        ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_int *"), SWIG_POINTER_OWN);
    } else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
        swig_double * result = new swig_double() ;
        swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
        if ( !temp_m->units.compare("1")) {
            result->value = fmod( value , temp_m->value) ;
        } else {
            PyErr_SetString(PyExc_TypeError,"Divisor must be unitless.  Cannot create new unit-ed type.");
            return NULL ;
        }
        result->units = units ;
        ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_double *"), SWIG_POINTER_OWN);
    } else if ( PyInt_Check(obj1) ) {
        swig_int * result = new swig_int() ;
        result->value = value % PyInt_AsLong(obj1) ;
        result->units = units ;
        ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_int *"), SWIG_POINTER_OWN);
    }

    return ret ;
}
Exemplo n.º 7
0
Arquivo: python.c Projeto: gplv2/rlib
static PyObject *_wrap_rlib_signal_connect_string(PyObject *self, PyObject *args) {
    PyObject *resultobj;
    rlib *arg1 = (rlib *) 0 ;
    char *arg2 ;
    int (*arg3)(rlib *,void *) = (int (*)(rlib *,void *)) 0 ;
    void *arg4 = (void *) 0 ;
    int result;
    PyObject * obj0 = 0 ;
    PyObject * obj2 = 0 ;
    PyObject * obj3 = 0 ;
    
    if(!PyArg_ParseTuple(args,(char *)"OsOO:rlib_signal_connect_string",&obj0,&arg2,&obj2,&obj3)) goto fail;
    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_rlib,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
    if ((SWIG_ConvertPtr(obj2,(void **) &arg3, SWIGTYPE_p_f_p_rlib_p_void__int,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
    if ((SWIG_ConvertPtr(obj3,(void **) &arg4, 0, SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
    result = (int)rlib_signal_connect_string(arg1,arg2,arg3,arg4);
    
    resultobj = PyInt_FromLong((long)result);
    return resultobj;
    fail:
    return NULL;
}
Exemplo n.º 8
0
PyObject * swig_int::__sub__( PyObject * obj1 ) {
    swig_int * result ;
    PyObject * ret = NULL ;
    void * argp2 ;
    int conv_ret ;

    result = new swig_int() ;

    if ( PyFloat_Check(obj1) ) {
        result->value = (long long)(round(value - PyFloat_AsDouble(obj1))) ;
    } else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
        long long new_val ;
        swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
        new_val = temp_m->value ;
        conv_ret = scale_united_value( units , temp_m->units , &new_val ) ;
        if ( conv_ret == 0 ) {
            result->value = value - new_val ;
        } else {
            return NULL ;
        }
    } else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
        double new_val ;
        swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
        new_val = temp_m->value ;
        conv_ret = scale_united_value( units , temp_m->units , &new_val ) ;
        if ( conv_ret == 0 ) {
            result->value = (long long)(round(value - new_val)) ;
        } else {
            return NULL ;
        }
    } else if ( PyInt_Check(obj1) ) {
        result->value = value - (long long)PyInt_AsLong(obj1) ;
    }
    result->units = units ;

    ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_int *"), SWIG_POINTER_OWN);

    return ret ;
}
static VALUE
_wrap_HLServerInfos_max_clients_get(int argc, VALUE *argv, VALUE self) {
    server_info *arg1 = (server_info *) 0 ;
    int result;
    VALUE vresult = Qnil;
    
    if ((argc < 0) || (argc > 0))
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc);
    SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_server_info, 1);
    result = (int) ((arg1)->max_clients);
    
    vresult = INT2NUM(result);
    return vresult;
}
Exemplo n.º 10
0
static PyObject *_wrap_delete_Parr(PyObject *self, PyObject *args) {
    PyObject *resultobj;
    double *arg1 = (double *) 0 ;
    PyObject * obj0  = 0 ;
    
    if(!PyArg_ParseTuple(args,(char *)"O:delete_Parr",&obj0)) goto fail;
    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_double,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
    delete_Parr(arg1);
    
    Py_INCREF(Py_None); resultobj = Py_None;
    return resultobj;
    fail:
    return NULL;
}
Exemplo n.º 11
0
Arquivo: python.c Projeto: gplv2/rlib
static PyObject *_wrap_rlib_set_output_encoding(PyObject *self, PyObject *args) {
    PyObject *resultobj;
    rlib *arg1 = (rlib *) 0 ;
    char *arg2 ;
    PyObject * obj0 = 0 ;
    
    if(!PyArg_ParseTuple(args,(char *)"Os:rlib_set_output_encoding",&obj0,&arg2)) goto fail;
    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_rlib,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
    rlib_set_output_encoding(arg1,(char const *)arg2);
    
    Py_INCREF(Py_None); resultobj = Py_None;
    return resultobj;
    fail:
    return NULL;
}
Exemplo n.º 12
0
Arquivo: python.c Projeto: gplv2/rlib
static PyObject *_wrap_rlib_get_output_length(PyObject *self, PyObject *args) {
    PyObject *resultobj;
    rlib *arg1 = (rlib *) 0 ;
    int result;
    PyObject * obj0 = 0 ;
    
    if(!PyArg_ParseTuple(args,(char *)"O:rlib_get_output_length",&obj0)) goto fail;
    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_rlib,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
    result = (int)rlib_get_output_length(arg1);
    
    resultobj = PyInt_FromLong((long)result);
    return resultobj;
    fail:
    return NULL;
}
Exemplo n.º 13
0
PyObject * swig_int::__rshift__( PyObject * obj1 ) {
    swig_int * result ;
    PyObject * ret = NULL ;
    void * argp2 ;

    result = new swig_int() ;

    if ( PyFloat_Check(obj1) ) {
        PyErr_SetString(PyExc_TypeError,"Shift value must be integer");
        return NULL ;
    } else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
        swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
        if ( !temp_m->units.compare("1")) {
            result->value = value >> temp_m->value ;
        } else {
Exemplo n.º 14
0
Arquivo: python.c Projeto: gplv2/rlib
static PyObject *_wrap_rlib_get_content_type_as_text(PyObject *self, PyObject *args) {
    PyObject *resultobj;
    rlib *arg1 = (rlib *) 0 ;
    char *result;
    PyObject * obj0 = 0 ;
    
    if(!PyArg_ParseTuple(args,(char *)"O:rlib_get_content_type_as_text",&obj0)) goto fail;
    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_rlib,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
    result = (char *)rlib_get_content_type_as_text(arg1);
    
    resultobj = result ? PyString_FromString(result) : Py_BuildValue((char*)"");
    return resultobj;
    fail:
    return NULL;
}
Exemplo n.º 15
0
static PyObject *_wrap_Pdbl_value(PyObject *self, PyObject *args) {
    PyObject *resultobj;
    double *arg1 = (double *) 0 ;
    double result;
    PyObject * obj0  = 0 ;
    
    if(!PyArg_ParseTuple(args,(char *)"O:Pdbl_value",&obj0)) goto fail;
    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_double,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
    result = (double)Pdbl_value(arg1);
    
    resultobj = PyFloat_FromDouble(result);
    return resultobj;
    fail:
    return NULL;
}
Exemplo n.º 16
0
static PyObject *_wrap_Pint_assign(PyObject *self, PyObject *args) {
    PyObject *resultobj;
    int *arg1 = (int *) 0 ;
    int arg2 ;
    PyObject * obj0  = 0 ;
    
    if(!PyArg_ParseTuple(args,(char *)"Oi:Pint_assign",&obj0,&arg2)) goto fail;
    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_int,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
    Pint_assign(arg1,arg2);
    
    Py_INCREF(Py_None); resultobj = Py_None;
    return resultobj;
    fail:
    return NULL;
}
Exemplo n.º 17
0
static PyObject *_wrap_Pint_value(PyObject *self, PyObject *args) {
    PyObject *resultobj;
    int *arg1 = (int *) 0 ;
    int result;
    PyObject * obj0  = 0 ;
    
    if(!PyArg_ParseTuple(args,(char *)"O:Pint_value",&obj0)) goto fail;
    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_int,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
    result = (int)Pint_value(arg1);
    
    resultobj = PyInt_FromLong((long)result);
    return resultobj;
    fail:
    return NULL;
}
Exemplo n.º 18
0
bool PopPointer(lua_State* L, void** ptr, const char* type_name, int idx)
{
    swig_type_info * pTypeInfo = querySwigType(type_name);
    if (pTypeInfo == 0)
    {
        return false;  
    }

    if(!lua_isuserdata(L,idx))
    {
        return false;
    }

    return SWIG_IsOK(SWIG_ConvertPtr(L, idx, ptr, pTypeInfo, 0));
}
Exemplo n.º 19
0
Arquivo: python.c Projeto: gplv2/rlib
static PyObject *_wrap_rlib_get_output(PyObject *self, PyObject *args) {
    PyObject *resultobj;
    rlib *arg1 = (rlib *) 0 ;
    char *result;
    PyObject * obj0 = 0 ;
    int		size;
    
    if(!PyArg_ParseTuple(args,(char *)"O:rlib_get_output",&obj0)) goto fail;
    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_rlib,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
    result = (char *)rlib_get_output(arg1);
    size = rlib_get_output_length(arg1);
    resultobj = result ? PyString_FromStringAndSize(result, size) : Py_BuildValue((char*)"");
    return resultobj;
    fail:
    return NULL;
}
Exemplo n.º 20
0
static PyObject *_wrap_Parr_setitem(PyObject *self, PyObject *args) {
    PyObject *resultobj;
    double *arg1 = (double *) 0 ;
    int arg2 ;
    double arg3 ;
    PyObject * obj0  = 0 ;
    
    if(!PyArg_ParseTuple(args,(char *)"Oid:Parr_setitem",&obj0,&arg2,&arg3)) goto fail;
    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_double,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
    Parr_setitem(arg1,arg2,arg3);
    
    Py_INCREF(Py_None); resultobj = Py_None;
    return resultobj;
    fail:
    return NULL;
}
Exemplo n.º 21
0
Arquivo: python.c Projeto: gplv2/rlib
static PyObject *_wrap_rlib_add_report_from_buffer(PyObject *self, PyObject *args) {
    PyObject *resultobj;
    rlib *arg1 = (rlib *) 0 ;
    char *arg2 ;
    int result;
    PyObject * obj0 = 0 ;
    
    if(!PyArg_ParseTuple(args,(char *)"Os:rlib_add_report_from_buffer",&obj0,&arg2)) goto fail;
    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_rlib,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
    result = (int)rlib_add_report_from_buffer(arg1,arg2);
    
    resultobj = PyInt_FromLong((long)result);
    return resultobj;
    fail:
    return NULL;
}
Exemplo n.º 22
0
Arquivo: python.c Projeto: gplv2/rlib
static PyObject *_wrap_rlib_graph_set_x_minor_tick_by_location(PyObject *self, PyObject *args) {
    PyObject *resultobj;
    rlib *arg1 = (rlib *) 0 ;
    char *arg2 ;
    int arg3 ;
    int result;
    PyObject * obj0 = 0 ;
    
    if(!PyArg_ParseTuple(args,(char *)"Osi:rlib_graph_set_x_minor_tick_by_location",&obj0,&arg2,&arg3)) goto fail;
    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_rlib,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
    result = (int)rlib_graph_set_x_minor_tick_by_location(arg1,arg2,arg3);
    
    resultobj = PyInt_FromLong((long)result);
    return resultobj;
    fail:
    return NULL;
}
static VALUE
_wrap_HLServerInfos_country_get(int argc, VALUE *argv, VALUE self) {
    server_info *arg1 = (server_info *) 0 ;
    string result;
    VALUE vresult = Qnil;
    
    if ((argc < 0) || (argc > 0))
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc);
    SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_server_info, 1);
    result =  ((arg1)->country);
    
    {
        string * resultptr;
        resultptr = new string((string &)result);
        vresult = SWIG_NewPointerObj((void *) resultptr, SWIGTYPE_p_string, 1);
    }
    return vresult;
}
Exemplo n.º 24
0
Arquivo: python.c Projeto: gplv2/rlib
static PyObject *_wrap_rlib_add_resultset_follower_n_to_1(PyObject *self, PyObject *args) {
    PyObject *resultobj;
    rlib *arg1 = (rlib *) 0 ;
    char *arg2 ;
    char *arg3 ;
    char *arg4 ;
    char *arg5 ;
    int result;
    PyObject * obj0 = 0 ;
    
    if(!PyArg_ParseTuple(args,(char *)"Ossss:rlib_add_resultset_follower_n_to_1",&obj0,&arg2,&arg3,&arg4,&arg5)) goto fail;
    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_rlib,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
    result = (int)rlib_add_resultset_follower_n_to_1(arg1,arg2,arg3,arg4,arg5);
    
    resultobj = PyInt_FromLong((long)result);
    return resultobj;
    fail:
    return NULL;
}
static PyObject* GetAmsEntityList(PyObject *self, PyObject *args)
{
  ClAmsEntityListT *lst = (ClAmsEntityListT *) 0 ;
  void *argp1 = 0 ;

  if (!PyArg_ParseTuple(args,(char *)"O:GetAmsEntityListT",&obj0)) return NULL;
  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ClAmsEntityListT, 0 |  0 );
  if (!SWIG_IsOK(res1))
  {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GetAmsEntityList" "', argument " "1"" of type '" "ClAmsEntityListT *""'"); 
  }
  lst = (ClAmsEntityListT *)(argp1);

  char buf[2048];
  const int bufLen = 2048;
  int curLen = 0;
  
  if (lst->isValid == 0)
  {
      sprintf(buf,"List is not valid");
      PyErr_SetString(PyExc_SystemError,buf);
      return NULL; /* Oops, list is invalid */
  }
  

  ClCntNodeHandleT  nodeHandle = -1;

  curLen += snprintf(buf+curLen, bufLen-curLen, "[");

  for (int count=0, entityRef = (ClAmsEntityRefT *) clAmsCntGetFirst( &entityList->list,&nodeHandle);
       entityRef != NULL; 
       count++, entityRef = (ClAmsEntityRefT *) clAmsCntGetNext( &entityList->list,&nodeHandle) )
  {
      AMS_CHECKPTR_AND_EXIT (!entityRef);        
      curLen += snprintf(buf+curLen, bufLen-curLen, "%s(%d,'%.*s')",(count==0) ? "":",", entityRef->entity.type,entityRef->entity.name.length,entityRef->entity.name.value);
  }

  curLen += snprintf(buf+curLen, bufLen-curLen, "]");
  
  PyObject* ret = PyRun_String(buf,Py_eval_input,emptyDict,emptyDict);
  return ret;
}
static VALUE
_wrap_HLServer_ping(int argc, VALUE *argv, VALUE self) {
    HLServer *arg1 = (HLServer *) 0 ;
    char *arg2 ;
    int arg3 = (int) 27015 ;
    int result;
    VALUE vresult = Qnil;
    
    if ((argc < 1) || (argc > 2))
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc);
    SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_HLServer, 1);
    arg2 = StringValuePtr(argv[0]);
    if (argc > 1) {
        arg3 = NUM2INT(argv[1]);
    }
    result = (int)HLServer_ping(arg1,(char const *)arg2,arg3);
    
    vresult = INT2NUM(result);
    return vresult;
}
Exemplo n.º 27
0
Arquivo: python.c Projeto: gplv2/rlib
static PyObject *_wrap_rlib_graph_add_bg_region(PyObject *self, PyObject *args) {
    PyObject *resultobj;
    rlib *arg1 = (rlib *) 0 ;
    char *arg2 ;
    char *arg3 ;
    char *arg4 ;
    float arg5 ;
    float arg6 ;
    int result;
    PyObject * obj0 = 0 ;
    
    if(!PyArg_ParseTuple(args,(char *)"Osssff:rlib_graph_add_bg_region",&obj0,&arg2,&arg3,&arg4,&arg5,&arg6)) goto fail;
    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_rlib,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
    result = (int)rlib_graph_add_bg_region(arg1,arg2,arg3,arg4,arg5,arg6);
    
    resultobj = PyInt_FromLong((long)result);
    return resultobj;
    fail:
    return NULL;
}
Exemplo n.º 28
0
Csock* CPySocket::GetSockObj(const CString& sHost, unsigned short uPort) {
	CPySocket* result = NULL;
	PyObject* pyRes = PyObject_CallMethod(m_pyObj, const_cast<char*>("_Accepted"), const_cast<char*>("sH"), sHost.c_str(), uPort);
	if (!pyRes) {
		CString sRetMsg = m_pModPython->GetPyExceptionStr();
		DEBUG("python socket failed in OnAccepted: " << sRetMsg);
		Close();
	}
	int res = SWIG_ConvertPtr(pyRes, (void**)&result, SWIG_TypeQuery("CPySocket*"), 0);
	if (!SWIG_IsOK(res)) {
		DEBUG("python socket was expected to return new socket from OnAccepted, but error=" << res);
		Close();
		result = NULL;
	}
    if (!result) {
        DEBUG("modpython: OnAccepted didn't return new socket");
    }
	Py_CLEAR(pyRes);
	return result;
}
static VALUE
_wrap_HLServer_get_infos(int argc, VALUE *argv, VALUE self) {
    HLServer *arg1 = (HLServer *) 0 ;
    string arg2 ;
    int arg3 ;
    server_info *result;
    VALUE vresult = Qnil;
    
    if ((argc < 2) || (argc > 2))
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc);
    SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_HLServer, 1);
    {
        Check_Type(argv[0], T_STRING);
        arg2= std::string( StringValueCStr(argv[0]) );
    }
    arg3 = NUM2INT(argv[1]);
    result = (server_info *)HLServer_get_infos(arg1,arg2,arg3);
    
    vresult = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_server_info,0);
    return vresult;
}
Exemplo n.º 30
0
      Type asType(VALUE v)
      {
        Type *ptr = nullptr;

        int res = SWIG_ConvertPtr(v, reinterpret_cast<void **>(&ptr), getTypeInfo<Type *>(), 0);
        if (SWIG_IsOK(res))
        {
          if (!ptr)
          {
            throw std::runtime_error(std::string("Result is null, trying to get type: ") + typeid(Type).name());
          }

          if (SWIG_IsNewObj(res)) {
            Type obj = *ptr;
            delete ptr;
            return obj;
          } else {
            return *ptr;
          }
        } else {
          throw std::runtime_error(std::string("Unable to convert object to type: ") + typeid(Type).name());
        }
      }