home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / datamage.zip / CODE.ZIP / MAGEISAM.H < prev    next >
C/C++ Source or Header  |  1991-09-24  |  7KB  |  191 lines

  1. extern BYTE
  2.  
  3.     readf,             /*  flag for necessity of getting files from disk  */
  4.     pth_str [81],      /*  holds current path  */
  5.     r_buff [256],      /*  small buffer - misc tasks  */
  6.     f_buff [10241],     /*  large buffer - read/write records  */
  7.     files_loaded;      /*  number DATAMAGE files currently open  */
  8.  
  9. typedef struct                     /* structure holding field definitions */
  10.     {
  11.     BYTE   name [27];            /* name of field */
  12.     BYTE   type;                 /* 0=date 1=string 2=numeric 3=dollar */
  13.     BYTE   length;               /* length of field */
  14.     BYTE   spare;                /* explained below */
  15.     BYTE   abs;                  /* absolute field number */
  16.     WORD   offset;               /* offset of field in record */
  17.     } fdef;
  18.  
  19. /*  definition of fdef.spare:
  20.  
  21. switch (fdef.type)
  22.     {
  23.     case 0: defines date field format: 0=mm/dd/yy 1=dd/mm/yy
  24.     case 1: defines index mode for string: 0=none 1=unique 2=normal 3=cross
  25.     case 2: defines number of decimals to maintain in numeric field
  26.     case 3: always 2, defines precision of dollar format field
  27.     }  */
  28.  
  29. typedef struct                    /* structure holding loaded datafiles */
  30.     {
  31.     /*  NOMINCLATURE  */
  32.  
  33.     BYTE dir [51];               /* directory name holding file */
  34.     BYTE des [41];               /* description of loaded file  */
  35.  
  36.     /*  NUMERIC DATA  */
  37.  
  38.     DWORD rcd_len;               /* length of record in bytes */
  39.     WORD num_rcds;               /* number of records in file */
  40.     WORD num_flds;               /* number of fields in file  */
  41.  
  42.     /*  array of far pointers to type fdef (defined above)  */
  43.  
  44.     fdef far * key [200];
  45.  
  46.     /*  data relating to idnexes and searches of same  */
  47.  
  48.     BYTE indexes;                /* holds number of indexed fields  */
  49.     BYTE indexed_fields [5];     /* holds numbers of indexed fields  */
  50.  
  51.     BYTE unique_field;           /* 1 = unique fields 2=no  */
  52.  
  53.     BYTE cross_fields;           /* number of cross-indexed fields  */
  54.     BYTE cross_cntr;             /* number of cross-indexed fields selected  */
  55.  
  56.     BYTE write_sw;               /* 0=no write to file, 1=write record  */
  57.     DWORD rw_sw;                 /* 0=not ready for read
  58.                               1=ready after (row * 7800) + col */
  59.  
  60.     BYTE  i_case [5];            /*  1=ignore case/spacing in search 0=no */
  61.     SWORD index_results [5];     /*  holds index of record being checked  */
  62.     SWORD disk_index    [5];     /*  holds indexs read fron disk - buffer  */
  63.  
  64.     /*  LOAD INFORMATION  */
  65.  
  66.     WORD sequence;               /* file sequence# of record in buffer  */
  67.     WORD next_rcd;               /* sequence of next record             */
  68.     WORD r_number;               /* record number of record in buffer   */
  69.  
  70.     BYTE m_name [53];            /* main datafile path/filename      */
  71.     BYTE i_name [53];            /* index file path/filename         */
  72.     BYTE c_name [53];            /* control file path/filename       */
  73.  
  74.     /*  FILE POINTERS TO THE THREE ASSOCIATED FILES  */
  75.  
  76.     FILE * main;                 /* pointer for main datafile buffer */
  77.     FILE * indx;                 /* pointer for index file buffer    */
  78.     FILE * ctrl;                 /* pointer for control file buffer  */
  79.  
  80.     /*  MARKER FILE INFORMATION  */
  81.  
  82.     BYTE mkr_active;             /* 0=process file, 1=process marker */
  83.  
  84.     FILE * marker;               /* pointer for marker file buffer   */
  85.  
  86.     WORD m_num_rcds;             /* holds number of records in mkr   */
  87.  
  88.     WORD m_next_rcd;             /* holds next record seq in marker  */
  89.  
  90.     BYTE m_rcd_len;             /* holds record length in marker    */
  91.  
  92.     BYTE b_levels;                /* holds number of search levels    */
  93.  
  94.     SBYTE bs_sw;                /*  binary search switch
  95.                                     -10 = inactive
  96.                                    -2  = search counter 2
  97.                                    -1  = search counter 1
  98.                                      0  = search record numbers
  99.                                      1  = search disk data        */
  100.  
  101.     BYTE asf [8] [3];            /*  holds details of current binary order
  102.  
  103.                                pos 0 = target field + 1
  104.  
  105.                                pos 1 = format:
  106.                                        1 = nromal
  107.                                        2 = name
  108.                                        3 = string as numeric
  109.  
  110.                                pos 2 = ignore case/spacing
  111.                                         (not recorded - user selected)
  112.                                        0 = no, 1 = yes         */
  113.  
  114.     BYTE counter_sw;             /*  0= no counters in marker,
  115.                                       1= counter 1 in marker,
  116.                                   2= counter 2 in marker,
  117.                                   3= both  */
  118.  
  119.     SBYTE c1_sw;                 /*  -1= counter is inactive,
  120.                                 0-8=decimal precision,
  121.                                9=no rounding  */
  122.  
  123.     double c1_val;                /*  value of counter 1, if any  */
  124.  
  125.     SBYTE c2_sw;                 /*  as above  */
  126.  
  127.     double c2_val;                /*  value of counter 2, if any  */
  128.  
  129.     /*  BUFFER  */
  130.  
  131.     BYTE far * buff;             /* buffer for this file */
  132.     } file_info;
  133.  
  134. extern file_info fi [];
  135.  
  136. /*  FUNCTIONS INCLUDED IN MAGEISAM.C  */
  137.  
  138.     void           far decoder         ();
  139.     SWORD          far index_field     (BYTE * target);
  140.  
  141.     void           far set_field       (BYTE, BYTE, BYTE, BYTE *);
  142.     void           far get_field       (BYTE, WORD, BYTE, BYTE *);
  143.     BYTE           far read_field      (BYTE, WORD, WORD, BYTE *);
  144.     BYTE           far write_field     (BYTE, WORD, WORD, BYTE *);
  145.  
  146.     BYTE           far index_MAGErecord (BYTE);
  147.     BYTE           far find_MAGErecord  (BYTE, WORD, BYTE, WORD);
  148.     BYTE           far find_MAGErecord_nmbr (BYTE, WORD);
  149.     BYTE           far access_MAGE_record  (BYTE, BYTE, BYTE);
  150.  
  151.     BYTE           far write_MAGErcd   (BYTE);
  152.     BYTE           far read_MAGErcd    (BYTE, WORD);
  153.     BYTE         far read_next_rcd     (BYTE, BYTE *);
  154.  
  155.     void           far print_MAGE_record (BYTE);
  156.  
  157.     BYTE           far search_MAGE_files (BYTE, BYTE);
  158.     BYTE           far vs_MAGE_recrd   (BYTE, BYTE, BYTE *);
  159.  
  160.     BYTE           far get_files       (BYTE *, BYTE);
  161.     BYTE           far select_datafile ();
  162.  
  163.     BYTE           far open_file       (BYTE);
  164.     void           far close_file      (BYTE);
  165.  
  166.     BYTE           far ready_files     (SBYTE);
  167.     BYTE           far get_next_rno    (BYTE);
  168.  
  169.     BYTE           far show_files      (BYTE);
  170.     BYTE           far show_datafiles  (BYTE);
  171.     BYTE           far show_fields     (BYTE, BYTE);
  172.     BYTE           far show_menu       ();
  173.  
  174.     void           far fill_window     (BYTE, SWORD *, SWORD *, BYTE);
  175.     BYTE           far work_window     (BYTE, SWORD *, SWORD *, BYTE);
  176.     void           far window_line     (BYTE, BYTE, BYTE, BYTE);
  177.  
  178.     WORD         far get_curr_fno     (BYTE, WORD);
  179.  
  180.     BYTE         far read_next_rcd    (BYTE, BYTE *);
  181.     BYTE         far get_cntr         (BYTE, BYTE, double *, BYTE *);
  182.     BYTE         far load_marker    (BYTE, BYTE *);
  183.  
  184.     void         far ipt_box         (BYTE, BYTE, BYTE, BYTE,
  185.                                      BYTE, BYTE, BYTE *);
  186.  
  187.     WORD         far minpt            (BYTE, BYTE, BYTE *);
  188. /*-------------------------------------------------------------------------*/
  189.  
  190.  
  191.