annotate src/xmenu.c @ 975:3493118bc79f

* xmenu.c: Deleted "$Log" header and other RCS stuff in comments at top of file; this was beginning to grow RCS hair, which we don't want.
author Jim Blandy <jimb@redhat.com>
date Wed, 12 Aug 1992 14:35:16 +0000
parents 4de9c9a62bda
children d24afc1bef38
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
118
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1 /* X Communication module for terminals which understand the X protocol.
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2 Copyright (C) 1986, 1988 Free Software Foundation, Inc.
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4 This file is part of GNU Emacs.
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6 GNU Emacs is free software; you can redistribute it and/or modify
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
7 it under the terms of the GNU General Public License as published by
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
8 the Free Software Foundation; either version 1, or (at your option)
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
9 any later version.
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
10
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11 GNU Emacs is distributed in the hope that it will be useful,
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14 GNU General Public License for more details.
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17 along with GNU Emacs; see the file COPYING. If not, write to
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
19
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20 /* X pop-up deck-of-cards menu facility for gnuemacs.
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
21 *
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
22 * Written by Jon Arnold and Roman Budzianowski
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
23 * Mods and rewrite by Robert Krawitz
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
24 *
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
25 */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
26
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
27 #ifdef XDEBUG
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
28 #include <stdio.h>
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
29 #endif
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
30
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31 /* On 4.3 this loses if it comes after xterm.h. */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
32 #include <signal.h>
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
33 #include "config.h"
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34 #include "lisp.h"
770
4de9c9a62bda entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
35 #include "frame.h"
118
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
36 #include "window.h"
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
37
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
38 /* This may include sys/types.h, and that somehow loses
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
39 if this is not done before the other system files. */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
40 #include "xterm.h"
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
41
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
42 /* Load sys/types.h if not already loaded.
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
43 In some systems loading it twice is suicidal. */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
44 #ifndef makedev
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
45 #include <sys/types.h>
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
46 #endif
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
47
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
48 #include "dispextern.h"
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
49
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
50 #ifdef HAVE_X11
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
51 #include "../oldXMenu/XMenu.h"
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
52 #else
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
53 #include <X/XMenu.h>
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
54 #endif
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
55
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
56 #define min(x,y) (((x) < (y)) ? (x) : (y))
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
57 #define max(x,y) (((x) > (y)) ? (x) : (y))
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
58
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
59 #define NUL 0
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
60
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
61 #ifndef TRUE
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
62 #define TRUE 1
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
63 #define FALSE 0
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
64 #endif TRUE
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
65
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
66 #ifdef HAVE_X11
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
67 extern Display *x_current_display;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
68 #else
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
69 #define ButtonReleaseMask ButtonReleased
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
70 #endif /* not HAVE_X11 */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72 Lisp_Object xmenu_show ();
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
73 extern int x_error_handler ();
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
74
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75 /*************************************************************/
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
76
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
77 #if 0
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
78 /* Ignoring the args is easiest. */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
79 xmenu_quit ()
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
80 {
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
81 error ("Unknown XMenu error");
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
82 }
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
83 #endif
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
84
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
85 DEFUN ("x-popup-menu",Fx_popup_menu, Sx_popup_menu, 1, 2, 0,
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
86 "Pop up a deck-of-cards menu and return user's selection.\n\
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
87 ARG is a position specification: a list ((XOFFSET YOFFSET) WINDOW)\n\
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
88 where XOFFSET and YOFFSET are positions in characters from the top left\n\
770
4de9c9a62bda entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
89 corner of WINDOW's frame. A mouse-event list will serve for this.\n\
118
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
90 This controls the position of the center of the first line\n\
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
91 in the first pane of the menu, not the top left of the menu as a whole.\n\
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
92 \n\
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
93 MENU is a specifier for a menu. It is a list of the form\n\
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
94 \(TITLE PANE1 PANE2...), and each pane is a list of form\n\
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
95 \(TITLE (LINE ITEM)...). Each line should be a string, and item should\n\
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
96 be the return value for that line (i.e. if it is selected.")
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
97 (arg, menu)
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
98 Lisp_Object arg, menu;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
99 {
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
100 int number_of_panes;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
101 Lisp_Object XMenu_return;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
102 int XMenu_xpos, XMenu_ypos;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
103 char **menus;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
104 char ***names;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
105 Lisp_Object **obj_list;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
106 int *items;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
107 char *title;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
108 char *error_name;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
109 Lisp_Object ltitle, selection;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
110 int i, j;
770
4de9c9a62bda entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
111 FRAME_PTR f;
118
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
112 Lisp_Object x, y, window;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
113
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
114 window = Fcar (Fcdr (arg));
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
115 x = Fcar (Fcar (arg));
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
116 y = Fcar (Fcdr (Fcar (arg)));
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
117 CHECK_WINDOW (window, 0);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
118 CHECK_NUMBER (x, 0);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
119 CHECK_NUMBER (y, 0);
770
4de9c9a62bda entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
120 f = XFRAME (WINDOW_FRAME (XWINDOW (window)));
118
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
121
770
4de9c9a62bda entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
122 XMenu_xpos = FONT_WIDTH (f->display.x->font) * XINT (x);
4de9c9a62bda entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
123 XMenu_ypos = FONT_HEIGHT (f->display.x->font) * XINT (y);
4de9c9a62bda entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
124 XMenu_xpos += f->display.x->left_pos;
4de9c9a62bda entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
125 XMenu_ypos += f->display.x->top_pos;
118
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
126
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
127 ltitle = Fcar (menu);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
128 CHECK_STRING (ltitle, 1);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
129 title = (char *) XSTRING (ltitle)->data;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
130 number_of_panes=list_of_panes (&obj_list, &menus, &names, &items, Fcdr (menu));
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
131 #ifdef XDEBUG
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
132 fprintf (stderr, "Panes= %d\n", number_of_panes);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
133 for (i=0; i < number_of_panes; i++)
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
134 {
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
135 fprintf (stderr, "Pane %d lines %d title %s\n", i, items[i], menus[i]);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
136 for (j=0; j < items[i]; j++)
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
137 {
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
138 fprintf (stderr, " Item %d %s\n", j, names[i][j]);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
139 }
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
140 }
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
141 #endif
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
142 BLOCK_INPUT;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
143 selection = xmenu_show (ROOT_WINDOW, XMenu_xpos, XMenu_ypos, names, menus,
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
144 items, number_of_panes, obj_list, title, &error_name);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
145 UNBLOCK_INPUT;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
146 /** fprintf (stderr, "selection = %x\n", selection); **/
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
147 if (selection != NUL)
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
148 { /* selected something */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
149 XMenu_return = selection;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
150 }
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
151 else
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
152 { /* nothing selected */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
153 XMenu_return = Qnil;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
154 }
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
155 /* now free up the strings */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
156 for (i=0; i < number_of_panes; i++)
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
157 {
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
158 free (names[i]);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
159 free (obj_list[i]);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
160 }
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
161 free (menus);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
162 free (obj_list);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
163 free (names);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
164 free (items);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
165 /* free (title); */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
166 if (error_name) error (error_name);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
167 return XMenu_return;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
168 }
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
169
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
170 struct indices {
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
171 int pane;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
172 int line;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
173 };
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
174
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
175 Lisp_Object
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
176 xmenu_show (parent, startx, starty, line_list, pane_list, line_cnt,
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
177 pane_cnt, item_list, title, error)
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
178 Window parent;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
179 int startx, starty; /* upper left corner position BROKEN */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
180 char **line_list[]; /* list of strings for items */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
181 char *pane_list[]; /* list of pane titles */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
182 char *title;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
183 int pane_cnt; /* total number of panes */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
184 Lisp_Object *item_list[]; /* All items */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
185 int line_cnt[]; /* Lines in each pane */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
186 char **error; /* Error returned */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
187 {
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
188 XMenu *GXMenu;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
189 int last, panes, selidx, lpane, status;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
190 int lines, sofar;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
191 Lisp_Object entry;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
192 /* struct indices *datap, *datap_save; */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
193 char *datap;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
194 int ulx, uly, width, height;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
195 int dispwidth, dispheight;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
196
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
197 *error = (char *) 0; /* Initialize error pointer to null */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
198 GXMenu = XMenuCreate (XDISPLAY parent, "emacs");
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
199 if (GXMenu == NUL)
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
200 {
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
201 *error = "Can't create menu";
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
202 return (0);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
203 }
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
204
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
205 for (panes=0, lines=0; panes < pane_cnt; lines += line_cnt[panes], panes++)
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
206 ;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
207 /* datap = (struct indices *) xmalloc (lines * sizeof (struct indices)); */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
208 /*datap = (char *) xmalloc (lines * sizeof (char));
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
209 datap_save = datap;*/
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
210
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
211 for (panes = 0, sofar=0;panes < pane_cnt;sofar +=line_cnt[panes], panes++)
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
212 {
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
213 /* create all the necessary panes */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
214 lpane = XMenuAddPane (XDISPLAY GXMenu, pane_list[panes], TRUE);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
215 if (lpane == XM_FAILURE)
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
216 {
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
217 XMenuDestroy (XDISPLAY GXMenu);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
218 *error = "Can't create pane";
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
219 return (0);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
220 }
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
221 for (selidx = 0; selidx < line_cnt[panes] ; selidx++)
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
222 {
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
223 /* add the selection stuff to the menus */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
224 /* datap[selidx+sofar].pane = panes;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
225 datap[selidx+sofar].line = selidx; */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
226 if (XMenuAddSelection (XDISPLAY GXMenu, lpane, 0,
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
227 line_list[panes][selidx], TRUE)
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
228 == XM_FAILURE)
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
229 {
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
230 XMenuDestroy (XDISPLAY GXMenu);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
231 /* free (datap); */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
232 *error = "Can't add selection to menu";
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
233 /* error ("Can't add selection to menu"); */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
234 return (0);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
235 }
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
236 }
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
237 }
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
238 /* all set and ready to fly */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
239 XMenuRecompute (XDISPLAY GXMenu);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
240 dispwidth = DisplayWidth (x_current_display, XDefaultScreen (x_current_display));
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
241 dispheight = DisplayHeight (x_current_display, XDefaultScreen (x_current_display));
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
242 startx = min (startx, dispwidth);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
243 starty = min (starty, dispheight);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
244 startx = max (startx, 1);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
245 starty = max (starty, 1);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
246 XMenuLocate (XDISPLAY GXMenu, 0, 0, startx, starty,
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
247 &ulx, &uly, &width, &height);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
248 if (ulx+width > dispwidth)
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
249 {
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
250 startx -= (ulx + width) - dispwidth;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
251 ulx = dispwidth - width;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
252 }
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
253 if (uly+height > dispheight)
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
254 {
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
255 starty -= (uly + height) - dispheight;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
256 uly = dispheight - height;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
257 }
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
258 if (ulx < 0) startx -= ulx;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
259 if (uly < 0) starty -= uly;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
260
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
261 XMenuSetFreeze (GXMenu, TRUE);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
262 panes = selidx = 0;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
263
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
264 status = XMenuActivate (XDISPLAY GXMenu, &panes, &selidx,
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
265 startx, starty, ButtonReleaseMask, &datap);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
266 switch (status)
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
267 {
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
268 case XM_SUCCESS:
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
269 #ifdef XDEBUG
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
270 fprintf (stderr, "pane= %d line = %d\n", panes, selidx);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
271 #endif
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
272 entry = item_list[panes][selidx];
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
273 break;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
274 case XM_FAILURE:
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
275 /*free (datap_save); */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
276 XMenuDestroy (XDISPLAY GXMenu);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
277 *error = "Can't activate menu";
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
278 /* error ("Can't activate menu"); */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
279 case XM_IA_SELECT:
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
280 case XM_NO_SELECT:
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
281 entry = Qnil;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
282 break;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
283 }
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
284 XMenuDestroy (XDISPLAY GXMenu);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
285 /*free (datap_save);*/
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
286 return (entry);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
287 }
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
288
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
289 syms_of_xmenu ()
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
290 {
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
291 defsubr (&Sx_popup_menu);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
292 }
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
293
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
294 list_of_panes (vector, panes, names, items, menu)
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
295 Lisp_Object ***vector; /* RETURN all menu objects */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
296 char ***panes; /* RETURN pane names */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
297 char ****names; /* RETURN all line names */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
298 int **items; /* RETURN number of items per pane */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
299 Lisp_Object menu;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
300 {
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
301 Lisp_Object tail, item, item1;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
302 int i;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
303
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
304 if (XTYPE (menu) != Lisp_Cons) menu = wrong_type_argument (Qlistp, menu);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
305
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
306 i= XFASTINT (Flength (menu, 1));
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
307
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
308 *vector = (Lisp_Object **) xmalloc (i * sizeof (Lisp_Object *));
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
309 *panes = (char **) xmalloc (i * sizeof (char *));
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
310 *items = (int *) xmalloc (i * sizeof (int));
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
311 *names = (char ***) xmalloc (i * sizeof (char **));
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
312
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 118
diff changeset
313 for (i=0, tail = menu; !NILP (tail); tail = Fcdr (tail), i++)
118
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
314 {
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
315 item = Fcdr (Fcar (tail));
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
316 if (XTYPE (item) != Lisp_Cons) (void) wrong_type_argument (Qlistp, item);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
317 #ifdef XDEBUG
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
318 fprintf (stderr, "list_of_panes check tail, i=%d\n", i);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
319 #endif
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
320 item1 = Fcar (Fcar (tail));
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
321 CHECK_STRING (item1, 1);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
322 #ifdef XDEBUG
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
323 fprintf (stderr, "list_of_panes check pane, i=%d%s\n", i,
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
324 XSTRING (item1)->data);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
325 #endif
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
326 (*panes)[i] = (char *) XSTRING (item1)->data;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
327 (*items)[i] = list_of_items ((*vector)+i, (*names)+i, item);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
328 /* (*panes)[i] = (char *) xmalloc ((XSTRING (item1)->size)+1);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
329 bcopy (XSTRING (item1)->data, (*panes)[i], XSTRING (item1)->size + 1)
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
330 ; */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
331 }
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
332 return i;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
333 }
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
334
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
335
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
336 list_of_items (vector, names, pane) /* get list from emacs and put to vector */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
337 Lisp_Object **vector; /* RETURN menu "objects" */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
338 char ***names; /* RETURN line names */
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
339 Lisp_Object pane;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
340 {
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
341 Lisp_Object tail, item, item1;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
342 int i;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
343
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
344 if (XTYPE (pane) != Lisp_Cons) pane = wrong_type_argument (Qlistp, pane);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
345
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
346 i= XFASTINT (Flength (pane, 1));
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
347
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
348 *vector = (Lisp_Object *) xmalloc (i * sizeof (Lisp_Object));
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
349 *names = (char **) xmalloc (i * sizeof (char *));
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
350
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 118
diff changeset
351 for (i=0, tail = pane; !NILP (tail); tail = Fcdr (tail), i++)
118
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
352 {
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
353 item = Fcar (tail);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
354 if (XTYPE (item) != Lisp_Cons) (void) wrong_type_argument (Qlistp, item);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
355 #ifdef XDEBUG
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
356 fprintf (stderr, "list_of_items check tail, i=%d\n", i);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
357 #endif
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
358 (*vector)[i] = Fcdr (item);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
359 item1 = Fcar (item);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
360 CHECK_STRING (item1, 1);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
361 #ifdef XDEBUG
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
362 fprintf (stderr, "list_of_items check item, i=%d%s\n", i,
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
363 XSTRING (item1)->data);
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
364 #endif
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
365 (*names)[i] = (char *) XSTRING (item1)->data;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
366 }
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
367 return i;
49342840ba00 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
368 }