pike.git / src / builtin.cmod

version» Context lines:

pike.git/src/builtin.cmod:1:   /* -*- c -*- -  * $Id: builtin.cmod,v 1.58 2001/07/11 17:57:23 mast Exp $ +  * $Id: builtin.cmod,v 1.59 2001/07/13 11:26:37 grubba Exp $    */      #include "global.h"   #include "interpret.h"   #include "svalue.h"   #include "opcodes.h"   #include "pike_macros.h"   #include "object.h"   #include "program.h"   #include "array.h"
pike.git/src/builtin.cmod:400:    *!    *! If it cannot be determined where the program was defined, @tt{0@} (zero)    *! will be returned.    */   PIKEFUN string program_defined(program p)    errname Program.defined;    optflags OPT_TRY_OPTIMIZE;   {    if(p && p->num_linenumbers)    { -  char *tmp; +     INT32 line; -  if((tmp=get_program_line(p, &line))) -  { -  struct pike_string *tmp2; -  tmp2=make_shared_string(tmp); +  struct pike_string *tmp = get_program_line(p, &line); +     pop_n_elems(args);    -  push_string(tmp2); +  push_string(tmp);    if(line >= 1)    {    push_constant_text(":");    push_int(line);    f_add(3);    }    return;    } -  } +        pop_n_elems(args);    push_int(0);   }      /*! @decl int(8..8)|int(16..16)|int(32..32) String.width(string s)    *!    *! Returns the width of a string.    *!    *! Three return values are possible:
pike.git/src/builtin.cmod:795:    push_int(res);    }       PIKEFUN string _sprintf(int c, mapping|void opts)    {    pop_n_elems(args);       push_text("backtrace_frame(");    if (THIS->pc) {    if (!THIS->filename) { -  THIS->filename = -  make_shared_string(get_line(THIS->pc, THIS->prog, &THIS->lineno)); +  THIS->filename = get_line(THIS->pc, THIS->prog, &THIS->lineno);    }    THIS->pc = NULL;    }    if (THIS->prog) {    free_program(THIS->prog);    THIS->prog = NULL;    }    if (THIS->filename) {    ref_push_string(THIS->filename);    push_text(":");
pike.git/src/builtin.cmod:896:    end = numargs-1;    }    }       for (i = index; i <= end; i++) {    switch(i) {    case 0: /* Filename */    case 1: /* Linenumber */    if (THIS->pc) {    if (!THIS->filename) { -  THIS->filename = -  make_shared_string(get_line(THIS->pc, THIS->prog, -  &THIS->lineno)); +  THIS->filename = get_line(THIS->pc, THIS->prog, &THIS->lineno);    }    THIS->pc = NULL;    }    if (THIS->prog) {    free_program(THIS->prog);    THIS->prog = NULL;    }    if (i) {    /* Linenumber */    push_int(THIS->lineno);
pike.git/src/builtin.cmod:972:    pop_n_elems(args - 2);    args = 2;    }       switch(index) {    case 0: /* Filename */    case 1: /* Linenumber */    /* First make sure we have line-number info. */    if (THIS->pc) {    if (!THIS->filename) { -  THIS->filename = -  make_shared_string(get_line(THIS->pc, THIS->prog, -  &THIS->lineno)); +  THIS->filename = get_line(THIS->pc, THIS->prog, &THIS->lineno);    }    THIS->pc = NULL;    }    if (THIS->prog) {    free_program(THIS->prog);    THIS->prog = NULL;    }    if (index) {    /* Linenumber */    if (value->type != PIKE_T_INT) {
pike.git/src/builtin.cmod:1714:       if (del_->u.string == to_->u.string) {    /* No-op... */    return;    }       copy_shared_string(THIS->del, del = del_->u.string);    copy_shared_string(THIS->to, to = to_->u.string);       if (del->len) { -  THIS->mojt = compile_memsearcher(MKPCHARP_STR(del), -  del->len, -  0x7fffffff, -  del); +  THIS->mojt = simple_compile_memsearcher(del);    }    }       /*** replace function ***/    typedef char *(* replace_searchfunc)(void *,void *,size_t);    PIKEFUN string `()(string str)    {    int shift;    struct pike_string *del = THIS->del;    struct pike_string *to = THIS->to;