home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / C++-7 / DISK4 / INCLUDE / EXT.H$ / EXT
Encoding:
Text File  |  1992-03-06  |  30.3 KB  |  765 lines

  1. /*** ext.h - extension definitions
  2. *
  3. *   Copyright (C) 1988-1992, Microsoft Corporation
  4. *   All rights reserved
  5. *
  6. *************************************************************************/
  7.  
  8. /*************************************************************************
  9.  *
  10.  * Macro Definitions 
  11.  */
  12.  
  13. /* Common Definitions 
  14.  */
  15.  
  16. #include <stddef.h>    /* get standard definitions */
  17.  
  18. #ifndef TRUE
  19. #define TRUE    1
  20. #endif
  21.  
  22. #ifndef FALSE
  23. #define FALSE    0
  24. #endif
  25.  
  26. /* PNULL - NULL PFILE 
  27.  */
  28. #define PNULL    ((PFILE) 0)
  29.  
  30. /* BUFLEN is the maximum line length that can be passed or will be returned
  31.  * by the editor. MAX_PATH is the maximum path length supported.
  32.  */
  33. #define BUFLEN        251
  34. #define MAX_PATH    200
  35.  
  36. /* EXPORT defines the attributes required for extension functions. _loadds
  37.  * is used such that extensions can be compiled /Aw as well as /Au.
  38.  */
  39. #define EXPORT        _loadds far
  40. #define EXTERNAL    _loadds far
  41.  
  42. /* PWBFUNC defines the return value and characteristics of extension defined
  43.  * editing functions.
  44.  */
  45. #define PWBFUNC     flagType pascal _loadds far
  46.  
  47. /* RQ_... are various request types supported for Get/Set EditorObject 
  48.  */
  49. #define RQ_FILE         0x1000  /* GetEditorObject: File request    */
  50. #define RQ_FILE_HANDLE        0x1000  /*        File Handle         */
  51. #define RQ_FILE_NAME        0x1100  /*        ASCIIZ filename        */
  52. #define RQ_FILE_FLAGS        0x1200  /*        flags            */
  53. #define RQ_FILE_REFCNT        0x1300  /*        reference count        */
  54. #define RQ_FILE_FREEZE        0x1400  /*        freeze count        */
  55. #define RQ_WIN            0x2000  /* Window request            */
  56. #define RQ_WIN_HANDLE        0x2000  /*        Window Handle        */
  57. #define RQ_WIN_CONTENTS     0x2100  /*        Window Contents        */
  58. #define RQ_WIN_CUR        0x2200  /*        Current Window        */
  59. #define RQ_WIN_MAXED        0x2300  /*        Zoomed flag         */
  60. #define RQ_WIN_PWBHANDLE    0x2400  /*        PWB Window Handle        */
  61. #define RQ_WIN_ARC        0x2500  /*                    */
  62. #define RQ_WIN_COLOR        0x2600  /*        text/border colors        */
  63. #define RQ_MISC         0x3000  /* Misc requests            */
  64. #define RQ_SCREENSIZE        0x3100  /*        screen size         */
  65. #define RQ_SEARCHINFO        0x3200  /*        search state information    */
  66. #define RQ_ALLFILE        0x4000  /* GetEditorObject: All file request */
  67. #define RQ_ALLFILE_HANDLE   0x4000  /*        File Handle         */
  68. #define RQ_ALLFILE_NAME     0x4100  /*        ASCIIZ filename        */
  69. #define RQ_ALLFILE_FLAGS    0x4200  /*        flags            */
  70. #define RQ_ALLFILE_REFCNT   0x4300  /*        reference count        */
  71. #define RQ_ALLFILE_FREEZE   0x4400  /*        freeze count        */
  72.  
  73. #define RQ_COLOR        0x9000  /* Color request            */
  74.  
  75. #define RQ_NAME         0xd000  /* editor name            */
  76. #define RQ_TOOLSINI        0xe000  /* tools.ini PFILE            */
  77. #define RQ_CLIP         0xf000  /* clipboard type            */
  78.  
  79.  
  80. /* toPif is used when placing numeric or boolean switches in the swiDesc
  81.  * table to eliminate compiler warnings.
  82.  * 
  83.  * For example: { "Switchname", toPIF(switchvar), SWI_BOOLEAN },
  84.  */
  85. #define toPIF(x)  (PIF)(long)(void far *)&x
  86.  
  87. /* Editor color table indicies. (Colors USERCOLORMIN - USERCOLORMAX are
  88.  * unassigned and available for extension use).
  89.  */
  90. #define Background    0    /* all backgrounds (unused in PWB)        */
  91. #define Hilite        1    /* Hilited items                */
  92. #define Greyed        2    /* greyed items                 */
  93. #define Enabled     3    /* enabled items                */
  94. #define Disabled    4    /* disabled items                */
  95. #define Alert        5    /* for MessageBox alerts            */
  96. #define DialogBox    6    /* background for dialogs            */
  97. #define PushButton    7    /* push button color                */
  98. #define ButtonDown    8    /* pushed button color                */
  99. #define ListBox     9    /* listbox background                */
  100. #define Scrollbar    10    /* scroll bar Background & arrows        */
  101. #define Elevator    11    /* scroll bar elevator                */
  102. #define MenuBox     12    /* background for menus             */
  103. #define Menu        13    /* menu bar color                */
  104. #define MenuSelected    14    /* Selected menus                */
  105. #define MenuHilite    15    /* for single character             */
  106. #define MenuHiliteSel    16    /* for single character (under selection)   */
  107. #define ItemHiliteSel    17    /* for single character (under selection)   */
  108. #define DialogAccel    18    /* dialog accelerators                */
  109. #define DialogAccelBor    19    /* dialog accelerator border            */
  110. #define Shadow        20    /* shadows                    */
  111. #define FGCOLOR     21    /* Normal text in non-PWB edit windows        */
  112. #define HGCOLOR     22    /* Highlighted text                */
  113. #define INFCOLOR    23    /* Noise                    */
  114. #define SELCOLOR    24    /* Text Selections                */
  115. #define WDCOLOR     25    /* Non-PWB edit Window Borders            */
  116. #define STACOLOR    26    /* Status Letters on bottom line        */
  117. /*            27       internal: used by PWB            */
  118. #define BECOLOR     28    /* Build Error Window                */
  119. #define DTCOLOR     29    /* Desktop                    */
  120. #define PWBTCOLOR    30    /* PWB Window Text                */
  121. #define PWBBCOLOR    31    /* PWB Window Border                */
  122. #define MSGCOLOR    32    /* Message line                 */
  123. #define LOCCOLOR    33    /* Cursor position indicator            */
  124.  
  125. #define USERCOLORMIN    34    /* beginning of extension colors        */
  126. #define USERCOLORMAX    56    /* end of extension colors            */
  127.  
  128. /* Attributes for ForFile
  129.  */
  130. #define FORFILE_RO    1    /* read only    */
  131. #define FORFILE_H    2    /* hidden    */
  132. #define FORFILE_S    4    /* system    */
  133. #define FORFILE_V    8    /* volume id    */
  134. #define FORFILE_D    16    /* directory    */
  135. #define FORFILE_A    32    /* archive    */
  136.  
  137. /* changeable attributes 
  138.  */
  139. #define FORFILE_MOD    (FORFILE_RO|FORFILE_H|FORFILE_S|FORFILE_A) 
  140. #define FORFILE_ALL    (FORFILE_RO|FORFILE_H|FORFILE_S|FORFILE_V|FORFILE_D|FORFILE_A)
  141.  
  142. /*************************************************************************
  143.  *
  144.  * General type Definitions
  145.  */
  146. typedef char flagType;            /* Boolean value        */
  147. typedef int  COL;            /* column or position with line */
  148. typedef long LINE;            /* line number within file    */
  149. typedef unsigned PFILE;         /* editor file handle        */
  150. typedef unsigned PINS;
  151. #ifndef EXTINT
  152. typedef unsigned PWND;            /* editor window handle     */
  153. #endif
  154.  
  155.  
  156. typedef char buffer[BUFLEN];        /* miscellaneous buffer        */
  157. typedef char linebuf[BUFLEN];        /* line buffer            */
  158. typedef char pathbuf[BUFLEN];        /* Pathname buffer        */
  159.  
  160. typedef struct {            /* file location        */
  161.     LINE    lin;            /* - line number        */
  162.     COL     col;            /* - column            */
  163.     } fl, *pfl;
  164.  
  165. typedef struct {            /* screen location        */
  166.     int     lin;            /* - line number        */
  167.     int     col;            /* - column            */
  168.     } sl, *psl;
  169.  
  170. typedef struct {            /* file range            */
  171.     fl        flFirst;            /* - Lower line, or leftmost col */
  172.     fl        flLast;            /* - Higher, or rightmost    */
  173.     } rn, *prn;
  174.  
  175. typedef struct lineAttr {        /* Line color attribute info    */
  176.     unsigned char attr;         /* - Attribute of piece        */
  177.     unsigned char len;            /* - Bytes in colored piece    */
  178.     } la, *pla;
  179.  
  180. typedef unsigned char    BYTE;
  181. typedef unsigned short    WORD;
  182. typedef WORD        ISA;
  183. typedef struct _arc
  184.     {
  185.     BYTE axLeft;
  186.     BYTE ayTop;
  187.     BYTE axRight;
  188.     BYTE ayBottom;
  189.     } ARC;
  190.  
  191. /*************************************************************************
  192.  *
  193.  * Argument definition structures.
  194.  *
  195.  * We define a structure for each of the argument types that may be passed
  196.  * to an extension function. Then, we define the structure argType which is
  197.  * used to pass these arguments around in a union.
  198.  */
  199. struct    noargType {            /* no argument specified    */
  200.     LINE    y;                /* - cursor line        */
  201.     COL     x;                /* - cursor column        */
  202.     };
  203.  
  204. struct textargType {            /* text argument specified    */
  205.     int     cArg;            /* - count of <arg>s pressed    */
  206.     LINE    y;                /* - cursor line        */
  207.     COL     x;                /* - cursor column        */
  208.     char far *pText;            /* - ptr to text of arg        */
  209.     };
  210.  
  211. struct    nullargType {            /* null argument specified    */
  212.     int     cArg;            /* - count of <arg>s pressed    */
  213.     LINE    y;                /* - cursor line        */
  214.     COL     x;                /* - cursor column        */
  215.     };
  216.  
  217. struct lineargType {            /* line argument specified    */
  218.     int     cArg;            /* - count of <arg>s pressed    */
  219.     LINE yStart;            /* - starting line of range    */
  220.     LINE yEnd;                /* - ending line of range    */
  221.     };
  222.  
  223. struct streamargType {            /* stream argument specified    */
  224.     int     cArg;            /* - count of <arg>s pressed    */
  225.     LINE yStart;            /* - starting line of region    */
  226.     COL  xStart;            /* - starting column of region    */
  227.     LINE yEnd;                /* - ending line of region    */
  228.     COL  xEnd;                /* - ending column of region    */
  229.     };
  230.  
  231. struct boxargType {            /* box argument specified    */
  232.     int     cArg;            /* - count of <arg>s pressed    */
  233.     LINE yTop;                /* - top line of box        */
  234.     LINE yBottom;            /* - bottom line of bix        */
  235.     COL  xLeft;             /* - left column of box        */
  236.     COL  xRight;            /* - right column of box    */
  237.     };
  238.  
  239. struct    PWBargType {
  240.     int     argType;
  241.     union   {
  242.     struct    noargType    noarg;
  243.     struct    textargType    textarg;
  244.     struct    nullargType    nullarg;
  245.     struct    lineargType    linearg;
  246.     struct    streamargType    streamarg;
  247.     struct    boxargType    boxarg;
  248.     } arg;
  249.     PWND  pwnd;
  250.     PINS  pins;
  251.     PFILE pfile;
  252.     };
  253. typedef struct PWBargType ARG;
  254.  
  255. /*************************************************************************
  256.  *
  257.  * Function definition table definitions
  258.  */
  259. typedef unsigned CMDDATA;
  260.  
  261. struct cmdDesc {                /* function definition entry */
  262.     char far *name;                /* - pointer to name of fcn  */
  263.     flagType (pascal EXTERNAL *func)(CMDDATA,
  264.                      ARG far *,
  265.                      flagType);    /* - pointer to function     */
  266.     CMDDATA  arg;                /* - used internally by editor*/
  267.     unsigned long argType;            /* - user args allowed         */
  268.     };
  269. typedef struct cmdDesc far *PCMD;
  270.  
  271. typedef struct KeyData {        /* Key information             */
  272.     unsigned ascii;            /* ASCII code, or .vkey if none      */
  273.     unsigned scan;            /* scan code                 */
  274.     unsigned vkey;            /* virtual key code             */
  275.     unsigned shift;            /* Shift state 0 - 3             */
  276.     PCMD pFunc;             /* command key will invoke         */
  277.     char name[30];            /* full name for key             */
  278.     } KeyData;
  279.  
  280. typedef unsigned KeyHandle;
  281.  
  282. #define NOARG        0x00000001        /* no argument specified            */
  283. #define TEXTARG     0x00000002        /* text specified                */
  284. #define NULLARG     0x00000004        /* arg + no cursor movement         */
  285. #define NULLEOL     0x00000008        /* null arg => text from arg->eol        */
  286. #define NULLEOW     0x00000010        /* null arg => text from arg->end word  */
  287. #define LINEARG     0x00000020        /* range of entire lines            */
  288. #define STREAMARG   0x00000040        /* from low-to-high, viewed 1-D        */
  289. #define BOXARG        0x00000080        /* box delimited by arg, cursor        */
  290.  
  291. #define NUMARG        0x00000100        /* text => delta to y position        */
  292. #define MARKARG     0x00000200        /* text => mark at end of arg        */
  293.  
  294. #define BOXSTR        0x00000400        /* single-line box => text            */
  295.  
  296. #define FASTKEY     0x00000800        /* Fast repeat function            */
  297. #define MODIFIES    0x00001000        /* modifies file                */
  298. #define KEEPMETA    0x00002000        /* do not eat meta flag            */
  299. #define WINDOWFUNC  0x00004000        /* moves window                */
  300. #define CURSORFUNC  0x00008000        /* moves cursor                */
  301.  
  302. #define NOWINDOWS   0x00010000        /* cmd works when no windows are open   */
  303. #define ICONFOCUS   0x00020000        /* cmd works when an icon has focus     */
  304. #define BEEPERROR   0x00040000        /* PWB beeps when cmd is not allowed    */
  305. #define POPUP        0x00080000        /* cmd works when PopUp window is present */
  306. #define NAMEINHEAP  0x00100000        /* cmd name (macros-only) lives in heap */
  307.  
  308. /*************************************************************************
  309.  *
  310.  * Switch definition table definitions
  311.  *
  312.  *  SWI_NUMERIC:    hex or decimal switch.
  313.  *  SWI_BOOLEAN:    boolean switch.
  314.  *  SWI_EXTTEXT:    extension text switch.
  315.  *            function is provided whose second argument (fQuery)
  316.  *            specifies the mode:
  317.  *                1) If fQuery is FALSE, set the switch to the text
  318.  *                   specified by the first argument.
  319.  *                   Return NULL if successful, else return error
  320.  *                   string.
  321.  *                2) If fQuery is TRUE, return the current value of
  322.  *                   switch. The first argument is ignored (should
  323.  *                   be NULL).
  324.  *
  325.  *  1.x Compatibility Switches: (DO NOT USE)
  326.  *
  327.  *  SWI_SPECIAL     old-style special text switch.
  328.  *            Provided for compatibility with PWB 1.x versions only.
  329.  *            function is provided which takes a text value and
  330.  *            returns a boolean indicator of success/failure.
  331.  *  SWI_SPECIAL2    old-style special text switch.
  332.  *            Provided for compatability with PWB 1.x versions only.
  333.  *            function is provided which takes a text value and
  334.  *            returns NULL for success, error string otherwise.
  335.  *
  336.  */
  337. typedef char far * (pascal EXTERNAL *PIF)(char far *, flagType);
  338. typedef flagType (pascal EXTERNAL *PIF_S)(char far *);
  339. typedef char far * (pascal EXTERNAL *PIF_S2)(char far *);
  340.  
  341.  
  342. union swiAct {                /* switch location or routine        */
  343.     PIF         pExtFunc;        /* SWI_EXTTEXT function        */
  344.     PIF_S     pFunc;            /* SWI_SPECIAL function         */
  345.     PIF_S2     pFunc2;        /* SWI_SPECIAL2 function        */
  346.     int far     *ival;            /* SWI_NUMERIC integer value        */
  347.     flagType far *fval;         /* SWI_BOOLEAN flag            */
  348.     };
  349.  
  350. struct swiDesc {            /* switch definition entry         */
  351.     char far *name;            /* - pointer to name of switch         */
  352.     union swiAct act;            /* - pointer to value or fcn         */
  353.     int type;                /* - flags defining switch type         */
  354.     };
  355. typedef struct swiDesc far *PSWI;
  356.  
  357. #define SWI_BOOLEAN    0        /* Boolean switch             */
  358. #define SWI_NUMERIC    1        /* hex or decimal switch         */
  359. #define SWI_EXTTEXT    2        /* text switch w/fQuery arg         */
  360. #define SWI_SPECIAL    5        /* textual switch             */
  361. #define SWI_SPECIAL2    6        /* #5, returning an error string     */
  362. #define RADIX10 (0x0A << 8)        /* numeric switch is decimal         */
  363. #define RADIX16 (0x10 << 8)        /* numeric switch is hex         */
  364.  
  365. /************************************************************************
  366.  *
  367.  * Get/Set EditorObject data structures
  368.  */
  369. typedef struct {
  370.     ISA        text;   /* - default text color                */
  371.     ISA        border; /* - default border color            */
  372.     } winColors;
  373.  
  374. typedef struct {    /* define window contents             */
  375.     PFILE    pFile;    /* - handle of file displayed             */
  376.     ARC     arcWin; /* - location of window              */
  377.     fl        flPos;    /* - upper left corner wrt file          */
  378.     fl        flCursor; /* - Cursor position                 */
  379.     WORD    id;    /* - window number                 */
  380.     WORD    flags;    /* - window flags                 */
  381.     winColors    colors; /* - default window colors             */
  382.     } winContents;
  383.  
  384. /************************************************************************
  385.  *
  386.  * Values for .flags field in struct winContents
  387.  */
  388. #define WF_PWB        1
  389. #define WF_ICONIC   2
  390. #define WF_ZOOMED   4
  391. #define WF_OPEN     0x10
  392. #define WF_CURRENT  0x80
  393. #define WF_POPUP    0x100
  394.  
  395.  
  396.  
  397.  
  398. /************************************************************************
  399.  *
  400.  * Values for flag (BYTE) argument to NewWindow
  401.  */
  402.  
  403. #define NEWWND_ICON    2
  404. #define NEWWND_ZOOMED    4
  405. #define NEWWND_CLOSED    8
  406. #define NEWWND_PWB    0x80
  407.  
  408.  
  409. /************************************************************************
  410.  *
  411.  * Constants for use with sub windows.
  412.  *
  413.  * SWF_* - Values for flag (last) argument to GenEditSubWindow
  414.  * SW_*  - Values for type (next-to-last) argument to GenEditSubWindow
  415.  *
  416.  */
  417.  
  418. #define SWF_CURSOR  1
  419. #define SWF_TOP     2
  420.  
  421. #define SW_BUILDERR 1
  422. #define SW_USER     0x8000
  423.  
  424. typedef struct {        /* search/replace state information         */
  425.     struct {            /* TOOLS.INI switch info             */
  426.     flagType fUnixRE;    /* TRUE => Use UNIX RE's (unixre: switch)    */
  427.     flagType fSrchCase;    /* TRUE => case is significant (case: switch)*/
  428.     flagType fSrchWrap;    /* TRUE => searches wrap (wrap: switch)         */
  429.     } swit;
  430.     struct {            /* state of previous activity             */
  431.     flagType fSrchAll;    /* TRUE => previously searched for all         */
  432.     flagType fSrchCase;    /* TRUE => case was significant             */
  433.     flagType fSrchDir;    /* TRUE => previously searched forward         */    
  434.     flagType fSrchRe;    /* TRUE => search previously used RE's         */
  435.     flagType fSrchWrap;    /* TRUE => previously did wrap             */
  436.     flagType fReplRe;    /* TRUE => replace previously used RE's         */
  437.     buffer     szSrch;    /* search buffer                 */
  438.     buffer     szReplsrc;    /* source string for replace             */
  439.     buffer     szReplrpl;    /* destination string for replace         */
  440.     } prev;
  441.     } SearchInfo;
  442.  
  443. /* FILE flags values
  444.  *
  445.  *
  446.  * DIRTY    file had been modified, and has not yet been written to disk.
  447.  *
  448.  * FAKE        file is a pseudo file. It cannot be saved to disk under it's
  449.  *        current name, and may also be otherwise treated specially.
  450.  *
  451.  * REAL        file has been read from disk. If reset, the file needs to be
  452.  *        read if any operations are to be performed on it. (May also
  453.  *        be set for FAKE files, even though they are not really on
  454.  *        disk.)
  455.  *
  456.  * DOSFILE    file has CR-LF. If not set, lines are terminated by LF only
  457.  *        in unix-style. The setting is determined by the file reader
  458.  *        having seen CRLF or not. Should default on for all files we
  459.  *        create.
  460.  *
  461.  * TEMP        file is a temp file, and is not saved in the status file.
  462.  *        These are the files specified by /t on the command line.
  463.  *
  464.  * NEW        file has been created by editor. This is set when we create
  465.  *        the file (after asking the user), and causes us to avoid
  466.  *        trying to back-up a non-existant previous version.
  467.  *
  468.  * REFRESH    file needs to be refreshed every time it is viewed. This is
  469.  *        set for pseudo files which need to be regenerated each time
  470.  *        they are viewed, such as the file history list.
  471.  *
  472.  * READONLY    file may not be edited. For example, this bit is set by the
  473.  *        help extension on it's pseudo file to prevent users from
  474.  *        editing the contents. All commands with the MODIFIES bit are
  475.  *        disabled if a file with this bit is current.
  476.  *
  477.  * DISKRO    file on disk is read only.
  478.  *
  479.  * MODE1    Meaning depends on the file
  480.  *
  481.  * VALMARKS    file has valid marks defined
  482.  *
  483.  * READING    file is currently being read. This means that the idle time
  484.  *        reader may be operating on this file.
  485.  *
  486.  * MARKSDIRTY    file's marks need to be written
  487.  *
  488.  * HYBRID    file is FAKE, but gets saved
  489.  *
  490.  * NORENAME    file should never be renamed
  491.  *
  492.  * NOREMOVE    file should never be removed or expunged
  493.  */
  494. #define DIRTY        0x01
  495. #define FAKE        0x02
  496. #define REAL        0x04
  497. #define DOSFILE     0x08
  498. #define TEMP        0x10
  499. #define NEW        0x20
  500. #define REFRESH     0x40
  501. #define READONLY    0x80
  502.  
  503. #define DISKRO        0x0100
  504. #define MODE1        0x0200
  505. #define VALMARKS    0x0400
  506. #define READING     0x0800
  507.  
  508. #define MARKSDIRTY  0x1000
  509. #define HYBRID        0x2000
  510. #define NORENAME    0x4000
  511. #define NOREMOVE    0x8000
  512.  
  513.  
  514. /****************************************************************************
  515.  *
  516.  * Flags for dealing with instance lists when splitting a window...
  517.  * Use these when calling SplitWnd() to specify how to handle the instance
  518.  * lists.
  519.  *
  520.  */
  521. #define INF_NODUP    0    /* don't duplicate instance list, don't move */
  522. #define INF_NODUPMV      2    /* don't duplicate instance list, move it    */
  523. #define INF_DUP     4    /* duplicate instance list             */    
  524.  
  525. /****************************************************************************
  526.  *
  527.  * Values for third parameter to GetPfileFromName.  The values control the
  528.  * behaviour i nthe case that the specified file doe not exist on disk.
  529.  * The options are: Fail silently, ask the user to create the file, create
  530.  * the file silently.
  531.  *
  532.  */
  533. #define PFN_FAIL   0
  534. #define PFN_ASK    1
  535. #define PFN_CREATE 2
  536.  
  537. /*************************************************************************
  538.  *
  539.  * Menu, window and dialog definitions
  540.  *
  541.  * action constants for ChangeMenu
  542.  */
  543. #define MNU_DISABLE    1        /* disable (grey) menu item    */
  544. #define MNU_ENABLE    2        /* enable menu item        */
  545. #define MNU_CHECK    3        /* check menu item        */
  546. #define MNU_UNCHECK    4        /* uncheck menu item        */
  547. #define MNU_RENAME    5        /* rename menu item        */
  548. #define MNU_COMMAND    6        /* define menu item command    */
  549.  
  550. /* Message box types.
  551.  */
  552. #define MBOX_OK         1    /* <OK>                */
  553. #define MBOX_YESNOCANCEL    2    /* <YES> <NO> <CANCEL>        */
  554. #define MBOX_RETRYCANCEL    3    /* <RETRY> <CANCEL>        */
  555. #define MBOX_OKCANCEL        4    /* <OK> <CANCEL>        */
  556. #define MBOX_ABORT        5    /* <ABORT>            */
  557. #define MBOX_YESNO        6    /* <YES> <NO>            */
  558. #define MBOX_RETRY        7    /* <RETRY>            */
  559. #define MBOX_TYPE        0x0f    /* message type            */
  560. #define MBOX_BEEP        0x10    /* beep when displayed        */
  561. #define MBOX_CAPTION        0x20    /* 1st param is caption        */
  562. #define MBOX_NOHELP        0x8000    /* don't add a help button    */
  563.  
  564. /* Message Box Return types
  565.  */
  566. #define MBOX_IDOK        1    /* <OK> button            */
  567. #define MBOX_IDCANCEL        2    /* <CANCEL> button        */
  568. #define MBOX_IDABORT        3    /* <ABORT> button        */
  569. #define MBOX_IDRETRY        4    /* <RETRY> button        */
  570. #define MBOX_IDIGNORE        5    /* <IGNORE> button        */
  571. #define MBOX_IDYES        6    /* <YES> button            */
  572. #define MBOX_IDNO        7    /* <NO> button            */
  573.  
  574. /* Flags in flags parameter to DoSpawn
  575.  */
  576. #define EXTCMD_NONE    0x0000
  577. #define EXTCMD_NOEVENT    0x0001     // do not notify extensions of spawn
  578. #define EXTCMD_NOSAVE    0x0002     // do not autosave before spawn
  579. #define EXTCMD_NOSYNC    0x0004     // do not sync cur file on return
  580. #define EXTCMD_REDIR    0x0008   // redirect output to file
  581. #define EXTCMD_APPEND    0x0010     // append to output file (don't rewrite)
  582. #define EXTCMD_BACK    0x0010     // background execution
  583. #define EXTCMD_ECHO    0x0020     // DOS: echo command output in build box
  584. #define EXTCMD_ASK    0x0040     // prompt for return
  585. #define EXTCMD_ASKERR    0x0080     // prompt for return if error
  586. #define EXTCMD_GLOBAL    0x0100     // prompt for return if Askrtn is Yes
  587.  
  588. /* Flags in flags parameter to IdAddPwbMenuItem
  589.  */
  590. #define TM_CHECKED    0x00
  591. #define TM_UNCHECKED    0x01
  592.  
  593. #define TM_ENABLED    0x00
  594. #define TM_DISABLED    0x02
  595.  
  596. #define TM_RECORD    0x00
  597. #define TM_NORECORD    0x04
  598.  
  599. #define TM_TYPE     0x70
  600.  
  601. #define TM_COMMAND    0x10
  602. #define TM_SUBMENU    0x20
  603. #define TM_SEPARATOR    0x40
  604.  
  605. /*************************************************************************
  606.  *
  607.  * Constants for the Virtual Memory (VM) functions
  608.  */
  609.  
  610. #define _NULLVP        0xffffffffL    // the NULL virtual pointer
  611.  
  612.  
  613. /*************************************************************************
  614.  *
  615.  * Editor function prototypes.
  616.  
  617.  *
  618.  * This list defines the routines within the editor which may be called
  619.  * by extension functions.
  620.  */
  621. int        pascal  EXPORT  AddAColor        (char far *, char far *);
  622. PFILE        pascal  EXPORT  AddFile        (char far *);
  623. int        pascal  EXPORT  AddMenu        (char far *, char far *, char far *, flagType);
  624. int        pascal  EXPORT  AddMenuItem     (int, char far *, char far *, char far *, char far *);
  625. void        pascal  EXPORT  AddStrToList    (PCMD, char far *, flagType);
  626. unsigned    pascal  EXPORT  atou        (const char far *);
  627. flagType    pascal  EXPORT  BadArg        (void);
  628. void        pascal  EXPORT  bell        (void);
  629. flagType    pascal  EXPORT  ChangeMenu        (int, int, char far *);
  630. void        pascal  EXPORT  CheckPwbMenuItem    (WORD, unsigned short);
  631. void        pascal  EXPORT  ClearList        (PCMD);
  632. flagType    pascal  EXPORT  CloseWnd        (PWND);
  633. void        pascal  EXPORT  CopyBox        (PFILE, PFILE, COL, LINE, COL, LINE, COL, LINE);
  634. void        pascal  EXPORT  CopyLine        (PFILE, PFILE, LINE, LINE, LINE);
  635. void        pascal  EXPORT  CopyStream        (PFILE, PFILE, COL, LINE, COL, LINE, COL, LINE);
  636. void        pascal  EXPORT  DelBox        (PFILE, COL, LINE, COL, LINE);
  637. void        pascal  EXPORT  DelFile        (PFILE);
  638. void        pascal  EXPORT  DelLine        (PFILE, LINE, LINE);
  639. void        pascal  EXPORT  DelStream        (PFILE, COL, LINE, COL, LINE);
  640. void        pascal  EXPORT  Display        (void);
  641. void        pascal  EXPORT  DoMessage        (char far *);
  642. int        pascal  EXPORT  DoMessageBox    (char far *, char far *, char far *, int, int);
  643. int        pascal  EXPORT  DoMessageBoxHelp    (char far *, char far *, char far *, int, int, char far *);
  644. void        pascal  EXPORT  DoDrawWindow    (PWND);
  645. void        pascal  EXPORT  DoStatusBox     (char far *, char far *);
  646. void        pascal  EXPORT  DrawEditWindowBorder(PWND);
  647. void        pascal  EXPORT  EnablePwbMenuItem    (WORD, unsigned short);
  648. char far *  pascal  EXPORT  Falloc        (long);
  649. char far *  _cdecl  EXPORT  farstrncpy        (char far *, const char far *, int);
  650. char far *  _cdecl  EXPORT  farstrcpy        (char far *, const char far *);
  651. char far *  _cdecl  EXPORT  farstrcat        (char far *, const char far *);
  652. char far *  _cdecl  EXPORT  farstrstr        (const char far *, const char far *);
  653. int        _cdecl  EXPORT  farstrlen        (const char far *);
  654. int        _cdecl  EXPORT  farstrnicmp        (const char far *, const char far *, int);
  655. int        _cdecl  EXPORT  farstrncmp        (const char far *, const char far *, int);
  656. int        _cdecl  EXPORT  farstrcmp        (const char far *, const char far *);
  657. void far *  _cdecl  EXPORT  farmemset        (void far *, int, size_t);
  658. int        _cdecl  EXPORT  farstricmp        (char far *, char far *);
  659. char far *  _cdecl  EXPORT  farstrchr        (char far *, int);
  660. char far *  _cdecl  EXPORT  farstrlwr        (char far *);
  661. char far *  pascal  EXPORT  farstradd        (char far *, const char far *);
  662. char far *  pascal  EXPORT  farstrstrip        (char far *);
  663. flagType    pascal  EXPORT  fChangeFile     (unsigned, char far *);
  664. void        pascal  EXPORT  Fdalloc        (char far *);
  665. flagType    pascal  EXPORT  fExecute        (char far *);
  666. LINE        pascal  EXPORT  FileLength        (PFILE);
  667. PFILE        pascal  EXPORT  FileNameToHandle    (char far *, char far *);
  668. flagType    pascal  EXPORT  FileRead        (char far *, PFILE);
  669. flagType    pascal  EXPORT  FileWrite        (char far *, PFILE);
  670. PSWI        pascal  EXPORT  FindSwitch        (char far *);
  671. int        pascal  EXPORT  ForFile        (char far *,int ,void (pascal EXPORT *)(char far *));
  672. flagType    pascal  EXPORT  fSetWindowWithFile    (char far *);
  673. PWND        pascal  EXPORT  GenEditSubWindow    (PWND, WORD, ISA, WORD, WORD);
  674. flagType    pascal  EXPORT  GetColor        (LINE, struct lineAttr far *, PFILE);
  675. void        pascal  EXPORT  GetCursor        (COL far *, LINE far *);
  676. flagType    pascal  EXPORT  GetEditorObject    (unsigned, unsigned, void far *);
  677. PWND        pascal  EXPORT  GetEditSubWindow    (PWND, WORD);
  678. int        pascal  EXPORT  GetLine        (LINE, char far *, PFILE);
  679. char far *  pascal  EXPORT  GetListEntry    (PCMD, int, flagType);
  680. PCMD        pascal  EXPORT  GetListHandle    (char far *, flagType);
  681. PFILE        pascal  EXPORT  GetPfileFromName    (char far *, char far *, flagType);
  682. flagType    pascal  EXPORT  GetString        (char far *, char far *, flagType);
  683. WORD        pascal  EXPORT  IdAddPwbMenuItem    (unsigned, unsigned, unsigned, char far *, char far *, char far *, char far *);
  684. WORD        pascal  EXPORT  IdFindPwbMenuItem    (char far *, unsigned, unsigned);
  685. void        pascal  EXPORT  LockFile        (PFILE);
  686. char far *  pascal  EXPORT  mgetenv        (char far *);
  687. void        pascal  EXPORT  MoveCur        (COL, LINE);
  688. char far *  pascal  EXPORT  NameToKeys        (char far *, char far *);
  689. PCMD        pascal  EXPORT  NameToFunc        (char far *);
  690. PWND        pascal  EXPORT  NewWindow        (PFILE, BYTE, int, int, int, int, int, int);
  691. PCMD        pascal  EXPORT  pCmdPrompt          (char far *, char far *, char far *);
  692. flagType    pascal  EXPORT  pFileToBottom    (PFILE);
  693. flagType    pascal  EXPORT  pFileToTop        (PFILE);
  694. void        pascal  EXPORT  PopUpBox        (PFILE, char far *, int, fl);
  695. void        pascal  EXPORT  PopUpBoxColor    (PFILE, char far *, int, fl, ISA);
  696. void        pascal  EXPORT  PutColor        (LINE, struct lineAttr far *, PFILE);
  697. void        pascal  EXPORT  PutLine        (LINE, char far *, PFILE);
  698. long        pascal  EXPORT  ReadChar        (void);
  699. PCMD        pascal  EXPORT  ReadCmd        (void);
  700. void        pascal  EXPORT  RecordPwbMenuItem    (WORD, unsigned short);
  701. void        pascal  EXPORT  DoRedrawDamagedRegions(void);
  702. flagType    pascal  EXPORT  RemoveFile        (PFILE);
  703. flagType    pascal  EXPORT  Replace        (char, COL, LINE, PFILE, flagType);
  704. int        pascal  EXPORT  REsearch        (PFILE, flagType, flagType, flagType, flagType, char far *, fl far *);
  705. flagType    pascal  EXPORT  Resize        (PWND, ARC);
  706. char far *  pascal  EXPORT  ScanList        (PCMD, flagType);
  707. int        pascal  EXPORT  search        (PFILE, flagType, flagType, flagType, flagType, char far *, fl far *);
  708. flagType    pascal  EXPORT  SelectFiles     (PCMD, char far *, char far *, char far *, flagType, int);
  709. flagType    pascal  EXPORT  SelectFile        (char far *, int, char far *, char far *, int);
  710. void        pascal  EXPORT  SetColor        (PFILE, LINE, COL, COL, int);
  711. void        pascal  EXPORT  SetHiLite        (PFILE, rn, int);
  712. flagType    pascal  EXPORT  SetEditorObject    (unsigned, unsigned, void far *);
  713. flagType    pascal  EXPORT  SetKey        (char far *, char far *);
  714. flagType    pascal  EXPORT  SetPwbMenuItemTitle   (WORD, char far *);
  715. flagType    pascal  EXPORT  SetPwbMenuItemCommand (WORD, char far *);
  716. void        pascal  EXPORT  SetPWBWindowMenuTitle (PWND, char far *);
  717. flagType    pascal  EXPORT  SetSubWinHeight    (PWND, WORD);
  718. void        pascal  EXPORT  SetSubWinPFile    (PWND, PFILE);
  719. void        pascal  EXPORT  SetSubWinView    (PWND, LINE, COL);
  720. void        pascal  EXPORT  SetWindowColors    (PWND, ISA, ISA);
  721. PWND        pascal  EXPORT  SplitWnd        (PWND, flagType, int, int);
  722. void        pascal  EXPORT  UnLockFile        (PFILE);
  723. long        pascal  EXPORT  VMAlloc        (long);
  724. void        pascal  EXPORT  VMFree        (long);
  725. void        pascal  EXPORT  fpbToVM        (char far *, long, unsigned);
  726. void        pascal  EXPORT  VMTofpb        (long, char far *, unsigned);
  727. long        pascal  EXPORT  VMSize        (long);
  728. flagType    pascal  EXPORT  DoSpawn        (char far *, char far *,
  729.                          unsigned, unsigned far *);
  730.  
  731.  
  732. void        _cdecl  EXTERNAL WhenLoaded (void);
  733.  
  734. /*** - event processing definitions */
  735.  
  736. #define TM_NONE        0            /* place cursor at 'newcol'             */
  737. #define TM_FORWARD  1            /* place cursor 1 backtab from 'newcol' */
  738. #define TM_BACKWARD 2            /* place cursor 1 tab from 'newcol'     */
  739.  
  740. struct newlinevent {
  741.     PFILE      pFile;            /* pFile at time of event           */
  742.     char far * lpszSuffix;        /* file suffix                      */
  743.     LINE       line;            /* current line of pFile            */
  744.     COL        newcol;            /* returns x-position on new line   */
  745.     int           tabmode;            /* TM_NONE, TM_FORWARD, TM_BACKWARD */
  746.     };
  747.  
  748. typedef union {                 /* arguments to event dispatches */
  749.     struct newlinevent         EvtNewline;    /* newline event data            */
  750.     } EVTargs;
  751.  
  752. struct eventType {            /* event definition struct                */
  753.     struct eventType far *pEVTNext;    /* - next handler in list                 */
  754.     flagType (pascal EXPORT *func)(EVTargs far *);  /* - handler                  */
  755.     EVTargs far    *pEVTargs;        /* - optional pointer to arg restrictions */
  756.     unsigned    evtType;        /* - type                                 */
  757.     PFILE    focus;            /* - applicable focus                     */
  758.     };
  759. typedef struct eventType EVT;
  760.  
  761. void        pascal  EXPORT  DeRegisterEvent    (EVT far *);
  762. void        pascal  EXPORT  RegisterEvent    (EVT far *);
  763.  
  764. #define EVT_NEWLINE        43        /* newline has been entered */
  765.