Branch: Tag:

2002-12-01

2002-12-01 18:58:20 by Martin Stjernholm <mast@lysator.liu.se>

Use low_get_line and low_get_program_line in some places where the
dwim:ey error strings just gets in the way. Make it possible to pass
file and line to __empty_program(), which will then be used as line
number info for the dummy program.

Rev: src/builtin.cmod:1.101

2:   || 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: builtin.cmod,v 1.100 2002/11/28 23:45:38 marcus Exp $ + || $Id: builtin.cmod,v 1.101 2002/12/01 18:58:20 mast Exp $   */      #include "global.h"
533:    errname Program.defined;    optflags OPT_TRY_OPTIMIZE;   { -  if(p && p->num_linenumbers) -  { +     INT32 line; -  struct pike_string *tmp = get_program_line(p, &line); +  struct pike_string *tmp = low_get_program_line(p, &line);       pop_n_elems(args);    -  +  if (tmp) {    push_string(tmp);    if(line >= 1)    {
547:    push_int(line);    f_add(3);    } -  return; +     } -  -  pop_n_elems(args); +  else    push_int(0);   }   
655:   #endif   }    - PIKEFUN program __empty_program() + PIKEFUN program __empty_program(int|void line, string|void file)    efun;    optflags OPT_EXTERNAL_DEPEND;   { -  RETURN low_allocate_program(); +  if (line && line->type != T_INT) +  SIMPLE_BAD_ARG_ERROR("__empty_program", 1, "int|void"); +  else if (file && file->type != T_STRING) +  SIMPLE_BAD_ARG_ERROR("__empty_program", 2, "string|void"); +  else { +  struct program *prog = low_allocate_program(); +  if (file) ext_store_program_line (prog, line->u.integer, file->u.string); +  RETURN prog;    } -  + }      /*! @decl string function_name(function f)    *!