ksymbol.h (1004B)
1 /* 2 ** ksymbol.h 3 ** Kernel Symbols 4 ** See Copyright Notice in klisp.h 5 */ 6 7 #ifndef ksymbol_h 8 #define ksymbol_h 9 10 #include "kobject.h" 11 #include "kstate.h" 12 #include "kstring.h" 13 #include "kmem.h" 14 15 /* TEMP: for now all symbols with no source info are interned */ 16 17 /* NOTE: symbols can have source info, they should be compared with 18 tv_sym_equal, NOT tv_equal */ 19 20 /* No case folding is performed by these constructors */ 21 22 /* buffer + size, may contain nulls */ 23 TValue ksymbol_new_bs(klisp_State *K, const char *buf, uint32_t size, 24 TValue si); 25 /* null terminated buffer */ 26 TValue ksymbol_new_b(klisp_State *K, const char *buf, TValue si); 27 /* copies str if not immutable */ 28 TValue ksymbol_new_str(klisp_State *K, TValue str, TValue si); 29 30 #define ksymbol_str(tv_) (tv2sym(tv_)->str) 31 #define ksymbol_buf(tv_) (kstring_buf(tv2sym(tv_)->str)) 32 #define ksymbol_size(tv_) (kstring_size(tv2sym(tv_)->str)) 33 34 bool ksymbolp(TValue obj); 35 int32_t ksymbol_cstr_cmp(TValue sym, const char *buf); 36 37 #endif