]>
code.delx.au - gnu-emacs/blob - src/xmenu.c
1 /* X Communication module for terminals which understand the X protocol.
2 Copyright (C) 1986, 1988, 1993 Free Software Foundation, Inc.
4 This file is part of GNU Emacs.
6 GNU Emacs is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU Emacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Emacs; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
20 /* X pop-up deck-of-cards menu facility for gnuemacs.
22 * Written by Jon Arnold and Roman Budzianowski
23 * Mods and rewrite by Robert Krawitz
31 /* On 4.3 this loses if it comes after xterm.h. */
38 #include "blockinput.h"
40 /* This may include sys/types.h, and that somehow loses
41 if this is not done before the other system files. */
44 /* Load sys/types.h if not already loaded.
45 In some systems loading it twice is suicidal. */
47 #include <sys/types.h>
50 #include "dispextern.h"
53 #include "../oldXMenu/XMenu.h"
58 #define min(x,y) (((x) < (y)) ? (x) : (y))
59 #define max(x,y) (((x) > (y)) ? (x) : (y))
69 extern Display
*x_current_display
;
71 #define ButtonReleaseMask ButtonReleased
72 #endif /* not HAVE_X11 */
74 extern Lisp_Object Qmenu_enable
;
75 Lisp_Object
xmenu_show ();
76 extern int x_error_handler ();
78 /*************************************************************/
81 /* Ignoring the args is easiest. */
84 error ("Unknown XMenu error");
88 DEFUN ("x-popup-menu",Fx_popup_menu
, Sx_popup_menu
, 1, 2, 0,
89 "Pop up a deck-of-cards menu and return user's selection.\n\
90 POSITION is a position specification. This is either a mouse button event\n\
91 or a list ((XOFFSET YOFFSET) WINDOW)\n\
92 where XOFFSET and YOFFSET are positions in characters from the top left\n\
93 corner of WINDOW's frame. (WINDOW may be a frame object instead of a window.)\n\
94 This controls the position of the center of the first line\n\
95 in the first pane of the menu, not the top left of the menu as a whole.\n\
97 MENU is a specifier for a menu. For the simplest case, MENU is a keymap.\n\
98 The menu items come from key bindings that have a menu string as well as\n\
99 a definition; actually, the \"definition\" in such a key binding looks like\n\
100 \(STRING . REAL-DEFINITION). To give the menu a title, put a string into\n\
101 the keymap as a top-level element.\n\n\
102 You can also use a list of keymaps as MENU.\n\
103 Then each keymap makes a separate pane.\n\
104 When MENU is a keymap or a list of keymaps, the return value\n\
105 is a list of events.\n\n\
106 Alternatively, you can specify a menu of multiple panes\n\
107 with a list of the form (TITLE PANE1 PANE2...),\n\
108 where each pane is a list of form (TITLE ITEM1 ITEM2...).\n\
109 Each ITEM is normally a cons cell (STRING . VALUE);\n\
110 but a string can appear as an item--that makes a nonselectable line\n\
112 With this form of menu, the return value is VALUE from the chosen item.")
114 Lisp_Object position
, menu
;
117 Lisp_Object XMenu_return
, keymap
, tem
;
118 int XMenu_xpos
, XMenu_ypos
;
122 Lisp_Object
**obj_list
;
123 Lisp_Object
*prefixes
;
127 Lisp_Object ltitle
, selection
;
130 Lisp_Object x
, y
, window
;
132 /* Decode the first argument: find the window and the coordinates. */
133 tem
= Fcar (position
);
134 if (XTYPE (tem
) == Lisp_Cons
)
136 window
= Fcar (Fcdr (position
));
138 y
= Fcar (Fcdr (tem
));
142 tem
= Fcar (Fcdr (position
)); /* EVENT_START (position) */
143 window
= Fcar (tem
); /* POSN_WINDOW (tem) */
144 tem
= Fcar (Fcdr (Fcdr (tem
))); /* POSN_WINDOW_POSN (tem) */
151 if (XTYPE (window
) == Lisp_Frame
)
158 else if (XTYPE (window
) == Lisp_Window
)
160 CHECK_LIVE_WINDOW (window
, 0);
161 f
= XFRAME (WINDOW_FRAME (XWINDOW (window
)));
163 XMenu_xpos
= FONT_WIDTH (f
->display
.x
->font
) * XWINDOW (window
)->left
;
164 XMenu_ypos
= FONT_HEIGHT (f
->display
.x
->font
) * XWINDOW (window
)->top
;
167 XMenu_xpos
+= FONT_WIDTH (f
->display
.x
->font
) * XINT (x
);
168 XMenu_ypos
+= FONT_HEIGHT (f
->display
.x
->font
) * XINT (y
);
170 XMenu_xpos
+= f
->display
.x
->left_pos
;
171 XMenu_ypos
+= f
->display
.x
->top_pos
;
173 keymap
= Fkeymapp (menu
);
175 if (XTYPE (menu
) == Lisp_Cons
)
176 tem
= Fkeymapp (Fcar (menu
));
179 /* We were given a keymap. Extract menu info from the keymap. */
181 keymap
= get_keymap (menu
);
183 /* Search for a string appearing directly as an element of the keymap.
184 That string is the title of the menu. */
185 prompt
= map_prompt (keymap
);
187 title
= (char *) XSTRING (prompt
)->data
;
189 /* Extract the detailed info to make one pane. */
190 number_of_panes
= keymap_panes (&obj_list
, &menus
, &names
, &enables
,
192 /* The menu title seems to be ignored,
193 so put it in the pane title. */
197 else if (!NILP (tem
))
199 /* We were given a list of keymaps. */
201 int nmaps
= XFASTINT (Flength (menu
));
203 = (Lisp_Object
*) alloca (nmaps
* sizeof (Lisp_Object
));
207 /* The first keymap that has a prompt string
208 supplies the menu title. */
209 for (tem
= menu
, i
= 0; XTYPE (tem
) == Lisp_Cons
; tem
= Fcdr (tem
))
211 maps
[i
++] = keymap
= get_keymap (Fcar (tem
));
213 prompt
= map_prompt (keymap
);
214 if (title
== 0 && !NILP (prompt
))
215 title
= (char *) XSTRING (prompt
)->data
;
218 /* Extract the detailed info to make one pane. */
219 number_of_panes
= keymap_panes (&obj_list
, &menus
, &names
, &enables
,
220 &items
, &prefixes
, maps
, nmaps
);
221 /* The menu title seems to be ignored,
222 so put it in the pane title. */
228 /* We were given an old-fashioned menu. */
229 ltitle
= Fcar (menu
);
230 CHECK_STRING (ltitle
, 1);
231 title
= (char *) XSTRING (ltitle
)->data
;
233 number_of_panes
= list_of_panes (&obj_list
, &menus
, &names
, &enables
,
234 &items
, Fcdr (menu
));
237 fprintf (stderr
, "Panes = %d\n", number_of_panes
);
238 for (i
= 0; i
< number_of_panes
; i
++)
240 fprintf (stderr
, "Pane %d has lines %d title %s\n",
241 i
, items
[i
], menus
[i
]);
242 for (j
= 0; j
< items
[i
]; j
++)
243 fprintf (stderr
, " Item %d %s\n", j
, names
[i
][j
]);
251 unsigned int dummy_uint
;
254 /* Figure out which root window F is on. */
255 XGetGeometry (x_current_display
, FRAME_X_WINDOW (f
), &root
,
256 &dummy_int
, &dummy_int
, &dummy_uint
, &dummy_uint
,
257 &dummy_uint
, &dummy_uint
);
259 /* Translate the menu co-ordinates within f to menu co-ordinates
260 on that root window. */
261 if (! XTranslateCoordinates (x_current_display
,
262 FRAME_X_WINDOW (f
), root
,
263 XMenu_xpos
, XMenu_ypos
, &root_x
, &root_y
,
265 /* But XGetGeometry said root was the root window of f's screen! */
268 selection
= xmenu_show (root
, XMenu_xpos
, XMenu_ypos
, names
, enables
,
269 menus
, prefixes
, items
, number_of_panes
, obj_list
,
273 /* fprintf (stderr, "selection = %x\n", selection); */
274 if (selection
!= NUL
)
275 { /* selected something */
276 XMenu_return
= selection
;
279 { /* nothing selected */
282 /* now free up the strings */
283 for (i
= 0; i
< number_of_panes
; i
++)
295 if (error_name
) error (error_name
);
305 xmenu_show (parent
, startx
, starty
, line_list
, enable_list
, pane_list
,
306 prefixes
, line_cnt
, pane_cnt
, item_list
, title
, error
)
308 int startx
, starty
; /* upper left corner position BROKEN */
309 char **line_list
[]; /* list of strings for items */
310 int *enable_list
[]; /* list of strings for items */
311 char *pane_list
[]; /* list of pane titles */
312 Lisp_Object
*prefixes
; /* Prefix key for each pane */
314 int pane_cnt
; /* total number of panes */
315 Lisp_Object
*item_list
[]; /* All items */
316 int line_cnt
[]; /* Lines in each pane */
317 char **error
; /* Error returned */
320 int last
, panes
, selidx
, lpane
, status
;
323 /* struct indices *datap, *datap_save; */
325 int ulx
, uly
, width
, height
;
326 int dispwidth
, dispheight
;
332 *error
= (char *) 0; /* Initialize error pointer to null */
333 GXMenu
= XMenuCreate (XDISPLAY parent
, "emacs");
336 *error
= "Can't create menu";
341 for (panes
= 0, lines
= 0; panes
< pane_cnt
;
342 lines
+= line_cnt
[panes
], panes
++)
344 /* datap = (struct indices *) xmalloc (lines * sizeof (struct indices)); */
345 /* datap = (char *) xmalloc (lines * sizeof (char));
346 datap_save = datap;*/
348 for (panes
= 0, sofar
= 0; panes
< pane_cnt
;
349 sofar
+= line_cnt
[panes
], panes
++)
351 /* create all the necessary panes */
352 lpane
= XMenuAddPane (XDISPLAY GXMenu
, pane_list
[panes
], TRUE
);
353 if (lpane
== XM_FAILURE
)
355 XMenuDestroy (XDISPLAY GXMenu
);
356 *error
= "Can't create pane";
360 for (selidx
= 0; selidx
< line_cnt
[panes
]; selidx
++)
362 /* add the selection stuff to the menus */
363 /* datap[selidx+sofar].pane = panes;
364 datap[selidx+sofar].line = selidx; */
365 if (XMenuAddSelection (XDISPLAY GXMenu
, lpane
, 0,
366 line_list
[panes
][selidx
],
367 enable_list
[panes
][selidx
])
370 XMenuDestroy (XDISPLAY GXMenu
);
372 *error
= "Can't add selection to menu";
373 /* error ("Can't add selection to menu"); */
379 /* all set and ready to fly */
380 XMenuRecompute (XDISPLAY GXMenu
);
381 dispwidth
= DisplayWidth (x_current_display
, XDefaultScreen (x_current_display
));
382 dispheight
= DisplayHeight (x_current_display
, XDefaultScreen (x_current_display
));
383 startx
= min (startx
, dispwidth
);
384 starty
= min (starty
, dispheight
);
385 startx
= max (startx
, 1);
386 starty
= max (starty
, 1);
387 XMenuLocate (XDISPLAY GXMenu
, 0, 0, startx
, starty
,
388 &ulx
, &uly
, &width
, &height
);
389 if (ulx
+width
> dispwidth
)
391 startx
-= (ulx
+ width
) - dispwidth
;
392 ulx
= dispwidth
- width
;
394 if (uly
+height
> dispheight
)
396 starty
-= (uly
+ height
) - dispheight
;
397 uly
= dispheight
- height
;
399 if (ulx
< 0) startx
-= ulx
;
400 if (uly
< 0) starty
-= uly
;
402 XMenuSetFreeze (GXMenu
, TRUE
);
405 status
= XMenuActivate (XDISPLAY GXMenu
, &panes
, &selidx
,
406 startx
, starty
, ButtonReleaseMask
, &datap
);
411 fprintf (stderr
, "pane= %d line = %d\n", panes
, selidx
);
413 entry
= item_list
[panes
][selidx
];
416 entry
= Fcons (entry
, Qnil
);
417 if (!NILP (prefixes
[panes
]))
418 entry
= Fcons (prefixes
[panes
], entry
);
422 /* free (datap_save); */
423 XMenuDestroy (XDISPLAY GXMenu
);
424 *error
= "Can't activate menu";
425 /* error ("Can't activate menu"); */
431 XMenuDestroy (XDISPLAY GXMenu
);
433 /* free (datap_save);*/
439 defsubr (&Sx_popup_menu
);
442 /* Construct the vectors that describe a menu
443 and store them in *VECTOR, *PANES, *NAMES, *ENABLES and *ITEMS.
444 Each of those four values is a vector indexed by pane number.
445 Return the number of panes.
447 KEYMAPS is a vector of keymaps. NMAPS gives the length of KEYMAPS. */
450 keymap_panes (vector
, panes
, names
, enables
, items
, prefixes
, keymaps
, nmaps
)
451 Lisp_Object
***vector
; /* RETURN all menu objects */
452 char ***panes
; /* RETURN pane names */
453 char ****names
; /* RETURN all line names */
454 int ***enables
; /* RETURN enable-flags of lines */
455 int **items
; /* RETURN number of items per pane */
456 Lisp_Object
**prefixes
; /* RETURN vector of prefix keys, per pane */
457 Lisp_Object
*keymaps
;
460 /* Number of panes we have made. */
462 /* Number of panes we have space for. */
463 int npanes_allocated
= nmaps
;
466 if (npanes_allocated
< 4)
467 npanes_allocated
= 4;
469 /* Make space for an estimated number of panes. */
470 *vector
= (Lisp_Object
**) xmalloc (npanes_allocated
* sizeof (Lisp_Object
*));
471 *panes
= (char **) xmalloc (npanes_allocated
* sizeof (char *));
472 *items
= (int *) xmalloc (npanes_allocated
* sizeof (int));
473 *names
= (char ***) xmalloc (npanes_allocated
* sizeof (char **));
474 *enables
= (int **) xmalloc (npanes_allocated
* sizeof (int *));
475 *prefixes
= (Lisp_Object
*) xmalloc (npanes_allocated
* sizeof (Lisp_Object
));
477 /* Loop over the given keymaps, making a pane for each map.
478 But don't make a pane that is empty--ignore that map instead.
479 P is the number of panes we have made so far. */
480 for (mapno
= 0; mapno
< nmaps
; mapno
++)
481 single_keymap_panes (keymaps
[mapno
], panes
, vector
, names
, enables
, items
,
482 prefixes
, &p
, &npanes_allocated
, "");
484 /* Return the number of panes. */
488 /* This is a recursive subroutine of the previous function.
489 It handles one keymap, KEYMAP.
490 The other arguments are passed along
491 or point to local variables of the previous function. */
493 single_keymap_panes (keymap
, panes
, vector
, names
, enables
, items
, prefixes
,
494 p_ptr
, npanes_allocated_ptr
, pane_name
)
496 Lisp_Object
***vector
; /* RETURN all menu objects */
497 char ***panes
; /* RETURN pane names */
498 char ****names
; /* RETURN all line names */
499 int ***enables
; /* RETURN enable flags of lines */
500 int **items
; /* RETURN number of items per pane */
501 Lisp_Object
**prefixes
; /* RETURN vector of prefix keys, per pane */
503 int *npanes_allocated_ptr
;
507 Lisp_Object pending_maps
;
508 Lisp_Object tail
, item
, item1
, item2
, table
;
512 /* Make sure we have room for another pane. */
513 if (*p_ptr
== *npanes_allocated_ptr
)
515 *npanes_allocated_ptr
*= 2;
518 = (Lisp_Object
**) xrealloc (*vector
,
519 *npanes_allocated_ptr
* sizeof (Lisp_Object
*));
521 = (char **) xrealloc (*panes
,
522 *npanes_allocated_ptr
* sizeof (char *));
524 = (int *) xrealloc (*items
,
525 *npanes_allocated_ptr
* sizeof (int));
527 = (Lisp_Object
*) xrealloc (*prefixes
,
528 (*npanes_allocated_ptr
529 * sizeof (Lisp_Object
)));
531 = (char ***) xrealloc (*names
,
532 *npanes_allocated_ptr
* sizeof (char **));
534 = (int **) xrealloc (*enables
,
535 *npanes_allocated_ptr
* sizeof (int *));
538 /* When a menu comes from keymaps, don't give names to the panes. */
539 (*panes
)[*p_ptr
] = pane_name
;
541 /* Normally put nil as pane's prefix key.
542 Caller will override this if appropriate. */
543 (*prefixes
)[*p_ptr
] = Qnil
;
545 /* Get the length of the list level of the keymap. */
546 i
= XFASTINT (Flength (keymap
));
548 /* Add in lengths of any arrays. */
549 for (tail
= keymap
; XTYPE (tail
) == Lisp_Cons
; tail
= XCONS (tail
)->cdr
)
550 if (XTYPE (XCONS (tail
)->car
) == Lisp_Vector
)
551 i
+= XVECTOR (XCONS (tail
)->car
)->size
;
553 /* Create vectors for the names and values of the items in the pane.
554 I is an upper bound for the number of items. */
555 (*vector
)[*p_ptr
] = (Lisp_Object
*) xmalloc (i
* sizeof (Lisp_Object
));
556 (*names
)[*p_ptr
] = (char **) xmalloc (i
* sizeof (char *));
557 (*enables
)[*p_ptr
] = (int *) xmalloc (i
* sizeof (int));
559 /* I is now the index of the next unused slots. */
561 for (tail
= keymap
; XTYPE (tail
) == Lisp_Cons
; tail
= XCONS (tail
)->cdr
)
563 /* Look at each key binding, and if it has a menu string,
564 make a menu item from it. */
565 item
= XCONS (tail
)->car
;
566 if (XTYPE (item
) == Lisp_Cons
)
568 item1
= XCONS (item
)->cdr
;
569 if (XTYPE (item1
) == Lisp_Cons
)
571 item2
= XCONS (item1
)->car
;
572 if (XTYPE (item2
) == Lisp_String
)
574 Lisp_Object def
, tem
;
579 if (XTYPE (def
) == Lisp_Symbol
)
581 /* No property, or nil, means enable.
582 Otherwise, enable if value is not nil. */
583 tem
= Fget (def
, Qmenu_enable
);
585 enabled
= Feval (tem
);
587 tem
= Fkeymapp (def
);
588 if (XSTRING (item2
)->data
[0] == '@' && !NILP (tem
))
589 pending_maps
= Fcons (Fcons (def
, Fcons (item2
, XCONS (item
)->car
)),
593 (*names
)[*p_ptr
][i
] = (char *) XSTRING (item2
)->data
;
594 /* The menu item "value" is the key bound here. */
595 (*vector
)[*p_ptr
][i
] = XCONS (item
)->car
;
596 (*enables
)[*p_ptr
][i
]
597 = (NILP (def
) ? -1 : !NILP (enabled
) ? 1 : 0);
603 else if (XTYPE (item
) == Lisp_Vector
)
605 /* Loop over the char values represented in the vector. */
606 int len
= XVECTOR (item
)->size
;
608 for (c
= 0; c
< len
; c
++)
610 Lisp_Object character
;
611 XFASTINT (character
) = c
;
612 item1
= XVECTOR (item
)->contents
[c
];
613 if (XTYPE (item1
) == Lisp_Cons
)
615 item2
= XCONS (item1
)->car
;
616 if (XTYPE (item2
) == Lisp_String
)
624 if (XTYPE (def
) == Lisp_Symbol
)
626 tem
= Fget (def
, Qmenu_enable
);
627 /* No property, or nil, means enable.
628 Otherwise, enable if value is not nil. */
630 enabled
= Feval (tem
);
633 tem
= Fkeymapp (def
);
634 if (XSTRING (item2
)->data
[0] == '@' && !NILP (tem
))
635 pending_maps
= Fcons (Fcons (def
, Fcons (item2
, character
)),
639 (*names
)[*p_ptr
][i
] = (char *) XSTRING (item2
)->data
;
640 /* The menu item "value" is the key bound here. */
641 (*vector
)[*p_ptr
][i
] = character
;
642 (*enables
)[*p_ptr
][i
]
643 = (NILP (def
) ? -1 : !NILP (enabled
) ? 1 : 0);
651 /* Record the number of items in the pane. */
652 (*items
)[*p_ptr
] = i
;
654 /* If we just made an empty pane, get rid of it. */
657 xfree ((*vector
)[*p_ptr
]);
658 xfree ((*names
)[*p_ptr
]);
659 xfree ((*enables
)[*p_ptr
]);
661 /* Otherwise, advance past it. */
665 /* Process now any submenus which want to be panes at this level. */
666 while (!NILP (pending_maps
))
668 Lisp_Object elt
, eltcdr
;
669 int panenum
= *p_ptr
;
670 elt
= Fcar (pending_maps
);
671 eltcdr
= XCONS (elt
)->cdr
;
672 single_keymap_panes (Fcar (elt
), panes
, vector
, names
, enables
, items
,
673 prefixes
, p_ptr
, npanes_allocated_ptr
,
674 /* Add 1 to discard the @. */
675 (char *) XSTRING (XCONS (eltcdr
)->car
)->data
+ 1);
676 (*prefixes
)[panenum
] = XCONS (eltcdr
)->cdr
;
677 pending_maps
= Fcdr (pending_maps
);
681 /* Construct the vectors that describe a menu
682 and store them in *VECTOR, *PANES, *NAMES, *ENABLES and *ITEMS.
683 Each of those four values is a vector indexed by pane number.
684 Return the number of panes.
686 MENU is the argument that was given to Fx_popup_menu. */
689 list_of_panes (vector
, panes
, names
, enables
, items
, menu
)
690 Lisp_Object
***vector
; /* RETURN all menu objects */
691 char ***panes
; /* RETURN pane names */
692 char ****names
; /* RETURN all line names */
693 int ***enables
; /* RETURN enable flags of lines */
694 int **items
; /* RETURN number of items per pane */
697 Lisp_Object tail
, item
, item1
;
700 if (XTYPE (menu
) != Lisp_Cons
) menu
= wrong_type_argument (Qlistp
, menu
);
702 i
= XFASTINT (Flength (menu
));
704 *vector
= (Lisp_Object
**) xmalloc (i
* sizeof (Lisp_Object
*));
705 *panes
= (char **) xmalloc (i
* sizeof (char *));
706 *items
= (int *) xmalloc (i
* sizeof (int));
707 *names
= (char ***) xmalloc (i
* sizeof (char **));
708 *enables
= (int **) xmalloc (i
* sizeof (int *));
710 for (i
= 0, tail
= menu
; !NILP (tail
); tail
= Fcdr (tail
), i
++)
712 item
= Fcdr (Fcar (tail
));
713 if (XTYPE (item
) != Lisp_Cons
) (void) wrong_type_argument (Qlistp
, item
);
715 fprintf (stderr
, "list_of_panes check tail, i=%d\n", i
);
717 item1
= Fcar (Fcar (tail
));
718 CHECK_STRING (item1
, 1);
720 fprintf (stderr
, "list_of_panes check pane, i=%d%s\n", i
,
721 XSTRING (item1
)->data
);
723 (*panes
)[i
] = (char *) XSTRING (item1
)->data
;
724 (*items
)[i
] = list_of_items ((*vector
)+i
, (*names
)+i
, (*enables
)+i
, item
);
725 /* (*panes)[i] = (char *) xmalloc ((XSTRING (item1)->size)+1);
726 bcopy (XSTRING (item1)->data, (*panes)[i], XSTRING (item1)->size + 1)
732 /* Construct the lists of values and names for a single pane, from the
733 alist PANE. Put them in *VECTOR and *NAMES. Put the enable flags
734 int *ENABLES. Return the number of items. */
737 list_of_items (vector
, names
, enables
, pane
)
738 Lisp_Object
**vector
; /* RETURN menu "objects" */
739 char ***names
; /* RETURN line names */
740 int **enables
; /* RETURN enable flags of lines */
743 Lisp_Object tail
, item
, item1
;
746 if (XTYPE (pane
) != Lisp_Cons
) pane
= wrong_type_argument (Qlistp
, pane
);
748 i
= XFASTINT (Flength (pane
));
750 *vector
= (Lisp_Object
*) xmalloc (i
* sizeof (Lisp_Object
));
751 *names
= (char **) xmalloc (i
* sizeof (char *));
752 *enables
= (int *) xmalloc (i
* sizeof (int));
754 for (i
= 0, tail
= pane
; !NILP (tail
); tail
= Fcdr (tail
), i
++)
760 (*names
)[i
] = (char *) XSTRING (item
)->data
;
765 CHECK_CONS (item
, 0);
766 (*vector
)[i
] = Fcdr (item
);
768 CHECK_STRING (item1
, 1);
769 (*names
)[i
] = (char *) XSTRING (item1
)->data
;