aboutsummaryrefslogtreecommitdiffstats
path: root/src/frame.c
diff options
context:
space:
mode:
authorPaul Eggert2015-01-05 09:07:45 -0800
committerPaul Eggert2015-01-05 10:14:58 -0800
commit58f2d6ef32b28a787fcc4e0d98b3f331ceb2a68c (patch)
treed6d79ad7b7cceafc78c5a9c54f5be1ac441a8ed7 /src/frame.c
parentd2cf05d1bac19d8564d0806f515b9f40fe57f4df (diff)
downloademacs-58f2d6ef32b28a787fcc4e0d98b3f331ceb2a68c.tar.gz
emacs-58f2d6ef32b28a787fcc4e0d98b3f331ceb2a68c.zip
Compute C decls for DEFSYMs automatically
Fixes Bug#15880. This patch also makes Q constants (e.g., Qnil) constant addresses from the C point of view. * make-docfile.c: Revamp to generate table of symbols, too. Include <stdbool.h>. (xstrdup): New function. (main): Don't process the same file twice. (SYMBOL): New constant in enum global_type. (struct symbol): Turn 'value' member into a union, either v.value for int or v.svalue for string. All uses changed. (add_global): New arg svalue, which overrides value, so that globals can have a string value. (close_emacs_global): New arg num_symbols; all uses changed. Output lispsym decl. (write_globals): Output symbol globals too. Output more ATTRIBUTE_CONST, now that Qnil etc. are C constants. Output defsym_name table. (scan_c_file): Move most of guts into ... (scan_c_stream): ... new function. Scan for DEFSYMs and record symbols found. Don't read past EOF if file doesn't end in newline. * alloc.c, bidi.c, buffer.c, bytecode.c, callint.c, casefiddle: * casetab.c, category.c, ccl.c, charset.c, chartab.c, cmds.c, coding.c: * composite.c, data.c, dbusbind.c, decompress.c, dired.c, dispnew.c: * doc.c, editfns.c, emacs.c, eval.c, fileio.c, fns.c, font.c, fontset.c: * frame.c, fringe.c, ftfont.c, ftxfont.c, gfilenotify.c, gnutls.c: * image.c, inotify.c, insdel.c, keyboard.c, keymap.c, lread.c: * macfont.m, macros.c, minibuf.c, nsfns.m, nsfont.m, nsimage.m: * nsmenu.m, nsselect.m, nsterm.m, print.c, process.c, profiler.c: * search.c, sound.c, syntax.c, term.c, terminal.c, textprop.c, undo.c: * window.c, xdisp.c, xfaces.c, xfns.c, xftfont.c, xmenu.c, xml.c: * xselect.c, xsettings.c, xterm.c: Remove Q vars that represent symbols (e.g., Qnil, Qt, Qemacs). These names are now defined automatically by make-docfile. * alloc.c (init_symbol): New function. (Fmake_symbol): Use it. (c_symbol_p): New function. (valid_lisp_object_p, purecopy): Use it. * alloc.c (marked_pinned_symbols): Use make_lisp_symbol instead of make_lisp_ptr. (garbage_collect_1): Mark lispsym symbols. (CHECK_ALLOCATED_AND_LIVE_SYMBOL): New macro. (mark_object): Use it. (sweep_symbols): Sweep lispsym symbols. (symbol_uses_obj): New function. (which_symbols): Use it. Work for lispsym symbols, too. (init_alloc_once): Initialize Vpurify_flag here; no need to wait, since Qt's address is already known now. (syms_of_alloc): Add lispsym count to symbols_consed. * buffer.c (init_buffer_once): Compare to Qnil, not to make_number (0), when testing whether storage is all bits zero. * dispextern (struct image_type): * font.c (font_property_table): * frame.c (struct frame_parm_table, frame_parms): * keyboard.c (scroll_bar_parts, struct event_head): * xdisp.c (struct props): Use XSYMBOL_INIT (Qfoo) and struct Lisp_Symbol * rather than &Qfoo and Lisp_Object *, since Qfoo is no longer an object whose address can be taken. All uses changed. * eval.c (run_hook): New function. Most uses of Frun_hooks changed to use it, so that they no longer need to take the address of a Lisp sym. (syms_of_eval): Don't use DEFSYM on Vrun_hooks, as it's a variable. * frame.c (syms_of_frame): Add defsyms for the frame_parms table. * keyboard.c (syms_of_keyboard): Don't DEFSYM Qmenu_bar here. DEFSYM Qdeactivate_mark before the corresponding var. * keymap.c (syms_of_keymap): Use DEFSYM for Qmenu_bar and Qmode_line instead of interning their symbols; this avoids duplicates. (LISP_INITIALLY, TAG_PTR) (DEFINE_LISP_SYMBOL_BEGIN, DEFINE_LISP_SYMBOL_END, XSYMBOL_INIT): New macros. (LISP_INITIALLY_ZERO): Use it. (enum symbol_interned, enum symbol_redirect, struct Lisp_Symbol) (EXFUN, DEFUN_ARGS_MANY, DEFUN_ARGS_UNEVALLED, DEFUN_ARGS_*): Move decls up, to avoid forward uses. Include globals.h earlier, too. (make_lisp_symbol): New function. (XSETSYMBOL): Use it. (DEFSYM): Now just a placeholder for make-docfile. * lread.c (DEFINE_SYMBOLS): Define, for globals.h. (intern_sym): New function, with body taken from old intern_driver. (intern_driver): Use it. Last arg is now Lisp integer, not ptrdiff_t. All uses changed. (define_symbol): New function. (init_obarray): Define the C symbols taken from lispsym. Use plain DEFSYM for Qt and Qnil. * syntax.c (init_syntax_once): No need to worry about Qchar_table_extra_slots.
Diffstat (limited to 'src/frame.c')
-rw-r--r--src/frame.c186
1 files changed, 74 insertions, 112 deletions
diff --git a/src/frame.c b/src/frame.c
index 9394ae481f5..fb9bf2e9cbb 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -55,76 +55,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
55#include "widget.h" 55#include "widget.h"
56#endif 56#endif
57 57
58#ifdef HAVE_NS
59Lisp_Object Qns_parse_geometry;
60#endif
61
62Lisp_Object Qframep, Qframe_live_p;
63Lisp_Object Qicon, Qmodeline;
64Lisp_Object Qonly, Qnone;
65Lisp_Object Qx, Qw32, Qpc, Qns;
66Lisp_Object Qvisible;
67Lisp_Object Qdisplay_type;
68static Lisp_Object Qbackground_mode;
69Lisp_Object Qnoelisp;
70
71static Lisp_Object Qx_frame_parameter;
72Lisp_Object Qx_resource_name;
73Lisp_Object Qterminal;
74
75/* Frame parameters (set or reported). */
76
77Lisp_Object Qauto_raise, Qauto_lower;
78Lisp_Object Qborder_color, Qborder_width;
79Lisp_Object Qcursor_color, Qcursor_type;
80Lisp_Object Qheight, Qwidth;
81Lisp_Object Qicon_left, Qicon_top, Qicon_type, Qicon_name;
82Lisp_Object Qtooltip;
83Lisp_Object Qinternal_border_width;
84Lisp_Object Qright_divider_width, Qbottom_divider_width;
85Lisp_Object Qmouse_color;
86Lisp_Object Qminibuffer;
87Lisp_Object Qscroll_bar_width, Qvertical_scroll_bars;
88Lisp_Object Qscroll_bar_height, Qhorizontal_scroll_bars;
89Lisp_Object Qvisibility;
90Lisp_Object Qscroll_bar_foreground, Qscroll_bar_background;
91Lisp_Object Qscreen_gamma;
92Lisp_Object Qline_spacing;
93static Lisp_Object Quser_position, Quser_size;
94Lisp_Object Qwait_for_wm;
95static Lisp_Object Qwindow_id;
96#ifdef HAVE_X_WINDOWS
97static Lisp_Object Qouter_window_id;
98#endif
99Lisp_Object Qparent_id;
100Lisp_Object Qtitle, Qname;
101static Lisp_Object Qexplicit_name;
102Lisp_Object Qunsplittable;
103Lisp_Object Qmenu_bar_lines, Qtool_bar_lines, Qtool_bar_position;
104Lisp_Object Qleft_fringe, Qright_fringe;
105Lisp_Object Qbuffer_predicate;
106static Lisp_Object Qbuffer_list, Qburied_buffer_list;
107Lisp_Object Qtty_color_mode;
108Lisp_Object Qtty, Qtty_type;
109
110Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth, Qmaximized;
111Lisp_Object Qsticky;
112Lisp_Object Qfont_backend;
113Lisp_Object Qalpha;
114
115Lisp_Object Qface_set_after_frame_default;
116
117static Lisp_Object Qfocus_in_hook;
118static Lisp_Object Qfocus_out_hook;
119static Lisp_Object Qdelete_frame_functions;
120static Lisp_Object Qframe_windows_min_size;
121static Lisp_Object Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource;
122
123Lisp_Object Qframe_position, Qframe_outer_size, Qframe_inner_size;
124Lisp_Object Qexternal_border_size, Qtitle_height;
125Lisp_Object Qmenu_bar_external, Qmenu_bar_size;
126Lisp_Object Qtool_bar_external, Qtool_bar_size;
127
128/* The currently selected frame. */ 58/* The currently selected frame. */
129 59
130Lisp_Object selected_frame; 60Lisp_Object selected_frame;
@@ -1221,7 +1151,7 @@ to that frame. */)
1221{ 1151{
1222 /* Preserve prefix arg that the command loop just cleared. */ 1152 /* Preserve prefix arg that the command loop just cleared. */
1223 kset_prefix_arg (current_kboard, Vcurrent_prefix_arg); 1153 kset_prefix_arg (current_kboard, Vcurrent_prefix_arg);
1224 Frun_hooks (1, &Qmouse_leave_buffer_hook); 1154 run_hook (Qmouse_leave_buffer_hook);
1225 /* `switch-frame' implies a focus in. */ 1155 /* `switch-frame' implies a focus in. */
1226 call1 (intern ("handle-focus-in"), event); 1156 call1 (intern ("handle-focus-in"), event);
1227 return do_switch_frame (event, 0, 0, Qnil); 1157 return do_switch_frame (event, 0, 0, Qnil);
@@ -2995,48 +2925,48 @@ or bottommost possible position (that stays within the screen). */)
2995 2925
2996struct frame_parm_table { 2926struct frame_parm_table {
2997 const char *name; 2927 const char *name;
2998 Lisp_Object *variable; 2928 struct Lisp_Symbol *sym;
2999}; 2929};
3000 2930
3001static const struct frame_parm_table frame_parms[] = 2931static const struct frame_parm_table frame_parms[] =
3002{ 2932{
3003 {"auto-raise", &Qauto_raise}, 2933 {"auto-raise", XSYMBOL_INIT (Qauto_raise)},
3004 {"auto-lower", &Qauto_lower}, 2934 {"auto-lower", XSYMBOL_INIT (Qauto_lower)},
3005 {"background-color", 0}, 2935 {"background-color", 0},
3006 {"border-color", &Qborder_color}, 2936 {"border-color", XSYMBOL_INIT (Qborder_color)},
3007 {"border-width", &Qborder_width}, 2937 {"border-width", XSYMBOL_INIT (Qborder_width)},
3008 {"cursor-color", &Qcursor_color}, 2938 {"cursor-color", XSYMBOL_INIT (Qcursor_color)},
3009 {"cursor-type", &Qcursor_type}, 2939 {"cursor-type", XSYMBOL_INIT (Qcursor_type)},
3010 {"font", 0}, 2940 {"font", 0},
3011 {"foreground-color", 0}, 2941 {"foreground-color", 0},
3012 {"icon-name", &Qicon_name}, 2942 {"icon-name", XSYMBOL_INIT (Qicon_name)},
3013 {"icon-type", &Qicon_type}, 2943 {"icon-type", XSYMBOL_INIT (Qicon_type)},
3014 {"internal-border-width", &Qinternal_border_width}, 2944 {"internal-border-width", XSYMBOL_INIT (Qinternal_border_width)},
3015 {"right-divider-width", &Qright_divider_width}, 2945 {"right-divider-width", XSYMBOL_INIT (Qright_divider_width)},
3016 {"bottom-divider-width", &Qbottom_divider_width}, 2946 {"bottom-divider-width", XSYMBOL_INIT (Qbottom_divider_width)},
3017 {"menu-bar-lines", &Qmenu_bar_lines}, 2947 {"menu-bar-lines", XSYMBOL_INIT (Qmenu_bar_lines)},
3018 {"mouse-color", &Qmouse_color}, 2948 {"mouse-color", XSYMBOL_INIT (Qmouse_color)},
3019 {"name", &Qname}, 2949 {"name", XSYMBOL_INIT (Qname)},
3020 {"scroll-bar-width", &Qscroll_bar_width}, 2950 {"scroll-bar-width", XSYMBOL_INIT (Qscroll_bar_width)},
3021 {"scroll-bar-height", &Qscroll_bar_height}, 2951 {"scroll-bar-height", XSYMBOL_INIT (Qscroll_bar_height)},
3022 {"title", &Qtitle}, 2952 {"title", XSYMBOL_INIT (Qtitle)},
3023 {"unsplittable", &Qunsplittable}, 2953 {"unsplittable", XSYMBOL_INIT (Qunsplittable)},
3024 {"vertical-scroll-bars", &Qvertical_scroll_bars}, 2954 {"vertical-scroll-bars", XSYMBOL_INIT (Qvertical_scroll_bars)},
3025 {"horizontal-scroll-bars", &Qhorizontal_scroll_bars}, 2955 {"horizontal-scroll-bars", XSYMBOL_INIT (Qhorizontal_scroll_bars)},
3026 {"visibility", &Qvisibility}, 2956 {"visibility", XSYMBOL_INIT (Qvisibility)},
3027 {"tool-bar-lines", &Qtool_bar_lines}, 2957 {"tool-bar-lines", XSYMBOL_INIT (Qtool_bar_lines)},
3028 {"scroll-bar-foreground", &Qscroll_bar_foreground}, 2958 {"scroll-bar-foreground", XSYMBOL_INIT (Qscroll_bar_foreground)},
3029 {"scroll-bar-background", &Qscroll_bar_background}, 2959 {"scroll-bar-background", XSYMBOL_INIT (Qscroll_bar_background)},
3030 {"screen-gamma", &Qscreen_gamma}, 2960 {"screen-gamma", XSYMBOL_INIT (Qscreen_gamma)},
3031 {"line-spacing", &Qline_spacing}, 2961 {"line-spacing", XSYMBOL_INIT (Qline_spacing)},
3032 {"left-fringe", &Qleft_fringe}, 2962 {"left-fringe", XSYMBOL_INIT (Qleft_fringe)},
3033 {"right-fringe", &Qright_fringe}, 2963 {"right-fringe", XSYMBOL_INIT (Qright_fringe)},
3034 {"wait-for-wm", &Qwait_for_wm}, 2964 {"wait-for-wm", XSYMBOL_INIT (Qwait_for_wm)},
3035 {"fullscreen", &Qfullscreen}, 2965 {"fullscreen", XSYMBOL_INIT (Qfullscreen)},
3036 {"font-backend", &Qfont_backend}, 2966 {"font-backend", XSYMBOL_INIT (Qfont_backend)},
3037 {"alpha", &Qalpha}, 2967 {"alpha", XSYMBOL_INIT (Qalpha)},
3038 {"sticky", &Qsticky}, 2968 {"sticky", XSYMBOL_INIT (Qsticky)},
3039 {"tool-bar-position", &Qtool_bar_position}, 2969 {"tool-bar-position", XSYMBOL_INIT (Qtool_bar_position)},
3040}; 2970};
3041 2971
3042#ifdef HAVE_WINDOW_SYSTEM 2972#ifdef HAVE_WINDOW_SYSTEM
@@ -4854,17 +4784,49 @@ syms_of_frame (void)
4854 DEFSYM (Qns_parse_geometry, "ns-parse-geometry"); 4784 DEFSYM (Qns_parse_geometry, "ns-parse-geometry");
4855#endif 4785#endif
4856 4786
4787 DEFSYM (Qalpha, "alpha");
4788 DEFSYM (Qauto_lower, "auto-lower");
4789 DEFSYM (Qauto_raise, "auto-raise");
4790 DEFSYM (Qborder_color, "border-color");
4791 DEFSYM (Qborder_width, "border-width");
4792 DEFSYM (Qbottom_divider_width, "bottom-divider-width");
4793 DEFSYM (Qcursor_color, "cursor-color");
4794 DEFSYM (Qcursor_type, "cursor-type");
4795 DEFSYM (Qfont_backend, "font-backend");
4796 DEFSYM (Qfullscreen, "fullscreen");
4797 DEFSYM (Qhorizontal_scroll_bars, "horizontal-scroll-bars");
4798 DEFSYM (Qicon_name, "icon-name");
4799 DEFSYM (Qicon_type, "icon-type");
4800 DEFSYM (Qinternal_border_width, "internal-border-width");
4801 DEFSYM (Qleft_fringe, "left-fringe");
4802 DEFSYM (Qline_spacing, "line-spacing");
4803 DEFSYM (Qmenu_bar_lines, "menu-bar-lines");
4804 DEFSYM (Qmouse_color, "mouse-color");
4805 DEFSYM (Qname, "name");
4806 DEFSYM (Qright_divider_width, "right-divider-width");
4807 DEFSYM (Qright_fringe, "right-fringe");
4808 DEFSYM (Qscreen_gamma, "screen-gamma");
4809 DEFSYM (Qscroll_bar_background, "scroll-bar-background");
4810 DEFSYM (Qscroll_bar_foreground, "scroll-bar-foreground");
4811 DEFSYM (Qscroll_bar_height, "scroll-bar-height");
4812 DEFSYM (Qscroll_bar_width, "scroll-bar-width");
4813 DEFSYM (Qsticky, "sticky");
4814 DEFSYM (Qtitle, "title");
4815 DEFSYM (Qtool_bar_lines, "tool-bar-lines");
4816 DEFSYM (Qtool_bar_position, "tool-bar-position");
4817 DEFSYM (Qunsplittable, "unsplittable");
4818 DEFSYM (Qvertical_scroll_bars, "vertical-scroll-bars");
4819 DEFSYM (Qvisibility, "visibility");
4820 DEFSYM (Qwait_for_wm, "wait-for-wm");
4821
4857 { 4822 {
4858 int i; 4823 int i;
4859 4824
4860 for (i = 0; i < ARRAYELTS (frame_parms); i++) 4825 for (i = 0; i < ARRAYELTS (frame_parms); i++)
4861 { 4826 {
4862 Lisp_Object v = intern_c_string (frame_parms[i].name); 4827 Lisp_Object v = (frame_parms[i].sym
4863 if (frame_parms[i].variable) 4828 ? make_lisp_symbol (frame_parms[i].sym)
4864 { 4829 : intern_c_string (frame_parms[i].name));
4865 *frame_parms[i].variable = v;
4866 staticpro (frame_parms[i].variable);
4867 }
4868 Fput (v, Qx_frame_parameter, make_number (i)); 4830 Fput (v, Qx_frame_parameter, make_number (i));
4869 } 4831 }
4870 } 4832 }