integers to C `unsigned long' integers.
/* -*-C-*-
-$Id: artutl.c,v 1.11 1992/09/18 19:40:07 jinx Exp $
+$Id: artutl.c,v 1.12 1995/09/18 22:32:53 cph Exp $
-Copyright (c) 1989-1992 Massachusetts Institute of Technology
+Copyright (c) 1989-95 Massachusetts Institute of Technology
This material was developed by the Scheme project at the Massachusetts
Institute of Technology, Department of Electrical Engineering and
: (long_to_bignum (number)));
}
+Boolean
+DEFUN (integer_to_ulong_p, (n), fast SCHEME_OBJECT n)
+{
+ return ((FIXNUM_P (n)) || (BIGNUM_TO_ULONG_P (n)));
+}
+
unsigned long
DEFUN (integer_to_ulong,
(n),
/* -*-C-*-
-$Id: extern.h,v 9.52 1995/07/26 21:06:15 adams Exp $
+$Id: extern.h,v 9.53 1995/09/18 22:32:54 cph Exp $
-Copyright (c) 1987-1993 Massachusetts Institute of Technology
+Copyright (c) 1987-95 Massachusetts Institute of Technology
This material was developed by the Scheme project at the Massachusetts
Institute of Technology, Department of Electrical Engineering and
extern Boolean EXFUN (integer_to_long_p, (SCHEME_OBJECT));
extern long EXFUN (integer_to_long, (SCHEME_OBJECT));
extern SCHEME_OBJECT EXFUN (long_to_integer, (long));
+extern Boolean EXFUN (integer_to_ulong_p, (SCHEME_OBJECT));
extern unsigned long EXFUN (integer_to_ulong, (SCHEME_OBJECT));
extern SCHEME_OBJECT EXFUN (ulong_to_integer, (unsigned long));
extern Boolean EXFUN (integer_to_double_p, (SCHEME_OBJECT));
/* -*-C-*-
-$Id: object.h,v 9.45 1993/12/05 06:35:45 cph Exp $
+$Id: object.h,v 9.46 1995/09/18 22:33:38 cph Exp $
-Copyright (c) 1987-1993 Massachusetts Institute of Technology
+Copyright (c) 1987-95 Massachusetts Institute of Technology
This material was developed by the Scheme project at the Massachusetts
Institute of Technology, Department of Electrical Engineering and
#define BIGNUM_TO_LONG_P(bignum) \
(bignum_fits_in_word_p ((bignum), ((sizeof (long)) * CHAR_BIT), 1))
+#define BIGNUM_TO_ULONG_P(bignum) \
+ (bignum_fits_in_word_p ((bignum), ((sizeof (unsigned long)) * CHAR_BIT), 0))
+
/* If precision should not be lost,
compare to DBL_MANT_DIG instead. */
#define BIGNUM_TO_DOUBLE_P(bignum) \
/* -*-C-*-
-$Id: prims.h,v 9.44 1993/12/05 06:08:03 cph Exp $
+$Id: prims.h,v 9.45 1995/09/18 22:33:00 cph Exp $
-Copyright (c) 1987-1993 Massachusetts Institute of Technology
+Copyright (c) 1987-95 Massachusetts Institute of Technology
This material was developed by the Scheme project at the Massachusetts
Institute of Technology, Department of Electrical Engineering and
extern long EXFUN (arg_nonnegative_integer, (int));
extern long EXFUN (arg_index_integer, (int, long));
extern long EXFUN (arg_integer_in_range, (int, long, long));
+extern unsigned long EXFUN (arg_ulong_integer, (int));
+extern unsigned long EXFUN (arg_ulong_index_integer, (int, unsigned long));
extern double EXFUN (arg_real_number, (int));
extern double EXFUN (arg_real_in_range, (int, double, double));
extern long EXFUN (arg_ascii_char, (int));
/* -*-C-*-
-$Id: utils.c,v 9.67 1994/11/28 04:37:22 cph Exp $
+$Id: utils.c,v 9.68 1995/09/18 22:33:04 cph Exp $
-Copyright (c) 1987-94 Massachusetts Institute of Technology
+Copyright (c) 1987-95 Massachusetts Institute of Technology
This material was developed by the Scheme project at the Massachusetts
Institute of Technology, Department of Electrical Engineering and
error_bad_range_arg (arg_number);
return (result);
}
+
+unsigned long
+DEFUN (arg_ulong_integer, (arg_number), int arg_number)
+{
+ fast SCHEME_OBJECT object = (ARG_REF (arg_number));
+ if (! (INTEGER_P (object)))
+ error_wrong_type_arg (arg_number);
+ if (! (integer_to_ulong_p (object)))
+ error_bad_range_arg (arg_number);
+ return (integer_to_ulong (object));
+}
+
+unsigned long
+DEFUN (arg_ulong_index_integer, (arg_number, upper_limit),
+ int arg_number AND unsigned long upper_limit)
+{
+ fast unsigned long result = (arg_ulong_integer (arg_number));
+ if (result >= upper_limit)
+ error_bad_range_arg (arg_number);
+ return (result);
+}
\f
Boolean
DEFUN (real_number_to_double_p, (x), fast SCHEME_OBJECT x)
/* -*-C-*-
-$Id: x11graph.c,v 1.33 1994/09/26 23:08:46 cph Exp $
+$Id: x11graph.c,v 1.34 1995/09/18 22:33:08 cph Exp $
-Copyright (c) 1989-94 Massachusetts Institute of Technology
+Copyright (c) 1989-95 Massachusetts Institute of Technology
This material was developed by the Scheme project at the Massachusetts
Institute of Technology, Department of Electrical Engineering and
{
PRIMITIVE_HEADER (3);
reconfigure ((x_window_arg (1)),
- (arg_nonnegative_integer (2)),
- (arg_nonnegative_integer (3)));
+ (arg_ulong_integer (2)),
+ (arg_ulong_integer (3)));
PRIMITIVE_RETURN (UNSPECIFIC);
}
{
struct xwindow * xw = (x_window_arg (1));
Display * display = (XW_DISPLAY (xw));
- unsigned int function = (arg_index_integer (2, 16));
+ unsigned int function = (arg_ulong_index_integer (2, 16));
XSetFunction (display, (XW_NORMAL_GC (xw)), function);
XSetFunction (display, (XW_REVERSE_GC (xw)), function);
}
{
struct xwindow * xw = (x_window_arg (1));
Display * display = (XW_DISPLAY (xw));
- unsigned int fill_style = (arg_index_integer (2, 4));
+ unsigned int fill_style = (arg_ulong_index_integer (2, 4));
XSetFillStyle (display, (XW_NORMAL_GC (xw)), fill_style);
XSetFillStyle (display, (XW_REVERSE_GC (xw)), fill_style);
}
{
struct xwindow * xw = (x_window_arg (1));
Display * display = (XW_DISPLAY (xw));
- unsigned int style = (arg_index_integer (2, 3));
+ unsigned int style = (arg_ulong_index_integer (2, 3));
XSetLineAttributes
(display, (XW_NORMAL_GC (xw)), 0, style, CapButt, JoinMiter);
XSetLineAttributes
Display * display = (XW_DISPLAY (xw));
char * dash_list = (STRING_ARG (3));
unsigned int dash_list_length = (STRING_LENGTH (ARG_REF (3)));
- unsigned int dash_offset = (arg_index_integer (2, dash_list_length));
+ unsigned int dash_offset = (arg_ulong_index_integer (2, dash_list_length));
XSetDashes
(display, (XW_NORMAL_GC (xw)), dash_offset, dash_list, dash_list_length);
XSetDashes
struct xwindow * xw = (x_window_arg (1));
Window window = (XW_WINDOW (xw));
Display * dpy = (XW_DISPLAY (xw));
- unsigned int width = (arg_nonnegative_integer (2));
- unsigned int height = (arg_nonnegative_integer (3));
+ unsigned int width = (arg_ulong_integer (2));
+ unsigned int height = (arg_ulong_integer (3));
unsigned int bitmap_pad = (BitmapPad (dpy));
unsigned int byte_pad = (bitmap_pad / CHAR_BIT);
unsigned int bytes_per_line =
{
PRIMITIVE_HEADER (2);
{
- SCHEME_OBJECT vector = ARG_REF (1);
- XImage * image = XI_IMAGE (x_image_arg (2));
+ SCHEME_OBJECT vector = (ARG_REF (1));
+ XImage * image = (XI_IMAGE (x_image_arg (2)));
char * image_scan;
unsigned long width = (image -> width);
unsigned long height = (image -> height);
}
}
\f
-DEFINE_PRIMITIVE("X-GET-PIXEL-FROM-IMAGE", Prim_x_get_image_pixel, 3, 3, 0)
+DEFINE_PRIMITIVE ("X-GET-PIXEL-FROM-IMAGE", Prim_x_get_image_pixel, 3, 3, 0)
{
PRIMITIVE_HEADER (3);
{
XImage * image = (XI_IMAGE (x_image_arg (1)));
PRIMITIVE_RETURN
- (long_to_integer
+ (ulong_to_integer
(XGetPixel (image,
(arg_index_integer (2, (image -> width))),
(arg_index_integer (3, (image -> height))))));
}
}
-DEFINE_PRIMITIVE("X-SET-PIXEL-IN-IMAGE", Prim_x_set_image_pixel, 4, 4, 0)
+DEFINE_PRIMITIVE ("X-SET-PIXEL-IN-IMAGE", Prim_x_set_image_pixel, 4, 4, 0)
{
PRIMITIVE_HEADER (4);
{
XPutPixel (image,
(arg_index_integer (2, (image -> width))),
(arg_index_integer (3, (image -> height))),
- (arg_integer (4)));
+ (arg_ulong_integer (4)));
PRIMITIVE_RETURN (UNSPECIFIC);
}
}
XImage * image = (XI_IMAGE (x_image_arg (1)));
unsigned int image_width = (image -> width);
unsigned int image_height = (image -> height);
- unsigned int x_offset = (arg_index_integer (2, image_width));
- unsigned int y_offset = (arg_index_integer (3, image_height));
+ unsigned int x_offset = (arg_ulong_index_integer (2, image_width));
+ unsigned int y_offset = (arg_ulong_index_integer (3, image_height));
struct xwindow * xw = (x_window_arg (4));
XPutImage
((XW_DISPLAY (xw)),(XW_WINDOW (xw)),(XW_NORMAL_GC (xw)),
PRIMITIVE_HEADER (2);
{
struct xwindow * xw = (x_window_arg (1));
- unsigned int xp = (arg_nonnegative_integer (2));
+ unsigned int xp = (arg_ulong_integer (2));
int bx = (xp - (XW_INTERNAL_BORDER_WIDTH (xw)));
PRIMITIVE_RETURN
(x_coordinate_map
PRIMITIVE_HEADER (2);
{
struct xwindow * xw = (x_window_arg (1));
- unsigned int yp = (arg_nonnegative_integer (2));
+ unsigned int yp = (arg_ulong_integer (2));
int by = (yp - (XW_INTERNAL_BORDER_WIDTH (xw)));
PRIMITIVE_RETURN
(y_coordinate_map
/* -*-C-*-
-$Id: x11term.c,v 1.23 1993/08/16 08:12:32 cph Exp $
+$Id: x11term.c,v 1.24 1995/09/18 22:33:14 cph Exp $
-Copyright (c) 1989-93 Massachusetts Institute of Technology
+Copyright (c) 1989-95 Massachusetts Institute of Technology
This material was developed by the Scheme project at the Massachusetts
Institute of Technology, Department of Electrical Engineering and
static SCHEME_OBJECT
DEFUN (xterm_x_coordinate_map, (xw, x), struct xwindow * xw AND unsigned int x)
{
- return (long_to_integer (x / (FONT_WIDTH (XW_FONT (xw)))));
+ return (ulong_to_integer (x / (FONT_WIDTH (XW_FONT (xw)))));
}
static SCHEME_OBJECT
DEFUN (xterm_y_coordinate_map, (xw, y), struct xwindow * xw AND unsigned int y)
{
- return (long_to_integer (y / (FONT_HEIGHT (XW_FONT (xw)))));
+ return (ulong_to_integer (y / (FONT_HEIGHT (XW_FONT (xw)))));
}
static void
{
PRIMITIVE_HEADER (3);
xterm_reconfigure ((x_window_arg (1)),
- (arg_nonnegative_integer (2)),
- (arg_nonnegative_integer (3)));
+ (arg_ulong_integer (2)),
+ (arg_ulong_integer (3)));
PRIMITIVE_RETURN (UNSPECIFIC);
}
{
PRIMITIVE_HEADER (5);
xterm_dump_rectangle ((x_window_arg (1)),
- (arg_nonnegative_integer (2)),
- (arg_nonnegative_integer (3)),
- (arg_nonnegative_integer (4)),
- (arg_nonnegative_integer (5)));
+ (arg_ulong_integer (2)),
+ (arg_ulong_integer (3)),
+ (arg_ulong_integer (4)),
+ (arg_ulong_integer (5)));
PRIMITIVE_RETURN (UNSPECIFIC);
}
PRIMITIVE_HEADER (2);
{
struct xwindow * xw = (x_window_arg (1));
- unsigned int xp = (arg_nonnegative_integer (2));
+ unsigned int xp = (arg_ulong_integer (2));
int bx = (xp - (XW_INTERNAL_BORDER_WIDTH (xw)));
PRIMITIVE_RETURN
(long_to_integer
PRIMITIVE_HEADER (2);
{
struct xwindow * xw = (x_window_arg (1));
- unsigned int yp = (arg_nonnegative_integer (2));
+ unsigned int yp = (arg_ulong_integer (2));
int by = (yp - (XW_INTERNAL_BORDER_WIDTH (xw)));
PRIMITIVE_RETURN
(long_to_integer
int width =
((arg_nonnegative_integer (2)) - (2 * (XW_INTERNAL_BORDER_WIDTH (xw))));
PRIMITIVE_RETURN
- (long_to_integer
+ (ulong_to_integer
((width < 0) ? 0 : (width / (FONT_WIDTH (XW_FONT (xw))))));
}
}
int height =
((arg_nonnegative_integer (2)) - (2 * (XW_INTERNAL_BORDER_WIDTH (xw))));
PRIMITIVE_RETURN
- (long_to_integer
+ (ulong_to_integer
((height < 0) ? 0 : (height / (FONT_HEIGHT (XW_FONT (xw))))));
}
}
DEFINE_PRIMITIVE ("XTERM-X-SIZE", Prim_xterm_x_size, 1, 1, 0)
{
PRIMITIVE_HEADER (1);
- PRIMITIVE_RETURN (long_to_integer (XW_X_CSIZE (x_window_arg (1))));
+ PRIMITIVE_RETURN (ulong_to_integer (XW_X_CSIZE (x_window_arg (1))));
}
DEFINE_PRIMITIVE ("XTERM-Y-SIZE", Prim_xterm_y_size, 1, 1, 0)
{
PRIMITIVE_HEADER (1);
- PRIMITIVE_RETURN (long_to_integer (XW_Y_CSIZE (x_window_arg (1))));
+ PRIMITIVE_RETURN (ulong_to_integer (XW_Y_CSIZE (x_window_arg (1))));
}
DEFINE_PRIMITIVE ("XTERM-SET-SIZE", Prim_xterm_set_size, 3, 3, 0)
XResizeWindow
((XW_DISPLAY (xw)),
(XW_WINDOW (xw)),
- (((arg_nonnegative_integer (2)) * (FONT_WIDTH (font))) + extra),
- (((arg_nonnegative_integer (3)) * (FONT_HEIGHT (font))) + extra));
+ (((arg_ulong_integer (2)) * (FONT_WIDTH (font))) + extra),
+ (((arg_ulong_integer (3)) * (FONT_HEIGHT (font))) + extra));
PRIMITIVE_RETURN (UNSPECIFIC);
}
PRIMITIVE_HEADER (3);
{
struct xwindow * xw = (x_window_arg (1));
- unsigned int x = (arg_index_integer (2, (XW_X_CSIZE (xw))));
- unsigned int y = (arg_index_integer (3, (XW_Y_CSIZE (xw))));
+ unsigned int x = (arg_ulong_index_integer (2, (XW_X_CSIZE (xw))));
+ unsigned int y = (arg_ulong_index_integer (3, (XW_Y_CSIZE (xw))));
if ((x != (XW_CURSOR_X (xw))) || (y != (XW_CURSOR_Y (xw))))
{
xterm_erase_cursor (xw);
PRIMITIVE_HEADER (5);
{
struct xwindow * xw = (x_window_arg (1));
- unsigned int x = (arg_index_integer (2, (XW_X_CSIZE (xw))));
- unsigned int y = (arg_index_integer (3, (XW_Y_CSIZE (xw))));
+ unsigned int x = (arg_ulong_index_integer (2, (XW_X_CSIZE (xw))));
+ unsigned int y = (arg_ulong_index_integer (3, (XW_Y_CSIZE (xw))));
int c = (arg_ascii_char (4));
unsigned int hl = (HL_ARG (5));
unsigned int index = (XTERM_CHAR_INDEX (xw, x, y));
CHECK_ARG (4, STRING_P);
{
struct xwindow * xw = (x_window_arg (1));
- unsigned int x = (arg_index_integer (2, (XW_X_CSIZE (xw))));
- unsigned int y = (arg_index_integer (3, (XW_Y_CSIZE (xw))));
+ unsigned int x = (arg_ulong_index_integer (2, (XW_X_CSIZE (xw))));
+ unsigned int y = (arg_ulong_index_integer (3, (XW_Y_CSIZE (xw))));
SCHEME_OBJECT string = (ARG_REF (4));
- unsigned int end = (arg_index_integer (6, ((STRING_LENGTH (string)) + 1)));
- unsigned int start = (arg_index_integer (5, (end + 1)));
+ unsigned int end
+ = (arg_ulong_index_integer (6, ((STRING_LENGTH (string)) + 1)));
+ unsigned int start = (arg_ulong_index_integer (5, (end + 1)));
unsigned int hl = (HL_ARG (7));
unsigned int length = (end - start);
unsigned int index = (XTERM_CHAR_INDEX (xw, x, y));
PRIMITIVE_HEADER (6);
{
struct xwindow * xw = (x_window_arg (1));
- unsigned int x_end = (arg_index_integer (3, ((XW_X_CSIZE (xw)) + 1)));
- unsigned int y_end = (arg_index_integer (5, ((XW_Y_CSIZE (xw)) + 1)));
- unsigned int x_start = (arg_index_integer (2, (x_end + 1)));
- unsigned int y_start = (arg_index_integer (4, (y_end + 1)));
+ unsigned int x_end
+ = (arg_ulong_index_integer (3, ((XW_X_CSIZE (xw)) + 1)));
+ unsigned int y_end
+ = (arg_ulong_index_integer (5, ((XW_Y_CSIZE (xw)) + 1)));
+ unsigned int x_start = (arg_ulong_index_integer (2, (x_end + 1)));
+ unsigned int y_start = (arg_ulong_index_integer (4, (y_end + 1)));
unsigned int hl = (HL_ARG (6));
if ((x_start < x_end) && (y_start < y_end))
{
PRIMITIVE_HEADER (6);
{
struct xwindow * xw = (x_window_arg (1));
- unsigned int x_end = (arg_index_integer (3, ((XW_X_CSIZE (xw)) + 1)));
- unsigned int x_start = (arg_index_integer (2, (x_end + 1)));
- unsigned int y_end = (arg_index_integer (5, ((XW_Y_CSIZE (xw)) + 1)));
- unsigned int y_start = (arg_index_integer (4, (y_end + 1)));
- unsigned int lines = (arg_index_integer (6, (y_end - y_start)));
+ unsigned int x_end
+ = (arg_ulong_index_integer (3, ((XW_X_CSIZE (xw)) + 1)));
+ unsigned int x_start = (arg_ulong_index_integer (2, (x_end + 1)));
+ unsigned int y_end
+ = (arg_ulong_index_integer (5, ((XW_Y_CSIZE (xw)) + 1)));
+ unsigned int y_start = (arg_ulong_index_integer (4, (y_end + 1)));
+ unsigned int lines = (arg_ulong_index_integer (6, (y_end - y_start)));
if ((0 < lines) && (x_start < x_end) && (y_start < y_end))
{
if (CURSOR_IN_RECTANGLE (xw, x_start, x_end, (y_start + lines), y_end))
PRIMITIVE_HEADER (6);
{
struct xwindow * xw = (x_window_arg (1));
- unsigned int x_end = (arg_index_integer (3, ((XW_X_CSIZE (xw)) + 1)));
- unsigned int x_start = (arg_index_integer (2, (x_end + 1)));
- unsigned int y_end = (arg_index_integer (5, ((XW_Y_CSIZE (xw)) + 1)));
- unsigned int y_start = (arg_index_integer (4, (y_end + 1)));
- unsigned int lines = (arg_index_integer (6, (y_end - y_start)));
+ unsigned int x_end
+ = (arg_ulong_index_integer (3, ((XW_X_CSIZE (xw)) + 1)));
+ unsigned int x_start = (arg_ulong_index_integer (2, (x_end + 1)));
+ unsigned int y_end
+ = (arg_ulong_index_integer (5, ((XW_Y_CSIZE (xw)) + 1)));
+ unsigned int y_start = (arg_ulong_index_integer (4, (y_end + 1)));
+ unsigned int lines = (arg_ulong_index_integer (6, (y_end - y_start)));
if ((0 < lines) && (x_start < x_end) && (y_start < y_end))
{
if (CURSOR_IN_RECTANGLE (xw, x_start, x_end, y_start, (y_end - lines)))
PRIMITIVE_HEADER (5);
{
struct xwindow * xw = (x_window_arg (1));
- unsigned int x_end = (arg_index_integer (3, ((XW_X_CSIZE (xw)) + 1)));
- unsigned int y_end = (arg_index_integer (5, ((XW_Y_CSIZE (xw)) + 1)));
- unsigned int x_start = (arg_index_integer (2, (x_end + 1)));
- unsigned int y_start = (arg_index_integer (4, (y_end + 1)));
+ unsigned int x_end
+ = (arg_ulong_index_integer (3, ((XW_X_CSIZE (xw)) + 1)));
+ unsigned int y_end
+ = (arg_ulong_index_integer (5, ((XW_Y_CSIZE (xw)) + 1)));
+ unsigned int x_start = (arg_ulong_index_integer (2, (x_end + 1)));
+ unsigned int y_start = (arg_ulong_index_integer (4, (y_end + 1)));
unsigned int x_length = (x_end - x_start);
unsigned int string_length = (2 * x_length * (y_end - y_start));
SCHEME_OBJECT string = (allocate_string (string_length));
CHECK_ARG (6, STRING_P);
{
struct xwindow * xw = (x_window_arg (1));
- unsigned int x_end = (arg_index_integer (3, ((XW_X_CSIZE (xw)) + 1)));
- unsigned int y_end = (arg_index_integer (5, ((XW_Y_CSIZE (xw)) + 1)));
- unsigned int x_start = (arg_index_integer (2, (x_end + 1)));
- unsigned int y_start = (arg_index_integer (4, (y_end + 1)));
+ unsigned int x_end
+ = (arg_ulong_index_integer (3, ((XW_X_CSIZE (xw)) + 1)));
+ unsigned int y_end
+ = (arg_ulong_index_integer (5, ((XW_Y_CSIZE (xw)) + 1)));
+ unsigned int x_start = (arg_ulong_index_integer (2, (x_end + 1)));
+ unsigned int y_start = (arg_ulong_index_integer (4, (y_end + 1)));
unsigned int x_length = (x_end - x_start);
unsigned int string_length = (2 * x_length * (y_end - y_start));
SCHEME_OBJECT string = (ARG_REF (6));
/* -*-C-*-
-$Id: object.h,v 9.46 1995/07/27 00:06:04 adams Exp $
+$Id: object.h,v 9.47 1995/09/18 22:32:56 cph Exp $
-Copyright (c) 1987-1993 Massachusetts Institute of Technology
+Copyright (c) 1987-95 Massachusetts Institute of Technology
This material was developed by the Scheme project at the Massachusetts
Institute of Technology, Department of Electrical Engineering and
#define BIGNUM_TO_LONG_P(bignum) \
(bignum_fits_in_word_p ((bignum), ((sizeof (long)) * CHAR_BIT), 1))
+#define BIGNUM_TO_ULONG_P(bignum) \
+ (bignum_fits_in_word_p ((bignum), ((sizeof (unsigned long)) * CHAR_BIT), 0))
+
/* If precision should not be lost,
compare to DBL_MANT_DIG instead. */
#define BIGNUM_TO_DOUBLE_P(bignum) \