pike.git / src / post_modules / COM / com.c

version» Context lines:

pike.git/src/post_modules/COM/com.c:2:    * Pike interface to Common Object Model (COM)    *    * Tomas Nilsson    */      /*    * Includes    */      #define COM_DEBUG - #define NO_PIKE_SHORTHAND +     - #ifdef HAVE_CONFIG_H +    #include "config.h" - #endif /* HAVE_CONFIG_H */ -  +    #include "global.h" -  +    #include "program.h"   #include "interpret.h"   #include "stralloc.h"   #include "object.h"   #include "mapping.h"   #include "builtin_functions.h"   #include "pike_error.h"   #include "module_support.h"   #include "pike_memory.h" -  + #include "pike_types.h"   #include "gc.h"   #include "threads.h"   #include "operators.h"      #ifdef HAVE_COM      #ifdef HAVE_OBJBASE_H   #include <objbase.h>   #endif /* HAVE_OBJBASE_H */   
pike.git/src/post_modules/COM/com.c:132:    LPVOID lpMsgBuf;    ONERROR tmp;    FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |    FORMAT_MESSAGE_FROM_SYSTEM |    FORMAT_MESSAGE_IGNORE_INSERTS, NULL, hr,    MAKELANGID(LANG_NEUTRAL,    SUBLANG_DEFAULT),(LPTSTR) &lpMsgBuf,    0, NULL);    SET_ONERROR(tmp, LocalFree, lpMsgBuf);    Pike_error("Com Error: %s\n", lpMsgBuf); -  /* NOT_REACHED */ -  CALL_AND_UNSET_ONERROR(tmp); +  UNREACHABLE(CALL_AND_UNSET_ONERROR(tmp));   }      static void com_throw_error2(HRESULT hr, EXCEPINFO excep)   {    if (hr==DISP_E_EXCEPTION && excep.bstrDescription)    {    char errDesc[512];    wcstombs(errDesc, excep.bstrDescription, 512);    Pike_error("Server Error: Run-time error %d:\n\n %s\n",    excep.scode & 0x0000FFFF, //Lower 16-bits of SCODE
pike.git/src/post_modules/COM/com.c:312:    long lbound, ubound;    int push_count = 0;       SafeArrayLock(psa);    SafeArrayGetVartype(psa, &vtype);       if (vtype != VT_VARIANT)    {    /* TODO: Handle more array types */    Pike_error("Unknown vartype: %d\n", vtype); -  /* Not reached! */ -  push_undefined(); -  return; +  UNREACHABLE(return);    }       SafeArrayGetLBound(psa, curdim, &lbound);    SafeArrayGetUBound(psa, curdim, &ubound);    for (i=lbound; i<=ubound; i++)    {    indices[dims-curdim] = i;    if (curdim < dims)    {    low_push_safearray(psa, dims, indices, curdim+1);
pike.git/src/post_modules/COM/com.c:579:    &res,    &exc,    &argErr);          free_variant_arg(&dpar);       if (FAILED(hr))    {    com_throw_error2(hr, exc); -  -  /* NOT reached! */ -  pop_n_elems(args); -  push_int(0); -  return; +  UNREACHABLE(return);    }       pop_n_elems(args);       push_varg(&res);       VariantClear(&res);       return;   }
pike.git/src/post_modules/COM/com.c:619:    cval->pIDispatch->lpVtbl->Release(cval->pIDispatch);    cval->pIDispatch = NULL;    }    if (cval->method)    {    free_string(cval->method);    cval->method = NULL;    }   }    - /* pike_add_function("create", f_cval_create, "function(void:void)", 0); */ - /* - static void f_cval_create(INT32 args) - { - } - */ -  - /* pike_add_function("destroy", f_cval_destroy, "function(void:void)", 0); */ - /* - static void f_cval_destroy(INT32 args) - { - } - */ -  - /* pike_add_function("_value", f_cval_value, "function(:mixed)", 0); */ + /* ADD_FUNCTION("_value", f_cval_value, tFunc(tVoid,tMix), 0); */   static void f_cval__value(INT32 args)   {    cval_push_result(0, DISPATCH_PROPERTYGET);   }      #define OPERATOR(op) static void f_cval_##op(INT32 args) \   { \    cval_push_result(0, DISPATCH_PROPERTYGET); \    args++; \    stack_swap2(args); \
pike.git/src/post_modules/COM/com.c:687:   ROPERATOR(xor)   ROPERATOR(lsh)   ROPERATOR(rsh)   ROPERATOR(multiply)   ROPERATOR(divide)   ROPERATOR(mod)      #undef ROPERATOR       - /* pike_add_function("__hash", f_cval___hash, "function(mixed:mixed)", 0); */ + /* ADD_FUNCTION("__hash", f_cval___hash, tFunc(tMix,tMix), 0); */   static void f_cval___hash(INT32 args)   {    cval_push_result(0, DISPATCH_PROPERTYGET);    args++;    stack_swap2(args);    f_hash(args);   }    - /* pike_add_function("cast", f_cval_cast, "function(mixed:mixed)", 0); */ + /* ADD_FUNCTION("cast", f_cval_cast, tFunc(tMix,tMix), 0); */   static void f_cval_cast(INT32 args)   {    struct cval_storage *cval = THIS_CVAL;       if (args < 1)    Pike_error("cast() called without arguments.\n");    if (TYPEOF(Pike_sp[-args]) != PIKE_T_STRING)    Pike_error("Bad argument 1 to cast().\n");    -  if (!strcmp(Pike_sp[-args].u.string->str, "object")) { +  if( Pike_sp[-args].u.string == literal_string_string ) +  {    pop_n_elems(args); -  push_object(this_object()); +  cval_push_result(0, DISPATCH_PROPERTYGET);    } -  -  - /* if (strcmp(Pike_sp[-args].u.string->str, "string")) */ - /* Pike_error("cast() to other type than string.\n"); */ -  +  else +  {    pop_n_elems(args); -  cval_push_result(0, DISPATCH_PROPERTYGET); +  push_undefined();    } -  + }    - /* pike_add_function("`[]", f_cval_ind, "function(mixed:mixed)", 0); */ + /* ADD_FUNCTION("`[]", f_cval_ind, tFunc(tMix,tMix), 0); */   /* static void f_cval_ind(INT32 args) */   /* { */   /* f_index(args); */   /* } */    - /* pike_add_function("`[]=", f_cval_indset, "function(mixed:mixed)", 0); */ + /* ADD_FUNCTION("`[]=", f_cval_indset, tFunc(tMix,tMix), 0); */   /* static void f_cval_indset(INT32 args) */   /* { */   /* f_index_assign(args); */   /* } */    - /* pike_add_function("`->", f_cval_aind, "function(mixed:mixed)", 0); */ + /* ADD_FUNCTION("`->", f_cval_aind, tFunc(tMix,tMix), 0); */   static void f_cval_arrow(INT32 args)   {    struct cval_storage *cval = THIS_CVAL;       if (args != 1)    Pike_error("Bad argument to cval::`->\n");       if (TYPEOF(Pike_sp[-1]) == PIKE_T_STRING &&    !strncmp(Pike_sp[-1].u.string->str, "_value", Pike_sp[-1].u.string->len))    {
pike.git/src/post_modules/COM/com.c:759:    Pike_sp[-1].u.object->prog != cobj_program)    {    pop_n_elems(args+1);    push_undefined();    return;    }    stack_swap();    f_arrow(2);   }    - /* pike_add_function("`->=", f_cval_aindset, "function(mixed:mixed)", 0); */ + /* ADD_FUNCTION("`->=", f_cval_aindset, tFunc(tMix,tMix), 0); */   static void f_cval_arrow_assign(INT32 args)   {    struct cval_storage *cval = THIS_CVAL;       if (args != 2)    Pike_error("Bad argument to cval::`->=\n");       cval_push_result(0, DISPATCH_PROPERTYGET);    if (TYPEOF(Pike_sp[-1]) != PIKE_T_OBJECT ||    Pike_sp[-1].u.object->prog != cobj_program)    {    pop_n_elems(args+1);    push_int(0);    }    stack_swap2(3);    f_arrow_assign(3);   }    - /* pike_add_function("_sizeof", f_cval__sizeof, "function(mixed:mixed)", 0); */ + /* ADD_FUNCTION("_sizeof", f_cval__sizeof, tFunc(tMix,tMix), 0); */   /* static void f_cval__sizeof(INT32 args) */   /* { */   /* } */    - /* pike_add_function("_indices", f_cval__indices, "function(mixed:mixed)", 0); */ + /* ADD_FUNCTION("_indices", f_cval__indices, tFunc(tMix,tMix), 0); */   /* static void f_cval__indices(INT32 args) */   /* { */   /* } */    - /* pike_add_function("_values", f_cval__values, "function(mixed:mixed)", 0); */ + /* ADD_FUNCTION("_values", f_cval__values, tFunc(tMix,tMix), 0); */   /* static void f_cval__values(INT32 args) */   /* { */   /* } */    - /* pike_add_function("`()", f_cval_func, "function(mixed:mixed)", 0); */ + /* ADD_FUNCTION("`()", f_cval_func, tFunc(tMix,tMix), 0); */   static void f_cval_func(INT32 args)   {    cval_push_result(args, DISPATCH_METHOD);   }    - /* pike_add_function("`+=", f_cval_inc, "function(mixed:mixed)", 0); */ + /* ADD_FUNCTION("`+=", f_cval_inc, tFunc(tMix,tMix), 0); */   /* static void f_cval_inc(INT32 args) */   /* { */   /* } */    - /* pike_add_function("_is_type", f_cval__is_type, "function(mixed:mixed)", 0); */ + /* ADD_FUNCTION("_is_type", f_cval__is_type, tFunc(tMix,tMix), 0); */   /* static void f_cval__is_type(INT32 args) */   /* { */   /* } */    - /* pike_add_function("_sprintf", f_cval__sprintf, "function(mixed:mixed)", 0); */ + /* ADD_FUNCTION("_sprintf", f_cval__sprintf, tFunc(tMix,tMix), 0); */   static void f_cval__sprintf(INT32 args)   {    struct cval_storage *cval = THIS_CVAL;    char buf[80];    char *p;    INT_TYPE precision, precision_undecided, width, width_undecided;   /* INT_TYPE base = 0, mask_shift = 0; */   /* struct pike_string *s = 0; */    INT_TYPE flag_left, method;    struct string_builder s;    - /* get_all_args("_sprintf",args,"%i",&x); */ + /* get_all_args(NULL,args,"%i",&x); */    if (args < 1 || TYPEOF(Pike_sp[-args]) != PIKE_T_INT)    Pike_error("Bad argument 1 for Com.cval->_sprintf().\n");    if (args < 2 || TYPEOF(Pike_sp[1-args]) != PIKE_T_MAPPING)    Pike_error("Bad argument 2 for Com.cval->_sprintf().\n");       push_svalue(&Pike_sp[1-args]); -  push_constant_text("precision"); +  push_static_text("precision");    f_index(2);    if (TYPEOF(Pike_sp[-1]) != PIKE_T_INT)    Pike_error("\"precision\" argument to Com->_sprintf() is not an integer.\n");    precision_undecided = (SUBTYPEOF(Pike_sp[-1]) != NUMBER_NUMBER);    precision = (--Pike_sp)->u.integer;       push_svalue(&Pike_sp[1-args]); -  push_constant_text("width"); +  push_static_text("width");    f_index(2);    if (TYPEOF(Pike_sp[-1]) != PIKE_T_INT)    Pike_error("\"width\" argument to Com->_sprintf() is not an integer.\n");    width_undecided = (SUBTYPEOF(Pike_sp[-1]) != NUMBER_NUMBER);    width = (--Pike_sp)->u.integer;       push_svalue(&Pike_sp[1-args]); -  push_constant_text("flag_left"); +  push_static_text("flag_left");    f_index(2);    if (TYPEOF(Pike_sp[-1]) != PIKE_T_INT)    Pike_error("\"flag_left\" argument to Com->_sprintf() is not an integer.\n");    flag_left=Pike_sp[-1].u.integer;    pop_stack();       switch (method = Pike_sp[-args].u.integer)    {    case 'O':    init_string_builder(&s, 0);
pike.git/src/post_modules/COM/com.c:895:    return;       default:    pop_n_elems(args);    push_int(0);    return;    }      }    - /* pike_add_function("_equal", f_cval__equal, "function(mixed:mixed)", 0); */ + /* ADD_FUNCTION("_equal", f_cval__equal, tFunc(tMix,tMix), 0); */   /* static void f_cval__equal(INT32 args) */   /* { */   /* } */    - /* pike_add_function("_m_delete", f_cval__m_delete, "function(mixed:mixed)", 0); */ + /* ADD_FUNCTION("_m_delete", f_cval__m_delete, tFunc(tMix,tMix), 0); */   /* static void f_cval__m_delete(INT32 args) */   /* { */   /* } */            /********/   /* cobj */   /********/      static void f_cobj_create(INT32 args)   {    struct cobj_storage *cobj = THIS_COBJ;    HRESULT hr;    CLSID clsid;    struct pike_string *progID;    PCHARP progID2;       if (args > 0)    { -  get_all_args("Com.obj->create()", args, "%W", &progID); +  get_all_args(NULL, args, "%W", &progID);    progID2 = MKPCHARP(malloc(progID->len * 2 + 2), 1);    pike_string_cpy(progID2, progID);    SET_INDEX_PCHARP(progID2, progID->len, 0);       hr = CLSIDFromProgID((OLECHAR *)progID2.ptr, &clsid);    if (!SUCCEEDED(hr))    {    pop_n_elems(args);    destruct(Pike_fp->current_object);    return;
pike.git/src/post_modules/COM/com.c:987:   {    struct cobj_storage *cobj = THIS_COBJ;    DISPPARAMS *dpar;    VARIANT res;    EXCEPINFO exc;    UINT argErr;    HRESULT hr;    struct pike_string *prop;    PCHARP propU;    -  get_all_args("Com.obj->get_prop()", args, "%W", &prop); +  get_all_args(NULL, args, "%W", &prop);    propU = MKPCHARP(malloc(prop->len * 2 + 2), 1);    pike_string_cpy(propU, prop);    SET_INDEX_PCHARP(propU, prop->len, 0);       create_variant_arg(0, &dpar);    VariantInit(&res);    hr = invoke(cobj, (OLECHAR *)propU.ptr, DISPATCH_PROPERTYGET, dpar,    &res, &exc, &argErr);    free_variant_arg(&dpar);    free(propU.ptr);
pike.git/src/post_modules/COM/com.c:1049:    create_variant_arg(args-1, &dpar);    VariantInit(&res);    hr = invoke(cobj, (OLECHAR *)propU.ptr, DISPATCH_PROPERTYPUT, dpar,    &res, &exc, &argErr);    free_variant_arg(&dpar);    free(propU.ptr);       if (FAILED(hr))    {    com_throw_error2(hr, exc); -  -  /* Not reached */ -  pop_n_elems(args); -  push_int(0); -  return; +  UNREACHABLE(return);    }       pop_n_elems(args);       push_varg(&res);       VariantClear(&res);       return;   }
pike.git/src/post_modules/COM/com.c:1097:    create_variant_arg(args-1, &dpar);    VariantInit(&res);    hr = invoke(cobj, (OLECHAR *)propU.ptr, DISPATCH_METHOD, dpar,    &res, &exc, &argErr);    free_variant_arg(&dpar);    free(propU.ptr);       if (FAILED(hr))    {    com_throw_error2(hr, exc); -  -  /* Not reached */ -  pop_n_elems(args); -  push_int(0); -  return; +  UNREACHABLE(return);    }       pop_n_elems(args);       push_varg(&res);       VariantClear(&res);       return;   }
pike.git/src/post_modules/COM/com.c:1198:    if (args < 2 || TYPEOF(Pike_sp[1-args]) != PIKE_T_MAPPING)    Pike_error("Bad argument 2 for Com.cobj->_sprintf().\n");       switch (Pike_sp[-args].u.integer)    {    case 'O':    {    struct string_builder s;    init_string_builder(&s, 0);    string_builder_sprintf(&s, "Com.cobj(%llx)", -  (LONGEST)(ptrdiff_t)cobj->pIDispatch); +  (INT64)(ptrdiff_t)cobj->pIDispatch);    push_string(finish_string_builder(&s));    stack_pop_n_elems_keep_top(args);    return;    }    }       pop_n_elems(args);    push_int(0);   }   
pike.git/src/post_modules/COM/com.c:1405:      static void f_create_object(INT32 args)   {    struct object *oo;    HRESULT hr;    CLSID clsid;    struct pike_string *progID;    PCHARP progID2;    IDispatch *pDispatch;    -  get_all_args("Com->create_object()", args, "%W", &progID); -  //check_all_args("create_object", args, BIT_STRING, 0); +  get_all_args(NULL, args, "%W", &progID);       progID2 = MKPCHARP(malloc(progID->len * 2 + 2), 1);    pike_string_cpy(progID2, progID);    SET_INDEX_PCHARP(progID2, progID->len, 0);       hr = CLSIDFromProgID((OLECHAR *)progID2.ptr, &clsid);    free(progID2.ptr);       if (FAILED(hr))    {
pike.git/src/post_modules/COM/com.c:1805:    if (!typelib)    Pike_error("Bad argument 1 for Com->GetConstants().\n");       hr = LoadTypeLib(typelib, &ptlib);    if (to_free)    free(to_free);       if (FAILED(hr))    {    com_throw_error(hr); -  /* Not reached */ -  return; +  UNREACHABLE(return);    }    }    else if (TYPEOF(Pike_sp[-args]) == PIKE_T_OBJECT &&    Pike_sp[-args].u.object->prog == cobj_program)    {    /* cobj */    co = (struct cobj_storage *)Pike_sp[-args].u.object->storage;    hr = co->pIDispatch->lpVtbl->GetTypeInfo(co->pIDispatch, 0,    GetUserDefaultLCID(), &ptinfo);   
pike.git/src/post_modules/COM/com.c:1884:   #endif /* USE_COM_PROG */       if (args < 1 || TYPEOF(Pike_sp[-args]) != PIKE_T_INT)    Pike_error("Bad argument 1 for Com->_sprintf().\n");    if (args < 2 || TYPEOF(Pike_sp[1-args]) != PIKE_T_MAPPING)    Pike_error("Bad argument 2 for Com->_sprintf().\n");       switch (Pike_sp[-args].u.integer)    {    case 'O': -  push_constant_text("Com()"); +  push_static_text("Com()");    stack_pop_n_elems_keep_top(args);    return;    }       pop_n_elems(args);    push_int(0);   }      #endif /* HAVE_COM */   
pike.git/src/post_modules/COM/com.c:1906: Inside #if defined(HAVE_COM)
  {   #ifdef HAVE_COM    struct svalue prog;    SET_SVAL(prog, PIKE_T_PROGRAM, 0, program, NULL);       /* load and initialize COM */    CoInitialize(0);       start_new_program();    ADD_STORAGE(struct cval_storage); - /* pike_add_function("create", f_cval_create, "function(void:void)", 0); */ - /* pike_add_function("destroy", f_cval_destroy, "function(void:void)", 0); */ +     -  pike_add_function("_value", f_cval__value, "function(:mixed)", 0); +  ADD_FUNCTION("_value", f_cval__value, tFunc(tVoid,tMix), 0);    -  pike_add_function("`+", f_cval_add, "function(mixed:mixed)", 0); -  pike_add_function("`-", f_cval_minus, "function(mixed:mixed)", 0); -  pike_add_function("`&", f_cval_and, "function(mixed:mixed)", 0); -  pike_add_function("`|", f_cval_or, "function(mixed:mixed)", 0); -  pike_add_function("`^", f_cval_xor, "function(mixed:mixed)", 0); -  pike_add_function("`<<", f_cval_lsh, "function(mixed:mixed)", 0); -  pike_add_function("`>>", f_cval_rsh, "function(mixed:mixed)", 0); -  pike_add_function("`*", f_cval_multiply, "function(mixed:mixed)", 0); -  pike_add_function("`/", f_cval_divide, "function(mixed:mixed)", 0); -  pike_add_function("`%", f_cval_mod, "function(mixed:mixed)", 0); -  pike_add_function("`~", f_cval_compl, "function(:mixed)", 0); -  pike_add_function("`==", f_cval_eq, "function(mixed:mixed)", 0); -  pike_add_function("`<", f_cval_lt, "function(mixed:mixed)", 0); -  pike_add_function("`>", f_cval_gt, "function(mixed:mixed)", 0); +  ADD_FUNCTION("`+", f_cval_add, tFunc(tMix,tMix), 0); +  ADD_FUNCTION("`-", f_cval_minus, tFunc(tMix,tMix), 0); +  ADD_FUNCTION("`&", f_cval_and, tFunc(tMix,tMix), 0); +  ADD_FUNCTION("`|", f_cval_or, tFunc(tMix,tMix), 0); +  ADD_FUNCTION("`^", f_cval_xor, tFunc(tMix,tMix), 0); +  ADD_FUNCTION("`<<", f_cval_lsh, tFunc(tMix,tMix), 0); +  ADD_FUNCTION("`>>", f_cval_rsh, tFunc(tMix,tMix), 0); +  ADD_FUNCTION("`*", f_cval_multiply, tFunc(tMix,tMix), 0); +  ADD_FUNCTION("`/", f_cval_divide, tFunc(tMix,tMix), 0); +  ADD_FUNCTION("`%", f_cval_mod, tFunc(tMix,tMix), 0); +  ADD_FUNCTION("`~", f_cval_compl, tFunc(tVoid,tMix), 0); +  ADD_FUNCTION("`==", f_cval_eq, tFunc(tMix,tMix), 0); +  ADD_FUNCTION("`<", f_cval_lt, tFunc(tMix,tMix), 0); +  ADD_FUNCTION("`>", f_cval_gt, tFunc(tMix,tMix), 0);    -  pike_add_function("__hash", f_cval___hash, "function(:mixed)", 0); -  pike_add_function("cast", f_cval_cast, "function(mixed:mixed)", 0); -  pike_add_function("`!", f_cval_not, "function(:mixed)", 0); - /* pike_add_function("`[]", f_cval_ind, "function(mixed:mixed)", 0); */ - /* pike_add_function("`[]=", f_cval_indset, "function(mixed:mixed)", 0); */ -  pike_add_function("`[]", f_cval_arrow, "function(mixed:mixed)", 0); -  pike_add_function("`[]=", f_cval_arrow_assign, "function(mixed:mixed)", 0); -  pike_add_function("`->", f_cval_arrow, "function(mixed:mixed)", 0); -  pike_add_function("`->=", f_cval_arrow_assign, "function(mixed:mixed)", 0); - /* pike_add_function("_sizeof", f_cval__sizeof, "function(mixed:mixed)", 0); */ - /* pike_add_function("_indices", f_cval__indices, "function(mixed:mixed)", 0); */ - /* pike_add_function("_values", f_cval__values, "function(mixed:mixed)", 0); */ -  pike_add_function("`()", f_cval_func, "function(mixed:mixed)", 0); -  pike_add_function("``+", f_cval_radd, "function(mixed:mixed)", 0); -  pike_add_function("``-", f_cval_rminus, "function(mixed:mixed)", 0); -  pike_add_function("``&", f_cval_rand, "function(mixed:mixed)", 0); -  pike_add_function("``|", f_cval_ror, "function(mixed:mixed)", 0); -  pike_add_function("``^", f_cval_rxor, "function(mixed:mixed)", 0); -  pike_add_function("``<<", f_cval_rlsh, "function(mixed:mixed)", 0); -  pike_add_function("``>>", f_cval_rrsh, "function(mixed:mixed)", 0); -  pike_add_function("``*", f_cval_rmultiply, "function(mixed:mixed)", 0); -  pike_add_function("``/", f_cval_rdivide, "function(mixed:mixed)", 0); -  pike_add_function("``%", f_cval_rmod, "function(mixed:mixed)", 0); - /* pike_add_function("`+=", f_cval_inc, "function(mixed:mixed)", 0); */ - /* pike_add_function("_is_type", f_cval__is_type, "function(mixed:mixed)", 0); */ -  pike_add_function("_sprintf", f_cval__sprintf, "function(mixed:mixed)", 0); - /* pike_add_function("_equal", f_cval__equal, "function(mixed:mixed)", 0); */ - /* pike_add_function("_m_delete", f_cval__m_delete, "function(mixed:mixed)", 0); */ +  ADD_FUNCTION("__hash", f_cval___hash, tFunc(tVoid,tMix), 0); +  ADD_FUNCTION("cast", f_cval_cast, tFunc(tMix,tMix), 0); +  ADD_FUNCTION("`!", f_cval_not, tFunc(tVoid,tMix), 0); + /* ADD_FUNCTION("`[]", f_cval_ind, tFunc(tMix,tMix), 0); */ + /* ADD_FUNCTION("`[]=", f_cval_indset, tFunc(tMix,tMix), 0); */ +  ADD_FUNCTION("`[]", f_cval_arrow, tFunc(tMix,tMix), 0); +  ADD_FUNCTION("`[]=", f_cval_arrow_assign, tFunc(tMix,tMix), 0); +  ADD_FUNCTION("`->", f_cval_arrow, tFunc(tMix,tMix), 0); +  ADD_FUNCTION("`->=", f_cval_arrow_assign, tFunc(tMix,tMix), 0); + /* ADD_FUNCTION("_sizeof", f_cval__sizeof, tFunc(tMix,tMix), 0); */ + /* ADD_FUNCTION("_indices", f_cval__indices, tFunc(tMix,tMix), 0); */ + /* ADD_FUNCTION("_values", f_cval__values, tFunc(tMix,tMix), 0); */ +  ADD_FUNCTION("`()", f_cval_func, tFunc(tMix,tMix), 0); +  ADD_FUNCTION("``+", f_cval_radd, tFunc(tMix,tMix), 0); +  ADD_FUNCTION("``-", f_cval_rminus, tFunc(tMix,tMix), 0); +  ADD_FUNCTION("``&", f_cval_rand, tFunc(tMix,tMix), 0); +  ADD_FUNCTION("``|", f_cval_ror, tFunc(tMix,tMix), 0); +  ADD_FUNCTION("``^", f_cval_rxor, tFunc(tMix,tMix), 0); +  ADD_FUNCTION("``<<", f_cval_rlsh, tFunc(tMix,tMix), 0); +  ADD_FUNCTION("``>>", f_cval_rrsh, tFunc(tMix,tMix), 0); +  ADD_FUNCTION("``*", f_cval_rmultiply, tFunc(tMix,tMix), 0); +  ADD_FUNCTION("``/", f_cval_rdivide, tFunc(tMix,tMix), 0); +  ADD_FUNCTION("``%", f_cval_rmod, tFunc(tMix,tMix), 0); + /* ADD_FUNCTION("`+=", f_cval_inc, tFunc(tMix,tMix), 0); */ + /* ADD_FUNCTION("_is_type", f_cval__is_type, tFunc(tMix,tMix), 0); */ +  ADD_FUNCTION("_sprintf", f_cval__sprintf, tFunc(tMix,tMix), 0); + /* ADD_FUNCTION("_equal", f_cval__equal, tFunc(tMix,tMix), 0); */ + /* ADD_FUNCTION("_m_delete", f_cval__m_delete, tFunc(tMix,tMix), 0); */       set_init_callback(init_cval_struct);    set_exit_callback(exit_cval_struct);    cval_program = end_program();    cval_program->flags |= PROGRAM_DESTRUCT_IMMEDIATE;       start_new_program();    ADD_STORAGE(struct cobj_storage); -  pike_add_function("create", f_cobj_create, "function(string:void)", 0); -  pike_add_function("get_prop", f_cobj_getprop, "function(string:mixed)", 0); -  pike_add_function("set_prop", f_cobj_setprop, -  "function(string,mixed:mixed)", 0); -  pike_add_function("call_method", f_cobj_call_method, -  "function(string:mixed)", 0); -  pike_add_function("`->", f_cobj_arrow, "function(string:mixed)", 0); -  pike_add_function("`->=", f_cobj_arrow_assign, -  "function(string,mixed:mixed)", 0); -  pike_add_function("_sprintf", f_cobj__sprintf, "function(mixed:mixed)", 0); -  pike_add_function("_indices", f_cobj__indices, "function(:mixed)", 0); +  ADD_FUNCTION("create", f_cobj_create, tFunc(tStr,tVoid), 0); +  ADD_FUNCTION("get_prop", f_cobj_getprop, tFunc(tStr,tMix), 0); +  ADD_FUNCTION("set_prop", f_cobj_setprop, tFunc(tStr tMix,tMix), 0); +  ADD_FUNCTION("call_method", f_cobj_call_method, tFunc(tStr,tMix), 0); +  ADD_FUNCTION("`->", f_cobj_arrow, tFunc(tStr,tMix), 0); +  ADD_FUNCTION("`->=", f_cobj_arrow_assign, tFunc(tStr tMix,tMix), 0); +  ADD_FUNCTION("_sprintf", f_cobj__sprintf, tFunc(tMix,tMix), 0); +  ADD_FUNCTION("_indices", f_cobj__indices, tFunc(tVoid,tMix), 0);       set_init_callback(init_cobj_struct);    set_exit_callback(exit_cobj_struct);    cobj_program = end_program();   /* add_program_constant("cobj", cobj_program = end_program(), 0); */    cobj_program->flags |= PROGRAM_DESTRUCT_IMMEDIATE;      #ifdef USE_COM_PROG    start_new_program();    ADD_STORAGE(struct com_storage); -  pike_add_function("create", f_create, "function(string|void:void)", 0); +  ADD_FUNCTION("create", f_create, tFunc(tOr(tStr,tVoid),tVoid), 0);   #endif /* USE_COM_PROG */    - /* pike_add_function("get_version", f_get_version, "function(:int)", 0); */ - /* pike_add_function("get_nt_systeminfo", f_get_nt_systeminfo, */ - /* "function(:string|array|mapping)", 0); */ -  pike_add_function("CreateObject", f_create_object, -  "function(string:object)", 0); -  pike_add_function("GetObject", f_get_object, -  "function(string|void,string|void:object)", 0); -  pike_add_function("GetTypeInfo", f_get_typeinfo, -  "function(object:mixed)", 0); -  pike_add_function("GetConstants", f_get_constants, -  "function(object|string:mapping)", 0); -  pike_add_function("_sprintf", f_com__sprintf, "function(mixed:mixed)", 0); + /* ADD_FUNCTION("get_version", f_get_version, tFunc(tVoid,tInt), 0); */ + /* ADD_FUNCTION("get_nt_systeminfo", f_get_nt_systeminfo, */ + /* tFunc(tVoid,tOr3(tStr,tArray,tMapping), 0); */ +  ADD_FUNCTION("CreateObject", f_create_object, tFunc(tStr,tObj), 0); +  ADD_FUNCTION("GetObject", f_get_object, +  tFunc(tOr(tStr,tVoid) tOr(tStr,tVoid),tObj), 0); +  ADD_FUNCTION("GetTypeInfo", f_get_typeinfo, tFunc(tObj,tMix), 0); +  ADD_FUNCTION("GetConstants", f_get_constants, +  tFunc(tOr(tObj,tStr),tMapping), 0); +  ADD_FUNCTION("_sprintf", f_com__sprintf, tFunc(tMix,tMix), 0);      #ifdef USE_COM_PROG    set_init_callback(init_com_struct);    set_exit_callback(exit_com_struct);   /* #ifdef _REENTRANT */   /* set_gc_check_callback(com_gc_check); */   /* set_gc_recurse_callback(com_gc_recurse); */   /* #endif /\* _REENTRANT *\/ */       add_program_constant("com", com_program = end_program(), 0);
pike.git/src/post_modules/COM/com.c:2035: Inside #if defined(HAVE_COM)
   cobj_program=NULL;    }    if (cval_program) {    free_program(cval_program);    cval_program=NULL;    }       CoUninitialize();   #endif /* HAVE_COM */   } -  -  +