From 39f9487ee1ee4132e12eaafa0ed2a63e12612420 Mon Sep 17 00:00:00 2001 From: Andi Gutmans Date: Wed, 14 Apr 1999 19:53:33 +0000 Subject: [PATCH] -Tiny patches --- Zend/config.w32.h | 2 +- Zend/libzend.dsp | 3 ++- Zend/zend-scanner.l | 19 ++++++++++++++----- Zend/zend_API.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ Zend/zend_API.h | 5 +++++ Zend/zend_compile.c | 2 +- Zend/zend_compile.h | 9 +++++---- Zend/zend_opcode.c | 5 +++-- 8 files changed, 76 insertions(+), 14 deletions(-) diff --git a/Zend/config.w32.h b/Zend/config.w32.h index dac03e3b46..1a416de974 100644 --- a/Zend/config.w32.h +++ b/Zend/config.w32.h @@ -17,7 +17,7 @@ typedef unsigned int uint; #undef inline #endif -#define ZEND_DEBUG 1 +#define ZEND_DEBUG 0 #define zend_sprintf sprintf diff --git a/Zend/libzend.dsp b/Zend/libzend.dsp index 9dfde8e151..dca4dcd67c 100644 --- a/Zend/libzend.dsp +++ b/Zend/libzend.dsp @@ -41,7 +41,8 @@ RSC=rc.exe # PROP Intermediate_Dir "Release" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "COMPILE_LIBZEND" /FR /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "COMPILE_LIBZEND" /FR /FD /c +# SUBTRACT CPP /YX # ADD BASE RSC /l 0x40d /d "NDEBUG" # ADD RSC /l 0x40d /d "NDEBUG" BSC32=bscmake.exe diff --git a/Zend/zend-scanner.l b/Zend/zend-scanner.l index 173e06b7ef..f6132dee76 100644 --- a/Zend/zend-scanner.l +++ b/Zend/zend-scanner.l @@ -170,18 +170,28 @@ inline int open_file_for_scanning(zend_file_handle *file_handle CLS_DC) } -zend_op_array *compile_files(int mark_as_ref CLS_DC, int file_count, ...) + +ZEND_API zend_op_array *compile_files(int mark_as_ref ELS_DC, int file_count, ...) +{ + va_list files; + zend_op_array *op_array; + + va_start(files, file_count); + op_array = v_compile_files(mark_as_ref ELS_CC, file_count, files); + va_end(files); + return op_array; +} + + +ZEND_API zend_op_array *v_compile_files(int mark_as_ref ELS_DC, int file_count, va_list files) { zend_lex_state original_lex_state; zend_op_array *op_array = (zend_op_array *) emalloc(sizeof(zend_op_array)); zend_op_array *original_active_op_array = CG(active_op_array); zend_op_array *retval=NULL; zend_file_handle *file_handle; - va_list files; int i; - va_start(files, file_count); - init_op_array(op_array, INITIAL_OP_ARRAY_SIZE); save_lexical_state(&original_lex_state CLS_CC); @@ -215,7 +225,6 @@ zend_op_array *compile_files(int mark_as_ref CLS_DC, int file_count, ...) pass_include_eval(op_array); } } - va_end(files); return retval; } diff --git a/Zend/zend_API.c b/Zend/zend_API.c index caf097b01b..67cfd78546 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -103,6 +103,51 @@ int getParametersArray(int ht, int param_count, zval **argument_array) } + + +/* Zend-optimized Extended functions */ +/* this function doesn't check for too many parameters */ +int getParametersEx(int param_count,...) +{ + void **p = EG(argument_stack).top_element-1; + int arg_count = (ulong) *p; + va_list ptr; + zval ***param; + ELS_FETCH(); + + if (param_count>arg_count) { + return FAILURE; + } + + va_start(ptr, param_count); + while (param_count>0) { + param = va_arg(ptr, zval ***); + *param = (zval **) p-(param_count--); + } + va_end(ptr); + + return SUCCESS; +} + + +int getParametersArrayEx(int param_count, zval ***argument_array) +{ + void **p = EG(argument_stack).top_element-1; + int arg_count = (ulong) *p; + ELS_FETCH(); + + if (param_count>arg_count) { + return FAILURE; + } + + while (param_count>0) { + *(argument_array++) = (zval **) p-(param_count--); + } + + return SUCCESS; +} + + int getThis(zval **this) { /* NEEDS TO BE IMPLEMENTED FOR ZEND */ diff --git a/Zend/zend_API.h b/Zend/zend_API.h index b2d6a4c81e..0399748cb3 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -25,7 +25,12 @@ int zend_next_free_module(void); int getParameters(int ht, int param_count,...); int getParametersArray(int ht, int param_count, zval **argument_array); +int getParametersEx(int param_count,...); +int getParametersArrayEx(int param_count, zval ***argument_array); + int getThis(zval **this); + + int ParameterPassedByReference(int ht, uint n); int register_functions(function_entry *functions); void unregister_functions(function_entry *functions, int count); diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index d1e4a92088..c7c6d842de 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -22,7 +22,7 @@ #include "zend_operators.h" -zend_op_array *(*zend_compile_files)(int mark_as_ref CLS_DC, int file_count, ...); +ZEND_API zend_op_array *(*zend_compile_files)(int mark_as_ref CLS_DC, int file_count, ...); #ifndef ZTS diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index ff66074cd5..1477d95e50 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -150,7 +150,7 @@ typedef struct { } list_llist_element; -typedef struct { +typedef struct _zend_file_handle { int type; char *filename; union { @@ -176,7 +176,7 @@ typedef struct { void init_compiler(CLS_D ELS_DC); void shutdown_compiler(CLS_D); -extern zend_op_array *(*zend_compile_files)(int mark_as_ref CLS_DC, int file_count, ...); +extern ZEND_API zend_op_array *(*zend_compile_files)(int mark_as_ref CLS_DC, int file_count, ...); int lex_scan(zval *zendlval CLS_DC); void reset_scanner(CLS_D); @@ -315,6 +315,7 @@ void do_extended_fcall_end(CLS_D); ZEND_API int require_file(zend_file_handle *file_handle CLS_DC); ZEND_API int require_filename(char *filename CLS_DC); ZEND_API zend_op_array *compile_files(int mark_as_ref CLS_DC, int file_count, ...); +ZEND_API zend_op_array *v_compile_files(int mark_as_ref ELS_DC, int file_count, va_list files); ZEND_API zend_op_array *compile_string(zval *source_string CLS_DC); ZEND_API zend_op_array *compile_filename(zval *filename CLS_DC); inline int open_file_for_scanning(zend_file_handle *file_handle CLS_DC); @@ -325,8 +326,8 @@ inline int open_file_for_scanning(zend_file_handle *file_handle CLS_DC); ZEND_API void init_op_array(zend_op_array *op_array, int initial_ops_size); ZEND_API void destroy_op_array(zend_op_array *op_array); -void destroy_zend_function(zend_function *function); -void destroy_zend_class(zend_class_entry *ce); +ZEND_API void destroy_zend_function(zend_function *function); +ZEND_API void destroy_zend_class(zend_class_entry *ce); zend_op *get_next_op(zend_op_array *op_array CLS_DC); int get_next_op_number(zend_op_array *op_array); int print_class(zend_class_entry *class_entry); diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 551f7366a0..a6d9e8aca0 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -96,7 +96,7 @@ void init_op_array(zend_op_array *op_array, int initial_ops_size) } -void destroy_zend_function(zend_function *function) +ZEND_API void destroy_zend_function(zend_function *function) { switch (function->type) { case ZEND_USER_FUNCTION: @@ -108,7 +108,8 @@ void destroy_zend_function(zend_function *function) } } -void destroy_zend_class(zend_class_entry *ce) + +ZEND_API void destroy_zend_class(zend_class_entry *ce) { switch (ce->type) { case ZEND_USER_CLASS: -- 2.40.0