diff options
| author | Paul Eggert | 2011-06-16 11:31:16 -0400 |
|---|---|---|
| committer | David Reitter | 2011-06-16 11:31:16 -0400 |
| commit | d65e8a993fa02bf52ed8bd5ae4ea5771eb0c1018 (patch) | |
| tree | ff112744bd7e028de23ab3c5f29a3cc2ef62f16c /src | |
| parent | dfc47e35111ff5332791303a881bfa5d262e3a10 (diff) | |
| download | emacs-d65e8a993fa02bf52ed8bd5ae4ea5771eb0c1018.tar.gz emacs-d65e8a993fa02bf52ed8bd5ae4ea5771eb0c1018.zip | |
Merge: nsmenu.m: Replace all uses of XVECTOR with ASIZE and AREF.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/nsmenu.m | 70 |
2 files changed, 40 insertions, 35 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index a86a23e7c0b..f51078f87ef 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -127,6 +127,11 @@ | |||
| 127 | * w32heap.c (allocate_heap) [USE_LISP_UNION_TYPE || USE_LSB_TAG]: | 127 | * w32heap.c (allocate_heap) [USE_LISP_UNION_TYPE || USE_LSB_TAG]: |
| 128 | New version that can reserve upto 2GB of heap space. | 128 | New version that can reserve upto 2GB of heap space. |
| 129 | 129 | ||
| 130 | 2011-04-27 Paul Eggert <eggert@cs.ucla.edu> | ||
| 131 | |||
| 132 | * nsmenu.m: Replace all uses of XVECTOR with ASIZE and AREF. | ||
| 133 | This makes this file independent of the recent pseudovector change. | ||
| 134 | |||
| 130 | 2011-04-26 Chong Yidong <cyd@stupidchicken.com> | 135 | 2011-04-26 Chong Yidong <cyd@stupidchicken.com> |
| 131 | 136 | ||
| 132 | * nsfns.m (Fns_read_file_name): Doc fix (Bug#8534). | 137 | * nsfns.m (Fns_read_file_name): Doc fix (Bug#8534). |
diff --git a/src/nsmenu.m b/src/nsmenu.m index 5fd74333f22..482b33afb8f 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m | |||
| @@ -227,19 +227,19 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu) | |||
| 227 | 227 | ||
| 228 | menu_items = f->menu_bar_vector; | 228 | menu_items = f->menu_bar_vector; |
| 229 | menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0; | 229 | menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0; |
| 230 | submenu_start = (int *) alloca (XVECTOR (items)->size * sizeof (int *)); | 230 | submenu_start = (int *) alloca (ASIZE (items) * sizeof (int *)); |
| 231 | submenu_end = (int *) alloca (XVECTOR (items)->size * sizeof (int *)); | 231 | submenu_end = (int *) alloca (ASIZE (items) * sizeof (int *)); |
| 232 | submenu_n_panes = (int *) alloca (XVECTOR (items)->size * sizeof (int)); | 232 | submenu_n_panes = (int *) alloca (ASIZE (items) * sizeof (int)); |
| 233 | submenu_top_level_items | 233 | submenu_top_level_items |
| 234 | = (int *) alloca (XVECTOR (items)->size * sizeof (int *)); | 234 | = (int *) alloca (ASIZE (items) * sizeof (int *)); |
| 235 | init_menu_items (); | 235 | init_menu_items (); |
| 236 | for (i = 0; i < XVECTOR (items)->size; i += 4) | 236 | for (i = 0; i < ASIZE (items); i += 4) |
| 237 | { | 237 | { |
| 238 | Lisp_Object key, string, maps; | 238 | Lisp_Object key, string, maps; |
| 239 | 239 | ||
| 240 | key = XVECTOR (items)->contents[i]; | 240 | key = AREF (items, i); |
| 241 | string = XVECTOR (items)->contents[i + 1]; | 241 | string = AREF (items, i + 1); |
| 242 | maps = XVECTOR (items)->contents[i + 2]; | 242 | maps = AREF (items, i + 2); |
| 243 | if (NILP (string)) | 243 | if (NILP (string)) |
| 244 | break; | 244 | break; |
| 245 | 245 | ||
| @@ -312,11 +312,11 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu) | |||
| 312 | /* FIXME: this ALWAYS fails on Buffers menu items.. something | 312 | /* FIXME: this ALWAYS fails on Buffers menu items.. something |
| 313 | about their strings causes them to change every time, so we | 313 | about their strings causes them to change every time, so we |
| 314 | double-check failures */ | 314 | double-check failures */ |
| 315 | if (!EQ (previous_items[i], XVECTOR (menu_items)->contents[i])) | 315 | if (!EQ (previous_items[i], AREF (menu_items, i))) |
| 316 | if (!(STRINGP (previous_items[i]) | 316 | if (!(STRINGP (previous_items[i]) |
| 317 | && STRINGP (XVECTOR (menu_items)->contents[i]) | 317 | && STRINGP (AREF (menu_items, i)) |
| 318 | && !strcmp (SDATA (previous_items[i]), | 318 | && !strcmp (SDATA (previous_items[i]), |
| 319 | SDATA (XVECTOR (menu_items)->contents[i])))) | 319 | SDATA (AREF (menu_items, i))))) |
| 320 | break; | 320 | break; |
| 321 | if (i == previous_menu_items_used) | 321 | if (i == previous_menu_items_used) |
| 322 | { | 322 | { |
| @@ -347,10 +347,10 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu) | |||
| 347 | /* Parse stage 2a: now GC cannot happen during the lifetime of the | 347 | /* Parse stage 2a: now GC cannot happen during the lifetime of the |
| 348 | widget_value, so it's safe to store data from a Lisp_String */ | 348 | widget_value, so it's safe to store data from a Lisp_String */ |
| 349 | wv = first_wv->contents; | 349 | wv = first_wv->contents; |
| 350 | for (i = 0; i < XVECTOR (items)->size; i += 4) | 350 | for (i = 0; i < ASIZE (items); i += 4) |
| 351 | { | 351 | { |
| 352 | Lisp_Object string; | 352 | Lisp_Object string; |
| 353 | string = XVECTOR (items)->contents[i + 1]; | 353 | string = AREF (items, i + 1); |
| 354 | if (NILP (string)) | 354 | if (NILP (string)) |
| 355 | break; | 355 | break; |
| 356 | /* if (submenu && strcmp (submenuTitle, SDATA (string))) | 356 | /* if (submenu && strcmp (submenuTitle, SDATA (string))) |
| @@ -408,7 +408,7 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu) | |||
| 408 | 408 | ||
| 409 | 409 | ||
| 410 | /* check if no change.. this mechanism is a bit rough, but ready */ | 410 | /* check if no change.. this mechanism is a bit rough, but ready */ |
| 411 | n = XVECTOR (items)->size / 4; | 411 | n = ASIZE (items) / 4; |
| 412 | if (f == last_f && n_previous_strings == n) | 412 | if (f == last_f && n_previous_strings == n) |
| 413 | { | 413 | { |
| 414 | for (i = 0; i<n; i++) | 414 | for (i = 0; i<n; i++) |
| @@ -435,9 +435,9 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu) | |||
| 435 | } | 435 | } |
| 436 | 436 | ||
| 437 | [menu clear]; | 437 | [menu clear]; |
| 438 | for (i = 0; i < XVECTOR (items)->size; i += 4) | 438 | for (i = 0; i < ASIZE (items); i += 4) |
| 439 | { | 439 | { |
| 440 | string = XVECTOR (items)->contents[i + 1]; | 440 | string = AREF (items, i + 1); |
| 441 | if (NILP (string)) | 441 | if (NILP (string)) |
| 442 | break; | 442 | break; |
| 443 | 443 | ||
| @@ -608,7 +608,7 @@ name_is_separator (name) | |||
| 608 | 608 | ||
| 609 | if (!key || !strlen (key)) | 609 | if (!key || !strlen (key)) |
| 610 | return @""; | 610 | return @""; |
| 611 | 611 | ||
| 612 | while (*tpos == ' ' || *tpos == '(') | 612 | while (*tpos == ' ' || *tpos == '(') |
| 613 | tpos++; | 613 | tpos++; |
| 614 | if ((*tpos == 's') && (*(tpos+1) == '-')) | 614 | if ((*tpos == 's') && (*(tpos+1) == '-')) |
| @@ -669,7 +669,7 @@ name_is_separator (name) | |||
| 669 | -(void)clear | 669 | -(void)clear |
| 670 | { | 670 | { |
| 671 | int n; | 671 | int n; |
| 672 | 672 | ||
| 673 | for (n = [self numberOfItems]-1; n >= 0; n--) | 673 | for (n = [self numberOfItems]-1; n >= 0; n--) |
| 674 | { | 674 | { |
| 675 | NSMenuItem *item = [self itemAtIndex: n]; | 675 | NSMenuItem *item = [self itemAtIndex: n]; |
| @@ -809,7 +809,7 @@ ns_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, | |||
| 809 | i = 0; | 809 | i = 0; |
| 810 | while (i < menu_items_used) | 810 | while (i < menu_items_used) |
| 811 | { | 811 | { |
| 812 | if (EQ (XVECTOR (menu_items)->contents[i], Qnil)) | 812 | if (EQ (AREF (menu_items, i), Qnil)) |
| 813 | { | 813 | { |
| 814 | submenu_stack[submenu_depth++] = save_wv; | 814 | submenu_stack[submenu_depth++] = save_wv; |
| 815 | save_wv = prev_wv; | 815 | save_wv = prev_wv; |
| @@ -817,21 +817,21 @@ ns_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, | |||
| 817 | first_pane = 1; | 817 | first_pane = 1; |
| 818 | i++; | 818 | i++; |
| 819 | } | 819 | } |
| 820 | else if (EQ (XVECTOR (menu_items)->contents[i], Qlambda)) | 820 | else if (EQ (AREF (menu_items, i), Qlambda)) |
| 821 | { | 821 | { |
| 822 | prev_wv = save_wv; | 822 | prev_wv = save_wv; |
| 823 | save_wv = submenu_stack[--submenu_depth]; | 823 | save_wv = submenu_stack[--submenu_depth]; |
| 824 | first_pane = 0; | 824 | first_pane = 0; |
| 825 | i++; | 825 | i++; |
| 826 | } | 826 | } |
| 827 | else if (EQ (XVECTOR (menu_items)->contents[i], Qt) | 827 | else if (EQ (AREF (menu_items, i), Qt) |
| 828 | && submenu_depth != 0) | 828 | && submenu_depth != 0) |
| 829 | i += MENU_ITEMS_PANE_LENGTH; | 829 | i += MENU_ITEMS_PANE_LENGTH; |
| 830 | /* Ignore a nil in the item list. | 830 | /* Ignore a nil in the item list. |
| 831 | It's meaningful only for dialog boxes. */ | 831 | It's meaningful only for dialog boxes. */ |
| 832 | else if (EQ (XVECTOR (menu_items)->contents[i], Qquote)) | 832 | else if (EQ (AREF (menu_items, i), Qquote)) |
| 833 | i += 1; | 833 | i += 1; |
| 834 | else if (EQ (XVECTOR (menu_items)->contents[i], Qt)) | 834 | else if (EQ (AREF (menu_items, i), Qt)) |
| 835 | { | 835 | { |
| 836 | /* Create a new pane. */ | 836 | /* Create a new pane. */ |
| 837 | Lisp_Object pane_name, prefix; | 837 | Lisp_Object pane_name, prefix; |
| @@ -921,7 +921,7 @@ ns_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, | |||
| 921 | make the call_data null so that it won't display a box | 921 | make the call_data null so that it won't display a box |
| 922 | when the mouse is on it. */ | 922 | when the mouse is on it. */ |
| 923 | wv->call_data | 923 | wv->call_data |
| 924 | = !NILP (def) ? (void *) &XVECTOR (menu_items)->contents[i] : 0; | 924 | = !NILP (def) ? (void *) &AREF (menu_items, i) : 0; |
| 925 | wv->enabled = !NILP (enable); | 925 | wv->enabled = !NILP (enable); |
| 926 | 926 | ||
| 927 | if (NILP (type)) | 927 | if (NILP (type)) |
| @@ -1262,12 +1262,12 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1262 | { | 1262 | { |
| 1263 | NSString *str = [NSString stringWithUTF8String: text]; | 1263 | NSString *str = [NSString stringWithUTF8String: text]; |
| 1264 | NSRect r = [textField frame]; | 1264 | NSRect r = [textField frame]; |
| 1265 | NSSize textSize = [str sizeWithAttributes: | 1265 | NSSize textSize = [str sizeWithAttributes: |
| 1266 | [NSDictionary dictionaryWithObject: [[textField font] screenFont] | 1266 | [NSDictionary dictionaryWithObject: [[textField font] screenFont] |
| 1267 | forKey: NSFontAttributeName]]; | 1267 | forKey: NSFontAttributeName]]; |
| 1268 | NSSize padSize = [[[textField font] screenFont] | 1268 | NSSize padSize = [[[textField font] screenFont] |
| 1269 | boundingRectForFont].size; | 1269 | boundingRectForFont].size; |
| 1270 | 1270 | ||
| 1271 | r.size.width = textSize.width + padSize.width/2; | 1271 | r.size.width = textSize.width + padSize.width/2; |
| 1272 | r.size.height = textSize.height + padSize.height/2; | 1272 | r.size.height = textSize.height + padSize.height/2; |
| 1273 | [textField setFrame: r]; | 1273 | [textField setFrame: r]; |
| @@ -1350,7 +1350,7 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header) | |||
| 1350 | BOOL isQ; | 1350 | BOOL isQ; |
| 1351 | 1351 | ||
| 1352 | NSTRACE (x-popup-dialog); | 1352 | NSTRACE (x-popup-dialog); |
| 1353 | 1353 | ||
| 1354 | check_ns (); | 1354 | check_ns (); |
| 1355 | 1355 | ||
| 1356 | isQ = NILP (header); | 1356 | isQ = NILP (header); |
| @@ -1512,10 +1512,10 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header) | |||
| 1512 | [cell setCellAttribute: NSCellIsInsetButton to: 8]; | 1512 | [cell setCellAttribute: NSCellIsInsetButton to: 8]; |
| 1513 | [cell setBezelStyle: NSRoundedBezelStyle]; | 1513 | [cell setBezelStyle: NSRoundedBezelStyle]; |
| 1514 | 1514 | ||
| 1515 | matrix = [[NSMatrix alloc] initWithFrame: contentRect | 1515 | matrix = [[NSMatrix alloc] initWithFrame: contentRect |
| 1516 | mode: NSHighlightModeMatrix | 1516 | mode: NSHighlightModeMatrix |
| 1517 | prototype: cell | 1517 | prototype: cell |
| 1518 | numberOfRows: 0 | 1518 | numberOfRows: 0 |
| 1519 | numberOfColumns: 1]; | 1519 | numberOfColumns: 1]; |
| 1520 | [[self contentView] addSubview: matrix]; | 1520 | [[self contentView] addSubview: matrix]; |
| 1521 | [matrix release]; | 1521 | [matrix release]; |
| @@ -1566,7 +1566,7 @@ void process_dialog (id window, Lisp_Object list) | |||
| 1566 | - addButton: (char *)str value: (Lisp_Object)val row: (int)row | 1566 | - addButton: (char *)str value: (Lisp_Object)val row: (int)row |
| 1567 | { | 1567 | { |
| 1568 | id cell; | 1568 | id cell; |
| 1569 | 1569 | ||
| 1570 | if (row >= rows) | 1570 | if (row >= rows) |
| 1571 | { | 1571 | { |
| 1572 | [matrix addRow]; | 1572 | [matrix addRow]; |
| @@ -1587,7 +1587,7 @@ void process_dialog (id window, Lisp_Object list) | |||
| 1587 | - addString: (char *)str row: (int)row | 1587 | - addString: (char *)str row: (int)row |
| 1588 | { | 1588 | { |
| 1589 | id cell; | 1589 | id cell; |
| 1590 | 1590 | ||
| 1591 | if (row >= rows) | 1591 | if (row >= rows) |
| 1592 | { | 1592 | { |
| 1593 | [matrix addRow]; | 1593 | [matrix addRow]; |
| @@ -1616,7 +1616,7 @@ void process_dialog (id window, Lisp_Object list) | |||
| 1616 | EMACS_INT seltag; | 1616 | EMACS_INT seltag; |
| 1617 | 1617 | ||
| 1618 | sellist = [sender selectedCells]; | 1618 | sellist = [sender selectedCells]; |
| 1619 | if ([sellist count]<1) | 1619 | if ([sellist count]<1) |
| 1620 | return self; | 1620 | return self; |
| 1621 | 1621 | ||
| 1622 | seltag = [[sellist objectAtIndex: 0] tag]; | 1622 | seltag = [[sellist objectAtIndex: 0] tag]; |