/* * Duplicate the menu item text and then process to see if a mnemonic key * and/or accelerator text has been identified. * Returns a pointer to allocated memory, or NULL for failure. * If mnemonic != NULL, *mnemonic is set to the character after the first '&'. * If actext != NULL, *actext is set to the text after the first TAB. */ static char_u *menu_text(char_u *str, int *mnemonic, char_u **actext) { char_u *p; char_u *text; /* Locate accelerator text, after the first TAB */ p = vim_strchr(str, TAB); if (p != NULL) { if (actext != NULL) *actext = vim_strsave(p + 1); text = vim_strnsave(str, (int)(p - str)); } else text = vim_strsave(str); /* Find mnemonic characters "&a" and reduce "&&" to "&". */ for (p = text; p != NULL; ) { p = vim_strchr(p, '&'); if (p != NULL) { if (p[1] == NUL) /* trailing "&" */ break; if (mnemonic != NULL && p[1] != '&') #if !defined(__MVS__) || defined(MOTIF390_MNEMONIC_FIXED) *mnemonic = p[1]; #else { /* * Well there is a bug in the Motif libraries on OS390 Unix. * The mnemonic keys needs to be converted to ASCII values * first. * This behavior has been seen in 2.8 and 2.9. */ char c = p[1]; __etoa_l(&c, 1); *mnemonic = c; } #endif STRMOVE(p, p + 1); p = p + 1; } } return text; }
uchar_ptr_t iott_escape(uchar_ptr_t strin, uchar_ptr_t strtop, io_desc *io_ptr) { unsigned char *str; unsigned char esc_type; #ifdef __MVS__ error_def(ERR_ASC2EBCDICCONV); if ((DEFAULT_CODE_SET != io_ptr->in_code_set) && ( -1 == __etoa_l((char *)strin, strtop - strin) )) rts_error(VARLSTCNT(4) ERR_ASC2EBCDICCONV, 2, LEN_AND_LIT("__etoa_l")); #endif str = strin; esc_type = io_ptr->esc_state; while (esc_type < FINI) { switch (esc_type) { case START: assert(*str == ESC); esc_type = AFTESC; break; case AFTESC: switch(*str) { case ';': case '?': esc_type = SEQ2; break; case 'O': esc_type = SEQ4; break; case '[': esc_type = SEQ1; break; default: if (*str >= 0x30 && *str < 0x7F) esc_type = FINI; else if (*str > 0x1F && *str < 0x30) esc_type = SEQ2; else esc_type = BADESC; break; } break; case SEQ1: if (*str < 0x30 && *str > 0x1F) esc_type = SEQ3; else if (*str > 0x3F && *str < 0x7F) esc_type = FINI; else if (*str > 0x3F || *str < 0x30) esc_type = BADESC; break; case SEQ2: if (*str >= 0x30 && *str < 0x7F) esc_type = FINI; else if (*str > 0x2F || *str < 0x20) esc_type = BADESC; break; case SEQ3: if (*str > 0x3F && *str < 0x7F) esc_type = FINI; else if (*str > 0x2F || *str < 0x20) esc_type = BADESC; case SEQ4: if (*str >= 0x40 && *str < 0x7F) esc_type = FINI; else if (*str > 0x2F || *str < 0x20) esc_type = BADESC; break; default: GTMASSERT; } if (esc_type == BADESC || ++str >= strtop) break; } io_ptr->esc_state = esc_type; #ifdef __MVS__ if ((DEFAULT_CODE_SET != io_ptr->in_code_set) && ( -1 == __atoe_l((char *)strin, strtop - strin) )) rts_error(VARLSTCNT(4) ERR_ASC2EBCDICCONV, 2, LEN_AND_LIT("__atoe_l")); #endif return str; }