28 cerr <<
"SIOD: duplicate builtin function: " <<
30 cerr <<
"SIOD: probably an error" << endl;
35 static LISP siod_doc(LISP args,LISP penv)
39 LISP lpair,
val,tmp,code;
43 return rintern(
"No documentation available for non-symbol.");
50 return rintern(
"Symbol is unbound.");
54 lpair =
assq(
car(args),var_docstrings);
58 rintern(
"No documentation available for symbol.");
74 return rintern(
"No documentation available for builtin function.");
77 code = val->storage_as.closure.code;
82 return rintern(
"No documentation available for user-defined function.");
84 return rintern(
"No documentation available for symbol.");
89 static LISP siod_all_function_docstrings(
void)
108 code = val->storage_as.closure.code;
122 static int sort_compare_docstrings(
const void *x,
const void *y)
130 static void siod_print_docstring(
const char *symname,
131 const char *docstring, FILE *
fp)
145 ref = ds.
after(rest);
146 ref = ref.
after(
"[see ");
153 fprintf(fp,
"@item ");
154 for (state=0,i=0; dsc[i] !=
'\0'; i++)
156 if (((dsc[i] ==
'@') ||
162 if ((dsc[i] ==
'\\') &&
163 ((dsc[i+1] ==
'@') ||
183 static LISP siod_sort_and_dump_docstrings(LISP type,LISP filefp)
186 LISP *array,l,docstrings;
191 docstrings = siod_all_function_docstrings();
198 array =
walloc(LISP,num_strings);
199 for (l=docstrings,i=0; i < num_strings; i++,l=
cdr(l))
201 qsort(array,num_strings,
sizeof(LISP),sort_compare_docstrings);
203 for (i=0; i < num_strings; i++)
248 Return documentation for SYMBOL.");
249 init_subr_2(
"sort-and-dump-docstrings",siod_sort_and_dump_docstrings,
250 "(sort-and-dump-docstrings DOCSTRINGS FILEFP)\n\ 251 DOCSTRINGS is an assoc list of name and document string var-docstrings\n\ 252 or func-docstrings. This very individual function sorts the list and \n\ 253 prints out the documentation strings as texinfo list members to FILEFP.");
LISP envlookup(LISP var, LISP env)
#define walloc(TYPE, SIZE)
void qsort(EST_TList< T > &a)
int contains(const char *s, ssize_t pos=-1) const
Does it contain this substring?
const char * siod_manual_sym(const char *symbol)
int siod_llength(LISP list)
void init_subr_2(const char *name, LISP(*fcn)(LISP, LISP), const char *doc)
void init_fsubr(const char *name, LISP(*fcn)(LISP, LISP), const char *doc)
FILE * get_c_file(LISP p, FILE *deflt)
const char * get_c_string(LISP x)
EST_Regex & make_regex(const char *r)
LISP cons(LISP x, LISP y)
void setdoc(LISP name, LISP doc)
LISP symbol_value(LISP x, LISP env)
LISP rintern(const char *name)
int EST_strcasecmp(const char *s1, const char *s2, const unsigned char *charmap)
LISP leval(LISP x, LISP env)
LISP assq(LISP x, LISP alist)
EST_String after(int pos, int len=1) const
Part after pos+len.
void init_subrs_doc(void)
EST_String before(int pos, int len=0) const
Part before position.
const char * siod_docstring(const char *symbol)
void siod_saydocstring(const char *symbol)