home *** CD-ROM | disk | FTP | other *** search
/ Best Objectech Shareware Selections / UNTITLED.iso / boss / word / text / 001 / api.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-09-05  |  17.8 KB  |  315 lines

  1. /******************************************************************************/
  2. /*  This is the include file for a C program using the E! API.                */
  3. /******************************************************************************/
  4. /******************************************************************************/
  5. /*  WARNING :                                                                 */
  6. /*  All strings involved in API functions are supposed to be PASCAL strings.  */
  7. /*  So they are NOT null terminated and the first byte of the string is ac-   */
  8. /*  tually the string length. This is also true for strings adresses you      */
  9. /*  pass to E! API functions                                                  */
  10. /******************************************************************************/
  11.  
  12.  
  13. #ifndef E_API
  14.  
  15. #ifndef FALSE
  16. #define FALSE 0
  17. #endif
  18.  
  19. #ifndef TRUE
  20. #define TRUE 1
  21. #endif
  22.  
  23. /******************************************************************************/
  24. /*  This global variable is initialized to the default value used by E! to    */
  25. /*  install the API interrupt handler. This value may be changed dynamical-   */
  26. /*  ly using a Profile. So the API program must also change the interrupt     */
  27. /*  number.                                                                   */
  28. /******************************************************************************/
  29. extern int E_Vec;
  30.  
  31. /******************************************************************************/
  32. /*    Values to pass in AH to specify the E! API service you want to use      */
  33. /*    FUNCTION_REQUEST   = 0;      Call a E! function - code in BX            */
  34. /******************************************************************************/
  35.  
  36. #define   EDITBUFF_REQUEST   1   /* Request Editbuffer address              */
  37. #define   FLAGS_REQUEST      2   /* Request flags block address             */
  38. #define   ATTR_REQUEST       3   /* Request attribute block address         */
  39. #define   MARG_REQUEST       4   /* Request margins+misc. block address     */
  40. #define   MESS_REQUEST       5   /* Request messages block address          */
  41. #define   FLOW_REQUEST       6   /* Request pointers array address-text flow*/
  42. #define   NAME_REQUEST       7   /* Request current name address            */
  43.  
  44. #define   STATUS_REQUEST     8   /* Request curr.line, line#, column etc... */
  45.  
  46. #define   LOCK_REQUEST       20  /* Request locked extensions array addr.   */
  47. #define   COMP_REQUEST       21  /* Request compile commands block addr.    */
  48. #define   SCR_REQUEST        22  /* Request screen address                  */
  49.  
  50. #define   DISPLINE_SERVICE   9   /* Display contents of edit buffer */
  51. #define   REFRESH_SERVICE    10  /* Rebuild the whole E! screeen    */
  52. #define   MASK_SERVICE       11  /* Refresh text mask               */
  53. #define   STORE_SERVICE      12  /* Store edit Buffer to text       */
  54. #define   CHANGE_SERVICE     13  /* Set change flag to true         */
  55. #define   SEEK_SERVICE       14  /* Set active line                 */
  56. #define   VERSION_SERVICE    15  /* Return version number           */
  57. #define   REGISTER_SERVICE   16  /* Execute command after exit      */
  58. #define   GETMEM_SERVICE     17  /* Request memory for API program  */
  59. #define   FREEMEM_SERVICE    18  /* Free API program owned memory   */
  60. #define   E_IDLE_SERVICE     19  /* Resident program may call E! API*/
  61.  
  62. #define   MODIF_SERVICE      23  /* Was the file modified ?         */
  63.  
  64. /******************************************************************************/
  65. /*    If AH is set to 0 please use one of the following function code         */
  66. /*    and pass it to E! API thru BX.                                          */
  67. /******************************************************************************/
  68.  
  69. #define   ALIGN_TEXT           1 /* Align text to cursor                   */
  70. #define   PASCAL_STYLE         2 /* See documentation (Ctrl B)             */
  71. #define   CLEAR_LINE           3 /* Clear line                             */
  72. #define   REPEAT_CHAR          4 /* Repeat specified character             */
  73. #define   CLEAR_EOL            5 /* Erase end of line                      */
  74. #define   WRAP                 6 /* Toggle Wordwrap                        */
  75. #define   _43LINES             7 /* Toggle 35/43/50 lines mode             */
  76. #define   DELETE_LEFT          8 /* Delete left character                  */
  77. #define   NEXT_TAB             9 /* Go to next tab                         */
  78. #define   JUSTIFICATION       10 /* Toggle justify mode                    */
  79. #define   EDIT                12 /* Edit a file                            */
  80. #define   ENTER               13 /* Insert a line or validate a command    */
  81. #define   INSERT_NAME         14 /* Insert filename                        */
  82. #define   MACRO               16 /* Execute active macro                   */
  83. #define   RESTORE_MACRO       17 /* Restore previous macro                 */
  84. #define   REPEAT_SEARCH       19 /* Repeat last search                     */
  85. #define   INSERT_DATE         20 /* Insert date and time                   */
  86. #define   INIT_SEARCH         22 /* Initialize search variables            */
  87. #define   DEL_WORD            23 /* Delet current word                     */
  88. #define   LIST_DIR            26 /* List current line as a directory       */
  89. #define   REMOVE_LINE        127 /* Remove current line                    */
  90. #define   PREV_TAB           271 /* Go to previous tab                     */
  91. #define   CONTINUE           272 /* Insert a continue-mark in macro        */
  92. #define   WORD_MARK          273 /* Mark the current Word                  */
  93. #define   END_OF_BLOCK       274 /* Go to end of block                     */
  94. #define   REMOVE_TAB         275 /* Remove current tab position            */
  95. #define   RECORD_TAB         276 /* Create a new tab positioneur           */
  96. #define   BLOCK_BEGIN        277 /* Go to block begin                      */
  97. #define   UNMARK             278 /* Unmark block                           */
  98. #define   REMOVE_TABS        279 /* Remove all tab positions               */
  99. #define   OVERLAY            280 /* Overlay block at cursor position       */
  100. #define   PARAGRAPH          281 /* Go to next paragraph                   */
  101. #define   ADJUST             286 /* Adjust block position                  */
  102. #define   SPLIT              287 /* Split line at cursor                   */
  103. #define   DELETE_BLOCK       288 /* Delete marked block                    */
  104. #define   FILL_BLOCK         289 /* Fill block with specified character    */
  105. #define   SORT               290 /* Sort block                             */
  106. #define   BOX                291 /* Draw a box around the block            */
  107. #define   JOIN               292 /* Join current line and next line        */
  108. #define   BOOKMARK           293 /* Drop bookmark                          */
  109. #define   LINE_MARK          294 /* Mark lines                             */
  110. #define   SENTENCE_MARK      300 /* Mark sentences                         */
  111. #define   GRAPHICS           301 /* Toggle control characters access       */
  112. #define   COPY_BLOCK         302 /* Copy block to cursor position          */
  113. #define   REMOVE_SPACES      303 /* Remove trailing blanks                 */
  114. #define   BLOCK_MARK         304 /* Mark block                             */
  115. #define   MOVE_BLOCK         306 /* Move block                             */
  116. #define   HELP               315 /* Load help file                         */
  117. #define   SAVE               316 /* Save current file                      */
  118. #define   QUIT               317 /* Quit current file                      */
  119. #define   QUIT_SAVE          318 /* Quite and save current file            */
  120. #define   WINDOW             319 /* Create/Remove window                   */
  121. #define   DRAW               320 /* Toggle draw mode                       */
  122. #define   NAME               321 /* Name current file                      */
  123. #define   LOAD               322 /* Edit a new file                        */
  124. #define   RESTORE            323 /* Restore (undo) current line            */
  125. #define   NEXT               324 /* Go to next file                        */
  126. #define   LINE_BEGIN         327 /* Go to line begin                       */
  127. #define   UP                 328 /* Up                                     */
  128. #define   PREV_PAGE          329 /* Scroll screen up                       */
  129. #define   LEFT               331 /* Left                                   */
  130. #define   RIGHT              333 /* Right                                  */
  131. #define   EOL                335 /* Go to end of line                      */
  132. #define   DOWN               336 /* Down                                   */
  133. #define   NEXT_PAGE          337 /* Scroll screen down                     */
  134. #define   TOGGLE_INSERT      338 /* Toggle insert mode                     */
  135. #define   DEL_CHAR           339 /* Delete character at cursor             */
  136. #define   SCROLL_RIGHT       340 /* Scroll right                           */
  137. #define   SCROLL_LEFT        341 /* Scroll left                            */
  138. #define   SCROLL_UP          342 /* Scroll up                              */
  139. #define   SCROLL_DOWN        343 /* Scroll down                            */
  140. #define   CENTER_LINE        344 /* Center line in window                  */
  141. #define   RAISE_LINE         345 /* Raise line to top of window            */
  142. #define   CLEAR_WINDOWS      346 /* Delete all windows                     */
  143. #define   UPCASE_WORD        350 /* Upcase word                            */
  144. #define   LOWCASE_WORD       351 /* Lowcase word                           */
  145. #define   UPCASE_BLOCK       352 /* Upcase block                           */
  146. #define   LOWCASE_BLOCK      353 /* Lowcase block                          */
  147. #define   CENTER_BLOCK       354 /* Center text in block                   */
  148. #define   FORMAT_PAR         355 /* Format paragraph                       */
  149. #define   FORMAT_BLOCK       356 /* Format paragraphs within block         */
  150. #define   KEYHELP            360 /* Key oriented help                      */
  151. #define   PAGE_RIGHT         362 /* Scroll page right                      */
  152. #define   PAGE_LEFT          363 /* Scroll page left                       */
  153. #define   CHANGE_WINDOW      364 /* Change active window                   */
  154. #define   DELETE_WINDOW      365 /* Supprime une fenĂȘtre                   */
  155. #define   ZOOM               366 /* Zoom / Unzoom active window            */
  156. #define   NEXT_ERROR         367 /* Go to next compilation error           */
  157. #define   PREV_ERROR         368 /* Go to previous compilation error       */
  158. #define   PREVIOUS           369 /* Go to previous file                    */
  159. #define   PREV_WORD          371 /* Go to previous word                    */
  160. #define   NEXT_WORD          372 /* Go to next word                        */
  161. #define   TEXT_END           373 /* Go to end of text                      */
  162. #define   PAGE_BOTTOM        374 /* Go to bottom of window                 */
  163. #define   TEXT_BEGIN         375 /* Go to text begin                       */
  164. #define   TEXTMARK1          376 /* Drop text mark 1                       */
  165. #define   TEXTMARK2          377 /* Drop text mark 2                       */
  166. #define   TEXTMARK3          378 /* Drop text mark 3                       */
  167. #define   UNMARK_TEXTS       379 /* Remove text marks                      */
  168. #define   REFRESH            380 /* Reload (refresh) original file         */
  169. #define   PAIRED_BRACE       381 /* See documentation                      */
  170. #define   MATCH_BRACE        382 /* See documentation                      */
  171. #define   UNDO               383 /* Restore removed lines                  */
  172. #define   INSERT_DOS         384 /* Insert captured lines (DOS SHELL)      */
  173. #define   SEARCH_WORD        385 /* Search current word                    */
  174. #define   INSERT_BLOCK       386 /* Insert blanks before block             */
  175. #define   INSERT_BLANK       387 /* Insert blanks without moving cursor    */
  176. #define   PAGE_TOP           388 /* Go to top of window                    */
  177.  
  178. #define   CALLFAILED         0xFF
  179. /* A bad function id has been passed to Call_E_Function */
  180.  
  181. /******************************************************************************/
  182. /*  WARNING : THESE STRUCTURES MUST BE PACKED !!!                             */
  183. /******************************************************************************/
  184. typedef unsigned int BOOL;
  185.  
  186. typedef struct flagrecord
  187.         {
  188.          BOOL   addonlast,     /* Key down insert newline on last line flag */
  189.                 alarmflag,     /* Error beep flag                      */
  190.                 asciimode,     /* Control characters entry flag        */
  191.                 autobackflag,  /* Backspace behaviour flag             */
  192.                 autosaveflag,  /* Autosave flag                        */
  193.                 autoscrollflag,/* Autoscroll flag                      */
  194.                 autotabflag,   /* Autotab flag                         */
  195.                 bakflag,       /* .BAK files generation flag           */
  196.                 blanksflag,    /* Strip trailing spaces when saving flag*/
  197.                 compflag,      /* Compression mode flag                */
  198.                 ega_vga_ok,    /* 43 lines mode flag                   */
  199.                 flag35,        /* 35 lines mode flag - EGA_VGA_OK must be on*/
  200.                 logflag,       /* Log file flag                        */
  201.                 pausemode,     /* Pause on return from DOS flag        */
  202.                 shiftflag,     /* Accelerated cursor flag              */
  203.                 warning,       /* Warning before saving flag           */
  204.                 enter_classic, /* Split line using ENTER flag          */
  205.                 refresh,       /* Display authorization                */
  206.                 selfinsert;    /* Bracket auto insertion flag          */
  207.  
  208.         } FLAGRECORD;
  209.  
  210.  typedef struct attrrecord
  211.         {
  212.           char text_attr,        /* Edited text attribute   */
  213.                blockattr,        /* Marked block attribute  */
  214.                commandlineattr,  /* Command line attribute  */
  215.                lostatuslineattr, /* Status line 1 attribute */
  216.                histatuslineattr, /* Status line 2 attribute */
  217.                messageattr,      /* Messages attribute      */
  218.                helpattr,         /* Help line attribute     */
  219.                cursorattr;       /* Virtual cursor attribute*/
  220.         }
  221.         ATTRRECORD;
  222.  
  223.  typedef struct margrecord
  224.         {
  225.           unsigned int shiftkeycount,   /* Delay value for secondary help lines */
  226.                        autosavelimit,   /* Seconds# for autosave                */
  227.                        scrollamountglb, /* Left / Right scroll amount           */
  228.                        drawmodel,       /* Drawing style                        */
  229.                        leftmargin,      /* Left margin                          */
  230.                        parmargin,       /* New paragraph margin                 */
  231.                        rightmargin;     /* Right margin                         */
  232.  
  233.         }
  234.         MARGRECORD;
  235.  
  236. typedef struct statusrecord
  237.         {
  238.           unsigned int linenum,    /* Line number of current text    */
  239.                        line;       /* Current row in current text    */
  240.                   char col,        /* Current column in current text */
  241.                        firstcol,   /* First displayed column         */
  242.                        lower,      /* Displayed lines number         */
  243.                        nbwin;      /* Number of windows              */
  244.  
  245.         } STATUSRECORD;
  246.  
  247. /******************************************************************************/
  248. /* E! strings are PASCAL strings! First byte is length of string              */
  249. /******************************************************************************/
  250.  
  251. typedef struct messagerecord
  252.         {
  253.           char helpline [3][80]; /* Help line and 3 secondary help lines */
  254.           char editerrormessages [47][38]; /* Error messages */
  255.         }
  256.         MESSAGERECORD;
  257.  
  258. typedef char LOCKARRAY   [25][3]; /* locked extensions */
  259.  
  260. typedef char COMPILELINE [128];
  261.  
  262. typedef struct compileentry
  263.         {
  264.          char fileext [3];
  265.          COMPILELINE  compcommand;
  266.         }
  267.         COMPILEEXT[10];
  268.  
  269. typedef char      textline[256];  /* Each line has 255 char. max.    */
  270. typedef textline  *lineptr;
  271. typedef char far  *commandline;
  272.  
  273. /******************************************************************************/
  274. /*                         E_API functions                                    */
  275. /******************************************************************************/
  276.  
  277. char   Call_E_Function ( unsigned );
  278.        /* Use this function to execute a E! function */
  279.  
  280. void far *Request_E_Address ( char );
  281.        /* Use this function to get the address of E! variables */
  282.  
  283. void   Get_E_Status ( STATUSRECORD *);
  284.        /* Use this function to get cursor current position and window status */
  285.  
  286. void   Request_E_Service ( char );
  287.        /* Use this function to get special services */
  288.  
  289. void   Get_E_Version ( char *, char *);
  290.        /* Retrieve E! version */
  291.  
  292. void   RegisterCommand ( commandline );
  293.        /* Execute a E! command after exit*/
  294.  
  295. char   Seek_E_Line ( unsigned , char );
  296.        /* Call E! seek function and return error code */
  297.  
  298. BOOL   Get_E_Memory( unsigned,
  299.                      unsigned,
  300.                      void **,
  301.                      BOOL *);
  302.        /* Request a block of memory from E! heap to store permanent information */
  303.  
  304. BOOL   Free_E_Memory ( unsigned );
  305.        /* Free a previously requested memory block */
  306.  
  307. BOOL   Is_E_Idle ();
  308.        /* Is E! idle ? */
  309.  
  310. BOOL   Is_File_Modified ();
  311.        /* Was the file modified ? */
  312.  
  313. #define E_API
  314. #endif
  315.