home *** CD-ROM | disk | FTP | other *** search
/ WordPerfect for Linux Bible / WP4LinuxBible.iso / sdk / wpx / code / wt / wtapi.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-06-25  |  12.0 KB  |  310 lines

  1.  
  2. /* HEADER FILE *****************************************************
  3.  * WTAPI.H  -  Platform-specific Writing Tools API declarations
  4.  *******************************************************************
  5.  *  Copyright (C) 1994 WordPerfect Corp., All Rights Reserved
  6.  *******************************************************************/
  7. #ifndef WTAPI_H
  8. #define WTAPI_H
  9.  
  10. #include <wtdef.h>
  11. #include <Xm/Xm.h>
  12.  
  13. /*** Definitions used for sending command messages ***/
  14. /*** We can use the same routines as the query     ***/
  15. /*** messages with the return message information  ***/
  16. /*** zeroed out.                                   ***/
  17. #define wtcClSend(comm,inmsgid,inmsg,inmsgsize,inbuf,inbufsize) \
  18.         wtqClSend(comm,inmsgid,inmsg,inmsgsize,inbuf,inbufsize,    \
  19.                   WTC_NOMESSAGE, NULL, 0, NULL, 0)
  20.  
  21. #define wtcTlSend(comm,inmsgid,inmsg,inmsgsize,inbuf,inbufsize) \
  22.         wtqTlSend(comm,inmsgid,inmsg,inmsgsize,inbuf,inbufsize,    \
  23.                   WTC_NOMESSAGE, NULL, 0, NULL, 0)
  24.  
  25. /*** Types and Structures ***/
  26. typedef struct {
  27.     int read;    /* file descriptor to read from */
  28.     int write;    /* file descriptor to write to */
  29. } WTPIPE;
  30.  
  31. typedef struct {
  32.     char *client;        /* client id string */
  33.     char *tool;            /* tool id string */
  34.     WTPIPE cl_pipe;        /* client's read/write file descriptors */
  35.     WTPIPE tl_pipe;        /* tool's read/write file descriptors */
  36.     XtInputId inputid;    /* id of XtInputCallbackProc */
  37.     Widget toplevel;    /* widget of own toplevel shell */
  38.     Window window;        /* window id of communication partner */
  39. } WTCOMMDATA, *WTCOMM;        /* platform specific communication */
  40.  
  41. typedef unsigned char WTBUF, *WTBUFP;/* Pointer for Writing Tool information buffers */
  42. typedef unsigned WTSIZE, *WTSIZEP;    /* size (unsigned) WTAPI values */
  43. typedef int WTCOUNT, *WTCOUNTP;        /* counted (signed) WTAPI values */
  44.  
  45. typedef unsigned short WTACTION;    /* writing tool action */
  46. typedef unsigned short WTDAMODE;    /* writing tool data storage modes */
  47. typedef unsigned short WTINFO;        /* writing tool reactivation info */
  48. typedef unsigned long WTTEXT;        /* writing tool text types */
  49. typedef unsigned long WTUNIT;        /* writing tool text units */
  50.  
  51. typedef struct {                    /* WTLANG structure */
  52.     unsigned char    script;                /* script of text */
  53.     unsigned char    language;            /* language of text */
  54.     unsigned short    region;                /* region (dialect) of text */
  55. } WTLANG, *WTLANGP;
  56.  
  57. /*** Message Structures ***/
  58. typedef struct {                    /* WTC_RQINIT message */
  59.     WTMSGID        msgid;                    /* WTC_RQINIT */
  60.     WTBOOL        newdoc;                    /* new document or window? */
  61.     WTSIZE        size;                    /* size of document path name */
  62. } WTCRQINIT, *WTCRQINITP;
  63.  
  64. typedef struct {                    /* WTC_INIT message */
  65.     WTMSGID        msgid;                    /* WTC_INIT */
  66.     WTMODE        mode;                    /* desired mode of execution */
  67.     int            version;                /* API version number */
  68.     Window        windowClient;            /* Client's window id */
  69. } WTCINIT, *WTCINITP;
  70.  
  71. typedef struct {                    /* WTQ_INFOBLOCK message */
  72.     WTMSGID        msgid;                    /* WTQ_INFOBLOCK */
  73.     WTTOOL        tooltype;                /* type of writing tool */
  74.     WTTEXT        suptext;                /* supported text modes */
  75.     WTTEXT        preftext;                /* preferred text mode */
  76.     int            version;                /* API version number */
  77.     WTBOOL        cleanTxt;                /* support clean text? */
  78.     WTBOOL        resume;                    /* resume a query? */
  79.     WTSIZE        size;                    /* maximum size of a block */
  80. } WTQINFOBLOCK, *WTQINFOBLOCKP;
  81.  
  82. typedef struct {                    /* WTR_INFOBLOCK message */
  83.     WTMSGID        msgid;                    /* WTR_INFOBLOCK */
  84.     WTSTATUS    status;                    /* return status from client */
  85.     WTTEXT        textmode;                /* mode of representing text */
  86.     WTDAMODE    tdamode;                /* supported tool data area modes */
  87.     WTLANG        userlang;                /* user interface language */
  88.     WTLANG        textlang;                /* default text language */
  89.     WTBOOL        hastext;                /* the client has default text */
  90.     int            service;                /* writing tool service requested */
  91.     WTSIZE        mysize;                    /* maximum size block to the client */
  92.     WTBOOL        complete;                /* is text request complete? */
  93.     WTSIZE        winsize;                /* size of window name text */
  94. } WTRINFOBLOCK, *WTRINFOBLOCKP;
  95.  
  96. typedef struct {                    /* WTQ_UNITINFO message */
  97.     WTMSGID        msgid;                    /* WTQ_UNITINFO */
  98. } WTQUNITINFO, *WTQUNITINFOP;
  99.  
  100. typedef struct {                    /* WTR_UNITINFO message */
  101.     WTMSGID        msgid;                    /* WTR_UNITINFO */
  102.     WTSTATUS    status;                    /* return status from client */
  103.     WTUNIT        supunit;                /* supported text units */
  104.     WTUNIT        curunit;                /* current text units */
  105.     WTUNIT        defunit;                /* default text unit */
  106.     WTSIZE        size;                    /* size of client-defined unit text */
  107. } WTRUNITINFO, *WTRUNITINFOP;
  108.  
  109. typedef struct {                    /* WTQ_READTOOLDATA message */
  110.     WTMSGID        msgid;                    /* WTQ_READTOOLDATA */
  111.     int            company;                /* company ID of this block */
  112.     int            product;                /* product/version of block */
  113.     WTDAMODE    tdamode;                /* tool data area mode */
  114.     WTBOOL        resume;                    /* resume the current query */
  115.     WTSIZE        size;                    /* maximum size of a block */
  116. } WTQREADTOOLDATA, *WTQREADTOOLDATAP;
  117.  
  118. typedef struct {                    /* WTR_READTOOLDATA message */
  119.     WTMSGID        msgid;                    /* WTR_READTOOLDATA */
  120.     WTSTATUS    status;                    /* return status from client */
  121.     WTBOOL        complete;                /* is request now complete? */
  122.     WTSIZE        size;                    /* size of data returned */
  123. } WTRREADTOOLDATA, *WTRREADTOOLDATAP;
  124.  
  125. typedef struct {                    /* WTQ_WRITETOOLDATA message */
  126.     WTMSGID        msgid;                    /* WTQ_WRITETOOLDATA */
  127.     int            company;                /* company ID */
  128.     int            product;                /* product/version info */
  129.     WTDAMODE    tdamode;                /* tool data area mode */
  130.     WTBOOL        append;                    /* should the data be appended? */
  131.     WTSIZE        size;                    /* size of data to write */
  132. } WTQWRITETOOLDATA, *WTQWRITETOOLDATAP;
  133.  
  134. typedef struct {                    /* WTR_WRITETOOLDATA message */
  135.     WTMSGID        msgid;                    /* WTR_WRITETOOLDATA */
  136.     WTSTATUS    status;                    /* return status from client */
  137.     WTSIZE        size;                    /* actual size of data written */
  138. } WTRWRITETOOLDATA, *WTRWRITETOOLDATAP;
  139.  
  140. typedef struct {                    /* WTQ_TEXTBLOCK message */
  141.     WTMSGID        msgid;                    /* WTQ_TEXTBLOCK */
  142.     WTUNIT        fromunit;                /* start at beginning of unit */
  143.     WTPOS        frompos;                /* REL/ABS starting position */
  144.     WTCOUNT        fromloc;                /* current, back/forward ... */
  145.     WTUNIT        tounit;                    /* end at end of unit */
  146.     WTPOS        topos;                    /* REL/ABS ending position */
  147.     WTCOUNT        toloc;                    /* current, back/forward ... */
  148.     WTTBQTYPE    qtype;                    /* type of query */
  149.     WTBOOL        containers;                /* return sub-containers? */
  150.     WTBOOL        tracking;                /* Track user's changes? */
  151.     WTSIZE        size;                    /* maximum size of a block */
  152.     Window        windowTool;                /* Tool's window id */
  153. } WTQTEXTBLOCK, *WTQTEXTBLOCKP;
  154.  
  155. typedef struct {                    /* WTQ_NEXTTEXTBLOCK message */
  156.     WTMSGID        msgid;                    /* WTQ_NEXTTEXTBLOCK */
  157.     WTSIZE        size;                    /* maximum size of a block */
  158. } WTQNEXTTEXTBLOCK, *WTQNEXTTEXTBLOCKP;
  159.  
  160. typedef struct {                    /* WTR_TEXTBLOCK message */
  161.     WTMSGID        msgid;                    /* WTR_TEXTBLOCK */
  162.     WTSTATUS    status;                    /* return status from client */
  163.     WTSIZE        blocknum;                /* the id number of this block */
  164.     WTLANG        language;                /* language of this text block */
  165.     WTCOUNT        depth;                    /* relative block container depth */
  166.     WTENDBLOCK    endblock;                /* cause of end of text block */
  167.     WTSIZE        size;                    /* size of text block */
  168. } WTRTEXTBLOCK, *WTRTEXTBLOCKP;
  169.  
  170. typedef struct {                    /* WTQ_READTEXTOBJECT message */
  171.     WTMSGID        msgid;                    /* WTQ_READTEXTOBJECT */
  172.     WTCOUNT     idnumber;                /* id of object to read */
  173.     WTBOOL        resume;                    /* resume the current query */
  174.     WTSIZE        size;                    /* maximum size of a block */
  175. } WTQREADTEXTOBJECT, *WTQREADTEXTOBJECTP;
  176.  
  177. typedef struct {                    /* WTR_READTEXTOBJECT message */
  178.     WTMSGID        msgid;                    /* WTR_READTEXTOBJECT */
  179.     WTSTATUS    status;                    /* return status from client */
  180.     WTBOOL        complete;                /* is request now complete? */
  181.     WTSIZE        size;                    /* size of data returned */
  182. } WTRREADTEXTOBJECT, *WTRREADTEXTOBJECTP;
  183.  
  184. typedef struct {                    /* WTQ_WRITETEXTOBJECT message */
  185.     WTMSGID        msgid;                    /* WTQ_WRITETEXTOBJECT    */
  186.     WTCOUNT     idnumber;                /* id of object to write */
  187.     WTBOOL        append;                    /* should the data be appended? */
  188.     WTSIZE        size;                    /* size of data to write */
  189. } WTQWRITETEXTOBJECT, *WTQWRITETEXTOBJECTP;
  190.  
  191. typedef struct {                    /* WTR_WRITETEXTOBJECT message */
  192.     WTMSGID        msgid;                    /* WTR_WRITETEXTOBJECT */
  193.     WTSTATUS    status;                    /* return status from client */
  194.     WTSIZE        size;                    /* actual size of data written */
  195. } WTRWRITETEXTOBJECT, *WTRWRITETEXTOBJECTP;
  196.  
  197. typedef struct {                    /* WTQ_GOTO message */
  198.     WTMSGID        msgid;                    /* WTQ_GOTO */
  199.     WTPOS        blockpos;                /* REL/ABS block number */
  200.     WTCOUNT        blocknum;                /* block number */
  201.     WTPOS        offsetpos;                /* REL/ABS offset in block */
  202.     WTCOUNT        offsetloc;                /* offset in block */
  203. } WTQGOTO, *WTQGOTOP;
  204.  
  205. typedef struct {                    /* WTR_GOTO message */
  206.     WTMSGID        msgid;                    /* WTR_GOTO */
  207.     WTSTATUS    status;                    /* return status from client */
  208.     WTCOUNT        count;                    /* count of API bytes moved */
  209.     WTSIZE        block;                    /* new cursor block position */
  210.     WTSIZE        offset;                    /* new cursor offset in block */
  211. } WTRGOTO, *WTRGOTOP;
  212.  
  213. typedef struct {                    /* WTQ_HILITE message */
  214.     WTMSGID        msgid;                    /* WTQ_HILITE */
  215.     WTCOUNT        count;                    /* count of bytes to highlight */
  216. } WTQHILITE, *WTQHILITEP;
  217.  
  218. typedef struct {                    /* WTR_HILITE message */
  219.     WTMSGID        msgid;                    /* WTR_HILITE */
  220.     WTSTATUS    status;                    /* return status from client */
  221.     WTCOUNT        count;                    /* count of bytes highlighted */
  222. } WTRHILITE, *WTRHILITEP;
  223.  
  224. typedef struct {                    /* WTQ_DEHILITE message */
  225.     WTMSGID        msgid;                    /* WTQ_DEHILITE */
  226.     WTCOUNT        count;                    /* count of bytes to dehilite */
  227. } WTQDEHILITE, *WTQDEHILITEP;
  228.  
  229. typedef struct {                    /* WTR_DEHILITE message */
  230.     WTMSGID        msgid;                    /* WTR_DEHILITE */
  231.     WTSTATUS    status;                    /* return status from client */
  232.     WTCOUNT        count;                    /* count of bytes dehilited */
  233. } WTRDEHILITE, *WTRDEHILITEP;
  234.  
  235. typedef struct {                    /* WTQ_REPLACE message */
  236.     WTMSGID        msgid;                    /* WTQ_REPLACE */
  237.     WTLANG        language;                /* language of this replacement */
  238.     WTCOUNT     depth;                    /* relative depth of this replacement */
  239.     WTCOUNT        count;                    /* count of bytes to remove */
  240.     WTBOOL        newblock;                /* put this text in its own block? */
  241.     WTSIZE        size;                    /* size of replacement buffer */
  242. } WTQREPLACE, *WTQREPLACEP;
  243.  
  244. typedef struct {                    /* WTQ_UNDOREPLACE message */
  245.     WTMSGID        msgid;                    /* WTQ_UNDOREPLACE */
  246. } WTQUNDOREPLACE, *WTQUNDOREPLACEP;
  247.  
  248. typedef struct {                    /* WTR_REPLACE message */
  249.     WTMSGID        msgid;                    /* WTR_REPLACE */
  250.     WTSTATUS    status;                    /* return status from client */
  251.     WTCOUNT        count;                    /* count of bytes removed */
  252.     WTSIZE        size;                    /* actual replacement buffer size */
  253.     WTSIZE        block;                    /* new cursor block position */
  254.     WTSIZE        offset;                    /* new cursor offset in block */
  255. } WTRREPLACE, *WTRREPLACEP;
  256.  
  257. typedef struct {                    /* WTC_RQCLACTIVE message */
  258.     WTMSGID        msgid;                    /* WTC_RQCLACTIVE */
  259. } WTCRQCLACTIVE, *WTCRQCLACTIVEP;
  260.  
  261. typedef struct {                    /* WTC_CLACTIVE message */
  262.     WTMSGID        msgid;                    /* WTC_CLACTIVE */
  263.     WTACTION    action;                    /* desired writing tool action */
  264. } WTCCLACTIVE, *WTCCLACTIVEP;
  265.  
  266. typedef struct {                    /* WTC_CLINACTIVE message */
  267.     WTMSGID        msgid;                    /* WTC_INCLACTIVE */
  268.     WTACTION    action;                    /* desired writing tool action */
  269. } WTCCLINACTIVE, *WTCCLINACTIVEP;
  270.  
  271. typedef struct {                    /* WTC_TLINACTIVE message */
  272.     WTMSGID        msgid;                    /* WTC_TLINACTIVE */
  273.     WTACTION    action;                 /* desired writing tool action */
  274. } WTCTLINACTIVE, *WTCTLINACTIVEP;
  275.  
  276. typedef struct {                    /* WTQ_TLACTIVE message */
  277.     WTMSGID        msgid;                    /* WTQ_TLACTIVE */
  278. } WTQTLACTIVE, *WTQTLACTIVEP;
  279.  
  280. typedef struct {                    /* WTR_TLACTIVE message */
  281.     WTMSGID        msgid;                    /* WTR_TLACTIVE */
  282.     WTSTATUS    status;                    /* return status from client */
  283.     WTCOUNT        modified;                /* number of blocks modified */
  284.     WTCOUNT     cursor;                 /* new client cursor position */
  285.     WTINFO        newinfo;                /* need new client information? */
  286. } WTRTLACTIVE, *WTRTLACTIVEP;
  287.  
  288. typedef struct {                    /* WTC_RQTLTERM message */
  289.     WTMSGID        msgid;                    /* WTC_RQTLTERM    */
  290. } WTCRQTLTERM, *WTCRQTLTERMP;
  291.  
  292. typedef struct {                    /* WTC_TLTERM message */
  293.     WTMSGID        msgid;                    /* WTC_TLTERM */
  294. } WTCTLTERM, *WTCTLTERMP;
  295.  
  296.  
  297. /*** Function Prototypes ***/
  298.  
  299. WTSTATUS wtqClSend(WTCOMM, WTMSGID, WTBUFP, WTSIZE, WTBUFP, WTSIZE,
  300.                            WTMSGID, WTBUFP, WTSIZE, WTBUFP, WTSIZE);
  301.  
  302. WTSTATUS wtqTlSend(WTCOMM, WTMSGID, WTBUFP, WTSIZE, WTBUFP, WTSIZE,
  303.                                WTMSGID, WTBUFP, WTSIZE, WTBUFP, WTSIZE);
  304.  
  305. WTSTATUS wtClReceive(WTCOMM, WTMSGID, WTBUFP, WTBUFP, WTBUFP, WTBUFP, WTSIZEP);
  306.  
  307. WTSTATUS wtTlReceive(WTCOMM, WTMSGID, WTBUFP, WTBUFP, WTBUFP, WTBUFP, WTSIZEP);
  308.  
  309. #endif    /* WTAPI_H */
  310.