(list4i): Move from window.c and make LISP_INLINE.
* editfns.c (make_lisp_time):
* fns.c (Flocale_info):
* keyboard.c (parse_modifiers):
* xterm.c (x_ewmh_activate_frame): Use list2i.
* instel.c (signal_after_change):
* nsfns.m (Fx_server_version, Fxw_color_values):
* w32fns.c (Fxw_color_values, Fx_server_version):
* xfns.c (Fxw_color_values, Fx_server_version): Use list3i.
* fileio.c (Fvisited_file_modtime):
* nsfns.m (Fns_display_usable_bounds):
* w32.c (ltime): Use list4i.
+2013-03-07 Dmitry Antipov <dmantipov@yandex.ru>
+
+ * lisp.h (list2i, list3i): New functions.
+ (list4i): Move from window.c and make LISP_INLINE.
+ * editfns.c (make_lisp_time):
+ * fns.c (Flocale_info):
+ * keyboard.c (parse_modifiers):
+ * xterm.c (x_ewmh_activate_frame): Use list2i.
+ * instel.c (signal_after_change):
+ * nsfns.m (Fx_server_version, Fxw_color_values):
+ * w32fns.c (Fxw_color_values, Fx_server_version):
+ * xfns.c (Fxw_color_values, Fx_server_version): Use list3i.
+ * fileio.c (Fvisited_file_modtime):
+ * nsfns.m (Fns_display_usable_bounds):
+ * w32.c (ltime): Use list4i.
+
2013-03-06 Eli Zaretskii <eliz@gnu.org>
* search.c (find_newline_no_quit): Rename from find_next_newline.
make_lisp_time (EMACS_TIME t)
{
int ns = EMACS_NSECS (t);
- return make_time_tail (EMACS_SECS (t),
- list2 (make_number (ns / 1000),
- make_number (ns % 1000 * 1000)));
+ return make_time_tail (EMACS_SECS (t), list2i (ns / 1000, ns % 1000 * 1000));
}
/* Decode a Lisp list SPECIFIED_TIME that represents a time.
if (EMACS_NSECS (current_buffer->modtime) == NONEXISTENT_MODTIME_NSECS)
{
/* make_lisp_time won't work here if time_t is unsigned. */
- return list4 (make_number (-1), make_number (65535),
- make_number (0), make_number (0));
+ return list4i (-1, 65535, 0, 0);
}
return make_number (0);
}
but is in the locale files. This could be used by ps-print. */
#ifdef PAPER_WIDTH
else if (EQ (item, Qpaper))
- {
- return list2 (make_number (nl_langinfo (PAPER_WIDTH)),
- make_number (nl_langinfo (PAPER_HEIGHT)));
- }
+ return list2i (nl_langinfo (PAPER_WIDTH), nl_langinfo (PAPER_HEIGHT));
#endif /* PAPER_WIDTH */
#endif /* HAVE_LANGINFO_CODESET*/
return Qnil;
&& current_buffer != XBUFFER (combine_after_change_buffer))
Fcombine_after_change_execute ();
- elt = Fcons (make_number (charpos - BEG),
- Fcons (make_number (Z - (charpos - lendel + lenins)),
- Fcons (make_number (lenins - lendel), Qnil)));
+ elt = list3i (charpos - BEG, Z - (charpos - lendel + lenins),
+ lenins - lendel);
combine_after_change_list
= Fcons (elt, combine_after_change_list);
combine_after_change_buffer = Fcurrent_buffer ();
Lisp_Object elements;
if (INTEGERP (symbol))
- return (Fcons (make_number (KEY_TO_CHAR (symbol)),
- Fcons (make_number (XINT (symbol) & CHAR_MODIFIER_MASK),
- Qnil)));
+ return list2i (KEY_TO_CHAR (symbol), XINT (symbol) & CHAR_MODIFIER_MASK);
else if (!SYMBOLP (symbol))
return Qnil;
Lisp_Object);
enum constype {CONSTYPE_HEAP, CONSTYPE_PURE};
extern Lisp_Object listn (enum constype, ptrdiff_t, Lisp_Object, ...);
+
+/* Build a frequently used 2/3/4-integer lists. */
+
+LISP_INLINE Lisp_Object
+list2i (EMACS_INT x, EMACS_INT y)
+{
+ return list2 (make_number (x), make_number (y));
+}
+
+LISP_INLINE Lisp_Object
+list3i (EMACS_INT x, EMACS_INT y, EMACS_INT w)
+{
+ return list3 (make_number (x), make_number (y), make_number (w));
+}
+
+LISP_INLINE Lisp_Object
+list4i (EMACS_INT x, EMACS_INT y, EMACS_INT w, EMACS_INT h)
+{
+ return list4 (make_number (x), make_number (y),
+ make_number (w), make_number (h));
+}
+
extern _Noreturn void string_overflow (void);
extern Lisp_Object make_string (const char *, ptrdiff_t);
extern Lisp_Object make_formatted_string (char *, const char *, ...)
The last number is where we distinguish between the Apple
and GNUstep implementations ("distributor-specific release
number") and give int'ized versions of major.minor. */
- return Fcons (make_number (10),
- Fcons (make_number (3),
- Fcons (make_number (ns_appkit_version_int()), Qnil)));
+ return list3i (10, 3, ns_appkit_version_int ());
}
[[col colorUsingColorSpaceName: NSCalibratedRGBColorSpace]
getRed: &red green: &green blue: &blue alpha: &alpha];
- return list3 (make_number (lrint (red*65280)),
- make_number (lrint (green*65280)),
- make_number (lrint (blue*65280)));
+ return list3i (lrint (red * 65280), lrint (green * 65280),
+ lrint (blue * 65280));
}
/* NS coordinate system is upside-down.
Transform to screen-specific coordinates. */
- return list4 (make_number ((int) vScreen.origin.x),
- make_number ((int) [screen frame].size.height
- - vScreen.size.height - vScreen.origin.y),
- make_number ((int) vScreen.size.width),
- make_number ((int) vScreen.size.height));
+ return list4i (vScreen.origin.x,
+ [screen frame].size.height
+ - vScreen.size.height - vScreen.origin.y,
+ vScreen.size.width, vScreen.size.height);
}
{
ULONGLONG time_sec = time_100ns / 10000000;
int subsec = time_100ns % 10000000;
- return list4 (make_number (time_sec >> 16),
- make_number (time_sec & 0xffff),
- make_number (subsec / 10),
- make_number (subsec % 10 * 100000));
+ return list4i (time_sec >> 16, time_sec & 0xffff,
+ subsec / 10, subsec % 10 * 100000);
}
#define U64_TO_LISP_TIME(time) ltime (time)
CHECK_STRING (color);
if (w32_defined_color (f, SDATA (color), &foo, 0))
- return list3 (make_number ((GetRValue (foo.pixel) << 8)
- | GetRValue (foo.pixel)),
- make_number ((GetGValue (foo.pixel) << 8)
- | GetGValue (foo.pixel)),
- make_number ((GetBValue (foo.pixel) << 8)
- | GetBValue (foo.pixel)));
+ return list3i ((GetRValue (foo.pixel) << 8) | GetRValue (foo.pixel),
+ (GetGValue (foo.pixel) << 8) | GetGValue (foo.pixel),
+ (GetBValue (foo.pixel) << 8) | GetBValue (foo.pixel));
else
return Qnil;
}
If omitted or nil, that stands for the selected frame's display. */)
(Lisp_Object display)
{
- return Fcons (make_number (w32_major_version),
- Fcons (make_number (w32_minor_version),
- Fcons (make_number (w32_build_number), Qnil)));
+ return list3i (w32_major_version, w32_minor_version, w32_build_number);
}
DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0,
adjust_window_count (w, 1);
}
-/* Build a frequently used 4-integer (X Y W H) list. */
-
-static Lisp_Object
-list4i (EMACS_INT x, EMACS_INT y, EMACS_INT w, EMACS_INT h)
-{
- return list4 (make_number (x), make_number (y),
- make_number (w), make_number (h));
-}
-
DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0,
doc: /* Return t if OBJECT is a window and nil otherwise. */)
(Lisp_Object object)
CHECK_STRING (color);
if (x_defined_color (f, SSDATA (color), &foo, 0))
- return list3 (make_number (foo.red),
- make_number (foo.green),
- make_number (foo.blue));
+ return list3i (foo.red, foo.green, foo.blue);
else
return Qnil;
}
struct x_display_info *dpyinfo = check_x_display_info (terminal);
Display *dpy = dpyinfo->display;
- return Fcons (make_number (ProtocolVersion (dpy)),
- Fcons (make_number (ProtocolRevision (dpy)),
- Fcons (make_number (VendorRelease (dpy)), Qnil)));
+ return list3i (ProtocolVersion (dpy), ProtocolRevision (dpy),
+ VendorRelease (dpy));
}
DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0,
XSETFRAME (frame, f);
x_send_client_event (frame, make_number (0), frame,
dpyinfo->Xatom_net_active_window,
- make_number (32),
- Fcons (make_number (1),
- Fcons (make_number (last_user_time),
- Qnil)));
+ make_number (32), list2i (1, last_user_time));
}
}