Skip to content
Snippets Groups Projects
Select Git revision
  • f682df42dcc6949182d977acdd296ebda712efeb
  • master default protected
  • 9.0
  • 8.0
  • 7.8
  • 7.6
  • 7.4
  • 7.2
  • 7.0
  • 0.6
  • rosuav/latex-markdown-renderer
  • rxnpatch/rxnpatch
  • marcus/gobject-introspection
  • rxnpatch/8.0
  • rosuav/pre-listening-ports
  • nt-tools
  • rosuav/async-annotations
  • rosuav/pgsql-ssl
  • rxnpatch/rxnpatch-broken/2023-10-06T094250
  • grubba/fdlib
  • grubba/wip/sakura/8.0
  • v8.0.2000
  • v8.0.1998
  • v8.0.1996
  • v8.0.1994
  • v8.0.1992
  • v8.0.1990
  • v8.0.1988
  • v8.0.1986
  • rxnpatch/clusters/8.0/2025-04-29T124414
  • rxnpatch/2025-04-29T124414
  • v8.0.1984
  • v8.0.1982
  • v8.0.1980
  • v8.0.1978
  • v8.0.1976
  • v8.0.1974
  • v8.0.1972
  • v8.0.1970
  • v8.0.1968
  • v8.0.1966
41 results

constants.c

Blame
  • 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;