diff --git a/src/constants.c b/src/constants.c index 8982cc0732250f9e8103d91749542256d39475b6..ea212d760c5137bbaaed22ac8b9f5c77929c815b 100644 --- a/src/constants.c +++ b/src/constants.c @@ -2,7 +2,7 @@ || 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.54 2004/09/18 20:50:48 nilsson Exp $ +|| $Id: constants.c,v 1.55 2004/12/30 12:57:24 grubba Exp $ */ #include "global.h" @@ -53,6 +53,15 @@ void low_add_constant(const char *name, struct svalue *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; diff --git a/src/constants.h b/src/constants.h index 1898661c3391e0e3b23af909352b059fe4ae2e98..bd8dd4c38bb471f503097d97932131cd8726a3b5 100644 --- a/src/constants.h +++ b/src/constants.h @@ -2,7 +2,7 @@ || 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.h,v 1.32 2003/08/20 16:31:44 mast Exp $ +|| $Id: constants.h,v 1.33 2004/12/30 12:57:24 grubba Exp $ */ #ifndef ADD_EFUN_H @@ -48,6 +48,7 @@ extern struct callable *first_callable; PMOD_EXPORT struct mapping *get_builtin_constants(void); void low_add_efun(struct pike_string *name, struct svalue *fun); void low_add_constant(const char *name, struct svalue *fun); +void add_pike_string_constant(const char *name, const char *str, int len); PMOD_EXPORT void add_global_program(const char *name, struct program *p); BLOCK_ALLOC_FILL_PAGES(callable,2) PMOD_EXPORT struct callable *low_make_callable(c_fun fun,