Debian Codegraph @

src/doc/manual/standards/symbols.txi

raw
1 @node Symbols
2 @section Symbols
3
4 There are no implementation-specific limits on the size or content of symbol names. It is however not allowed to write on the strings which have been passed to @code{#'make-symbol} or returned from @code{#'symbol-name}.
5
6 @subsection C Reference
7
8 @cppdef ecl_make_keyword
9 @deftypefun cl_object ecl_make_keyword (char *name);
10 Find a lisp keyword
11
12 @paragraph Description
13
14 Many Lisp functions take keyword arguments. When invoking a function with keyword arguments we need keywords, which are a kind of symbols that live in the @code{keyword} package. This function does the task of finding or creating those keywords from C strings.
15
16 @itemize
17 @item It is usually safe to store the resulting pointer, because keywords are always referenced by their package and will not be garbage collected (unless of course, you decide to delete it).
18 @item Remember that the case of the string is significant. @code{ecl_make_keyword("TO")} with return @code{:TO}, while @code{ecl_make_keyword("to")} returns a completely different keyword, @code{:|to|}. In short, you usually want to use uppercase.
19 @end itemize
20
21 @paragraph Example
22 The following example converts a section of a string to uppercase characters:
23
24 @example
25 cl_object start = ecl_make_keyword("START");
26 cl_object end = ecl_make_keyword("END");
27 ...
28 sup = cl_string_upcase(4, s, start, ecl_make_fixnum(2),
29 end, ecl_make_fixnum(6));
30 @end example
31
32 @end deftypefun
33
34 @cppdef ecl_make_symbol
35 @deftypefun cl_object ecl_make_symbol (const char *name, const char *package_name);
36 Find a lisp symbol
37
38 @paragraph Description
39 This function finds or create a symbol in the given package. First of
40 all, it tries to find the package named by @var{package_name}. If it
41 does not exist, an error is signaled. Then, a symbol with the supplied
42 @var{name} is created and interned in the given package.
43
44 @end deftypefun
45
46 @subsubsection ANSI Dictionary
47 Common Lisp and C equivalence
48
49 @multitable @columnfractions .3 .7
50 @headitem Lisp symbol @tab C function
51 @item @clhs{f_boundp.htm,boundp} @tab cl_object cl_boundp(cl_object symbolp)
52 @item @clhs{f_cp_sym.htm,copy-symbol} @tab cl_object cl_copy_symbol(cl_narg narg, cl_object symbol, ...)
53 @item @clhs{f_get.htm,get} @tab cl_object cl_get(cl_narg narg, cl_object sym, cl_object indicator, ...)
54 @item @clhs{f_gensym.htm,gensym} @tab cl_object cl_gensym(cl_narg narg, ...)
55 @item @clhs{f_gentem.htm,gentemp} @tab cl_object cl_gentemp(cl_narg narg, ...)
56 @item @clhs{f_kwdp.htm,keywordp} @tab cl_object cl_keywordp(cl_object object)
57 @item @clhs{f_mk_sym.htm,make-symbol} @tab cl_object cl_make_symbol(cl_object name)
58 @item @clhs{f_makunb.htm,makunbound} @tab cl_object cl_makunbound(cl_object makunbound)
59 @item @clhs{f_rempro.htm,remprop} @tab cl_object cl_remprop(cl_object symbol, cl_object indicator)
60 @item @clhs{f_set.htm,set} @tab cl_object cl_set(cl_object symbol, cl_object value)
61 @item @clhs{f_symbol.htm,symbolp} @tab cl_object cl_symbolp(cl_object object)
62 @item @clhs{f_symb_1.htm,symbol-function} @tab cl_object cl_symbol_function(cl_object symbol)
63 @item @clhs{f_symb_1.htm,(setf symbol-function)} @tab cl_object si_fset(cl_narg narg, cl_object function_name, cl_object definition, ...)
64 @item @clhs{f_symb_2.htm,symbol-name} @tab cl_object cl_symbol_name(cl_object symbol)
65 @item @clhs{f_symb_3.htm,symbol-package} @tab cl_object cl_symbol_package(cl_object symbol)
66 @item @clhs{f_symb_4.htm,symbol-plist} @tab cl_object cl_symbol_plist(cl_object symbol)
67 @item @clhs{f_symb_4.htm,(setf symbol-plist)} @tab cl_object si_set_symbol_plist(cl_object symbol, cl_object plist)
68 @item @clhs{f_symb_5.htm,symbol-value} @tab cl_object cl_symbol_value(cl_object symbol)
69 @end multitable