Macro functionality
| From: | Emiliano | Date: | Fri, 07 Sep 2001 22:36:41 +0000 |
| Subject: | Macro functionality | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-65394@lists.php.net to get a copy of this message | ||
Is there any way (with C coding or otherwise) to implement macros a la
#define in C for PHP? I need to have something that looks like a function but
that calls eval in the body, and I need that eval to be executed in the
calling scope. If that's not possible, would it be OK to do something akin to
(pseudocode here):
save_current_symbol_table=EG(active_symbol_table);
EG(active_symbol_table) = EG(symbol_table);
ops = compile_string(param)
execute(ops)
EG(active_symbol_table)=save_current_symbol_table;
Thiis wouldn't execute in the calling scope (which looks like it's trapped in
execute) but the global scope. It'd be a comrpomise but I'd settle for it.
Emile