Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:4070 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 55673 invoked from network); 18 Aug 2003 19:14:43 -0000 Received: from unknown (HELO moutng.kundenserver.de) (212.227.126.188) by pb1.pair.com with SMTP; 18 Aug 2003 19:14:43 -0000 Received: from [212.227.126.162] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 19opSi-0006If-00; Mon, 18 Aug 2003 21:14:40 +0200 Received: from [217.80.180.211] (helo=[217.80.180.211]) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 19opSi-0002Ly-00; Mon, 18 Aug 2003 21:14:40 +0200 To: Cristiano Duarte Cc: internals@lists.php.net In-Reply-To: <20030818185708.47629.qmail@pb1.pair.com> References: <20030818185708.47629.qmail@pb1.pair.com> Content-Type: text/plain Message-ID: <1061234012.253.16.camel@localhost> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.4 Date: Mon, 18 Aug 2003 21:13:33 +0200 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] userland macros From: thekid@thekid.de (Timm Friebe) On Mon, 2003-08-18 at 20:56, Cristiano Duarte wrote: > Is possible to implement userland macros in a PHP extension or it can > only be implemented in the core? A "userland" solution could be to use cc -E on your .php files. > I know that macros is a preprocessor task and I think PHP has no > preprocessor (does it?). It doesn't. > So it's possible to implement a preprocessor ? It's possible, of course, but PHP needs to compile fast as (without any accelerator products whatsoever) this is what happens on each request to a script. A preprocessor takes up more time and IMHO only makes sense in compiled languages (in the original sense of "compiled":)). > An example (or something like that): [...example...] thekid@friebes:~ > cat prep.phpc thekid@friebes:~ > cc -P -C -E -x c prep.phpc Notes on command line arguments passed to cc: -E execute preprocessor only -P do not generate # comments -x c Set language to "C". -C leave comments intact You might also want to do a grep -v '^$' to get rid of some of the whitespace leftovers by the preprocessor. - Timm