pike.git
/
src
/
builtin.cmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/builtin.cmod:1:
/* -*- c -*- || 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" #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:526:
*! *! The returned string is of the format @tt{"@i{filename@}:@i{linenumber@}"@}. *! *! 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)
-
{
+
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) { push_constant_text(":"); push_int(line); f_add(3); }
-
return;
+
}
-
-
pop_n_elems(args);
+
else
push_int(0); } /*! @decl int(8..8)|int(16..16)|int(32..32) width(string s) *! @belongs String *! *! Returns the width of a string. *! *! Three return values are possible: *! @int
pike.git/src/builtin.cmod:648:
PIKEFUN int get_weak_flag(multiset m) { #ifdef PIKE_NEW_MULTISETS RETURN multiset_get_flags(m) & MULTISET_WEAK; #else RETURN (m->ind->flags & (ARRAY_WEAK_FLAG|ARRAY_WEAK_SHRINK)) ? PIKE_WEAK_INDICES : 0; #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) *! *! Return the name of the function @[f]. *! *! If @[f] is a global function defined in the runtime @tt{0@} (zero) *! will be returned. *! *! @seealso *! @[function_object()]