Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:5079 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 98075 invoked by uid 1010); 29 Oct 2003 19:00:19 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 98042 invoked from network); 29 Oct 2003 19:00:19 -0000 Received: from unknown (HELO mail-1.nethere.net) (66.63.128.70) by pb1.pair.com with SMTP; 29 Oct 2003 19:00:19 -0000 Received: (qmail 51739 invoked from network); 29 Oct 2003 19:00:16 -0000 Received: from ppp-66-63-134-187.sndg-pm4-2.dialup.nethere.net (localhost.localdomain [66.63.134.187]) by mail-1.nethere.net with SMTP; 29 Oct 2003 19:00:16 -0000 (envelope-sender ) Organization: The Coeus Group To: internals@lists.php.net Date: Wed, 29 Oct 2003 08:50:27 -0800 User-Agent: KMail/1.4.3 X-I-See: Faces X-Presso: Yes X-DeCSS-Usage: cat title-key scrambled.vob | decss > clear.vob X-DeCSS-Line-1: #define m(i)(x[i]^s[i+84])<< X-DeCSS-Line-2: unsigned char x[5],y,s[2048];main(n){for(read(0,x,5);read(0,s,n=2048);write(1,s,n))if(s[y=s[13]%8+20]/16%4==1){int i=m(1)17^256+m(0)8,k=m(2)0,j=m(4)17^m(3)9^k*2-k%8^8,a=0,c=26;for(s[y]-=16;--c;j*=2)a=a*2^i&1,i=i/2^j&1<<24;for(j=127;++jy)c+=y=i^i/8^i>>4^i>>12,i=i>>8^y<<17,a^=a>>14,y=a^a*8^a<<6,a=a>>8^y<<9,k=s[j],k="7Wo~'G_\216"[k&7]+2^"cr3sfw6v;*k+>/n."[k>>4]*2^k*257/8,s[j]=k^(k&k*2&34)*6^c+~y;}} MIME-Version: 1.0 Message-ID: <200310290840.17284.evan@coeus-group.com> Content-Type: Multipart/Mixed; boundary="------------Boundary-00=_3S2JL0N3W45NOF3OGNUU" Subject: [PATCH] Prepend and append strings for zend_highlight From: evan@coeus-group.com (Evan Nemerson) --------------Boundary-00=_3S2JL0N3W45NOF3OGNUU Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8bit After a little discussion on php-general[1], I wrote a patch that basically allows two new php.ini entries: highlight.prepend and highlight.append. They default to what the output currently is ('' and '') The code effects four files; ext/standard/basic_functions.c, main/main.c, Zend/zend_highlight.c, and Zend/zend_highlight.h I didn't account for Lisa Seelye's patch, but if there's interest in both patches I'd be happy to make the changes to mine. Have a nice day. [1]: http://marc.theaimsgroup.com/?l=php-general&m=106737816224797&w=2 -- Evan Nemerson evan@coeus-group.com -- "A people who mean to be their own governors, must arm themselves with the power knowledge gives." -James Madison --------------Boundary-00=_3S2JL0N3W45NOF3OGNUU Content-Type: text/x-diff; charset="us-ascii"; name="php_highlight.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="php_highlight.diff" Index: main/main.c =================================================================== RCS file: /repository/php-src/main/main.c,v retrieving revision 1.579 diff -u -r1.579 main.c --- main/main.c 9 Oct 2003 02:58:34 -0000 1.579 +++ main/main.c 29 Oct 2003 17:59:24 -0000 @@ -248,6 +248,8 @@ PHP_INI_ENTRY_EX("highlight.html", HL_HTML_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb) PHP_INI_ENTRY_EX("highlight.keyword", HL_KEYWORD_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb) PHP_INI_ENTRY_EX("highlight.string", HL_STRING_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb) + PHP_INI_ENTRY_EX("highlight.prepend", HL_PREPEND_STRING, PHP_INI_ALL, NULL, php_ini_color_displayer_cb) + PHP_INI_ENTRY_EX("highlight.append", HL_APPEND_STRING, PHP_INI_ALL, NULL, php_ini_color_displayer_cb) STD_PHP_INI_BOOLEAN("allow_call_time_pass_reference", "1", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, allow_call_time_pass_reference, zend_compiler_globals, compiler_globals) STD_PHP_INI_BOOLEAN("asp_tags", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, asp_tags, zend_compiler_globals, compiler_globals) Index: Zend/zend_highlight.c =================================================================== RCS file: /repository/ZendEngine2/zend_highlight.c,v retrieving revision 1.39 diff -u -r1.39 zend_highlight.c --- Zend/zend_highlight.c 11 Aug 2003 05:24:41 -0000 1.39 +++ Zend/zend_highlight.c 29 Oct 2003 17:59:25 -0000 @@ -104,8 +104,7 @@ char *next_color; int in_string=0; - zend_printf(""); - zend_printf("\n", last_color); + zend_printf("%s\n", syntax_highlighter_ini->highlight_prepend); /* highlight stuff coming back from zendlex() */ token.type = 0; while ((token_type=lex_scan(&token TSRMLS_CC))) { @@ -194,8 +193,7 @@ if (last_color != syntax_highlighter_ini->highlight_html) { zend_printf("\n"); } - zend_printf("\n"); - zend_printf(""); + zend_printf("%s\n", syntax_highlighter_ini->highlight_append); } Index: Zend/zend_highlight.h =================================================================== RCS file: /repository/ZendEngine2/zend_highlight.h,v retrieving revision 1.23 diff -u -r1.23 zend_highlight.h --- Zend/zend_highlight.h 10 Jun 2003 20:03:25 -0000 1.23 +++ Zend/zend_highlight.h 29 Oct 2003 17:59:25 -0000 @@ -28,6 +28,8 @@ #define HL_STRING_COLOR "#DD0000" /* red */ #define HL_BG_COLOR "#FFFFFF" /* white */ #define HL_KEYWORD_COLOR "#007700" /* green */ +#define HL_PREPEND_STRING "" +#define HL_APPEND_STRING "" typedef struct _zend_syntax_highlighter_ini { @@ -36,6 +38,8 @@ char *highlight_default; char *highlight_string; char *highlight_keyword; + char *highlight_prepend; + char *highlight_append; } zend_syntax_highlighter_ini; Index: ext/standard/basic_functions.c =================================================================== RCS file: /repository/php-src/ext/standard/basic_functions.c,v retrieving revision 1.636 diff -u -r1.636 basic_functions.c --- ext/standard/basic_functions.c 28 Oct 2003 04:02:11 -0000 1.636 +++ ext/standard/basic_functions.c 29 Oct 2003 17:59:32 -0000 @@ -2229,6 +2229,8 @@ syntax_highlighter_ini->highlight_html = INI_STR("highlight.html"); syntax_highlighter_ini->highlight_keyword = INI_STR("highlight.keyword"); syntax_highlighter_ini->highlight_string = INI_STR("highlight.string"); + syntax_highlighter_ini->highlight_prepend = INI_STR("highlight.prepend"); + syntax_highlighter_ini->highlight_append = INI_STR("highlight.append"); } /* {{{ proto bool highlight_file(string file_name [, bool return] ) --------------Boundary-00=_3S2JL0N3W45NOF3OGNUU--