Select Git revision
constants.c
-
Henrik (Grubba) Grubbström authored
low_make_callable() now uses the new function call checker (check_splice_call()/new_get_return_type()) rather than the old (check_call()) in the debug code. Rev: src/constants.c:1.61
Henrik (Grubba) Grubbström authoredlow_make_callable() now uses the new function call checker (check_splice_call()/new_get_return_type()) rather than the old (check_call()) in the debug code. Rev: src/constants.c:1.61
constants.c 5.78 KiB
/*
|| 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: constants.c,v 1.61 2008/06/18 21:23:12 grubba Exp $
*/
#include "global.h"
#include "constants.h"
#include "pike_macros.h"
#include "program.h"
#include "pike_types.h"
#include "stralloc.h"
#include "pike_memory.h"
#include "interpret.h"
#include "mapping.h"
#include "pike_error.h"
#include "pike_security.h"
#include "gc.h"
#include "block_alloc.h"
struct mapping *builtin_constants = 0;
#ifdef PIKE_DEBUG
struct callable *first_callable = NULL;
#endif
PMOD_EXPORT struct mapping *get_builtin_constants(void)
{
return builtin_constants;
}
void low_add_efun(struct pike_string *name, struct svalue *fun)
{
struct svalue s;
s.type=T_STRING;
s.subtype=0;
s.u.string=name;
if(fun)
{
mapping_insert(builtin_constants, &s, fun);
}else{
map_delete(builtin_constants, &s);
}
}
void low_add_constant(const char *name, struct svalue *fun)
{
struct pike_string *p;
p=make_shared_string(name);
low_add_efun(p, fun);
free_string(p);
}
void add_pike_string_constant(const char *name, const char *str, int len)
{
struct pike_string *key = make_shared_string(name);
struct pike_string *val = make_shared_binary_string(str, len);
mapping_string_insert_string(builtin_constants, key, val);
free_string(val);
free_string(key);
}
PMOD_EXPORT void add_global_program(const char *name, struct program *p)
{
struct svalue s;
s.type=T_PROGRAM;