comparison src/editfns.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 54fa1a5c2d12
children 5fd7ba8b56e7
comparison
equal deleted inserted replaced
562:c775bd016b32 563:183866b06e0b
109 109
110 if (EVENTP (character)) 110 if (EVENTP (character))
111 { 111 {
112 Lisp_Object ch2 = Fevent_to_character (character, Qt, Qnil, Qnil); 112 Lisp_Object ch2 = Fevent_to_character (character, Qt, Qnil, Qnil);
113 if (NILP (ch2)) 113 if (NILP (ch2))
114 return 114 invalid_argument
115 signal_simple_continuable_error 115 ("character has no ASCII equivalent:", Fcopy_event (character, Qnil));
116 ("character has no ASCII equivalent:", Fcopy_event (character, Qnil));
117 character = ch2; 116 character = ch2;
118 } 117 }
119 118
120 CHECK_CHAR_COERCE_INT (character); 119 CHECK_CHAR_COERCE_INT (character);
121 120
232 if (!NILP (Vtransient_mark_mode) && NILP (Vmark_even_if_inactive) 231 if (!NILP (Vtransient_mark_mode) && NILP (Vmark_even_if_inactive)
233 && NILP (b->mark_active)) 232 && NILP (b->mark_active))
234 Fsignal (Qmark_inactive, Qnil); 233 Fsignal (Qmark_inactive, Qnil);
235 #endif 234 #endif
236 m = Fmarker_position (b->mark); 235 m = Fmarker_position (b->mark);
237 if (NILP (m)) error ("There is no region now"); 236 if (NILP (m)) invalid_operation ("There is no region now", Qunbound);
238 if (!!(BUF_PT (b) < XINT (m)) == !!beginningp) 237 if (!!(BUF_PT (b) < XINT (m)) == !!beginningp)
239 return make_int (BUF_PT (b)); 238 return make_int (BUF_PT (b));
240 else 239 else
241 return m; 240 return m;
242 } 241 }
1108 size_t size; 1107 size_t size;
1109 1108
1110 CHECK_STRING (format_string); 1109 CHECK_STRING (format_string);
1111 1110
1112 if (! lisp_to_time (time_, &value)) 1111 if (! lisp_to_time (time_, &value))
1113 error ("Invalid time specification"); 1112 invalid_argument ("Invalid time specification", Qunbound);
1114 1113
1115 /* This is probably enough. */ 1114 /* This is probably enough. */
1116 size = XSTRING_LENGTH (format_string) * 6 + 50; 1115 size = XSTRING_LENGTH (format_string) * 6 + 50;
1117 1116
1118 while (1) 1117 while (1)
1149 struct tm save_tm; 1148 struct tm save_tm;
1150 struct tm *decoded_time; 1149 struct tm *decoded_time;
1151 Lisp_Object list_args[9]; 1150 Lisp_Object list_args[9];
1152 1151
1153 if (! lisp_to_time (specified_time, &time_spec)) 1152 if (! lisp_to_time (specified_time, &time_spec))
1154 error ("Invalid time specification"); 1153 invalid_argument ("Invalid time specification", Qunbound);
1155 1154
1156 decoded_time = localtime (&time_spec); 1155 decoded_time = localtime (&time_spec);
1157 list_args[0] = make_int (decoded_time->tm_sec); 1156 list_args[0] = make_int (decoded_time->tm_sec);
1158 list_args[1] = make_int (decoded_time->tm_min); 1157 list_args[1] = make_int (decoded_time->tm_min);
1159 list_args[2] = make_int (decoded_time->tm_hour); 1158 list_args[2] = make_int (decoded_time->tm_hour);
1226 sprintf (tzbuf, "XXX%s%d:%02d:%02d", "-" + (XINT (zone) < 0), 1225 sprintf (tzbuf, "XXX%s%d:%02d:%02d", "-" + (XINT (zone) < 0),
1227 abszone / (60*60), (abszone/60) % 60, abszone % 60); 1226 abszone / (60*60), (abszone/60) % 60, abszone % 60);
1228 tzstring = tzbuf; 1227 tzstring = tzbuf;
1229 } 1228 }
1230 else 1229 else
1231 error ("Invalid time zone specification"); 1230 invalid_argument ("Invalid time zone specification", Qunbound);
1232 1231
1233 /* Set TZ before calling mktime; merely adjusting mktime's returned 1232 /* Set TZ before calling mktime; merely adjusting mktime's returned
1234 value doesn't suffice, since that would mishandle leap seconds. */ 1233 value doesn't suffice, since that would mishandle leap seconds. */
1235 set_time_zone_rule (tzstring); 1234 set_time_zone_rule (tzstring);
1236 1235
1244 tzset (); 1243 tzset ();
1245 #endif 1244 #endif
1246 } 1245 }
1247 1246
1248 if (the_time == (time_t) -1) 1247 if (the_time == (time_t) -1)
1249 error ("Specified time is not representable"); 1248 invalid_argument ("Specified time is not representable", Qunbound);
1250 1249
1251 return wasteful_word_to_lisp (the_time); 1250 return wasteful_word_to_lisp (the_time);
1252 } 1251 }
1253 1252
1254 DEFUN ("current-time-string", Fcurrent_time_string, 0, 1, 0, /* 1253 DEFUN ("current-time-string", Fcurrent_time_string, 0, 1, 0, /*
2380 2379
2381 len1 = endr1 - startr1; 2380 len1 = endr1 - startr1;
2382 len2 = endr2 - startr2; 2381 len2 = endr2 - startr2;
2383 2382
2384 if (startr2 < endr1) 2383 if (startr2 < endr1)
2385 error ("transposed regions not properly ordered"); 2384 invalid_argument ("transposed regions not properly ordered", Qunbound);
2386 else if (startr1 == endr1 || startr2 == endr2) 2385 else if (startr1 == endr1 || startr2 == endr2)
2387 error ("transposed region may not be of length 0"); 2386 invalid_argument ("transposed region may not be of length 0", Qunbound);
2388 2387
2389 string1 = make_string_from_buffer (buf, startr1, len1); 2388 string1 = make_string_from_buffer (buf, startr1, len1);
2390 string2 = make_string_from_buffer (buf, startr2, len2); 2389 string2 = make_string_from_buffer (buf, startr2, len2);
2391 buffer_delete_range (buf, startr2, endr2, 0); 2390 buffer_delete_range (buf, startr2, endr2, 0);
2392 buffer_insert_lisp_string_1 (buf, startr2, string1, 0); 2391 buffer_insert_lisp_string_1 (buf, startr2, string1, 0);
2407 /************************************************************************/ 2406 /************************************************************************/
2408 2407
2409 void 2408 void
2410 syms_of_editfns (void) 2409 syms_of_editfns (void)
2411 { 2410 {
2412 defsymbol (&Qpoint, "point"); 2411 DEFSYMBOL (Qpoint);
2413 defsymbol (&Qmark, "mark"); 2412 DEFSYMBOL (Qmark);
2414 defsymbol (&Qregion_beginning, "region-beginning"); 2413 DEFSYMBOL (Qregion_beginning);
2415 defsymbol (&Qregion_end, "region-end"); 2414 DEFSYMBOL (Qregion_end);
2416 defsymbol (&Qformat, "format"); 2415 DEFSYMBOL (Qformat);
2417 defsymbol (&Quser_files_and_directories, "user-files-and-directories"); 2416 DEFSYMBOL (Quser_files_and_directories);
2418 2417
2419 DEFSUBR (Fchar_equal); 2418 DEFSUBR (Fchar_equal);
2420 DEFSUBR (Fchar_Equal); 2419 DEFSUBR (Fchar_Equal);
2421 DEFSUBR (Fgoto_char); 2420 DEFSUBR (Fgoto_char);
2422 DEFSUBR (Fstring_to_char); 2421 DEFSUBR (Fstring_to_char);
2478 DEFSUBR (Fwiden); 2477 DEFSUBR (Fwiden);
2479 DEFSUBR (Fnarrow_to_region); 2478 DEFSUBR (Fnarrow_to_region);
2480 DEFSUBR (Fsave_restriction); 2479 DEFSUBR (Fsave_restriction);
2481 DEFSUBR (Ftranspose_regions); 2480 DEFSUBR (Ftranspose_regions);
2482 2481
2483 defsymbol (&Qzmacs_update_region, "zmacs-update-region"); 2482 DEFSYMBOL (Qzmacs_update_region);
2484 defsymbol (&Qzmacs_deactivate_region, "zmacs-deactivate-region"); 2483 DEFSYMBOL (Qzmacs_deactivate_region);
2485 defsymbol (&Qzmacs_region_buffer, "zmacs-region-buffer"); 2484 DEFSYMBOL (Qzmacs_region_buffer);
2486 } 2485 }
2487 2486
2488 void 2487 void
2489 vars_of_editfns (void) 2488 vars_of_editfns (void)
2490 { 2489 {