Mercurial > hg > xemacs-beta
comparison src/elhash.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 | bcda0b3445a6 |
children | 190b164ddcac |
comparison
equal
deleted
inserted
replaced
562:c775bd016b32 | 563:183866b06e0b |
---|---|
576 Error_behavior errb) | 576 Error_behavior errb) |
577 { | 577 { |
578 if (NATNUMP (value)) | 578 if (NATNUMP (value)) |
579 return 1; | 579 return 1; |
580 | 580 |
581 maybe_signal_error (Qwrong_type_argument, list2 (Qnatnump, value), | 581 maybe_signal_error_1 (Qwrong_type_argument, list2 (Qnatnump, value), |
582 Qhash_table, errb); | 582 Qhash_table, errb); |
583 return 0; | 583 return 0; |
584 } | 584 } |
585 | 585 |
586 static size_t | 586 static size_t |
605 if (EQ (value, Qweak)) return 1; | 605 if (EQ (value, Qweak)) return 1; |
606 if (EQ (value, Qkey_weak)) return 1; | 606 if (EQ (value, Qkey_weak)) return 1; |
607 if (EQ (value, Qkey_or_value_weak)) return 1; | 607 if (EQ (value, Qkey_or_value_weak)) return 1; |
608 if (EQ (value, Qvalue_weak)) return 1; | 608 if (EQ (value, Qvalue_weak)) return 1; |
609 | 609 |
610 maybe_signal_simple_error ("Invalid hash table weakness", | 610 maybe_invalid_constant ("Invalid hash table weakness", |
611 value, Qhash_table, errb); | 611 value, Qhash_table, errb); |
612 return 0; | 612 return 0; |
613 } | 613 } |
614 | 614 |
615 static enum hash_table_weakness | 615 static enum hash_table_weakness |
627 if (EQ (obj, Qweak)) return HASH_TABLE_WEAK; | 627 if (EQ (obj, Qweak)) return HASH_TABLE_WEAK; |
628 if (EQ (obj, Qkey_weak)) return HASH_TABLE_KEY_WEAK; | 628 if (EQ (obj, Qkey_weak)) return HASH_TABLE_KEY_WEAK; |
629 if (EQ (obj, Qkey_or_value_weak)) return HASH_TABLE_KEY_VALUE_WEAK; | 629 if (EQ (obj, Qkey_or_value_weak)) return HASH_TABLE_KEY_VALUE_WEAK; |
630 if (EQ (obj, Qvalue_weak)) return HASH_TABLE_VALUE_WEAK; | 630 if (EQ (obj, Qvalue_weak)) return HASH_TABLE_VALUE_WEAK; |
631 | 631 |
632 signal_simple_error ("Invalid hash table weakness", obj); | 632 invalid_constant ("Invalid hash table weakness", obj); |
633 return HASH_TABLE_NON_WEAK; /* not reached */ | 633 return HASH_TABLE_NON_WEAK; /* not reached */ |
634 } | 634 } |
635 | 635 |
636 static int | 636 static int |
637 hash_table_test_validate (Lisp_Object keyword, Lisp_Object value, | 637 hash_table_test_validate (Lisp_Object keyword, Lisp_Object value, |
640 if (EQ (value, Qnil)) return 1; | 640 if (EQ (value, Qnil)) return 1; |
641 if (EQ (value, Qeq)) return 1; | 641 if (EQ (value, Qeq)) return 1; |
642 if (EQ (value, Qequal)) return 1; | 642 if (EQ (value, Qequal)) return 1; |
643 if (EQ (value, Qeql)) return 1; | 643 if (EQ (value, Qeql)) return 1; |
644 | 644 |
645 maybe_signal_simple_error ("Invalid hash table test", | 645 maybe_invalid_constant ("Invalid hash table test", |
646 value, Qhash_table, errb); | 646 value, Qhash_table, errb); |
647 return 0; | 647 return 0; |
648 } | 648 } |
649 | 649 |
650 static enum hash_table_test | 650 static enum hash_table_test |
653 if (EQ (obj, Qnil)) return HASH_TABLE_EQL; | 653 if (EQ (obj, Qnil)) return HASH_TABLE_EQL; |
654 if (EQ (obj, Qeq)) return HASH_TABLE_EQ; | 654 if (EQ (obj, Qeq)) return HASH_TABLE_EQ; |
655 if (EQ (obj, Qequal)) return HASH_TABLE_EQUAL; | 655 if (EQ (obj, Qequal)) return HASH_TABLE_EQUAL; |
656 if (EQ (obj, Qeql)) return HASH_TABLE_EQL; | 656 if (EQ (obj, Qeql)) return HASH_TABLE_EQL; |
657 | 657 |
658 signal_simple_error ("Invalid hash table test", obj); | 658 invalid_constant ("Invalid hash table test", obj); |
659 return HASH_TABLE_EQ; /* not reached */ | 659 return HASH_TABLE_EQ; /* not reached */ |
660 } | 660 } |
661 | 661 |
662 static int | 662 static int |
663 hash_table_rehash_size_validate (Lisp_Object keyword, Lisp_Object value, | 663 hash_table_rehash_size_validate (Lisp_Object keyword, Lisp_Object value, |
664 Error_behavior errb) | 664 Error_behavior errb) |
665 { | 665 { |
666 if (!FLOATP (value)) | 666 if (!FLOATP (value)) |
667 { | 667 { |
668 maybe_signal_error (Qwrong_type_argument, list2 (Qfloatp, value), | 668 maybe_signal_error_1 (Qwrong_type_argument, list2 (Qfloatp, value), |
669 Qhash_table, errb); | 669 Qhash_table, errb); |
670 return 0; | 670 return 0; |
671 } | 671 } |
672 | 672 |
673 { | 673 { |
674 double rehash_size = XFLOAT_DATA (value); | 674 double rehash_size = XFLOAT_DATA (value); |
675 if (rehash_size <= 1.0) | 675 if (rehash_size <= 1.0) |
676 { | 676 { |
677 maybe_signal_simple_error | 677 maybe_invalid_argument |
678 ("Hash table rehash size must be greater than 1.0", | 678 ("Hash table rehash size must be greater than 1.0", |
679 value, Qhash_table, errb); | 679 value, Qhash_table, errb); |
680 return 0; | 680 return 0; |
681 } | 681 } |
682 } | 682 } |
694 hash_table_rehash_threshold_validate (Lisp_Object keyword, Lisp_Object value, | 694 hash_table_rehash_threshold_validate (Lisp_Object keyword, Lisp_Object value, |
695 Error_behavior errb) | 695 Error_behavior errb) |
696 { | 696 { |
697 if (!FLOATP (value)) | 697 if (!FLOATP (value)) |
698 { | 698 { |
699 maybe_signal_error (Qwrong_type_argument, list2 (Qfloatp, value), | 699 maybe_signal_error_1 (Qwrong_type_argument, list2 (Qfloatp, value), |
700 Qhash_table, errb); | 700 Qhash_table, errb); |
701 return 0; | 701 return 0; |
702 } | 702 } |
703 | 703 |
704 { | 704 { |
705 double rehash_threshold = XFLOAT_DATA (value); | 705 double rehash_threshold = XFLOAT_DATA (value); |
706 if (rehash_threshold <= 0.0 || rehash_threshold >= 1.0) | 706 if (rehash_threshold <= 0.0 || rehash_threshold >= 1.0) |
707 { | 707 { |
708 maybe_signal_simple_error | 708 maybe_invalid_argument |
709 ("Hash table rehash threshold must be between 0.0 and 1.0", | 709 ("Hash table rehash threshold must be between 0.0 and 1.0", |
710 value, Qhash_table, errb); | 710 value, Qhash_table, errb); |
711 return 0; | 711 return 0; |
712 } | 712 } |
713 } | 713 } |
729 | 729 |
730 GET_EXTERNAL_LIST_LENGTH (value, len); | 730 GET_EXTERNAL_LIST_LENGTH (value, len); |
731 | 731 |
732 if (len & 1) | 732 if (len & 1) |
733 { | 733 { |
734 maybe_signal_simple_error | 734 maybe_sferror |
735 ("Hash table data must have alternating key/value pairs", | 735 ("Hash table data must have alternating key/value pairs", |
736 value, Qhash_table, errb); | 736 value, Qhash_table, errb); |
737 return 0; | 737 return 0; |
738 } | 738 } |
739 return 1; | 739 return 1; |
907 else if (EQ (keyword, Q_size)) size = value; | 907 else if (EQ (keyword, Q_size)) size = value; |
908 else if (EQ (keyword, Q_rehash_size)) rehash_size = value; | 908 else if (EQ (keyword, Q_rehash_size)) rehash_size = value; |
909 else if (EQ (keyword, Q_rehash_threshold)) rehash_threshold = value; | 909 else if (EQ (keyword, Q_rehash_threshold)) rehash_threshold = value; |
910 else if (EQ (keyword, Q_weakness)) weakness = value; | 910 else if (EQ (keyword, Q_weakness)) weakness = value; |
911 else if (EQ (keyword, Q_type))/*obsolete*/ weakness = value; | 911 else if (EQ (keyword, Q_type))/*obsolete*/ weakness = value; |
912 else signal_simple_error ("Invalid hash table property keyword", keyword); | 912 else invalid_constant ("Invalid hash table property keyword", keyword); |
913 } | 913 } |
914 | 914 |
915 if (i < nargs) | 915 if (i < nargs) |
916 signal_simple_error ("Hash table property requires a value", args[i]); | 916 sferror ("Hash table property requires a value", args[i]); |
917 | 917 |
918 #define VALIDATE_VAR(var) \ | 918 #define VALIDATE_VAR(var) \ |
919 if (!NILP (var)) hash_table_##var##_validate (Q##var, var, ERROR_ME); | 919 if (!NILP (var)) hash_table_##var##_validate (Q##var, var, ERROR_ME); |
920 | 920 |
921 VALIDATE_VAR (test); | 921 VALIDATE_VAR (test); |
1663 DEFSUBR (Fsxhash); | 1663 DEFSUBR (Fsxhash); |
1664 #if 0 | 1664 #if 0 |
1665 DEFSUBR (Finternal_hash_value); | 1665 DEFSUBR (Finternal_hash_value); |
1666 #endif | 1666 #endif |
1667 | 1667 |
1668 defsymbol (&Qhash_tablep, "hash-table-p"); | 1668 DEFSYMBOL_MULTIWORD_PREDICATE (Qhash_tablep); |
1669 defsymbol (&Qhash_table, "hash-table"); | 1669 DEFSYMBOL (Qhash_table); |
1670 defsymbol (&Qhashtable, "hashtable"); | 1670 DEFSYMBOL (Qhashtable); |
1671 defsymbol (&Qweakness, "weakness"); | 1671 DEFSYMBOL (Qweakness); |
1672 defsymbol (&Qvalue, "value"); | 1672 DEFSYMBOL (Qvalue); |
1673 defsymbol (&Qkey_or_value, "key-or-value"); | 1673 DEFSYMBOL (Qkey_or_value); |
1674 defsymbol (&Qkey_and_value, "key-and-value"); | 1674 DEFSYMBOL (Qkey_and_value); |
1675 defsymbol (&Qrehash_size, "rehash-size"); | 1675 DEFSYMBOL (Qrehash_size); |
1676 defsymbol (&Qrehash_threshold, "rehash-threshold"); | 1676 DEFSYMBOL (Qrehash_threshold); |
1677 | 1677 |
1678 defsymbol (&Qweak, "weak"); /* obsolete */ | 1678 DEFSYMBOL (Qweak); /* obsolete */ |
1679 defsymbol (&Qkey_weak, "key-weak"); /* obsolete */ | 1679 DEFSYMBOL (Qkey_weak); /* obsolete */ |
1680 defsymbol (&Qkey_or_value_weak, "key-or-value-weak"); /* obsolete */ | 1680 DEFSYMBOL (Qkey_or_value_weak); /* obsolete */ |
1681 defsymbol (&Qvalue_weak, "value-weak"); /* obsolete */ | 1681 DEFSYMBOL (Qvalue_weak); /* obsolete */ |
1682 defsymbol (&Qnon_weak, "non-weak"); /* obsolete */ | 1682 DEFSYMBOL (Qnon_weak); /* obsolete */ |
1683 | 1683 |
1684 defkeyword (&Q_test, ":test"); | 1684 DEFKEYWORD (Q_test); |
1685 defkeyword (&Q_size, ":size"); | 1685 DEFKEYWORD (Q_size); |
1686 defkeyword (&Q_rehash_size, ":rehash-size"); | 1686 DEFKEYWORD (Q_rehash_size); |
1687 defkeyword (&Q_rehash_threshold, ":rehash-threshold"); | 1687 DEFKEYWORD (Q_rehash_threshold); |
1688 defkeyword (&Q_weakness, ":weakness"); | 1688 DEFKEYWORD (Q_weakness); |
1689 defkeyword (&Q_type, ":type"); /* obsolete */ | 1689 DEFKEYWORD (Q_type); /* obsolete */ |
1690 } | 1690 } |
1691 | 1691 |
1692 void | 1692 void |
1693 vars_of_elhash (void) | 1693 vars_of_elhash (void) |
1694 { | 1694 { |