home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / g / gs252src.zip / GS252 / GS.H < prev    next >
C/C++ Source or Header  |  1992-09-17  |  3KB  |  91 lines

  1. /* Copyright (C) 1989, 1990 Aladdin Enterprises.  All rights reserved.
  2.    Distributed by Free Software Foundation, Inc.
  3.  
  4. This file is part of Ghostscript.
  5.  
  6. Ghostscript is distributed in the hope that it will be useful, but
  7. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  8. to anyone for the consequences of using it or for whether it serves any
  9. particular purpose or works at all, unless he says so in writing.  Refer
  10. to the Ghostscript General Public License for full details.
  11.  
  12. Everyone is granted permission to copy, modify and redistribute
  13. Ghostscript, but only under the conditions described in the Ghostscript
  14. General Public License.  A copy of this license is supposed to have been
  15. given to you along with Ghostscript so you can know your rights and
  16. responsibilities.  It should be in a file named COPYING.  Among other
  17. things, the copyright notice and this notice must be preserved on all
  18. copies.  */
  19.  
  20. /* gs.h */
  21. /* Common definitions for Ghostscript library */
  22. #include "stdio_.h"        /* includes std.h */
  23.  
  24. /* Ghostscript never uses stdin/out/err directly. */
  25. extern FILE *gs_stdin, *gs_stdout, *gs_stderr;
  26.  
  27. /* Redefine all the relevant stdio functions to use the above. */
  28. /* Some functions we make illegal, rather than redefining them. */
  29. #undef stdin
  30. #define stdin gs_stdin
  31. #undef stdout
  32. #define stdout gs_stdout
  33. #undef stderr
  34. #define stderr gs_stderr
  35. #undef fgetchar
  36. #define fgetchar() fgetc(stdin)
  37. #undef fputchar
  38. #define fputchar(c) fputc(c, stdout)
  39. #undef getchar
  40. #define getchar() getc(stdin)
  41. #undef gets
  42. #define gets Function._gets_.unavailable
  43. /* We should do something about perror, but since many Unix systems */
  44. /* don't provide the strerror function, we can't.  (Neither the */
  45. /* Ghostscript kernel nor any Aladdin-maintained driver uses perror.) */
  46. #undef printf
  47. #define printf Function._printf_.unavailable
  48. #undef putchar
  49. #define putchar(c) fputc(c, stdout)
  50. #undef puts
  51. #define puts(s) (fputs(s, stdout), putchar('\n'))
  52. #undef scanf
  53. #define scanf Function._scanf_.unavailable
  54. #undef vprintf
  55. #define vprintf Function._vprintf_.unavailable
  56. #undef vscanf
  57. #define vscanf Function._vscanf_.unavailable
  58.  
  59. /* Representation of a point. */
  60. typedef struct gs_point_s {
  61.     double x, y;
  62. } gs_point;
  63. typedef struct gs_int_point_s {
  64.     int x, y;
  65. } gs_int_point;
  66. /* Representation of a rectangle. */
  67. /* Note that rectangles are half-open, i.e.: their width is */
  68. /* q.x-p.x and their height is q.y-p.y; they include the points */
  69. /* (x,y) such that p.x<=x<q.x and p.y<=y<q.y. */
  70. typedef struct gs_rect_s {
  71.     gs_point p, q;            /* origin point, corner point */
  72. } gs_rect;
  73. typedef struct gs_int_rect_s {
  74.     gs_int_point p, q;
  75. } gs_int_rect;
  76.  
  77. /* So many routines use the graphics state */
  78. /* that we may as well declare the abstract type here. */
  79. typedef struct gs_state_s gs_state;
  80.  
  81. /* A number of interfaces involve user-specified allocation */
  82. /* and deallocation procedures, so we define the structure here. */
  83. typedef struct {
  84.     proc_alloc_t alloc;
  85.     proc_free_t free;
  86. } gs_memory_procs;
  87. /* We define our own versions of malloc and free that conform */
  88. /* to the types proc_alloc_t and proc_free_t: */
  89. char *gs_malloc(P3(uint, uint, const char *));
  90. void gs_free(P4(char *, uint, uint, const char *));
  91.