1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-01 08:17:38 +00:00

Merge: nsmenu.m: Replace all uses of XVECTOR with ASIZE and AREF.

This commit is contained in:
Paul Eggert 2011-06-16 11:31:16 -04:00 committed by David Reitter
parent dfc47e3511
commit d65e8a993f
2 changed files with 40 additions and 35 deletions

View File

@ -127,6 +127,11 @@
* w32heap.c (allocate_heap) [USE_LISP_UNION_TYPE || USE_LSB_TAG]:
New version that can reserve upto 2GB of heap space.
2011-04-27 Paul Eggert <eggert@cs.ucla.edu>
* nsmenu.m: Replace all uses of XVECTOR with ASIZE and AREF.
This makes this file independent of the recent pseudovector change.
2011-04-26 Chong Yidong <cyd@stupidchicken.com>
* nsfns.m (Fns_read_file_name): Doc fix (Bug#8534).

View File

@ -227,19 +227,19 @@
menu_items = f->menu_bar_vector;
menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0;
submenu_start = (int *) alloca (XVECTOR (items)->size * sizeof (int *));
submenu_end = (int *) alloca (XVECTOR (items)->size * sizeof (int *));
submenu_n_panes = (int *) alloca (XVECTOR (items)->size * sizeof (int));
submenu_start = (int *) alloca (ASIZE (items) * sizeof (int *));
submenu_end = (int *) alloca (ASIZE (items) * sizeof (int *));
submenu_n_panes = (int *) alloca (ASIZE (items) * sizeof (int));
submenu_top_level_items
= (int *) alloca (XVECTOR (items)->size * sizeof (int *));
= (int *) alloca (ASIZE (items) * sizeof (int *));
init_menu_items ();
for (i = 0; i < XVECTOR (items)->size; i += 4)
for (i = 0; i < ASIZE (items); i += 4)
{
Lisp_Object key, string, maps;
key = XVECTOR (items)->contents[i];
string = XVECTOR (items)->contents[i + 1];
maps = XVECTOR (items)->contents[i + 2];
key = AREF (items, i);
string = AREF (items, i + 1);
maps = AREF (items, i + 2);
if (NILP (string))
break;
@ -312,11 +312,11 @@
/* FIXME: this ALWAYS fails on Buffers menu items.. something
about their strings causes them to change every time, so we
double-check failures */
if (!EQ (previous_items[i], XVECTOR (menu_items)->contents[i]))
if (!EQ (previous_items[i], AREF (menu_items, i)))
if (!(STRINGP (previous_items[i])
&& STRINGP (XVECTOR (menu_items)->contents[i])
&& STRINGP (AREF (menu_items, i))
&& !strcmp (SDATA (previous_items[i]),
SDATA (XVECTOR (menu_items)->contents[i]))))
SDATA (AREF (menu_items, i)))))
break;
if (i == previous_menu_items_used)
{
@ -347,10 +347,10 @@
/* Parse stage 2a: now GC cannot happen during the lifetime of the
widget_value, so it's safe to store data from a Lisp_String */
wv = first_wv->contents;
for (i = 0; i < XVECTOR (items)->size; i += 4)
for (i = 0; i < ASIZE (items); i += 4)
{
Lisp_Object string;
string = XVECTOR (items)->contents[i + 1];
string = AREF (items, i + 1);
if (NILP (string))
break;
/* if (submenu && strcmp (submenuTitle, SDATA (string)))
@ -408,7 +408,7 @@
/* check if no change.. this mechanism is a bit rough, but ready */
n = XVECTOR (items)->size / 4;
n = ASIZE (items) / 4;
if (f == last_f && n_previous_strings == n)
{
for (i = 0; i<n; i++)
@ -435,9 +435,9 @@
}
[menu clear];
for (i = 0; i < XVECTOR (items)->size; i += 4)
for (i = 0; i < ASIZE (items); i += 4)
{
string = XVECTOR (items)->contents[i + 1];
string = AREF (items, i + 1);
if (NILP (string))
break;
@ -608,7 +608,7 @@ -(NSString *)parseKeyEquiv: (char *)key
if (!key || !strlen (key))
return @"";
while (*tpos == ' ' || *tpos == '(')
tpos++;
if ((*tpos == 's') && (*(tpos+1) == '-'))
@ -669,7 +669,7 @@ - (NSMenuItem *)addItemWithWidgetValue: (void *)wvptr
-(void)clear
{
int n;
for (n = [self numberOfItems]-1; n >= 0; n--)
{
NSMenuItem *item = [self itemAtIndex: n];
@ -809,7 +809,7 @@ - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f
i = 0;
while (i < menu_items_used)
{
if (EQ (XVECTOR (menu_items)->contents[i], Qnil))
if (EQ (AREF (menu_items, i), Qnil))
{
submenu_stack[submenu_depth++] = save_wv;
save_wv = prev_wv;
@ -817,21 +817,21 @@ - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f
first_pane = 1;
i++;
}
else if (EQ (XVECTOR (menu_items)->contents[i], Qlambda))
else if (EQ (AREF (menu_items, i), Qlambda))
{
prev_wv = save_wv;
save_wv = submenu_stack[--submenu_depth];
first_pane = 0;
i++;
}
else if (EQ (XVECTOR (menu_items)->contents[i], Qt)
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 (XVECTOR (menu_items)->contents[i], Qquote))
else if (EQ (AREF (menu_items, i), Qquote))
i += 1;
else if (EQ (XVECTOR (menu_items)->contents[i], Qt))
else if (EQ (AREF (menu_items, i), Qt))
{
/* Create a new pane. */
Lisp_Object pane_name, prefix;
@ -921,7 +921,7 @@ - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f
make the call_data null so that it won't display a box
when the mouse is on it. */
wv->call_data
= !NILP (def) ? (void *) &XVECTOR (menu_items)->contents[i] : 0;
= !NILP (def) ? (void *) &AREF (menu_items, i) : 0;
wv->enabled = !NILP (enable);
if (NILP (type))
@ -1262,12 +1262,12 @@ - (void) setText: (char *)text
{
NSString *str = [NSString stringWithUTF8String: text];
NSRect r = [textField frame];
NSSize textSize = [str sizeWithAttributes:
NSSize textSize = [str sizeWithAttributes:
[NSDictionary dictionaryWithObject: [[textField font] screenFont]
forKey: NSFontAttributeName]];
NSSize padSize = [[[textField font] screenFont]
NSSize padSize = [[[textField font] screenFont]
boundingRectForFont].size;
r.size.width = textSize.width + padSize.width/2;
r.size.height = textSize.height + padSize.height/2;
[textField setFrame: r];
@ -1350,7 +1350,7 @@ - (NSRect) frame
BOOL isQ;
NSTRACE (x-popup-dialog);
check_ns ();
isQ = NILP (header);
@ -1512,10 +1512,10 @@ @implementation EmacsDialogPanel
[cell setCellAttribute: NSCellIsInsetButton to: 8];
[cell setBezelStyle: NSRoundedBezelStyle];
matrix = [[NSMatrix alloc] initWithFrame: contentRect
mode: NSHighlightModeMatrix
prototype: cell
numberOfRows: 0
matrix = [[NSMatrix alloc] initWithFrame: contentRect
mode: NSHighlightModeMatrix
prototype: cell
numberOfRows: 0
numberOfColumns: 1];
[[self contentView] addSubview: matrix];
[matrix release];
@ -1566,7 +1566,7 @@ void process_dialog (id window, Lisp_Object list)
- addButton: (char *)str value: (Lisp_Object)val row: (int)row
{
id cell;
if (row >= rows)
{
[matrix addRow];
@ -1587,7 +1587,7 @@ void process_dialog (id window, Lisp_Object list)
- addString: (char *)str row: (int)row
{
id cell;
if (row >= rows)
{
[matrix addRow];
@ -1616,7 +1616,7 @@ void process_dialog (id window, Lisp_Object list)
EMACS_INT seltag;
sellist = [sender selectedCells];
if ([sellist count]<1)
if ([sellist count]<1)
return self;
seltag = [[sellist objectAtIndex: 0] tag];