home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume14 / jove4.9 / part02 / mac.h next >
Encoding:
C/C++ Source or Header  |  1988-04-25  |  4.5 KB  |  155 lines

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