|
|
1.1 root 1: /*-----------------------------------------------------------------------------
2: Talking BIOS device driver for the AT&T PC6300.
3: Copyright (C) Karl Dahlke 1987
4: This software may be freely used and distributed
5: for any non-profit purpose.
6: *-----------------------------------------------------------------------------
7: */
8:
9: /* speech.h: header file for speaking device drivers */
10:
11: /* don't incorporate any C routines from libc.a,
12: * becaues they do stack checking, and this is not a normal stack.
13: * However, we can use the ctype macros and static _ctype[] array. */
14:
15: #include <ctype.h>
16:
17: #define WORDLEN 24 /* length of longest "word" */
18: #define LINELEN 38 /* length of support command line */
19: #define N_CMDS 32 /* number of available speech commands */
20:
21: /* record additional keystrokes,
22: * when a speech command requires extra data.
23: * For instance, search through the circular buffer for a string,
24: * and start reading at that point. */
25: struct MULTIKEY {
26: char lastcmd; /* the multi-key command */
27: char nextchar; /* command needs the next character */
28: char nextline; /* command needs the next line */
29: char textlen;
30: short support; /* extra key, could be function key etc */
31: char text[LINELEN];
32: char lasttext[LINELEN];
33: };
34:
35: /* control structure for speaking session */
36: extern struct SDCONTROL {
37: struct MULTIKEY indata, outdata;
38: char *bufbot, *buftop; /* the circular buffer */
39: char *bufhead, *buftail; /* extend of text within the buffer */
40: char *bufcur; /* position of internal cursor within the buffer */
41: int (*dev_in)(); /* function to put char on device input queue */
42: char talkcmd; /* talking command */
43: char talkcmd2; /* queue up one extra command */
44: long drain_lbolt;
45: /* flags/modes */
46: char xparent; /* transparent mode, emulate the original driver */
47: char buf_ok; /* send output characters to the circular buffer for reading */
48: char ctrl_ok; /* allow control characters to enter the buffer for reading */
49: char dev_ok; /* send output characters to the screen (or com port) */
50: char rdflag; /* currently reading text */
51: char onesymb; /* reading one symbol */
52: char oneline; /* read one line at a time */
53: char esc; /* last char was escape */
54: char esc_lc; /* escape leftbrace received */
55: /* arrays of text */
56: /* punctuation pronounciation table, at most 10 letters per symbol.
57: * it turns out, you don't want long names for these anyways.
58: * it slows you down, reducing productivity. */
59: char punctab[40*10];
60: /* bind keys to talking commands */
61: char keymap[146];
62: char defcbuf[80]; /* in case kalloc fails */
63: } *sdcontrol[5];
64:
65: /* the above structures are initialized upon startup.
66: * One should use kalloc() to allocate the circular
67: * buffer and replacement text space at load time rather than compile time. */
68:
69: /* speech command structure, one for each possible command */
70: extern struct SDCMD {
71: char *desc; /* description */
72: char brief[8];
73: char nonempty; /* buffer must be nonempty */
74: char rdline; /* read the current line */
75: char rdsymb; /* read one symbol */
76: char rdchar; /* read one character */
77: char nextkey; /* needs next key to complete command */
78: char nextline; /* needs line of text to complete command */
79: } sdcmds[];
80:
81: /* state variables, set when entering deferred speech routines */
82: extern struct SDCONTROL *sdc;
83: extern char sdw[];
84: extern int sdsession, sdnoises, sdtones;
85: extern int sd0synth, sd0comport;
86: extern int sdscreenmode, sdoverride;
87:
88: #ifdef MSDOS
89: extern char *kalloc();
90: #else
91: extern char *allkp, *alloc();
92: #define kalloc(n) alloc(allkp, n)
93: #define kfree(p) free(p)
94: #endif
95:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.