diff options
author | Holger Zimmermann <holger@php.net> | 2001-07-20 21:00:17 +0000 |
---|---|---|
committer | Holger Zimmermann <holger@php.net> | 2001-07-20 21:00:17 +0000 |
commit | a088c2e19df11126e40102bbabb790107995cd42 (patch) | |
tree | ea77c72fc56ac0fbdba36988d38ca953670e1e6e /sapi/pi3web | |
parent | b79aa095f56987622919ee09c9062feab7469bc3 (diff) | |
download | php-git-a088c2e19df11126e40102bbabb790107995cd42.tar.gz |
Updated PHP mode, fixed indent mode, added syntax check mode
Diffstat (limited to 'sapi/pi3web')
-rw-r--r-- | sapi/pi3web/pi3web_sapi.c | 45 | ||||
-rw-r--r-- | sapi/pi3web/pi3web_sapi.h | 13 |
2 files changed, 39 insertions, 19 deletions
diff --git a/sapi/pi3web/pi3web_sapi.c b/sapi/pi3web/pi3web_sapi.c index 9a1d9234d5..012dd38eac 100644 --- a/sapi/pi3web/pi3web_sapi.c +++ b/sapi/pi3web/pi3web_sapi.c @@ -31,6 +31,7 @@ #include "ext/standard/info.h" #include "zend_highlight.h" #include "zend_indent.h" +#include "zend_alloc.h" #include "ext/standard/basic_functions.h" #include "TSRM/TSRM.h" #include "PiAPI.h" @@ -276,7 +277,6 @@ static char *sapi_pi3web_read_cookies(SLS_D) return NULL; } - static sapi_module_struct pi3web_sapi_module = { "pi3web", /* name */ "PI3WEB", /* pretty name */ @@ -303,7 +303,6 @@ static sapi_module_struct pi3web_sapi_module = { STANDARD_SAPI_MODULE_PROPERTIES }; - static void init_request_info(sapi_globals_struct *sapi_globals, LPCONTROL_BLOCK lpCB) { char *path_end = strrchr(lpCB->lpszFileName, PHP_DIR_SEPARATOR); @@ -376,6 +375,8 @@ static void hash_pi3web_variables(ELS_D SLS_DC) DWORD PHP4_wrapper(LPCONTROL_BLOCK lpCB) { zend_file_handle file_handle; + char *header_line; + int iRet = PIAPI_COMPLETED; SLS_FETCH(); CLS_FETCH(); ELS_FETCH(); @@ -396,31 +397,49 @@ DWORD PHP4_wrapper(LPCONTROL_BLOCK lpCB) switch ( lpCB->dwBehavior ) { case PHP_MODE_STANDARD: - php_execute_script( &file_handle CLS_CC ELS_CC PLS_CC ); + iRet = ( php_execute_script( &file_handle CLS_CC ELS_CC PLS_CC ) == SUCCESS ) ? + PIAPI_COMPLETED : PIAPI_ERROR; break; case PHP_MODE_HIGHLIGHT: { - zend_syntax_highlighter_ini syntax_highlighter_ini; - if ( open_file_for_scanning( &file_handle CLS_CC ) == SUCCESS ) { - php_get_highlight_struct( &syntax_highlighter_ini ); - zend_highlight( &syntax_highlighter_ini ); - /* fclose( file_handle.handle.fp ); */ + zend_syntax_highlighter_ini syntax_highlighter_ini; + if ( open_file_for_scanning( &file_handle CLS_CC ) == SUCCESS ) + { + php_get_highlight_struct( &syntax_highlighter_ini ); + zend_highlight( &syntax_highlighter_ini ); + } + else + { + iRet = PIAPI_ERROR; }; }; break; case PHP_MODE_INDENT: - if ( open_file_for_scanning( &file_handle CLS_CC ) == SUCCESS ) { + header_line = (char *)estrdup("Content-Type: text/plain"); + sapi_add_header_ex(header_line, strlen(header_line), TRUE, TRUE); + if ( open_file_for_scanning( &file_handle CLS_CC ) == SUCCESS ) + { zend_indent(); - }; - /* fclose( file_handle.handle.fp ); */ + } + else + { + iRet = PIAPI_ERROR; + }; break; - } + case PHP_MODE_LINT: + iRet = (php_lint_script(&file_handle CLS_CC ELS_CC PLS_CC) == SUCCESS) ? + PIAPI_COMPLETED : PIAPI_ERROR; + break; + default: + iRet = PIAPI_ERROR;; + } if (SG(request_info).cookie_data) { efree(SG(request_info).cookie_data); }; + efree(header_line); php_request_shutdown(NULL); - return PIAPI_COMPLETED; + return iRet; } BOOL PHP4_startup() { diff --git a/sapi/pi3web/pi3web_sapi.h b/sapi/pi3web/pi3web_sapi.h index 8ca4392db0..e37271bc5f 100644 --- a/sapi/pi3web/pi3web_sapi.h +++ b/sapi/pi3web/pi3web_sapi.h @@ -28,9 +28,10 @@ extern "C" { #endif -#define PHP_MODE_STANDARD 0 -#define PHP_MODE_HIGHLIGHT 1 -#define PHP_MODE_INDENT 2 +#define PHP_MODE_STANDARD 1 +#define PHP_MODE_HIGHLIGHT 2 +#define PHP_MODE_INDENT 3 +#define PHP_MODE_LINT 4 // // passed to the procedure on a new request @@ -79,9 +80,9 @@ typedef struct _CONTROL_BLOCK { } CONTROL_BLOCK, *LPCONTROL_BLOCK; -MODULE_API DWORD PHP4_wrapper(LPCONTROL_BLOCK lpCB); -MODULE_API BOOL PHP4_startup(); -MODULE_API BOOL PHP4_shutdown(); +DWORD PHP4_wrapper(LPCONTROL_BLOCK lpCB); +BOOL PHP4_startup(); +BOOL PHP4_shutdown(); // the following type declaration is for the server side typedef DWORD ( * PFN_WRAPPERFUNC )( CONTROL_BLOCK *pCB ); |