static int getCommands(void) { paramLetters(); do { printf("Command: "); getInput(); switch (inputBuffer[0]) { case 0: break; case 'h': commandHelp(); break; case 'C': show_charMap(-1); break; case 'D': show_dotsMap(-1); break; case 'z': show_compDots(-1); break; case 'c': show_characters(-1); break; case 'd': show_dots(-1); break; case 'f': show_forRules(-1); break; case 'b': show_backRules(-1); break; case 'i': show_brailleIndicators(); break; case 'm': show_misc(); break; case 'p': particular(); break; case 'q': return 1; default: printf("Bad choice.\n"); break; } } while (inputBuffer[0] != 'q'); return 1; }
static int getCommands (void) { paramLetters (); do { printf ("Command: "); getInput (); switch (inputBuffer[0]) { case 0: break; case 't': do { printf ("Enter the name of a table: "); getInput (); strcpy (table, inputBuffer); } while ((validTable = lou_getTable (table)) == NULL); break; case 'r': if (validTable == NULL) { printf ("You must enter a valid table name.\n"); inputBuffer[0] = 0; } break; case 'm': printf ("Reset mode"); if (getYN ()) mode = 0; printf ("No contractions"); mode |= getYN (); printf ("Computer braille at cursor"); mode |= 2 * getYN (); printf ("Dots input and output"); mode |= 4 * getYN (); printf ("8-dot computer braille"); mode |= 8 * getYN (); printf ("Pass1 only"); mode |= 16 * getYN (); break; case 'l': printf ("Do you want to test input and output lengths"); showSizes = getYN (); if (!showSizes) { outputSize = BUFSIZE; break; } printf ("Enter a maximum output size: "); getInput (); outputSize = atoi (inputBuffer); if (outputSize < 0 || outputSize > BUFSIZE) { printf ("Output size must be from 0 tu %d.\n", BUFSIZE); outputSize = BUFSIZE; showSizes = 0; } break; case 'c': printf ("Enter a cursor position: "); getInput (); enteredCursorPos = atoi (inputBuffer); if (enteredCursorPos < -1 || enteredCursorPos > outputSize) { printf ("Cursor position must be from -1 to %d.\n", outputSize); enteredCursorPos = -1; } break; case 'e': printf ("(Enter an x to cancel emphasis.)\n"); printf ("Enter an emphasis string: "); getInput (); strcpy (enteredEmphasis, inputBuffer); break; case 's': printf ("(Enter an x to cancel spacing.)\n"); printf ("Enter a spacing string: "); getInput (); strcpy (enteredSpacing, inputBuffer); break; case 'h': printf ("Commands: action\n"); printf ("(t)able: Enter a table name\n"); printf ("(r)un: run the translation/back-translation loop\n"); printf ("(m)ode: Enter a mode parameter\n"); printf ("(c)ursor: Enter a cursor position\n"); printf ("(e)mphasis: Enter an emphasis string\n"); printf ("(s)pacing: Enter a spacing string\n"); printf ("(h)elp: print this page\n"); printf ("(q)uit: leave the program\n"); printf ("(f)orward-only: do only forward translation\n"); printf ("(b)ack-only: do only back-translation\n"); printf ("show-(p)ositions: show input and output positions\n"); printf ("m(i)nimal: test translator and back-translator with minimal parameters\n"); printf ("test-(l)engths: test accuracy of returned lengths\n"); printf ("\n"); paramLetters (); break; case 'q': lou_free(); exit (EXIT_SUCCESS); case 'f': printf ("Do only forward translation"); forwardOnly = getYN (); break; case 'b': printf ("Do only backward translation"); backOnly = getYN (); break; case 'p': printf ("Show input and output positions"); showPositions = getYN (); break; case 'i': printf ("Test translation/back-translation loop with minimal parameters"); minimalist = getYN (); break; default: printf ("Bad choice.\n"); break; } if (forwardOnly && backOnly) printf ("You cannot specify both forward-only and backward-only translation.\n"); } while (inputBuffer[0] != 'r'); return 1; }
static int getCommands (void) { paramLetters (); do { printf ("Command: "); getInput (); switch (inputBuffer[0]) { case 0: break; case 't': do { printf ("Enter the name of a table or a list: "); getInput (); strcpy (table, inputBuffer); validTable = lou_getTable (table); if (validTable != NULL && validTable->hyphenStatesArray == 0) { printf ("No hyphenation table.\n"); validTable = NULL; } } while (validTable == NULL); break; case 'a': mode = 1; break; case 'u': mode = 0; break; case 'r': if (validTable == NULL) { printf ("You must enter a valid table name or list.\n"); inputBuffer[0] = 0; } break; case 'h': printf ("Commands: action\n"); printf ("(t)able: Enter a table name or list\n"); printf ("(r)un: run the hyphenation test loop\n"); printf ("tr(a)nslated: translated input\n"); printf ("(u)ntranslated: untranslated input\n"); printf ("(h)elp: print this page\n"); printf ("(q)uit: leave the program\n"); printf ("\n"); paramLetters (); break; case 'q': exit (0); default: printf ("Bad choice.\n"); break; } } while (inputBuffer[0] != 'r'); return 1; }
static void commandHelp(void) { paramLetters(); }