home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume17 / mgr / part37 < prev    next >
Encoding:
Internet Message Format  |  1989-01-19  |  44.2 KB

  1. Subject:  v17i038:  MGR, Bellcore window manager, Part37/61
  2. Newsgroups: comp.sources.unix
  3. Approved: rsalz@uunet.UU.NET
  4.  
  5. Submitted-by: Stephen A. Uhler <sau@bellcore.com>
  6. Posting-number: Volume 17, Issue 38
  7. Archive-name: mgr/part37
  8.  
  9.  
  10.  
  11.  
  12. #! /bin/sh
  13. # This is a shell archive.  Remove anything before this line, then unpack
  14. # it by saving it into a file and typing "sh file".  To overwrite existing
  15. # files, type "sh file -c".  You can also feed this as standard input via
  16. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  17. # will see the following message at the end:
  18. #        "End of archive 37 (of 61)."
  19. # Contents:  demo/msg/do.c lib/scribe.c.4 src/mgr.c
  20. # Wrapped by rsalz@papaya.bbn.com on Thu Nov 17 21:05:46 1988
  21. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  22. if test -f 'demo/msg/do.c' -a "${1}" != "-c" ; then 
  23.   echo shar: Will not clobber existing file \"'demo/msg/do.c'\"
  24. else
  25. echo shar: Extracting \"'demo/msg/do.c'\" \(14264 characters\)
  26. sed "s/^X//" >'demo/msg/do.c' <<'END_OF_FILE'
  27. X/*    $Header: do.c,v 4.1 88/06/21 14:02:38 bianchi Exp $
  28. X    $Source: /tmp/mgrsrc/demo/msg/RCS/do.c,v $
  29. X*/
  30. Xstatic char    RCSid_[] = "$Source: /tmp/mgrsrc/demo/msg/RCS/do.c,v $$Revision: 4.1 $";
  31. X
  32. X/*                        Copyright (c) 1987 Bellcore
  33. X *                            All Rights Reserved
  34. X *       Permission is granted to copy or use this program, EXCEPT that it
  35. X *       may not be sold for profit, the copyright notice must be reproduced
  36. X *       on copies, and credit should be given to Bellcore where it is due.
  37. X *       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  38. X */
  39. X/* do a service */
  40. X
  41. X#include <stdio.h>
  42. X#include <signal.h>
  43. X#include "term.h"
  44. X#include "do.h"
  45. X
  46. X#define dprintf        if (debug) fprintf
  47. X#define have_icon(icon)    (icon->w && icon->h)
  48. X#define GET_OPT(i)    \
  49. X    strlen(argv[i])>2 ? argv[i]+2 : argv[++i]
  50. X
  51. X#define MSG        '&'        /* message leader */
  52. X
  53. X#define TIMEOUT        3        /* need first response by now */
  54. X
  55. X#define NORMAL        0        /* quiescent icon */
  56. X#define RUNNING        1        /* icon while running command */
  57. X#define ACTIVE        2        /* icon while window active */
  58. X
  59. X/* remote options */
  60. X
  61. X#define NONE    0            /* no remotes at all */
  62. X#define LOCAL    1            /* command runs locally, ship file */
  63. X#define REMOTE    2            /* command runs remotely */
  64. X
  65. Xint debug;
  66. Xint wx,wy,border;            /* initial window parameters */
  67. Xint fw, fh;                /* font size */
  68. Xstruct icon *icon;            /* current icon */
  69. X
  70. Xmain(argc,argv)
  71. Xint argc;
  72. Xchar **argv;
  73. X   {
  74. X   register int i;
  75. X
  76. X   char *index(), *ttyname(), *getenv();
  77. X   int timeout(),clean();
  78. X
  79. X   struct icon icons[3];        /* icons */
  80. X   char line[100];            /* mgr inout buffer */
  81. X   char file[100];            /* command args go here */
  82. X   char message[100];            /* place to format messages */
  83. X   char temp[100];            /* temp file name */
  84. X   char do_host[32];            /* our host */
  85. X
  86. X   char action;                /* message command */
  87. X   char *client_host;            /* client host */
  88. X   char *command;            /* command to run */
  89. X   char *name = NULL;            /* server name (if not command) */
  90. X   char *path;                /* path part of file name */
  91. X
  92. X   int id;                /* id of sender */
  93. X   int code;                /* return code from command */
  94. X   int xpos, ypos;            /* where command window goes */
  95. X   int wide ,high;            /* command window size */
  96. X   int nowindow = 0;            /* no command window */
  97. X   int font=0;                /* font in leiu of icon */
  98. X   int wait=0;                /* wait for ack at command term. */
  99. X   int remote=NONE;            /* remote requests permitted */
  100. X   int icon_count=0;            /* Number of icons */
  101. X   int servers = 0;            /* number of servers out there */
  102. X   int bailout = 0;            /* bail out w/out running command */
  103. X
  104. X   debug = (int) getenv("DEBUG");
  105. X
  106. X   /* check for valid environment */
  107. X
  108. X   if (argc < 3) {
  109. X      fprintf(stderr,"usage: %s [options] -c<command> icon1 icon2 [icon3]\n",
  110. X              *argv);
  111. X      fprintf(stderr,"options:\n");
  112. X      fprintf(stderr,"   -C nnn   number of columns\n");
  113. X      fprintf(stderr,"   -R nnn   number of rows\n");
  114. X      fprintf(stderr,"   -f n     font\n");
  115. X      fprintf(stderr,"   -n name  name of command (if not command name)\n");
  116. X      fprintf(stderr,"   -p       wait for CR at command termination\n");
  117. X      fprintf(stderr,"   -W       don't make alternate window\n");
  118. X      fprintf(stderr,"   -x nnn   starting window position\n");
  119. X      fprintf(stderr,"   -y nnn   starting window position\n");
  120. X      fprintf(stderr,"   -i       interactive starting icon position\n");
  121. X      fprintf(stderr,"   -r       permit remote invocations\n");
  122. X      fprintf(stderr,"   -N       remote invocations run over there1\n");
  123. X      exit(1);
  124. X      }
  125. X
  126. X   ckmgrterm( *argv );
  127. X   
  128. X   /* setup mgr */
  129. X
  130. X   m_setup(M_FLUSH);
  131. X   chmod(ttyname(2),0600);    /* this is not gauranteed */
  132. X   m_push(P_POSITION|P_FONT|P_EVENT|P_FLAGS);
  133. X
  134. X   signal(SIGTERM,clean);
  135. X   signal(SIGINT,clean);
  136. X   signal(SIGHUP,clean);
  137. X   signal(SIGALRM,timeout);
  138. X
  139. X   m_ttyset();
  140. X   m_setmode(M_NOWRAP);
  141. X   m_setmode(M_ABS);
  142. X   m_func(B_COPY);
  143. X
  144. X   m_setevent(ACCEPT,"&%f:%m\r");
  145. X   m_setevent(REDRAW,"R\r");
  146. X   m_setevent(RESHAPE,"S\r");
  147. X   m_setevent(MOVE,"M\r");
  148. X   m_setevent(ACTIVATE,"A\r");
  149. X   m_setevent(DEACTIVATE,"D\r");
  150. X
  151. X   get_size(&wx,&wy,&wide,&high);
  152. X   get_param(0,0,0,&border);
  153. X   font = get_font(&fw,&fh);
  154. X   dprintf(stderr,"%d,%d %dx%d font %d (%d,%d)\n",wx,wy,wide,high,font,fw,fh);
  155. X
  156. X   xpos = wx, ypos=wy;
  157. X   gethostname(do_host,sizeof(do_host));
  158. X
  159. X   /* check arguments */
  160. X
  161. X   for(i=1;i<argc;i++) {
  162. X      if (*argv[i] == '-')
  163. X         switch (argv[i][1]) {
  164. X            case 'W':                /* don't make alt. window */
  165. X               nowindow++;
  166. X               break;
  167. X            case 'r':                /* remote file, local command */
  168. X               remote=LOCAL;
  169. X               break;
  170. X            case 'N':                /* remote commmand,local file */
  171. X               remote=REMOTE;
  172. X               break;
  173. X            case 'p':                /* wait for ack */
  174. X               wait++;
  175. X               break;
  176. X            case 'n':                /* specify command name */
  177. X               name = GET_OPT(i);
  178. X               break;
  179. X            case 'c':                /* specify command */
  180. X               command = GET_OPT(i);
  181. X               break;
  182. X            case 'f':                /* specify font */
  183. X               font = atoi(GET_OPT(i));
  184. X               break;
  185. X            case 'C':                /* specify columns */
  186. X               wide = 2*border + fw * atoi(GET_OPT(i));
  187. X               break;
  188. X            case 'R':                /* specify rows */
  189. X               high = 2*border + fh * atoi(GET_OPT(i));
  190. X               break;
  191. X            case 'w':                /* specify wide */
  192. X               wide = atoi(GET_OPT(i));
  193. X               break;
  194. X            case 'i':                /* specify icon start */
  195. X               {
  196. X                  int x,y;
  197. X                  m_push(P_EVENT);
  198. X                  m_setevent(BUTTON_1,"Z %p\r");
  199. X                  fprintf(stderr,"Click button 1 to indicate icon position\n");
  200. X                  while (*m_gets(line) != 'Z')
  201. X                     ;
  202. X                  sscanf(line,"Z %d %d",&x,&y);
  203. X                  wx += x, wy +=y;
  204. X                  m_pop();
  205. X                  }
  206. X               break;
  207. X            case 'x':                /* specify x_start */
  208. X               xpos = atoi(GET_OPT(i));
  209. X               break;
  210. X            case 'y':                /* specify y_start */
  211. X               ypos = atoi(GET_OPT(i));
  212. X               break;
  213. X            default:
  214. X               fprintf(stderr,"%s: bad flag %c ignored\n",argv[0],argv[i][1]);
  215. X            }
  216. X      else if (icon_count < 3) {
  217. X         download_icon(&icons[icon_count],argv[i],icon_count+1,font);
  218. X         icon_count++;
  219. X         }
  220. X      else
  221. X         fprintf(stderr,"%s: invalid arg [%s] ignored\n",argv[0],argv[i]);
  222. X      }
  223. X
  224. X   if (RUNNING > icon_count) {
  225. X      fprintf(stderr,"%s: Not enough icons specified\n",argv[0]);
  226. X      exit(2);
  227. X      }
  228. X      
  229. X   if (debug) 
  230. X      getchar();
  231. X
  232. X   set_icon(&icons[NORMAL]);
  233. X
  234. X   if (name == NULL)
  235. X      name = command;
  236. X
  237. X   m_setevent(NOTIFY,name);
  238. X   sprintf(message,"%c %s",S_HI,name);
  239. X
  240. X   m_broadcast(message);
  241. X   alarm(TIMEOUT);
  242. X   m_clearmode(M_ACTIVATE);
  243. X   m_flush();
  244. X   dprintf(stderr,"%s: broadcast id\r\n",name);
  245. X         
  246. X   while(m_gets(line) != NULL) {
  247. X
  248. X      /* process messages */
  249. X
  250. X      if (*line == MSG) {
  251. X         sscanf(line+1,"%d:%c %[^\n]", &id,&action,file);
  252. X         dprintf(stderr,"%s id: %d message: %s\r\n",name,id,file);
  253. X         switch (action) {
  254. X            case C_DO:            /* received command */
  255. X               dprintf(stderr,"%s received command from %d (%s)\r\n",
  256. X                       name,id,file);
  257. X               sprintf(message,"%c%c",S_REPLY,R_RCVD);
  258. X               m_sendto(id,message);
  259. X               set_icon(&icons[RUNNING]);
  260. X
  261. X               /* no file name in command, use snarf buffer */
  262. X
  263. X               if (*file == C_SNARF) {
  264. X                  m_put();
  265. X                  m_gets(file);
  266. X                  dprintf(stderr,"%s snarfing (%s)\r\n", name,file);
  267. X                  }
  268. X
  269. X               /* get host name (if none, assume local host) */
  270. X
  271. X               if (path=index(file,HOST)) {
  272. X                  *path = '\0';
  273. X                  client_host = file;
  274. X                  path++;
  275. X                  }
  276. X               else {
  277. X                  path = file;
  278. X                  client_host = do_host;
  279. X                  }
  280. X
  281. X               dprintf(stderr,"Got %s at %s\n",path,client_host);
  282. X              
  283. X               if (strcmp(client_host,do_host)!= 0)
  284. X                  switch (remote) {
  285. X                     case NONE:        /* no remote access allowed */ 
  286. X                        sprintf(message,"%c%c",S_REPLY,R_HOST);
  287. X                        m_sendto(id,message);
  288. X                        bailout++;
  289. X                        break;
  290. X                     case LOCAL:    /* ship file to command */
  291. X                        sprintf(temp,"TEMP/%s:%s.%d",
  292. X                               client_host,path,getpid());
  293. X                        sprintf(message,"rcp %s:%s %s",
  294. X                               client_host,path,temp);
  295. X                        if (system(message)) {
  296. X                           sprintf(message,"%c%c",S_REPLY,R_NET);
  297. X                           m_sendto(id,message);
  298. X                           bailout++;
  299. X                           }
  300. X                        break;
  301. X                     case REMOTE:    /* run command remotely */
  302. X                        sprintf(message,"rsh %s '%s %s'",
  303. X                                client_host,command,path);
  304. X                        break;
  305. X                     }
  306. X               else
  307. X                  sprintf(message,"%s %s",command,path);
  308. X               
  309. X               if (bailout)
  310. X                  break;
  311. X
  312. X               if (nowindow) {
  313. X                  m_ttyreset();
  314. X                  dprintf(stderr,"%s Running [%s] no window\n",name,message);
  315. X                  code = system(message);
  316. X                  m_ttyset();
  317. X                  }
  318. X               else 
  319. X                  code = do_command(message,0,0,font,xpos,ypos,wide,high,wait);
  320. X               set_icon(&icons[NORMAL]);
  321. X               sprintf(message,"%c%c",S_REPLY,code==0?R_DONE:R_BAD);
  322. X               m_sendto(id,message);
  323. X               m_clearmode(M_ACTIVATE);
  324. X               break;
  325. X            case C_WHO:            /* received who-are-you inquiry */
  326. X               dprintf(stderr,"%s received query from %d\r\n",name,id);
  327. X               sprintf(message,"%c%c %s",S_REPLY,R_WHO,name);
  328. X               m_sendto(id,message);
  329. X               break;
  330. X            case S_HI:            /* Hi, I'm a server */
  331. X               dprintf(stderr,"%s Server HI message, ignored\r\n",name);
  332. X               alarm(0);
  333. X               break;
  334. X            case S_BYE:            /* server died */
  335. X               dprintf(stderr,"%s Server BYE message, ignored\r\n",name);
  336. X               break;
  337. X            case S_REPLY:        /* someone thinks I'm a client */
  338. X               dprintf(stderr,"%s Oops, I got a server reply message\r\n",name);
  339. X               break;
  340. X            default:            /* unknown message */
  341. X               sprintf(message,"%c%c",S_REPLY,R_UNKWN);
  342. X               m_sendto(id,message);
  343. X               dprintf(stderr,"%s unknown message\r\n",name);
  344. X               break;
  345. X            }
  346. X         }
  347. X      else {
  348. X
  349. X         /* process mgr events */
  350. X
  351. X         dprintf(stderr,"%s Not a message: %s\r\n",name,line);
  352. X         switch(*line) {
  353. X            case 'M':                /* moved */
  354. X              get_size(&wx,&wy,0,0);
  355. X              break;
  356. X            case 'S':                /* reshape */
  357. X              get_size(&wx,&wy,0,0);
  358. X              reset_icon();
  359. X              break;
  360. X            case 'R':                /* redraw */
  361. X              reset_icon();
  362. X              break;
  363. X#ifdef OOPS
  364. X            case 'A':                /* window activated */
  365. X              if (icon_count > ACTIVE)
  366. X                 set_icon(&icons[ACTIVE]);
  367. X              break;
  368. X            case 'D':                /* window deactivated */
  369. X              if (icon_count > ACTIVE)
  370. X                 set_icon(&icons[NORMAL]);
  371. X              break;
  372. X#endif
  373. X            }
  374. X         }
  375. X      m_flush();
  376. X      }
  377. X   }
  378. X   
  379. X/* down load an icon */
  380. X
  381. Xdownload_icon(icon,name,where,font)
  382. Xregister struct icon *icon;    /* name of icon to download */
  383. Xchar *name;            /* text string in lieu of icon */
  384. Xint where;            /* bitmap to download icon to */
  385. Xint font;            /* char font if no icon */
  386. X   {
  387. X   int size;
  388. X   char line[100];
  389. X   int w_in=0,h_in=0;
  390. X
  391. X   /* look only on the local machine */
  392. X
  393. X   dprintf(stderr,"   looking for %s\r\n",name);
  394. X   m_bitfromfile(where,name);
  395. X   m_flush();
  396. X   m_gets(line);
  397. X   sscanf(line,"%d %d",&w_in,&h_in);
  398. X   dprintf(stderr,"   Found %s (%d x %d)\r\n",name,w_in,h_in);
  399. X   icon->w = w_in;
  400. X   icon->h = h_in;
  401. X   icon->type = (h_in && w_in) ? where : font;
  402. X   icon->name = name;
  403. X   return(w_in && h_in);
  404. X   } 
  405. X
  406. X/* put icon in a window */
  407. X
  408. Xset_icon(name)
  409. Xstruct icon *name;        /* name of icon */
  410. X   {
  411. X   m_push(P_EVENT);
  412. X   if (have_icon(name)) {
  413. X      m_font(1);
  414. X      dprintf(stderr,"Setting icon %s\r\n",name->name);
  415. X      m_shapewindow(wx,wy,name->w+2*border,name->h+2*border);
  416. X      m_bitcopyto(0,0,name->w,name->h,0,0,0,name->type);
  417. X      }
  418. X   else {
  419. X      dprintf(stderr,"Setting text %s\r\n",name->name);
  420. X      m_font(name->type);
  421. X      m_size(strlen(name->name),1);
  422. X      m_clear();
  423. X      m_printstr(name->name);
  424. X      }
  425. X   m_flush();
  426. X   m_clearmode(M_ACTIVATE);
  427. X   m_pop();
  428. X   icon = name;
  429. X   }
  430. X
  431. Xreset_icon()
  432. X   {
  433. X   if (icon)
  434. X      set_icon(icon);
  435. X   }
  436. X
  437. X/* time out */
  438. X
  439. Xint
  440. Xtimeout(n)
  441. Xint n;
  442. X   {
  443. X   fprintf(stderr,"Can't send messages, sorry\n");
  444. X   clean(n);
  445. X   }
  446. X
  447. X/*    Clean up and exit */
  448. X
  449. Xclean(n)
  450. Xint n;
  451. X   {
  452. X   char message[40];
  453. X
  454. X   sprintf(message,"%c",S_BYE);
  455. X   m_broadcast(message);
  456. X   m_gets(message);
  457. X   m_popall();
  458. X   m_clear();
  459. X   m_ttyreset();
  460. X   exit(n);
  461. X   }
  462. X
  463. X/* run  a command in a sub window */
  464. X
  465. Xdo_command(command,menu,count,font,xpos,ypos,wide,high,wait)
  466. Xchar *command;
  467. Xstruct menu_entry *menu;
  468. Xint count;
  469. Xint font,xpos,ypos,wide,high;
  470. Xint wait;
  471. X   {
  472. X   int code;        /* return code from command */
  473. X   int n;        /* sub-window number */
  474. X
  475. X   n=m_makewindow(xpos,ypos,wide,high);
  476. X
  477. X   if (n==0) {            /* can't make window */
  478. X      m_printstr("\007\fCan't open command window, sorry");
  479. X      return(-1);
  480. X      }
  481. X
  482. X   m_selectwin(n);
  483. X   if (count) {
  484. X      menu_load(1,count,menu);
  485. X      m_selectmenu(1);
  486. X      }
  487. X   if (font > 0)
  488. X      m_font(font);
  489. X   m_ttyreset();
  490. X   dprintf(stderr,"Running [%s]\n",command);
  491. X   code = system(command);
  492. X   if (wait) {
  493. X      char temp[10];
  494. X      m_gets(temp);
  495. X      }
  496. X   m_ttyset();
  497. X   m_selectwin(0);
  498. X   m_destroywin(n);
  499. X   return(code);
  500. X   }
  501. END_OF_FILE
  502. # end of 'demo/msg/do.c'
  503. fi
  504. if test -f 'lib/scribe.c.4' -a "${1}" != "-c" ; then 
  505.   echo shar: Will not clobber existing file \"'lib/scribe.c.4'\"
  506. else
  507. echo shar: Extracting \"'lib/scribe.c.4'\" \(14275 characters\)
  508. sed "s/^X//" >'lib/scribe.c.4' <<'END_OF_FILE'
  509. X    31, 31, 0, -1, 2, 0, 4, 0, 6, -1};
  510. Xstatic char c347[115] = {
  511. X    56, -11, 13,            /*, 8, 26, Z  */
  512. X    7, 11, 6, 9, 0, 3, -4, -2, -6, -5, -9, -9, 31, 31, 4, 6,
  513. X    -4, -3, 31, 31, 9, 12, 6, 8, 4, 5, 0, 0, -6, -6, -7, -8,
  514. X    31, 31, -9, 10, -7, 12, -4, 11, 3, 11, 9, 12, 31, 31, -8, 11,
  515. X    -4, 10, 1, 10, 6, 11, 31, 31, -9, 10, -5, 9, 0, 9, 5, 10,
  516. X    7, 11, 31, 31, -7, -8, -5, -7, 0, -6, 5, -6, 9, -7, 31, 31,
  517. X    -6, -8, -1, -7, 4, -7, 8, -8, 31, 31, -9, -9, -3, -8, 4, -8,
  518. X    7, -9, 9, -7, 31, 31, -6, 2, -1, 2, 31, 31, 2, 2, 6, 2};
  519. Xstatic char c348[25] = {
  520. X    11, -7, 9,            /*, 1, 49, [  */
  521. X    -3, 16, -3, -16, 31, 31, -2, 16, -2, -16, 31, 31, -3, 16, 4, 16,
  522. X    31, 31, -3, -16, 4, -16};
  523. Xstatic char c349[7] = {
  524. X    2, -11, 11,            /*, 1, 40, /  */
  525. X    -9, 16, 9, -16};
  526. Xstatic char c350[25] = {
  527. X    11, -7, 9,            /*, 1, 50, ]  */
  528. X    2, 16, 2, -16, 31, 31, 3, 16, 3, -16, 31, 31, -4, 16, 3, 16,
  529. X    31, 31, -4, -16, 3, -16};
  530. Xstatic char c351[17] = {
  531. X    7, -11, 11,            /*, 9, 28, 1, */
  532. X    -8, -2, 0, 3, 8, -2, 31, 31, -8, -2, 0, 2, 8, -2};
  533. Xstatic char c352[7] = {
  534. X    2, -12, 12,            /*, 1, 38, -  */
  535. X    -9, -12, 9, -12};
  536. Xstatic char c353[15] = {
  537. X    6, -6, 6,            /*, 9, 30, 3, */
  538. X    -2, 12, 3, 6, 31, 31, -2, 12, -3, 11, 3, 6};
  539. Xstatic char c354[107] = {
  540. X    52, -8, 11,            /*, 7, 1, A  */
  541. X    -2, 0, -4, -2, -5, -4, -5, -6, -4, -8, -2, -9, 0, -7, 3, -6,
  542. X    31, 31, -5, -4, -4, -6, -3, -7, -1, -8, 31, 31, -4, -2, -4, -4,
  543. X    -3, -6, -1, -7, 0, -7, 31, 31, -4, 2, -2, 2, 1, 3, 3, 4,
  544. X    4, 5, 6, 3, 5, 2, 5, -6, 6, -7, 7, -7, 31, 31, -3, 4,
  545. X    -4, 3, -1, 3, 31, 31, 2, 3, 5, 3, 4, 4, 4, -7, 5, -8,
  546. X    31, 31, -5, 3, -3, 5, -2, 4, 0, 3, 3, 2, 3, -7, 5, -9,
  547. X    7, -7, 31, 31, -5, 3, 0, -2};
  548. Xstatic char c355[89] = {
  549. X    43, -9, 11,            /*, 7, 2, B  */
  550. X    -6, 10, -5, 8, -5, -6, -7, -7, 31, 31, -4, 8, -5, 10, -4, 11,
  551. X    -4, -6, -1, -8, 31, 31, -6, 10, -3, 12, -3, -6, -1, -7, 0, -8,
  552. X    31, 31, -7, -7, -5, -7, -3, -8, -2, -9, 0, -8, 3, -7, 5, -7,
  553. X    31, 31, -3, 2, 0, 3, 2, 4, 3, 5, 4, 4, 6, 3, 7, 3,
  554. X    5, 2, 5, -7, 31, 31, 2, 4, 4, 3, 4, -6, 31, 31, 0, 3,
  555. X    1, 3, 3, 2, 3, -7};
  556. Xstatic char c356[71] = {
  557. X    34, -8, 8,            /*, 7, 3, C  */
  558. X    -4, 3, -4, -6, -6, -7, -5, -7, -3, -8, -2, -9, 31, 31, -3, 3,
  559. X    -3, -7, -1, -8, 31, 31, -2, 3, -2, -6, 0, -7, 4, -5, -1, -8,
  560. X    -2, -9, 31, 31, -4, 3, 0, 4, 2, 5, 3, 4, 5, 3, 6, 3,
  561. X    31, 31, 1, 4, 2, 3, 4, 3, 31, 31, -2, 3, 0, 4, 2, 2,
  562. X    4, 2, 6, 3};
  563. Xstatic char c357[83] = {
  564. X    40, -9, 10,            /*, 7, 4, D  */
  565. X    0, 5, -2, 4, -5, 3, -5, -6, -7, -7, 31, 31, -4, 3, -4, -6,
  566. X    -1, -8, 31, 31, 0, 5, -3, 3, -3, -6, -1, -7, 0, -8, 31, 31,
  567. X    -7, -7, -5, -7, -3, -8, -2, -9, 0, -8, 3, -7, 5, -7, 31, 31,
  568. X    -5, 10, -2, 12, -1, 9, 5, 3, 5, -7, 31, 31, -2, 9, -4, 10,
  569. X    -3, 11, -2, 9, 4, 3, 4, -6, 31, 31, -5, 10, 3, 2, 3, -7};
  570. Xstatic char c358[65] = {
  571. X    31, -8, 8,            /*, 7, 5, E  */
  572. X    -4, 3, -4, -6, -6, -7, -5, -7, -3, -8, -2, -9, 31, 31, -3, 3,
  573. X    -3, -7, -1, -8, 31, 31, -2, 3, -2, -6, 0, -7, 4, -5, -1, -8,
  574. X    -2, -9, 31, 31, -4, 3, 0, 4, 2, 5, 5, 1, 3, 0, -2, -3,
  575. X    31, 31, 1, 4, 4, 1, 31, 31, -2, 3, 0, 4, 3, 0};
  576. Xstatic char c359[83] = {
  577. X    40, -8, 8,            /*, 7, 6, F  */
  578. X    -4, 10, -4, -6, -6, -7, -5, -7, -3, -8, -2, -9, 31, 31, -3, 10,
  579. X    -3, -7, -1, -8, 31, 31, -2, 10, -2, -6, 0, -7, 1, -7, -1, -8,
  580. X    -2, -9, 31, 31, -4, 10, 0, 11, 2, 12, 3, 11, 5, 10, 6, 10,
  581. X    31, 31, 1, 11, 2, 10, 4, 10, 31, 31, -2, 10, 0, 11, 2, 9,
  582. X    4, 9, 6, 10, 31, 31, -7, 5, -4, 5, 31, 31, -2, 5, 1, 5};
  583. Xstatic char c360[113] = {
  584. X    55, -9, 11,            /*, 7, 7, G  */
  585. X    -5, 3, -5, -6, -7, -7, -6, -7, -4, -8, -3, -9, -2, -8, 0, -7,
  586. X    3, -6, 31, 31, -4, 2, -4, -7, -2, -8, 31, 31, -3, 3, -3, -6,
  587. X    -1, -7, 0, -7, 31, 31, -5, 3, -3, 3, 0, 4, 2, 5, 3, 4,
  588. X    5, 3, 7, 3, 5, 2, 5, -10, 4, -13, 2, -15, 0, -16, -1, -15,
  589. X    -3, -14, -5, -14, 31, 31, 1, 4, 4, 2, 4, -10, 31, 31, 1, -15,
  590. X    -1, -14, -2, -14, 31, 31, 0, 4, 1, 3, 3, 2, 3, -8, 4, -11,
  591. X    4, -13, 31, 31, 2, -15, 1, -14, -1, -13, -3, -13, -5, -14};
  592. Xstatic char c361[95] = {
  593. X    46, -9, 11,            /*, 7, 8, H  */
  594. X    -6, 10, -5, 8, -5, -6, -7, -7, -6, -7, -4, -8, -3, -9, 31, 31,
  595. X    -4, 8, -5, 10, -4, 11, -4, -7, -2, -8, 31, 31, -6, 10, -3, 12,
  596. X    -3, -6, -1, -7, -3, -9, 31, 31, -3, 2, 0, 3, 2, 4, 3, 5,
  597. X    4, 4, 6, 3, 7, 3, 5, 2, 5, -7, 3, -9, 2, -11, 31, 31,
  598. X    2, 4, 4, 3, 4, -7, 3, -9, 31, 31, 0, 3, 1, 3, 3, 2,
  599. X    3, -7, 2, -11, 2, -14, 3, -16, 4, -16, 2, -14};
  600. Xstatic char c362[71] = {
  601. X    34, -5, 7,            /*, 7, 9, I  */
  602. X    0, 12, -2, 10, 0, 9, 2, 10, 0, 12, 31, 31, 0, 11, -1, 10,
  603. X    1, 10, 0, 11, 31, 31, 0, 5, -1, 4, -3, 3, -1, 2, -1, -7,
  604. X    1, -9, 3, -7, 31, 31, 0, 2, 1, 3, 0, 4, -1, 3, 0, 2,
  605. X    0, -7, 1, -8, 31, 31, 0, 5, 1, 4, 3, 3, 1, 2, 1, -6,
  606. X    2, -7, 3, -7};
  607. Xstatic char c363[79] = {
  608. X    38, -5, 7,            /*, 7, 10, J  */
  609. X    0, 12, -2, 10, 0, 9, 2, 10, 0, 12, 31, 31, 0, 11, -1, 10,
  610. X    1, 10, 0, 11, 31, 31, 0, 5, -1, 4, -3, 3, -1, 2, -1, -7,
  611. X    1, -9, 2, -11, 31, 31, 0, 2, 1, 3, 0, 4, -1, 3, 0, 2,
  612. X    0, -7, 1, -9, 31, 31, 0, 5, 1, 4, 3, 3, 1, 2, 1, -7,
  613. X    2, -11, 2, -14, 0, -16, -2, -16, -2, -15, 0, -16};
  614. Xstatic char c364[101] = {
  615. X    49, -9, 10,            /*, 7, 11, K  */
  616. X    -6, 10, -5, 8, -5, -6, -7, -7, -6, -7, -4, -8, -3, -9, 31, 31,
  617. X    -4, 8, -5, 10, -4, 11, -4, -7, -2, -8, 31, 31, -6, 10, -3, 12,
  618. X    -3, -6, -1, -7, -3, -9, 31, 31, -3, 2, 0, 4, 2, 5, 4, 2,
  619. X    1, 0, -3, -3, 31, 31, 1, 4, 3, 2, 31, 31, 0, 4, 2, 1,
  620. X    31, 31, 1, 0, 2, -1, 4, -6, 5, -7, 6, -7, 31, 31, 1, -1,
  621. X    2, -2, 3, -7, 4, -8, 31, 31, 0, -1, 1, -2, 2, -7, 4, -9,
  622. X    6, -7};
  623. Xstatic char c365[45] = {
  624. X    21, -5, 7,            /*, 7, 12, L  */
  625. X    -2, 10, -1, 8, -1, -6, -3, -7, -2, -7, 0, -8, 1, -9, 31, 31,
  626. X    0, 8, -1, 10, 0, 11, 0, -7, 2, -8, 31, 31, -2, 10, 1, 12,
  627. X    1, -6, 3, -7, 4, -7, 2, -8, 1, -9};
  628. Xstatic char c366[135] = {
  629. X    66, -13, 15,            /*, 7, 13, M  */
  630. X    -11, 3, -10, 3, -9, 2, -9, -6, -11, -7, -10, -7, -8, -8, -7, -9,
  631. X    31, 31, -9, 4, -8, 3, -8, -7, -6, -8, 31, 31, -11, 3, -9, 5,
  632. X    -7, 3, -7, -6, -5, -7, -7, -9, 31, 31, -7, 2, -4, 3, -2, 4,
  633. X    -1, 5, 1, 3, 1, -6, 3, -7, 1, -9, 31, 31, -2, 4, 0, 3,
  634. X    0, -7, 2, -8, 31, 31, -4, 3, -3, 3, -1, 2, -1, -6, -2, -7,
  635. X    0, -8, 1, -9, 31, 31, 1, 2, 4, 3, 6, 4, 7, 5, 8, 4,
  636. X    10, 3, 11, 3, 9, 2, 9, -6, 10, -7, 11, -7, 31, 31, 6, 4,
  637. X    8, 3, 8, -7, 9, -8, 31, 31, 4, 3, 5, 3, 7, 2, 7, -7,
  638. X    9, -9, 11, -7};
  639. Xstatic char c367[91] = {
  640. X    44, -9, 11,            /*, 7, 14, N  */
  641. X    -7, 3, -6, 3, -5, 2, -5, -6, -7, -7, -6, -7, -4, -8, -3, -9,
  642. X    31, 31, -5, 4, -4, 3, -4, -7, -2, -8, 31, 31, -7, 3, -5, 5,
  643. X    -3, 3, -3, -6, -1, -7, -3, -9, 31, 31, -3, 2, 0, 3, 2, 4,
  644. X    3, 5, 4, 4, 6, 3, 7, 3, 5, 2, 5, -6, 6, -7, 7, -7,
  645. X    31, 31, 2, 4, 4, 3, 4, -7, 5, -8, 31, 31, 0, 3, 1, 3,
  646. X    3, 2, 3, -7, 5, -9, 7, -7};
  647. Xstatic char c368[81] = {
  648. X    39, -9, 11,            /*, 7, 15, O  */
  649. X    -5, 3, -5, -6, -7, -7, 31, 31, -4, 2, -4, -6, -1, -8, 31, 31,
  650. X    -3, 3, -3, -6, -1, -7, 0, -8, 31, 31, -7, -7, -5, -7, -3, -8,
  651. X    -2, -9, 0, -8, 3, -7, 5, -7, 31, 31, -5, 3, -3, 3, 0, 4,
  652. X    2, 5, 3, 4, 5, 3, 7, 3, 5, 2, 5, -7, 31, 31, 1, 4,
  653. X    4, 2, 4, -6, 31, 31, 0, 4, 1, 3, 3, 2, 3, -7};
  654. Xstatic char c369[109] = {
  655. X    53, -9, 11,            /*, 7, 16, P  */
  656. X    -6, 5, -5, 3, -5, -6, -7, -7, -5, -7, -5, -16, 31, 31, -5, 4,
  657. X    -4, 3, -4, -15, -3, -14, -4, -12, 31, 31, -4, -7, -3, -7, -1, -8,
  658. X    31, 31, -6, 5, -4, 4, -3, 3, -3, -6, -1, -7, 0, -8, 31, 31,
  659. X    -3, -8, -2, -9, 0, -8, 3, -7, 5, -7, 31, 31, -3, -8, -3, -12,
  660. X    -2, -14, -5, -16, 31, 31, -3, 2, 0, 3, 2, 4, 3, 5, 4, 4,
  661. X    6, 3, 7, 3, 5, 2, 5, -7, 31, 31, 2, 4, 4, 3, 4, -6,
  662. X    31, 31, 0, 3, 1, 3, 3, 2, 3, -7};
  663. Xstatic char c370[89] = {
  664. X    43, -9, 11,            /*, 7, 17, Q  */
  665. X    -5, 3, -5, -6, -7, -7, 31, 31, -4, 2, -4, -7, -2, -8, 31, 31,
  666. X    -3, 3, -3, -6, -1, -7, 0, -7, 31, 31, -7, -7, -6, -7, -4, -8,
  667. X    -3, -9, -2, -8, 0, -7, 3, -6, 31, 31, -5, 3, -3, 3, 0, 4,
  668. X    2, 5, 3, 4, 5, 3, 7, 3, 5, 2, 5, -16, 31, 31, 1, 4,
  669. X    4, 2, 4, -15, 3, -14, 4, -12, 31, 31, 0, 4, 1, 3, 3, 2,
  670. X    3, -12, 2, -14, 5, -16};
  671. Xstatic char c371[77] = {
  672. X    37, -8, 8,            /*, 7, 18, R  */
  673. X    -6, 3, -5, 3, -4, 2, -4, -6, -6, -7, -5, -7, -3, -8, -2, -9,
  674. X    31, 31, -5, 4, -3, 3, -3, -7, -1, -8, 31, 31, -6, 3, -4, 5,
  675. X    -2, 3, -2, -6, 0, -7, 1, -7, -1, -8, -2, -9, 31, 31, -2, 3,
  676. X    2, 5, 3, 4, 5, 3, 6, 3, 31, 31, 1, 4, 2, 3, 4, 3,
  677. X    31, 31, 0, 4, 2, 2, 4, 2, 6, 3};
  678. Xstatic char c372[119] = {
  679. X    58, -8, 10,            /*, 7, 19, S  */
  680. X    -5, 3, -5, -1, -3, -2, 3, -2, 5, -3, 5, -7, 31, 31, -4, 3,
  681. X    -4, -1, 31, 31, 4, -3, 4, -7, 31, 31, -2, 4, -3, 3, -3, -1,
  682. X    -1, -2, 31, 31, 1, -2, 3, -3, 3, -7, 2, -8, 31, 31, -5, 3,
  683. X    -2, 4, 0, 5, 2, 4, 4, 4, 5, 5, 31, 31, -1, 4, 1, 4,
  684. X    31, 31, -2, 4, 0, 3, 2, 3, 4, 4, 31, 31, 5, -7, 2, -8,
  685. X    0, -9, -2, -8, -4, -8, -6, -9, 31, 31, 1, -8, -1, -8, 31, 31,
  686. X    2, -8, 0, -7, -3, -7, -6, -9, 31, 31, 5, 5, 4, 3, 2, 0,
  687. X    -3, -5, -6, -9};
  688. Xstatic char c373[57] = {
  689. X    27, -5, 7,            /*, 7, 20, T  */
  690. X    -2, 10, -1, 8, -1, -6, -3, -7, -2, -7, 0, -8, 1, -9, 31, 31,
  691. X    0, 8, -1, 10, 0, 11, 0, -7, 2, -8, 31, 31, -2, 10, 1, 12,
  692. X    1, -6, 3, -7, 4, -7, 2, -8, 1, -9, 31, 31, -4, 5, -1, 5,
  693. X    31, 31, 1, 5, 4, 5};
  694. Xstatic char c374[95] = {
  695. X    46, -9, 11,            /*, 7, 21, U  */
  696. X    -7, 3, -6, 3, -5, 2, -5, -6, -7, -7, 31, 31, -6, 4, -4, 3,
  697. X    -4, -7, -2, -8, 31, 31, -7, 3, -5, 5, -3, 3, -3, -6, -1, -7,
  698. X    0, -7, 31, 31, -7, -7, -6, -7, -4, -8, -3, -9, -2, -8, 0, -7,
  699. X    3, -6, 31, 31, 3, 5, 4, 4, 6, 3, 7, 3, 5, 2, 5, -6,
  700. X    6, -7, 7, -7, 31, 31, 2, 4, 4, 3, 4, -7, 5, -8, 31, 31,
  701. X    3, 5, 1, 3, 3, 2, 3, -7, 5, -9, 7, -7};
  702. Xstatic char c375[73] = {
  703. X    35, -9, 11,            /*, 7, 22, V  */
  704. X    -6, 5, -5, 3, -5, -6, -2, -9, 0, -7, 3, -6, 5, -6, 31, 31,
  705. X    -5, 4, -4, 3, -4, -6, -1, -8, 31, 31, -6, 5, -4, 4, -3, 3,
  706. X    -3, -5, -2, -6, 0, -7, 31, 31, 3, 5, 4, 4, 6, 3, 7, 3,
  707. X    5, 2, 5, -6, 31, 31, 2, 4, 4, 3, 4, -5, 31, 31, 3, 5,
  708. X    1, 3, 3, 2, 3, -6};
  709. Xstatic char c376[115] = {
  710. X    56, -13, 15,            /*, 7, 23, W  */
  711. X    -10, 5, -9, 3, -9, -6, -6, -9, -4, -7, -1, -6, 31, 31, -9, 4,
  712. X    -8, 3, -8, -6, -5, -8, 31, 31, -10, 5, -8, 4, -7, 3, -7, -5,
  713. X    -6, -6, -4, -7, 31, 31, -1, 5, -3, 3, -1, 2, -1, -6, 2, -9,
  714. X    4, -7, 7, -6, 9, -6, 31, 31, -2, 4, 0, 3, 0, -6, 3, -8,
  715. X    31, 31, -1, 5, 0, 4, 2, 3, 1, 2, 1, -5, 2, -6, 4, -7,
  716. X    31, 31, 7, 5, 8, 4, 10, 3, 11, 3, 9, 2, 9, -6, 31, 31,
  717. X    6, 4, 8, 3, 8, -5, 31, 31, 7, 5, 5, 3, 7, 2, 7, -6};
  718. Xstatic char c377[119] = {
  719. X    58, -10, 11,            /*, 7, 24, X  */
  720. X    -7, 3, -6, 3, -4, 2, -3, 1, 1, -7, 2, -8, 4, -9, 6, -7,
  721. X    31, 31, -5, 4, -3, 3, 2, -7, 4, -8, 31, 31, -7, 3, -5, 5,
  722. X    -3, 4, -2, 3, 2, -5, 3, -6, 5, -7, 6, -7, 31, 31, 0, -1,
  723. X    3, 5, 4, 4, 6, 4, 7, 5, 31, 31, 3, 4, 4, 3, 5, 3,
  724. X    31, 31, 2, 3, 4, 2, 6, 3, 7, 5, 31, 31, -1, -3, -4, -9,
  725. X    -5, -8, -7, -8, -8, -9, 31, 31, -4, -8, -5, -7, -6, -7, 31, 31,
  726. X    -3, -7, -5, -6, -7, -7, -8, -9, 31, 31, -5, -2, -2, -2, 31, 31,
  727. X    1, -2, 4, -2};
  728. Xstatic char c378[121] = {
  729. X    59, -9, 11,            /*, 7, 25, Y  */
  730. X    -7, 3, -6, 3, -5, 2, -5, -6, -7, -7, 31, 31, -6, 4, -4, 3,
  731. X    -4, -7, -2, -8, 31, 31, -7, 3, -5, 5, -3, 3, -3, -6, -1, -7,
  732. X    0, -7, 31, 31, -7, -7, -6, -7, -4, -8, -3, -9, -2, -8, 0, -7,
  733. X    3, -6, 31, 31, 3, 5, 4, 4, 6, 3, 7, 3, 5, 2, 5, -10,
  734. X    4, -13, 2, -15, 0, -16, -1, -15, -3, -14, -5, -14, 31, 31, 2, 4,
  735. X    4, 3, 4, -10, 31, 31, 1, -15, -1, -14, -2, -14, 31, 31, 3, 5,
  736. X    1, 3, 3, 2, 3, -8, 4, -11, 4, -13, 31, 31, 2, -15, 1, -14,
  737. X    -1, -13, -3, -13, -5, -14};
  738. Xstatic char c379[77] = {
  739. X    37, -9, 11,            /*, 7, 26, Z  */
  740. X    6, 5, -6, -9, 31, 31, -6, 3, -4, 2, -1, 2, 2, 3, 6, 5,
  741. X    31, 31, -5, 4, -3, 3, 1, 3, 31, 31, -6, 3, -4, 5, -2, 4,
  742. X    2, 4, 6, 5, 31, 31, -6, -9, -2, -7, 1, -6, 4, -6, 6, -7,
  743. X    31, 31, -1, -7, 3, -7, 5, -8, 31, 31, -6, -9, -2, -8, 2, -8,
  744. X    4, -9, 6, -7, 31, 31, -4, -2, 4, -2};
  745. Xstatic char c380[57] = {
  746. X    27, -7, 9,            /*, 3, 49, [  */
  747. X    2, 16, -1, 13, -2, 10, -2, 8, -1, 5, 2, 2, 31, 31, 0, 14,
  748. X    -1, 11, -1, 7, 0, 4, 31, 31, 2, 2, -1, 0, 2, -2, 31, 31,
  749. X    2, -2, -1, -5, -2, -8, -2, -10, -1, -13, 2, -16, 31, 31, 0, -4,
  750. X    -1, -7, -1, -11, 0, -14};
  751. Xstatic char c381[7] = {
  752. X    2, -4, 4,            /*, 9, 14, N  */
  753. X    0, 16, 0, -16};
  754. Xstatic char c382[57] = {
  755. X    27, -7, 9,            /*, 3, 50, ]  */
  756. X    -2, 16, 1, 13, 2, 10, 2, 8, 1, 5, -2, 2, 31, 31, 0, 14,
  757. X    1, 11, 1, 7, 0, 4, 31, 31, -2, 2, 1, 0, -2, -2, 31, 31,
  758. X    -2, -2, 1, -5, 2, -8, 2, -10, 1, -13, -2, -16, 31, 31, 0, -4,
  759. X    1, -7, 1, -11, 0, -14};
  760. Xstatic char c383[49] = {
  761. X    23, -12, 14,            /*, 3, 59, >  */
  762. X    -9, -3, -9, -1, -8, 2, -6, 3, -4, 3, -2, 2, 2, -1, 4, -2,
  763. X    6, -2, 8, -1, 9, 1, 31, 31, -9, -1, -8, 1, -6, 2, -4, 2,
  764. X    -2, 1, 2, -2, 4, -3, 6, -3, 8, -2, 9, 1, 9, 3};
  765. Xstatic char c384[7] = {
  766. X    2, -12, 14,            /*, 3, 38, -  */
  767. X    -9, -12, 9, -12};
  768. X
  769. Xstatic char *p[384] = { 
  770. X    c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
  771. X    c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
  772. X    c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36,
  773. X    c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48,
  774. X    c49, c50, c51, c52, c53, c54, c55, c56, c57, c58, c59, c60,
  775. X    c61, c62, c63, c64, c65, c66, c67, c68, c69, c70, c71, c72,
  776. X    c73, c74, c75, c76, c77, c78, c79, c80, c81, c82, c83, c84,
  777. X    c85, c86, c87, c88, c89, c90, c91, c92, c93, c94, c95, c96,
  778. X    c97, c98, c99, c100,c101,c102,c103,c104,c105,c106,c107,c108,
  779. X    c109,c110,c111,c112,c113,c114,c115,c116,c117,c118,c119,c120,
  780. X    c121,c122,c123,c124,c125,c126,c127,c128,c129,c130,c131,c132,
  781. X    c133,c134,c135,c136,c137,c138,c139,c140,c141,c142,c143,c144,
  782. X    c145,c146,c147,c148,c149,c150,c151,c152,c153,c154,c155,c156,
  783. X    c157,c158,c159,c160,c161,c162,c163,c164,c165,c166,c167,c168,
  784. X    c169,c170,c171,c172,c173,c174,c175,c176,c177,c178,c179,c180,
  785. X    c181,c182,c183,c184,c185,c186,c187,c188,c189,c190,c191,c192,
  786. X    c193,c194,c195,c196,c197,c198,c199,c200,c201,c202,c203,c204,
  787. X    c205,c206,c207,c208,c209,c210,c211,c212,c213,c214,c215,c216,
  788. X    c217,c218,c219,c220,c221,c222,c223,c224,c225,c226,c227,c228,
  789. X    c229,c230,c231,c232,c233,c234,c235,c236,c237,c238,c239,c240,
  790. X    c241,c242,c243,c244,c245,c246,c247,c248,c249,c250,c251,c252,
  791. X    c253,c254,c255,c256,c257,c258,c259,c260,c261,c262,c263,c264,
  792. X    c265,c266,c267,c268,c269,c270,c271,c272,c273,c274,c275,c276,
  793. X    c277,c278,c279,c280,c281,c282,c283,c284,c285,c286,c287,c288,
  794. X    c289,c290,c291,c292,c293,c294,c295,c296,c297,c298,c299,c300,
  795. X    c301,c302,c303,c304,c305,c306,c307,c308,c309,c310,c311,c312,
  796. X    c313,c314,c315,c316,c317,c318,c319,c320,c321,c322,c323,c324,
  797. X    c325,c326,c327,c328,c329,c330,c331,c332,c333,c334,c335,c336,
  798. X    c337,c338,c339,c340,c341,c342,c343,c344,c345,c346,c347,c348,
  799. X    c349,c350,c351,c352,c353,c354,c355,c356,c357,c358,c359,c360,
  800. X    c361,c362,c363,c364,c365,c366,c367,c368,c369,c370,c371,c372,
  801. X    c373,c374,c375,c376,c377,c378,c379,c380,c381,c382,c383,c384};
  802. X/*--------------------------*/
  803. X    i = char_per_font * font + (ch-32);
  804. X    c = error_char;
  805. X    if (i >= 0 && i <383) c = p[i];
  806. X    *npts = ( *c++) << 1;        /* convert pt count to coord count*/
  807. X    *min = *c++;            /* extent of char, in char coords*/
  808. X    *max = *c++;
  809. X    for (i=0; i<*npts; i++) *pts++ = *c++;
  810. X}
  811. X
  812. END_OF_FILE
  813. # end of 'lib/scribe.c.4'
  814. fi
  815. if test -f 'src/mgr.c' -a "${1}" != "-c" ; then 
  816.   echo shar: Will not clobber existing file \"'src/mgr.c'\"
  817. else
  818. echo shar: Extracting \"'src/mgr.c'\" \(13239 characters\)
  819. sed "s/^X//" >'src/mgr.c' <<'END_OF_FILE'
  820. X/*                        Copyright (c) 1987 Bellcore
  821. X *                            All Rights Reserved
  822. X *       Permission is granted to copy or use this program, EXCEPT that it
  823. X *       may not be sold for profit, the copyright notice must be reproduced
  824. X *       on copies, and credit should be given to Bellcore where it is due.
  825. X *       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  826. X */
  827. X/*    $Header: mgr.c,v 4.7 88/07/28 11:11:05 sau Exp $
  828. X    $Source: /tmp/mgrsrc/src/RCS/mgr.c,v $
  829. X*/
  830. Xstatic char    RCSid_[] = "$Source: /tmp/mgrsrc/src/RCS/mgr.c,v $$Revision: 4.7 $";
  831. X
  832. X/* main routine for MGR */
  833. X
  834. X#include "bitmap.h"
  835. X#include <stdio.h>
  836. X#include <sys/signal.h>
  837. X#ifdef sun
  838. X#include <sys/time.h> 
  839. X#endif
  840. X#include <errno.h>
  841. X#include "defs.h"
  842. X#include "menu.h"
  843. X#include "font.h"
  844. X#include "event.h"
  845. X
  846. X#ifndef Min
  847. X#define Min(x,y)        ((x)>(y)?(y):(x))
  848. X#endif
  849. X#define POLL(poll)        (poll&mask ? &set_poll : (struct timeval *) 0)
  850. X
  851. X#ifdef sun
  852. Xstruct timeval set_poll = {
  853. X   (long) 0, (long) POLL_INT
  854. X   };                /* set select to poll */
  855. X#endif
  856. X
  857. Xchar *mouse_dev = MOUSE_DEV;        /* name of mouse device */
  858. Xstatic int bitmaptype = 1;            /* old, non portable bitmap format */
  859. X
  860. Xmain(argc,argv)
  861. Xint argc;
  862. Xchar **argv;
  863. X   {
  864. X   register WINDOW *win;        /* current window to update */
  865. X   register int i;            /* counter */
  866. X   register int count;            /* # chars read from shell */
  867. X   int maxbuf = MAXBUF;            /* # chars processed per window */
  868. X   int shellbuf = MAXSHELL;        /* # chars processed per shell */
  869. X   int type=1;                /* state var. for parsing argv */
  870. X   int reads;                /* masks, result of select */
  871. X   int tty;                /* fd for controlling tty */
  872. X
  873. X   unsigned char c;            /* reads from kbd go here */
  874. X   char start_file[MAX_PATH];        /* name of startup file */
  875. X   char *screen_dev = SCREEN_DEV;    /* name of frame buffer */
  876. X   char *default_font = (char * )0;    /* default font */
  877. X   char *rindex(), *getenv(), *ttyname();
  878. X   char *term = getenv("TERM");        /* place to put terminal name */
  879. X#ifdef SHRINK
  880. X   BITMAP *prime;
  881. X#endif
  882. X
  883. X   SETMOUSEICON(&mouse_arrow);
  884. X
  885. X   /* process arguments */
  886. X
  887. X   sprintf(start_file,"%s/%s",getenv("HOME"),STARTFILE);
  888. X   while(--argc > 0) {
  889. X      argv++;
  890. X#ifdef DEBUG
  891. X      dprintf(S)(stderr,"argument %s type %c\r\n",*argv,type==1?'*':type);
  892. X#endif
  893. X      switch(type) {
  894. X         case 1:    /* looking for flag */
  895. X              if (**argv == '-')
  896. X                 switch(type = *(*argv+1)) {
  897. X#ifdef DEBUG
  898. X                 case 'd': debug = 1;
  899. X                           strcpy(debug_level,*argv+2);
  900. X                           fprintf(stderr,"Debug level: [%s]\n",debug_level);
  901. X                           type = 1;
  902. X                           break;
  903. X#endif
  904. X                 case 'v':         /* print version number */
  905. X                           printf("Mgr version %s created on %s at: %s\n",
  906. X                                  version[0],version[1],version[2]);
  907. X                           exit(1);
  908. X                 case 'V':         /* print version and options */
  909. X                           printf("Mgr version %s created on %s at: %s by %s\n",
  910. X                                  version[0],version[1],version[2],version[5]);
  911. X                           printf("Compile flags: %s\n",version[3]);
  912. X                           printf("Home directory: %s\n",version[4]);
  913. X                                    printf("built with: %s\n",version[6]);
  914. X                           exit(1);
  915. X                 case 'x': strcpy(start_file,"/dev/null");
  916. X                           type = 1;
  917. X                           break;
  918. X                 case 'n':     /* use new style bitmap headers */
  919. X                           bitmaptype = 0;
  920. X                           break;
  921. X                 }
  922. X              else fprintf(stderr,"Invalid argument %s, ignored\n",*argv);
  923. X              break;
  924. X         case 'm':    /* set mouse device */
  925. X              mouse_dev = *argv;
  926. X              type = 1;
  927. X              break;
  928. X         case 's':    /* set start file */
  929. X              strcpy(start_file,*argv);
  930. X              type = 1;
  931. X              break;
  932. X         case 'F':    /* set default font file */
  933. X              default_font = *argv;
  934. X              type = 1;
  935. X         case 'P':    /* set polling timeout */
  936. X              set_poll.tv_usec = (long) atoi(*argv);
  937. X              break;
  938. X         case 'b':    /* set shell buffering */
  939. X              shellbuf = atoi(*argv);
  940. X              shellbuf = BETWEEN(5,shellbuf,1024);
  941. X              break;
  942. X         case 'B':    /* set window buffering */
  943. X              maxbuf = atoi(*argv);
  944. X              maxbuf = BETWEEN(1,maxbuf,shellbuf);
  945. X              break;
  946. X         case 'f':    /* set font directory */
  947. X              font_dir = *argv;
  948. X              type = 1;
  949. X              break;
  950. X         case 'i':    /* set icon directory */
  951. X              icon_dir = *argv;
  952. X              type = 1;
  953. X              break;
  954. X         case 'S':    /* set alternate frame buffer */
  955. X              screen_dev = *argv;
  956. X              type = 1;
  957. X              break;
  958. X         default:    /* invalid flag */
  959. X             fprintf(stderr,"Invalid flag %c, ignored\r\n",type);
  960. X              type = 1;
  961. X              break;
  962. X         }
  963. X      }
  964. X
  965. X   /* keep mgr from being run within itself */
  966. X
  967. X   if (term && strcmp(TERMNAME,term)==0) {
  968. X      fprintf(stderr,"Can't invoke mgr from within itself\n");
  969. X      exit(1);
  970. X      }
  971. X   /* save tty modes for ptty's */
  972. X
  973. X   save_modes(0);
  974. X
  975. X   /* free all unused fd's */
  976. X
  977. X   count = getdtablesize();
  978. X   for(i=3;i<count;i++)
  979. X      close(i);
  980. X
  981. X#ifdef WHO
  982. X   save_utmp(ttyname(0));
  983. X#endif
  984. X
  985. X   /* initialize the keyboard; sometimes a special device */
  986. X   initkbd();
  987. X
  988. X   /* initialize the bell; sometimes a special device requiring funnys */
  989. X   initbell();
  990. X
  991. X   /* get the default font file */
  992. X
  993. X   if (default_font || (default_font = getenv(DEFAULT_FONT)))
  994. X      font = open_font(default_font);
  995. X
  996. X   if (font == (struct font *) 0)
  997. X      font = open_font("");
  998. X   font->ident = 0;
  999. X
  1000. X   /* set up the default font names */
  1001. X
  1002. X   /* open the mouse */
  1003. X
  1004. X   if ((mouse=open(mouse_dev,2)) <0) {
  1005. X      perror("can't find the mouse, or it is already in use\n");
  1006. X      exit(1);
  1007. X      }
  1008. X
  1009. X   if (set_mouseio(mouse) < 0)
  1010. X      fprintf(stderr,"can't set mouse to exclusive use\n");
  1011. X
  1012. X   mousex=mousey=32;
  1013. X
  1014. X   /* find the screen */
  1015. X
  1016. X#ifdef SHRINK            /* for sdh */
  1017. X
  1018. X#ifndef X0
  1019. X# define X0 64
  1020. X#endif
  1021. X#ifndef Y0
  1022. X# define Y0 64
  1023. X#endif
  1024. X#ifndef W0
  1025. X# define W0 1024
  1026. X#endif
  1027. X#ifndef H0
  1028. X# define H0 772
  1029. X#endif
  1030. X
  1031. X   if ((prime = bit_open(screen_dev)) == (BITMAP *) 0) {
  1032. X      perror("can't find the screen");
  1033. X      exit(2);
  1034. X      }
  1035. X   screen = bit_create(prime,X0&~0xf,Y0&~0xf,W0&~0xf,H0&~0xf);
  1036. X#else
  1037. X   if ((screen = bit_open(screen_dev)) == (BITMAP *) 0) {
  1038. X      perror("can't find the screen");
  1039. X      exit(2);
  1040. X      }
  1041. X#endif
  1042. X
  1043. X   copyright(screen);
  1044. X
  1045. X   set_tty(0);
  1046. X
  1047. X   SETMOUSEICON(&mouse_cup);
  1048. X
  1049. X   /* catch the right interrupts */
  1050. X
  1051. X   for(i=0;i<NSIG;i++) switch(i) {
  1052. X      case SIGCHLD:     signal(SIGCHLD,sig_child);
  1053. X                        break;
  1054. X      case SIGILL:    /* <= 3.0 abort gererates this one */
  1055. X      case SIGCONT:
  1056. X      case SIGIOT:    /* 3.2 abort generates this (gee thanks, SUN!) */
  1057. X      case SIGQUIT:
  1058. X                        break;
  1059. X      case SIGTTIN:
  1060. X      case SIGTTOU:     signal(i,SIG_IGN);
  1061. X                        break;
  1062. X      default:          signal(i,catch);
  1063. X                        break;
  1064. X      }
  1065. X
  1066. X   /* set the terminal type */
  1067. X
  1068. X   if (term && strlen(term) >= strlen(TERMNAME))
  1069. X      strcpy(term,TERMNAME);
  1070. X
  1071. X    /* get default font definitions */
  1072. X
  1073. X      {
  1074. X      char buff[MAX_PATH];
  1075. X      sprintf(buff,"%s/%s",font_dir,STARTFILE);
  1076. X      startup(buff);
  1077. X      }
  1078. X
  1079. X   /* process startup file */
  1080. X
  1081. X   startup(start_file);
  1082. X   if (active != (WINDOW *) 0)
  1083. X      ACTIVE_ON();
  1084. X   else {
  1085. X      MOUSE_OFF(mousex,mousey);
  1086. X      erase_win(screen,0,0);
  1087. X      MOUSE_ON(mousex,mousey);
  1088. X   }
  1089. X
  1090. X   /* turn on mouse cursor */
  1091. X
  1092. X   MOUSE_OFF(mousex,mousey);
  1093. X   SETMOUSEICON(&mouse_arrow);
  1094. X   MOUSE_ON(mousex,mousey);
  1095. X
  1096. X   /* void tty association         (does bad things when mgr crashes) */
  1097. X
  1098. X   /*  void_tty();       Flakey ... Commented Out! */
  1099. X
  1100. X   /* always look for keyboard and mouse input */
  1101. X
  1102. X   mask |= (1<<mouse) | (1<<0); 
  1103. X
  1104. X   /* main polling loop */
  1105. X
  1106. X   while(1) {
  1107. X
  1108. X      /* see if any window died */
  1109. X
  1110. X      for(win=active;win != (WINDOW *) 0;) 
  1111. X         if (W(flags)&W_DIED) {
  1112. X#ifdef DEBUG
  1113. X            dprintf(d)(stderr,"Destroying %s-%d\r\n",W(tty),W(num));
  1114. X#endif
  1115. X            destroy(win);
  1116. X            win = active;
  1117. X            }
  1118. X         else
  1119. X            win = W(next);
  1120. X
  1121. X      /* wait for input */
  1122. X
  1123. X      reads = mask & ~poll;
  1124. X
  1125. X#ifdef DEBUG
  1126. X      dprintf(l)(stderr,"select: mask=0x%x poll=0x%x 0x%x got\r\n",
  1127. X                 mask,poll,reads);
  1128. X#endif
  1129. X#ifdef sun
  1130. X      if (select(32,&reads,0,0,POLL(poll)) <0) {
  1131. X#ifdef DEBUG
  1132. X         dprintf(l)(stderr,"select failed %d->%d\r\n",
  1133. X                 reads, mask & ~poll);
  1134. X         if (debug) 
  1135. X            perror("Select:");
  1136. X#endif
  1137. X         reads = mask & ~poll;
  1138. X         continue;
  1139. X         }
  1140. X#else
  1141. X    ????? /* I need to package up select some how */
  1142. X#endif
  1143. X#ifdef DEBUG
  1144. X      dprintf(l)(stderr,"0x%x\r\n",reads);
  1145. X#endif
  1146. X
  1147. X      /* process mouse */
  1148. X
  1149. X      if (reads & (1<<mouse))
  1150. X         do {
  1151. X            proc_mouse(mouse);
  1152. X            }
  1153. X         while(mouse_count());
  1154. X      
  1155. X      /* process keyboard input */
  1156. X      
  1157. X      if (reads&1 && active && !(ACTIVE(flags)&W_NOINPUT)) {
  1158. X         read(0,&c,1);
  1159. X#ifdef BUCKEY
  1160. X         if ( (ACTIVE(flags)&W_NOBUCKEY)  ||  !do_buckey(c) )
  1161. X            write(ACTIVE(to_fd),&c,1);
  1162. X#else
  1163. X         write(ACTIVE(to_fd),&c,1);
  1164. X#endif
  1165. X            if (ACTIVE(flags)&W_DUPKEY && c==ACTIVE(dup))
  1166. X             write(ACTIVE(to_fd),&c,1);
  1167. X         continue;
  1168. X         }
  1169. X       else if (reads&1 && !active) {        /* toss the input */
  1170. X         read(0,&c,1);
  1171. X#ifdef BUCKEY
  1172. X         do_buckey(c);
  1173. X#endif
  1174. X     }
  1175. X
  1176. X      /* process shell output */
  1177. X
  1178. X      for(win=active;win != (WINDOW *) 0;win=W(next)) {
  1179. X         register int fd_bit = W(from_fd) ? 1<<W(from_fd) : 0;
  1180. X
  1181. X         /* read data into buffer */
  1182. X
  1183. X         if (fd_bit&reads&(~poll)) {
  1184. X            W(current) = 0;
  1185. X            if ((W(max) = read(W(from_fd),W(buff),shellbuf)) > 0) {
  1186. X               poll |= fd_bit;
  1187. X#ifdef DEBUG
  1188. X               dprintf(p)(stderr,"%s: reading %d [%.*s]\r\n",W(tty),
  1189. X                     W(max),W(max),W(buff));
  1190. X#endif
  1191. X               }
  1192. X            else {
  1193. X               poll &= ~fd_bit;
  1194. X#ifdef KILL
  1195. X               if (W(flags)&W_NOKILL)
  1196. X                  W(flags) |= W_DIED;
  1197. X#endif
  1198. X#ifdef DEBUG
  1199. X               if(debug) {
  1200. X                  fprintf(stderr,"%s: Select boo-boo fd(%d) code %d\r\n",
  1201. X                          W(tty),W(from_fd),W(max));
  1202. X                  perror(W(tty)); 
  1203. X                  }
  1204. X#endif
  1205. X               }
  1206. X            }
  1207. X         /* check for window to auto-expose */
  1208. X
  1209. X         if (fd_bit&poll && W(flags)&W_EXPOSE && !(W(flags)&W_ACTIVE)) {
  1210. X#ifdef DEBUG
  1211. X            dprintf(m)(stderr,"%s: activating self\r\n",W(tty));
  1212. X#endif
  1213. X            MOUSE_OFF(mousex,mousey);
  1214. X            cursor_off();
  1215. X            ACTIVE_OFF();
  1216. X            expose(win);
  1217. X            ACTIVE_ON();
  1218. X            cursor_on();
  1219. X            MOUSE_ON(mousex,mousey);
  1220. X            }
  1221. X
  1222. X         /* write data into the window */
  1223. X
  1224. X         if (fd_bit&poll && W(flags)&(W_ACTIVE|W_BACKGROUND)) {
  1225. X            
  1226. X#ifdef PRIORITY            /* use priority scheduling */
  1227. X            if (win==active)
  1228. X               count = Min(maxbuf,W(max)-W(current));
  1229. X            else if (W(flags)&W_ACTIVE)
  1230. X               count = Min(maxbuf>>1,W(max)-W(current));
  1231. X            else
  1232. X               count = Min(maxbuf>>2,W(max)-W(current));
  1233. X#else                /* use round robin scheduling */
  1234. X            count = Min(maxbuf,W(max)-W(current));
  1235. X#endif
  1236. X
  1237. X            i = put_window(win,W(buff)+W(current),count);
  1238. X#ifdef DEBUG
  1239. X            dprintf(w)(stderr,"%s: writing %d/%d %.*s [%.*s]\r\n",
  1240. X                       W(tty),i,count,i,W(buff)+W(current),count-i,
  1241. X                       W(buff)+W(current)+i);
  1242. X#endif
  1243. X
  1244. X            W(current) += i;
  1245. X            if (W(current) >= W(max))
  1246. X               poll &= ~fd_bit;
  1247. X            }
  1248. X         }
  1249. X      }
  1250. X   }
  1251. X
  1252. X/*************************************************************************
  1253. X *    catch dead children 
  1254. X */
  1255. X
  1256. Xsig_child(sig)
  1257. Xint sig;
  1258. X   {
  1259. X   register WINDOW *win;
  1260. X   extern int errno;
  1261. X
  1262. X   /* see if a shell has died, mark deleted */
  1263. X
  1264. X#ifdef DEBUG
  1265. X   dprintf(d)(stderr,"Looking for dead windows\r\n");
  1266. X#endif
  1267. X
  1268. X   for(win=active;win != (WINDOW *) 0;win=W(next)) {
  1269. X      if (kill(W(pid),0) != 0 && !(W(flags)&W_NOKILL)) {
  1270. X         W(flags) |= W_DIED;
  1271. X#ifdef DEBUG
  1272. X         dprintf(d)(stderr, "%s-%d DIED\r\n",W(tty),W(num));
  1273. X#endif
  1274. X         }
  1275. X      }
  1276. X   }
  1277. X
  1278. X/* process mouse */
  1279. X
  1280. Xint
  1281. Xproc_mouse(mouse)
  1282. Xint mouse;
  1283. X   {
  1284. X   int dx, dy;
  1285. X   static int still_down = 0;
  1286. X   register int button, done = 0;
  1287. X
  1288. X   do {
  1289. X      button = mouse_get(mouse,&dx,&dy);
  1290. X      MOUSE_OFF(mousex,mousey);
  1291. X      mousex += 2*dx;
  1292. X      mousey -= 2*dy;
  1293. X      mousex = BETWEEN(0,mousex,BIT_WIDE(screen)-1);
  1294. X      mousey = BETWEEN(0,mousey,BIT_HIGH(screen)-1);
  1295. X      if (button != button_state) {
  1296. X         do_button( button );
  1297. X         done++;
  1298. X         }
  1299. X      MOUSE_ON(mousex,mousey);
  1300. X      } while (mouse_count() && !done);
  1301. X   return(done);
  1302. X   }
  1303. X
  1304. X/* reopen the mouse after suspend */
  1305. X      
  1306. Xint
  1307. Xmouse_reopen()
  1308. X   {
  1309. X   int m = open(mouse_dev,2);
  1310. X   set_mouseio(m);
  1311. X   return(m);
  1312. X   }
  1313. X
  1314. X/* return bitmap type */
  1315. X
  1316. Xint
  1317. Xget_bm_type()
  1318. X   {
  1319. X   return (bitmaptype);
  1320. X   }
  1321. END_OF_FILE
  1322. # end of 'src/mgr.c'
  1323. fi
  1324. echo shar: End of archive 37 \(of 61\).
  1325. cp /dev/null ark37isdone
  1326. MISSING=""
  1327. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 \
  1328.     21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 \
  1329.     38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 \
  1330.     55 56 57 58 59 60 61 ; do
  1331.     if test ! -f ark${I}isdone ; then
  1332.     MISSING="${MISSING} ${I}"
  1333.     fi
  1334. done
  1335. if test "${MISSING}" = "" ; then
  1336.     echo You have unpacked all 61 archives.
  1337.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1338. else
  1339.     echo You still need to unpack the following archives:
  1340.     echo "        " ${MISSING}
  1341. fi
  1342. ##  End of shell archive.
  1343. exit 0
  1344.