comparison src/events.c @ 5438:8d29f1c4bb98

Merge with 21.5 trunk.
author Mats Lidell <matsl@xemacs.org>
date Fri, 26 Nov 2010 06:43:36 +0100
parents 308d34e9f07d c096d8051f89
children 56144c8593a8
comparison
equal deleted inserted replaced
5437:002cb5224e4f 5438:8d29f1c4bb98
637 break; 637 break;
638 } 638 }
639 } 639 }
640 else if (EQ (keyword, Qbutton)) 640 else if (EQ (keyword, Qbutton))
641 { 641 {
642 CHECK_NATNUM (value); 642 check_integer_range (value, Qzero, make_int (26));
643 check_int_range (XINT (value), 0, 7);
644 643
645 switch (EVENT_TYPE (e)) 644 switch (EVENT_TYPE (e))
646 { 645 {
647 case button_press_event: 646 case button_press_event:
648 case button_release_event: 647 case button_release_event:
733 break; 732 break;
734 } 733 }
735 } 734 }
736 else if (EQ (keyword, Qtimestamp)) 735 else if (EQ (keyword, Qtimestamp))
737 { 736 {
738 CHECK_NATNUM (value); 737 #ifdef HAVE_BIGNUM
739 SET_EVENT_TIMESTAMP (e, XINT (value)); 738 check_integer_range (value, Qzero, make_integer (UINT_MAX));
739 if (BIGNUMP (value))
740 {
741 SET_EVENT_TIMESTAMP (e, bignum_to_uint (XBIGNUM_DATA (value)));
742 }
743 #else
744 check_integer_range (value, Qzero, make_integer (EMACS_INT_MAX));
745 #endif
746 if (INTP (value))
747 {
748 SET_EVENT_TIMESTAMP (e, XINT (value));
749 }
750 else
751 {
752 ABORT ();
753 }
740 } 754 }
741 else if (EQ (keyword, Qfunction)) 755 else if (EQ (keyword, Qfunction))
742 { 756 {
743 switch (EVENT_TYPE (e)) 757 switch (EVENT_TYPE (e))
744 { 758 {
1743 */ 1757 */
1744 (event)) 1758 (event))
1745 { 1759 {
1746 CHECK_LIVE_EVENT (event); 1760 CHECK_LIVE_EVENT (event);
1747 /* This junk is so that timestamps don't get to be negative, but contain 1761 /* This junk is so that timestamps don't get to be negative, but contain
1748 as many bits as this particular emacs will allow. 1762 as many bits as this particular emacs will allow. We could return
1763 bignums on builds that support them, but that involves consing and
1764 doesn't work on builds that don't support bignums.
1749 */ 1765 */
1750 return make_int (EMACS_INT_MAX & XEVENT_TIMESTAMP (event)); 1766 return make_int (EMACS_INT_MAX & XEVENT_TIMESTAMP (event));
1751 } 1767 }
1752 1768
1753 #define TIMESTAMP_HALFSPACE (1L << (INT_VALBITS - 2)) 1769 #define TIMESTAMP_HALFSPACE (1L << (INT_VALBITS - 2))
1759 */ 1775 */
1760 (time1, time2)) 1776 (time1, time2))
1761 { 1777 {
1762 EMACS_INT t1, t2; 1778 EMACS_INT t1, t2;
1763 1779
1764 CHECK_NATNUM (time1); 1780 check_integer_range (time1, Qzero, make_integer (EMACS_INT_MAX));
1765 CHECK_NATNUM (time2); 1781 check_integer_range (time2, Qzero, make_integer (EMACS_INT_MAX));
1782
1766 t1 = XINT (time1); 1783 t1 = XINT (time1);
1767 t2 = XINT (time2); 1784 t2 = XINT (time2);
1768 1785
1769 if (t1 < t2) 1786 if (t1 < t2)
1770 return t2 - t1 < TIMESTAMP_HALFSPACE ? Qt : Qnil; 1787 return t2 - t1 < TIMESTAMP_HALFSPACE ? Qt : Qnil;