home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / alphal.zip / ALPHA1.H < prev    next >
C/C++ Source or Header  |  1997-07-15  |  17KB  |  276 lines

  1. /*********** Alpha C Program Include file (.H) ****************************/
  2. /*                                                                        */
  3. /*  The Alpha V3.0 include file defines the structures used               */
  4. /*  in the Alpha1.C etc. and .RC files.                                   */
  5. /*                                                                        */
  6. /*  Lionel de Lambert - 28 Jul 1994 - IBM, Hursley                        */
  7. /*                                                                        */
  8. /**************************************************************************/
  9.  
  10.  
  11. #define Max_record_size 256        /* also in Alpha3.asm                  */
  12. #define PATHSZ          256        /* Maximum path size                   */
  13. #define PREVFILES       16         /* No. of save file names              */
  14. #define Max_elm        1000      /* maximum No. elements in structure blk.*/
  15. #define Str_max_nm      24         /* maximum name length for structure   */
  16. #define Str_nm_entr        2       /* number of entries in name           */
  17.                             /* number of entries in structure continuation*/
  18. #define Str_co_entr (Str_max_nm/4)+ Str_nm_entr  
  19. #define Max_modify_rec 64          /* Maximum No. records in modify block */
  20. #define STRINGSZ       32          /* Size of Highlighted string etc.     */
  21.         
  22. struct Toolbar_data {          
  23.       LONG ID;                     /* Menu id                             */
  24.       LONG Button_ID;              /* Bitmap id                           */
  25.       HWND Button;                 /* Button window handle                */
  26.       HWND Bhwnd;                  /* button bit map handle               */
  27.       char H_data[24];             /* Help text                           */
  28.      };
  29.  
  30. struct rec_elm {                   /* record element - see ALPHA3.ASM     */
  31.                  char *rec;        /* address of record                   */
  32.                  long length;      /* Length of record                    */
  33.                  unsigned Modified :1; /* pointer to Modification entry   */
  34.                  unsigned Continued :1; /* Record is continued            */
  35.                  unsigned Filea     :1; /* Record is unique to file a     */
  36.                  unsigned Fileb     :1; /* Record is unique to file b     */
  37.                  unsigned strcont   :3; /* 0, 1-4 for string continued    */ 
  38.                                      /* from this record to the following */
  39.                };                  /* the length will be 12 bytes         */
  40.  
  41. #define records_prefix 12          /* length of prefix part of block      */
  42. struct records {            /* record pointer block - see ALPHA3.ASM      */
  43.                  struct records *next;  /* next record block              */
  44.                  int    Max_elemt; /* Maximum No. elements in block       */
  45.                  long   No_elm;    /* number of elements                  */
  46.                  struct rec_elm record_elm[20000];
  47.                };
  48.  
  49. struct Recd_elmt {                 /* Update record element               */
  50.                   int length;      /* length of record                    */
  51.                   char rec[Max_record_size]; /* new record                */
  52.                  };
  53.  
  54. struct Modifyblk {                 /* Update record block                 */
  55.                   struct Modifyblk *nxt; /* next modification block       */
  56.                   int Max_rec;     /* maximum No. records in block        */
  57.                   int No_rec;      /* Actual No. records in block         */
  58.                   struct Recd_elmt entry[Max_modify_rec]; /* record entries*/
  59.                  };
  60.  
  61. struct Label_flgs {                /* flags for label entry etc.          */
  62.                     unsigned flcn : 1; /* continuation entry              */
  63.                     unsigned flse : 1; /* procedure entry                 */
  64.                     unsigned flsc : 1; /* procedure call                  */
  65.                     unsigned flsd : 1; /* label defined here              */
  66.  
  67.                   };
  68.  
  69. struct Label_state {               /* label statement number entry        */
  70.                     short int stmtn;  /* statement number                 */
  71.                     struct Label_flgs flag; /* entry flags                */
  72.                    };
  73.  
  74. union label_nm {
  75.              char name[Str_max_nm];    /* label name                      */
  76.              struct Label_state stmt[Str_max_nm/4]; /* statement number & flags */
  77.             };
  78.  
  79. struct Label_ent {                 /* label entry                         */
  80.                  struct Label_con *cont; /* pointer to continuation       */
  81.                  int nxfr;         /* next free index                     */
  82.                  struct Label_flgs flag; /* entry flags                   */
  83.                  short int naml;    /* name length                        */
  84.                  union label_nm statemnt;
  85.                  struct Label_state stmtc[Str_nm_entr]; /* statement number & flags */
  86.                  };
  87.  
  88. struct Label_con {                 /* label continuation                  */
  89.                  struct Label_con *cont; /* pointer to continuation       */
  90.                  int nxfr;         /* next free index                     */
  91.                  struct Label_flgs flag; /* entry flags                   */
  92.                  short int naml;    /* name length                        */
  93.                  struct Label_state stmt[Str_co_entr]; /* record statement # entries*/
  94.                  };
  95.  
  96. struct Label_pt {                  /* label block                         */
  97.                  struct Label_pt *nxt; /* next block or 0                 */
  98.                  int Num;        /* number of label entries in this block */
  99.                  struct Label_ent entr[Max_elm]; /* label entries         */
  100.                 };
  101.  
  102. struct Backout {                   /* Structure for backout records       */  
  103.              struct Backout *next; /* pointer to next backout block       */ 
  104.              int start_y;          /* start record #                      */ 
  105.              int start_x;          /* start character position            */ 
  106.              int end_y;            /* end record #                        */ 
  107.              int end_x;            /* end character position              */ 
  108.              char *recds;          /* pointer to records                  */
  109.              int len;              /* Length of storage                   */
  110.              unsigned select_mode : 1;  /* 1 => Box mode select           */
  111.              unsigned insert_mode : 1;  /* 1 => in insert mode            */
  112.              unsigned in_use : 1;  /* 1 => The block is active            */
  113.               };      
  114.  
  115. struct Bookmark {                  /* Bookmark structure                  */
  116.                int mark;           /* Line number                         */
  117.                char name[16];      /* bookmark name                       */
  118.                 };
  119.  
  120. typedef struct child {        
  121.                  struct child * next; /* Next child block or 0            */
  122.                  HWND hwnd;        /* Client widow handle                 */
  123.                  HWND Fhwnd;       /* frame handle                        */
  124.                  HFILE Fhand;      /* file handle                         */
  125.                  HWND hwndPopMenu; /* Pop-up menu window                  */
  126.                  char *buffer;     /* pointer to file buffer              */
  127.                  int lan;          /* language A37=1.ASM=2,etc.           */
  128.                  long file_size;   /* number of characters in file        */
  129.                  int rec_num;      /* current record number               */
  130.                  int rec_last;     /* last rec. # used for Window         */
  131.                  int Offset;       /* horizontal offset                   */
  132.                  int tot_rec;      /* total number of records in file     */
  133.                  int ySel_s;       /* Rec# start of Select area           */
  134.                  int ySel_e;       /* Rec# end of Select area             */
  135.                  int xSel_s;       /* Chr# start of select area           */
  136.                  int xSel_e;       /* Chr# end of select area             */
  137.                  int xMouse_l;     /* Last Mouse x coord.                 */
  138.                  int yMouse_l;     /* Last Mouse y coord.                 */
  139.                  int xEnd;         /* character end of Mouse button1 area */
  140.                  int Hide_s;       /* Rec# start of hide area             */
  141.                  int Hide_e;       /* Rec# end of hide area               */
  142.                  int Pair_s;       /* start of BEGIN/END Pair area        */
  143.                  int Pair_e;       /* end of Pair area                    */
  144.                  int find_s_x;     /* x coord. of start of BEGIN pair     */
  145.                  int menu_id;      /* window menu id of child if used     */
  146.                  int find_s_y; /* y coord. of start of BEGIN pair - offset*/ 
  147.                  int NoChng;       /* Number of changes to file           */ 
  148.                  int column;       /* Column number for grig line or 0    */ 
  149.                  char *OrigPath;   /* original file path                  */
  150.                  struct Bookmark Mark[10]; /* Bookmark line numbers etc.  */
  151.                  struct records *rec_array; /* pointer to records array   */
  152.                  struct Label_pt *structure; /* pointer to structure entries*/
  153.                  struct Modifyblk *Modblk; /* pointer to modification block */
  154.                  struct Backout * pBackout; /* pointer to backout block   */
  155.                  unsigned Expand_child : 1;  /* set if expand window      */
  156.                  unsigned Select : 1;  /* set if button1 drag area        */
  157.                  unsigned Hide : 1;  /* set if hiding records             */
  158.                  unsigned Pair : 1;  /* set if PAIRing records            */
  159.                  unsigned erase_back :1; /* set if background to be erased */
  160.                  unsigned Button1_down :1; /* Mouse button 1 down         */
  161.                  unsigned Cmt_supr :1; /* Set if comment suppression      */
  162.                  unsigned Save :1; /* Set if Save is required             */
  163.                  unsigned Insert :1; /* Set if Insert mode - edit         */
  164.                  unsigned Composite :1; /* Set if Composite from compare  */
  165.                  unsigned ReadingFile :1; /* Set if still reading data    */    
  166.                  unsigned ParsingFile :1; /* Set if still parsing data    */
  167.                  unsigned InSelect :1; /* Set if button 1 in select area  */ 
  168.                } CHILD;            /* End of child structure              */
  169.  
  170. #define sizeof_lex 256
  171. struct lex {                       /* language table entry                */
  172.            int len;                /* length of key word                  */
  173.            long col;               /* colour                              */
  174.            long backcol;           /* background colour                   */
  175.            unsigned underline :1;  /* use underline font                  */
  176.            char *kwd;              /* key word                            */
  177.            };
  178.  
  179.  
  180. struct stat {
  181.             unsigned tile :1;      /* =1 if tile was last window operation */ 
  182.             unsigned saving :1;    /* =1 if currently saving a file        */ 
  183.             unsigned compiling :1; /* =1 if currently compiling a file     */ 
  184.             };
  185.  
  186.  
  187. struct OPR_Flg {                   /* operator table flags                */
  188.                 unsigned OPR_F_P :1; /* procedure                         */
  189.                 unsigned OPR_F_C :1; /* call                              */
  190.                 unsigned OPR_F_L :1; /* scan left                         */
  191.                 unsigned OPR_F_R :1; /* scan right                        */
  192.                 unsigned OPR_F_Co :1; /* label followed by colon          */
  193.                 unsigned OPR_F_2 :1; /* second parameteer                 */
  194.                };
  195.  
  196. struct LANGUAGE {
  197.             char strs[9];          /* String start pairs - 1st. two comment */
  198.             char stre[9];          /* string end pairs                    */  
  199.             char Esc;              /* Escape character or 0               */
  200.             int cmtpos;            /* 0 or chr. pos. of fixed comment     */
  201.             int Nolex;             /* No. of keyword entries              */
  202.             struct lex * lex_ent;  /* Pointer to keyword  lex entries     */
  203.             unsigned tab[2];       /* Four tab values 1-255               */
  204.             unsigned Case    : 1;  /* case sensitive                      */
  205.             unsigned def     : 1;  /* default language type - Algol       */
  206.             unsigned none    : 1;  /* no comment parsing etc.             */
  207.             unsigned A37     : 1;  /* 370 assembler                       */
  208.             unsigned FORTRAN : 1;  /* FORTRAN                             */
  209.             unsigned C       : 1;  /* C language                          */  
  210.             unsigned ASM     : 1;  /* MASM                                */
  211.                 };
  212.                                    /* operator table                      */
  213. struct OPR {
  214.             short int Lang;        /* Language or -1                      */
  215.             struct OPR_Flg OFLAG;  /* Flags                               */
  216.             short int Nm_len;      /* name length                         */
  217.             char  Nm[12];          /* operator name                       */
  218.            };
  219.  
  220. #define No_Cmd 3                   /* Number of commands                  */
  221. #define Cmd_size 256               /* maximum length of commands          */
  222.  
  223. struct Command {                   /* Command array for compile           */
  224.              char Cmd[No_Cmd][Cmd_size]; /* command strings               */
  225.            };
  226.  
  227. struct Interval {                  /* text intervals                      */
  228.            struct Interval *fwd;   /* forward pointer                     */
  229.            int a;                  /* interval start                      */
  230.            int b;                  /* interval end                        */
  231.            COLOR fg;               /* forground colour                    */
  232.            COLOR bg;               /* background colour                   */
  233.            unsigned underline :1;  /* use underline font                  */
  234.            unsigned string :1;     /* string interval                     */
  235.                 };
  236.                                                          
  237. struct COLR {
  238.              COLOR fg;             /* forground colour                    */ 
  239.              COLOR bg;             /* background colour                   */ 
  240.              unsigned underline :1; /* use underline font                 */  
  241.             };                                                                
  242.                    
  243. #define Max_trace_lvl 16           /* depth of trace level                */
  244. struct Trace_Ent {                 /* trace entry for debug               */
  245.              int Module;           /* Module number                       */
  246.              int Line;             /* Line number                         */
  247.              unsigned Flags;       /* 0x1 - entry, 0x2 - exit, 0x3 - data */
  248.              unsigned Data;        /* data field                          */
  249.                  };
  250.  
  251. typedef struct _RCD {              /* Msg. entry for record playback      */ 
  252.              HWND hwnd;
  253.              ULONG msg;
  254.              MPARAM mp1;
  255.              MPARAM mp2;   
  256.             } RCD;    
  257.                                    /* Procedure declarations              */
  258.        
  259. /***********************************************************************/
  260. /*                                                                     */
  261. /* block of main program parameters                                    */
  262. /* the variable that points to this block is usually named pThreadParm */
  263. /***********************************************************************/
  264.  
  265. typedef  struct _MAIN_PARM {
  266.     HAB        hab;                /* hab obtained on thread 1                */
  267.     HWND       hwndFrame;          /* frame handle                            */
  268.     HWND       hwndClient;         /* client window handle                    */
  269.     HWND       hwndObject;         /* object window handle on thread 2        */
  270.     TID        tidObjectThread;    /* thread id for object window         */
  271. } MAIN_PARM;
  272. typedef MAIN_PARM *PMAIN_PARM;
  273.  
  274. /* end of file - ALPHA1.H                                                  */
  275.  
  276.