comparison src/doc.c @ 867:804517e16990

[xemacs-hg @ 2002-06-05 09:54:39 by ben] Textual renaming: text/char names abbrev.c, alloc.c, buffer.c, buffer.h, bytecode.c, callint.c, casefiddle.c, casetab.c, charset.h, chartab.c, chartab.h, cmds.c, console-gtk.h, console-msw.c, console-msw.h, console-stream.c, console-tty.c, console-x.c, console-x.h, console.h, data.c, device-msw.c, device-x.c, dialog-msw.c, dired-msw.c, dired.c, doc.c, doprnt.c, editfns.c, eldap.c, emodules.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-unixoid.c, events.c, events.h, file-coding.c, file-coding.h, fileio.c, filelock.c, fns.c, font-lock.c, frame-gtk.c, frame-msw.c, frame-x.c, frame.c, glyphs-eimage.c, glyphs-msw.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gui-x.c, gui-x.h, gui.c, gui.h, hpplay.c, indent.c, insdel.c, insdel.h, intl-win32.c, keymap.c, line-number.c, line-number.h, lisp-disunion.h, lisp-union.h, lisp.h, lread.c, lrecord.h, lstream.c, lstream.h, md5.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, mule-ccl.c, mule-charset.c, mule-coding.c, mule-wnnfns.c, ndir.h, nt.c, objects-gtk.c, objects-gtk.h, objects-msw.c, objects-tty.c, objects-x.c, objects.c, objects.h, postgresql.c, print.c, process-nt.c, process-unix.c, process.c, procimpl.h, realpath.c, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-tty.c, redisplay-x.c, redisplay.c, redisplay.h, regex.c, search.c, select-common.h, select-gtk.c, select-x.c, sound.h, symbols.c, syntax.c, syntax.h, sysdep.c, sysdep.h, sysdir.h, sysfile.h, sysproc.h, syspwd.h, systime.h, syswindows.h, termcap.c, tests.c, text.c, text.h, toolbar-common.c, tooltalk.c, ui-gtk.c, unexnt.c, unicode.c, win32.c: Text/char naming rationalization. [a] distinguish between "charptr" when it refers to operations on the pointer itself and when it refers to operations on text; and [b] use consistent naming for everything referring to internal format, i.e. Itext == text in internal format Ibyte == a byte in such text Ichar == a char as represented in internal character format thus e.g. set_charptr_emchar -> set_itext_ichar The pre and post tags on either side of this change are: pre-internal-format-textual-renaming post-internal-format-textual-renaming See the Internals Manual for details of exactly how this was done, how to handle the change in your workspace, etc.
author ben
date Wed, 05 Jun 2002 09:58:45 +0000
parents e7ee5f8bde58
children 4542b72c005e
comparison
equal deleted inserted replaced
866:613552a02607 867:804517e16990
44 error, returns a cons holding the error data to pass to Fsignal. 44 error, returns a cons holding the error data to pass to Fsignal.
45 NAME_NONRELOC and NAME_RELOC are only used for the error messages. */ 45 NAME_NONRELOC and NAME_RELOC are only used for the error messages. */
46 46
47 Lisp_Object 47 Lisp_Object
48 unparesseuxify_doc_string (int fd, EMACS_INT position, 48 unparesseuxify_doc_string (int fd, EMACS_INT position,
49 Intbyte *name_nonreloc, Lisp_Object name_reloc, 49 Ibyte *name_nonreloc, Lisp_Object name_reloc,
50 int standard_doc_file) 50 int standard_doc_file)
51 { 51 {
52 Intbyte buf[512 * 32 + 1]; 52 Ibyte buf[512 * 32 + 1];
53 Intbyte *buffer = buf; 53 Ibyte *buffer = buf;
54 int buffer_size = sizeof (buf); 54 int buffer_size = sizeof (buf);
55 Intbyte *from, *to; 55 Ibyte *from, *to;
56 REGISTER Intbyte *p = buffer; 56 REGISTER Ibyte *p = buffer;
57 Lisp_Object return_me; 57 Lisp_Object return_me;
58 Lisp_Object fdstream = Qnil, instream = Qnil; 58 Lisp_Object fdstream = Qnil, instream = Qnil;
59 struct gcpro gcpro1, gcpro2; 59 struct gcpro gcpro1, gcpro2;
60 60
61 GCPRO2 (fdstream, instream); 61 GCPRO2 (fdstream, instream);
95 int nread; 95 int nread;
96 96
97 /* Switch to a bigger buffer if we need one. */ 97 /* Switch to a bigger buffer if we need one. */
98 if (space_left == 0) 98 if (space_left == 0)
99 { 99 {
100 Intbyte *old_buffer = buffer; 100 Ibyte *old_buffer = buffer;
101 if (buffer == buf) 101 if (buffer == buf)
102 { 102 {
103 buffer = (Intbyte *) xmalloc (buffer_size *= 2); 103 buffer = (Ibyte *) xmalloc (buffer_size *= 2);
104 memcpy (buffer, old_buffer, p - old_buffer); 104 memcpy (buffer, old_buffer, p - old_buffer);
105 } 105 }
106 else 106 else
107 buffer = (Intbyte *) xrealloc (buffer, buffer_size *= 2); 107 buffer = (Ibyte *) xrealloc (buffer, buffer_size *= 2);
108 p += buffer - old_buffer; 108 p += buffer - old_buffer;
109 space_left = buffer_size - (p - buffer); 109 space_left = buffer_size - (p - buffer);
110 } 110 }
111 111
112 /* Don't read too much at one go. */ 112 /* Don't read too much at one go. */
121 } 121 }
122 p[nread] = 0; 122 p[nread] = 0;
123 if (!nread) 123 if (!nread)
124 break; 124 break;
125 { 125 {
126 Intbyte *p1 = qxestrchr (p, '\037'); /* End of doc string marker */ 126 Ibyte *p1 = qxestrchr (p, '\037'); /* End of doc string marker */
127 if (p1) 127 if (p1)
128 { 128 {
129 *p1 = 0; 129 *p1 = 0;
130 p = p1; 130 p = p1;
131 break; 131 break;
192 192
193 static Lisp_Object 193 static Lisp_Object
194 get_doc_string (Lisp_Object filepos) 194 get_doc_string (Lisp_Object filepos)
195 { 195 {
196 REGISTER int fd; 196 REGISTER int fd;
197 REGISTER Intbyte *name_nonreloc = 0; 197 REGISTER Ibyte *name_nonreloc = 0;
198 EMACS_INT position; 198 EMACS_INT position;
199 Lisp_Object file, tem; 199 Lisp_Object file, tem;
200 Lisp_Object name_reloc = Qnil; 200 Lisp_Object name_reloc = Qnil;
201 int standard_doc_file = 0; 201 int standard_doc_file = 0;
202 202
233 233
234 minsize = XSTRING_LENGTH (Vdoc_directory); 234 minsize = XSTRING_LENGTH (Vdoc_directory);
235 /* sizeof ("../lib-src/") == 12 */ 235 /* sizeof ("../lib-src/") == 12 */
236 if (minsize < 12) 236 if (minsize < 12)
237 minsize = 12; 237 minsize = 12;
238 name_nonreloc = alloca_intbytes (minsize + XSTRING_LENGTH (file) + 8); 238 name_nonreloc = alloca_ibytes (minsize + XSTRING_LENGTH (file) + 8);
239 string_join (name_nonreloc, Vdoc_directory, file); 239 string_join (name_nonreloc, Vdoc_directory, file);
240 } 240 }
241 else 241 else
242 name_reloc = file; 242 name_reloc = file;
243 243
247 { 247 {
248 #ifndef CANNOT_DUMP 248 #ifndef CANNOT_DUMP
249 if (purify_flag) 249 if (purify_flag)
250 { 250 {
251 /* sizeof ("../lib-src/") == 12 */ 251 /* sizeof ("../lib-src/") == 12 */
252 name_nonreloc = (Intbyte *) ALLOCA (12 + XSTRING_LENGTH (file) + 8); 252 name_nonreloc = (Ibyte *) ALLOCA (12 + XSTRING_LENGTH (file) + 8);
253 /* Preparing to dump; DOC file is probably not installed. 253 /* Preparing to dump; DOC file is probably not installed.
254 So check in ../lib-src. */ 254 So check in ../lib-src. */
255 qxestrcpy (name_nonreloc, (Intbyte *) "../lib-src/"); 255 qxestrcpy (name_nonreloc, (Ibyte *) "../lib-src/");
256 qxestrcat (name_nonreloc, XSTRING_DATA (file)); 256 qxestrcat (name_nonreloc, XSTRING_DATA (file));
257 257
258 fd = qxe_open (name_nonreloc, O_RDONLY | OPEN_BINARY, 0); 258 fd = qxe_open (name_nonreloc, O_RDONLY | OPEN_BINARY, 0);
259 } 259 }
260 #endif /* CANNOT_DUMP */ 260 #endif /* CANNOT_DUMP */
420 UNGCPRO; 420 UNGCPRO;
421 return doc; 421 return doc;
422 } 422 }
423 423
424 static void 424 static void
425 weird_doc (Lisp_Object sym, const CIntbyte *weirdness, const CIntbyte *type, 425 weird_doc (Lisp_Object sym, const CIbyte *weirdness, const CIbyte *type,
426 int pos) 426 int pos)
427 { 427 {
428 if (!strcmp (weirdness, GETTEXT ("duplicate"))) return; 428 if (!strcmp (weirdness, GETTEXT ("duplicate"))) return;
429 message ("Note: Strange doc (%s) for %s %s @ %d", 429 message ("Note: Strange doc (%s) for %s %s @ %d",
430 weirdness, type, XSTRING_DATA (XSYMBOL (sym)->name), pos); 430 weirdness, type, XSTRING_DATA (XSYMBOL (sym)->name), pos);
439 when doc strings are referred to in the dumped Emacs. 439 when doc strings are referred to in the dumped Emacs.
440 */ 440 */
441 (filename)) 441 (filename))
442 { 442 {
443 int fd; 443 int fd;
444 Intbyte buf[1024 + 1]; 444 Ibyte buf[1024 + 1];
445 REGISTER int filled; 445 REGISTER int filled;
446 REGISTER int pos; 446 REGISTER int pos;
447 REGISTER Intbyte *p, *end; 447 REGISTER Ibyte *p, *end;
448 Lisp_Object sym, fun, tem; 448 Lisp_Object sym, fun, tem;
449 Intbyte *name; 449 Ibyte *name;
450 450
451 /* This function should not pass the data it's reading through a coding 451 /* This function should not pass the data it's reading through a coding
452 stream. The reason is that the only purpose of this function is to 452 stream. The reason is that the only purpose of this function is to
453 find the file offsets for the documentation of the various functions, 453 find the file offsets for the documentation of the various functions,
454 not do anything with the documentation itself. If we pass through a 454 not do anything with the documentation itself. If we pass through a
465 465
466 #ifdef CANNOT_DUMP 466 #ifdef CANNOT_DUMP
467 if (!NILP (Vdoc_directory)) 467 if (!NILP (Vdoc_directory))
468 { 468 {
469 CHECK_STRING (Vdoc_directory); 469 CHECK_STRING (Vdoc_directory);
470 name = alloca_intbytes (XSTRING_LENGTH (filename) 470 name = alloca_ibytes (XSTRING_LENGTH (filename)
471 + XSTRING_LENGTH (Vdoc_directory) 471 + XSTRING_LENGTH (Vdoc_directory)
472 + 1); 472 + 1);
473 qxestrcpy (name, XSTRING_DATA (Vdoc_directory)); 473 qxestrcpy (name, XSTRING_DATA (Vdoc_directory));
474 } 474 }
475 else 475 else
476 #endif /* CANNOT_DUMP */ 476 #endif /* CANNOT_DUMP */
477 { 477 {
478 name = alloca_intbytes (XSTRING_LENGTH (filename) + 14); 478 name = alloca_ibytes (XSTRING_LENGTH (filename) + 14);
479 qxestrcpy (name, (Intbyte *) "../lib-src/"); 479 qxestrcpy (name, (Ibyte *) "../lib-src/");
480 } 480 }
481 481
482 qxestrcat (name, XSTRING_DATA (filename)); 482 qxestrcat (name, XSTRING_DATA (filename));
483 483
484 fd = qxe_open (name, O_RDONLY | OPEN_BINARY, 0); 484 fd = qxe_open (name, O_RDONLY | OPEN_BINARY, 0);
799 thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ into the output. 799 thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ into the output.
800 */ 800 */
801 (string)) 801 (string))
802 { 802 {
803 /* This function can GC */ 803 /* This function can GC */
804 Intbyte *buf; 804 Ibyte *buf;
805 int changed = 0; 805 int changed = 0;
806 REGISTER Intbyte *strdata; 806 REGISTER Ibyte *strdata;
807 REGISTER Intbyte *bufp; 807 REGISTER Ibyte *bufp;
808 Bytecount strlength; 808 Bytecount strlength;
809 Bytecount idx; 809 Bytecount idx;
810 Bytecount bsize; 810 Bytecount bsize;
811 Intbyte *new; 811 Ibyte *new;
812 Lisp_Object tem = Qnil; 812 Lisp_Object tem = Qnil;
813 Lisp_Object keymap = Qnil; 813 Lisp_Object keymap = Qnil;
814 Lisp_Object name = Qnil; 814 Lisp_Object name = Qnil;
815 Intbyte *start; 815 Ibyte *start;
816 Bytecount length; 816 Bytecount length;
817 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 817 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
818 818
819 if (NILP (string)) 819 if (NILP (string))
820 return Qnil; 820 return Qnil;
845 */ 845 */
846 #endif 846 #endif
847 847
848 strlength = XSTRING_LENGTH (string); 848 strlength = XSTRING_LENGTH (string);
849 bsize = 1 + strlength; 849 bsize = 1 + strlength;
850 buf = (Intbyte *) xmalloc (bsize); 850 buf = (Ibyte *) xmalloc (bsize);
851 bufp = buf; 851 bufp = buf;
852 852
853 /* Have to reset strdata every time GC might be called */ 853 /* Have to reset strdata every time GC might be called */
854 strdata = XSTRING_DATA (string); 854 strdata = XSTRING_DATA (string);
855 for (idx = 0; idx < strlength; ) 855 for (idx = 0; idx < strlength; )
856 { 856 {
857 Intbyte *strp = strdata + idx; 857 Ibyte *strp = strdata + idx;
858 858
859 if (strp[0] != '\\') 859 if (strp[0] != '\\')
860 { 860 {
861 /* just copy other chars */ 861 /* just copy other chars */
862 /* As it happens, this will work with Mule even if the 862 /* As it happens, this will work with Mule even if the
917 } 917 }
918 #endif 918 #endif
919 919
920 if (NILP (tem)) /* but not on any keys */ 920 if (NILP (tem)) /* but not on any keys */
921 { 921 {
922 new = (Intbyte *) xrealloc (buf, bsize += 4); 922 new = (Ibyte *) xrealloc (buf, bsize += 4);
923 bufp += new - buf; 923 bufp += new - buf;
924 buf = new; 924 buf = new;
925 memcpy (bufp, "M-x ", 4); 925 memcpy (bufp, "M-x ", 4);
926 bufp += 4; 926 bufp += 4;
927 goto subst; 927 goto subst;
991 subst_string: 991 subst_string:
992 start = XSTRING_DATA (tem); 992 start = XSTRING_DATA (tem);
993 length = XSTRING_LENGTH (tem); 993 length = XSTRING_LENGTH (tem);
994 subst: 994 subst:
995 bsize += length; 995 bsize += length;
996 new = (Intbyte *) xrealloc (buf, bsize); 996 new = (Ibyte *) xrealloc (buf, bsize);
997 bufp += new - buf; 997 bufp += new - buf;
998 buf = new; 998 buf = new;
999 memcpy (bufp, start, length); 999 memcpy (bufp, start, length);
1000 bufp += length; 1000 bufp += length;
1001 1001