Changeset 1072 for trunk/ext

Show
Ignore:
Timestamp:
09/03/08 00:07:24 (4 months ago)
Author:
laurentj
Message:

jelix extension: fixed compilation issue with some old compilers
ticket #386: added a pref in php.ini to disable some features of the jelix ext in order to use some dev/opt edition of jelix in some virtual host for examples

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ext/jelix/jelix.c

    r695 r1072  
    22*  Jelix 
    33*  a php extension for Jelix Framework 
    4 * @copyright Copyright (c) 2006-2007 Laurent Jouanneau 
     4* @copyright Copyright (c) 2006-2008 Laurent Jouanneau 
    55* @author : Laurent Jouanneau 
    66* @link http://jelix.org 
     
    6262/* {{{ PHP_INI 
    6363 */ 
    64 /* Remove comments and fill if you need to have entries in php.ini 
    6564PHP_INI_BEGIN() 
    66     STD_PHP_INI_ENTRY("jelix.global_value",      "42", PHP_INI_ALL, OnUpdateLong, global_value, zend_jelix_globals, jelix_globals) 
    67     STD_PHP_INI_ENTRY("jelix.global_string", "foobar", PHP_INI_ALL, OnUpdateString, global_string, zend_jelix_globals, jelix_globals) 
     65    /* this flag allow to disable some features of the jelix extension, so we can use 
     66     * dev or opt edition of jelix 
     67     */ 
     68    STD_PHP_INI_BOOLEAN("jelix.activated", "1", PHP_INI_SYSTEM, OnUpdateBool, activated, zend_jelix_globals, jelix_globals) 
    6869PHP_INI_END() 
    69 */ 
     70 
    7071/* }}} */ 
    7172 
    7273/* {{{ php_jelix_init_globals 
    7374 */ 
    74 /* Uncomment this function if you have INI entries 
     75 
    7576static void php_jelix_init_globals(zend_jelix_globals *jelix_globals) 
    7677{ 
    77         jelix_globals->global_value = 0; 
    78         jelix_globals->global_string = NULL; 
    79 
    80 */ 
     78    jelix_globals->activated = 1; 
     79
     80 
    8181/* }}} */ 
    8282 
     
    8585PHP_MINIT_FUNCTION(jelix) 
    8686{ 
    87         /* If you have INI entries, uncomment these lines 
    88         REGISTER_INI_ENTRIES(); 
    89         */ 
    90  
    91         PHP_MINIT(jelix_interfaces)(INIT_FUNC_ARGS_PASSTHRU); 
    92  
    93     REGISTER_STRING_CONSTANT("JELIX_NAMESPACE_BASE", "http://jelix.org/ns/", CONST_CS | CONST_PERSISTENT); 
    94  
    95         return SUCCESS; 
     87    REGISTER_INI_ENTRIES(); 
     88    if (JELIX_G(activated)) { 
     89        PHP_MINIT(jelix_interfaces)(INIT_FUNC_ARGS_PASSTHRU); 
     90 
     91        REGISTER_STRING_CONSTANT("JELIX_NAMESPACE_BASE", "http://jelix.org/ns/", CONST_CS | CONST_PERSISTENT); 
     92    } 
     93    return SUCCESS; 
    9694} 
    9795/* }}} */ 
     
    10199PHP_MSHUTDOWN_FUNCTION(jelix) 
    102100{ 
    103         /* uncomment this line if you have INI entries 
    104         UNREGISTER_INI_ENTRIES(); 
    105         */ 
    106         return SUCCESS; 
     101    UNREGISTER_INI_ENTRIES(); 
     102    return SUCCESS; 
    107103} 
    108104/* }}} */ 
     
    113109PHP_RINIT_FUNCTION(jelix) 
    114110{ 
    115        return SUCCESS; 
     111    return SUCCESS; 
    116112} 
    117113/* }}} */ 
     
    134130        php_info_print_table_end(); 
    135131 
    136         /* Remove comments if you have entries in php.ini 
    137132        DISPLAY_INI_ENTRIES(); 
    138         */ 
    139133} 
    140134/* }}} */ 
     
    146140{ 
    147141        if(ZEND_NUM_ARGS() != 0)  ZEND_WRONG_PARAM_COUNT() 
    148  
     142     
    149143        RETURN_STRINGL(JELIX_VERSION, sizeof(JELIX_VERSION)-1, 1); 
    150144} 
     
    327321            if(type < 1 || type > 4){ 
    328322                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Third argument doesn't correspond to one of JELIX_SEL_* constant"); 
    329                 RETURN_FALSE 
     323                RETURN_FALSE; 
    330324            } 
    331325            break;*/ 
     
    337331    if(Z_TYPE_P(*objectArg) != IS_OBJECT){ 
    338332                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid second argument, not an object"); 
    339         RETURN_FALSE 
     333        RETURN_FALSE; 
    340334        } 
    341335 
     
    362356            || ( *cursor >= '0' && *cursor <= '9') 
    363357            || *cursor == '_' || *cursor == '.')){ 
    364             RETURN_FALSE 
     358            RETURN_FALSE; 
    365359        } 
    366360        module_length ++; 
     
    378372        // to keep compatibily with php version of selectors. 
    379373        if(module_length == 0){ 
    380             RETURN_FALSE 
     374            RETURN_FALSE; 
    381375        } 
    382376 
     
    390384                || ( *cursor >= '0' && *cursor <= '9') 
    391385                || *cursor == '_' || *cursor == '.')){ 
    392                 RETURN_FALSE 
     386                RETURN_FALSE; 
    393387            } 
    394388            resource_length ++; 
     
    399393 
    400394    if( resource_length == 0 ){ 
    401         RETURN_FALSE 
     395        RETURN_FALSE; 
    402396    } 
    403397 
    404398    zend_update_property_stringl(Z_OBJCE_P(*objectArg), *objectArg, "module", sizeof("module") - 1,     module, module_length TSRMLS_CC); 
    405399    zend_update_property_stringl(Z_OBJCE_P(*objectArg), *objectArg, "resource", sizeof("resource") - 1, resource, resource_length TSRMLS_CC); 
    406         RETURN_TRUE 
     400        RETURN_TRUE; 
    407401} 
    408402/* }}} */ 
     
    430424    if(Z_TYPE_P(*objectArg) != IS_OBJECT){ 
    431425                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid second argument, not an object"); 
    432         RETURN_FALSE 
     426        RETURN_FALSE; 
    433427        } 
    434428    if(Z_TYPE_P(*defaultActionArg) != IS_STRING){ 
    435429                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid third argument, not a string"); 
    436         RETURN_FALSE 
     430        RETURN_FALSE; 
    437431        } 
    438432 
     
    462456        if(*cursor == '#'){ 
    463457            if(sharpOk || module_length > 1){ 
    464                 RETURN_FALSE 
     458                RETURN_FALSE; 
    465459            } 
    466460            sharpOk=1; 
     
    471465                || ( *cursor >= '0' && *cursor <= '9') 
    472466                || *cursor == '_' ) || sharpOk){ 
    473                 RETURN_FALSE 
     467                RETURN_FALSE; 
    474468        } 
    475469        if(*cursor == '_' && firstDashPos == -1){ 
     
    484478    if(cursor_count >= length){ 
    485479        // we don't find any '~' characters, so we have parsed the resource 
    486         if(hasDot) RETURN_FALSE 
     480        if(hasDot) RETURN_FALSE; 
    487481 
    488482        resource_length = module_length; 
     
    490484    }else if( *cursor == '@'){ 
    491485        // we don't find any '~' characters, so we have parsed the resource 
    492         if(hasDot) RETURN_FALSE 
     486        if(hasDot) RETURN_FALSE; 
    493487 
    494488        resource_length = module_length; 
     
    506500                || ( *cursor >= '0' && *cursor <= '9') 
    507501                || *cursor == '_' || *cursor == '.')){ 
    508                 RETURN_FALSE 
     502                RETURN_FALSE; 
    509503            } 
    510504            request_length ++; 
     
    516510        // to keep compatibily with php version of selectors. 
    517511        if(module_length == 0){ 
    518             RETURN_FALSE 
     512            RETURN_FALSE; 
    519513        } 
    520514        firstDashPos=-1; 
     
    531525            if(*cursor == '#'){ 
    532526                if(sharpOk || resource_length > 1){ 
    533                     RETURN_FALSE 
     527                    RETURN_FALSE; 
    534528                } 
    535529                sharpOk=1; 
     
    538532                    || ( *cursor >= '0' && *cursor <= '9') 
    539533                    || *cursor == '_') || sharpOk){ 
    540                     RETURN_FALSE 
     534                    RETURN_FALSE; 
    541535            } 
    542536            if(*cursor == '_' && firstDashPos == -1){ 
     
    560554                    || ( *cursor >= '0' && *cursor <= '9') 
    561555                    || *cursor == '_' || *cursor == '.')){ 
    562                     RETURN_FALSE 
     556                    RETURN_FALSE; 
    563557                } 
    564558                request_length ++; 
     
    571565    // request shouldn't empty if there is a @ 
    572566    if(hasRequest && request_length == 0){ 
    573         RETURN_FALSE 
     567        RETURN_FALSE; 
    574568    } 
    575569 
     
    665659    zend_update_property_stringl(Z_OBJCE_P(*objectArg), *objectArg, "module", sizeof("module") - 1,     module, module_length TSRMLS_CC); 
    666660    zend_update_property_stringl(Z_OBJCE_P(*objectArg), *objectArg, "request", sizeof("request") - 1,   request, request_length TSRMLS_CC); 
    667         RETURN_TRUE 
     661        RETURN_TRUE; 
    668662} 
    669663/* }}} */ 
     
    691685    if(Z_TYPE_P(*objectArg) != IS_OBJECT){ 
    692686                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid second argument, not an object"); 
    693         RETURN_FALSE 
     687        RETURN_FALSE; 
    694688        } 
    695689    if(Z_TYPE_P(*defaultActionArg) != IS_STRING){ 
    696690                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid third argument, not a string"); 
    697         RETURN_FALSE 
     691        RETURN_FALSE; 
    698692        } 
    699693 
     
    723717        if(*cursor == '#'){ 
    724718            if(sharpOk || module_length > 1){ 
    725                 RETURN_FALSE 
     719                RETURN_FALSE; 
    726720            } 
    727721            sharpOk=1; 
     
    732726                || ( *cursor >= '0' && *cursor <= '9') 
    733727                || *cursor == '_' || *cursor == ':' ) || sharpOk){ 
    734                 RETURN_FALSE 
     728                RETURN_FALSE; 
    735729        } 
    736730        if(*cursor == ':' && firstDashPos == -1){ 
     
    745739    if(cursor_count >= length){ 
    746740        // we don't find any '~' characters, so we have parsed the resource 
    747         if(hasDot) RETURN_FALSE 
     741        if(hasDot) RETURN_FALSE; 
    748742 
    749743        resource_length = module_length; 
     
    751745    }else if( *cursor == '@'){ 
    752746        // we don't find any '~' characters, so we have parsed the resource 
    753         if(hasDot) RETURN_FALSE 
     747        if(hasDot) RETURN_FALSE; 
    754748 
    755749        resource_length = module_length; 
     
    767761                || ( *cursor >= '0' && *cursor <= '9') 
    768762                || *cursor == '_' || *cursor == ':' || *cursor == '.')){ 
    769                 RETURN_FALSE 
     763                RETURN_FALSE; 
    770764            } 
    771765            request_length ++; 
     
    777771        // to keep compatibily with php version of selectors. 
    778772        if(module_length == 0){ 
    779             RETURN_FALSE 
     773            RETURN_FALSE; 
    780774        } 
    781775        firstDashPos=-1; 
     
    792786            if(*cursor == '#'){ 
    793787                if(sharpOk || resource_length > 1){ 
    794                     RETURN_FALSE 
     788                    RETURN_FALSE; 
    795789                } 
    796790                sharpOk=1; 
     
    799793                    || ( *cursor >= '0' && *cursor <= '9') 
    800794                    || *cursor == '_' || *cursor == ':') || sharpOk){ 
    801                     RETURN_FALSE 
     795                    RETURN_FALSE; 
    802796            } 
    803797            if(*cursor == ':' && firstDashPos == -1){ 
     
    821815                    || ( *cursor >= '0' && *cursor <= '9') 
    822816                    || *cursor == '_' || *cursor == '.')){ 
    823                     RETURN_FALSE 
     817                    RETURN_FALSE; 
    824818                } 
    825819                request_length ++; 
     
    832826    // request shouldn't empty if there is a @ 
    833827    if(hasRequest && request_length == 0){ 
    834         RETURN_FALSE 
     828        RETURN_FALSE; 
    835829    } 
    836830 
     
    909903    zend_update_property_stringl(Z_OBJCE_P(*objectArg), *objectArg, "module", sizeof("module") - 1,     module, module_length TSRMLS_CC); 
    910904    zend_update_property_stringl(Z_OBJCE_P(*objectArg), *objectArg, "request", sizeof("request") - 1,   request, request_length TSRMLS_CC); 
    911         RETURN_TRUE 
     905        RETURN_TRUE; 
    912906} 
    913907/* }}} */ 
     
    934928    if(Z_TYPE_P(*objectArg) != IS_OBJECT){ 
    935929                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid second argument, not an object"); 
    936         RETURN_FALSE 
     930        RETURN_FALSE; 
    937931        } 
    938932 
     
    968962            || ( *cursor >= '0' && *cursor <= '9') 
    969963            || *cursor == '_' || *cursor == '.')) { 
    970             RETURN_FALSE 
     964            RETURN_FALSE; 
    971965        } 
    972966        module_length ++; 
     
    984978        // to keep compatibility with php version of selectors. 
    985979        if(module_length == 0 || subpath_length != 0){ 
    986             RETURN_FALSE 
     980            RETURN_FALSE; 
    987981        } 
    988982 
     
    999993                || ( *cursor >= '0' && *cursor <= '9') 
    1000994                || *cursor == '_' || *cursor == '.')){ 
    1001                 RETURN_FALSE 
     995                RETURN_FALSE; 
    1002996            } 
    1003997            resource_length ++; 
     
    10091003 
    10101004    if( resource_length == 0 ){ 
    1011         RETURN_FALSE 
     1005        RETURN_FALSE; 
    10121006    } 
    10131007 
     
    10181012    else if (subpath_length == 1) { 
    10191013        if (resource_length == 1) { 
    1020             RETURN_FALSE 
     1014            RETURN_FALSE; 
    10211015        } 
    10221016        zend_update_property_stringl(Z_OBJCE_P(*objectArg), *objectArg, "className", sizeof("className") - 1,   classname, resource_length-1 TSRMLS_CC); 
     
    10251019    else { 
    10261020        if (resource_length == subpath_length) { 
    1027             RETURN_FALSE 
     1021            RETURN_FALSE; 
    10281022        } 
    10291023        zend_update_property_stringl(Z_OBJCE_P(*objectArg), *objectArg, "className", sizeof("className") - 1,   classname, resource_length - subpath_length TSRMLS_CC); 
     
    10341028    zend_update_property_stringl(Z_OBJCE_P(*objectArg), *objectArg, "resource", sizeof("resource") - 1, resource, resource_length TSRMLS_CC); 
    10351029 
    1036         RETURN_TRUE 
     1030        RETURN_TRUE; 
    10371031} 
    10381032 
     
    10571051    if(Z_TYPE_P(*objectArg) != IS_OBJECT){ 
    10581052                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid second argument, not an object"); 
    1059         RETURN_FALSE 
     1053        RETURN_FALSE; 
    10601054        } 
    10611055 
     
    10921086            || ( *cursor >= '0' && *cursor <= '9') 
    10931087            || *cursor == '_' || *cursor == '.')) { 
    1094             RETURN_FALSE 
     1088            RETURN_FALSE; 
    10951089        } 
    10961090        module_length ++; 
     
    11071101        // to keep compatibility with php version of selectors. 
    11081102        if(module_length == 0){ 
    1109             RETURN_FALSE 
     1103            RETURN_FALSE; 
    11101104        } 
    11111105        hasPoint = 0; 
     
    11241118                || ( *cursor >= '0' && *cursor <= '9') 
    11251119                || *cursor == '_' || *cursor == '.')){ 
    1126                 RETURN_FALSE 
     1120                RETURN_FALSE; 
    11271121            } 
    11281122            resource_length ++; 
     
    11341128    if (resource_length == 0 || filekey_length == 0 || filekey_length == 1  
    11351129        || filekey_length == resource_length || filekey_length == resource_length -1) { 
    1136         RETURN_FALSE 
     1130        RETURN_FALSE; 
    11371131    } 
    11381132 
     
    11431137    zend_update_property_stringl(Z_OBJCE_P(*objectArg), *objectArg, "resource", sizeof("resource") - 1, filekey, filekey_length TSRMLS_CC); 
    11441138 
    1145         RETURN_TRUE 
    1146 } 
    1147 /* }}} */ 
     1139        RETURN_TRUE; 
     1140} 
     1141/* }}} */ 
  • trunk/ext/jelix/php_jelix.h

    r691 r1072  
    22*  Jelix 
    33*  a php extension for Jelix Framework 
    4 * @copyright Copyright (c) 2006-2007 Laurent Jouanneau 
     4* @copyright Copyright (c) 2006-2008 Laurent Jouanneau 
    55* @author : Laurent Jouanneau 
    66* @link http://jelix.org 
     
    4242ZEND_BEGIN_MODULE_GLOBALS(jelix) 
    4343    zval * active_ini_file_section; 
     44    int activated; 
    4445ZEND_END_MODULE_GLOBALS(jelix) 
    4546 
Download in other formats: Unified Diff Zip Archive