Skip to content

Commit

Permalink
- Reverted r296062 and r296065
Browse files Browse the repository at this point in the history
  • Loading branch information
Jani Taskinen committed Mar 12, 2010
1 parent ea539c8 commit af49e58
Show file tree
Hide file tree
Showing 108 changed files with 3,344 additions and 4,038 deletions.
142 changes: 0 additions & 142 deletions README.NEW-OUTPUT-API

This file was deleted.

45 changes: 22 additions & 23 deletions Zend/zend_highlight.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "zend_ptr_stack.h"
#include "zend_globals.h"

ZEND_API void zend_html_putc(char c) /* {{{ */
ZEND_API void zend_html_putc(char c)
{
switch (c) {
case '\n':
Expand All @@ -52,9 +52,9 @@ ZEND_API void zend_html_putc(char c) /* {{{ */
break;
}
}
/* }}} */

ZEND_API void zend_html_puts(const char *s, uint len TSRMLS_DC) /* {{{ */

ZEND_API void zend_html_puts(const char *s, uint len TSRMLS_DC)
{
const char *ptr=s, *end=s+len;

Expand Down Expand Up @@ -85,9 +85,9 @@ ZEND_API void zend_html_puts(const char *s, uint len TSRMLS_DC) /* {{{ */
}
#endif /* ZEND_MULTIBYTE */
}
/* }}} */

ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini TSRMLS_DC) /* {{{ */

ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini TSRMLS_DC)
{
zval token;
int token_type;
Expand All @@ -97,7 +97,7 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
zend_printf("<code>");
zend_printf("<span style=\"color: %s\">\n", last_color);
/* highlight stuff coming back from zendlex() */
Z_TYPE(token) = 0;
token.type = 0;
while ((token_type=lex_scan(&token TSRMLS_CC))) {
switch (token_type) {
case T_INLINE_HTML:
Expand All @@ -121,11 +121,11 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
break;
case T_WHITESPACE:
zend_html_puts(LANG_SCNG(yy_text), LANG_SCNG(yy_leng) TSRMLS_CC); /* no color needed */
Z_TYPE(token) = 0;
token.type = 0;
continue;
break;
default:
if (Z_TYPE(token) == 0) {
if (token.type == 0) {
next_color = syntax_highlighter_ini->highlight_keyword;
} else {
next_color = syntax_highlighter_ini->highlight_default;
Expand All @@ -145,7 +145,7 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini

zend_html_puts(LANG_SCNG(yy_text), LANG_SCNG(yy_leng) TSRMLS_CC);

if (Z_TYPE(token) == IS_STRING) {
if (token.type == IS_STRING) {
switch (token_type) {
case T_OPEN_TAG:
case T_OPEN_TAG_WITH_ECHO:
Expand All @@ -155,13 +155,13 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
case T_DOC_COMMENT:
break;
default:
efree(Z_STRVAL(token));
efree(token.value.str.val);
break;
}
} else if (token_type == T_END_HEREDOC) {
efree(Z_STRVAL(token));
efree(token.value.str.val);
}
Z_TYPE(token) = 0;
token.type = 0;
}

if (last_color != syntax_highlighter_ini->highlight_html) {
Expand All @@ -170,15 +170,14 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
zend_printf("</span>\n");
zend_printf("</code>");
}
/* }}} */

ZEND_API void zend_strip(TSRMLS_D) /* {{{ */
ZEND_API void zend_strip(TSRMLS_D)
{
zval token;
int token_type;
int prev_space = 0;

Z_TYPE(token) = 0;
token.type = 0;
while ((token_type=lex_scan(&token TSRMLS_CC))) {
switch (token_type) {
case T_WHITESPACE:
Expand All @@ -189,27 +188,27 @@ ZEND_API void zend_strip(TSRMLS_D) /* {{{ */
/* lack of break; is intentional */
case T_COMMENT:
case T_DOC_COMMENT:
Z_TYPE(token) = 0;
token.type = 0;
continue;

case T_END_HEREDOC:
zend_write(LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
efree(Z_STRVAL(token));
efree(token.value.str.val);
/* read the following character, either newline or ; */
if (lex_scan(&token TSRMLS_CC) != T_WHITESPACE) {
zend_write(LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
}
zend_write("\n", sizeof("\n") - 1);
prev_space = 1;
Z_TYPE(token) = 0;
token.type = 0;
continue;

default:
zend_write(LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
break;
}

if (Z_TYPE(token) == IS_STRING) {
if (token.type == IS_STRING) {
switch (token_type) {
case T_OPEN_TAG:
case T_OPEN_TAG_WITH_ECHO:
Expand All @@ -220,14 +219,13 @@ ZEND_API void zend_strip(TSRMLS_D) /* {{{ */
break;

default:
efree(Z_STRVAL(token));
efree(token.value.str.val);
break;
}
}
prev_space = Z_TYPE(token) = 0;
prev_space = token.type = 0;
}
}
/* }}} */

/*
* Local variables:
Expand All @@ -236,3 +234,4 @@ ZEND_API void zend_strip(TSRMLS_D) /* {{{ */
* indent-tabs-mode: t
* End:
*/

28 changes: 14 additions & 14 deletions Zend/zend_indent.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@
#define zendtext LANG_SCNG(yy_text)
#define zendleng LANG_SCNG(yy_leng)

static void handle_whitespace(unsigned int *emit_whitespace) /* {{{ */

static void handle_whitespace(int *emit_whitespace)
{
unsigned char c;
unsigned int i;
int i;

for (c=0; c<128; c++) {
if (emit_whitespace[c]>0) {
Expand All @@ -44,29 +45,29 @@ static void handle_whitespace(unsigned int *emit_whitespace) /* {{{ */
}
memset(emit_whitespace, 0, sizeof(int)*256);
}
/* }}} */

ZEND_API void zend_indent(void) /* {{{ */

ZEND_API void zend_indent()
{
zval token;
int token_type;
int in_string=0;
unsigned int nest_level=0;
unsigned int emit_whitespace[256];
unsigned int i;
int nest_level=0;
int emit_whitespace[256];
int i;
TSRMLS_FETCH();

memset(emit_whitespace, 0, sizeof(int)*256);

/* highlight stuff coming back from zendlex() */
Z_TYPE(token) = 0;
token.type = 0;
while ((token_type=lex_scan(&token TSRMLS_CC))) {
switch (token_type) {
case T_INLINE_HTML:
zend_write(LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
break;
case T_WHITESPACE: {
Z_TYPE(token) = 0;
token.type = 0;
/* eat whitespace, emit newlines */
for (i=0; i<LANG_SCNG(yy_leng); i++) {
emit_whitespace[(unsigned char) LANG_SCNG(yy_text)[i]]++;
Expand All @@ -78,7 +79,7 @@ ZEND_API void zend_indent(void) /* {{{ */
in_string = !in_string;
/* break missing intentionally */
default:
if (Z_TYPE(token)==0) {
if (token.type==0) {
/* keyword */
switch (token_type) {
case ',':
Expand Down Expand Up @@ -131,21 +132,20 @@ ZEND_API void zend_indent(void) /* {{{ */
}
break;
}
if (Z_TYPE(token) == IS_STRING) {
if (token.type == IS_STRING) {
switch (token_type) {
case T_OPEN_TAG:
case T_CLOSE_TAG:
case T_WHITESPACE:
break;
default:
efree(Z_STRVAL(token));
efree(token.value.str.val);
break;
}
}
Z_TYPE(token) = 0;
token.type = 0;
}
}
/* }}} */

/*
* Local variables:
Expand Down
Loading

0 comments on commit af49e58

Please sign in to comment.