DataMuseum.dk

Presents historical artifacts from the history of:

RC4000/8000/9000

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about RC4000/8000/9000

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download

⟦e19b4417b⟧ TextFile

    Length: 3840 (0xf00)
    Types: TextFile
    Names: »theadpm     «

Derivation

└─⟦01e83a425⟧ Bits:30008166 Bånd med SW8010 og SW8500 source code
    └─⟦75ff9bef3⟧ 
        └─⟦this⟧ »theadpm     « 

TextFile

external
integer
procedure  headparamsm(filename, fileno, chains,
                      recdescr, noofkeys, sizem);
string filename;
integer fileno, noofkeys;
integer array chains, recdescr, sizem;
comment

  the procedure performs the reverse function of headm.
  the only call parameter is filename.
  the result of the procedure is indicated by its value:

    headparamsm  meaning
    0            ok
    -1           the file is not a cfmaster file
    >0           the number of last chain is returned.
                 array chains is not declared (1:maxchain*4)

  it must be mentioned that array chains is initialized only 
  partly as the number of the daugtherfile of a chain cannot
  be found in the motherfile head.
  the initialization is sufficient though for a subsequent call
  of headm.

  the procedure headparamsi is used as a subroutine.
;
begin
  integer  i, maxchain, chainno, cfbufrefrel, chainpartsize,
    maxreclength, maxbucks, segsperbuck, segsperblock;
  integer field  ifld;
  integer array field  chtab, iaf;
  zone  z(256, 1, stderror);

  headparamsm:= 0; <* ok *>

  if system(3, maxchain, chains) <> 1 then  maxchain:= 0
  else
    maxchain:= maxchain // 4;

  for i:= 0 step 1 until maxchain - 1 do
  begin
    chains(i*4 + 1):= -1;
    chains(i*4 + 2):= -2;
    chains(i*4 + 3):=  0;
    chains(i*4 + 4):=  0;
  end;

  open(z, 4, filename, 0);
  inrec6(z, 1024);

  iaf:= 0;
  if  z.iaf(1) > 0    <*  ibufrefrel *>
  and z.iaf(2) > 0    <* cfbufrefrel *>
  and z.iaf(1) > z.iaf(2)
  and z.iaf(2) <= 1024 - 1 - 24 <* = b15 *> then
  begin
  comment
    great chance for a master file.

    find the filenumber and chainpartsize;
    cfbufrefrel:= z.iaf(2) + 1;
    ifld:= cfbufrefrel + 24 <* = b25 *>;
    fileno:= z.ifld shift(-4);
    if z.ifld extract 4 <> 0 <* type master *> then  goto notok;
    ifld:= cfbufrefrel + 20 <* = b9  *>;
    chainpartsize:= z.ifld;

  comment
    now find the first mother chaintable.
    the format of a mother table is 4 words of the following contents:
      -1, -1, chfldrel, chainnumber shift 12 add chainsequencenumber.
    end of tables is signalled through a word containing the value 0.
    ;
    ifld:= cfbufrefrel + 26 <* = b16, first mother chaintable *>;
    chtab:= cfbufrefrel + z.ifld - 2;
    if chtab < 4 or chtab > 6 then  goto notok;

    while z.chtab(1) = -1 do
    begin
      chainno:= z.chtab(4) shift(-12);
      if chainno <= maxchain then
         chains((chainno-1)*4 + 1):= fileno
      else
         headparamsm:= chainno;
      chtab:= chtab + 8;
    end  go through mother tables;

    if z.chtab(1) <> 0 <* end tables *> then  goto notok;

    headparamsi(z, recdescr, noofkeys, 
        maxreclength, maxbucks, segsperbuck, segsperblock);

    sizem(1):= maxreclength * 4 - chainpartsize;
    sizem(2):= maxbucks;
    sizem(3):= segsperbuck;
    sizem(4):= segsperblock;

  end  ok master file
  else
  begin
  comment  not ok masterfile;

notok:
    headparamsm:= -1;
  end;
  close(z, true);
end  headparamsm;
end
▶EOF◀