pike.git / src / program.c

version» Context lines:

pike.git/src/program.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: program.c,v 1.477 2003/02/01 15:43:51 mast Exp $ + || $Id: program.c,v 1.478 2003/02/04 17:29:19 mast Exp $   */      #include "global.h" - RCSID("$Id: program.c,v 1.477 2003/02/01 15:43:51 mast Exp $"); + RCSID("$Id: program.c,v 1.478 2003/02/04 17:29:19 mast Exp $");   #include "program.h"   #include "object.h"   #include "dynamic_buffer.h"   #include "pike_types.h"   #include "stralloc.h"   #include "las.h"   #include "language.h"   #include "lex.h"   #include "pike_macros.h"   #include "fsort.h"
pike.git/src/program.c:1963:    void_type_string);       debug_malloc_touch(Pike_compiler->fake_object);    debug_malloc_touch(Pike_compiler->fake_object->storage);   }      PMOD_EXPORT void debug_start_new_program(int line, const char *file)   {    struct pike_string *save_file = lex.current_file;    int save_line = lex.current_line; -  lex.current_file = make_shared_string(file); +  +  { /* Trim off the leading path of the compilation environment. */ +  const char *p = DEFINETOSTR(PIKE_SRC_ROOT), *f = file; +  while (*p && *p == *f) p++, f++; +  while (*f == '/' || *f == '\\') f++; +  +  lex.current_file = make_shared_string(f);    lex.current_line = line; -  +  }       CDFPRINTF((stderr,    "th(%ld) start_new_program(%d, %s): "    "threads_disabled:%d, compilation_depth:%d\n",    (long)th_self(), line, file, threads_disabled, compilation_depth));       low_start_new_program(0,0,0,0);    store_linenumber(line,lex.current_file);    debug_malloc_name(Pike_compiler->new_program, file, line);   
pike.git/src/program.c:5038:    insert_small_number(DO_NOT_WARN((INT32)(PIKE_PC-Pike_compiler->last_pc)));    insert_small_number(current_line-Pike_compiler->last_line);    Pike_compiler->last_line = current_line;    Pike_compiler->last_pc = DO_NOT_WARN((INT32)PIKE_PC);    }   }      PMOD_EXPORT struct pike_string *low_get_program_line (struct program *prog,    INT32 *linep)   { +  *linep = 0; +     if (prog->linenumbers) {    char *cnt;    size_t len = 0;    INT32 shift = 0;    char *file = NULL;       cnt = prog->linenumbers;    if (cnt < prog->linenumbers + prog->num_linenumbers) {    if (*cnt == 127) {    cnt++;    len = get_small_number(&cnt);    shift = *cnt;    file = ++cnt;    cnt += len<<shift;    }    get_small_number(&cnt); /* Ignore the offset */    *linep = get_small_number(&cnt);    } -  else *linep = 0; +        if (file) {    struct pike_string *str = begin_wide_shared_string(len, shift);    memcpy(str->str, file, len<<shift);    return end_shared_string(str);    }    }       return NULL;   }
pike.git/src/program.c:5097: Inside #if defined(PIKE_DEBUG)
   * after the shared string table has expired.    */   char *debug_get_program_line(struct program *prog,    INT32 *linep)   {    char *cnt;    size_t len = 0;    INT32 shift = 0;    char *file = NULL;    static char buffer[1025]; +  *linep = 0;       if (!prog->linenumbers)    return "stub";       cnt = prog->linenumbers;    if (cnt < prog->linenumbers + prog->num_linenumbers) {    if (*cnt == 127) {    cnt++;    len = get_small_number(&cnt);    shift = *cnt;    file = ++cnt;    cnt += len<<shift;    }    get_small_number(&cnt); /* Ignore the offset */    *linep = get_small_number(&cnt);    } -  else *linep = 0; +     if (file) {    if(shift)    {    PCHARP from=MKPCHARP(file, shift);    size_t ptr=0;    while(ptr < NELEM(buffer)-20 &&    EXTRACT_PCHARP(from))    {    if(EXTRACT_PCHARP(from) > 255)    {