diff options
| author | Zeev Suraski <zeev@php.net> | 2000-09-12 19:47:25 +0000 |
|---|---|---|
| committer | Zeev Suraski <zeev@php.net> | 2000-09-12 19:47:25 +0000 |
| commit | 5286b3971cbe7763f1f5aa918a5a909f61968fe8 (patch) | |
| tree | e4a735e247114874d05c60a4e7f4c4b98363bad9 /Zend/zend.c | |
| parent | 5470222d706e422ded13111100774596d6d5822b (diff) | |
| download | php-git-5286b3971cbe7763f1f5aa918a5a909f61968fe8.tar.gz | |
Make compile_string() accept a description of the code
Diffstat (limited to 'Zend/zend.c')
| -rw-r--r-- | Zend/zend.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Zend/zend.c b/Zend/zend.c index 2c2fa082ae..01737f8946 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -730,3 +730,29 @@ ZEND_API int zend_execute_scripts(int type CLS_DC ELS_DC, int file_count, ...) return SUCCESS; } +#define COMPILED_STRING_DESCRIPTION_FORMAT "%s(%d) : %s" + +ZEND_API char *zend_make_compiled_string_description(char *name) +{ + char *cur_filename; + int cur_lineno; + char *compiled_string_description; + CLS_FETCH(); + ELS_FETCH(); + + if (zend_is_compiling()) { + cur_filename = zend_get_compiled_filename(CLS_C); + cur_lineno = zend_get_compiled_lineno(CLS_C); + } else if (zend_is_executing()) { + cur_filename = zend_get_executed_filename(ELS_C); + cur_lineno = zend_get_executed_lineno(ELS_C); + } else { + cur_filename = "Unknown"; + cur_lineno = 0; + } + + compiled_string_description = emalloc(sizeof(COMPILED_STRING_DESCRIPTION_FORMAT)+strlen(name)+strlen(cur_filename)+MAX_LENGTH_OF_LONG); + sprintf(compiled_string_description, COMPILED_STRING_DESCRIPTION_FORMAT, cur_filename, cur_lineno, name); + return compiled_string_description; +} + |
