Mercurial > hg > xemacs-beta
comparison src/glyphs-widget.c @ 5581:56144c8593a8
Mechanically change INT to FIXNUM in our sources.
src/ChangeLog addition:
2011-10-09 Aidan Kehoe <kehoea@parhasard.net>
[...]
Mechanically change INT (where it refers to non-bignum Lisp
integers) to FIXNUM in our sources. Done for the following
functions, enums, and macros: Lisp_Type_Int_Even,
Lisp_Type_Int_Odd, INT_GCBITS, INT_VALBITS, make_int(), INTP(),
XINT(), CHECK_INT(), XREALINT(), INT_PLUS(), INT_MINUS(),
EMACS_INT_MAX (to MOST_POSITIVE_FIXNUM), EMACS_INT_MIN (to
MOST_NEGATIVE_FIXNUM), NUMBER_FITS_IN_AN_EMACS_INT() to
NUMBER_FITS_IN_A_FIXNUM(), XFLOATINT, XCHAR_OR_INT, INT_OR_FLOAT.
The EMACS_INT typedef was not changed, it does not describe
non-bignum Lisp integers.
Script that did the change available in
http://mid.gmane.org/20067.17650.181273.12014@parhasard.net .
modules/ChangeLog addition:
2011-10-09 Aidan Kehoe <kehoea@parhasard.net>
[...]
Mechanically change INT to FIXNUM, where the usage describes non-bignum
Lisp integers. See the src/ChangeLog entry for more details.
man/ChangeLog addition:
2011-10-09 Aidan Kehoe <kehoea@parhasard.net>
* internals/internals.texi (How Lisp Objects Are Represented in C):
* internals/internals.texi (Integers and Characters):
Mechanically change INT to FIXNUM, where the usage describes non-bignum
Lisp integers.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sun, 09 Oct 2011 09:51:57 +0100 |
parents | 4dee0387b9de |
children |
comparison
equal
deleted
inserted
replaced
5580:a0e81357194e | 5581:56144c8593a8 |
---|---|
163 } | 163 } |
164 | 164 |
165 static void | 165 static void |
166 check_valid_int_or_function (Lisp_Object data) | 166 check_valid_int_or_function (Lisp_Object data) |
167 { | 167 { |
168 if (!INTP (data) && !CONSP (data) && !SYMBOLP (data)) | 168 if (!FIXNUMP (data) && !CONSP (data) && !SYMBOLP (data)) |
169 invalid_argument ("must be an integer or expresssion", data); | 169 invalid_argument ("must be an integer or expresssion", data); |
170 } | 170 } |
171 | 171 |
172 static void | 172 static void |
173 check_valid_symbol (Lisp_Object data) | 173 check_valid_symbol (Lisp_Object data) |
576 /* Finish off with dynamic sizing. */ | 576 /* Finish off with dynamic sizing. */ |
577 if (width && !NILP (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii))) | 577 if (width && !NILP (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii))) |
578 { | 578 { |
579 dynamic_width = | 579 dynamic_width = |
580 eval_within_redisplay (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii)); | 580 eval_within_redisplay (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii)); |
581 if (INTP (dynamic_width)) | 581 if (FIXNUMP (dynamic_width)) |
582 *width = XINT (dynamic_width); | 582 *width = XFIXNUM (dynamic_width); |
583 } | 583 } |
584 if (height && !NILP (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii))) | 584 if (height && !NILP (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii))) |
585 { | 585 { |
586 dynamic_height = | 586 dynamic_height = |
587 eval_within_redisplay (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii)); | 587 eval_within_redisplay (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii)); |
588 if (INTP (dynamic_height)) | 588 if (FIXNUMP (dynamic_height)) |
589 *height = XINT (dynamic_height); | 589 *height = XFIXNUM (dynamic_height); |
590 } | 590 } |
591 } | 591 } |
592 } | 592 } |
593 | 593 |
594 static int | 594 static int |
768 gives us some explicitly, or there are some constraints that we | 768 gives us some explicitly, or there are some constraints that we |
769 can't change later on. Otherwise we postpone sizing until query | 769 can't change later on. Otherwise we postpone sizing until query |
770 geometry gets called. */ | 770 geometry gets called. */ |
771 if (!NILP (pixwidth)) /* pixwidth takes precendent */ | 771 if (!NILP (pixwidth)) /* pixwidth takes precendent */ |
772 { | 772 { |
773 if (!INTP (pixwidth)) | 773 if (!FIXNUMP (pixwidth)) |
774 IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii) = pixwidth; | 774 IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii) = pixwidth; |
775 else | 775 else |
776 { | 776 { |
777 pw = XINT (pixwidth); | 777 pw = XFIXNUM (pixwidth); |
778 IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii) = 0; | 778 IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii) = 0; |
779 } | 779 } |
780 } | 780 } |
781 else if (!NILP (width)) | 781 else if (!NILP (width)) |
782 { | 782 { |
783 tw = XINT (width); | 783 tw = XFIXNUM (width); |
784 IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii) = 0; | 784 IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii) = 0; |
785 } | 785 } |
786 | 786 |
787 if (!NILP (pixheight)) | 787 if (!NILP (pixheight)) |
788 { | 788 { |
789 if (!INTP (pixheight)) | 789 if (!FIXNUMP (pixheight)) |
790 IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii) = pixheight; | 790 IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii) = pixheight; |
791 else | 791 else |
792 { | 792 { |
793 ph = XINT (pixheight); | 793 ph = XFIXNUM (pixheight); |
794 IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii) = 0; | 794 IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii) = 0; |
795 } | 795 } |
796 } | 796 } |
797 else if (!NILP (height) && XINT (height) > 1) | 797 else if (!NILP (height) && XFIXNUM (height) > 1) |
798 { | 798 { |
799 th = XINT (height); | 799 th = XFIXNUM (height); |
800 IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii) = 0; | 800 IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii) = 0; |
801 } | 801 } |
802 | 802 |
803 /* Taking the default face information when the user has specified | 803 /* Taking the default face information when the user has specified |
804 size in characters is probably as good as any since the widget | 804 size in characters is probably as good as any since the widget |
846 IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii) = 0; | 846 IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii) = 0; |
847 } | 847 } |
848 | 848 |
849 /* Pick up the margin width. */ | 849 /* Pick up the margin width. */ |
850 if (!NILP (mwidth)) | 850 if (!NILP (mwidth)) |
851 IMAGE_INSTANCE_MARGIN_WIDTH (ii) = XINT (mwidth); | 851 IMAGE_INSTANCE_MARGIN_WIDTH (ii) = XFIXNUM (mwidth); |
852 | 852 |
853 IMAGE_INSTANCE_WANTS_INITIAL_FOCUS (ii) = !NILP (ifocus); | 853 IMAGE_INSTANCE_WANTS_INITIAL_FOCUS (ii) = !NILP (ifocus); |
854 | 854 |
855 /* Layout for the layout widget is premature at this point since the | 855 /* Layout for the layout widget is premature at this point since the |
856 children will not have been instantiated. We can't instantiate | 856 children will not have been instantiated. We can't instantiate |
1136 | 1136 |
1137 /* We want to avoid consing if we can. This is quite awkward because | 1137 /* We want to avoid consing if we can. This is quite awkward because |
1138 we have to deal with the border as well as the items. */ | 1138 we have to deal with the border as well as the items. */ |
1139 GCPRO1 (border); | 1139 GCPRO1 (border); |
1140 | 1140 |
1141 if (INTP (IMAGE_INSTANCE_LAYOUT_BORDER (ii))) | 1141 if (FIXNUMP (IMAGE_INSTANCE_LAYOUT_BORDER (ii))) |
1142 { | 1142 { |
1143 border = XCAR (children); | 1143 border = XCAR (children); |
1144 children = XCDR (children); | 1144 children = XCDR (children); |
1145 } | 1145 } |
1146 | 1146 |
1161 else | 1161 else |
1162 { | 1162 { |
1163 border = Fcons (call1 (Qmake_glyph, border_inst), Qnil); | 1163 border = Fcons (call1 (Qmake_glyph, border_inst), Qnil); |
1164 structure_changed = 1; | 1164 structure_changed = 1; |
1165 } | 1165 } |
1166 IMAGE_INSTANCE_LAYOUT_BORDER (ii) = make_int (0); | 1166 IMAGE_INSTANCE_LAYOUT_BORDER (ii) = make_fixnum (0); |
1167 } | 1167 } |
1168 else | 1168 else |
1169 { | 1169 { |
1170 if (!NILP (border)) | 1170 if (!NILP (border)) |
1171 { | 1171 { |
1339 return; | 1339 return; |
1340 | 1340 |
1341 luh = widget_logical_unit_height (ii); | 1341 luh = widget_logical_unit_height (ii); |
1342 | 1342 |
1343 /* Pick up the border text if we have one. */ | 1343 /* Pick up the border text if we have one. */ |
1344 if (INTP (IMAGE_INSTANCE_LAYOUT_BORDER (ii))) | 1344 if (FIXNUMP (IMAGE_INSTANCE_LAYOUT_BORDER (ii))) |
1345 { | 1345 { |
1346 glyph_query_geometry (XCAR (items), &gwidth, &gheight, disp, | 1346 glyph_query_geometry (XCAR (items), &gwidth, &gheight, disp, |
1347 image_instance); | 1347 image_instance); |
1348 ph_adjust = gheight; | 1348 ph_adjust = gheight; |
1349 /* Include text width in vertical layouts. */ | 1349 /* Include text width in vertical layouts. */ |
1377 { | 1377 { |
1378 if (!NILP (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii))) | 1378 if (!NILP (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii))) |
1379 { | 1379 { |
1380 Lisp_Object dynamic_width = | 1380 Lisp_Object dynamic_width = |
1381 eval_within_redisplay (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii)); | 1381 eval_within_redisplay (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii)); |
1382 if (INTP (dynamic_width)) | 1382 if (FIXNUMP (dynamic_width)) |
1383 *width = XINT (dynamic_width); | 1383 *width = XFIXNUM (dynamic_width); |
1384 } | 1384 } |
1385 else if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) == LAYOUT_HORIZONTAL) | 1385 else if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) == LAYOUT_HORIZONTAL) |
1386 { | 1386 { |
1387 *width = maxpw + ((nitems + 1) * widget_instance_border_width (ii) + | 1387 *width = maxpw + ((nitems + 1) * widget_instance_border_width (ii) + |
1388 IMAGE_INSTANCE_MARGIN_WIDTH (ii)) * 2; | 1388 IMAGE_INSTANCE_MARGIN_WIDTH (ii)) * 2; |
1399 { | 1399 { |
1400 if (!NILP (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii))) | 1400 if (!NILP (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii))) |
1401 { | 1401 { |
1402 Lisp_Object dynamic_height = | 1402 Lisp_Object dynamic_height = |
1403 eval_within_redisplay (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii)); | 1403 eval_within_redisplay (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii)); |
1404 if (INTP (dynamic_height)) | 1404 if (FIXNUMP (dynamic_height)) |
1405 *height = XINT (dynamic_height); | 1405 *height = XFIXNUM (dynamic_height); |
1406 } | 1406 } |
1407 else if (IMAGE_INSTANCE_SUBWINDOW_LOGICAL_LAYOUT (ii)) | 1407 else if (IMAGE_INSTANCE_SUBWINDOW_LOGICAL_LAYOUT (ii)) |
1408 { | 1408 { |
1409 *height = nitems * luh + ph_adjust; | 1409 *height = nitems * luh + ph_adjust; |
1410 } | 1410 } |
1450 values Qetched_in, Qetched_out, Qbevel_in, Qbevel_out or an | 1450 values Qetched_in, Qetched_out, Qbevel_in, Qbevel_out or an |
1451 integer. The first four just affect the display properties of the | 1451 integer. The first four just affect the display properties of the |
1452 border that is drawn. The last is an offset and implies that the | 1452 border that is drawn. The last is an offset and implies that the |
1453 first item in the list of subcontrols is a text control that | 1453 first item in the list of subcontrols is a text control that |
1454 should be displayed on the border. */ | 1454 should be displayed on the border. */ |
1455 if (INTP (IMAGE_INSTANCE_LAYOUT_BORDER (ii))) | 1455 if (FIXNUMP (IMAGE_INSTANCE_LAYOUT_BORDER (ii))) |
1456 { | 1456 { |
1457 Lisp_Object border = XCAR (items); | 1457 Lisp_Object border = XCAR (items); |
1458 items = XCDR (items); | 1458 items = XCDR (items); |
1459 glyph_query_geometry (border, &gwidth, &gheight, | 1459 glyph_query_geometry (border, &gwidth, &gheight, |
1460 IMAGE_DESIRED_GEOMETRY, image_instance); | 1460 IMAGE_DESIRED_GEOMETRY, image_instance); |
1461 /* The vertical offset for subsequent items is the full height | 1461 /* The vertical offset for subsequent items is the full height |
1462 of the border glyph. */ | 1462 of the border glyph. */ |
1463 ph_adjust = gheight; | 1463 ph_adjust = gheight; |
1464 /* The offset for the border is half the glyph height. */ | 1464 /* The offset for the border is half the glyph height. */ |
1465 IMAGE_INSTANCE_LAYOUT_BORDER (ii) = make_int (gheight / 2); | 1465 IMAGE_INSTANCE_LAYOUT_BORDER (ii) = make_fixnum (gheight / 2); |
1466 | 1466 |
1467 /* #### Really, what should this be? */ | 1467 /* #### Really, what should this be? */ |
1468 glyph_do_layout (border, gwidth, gheight, BORDER_FIDDLE_FACTOR, 0, | 1468 glyph_do_layout (border, gwidth, gheight, BORDER_FIDDLE_FACTOR, 0, |
1469 image_instance); | 1469 image_instance); |
1470 } | 1470 } |
1592 { | 1592 { |
1593 /* This function can GC. */ | 1593 /* This function can GC. */ |
1594 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | 1594 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); |
1595 if (EQ (prop, Q_items)) | 1595 if (EQ (prop, Q_items)) |
1596 { | 1596 { |
1597 if (INTP (IMAGE_INSTANCE_LAYOUT_BORDER (ii)) && | 1597 if (FIXNUMP (IMAGE_INSTANCE_LAYOUT_BORDER (ii)) && |
1598 CONSP (IMAGE_INSTANCE_LAYOUT_CHILDREN (ii))) | 1598 CONSP (IMAGE_INSTANCE_LAYOUT_CHILDREN (ii))) |
1599 return Fcopy_sequence (XCDR | 1599 return Fcopy_sequence (XCDR |
1600 (IMAGE_INSTANCE_LAYOUT_CHILDREN (ii))); | 1600 (IMAGE_INSTANCE_LAYOUT_CHILDREN (ii))); |
1601 else | 1601 else |
1602 return Fcopy_sequence (IMAGE_INSTANCE_LAYOUT_CHILDREN (ii)); | 1602 return Fcopy_sequence (IMAGE_INSTANCE_LAYOUT_CHILDREN (ii)); |
1649 int border_width = DEFAULT_WIDGET_BORDER_WIDTH; | 1649 int border_width = DEFAULT_WIDGET_BORDER_WIDTH; |
1650 | 1650 |
1651 if (NILP (domain)) | 1651 if (NILP (domain)) |
1652 domain = Fselected_frame (Qnil); | 1652 domain = Fselected_frame (Qnil); |
1653 | 1653 |
1654 CHECK_INT (width); | 1654 CHECK_FIXNUM (width); |
1655 w = XINT (width); | 1655 w = XFIXNUM (width); |
1656 | 1656 |
1657 if (HAS_DEVMETH_P (DOMAIN_XDEVICE (domain), widget_border_width)) | 1657 if (HAS_DEVMETH_P (DOMAIN_XDEVICE (domain), widget_border_width)) |
1658 border_width = DEVMETH (DOMAIN_XDEVICE (domain), widget_border_width, ()); | 1658 border_width = DEVMETH (DOMAIN_XDEVICE (domain), widget_border_width, ()); |
1659 | 1659 |
1660 default_face_font_info (domain, 0, 0, &charwidth, 0, 0); | 1660 default_face_font_info (domain, 0, 0, &charwidth, 0, 0); |
1661 neww = ROUND_UP (charwidth * w + 4 * border_width + 2 * widget_spacing (domain), | 1661 neww = ROUND_UP (charwidth * w + 4 * border_width + 2 * widget_spacing (domain), |
1662 charwidth) / charwidth; | 1662 charwidth) / charwidth; |
1663 | 1663 |
1664 return make_int (neww); | 1664 return make_fixnum (neww); |
1665 } | 1665 } |
1666 | 1666 |
1667 DEFUN ("widget-logical-to-character-height", Fwidget_logical_to_character_height, 1, 3, 0, /* | 1667 DEFUN ("widget-logical-to-character-height", Fwidget_logical_to_character_height, 1, 3, 0, /* |
1668 Convert the height in logical widget units to characters. | 1668 Convert the height in logical widget units to characters. |
1669 Logical widget units do not take into account adjustments made for | 1669 Logical widget units do not take into account adjustments made for |
1683 */ | 1683 */ |
1684 (height, UNUSED (face), domain)) | 1684 (height, UNUSED (face), domain)) |
1685 { | 1685 { |
1686 int h, newh, charheight; | 1686 int h, newh, charheight; |
1687 | 1687 |
1688 CHECK_INT (height); | 1688 CHECK_FIXNUM (height); |
1689 if (NILP (domain)) | 1689 if (NILP (domain)) |
1690 domain = Fselected_frame (Qnil); | 1690 domain = Fselected_frame (Qnil); |
1691 | 1691 |
1692 h = XINT (height); | 1692 h = XFIXNUM (height); |
1693 | 1693 |
1694 default_face_font_info (domain, 0, 0, 0, &charheight, 0); | 1694 default_face_font_info (domain, 0, 0, 0, &charheight, 0); |
1695 newh = ROUND_UP (logical_unit_height (Fsymbol_name (Qwidget), | 1695 newh = ROUND_UP (logical_unit_height (Fsymbol_name (Qwidget), |
1696 Vwidget_face, domain) * h, charheight) | 1696 Vwidget_face, domain) * h, charheight) |
1697 / charheight; | 1697 / charheight; |
1698 | 1698 |
1699 return make_int (newh); | 1699 return make_fixnum (newh); |
1700 } | 1700 } |
1701 | 1701 |
1702 | 1702 |
1703 /************************************************************************/ | 1703 /************************************************************************/ |
1704 /* initialization */ | 1704 /* initialization */ |