home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-bin / x11r6.1 / include / x11 / xmu / xct.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-10-17  |  6.4 KB  |  173 lines

  1. /* $XConsortium: Xct.h,v 1.7 94/04/17 20:16:26 converse Exp $ */
  2.  
  3. /*
  4.  
  5. Copyright (c) 1989  X Consortium
  6.  
  7. Permission is hereby granted, free of charge, to any person obtaining a copy
  8. of this software and associated documentation files (the "Software"), to deal
  9. in the Software without restriction, including without limitation the rights
  10. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. copies of the Software, and to permit persons to whom the Software is
  12. furnished to do so, subject to the following conditions:
  13.  
  14. The above copyright notice and this permission notice shall be included in
  15. all copies or substantial portions of the Software.
  16.  
  17. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
  20. X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  21. AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23.  
  24. Except as contained in this notice, the name of the X Consortium shall not be
  25. used in advertising or otherwise to promote the sale, use or other dealings
  26. in this Software without prior written authorization from the X Consortium.
  27.  
  28. */
  29.  
  30. #ifndef _Xct_h
  31. #define _Xct_h
  32.  
  33. #include <X11/Xfuncproto.h>
  34.  
  35. #define XctVersion 1
  36.  
  37. typedef unsigned char *XctString;
  38.  
  39. typedef enum {
  40.     XctUnspecified,
  41.     XctLeftToRight,
  42.     XctRightToLeft
  43. } XctHDirection;
  44.  
  45. typedef unsigned long XctFlags;
  46.  
  47. /* These are bits in XctFlags. */
  48.  
  49. #define XctSingleSetSegments    0x0001
  50.    /* This means that returned segments should contain characters from only
  51.     * one set (C0, C1, GL, GR).  When this is requested, XctSegment is never
  52.     * returned, instead XctC0Segment, XctC1Segment, XctGlSegment, and
  53.     * XctGRSegment are returned.  C0 and C1 segments are always returned as
  54.     * singleton characters.
  55.     */
  56.  
  57. #define XctProvideExtensions    0x0002
  58.    /* This means that if the Compound Text string is from a higher version
  59.     * than this code is implemented to, then syntactically correct but unknown
  60.     * control sequences should be returned as XctExtension items.  If this
  61.     * flag is not set, and the Compound Text string version indicates that
  62.     * extensions cannot be ignored, then each unknown control sequence will be
  63.     * reported as an XctError.
  64.     */
  65.  
  66. #define XctAcceptC0Extensions    0x0004
  67.    /* This means that if the Compound Text string is from a higher version
  68.     * than this code is implemented to, then unknown C0 characters should be
  69.     * treated as if they were legal, and returned as C0 characters (regardless
  70.     * of how XctProvideExtensions is set).  If this flag is not set, then all
  71.     * unknown C0 characters are treated according to XctProvideExtensions.
  72.     */
  73.  
  74. #define XctAcceptC1Extensions    0x0008
  75.    /* This means that if the Compound Text string is from a higher version
  76.     * than this code is implemented to, then unknown C0 characters should be
  77.     * treated as if they were legal, and returned as C0 characters (regardless
  78.     * of how XctProvideExtensions is set).  If this flag is not set, then all
  79.     * unknown C0 characters are treated according to XctProvideExtensions.
  80.     */
  81.  
  82. #define XctHideDirection    0x0010
  83.    /* This means that horizontal direction changes should be reported as
  84.     * XctHorizontal items.  If this flag is not set, then direction changes are
  85.     * not returned as items, but the current direction is still maintained and
  86.     * reported for other items.
  87.     */
  88.  
  89. #define XctFreeString        0x0020
  90.    /* This means that XctFree should free the Compound Text string (that was
  91.     * passed to XctCreate.  If this flag is not set, the string is not freed.
  92.     */
  93.  
  94. #define XctShiftMultiGRToGL    0x0040
  95.    /* Translate GR segments on-the-fly into GL segments for the GR sets:
  96.     * GB2312.1980-1, JISX0208.1983-1, and KSC5601.1987-1.
  97.     */
  98.  
  99. /* This is the return type for XctNextItem. */
  100. typedef enum {
  101.     XctSegment,        /* used when XctSingleSetSegments is not requested */
  102.     XctC0Segment,    /* used when XctSingleSetSegments is requested */
  103.     XctGLSegment,    /* used when XctSingleSetSegments is requested */
  104.     XctC1Segment,    /* used when XctSingleSetSegments is requested */
  105.     XctGRSegment,    /* used when XctSingleSetSegments is requested */
  106.     XctExtendedSegment,    /* an extended segment */
  107.     XctExtension,    /* used when XctProvideExtensions is requested */
  108.     XctHorizontal,    /* horizontal direction or depth change */
  109.     XctEndOfText,    /* end of text string */
  110.     XctError        /* syntactic or semantic error */
  111. } XctResult;
  112.  
  113. typedef struct _XctRec {
  114.     XctString        total_string;    /* as given to XctCreate */
  115.     int            total_length;    /* as given to XctCreate */
  116.     XctFlags        flags;        /* as given to XctCreate */
  117.     int            version;    /* indicates the version of the CT spec
  118.                      * the string was produced from */
  119.     int            can_ignore_exts;/* non-zero if ignoring extensions is
  120.                      * acceptable, else zero */
  121.     XctString        item;        /* item returned from XctNextItem */
  122.     int            item_length;    /* length of item in bytes */
  123.     int            char_size;    /* number of bytes per character in
  124.                      * item, with zero meaning variable */
  125.     char        *encoding;    /* Encoding name for item */
  126.     XctHDirection    horizontal;    /* direction of item */
  127.     int            horz_depth;    /* current direction nesting depth */
  128.     char        *GL;        /* "{I} F" string for current GL */
  129.     char        *GL_encoding;    /* Encoding name for current GL */
  130.     int            GL_set_size;    /* 94 or 96 */
  131.     int            GL_char_size;    /* number of bytes per GL character */
  132.     char        *GR;        /* "{I} F" string for current GR */
  133.     char        *GR_encoding;    /* Encoding name for current GR */
  134.     int            GR_set_size;    /* 94 or 96 */
  135.     int            GR_char_size;    /* number of bytes per GR character */
  136.     char        *GLGR_encoding;    /* Encoding name for current GL+GR,
  137.                      * if known */
  138.     struct _XctPriv    *priv;        /* private to parser, don't peek */
  139. } *XctData;
  140.  
  141. /* these are the external routines */
  142. _XFUNCPROTOBEGIN
  143.  
  144. extern XctData XctCreate(
  145. #if NeedFunctionPrototypes
  146.     _Xconst unsigned char *    /* string */,
  147.     int            /* length */,
  148.     XctFlags        /* flags */
  149. #endif
  150. );
  151.  
  152. extern XctResult XctNextItem(
  153. #if NeedFunctionPrototypes
  154.     XctData    /* data */
  155. #endif
  156. );
  157.  
  158. extern void XctFree(
  159. #if NeedFunctionPrototypes
  160.     XctData    /* data */
  161. #endif
  162. );
  163.  
  164. extern void XctReset(
  165. #if NeedFunctionPrototypes
  166.     XctData    /* data */
  167. #endif
  168. );
  169.  
  170. _XFUNCPROTOEND
  171.  
  172. #endif /* _Xct_h */
  173.