|
|
1.1 root 1: /***************************************************************************
2: * This program is Copyright (C) 1986, 1987, 1988 by Jonathan Payne. JOVE *
3: * is provided to you without charge, and with no warranty. You may give *
4: * away copies of JOVE, including sources, provided that this notice is *
5: * included in all the files. *
6: ***************************************************************************/
7:
8: /* Macintosh related things. K. Mitchum 2/88 */
9:
10:
11: #define NMENUS 6
12: #define NMENUITEMS 40 /* This has GOT to be enough! */
13:
14: typedef data_obj *menumap[NMENUITEMS];
15: struct menu {
16: char *Name;
17: int menu_id;
18: MenuHandle Mn;
19: menumap m;
20: };
21:
22: struct stat {
23: int st_dev; /* volume number */
24: long st_ino; /* file number on volume */
25: dev_t st_rdev;
26: off_t st_size; /* logical end of file */
27: int st_mode;
28: time_t st_mtime; /* last modified */
29: };
30:
31: #define S_IFDIR 2
32:
33: typedef char *va_list;
34: #define va_dcl va_list va_alist;
35: #define va_start(l) { (l) = (va_list)&va_alist; }
36: #define va_arg(l,m) (((m*)((l) += sizeof(m)))[-1])
37: #define va_end(l) { (l) = NULL; }
38:
39: #ifdef _mac
40: extern struct menu Menus[NMENUS];
41:
42: static EventRecord the_Event;
43:
44: /* keycodes (from Inside MacIntosh I-251). because of changes with
45: the MacPlus, there are some duplicate codes between cursor keys and
46: keypad keys. these can be deciphered by the corresponding character
47: codes, which are different. this table simply translates a keycode
48: into a character code that is appropriate. */
49:
50: #define NOKEY (-1)
51: #define RET 0x0D
52: #define TAB 0x09
53: #define BACKSP 0x08
54: #define ENTERL NOKEY /* left enter key absent on MacPlus */
55: #define COMMAND NOKEY /* will be no translation anyway for these */
56: #define SHIFT NOKEY
57: #define CAPSLOCK NOKEY
58: #define OPTION NOKEY
59: #define PADDOT '.' /* PAD period */
60: #define PAD0 '0'
61: #define PAD1 '1'
62: #define PAD2 '2'
63: #define PAD3 '3'
64: #define PAD4 '4'
65: #define PAD5 '5'
66: #define PAD6 '6'
67: #define PAD7 '7'
68: #define PAD8 '8'
69: #define PAD9 '9'
70: #define LEFTCURS 'B' /* jove only, make like commands */
71: #define RIGHTCURS 'F'
72: #define UPCURS 'P'
73: #define DOWNCURS 'N'
74: #define PADENTER RET
75: #define PADMINUS '-'
76: #define CLEAR 0
77:
78: static char nsh_keycodes[] = {
79: 'a','s','d','f','h', /* 0 - 4 */
80: 'g','z','x','c','v', /* 5 - 9 */
81: NOKEY,'b','q','w','e', /* 10 - 14 */
82: 'r','y','t','1','2', /* 15 - 19 */
83: '3','4','6','5','=', /* 20 - 24 */
84: '9','7','-','8','0', /* 25 - 29 */
85: ']','O','u','[','i', /* 30 - 34 */
86: 'p',RET,'l','j','\'', /* 35 - 39 */
87: 'k',';','\\',',','/', /* 40 - 44 */
88: 'n','m','.',TAB,NOKEY, /* 45 - 49 */
89: '`',BACKSP,ENTERL,NOKEY,NOKEY, /* 50 - 54 */
90: COMMAND,SHIFT,CAPSLOCK,OPTION, NOKEY, /* 55 - 59 */
91: NOKEY,NOKEY,NOKEY,NOKEY,NOKEY, /* 60 - 64 */
92: PADDOT,RIGHTCURS,NOKEY,NOKEY,NOKEY, /* 65 - 69 */
93: LEFTCURS,CLEAR,DOWNCURS,NOKEY,NOKEY, /* 70 - 74 */
94: NOKEY,PADENTER,UPCURS,PADMINUS,NOKEY, /* 75 - 79 */
95: NOKEY,NOKEY,PAD0,PAD1,PAD2, /* 80 - 84 */
96: PAD3,PAD4,PAD5,PAD6,PAD7, /* 85 - 89 */
97: NOKEY,PAD8,PAD9
98: };
99:
100: static char sh_keycodes[] = {
101: 'A','S','D','F','H', /* 0 - 4 */
102: 'G','Z','X','C','V', /* 5 - 9 */
103: NOKEY,'B','Q','W','E', /* 10 - 14 */
104: 'R','Y','T','!','@', /* 15 - 19 */
105: '#','$','^','%','+', /* 20 - 24 */
106: '(','&','_','*',')', /* 25 - 29 */
107: '}','O','U','{','I', /* 30 - 34 */
108: 'P',RET,'L','J','\'', /* 35 - 39 */
109: 'K',';','|','<','?', /* 40 - 44 */
110: 'N','M','>',TAB,NOKEY, /* 45 - 49 */
111: '~',BACKSP,ENTERL,NOKEY,NOKEY, /* 50 - 54 */
112: COMMAND,SHIFT,CAPSLOCK,OPTION, NOKEY, /* 55 - 59 */
113: NOKEY,NOKEY,NOKEY,NOKEY,NOKEY, /* 60 - 64 */
114: PADDOT,RIGHTCURS,NOKEY,NOKEY,NOKEY, /* 65 - 69 */
115: LEFTCURS,CLEAR,DOWNCURS,NOKEY,NOKEY, /* 70 - 74 */
116: NOKEY,PADENTER,UPCURS,PADMINUS,NOKEY, /* 75 - 79 */
117: NOKEY,NOKEY,PAD0,PAD1,PAD2, /* 80 - 84 */
118: PAD3,PAD4,PAD5,PAD6,PAD7, /* 85 - 89 */
119: NOKEY,PAD8,PAD9
120: };
121:
122:
123:
124: /* tn.h Modified for variable screen size 11/21/87. K. Mitchum */
125:
126: #define SCREENSIZE (wc->w_rows * ROWSIZE)
127: #define FONT monaco
128: #define TEXTSIZE 9
129:
130: #define HEIGHT 11
131: #define WIDTH 6
132: #define DESCENT 2
133: #define TWIDTH CO * WIDTH
134: #define THEIGHT LI * HEIGHT
135:
136: /* window specs */
137:
138: #define SCROLLWIDTH 16 /* width of scroll bar control in pixels */
139: #define WINDWIDTH (wc->w_width - SCROLLWIDTH + 1) /* local coordinates */
140: #define WINDHEIGHT (wc->w_height) /* local coordinates */
141: #define MAXROW (LI - 1)
142: #define MAXCOL (CO - 1)
143:
144:
145: /* for keyboard routines */
146: #define MCHARS 32 /* must be power of two */
147: #define NMASK MCHARS (-1) /* circular buffer */
148:
149: #endif /* _mac */
150:
151:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.