Back to index

php5  5.3.10
Defines | Functions | Variables
com_extension.c File Reference
#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "php_com_dotnet.h"
#include "php_com_dotnet_internal.h"
#include "Zend/zend_exceptions.h"

Go to the source code of this file.

Defines

#define COM_CONST(x)   REGISTER_LONG_CONSTANT(#x, x, CONST_CS|CONST_PERSISTENT)

Functions

static PHP_GINIT_FUNCTION (com_dotnet)
static PHP_INI_MH (OnTypeLibFileUpdate)
 PHP_MINIT_FUNCTION (com_dotnet)
 PHP_MSHUTDOWN_FUNCTION (com_dotnet)
 PHP_RINIT_FUNCTION (com_dotnet)
 PHP_RSHUTDOWN_FUNCTION (com_dotnet)
 PHP_MINFO_FUNCTION (com_dotnet)

Variables

TsHashTable php_com_typelibraries
zend_class_entry * php_com_variant_class_entry
zend_class_entry * php_com_exception_class_entry
zend_class_entry * php_com_saproxy_class_entry
const zend_function_entry com_dotnet_functions []
zend_module_entry com_dotnet_module_entry

Define Documentation


Function Documentation

static PHP_GINIT_FUNCTION ( com_dotnet  ) [static]

Definition at line 336 of file com_extension.c.

{
       memset(com_dotnet_globals, 0, sizeof(*com_dotnet_globals));
       com_dotnet_globals->code_page = CP_ACP;
}
static PHP_INI_MH ( OnTypeLibFileUpdate  ) [static]

Definition at line 266 of file com_extension.c.

{
       FILE *typelib_file;
       char *typelib_name_buffer;
       char *strtok_buf = NULL;
       int cached;

       if (!new_value || !new_value[0] || (typelib_file = VCWD_FOPEN(new_value, "r"))==NULL) {
              return FAILURE;
       }

       typelib_name_buffer = (char *) emalloc(sizeof(char)*1024);

       while (fgets(typelib_name_buffer, 1024, typelib_file)) {
              ITypeLib *pTL;
              char *typelib_name;
              char *modifier, *ptr;
              int mode = CONST_CS | CONST_PERSISTENT;   /* CONST_PERSISTENT is ok here */

              if (typelib_name_buffer[0]==';') {
                     continue;
              }
              typelib_name = php_strtok_r(typelib_name_buffer, "\r\n", &strtok_buf); /* get rid of newlines */
              if (typelib_name == NULL) {
                     continue;
              }
              typelib_name = php_strtok_r(typelib_name, "#", &strtok_buf);
              modifier = php_strtok_r(NULL, "#", &strtok_buf);
              if (modifier != NULL) {
                     if (!strcmp(modifier, "cis") || !strcmp(modifier, "case_insensitive")) {
                            mode &= ~CONST_CS;
                     }
              }

              /* Remove leading/training white spaces on search_string */
              while (isspace(*typelib_name)) {/* Ends on '\0' in worst case */
                     typelib_name ++;
              }
              ptr = typelib_name + strlen(typelib_name) - 1;
              while ((ptr != typelib_name) && isspace(*ptr)) {
                     *ptr = '\0';
                     ptr--;
              }

              if ((pTL = php_com_load_typelib_via_cache(typelib_name, COMG(code_page), &cached TSRMLS_CC)) != NULL) {
                     if (!cached) {
                            php_com_import_typelib(pTL, mode, COMG(code_page) TSRMLS_CC);
                     }
                     ITypeLib_Release(pTL);
              }
       }

       efree(typelib_name_buffer);
       fclose(typelib_file);

       return SUCCESS;
}

Here is the call graph for this function:

PHP_MINFO_FUNCTION ( com_dotnet  )

Definition at line 494 of file com_extension.c.

{
       php_info_print_table_start();

       php_info_print_table_header(2, "COM support", "enabled");
       php_info_print_table_header(2, "DCOM support", COMG(allow_dcom) ? "enabled" : "disabled");

#if HAVE_MSCOREE_H
       php_info_print_table_header(2, ".Net support", "enabled");
#else
       php_info_print_table_header(2, ".Net support", "not present in this build");
#endif

       php_info_print_table_end();

       DISPLAY_INI_ENTRIES();
}

Here is the call graph for this function:

PHP_MINIT_FUNCTION ( com_dotnet  )

Definition at line 345 of file com_extension.c.

{
       zend_class_entry ce, *tmp;

       php_com_wrapper_minit(INIT_FUNC_ARGS_PASSTHRU);
       php_com_persist_minit(INIT_FUNC_ARGS_PASSTHRU);

       INIT_CLASS_ENTRY(ce, "com_exception", NULL);
       php_com_exception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC);
       php_com_exception_class_entry->ce_flags |= ZEND_ACC_FINAL;
/*     php_com_exception_class_entry->constructor->common.fn_flags |= ZEND_ACC_PROTECTED; */

       INIT_CLASS_ENTRY(ce, "com_safearray_proxy", NULL);
       php_com_saproxy_class_entry = zend_register_internal_class(&ce TSRMLS_CC);
       php_com_saproxy_class_entry->ce_flags |= ZEND_ACC_FINAL;
/*     php_com_saproxy_class_entry->constructor->common.fn_flags |= ZEND_ACC_PROTECTED; */
       php_com_saproxy_class_entry->get_iterator = php_com_saproxy_iter_get;
       
       INIT_CLASS_ENTRY(ce, "variant", NULL);
       ce.create_object = php_com_object_new;
       php_com_variant_class_entry = zend_register_internal_class(&ce TSRMLS_CC);
       php_com_variant_class_entry->get_iterator = php_com_iter_get;

       INIT_CLASS_ENTRY(ce, "com", NULL);
       ce.create_object = php_com_object_new;
       tmp = zend_register_internal_class_ex(&ce, php_com_variant_class_entry, "variant" TSRMLS_CC);
       tmp->get_iterator = php_com_iter_get;

       zend_ts_hash_init(&php_com_typelibraries, 0, NULL, php_com_typelibrary_dtor, 1);

#if HAVE_MSCOREE_H
       INIT_CLASS_ENTRY(ce, "dotnet", NULL);
       ce.create_object = php_com_object_new;
       tmp = zend_register_internal_class_ex(&ce, php_com_variant_class_entry, "variant" TSRMLS_CC);
       tmp->get_iterator = php_com_iter_get;
#endif

       REGISTER_INI_ENTRIES();

#define COM_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_CS|CONST_PERSISTENT)
       
       COM_CONST(CLSCTX_INPROC_SERVER);
       COM_CONST(CLSCTX_INPROC_HANDLER);
       COM_CONST(CLSCTX_LOCAL_SERVER);
       COM_CONST(CLSCTX_REMOTE_SERVER);
       COM_CONST(CLSCTX_SERVER);
       COM_CONST(CLSCTX_ALL);

#if 0
       COM_CONST(DISPATCH_METHOD);
       COM_CONST(DISPATCH_PROPERTYGET);
       COM_CONST(DISPATCH_PROPERTYPUT);
#endif

       COM_CONST(VT_NULL);
       COM_CONST(VT_EMPTY);
       COM_CONST(VT_UI1);
       COM_CONST(VT_I1);
       COM_CONST(VT_UI2);
       COM_CONST(VT_I2);
       COM_CONST(VT_UI4);
       COM_CONST(VT_I4);
       COM_CONST(VT_R4);
       COM_CONST(VT_R8);
       COM_CONST(VT_BOOL);
       COM_CONST(VT_ERROR);
       COM_CONST(VT_CY);
       COM_CONST(VT_DATE);
       COM_CONST(VT_BSTR);
       COM_CONST(VT_DECIMAL);
       COM_CONST(VT_UNKNOWN);
       COM_CONST(VT_DISPATCH);
       COM_CONST(VT_VARIANT);
       COM_CONST(VT_INT);
       COM_CONST(VT_UINT);
       COM_CONST(VT_ARRAY);
       COM_CONST(VT_BYREF);

       COM_CONST(CP_ACP);
       COM_CONST(CP_MACCP);
       COM_CONST(CP_OEMCP);
       COM_CONST(CP_UTF7);
       COM_CONST(CP_UTF8);
       COM_CONST(CP_SYMBOL);
       COM_CONST(CP_THREAD_ACP);

       COM_CONST(VARCMP_LT);
       COM_CONST(VARCMP_EQ);
       COM_CONST(VARCMP_GT);
       COM_CONST(VARCMP_NULL);

       COM_CONST(NORM_IGNORECASE);
       COM_CONST(NORM_IGNORENONSPACE);
       COM_CONST(NORM_IGNORESYMBOLS);
       COM_CONST(NORM_IGNOREWIDTH);
       COM_CONST(NORM_IGNOREKANATYPE);
#ifdef NORM_IGNOREKASHIDA
       COM_CONST(NORM_IGNOREKASHIDA);
#endif
       COM_CONST(DISP_E_DIVBYZERO);
       COM_CONST(DISP_E_OVERFLOW);
       COM_CONST(DISP_E_BADINDEX);
       COM_CONST(MK_E_UNAVAILABLE);

       return SUCCESS;
}

Here is the call graph for this function:

PHP_MSHUTDOWN_FUNCTION ( com_dotnet  )

Definition at line 455 of file com_extension.c.

Here is the call graph for this function:

PHP_RINIT_FUNCTION ( com_dotnet  )

Definition at line 471 of file com_extension.c.

{
       COMG(rshutdown_started) = 0;
       return SUCCESS;
}
PHP_RSHUTDOWN_FUNCTION ( com_dotnet  )

Definition at line 480 of file com_extension.c.

{
#if HAVE_MSCOREE_H
       if (COMG(dotnet_runtime_stuff)) {
              php_com_dotnet_rshutdown(TSRMLS_C);
       }
#endif
       COMG(rshutdown_started) = 1;
       return SUCCESS;
}

Here is the call graph for this function:


Variable Documentation

Definition at line 197 of file com_extension.c.

zend_module_entry com_dotnet_module_entry
Initial value:
 {
       STANDARD_MODULE_HEADER,
       "com_dotnet",
       com_dotnet_functions,
       PHP_MINIT(com_dotnet),
       PHP_MSHUTDOWN(com_dotnet),
       PHP_RINIT(com_dotnet),
       PHP_RSHUTDOWN(com_dotnet),
       PHP_MINFO(com_dotnet),
       "0.1",
       PHP_MODULE_GLOBALS(com_dotnet),
       PHP_GINIT(com_dotnet),
       NULL,
       NULL,
       STANDARD_MODULE_PROPERTIES_EX
}

Definition at line 236 of file com_extension.c.

zend_class_entry * php_com_exception_class_entry

Definition at line 38 of file com_extension.c.

zend_class_entry * php_com_saproxy_class_entry

Definition at line 38 of file com_extension.c.

Definition at line 35 of file com_extension.c.

zend_class_entry* php_com_variant_class_entry

Definition at line 38 of file com_extension.c.