home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / utility / unittool / turbo5 / intrfac5 / globals.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1988-12-11  |  4.0 KB  |  164 lines

  1. unit globals;
  2.  
  3. interface
  4.  
  5. type
  6.   header_ptr = ^header_rec;
  7.   header_rec = record
  8.     file_id: array[0..3] of char; { 0-3 }
  9.     i4,                           { 4-5 }
  10.     i6,                           { 6-7 }
  11.     ofs_this_unit,                { 8-9 }
  12.     ofs_hashtable,                { A-B }
  13.     ofs_3,                        { C-D }
  14.     ofs_storage_req,              { E-F }
  15.     ofs_5,                        {10-11}
  16.     ofs_6,                        {12-13}
  17.     ofs_src_name,                 {14-15}
  18.     ofs_line_nums,                {16-17}
  19.     sym_size,                     {18-19}
  20.     code_size,                    {1A-1B}
  21.     reloc_size,                   {1C-1D}
  22.     const_size,                   {1E-1F}
  23.     var_size,                     {20-21}
  24.     ofs_localhash:word;           {22-23}
  25.     float_flag:word;              {24-25}    { 0=N-, 1=N+ }
  26.     other: array[$26 div 2..$3F div 2] of word; {26-3F}
  27.   end;
  28.  
  29.   word_array_ptr = ^word_array;
  30.   word_array=array[0..32760] of word;
  31.   byte_array_ptr = ^byte_array;
  32.   byte_array=array[0..65520] of byte;
  33.  
  34.   hash_ptr = ^hash_rec;
  35.   hash_rec = record
  36.     byte_len : word;
  37.     table    : word_array;
  38.   end;
  39.  
  40.   obj_ptr = ^obj_rec;
  41.   obj_rec = record
  42.     next_obj: word;  { in case of a hash collision }
  43.     name: string;
  44.   end;
  45.  
  46.   list_ptr = ^list_rec;
  47.   list_rec = record
  48.     offset : word;
  49.     hash : word;
  50.     next : list_ptr;
  51.   end;
  52.  
  53.   type_def_ptr = ^type_def_rec;
  54.   type_def_rec = record
  55.     type_type : byte;
  56.     other_byte : byte;
  57.     size : word;
  58.     case integer of
  59.     1 : ( element_ofs,element_unit,index_ofs,index_unit: word );
  60.     2 : ( first_ofs : word;       {  After each entry is a pointer to the next }
  61.           hash_table : hash_rec );
  62.   3,7 : ( base_ofs,base_unit:word );
  63.   5,6 : ( return_ofs,return_unit,num_args:word );
  64.     8 : ( target_ofs,target_unit:word;
  65.           target_name:string );
  66. 10,13 : ( lower,upper : longint;
  67.           type_ofs,type_unit:word
  68.         );
  69.    -1 : ( who_knows : array[3..8] of word
  70.         );
  71.   end;
  72.  
  73.   type_info_ptr = ^type_info_rec;
  74.   type_info_rec = record
  75.     id:byte;
  76.     type_def_ofs,type_unit : word;
  77.   end;
  78.  
  79.   var_info_ptr = ^var_info_rec;
  80.   var_info_rec = record
  81.     id,
  82.     c_or_v:byte;  { 0 = var, 1 = typed const }
  83.     offset,  { within the appropriate section }
  84.     in_unit,
  85.     type_def_ofs,type_unit : word;
  86.   end;
  87.  
  88.   func_info_ptr = ^func_info_rec;
  89.   func_info_rec = record
  90.     id,always8:byte;
  91.     ofs1,ofs2,local_hash,q1,q2,type_def_ofs,type_unit,num_args : word;
  92.   end;
  93.  
  94.   const_info_ptr = ^const_info_rec;
  95.   const_info_rec = record
  96.     id:byte;
  97.     type_def_ofs,type_unit : word;
  98.     case integer of
  99.     0:  (intval:longint);
  100.     1:  (realval:real);
  101.     2:  (stringval:string);
  102.     3:  (extendval:extended);
  103.     end;
  104.  
  105.   arg_ptr = ^arg_rec;
  106.   arg_rec = record
  107.     type_def_ofs,type_unit : word;
  108.     var_or_val : byte;    {  2=by value, 6=by reference, i.e. var  }
  109.     name:string;
  110.   end;
  111.  
  112.   unit_ptr = ^unit_rec;
  113.   unit_rec = record
  114.     id:byte;
  115.     target:word;
  116.     q1:word;
  117.     next_unit : word;
  118.   end;
  119.  
  120.   unit_list_ptr = ^unit_list_rec;
  121.   unit_list_rec = record
  122.     name : string;
  123.     buffer : byte_array_ptr;
  124.     obj_list : list_ptr;
  125.     own_record : word;
  126.   end;
  127.  
  128. const
  129.   record_id   =  2;
  130.   pointer_id  =  6;
  131.   const_id    = 81;
  132.   type_id     = 82;
  133.   var_id      = 83;
  134.   proc_id     = 84;
  135.   func_id     = 85;
  136.   sys_proc_id = 86;
  137.   sys_fn_id   = 87;
  138.   sys_port_id = 88;
  139.   sys_mem_id  = 89;
  140.   unit_id     = 90;
  141.   init_id     = 128;   { Just hope that these haven't already been taken! }
  142.   uses_id     = 129;
  143.   local_id    = 130;
  144.   referenced_id = 131;
  145. var
  146.   buffer,tpl_buffer : byte_array_ptr;
  147.   tpl_size : word;
  148.   header : ^header_rec;
  149.   hash_table : hash_ptr;
  150.   unit_list : array[1..255] of unit_list_ptr;
  151.   obj_list : list_ptr;
  152.   unitname : string;
  153.   last_kind : byte;
  154.   in_function : boolean;
  155.   f:file;
  156.   got_tpl : boolean;
  157.   just_tpl : pointer;
  158.   unit_size : word;
  159.   uses_path : string;
  160.  
  161. implementation
  162. { just declarations! }
  163.  
  164. end.