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

⟦d8192cfc4⟧ TextFile

    Length: 7680 (0x1e00)
    Types: TextFile
    Names: »filtertx    «

Derivation

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

TextFile

; dh 87.05.06        filter algorithm for search        page ...00...




b. a11, b3, c1, d5 w.

;This algorithm enables search to filter the output of catalog entries
;found according to a given scope specification. The filter works on
;the entry name and the document name of an entry.
;
;Syntax (augments):
;------------------
;(             )1                    (        )*
;(<out file> = ) search <scope spec> (<filter>)
;(             )0                    (        )0
;
;                        (            )*
;<filter> ::= <substring>(.<substring>)
;                        (            )0
;
;                ( <generalized name> )
;<substring> ::= (      <name>        )
;                (<apostrophized name>)
;
;Function:
;---------
;   The main catalog is scanned, and a subset of it is listed with an
;output format as for lookup. If an outfile is specified, the list of
;catalog entries is printed on that file, otherwise current output is
;used.  Messages from search are always printed on current output.
;   If no filters are given, all entries from the main catalog accor-
;ding to the scope spec (see Scope specification) are listed, other-
;wise, the set of catalog entries is further delimited by means of
;filters (see Filter specification below).
;
;Filter specification:
;---------------------
;   A filter consists of one or more substrings concatenated by period.
;If a list of filters exists, an entry selected for listing will only
;be listed if either its name or its document name contain all the sub-
;strings of at least one of the filters. The order of the substrings 
;in a filter is irrellevant.
;   Thus, in a possible list of filters, you may consider space as "or"
;and period as "and", where the precedence of "and" and "or" is as in
;Algol.
\f


; dh 87.05.07        filter algorithm for search        page ...01...




;requirements:
;           w0       w1       w2       w3         r0         r1
;
;entry:    irr.     irr.     irr.    return   item after   catalog
;                                             scope spec    entry
;
;exit:    all registers and variables unchanged.
;
;         the procedure returns to return+0 in case of failure
;                           and to return+2 in case of success.
;


     ds. w3  b3.     ; save registers
     rl. w3  r0.     ;
     el  w2  x3      ; if item after scope spec = end command
     sh  w2  2       ;   then goto letitpass1;
     jl.     a11.    ;
     ds. w1  b2.     ;

     rl. w2  r1.     ; name in entry := entry name;
     al  w2  x2+6    ;

c1:  al  w3  x3+2    ; repeat <* entry- and document-name *>
     ds. w3  d1.     ;  text part(item) := first item addr + 2;
     al  w3  10      ;  x := 10;
                     ;  string := name in entry;

a0:  rs. w3  d2.     ;
     al  w1  x3      ;  repeat
     jl. w3  c0.     ;   namelength := x;
     rl. w3  d2.     ;   l := takechar(x, string);
     al  w3  x3-1    ;   x := namelength - 1;
     sn  w1  0       ;  until l <> 0;
     jl.     a0.     ;

a1:                  ;  repeat <* all possibillities of filter *>
\f


; dh 87.05.05        filter algorithm for search        page ...02...




;a1:                 ;   repeat <* items in a filter *>
     rl. w0  d2.     ;    j := namelength; <* charcount in an entry *>

a2:  rs. w0  d3.     ;    repeat <* stepping backward through the
                     ;              name in the entry *>
     al  w3  0       ;
     jl.     a4.     ;     for i := 0,
a3:  rl. w3  d4.     ;                <*i controls pos in an item *>
     al  w3  x3+1    ;              i+1 while l = k do
     se. w1 (d5.)    ;      begin
     jl.     a5.     ;
a4:  rs. w3  d4.     ;
     am.    (d3.)    ;       k := takechar
     al  w1  x3      ;               (j+i, name in entry);
     rl. w2  d0.     ;
     jl. w3  c0.     ;
     rs. w1  d5.     ;
     rl. w1  d4.     ;       l := takechar
     rl. w2  d1.     ;               (i, item);
     jl. w3  c0.     ;
     sn  w1  0       ;       if l = 0
     jl.     a6.     ;         then goto found;
     jl.     a3.     ;      end while loop;

a5:  rl. w0  d3.     ;
     es. w0  1       ;     j := j - 1;
     sl  w0  0       ;    until j < 0 <* end backward stepping *>;
     jl.     a2.     ;    comment when the loop is exhausted, l<>0;

a6:                  ;found:
     al  w2  x2+10   ;    nopass := l <> 0; <* variable kept in w1 *>
     rs. w2  d1.     ;    item := next item;
     el  w0  x2-2    ;    sep := item separator;

     se  w0  8       ;   until sep <> '.'
     jl.     a7.     ;      or nopass <* end items in a filter *>;
     sn  w1  0       ;   comment hereafter either all substrings in a
     jl.     a1.     ;       filter have suceeded, or a filter failed;
\f


; dh 87.05.07        filter algorithm for search        page ...03...




a7:  sn  w1  0       ;   if -,nopass <* i.e. a filter suceeded *>
     jl.     a10.    ;     then goto letitpass;

a8:  se  w0  8       ;   comment a filter failed, therfore: ;
     jl.     a9.     ;   while sep = '.' do
     al  w2  x2+10   ;    begin
     el  w0  x2-2    ;     item := next item;  sep := item separator;
     jl.     a8.     ;    end;
a9:  rs. w2  d1.     ;   comment we may now examine the next filter;

     sl  w0  4       ;  until sep = end command;
     jl.     a1.     ;  comment all filters have failed on this name;

     rl. w2  r1.     ;  name in entry := document name;
     al  w2  x2+16   ;  item := item after scope spec;
     rl. w3  r0.     ;

     se. w2 (d0.)    ; until document name tested once before;
     jl.     c1.     ; comment the names have been tested with all filters;

     dl. w1  b2.     ;failure:
     dl. w3  b3.     ; restore registers;
     jl      x3      ; return failure;

a10: dl. w1  b2.     ;letitpass:
a11: dl. w3  b3.     ;letitpass1: restore registers;
     jl      x3+2    ; return success;
\f


; dh 87.05.05        filter algorithm for search        page ...04...




c0:                  ;subprocedure takechar(pos, string);
                     ; call: w0: -; w1:  pos; w2: string; w3: return
     al  w0  0       ; exit: w0: -; w1: char; w2:   unch; w3:   unch
     wd. w1  b0.     ;  addr := pos // 3;
     am      x1      ;  subpos := pos mod 3;
     am      x1      ;
     rl  w1  x2      ;  substring := word(2*addr + string);
     ls  w0  3       ;
     am     (0)      ;  char := substring shift(subpos*8 -16)
     ls  w1  -16     ;                    extract 7;
     la. w1  b1.     ;
     jl      x3      ; return;



b0:       3          ; constant 3 <* chars per word *>
b1:     8.177        ; constant: last 7 bits;


0, b2: 0, 0, b3: 0   ; room for registers;


d0:       0          ; addr of name in an entry;
d1:       0          ; addr of text part of an item;
d2:       0          ; namelength, i.e. length of name part in an entry
d3:       0          ; var: j <* stepping through name in an entry *>
d4:       0          ; var: i <* stepping through an item *>
d5:       0          ; var: k <* char from an entry *>

e.                   ; end block
▶EOF◀