home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / fonts / lib / fs / FSlib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-07-16  |  5.5 KB  |  185 lines

  1. /* $XConsortium: FSlib.h,v 1.6 91/07/16 20:32:18 keith Exp $ */
  2. /*
  3.  * Font server C interface library
  4.  */
  5. /*
  6.  * Copyright 1990, 1991 Network Computing Devices;
  7.  * Portions Copyright 1987 by Digital Equipment Corporation and the
  8.  * Massachusetts Institute of Technology
  9.  *
  10.  * Permission to use, copy, modify, and distribute this protoype software
  11.  * and its documentation to Members and Affiliates of the MIT X Consortium
  12.  * any purpose and without fee is hereby granted, provided
  13.  * that the above copyright notice appear in all copies and that both that
  14.  * copyright notice and this permission notice appear in supporting
  15.  * documentation, and that the names of Network Computing Devices, Digital or
  16.  * MIT not be used in advertising or publicity pertaining to distribution of
  17.  * the software without specific, written prior permission.
  18.  *
  19.  * NETWORK COMPUTING DEVICES, DIGITAL AND MIT DISCLAIM ALL WARRANTIES WITH
  20.  * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  21.  * AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES, DIGITAL OR MIT BE
  22.  * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  23.  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  24.  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  25.  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  26.  *
  27.  * @(#)FSlib.h    4.1    91/05/02
  28.  *
  29.  */
  30.  
  31. #ifndef _FSLIB_H_
  32. #define _FSLIB_H_
  33.  
  34. #include    <FS.h>
  35. #include    <FSproto.h>
  36.  
  37. #define    Bool    int
  38. #define    Status    int
  39. #define    True    1
  40. #define    False    0
  41.  
  42. #define QueuedAlready 0
  43. #define QueuedAfterReading 1
  44. #define QueuedAfterFlush 2
  45.  
  46. #define    FSServerString(svr)    ((svr)->server_name)
  47. #define    FSVendorRelease(svr)    ((svr)->release)
  48. #define    FSProtocolVersion(svr)    ((svr)->proto_version)
  49. #define    FSServerVendor(svr)    ((svr)->vendor)
  50. #define    FSAuthorizationData(svr)    ((svr)->auth_data)
  51. #define    FSAlternateServers(svr)    ((svr)->alternate_servers)
  52. #define    FSNumAlternateServers(svr)    ((svr)->num_alternates)
  53.  
  54. #ifdef QLength
  55. #undef QLength
  56. #endif
  57. #define    QLength(svr)        ((svr)->qlen)
  58. #ifdef NextRequest
  59. #undef NextRequest
  60. #endif
  61. #define    NextRequest(svr)    ((svr)->request + 1)
  62. #ifdef LastKnownRequestProcessed
  63. #undef LastKnownRequestProcessed
  64. #endif
  65. #define LastKnownRequestProcessed(svr)   ((svr)->last_request_read)
  66.  
  67. #define    FSAllocID(svr)        ((*(svr)->resource_alloc)((svr)))
  68.  
  69. typedef struct _alternate {
  70.     Bool        subset;
  71.     char       *name;
  72. }           AlternateServer;
  73.  
  74. /* extension stuff */
  75. typedef struct _FSExtData {
  76.     int         number;        /* number returned by FSRegisterExtension */
  77.     struct _FSExtData *next;    /* next item on list of data for structure */
  78.     int         (*free_private) ();    /* called to free private storage */
  79.     char       *private_data;    /* data private to this extension. */
  80. }           FSExtData;
  81.  
  82.  
  83. typedef struct {        /* public to extension, cannot be changed */
  84.     int         extension;    /* extension number */
  85.     int         major_opcode;    /* major op-code assigned by server */
  86.     int         first_event;    /* first event number for the extension */
  87.     int         first_error;    /* first error number for the extension */
  88. }           FSExtCodes;
  89.  
  90. typedef struct _FSExtent {
  91.     struct _FSExtent *next;    /* next in list */
  92.     FSExtCodes  codes;        /* public information, all extension told */
  93.     int         (*close_server) ();    /* routine to call when connection
  94.                      * closed */
  95.     int         (*error) ();    /* who to call when an error occurs */
  96.     int         (*error_string) ();    /* routine to supply error string */
  97.     char       *name;
  98. }           _FSExtension;
  99.  
  100.  
  101. /* server data structure */
  102. typedef struct _FSServer {
  103.     struct _FSServer *next;
  104.     int         fd;
  105.     int         proto_version;
  106.     char       *vendor;
  107.     int         byte_order;
  108.     int         vnumber;
  109.     int         release;
  110.     int         resource_id;
  111.     struct _FSQEvent *head,
  112.                *tail;
  113.     int         qlen;
  114.     unsigned long last_request_read;
  115.     unsigned long request;
  116.     char       *last_req;
  117.     char       *buffer;
  118.     char       *bufptr;
  119.     char       *bufmax;
  120.     unsigned    max_request_size;
  121.     char       *server_name;
  122.     char       *auth_data;
  123.     AlternateServer *alternate_servers;
  124.     int         num_alternates;
  125.     FSExtData  *ext_data;
  126.     _FSExtension *ext_procs;
  127.     int         ext_number;
  128.     Bool        (*event_vec[132]) ();
  129.                 Status(*wire_vec[132]) ();
  130.     char       *scratch_buffer;
  131.     unsigned long scratch_length;
  132.     int         (*synchandler) ();
  133.     unsigned long flags;
  134. }           FSServer;
  135.  
  136. typedef struct {
  137.     int         type;
  138.     unsigned long serial;
  139.     Bool        send_event;
  140.     FSServer   *server;
  141. }           FSAnyEvent;
  142.  
  143. typedef struct {
  144.     int         type;
  145.     FSServer   *server;
  146.     FSID        resourceid;
  147.     unsigned long serial;
  148.     unsigned char error_code;
  149.     unsigned char request_code;
  150.     unsigned char minor_code;
  151. }           FSErrorEvent;
  152.  
  153. typedef union _FSEvent {
  154.     int         type;
  155.     FSAnyEvent  fsany;
  156. }           FSEvent;
  157.  
  158. typedef struct _FSQEvent {
  159.     struct _FSQEvent *next;
  160.     FSEvent     event;
  161. }           _FSQEvent;
  162.  
  163. /* function decls */
  164.  
  165. FSServer   *FSOpenServer();
  166.  
  167. extern int  (*FSSynchronize()) ();
  168. extern int  (*FSSetAfterFunction()) ();
  169.  
  170. char       *FSServerName();
  171. char      **FSListExtensions();
  172. Bool        FSQueryExtension();
  173.  
  174. char      **FSListCatalogues();
  175. char      **FSGetCatalogues();
  176.  
  177. long        FSMaxRequestSize();
  178.  
  179. char      **FSListFonts();
  180. char      **FSListFontsWithXInfo();
  181.  
  182. Font        FSOpenBitmapFont();
  183.  
  184. #endif                /* _FSLIB_H_ */
  185.