diff options
| author | Paul Eggert | 2011-04-26 23:01:43 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-04-26 23:01:43 -0700 |
| commit | 96fb4434c80ad33b648231fcc8e5bc6d0721c8ef (patch) | |
| tree | e6662f998b86f1c7b214aff0ba3524b5b26ccbf7 /src | |
| parent | b6f5355a9e65892e4af245fbd9789cd9a9a5ed6b (diff) | |
| download | emacs-96fb4434c80ad33b648231fcc8e5bc6d0721c8ef.tar.gz emacs-96fb4434c80ad33b648231fcc8e5bc6d0721c8ef.zip | |
* nsmenu.m: Replace all uses of XVECTOR with ASIZE and AREF.
This makes this file independent of the recent pseudovector change.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/nsmenu.m | 73 |
2 files changed, 41 insertions, 37 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 5c04f32b194..5584eb61980 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2011-04-27 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | * nsmenu.m: Replace all uses of XVECTOR with ASIZE and AREF. | ||
| 4 | This makes this file independent of the recent pseudovector change. | ||
| 5 | |||
| 1 | 2011-04-26 Paul Eggert <eggert@cs.ucla.edu> | 6 | 2011-04-26 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 7 | ||
| 3 | * keyboard.c (handle_user_signal): Fix pointer signedness problem. | 8 | * keyboard.c (handle_user_signal): Fix pointer signedness problem. |
diff --git a/src/nsmenu.m b/src/nsmenu.m index 623c933ce8e..2a2f952e751 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m | |||
| @@ -218,7 +218,7 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu) | |||
| 218 | 218 | ||
| 219 | /* Save the frame's previous menu bar contents data */ | 219 | /* Save the frame's previous menu bar contents data */ |
| 220 | if (previous_menu_items_used) | 220 | if (previous_menu_items_used) |
| 221 | memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents, | 221 | memcpy (previous_items, &AREF (f->menu_bar_vector, 0), |
| 222 | previous_menu_items_used * sizeof (Lisp_Object)); | 222 | previous_menu_items_used * sizeof (Lisp_Object)); |
| 223 | 223 | ||
| 224 | /* parse stage 1: extract from lisp */ | 224 | /* parse stage 1: extract from lisp */ |
| @@ -226,19 +226,19 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu) | |||
| 226 | 226 | ||
| 227 | menu_items = f->menu_bar_vector; | 227 | menu_items = f->menu_bar_vector; |
| 228 | menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0; | 228 | menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0; |
| 229 | submenu_start = (int *) alloca (XVECTOR (items)->size * sizeof (int *)); | 229 | submenu_start = (int *) alloca (ASIZE (items) * sizeof (int *)); |
| 230 | submenu_end = (int *) alloca (XVECTOR (items)->size * sizeof (int *)); | 230 | submenu_end = (int *) alloca (ASIZE (items) * sizeof (int *)); |
| 231 | submenu_n_panes = (int *) alloca (XVECTOR (items)->size * sizeof (int)); | 231 | submenu_n_panes = (int *) alloca (ASIZE (items) * sizeof (int)); |
| 232 | submenu_top_level_items | 232 | submenu_top_level_items |
| 233 | = (int *) alloca (XVECTOR (items)->size * sizeof (int *)); | 233 | = (int *) alloca (ASIZE (items) * sizeof (int *)); |
| 234 | init_menu_items (); | 234 | init_menu_items (); |
| 235 | for (i = 0; i < XVECTOR (items)->size; i += 4) | 235 | for (i = 0; i < ASIZE (items); i += 4) |
| 236 | { | 236 | { |
| 237 | Lisp_Object key, string, maps; | 237 | Lisp_Object key, string, maps; |
| 238 | 238 | ||
| 239 | key = XVECTOR (items)->contents[i]; | 239 | key = AREF (items, i); |
| 240 | string = XVECTOR (items)->contents[i + 1]; | 240 | string = AREF (items, i + 1); |
| 241 | maps = XVECTOR (items)->contents[i + 2]; | 241 | maps = AREF (items, i + 2); |
| 242 | if (NILP (string)) | 242 | if (NILP (string)) |
| 243 | break; | 243 | break; |
| 244 | 244 | ||
| @@ -311,11 +311,11 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu) | |||
| 311 | /* FIXME: this ALWAYS fails on Buffers menu items.. something | 311 | /* FIXME: this ALWAYS fails on Buffers menu items.. something |
| 312 | about their strings causes them to change every time, so we | 312 | about their strings causes them to change every time, so we |
| 313 | double-check failures */ | 313 | double-check failures */ |
| 314 | if (!EQ (previous_items[i], XVECTOR (menu_items)->contents[i])) | 314 | if (!EQ (previous_items[i], AREF (menu_items, i))) |
| 315 | if (!(STRINGP (previous_items[i]) | 315 | if (!(STRINGP (previous_items[i]) |
| 316 | && STRINGP (XVECTOR (menu_items)->contents[i]) | 316 | && STRINGP (AREF (menu_items, i)) |
| 317 | && !strcmp (SDATA (previous_items[i]), | 317 | && !strcmp (SDATA (previous_items[i]), |
| 318 | SDATA (XVECTOR (menu_items)->contents[i])))) | 318 | SDATA (AREF (menu_items, i))))) |
| 319 | break; | 319 | break; |
| 320 | if (i == previous_menu_items_used) | 320 | if (i == previous_menu_items_used) |
| 321 | { | 321 | { |
| @@ -346,10 +346,10 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu) | |||
| 346 | /* Parse stage 2a: now GC cannot happen during the lifetime of the | 346 | /* Parse stage 2a: now GC cannot happen during the lifetime of the |
| 347 | widget_value, so it's safe to store data from a Lisp_String */ | 347 | widget_value, so it's safe to store data from a Lisp_String */ |
| 348 | wv = first_wv->contents; | 348 | wv = first_wv->contents; |
| 349 | for (i = 0; i < XVECTOR (items)->size; i += 4) | 349 | for (i = 0; i < ASIZE (items); i += 4) |
| 350 | { | 350 | { |
| 351 | Lisp_Object string; | 351 | Lisp_Object string; |
| 352 | string = XVECTOR (items)->contents[i + 1]; | 352 | string = AREF (items, i + 1); |
| 353 | if (NILP (string)) | 353 | if (NILP (string)) |
| 354 | break; | 354 | break; |
| 355 | /* if (submenu && strcmp (submenuTitle, SDATA (string))) | 355 | /* if (submenu && strcmp (submenuTitle, SDATA (string))) |
| @@ -407,7 +407,7 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu) | |||
| 407 | 407 | ||
| 408 | 408 | ||
| 409 | /* check if no change.. this mechanism is a bit rough, but ready */ | 409 | /* check if no change.. this mechanism is a bit rough, but ready */ |
| 410 | n = XVECTOR (items)->size / 4; | 410 | n = ASIZE (items) / 4; |
| 411 | if (f == last_f && n_previous_strings == n) | 411 | if (f == last_f && n_previous_strings == n) |
| 412 | { | 412 | { |
| 413 | for (i = 0; i<n; i++) | 413 | for (i = 0; i<n; i++) |
| @@ -434,9 +434,9 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu) | |||
| 434 | } | 434 | } |
| 435 | 435 | ||
| 436 | [menu clear]; | 436 | [menu clear]; |
| 437 | for (i = 0; i < XVECTOR (items)->size; i += 4) | 437 | for (i = 0; i < ASIZE (items); i += 4) |
| 438 | { | 438 | { |
| 439 | string = XVECTOR (items)->contents[i + 1]; | 439 | string = AREF (items, i + 1); |
| 440 | if (NILP (string)) | 440 | if (NILP (string)) |
| 441 | break; | 441 | break; |
| 442 | 442 | ||
| @@ -591,7 +591,7 @@ set_frame_menubar (struct frame *f, int first_time, int deep_p) | |||
| 591 | 591 | ||
| 592 | if (!key || !strlen (key)) | 592 | if (!key || !strlen (key)) |
| 593 | return @""; | 593 | return @""; |
| 594 | 594 | ||
| 595 | while (*tpos == ' ' || *tpos == '(') | 595 | while (*tpos == ' ' || *tpos == '(') |
| 596 | tpos++; | 596 | tpos++; |
| 597 | if ((*tpos == 's') && (*(tpos+1) == '-')) | 597 | if ((*tpos == 's') && (*(tpos+1) == '-')) |
| @@ -652,7 +652,7 @@ set_frame_menubar (struct frame *f, int first_time, int deep_p) | |||
| 652 | -(void)clear | 652 | -(void)clear |
| 653 | { | 653 | { |
| 654 | int n; | 654 | int n; |
| 655 | 655 | ||
| 656 | for (n = [self numberOfItems]-1; n >= 0; n--) | 656 | for (n = [self numberOfItems]-1; n >= 0; n--) |
| 657 | { | 657 | { |
| 658 | NSMenuItem *item = [self itemAtIndex: n]; | 658 | NSMenuItem *item = [self itemAtIndex: n]; |
| @@ -794,7 +794,7 @@ ns_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, | |||
| 794 | i = 0; | 794 | i = 0; |
| 795 | while (i < menu_items_used) | 795 | while (i < menu_items_used) |
| 796 | { | 796 | { |
| 797 | if (EQ (XVECTOR (menu_items)->contents[i], Qnil)) | 797 | if (EQ (AREF (menu_items, i), Qnil)) |
| 798 | { | 798 | { |
| 799 | submenu_stack[submenu_depth++] = save_wv; | 799 | submenu_stack[submenu_depth++] = save_wv; |
| 800 | save_wv = prev_wv; | 800 | save_wv = prev_wv; |
| @@ -802,21 +802,21 @@ ns_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, | |||
| 802 | first_pane = 1; | 802 | first_pane = 1; |
| 803 | i++; | 803 | i++; |
| 804 | } | 804 | } |
| 805 | else if (EQ (XVECTOR (menu_items)->contents[i], Qlambda)) | 805 | else if (EQ (AREF (menu_items, i), Qlambda)) |
| 806 | { | 806 | { |
| 807 | prev_wv = save_wv; | 807 | prev_wv = save_wv; |
| 808 | save_wv = submenu_stack[--submenu_depth]; | 808 | save_wv = submenu_stack[--submenu_depth]; |
| 809 | first_pane = 0; | 809 | first_pane = 0; |
| 810 | i++; | 810 | i++; |
| 811 | } | 811 | } |
| 812 | else if (EQ (XVECTOR (menu_items)->contents[i], Qt) | 812 | else if (EQ (AREF (menu_items, i), Qt) |
| 813 | && submenu_depth != 0) | 813 | && submenu_depth != 0) |
| 814 | i += MENU_ITEMS_PANE_LENGTH; | 814 | i += MENU_ITEMS_PANE_LENGTH; |
| 815 | /* Ignore a nil in the item list. | 815 | /* Ignore a nil in the item list. |
| 816 | It's meaningful only for dialog boxes. */ | 816 | It's meaningful only for dialog boxes. */ |
| 817 | else if (EQ (XVECTOR (menu_items)->contents[i], Qquote)) | 817 | else if (EQ (AREF (menu_items, i), Qquote)) |
| 818 | i += 1; | 818 | i += 1; |
| 819 | else if (EQ (XVECTOR (menu_items)->contents[i], Qt)) | 819 | else if (EQ (AREF (menu_items, i), Qt)) |
| 820 | { | 820 | { |
| 821 | /* Create a new pane. */ | 821 | /* Create a new pane. */ |
| 822 | Lisp_Object pane_name, prefix; | 822 | Lisp_Object pane_name, prefix; |
| @@ -906,7 +906,7 @@ ns_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, | |||
| 906 | make the call_data null so that it won't display a box | 906 | make the call_data null so that it won't display a box |
| 907 | when the mouse is on it. */ | 907 | when the mouse is on it. */ |
| 908 | wv->call_data | 908 | wv->call_data |
| 909 | = !NILP (def) ? (void *) &XVECTOR (menu_items)->contents[i] : 0; | 909 | = !NILP (def) ? (void *) &AREF (menu_items, i) : 0; |
| 910 | wv->enabled = !NILP (enable); | 910 | wv->enabled = !NILP (enable); |
| 911 | 911 | ||
| 912 | if (NILP (type)) | 912 | if (NILP (type)) |
| @@ -1257,12 +1257,12 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1257 | { | 1257 | { |
| 1258 | NSString *str = [NSString stringWithUTF8String: text]; | 1258 | NSString *str = [NSString stringWithUTF8String: text]; |
| 1259 | NSRect r = [textField frame]; | 1259 | NSRect r = [textField frame]; |
| 1260 | NSSize textSize = [str sizeWithAttributes: | 1260 | NSSize textSize = [str sizeWithAttributes: |
| 1261 | [NSDictionary dictionaryWithObject: [[textField font] screenFont] | 1261 | [NSDictionary dictionaryWithObject: [[textField font] screenFont] |
| 1262 | forKey: NSFontAttributeName]]; | 1262 | forKey: NSFontAttributeName]]; |
| 1263 | NSSize padSize = [[[textField font] screenFont] | 1263 | NSSize padSize = [[[textField font] screenFont] |
| 1264 | boundingRectForFont].size; | 1264 | boundingRectForFont].size; |
| 1265 | 1265 | ||
| 1266 | r.size.width = textSize.width + padSize.width/2; | 1266 | r.size.width = textSize.width + padSize.width/2; |
| 1267 | r.size.height = textSize.height + padSize.height/2; | 1267 | r.size.height = textSize.height + padSize.height/2; |
| 1268 | [textField setFrame: r]; | 1268 | [textField setFrame: r]; |
| @@ -1345,7 +1345,7 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header) | |||
| 1345 | BOOL isQ; | 1345 | BOOL isQ; |
| 1346 | 1346 | ||
| 1347 | NSTRACE (x-popup-dialog); | 1347 | NSTRACE (x-popup-dialog); |
| 1348 | 1348 | ||
| 1349 | check_ns (); | 1349 | check_ns (); |
| 1350 | 1350 | ||
| 1351 | isQ = NILP (header); | 1351 | isQ = NILP (header); |
| @@ -1507,10 +1507,10 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header) | |||
| 1507 | [cell setCellAttribute: NSCellIsInsetButton to: 8]; | 1507 | [cell setCellAttribute: NSCellIsInsetButton to: 8]; |
| 1508 | [cell setBezelStyle: NSRoundedBezelStyle]; | 1508 | [cell setBezelStyle: NSRoundedBezelStyle]; |
| 1509 | 1509 | ||
| 1510 | matrix = [[NSMatrix alloc] initWithFrame: contentRect | 1510 | matrix = [[NSMatrix alloc] initWithFrame: contentRect |
| 1511 | mode: NSHighlightModeMatrix | 1511 | mode: NSHighlightModeMatrix |
| 1512 | prototype: cell | 1512 | prototype: cell |
| 1513 | numberOfRows: 0 | 1513 | numberOfRows: 0 |
| 1514 | numberOfColumns: 1]; | 1514 | numberOfColumns: 1]; |
| 1515 | [[self contentView] addSubview: matrix]; | 1515 | [[self contentView] addSubview: matrix]; |
| 1516 | [matrix release]; | 1516 | [matrix release]; |
| @@ -1561,7 +1561,7 @@ void process_dialog (id window, Lisp_Object list) | |||
| 1561 | - addButton: (char *)str value: (Lisp_Object)val row: (int)row | 1561 | - addButton: (char *)str value: (Lisp_Object)val row: (int)row |
| 1562 | { | 1562 | { |
| 1563 | id cell; | 1563 | id cell; |
| 1564 | 1564 | ||
| 1565 | if (row >= rows) | 1565 | if (row >= rows) |
| 1566 | { | 1566 | { |
| 1567 | [matrix addRow]; | 1567 | [matrix addRow]; |
| @@ -1582,7 +1582,7 @@ void process_dialog (id window, Lisp_Object list) | |||
| 1582 | - addString: (char *)str row: (int)row | 1582 | - addString: (char *)str row: (int)row |
| 1583 | { | 1583 | { |
| 1584 | id cell; | 1584 | id cell; |
| 1585 | 1585 | ||
| 1586 | if (row >= rows) | 1586 | if (row >= rows) |
| 1587 | { | 1587 | { |
| 1588 | [matrix addRow]; | 1588 | [matrix addRow]; |
| @@ -1611,7 +1611,7 @@ void process_dialog (id window, Lisp_Object list) | |||
| 1611 | EMACS_INT seltag; | 1611 | EMACS_INT seltag; |
| 1612 | 1612 | ||
| 1613 | sellist = [sender selectedCells]; | 1613 | sellist = [sender selectedCells]; |
| 1614 | if ([sellist count]<1) | 1614 | if ([sellist count]<1) |
| 1615 | return self; | 1615 | return self; |
| 1616 | 1616 | ||
| 1617 | seltag = [[sellist objectAtIndex: 0] tag]; | 1617 | seltag = [[sellist objectAtIndex: 0] tag]; |
| @@ -1794,4 +1794,3 @@ syms_of_nsmenu (void) | |||
| 1794 | Qdebug_on_next_call = intern_c_string ("debug-on-next-call"); | 1794 | Qdebug_on_next_call = intern_c_string ("debug-on-next-call"); |
| 1795 | staticpro (&Qdebug_on_next_call); | 1795 | staticpro (&Qdebug_on_next_call); |
| 1796 | } | 1796 | } |
| 1797 | |||