diff options
| author | Richard M. Stallman | 1998-05-12 23:11:10 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-05-12 23:11:10 +0000 |
| commit | ba29c3c9419a23b2ed916a55bb72a42f79a3b3dc (patch) | |
| tree | ae8d141655755abdefe6427afda090d54e9501f8 /src | |
| parent | 70697733d43aa570748c3a59cc818d8681543b08 (diff) | |
| download | emacs-ba29c3c9419a23b2ed916a55bb72a42f79a3b3dc.tar.gz emacs-ba29c3c9419a23b2ed916a55bb72a42f79a3b3dc.zip | |
(get_doc_string): New arg UNIBYTE
Maybe use make_unibyte_string. All callers changed.
(read_doc_string): Specify 1 for UNIBYTE.
Diffstat (limited to 'src')
| -rw-r--r-- | src/doc.c | 27 |
1 files changed, 17 insertions, 10 deletions
| @@ -81,11 +81,14 @@ static int get_doc_string_buffer_size; | |||
| 81 | and INTEGER as the position in that file. | 81 | and INTEGER as the position in that file. |
| 82 | But if INTEGER is negative, make it positive. | 82 | But if INTEGER is negative, make it positive. |
| 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 | |||
| 86 | If UNIBYTE is nonzero, always return the result as a unibyte string. */ | ||
| 85 | 87 | ||
| 86 | static Lisp_Object | 88 | static Lisp_Object |
| 87 | get_doc_string (filepos) | 89 | get_doc_string (filepos, unibyte) |
| 88 | Lisp_Object filepos; | 90 | Lisp_Object filepos; |
| 91 | int unibyte; | ||
| 89 | { | 92 | { |
| 90 | char *from, *to; | 93 | char *from, *to; |
| 91 | register int fd; | 94 | register int fd; |
| @@ -239,8 +242,12 @@ get_doc_string (filepos) | |||
| 239 | *to++ = *from++; | 242 | *to++ = *from++; |
| 240 | } | 243 | } |
| 241 | 244 | ||
| 242 | return make_string (get_doc_string_buffer + offset, | 245 | if (unibyte) |
| 243 | to - (get_doc_string_buffer + offset)); | 246 | return make_unibyte_string (get_doc_string_buffer + offset, |
| 247 | to - (get_doc_string_buffer + offset)); | ||
| 248 | else | ||
| 249 | return make_string (get_doc_string_buffer + offset, | ||
| 250 | to - (get_doc_string_buffer + offset)); | ||
| 244 | } | 251 | } |
| 245 | 252 | ||
| 246 | /* Get a string from position FILEPOS and pass it through the Lisp reader. | 253 | /* Get a string from position FILEPOS and pass it through the Lisp reader. |
| @@ -251,7 +258,7 @@ Lisp_Object | |||
| 251 | read_doc_string (filepos) | 258 | read_doc_string (filepos) |
| 252 | Lisp_Object filepos; | 259 | Lisp_Object filepos; |
| 253 | { | 260 | { |
| 254 | return Fread (get_doc_string (filepos)); | 261 | return Fread (get_doc_string (filepos, 1)); |
| 255 | } | 262 | } |
| 256 | 263 | ||
| 257 | DEFUN ("documentation", Fdocumentation, Sdocumentation, 1, 2, 0, | 264 | DEFUN ("documentation", Fdocumentation, Sdocumentation, 1, 2, 0, |
| @@ -273,7 +280,7 @@ string is passed through `substitute-command-keys'.") | |||
| 273 | if ((EMACS_INT) XSUBR (fun)->doc >= 0) | 280 | if ((EMACS_INT) XSUBR (fun)->doc >= 0) |
| 274 | doc = build_string (XSUBR (fun)->doc); | 281 | doc = build_string (XSUBR (fun)->doc); |
| 275 | else | 282 | else |
| 276 | doc = get_doc_string (make_number (- (EMACS_INT) XSUBR (fun)->doc)); | 283 | doc = get_doc_string (make_number (- (EMACS_INT) XSUBR (fun)->doc), 0); |
| 277 | } | 284 | } |
| 278 | else if (COMPILEDP (fun)) | 285 | else if (COMPILEDP (fun)) |
| 279 | { | 286 | { |
| @@ -283,7 +290,7 @@ string is passed through `substitute-command-keys'.") | |||
| 283 | if (STRINGP (tem)) | 290 | if (STRINGP (tem)) |
| 284 | doc = tem; | 291 | doc = tem; |
| 285 | else if (NATNUMP (tem) || CONSP (tem)) | 292 | else if (NATNUMP (tem) || CONSP (tem)) |
| 286 | doc = get_doc_string (tem); | 293 | doc = get_doc_string (tem, 1); |
| 287 | else | 294 | else |
| 288 | return Qnil; | 295 | return Qnil; |
| 289 | } | 296 | } |
| @@ -311,7 +318,7 @@ subcommands.)"); | |||
| 311 | in the function body, so reject them if they are last. */ | 318 | in the function body, so reject them if they are last. */ |
| 312 | else if ((NATNUMP (tem) || CONSP (tem)) | 319 | else if ((NATNUMP (tem) || CONSP (tem)) |
| 313 | && ! NILP (XCONS (tem1)->cdr)) | 320 | && ! NILP (XCONS (tem1)->cdr)) |
| 314 | doc = get_doc_string (tem); | 321 | doc = get_doc_string (tem, 1); |
| 315 | else | 322 | else |
| 316 | return Qnil; | 323 | return Qnil; |
| 317 | } | 324 | } |
| @@ -352,9 +359,9 @@ translation.") | |||
| 352 | 359 | ||
| 353 | tem = Fget (symbol, prop); | 360 | tem = Fget (symbol, prop); |
| 354 | if (INTEGERP (tem)) | 361 | if (INTEGERP (tem)) |
| 355 | tem = get_doc_string (XINT (tem) > 0 ? tem : make_number (- XINT (tem))); | 362 | tem = get_doc_string (XINT (tem) > 0 ? tem : make_number (- XINT (tem)), 0); |
| 356 | else if (CONSP (tem)) | 363 | else if (CONSP (tem)) |
| 357 | tem = get_doc_string (tem); | 364 | tem = get_doc_string (tem, 0); |
| 358 | if (NILP (raw) && STRINGP (tem)) | 365 | if (NILP (raw) && STRINGP (tem)) |
| 359 | return Fsubstitute_command_keys (tem); | 366 | return Fsubstitute_command_keys (tem); |
| 360 | return tem; | 367 | return tem; |