aboutsummaryrefslogtreecommitdiffstats
path: root/src/menu.c
diff options
context:
space:
mode:
authorDan Nicolaescu2010-07-04 00:50:25 -0700
committerDan Nicolaescu2010-07-04 00:50:25 -0700
commit971de7fb158335fbda39525feb2d7776a26bc030 (patch)
tree605333d85f16e35bb06baffcb66ac49f4ec0dce9 /src/menu.c
parentb8463cbfbe2c5183cf40772df2746e58b787ddeb (diff)
downloademacs-971de7fb158335fbda39525feb2d7776a26bc030.tar.gz
emacs-971de7fb158335fbda39525feb2d7776a26bc030.zip
Convert (most) functions in src to standard C.
* src/alloc.c: Convert function definitions to standard C. * src/atimer.c: * src/bidi.c: * src/bytecode.c: * src/callint.c: * src/callproc.c: * src/casefiddle.c: * src/casetab.c: * src/category.c: * src/ccl.c: * src/character.c: * src/charset.c: * src/chartab.c: * src/cmds.c: * src/coding.c: * src/composite.c: * src/data.c: * src/dbusbind.c: * src/dired.c: * src/dispnew.c: * src/doc.c: * src/doprnt.c: * src/ecrt0.c: * src/editfns.c: * src/fileio.c: * src/filelock.c: * src/filemode.c: * src/fns.c: * src/font.c: * src/fontset.c: * src/frame.c: * src/fringe.c: * src/ftfont.c: * src/ftxfont.c: * src/gtkutil.c: * src/indent.c: * src/insdel.c: * src/intervals.c: * src/keymap.c: * src/lread.c: * src/macros.c: * src/marker.c: * src/md5.c: * src/menu.c: * src/minibuf.c: * src/prefix-args.c: * src/print.c: * src/ralloc.c: * src/regex.c: * src/region-cache.c: * src/scroll.c: * src/search.c: * src/sound.c: * src/strftime.c: * src/syntax.c: * src/sysdep.c: * src/termcap.c: * src/terminal.c: * src/terminfo.c: * src/textprop.c: * src/tparam.c: * src/undo.c: * src/unexelf.c: * src/window.c: * src/xfaces.c: * src/xfns.c: * src/xfont.c: * src/xftfont.c: * src/xgselect.c: * src/xmenu.c: * src/xrdb.c: * src/xselect.c: * src/xsettings.c: * src/xsmfns.c: * src/xterm.c: Likewise.
Diffstat (limited to 'src/menu.c')
-rw-r--r--src/menu.c64
1 files changed, 23 insertions, 41 deletions
diff --git a/src/menu.c b/src/menu.c
index 55b1acb3fb9..a90c71219d3 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -87,7 +87,7 @@ int menu_items_n_panes;
87static int menu_items_submenu_depth; 87static int menu_items_submenu_depth;
88 88
89void 89void
90init_menu_items () 90init_menu_items (void)
91{ 91{
92 if (!NILP (menu_items_inuse)) 92 if (!NILP (menu_items_inuse))
93 error ("Trying to use a menu from within a menu-entry"); 93 error ("Trying to use a menu from within a menu-entry");
@@ -107,13 +107,12 @@ init_menu_items ()
107/* Call at the end of generating the data in menu_items. */ 107/* Call at the end of generating the data in menu_items. */
108 108
109void 109void
110finish_menu_items () 110finish_menu_items (void)
111{ 111{
112} 112}
113 113
114Lisp_Object 114Lisp_Object
115unuse_menu_items (dummy) 115unuse_menu_items (Lisp_Object dummy)
116 Lisp_Object dummy;
117{ 116{
118 return menu_items_inuse = Qnil; 117 return menu_items_inuse = Qnil;
119} 118}
@@ -122,7 +121,7 @@ unuse_menu_items (dummy)
122 in menu_items. */ 121 in menu_items. */
123 122
124void 123void
125discard_menu_items () 124discard_menu_items (void)
126{ 125{
127 /* Free the structure if it is especially large. 126 /* Free the structure if it is especially large.
128 Otherwise, hold on to it, to save time. */ 127 Otherwise, hold on to it, to save time. */
@@ -145,8 +144,7 @@ cleanup_popup_menu (Lisp_Object arg)
145 mechanism. */ 144 mechanism. */
146 145
147static Lisp_Object 146static Lisp_Object
148restore_menu_items (saved) 147restore_menu_items (Lisp_Object saved)
149 Lisp_Object saved;
150{ 148{
151 menu_items = XCAR (saved); 149 menu_items = XCAR (saved);
152 menu_items_inuse = (! NILP (menu_items) ? Qt : Qnil); 150 menu_items_inuse = (! NILP (menu_items) ? Qt : Qnil);
@@ -164,7 +162,7 @@ restore_menu_items (saved)
164 It will be restored when the specpdl is unwound. */ 162 It will be restored when the specpdl is unwound. */
165 163
166void 164void
167save_menu_items () 165save_menu_items (void)
168{ 166{
169 Lisp_Object saved = list4 (!NILP (menu_items_inuse) ? menu_items : Qnil, 167 Lisp_Object saved = list4 (!NILP (menu_items_inuse) ? menu_items : Qnil,
170 make_number (menu_items_used), 168 make_number (menu_items_used),
@@ -179,7 +177,7 @@ save_menu_items ()
179/* Make the menu_items vector twice as large. */ 177/* Make the menu_items vector twice as large. */
180 178
181static void 179static void
182grow_menu_items () 180grow_menu_items (void)
183{ 181{
184 menu_items_allocated *= 2; 182 menu_items_allocated *= 2;
185 menu_items = larger_vector (menu_items, menu_items_allocated, Qnil); 183 menu_items = larger_vector (menu_items, menu_items_allocated, Qnil);
@@ -188,7 +186,7 @@ grow_menu_items ()
188/* Begin a submenu. */ 186/* Begin a submenu. */
189 187
190static void 188static void
191push_submenu_start () 189push_submenu_start (void)
192{ 190{
193 if (menu_items_used + 1 > menu_items_allocated) 191 if (menu_items_used + 1 > menu_items_allocated)
194 grow_menu_items (); 192 grow_menu_items ();
@@ -200,7 +198,7 @@ push_submenu_start ()
200/* End a submenu. */ 198/* End a submenu. */
201 199
202static void 200static void
203push_submenu_end () 201push_submenu_end (void)
204{ 202{
205 if (menu_items_used + 1 > menu_items_allocated) 203 if (menu_items_used + 1 > menu_items_allocated)
206 grow_menu_items (); 204 grow_menu_items ();
@@ -212,7 +210,7 @@ push_submenu_end ()
212/* Indicate boundary between left and right. */ 210/* Indicate boundary between left and right. */
213 211
214static void 212static void
215push_left_right_boundary () 213push_left_right_boundary (void)
216{ 214{
217 if (menu_items_used + 1 > menu_items_allocated) 215 if (menu_items_used + 1 > menu_items_allocated)
218 grow_menu_items (); 216 grow_menu_items ();
@@ -224,8 +222,7 @@ push_left_right_boundary ()
224 NAME is the pane name. PREFIX_VEC is a prefix key for this pane. */ 222 NAME is the pane name. PREFIX_VEC is a prefix key for this pane. */
225 223
226static void 224static void
227push_menu_pane (name, prefix_vec) 225push_menu_pane (Lisp_Object name, Lisp_Object prefix_vec)
228 Lisp_Object name, prefix_vec;
229{ 226{
230 if (menu_items_used + MENU_ITEMS_PANE_LENGTH > menu_items_allocated) 227 if (menu_items_used + MENU_ITEMS_PANE_LENGTH > menu_items_allocated)
231 grow_menu_items (); 228 grow_menu_items ();
@@ -246,8 +243,7 @@ push_menu_pane (name, prefix_vec)
246 item, one of nil, `toggle' or `radio'. */ 243 item, one of nil, `toggle' or `radio'. */
247 244
248static void 245static void
249push_menu_item (name, enable, key, def, equiv, type, selected, help) 246push_menu_item (Lisp_Object name, Lisp_Object enable, Lisp_Object key, Lisp_Object def, Lisp_Object equiv, Lisp_Object type, Lisp_Object selected, Lisp_Object help)
250 Lisp_Object name, enable, key, def, equiv, type, selected, help;
251{ 247{
252 if (menu_items_used + MENU_ITEMS_ITEM_LENGTH > menu_items_allocated) 248 if (menu_items_used + MENU_ITEMS_ITEM_LENGTH > menu_items_allocated)
253 grow_menu_items (); 249 grow_menu_items ();
@@ -332,9 +328,7 @@ single_keymap_panes (Lisp_Object keymap, Lisp_Object pane_name,
332 If we encounter submenus deeper than SKP->MAXDEPTH levels, ignore them. */ 328 If we encounter submenus deeper than SKP->MAXDEPTH levels, ignore them. */
333 329
334static void 330static void
335single_menu_item (key, item, dummy, skp_v) 331single_menu_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy, void *skp_v)
336 Lisp_Object key, item, dummy;
337 void *skp_v;
338{ 332{
339 Lisp_Object map, item_string, enabled; 333 Lisp_Object map, item_string, enabled;
340 struct gcpro gcpro1, gcpro2; 334 struct gcpro gcpro1, gcpro2;
@@ -456,9 +450,7 @@ single_menu_item (key, item, dummy, skp_v)
456 and generate menu panes for them in menu_items. */ 450 and generate menu panes for them in menu_items. */
457 451
458static void 452static void
459keymap_panes (keymaps, nmaps) 453keymap_panes (Lisp_Object *keymaps, int nmaps)
460 Lisp_Object *keymaps;
461 int nmaps;
462{ 454{
463 int mapno; 455 int mapno;
464 456
@@ -477,8 +469,7 @@ keymap_panes (keymaps, nmaps)
477 469
478/* Push the items in a single pane defined by the alist PANE. */ 470/* Push the items in a single pane defined by the alist PANE. */
479static void 471static void
480list_of_items (pane) 472list_of_items (Lisp_Object pane)
481 Lisp_Object pane;
482{ 473{
483 Lisp_Object tail, item, item1; 474 Lisp_Object tail, item, item1;
484 475
@@ -505,8 +496,7 @@ list_of_items (pane)
505 alist-of-alists MENU. 496 alist-of-alists MENU.
506 This handles old-fashioned calls to x-popup-menu. */ 497 This handles old-fashioned calls to x-popup-menu. */
507void 498void
508list_of_panes (menu) 499list_of_panes (Lisp_Object menu)
509 Lisp_Object menu;
510{ 500{
511 Lisp_Object tail; 501 Lisp_Object tail;
512 502
@@ -531,8 +521,7 @@ list_of_panes (menu)
531 whose event type is ITEM_KEY (with string ITEM_NAME) 521 whose event type is ITEM_KEY (with string ITEM_NAME)
532 and whose contents come from the list of keymaps MAPS. */ 522 and whose contents come from the list of keymaps MAPS. */
533int 523int
534parse_single_submenu (item_key, item_name, maps) 524parse_single_submenu (Lisp_Object item_key, Lisp_Object item_name, Lisp_Object maps)
535 Lisp_Object item_key, item_name, maps;
536{ 525{
537 Lisp_Object length; 526 Lisp_Object length;
538 int len; 527 int len;
@@ -583,7 +572,7 @@ parse_single_submenu (item_key, item_name, maps)
583/* Allocate a widget_value, blocking input. */ 572/* Allocate a widget_value, blocking input. */
584 573
585widget_value * 574widget_value *
586xmalloc_widget_value () 575xmalloc_widget_value (void)
587{ 576{
588 widget_value *value; 577 widget_value *value;
589 578
@@ -600,8 +589,7 @@ xmalloc_widget_value ()
600 must be left alone. */ 589 must be left alone. */
601 590
602void 591void
603free_menubar_widget_value_tree (wv) 592free_menubar_widget_value_tree (widget_value *wv)
604 widget_value *wv;
605{ 593{
606 if (! wv) return; 594 if (! wv) return;
607 595
@@ -627,8 +615,7 @@ free_menubar_widget_value_tree (wv)
627 in menu_items starting at index START, up to index END. */ 615 in menu_items starting at index START, up to index END. */
628 616
629widget_value * 617widget_value *
630digest_single_submenu (start, end, top_level_items) 618digest_single_submenu (int start, int end, int top_level_items)
631 int start, end, top_level_items;
632{ 619{
633 widget_value *wv, *prev_wv, *save_wv, *first_wv; 620 widget_value *wv, *prev_wv, *save_wv, *first_wv;
634 int i; 621 int i;
@@ -856,8 +843,7 @@ digest_single_submenu (start, end, top_level_items)
856 tree is constructed, and small strings are relocated. So we must wait 843 tree is constructed, and small strings are relocated. So we must wait
857 until no GC can happen before storing pointers into lisp values. */ 844 until no GC can happen before storing pointers into lisp values. */
858void 845void
859update_submenu_strings (first_wv) 846update_submenu_strings (widget_value *first_wv)
860 widget_value *first_wv;
861{ 847{
862 widget_value *wv; 848 widget_value *wv;
863 849
@@ -891,11 +877,7 @@ update_submenu_strings (first_wv)
891 VECTOR is an array of menu events for the whole menu. */ 877 VECTOR is an array of menu events for the whole menu. */
892 878
893void 879void
894find_and_call_menu_selection (f, menu_bar_items_used, vector, client_data) 880find_and_call_menu_selection (FRAME_PTR f, int menu_bar_items_used, Lisp_Object vector, void *client_data)
895 FRAME_PTR f;
896 int menu_bar_items_used;
897 Lisp_Object vector;
898 void *client_data;
899{ 881{
900 Lisp_Object prefix, entry; 882 Lisp_Object prefix, entry;
901 Lisp_Object *subprefix_stack; 883 Lisp_Object *subprefix_stack;
@@ -1368,7 +1350,7 @@ no quit occurs and `x-popup-menu' returns nil. */)
1368} 1350}
1369 1351
1370void 1352void
1371syms_of_menu () 1353syms_of_menu (void)
1372{ 1354{
1373 staticpro (&menu_items); 1355 staticpro (&menu_items);
1374 menu_items = Qnil; 1356 menu_items = Qnil;