Back to index

php5  5.3.10
Classes | Typedefs | Functions
zend_language_scanner.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _zend_lex_state

Typedefs

typedef struct _zend_lex_state zend_lex_state

Functions

int zend_compare_file_handles (zend_file_handle *fh1, zend_file_handle *fh2)
ZEND_API void zend_save_lexical_state (zend_lex_state *lex_state TSRMLS_DC)
ZEND_API void zend_restore_lexical_state (zend_lex_state *lex_state TSRMLS_DC)
ZEND_API int zend_prepare_string_for_scanning (zval *str, char *filename TSRMLS_DC)

Class Documentation

struct _zend_lex_state

Definition at line 25 of file zend_language_scanner.h.

Collaboration diagram for _zend_lex_state:
Class Members
char * filename
zend_file_handle * in
uint lineno
zend_stack state_stack
unsigned char * yy_cursor
unsigned int yy_leng
unsigned char * yy_limit
unsigned char * yy_marker
unsigned char * yy_start
int yy_state
unsigned char * yy_text

Typedef Documentation


Function Documentation

Definition at line 337 of file zend_stream.c.

{
       if (fh1->type != fh2->type) {
              return 0;
       }
       switch (fh1->type) {
              case ZEND_HANDLE_FD:
                     return fh1->handle.fd == fh2->handle.fd;
              case ZEND_HANDLE_FP:
                     return fh1->handle.fp == fh2->handle.fp;
              case ZEND_HANDLE_STREAM:
                     return fh1->handle.stream.handle == fh2->handle.stream.handle;
              case ZEND_HANDLE_MAPPED:
                     return (fh1->handle.stream.handle == &fh1->handle.stream &&
                             fh2->handle.stream.handle == &fh2->handle.stream &&
                             fh1->handle.stream.mmap.old_handle == fh2->handle.stream.mmap.old_handle)
                            || fh1->handle.stream.handle == fh2->handle.stream.handle;
              default:
                     return 0;
       }
       return 0;
} /* }}} */

Here is the caller graph for this function:

ZEND_API int zend_prepare_string_for_scanning ( zval *  str,
char *filename  TSRMLS_DC 
)

Definition at line 431 of file zend_language_scanner.c.

{
       /* enforce two trailing NULLs for flex... */
       str->value.str.val = safe_erealloc(str->value.str.val, 1, str->value.str.len, ZEND_MMAP_AHEAD);

       memset(str->value.str.val + str->value.str.len, 0, ZEND_MMAP_AHEAD);

       SCNG(yy_in)=NULL;
       SCNG(yy_start) = NULL;

#ifdef ZEND_MULTIBYTE
       SCNG(script_org) = (unsigned char *)estrdup(str->value.str.val);
       SCNG(script_org_size) = str->value.str.len;

       zend_multibyte_set_filter(CG(internal_encoding) TSRMLS_CC);

       if (!SCNG(input_filter)) {
              SCNG(script_filtered) = (unsigned char*)emalloc(SCNG(script_org_size)+1);
              memcpy(SCNG(script_filtered), SCNG(script_org), SCNG(script_org_size)+1);
              SCNG(script_filtered_size) = SCNG(script_org_size);
       } else {
              SCNG(input_filter)(&SCNG(script_filtered), &SCNG(script_filtered_size), SCNG(script_org), SCNG(script_org_size) TSRMLS_CC);
       }

       yy_scan_buffer((char *)SCNG(script_filtered), SCNG(script_filtered_size) TSRMLS_CC);       
#else /* !ZEND_MULTIBYTE */
       yy_scan_buffer(str->value.str.val, str->value.str.len TSRMLS_CC);
#endif /* ZEND_MULTIBYTE */

       zend_set_compiled_filename(filename TSRMLS_CC);
       CG(zend_lineno) = 1;
       CG(increment_lineno) = 0;
       return SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

ZEND_API void zend_restore_lexical_state ( zend_lex_state *lex_state  TSRMLS_DC)

Definition at line 198 of file zend_language_scanner.c.

{
       SCNG(yy_leng)   = lex_state->yy_leng;
       SCNG(yy_start)  = lex_state->yy_start;
       SCNG(yy_text)   = lex_state->yy_text;
       SCNG(yy_cursor) = lex_state->yy_cursor;
       SCNG(yy_marker) = lex_state->yy_marker;
       SCNG(yy_limit)  = lex_state->yy_limit;

       zend_stack_destroy(&SCNG(state_stack));
       SCNG(state_stack) = lex_state->state_stack;

       SCNG(yy_in) = lex_state->in;
       YYSETCONDITION(lex_state->yy_state);
       CG(zend_lineno) = lex_state->lineno;
       zend_restore_compiled_filename(lex_state->filename TSRMLS_CC);
#ifdef ZEND_MULTIBYTE
       if (SCNG(script_org)) {
              efree(SCNG(script_org));
              SCNG(script_org) = NULL;
       }
       if (SCNG(script_filtered)) {
              efree(SCNG(script_filtered));
              SCNG(script_filtered) = NULL;
       }
       SCNG(script_org) = lex_state->script_org;
       SCNG(script_org_size) = lex_state->script_org_size;
       SCNG(script_filtered) = lex_state->script_filtered;
       SCNG(script_filtered_size) = lex_state->script_filtered_size;
       SCNG(input_filter) = lex_state->input_filter;
       SCNG(output_filter) = lex_state->output_filter;
       SCNG(script_encoding) = lex_state->script_encoding;
       SCNG(internal_encoding) = lex_state->internal_encoding;
#endif /* ZEND_MULTIBYTE */

       if (CG(heredoc)) {
              efree(CG(heredoc));
              CG(heredoc) = NULL;
              CG(heredoc_len) = 0;
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

ZEND_API void zend_save_lexical_state ( zend_lex_state *lex_state  TSRMLS_DC)

Definition at line 169 of file zend_language_scanner.c.

{
       lex_state->yy_leng   = SCNG(yy_leng);
       lex_state->yy_start  = SCNG(yy_start);
       lex_state->yy_text   = SCNG(yy_text);
       lex_state->yy_cursor = SCNG(yy_cursor);
       lex_state->yy_marker = SCNG(yy_marker);
       lex_state->yy_limit  = SCNG(yy_limit);

       lex_state->state_stack = SCNG(state_stack);
       zend_stack_init(&SCNG(state_stack));

       lex_state->in = SCNG(yy_in);
       lex_state->yy_state = YYSTATE;
       lex_state->filename = zend_get_compiled_filename(TSRMLS_C);
       lex_state->lineno = CG(zend_lineno);

#ifdef ZEND_MULTIBYTE
       lex_state->script_org = SCNG(script_org);
       lex_state->script_org_size = SCNG(script_org_size);
       lex_state->script_filtered = SCNG(script_filtered);
       lex_state->script_filtered_size = SCNG(script_filtered_size);
       lex_state->input_filter = SCNG(input_filter);
       lex_state->output_filter = SCNG(output_filter);
       lex_state->script_encoding = SCNG(script_encoding);
       lex_state->internal_encoding = SCNG(internal_encoding);
#endif /* ZEND_MULTIBYTE */
}

Here is the call graph for this function:

Here is the caller graph for this function: