{$X+}
program makedf;

include {NOLIST} 'domain:jsys.def';
include {NOLIST} 'pascal:extern.pas';		
include {NOLIST} 'domain:mdep.def';
include {NOLIST} 'domain:master.def';
include {NOLIST} 'domain:lparse.def';
include {NOLIST} 'domain:msub.hdr';
include {NOLIST} 'domain:fload.hdr';
include {NOLIST} 'domain:irdata.hdr';
include {NOLIST} 'domain:dump.hdr';
include {NOLIST} 'domain:addrr.hdr';
include {NOLIST} 'domain:mdep.hdr';
include {NOLIST} 'domain:pp.hdr';
include {NOLIST} 'domain:alloc.hdr';
include {NOLIST} 'domain:lparse.hdr';

type	char6=packed array[1..6] of char;
	char30=packed array[1..30] of char;
	pool_table=array[sapool] of free_block_pointer;

var	out:file of char;
	cpyfil:file of char;
	p_filename:^filename;
	p_pagemap:^pagemap;
	p_label_string:^label_string;
	p_ulabel:^ulabel;
	p_lab_use:^lab_use;
	p_dname:^dname;
	p_dname_string:^dname_string;
	p_dname_string_table:^dname_string_table;
	p_dname_table:^dname_table;
	p_primary_label_table:^primary_label_table;
	p_rr_table:^rr_table;
	p_rd_table:^rd_table;
	p_stgmap:^stgmap;
	p_zone_pools:^pool_table;
	p_node:^node;
	p_lock:^lock;
	p_zone_entry:^zone_entry;
	p_search_block:^search_block;
	p_master_block:^master_block;
	p_msure_type:^msure_type;
	p_rr:^rr;
	p_file_blk:^file_blk;
	p_zone_cdata:^zone_cdata;
	p_server_type:^server_type;
	p_servers_dv:^servers_dv;
	afile:filename;

procedure dd(lab:char6;val:integer;com:char30);

{	define a symbol	}

begin
writeln(out,lab,'==',val:5:o,'	; ',com);
end; {dd}

procedure dc(lab:char6;val:integer);

{	check a symbol	}
begin
writeln(out,'ifn ',lab,'-',val:5:o,',<printx ',lab,
	' consistency failure, should be ',val:5:o,'>');
end; {dc}

procedure dumpfn;

var	  i:integer;
begin
i:=1;
while afile[i]<>' '
do begin
       write(out,afile[i]);
       i:=i+1
   end
end;
{	This program makes the file DOMSYM.MAC which in turn is
	assembled to produce DOMSYM.unv

	DOMSYM.UNV is used to insure consistency of definitions
	for master file data structures between the pascal world
	and the MACRO world

}
begin { main }

rewrite(out,'domsym.mac');
writeln(out,'	universal domsym	Domain block sizes and offsets');
writeln(out,'	search	  monsym,macsym');
writeln(out);

{	Test or real version            }
if test_version
then dd('dtestv',1,'This is the test version      ')
else dd('dtestv',0,'This is the real thing        ');
writeln(out);

{	Database section definition     }
dd('domsec',db_first_page div 512,'Domain section number         ');
dd('dbvern',dbvern,'Database version number       ');

{	Class related definitions	}

dd('  dclb',ord(dclass_l_bound),'Class lower bound             ');
dd('  dchb',ord(dclass_h_bound),'Class upper bound             ');

{	Type related definitions	}

dd('  dtlb',ord(dtype_l_bound),'Type lower bound              ');
dd('  dthb',ord(dtype_h_bound),'Type upper bound              ');

dd(' fname',sizeof(p_filename),'                              ');
dd('pagema',sizeof(p_pagemap),'                              ');
dd('filebk',sizeof(p_file_blk),'                              ');
dd('zcdata',sizeof(p_zone_cdata),'                              ');
dd(' dntbl',sizeof(p_dname_table),'                              ');
dd('   plt',sizeof(p_primary_label_table),'                              ');
dd(' rrtbl',sizeof(p_rr_table),'                              ');
dd(' rdtbl',sizeof(p_rd_table),'                              ');
dd('stgmap',sizeof(p_stgmap),'                              ');
dd('poltbl',sizeof(p_zone_pools),'                              ');
dd('srvrty',sizeof(p_server_type),'single server definition      ');
dd('srvrdv',sizeof(p_servers_dv),'multiple servers definition   ');

dd(' maxdc',max_dname_chars,'Max chars in a dname          ');
dd(' maxdl',max_dname_labels,'Max labels in a dname         ');
dd(' maxlc',max_lab_chars,'Max chars in a label          ');
dd('labelh',label_hashmod,'Hashing modulo                ');
dd(' maxsb',max_sb,'Number of search blocks       ');
dd('gtdfmx',gtdfmx,'Max GTDOM function            ');

dd('hslots',hslots,'Host slots in tgraph          ');
dd('tslots',tslots,'Time slots in tgraph          ');
dd('qslots',qslots,'QTYPE slots in qgraph         ');
dd('cslots',cslots,'QCLASS slots in cgraph        ');
dd(' dimax',dimax ,'maximum day interval          ');
dd(' maxcs',maxcs ,'maximum compression savings   ');
dd(' sgmax',sgmax ,'maximum segment size graph    ');
dd('prfmax',prfmax,'high index of preference db   ');

{	     copy file of structure definitions}
reset(cpyfil,'master.mac','/E');
while not(eof(cpyfil))
do    begin
	  out^:=cpyfil^;
	  get(cpyfil);
	  put(out)
      end;
close(cpyfil);

{ define the file names }

if test_version
then afile:=tst_flipfile
else afile:=flipfile;
write(out,'define flipfn < asciz /');
dumpfn;
writeln(out,'/>');

if test_version
then afile:=tst_flopfile
else afile:=flopfile;
write(out,'define flopfn < asciz /');
dumpfn;
writeln(out,'/>');

{ now define the dcheck macro which checks for definition consistency	}

writeln(out,'define	dcheck <');

if test_version
then dc('dtestv',1)
else dc('dtestv',0);

dc('  dclb',ord(dclass_l_bound));
dc('   din',ord(internet));
dc('   dcs',ord(csnet));
dc('  dchb',ord(dclass_h_bound));

{	Type related definitions	}

dc('  dtlb',ord(dtype_l_bound));
dc('    da',ord(a));
dc('   dns',ord(ns));
dc('   dmd',ord(md));
dc('   dmf',ord(mf));
dc('dcname',ord(cname));
dc('  dsoa',ord(soa));
dc('   dmb',ord(mb));
dc('   dmg',ord(mg));
dc('   dmr',ord(mr));
dc(' dnull',ord(null));
dc('  dwks',ord(wks));
dc('  dptr',ord(ptr));
dc('dhinfo',ord(hinfo));
dc('dminfo',ord(minfo));
dc('dmx   ',ord(mx));
dc('  dthb',ord(dtype_h_bound));

dc('daxfer',axfr);
dc('dmailb',mailb);
dc('dmaila',maila);
dc(' dstar',star);

dc(' fname',sizeof(p_filename));
dc('pagema',sizeof(p_pagemap));
dc('filebk',sizeof(p_file_blk));
dc('zcdata',sizeof(p_zone_cdata));
dc(' dntbl',sizeof(p_dname_table));
dc('   plt',sizeof(p_primary_label_table));
dc(' rrtbl',sizeof(p_rr_table));
dc(' rdtbl',sizeof(p_rd_table));
dc('stgmap',sizeof(p_stgmap));
dc('poltbl',sizeof(p_zone_pools));
dc('srvrty',sizeof(p_server_type));
dc('srvrdv',sizeof(p_servers_dv));

dc(' maxdc',max_dname_chars);
dc(' maxdl',max_dname_labels);
dc(' maxlc',max_lab_chars);
dc('labelh',label_hashmod);
dc(' maxsb',max_sb);
dc('gtdfmx',gtdfmx);

dc('hslots',hslots);
dc('tslots',tslots);
dc('qslots',qslots);
dc('cslots',cslots);
dc(' dimax',dimax );
dc(' maxcs',maxcs );
dc(' sgmax',sgmax );
dc('prfmax',prfmax);

dc('labels',sizeof(p_label_string));
dc('ulabel',sizeof(p_ulabel));
dc('labuse',sizeof(p_lab_use));
dc(' dname',sizeof(p_dname));
dc('dnames',sizeof(p_dname_string));
dc(' dstbl',sizeof(p_dname_string_table));
dc('  node',sizeof(p_node));
dc('    rr',sizeof(p_rr));
dc('  lock',sizeof(p_lock));
dc('zoneen',sizeof(p_zone_entry));
dc(' serch',sizeof(p_search_block));
dc('master',sizeof(p_master_block));
dc(' msure',sizeof(p_msure_type));

writeln(out,'	>');

writeln(out,'	end');

close(out)

end. { main }
