81 |
static int get_doc_string_buffer_size; |
static int get_doc_string_buffer_size; |
82 |
|
|
83 |
static unsigned char *read_bytecode_pointer; |
static unsigned char *read_bytecode_pointer; |
84 |
|
Lisp_Object Fsnarf_documentation P_ ((Lisp_Object)); |
85 |
|
|
86 |
/* readchar in lread.c calls back here to fetch the next byte. |
/* readchar in lread.c calls back here to fetch the next byte. |
87 |
If UNREADFLAG is 1, we unread a byte. */ |
If UNREADFLAG is 1, we unread a byte. */ |
135 |
{ |
{ |
136 |
file = XCAR (filepos); |
file = XCAR (filepos); |
137 |
position = XINT (XCDR (filepos)); |
position = XINT (XCDR (filepos)); |
|
if (position < 0) |
|
|
position = - position; |
|
138 |
} |
} |
139 |
else |
else |
140 |
return Qnil; |
return Qnil; |
141 |
|
|
142 |
|
if (position < 0) |
143 |
|
position = - position; |
144 |
|
|
145 |
if (!STRINGP (Vdoc_directory)) |
if (!STRINGP (Vdoc_directory)) |
146 |
return Qnil; |
return Qnil; |
147 |
|
|
331 |
else if ((EMACS_INT) XSUBR (fun)->doc >= 0) |
else if ((EMACS_INT) XSUBR (fun)->doc >= 0) |
332 |
doc = build_string (XSUBR (fun)->doc); |
doc = build_string (XSUBR (fun)->doc); |
333 |
else |
else |
334 |
doc = get_doc_string (make_number (- (EMACS_INT) XSUBR (fun)->doc), |
doc = make_number ((EMACS_INT) XSUBR (fun)->doc); |
|
0, 0); |
|
335 |
} |
} |
336 |
else if (COMPILEDP (fun)) |
else if (COMPILEDP (fun)) |
337 |
{ |
{ |
338 |
if ((XVECTOR (fun)->size & PSEUDOVECTOR_SIZE_MASK) <= COMPILED_DOC_STRING) |
if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) <= COMPILED_DOC_STRING) |
339 |
return Qnil; |
return Qnil; |
340 |
tem = XVECTOR (fun)->contents[COMPILED_DOC_STRING]; |
tem = AREF (fun, COMPILED_DOC_STRING); |
341 |
if (STRINGP (tem)) |
if (STRINGP (tem)) |
342 |
doc = tem; |
doc = tem; |
343 |
else if (NATNUMP (tem) || CONSP (tem)) |
else if (NATNUMP (tem) || CONSP (tem)) |
344 |
doc = get_doc_string (tem, 0, 0); |
doc = tem; |
345 |
else |
else |
346 |
return Qnil; |
return Qnil; |
347 |
} |
} |
366 |
doc = tem; |
doc = tem; |
367 |
/* Handle a doc reference--but these never come last |
/* Handle a doc reference--but these never come last |
368 |
in the function body, so reject them if they are last. */ |
in the function body, so reject them if they are last. */ |
369 |
else if ((NATNUMP (tem) || CONSP (tem)) |
else if ((NATNUMP (tem) || (CONSP (tem) && INTEGERP (XCDR (tem)))) |
370 |
&& ! NILP (XCDR (tem1))) |
&& !NILP (XCDR (tem1))) |
371 |
doc = get_doc_string (tem, 0, 0); |
doc = tem; |
372 |
else |
else |
373 |
return Qnil; |
return Qnil; |
374 |
} |
} |
385 |
Fsignal (Qinvalid_function, Fcons (fun, Qnil)); |
Fsignal (Qinvalid_function, Fcons (fun, Qnil)); |
386 |
} |
} |
387 |
|
|
388 |
|
if (INTEGERP (doc) || CONSP (doc)) |
389 |
|
doc = get_doc_string (doc, 0, 0); |
390 |
|
|
391 |
if (NILP (raw)) |
if (NILP (raw)) |
392 |
doc = Fsubstitute_command_keys (doc); |
doc = Fsubstitute_command_keys (doc); |
393 |
return doc; |
return doc; |
408 |
Lisp_Object tem; |
Lisp_Object tem; |
409 |
|
|
410 |
tem = Fget (symbol, prop); |
tem = Fget (symbol, prop); |
411 |
if (INTEGERP (tem)) |
if (INTEGERP (tem) || (CONSP (tem) && INTEGERP (XCDR (tem)))) |
|
tem = get_doc_string (XINT (tem) > 0 ? tem : make_number (- XINT (tem)), 0, 0); |
|
|
else if (CONSP (tem) && INTEGERP (XCDR (tem))) |
|
412 |
tem = get_doc_string (tem, 0, 0); |
tem = get_doc_string (tem, 0, 0); |
413 |
else if (!STRINGP (tem)) |
else if (!STRINGP (tem)) |
414 |
/* Feval protects its argument. */ |
/* Feval protects its argument. */ |
456 |
{ |
{ |
457 |
/* This bytecode object must have a slot for the |
/* This bytecode object must have a slot for the |
458 |
docstring, since we've found a docstring for it. */ |
docstring, since we've found a docstring for it. */ |
459 |
if ((XVECTOR (fun)->size & PSEUDOVECTOR_SIZE_MASK) > COMPILED_DOC_STRING) |
if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_DOC_STRING) |
460 |
XSETFASTINT (XVECTOR (fun)->contents[COMPILED_DOC_STRING], offset); |
XSETFASTINT (AREF (fun, COMPILED_DOC_STRING), offset); |
461 |
} |
} |
462 |
} |
} |
463 |
|
|