comparison src/doprnt.c @ 563:183866b06e0b

[xemacs-hg @ 2001-05-24 07:50:48 by ben] Makefile.in.in, abbrev.c, alloc.c, buffer.c, bytecode.c, callint.c, callproc.c, casetab.c, chartab.c, cmdloop.c, cmds.c, console-msw.c, console-msw.h, console-stream.c, console-tty.c, console-x.c, console.c, data.c, database.c, debug.c, device-gtk.c, device-msw.c, device-tty.c, device-x.c, device.c, dialog-gtk.c, dialog-msw.c, dialog-x.c, dialog.c, dired-msw.c, dired.c, doc.c, doprnt.c, dragdrop.c, editfns.c, eldap.c, eldap.h, elhash.c, emacs-widget-accessors.c, emacs.c, emodules.c, esd.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, events.c, extents.c, faces.c, file-coding.c, fileio.c, filelock.c, floatfns.c, fns.c, font-lock.c, frame-gtk.c, frame-x.c, frame.c, general-slots.h, glade.c, glyphs-gtk.c, glyphs-msw.c, glyphs-widget.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gui-gtk.c, gui-x.c, gui.c, gutter.c, hpplay.c, indent.c, input-method-xlib.c, insdel.c, intl.c, keymap.c, libsst.c, libsst.h, linuxplay.c, lisp.h, lread.c, lstream.c, lstream.h, macros.c, marker.c, md5.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, miscplay.c, miscplay.h, mule-ccl.c, mule-charset.c, mule-wnnfns.c, mule.c, nas.c, ntplay.c, ntproc.c, objects-gtk.c, objects-msw.c, objects-x.c, objects.c, postgresql.c, print.c, process-nt.c, process-unix.c, process.c, ralloc.c, rangetab.c, redisplay.c, scrollbar.c, search.c, select-gtk.c, select-x.c, select.c, sgiplay.c, sheap.c, sound.c, specifier.c, sunplay.c, symbols.c, symeval.h, symsinit.h, syntax.c, sysdep.c, toolbar-msw.c, toolbar.c, tooltalk.c, ui-byhand.c, ui-gtk.c, undo.c, unexaix.c, unexapollo.c, unexconvex.c, unexec.c, widget.c, win32.c, window.c: -- defsymbol -> DEFSYMBOL. -- add an error type to all errors. -- eliminate the error functions in eval.c that let you just use Qerror as the type. -- redo the error API to be more consistent, sensibly named, and easier to use. -- redo the error hierarchy somewhat. create new errors: structure-formation-error, gui-error, invalid-constant, stack-overflow, out-of-memory, process-error, network-error, sound-error, printing-unreadable-object, base64-conversion- error; coding-system-error renamed to text-conversion error; some others. -- fix Mule problems in error strings in emodules.c, tooltalk.c. -- fix error handling in mswin open-network-stream. -- Mule-ize all sound files and clean up the headers. -- nativesound.h -> sound.h and used for all sound files. -- move some shared stuff into glyphs-shared.c: first attempt at eliminating some of the massive GTK code duplication. xemacs.mak: add glyphs-shared.c. xemacs-faq.texi: document how to debug X errors subr.el: fix doc string to reflect reality
author ben
date Thu, 24 May 2001 07:51:33 +0000
parents 3078fd1074e8
children 430f8ca10ca6
comparison
equal deleted inserted replaced
562:c775bd016b32 563:183866b06e0b
128 128
129 *returned_num = -1; 129 *returned_num = -1;
130 while (start != end && isdigit (*start)) 130 while (start != end && isdigit (*start))
131 { 131 {
132 if ((size_t) (arg_ptr - arg_convert) >= sizeof (arg_convert) - 1) 132 if ((size_t) (arg_ptr - arg_convert) >= sizeof (arg_convert) - 1)
133 error ("Format converter number too large"); 133 syntax_error ("Format converter number too large", Qunbound);
134 *arg_ptr++ = *start++; 134 *arg_ptr++ = *start++;
135 } 135 }
136 *arg_ptr = '\0'; 136 *arg_ptr = '\0';
137 if (arg_convert != arg_ptr) 137 if (arg_convert != arg_ptr)
138 *returned_num = atoi ((char *) arg_convert); 138 *returned_num = atoi ((char *) arg_convert);
140 } 140 }
141 141
142 #define NEXT_ASCII_BYTE(ch) \ 142 #define NEXT_ASCII_BYTE(ch) \
143 do { \ 143 do { \
144 if (fmt == fmt_end) \ 144 if (fmt == fmt_end) \
145 error ("Premature end of format string"); \ 145 syntax_error ("Premature end of format string", Qunbound); \
146 ch = *fmt; \ 146 ch = *fmt; \
147 if (ch >= 0200) \ 147 if (ch >= 0200) \
148 error ("Non-ASCII character in format converter spec"); \ 148 syntax_error ("Non-ASCII character in format converter spec", Qunbound); \
149 fmt++; \ 149 fmt++; \
150 } while (0) 150 } while (0)
151 151
152 #define RESOLVE_FLAG_CONFLICTS(spec) \ 152 #define RESOLVE_FLAG_CONFLICTS(spec) \
153 do { \ 153 do { \
294 spec.l_flag = 1; 294 spec.l_flag = 1;
295 NEXT_ASCII_BYTE (ch); 295 NEXT_ASCII_BYTE (ch);
296 } 296 }
297 297
298 if (!strchr (valid_converters, ch)) 298 if (!strchr (valid_converters, ch))
299 error ("Invalid converter character %c", ch); 299 syntax_error ("Invalid converter character", make_char (ch));
300 spec.converter = ch; 300 spec.converter = ch;
301 } 301 }
302 302
303 RESOLVE_FLAG_CONFLICTS(spec); 303 RESOLVE_FLAG_CONFLICTS(spec);
304 Dynarr_add (specs, spec); 304 Dynarr_add (specs, spec);
354 if (spec->argnum == i) 354 if (spec->argnum == i)
355 break; 355 break;
356 } 356 }
357 357
358 if (j == Dynarr_length (specs)) 358 if (j == Dynarr_length (specs))
359 error ("No conversion spec for argument %d", i); 359 syntax_error ("No conversion spec for argument", make_int (i));
360 360
361 ch = spec->converter; 361 ch = spec->converter;
362 362
363 if (strchr (int_converters, ch)) 363 if (strchr (int_converters, ch))
364 { 364 {
423 specs = parse_doprnt_spec (format_nonreloc, format_length); 423 specs = parse_doprnt_spec (format_nonreloc, format_length);
424 if (largs) 424 if (largs)
425 { 425 {
426 /* allow too many args for string, but not too few */ 426 /* allow too many args for string, but not too few */
427 if (nargs < get_args_needed (specs)) 427 if (nargs < get_args_needed (specs))
428 signal_error (Qwrong_number_of_arguments, 428 signal_error_1 (Qwrong_number_of_arguments,
429 list3 (Qformat, 429 list3 (Qformat,
430 make_int (nargs), 430 make_int (nargs),
431 !NILP (format_reloc) ? format_reloc : 431 !NILP (format_reloc) ? format_reloc :
432 make_string (format_nonreloc, format_length))); 432 make_string (format_nonreloc, format_length)));
433 } 433 }
491 } 491 }
492 continue; 492 continue;
493 } 493 }
494 494
495 if (largs && (spec->argnum < 1 || spec->argnum > nargs)) 495 if (largs && (spec->argnum < 1 || spec->argnum > nargs))
496 error ("Invalid repositioning argument %d", spec->argnum); 496 syntax_error ("Invalid repositioning argument", make_int (spec->argnum));
497 497
498 else if (ch == 'S' || ch == 's') 498 else if (ch == 'S' || ch == 's')
499 { 499 {
500 Bufbyte *string; 500 Bufbyte *string;
501 Bytecount string_len; 501 Bytecount string_len;
556 Lisp_Object obj = largs[spec->argnum - 1]; 556 Lisp_Object obj = largs[spec->argnum - 1];
557 if (CHARP (obj)) 557 if (CHARP (obj))
558 obj = make_int (XCHAR (obj)); 558 obj = make_int (XCHAR (obj));
559 if (!INT_OR_FLOATP (obj)) 559 if (!INT_OR_FLOATP (obj))
560 { 560 {
561 error ("format specifier %%%c doesn't match argument type", 561 syntax_error ("format specifier %%%c doesn't match argument type",
562 ch); 562 ch);
563 } 563 }
564 else if (strchr (double_converters, ch)) 564 else if (strchr (double_converters, ch))
565 arg.d = XFLOATINT (obj); 565 arg.d = XFLOATINT (obj);
566 else 566 else
583 Bufbyte charbuf[MAX_EMCHAR_LEN]; 583 Bufbyte charbuf[MAX_EMCHAR_LEN];
584 584
585 a = (Emchar) arg.l; 585 a = (Emchar) arg.l;
586 586
587 if (!valid_char_p (a)) 587 if (!valid_char_p (a))
588 error ("invalid character value %d to %%c spec", a); 588 syntax_error ("invalid character value %d to %%c spec", a);
589 589
590 charlen = set_charptr_emchar (charbuf, a); 590 charlen = set_charptr_emchar (charbuf, a);
591 doprnt_1 (stream, charbuf, charlen, spec->minwidth, 591 doprnt_1 (stream, charbuf, charlen, spec->minwidth,
592 -1, spec->minus_flag, spec->zero_flag); 592 -1, spec->minus_flag, spec->zero_flag);
593 } 593 }