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 / GP.H < prev    next >
C/C++ Source or Header  |  1992-07-14  |  6KB  |  170 lines

  1. /* Copyright (C) 1991, 1992 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. /* gp.h */
  21. /* Interface to platform-specific routines for Ghostscript */
  22.  
  23. /*
  24.  * This file defines ***ALL*** the routines that are Ghostscript- and
  25.  * platform-specific.  The routines are implemented in a gp_*.c file
  26.  * specific to each platform.  We try very hard to keep this list short!
  27.  */
  28.  
  29. /* ------ Initialization/termination ------ */
  30.  
  31. /*
  32.  * This routine is called early in the Ghostscript initialization.
  33.  * It should do as little as possible.  In particular, it should not
  34.  * do things like open display connections: that is the responsibility
  35.  * of the display device driver.
  36.  */
  37. extern void gp_init(P0());
  38.  
  39. /*
  40.  * This routine is called just before Ghostscript exits (normally or
  41.  * abnormally).  It too should do as little as possible.
  42.  */
  43. extern void gp_exit(P0());
  44.  
  45. /* ------ Date and time ------ */
  46.  
  47. /*
  48.  * Read the current date (in days since Jan. 1, 1980) into pdt[0],
  49.  * and time (in milliseconds since midnight) into pdt[1].
  50.  */
  51. extern void gp_get_clock(P1(long *pdt));
  52.  
  53. /* ------ Screen management ------ */
  54.  
  55. /*
  56.  * These routines are only relevant in a single-window environment
  57.  * such as a PC; on platforms with window systems, the 'make current'
  58.  * routines do nothing.
  59.  */
  60.  
  61. #ifndef gx_device_DEFINED
  62. #  define gx_device_DEFINED
  63. typedef struct gx_device_s gx_device;
  64. #endif
  65.  
  66. /* Write a string to the console. */
  67. extern void gp_console_puts(P2(const char *, uint));
  68.  
  69. /* Make the console current on the screen. */
  70. extern int gp_make_console_current(P1(gx_device *));
  71.  
  72. /* Make the graphics current on the screen. */
  73. extern int gp_make_graphics_current(P1(gx_device *));
  74.  
  75. /* ------ Printer accessing ------ */
  76.  
  77. /*
  78.  * Open a connection to a printer.  A null file name means use the
  79.  * standard printer connected to the machine, if any.
  80.  * If possible, support "|command" for opening an output pipe.
  81.  * Return NULL if the connection could not be opened.
  82.  */
  83. extern FILE *gp_open_printer(P1(char *fname));
  84.  
  85. /* Close the connection to the printer. */
  86. extern void gp_close_printer(P2(FILE *pfile, const char *fname));
  87.  
  88. /* ------ File names ------ */
  89.  
  90. /* Define the character used for separating file names in a list. */
  91. extern const char gp_file_name_list_separator;
  92.  
  93. /* Define the default scratch file name prefix. */
  94. extern const char gp_scratch_file_name_prefix[];
  95.  
  96. /* Define whether case is insignificant in file names. */
  97. extern const int gp_file_names_ignore_case;
  98.  
  99. /* Define the string to be concatenated with the file mode */
  100. /* for opening files without end-of-line conversion. */
  101. /* This is always either "" or "b". */
  102. extern const char gp_fmode_binary_suffix[];
  103. /* Define the file modes for binary reading or writing. */
  104. /* (This is just a convenience: they are "r" or "w" + the suffix.) */
  105. extern const char gp_fmode_rb[];
  106. extern const char gp_fmode_wb[];
  107.  
  108. /* Create and open a scratch file with a given name prefix. */
  109. /* Write the actual file name at fname. */
  110. extern FILE *gp_open_scratch_file(P3(const char *prefix, char *fname,
  111.                      const char *mode));
  112.  
  113. /* Answer whether a file name contains a directory/device specification, */
  114. /* i.e. is absolute (not directory- or device-relative). */
  115. extern int gp_file_name_is_absolute(P2(const char *fname, uint len));
  116.  
  117. /* Answer the string to be used for combining a directory/device prefix */
  118. /* with a base file name.  The file name is known to not be absolute. */
  119. extern const char *
  120.     gp_file_name_concat_string(P4(const char *prefix, uint plen,
  121.                       const char *fname, uint len));
  122.  
  123. /* ------ File operations ------ */
  124.  
  125. /* If the file given by fname exists, fill in its status and return 1; */
  126. /* otherwise return 0. */
  127. typedef struct file_status_s {
  128.     long size_pages;
  129.     long size_bytes;
  130.     long time_referenced;
  131.     long time_created;
  132. } file_status;
  133. extern int gp_file_status(P2(const char *fname, file_status *pstatus));
  134.  
  135. /* ------ File enumeration ------ */
  136.  
  137. struct file_enum_s;    /* opaque to client, defined by implementor */
  138. typedef struct file_enum_s file_enum;
  139.  
  140. /*
  141.  * Begin an enumeration.  pat is a C string that may contain *s or ?s.
  142.  * The implementor should copy the string to a safe place.
  143.  * If the operating system doesn't support correct, arbitrarily placed
  144.  * *s and ?s, the implementation should modify the string so that it
  145.  * will return a conservative superset of the request.  E.g., if the OS
  146.  * doesn't implement ? (single-character wild card), any consecutive
  147.  * string of ?s should be interpreted as *.  Note that \ can appear in
  148.  * the pattern also, as a quoting character.
  149.  */
  150. extern file_enum *gp_enumerate_files_init(P4(const char *pat, uint patlen,
  151.                          proc_alloc_t palloc,
  152.                          proc_free_t pfree));
  153.  
  154. /*
  155.  * Return the next file name in the enumeration.  The client passes in
  156.  * a scratch string and a max length.  If the name of the next file fits,
  157.  * the procedure returns the length.  If it doesn't fit, the procedure
  158.  * returns max length +1.  If there are no more files, the procedure
  159.  * returns -1.
  160.  */
  161. extern uint gp_enumerate_files_next(P3(file_enum *pfen, char *ptr, uint maxlen));
  162.  
  163. /*
  164.  * Clean up a file enumeration.  This is only called to abandon
  165.  * an enumeration partway through: ...next should do it if there are
  166.  * no more files to enumerate.  This should deallocate the file_enum
  167.  * structure and any subsidiary structures, strings, buffers, etc.
  168.  */
  169. extern void gp_enumerate_files_close(P1(file_enum *pfen));
  170.