home *** CD-ROM | disk | FTP | other *** search
- /*
- * ParseMenuList.c
- */
-
-
- #define MENU_SEPARATOR ';'
-
-
-
- /*
- * Function: ParseMenuList
- *
- * Inputs: char *menuList - string representing the menu to display.
- *
- * Outputs: menuList will be have all of the mac menu manager specific
- * strings removed (boldface, circumflex, open paren, dash).
- *
- * Returns: the number of items in the menu list
- */
- int
- ParseMenuList(menuList)
- char *menuList;
- {
- char *cp1;
- char *cp2;
- int num_items;
- int in_item = FALSE;
-
-
- for (cp1 = cp2 = menuList, num_items = 0; *cp2 != '\0'; ++cp2) {
- switch (*cp2) {
- case '^': /* Item has an icon */
- case '!': /* Item has a mark */
- case '<': /* Item has a special style */
- case '/': /* Item has keyboard equivalent */
- ++cp2;
- break;
-
- case '(': /* Item is to be dimmed, ignore request */
- break;
-
- case MENU_SEPARATOR: /* Menu Separator */
- ++num_items;
- *cp1++ = *cp2;
- in_item = FALSE;
- break;
-
- default:
- *cp1++ = *cp2;
- in_item = TRUE;
- break;
- }
- }
-
- /* The last item isn't required to have a separator */
- if (in_item)
- ++num_items;
-
- /* Terminate the string to delete the junk that follows */
- *cp1 = '\0';
-
- return (num_items);
- }
-
-
-