PageRenderTime 101ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/nx-3.5.0/nx-X11/lib/FS/FSlib.h

#
C Header | 313 lines | 205 code | 47 blank | 61 comment | 0 complexity | 847462ab320a18c35a2b03dc1d2110ea MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-2.0, LGPL-2.0
  1. /* $Xorg: FSlib.h,v 1.5 2001/02/09 02:03:25 xorgcvs Exp $ */
  2. /*
  3. * Copyright 1990 Network Computing Devices;
  4. * Portions Copyright 1987 by Digital Equipment Corporation
  5. *
  6. * Permission to use, copy, modify, distribute, and sell this software
  7. * and its documentation for any purpose is hereby granted without fee,
  8. * provided that the above copyright notice appear in all copies and
  9. * that both that copyright notice and this permission notice appear
  10. * in supporting documentation, and that the names of Network Computing
  11. * Devices or Digital not be used in advertising or publicity pertaining
  12. * to distribution of the software without specific, written prior
  13. * permission. Network Computing Devices or Digital make no representations
  14. * about the suitability of this software for any purpose. It is provided
  15. * "as is" without express or implied warranty.
  16. *
  17. * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
  18. * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
  19. * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
  20. * OR DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES
  21. * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  22. * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  23. * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  24. * SOFTWARE.
  25. */
  26. /* $XFree86: xc/lib/FS/FSlib.h,v 1.6 2001/12/14 19:53:33 dawes Exp $ */
  27. /*
  28. Copyright 1987, 1994, 1998 The Open Group
  29. Permission to use, copy, modify, distribute, and sell this software and its
  30. documentation for any purpose is hereby granted without fee, provided that
  31. the above copyright notice appear in all copies and that both that
  32. copyright notice and this permission notice appear in supporting
  33. documentation.
  34. The above copyright notice and this permission notice shall be included in
  35. all copies or substantial portions of the Software.
  36. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  37. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  38. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  39. OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  40. AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  41. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  42. Except as contained in this notice, the name of The Open Group shall not be
  43. used in advertising or otherwise to promote the sale, use or other dealings
  44. in this Software without prior written authorization from The Open Group.
  45. */
  46. /*
  47. * Font server C interface library
  48. */
  49. #ifndef _FSLIB_H_
  50. #define _FSLIB_H_
  51. #include <X11/Xfuncproto.h>
  52. #include <X11/fonts/FS.h>
  53. #include <X11/fonts/FSproto.h>
  54. #define Bool int
  55. #define Status int
  56. #define True 1
  57. #define False 0
  58. #define QueuedAlready 0
  59. #define QueuedAfterReading 1
  60. #define QueuedAfterFlush 2
  61. #define FSServerString(svr) ((svr)->server_name)
  62. #define FSVendorRelease(svr) ((svr)->release)
  63. #define FSProtocolVersion(svr) ((svr)->proto_version)
  64. #define FSServerVendor(svr) ((svr)->vendor)
  65. #define FSAuthorizationData(svr) ((svr)->auth_data)
  66. #define FSAlternateServers(svr) ((svr)->alternate_servers)
  67. #define FSNumAlternateServers(svr) ((svr)->num_alternates)
  68. #define FSQLength(svr) ((svr)->qlen)
  69. #define FSNextRequest(svr) ((svr)->request + 1)
  70. #define FSLastKnownRequestProcessed(svr) ((svr)->last_request_read)
  71. #define FSAllocID(svr) ((*(svr)->resource_alloc)((svr)))
  72. typedef struct _alternate {
  73. Bool subset;
  74. char *name;
  75. } AlternateServer;
  76. /* extension stuff */
  77. typedef struct _FSExtData {
  78. int number; /* number returned by FSRegisterExtension */
  79. struct _FSExtData *next; /* next item on list of data for structure */
  80. int (*free_private) (char *); /* called to free private storage */
  81. char *private_data; /* data private to this extension. */
  82. } FSExtData;
  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. typedef struct _FSServer FSServer;
  90. typedef union _FSEvent FSEvent;
  91. typedef struct _FSExtent {
  92. struct _FSExtent *next; /* next in list */
  93. FSExtCodes codes; /* public information, all extension told */
  94. int (*close_server) (FSServer *, FSExtCodes *); /* routine to call when connection
  95. * closed */
  96. int (*error) (FSServer *, fsError *, FSExtCodes *, int *); /* who to call when an error occurs */
  97. int (*error_string) (FSServer *, int, FSExtCodes *, char *, int); /* routine to supply error string */
  98. char *name;
  99. } _FSExtension;
  100. typedef int (*FSSyncHandler)(FSServer *);
  101. /* server data structure */
  102. 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]) (FSServer *, FSEvent *, fsEvent *);
  129. Status (*wire_vec[132]) (FSServer *, FSEvent *, fsEvent *);
  130. char *scratch_buffer;
  131. unsigned long scratch_length;
  132. FSSyncHandler synchandler;
  133. unsigned long flags;
  134. struct _XtransConnInfo *trans_conn; /* transport connection object */
  135. };
  136. typedef struct {
  137. int type;
  138. unsigned long serial;
  139. Bool send_event;
  140. FSServer *server;
  141. } FSAnyEvent;
  142. typedef struct {
  143. int type;
  144. FSServer *server;
  145. FSID resourceid;
  146. unsigned long serial;
  147. unsigned char error_code;
  148. unsigned char request_code;
  149. unsigned char minor_code;
  150. } FSErrorEvent;
  151. union _FSEvent {
  152. int type;
  153. FSAnyEvent fsany;
  154. };
  155. typedef struct _FSQEvent {
  156. struct _FSQEvent *next;
  157. FSEvent event;
  158. } _FSQEvent;
  159. /* protocol-related stuctures */
  160. typedef unsigned long FSBitmapFormat;
  161. typedef unsigned long FSBitmapFormatMask;
  162. typedef struct _FSChar2b {
  163. unsigned char high;
  164. unsigned char low;
  165. } FSChar2b;
  166. typedef struct _FSRange {
  167. FSChar2b min_char;
  168. FSChar2b max_char;
  169. } FSRange;
  170. typedef struct _FSOffset {
  171. unsigned int position;
  172. unsigned int length;
  173. } FSOffset;
  174. /* use names as in xCharInfo? */
  175. typedef struct _FSXCharInfo {
  176. short left;
  177. short right;
  178. short width;
  179. short ascent;
  180. short descent;
  181. unsigned short attributes;
  182. } FSXCharInfo;
  183. typedef struct _FSPropOffset {
  184. FSOffset name;
  185. FSOffset value;
  186. unsigned char type;
  187. } FSPropOffset;
  188. typedef struct _FSPropInfo {
  189. unsigned int num_offsets;
  190. unsigned int data_len;
  191. } FSPropInfo;
  192. /* should names match FontInfoRec? */
  193. typedef struct _FSXFontInfoHeader {
  194. int flags;
  195. FSRange char_range;
  196. unsigned draw_direction;
  197. FSChar2b default_char;
  198. FSXCharInfo min_bounds;
  199. FSXCharInfo max_bounds;
  200. short font_ascent;
  201. short font_descent;
  202. } FSXFontInfoHeader;
  203. /* function decls */
  204. _XFUNCPROTOBEGIN
  205. extern FSServer * FSOpenServer ( char *server );
  206. extern FSSyncHandler FSSynchronize(FSServer *, int);
  207. extern FSSyncHandler FSSetAfterFunction(FSServer *, FSSyncHandler);
  208. extern char * FSServerName ( char *server );
  209. extern char ** FSListExtensions ( FSServer *svr, int *next );
  210. extern int FSQueryExtension ( FSServer *svr, char *name, int *major_opcode,
  211. int *first_event, int *first_error );
  212. extern char ** FSListCatalogues ( FSServer *svr, char *pattern,
  213. int maxNames, int *actualCount );
  214. extern char ** FSGetCatalogues ( FSServer *svr, int *num );
  215. extern long FSMaxRequestSize ( FSServer *svr );
  216. extern char ** FSListFonts ( FSServer *svr, char *pattern, int maxNames,
  217. int *actualCount );
  218. extern char ** FSListFontsWithXInfo ( FSServer *svr, char *pattern,
  219. int maxNames, int *count,
  220. FSXFontInfoHeader ***info,
  221. FSPropInfo ***pprops,
  222. FSPropOffset ***offsets,
  223. unsigned char ***prop_data );
  224. extern Font FSOpenBitmapFont ( FSServer *svr, FSBitmapFormat hint,
  225. FSBitmapFormatMask fmask, char *name,
  226. Font *otherid );
  227. extern int FSSync ( FSServer *svr, Bool discard );
  228. extern int FSCloseServer ( FSServer *svr );
  229. extern int FSCloseFont ( FSServer *svr, Font fid );
  230. extern int FSGetErrorDatabaseText ( FSServer *svr, char *name, char *type,
  231. char *defaultp, char *buffer, int nbytes );
  232. extern int FSGetErrorText ( FSServer *svr, int code, char *buffer,
  233. int nbytes );
  234. extern int FSFlush ( FSServer *svr );
  235. extern int FSFreeFontNames ( char **list );
  236. extern int FSFreeCatalogues ( char **list );
  237. extern int FSFreeExtensionList ( char **list );
  238. extern int FSNextEvent ( FSServer *svr, FSEvent *event );
  239. extern int FSQueryXBitmaps8 ( FSServer *svr, Font fid, FSBitmapFormat format,
  240. int range_type, unsigned char *str,
  241. unsigned long str_len, FSOffset **offsets,
  242. unsigned char **glyphdata );
  243. extern int FSQueryXBitmaps16 ( FSServer *svr, Font fid, FSBitmapFormat format,
  244. int range_type, FSChar2b *str,
  245. unsigned long str_len, FSOffset **offsets,
  246. unsigned char **glyphdata );
  247. extern int FSQueryXExtents8 ( FSServer *svr, Font fid, int range_type,
  248. unsigned char *str, unsigned long str_len,
  249. FSXCharInfo **extents );
  250. extern int FSQueryXExtents16 ( FSServer *svr, Font fid, int range_type,
  251. FSChar2b *str, unsigned long str_len,
  252. FSXCharInfo **extents );
  253. extern int FSQueryXInfo ( FSServer *svr, Font fid, FSXFontInfoHeader *info,
  254. FSPropInfo *props, FSPropOffset **offsets,
  255. unsigned char **prop_data );
  256. extern int FSSetCatalogues ( FSServer *svr, int num, char **cats );
  257. extern int FSFree ( char *data );
  258. extern unsigned char * FSMalloc ( unsigned size );
  259. _XFUNCPROTOEND
  260. #endif /* _FSLIB_H_ */