char *gh_symbol2newstr(repv sym, size_t *lenp) { if (!rep_SYMBOLP (sym)) return NULL; return gh_scm2newstr (rep_SYM (sym)->name, lenp); }
static char * completion_generator (char *word, int state) { if (state == 0) { repv fun = completion_fun; if (fun == Qnil) /* backwards compatibility, ugh */ fun = Fsymbol_value (Qrl_completion_generator, Qt); if (Ffunctionp (fun) != Qnil) { completions = (rep_call_with_barrier (Ffuncall, rep_list_2 (fun, rep_string_dup (word)), rep_TRUE, 0, 0, 0)); } else { repv re = Fquote_regexp (rep_string_dup (word)); repv boundp = Fsymbol_value (Qboundp, Qt); completions = Fapropos (rep_concat2("^", rep_STR(re)), boundp, Qnil); } if (completions == rep_NULL) completions = Qnil; } if (completions != Qnil && rep_CONSP(completions) && (rep_SYMBOLP(rep_CAR(completions)) || rep_STRINGP(rep_CAR(completions)))) { repv string = rep_CAR(completions); if (rep_SYMBOLP(string)) string = rep_SYM(string)->name; completions = rep_CDR(completions); return strdup (rep_STR(string)); } else return 0; }
/* Scan for a binding of symbol VAR under structure S, or return null. This also searches the exports of any structures that S has opened */ static rep_struct_node * lookup_recursively (repv s, repv var) { if (rep_SYMBOLP (s)) s = Fget_structure (s); if (s && rep_STRUCTUREP (s) && !(rep_STRUCTURE (s)->car & rep_STF_EXCLUSION)) { rep_struct_node *n; n = lookup (rep_STRUCTURE (s), var); if (n != 0) return n->is_exported ? n : 0; rep_STRUCTURE (s)->car |= rep_STF_EXCLUSION; if (structure_exports_inherited_p (rep_STRUCTURE (s), var)) n = rep_search_imports (rep_STRUCTURE (s), var); rep_STRUCTURE (s)->car &= ~rep_STF_EXCLUSION; return n; } else return 0; }
static void datum_print (repv stream, repv arg) { if (arg == Qnil) { DEFSTRING (eol, "()"); rep_stream_puts (stream, rep_PTR (rep_VAL (&eol)), 2, rep_TRUE); } else { repv printer = Fassq (DATUM_ID (arg), printer_alist); if (printer && rep_CONSP (printer) && rep_CDR (printer) != Qnil) rep_call_lisp2 (rep_CDR (printer), arg, stream); else if (rep_SYMBOLP (DATUM_ID (arg))) { rep_stream_puts (stream, "#<datum ", -1, rep_FALSE); rep_stream_puts (stream, rep_PTR (rep_SYM (DATUM_ID (arg))->name), -1, rep_TRUE); rep_stream_putc (stream, '>'); } else rep_stream_puts (stream, "#<datum>", -1, rep_FALSE); } }
int gh_symbol_p(repv val) { return rep_SYMBOLP (val); }