1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 16:22:37 +01:00

Updated PHP mode, fixed indent mode, added syntax check mode

This commit is contained in:
Holger Zimmermann
2001-07-20 21:00:17 +00:00
parent b79aa095f5
commit a088c2e19d
2 changed files with 39 additions and 19 deletions

View File

@@ -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() {

View File

@@ -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 );