Browse Source

-Tiny patches

migration/INITIAL
Andi Gutmans 27 years ago
parent
commit
39f9487ee1
  1. 2
      Zend/config.w32.h
  2. 3
      Zend/libzend.dsp
  3. 19
      Zend/zend-scanner.l
  4. 45
      Zend/zend_API.c
  5. 5
      Zend/zend_API.h
  6. 2
      Zend/zend_compile.c
  7. 9
      Zend/zend_compile.h
  8. 5
      Zend/zend_opcode.c

2
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

3
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

19
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;
}

45
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 */

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

2
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

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

5
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:

Loading…
Cancel
Save