home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume17 / mgr / part23 < prev    next >
Text File  |  1989-01-19  |  52KB  |  1,499 lines

  1. Subject:  v17i024:  MGR, Bellcore window manager, Part23/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 24
  7. Archive-name: mgr/part23
  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 23 (of 61)."
  19. # Contents:  demo/misc/dmgr.c demo/misc/mgrmail.c demo/misc/omgrmail.c
  20. #   font-16/Ugal13x20b font-16/Ugal13x20r font-32/Ugal13x20b
  21. #   font-32/Ugal13x20r src/graph_subs.c
  22. # Wrapped by rsalz@papaya.bbn.com on Thu Nov 17 21:05:27 1988
  23. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  24. if test -f 'demo/misc/dmgr.c' -a "${1}" != "-c" ; then 
  25.   echo shar: Will not clobber existing file \"'demo/misc/dmgr.c'\"
  26. else
  27. echo shar: Extracting \"'demo/misc/dmgr.c'\" \(5769 characters\)
  28. sed "s/^X//" >'demo/misc/dmgr.c' <<'END_OF_FILE'
  29. X/*                        Copyright (c) 1987 Bellcore
  30. X *                            All Rights Reserved
  31. X *       Permission is granted to copy or use this program, EXCEPT that it
  32. X *       may not be sold for profit, the copyright notice must be reproduced
  33. X *       on copies, and credit should be given to Bellcore where it is due.
  34. X *       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  35. X */
  36. X/*    $Header: dmgr.c,v 4.1 88/06/30 10:06:21 bianchi Exp $
  37. X    $Source: /tmp/mgrsrc/demo/misc/RCS/dmgr.c,v $
  38. X*/
  39. Xstatic char    RCSid_[] = "$Source: /tmp/mgrsrc/demo/misc/RCS/dmgr.c,v $$Revision: 4.1 $";
  40. X
  41. X/* Ditroff to MGR conversion filter  (sample version) */
  42. X
  43. X#include "term.h"
  44. X#include <signal.h>
  45. X#include    <ctype.h>
  46. X
  47. X/* ditroff macros */
  48. X
  49. X#define t_push()    
  50. X#define t_pop()
  51. X#define hmot(N)        (hpos+=(N))
  52. X#define hgoto(N)    (hpos = (N))
  53. X#define vmot(N)        (vpos+=(N))
  54. X#define vgoto(N)    (vpos=(N))
  55. X#define put1s(c)        put1('?')
  56. X#define put1a(N)    printf("\\%3.3o",N);
  57. X#define t_text(S)    printf("{%s}",S)
  58. X#define draw(S)        printf("\nDRAW %s\n",S);
  59. X#define setfont(S)    (font=(S))
  60. X#define setsize(N)    (size=(N))
  61. X#define t_page()    (page++>0?(getpass("\007"),m_clear()):0)
  62. X#define t_newline()    m_flush()
  63. X#define t_init()
  64. X#define t_trailer()
  65. X#define t_reset(C)
  66. X#define    loadfont(N, S1, S2)
  67. X#define error        printf
  68. X#define done()        getpass("\007")
  69. X
  70. X/* mgr defines */
  71. X
  72. X#define GMAX    1000        /* maximum coordinate */
  73. X
  74. X/* these should be calculated from the ditroff input file */
  75. X
  76. X#define PAGE_WIDE    2300    /* page width (pixels) */
  77. X#define PAGE_HIGH    3200    /* page height (pixels) */
  78. X
  79. Xint hpos,vpos;
  80. Xint font;
  81. Xint size;
  82. Xint page=0;
  83. X
  84. Xmain()
  85. X   {
  86. X
  87. X    int clean();
  88. X
  89. X    /* setup MGR */
  90. X
  91. X    m_setup(M_DEBUG);
  92. X   m_push(P_FLAGS|P_FONT);
  93. X   signal(SIGTERM,clean);
  94. X   signal(SIGINT,clean);
  95. X   m_setmode(M_OVERSTRIKE);
  96. X    m_func(14);
  97. X   /* m_font(4); */
  98. X    m_clear();
  99. X
  100. X    /* display output */
  101. X
  102. X   conv(stdin);
  103. X
  104. X    /* wait for ack. */
  105. X
  106. X    getpass("\007");
  107. X   clean(0);
  108. X   }
  109. X
  110. X/* print a character */
  111. X
  112. Xint
  113. Xput1(c)
  114. Xregister char c;        /* the character to print */
  115. X    {
  116. X    register int x = hpos * GMAX / PAGE_WIDE;
  117. X   register int y = vpos * GMAX / PAGE_HIGH;
  118. X
  119. X    m_movecursor(x,y);
  120. X    putc(c,m_termout);
  121. X    switch(font) {
  122. X        case 2:    /* italic */
  123. X            m_printstr("\010_");
  124. X            break;
  125. X        case 3:    /* bold */
  126. X            m_incr(2);
  127. X            break;
  128. X        }
  129. X    }
  130. X
  131. X/* do ditroff conversion (standard template) */
  132. X
  133. Xconv(fp)
  134. Xregister FILE *fp;
  135. X{
  136. X    register int c, k, sign;
  137. X    int m, n, i, n1, m1;
  138. X    char str[100], buf[300];
  139. X
  140. X    while ((c = getc(fp)) != EOF) {
  141. X        switch (c) {
  142. X        case '\n':    /* when input is text */
  143. X        case ' ':
  144. X        case 0:        /* occasional noise creeps in */
  145. X            break;
  146. X        case '{':    /* push down current environment */
  147. X            t_push();
  148. X            break;
  149. X        case '}':
  150. X            t_pop();
  151. X            break;
  152. X        case '0': case '1': case '2': case '3': case '4':
  153. X        case '5': case '6': case '7': case '8': case '9':
  154. X            /* two motion digits plus a character */
  155. X            hmot((c-'0')*10 + getc(fp)-'0');
  156. X            put1(getc(fp));
  157. X            break;
  158. X        case 'c':    /* single ascii character */
  159. X            put1(getc(fp));
  160. X            break;
  161. X        case 'C':
  162. X            fscanf(fp, "%s", str);
  163. X            put1s(str);
  164. X            break;
  165. X        case 'N':    /* absolute character number */
  166. X            fscanf(fp, "%d", &n);
  167. X            put1a(n);
  168. X            break;
  169. X        case 't':    /* straight text */
  170. X            fgets(buf, sizeof(buf), fp);
  171. X            t_text(buf);
  172. X            break;
  173. X        case 'D':    /* draw function */
  174. X            fgets(buf, sizeof(buf), fp);
  175. X                        draw(buf);
  176. X            break;
  177. X        case 's':
  178. X            fscanf(fp, "%d", &n);    /* ignore fractional sizes */
  179. X            setsize(n);
  180. X            break;
  181. X        case 'f':
  182. X            fscanf(fp, "%d", &n);
  183. X            setfont(n);
  184. X            if (n==3)    /* bold */
  185. X                m_func(1);
  186. X            else if (n==1 || n==2)
  187. X                m_func(14);
  188. X            break;
  189. X        case 'H':    /* absolute horizontal motion */
  190. X            /* fscanf(fp, "%d", &n); */
  191. X            while ((c = getc(fp)) == ' ')
  192. X                ;
  193. X            k = 0;
  194. X            do {
  195. X                k = 10 * k + c - '0';
  196. X            } while (isdigit(c = getc(fp)));
  197. X            ungetc(c, fp);
  198. X            hgoto(k);
  199. X            break;
  200. X        case 'h':    /* relative horizontal motion */
  201. X            /* fscanf(fp, "%d", &n); */
  202. X            while ((c = getc(fp)) == ' ')
  203. X                ;
  204. X            k = 0;
  205. X            sign = 1;
  206. X            if (c == '-') {
  207. X                sign = -1;
  208. X                c = getc(fp);
  209. X            }
  210. X            do {
  211. X                k = 10 * k + c - '0';
  212. X            } while (isdigit(c = getc(fp)));
  213. X            ungetc(c, fp);
  214. X            hmot(sign * k);
  215. X            break;
  216. X        case 'w':    /* word space */
  217. X            break;
  218. X        case 'V':
  219. X            fscanf(fp, "%d", &n);
  220. X            vgoto(n);
  221. X            break;
  222. X        case 'v':
  223. X            fscanf(fp, "%d", &n);
  224. X            vmot(n);
  225. X            break;
  226. X        case 'p':    /* new page */
  227. X            fscanf(fp, "%d", &n);
  228. X            t_page(n);
  229. X            break;
  230. X        case 'n':    /* end of line */
  231. X            while (getc(fp) != '\n')
  232. X                ;
  233. X            t_newline();
  234. X            break;
  235. X        case '#':    /* comment */
  236. X            while (getc(fp) != '\n')
  237. X                ;
  238. X            break;
  239. X        case 'x':    /* device control */
  240. X            devcntrl(fp);
  241. X            break;
  242. X        default:
  243. X            error("unknown input character %o %c\n", c, c);
  244. X            fprintf(stderr, "input context is:\n%c", c);
  245. X            for (i = 0; i < 10; i++) {
  246. X                if (fgets(buf, sizeof(buf), fp) == NULL)
  247. X                    break;
  248. X                fprintf(stderr, "%s", buf);
  249. X            }
  250. X            done();
  251. X        }
  252. X    }
  253. X   }
  254. X
  255. Xdevcntrl(fp)    /* interpret device control functions */
  256. XFILE *fp;
  257. X{
  258. X        char str[20], str1[50], buf[50];
  259. X    int c, n;
  260. X
  261. X    fscanf(fp, "%s", str);
  262. X    switch (str[0]) {    /* crude for now */
  263. X    case 'i':    /* initialize */
  264. X        t_init();
  265. X        break;
  266. X    case 'T':    /* device name */
  267. X        fscanf(fp, "%s", buf);
  268. X        break;
  269. X    case 't':    /* trailer */
  270. X        t_trailer();
  271. X        break;
  272. X    case 'p':    /* pause -- can restart */
  273. X        t_reset('p');
  274. X        break;
  275. X    case 's':    /* stop */
  276. X        t_reset('s');
  277. X        break;
  278. X    case 'r':    /* resolution assumed when prepared */
  279. X        fscanf(fp, "%d", &n);
  280. X        break;
  281. X    case 'f':    /* font used */
  282. X        fscanf(fp, "%d %s", &n, str);
  283. X        fgets(buf, sizeof buf, fp);    /* in case there's a filename */
  284. X        ungetc('\n', fp);    /* fgets goes too far */
  285. X        str1[0] = 0;    /* in case there's nothing to come in */
  286. X        sscanf(buf, "%s", str1);
  287. X        loadfont(n, str, str1);
  288. X        break;
  289. X    }
  290. X    while ((c = getc(fp)) != '\n')    /* skip rest of input line */
  291. X        if (c == EOF)
  292. X            break;
  293. X}
  294. X
  295. Xint
  296. Xclean(n)
  297. Xint n;
  298. X    {
  299. X    m_pop();
  300. X    m_clear();
  301. X   }
  302. END_OF_FILE
  303. # end of 'demo/misc/dmgr.c'
  304. fi
  305. if test -f 'demo/misc/mgrmail.c' -a "${1}" != "-c" ; then 
  306.   echo shar: Will not clobber existing file \"'demo/misc/mgrmail.c'\"
  307. else
  308. echo shar: Extracting \"'demo/misc/mgrmail.c'\" \(5947 characters\)
  309. sed "s/^X//" >'demo/misc/mgrmail.c' <<'END_OF_FILE'
  310. X/*                        Copyright (c) 1987 Bellcore
  311. X *                            All Rights Reserved
  312. X *       Permission is granted to copy or use this program, EXCEPT that it
  313. X *       may not be sold for profit, the copyright notice must be reproduced
  314. X *       on copies, and credit should be given to Bellcore where it is due.
  315. X *       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  316. X */
  317. X/*    $Header: mgrmail.c,v 4.2 88/06/22 14:37:50 bianchi Exp $
  318. X    $Source: /tmp/mgrsrc/demo/misc/RCS/mgrmail.c,v $
  319. X*/
  320. Xstatic char    RCSid_[] = "$Source: /tmp/mgrsrc/demo/misc/RCS/mgrmail.c,v $$Revision: 4.2 $";
  321. X
  322. X/* check for new mail  (experimental version) */
  323. X
  324. X#include <sys/types.h>
  325. X#include <sys/stat.h>
  326. X#include <signal.h>
  327. X#include <stdio.h>
  328. X#include "term.h"
  329. X
  330. X#define MSG_1    "\fLooking for new mail"
  331. X#define MSG_2    "\f\007You have new mail"
  332. X#define MSG_3    "\freading mail ...\r"
  333. X#define MSG_4    "\rChecking for new mail..."
  334. X#define MSG_5    "\fMail window is active"
  335. X#define MSG_6    "\rYou don't have mail   "
  336. X
  337. X#define MAILF        "/usr/spool/mail"    /* spool file */
  338. X#define MAIL        "mail"            /* name of mail command */
  339. X#define POLL        60            /* polling interval */
  340. X#define XPOS        240            /* x start of mail window */
  341. X#define YPOS        190            /* y start of mail window */
  342. X#define W_WIDE        650            /* width of mail window */
  343. X#define W_HIGH        394            /* height of mail window */
  344. X
  345. X#define PROCESSED    2            /* new mail already processed */
  346. X
  347. X#define S(x)            statb.x
  348. X#define Isflag(arg,flag)    (!strncmp(arg,flag,strlen(flag)))
  349. X#define Max(x,y)        ((x)>(y)?(x):(y))
  350. X#define dprintf            if(debug) fprintf
  351. X
  352. X#define MENU_COUNT        (sizeof(menu)/sizeof(struct menu_entry))
  353. X
  354. Xstruct menu_entry menu[] = {
  355. X    "print","t\r",
  356. X    "delete","dt\r",
  357. X    "next","n\r",
  358. X    "quit","q\r",
  359. X    "help","?\r",
  360. X    "headers","h *\r",
  361. X    "abort","x\r",
  362. X};
  363. X
  364. Xstruct    stat statb;            /* spool file status */
  365. Xchar    mail[255];            /* spool file path name */
  366. Xlong omtime=0l;                /* previous file mod. time */
  367. Xint state = 0;                /* mail & window state */
  368. Xint poll = POLL;            /* poll interval */
  369. Xint debug=0;                /* for mgrmail -d >& /dev/tty?? */
  370. X
  371. Xmain(argc,argv)
  372. X    char **argv;
  373. X{
  374. X    register int i;
  375. X    int xpos = XPOS;        /* screen position of mail subwindow */
  376. X    int ypos = YPOS;
  377. X    int font = -1;            /* font to use for mail subwindow */
  378. X    int shape = 1;            /* initially reshape window */
  379. X    char *command = MAIL;        /* name of readmail command */
  380. X
  381. X    char *getenv();
  382. X    char *user = getenv("USER");
  383. X    char line[80];            /* event input buffer */
  384. X
  385. X    int clean(), update();
  386. X
  387. X    ckmgrterm( *argv );
  388. X
  389. X    /* make sure environment is ok */
  390. X    if (user==NULL || *user=='\0') {
  391. X        fprintf(stderr,"%s: Who are you?\n",argv[0]);
  392. X        exit(2);
  393. X    }
  394. X
  395. X    /* process arguments */
  396. X
  397. X    for(i=1;i<argc;i++) {
  398. X        if (Isflag(argv[i],"-s"))
  399. X            shape = 0;
  400. X        else if (Isflag(argv[i],"-d"))
  401. X            debug = 1;
  402. X        else if (Isflag(argv[i],"-x"))
  403. X            xpos = atoi(argv[i]+2);
  404. X        else if (Isflag(argv[i],"-y"))
  405. X            ypos = atoi(argv[i]+2);
  406. X        else if (Isflag(argv[i],"-f"))
  407. X            font = atoi(argv[i]+2);
  408. X        else if (Isflag(argv[i],"-p"))
  409. X            poll  = Max(atoi(argv[i]+2),10);
  410. X        else if (Isflag(argv[i],"-M"))
  411. X            command  = argv[i]+2;
  412. X        else
  413. X            usage(argv[0],argv[i]);
  414. X    }
  415. X    sprintf(mail,"%s/%s",MAILF,user);
  416. X
  417. X    /* set up window environment */
  418. X
  419. X    m_setup(M_FLUSH);
  420. X    m_ttyset();
  421. X    m_push(P_MENU|P_EVENT|P_FLAGS);
  422. X    dprintf(stderr,"pushing environment\n"); fflush(stderr);
  423. X    m_setmode(M_NOWRAP);
  424. X
  425. X    signal(SIGTERM,clean);
  426. X    signal(SIGINT,clean);
  427. X    signal(SIGALRM,update);
  428. X
  429. X    m_setmode(M_ACTIVATE);
  430. X    if (shape) {
  431. X        m_size(strlen(MSG_1),1);
  432. X        }
  433. X
  434. X    m_setevent(ACTIVATE,"A\r");
  435. X    m_setevent(REDRAW,"R\r");
  436. X
  437. X    m_clearmode(M_ACTIVATE);
  438. X    m_clear();
  439. X    m_printstr(MSG_1);
  440. X
  441. X    dprintf(stderr,"Starting state 0x%x\n",state); fflush(stderr);
  442. X
  443. X    update();
  444. X
  445. X    /* wait for an event */
  446. X
  447. X    while(1) {
  448. X        m_gets(line);
  449. X        dprintf(stderr,"state 0x%x line : %c\n",state,*line); fflush(stderr);
  450. X        switch(*line) {
  451. X            case 'A':    /* window is activated */
  452. X                if (!stat(mail,&statb) && S(st_size))
  453. X                    do_mail(command,font,xpos,ypos);
  454. X                                else {
  455. X                                    m_printstr(MSG_6);
  456. X                                        sleep(2);
  457. X                                        m_clearmode(M_ACTIVATE);
  458. X                                        }
  459. X                state &= ~PROCESSED;
  460. X                update();
  461. X                break;
  462. X            case 'R':    /* screen is redrawn */
  463. X                state &= ~PROCESSED;
  464. X                update();
  465. X                break;
  466. X        }
  467. X    }
  468. X}
  469. X
  470. X/* run readmail in a subwindow */
  471. X
  472. Xdo_mail(command,font,xpos,ypos)
  473. Xchar *command;
  474. Xint font,xpos,ypos;
  475. X    {
  476. X    int code;
  477. X    int n;
  478. X
  479. X    alarm(0);
  480. X    dprintf(stderr,"doing mail\n"); fflush(stderr);
  481. X    n=m_makewindow(xpos,ypos,W_WIDE,W_HIGH);
  482. X    if (n==0) {    /* can't make window */
  483. X        m_printstr("\007\fCan't open mail window, sorry");
  484. X        return(0);
  485. X        }
  486. X    m_clearevent(ACTIVATE);
  487. X    m_printstr(MSG_5);
  488. X    m_selectwin(n);
  489. X    menu_load(1,MENU_COUNT,menu);
  490. X    m_selectmenu(1);
  491. X    m_printstr(MSG_3);
  492. X    m_ttyreset();
  493. X    code = system(command);
  494. X    m_printstr(MSG_4);
  495. X    sleep(1);    /* for "New mail arrived" message */
  496. X    dprintf(stderr,"Readmail completed code %d\n",code); fflush(stderr);
  497. X    m_ttyset();
  498. X    m_destroywin(n);
  499. X    m_setevent(ACTIVATE,"A\r");
  500. X    m_clearmode(M_ACTIVATE);
  501. X    dprintf(stderr,"window deactivated\n"); fflush(stderr);
  502. X    }
  503. X
  504. X/* check the spool file for new mail and update message */
  505. X
  506. Xint
  507. Xupdate()
  508. X{
  509. X    alarm(0);
  510. X    dprintf(stderr,"checking mail state 0x%x\n",state); fflush(stderr);
  511. X    if (!stat(mail,&statb) && S(st_mtime)>S(st_atime) && S(st_size)) {
  512. X        state &= ~PROCESSED;
  513. X        if (S(st_mtime) != omtime) {
  514. X        dprintf(stderr,"    First time New mail\n"); fflush(stderr);
  515. X            m_printstr(MSG_2);
  516. X            m_setmode(M_WOB);
  517. X            omtime = S(st_mtime);
  518. X        }
  519. X    }
  520. X    else if (!(state&PROCESSED)) {
  521. X        dprintf(stderr,"    Clearing new mail\n"); fflush(stderr);
  522. X        m_clearmode(M_WOB);
  523. X        m_printstr(MSG_1);
  524. X        state |= PROCESSED;
  525. X    }
  526. X    alarm(poll);
  527. X}
  528. X
  529. X/*    Clean up and exit */
  530. X
  531. Xclean()
  532. X{
  533. X    m_popall();
  534. X    m_ttyreset();
  535. X    exit(1);
  536. X}
  537. X
  538. Xusage(name,error)
  539. Xchar *name, *error;
  540. X{
  541. X    fprintf(stderr,"Invalid flag: %s\n",error);
  542. X    fprintf(stderr,
  543. X        "usage: %s -[s|x<pos>|y<pos>|f<font>|p<poll>|M<mail_program>]\n"
  544. X        ,name);
  545. X    exit(1);
  546. X}
  547. END_OF_FILE
  548. # end of 'demo/misc/mgrmail.c'
  549. fi
  550. if test -f 'demo/misc/omgrmail.c' -a "${1}" != "-c" ; then 
  551.   echo shar: Will not clobber existing file \"'demo/misc/omgrmail.c'\"
  552. else
  553. echo shar: Extracting \"'demo/misc/omgrmail.c'\" \(5590 characters\)
  554. sed "s/^X//" >'demo/misc/omgrmail.c' <<'END_OF_FILE'
  555. X/*                        Copyright (c) 1987 Bellcore
  556. X *                            All Rights Reserved
  557. X *       Permission is granted to copy or use this program, EXCEPT that it
  558. X *       may not be sold for profit, the copyright notice must be reproduced
  559. X *       on copies, and credit should be given to Bellcore where it is due.
  560. X *       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  561. X */
  562. X/*    $Header: omgrmail.c,v 4.2 88/06/22 14:37:57 bianchi Exp $
  563. X    $Source: /tmp/mgrsrc/demo/misc/RCS/omgrmail.c,v $
  564. X*/
  565. Xstatic char    RCSid_[] = "$Source: /tmp/mgrsrc/demo/misc/RCS/omgrmail.c,v $$Revision: 4.2 $";
  566. X
  567. X/* check for new mail */
  568. X
  569. X#include <sys/types.h>
  570. X#include <sys/stat.h>
  571. X#include <signal.h>
  572. X#include <stdio.h>
  573. X#include "term.h"
  574. X
  575. X#define MSG_1    "\fLooking for new mail"
  576. X#define MSG_2    "\f\007You have new mail"
  577. X#define MSG_3    "\freading mail ...\r"
  578. X#define MSG_4    "\rChecking for new mail..."
  579. X
  580. X#define MAILF        "/usr/spool/mail"    /* spool file */
  581. X#define MAIL        "mail"            /* name of mail command */
  582. X#define POLL        60            /* polling interval */
  583. X#define XPOS        200            /* x start of mail window */
  584. X#define YPOS        150            /* y start of mail window */
  585. X
  586. X#define PROCESSED    2            /* new mail already processed */
  587. X
  588. X#define S(x)            statb.x
  589. X#define Isflag(arg,flag)    (!strncmp(arg,flag,strlen(flag)))
  590. X#define Max(x,y)        ((x)>(y)?(x):(y))
  591. X#define dprintf            if(debug) fprintf
  592. X
  593. X#define MENU_COUNT        (sizeof(menu)/sizeof(struct menu_entry))
  594. X
  595. Xstruct menu_entry menu[] = {
  596. X    "print","t\r",
  597. X    "delete","dt\r",
  598. X    "next","n\r",
  599. X    "quit","q\r",
  600. X    "help","?\r",
  601. X    "headers","h *\r",
  602. X    "abort","x\r",
  603. X};
  604. X
  605. Xstruct    stat statb;            /* spool file status */
  606. Xchar    mail[255];            /* spool file path name */
  607. Xlong omtime=0l;                /* previous file mod. time */
  608. Xint state = 0;                /* mail & window state */
  609. Xint poll = POLL;            /* poll interval */
  610. Xint debug=0;                /* for mgrmail -d >& /dev/tty?? */
  611. X
  612. Xmain(argc,argv)
  613. X    char **argv;
  614. X{
  615. X    register int i;
  616. X    int xpos = XPOS;        /* screen position of mail subwindow */
  617. X    int ypos = YPOS;
  618. X    int font = -1;            /* font to use for mail subwindow */
  619. X    int shape = 1;            /* initially reshape window */
  620. X    char *command = MAIL;        /* name of readmail command */
  621. X
  622. X    char *getenv();
  623. X    char *user = getenv("USER");
  624. X    char line[80];            /* event input buffer */
  625. X
  626. X    int clean(), update();
  627. X
  628. X    /* make sure environment is ok */
  629. X
  630. X    ckmgrterm( *argv );
  631. X
  632. X    if (user==NULL || *user=='\0') {
  633. X        fprintf(stderr,"%s: Who are you?\n",argv[0]);
  634. X        exit(2);
  635. X    }
  636. X
  637. X    /* process arguments */
  638. X
  639. X    for(i=1;i<argc;i++) {
  640. X        if (Isflag(argv[i],"-s"))
  641. X            shape = 0;
  642. X        else if (Isflag(argv[i],"-d"))
  643. X            debug = 1;
  644. X        else if (Isflag(argv[i],"-x"))
  645. X            xpos = atoi(argv[i]+2);
  646. X        else if (Isflag(argv[i],"-y"))
  647. X            ypos = atoi(argv[i]+2);
  648. X        else if (Isflag(argv[i],"-f"))
  649. X            font = atoi(argv[i]+2);
  650. X        else if (Isflag(argv[i],"-p"))
  651. X            poll  = Max(atoi(argv[i]+2),10);
  652. X        else if (Isflag(argv[i],"-M"))
  653. X            command  = argv[i]+2;
  654. X        else
  655. X            usage(argv[0],argv[i]);
  656. X    }
  657. X    sprintf(mail,"%s/%s",MAILF,user);
  658. X
  659. X    /* set up window environment */
  660. X
  661. X    m_setup(M_FLUSH);
  662. X    m_ttyset();
  663. X    m_push(P_MENU|P_EVENT|P_FLAGS);
  664. X    dprintf(stderr,"pushing environment\n"); fflush(stderr);
  665. X    m_setmode(M_NOWRAP);
  666. X
  667. X    signal(SIGTERM,clean);
  668. X    signal(SIGINT,clean);
  669. X    signal(SIGALRM,update);
  670. X
  671. X    m_setmode(M_ACTIVATE);
  672. X    if (shape) {
  673. X        m_size(strlen(MSG_1),1);
  674. X        }
  675. X
  676. X    menu_load(1,MENU_COUNT,menu);
  677. X    m_selectmenu(1);
  678. X    m_setevent(ACTIVATE,"A\r");
  679. X    m_setevent(REDRAW,"R\r");
  680. X
  681. X    m_clearmode(M_ACTIVATE);
  682. X    m_clear();
  683. X    m_printstr(MSG_1);
  684. X
  685. X    dprintf(stderr,"Starting state 0x%x\n",state); fflush(stderr);
  686. X
  687. X    update();
  688. X
  689. X    /* wait for an event */
  690. X
  691. X    while(1) {
  692. X        m_gets(line);
  693. X        dprintf(stderr,"state 0x%x line : %c\n",state,*line); fflush(stderr);
  694. X        switch(*line) {
  695. X            case 'A':    /* window is activated */
  696. X                if (!stat(mail,&statb) && S(st_size))
  697. X                    do_mail(command,font,xpos,ypos);
  698. X                state &= ~PROCESSED;
  699. X                update();
  700. X                break;
  701. X            case 'R':    /* screen is redrawn */
  702. X                state &= ~PROCESSED;
  703. X                update();
  704. X                break;
  705. X        }
  706. X    }
  707. X}
  708. X
  709. X/* run readmail in a subwindow */
  710. X
  711. Xdo_mail(command,font,xpos,ypos)
  712. Xchar *command;
  713. Xint font,xpos,ypos;
  714. X    {
  715. X    int x,y,dummy;
  716. X    int code;
  717. X
  718. X    alarm(0);
  719. X    m_push(P_POSITION|P_EVENT|P_FLAGS|P_FONT);
  720. X    dprintf(stderr,"doing mail\n"); fflush(stderr);
  721. X    if (font != -1)
  722. X        m_font(font);
  723. X    m_sizeall(xpos,ypos,80,24);
  724. X    m_printstr(MSG_3);
  725. X    m_ttyreset();
  726. X    code = system(command);
  727. X    m_printstr(MSG_4);
  728. X    sleep(2);    /* for "New mail arrived" message */
  729. X    dprintf(stderr,"Readmail completed code %d\n",code); fflush(stderr);
  730. X    m_ttyset();
  731. X        get_size(&x,&y,&dummy,&dummy);
  732. X    m_pop();
  733. X    dprintf(stderr,"done with mail\n"); fflush(stderr);
  734. X    if (x!=xpos || y!=ypos) {
  735. X        m_movewindow(x,y);
  736. X        xpos = x;
  737. X        dprintf(stderr,"moving mail window\n"); fflush(stderr);
  738. X        ypos = y;
  739. X    }
  740. X    m_clearmode(M_ACTIVATE);
  741. X    dprintf(stderr,"window deactivated\n"); fflush(stderr);
  742. X    }
  743. X
  744. X/* check the spool file for new mail and update message */
  745. X
  746. Xint
  747. Xupdate()
  748. X{
  749. X    alarm(0);
  750. X    dprintf(stderr,"checking mail state 0x%x\n",state); fflush(stderr);
  751. X    if (!stat(mail,&statb) && S(st_mtime)>S(st_atime) && S(st_size)) {
  752. X        state &= ~PROCESSED;
  753. X        if (S(st_mtime) != omtime) {
  754. X        dprintf(stderr,"    First time New mail\n"); fflush(stderr);
  755. X            m_printstr(MSG_2);
  756. X            m_setmode(M_WOB);
  757. X            omtime = S(st_mtime);
  758. X        }
  759. X    }
  760. X    else if (!(state&PROCESSED)) {
  761. X        dprintf(stderr,"    Clearing new mail\n"); fflush(stderr);
  762. X        m_clearmode(M_WOB);
  763. X        m_printstr(MSG_1);
  764. X        state |= PROCESSED;
  765. X    }
  766. X    alarm(poll);
  767. X}
  768. X
  769. X/*    Clean up and exit */
  770. X
  771. Xclean()
  772. X{
  773. X    m_popall();
  774. X    m_ttyreset();
  775. X    exit(1);
  776. X}
  777. X
  778. Xusage(name,error)
  779. Xchar *name, *error;
  780. X{
  781. X    fprintf(stderr,"Invalid flag: %s\n",error);
  782. X    fprintf(stderr,
  783. X        "usage: %s -[s|x<pos>|y<pos>|f<font>|p<poll>|M<mail_program>]\n"
  784. X        ,name);
  785. X    exit(1);
  786. X}
  787. END_OF_FILE
  788. # end of 'demo/misc/omgrmail.c'
  789. fi
  790. if test -f 'font-16/Ugal13x20b' -a "${1}" != "-c" ; then 
  791.   echo shar: Will not clobber existing file \"'font-16/Ugal13x20b'\"
  792. else
  793. echo shar: Extracting \"'font-16/Ugal13x20b'\" \(5772 characters\)
  794. sed "s/^X//" >'font-16/Ugal13x20b' <<'END_OF_FILE'
  795. Xbegin 644 gal13x20b.fnt
  796. XM%@T4!8                                                      
  797. XM                    . =P!W!P'C@> <  X<             .!X 8!^ ?
  798. XM@!P'\!X#_@^ ?@           ?                                  
  799. XM                          _' #\ &    8  #     <   \  !@     
  800. XMX 'P                               #P' >                    
  801. XM                                                         #@'
  802. XM< =Q_#-P/P/@ <#@            ' _ . _P/\ \!_ X!_X9P,\         
  803. XM  /X   X/^ ?S_@_\?^!_/CX_@?Q\>? >#^!X?!_P'P_X#_G_WP_P]__^'_#
  804. XMS_P/QP _ #P   .  !P    /   ;@  X #@ .>  <                   
  805. XM            !P!P!P                                          
  806. XM                                   X!W '<_XS<'.#X / \       
  807. XM     !P9P'@<>&'@/ P < X,..&'@          'O   .!PP,.<>'##A@PYP
  808. XM<#@!P..#@#AYP,,\..#/''!PYG,X&<&.YG S@8PX#@. !P!^   '   \    
  809. XM!P  &X  >  X #C@ '                !@              < < <     
  810. XM                                                            
  811. XM            . =P#N=_,^!S@. #@'             X&.#X&#C X'P, .  
  812. XM##CC@X          !AP/P'P<.&!G#APPX88&<' X <#G X \>>#&'#AQAQPX
  813. XMX&!P.!CC#N8X8<, . X#@ < YP  !P  '     <  #@  #@     X !P    
  814. XM            8              #@' .                            
  815. XM                                                 #@'<#_W=Q[@
  816. XM<X#@!X!X ^          .#CA^  X .!\& #@ !PXXX.            </^!\
  817. XM'#A@!P<< . & '!P. ' [@. /'GPQ@XX<8.<..!@<#@8XP[F/,#F ' . < '
  818. XM <.   ?  !P    '   X   X     .  <                .          
  819. XM     X!P#@                                                  
  820. XM                           X!W _]W !P#\!P < . ' #@       ' X
  821. XMX#@ . '@W!_AP  8',.#@X    <  <  '#AP;!PXX <'' #@#@!P<#@!P/P#
  822. XM@#QY\,X..'.#G#CP ' X&.,/YAS Y@!P#@' !P     'P'X=\#^ _P? . /V
  823. XM/\#X /CCP'!_\-\!^/_ ?9[P/\?^/OOA___\_\??_ . < X             
  824. XM                                                            
  825. XM    .   '</P <!\ X ' #@=W X       !P.. X #@/P-P<\=\ & ^#QX? 
  826. XM'  >  #P #AP<,X<<. '!QQ@XPX <' X <#X X ^^;C.#CCC@YPP? !P.!AV
  827. XM#_P/@'P X X X <      X#G'_ASPY\<<#@'/CW@.  XYP!P/_GW@SQYX,^/
  828. XMN'' X!QQP,[F>&.!G#P' ' '                                    
  829. XM                                         #@  !W!_ . _ , !P X
  830. XM'_P.        X#C@. !P'\&< 'G_@#@' ?^'P#X >#_P? !P=[#.'_#@!P<?
  831. XMX/\. '_P. ' ^ . /OF<S@X_PX.?X#X <#@8=@=\!P X . . . '        
  832. XMQQX\8<,/.#A_#APXX#@ ..X <#NXXX8></&'CSAPP. <<.&.YCS!PQAX#P!P
  833. XM!X                                                          
  834. XM                   X   [@'X' ?X   < . =P#@       < XX#@ X 'A
  835. XMG  YX\ P#X#[@X ^ ? _\!\ X'_PQAPXX <''&#C#@!P<#@!P/P#@#[YGLX.
  836. XM. .#GX /@' X&'8'_ < . ' #@!P!P       !\<'. '!S@X. X<.. X #C\
  837. XM ' [N...#G!S@XX > #@''#ACN8?@<, \ < < < >,                  
  838. XM                                                        .   
  839. XM.X!W!P'/P  ' #@  /_@ #_X  ' .. X <  XQP .<' ,!G  X  ' ?    '
  840. XMP<!^\?\<'. '!QP X X_<' X <#^ X W^8[.#C@#@Y_  \!P.!@X!_P/@#@!
  841. XMP X . <       #W'!S@!P<_^#@.'#C@.  X^ !P.[CCC@YP<X.. #X X!QP
  842. XM<P?\#P#F > #@' . /W                                         
  843. XM                                 #@  /_ =P[QQ\  !X!X!W#_X  _
  844. XM^  #@#C@. .  ./_ #G!P' XX <    'P   !\' ?O&''!S@!P<< . .#G!P
  845. XM. ' [P. -[F'S@XX X.=X '@<#@8/ ?X&< X X . #@'       !QQP<X <'
  846. XM.  X!S@XX#@ ./P <#NXXXX.<'.#C@ /@. <<','_ > Y@/  X!P#@#_@   
  847. XM                                                            
  848. XM              #_QW</F<>   . <!_\#@     X X XP#@' ,#G_S YP<!@
  849. XM.. ' X   ? _\!\  '?Q@QP<8 <'' #@!@YP<#@!P.>#@#>Y@\8,. '#'/# 
  850. XMX' X&#P#N!G@. . #@ <!P       <<<'. '!S@ . ?P.. X #C^ ' [N...
  851. XM#G!S@XX  \#@'' ^!_P/P'P'@ . < X!WX                          
  852. XM                                                    =P?^'9G'
  853. XM   #P/ =W X X   ? < ', X#@S@P!PX.>& 8#C@#@? ' !X/_!\  !P P.<
  854. XM''!G!AP8X <.<' X <#CPX,S.8/'##@!XQQXP.!P/# 8 [@PX#@'  X ' < 
  855. XM      '''ASPQX\< #@. #C@.  X[P!P.[CCCPQP8\.. &' XQQP/@.X&>!\
  856. XM#PP' ' ' 8\                                                 
  857. XM                         #@  .X#_!V8_\   <#@ < . ?   'P' !^ 
  858. XM.!_\?X <''#_ . <P#P'P#X '@  \ ' . ,#G#@XQQP<&. #CG!P. ' X>.#
  859. XM,SF!PY@X /X</.' <!_P& .X8' X!PP/P X_       ![Q\X<</?#C@X#_PX
  860. XMX#@ ..> <#NXXX>8>,'GC@!QP/8>\!P#N##P.!X<!P!P!P              
  861. XM                                                            
  862. XM   X  #N ' X\'W   #AP /@#@'P   X#@ / ?\?_#\ ' _@?@# #X'P X ^
  863. XM  <  < !P#_WA__P'X_P/_GP ?CX^/X!P?#W_WM_P.'P? !X/A[_@?P/X!@#
  864. XMN/#X? _\#\ ./P       /^;\#^!]X?@? ?^??#^ #GSX?Q__??#\'^ _Y\ 
  865. XM?X!\#[@< [CY^#@?_ / <!X                                     
  866. XM                                                            
  867. XM    <                               #@         /\           
  868. XM         <              _                                   
  869. XM           &#@    PX          !P  .                P     '  
  870. XM                                                            
  871. XM                                         '                  
  872. XM              X                               '             
  873. XM 9[                            ?_P              # 8    ..   
  874. XM        <  #@               <     !P                        
  875. XM                                                            
  876. XM                  #@                               <        
  877. XM                       !@              /@                   
  878. XM        '_\               P&    #S           '   X          
  879. XM     &      <                                               
  880. XM                                                       !P   
  881. XM                            .                               
  882. XM#P                                                          
  883. XM   /_     ?@          !P  .               /@     '          
  884. XM                                                            
  885. XM                                 8                          
  886. XM     #                                X                     
  887. XM                                        !_@    #P           
  888. X:^  'P              #P     !P        
  889. Xend
  890. END_OF_FILE
  891. # end of 'font-16/Ugal13x20b'
  892. fi
  893. if test -f 'font-16/Ugal13x20r' -a "${1}" != "-c" ; then 
  894.   echo shar: Will not clobber existing file \"'font-16/Ugal13x20r'\"
  895. else
  896. echo shar: Extracting \"'font-16/Ugal13x20r'\" \(5772 characters\)
  897. sed "s/^X//" >'font-16/Ugal13x20r' <<'END_OF_FILE'
  898. Xbegin 644 gal13x20r.fnt
  899. XM%@T4!8                                                      
  900. XM                    , 9@!F!@'# < 8  P8             ,!P 0!\ ?
  901. XM !@'X!P#_ \ ?            >                                  
  902. XM                          ^& #X $    0  "     8   X  !      
  903. XMP '@                               #@& <                    
  904. XM                                                         # &
  905. XM8 9A^")@/@/  8#             & ^ , _@/X X!^ P!_P1@(X         
  906. XM  /P   P/\ ?C_ _X?\!^/#P_ ?AX<> <#L!P>!_@'@_P#_'_G@[@Y_>\'>#
  907. XMC_@/A@ ^ #@   ,  !@    .   3   P #  ,<  8                   
  908. XM            !@!@!@                                          
  909. XM                                   P!F &8_PB8&,#P . X       
  910. XM     !@1@' 8<$' . @ 8 P(,,$'           '.   ,!@@(,8<&"#! @Q@
  911. XM8# !@,,# #!Q@((X,,".&&!@Q&(P$8$,Q& C 0@P# , !@!L   &   X    
  912. XM!@  $P  <  P ##  &                !               8 8 8     
  913. XM                                                            
  914. XM            , 9@#,9N(L!C , # &             P$,#P$#" P%@( ,  
  915. XM"### P          !!@/@%@8,$!&#!@@P00$8& P 8#& P X<<"$&#!A!A@P
  916. XMP$!@,!#"#,0P08( , P#  8 Q@  !@  &     8  #   #      P !@    
  917. XM            0              # & ,                            
  918. XM                                                 # &8#_F9AS 
  919. XM8P# !P!P \          ,##!L  P ,!8$ #  !@PPP,            8/\!8
  920. XM&#! !@88 , $ &!@, & S , .''@A PP80,8,,! 8# 0P@S$.(#$ & , 8 &
  921. XM 8,   >  !@    &   P   P     ,  8                ,          
  922. XM     P!@#                                                   
  923. XM                           P!F _YF !@#X!@ 8 , & #        & P
  924. XMP#  , ' F!_!@  0&(,# P    8  8  &#!@2!@PP 8&& # # !@8# !@-@#
  925. XM #AQ8(P,,&,#&##@ & P$,(.Q!B Q !@# & !@     '@'P9X#\ ]@> , /D
  926. XM-X#P /##@&!NX)X!\.^ >1S@/X?\///!W^[X]X>?^ , 8 P             
  927. XM                                                            
  928. XM    ,   &8/@ 8!X P & # 9F P       !@,, P # /@)@8X9X $ T#AP> 
  929. XM&  <  #@ #!@8(P88, &!AA P@P 8& P 8#P P LL3",#### Q@@> !@,!!D
  930. XM#N@- &@ P P P 8      P#&&_!C@QX88# &/#G ,  PQ@!@-W'G CAQP(\-
  931. XM,&& P!AA@(S$<$,!&#@& & &                                    
  932. XM                                         #   !F!^ , ^ ( !@ P
  933. XM';@,        P## , !@'X$8 '&_ # & ?L'@#P <#_@> !@9R",'^# !@8?
  934. XMP/X, '_@, & \ , ++$8C PW@P,?P#P 8# 09 9H!@ P , , , &        
  935. XMAAPX08(.,#!^#!@PP#  ,,P 8#,PPP0<8.$'#C!@@, 88,$,Q#B!@A!P#@!@
  936. XM!P                                                          
  937. XM                   P   S 'P& =P   8 , 9@#        8 PP#  P '!
  938. XM&  QPX @"P#S P \ > _X!X P&^@A!@PP 8&&$#"# !@8# !@/@# "RQ'(P,
  939. XM, ,#'P / & P$&0&Z 8 , & # !@!@       !X8&, &!C P, P8,, P ##X
  940. XM & S,,,,#&!C PP < # &&#!#,0= 8( X 8 8 8 <(                  
  941. XM                                                        ,   
  942. XM,P!F!@&-@  & #   /_  #_P  & ,, P 8  PA@ ,8& (!&  P  & >    '
  943. XM@8!LH?X8&, &!A@ P P^8& P 8#< P FL0R,## # QN  X!@,! P!W@+ # !
  944. XM@ P , 8       #F&!C !@8_\# ,&## ,  P\ !@,S### Q@8P,, #P P!A@
  945. XM8@;H#@#$ < # & , /F                                         
  946. XM                                 #   /^ 9@SAAX  !P!P!F#_P  _
  947. XM\  # ## , ,  ,/^ #&!@& PP 8    '@   !X& ;*$&&!C !@88 , ,#&!@
  948. XM, & S@, )S$&C PP P,9P ' 8# 0. =P$8 P P , # &       !AA@8P 8&
  949. XM,  P!C PP#  ,/@ 8#,PPPP,8&,##  / , 88&(': < Q .  P!@# #;    
  950. XM                                                            
  951. XM              #_AF8-$8<   , 8!VX#      P P P@# & (#'_B Q@8! 
  952. XM,, & P   > _X!X  &?A A@80 8&& # ! Q@8# !@,<# "<Q X0(, &"&." 
  953. XMP& P$#@#,!' , , #  8!@       888&, &!C  , ?@,, P ##< & S,,,,
  954. XM#&!C PP  X# && T!V@+@&@'  , 8 P!GP                          
  955. XM                                                    9@?\&1&&
  956. XM   #@. 9F P P   > 8 &( P# C @!@P,<$ 0## # > & !P/^!X  !@ @,8
  957. XM&&!&!!@0P 8,8& P 8##@P(B,0.&"# !PAAP@,!@." 0 S @P# &  P & 8 
  958. XM      &&'!C@APX8 # , ## ,  PS@!@,S###@A@0X,, $& PAA@- ,P$<!H
  959. XM#@@& & & 0X                                                 
  960. XM                         #   ,P#^!D0_X   8#  8 , >   '@& !\ 
  961. XM,!_X?P 8&&#^ , 8@#@'@#P '   X & , (#&# PAA@8$, ##&!@, & P<,"
  962. XM(C$!@Q P /P8.,& 8!_@$ ,P0& P!@@/@ P^       !SAXP88.6## P#_@P
  963. XMP#  ,,< 8#,PPP<0<(''# !A@.0<X!@#,"#@,!P8!@!@!@              
  964. XM                                                            
  965. XM   P  #, & PX'F   #!@ / # '@   P#  . ?X?^#X & _ ? " #P'@ P \
  966. XM  8  8 !@#_G![_@'P_@/_'@ ?#P\/P!@>#G_G)[@,'@> !P/!S_ ?@/P! #
  967. XM,.#P> _X#X ,/@       /<3X#\!YP? > ?\>>#\ #'CP?AWN>>#X'\ _QX 
  968. XM?P!X#S 8 S#Q\# ?^ . 8!P                                     
  969. XM                                                            
  970. XM    8                               #          /X           
  971. XM         8              ^                                   
  972. XM           $#     @P          !@  ,                @     &  
  973. XM                                                            
  974. XM                                         &                  
  975. XM              P                               &             
  976. XM 1R                            ?_@              " 0    ,,   
  977. XM        8  #                8     !@                        
  978. XM                                                            
  979. XM                  #                                8        
  980. XM                       !               /                    
  981. XM        '_X               @$    #B           &   P          
  982. XM     $      8                                               
  983. XM                                                       !@   
  984. XM                            ,                               
  985. XM#@                                                          
  986. XM   /^     ?           !@  ,               /      &          
  987. XM                                                            
  988. XM                                 0                          
  989. XM     "                                P                     
  990. XM                                        !_     #@           
  991. X:\  '@              #@     !@        
  992. Xend
  993. END_OF_FILE
  994. # end of 'font-16/Ugal13x20r'
  995. fi
  996. if test -f 'font-32/Ugal13x20b' -a "${1}" != "-c" ; then 
  997.   echo shar: Will not clobber existing file \"'font-32/Ugal13x20b'\"
  998. else
  999. echo shar: Extracting \"'font-32/Ugal13x20b'\" \(5772 characters\)
  1000. sed "s/^X//" >'font-32/Ugal13x20b' <<'END_OF_FILE'
  1001. Xbegin 644 gal13x20b.fnt
  1002. XM& T4!8                                                      
  1003. XM                    . =P!W!P'C@> <  X<             .!X 8!^ ?
  1004. XM@!P'\!X#_@^ ?@           ?                                  
  1005. XM                          _' #\ &    8  #     <   \  !@     
  1006. XMX 'P                               #P' >                    
  1007. XM                                                         #@'
  1008. XM< =Q_#-P/P/@ <#@            ' _ . _P/\ \!_ X!_X9P,\         
  1009. XM  /X   X/^ ?S_@_\?^!_/CX_@?Q\>? >#^!X?!_P'P_X#_G_WP_P]__^'_#
  1010. XMS_P/QP _ #P   .  !P    /   ;@  X #@ .>  <                   
  1011. XM            !P!P!P                                          
  1012. XM                                   X!W '<_XS<'.#X / \       
  1013. XM     !P9P'@<>&'@/ P < X,..&'@          'O   .!PP,.<>'##A@PYP
  1014. XM<#@!P..#@#AYP,,\..#/''!PYG,X&<&.YG S@8PX#@. !P!^   '   \    
  1015. XM!P  &X  >  X #C@ '                !@              < < <     
  1016. XM                                                            
  1017. XM            . =P#N=_,^!S@. #@'             X&.#X&#C X'P, .  
  1018. XM##CC@X          !AP/P'P<.&!G#APPX88&<' X <#G X \>>#&'#AQAQPX
  1019. XMX&!P.!CC#N8X8<, . X#@ < YP  !P  '     <  #@  #@     X !P    
  1020. XM            8              #@' .                            
  1021. XM                                                 #@'<#_W=Q[@
  1022. XM<X#@!X!X ^          .#CA^  X .!\& #@ !PXXX.            </^!\
  1023. XM'#A@!P<< . & '!P. ' [@. /'GPQ@XX<8.<..!@<#@8XP[F/,#F ' . < '
  1024. XM <.   ?  !P    '   X   X     .  <                .          
  1025. XM     X!P#@                                                  
  1026. XM                           X!W _]W !P#\!P < . ' #@       ' X
  1027. XMX#@ . '@W!_AP  8',.#@X    <  <  '#AP;!PXX <'' #@#@!P<#@!P/P#
  1028. XM@#QY\,X..'.#G#CP ' X&.,/YAS Y@!P#@' !P     'P'X=\#^ _P? . /V
  1029. XM/\#X /CCP'!_\-\!^/_ ?9[P/\?^/OOA___\_\??_ . < X             
  1030. XM                                                            
  1031. XM    .   '</P <!\ X ' #@=W X       !P.. X #@/P-P<\=\ & ^#QX? 
  1032. XM'  >  #P #AP<,X<<. '!QQ@XPX <' X <#X X ^^;C.#CCC@YPP? !P.!AV
  1033. XM#_P/@'P X X X <      X#G'_ASPY\<<#@'/CW@.  XYP!P/_GW@SQYX,^/
  1034. XMN'' X!QQP,[F>&.!G#P' ' '                                    
  1035. XM                                         #@  !W!_ . _ , !P X
  1036. XM'_P.        X#C@. !P'\&< 'G_@#@' ?^'P#X >#_P? !P=[#.'_#@!P<?
  1037. XMX/\. '_P. ' ^ . /OF<S@X_PX.?X#X <#@8=@=\!P X . . . '        
  1038. XMQQX\8<,/.#A_#APXX#@ ..X <#NXXX8></&'CSAPP. <<.&.YCS!PQAX#P!P
  1039. XM!X                                                          
  1040. XM                   X   [@'X' ?X   < . =P#@       < XX#@ X 'A
  1041. XMG  YX\ P#X#[@X ^ ? _\!\ X'_PQAPXX <''&#C#@!P<#@!P/P#@#[YGLX.
  1042. XM. .#GX /@' X&'8'_ < . ' #@!P!P       !\<'. '!S@X. X<.. X #C\
  1043. XM ' [N...#G!S@XX > #@''#ACN8?@<, \ < < < >,                  
  1044. XM                                                        .   
  1045. XM.X!W!P'/P  ' #@  /_@ #_X  ' .. X <  XQP .<' ,!G  X  ' ?    '
  1046. XMP<!^\?\<'. '!QP X X_<' X <#^ X W^8[.#C@#@Y_  \!P.!@X!_P/@#@!
  1047. XMP X . <       #W'!S@!P<_^#@.'#C@.  X^ !P.[CCC@YP<X.. #X X!QP
  1048. XM<P?\#P#F > #@' . /W                                         
  1049. XM                                 #@  /_ =P[QQ\  !X!X!W#_X  _
  1050. XM^  #@#C@. .  ./_ #G!P' XX <    'P   !\' ?O&''!S@!P<< . .#G!P
  1051. XM. ' [P. -[F'S@XX X.=X '@<#@8/ ?X&< X X . #@'       !QQP<X <'
  1052. XM.  X!S@XX#@ ./P <#NXXXX.<'.#C@ /@. <<','_ > Y@/  X!P#@#_@   
  1053. XM                                                            
  1054. XM              #_QW</F<>   . <!_\#@     X X XP#@' ,#G_S YP<!@
  1055. XM.. ' X   ? _\!\  '?Q@QP<8 <'' #@!@YP<#@!P.>#@#>Y@\8,. '#'/# 
  1056. XMX' X&#P#N!G@. . #@ <!P       <<<'. '!S@ . ?P.. X #C^ ' [N...
  1057. XM#G!S@XX  \#@'' ^!_P/P'P'@ . < X!WX                          
  1058. XM                                                    =P?^'9G'
  1059. XM   #P/ =W X X   ? < ', X#@S@P!PX.>& 8#C@#@? ' !X/_!\  !P P.<
  1060. XM''!G!AP8X <.<' X <#CPX,S.8/'##@!XQQXP.!P/# 8 [@PX#@'  X ' < 
  1061. XM      '''ASPQX\< #@. #C@.  X[P!P.[CCCPQP8\.. &' XQQP/@.X&>!\
  1062. XM#PP' ' ' 8\                                                 
  1063. XM                         #@  .X#_!V8_\   <#@ < . ?   'P' !^ 
  1064. XM.!_\?X <''#_ . <P#P'P#X '@  \ ' . ,#G#@XQQP<&. #CG!P. ' X>.#
  1065. XM,SF!PY@X /X</.' <!_P& .X8' X!PP/P X_       ![Q\X<</?#C@X#_PX
  1066. XMX#@ ..> <#NXXX>8>,'GC@!QP/8>\!P#N##P.!X<!P!P!P              
  1067. XM                                                            
  1068. XM   X  #N ' X\'W   #AP /@#@'P   X#@ / ?\?_#\ ' _@?@# #X'P X ^
  1069. XM  <  < !P#_WA__P'X_P/_GP ?CX^/X!P?#W_WM_P.'P? !X/A[_@?P/X!@#
  1070. XMN/#X? _\#\ ./P       /^;\#^!]X?@? ?^??#^ #GSX?Q__??#\'^ _Y\ 
  1071. XM?X!\#[@< [CY^#@?_ / <!X                                     
  1072. XM                                                            
  1073. XM    <                               #@         /\           
  1074. XM         <              _                                   
  1075. XM           &#@    PX          !P  .                P     '  
  1076. XM                                                            
  1077. XM                                         '                  
  1078. XM              X                               '             
  1079. XM 9[                            ?_P              # 8    ..   
  1080. XM        <  #@               <     !P                        
  1081. XM                                                            
  1082. XM                  #@                               <        
  1083. XM                       !@              /@                   
  1084. XM        '_\               P&    #S           '   X          
  1085. XM     &      <                                               
  1086. XM                                                       !P   
  1087. XM                            .                               
  1088. XM#P                                                          
  1089. XM   /_     ?@          !P  .               /@     '          
  1090. XM                                                            
  1091. XM                                 8                          
  1092. XM     #                                X                     
  1093. XM                                        !_@    #P           
  1094. X:^  'P              #P     !P        
  1095. Xend
  1096. END_OF_FILE
  1097. # end of 'font-32/Ugal13x20b'
  1098. fi
  1099. if test -f 'font-32/Ugal13x20r' -a "${1}" != "-c" ; then 
  1100.   echo shar: Will not clobber existing file \"'font-32/Ugal13x20r'\"
  1101. else
  1102. echo shar: Extracting \"'font-32/Ugal13x20r'\" \(5772 characters\)
  1103. sed "s/^X//" >'font-32/Ugal13x20r' <<'END_OF_FILE'
  1104. Xbegin 644 gal13x20r.fnt
  1105. XM& T4!8                                                      
  1106. XM                    , 9@!F!@'# < 8  P8             ,!P 0!\ ?
  1107. XM !@'X!P#_ \ ?            >                                  
  1108. XM                          ^& #X $    0  "     8   X  !      
  1109. XMP '@                               #@& <                    
  1110. XM                                                         # &
  1111. XM8 9A^")@/@/  8#             & ^ , _@/X X!^ P!_P1@(X         
  1112. XM  /P   P/\ ?C_ _X?\!^/#P_ ?AX<> <#L!P>!_@'@_P#_'_G@[@Y_>\'>#
  1113. XMC_@/A@ ^ #@   ,  !@    .   3   P #  ,<  8                   
  1114. XM            !@!@!@                                          
  1115. XM                                   P!F &8_PB8&,#P . X       
  1116. XM     !@1@' 8<$' . @ 8 P(,,$'           '.   ,!@@(,8<&"#! @Q@
  1117. XM8# !@,,# #!Q@((X,,".&&!@Q&(P$8$,Q& C 0@P# , !@!L   &   X    
  1118. XM!@  $P  <  P ##  &                !               8 8 8     
  1119. XM                                                            
  1120. XM            , 9@#,9N(L!C , # &             P$,#P$#" P%@( ,  
  1121. XM"### P          !!@/@%@8,$!&#!@@P00$8& P 8#& P X<<"$&#!A!A@P
  1122. XMP$!@,!#"#,0P08( , P#  8 Q@  !@  &     8  #   #      P !@    
  1123. XM            0              # & ,                            
  1124. XM                                                 # &8#_F9AS 
  1125. XM8P# !P!P \          ,##!L  P ,!8$ #  !@PPP,            8/\!8
  1126. XM&#! !@88 , $ &!@, & S , .''@A PP80,8,,! 8# 0P@S$.(#$ & , 8 &
  1127. XM 8,   >  !@    &   P   P     ,  8                ,          
  1128. XM     P!@#                                                   
  1129. XM                           P!F _YF !@#X!@ 8 , & #        & P
  1130. XMP#  , ' F!_!@  0&(,# P    8  8  &#!@2!@PP 8&& # # !@8# !@-@#
  1131. XM #AQ8(P,,&,#&##@ & P$,(.Q!B Q !@# & !@     '@'P9X#\ ]@> , /D
  1132. XM-X#P /##@&!NX)X!\.^ >1S@/X?\///!W^[X]X>?^ , 8 P             
  1133. XM                                                            
  1134. XM    ,   &8/@ 8!X P & # 9F P       !@,, P # /@)@8X9X $ T#AP> 
  1135. XM&  <  #@ #!@8(P88, &!AA P@P 8& P 8#P P LL3",#### Q@@> !@,!!D
  1136. XM#N@- &@ P P P 8      P#&&_!C@QX88# &/#G ,  PQ@!@-W'G CAQP(\-
  1137. XM,&& P!AA@(S$<$,!&#@& & &                                    
  1138. XM                                         #   !F!^ , ^ ( !@ P
  1139. XM';@,        P## , !@'X$8 '&_ # & ?L'@#P <#_@> !@9R",'^# !@8?
  1140. XMP/X, '_@, & \ , ++$8C PW@P,?P#P 8# 09 9H!@ P , , , &        
  1141. XMAAPX08(.,#!^#!@PP#  ,,P 8#,PPP0<8.$'#C!@@, 88,$,Q#B!@A!P#@!@
  1142. XM!P                                                          
  1143. XM                   P   S 'P& =P   8 , 9@#        8 PP#  P '!
  1144. XM&  QPX @"P#S P \ > _X!X P&^@A!@PP 8&&$#"# !@8# !@/@# "RQ'(P,
  1145. XM, ,#'P / & P$&0&Z 8 , & # !@!@       !X8&, &!C P, P8,, P ##X
  1146. XM & S,,,,#&!C PP < # &&#!#,0= 8( X 8 8 8 <(                  
  1147. XM                                                        ,   
  1148. XM,P!F!@&-@  & #   /_  #_P  & ,, P 8  PA@ ,8& (!&  P  & >    '
  1149. XM@8!LH?X8&, &!A@ P P^8& P 8#< P FL0R,## # QN  X!@,! P!W@+ # !
  1150. XM@ P , 8       #F&!C !@8_\# ,&## ,  P\ !@,S### Q@8P,, #P P!A@
  1151. XM8@;H#@#$ < # & , /F                                         
  1152. XM                                 #   /^ 9@SAAX  !P!P!F#_P  _
  1153. XM\  # ## , ,  ,/^ #&!@& PP 8    '@   !X& ;*$&&!C !@88 , ,#&!@
  1154. XM, & S@, )S$&C PP P,9P ' 8# 0. =P$8 P P , # &       !AA@8P 8&
  1155. XM,  P!C PP#  ,/@ 8#,PPPP,8&,##  / , 88&(': < Q .  P!@# #;    
  1156. XM                                                            
  1157. XM              #_AF8-$8<   , 8!VX#      P P P@# & (#'_B Q@8! 
  1158. XM,, & P   > _X!X  &?A A@80 8&& # ! Q@8# !@,<# "<Q X0(, &"&." 
  1159. XMP& P$#@#,!' , , #  8!@       888&, &!C  , ?@,, P ##< & S,,,,
  1160. XM#&!C PP  X# && T!V@+@&@'  , 8 P!GP                          
  1161. XM                                                    9@?\&1&&
  1162. XM   #@. 9F P P   > 8 &( P# C @!@P,<$ 0## # > & !P/^!X  !@ @,8
  1163. XM&&!&!!@0P 8,8& P 8##@P(B,0.&"# !PAAP@,!@." 0 S @P# &  P & 8 
  1164. XM      &&'!C@APX8 # , ## ,  PS@!@,S###@A@0X,, $& PAA@- ,P$<!H
  1165. XM#@@& & & 0X                                                 
  1166. XM                         #   ,P#^!D0_X   8#  8 , >   '@& !\ 
  1167. XM,!_X?P 8&&#^ , 8@#@'@#P '   X & , (#&# PAA@8$, ##&!@, & P<,"
  1168. XM(C$!@Q P /P8.,& 8!_@$ ,P0& P!@@/@ P^       !SAXP88.6## P#_@P
  1169. XMP#  ,,< 8#,PPP<0<(''# !A@.0<X!@#,"#@,!P8!@!@!@              
  1170. XM                                                            
  1171. XM   P  #, & PX'F   #!@ / # '@   P#  . ?X?^#X & _ ? " #P'@ P \
  1172. XM  8  8 !@#_G![_@'P_@/_'@ ?#P\/P!@>#G_G)[@,'@> !P/!S_ ?@/P! #
  1173. XM,.#P> _X#X ,/@       /<3X#\!YP? > ?\>>#\ #'CP?AWN>>#X'\ _QX 
  1174. XM?P!X#S 8 S#Q\# ?^ . 8!P                                     
  1175. XM                                                            
  1176. XM    8                               #          /X           
  1177. XM         8              ^                                   
  1178. XM           $#     @P          !@  ,                @     &  
  1179. XM                                                            
  1180. XM                                         &                  
  1181. XM              P                               &             
  1182. XM 1R                            ?_@              " 0    ,,   
  1183. XM        8  #                8     !@                        
  1184. XM                                                            
  1185. XM                  #                                8        
  1186. XM                       !               /                    
  1187. XM        '_X               @$    #B           &   P          
  1188. XM     $      8                                               
  1189. XM                                                       !@   
  1190. XM                            ,                               
  1191. XM#@                                                          
  1192. XM   /^     ?           !@  ,               /      &          
  1193. XM                                                            
  1194. XM                                 0                          
  1195. XM     "                                P                     
  1196. XM                                        !_     #@           
  1197. X:\  '@              #@     !@        
  1198. Xend
  1199. END_OF_FILE
  1200. # end of 'font-32/Ugal13x20r'
  1201. fi
  1202. if test -f 'src/graph_subs.c' -a "${1}" != "-c" ; then 
  1203.   echo shar: Will not clobber existing file \"'src/graph_subs.c'\"
  1204. else
  1205. echo shar: Extracting \"'src/graph_subs.c'\" \(5999 characters\)
  1206. sed "s/^X//" >'src/graph_subs.c' <<'END_OF_FILE'
  1207. X/*                        Copyright (c) 1987 Bellcore
  1208. X *                            All Rights Reserved
  1209. X *       Permission is granted to copy or use this program, EXCEPT that it
  1210. X *       may not be sold for profit, the copyright notice must be reproduced
  1211. X *       on copies, and credit should be given to Bellcore where it is due.
  1212. X *       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  1213. X */
  1214. X/*    $Header: graph_subs.c,v 4.1 88/06/21 13:33:53 bianchi Exp $
  1215. X    $Source: /tmp/mgrsrc/src/RCS/graph_subs.c,v $
  1216. X*/
  1217. Xstatic char    RCSid_[] = "$Source: /tmp/mgrsrc/src/RCS/graph_subs.c,v $$Revision: 4.1 $";
  1218. X
  1219. X/* graphics subs  - mostly from the BLIT */
  1220. X
  1221. X#include "bitmap.h"
  1222. X
  1223. X/* circle of radius r centered at x1,y1 */
  1224. X
  1225. Xcircle(b,x1,y1,r,f)
  1226. XBITMAP  *b;
  1227. Xint x1;
  1228. Xregister int y1;
  1229. Xint r, f;
  1230. X{
  1231. X   register err = 0;        /* x^2 + y^2 - r^2 */
  1232. X   register dxsq = 1;        /* (x+dx)^2-x^2*/
  1233. X   register dysq = 1 - 2*r;
  1234. X   register exy;
  1235. X   int x0 = x1;
  1236. X   register y0 = y1 - r;
  1237. X
  1238. X   y1 += r;
  1239. X   while(y1 > y0) {
  1240. X      bit_point(b,x0,y0,f);
  1241. X      bit_point(b,x0,y1,f);
  1242. X      bit_point(b,x1,y0,f);
  1243. X      bit_point(b,x1,y1,f);
  1244. X      exy = err + dxsq + dysq;
  1245. X      if(-exy <= err+dxsq) {
  1246. X         y1--;
  1247. X         y0++;
  1248. X         err += dysq;
  1249. X         dysq += 2;
  1250. X         }
  1251. X      if(exy <= -err) {
  1252. X         x1++;
  1253. X         x0--;
  1254. X         err += dxsq;
  1255. X         dxsq += 2;
  1256. X         }
  1257. X      }
  1258. X   bit_point(b,x0,y0,f);
  1259. X   bit_point(b,x1,y0,f);
  1260. X   }
  1261. X
  1262. X
  1263. X#define labs(x,y)        if((x=y)<0) x= -x
  1264. X#define    BIG            0x7fff
  1265. X#define    HUGE            0x3fffffffL
  1266. X
  1267. Xint bit_point();
  1268. X
  1269. X/* draw an ellipse centered at x0,y0 with half-axes a,b */
  1270. X
  1271. Xellipse(screen, x, y, a, b, f)
  1272. XBITMAP *screen;
  1273. Xint x, y;
  1274. Xint a, b;
  1275. Xint f;
  1276. X   {
  1277. X   if(a==0 || b==0)
  1278. X      bit_line(screen, x-a, y-b, x+a, y+b, f);
  1279. X   else
  1280. X      ellip1(screen, x, y, a, b, bit_point, 0, b, 0, b, f);
  1281. X   }
  1282. X
  1283. X/* calculate b*b*x*x + a*a*y*y - a*a*b*b avoiding ovfl */
  1284. X
  1285. Xstatic long
  1286. Xresid(a,b,x,y)
  1287. Xregister a,b;
  1288. X   {
  1289. X   long result = 0;
  1290. X   long u = b*((long)a*a - (long)x*x);
  1291. X   long v = (long)a*y*y;
  1292. X   register q = u>BIG? HUGE/u: BIG;
  1293. X   register r = v>BIG? HUGE/v: BIG;
  1294. X   while(a || b) {
  1295. X      if(result>=0 && b) {
  1296. X         if(q>b) q = b;
  1297. X         result -= q*u;
  1298. X         b -= q;
  1299. X         }
  1300. X      else {
  1301. X         if(r>a) r = a;
  1302. X         result += r*v;
  1303. X         a -= r;
  1304. X         }
  1305. X      }
  1306. X   return(result);
  1307. X   }
  1308. X
  1309. X/*
  1310. X * clockwise ellipse centered at x0,y0 with half-axes a,b.
  1311. X * from x1,y1 to x2,y2
  1312. X * do "action" at each point
  1313. X */
  1314. X
  1315. Xellip1(screen, x0,y0, a, b, action, x1,y1, x2,y2, f)
  1316. Xint x0,y0, x1,y1, x2, y2;
  1317. Xregister void (*action)();
  1318. XBITMAP *screen;
  1319. Xint f;
  1320. X   {
  1321. X   int z;
  1322. X   int dx = y1>0? 1: y1<0? -1: x1>0? -1: 1;
  1323. X   int dy = x1>0? -1: x1<0? 1: y1>0? -1: 1;
  1324. X   long a2 = (long)a*a;
  1325. X   long b2 = (long)b*b;
  1326. X   register long dex = b2*(2*dx*x1+1);
  1327. X   register long e;
  1328. X   register long dey = a2*(2*dy*y1+1);
  1329. X   register long ex, ey, exy;
  1330. X
  1331. X   e = resid(a, b, x1, y1);
  1332. X   a2 *= 2;
  1333. X   b2 *= 2;
  1334. X   do {
  1335. X      labs(ex, e+dex);
  1336. X      labs(ey, e+dey);
  1337. X      labs(exy, e+dex+dey);
  1338. X      if(exy<=ex || ey<ex) {
  1339. X         y1 += dy;
  1340. X         e += dey;
  1341. X         dey += a2;
  1342. X         }
  1343. X      if(exy<=ey || ex<ey) {
  1344. X         x1 += dx;
  1345. X         e += dex;
  1346. X         dex += b2;
  1347. X         }
  1348. X      (*action)(screen, x0+x1, y0+y1, f);
  1349. X      if(x1 == 0) {
  1350. X         dy = -dy;
  1351. X         dey = -dey + a2;
  1352. X         }
  1353. X       else if(y1 == 0) {
  1354. X         for(z=x1; abs(z+=dx)<=a; )
  1355. X            (*action)(screen, x0+z, y0+y1, f);
  1356. X         dx = -dx;
  1357. X         dex = -dex + b2;
  1358. X         }
  1359. X      } while(x1!=x2 || y1!=y2);
  1360. X   }
  1361. X
  1362. X/*----------------------------------------------------------------------*/
  1363. X
  1364. X#define sq(x) ((long)(x)*(x))
  1365. X#define    sgn(x)    ((x)<0? -1 : (x)==0? 0 : 1)
  1366. X
  1367. Xstatic long
  1368. XLabs(x)
  1369. Xlong x;
  1370. X   {
  1371. X   return(x<0? -x : x);
  1372. X   }
  1373. X
  1374. X/*    Draw an approximate arc centered at x0,y0 of an
  1375. X *    integer grid and running anti-clockwise from
  1376. X *    x1,y1 to the vicinity of x2,y2.
  1377. X *    If the endpoints coincide, draw a complete circle.
  1378. X *
  1379. X *    The "arc" is a sequence of vertically, horizontally,
  1380. X *    or diagonally adjacent points that minimize 
  1381. X *    abs(x^2+y^2-r^2).
  1382. X *
  1383. X *    The circle is guaranteed to be symmetric about
  1384. X *    the horizontal, vertical, and diagonal axes
  1385. X */
  1386. X
  1387. Xarc(bp, x0,y0, x2,y2, x1,y1, f)
  1388. Xregister BITMAP *bp;
  1389. Xint x0,y0,x1,y1,x2,y2;
  1390. X   {
  1391. X   register dx, dy;
  1392. X   register eps;   /* x^2 + y^2 - r^2 */
  1393. X   int dxsq, dysq;   /* (x+dx)^2-x^2, ...*/
  1394. X   int ex, ey, exy;
  1395. X
  1396. X   x1=x1-x0;
  1397. X   y1=y1-y0;
  1398. X   x2=x2-x0;
  1399. X   y2=y2-y0;
  1400. X
  1401. X   nearby(x1,y1,x2,y2, &x2, &y2);
  1402. X
  1403. X   dx = -sgn(y1);
  1404. X   dy = sgn(x1);
  1405. X   dxsq = (2*x1 + dx)*dx;
  1406. X   dysq = (2*y1 + dy)*dy;
  1407. X   eps = 0;
  1408. X   do {
  1409. X      if(x1 == 0) {
  1410. X         dy = -sgn(y1);
  1411. X         dysq = (2*y1 + dy)*dy;
  1412. X         }
  1413. X      else if(y1 == 0) {
  1414. X         dx = -sgn(x1);
  1415. X         dxsq = (2*x1 + dx)*dx;
  1416. X         }
  1417. X      ex = abs(eps + dxsq);
  1418. X      ey = abs(eps + dysq);
  1419. X      exy = abs(eps + dxsq + dysq);
  1420. X      if(ex<ey || exy<=ey) {
  1421. X         x1 += dx;
  1422. X         eps += dxsq;
  1423. X         dxsq += 2;
  1424. X         }
  1425. X      if(ey<ex || exy<=ex) {
  1426. X         y1 += dy;
  1427. X         eps += dysq;
  1428. X         dysq += 2;
  1429. X         }
  1430. X      bit_point(bp,x0+x1, y0+y1,f);
  1431. X      /* bit_blit(bp,x0+x1-1,y0+y1-1,2,2,f,NULL_DATA,0,0); */
  1432. X      }
  1433. X   while(!(x1==x2 && y1==y2));   /* Note1 */
  1434. X   }
  1435. X
  1436. X/*   Note1: the equality end test is justified
  1437. X *   because it is impossible that
  1438. X *   abs(x^2+y^2-r^2)==abs((x+\010+-1)^2+y^2-r^2) or
  1439. X *   abs(x^2+y^2-r^2)==abs(x^2+(y+\010+-1)-r^2),
  1440. X *   and no values of x or y are skipped.
  1441. X *
  1442. X */
  1443. X
  1444. Xnearby(x1,y1, x2,y2, rx, ry)
  1445. Xregister int x1, y1, x2, y2;
  1446. Xint *rx, *ry;
  1447. X   {
  1448. X   long eps, exy, Labs();   /*integers but many bits*/
  1449. X   int d, dy;
  1450. X   register dx;
  1451. X   eps = sq(x2) + sq(y2) - sq(x1) - sq(y1);
  1452. X   d = eps>0? -1: 1;
  1453. X   for( ; ; eps=exy, x2+=dx, y2+=dy) {
  1454. X      if(abs(y2) > abs(x2)) {
  1455. X         dy = d*sgn(y2);
  1456. X         dx = 0;
  1457. X         }
  1458. X      else {
  1459. X         dy = 0;
  1460. X         dx = d*sgn(x2);
  1461. X         if(dx==0)
  1462. X            dx = 1;
  1463. X         }
  1464. X      exy = eps + (2*x2+dx)*dx + (2*y2+dy)*dy;
  1465. X      if(Labs(eps) <= Labs(exy))
  1466. X         break;
  1467. X      }
  1468. X   *rx = x2;
  1469. X   *ry = y2;
  1470. X   return(0);
  1471. X   }
  1472. END_OF_FILE
  1473. # end of 'src/graph_subs.c'
  1474. fi
  1475. echo shar: End of archive 23 \(of 61\).
  1476. cp /dev/null ark23isdone
  1477. MISSING=""
  1478. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 \
  1479.     21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 \
  1480.     38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 \
  1481.     55 56 57 58 59 60 61 ; do
  1482.     if test ! -f ark${I}isdone ; then
  1483.     MISSING="${MISSING} ${I}"
  1484.     fi
  1485. done
  1486. if test "${MISSING}" = "" ; then
  1487.     echo You have unpacked all 61 archives.
  1488.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1489. else
  1490.     echo You still need to unpack the following archives:
  1491.     echo "        " ${MISSING}
  1492. fi
  1493. ##  End of shell archive.
  1494. exit 0
  1495.