Commit | Line | Data |
---|---|---|
0f2d19dd JB |
1 | /* classes: h_files */ |
2 | ||
729dbac3 DH |
3 | #ifndef SCM_SYMBOLS_H |
4 | #define SCM_SYMBOLS_H | |
dee01b01 | 5 | |
8a4ed2dd | 6 | /* Copyright (C) 1995,1996,1997,1998,2000,2001, 2003, 2004, 2006, 2008, 2010 Free Software Foundation, Inc. |
dee01b01 | 7 | * |
73be1d9e | 8 | * This library is free software; you can redistribute it and/or |
53befeb7 NJ |
9 | * modify it under the terms of the GNU Lesser General Public License |
10 | * as published by the Free Software Foundation; either version 3 of | |
11 | * the License, or (at your option) any later version. | |
dee01b01 | 12 | * |
53befeb7 NJ |
13 | * This library is distributed in the hope that it will be useful, but |
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
73be1d9e MV |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | * Lesser General Public License for more details. | |
dee01b01 | 17 | * |
73be1d9e MV |
18 | * You should have received a copy of the GNU Lesser General Public |
19 | * License along with this library; if not, write to the Free Software | |
53befeb7 NJ |
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
21 | * 02110-1301 USA | |
73be1d9e | 22 | */ |
d3a6bc94 | 23 | |
0f2d19dd JB |
24 | \f |
25 | ||
b4309c3c | 26 | #include "libguile/__scm.h" |
0f2d19dd JB |
27 | \f |
28 | ||
3ee86942 MV |
29 | #define scm_is_symbol(x) (!SCM_IMP (x) \ |
30 | && (SCM_TYP7 (x) == scm_tc7_symbol)) | |
31 | #define scm_i_symbol_hash(x) ((unsigned long) SCM_CELL_WORD_2 (x)) | |
6869328b MV |
32 | #define scm_i_symbol_is_interned(x) \ |
33 | (!(SCM_CELL_WORD_0 (x) & SCM_I_F_SYMBOL_UNINTERNED)) | |
34 | ||
35 | #define SCM_I_F_SYMBOL_UNINTERNED 0x100 | |
0f2d19dd | 36 | |
0f2d19dd | 37 | \f |
0f2d19dd | 38 | |
8a4ed2dd AW |
39 | /* Older spellings; don't use in new code. |
40 | */ | |
41 | #define SCM_SYMBOLP(x) (scm_is_symbol (x)) | |
42 | #define SCM_SYMBOL_FUNC(x) (scm_symbol_fref (x)) | |
43 | #define SCM_SET_SYMBOL_FUNC(x,f) (scm_symbol_fset_x (x, f)) | |
44 | #define SCM_SYMBOL_PROPS(x) (scm_symbol_pref (x)) | |
45 | #define SCM_SET_SYMBOL_PROPS(x,p) (scm_symbol_pset_x (x, p)) | |
46 | #define SCM_SYMBOL_HASH(x) (scm_i_symbol_hash (x)) | |
47 | #define SCM_SYMBOL_INTERNED_P(x) (scm_i_symbol_is_interned (x)) | |
48 | ||
49 | \f | |
50 | ||
a4c91488 | 51 | #ifdef GUILE_DEBUG |
33b001fd | 52 | SCM_API SCM scm_sys_symbols (void); |
a4c91488 | 53 | #endif |
23ade5e7 | 54 | |
33b001fd | 55 | SCM_API SCM scm_symbol_p (SCM x); |
a63cdd61 MV |
56 | SCM_API SCM scm_symbol_interned_p (SCM sym); |
57 | SCM_API SCM scm_make_symbol (SCM name); | |
33b001fd MV |
58 | SCM_API SCM scm_symbol_to_string (SCM s); |
59 | SCM_API SCM scm_string_to_symbol (SCM s); | |
1206efbe | 60 | SCM_API SCM scm_string_ci_to_symbol (SCM s); |
86d31dfe | 61 | |
33b001fd MV |
62 | SCM_API SCM scm_symbol_fref (SCM s); |
63 | SCM_API SCM scm_symbol_pref (SCM s); | |
64 | SCM_API SCM scm_symbol_fset_x (SCM s, SCM val); | |
65 | SCM_API SCM scm_symbol_pset_x (SCM s, SCM val); | |
86d31dfe | 66 | |
33b001fd MV |
67 | SCM_API SCM scm_symbol_hash (SCM s); |
68 | SCM_API SCM scm_gensym (SCM prefix); | |
86d31dfe | 69 | |
ad5cbc47 AW |
70 | /* Use locale encoding for user input, user output, or interacting with |
71 | the C library. Use latin-1 for ASCII, and for literals in source | |
72 | code. Use UTF-8 for interaction with modern libraries which deal in | |
73 | UTF-8. Otherwise use scm_to_stringn or scm_from_stringn, and | |
74 | convert. */ | |
75 | ||
3ee86942 MV |
76 | SCM_API SCM scm_from_locale_symbol (const char *str); |
77 | SCM_API SCM scm_from_locale_symboln (const char *str, size_t len); | |
fd0a5bbc HWN |
78 | SCM_API SCM scm_take_locale_symbol (char *sym); |
79 | SCM_API SCM scm_take_locale_symboln (char *sym, size_t len); | |
3ee86942 | 80 | |
ad5cbc47 AW |
81 | SCM_API SCM scm_from_latin1_symbol (const char *str); |
82 | SCM_API SCM scm_from_latin1_symboln (const char *str, size_t len); | |
83 | SCM_API SCM scm_take_latin1_symbol (char *sym); | |
84 | SCM_API SCM scm_take_latin1_symboln (char *sym, size_t len); | |
85 | ||
86 | SCM_API SCM scm_from_utf8_symbol (const char *str); | |
87 | SCM_API SCM scm_from_utf8_symboln (const char *str, size_t len); | |
88 | SCM_API SCM scm_take_utf8_symbol (char *sym); | |
89 | SCM_API SCM scm_take_utf8_symboln (char *sym, size_t len); | |
90 | ||
3ee86942 MV |
91 | /* internal functions. */ |
92 | ||
102dbb6f | 93 | SCM_INTERNAL unsigned long scm_i_hash_symbol (SCM obj, unsigned long n, |
3ee86942 MV |
94 | void *closure); |
95 | ||
102dbb6f LC |
96 | SCM_INTERNAL void scm_symbols_prehistory (void); |
97 | SCM_INTERNAL void scm_init_symbols (void); | |
0f2d19dd | 98 | |
729dbac3 | 99 | #endif /* SCM_SYMBOLS_H */ |
89e00824 ML |
100 | |
101 | /* | |
102 | Local Variables: | |
103 | c-file-style: "gnu" | |
104 | End: | |
105 | */ |