diff options
| author | Richard M. Stallman | 1998-06-24 18:26:20 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-06-24 18:26:20 +0000 |
| commit | e96179b37a70975020301aa4d2ef9585345f51ba (patch) | |
| tree | 30c270b858ff13084ecfc289ea66a4a2ab1eef50 /src | |
| parent | 01bc2c19ba2a1124dfec02366d52bef4a48c19e2 (diff) | |
| download | emacs-e96179b37a70975020301aa4d2ef9585345f51ba.tar.gz emacs-e96179b37a70975020301aa4d2ef9585345f51ba.zip | |
(get_doc_string): Take both UNIBYTE and DEFINITION as args.
All callers changed.
Diffstat (limited to 'src')
| -rw-r--r-- | src/doc.c | 27 |
1 files changed, 17 insertions, 10 deletions
| @@ -83,15 +83,17 @@ static int get_doc_string_buffer_size; | |||
| 83 | (A negative integer is used for user variables, so we can distinguish | 83 | (A negative integer is used for user variables, so we can distinguish |
| 84 | them without actually fetching the doc string.) | 84 | them without actually fetching the doc string.) |
| 85 | 85 | ||
| 86 | If UNIBYTE is nonzero, always make a unibyte string. | ||
| 87 | |||
| 86 | If DEFINITION is nonzero, assume this is for reading | 88 | If DEFINITION is nonzero, assume this is for reading |
| 87 | a dynamic function definition; convert the bytestring | 89 | a dynamic function definition; convert the bytestring |
| 88 | and the constants vector with appropriate byte handling, | 90 | and the constants vector with appropriate byte handling, |
| 89 | and return a cons cell. */ | 91 | and return a cons cell. */ |
| 90 | 92 | ||
| 91 | Lisp_Object | 93 | Lisp_Object |
| 92 | get_doc_string (filepos, definition) | 94 | get_doc_string (filepos, unibyte, definition) |
| 93 | Lisp_Object filepos; | 95 | Lisp_Object filepos; |
| 94 | int definition; | 96 | int unibyte, definition; |
| 95 | { | 97 | { |
| 96 | char *from, *to; | 98 | char *from, *to; |
| 97 | register int fd; | 99 | register int fd; |
| @@ -276,8 +278,12 @@ get_doc_string (filepos, definition) | |||
| 276 | return Fcons (bytestring, vector); | 278 | return Fcons (bytestring, vector); |
| 277 | } | 279 | } |
| 278 | 280 | ||
| 279 | return make_string (get_doc_string_buffer + offset, | 281 | if (unibyte) |
| 280 | to - (get_doc_string_buffer + offset)); | 282 | return make_unibyte_string (get_doc_string_buffer + offset, |
| 283 | to - (get_doc_string_buffer + offset)); | ||
| 284 | else | ||
| 285 | return make_string (get_doc_string_buffer + offset, | ||
| 286 | to - (get_doc_string_buffer + offset)); | ||
| 281 | } | 287 | } |
| 282 | 288 | ||
| 283 | /* Get a string from position FILEPOS and pass it through the Lisp reader. | 289 | /* Get a string from position FILEPOS and pass it through the Lisp reader. |
| @@ -288,7 +294,7 @@ Lisp_Object | |||
| 288 | read_doc_string (filepos) | 294 | read_doc_string (filepos) |
| 289 | Lisp_Object filepos; | 295 | Lisp_Object filepos; |
| 290 | { | 296 | { |
| 291 | return get_doc_string (filepos, 1); | 297 | return get_doc_string (filepos, 0, 1); |
| 292 | } | 298 | } |
| 293 | 299 | ||
| 294 | DEFUN ("documentation", Fdocumentation, Sdocumentation, 1, 2, 0, | 300 | DEFUN ("documentation", Fdocumentation, Sdocumentation, 1, 2, 0, |
| @@ -310,7 +316,8 @@ string is passed through `substitute-command-keys'.") | |||
| 310 | if ((EMACS_INT) XSUBR (fun)->doc >= 0) | 316 | if ((EMACS_INT) XSUBR (fun)->doc >= 0) |
| 311 | doc = build_string (XSUBR (fun)->doc); | 317 | doc = build_string (XSUBR (fun)->doc); |
| 312 | else | 318 | else |
| 313 | doc = get_doc_string (make_number (- (EMACS_INT) XSUBR (fun)->doc), 0); | 319 | doc = get_doc_string (make_number (- (EMACS_INT) XSUBR (fun)->doc), |
| 320 | 0, 0); | ||
| 314 | } | 321 | } |
| 315 | else if (COMPILEDP (fun)) | 322 | else if (COMPILEDP (fun)) |
| 316 | { | 323 | { |
| @@ -320,7 +327,7 @@ string is passed through `substitute-command-keys'.") | |||
| 320 | if (STRINGP (tem)) | 327 | if (STRINGP (tem)) |
| 321 | doc = tem; | 328 | doc = tem; |
| 322 | else if (NATNUMP (tem) || CONSP (tem)) | 329 | else if (NATNUMP (tem) || CONSP (tem)) |
| 323 | doc = get_doc_string (tem, 1); | 330 | doc = get_doc_string (tem, 1, 0); |
| 324 | else | 331 | else |
| 325 | return Qnil; | 332 | return Qnil; |
| 326 | } | 333 | } |
| @@ -348,7 +355,7 @@ subcommands.)"); | |||
| 348 | in the function body, so reject them if they are last. */ | 355 | in the function body, so reject them if they are last. */ |
| 349 | else if ((NATNUMP (tem) || CONSP (tem)) | 356 | else if ((NATNUMP (tem) || CONSP (tem)) |
| 350 | && ! NILP (XCONS (tem1)->cdr)) | 357 | && ! NILP (XCONS (tem1)->cdr)) |
| 351 | doc = get_doc_string (tem, 1); | 358 | doc = get_doc_string (tem, 1, 0); |
| 352 | else | 359 | else |
| 353 | return Qnil; | 360 | return Qnil; |
| 354 | } | 361 | } |
| @@ -389,9 +396,9 @@ translation.") | |||
| 389 | 396 | ||
| 390 | tem = Fget (symbol, prop); | 397 | tem = Fget (symbol, prop); |
| 391 | if (INTEGERP (tem)) | 398 | if (INTEGERP (tem)) |
| 392 | tem = get_doc_string (XINT (tem) > 0 ? tem : make_number (- XINT (tem)), 0); | 399 | tem = get_doc_string (XINT (tem) > 0 ? tem : make_number (- XINT (tem)), 0, 0); |
| 393 | else if (CONSP (tem)) | 400 | else if (CONSP (tem)) |
| 394 | tem = get_doc_string (tem, 0); | 401 | tem = get_doc_string (tem, 0, 0); |
| 395 | if (NILP (raw) && STRINGP (tem)) | 402 | if (NILP (raw) && STRINGP (tem)) |
| 396 | return Fsubstitute_command_keys (tem); | 403 | return Fsubstitute_command_keys (tem); |
| 397 | return tem; | 404 | return tem; |