changeset 95728:8776bde94a2c

(digest_single_submenu): Remove. (syms_of_w32menu): Don't initialise variables that have moved to menu.c.
author Jason Rumney <jasonr@gnu.org>
date Mon, 09 Jun 2008 22:05:54 +0000
parents 8fd7548ecb07
children 7aa7574f6edd
files src/w32menu.c
diffstat 1 files changed, 0 insertions(+), 182 deletions(-) [+]
line wrap: on
line diff
--- a/src/w32menu.c	Mon Jun 09 21:55:16 2008 +0000
+++ b/src/w32menu.c	Mon Jun 09 22:05:54 2008 +0000
@@ -623,186 +623,6 @@
 }
 
 
-/* Create a tree of widget_value objects
-   representing the panes and items
-   in menu_items starting at index START, up to index END.  */
-
-static widget_value *
-digest_single_submenu (start, end, top_level_items)
-     int start, end, top_level_items;
-{
-  widget_value *wv, *prev_wv, *save_wv, *first_wv;
-  int i;
-  int submenu_depth = 0;
-  widget_value **submenu_stack;
-
-  submenu_stack
-    = (widget_value **) alloca (menu_items_used * sizeof (widget_value *));
-  wv = xmalloc_widget_value ();
-  wv->name = "menu";
-  wv->value = 0;
-  wv->enabled = 1;
-  wv->button_type = BUTTON_TYPE_NONE;
-  wv->help = Qnil;
-  first_wv = wv;
-  save_wv = 0;
-  prev_wv = 0;
-
-  /* Loop over all panes and items made by the preceding call
-     to parse_single_submenu and construct a tree of widget_value objects.
-     Ignore the panes and items used by previous calls to
-     digest_single_submenu, even though those are also in menu_items.  */
-  i = start;
-  while (i < end)
-    {
-      if (EQ (AREF (menu_items, i), Qnil))
-	{
-	  submenu_stack[submenu_depth++] = save_wv;
-	  save_wv = prev_wv;
-	  prev_wv = 0;
-	  i++;
-	}
-      else if (EQ (AREF (menu_items, i), Qlambda))
-	{
-	  prev_wv = save_wv;
-	  save_wv = submenu_stack[--submenu_depth];
-	  i++;
-	}
-      else if (EQ (AREF (menu_items, i), Qt)
-	       && submenu_depth != 0)
-	i += MENU_ITEMS_PANE_LENGTH;
-      /* Ignore a nil in the item list.
-	 It's meaningful only for dialog boxes.  */
-      else if (EQ (AREF (menu_items, i), Qquote))
-	i += 1;
-      else if (EQ (AREF (menu_items, i), Qt))
-	{
-	  /* Create a new pane.  */
-	  Lisp_Object pane_name, prefix;
-	  char *pane_string;
-
-	  pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME);
-	  prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX);
-
-	  if (STRINGP (pane_name))
-	    {
-	      if (unicode_append_menu)
-		/* Encode as UTF-8 for now.  */
-		pane_name = ENCODE_UTF_8 (pane_name);
-	      else if (STRING_MULTIBYTE (pane_name))
-		pane_name = ENCODE_SYSTEM (pane_name);
-
-	      ASET (menu_items, i + MENU_ITEMS_PANE_NAME, pane_name);
-	    }
-
-	  pane_string = (NILP (pane_name)
-			 ? "" : (char *) SDATA (pane_name));
-	  /* If there is just one top-level pane, put all its items directly
-	     under the top-level menu.  */
-	  if (menu_items_n_panes == 1)
-	    pane_string = "";
-
-	  /* If the pane has a meaningful name,
-	     make the pane a top-level menu item
-	     with its items as a submenu beneath it.  */
-	  if (strcmp (pane_string, ""))
-	    {
-	      wv = xmalloc_widget_value ();
-	      if (save_wv)
-		save_wv->next = wv;
-	      else
-		first_wv->contents = wv;
-	      wv->lname = pane_name;
-	      /* Set value to 1 so update_submenu_strings can handle '@'  */
-	      wv->value = (char *) 1;
-	      wv->enabled = 1;
-	      wv->button_type = BUTTON_TYPE_NONE;
-	      wv->help = Qnil;
-	    }
-	  save_wv = wv;
-	  prev_wv = 0;
-	  i += MENU_ITEMS_PANE_LENGTH;
-	}
-      else
-	{
-	  /* Create a new item within current pane.  */
-	  Lisp_Object item_name, enable, descrip, def, type, selected;
-          Lisp_Object help;
-
-	  item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME);
-	  enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE);
-	  descrip = AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY);
-	  def = AREF (menu_items, i + MENU_ITEMS_ITEM_DEFINITION);
-	  type = AREF (menu_items, i + MENU_ITEMS_ITEM_TYPE);
-	  selected = AREF (menu_items, i + MENU_ITEMS_ITEM_SELECTED);
-	  help = AREF (menu_items, i + MENU_ITEMS_ITEM_HELP);
-
-	  if (STRINGP (item_name))
-	    {
-	      if (unicode_append_menu)
-		item_name = ENCODE_UTF_8 (item_name);
-	      else if (STRING_MULTIBYTE (item_name))
-		item_name = ENCODE_SYSTEM (item_name);
-
-	      ASET (menu_items, i + MENU_ITEMS_ITEM_NAME, item_name);
-	    }
-
-	  if (STRINGP (descrip) && STRING_MULTIBYTE (descrip))
-	    {
-	      descrip = ENCODE_SYSTEM (descrip);
-	      ASET (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY, descrip);
-	    }
-
-	  wv = xmalloc_widget_value ();
-	  if (prev_wv)
-	    prev_wv->next = wv;
-	  else
-	    save_wv->contents = wv;
-
-	  wv->lname = item_name;
-	  if (!NILP (descrip))
-	    wv->lkey = descrip;
-	  wv->value = 0;
-	  /* The EMACS_INT cast avoids a warning.  There's no problem
-	     as long as pointers have enough bits to hold small integers.  */
-	  wv->call_data = (!NILP (def) ? (void *) (EMACS_INT) i : 0);
-	  wv->enabled = !NILP (enable);
-
-	  if (NILP (type))
-	    wv->button_type = BUTTON_TYPE_NONE;
-	  else if (EQ (type, QCradio))
-	    wv->button_type = BUTTON_TYPE_RADIO;
-	  else if (EQ (type, QCtoggle))
-	    wv->button_type = BUTTON_TYPE_TOGGLE;
-	  else
-	    abort ();
-
-	  wv->selected = !NILP (selected);
-	  if (!STRINGP (help))
-	    help = Qnil;
-
-	  wv->help = help;
-
-	  prev_wv = wv;
-
-	  i += MENU_ITEMS_ITEM_LENGTH;
-	}
-    }
-
-  /* If we have just one "menu item"
-     that was originally a button, return it by itself.  */
-  if (top_level_items && first_wv->contents && first_wv->contents->next == 0)
-    {
-      wv = first_wv->contents;
-      free_widget_value (first_wv);
-      return wv;
-    }
-
-  return first_wv;
-}
-
-
-
 /* Set the contents of the menubar widgets of frame F.
    The argument FIRST_TIME is currently ignored;
    it is set the first time this is called, from initialize_frame_menubar.  */
@@ -2135,8 +1955,6 @@
 void syms_of_w32menu ()
 {
   globals_of_w32menu ();
-  staticpro (&menu_items);
-  menu_items = Qnil;
 
   current_popup_menu = NULL;