home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1516 < prev    next >
Internet Message Format  |  1990-12-28  |  62KB

  1. From: glenn@extro.ucc.su.oz.au (Glenn Geers)
  2. Newsgroups: alt.sources
  3. Subject: GhostScript driver for SCO Xenix/Unix 386
  4. Message-ID: <1990Jun27.225635.2697@metro.ucc.su.OZ.AU>
  5. Date: 27 Jun 90 22:56:35 GMT
  6.  
  7. Hi,
  8.     This is my first source posting so if I've done anything wrong
  9. would someone be kind enough to tell me.
  10.  
  11. The enclosed shar file contains various files needed to port GhostScript
  12. 1.4beta3 to Xenix/386. I haven't tried gs 1.3 but I think it still all should
  13. hold together. You also get a cheap BSD gettimeofday() for SYSV. Defining
  14. SYSV in the gs makefile did not seem to get rid of the calls to gettimeofday
  15. so I hacked one together. It's reasonable, but I woudln't use the microsecond
  16. count for anything critical - no it's not set to zero but to get the 
  17. functionality of gettimeofday I've used three system calls -:)
  18.  
  19. Anyway, you'll find an example of how to direct port i/o by raising the
  20. i/o privilege of a user task. This is a compile time option.
  21.  
  22. The recommended compiler is gcc.
  23.  
  24. As usual it's all covered by the GNU public license. So if your monitor
  25. melts it ain't my fault -:)
  26.  
  27.         Share and Enjoy,
  28.                 Glenn
  29.  
  30.  
  31. ---- Cut Here and unpack ----
  32. #!/bin/sh
  33. # shar:    Shell Archiver  (v1.22)
  34. #
  35. #    Run the following text with /bin/sh to create:
  36. #      README.XENIX
  37. #      bsdtime.h
  38. #      gdevxenix.c
  39. #      gdevxenix.h
  40. #      gp_unix.pat
  41. #      gtd.c
  42. #      makefile.cc
  43. #      makefile.gcc
  44. #
  45. if test -f README.XENIX; then echo "File README.XENIX exists"; else
  46. echo "x - extracting README.XENIX (Text)"
  47. sed 's/^X//' << 'SHAR_EOF' > README.XENIX &&
  48. XThis is the README file for the netwide release of the Xenix VGA GhostScript
  49. Xdriver.
  50. X
  51. XThe fastest possible interpreter is made using gcc. I am using undocumented
  52. Xfeatures of Xenix to get high speed. Please read gdevxenix.h and #undef
  53. XUSEASM if you don't want to make your interpreter setuid 0. You should
  54. X#undef USEASM in any case if you are not using gcc.
  55. XPlease note that on SCO UNIX you don't need have gs setuid 0 to use the 
  56. Xassembler code. This is because SCO UNIX uses the TSS bitmaps to check I/O
  57. Xprivilege. It doesn't just change the 386's status word. This stuff *is*
  58. Xdocumented in SCO UNIX 3.2. 
  59. XOn Xenix, if you issue ioctl(fd, VGA_IOPRIVL, 1), you can effectively have
  60. Xyour way with all of the machine hardware which may be dangerous.
  61. X
  62. XI have not done all port accesses using assembler - the fill routine is
  63. Xfairly fast as is. I will implement it in assembler when I get the urge.
  64. XIf anyone out there does implement it in assembler would you please post
  65. Xme the result.
  66. X
  67. XIn order to get all this stuff to work you need GhostScript 1.4beta3. This is
  68. Xavailable by anonymous ftp from extro.ucc.su.oz.au (IP: 129.78.64.1). It is
  69. Xin the directory archive/gnu. I know of no other sites with this version
  70. Xavailable. I'm hoping that no major device interface changes occur between
  71. Xwhat I have and the official release.
  72. X
  73. XThere are a few things that need to be pointed out before you start compiling
  74. XGhostScript.
  75. X
  76. X0. Apply the patch
  77. X1. Copy bsdtime.h /usr/include/sys/bsdtime.h if you can. Otherwise edit
  78. Xgp_unix.c and make the relevant change.
  79. XType
  80. X    [g]cc -O -c gtd.c
  81. X
  82. Xand stick gtd.o into /lib/386/Slibx.a if you can. Otherwise edit the chosen
  83. Xmakefile to include gtd.o as a required object.
  84. X
  85. X2. Use the makefile.[gcc,cc] distributed with these patches - it is broken just 
  86. Xlike the others -:) Copy the relevant one to makefile.
  87. X3. type:
  88. X    make gdevxenix.o
  89. X4. Hand compile gsline.c if you are using gcc - the optimiser fails on this.
  90. X    gcc -DSYSV -c gsline.c
  91. X   OR
  92. X    make ansi2knr
  93. X    ansi2knr gsline.c _z.c
  94. X    cc -Ox -CSON -DSYSV -c _z.c     (works ok)
  95. X    rm _z.c
  96. X    mv _z.o gsline.o
  97. X5. type
  98. X    make xenix.dev <- this should happen automatically: the makefile is 
  99. Xbroken.
  100. X6. (at last) type
  101. X    make
  102. X
  103. XTry gs golfer.ps.
  104. X
  105. XNote that GNU C is the recommended compiler. I have the 2.2 DS and I can't
  106. Xget GhostScript to compile using it. Would someone with a later compiler
  107. Xhave a shot and let me know the result? The problems is in gsmain.c and 
  108. Xhas to do with pointers to functions. I could fix it but I don't really want
  109. Xto touch GhostScript proper if I can help it.
  110. X
  111. X            Thanks,
  112. X                Glenn
  113. X
  114. Xglenn@extro.ucc.su.oz.au
  115. SHAR_EOF
  116. chmod 0644 README.XENIX || echo "restore of README.XENIX fails"
  117. set `wc -c README.XENIX`;Sum=$1
  118. if test "$Sum" != "2596"
  119. then echo original size 2596, current size $Sum;fi
  120. fi
  121. if test -f bsdtime.h; then echo "File bsdtime.h exists"; else
  122. echo "x - extracting bsdtime.h (Text)"
  123. sed 's/^X//' << 'SHAR_EOF' > bsdtime.h &&
  124. X/*
  125. X** Minimal BSD sys/time.h clone
  126. X*/
  127. X
  128. X/*
  129. X * Structure returned by gettimeofday(2) system call,
  130. X * and used in other calls.
  131. X */
  132. X
  133. Xstruct timeval {
  134. X    long    tv_sec;        /* seconds */
  135. X    long    tv_usec;    /* and microseconds */
  136. X};
  137. X
  138. Xstruct timezone {
  139. X    int    tz_minuteswest;    /* minutes west of Greenwich */
  140. X    int    tz_dsttime;    /* type of dst correction */
  141. X};
  142. SHAR_EOF
  143. chmod 0644 bsdtime.h || echo "restore of bsdtime.h fails"
  144. set `wc -c bsdtime.h`;Sum=$1
  145. if test "$Sum" != "337"
  146. then echo original size 337, current size $Sum;fi
  147. fi
  148. if test -f gdevxenix.c; then echo "File gdevxenix.c exists"; else
  149. echo "x - extracting gdevxenix.c (Text)"
  150. sed 's/^X//' << 'SHAR_EOF' > gdevxenix.c &&
  151. Xstatic char rcsid[] = "$Header: gdevxenix.c,v 1.4 90/06/24 12:18:17 root Exp $";
  152. X
  153. X/* Copyright (C) 1989, 1990 Aladdin Enterprises.  All rights reserved.
  154. X   Distributed by Free Software Foundation, Inc.
  155. X
  156. XThis file is part of Ghostscript.
  157. X
  158. XGhostscript is distributed in the hope that it will be useful, but
  159. XWITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  160. Xto anyone for the consequences of using it or for whether it serves any
  161. Xparticular purpose or works at all, unless he says so in writing.  Refer
  162. Xto the Ghostscript General Public License for full details.
  163. X
  164. XEveryone is granted permission to copy, modify and redistribute
  165. XGhostscript, but only under the conditions described in the Ghostscript
  166. XGeneral Public License.  A copy of this license is supposed to have been
  167. Xgiven to you along with Ghostscript so you can know your rights and
  168. Xresponsibilities.  It should be in a file named COPYING.  Among other
  169. Xthings, the copyright notice and this notice must be preserved on all
  170. Xcopies.  */
  171. X
  172. X/* gdevxenix.c */
  173. X
  174. X/* Ghostscript driver for Xenix/386 with VGA or EGA */
  175. X
  176. X#include "gdevxenix.h"
  177. X
  178. X/* See gxdevice.h for the definitions of the procedures. */
  179. X
  180. Xtypedef struct gx_device_s gx_device;
  181. X
  182. Xint xenix_open(P1(gx_device *));
  183. X
  184. Xint xenix_close(P1(gx_device *));
  185. X
  186. Xgx_color_index xenix_map_rgb_color(P4(gx_device *, ushort, ushort, ushort));
  187. X
  188. Xint xenix_map_color_rgb(P3(gx_device *, gx_color_index, ushort *));
  189. X
  190. Xint xenix_fill_rectangle(P6(gx_device *, int, int, int, int, gx_color_index));
  191. X
  192. Xint xenix_tile_rectangle(P8(gx_device *, gx_bitmap *, int, int, int, int, gx_color_index, gx_color_index));
  193. X
  194. Xint xenix_copy_mono(P10(gx_device *, unsigned char *, int, int, int, int, int, int, gx_color_index, gx_color_index));
  195. X
  196. Xint xenix_copy_color(P8(gx_device *, unsigned char *, int, int, int, int, int, int));
  197. X
  198. Xint xenix_draw_line(P6(gx_device *, int, int, int, int, gx_color_index));
  199. X
  200. X/* The device descriptor */
  201. Xprivate gx_device_procs xenix_procs = {
  202. X    xenix_open,
  203. X    gx_default_get_initial_matrix,
  204. X    gx_default_sync_output,
  205. X    gx_default_output_page,
  206. X    xenix_close,
  207. X    xenix_map_rgb_color,
  208. X    xenix_map_color_rgb,
  209. X    xenix_fill_rectangle,
  210. X    xenix_tile_rectangle,
  211. X    xenix_copy_mono,
  212. X    xenix_copy_color,
  213. X    xenix_draw_line,
  214. X    gx_default_fill_trapezoid,
  215. X    gx_default_tile_trapezoid
  216. X};
  217. X
  218. X#if defined(VGADEV)
  219. X#define aspect_ratio    1.0
  220. X#else
  221. X#define aspect_ratio    (14.0/11.0)
  222. X#endif
  223. X
  224. Xgx_device gs_xenix_device = {
  225. X    sizeof(gx_device),
  226. X    &xenix_procs,
  227. X    "xenix-vga",
  228. X    NX, NY,
  229. X    (NY*aspect_ratio)/11.0, NY/11.0,
  230. X    1,
  231. X    2,
  232. X    4,
  233. X    0        /* not open yet */
  234. X};
  235. X
  236. X
  237. X/* Open the driver for graphics mode */
  238. Xint
  239. Xxenix_open(gx_device *dev)
  240. X{
  241. X#if defined(VGADEV) || defined(EGASIM)
  242. X    if ((devfd = open("/dev/vga", O_WRONLY)) == -1) {
  243. X#else
  244. X    if ((devfd = open("/dev/ega", O_WRONLY)) == -1) {
  245. X#endif
  246. X        fprintf(stderr, "Cannot open device - FATAL\n");
  247. X        exit(1);
  248. X    }
  249. X
  250. X#if defined(VGADEV) || defined(EGASIM)
  251. X    ioctl(devfd, SWAPVGA, 0);    /* select vga */
  252. X#else
  253. X    ioctl(devfd, SWAPEGA, 0);    /* select ega */
  254. X#endif
  255. X
  256. X#if defined(USEASM)
  257. X    setpriv(RAISEPRIV);
  258. X#endif
  259. X
  260. X#if defined(VGADEV)
  261. X    ioctl(devfd, SW_VGA12, 0);     /* Switch to graphics mode */
  262. X#else 
  263. X    ioctl(devfd, SW_ENH_CG640);     /* Switch to graphics mode */
  264. X#endif
  265. X
  266. X#if defined(VGADEV) || defined(EGASIM)
  267. X    vidmem = (char *)ioctl(devfd, MAPVGA, 0); /* map in video ram */
  268. X#else
  269. X    vidmem = (char *)ioctl(devfd, MAPEGA, 0); /* map in video ram */
  270. X#endif
  271. X
  272. X    return 0;
  273. X}
  274. X
  275. X
  276. X/* Close the driver */
  277. Xint
  278. Xxenix_close(gx_device *dev)
  279. X{    
  280. X#if defined(USEASM)
  281. X    setpriv(REDUCPRIV);
  282. X#endif
  283. X
  284. X#if defined(VGADEV) || defined(EGASIM)
  285. X    ioctl(devfd, SW_VGA80x25, 0);
  286. X#else
  287. X    ioctl(devfd, SW_ENHC80x25, 0);
  288. X#endif
  289. X    close(devfd);
  290. X    return 0;
  291. X}
  292. X
  293. X/* Map a r-g-b color to the 16 colors available with an EGA/VGA video card. */
  294. X/* r, g, b are between 0 and 2. */
  295. Xprivate char rgb_color[3][3][3] =
  296. X  { { { BLACK, BLUE, LIGHTBLUE },
  297. X      { GREEN, CYAN, LIGHTCYAN },
  298. X      { LIGHTGREEN, LIGHTCYAN, LIGHTCYAN } },
  299. X    { { RED, MAGENTA, LIGHTMAGENTA },
  300. X      { BROWN, LIGHTGRAY, LIGHTBLUE },
  301. X      { YELLOW, YELLOW, WHITE } },
  302. X    { { LIGHTRED, LIGHTMAGENTA, LIGHTMAGENTA },
  303. X      { YELLOW, YELLOW, LIGHTMAGENTA },
  304. X      { YELLOW, YELLOW, WHITE } }
  305. X  };
  306. X
  307. Xgx_color_index
  308. Xxenix_map_rgb_color(gx_device *dev, ushort r, ushort g, ushort b)
  309. X{
  310. X    if ( dev->has_color )
  311. X       {    return (gx_color_index)rgb_color[r][g][b];
  312. X       }
  313. X    else
  314. X       {    if ( r > 0 || g > 0 || b > 0 )
  315. X            return (gx_color_index)WHITE;
  316. X        else
  317. X            return (gx_color_index)BLACK;
  318. X       }
  319. X}
  320. X
  321. X
  322. X/* Map a color code to r-g-b.  Surprisingly enough, this is algorithmic. */
  323. Xint
  324. Xxenix_map_color_rgb(gx_device *dev, gx_color_index color, ushort *prgb)
  325. X{    int on = (color & 8 ? 2 : 1);
  326. X    prgb[0] = (color & 4 ? on : 0);
  327. X    prgb[1] = (color & 2 ? on : 0);
  328. X    prgb[2] = (color & 1 ? on : 0);
  329. X    return 0;
  330. X}
  331. X
  332. X
  333. X/* Copy a monochrome bitmap.  The colors are given explicitly. */
  334. X/* Color = gx_no_color_index means transparent (no effect on the image). */
  335. Xint
  336. Xxenix_copy_mono(gx_device *dev, byte *base, int sourcex, int raster,
  337. X  int x, int y, int w, int h,
  338. X  gx_color_index zero, gx_color_index one)
  339. X{    byte *ptr_line = base + (sourcex >> 3);
  340. X    int left_bit = 0x80 >> (sourcex & 7);
  341. X    int dest_y = y, end_x = x + w;
  342. X    int invert = 0;
  343. X    int color;
  344. X
  345. X    if ( zero == gx_no_color_index )
  346. X       {    if ( one == gx_no_color_index ) return 0;
  347. X        color = (int)one;
  348. X       }
  349. X    else
  350. X       {    if ( one == gx_no_color_index )
  351. X           {    color = (int)zero;
  352. X            invert = -1;
  353. X           }
  354. X        else
  355. X           {    /* Pre-clear the rectangle to zero */
  356. X            fillrect(x, y, x + w - 1, y + h - 1,0,0x00);
  357. X            color = (int)one;
  358. X           }
  359. X       }
  360. X
  361. X    setcolor(color);
  362. X
  363. X    while ( h-- )              /* for each line */
  364. X       {    byte *ptr_source = ptr_line;
  365. X        register int dest_x = x;
  366. X        register int bit = left_bit;
  367. X        while ( dest_x < end_x )     /* for each bit in the line */
  368. X           {    if ( (*ptr_source ^ invert) & bit )
  369. X                monopix(dest_x, dest_y);
  370. X            dest_x++;
  371. X            if ( (bit >>= 1) == 0 )
  372. X                bit = 0x80, ptr_source++;
  373. X           }
  374. X        dest_y++;
  375. X        ptr_line += raster;
  376. X       }
  377. X    return 0;
  378. X}
  379. X
  380. X
  381. X/* Copy a color pixel map.  This is just like a bitmap, except that */
  382. X/* each pixel takes 4 bits instead of 1 when device driver has color. */
  383. Xint
  384. Xxenix_copy_color(gx_device *dev, byte *base, int sourcex, int raster,
  385. X  int x, int y, int w, int h)
  386. X{    
  387. X           /* color device, four bits per pixel */
  388. X        byte *line = base + (sourcex >> 1);
  389. X        int dest_y = y, end_x = x + w;
  390. X
  391. X        if ( w <= 0 ) return 0;
  392. X        while ( h-- )              /* for each line */
  393. X           {    byte *source = line;
  394. X            register int dest_x = x;
  395. X            if ( sourcex & 1 )    /* odd nibble first */
  396. X               {    int color =  *source++ & 0xf;
  397. X                colorpix(dest_x, dest_y, color);
  398. X                dest_x++;
  399. X               }
  400. X            /* Now do full bytes */
  401. X            while ( dest_x < end_x )
  402. X               {    int color = *source >> 4;
  403. X                colorpix(dest_x, dest_y, color);
  404. X                dest_x++;
  405. X                if ( dest_x < end_x )
  406. X                   {    color =  *source++ & 0xf;
  407. X                    colorpix(dest_x, dest_y, color);
  408. X                    dest_x++;
  409. X                   }
  410. X               }
  411. X            dest_y++;
  412. X            line += raster;
  413. X           }
  414. X    return 0;
  415. X}
  416. X
  417. X
  418. X/* Fill a rectangle. */
  419. Xint
  420. Xxenix_fill_rectangle(gx_device *dev, int x, int y, int w, int h,
  421. X  gx_color_index color)
  422. X{
  423. X    fillrect(x, y, x + w - 1, y + h - 1, color, 0xff);
  424. X    return 0;
  425. X}
  426. X
  427. X
  428. X/* Tile a rectangle.  If neither color is transparent, */
  429. X/* pre-clear the rectangle to color0 and just tile with color1. */
  430. X/* This is faster because of how xenix_copy_mono is implemented. */
  431. Xint
  432. Xxenix_tile_rectangle(gx_device *dev, gx_bitmap *tile,
  433. X  int x, int y, int w, int h, gx_color_index czero, gx_color_index cone)
  434. X{    if ( czero != gx_no_color_index && cone != gx_no_color_index )
  435. X       {    xenix_fill_rectangle(dev, x, y, w, h, czero);
  436. X        czero = gx_no_color_index;
  437. X       }
  438. X    return gx_default_tile_rectangle(dev, tile, x, y, w, h, czero, cone);
  439. X}
  440. X
  441. X
  442. X/* Draw a line */
  443. Xint
  444. Xxenix_draw_line(gx_device *dev, int x0, int y0, int x1, int y1,
  445. X  gx_color_index color)
  446. X{    setcolor((int)color);
  447. X    line(x0, y0, x1, y1);
  448. X    return 0;
  449. X}
  450. SHAR_EOF
  451. chmod 0644 gdevxenix.c || echo "restore of gdevxenix.c fails"
  452. set `wc -c gdevxenix.c`;Sum=$1
  453. if test "$Sum" != "7779"
  454. then echo original size 7779, current size $Sum;fi
  455. fi
  456. if test -f gdevxenix.h; then echo "File gdevxenix.h exists"; else
  457. echo "x - extracting gdevxenix.h (Text)"
  458. sed 's/^X//' << 'SHAR_EOF' > gdevxenix.h &&
  459. X/* $Header: gdevxenix.h,v 1.6 90/06/27 17:40:36 root Exp $ */
  460. X
  461. X/* Copyright (C) 1989, 1990 Aladdin Enterprises.  All rights reserved.
  462. X   Distributed by Free Software Foundation, Inc.
  463. X
  464. XThis file is part of Ghostscript.
  465. X
  466. XGhostscript is distributed in the hope that it will be useful, but
  467. XWITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  468. Xto anyone for the consequences of using it or for whether it serves any
  469. Xparticular purpose or works at all, unless he says so in writing.  Refer
  470. Xto the Ghostscript General Public License for full details.
  471. X
  472. XEveryone is granted permission to copy, modify and redistribute
  473. XGhostscript, but only under the conditions described in the Ghostscript
  474. XGeneral Public License.  A copy of this license is supposed to have been
  475. Xgiven to you along with Ghostscript so you can know your rights and
  476. Xresponsibilities.  It should be in a file named COPYING.  Among other
  477. Xthings, the copyright notice and this notice must be preserved on all
  478. Xcopies.  */
  479. X
  480. X/* gdevxenix.h */
  481. X
  482. X#include "gx.h"
  483. X#include "gsmatrix.h"            /* for gxdevice.h */
  484. X#include "gxbitmap.h"
  485. X#include "gxdevice.h"
  486. X
  487. X/* VGA/EGA and Xenix specific */
  488. X
  489. X#include <fcntl.h>             /* for O_WRONLY */
  490. X#include <sys/machdep.h>        /* adapter specifics */
  491. X
  492. X/* Colours */
  493. X
  494. X#define BLACK         0
  495. X#define BLUE         1
  496. X#define GREEN         2
  497. X#define CYAN         3
  498. X#define RED         4
  499. X#define MAGENTA     5
  500. X#define BROWN         6
  501. X#define LIGHTGRAY     7
  502. X#define DARKGRAY     8
  503. X#define LIGHTBLUE     9
  504. X#define LIGHTGREEN     10
  505. X#define LIGHTCYAN     11
  506. X#define LIGHTRED     12
  507. X#define LIGHTMAGENTA     13
  508. X#define YELLOW         14
  509. X#define WHITE         15
  510. X
  511. X/* Device specifics */
  512. X
  513. X#define VGADEV         /* udefine this for EGA */
  514. X#undef EGASIM         /* define this to simulate an EGA on a VGA */
  515. X
  516. X/*
  517. X** Define the next macro if you want real speed.
  518. X** Only do so if you are using GNU C
  519. X** For the pivelege stuff to work under Xenix you have to invoke 
  520. X** the program as root or make it setuid 0
  521. X** On SCO UNIX the program does not have to be setuid 0
  522. X*/
  523. X
  524. X#define USEASM
  525. X
  526. X#define REDUCPRIV    0
  527. X#define RAISEPRIV    1
  528. X
  529. X#define NX     640
  530. X#if defined(VGADEV)
  531. X#define NY     480
  532. X#else
  533. X#define NY     350
  534. X#endif
  535. X
  536. X#define GCTL     0x3ce
  537. X#define SEQCTL     0x3c4
  538. X
  539. X#if defined(__GNUC__)
  540. X#define INLINE     inline
  541. X#else
  542. X#define INLINE
  543. X#endif
  544. X
  545. X/*
  546. X* This is only a macro because its easier 
  547. X* to substitute different routines
  548. X*/
  549. X#define VGAREGOUT2(a) outp2(a);
  550. X
  551. Xprivate char *vidmem;   /* Pointer to virtual address of start of video ram */
  552. Xprivate int devfd;     /* fd for /dev/vga */
  553. Xprivate unsigned char mask;
  554. X
  555. Xprivate void INLINE outp2(P1(short));
  556. Xprivate void INLINE setcolor(P1(unsigned char));
  557. Xprivate void INLINE vgaout(P3(unsigned short, unsigned char, unsigned char));
  558. Xprivate int INLINE line(P4(int, int, int, int));
  559. Xprivate void INLINE monopix(P2(int, int));
  560. Xprivate void INLINE colorpix(P3(int, int, unsigned char));
  561. Xprivate void INLINE fillrect(P6(int,int,int,int,unsigned char,unsigned char));
  562. Xprivate void INLINE setpriv(P1(int));
  563. X
  564. Xprivate void INLINE
  565. Xsetcolor(unsigned char color)
  566. X{ 
  567. X    VGAREGOUT2(5);          
  568. X    VGAREGOUT2(color<<8);
  569. X    VGAREGOUT2(0x0f01);
  570. X}
  571. X
  572. Xprivate int INLINE
  573. Xline(int x1,int y1,int x2,int y2)
  574. X{
  575. X    int width,deltax,deltay;
  576. X    unsigned int xpos,ypos,i;
  577. X    int xinc,yinc,error;
  578. X
  579. X    xpos = x1;
  580. X    ypos = y1;
  581. X
  582. X    deltax = x2 - x1;
  583. X    deltay = y2 - y1;
  584. X
  585. X    if (deltax < 0) {
  586. X            deltax = -deltax;
  587. X            xinc = -1;
  588. X        }
  589. X    else
  590. X        xinc = 1;
  591. X
  592. X    if (deltay < 0) {
  593. X        deltay = -deltay;
  594. X            yinc = -1;
  595. X        }
  596. X    else
  597. X            yinc = 1;
  598. X
  599. X    if (deltax == 0) {
  600. X            deltay++;
  601. X            while(deltay>0) {
  602. X                    monopix(x1,ypos);
  603. X                    ypos += yinc;
  604. X                    deltay-- ;
  605. X                }
  606. X            return;
  607. X        }
  608. X
  609. X    if (deltay == 0) {
  610. X            deltax++;
  611. X            while(deltax>0) {
  612. X                    monopix(xpos,y1);
  613. X                    xpos += xinc;
  614. X                    deltax-- ;
  615. X                }
  616. X            return;
  617. X        }
  618. X
  619. X    if (deltax > deltay) {
  620. X            deltay <<= 1;
  621. X            error = deltay - deltax;
  622. X            deltax = deltay - (deltax << 1);
  623. X            while (xpos != x2) {
  624. X                    monopix(xpos,ypos);
  625. X                    xpos += xinc;
  626. X                    if (error > 0) {
  627. X                            ypos += yinc;
  628. X                            error += deltax;
  629. X                        }
  630. X                    else
  631. X                            error += deltay;
  632. X                }
  633. X            monopix(xpos,ypos);
  634. X            return;
  635. X        }
  636. X
  637. X    deltax <<= 1;
  638. X    error = deltax - deltay;
  639. X    deltay = deltax - ( deltay << 1);
  640. X    while (ypos != y2) {
  641. X            monopix(xpos,ypos);
  642. X            ypos += yinc;
  643. X            if (error > 0) {
  644. X                    xpos += xinc;
  645. X                    error += deltay;
  646. X                }
  647. X            else
  648. X                    error += deltax;
  649. X           }
  650. X    monopix(xpos,ypos);
  651. X}
  652. X
  653. X/* colour each pixel separately */
  654. Xprivate void INLINE
  655. Xcolorpix(int column, int row, unsigned char color)
  656. X{
  657. X    unsigned int byte;
  658. X
  659. X    mask = 128 >> (column & 7);
  660. X    byte = row << 6;
  661. X    byte += row << 4;
  662. X    byte += column >> 3;
  663. X
  664. X    VGAREGOUT2(5);          
  665. X    VGAREGOUT2(color<<8);
  666. X    VGAREGOUT2(0x0f01);
  667. X    VGAREGOUT2(mask<<8 | 8);
  668. X
  669. X    vidmem[byte] |= mask;
  670. X}
  671. X
  672. X/* use setcolor to set the pixel color before drawing */
  673. Xprivate void INLINE
  674. Xmonopix(int col, int row)
  675. X{
  676. X    unsigned int byte;
  677. X
  678. X    mask = 128 >> (col & 7);
  679. X
  680. X    byte = row << 6;
  681. X    byte += row << 4;
  682. X    byte += col >> 3;
  683. X
  684. X    VGAREGOUT2(mask<<8 | 8);
  685. X    vidmem[byte] |= mask;
  686. X}
  687. X
  688. Xprivate void INLINE
  689. Xfillrect(int x,int y,int x1,int y1,unsigned char color,unsigned char pattern)
  690. X{
  691. X    unsigned int byte;
  692. X    unsigned char bit, bit1;
  693. X    int i, j, k;
  694. X
  695. X    setcolor(color);
  696. X
  697. X    bit = 0xff >> (x & 7);
  698. X    x >>= 3;
  699. X
  700. X    bit1 = 0x7f >> (x1 & 7);
  701. X    bit1 ^= 0xff; 
  702. X    x1 >>= 3;
  703. X
  704. X    vgaout(GCTL,8,0xff);
  705. X    vgaout(SEQCTL,2,0xff);
  706. X
  707. X    for(j=y; j<y1+1; j++) {
  708. X             for(i=x+1;i<x1;i++) {
  709. X              byte = j << 6;
  710. X              byte += j << 4;
  711. X              byte += i;
  712. X                  vidmem[byte] &= 0x00;
  713. X              }
  714. X         }
  715. X
  716. X    vgaout(GCTL,8,pattern);
  717. X    vgaout(SEQCTL,2,color & 15);
  718. X
  719. X    for(j=y; j<y1+1; j++) {
  720. X             for(i=x+1; i<x1; i++) {
  721. X              byte = j << 6;
  722. X              byte += j << 4;
  723. X              byte += i;
  724. X                  vidmem[byte] |= 0xff;
  725. X            }
  726. X         }
  727. X
  728. X    vgaout(GCTL,8,bit);
  729. X    vgaout(SEQCTL,2,0xff);
  730. X
  731. X    for(j=y; j<y1+1; j++) {
  732. X        byte = j << 6;
  733. X          byte += j << 4;
  734. X          byte += x;
  735. X             vidmem[byte] &= (bit^0xff);
  736. X         }
  737. X
  738. X    bit &=pattern;
  739. X
  740. X    vgaout(GCTL,8,bit);
  741. X    vgaout(SEQCTL,2,color & 15);
  742. X
  743. X    for(j=y; j<y1+1; j++) {
  744. X          byte = j << 6;
  745. X          byte += j << 4;
  746. X          byte += x;
  747. X             vidmem[byte] |= 0xff;
  748. X         }
  749. X
  750. X    vgaout(GCTL,8,bit1);
  751. X    vgaout(SEQCTL,2,0xff);
  752. X
  753. X    for(j=y;j<y1+1;j++) {
  754. X          byte = j << 6;
  755. X          byte += j << 4;
  756. X          byte += x1;
  757. X             vidmem[byte] &= (bit1^0xff);
  758. X         }
  759. X
  760. X    bit1 &= pattern;
  761. X
  762. X    vgaout(GCTL,8,bit1);
  763. X    vgaout(SEQCTL,2,color & 15);
  764. X    
  765. X    for(j=y; j<y1+1; j++) {
  766. X        byte = j << 6;
  767. X        byte += j << 4;
  768. X        byte += x1;
  769. X        vidmem[byte] |= 0xff;
  770. X    }
  771. X
  772. X    vgaout(SEQCTL,2,0xff);
  773. X    vgaout(GCTL,3,0);
  774. X    vgaout(GCTL,8,0xff);
  775. X}
  776. X
  777. Xprivate void INLINE
  778. Xvgaout(unsigned short port,unsigned char index,unsigned char data)
  779. X{
  780. X    struct port_io_arg op;
  781. X
  782. X    op.args[1].dir = op.args[0].dir = OUT_ON_PORT;
  783. X    op.args[0].port = port;
  784. X    op.args[0].data = index & 0xff;
  785. X
  786. X    op.args[1].port = port+1;
  787. X    op.args[1].data = data & 0xff;
  788. X
  789. X    op.args[2].port = op.args[3].port = 0x00;
  790. X
  791. X    ioctl(devfd, VGAIO, &op);
  792. X}
  793. X
  794. Xvoid INLINE
  795. Xoutp2(short data)
  796. X{
  797. X#if !defined(USEASM)
  798. X    struct port_io_arg op;
  799. X
  800. X    op.args[1].dir = op.args[0].dir = OUT_ON_PORT;
  801. X
  802. X    op.args[0].port = GCTL;
  803. X    op.args[0].data = data&0xff;
  804. X
  805. X    op.args[1].port = GCTL+1;
  806. X    op.args[1].data = (data&0xff00)>>8;
  807. X
  808. X    op.args[2].port = op.args[3].port = 0x00;
  809. X
  810. X    ioctl(devfd, VGAIO, &op);
  811. X#else
  812. X    asm("movw 8(%ebp),%cx");
  813. X    asm("movw %cx,8(%ebp)");
  814. X    asm("movw %cx,%dx");
  815. X    asm("andw $255,%dx");
  816. X    asm("movswl %dx,%eax");
  817. X
  818. X    asm("movswl 8(%ebp),%ecx");
  819. X    asm("andl $65280,%ecx");
  820. X    asm("sarl $8,%ecx");
  821. X    
  822. X    asm("mov $0x03ce, %dx");
  823. X    asm("out %al, %dx");
  824. X    asm("inc %dx");
  825. X    asm("mov %cl, %al");
  826. X    asm("out %al, %dx");
  827. X#endif
  828. X}
  829. X
  830. Xvoid INLINE
  831. Xsetpriv(int priv)
  832. X{
  833. X    if (ioctl(devfd, VGA_IOPRIVL, priv) == -1) {
  834. X        xenix_close();
  835. X        fprintf(stderr, "Cannot set privelege level\n");
  836. X        exit(1);
  837. X    }
  838. X}
  839. SHAR_EOF
  840. chmod 0644 gdevxenix.h || echo "restore of gdevxenix.h fails"
  841. set `wc -c gdevxenix.h`;Sum=$1
  842. if test "$Sum" != "7924"
  843. then echo original size 7924, current size $Sum;fi
  844. fi
  845. if test -f gp_unix.pat; then echo "File gp_unix.pat exists"; else
  846. echo "x - extracting gp_unix.pat (Text)"
  847. sed 's/^X//' << 'SHAR_EOF' > gp_unix.pat &&
  848. X*** ../orig/gp_unix.c    Fri Jan 26 05:31:20 1990
  849. X--- gp_unix.c    Sun Jun 17 11:43:15 1990
  850. X***************
  851. X*** 20,27 ****
  852. X  /* gp_unix.c */
  853. X  /* Unix-specific routines for Ghostscript */
  854. X  #include "gx.h"
  855. X! #include <sys/time.h>
  856. X! #include <sys/resource.h>
  857. X  
  858. X  /* Do platform-dependent initialization */
  859. X  void
  860. X--- 20,28 ----
  861. X  /* gp_unix.c */
  862. X  /* Unix-specific routines for Ghostscript */
  863. X  #include "gx.h"
  864. X! #include <sys/bsdtime.h>
  865. X! /* #include "bsdtime.h" */
  866. X! #include <time.h>
  867. X  
  868. X  /* Do platform-dependent initialization */
  869. X  void
  870. SHAR_EOF
  871. chmod 0644 gp_unix.pat || echo "restore of gp_unix.pat fails"
  872. set `wc -c gp_unix.pat`;Sum=$1
  873. if test "$Sum" != "536"
  874. then echo original size 536, current size $Sum;fi
  875. fi
  876. if test -f gtd.c; then echo "File gtd.c exists"; else
  877. echo "x - extracting gtd.c (Text)"
  878. sed 's/^X//' << 'SHAR_EOF' > gtd.c &&
  879. Xstatic char rcsid[] = "$Header: gtd.c,v 1.3 90/04/01 19:56:14 glenn Exp $";
  880. X
  881. X/*
  882. X** Approximation of BSD gettimeofday(2) for Sys V (Xenix at least)
  883. X** Should work on a 286 - I think I've got all the casts right!
  884. X** D. Glenn Geers 2/90
  885. X*/
  886. X
  887. X#include <sys/types.h>
  888. X#include <sys/timeb.h>
  889. X#include <sys/bsdtime.h>
  890. X/* #include "bsdtime.h" */
  891. X#include <time.h>
  892. X#include <errno.h>
  893. X
  894. Xextern int errno;
  895. X
  896. Xint
  897. Xgettimeofday(tp, tzp)
  898. Xstruct timeval *tp;
  899. Xstruct timezone *tzp;
  900. X{
  901. X    long clock;
  902. X    struct timeb *now;
  903. X    struct tm *localnow;
  904. X
  905. X    now = (struct timeb *)malloc(sizeof(struct timeb));
  906. X    localnow = (struct tm *)malloc(sizeof(struct tm));
  907. X
  908. X    clock = time(0);
  909. X    localnow = localtime(&clock);
  910. X
  911. X    ftime(now);
  912. X
  913. X/* Shouldn't fail - just for completeness and in case ... */
  914. X    if (errno == EFAULT) {
  915. X        errno = EFAULT; /*must set since EFAULT was set for this call */
  916. X        return(-1);
  917. X    }
  918. X
  919. X    if (tzp != (struct timezone *)0) {
  920. X        tzp->tz_minuteswest = (int)(localnow->tm_tzadj/60);
  921. X        tzp->tz_dsttime = (int)(localnow->tm_isdst);
  922. X    }
  923. X
  924. X    tp->tv_sec = (long)(now->time);
  925. X    tp->tv_usec = (long)(1000 * (long)(now->millitm));
  926. X
  927. X    return(0);
  928. X}
  929. SHAR_EOF
  930. chmod 0644 gtd.c || echo "restore of gtd.c fails"
  931. set `wc -c gtd.c`;Sum=$1
  932. if test "$Sum" != "1100"
  933. then echo original size 1100, current size $Sum;fi
  934. fi
  935. if test -f makefile.cc; then echo "File makefile.cc exists"; else
  936. echo "x - extracting makefile.cc (Text)"
  937. sed 's/^X//' << 'SHAR_EOF' > makefile.cc &&
  938. X#    Copyright (C) 1989, 1990 Aladdin Enterprises.  All rights reserved.
  939. X#    Distributed by Free Software Foundation, Inc.
  940. X#
  941. X# This file is part of Ghostscript.
  942. X#
  943. X# Ghostscript is distributed in the hope that it will be useful, but
  944. X# WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  945. X# to anyone for the consequences of using it or for whether it serves any
  946. X# particular purpose or works at all, unless he says so in writing.  Refer
  947. X# to the Ghostscript General Public License for full details.
  948. X#
  949. X# Everyone is granted permission to copy, modify and redistribute
  950. X# Ghostscript, but only under the conditions described in the Ghostscript
  951. X# General Public License.  A copy of this license is supposed to have been
  952. X# given to you along with Ghostscript so you can know your rights and
  953. X# responsibilities.  It should be in a file named COPYING.  Among other
  954. X# things, the copyright notice and this notice must be preserved on all
  955. X# copies.
  956. X
  957. X# makefile for Ghostscript, Unix/gcc/xenix configuration.
  958. X
  959. X# ------------------------------- Options ------------------------------- #
  960. X
  961. X####### The following are the only parts of the file you should need to edit.
  962. X
  963. X# ------ Generic options ------ #
  964. X
  965. X# Choose the device(s) to include.  See gdevs.mak for details.
  966. X
  967. XDEVICES=xenix
  968. X
  969. X# Choose generic configuration options.
  970. X
  971. X# -DDEBUG
  972. X#    includes debugging features (-Z switch) in the code.
  973. X#      Code runs substantially slower even if no debugging switches
  974. X#      are set.
  975. X# -DNOPRIVATE
  976. X#    makes private (static) procedures and variables public,
  977. X#      so they are visible to the debugger and profiler.
  978. X#      No execution time or space penalty.
  979. X
  980. XGENOPT= -Ox -CSON
  981. X
  982. X# ------ Platform-specific options ------ #
  983. X
  984. X# Define the name of the C compiler.
  985. X
  986. XCC=gcc
  987. X
  988. X# Define the other compilation flags.
  989. X# Add -DBSD4_2 for 4.2bsd systems.
  990. X# Add -DSYSV for System V.
  991. X# We don't include -ansi, because this gets in the way of the platform-
  992. X#   specific stuff that <math.h> typically needs.
  993. X# If you are running on SunOS 4.0.x, you must add a -D for the machine
  994. X#   type, or /usr/include/sys/ieeefp.h will fail to define
  995. X#   fp_direction_type, and so <math.h> won't pass the compiler, and so
  996. X#   zarith.c and many other files won't compile.  The right -D symbol for
  997. X#   the Sun-4 and SparcStation is -Dsparc; for the Sun-3, it is mc68000.
  998. X
  999. XCFLAGS= -O -DSYSV -fstrength-reduce -finline-functions
  1000. X
  1001. X# Define platform flags for ld.
  1002. X# Most Unix systems accept -X, but some don't.
  1003. X# Sun OS4.n may need -Bstatic.
  1004. X
  1005. XLDPLAT=
  1006. X
  1007. X# ---------------------------- End of options --------------------------- #
  1008. X
  1009. X# Define the name of the makefile -- used in dependencies.
  1010. X
  1011. XMAKEFILE=unix-gcc.mak
  1012. X
  1013. X# Define the extensions for the object and executable files.
  1014. X
  1015. XOBJ=o
  1016. XXE=
  1017. X
  1018. X# Define the ANSI-to-K&R dependency.  (gcc accepts ANSI syntax.)
  1019. X
  1020. XAK= ansi2knr
  1021. X
  1022. X# Define the compilation rules.
  1023. X
  1024. XCCFLAGS=$(GENOPT) $(CFLAGS)
  1025. X
  1026. X.c.o:
  1027. X    -ansi2knr $*.c _temp_.c
  1028. X    $(CC) $(CCFLAGS) -c _temp_.c
  1029. X    mv _temp_.o $*.o
  1030. X
  1031. XCCNA=./ccgs "$(CC) $(CCFLAGS)" _temp_.c
  1032. X
  1033. X# --------------------------- Generic makefile ---------------------------- #
  1034. X
  1035. X# The remainder of the makefile (ghost.mak, gdevs.mak, and unixtail.mak)
  1036. X# is generic.  tar_gs concatenates all these together.
  1037. X#    Copyright (C) 1989, 1990 Aladdin Enterprises.  All rights reserved.
  1038. X#    Distributed by Free Software Foundation, Inc.
  1039. X#
  1040. X# This file is part of Ghostscript.
  1041. X#
  1042. X# Ghostscript is distributed in the hope that it will be useful, but
  1043. X# WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  1044. X# to anyone for the consequences of using it or for whether it serves any
  1045. X# particular purpose or works at all, unless he says so in writing.  Refer
  1046. X# to the Ghostscript General Public License for full details.
  1047. X#
  1048. X# Everyone is granted permission to copy, modify and redistribute
  1049. X# Ghostscript, but only under the conditions described in the Ghostscript
  1050. X# General Public License.  A copy of this license is supposed to have been
  1051. X# given to you along with Ghostscript so you can know your rights and
  1052. X# responsibilities.  It should be in a file named COPYING.  Among other
  1053. X# things, the copyright notice and this notice must be preserved on all
  1054. X# copies.
  1055. X
  1056. X# Generic makefile for Ghostscript.
  1057. X# The platform-specific makefiles 'include' this file.
  1058. X# They define the following symbols:
  1059. X#    XE - the extension for executable files (e.g., null or .exe).
  1060. X#    OBJ - the extension for relocatable object files (e.g., o or obj).
  1061. X#    CCNA - the non-ANSI C invocation for files that on some platforms
  1062. X#        include in-line assembly code or other non-standard
  1063. X#        constructs.  Currently this is needed on every file that
  1064. X#        includes sstorei.h.
  1065. X#    AK - if source files must be converted from ANSI to K&R syntax,
  1066. X#        this is ansi2knr$(XE); if not, it is null.
  1067. X
  1068. Xdefault: gs$(XE)
  1069. X
  1070. Xtest: gt$(XE)
  1071. X
  1072. Xclean:
  1073. X    rm -f *.$(OBJ) *.a core
  1074. X    rm -f _temp_.* *.dev libc*.tl *.map gdevs.h gdevs.tl
  1075. X    rm -f ansi2knr$(XE)
  1076. X    rm -f gs$(XE) gs.sym
  1077. X
  1078. Xansi2knr$(XE):
  1079. X    cc -o ansi2knr$(XE) -O ansi2knr.c
  1080. X
  1081. X# Note: Unix uses malloc.h and memory.h;
  1082. X# Turbo C uses alloc.h, stdlib.h, and mem.h.
  1083. X# 4.2bsd uses strings.h; other systems use string.h.
  1084. X# gcc on VMS doesn't have a math.h.
  1085. X# We handle this by using local include files called
  1086. X# malloc_.h, math_.h, memory_.h, and string_.h
  1087. X# that perform appropriate indirection.
  1088. X
  1089. X# -------------------------------- Library -------------------------------- #
  1090. X
  1091. XGX=$(AK) std.h gx.h
  1092. XGXERR=$(GX) gserrors.h
  1093. X
  1094. X# High-level facilities
  1095. X
  1096. Xgschar.$(OBJ): gschar.c $(GXERR) gxfixed.h gxmatrix.h gzdevice.h gxdevmem.h gxfont.h gxchar.h gzpath.h gzcolor.h gzstate.h
  1097. X
  1098. Xgscolor.$(OBJ): gscolor.c $(GXERR) gxfixed.h gxmatrix.h gxdevice.h gzstate.h gzcolor.h gzhalfto.h
  1099. X
  1100. Xgscoord.$(OBJ): gscoord.c $(GXERR) gxfixed.h gxmatrix.h gzdevice.h gzstate.h gscoord.h
  1101. X
  1102. Xgsdevice.$(OBJ): gsdevice.c $(GXERR) gxfixed.h gxmatrix.h gxbitmap.h gxdevmem.h gzstate.h gzdevice.h
  1103. X
  1104. Xgsfile.$(OBJ): gsfile.c $(GXERR) gsmatrix.h gxdevice.h gxdevmem.h
  1105. X
  1106. Xgsfont.$(OBJ): gsfont.c $(GXERR) gxdevice.h gxfixed.h gxmatrix.h gxfont.h gzstate.h
  1107. X
  1108. Xgsimage.$(OBJ): gsimage.c $(GXERR) gxfixed.h gxmatrix.h gspaint.h gzcolor.h gzdevice.h gzpath.h gzstate.h gximage.h
  1109. X
  1110. Xgsim2out.$(OBJ): gsim2out.c $(GXERR)
  1111. X
  1112. Xgsline.$(OBJ): gsline.c $(GXERR) gxfixed.h gxmatrix.h gzstate.h gzline.h
  1113. X
  1114. Xgsmatrix.$(OBJ): gsmatrix.c $(GXERR) gxfixed.h gxmatrix.h
  1115. X
  1116. Xgsmisc.$(OBJ): gsmisc.c $(GX)
  1117. X
  1118. Xgspaint.$(OBJ): gspaint.c $(GX) gxfixed.h gxmatrix.h gspaint.h gzpath.h gzstate.h gzdevice.h gximage.h
  1119. X
  1120. Xgspath.$(OBJ): gspath.c $(GXERR) gxfixed.h gxmatrix.h gxpath.h gzstate.h
  1121. X
  1122. Xgspath2.$(OBJ): gspath2.c $(GXERR) gspath.h gxfixed.h gxmatrix.h gzstate.h gzpath.h gzdevice.h
  1123. X
  1124. Xgsstate.$(OBJ): gsstate.c $(GXERR) gxfixed.h gxmatrix.h gzstate.h gzcolor.h gzdevice.h gzhalfto.h gzline.h gzpath.h
  1125. X
  1126. X# Low-level facilities
  1127. X
  1128. Xgxcache.$(OBJ): gxcache.c $(GX) gserrors.h gxfixed.h gxmatrix.h gspaint.h gzdevice.h gzcolor.h gxdevmem.h gxfont.h gxchar.h gzstate.h gzpath.h
  1129. X
  1130. Xgxcolor.$(OBJ): gxcolor.c $(GX) gxfixed.h gxmatrix.h gxdevice.h gzcolor.h gzhalfto.h
  1131. X
  1132. Xgxdraw.$(OBJ): gxdraw.c $(GX) gxfixed.h gxmatrix.h gxbitmap.h gzcolor.h gzdevice.h gzstate.h
  1133. X
  1134. Xgxfill.$(OBJ): gxfill.c $(GXERR) gxfixed.h gxmatrix.h gxdevice.h gzcolor.h gzpath.h gzstate.h
  1135. X
  1136. Xgxht.$(OBJ): gxht.c $(GXERR) gxfixed.h gxmatrix.h gxbitmap.h gzstate.h gzcolor.h gzdevice.h gzhalfto.h
  1137. X
  1138. Xgxpath.$(OBJ): gxpath.c $(GXERR) gxfixed.h gzpath.h
  1139. X
  1140. Xgxpath2.$(OBJ): gxpath2.c $(GXERR) gxfixed.h gzpath.h
  1141. X
  1142. Xgxstroke.$(OBJ): gxstroke.c $(GXERR) gxfixed.h gxmatrix.h gzstate.h gzcolor.h gzdevice.h gzline.h gzpath.h
  1143. X
  1144. X# The "memory" device
  1145. X
  1146. Xgdevmem.$(OBJ): gdevmem.c $(AK) gs.h gxbitmap.h gsmatrix.h gxdevice.h gxdevmem.h
  1147. X    $(CCNA) gdevmem.c
  1148. X
  1149. X# Files dependent on the set of installed devices.
  1150. X# Generating gdevs.h also generates gdevs.tl.
  1151. X
  1152. Xgdevs.h: gdevs.mak $(MAKEFILE)
  1153. X    gsconfig $(DEVICES)
  1154. X
  1155. Xgdevs.$(OBJ): gdevs.c $(AK) gdevs.h
  1156. X
  1157. X# On Unix, we pre-link all of the library except the back end.
  1158. X# On MS-DOS, we have to do the whole thing at once.
  1159. X
  1160. XLIB=gschar.$(OBJ) gscolor.$(OBJ) gscoord.$(OBJ) gsdevice.$(OBJ) \
  1161. X gsfile.$(OBJ) gsfont.$(OBJ) gsimage.$(OBJ) gsim2out.$(OBJ) \
  1162. X gsline.$(OBJ) gsmatrix.$(OBJ) gsmisc.$(OBJ) \
  1163. X gspaint.$(OBJ) gspath.$(OBJ) gspath2.$(OBJ) gsstate.$(OBJ) \
  1164. X gxcache.$(OBJ) gxcolor.$(OBJ) gxdraw.$(OBJ) gxfill.$(OBJ) \
  1165. X gxht.$(OBJ) gxpath.$(OBJ) gxpath2.$(OBJ) gxstroke.$(OBJ) \
  1166. X gdevmem.$(OBJ) gdevs.$(OBJ)
  1167. X
  1168. X# ------------------------------ Interpreter ------------------------------ #
  1169. X
  1170. X# Non-graphics utilities
  1171. X
  1172. XGH=$(AK) ghost.h
  1173. X
  1174. Xialloc.$(OBJ): ialloc.c $(AK) std.h alloc.h
  1175. X
  1176. Xidebug.$(OBJ): idebug.c $(GH) name.h
  1177. X
  1178. Xidict.$(OBJ): idict.c $(GH) alloc.h errors.h name.h store.h dict.h
  1179. X
  1180. Xiinit.$(OBJ): iinit.c $(GH) dict.h oper.h store.h
  1181. X
  1182. Xiname.$(OBJ): iname.c $(GH) alloc.h errors.h name.h store.h
  1183. X
  1184. Xinterp.$(OBJ): interp.c $(GH) errors.h name.h dict.h oper.h store.h sstorei.h stream.h
  1185. X    $(CCNA) interp.c
  1186. X
  1187. Xiscan.$(OBJ): iscan.c $(GH) alloc.h dict.h errors.h store.h stream.h
  1188. X
  1189. Xiutil.$(OBJ): iutil.c $(GH) errors.h alloc.h store.h gsmatrix.h gxdevice.h gzcolor.h
  1190. X
  1191. Xstream.$(OBJ): stream.c $(AK) std.h stream.h
  1192. X
  1193. X# Non-graphics operators
  1194. X
  1195. XOP=$(GH) errors.h oper.h
  1196. X
  1197. Xzarith.$(OBJ): zarith.c $(OP) store.h
  1198. X
  1199. Xzarray.$(OBJ): zarray.c $(OP) alloc.h store.h sstorei.h
  1200. X    $(CCNA) zarray.c
  1201. X
  1202. Xzcontrol.$(OBJ): zcontrol.c $(OP) estack.h store.h sstorei.h
  1203. X    $(CCNA) zcontrol.c
  1204. X
  1205. Xzdict.$(OBJ): zdict.c $(OP) dict.h store.h
  1206. X
  1207. Xzfile.$(OBJ): zfile.c $(OP) alloc.h stream.h store.h gsmatrix.h gxdevice.h gxdevmem.h
  1208. X
  1209. Xzgeneric.$(OBJ): zgeneric.c $(OP) dict.h estack.h store.h
  1210. X
  1211. Xzmath.$(OBJ): zmath.c $(OP) store.h
  1212. X
  1213. Xzmisc.$(OBJ): zmisc.c $(OP) alloc.h dict.h store.h
  1214. X
  1215. Xzrelbit.$(OBJ): zrelbit.c $(OP) store.h sstorei.h
  1216. X    $(CCNA) zrelbit.c
  1217. X
  1218. Xzstack.$(OBJ): zstack.c $(OP) store.h sstorei.h
  1219. X    $(CCNA) zstack.c
  1220. X
  1221. Xzstring.$(OBJ): zstring.c $(OP) alloc.h store.h stream.h
  1222. X
  1223. Xztype.$(OBJ): ztype.c $(OP) stream.h store.h
  1224. X
  1225. Xzvmem.$(OBJ): zvmem.c $(OP) alloc.h state.h store.h gsmatrix.h gsstate.h
  1226. X
  1227. X# Graphics operators
  1228. X
  1229. Xzchar.$(OBJ): zchar.c $(OP) gsmatrix.h gschar.h gxdevice.h gxfont.h alloc.h font.h estack.h state.h store.h
  1230. X
  1231. Xzcolor.$(OBJ): zcolor.c $(OP) alloc.h gsmatrix.h gsstate.h state.h store.h
  1232. X
  1233. Xzdevice.$(OBJ): zdevice.c $(OP) alloc.h state.h gsmatrix.h gsstate.h gxdevice.h store.h
  1234. X
  1235. Xzfont.$(OBJ): zfont.c $(OP) gsmatrix.h gxdevice.h gxfont.h alloc.h font.h dict.h state.h store.h
  1236. X
  1237. Xzgstate.$(OBJ): zgstate.c $(OP) alloc.h gsmatrix.h gsstate.h state.h store.h
  1238. X
  1239. Xzht.$(OBJ): zht.c $(OP) alloc.h estack.h gsmatrix.h gsstate.h state.h store.h
  1240. X
  1241. Xzmatrix.$(OBJ): zmatrix.c $(OP) gsmatrix.h state.h gscoord.h store.h
  1242. X
  1243. Xzpaint.$(OBJ): zpaint.c $(OP) alloc.h estack.h gsmatrix.h gspaint.h state.h store.h
  1244. X
  1245. Xzpath.$(OBJ): zpath.c $(OP) gsmatrix.h gspath.h state.h store.h
  1246. X
  1247. Xzpath2.$(OBJ): zpath2.c $(OP) alloc.h estack.h gspath.h state.h store.h
  1248. X
  1249. X# Linking
  1250. X
  1251. XINT=ialloc.$(OBJ) idebug.$(OBJ) idict.$(OBJ) iinit.$(OBJ) iname.$(OBJ) \
  1252. X interp.$(OBJ) iscan.$(OBJ) iutil.$(OBJ) stream.$(OBJ) \
  1253. X zarith.$(OBJ) zarray.$(OBJ) zcontrol.$(OBJ) zdict.$(OBJ) zfile.$(OBJ) \
  1254. X zgeneric.$(OBJ) zmath.$(OBJ) zmisc.$(OBJ) zrelbit.$(OBJ) \
  1255. X zstack.$(OBJ) zstring.$(OBJ) ztype.$(OBJ) zvmem.$(OBJ) \
  1256. X zchar.$(OBJ) zcolor.$(OBJ) zfont.$(OBJ) zdevice.$(OBJ) zgstate.$(OBJ) \
  1257. X zht.$(OBJ) zmatrix.$(OBJ) zpaint.$(OBJ) zpath.$(OBJ) zpath2.$(OBJ)
  1258. X
  1259. X# ----------------------------- Main program ------------------------------ #
  1260. X
  1261. X# Utilities shared between platforms
  1262. X
  1263. Xgsmain.$(OBJ): gsmain.c $(GX) gsmatrix.h gxdevice.h
  1264. X
  1265. X# Library test program driver
  1266. X
  1267. Xgt.$(OBJ): gt.c $(GX) gsmatrix.h gsstate.h gscoord.h gspaint.h gspath.h gxdevice.h
  1268. X
  1269. X# Interpreter main program
  1270. X
  1271. Xgs.$(OBJ): gs.c $(GH) alloc.h store.h stream.h
  1272. X#    Copyright (C) 1989, 1990 Aladdin Enterprises.  All rights reserved.
  1273. X#    Distributed by Free Software Foundation, Inc.
  1274. X#
  1275. X# This file is part of Ghostscript.
  1276. X#
  1277. X# Ghostscript is distributed in the hope that it will be useful, but
  1278. X# WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  1279. X# to anyone for the consequences of using it or for whether it serves any
  1280. X# particular purpose or works at all, unless he says so in writing.  Refer
  1281. X# to the Ghostscript General Public License for full details.
  1282. X#
  1283. X# Everyone is granted permission to copy, modify and redistribute
  1284. X# Ghostscript, but only under the conditions described in the Ghostscript
  1285. X# General Public License.  A copy of this license is supposed to have been
  1286. X# given to you along with Ghostscript so you can know your rights and
  1287. X# responsibilities.  It should be in a file named COPYING.  Among other
  1288. X# things, the copyright notice and this notice must be preserved on all
  1289. X# copies.
  1290. X
  1291. X# makefile for Ghostscript device drivers.
  1292. X
  1293. X# -------------------------------- Catalog ------------------------------- #
  1294. X
  1295. X# It is possible to build Ghostscript with an arbitrary collection of
  1296. X# device drivers, although many drivers are supported only on a subset
  1297. X# of the target platforms.  The currently available drivers are:
  1298. X
  1299. X# Displays:
  1300. X#    bgi    Borland Graphics Interface   [MS-DOS only]
  1301. X#    ega    EGA display using direct addressing   [MS-DOS only]
  1302. X#    ega_bios  EGA display using BIOS calls (very slow)   [MS-DOS only]
  1303. X#    x11    X Windows version 11, release >=3   [Unix only]
  1304. X# Printers:
  1305. X#    deskjet  H-P DeskJet   [MS-DOS only]
  1306. X#    epson    Epson dot matrix printers   [MS-DOS only]
  1307. X
  1308. X# If you add drivers, it would be nice if you kept each list
  1309. X# in alphabetical order.
  1310. X
  1311. X# Each platform-specific makefile should contain a line of the form
  1312. X#    DEVICES=<dev1> ... <devn>
  1313. X# where dev1 ... devn are the devices to be included in the build.
  1314. X# dev1 will be used as the default device.
  1315. X# This line should appear before the lines
  1316. X#    (!)include gdevs.mak
  1317. X#    (!)include ghost.mak
  1318. X# The rule for constructing the final executable should include gdevs.tl
  1319. X# as one of the files on which the executable depends, and the executable
  1320. X# must be linked with all the files named in gdevs.tl.
  1321. X
  1322. X# ---------------------------- End of catalog ---------------------------- #
  1323. X
  1324. X# If you want to add a new device driver, the examples below should be
  1325. X# enough of a guide to the correct form for the makefile rules.
  1326. X
  1327. X# All device drivers depend on the following:
  1328. X
  1329. XGDEV=$(AK) gx.h gsmatrix.h gxbitmap.h gxdevice.h
  1330. X
  1331. X###### ----------------------- The EGA device ----------------------- ######
  1332. X
  1333. Xega_=gdevegad.$(OBJ) gdevegaa.$(OBJ)
  1334. Xega.dev: $(ega_)
  1335. X    gssetdev ega.dev $(ega_)
  1336. X
  1337. Xega_bios_=gdevegab.$(OBJ) gdevegaa.$(OBJ)
  1338. Xega_bios.dev: $(ega_bios_)
  1339. X    gssetdev ega_bios.dev $(ega_bios_)
  1340. X
  1341. XETEST=ega.$(OBJ) trace.$(OBJ) $(ega_)
  1342. Xega.exe: $(ETEST) libc$(MM).tl
  1343. X    tlink /m /l $(LIBDIR)\c0$(MM) @ega.tl @libc$(MM).tl
  1344. X
  1345. Xega.$(OBJ): ega.c $(GDEV)
  1346. X
  1347. X# Note: gdevega.h includes gs.h, gsmatrix.h, gxbitmap.h, and gxdevice.h.
  1348. X# There is no way to express this indirect dependency in the makefile.
  1349. X
  1350. XGDEVEGAH=gs.h gdevega.h $(GDEV)
  1351. X
  1352. Xgdevegaa.$(OBJ): gdevegaa.asm
  1353. X
  1354. Xgdevegab.$(OBJ): gdevegab.c $(GDEVEGAH)
  1355. X    $(CCNA) $*
  1356. X
  1357. Xgdevegad.$(OBJ): gdevegad.c $(GDEVEGAH)
  1358. X    $(CCNA) $*
  1359. X
  1360. X###### --------- The BGI (Borland Graphics Interface) device -------- ######
  1361. X
  1362. Xbgi_=gdevbgi.$(OBJ)
  1363. Xbgi.dev: $(bgi_)
  1364. X    gssetdev bgi.dev $(bgi_)
  1365. X
  1366. Xgdevbgi.$(OBJ): gdevbgi.c $(GDEV)
  1367. X
  1368. X###### --------------- Memory-buffered printer devices --------------- ######
  1369. X
  1370. Xgvirtmem.$(OBJ): gvirtmem.c gvirtmem.h
  1371. X
  1372. X# Virtual memory test program -- requires VMDEBUG
  1373. X
  1374. Xgvm.exe: gvirtmem.$(OBJ) trace.$(OBJ)
  1375. X    tlink /m /l $(LIBDIR)\c0$(MM) gvirtmem trace,gvm,gvm,$(LIBDIR)\c$(MM)
  1376. X
  1377. XPDEVH=$(GDEV) gxdevmem.h gdevprn.h
  1378. X
  1379. X### ------------------ The H-P DeskJet printer device ------------------ ###
  1380. X
  1381. Xdeskjet_=gdevdjet.$(OBJ) gvirtmem.$(OBJ)
  1382. Xdeskjet.dev: $(deskjet_)
  1383. X    gssetdev deskjet.dev $(deskjet_)
  1384. X
  1385. Xgdevdjet.$(OBJ): gdevdjet.c $(PDEVH)
  1386. X
  1387. X### ----------------- The generic Epson printer device ----------------- ###
  1388. X
  1389. Xepson_=gdevepsn.$(OBJ) gvirtmem.$(OBJ)
  1390. Xepson.dev: $(epson_)
  1391. X    gssetdev epson.dev $(epson_)
  1392. X
  1393. Xgdevepsn.$(OBJ): gdevepsn.c $(PDEVH)
  1394. X
  1395. X###### ----------------------- The Xenix device ----------------------- ######
  1396. X
  1397. Xxenix_=gdevxenix.$(OBJ)
  1398. Xxenix.dev: $(xenix_)
  1399. X    gssetdev xenix.dev $(xenix_)
  1400. X
  1401. Xgdevxenix.$(OBJ): gdevxenix.c $(GDEV) gdevxenix.h
  1402. X
  1403. X#    Copyright (C) 1990 Aladdin Enterprises.  All rights reserved.
  1404. X#    Distributed by Free Software Foundation, Inc.
  1405. X#
  1406. X# This file is part of Ghostscript.
  1407. X#
  1408. X# Ghostscript is distributed in the hope that it will be useful, but
  1409. X# WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  1410. X# to anyone for the consequences of using it or for whether it serves any
  1411. X# particular purpose or works at all, unless he says so in writing.  Refer
  1412. X# to the Ghostscript General Public License for full details.
  1413. X#
  1414. X# Everyone is granted permission to copy, modify and redistribute
  1415. X# Ghostscript, but only under the conditions described in the Ghostscript
  1416. X# General Public License.  A copy of this license is supposed to have been
  1417. X# given to you along with Ghostscript so you can know your rights and
  1418. X# responsibilities.  It should be in a file named COPYING.  Among other
  1419. X# things, the copyright notice and this notice must be preserved on all
  1420. X# copies.
  1421. X
  1422. X# Partial makefile for Ghostscript, common to all Unix configurations.
  1423. X
  1424. X# This is the last part of the makefile for Unix configurations.
  1425. X# Since Unix make doesn't have an 'include' facility, we concatenate
  1426. X# the various parts of the makefile together by brute force (in tar_gs).
  1427. X
  1428. X# -------------------------------- Library -------------------------------- #
  1429. X
  1430. X## The Unix platform
  1431. X
  1432. XPLATUNIX=gp_unix.$(OBJ)
  1433. X
  1434. Xgp_unix.$(OBJ): gp_unix.c
  1435. X
  1436. X# ----------------------------- Main program ------------------------------ #
  1437. X
  1438. X# (Dummy) tracing package
  1439. X
  1440. Xutrace.$(OBJ): utrace.c
  1441. X
  1442. X# Main program
  1443. X
  1444. XALLUNIX=gsmain.$(OBJ) utrace.$(OBJ) $(LIB) $(PLATUNIX)
  1445. X
  1446. X# Library test programs
  1447. X
  1448. XGTUNIX=gt.$(OBJ) $(ALLUNIX)
  1449. Xgt: $(GTUNIX) gdevs.tl
  1450. X    $(CC) $(CFLAGS) $(LDPLAT) -o gt $(GTUNIX) `cat gdevs.tl` -lx -lfpu
  1451. X
  1452. X# Interpreter main program
  1453. X
  1454. XGSUNIX=gs.$(OBJ) $(INT) $(ALLUNIX)
  1455. Xgs: $(GSUNIX) gdevs.tl
  1456. X    $(CC) $(CFLAGS) $(LDPLAT) -o gs $(GSUNIX) `cat gdevs.tl` -lx -lm
  1457. SHAR_EOF
  1458. chmod 0644 makefile.cc || echo "restore of makefile.cc fails"
  1459. set `wc -c makefile.cc`;Sum=$1
  1460. if test "$Sum" != "17752"
  1461. then echo original size 17752, current size $Sum;fi
  1462. fi
  1463. if test -f makefile.gcc; then echo "File makefile.gcc exists"; else
  1464. echo "x - extracting makefile.gcc (Text)"
  1465. sed 's/^X//' << 'SHAR_EOF' > makefile.gcc &&
  1466. X#    Copyright (C) 1989, 1990 Aladdin Enterprises.  All rights reserved.
  1467. X#    Distributed by Free Software Foundation, Inc.
  1468. X#
  1469. X# This file is part of Ghostscript.
  1470. X#
  1471. X# Ghostscript is distributed in the hope that it will be useful, but
  1472. X# WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  1473. X# to anyone for the consequences of using it or for whether it serves any
  1474. X# particular purpose or works at all, unless he says so in writing.  Refer
  1475. X# to the Ghostscript General Public License for full details.
  1476. X#
  1477. X# Everyone is granted permission to copy, modify and redistribute
  1478. X# Ghostscript, but only under the conditions described in the Ghostscript
  1479. X# General Public License.  A copy of this license is supposed to have been
  1480. X# given to you along with Ghostscript so you can know your rights and
  1481. X# responsibilities.  It should be in a file named COPYING.  Among other
  1482. X# things, the copyright notice and this notice must be preserved on all
  1483. X# copies.
  1484. X
  1485. X# makefile for Ghostscript, Unix/gcc/xenix configuration.
  1486. X
  1487. X# ------------------------------- Options ------------------------------- #
  1488. X
  1489. X####### The following are the only parts of the file you should need to edit.
  1490. X
  1491. X# ------ Generic options ------ #
  1492. X
  1493. X# Choose the device(s) to include.  See gdevs.mak for details.
  1494. X
  1495. XDEVICES=xenix
  1496. X
  1497. X# Choose generic configuration options.
  1498. X
  1499. X# -DDEBUG
  1500. X#    includes debugging features (-Z switch) in the code.
  1501. X#      Code runs substantially slower even if no debugging switches
  1502. X#      are set.
  1503. X# -DNOPRIVATE
  1504. X#    makes private (static) procedures and variables public,
  1505. X#      so they are visible to the debugger and profiler.
  1506. X#      No execution time or space penalty.
  1507. X
  1508. XGENOPT=
  1509. X
  1510. X# ------ Platform-specific options ------ #
  1511. X
  1512. X# Define the name of the C compiler.
  1513. X
  1514. XCC=gcc
  1515. X
  1516. X# Define the other compilation flags.
  1517. X# Add -DBSD4_2 for 4.2bsd systems.
  1518. X# Add -DSYSV for System V.
  1519. X# We don't include -ansi, because this gets in the way of the platform-
  1520. X#   specific stuff that <math.h> typically needs.
  1521. X# If you are running on SunOS 4.0.x, you must add a -D for the machine
  1522. X#   type, or /usr/include/sys/ieeefp.h will fail to define
  1523. X#   fp_direction_type, and so <math.h> won't pass the compiler, and so
  1524. X#   zarith.c and many other files won't compile.  The right -D symbol for
  1525. X#   the Sun-4 and SparcStation is -Dsparc; for the Sun-3, it is mc68000.
  1526. X
  1527. XCFLAGS= -O -DSYSV -fstrength-reduce -finline-functions -fkeep-inline-functions
  1528. X
  1529. X# Define platform flags for ld.
  1530. X# Most Unix systems accept -X, but some don't.
  1531. X# Sun OS4.n may need -Bstatic.
  1532. X
  1533. XLDPLAT=
  1534. X
  1535. X# ---------------------------- End of options --------------------------- #
  1536. X
  1537. X# Define the name of the makefile -- used in dependencies.
  1538. X
  1539. XMAKEFILE=unix-gcc.mak
  1540. X
  1541. X# Define the extensions for the object and executable files.
  1542. X
  1543. XOBJ=o
  1544. XXE=
  1545. X
  1546. X# Define the ANSI-to-K&R dependency.  (gcc accepts ANSI syntax.)
  1547. X
  1548. XAK=
  1549. X
  1550. X# Define the compilation rules.
  1551. X
  1552. XCCFLAGS=$(GENOPT) $(CFLAGS)
  1553. X
  1554. X.c.o:
  1555. X    $(CC) $(CCFLAGS) -c $*.c
  1556. X
  1557. XCCNA=$(CC) $(CCFLAGS) -c
  1558. X
  1559. X# --------------------------- Generic makefile ---------------------------- #
  1560. X
  1561. X# The remainder of the makefile (ghost.mak, gdevs.mak, and unixtail.mak)
  1562. X# is generic.  tar_gs concatenates all these together.
  1563. X#    Copyright (C) 1989, 1990 Aladdin Enterprises.  All rights reserved.
  1564. X#    Distributed by Free Software Foundation, Inc.
  1565. X#
  1566. X# This file is part of Ghostscript.
  1567. X#
  1568. X# Ghostscript is distributed in the hope that it will be useful, but
  1569. X# WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  1570. X# to anyone for the consequences of using it or for whether it serves any
  1571. X# particular purpose or works at all, unless he says so in writing.  Refer
  1572. X# to the Ghostscript General Public License for full details.
  1573. X#
  1574. X# Everyone is granted permission to copy, modify and redistribute
  1575. X# Ghostscript, but only under the conditions described in the Ghostscript
  1576. X# General Public License.  A copy of this license is supposed to have been
  1577. X# given to you along with Ghostscript so you can know your rights and
  1578. X# responsibilities.  It should be in a file named COPYING.  Among other
  1579. X# things, the copyright notice and this notice must be preserved on all
  1580. X# copies.
  1581. X
  1582. X# Generic makefile for Ghostscript.
  1583. X# The platform-specific makefiles 'include' this file.
  1584. X# They define the following symbols:
  1585. X#    XE - the extension for executable files (e.g., null or .exe).
  1586. X#    OBJ - the extension for relocatable object files (e.g., o or obj).
  1587. X#    CCNA - the non-ANSI C invocation for files that on some platforms
  1588. X#        include in-line assembly code or other non-standard
  1589. X#        constructs.  Currently this is needed on every file that
  1590. X#        includes sstorei.h.
  1591. X#    AK - if source files must be converted from ANSI to K&R syntax,
  1592. X#        this is ansi2knr$(XE); if not, it is null.
  1593. X
  1594. Xdefault: gs$(XE)
  1595. X
  1596. Xtest: gt$(XE)
  1597. X
  1598. Xclean:
  1599. X    rm -f *.$(OBJ) *.a core
  1600. X    rm -f _temp_.* *.dev libc*.tl *.map gdevs.h gdevs.tl
  1601. X    rm -f ansi2knr$(XE)
  1602. X    rm -f gs$(XE) gs.sym
  1603. X
  1604. Xansi2knr$(XE):
  1605. X    cc -o ansi2knr$(XE) -O ansi2knr.c
  1606. X
  1607. X# Note: Unix uses malloc.h and memory.h;
  1608. X# Turbo C uses alloc.h, stdlib.h, and mem.h.
  1609. X# 4.2bsd uses strings.h; other systems use string.h.
  1610. X# gcc on VMS doesn't have a math.h.
  1611. X# We handle this by using local include files called
  1612. X# malloc_.h, math_.h, memory_.h, and string_.h
  1613. X# that perform appropriate indirection.
  1614. X
  1615. X# -------------------------------- Library -------------------------------- #
  1616. X
  1617. XGX=$(AK) std.h gx.h
  1618. XGXERR=$(GX) gserrors.h
  1619. X
  1620. X# High-level facilities
  1621. X
  1622. Xgschar.$(OBJ): gschar.c $(GXERR) gxfixed.h gxmatrix.h gzdevice.h gxdevmem.h gxfont.h gxchar.h gzpath.h gzcolor.h gzstate.h
  1623. X
  1624. Xgscolor.$(OBJ): gscolor.c $(GXERR) gxfixed.h gxmatrix.h gxdevice.h gzstate.h gzcolor.h gzhalfto.h
  1625. X
  1626. Xgscoord.$(OBJ): gscoord.c $(GXERR) gxfixed.h gxmatrix.h gzdevice.h gzstate.h gscoord.h
  1627. X
  1628. Xgsdevice.$(OBJ): gsdevice.c $(GXERR) gxfixed.h gxmatrix.h gxbitmap.h gxdevmem.h gzstate.h gzdevice.h
  1629. X
  1630. Xgsfile.$(OBJ): gsfile.c $(GXERR) gsmatrix.h gxdevice.h gxdevmem.h
  1631. X
  1632. Xgsfont.$(OBJ): gsfont.c $(GXERR) gxdevice.h gxfixed.h gxmatrix.h gxfont.h gzstate.h
  1633. X
  1634. Xgsimage.$(OBJ): gsimage.c $(GXERR) gxfixed.h gxmatrix.h gspaint.h gzcolor.h gzdevice.h gzpath.h gzstate.h gximage.h
  1635. X
  1636. Xgsim2out.$(OBJ): gsim2out.c $(GXERR)
  1637. X
  1638. Xgsline.$(OBJ): gsline.c $(GXERR) gxfixed.h gxmatrix.h gzstate.h gzline.h
  1639. X
  1640. Xgsmatrix.$(OBJ): gsmatrix.c $(GXERR) gxfixed.h gxmatrix.h
  1641. X
  1642. Xgsmisc.$(OBJ): gsmisc.c $(GX)
  1643. X
  1644. Xgspaint.$(OBJ): gspaint.c $(GX) gxfixed.h gxmatrix.h gspaint.h gzpath.h gzstate.h gzdevice.h gximage.h
  1645. X
  1646. Xgspath.$(OBJ): gspath.c $(GXERR) gxfixed.h gxmatrix.h gxpath.h gzstate.h
  1647. X
  1648. Xgspath2.$(OBJ): gspath2.c $(GXERR) gspath.h gxfixed.h gxmatrix.h gzstate.h gzpath.h gzdevice.h
  1649. X
  1650. Xgsstate.$(OBJ): gsstate.c $(GXERR) gxfixed.h gxmatrix.h gzstate.h gzcolor.h gzdevice.h gzhalfto.h gzline.h gzpath.h
  1651. X
  1652. X# Low-level facilities
  1653. X
  1654. Xgxcache.$(OBJ): gxcache.c $(GX) gserrors.h gxfixed.h gxmatrix.h gspaint.h gzdevice.h gzcolor.h gxdevmem.h gxfont.h gxchar.h gzstate.h gzpath.h
  1655. X
  1656. Xgxcolor.$(OBJ): gxcolor.c $(GX) gxfixed.h gxmatrix.h gxdevice.h gzcolor.h gzhalfto.h
  1657. X
  1658. Xgxdraw.$(OBJ): gxdraw.c $(GX) gxfixed.h gxmatrix.h gxbitmap.h gzcolor.h gzdevice.h gzstate.h
  1659. X
  1660. Xgxfill.$(OBJ): gxfill.c $(GXERR) gxfixed.h gxmatrix.h gxdevice.h gzcolor.h gzpath.h gzstate.h
  1661. X
  1662. Xgxht.$(OBJ): gxht.c $(GXERR) gxfixed.h gxmatrix.h gxbitmap.h gzstate.h gzcolor.h gzdevice.h gzhalfto.h
  1663. X
  1664. Xgxpath.$(OBJ): gxpath.c $(GXERR) gxfixed.h gzpath.h
  1665. X
  1666. Xgxpath2.$(OBJ): gxpath2.c $(GXERR) gxfixed.h gzpath.h
  1667. X
  1668. Xgxstroke.$(OBJ): gxstroke.c $(GXERR) gxfixed.h gxmatrix.h gzstate.h gzcolor.h gzdevice.h gzline.h gzpath.h
  1669. X
  1670. X# The "memory" device
  1671. X
  1672. Xgdevmem.$(OBJ): gdevmem.c $(AK) gs.h gxbitmap.h gsmatrix.h gxdevice.h gxdevmem.h
  1673. X    $(CCNA) gdevmem.c
  1674. X
  1675. X# Files dependent on the set of installed devices.
  1676. X# Generating gdevs.h also generates gdevs.tl.
  1677. X
  1678. Xgdevs.h: gdevs.mak $(MAKEFILE)
  1679. X    gsconfig $(DEVICES)
  1680. X
  1681. Xgdevs.$(OBJ): gdevs.c $(AK) gdevs.h
  1682. X
  1683. X# On Unix, we pre-link all of the library except the back end.
  1684. X# On MS-DOS, we have to do the whole thing at once.
  1685. X
  1686. XLIB=gschar.$(OBJ) gscolor.$(OBJ) gscoord.$(OBJ) gsdevice.$(OBJ) \
  1687. X gsfile.$(OBJ) gsfont.$(OBJ) gsimage.$(OBJ) gsim2out.$(OBJ) \
  1688. X gsline.$(OBJ) gsmatrix.$(OBJ) gsmisc.$(OBJ) \
  1689. X gspaint.$(OBJ) gspath.$(OBJ) gspath2.$(OBJ) gsstate.$(OBJ) \
  1690. X gxcache.$(OBJ) gxcolor.$(OBJ) gxdraw.$(OBJ) gxfill.$(OBJ) \
  1691. X gxht.$(OBJ) gxpath.$(OBJ) gxpath2.$(OBJ) gxstroke.$(OBJ) \
  1692. X gdevmem.$(OBJ) gdevs.$(OBJ)
  1693. X
  1694. X# ------------------------------ Interpreter ------------------------------ #
  1695. X
  1696. X# Non-graphics utilities
  1697. X
  1698. XGH=$(AK) ghost.h
  1699. X
  1700. Xialloc.$(OBJ): ialloc.c $(AK) std.h alloc.h
  1701. X
  1702. Xidebug.$(OBJ): idebug.c $(GH) name.h
  1703. X
  1704. Xidict.$(OBJ): idict.c $(GH) alloc.h errors.h name.h store.h dict.h
  1705. X
  1706. Xiinit.$(OBJ): iinit.c $(GH) dict.h oper.h store.h
  1707. X
  1708. Xiname.$(OBJ): iname.c $(GH) alloc.h errors.h name.h store.h
  1709. X
  1710. Xinterp.$(OBJ): interp.c $(GH) errors.h name.h dict.h oper.h store.h sstorei.h stream.h
  1711. X    $(CCNA) interp.c
  1712. X
  1713. Xiscan.$(OBJ): iscan.c $(GH) alloc.h dict.h errors.h store.h stream.h
  1714. X
  1715. Xiutil.$(OBJ): iutil.c $(GH) errors.h alloc.h store.h gsmatrix.h gxdevice.h gzcolor.h
  1716. X
  1717. Xstream.$(OBJ): stream.c $(AK) std.h stream.h
  1718. X
  1719. X# Non-graphics operators
  1720. X
  1721. XOP=$(GH) errors.h oper.h
  1722. X
  1723. Xzarith.$(OBJ): zarith.c $(OP) store.h
  1724. X
  1725. Xzarray.$(OBJ): zarray.c $(OP) alloc.h store.h sstorei.h
  1726. X    $(CCNA) zarray.c
  1727. X
  1728. Xzcontrol.$(OBJ): zcontrol.c $(OP) estack.h store.h sstorei.h
  1729. X    $(CCNA) zcontrol.c
  1730. X
  1731. Xzdict.$(OBJ): zdict.c $(OP) dict.h store.h
  1732. X
  1733. Xzfile.$(OBJ): zfile.c $(OP) alloc.h stream.h store.h gsmatrix.h gxdevice.h gxdevmem.h
  1734. X
  1735. Xzgeneric.$(OBJ): zgeneric.c $(OP) dict.h estack.h store.h
  1736. X
  1737. Xzmath.$(OBJ): zmath.c $(OP) store.h
  1738. X
  1739. Xzmisc.$(OBJ): zmisc.c $(OP) alloc.h dict.h store.h
  1740. X
  1741. Xzrelbit.$(OBJ): zrelbit.c $(OP) store.h sstorei.h
  1742. X    $(CCNA) zrelbit.c
  1743. X
  1744. Xzstack.$(OBJ): zstack.c $(OP) store.h sstorei.h
  1745. X    $(CCNA) zstack.c
  1746. X
  1747. Xzstring.$(OBJ): zstring.c $(OP) alloc.h store.h stream.h
  1748. X
  1749. Xztype.$(OBJ): ztype.c $(OP) stream.h store.h
  1750. X
  1751. Xzvmem.$(OBJ): zvmem.c $(OP) alloc.h state.h store.h gsmatrix.h gsstate.h
  1752. X
  1753. X# Graphics operators
  1754. X
  1755. Xzchar.$(OBJ): zchar.c $(OP) gsmatrix.h gschar.h gxdevice.h gxfont.h alloc.h font.h estack.h state.h store.h
  1756. X
  1757. Xzcolor.$(OBJ): zcolor.c $(OP) alloc.h gsmatrix.h gsstate.h state.h store.h
  1758. X
  1759. Xzdevice.$(OBJ): zdevice.c $(OP) alloc.h state.h gsmatrix.h gsstate.h gxdevice.h store.h
  1760. X
  1761. Xzfont.$(OBJ): zfont.c $(OP) gsmatrix.h gxdevice.h gxfont.h alloc.h font.h dict.h state.h store.h
  1762. X
  1763. Xzgstate.$(OBJ): zgstate.c $(OP) alloc.h gsmatrix.h gsstate.h state.h store.h
  1764. X
  1765. Xzht.$(OBJ): zht.c $(OP) alloc.h estack.h gsmatrix.h gsstate.h state.h store.h
  1766. X
  1767. Xzmatrix.$(OBJ): zmatrix.c $(OP) gsmatrix.h state.h gscoord.h store.h
  1768. X
  1769. Xzpaint.$(OBJ): zpaint.c $(OP) alloc.h estack.h gsmatrix.h gspaint.h state.h store.h
  1770. X
  1771. Xzpath.$(OBJ): zpath.c $(OP) gsmatrix.h gspath.h state.h store.h
  1772. X
  1773. Xzpath2.$(OBJ): zpath2.c $(OP) alloc.h estack.h gspath.h state.h store.h
  1774. X
  1775. X# Linking
  1776. X
  1777. XINT=ialloc.$(OBJ) idebug.$(OBJ) idict.$(OBJ) iinit.$(OBJ) iname.$(OBJ) \
  1778. X interp.$(OBJ) iscan.$(OBJ) iutil.$(OBJ) stream.$(OBJ) \
  1779. X zarith.$(OBJ) zarray.$(OBJ) zcontrol.$(OBJ) zdict.$(OBJ) zfile.$(OBJ) \
  1780. X zgeneric.$(OBJ) zmath.$(OBJ) zmisc.$(OBJ) zrelbit.$(OBJ) \
  1781. X zstack.$(OBJ) zstring.$(OBJ) ztype.$(OBJ) zvmem.$(OBJ) \
  1782. X zchar.$(OBJ) zcolor.$(OBJ) zfont.$(OBJ) zdevice.$(OBJ) zgstate.$(OBJ) \
  1783. X zht.$(OBJ) zmatrix.$(OBJ) zpaint.$(OBJ) zpath.$(OBJ) zpath2.$(OBJ)
  1784. X
  1785. X# ----------------------------- Main program ------------------------------ #
  1786. X
  1787. X# Utilities shared between platforms
  1788. X
  1789. Xgsmain.$(OBJ): gsmain.c $(GX) gsmatrix.h gxdevice.h
  1790. X
  1791. X# Library test program driver
  1792. X
  1793. Xgt.$(OBJ): gt.c $(GX) gsmatrix.h gsstate.h gscoord.h gspaint.h gspath.h gxdevice.h
  1794. X
  1795. X# Interpreter main program
  1796. X
  1797. Xgs.$(OBJ): gs.c $(GH) alloc.h store.h stream.h
  1798. X#    Copyright (C) 1989, 1990 Aladdin Enterprises.  All rights reserved.
  1799. X#    Distributed by Free Software Foundation, Inc.
  1800. X#
  1801. X# This file is part of Ghostscript.
  1802. X#
  1803. X# Ghostscript is distributed in the hope that it will be useful, but
  1804. X# WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  1805. X# to anyone for the consequences of using it or for whether it serves any
  1806. X# particular purpose or works at all, unless he says so in writing.  Refer
  1807. X# to the Ghostscript General Public License for full details.
  1808. X#
  1809. X# Everyone is granted permission to copy, modify and redistribute
  1810. X# Ghostscript, but only under the conditions described in the Ghostscript
  1811. X# General Public License.  A copy of this license is supposed to have been
  1812. X# given to you along with Ghostscript so you can know your rights and
  1813. X# responsibilities.  It should be in a file named COPYING.  Among other
  1814. X# things, the copyright notice and this notice must be preserved on all
  1815. X# copies.
  1816. X
  1817. X# makefile for Ghostscript device drivers.
  1818. X
  1819. X# -------------------------------- Catalog ------------------------------- #
  1820. X
  1821. X# It is possible to build Ghostscript with an arbitrary collection of
  1822. X# device drivers, although many drivers are supported only on a subset
  1823. X# of the target platforms.  The currently available drivers are:
  1824. X
  1825. X# Displays:
  1826. X#    bgi    Borland Graphics Interface   [MS-DOS only]
  1827. X#    ega    EGA display using direct addressing   [MS-DOS only]
  1828. X#    ega_bios  EGA display using BIOS calls (very slow)   [MS-DOS only]
  1829. X#    x11    X Windows version 11, release >=3   [Unix only]
  1830. X# Printers:
  1831. X#    deskjet  H-P DeskJet   [MS-DOS only]
  1832. X#    epson    Epson dot matrix printers   [MS-DOS only]
  1833. X
  1834. X# If you add drivers, it would be nice if you kept each list
  1835. X# in alphabetical order.
  1836. X
  1837. X# Each platform-specific makefile should contain a line of the form
  1838. X#    DEVICES=<dev1> ... <devn>
  1839. X# where dev1 ... devn are the devices to be included in the build.
  1840. X# dev1 will be used as the default device.
  1841. X# This line should appear before the lines
  1842. X#    (!)include gdevs.mak
  1843. X#    (!)include ghost.mak
  1844. X# The rule for constructing the final executable should include gdevs.tl
  1845. X# as one of the files on which the executable depends, and the executable
  1846. X# must be linked with all the files named in gdevs.tl.
  1847. X
  1848. X# ---------------------------- End of catalog ---------------------------- #
  1849. X
  1850. X# If you want to add a new device driver, the examples below should be
  1851. X# enough of a guide to the correct form for the makefile rules.
  1852. X
  1853. X# All device drivers depend on the following:
  1854. X
  1855. XGDEV=$(AK) gx.h gsmatrix.h gxbitmap.h gxdevice.h
  1856. X
  1857. X###### ----------------------- The EGA device ----------------------- ######
  1858. X
  1859. Xega_=gdevegad.$(OBJ) gdevegaa.$(OBJ)
  1860. Xega.dev: $(ega_)
  1861. X    gssetdev ega.dev $(ega_)
  1862. X
  1863. Xega_bios_=gdevegab.$(OBJ) gdevegaa.$(OBJ)
  1864. Xega_bios.dev: $(ega_bios_)
  1865. X    gssetdev ega_bios.dev $(ega_bios_)
  1866. X
  1867. XETEST=ega.$(OBJ) trace.$(OBJ) $(ega_)
  1868. Xega.exe: $(ETEST) libc$(MM).tl
  1869. X    tlink /m /l $(LIBDIR)\c0$(MM) @ega.tl @libc$(MM).tl
  1870. X
  1871. Xega.$(OBJ): ega.c $(GDEV)
  1872. X
  1873. X# Note: gdevega.h includes gs.h, gsmatrix.h, gxbitmap.h, and gxdevice.h.
  1874. X# There is no way to express this indirect dependency in the makefile.
  1875. X
  1876. XGDEVEGAH=gs.h gdevega.h $(GDEV)
  1877. X
  1878. Xgdevegaa.$(OBJ): gdevegaa.asm
  1879. X
  1880. Xgdevegab.$(OBJ): gdevegab.c $(GDEVEGAH)
  1881. X    $(CCNA) $*
  1882. X
  1883. Xgdevegad.$(OBJ): gdevegad.c $(GDEVEGAH)
  1884. X    $(CCNA) $*
  1885. X
  1886. X###### --------- The BGI (Borland Graphics Interface) device -------- ######
  1887. X
  1888. Xbgi_=gdevbgi.$(OBJ)
  1889. Xbgi.dev: $(bgi_)
  1890. X    gssetdev bgi.dev $(bgi_)
  1891. X
  1892. Xgdevbgi.$(OBJ): gdevbgi.c $(GDEV)
  1893. X
  1894. X###### --------------- Memory-buffered printer devices --------------- ######
  1895. X
  1896. Xgvirtmem.$(OBJ): gvirtmem.c gvirtmem.h
  1897. X
  1898. X# Virtual memory test program -- requires VMDEBUG
  1899. X
  1900. Xgvm.exe: gvirtmem.$(OBJ) trace.$(OBJ)
  1901. X    tlink /m /l $(LIBDIR)\c0$(MM) gvirtmem trace,gvm,gvm,$(LIBDIR)\c$(MM)
  1902. X
  1903. XPDEVH=$(GDEV) gxdevmem.h gdevprn.h
  1904. X
  1905. X### ------------------ The H-P DeskJet printer device ------------------ ###
  1906. X
  1907. Xdeskjet_=gdevdjet.$(OBJ) gvirtmem.$(OBJ)
  1908. Xdeskjet.dev: $(deskjet_)
  1909. X    gssetdev deskjet.dev $(deskjet_)
  1910. X
  1911. Xgdevdjet.$(OBJ): gdevdjet.c $(PDEVH)
  1912. X
  1913. X### ----------------- The generic Epson printer device ----------------- ###
  1914. X
  1915. Xepson_=gdevepsn.$(OBJ) gvirtmem.$(OBJ)
  1916. Xepson.dev: $(epson_)
  1917. X    gssetdev epson.dev $(epson_)
  1918. X
  1919. Xgdevepsn.$(OBJ): gdevepsn.c $(PDEVH)
  1920. X
  1921. X###### ----------------------- The Xenix device ----------------------- ######
  1922. X
  1923. Xxenix_=gdevxenix.$(OBJ)
  1924. Xxenix.dev: $(xenix_)
  1925. X    gssetdev xenix.dev $(xenix_)
  1926. X
  1927. Xgdevxenix.$(OBJ): gdevxenix.c $(GDEV) gdevxenix.h
  1928. X
  1929. X#    Copyright (C) 1990 Aladdin Enterprises.  All rights reserved.
  1930. X#    Distributed by Free Software Foundation, Inc.
  1931. X#
  1932. X# This file is part of Ghostscript.
  1933. X#
  1934. X# Ghostscript is distributed in the hope that it will be useful, but
  1935. X# WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  1936. X# to anyone for the consequences of using it or for whether it serves any
  1937. X# particular purpose or works at all, unless he says so in writing.  Refer
  1938. X# to the Ghostscript General Public License for full details.
  1939. X#
  1940. X# Everyone is granted permission to copy, modify and redistribute
  1941. X# Ghostscript, but only under the conditions described in the Ghostscript
  1942. X# General Public License.  A copy of this license is supposed to have been
  1943. X# given to you along with Ghostscript so you can know your rights and
  1944. X# responsibilities.  It should be in a file named COPYING.  Among other
  1945. X# things, the copyright notice and this notice must be preserved on all
  1946. X# copies.
  1947. X
  1948. X# Partial makefile for Ghostscript, common to all Unix configurations.
  1949. X
  1950. X# This is the last part of the makefile for Unix configurations.
  1951. X# Since Unix make doesn't have an 'include' facility, we concatenate
  1952. X# the various parts of the makefile together by brute force (in tar_gs).
  1953. X
  1954. X# -------------------------------- Library -------------------------------- #
  1955. X
  1956. X## The Unix platform
  1957. X
  1958. XPLATUNIX=gp_unix.$(OBJ)
  1959. X
  1960. Xgp_unix.$(OBJ): gp_unix.c
  1961. X
  1962. X# ----------------------------- Main program ------------------------------ #
  1963. X
  1964. X# (Dummy) tracing package
  1965. X
  1966. Xutrace.$(OBJ): utrace.c
  1967. X
  1968. X# Main program
  1969. X
  1970. XALLUNIX=gsmain.$(OBJ) utrace.$(OBJ) $(LIB) $(PLATUNIX)
  1971. X
  1972. X# Library test programs
  1973. X
  1974. XGTUNIX=gt.$(OBJ) $(ALLUNIX)
  1975. Xgt: $(GTUNIX) gdevs.tl
  1976. X    $(CC) $(CFLAGS) $(LDPLAT) -o gt $(GTUNIX) `cat gdevs.tl` -lx -lm
  1977. X
  1978. X# Interpreter main program
  1979. X
  1980. XGSUNIX=gs.$(OBJ) $(INT) $(ALLUNIX)
  1981. Xgs: $(GSUNIX) gdevs.tl
  1982. X    $(CC) $(CFLAGS) $(LDPLAT) -o gs $(GSUNIX) `cat gdevs.tl` -lx -lm
  1983. SHAR_EOF
  1984. chmod 0644 makefile.gcc || echo "restore of makefile.gcc fails"
  1985. set `wc -c makefile.gcc`;Sum=$1
  1986. if test "$Sum" != "17693"
  1987. then echo original size 17693, current size $Sum;fi
  1988. fi
  1989. exit 0
  1990. --
  1991. Glenn Geers                       | "So when it's over, we're back to people.
  1992. Department of Theoretical Physics |  Just to prove that human touch can have
  1993. The University of Sydney          |  no equal."
  1994. Sydney NSW 2006 Australia         |  - Basia Trzetrzelewska, 'Prime Time TV'
  1995.