Edit report at http://bugs.php.net/bug.php?id=21155&edit=1

 ID:                 21155
 Updated by:         [email protected]
 Reported by:        james at grickle dot org
 Summary:            Macro Request
-Status:             Open
+Status:             Bogus
 Type:               Feature/Change Request
-Package:            Feature/Change Request
+Package:            *General Issues
 Operating System:   Slackware-current (12/22/02)
 PHP Version:        4.2.3
 Block user comment: N
 Private report:     N

 New Comment:

For errors you could use trigger_error89 plus an error handler. Having a
"pre processor" for the "PHP Hypertext Preprocessor" doesn't have many
benefits besides complexity.



Some people were experimenting with
http://pecl.php.net/package/PreProcessor or build systems (ant, phing,
...) doing such substitutions, though. But nothing proved to be useful.


Previous Comments:
------------------------------------------------------------------------
[2003-04-27 09:41:45] james at grickle dot org

__LINE__ and __FILE__ were just meant to be used as an example of how a
macro feature might be used



I intended it to be more of a preprocessor. So where ever it sees:



DOERR(FATAL,"Database Error......");



it would replace it with



errOut(FATAL, __FILE__ . ': ' . __LINE__ . ': ' . "Database
Error......");



So __FILE__ and __LINE__ would actually be in the file and line the
macro would be at. Using it much in the same way as the C preprocessor
is/can be used.

------------------------------------------------------------------------
[2003-04-26 09:44:55] [email protected]

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

Maybe it would, but that is not the way __FILE__ and __LINE__ work.
Simply use them as they are now: They always return the current file and
line - no more no less.

------------------------------------------------------------------------
[2002-12-22 22:45:39] james at grickle dot org

Hello,



I would like to request something along the lines of macros. It would
help a lot when you need to run __LINE__ and/or __FILE__ constants
through a function.



A simplified version of what I'd need them for. Currently I have:

errOut([severity], [message]);



Every time I use errOut I have __FILE__ and __LINE__ in the message:

define(FATAL, 7);

errOut(FATAL, __FILE__ . ": " . __LINE__ . ": Database error bla bla
bla");



It could be shortened up by something like this:

mdefine("DOERR", "errOut($1, __FILE__ . ': ' . __LINE__ . ': ' . $2)");

DOERR(FATAL,"Database Error bla bla bla");



This could be used for more vital things than that of course. Anything
along those lines would be great.



Thank You,

James Harr

------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=21155&edit=1

Reply via email to