diff options
| author | Richard M. Stallman | 1998-07-05 20:31:12 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-07-05 20:31:12 +0000 |
| commit | 32caae30ca89794705c9c109772403bb494fd9d7 (patch) | |
| tree | 9b2358ea050690d1f1ae3e1e8646543974b3b7a3 /src/doc.c | |
| parent | dc14ae363e8f131b7849eb7780a49199123d808a (diff) | |
| download | emacs-32caae30ca89794705c9c109772403bb494fd9d7.tar.gz emacs-32caae30ca89794705c9c109772403bb494fd9d7.zip | |
(get_doc_string): Take both UNIBYTE and DEFINITION as args.
All callers changed.
Diffstat (limited to 'src/doc.c')
| -rw-r--r-- | src/doc.c | 47 |
1 files changed, 20 insertions, 27 deletions
| @@ -75,6 +75,22 @@ munge_doc_file_name (name) | |||
| 75 | static char *get_doc_string_buffer; | 75 | static char *get_doc_string_buffer; |
| 76 | static int get_doc_string_buffer_size; | 76 | static int get_doc_string_buffer_size; |
| 77 | 77 | ||
| 78 | static unsigned char *read_bytecode_pointer; | ||
| 79 | |||
| 80 | /* readchar in lread.c calls back here to fetch the next byte. | ||
| 81 | If UNREADFLAG is 1, we unread a byte. */ | ||
| 82 | |||
| 83 | int | ||
| 84 | read_bytecode_char (unreadflag) | ||
| 85 | { | ||
| 86 | if (unreadflag) | ||
| 87 | { | ||
| 88 | read_bytecode_pointer--; | ||
| 89 | return 0; | ||
| 90 | } | ||
| 91 | return *read_bytecode_pointer++; | ||
| 92 | } | ||
| 93 | |||
| 78 | /* Extract a doc string from a file. FILEPOS says where to get it. | 94 | /* Extract a doc string from a file. FILEPOS says where to get it. |
| 79 | If it is an integer, use that position in the standard DOC-... file. | 95 | If it is an integer, use that position in the standard DOC-... file. |
| 80 | If it is (FILE . INTEGER), use FILE as the file name | 96 | If it is (FILE . INTEGER), use FILE as the file name |
| @@ -247,35 +263,12 @@ get_doc_string (filepos, unibyte, definition) | |||
| 247 | *to++ = *from++; | 263 | *to++ = *from++; |
| 248 | } | 264 | } |
| 249 | 265 | ||
| 266 | /* If DEFINITION, read from this buffer | ||
| 267 | the same way we would read bytes from a file. */ | ||
| 250 | if (definition) | 268 | if (definition) |
| 251 | { | 269 | { |
| 252 | char *p = get_doc_string_buffer + offset; | 270 | read_bytecode_pointer = get_doc_string_buffer + offset; |
| 253 | char *start_ptr; | 271 | return Fread (Qlambda); |
| 254 | Lisp_Object bytestring, vector; | ||
| 255 | |||
| 256 | if (*p++ != '(') | ||
| 257 | return Qnil; | ||
| 258 | start_ptr = p; | ||
| 259 | if (*p++ != '"') | ||
| 260 | return Qnil; | ||
| 261 | while (*p != '"') | ||
| 262 | { | ||
| 263 | if (*p == '\\') | ||
| 264 | p++; | ||
| 265 | p++; | ||
| 266 | } | ||
| 267 | p++; | ||
| 268 | bytestring = Fread (make_unibyte_string (start_ptr, p - start_ptr)); | ||
| 269 | if (*p++ != ' ') | ||
| 270 | return Qnil; | ||
| 271 | if (*p++ != '.') | ||
| 272 | return Qnil; | ||
| 273 | if (*p++ != ' ') | ||
| 274 | return Qnil; | ||
| 275 | if (to[-1] != ')') | ||
| 276 | return Qnil; | ||
| 277 | vector = Fread (make_string (p, to - p - 1)); | ||
| 278 | return Fcons (bytestring, vector); | ||
| 279 | } | 272 | } |
| 280 | 273 | ||
| 281 | if (unibyte) | 274 | if (unibyte) |