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

⟦461e0bc5e⟧ TextFile

    Length: 48384 (0xbd00)
    Types: TextFile
    Names: »fpreadman«

Derivation

└─⟦00964e8f7⟧ Bits:30007478 RC8000 Dump tape fra HCØ.
    └─⟦b2ec5d50f⟧ 
        └─⟦this⟧ »fpreadman« 

TextFile

\f





H. C. Ørsted Institute
Computer Department
Universitetsparken 5
DK-2100 København Ø






                      HCØ RC8000 algol8 library
                        reading fp-parameters
                             "fpreadman"









                           Anders Lindgård
 



















                                               80/9 

                                               1980-12-20


                                               
\f


                                                                    1


Copyright 1980 Anders Lindgård.
For the time being this procedure set can be used freely for research
or other nonprofit purposes. Any other use demands written permission
from the author.



Read fp procedure system
------------------------

  The file processor language "fp" (ref. 1) for handling programs and
passing parameters to programs are nice and convenient  to  use.  But
to  read  them  in  an  algol  program  is  a little tricky using the
standard system. In algol 6 (ref. 2) it  is  possible  by  the  entry
system(4,i,arr);  to  scan  the  items in the fp-command-list for the
call of the running  algol  program.  Using  system(4,i,arr);  it  is
possible to read the items in the parameterlist in any order, but the
information  which  system(4,  gives back is not really in a nice and
easely usable form. It further requires a detailed knowledge  of  the
exact  formats of the file processor. In ref. 3 a sequential scanning
procedure readparam is described. The formats of readparam is  easier
to  remember but sequential scanning is not allways what a programmer
want.
  The procedures described here is an attempt to give the  programmer
an  easy  to  use  tool  for  searching the parameterlist in a random
manner. There is a close resemblance with  the  procedures  described
here and the conversational input procedures of ref. 4.
  A  sample  program for using the procedures described here and some
of the procedures described in ref. 5 is included to show how to  use
the system.

The procedures and variables.


  The  system  consist  of  a  set  of  procedures  and some standard
variables. The first call of any of the  procedures  will  initialize
the  system including most of the standard variables. If the standard
variable fplist is set to true by the program before the  first  call
the  fp-command-list  will  be  listed  on  current  output.  The fp-
command-list is treated according  to  the  syntax  described  below,
which  is  a  restricted  version  of  the  fp  syntax.  Items in the
fp-command-list which do no fulfill the syntax cannot be read by  the
procedures, but no errormessage is given. Parameters are scanned from
left  to right and only the first occurrence of a boolean, integer or
real parameter is significant.
\f


                                                                    2


Syntax of command list.


  <ls> <programname> <parameterlist>
  <ls>::= <text>=/<empty> ; left side in call, intended as output
  <programname>::=<text> ; name of program document
  <parameterlist>::=<boolean parameter>/<integer parameter>/
                    <real parameter>/<text parameter>/
                    <input parameter>/<extended parameter>/
                    <parameterlist><parameterlist>
  <boolean parameter>::=<SP><text>.<boolean>
  <integer parameter>::=<SP><text>.<integer>
  <real    parameter>::=<SP><text>.<integer>/
                        <SP><text>.<integer>.<integer2>
  <text    parameter>::=<SP><text>.<text>
  <input   parameter>::=<SP><text><SP> ; intended as input
  <extended parameter>::=<boolean parameter><extension>/
                         <integer parameter><extension>/
                         <text    parameter><extension>
  <extension>::=.<integer>/.<text>/<extension>.<extension>
  <boolean>::=yes/ja/true/sand/
              no/nej/false/falsk
  <integer2>::=<integer>/0.<integer>/<integer2>
  <text> and <integer> must fullfill the fp syntax.



NB. The strange definition of <integer2> in <real parameter>  is  due
    to  fp's interpretation of 2.03 as 2.3. To obtain the result 2.05
    it is nessecary to write 2.0.5
\f


                                                                    3


                            System variables
                Alphabetic list of predeclared variables


    integer     fpbooleans
    boolean     fpin
    integer     fpints
    integer     fpinareas
    integer     fpitems
    boolean     fplist
    integer     fpnr
    boolean     fpout
    integer     fpreals
    boolean     fptestpr
    boolean     fpunstacki
    

The boolean fptestpr is only for debugging the system.

Before the first call of any procedure only fplist and fpunstacki are
of interest.
fplist, if true the command list is listed on current output.
fpunstacki, if true  and  an  <input  parameter>  is  found  next  to
<programname>  current  input  is unstacked. Algol running system has
stacked it. Remember to stack current input before program  exit,  if
unstacking has taken place.

After  the  first call of any procedure the variables are initialized
as follows:
fpin        true if <input parameter> is found next to  <programname>
            else false
fpout       true if a left side <ls> was found else false
fpitems     sum  of  <boolean  parameter> and <integer parameter> and
            <real parameter> and <text parameter> and <input  parame-
            ter>.  <ls>,<extension> and <programname> is not counted.
fpinareas   number of <input parameter> found
fpbooleans  number of <boolean parameter> found
fpints      number of <integer parameter> found
fpreals     number of <real parameter> found
fptexts     number of <text parameter> found

<extended parameter> is counted under the first parameter.
fpnr points to the current parameter and is intended for use  by  the
sequential procedures "readifpnext" and "readsfpnext".
\f


                                                                    4


                    Alphabetic list of procedures

boolean     procedure   connectinp
boolean     procedure   connect_ls_o
boolean     procedure   initfp
boolean     procedure   programane
boolean     procedure   readbfp
boolean     procedure   readifp
boolean     procedure   readifpnext
boolean     procedure   readinfp
boolean     procedure   readlsfp
boolean     procedure   readrfp
boolean     procedure   readsfp
boolean     procedure   readsfpnext
boolean     procedure   takefpitem


\f


                                                                    5


                             References


ref. 1.
 H. Rischel and T.A. Aris
 System 3 Utility Programs Part one
 RCSL 31-D364
 Regnecentralen
 Copenhagen 1975

ref. 2.
 H. Dinsen Hansen (Ed.)
 Algol 6, Users Manual
 RCSL 31-D322
 Regnecentralen
 Copenhagen 1974

ref. 3.
 P. Bruun Madsen
 GA4000
 RC4000 Department
 H.C.Ørstedinstituttet
 Copenhagen 1971

ref. 4.
 A. Lindgård
 Read procedure system
 78/05
 Computer Department
 H.C.Ørstedinstituttet
 Copenhagen 1976

ref. 5.
 A.Lindgård
 Code procedure system
 78/06
 Computer Department
 H.C.Ørstedinstituttet
 Copenhagen 1976


\f


                                                                    6


                                                           1978-09-17
                                                      Anders Lindgård




                    boolean procedure connectinp




  Connects  the  current input zone "in" to the filedescriptor speci-
fied by the inp_number of the <input  parameter>.  <input  parameter>
must  be  the  name  of  a  filedescriptor and it must be possible to
connect in to the filedescriptor else  an  alarm  is  given  and  the
procedure  becomes false. When connection has taken place setposition
is used to position the document according to file  count  and  block
count in the filedescriptor.

Call: connectinp(inp_number)
      connectinp      (return  value,  boolean).  true  if the <input
                      parameter> described by inp_number  is  connec-
                      ted, false otherwise.
      inp_number      (call  value,  integer).  The inp_number of the
                      <input parameter>, see the introduction.

                      
                        
  





Language
--------
ALGOL

Maintenance level
-----------------
user
\f


                                                                    7


                                                           1978-09-17
                                                      Anders Lindgård




                   boolean procedure connect_ls_o




  Connects the  current  output  zone  "out"  to  the  filedescriptor
specified  as  a  left side parameter to the program call. If no left
side is specified the procedure becomes false. If the  filedescriptor
does  not  exist a discarea of 150 segments is created. In case of an
error in  the  connection  procedure  an  alarm  is  given,  and  the
procedure  becomes false. When connection has taken place setposition
is used to position the document according to file  count  and  block
count in the filedescriptor.

Call: connectlso
      connectlso      (return  value,  boolean).  true if the program
                      was called with  a  left  side  and  connection
                      could take place, false otherwise.

                      
                        
  





Language
--------
ALGOL

Maintenance level
-----------------
user
\f


                                                                    8


                                                           1978-09-17
                                                      Anders Lindgård




                      boolean procedure initfp




  This  procedure initializes the read fp procedure system. If fplist
is true the command list is listed on  current  output.  However  any
call  of  any  of  the  procedures in this system will initialize the
system.

Call: initfp
      initfp          (return value, boolean). true  if  the  program
                      was  called  with more parameters than <program
                      name>, false otherwise.

                      
                        
  





Language
--------
ALGOL

Maintenance level
-----------------

\f


                                                                    9


                                                           1980-12-20
                                                      Anders Lindgård




                    boolean procedure programname




  The procedure finds the programname of the call. It  will  only  be
different  from  the program file name if the program was called with
more parameters than the program name.

Call: programname(name)
      programname     (return value, boolean). true  if  the  program
                      was  called  with more parameters than <program
                      name>, false otherwise.
      name            (return value, array). Holds the  name  of  the
                      filedescriptor  in  the  program  call provided
                      programname is true.

                      
                        
  





Language
--------
ALGOL

Maintenance level
-----------------
user
\f


                                                                   10


                                                           1978-09-17
                                                      Anders Lindgård




                      boolean procedure readbfp




  Searches the command list for a <boolean parameter>,  where  <text>
matches  the string in the call. If found the boolean variable in the
call is set according to the  value  in  the  command  list  and  the
procedure  becomes  true,  else the boolean variable in the call will
obtain the specified initialvalue.
Only the leftmost matching parameter is used.

Call: readbfp(text,bool_var,initial_val)
      readbfp         (return value, boolean).  true  if  a  matching
                      <boolean parameter> was found, else false.
      text            (call  value,  string).  The  string  which  is
                      matched with <SP><text> in the program call.
      boolvar         (return value, boolean). If a matching <boolean
                      parameter>  was  found  it  becomes true if the
                      <boolean> was yes/ja/true/sand else  false.  If
                      no  matching  <boolean parameter> was found the
                      parameter initial_val is assigned to  bool_var.
      initialval      (call  value, boolean). If no matching <boolean
                      parameter> was found this value is assigned  to
                      bool_var.

                      
                        
  





Language
--------
ALGOL

Maintenance level
-----------------
user
\f


                                                                   11


                                                           1978-09-17
                                                      Anders Lindgård




                      boolean procedure readifp




  Searches  the command list for an <integer parameter>, where <text>
matches the string in the call. If found the integer variable in  the
call  is  set  according  to  the  value  in the command list and the
procedure becomes true, else the integer variable in  the  call  will
obtain the specified initialvalue.
Only the leftmost matching parameter is used.

Call: readifp(text,int_var,initial_val)
      readifp         (return  value,  boolean).  true  if a matching
                      <integer parameter> was found, else false.
      text            (call  value,  string).  The  string  which  is
                      matched with <SP><text> in the program call.
      intvar          (return value, integer). If a matching <integer
                      parameter> was found it obtains  the  value  of
                      <integer>.  If  no matching <integer parameter>
                      was found the parameter initial_val is assigned
                      to int_var.
      initialval      (call value, integer). If no matching  <integer
                      parameter>  was found this value is assigned to
                      int_var.

                      
                        
  





Language
--------
ALGOL

Maintenance level
-----------------
user
\f


                                                                   12


                                                           1978-09-17
                                                      Anders Lindgård




                    boolean procedure readifpnext




  Reads an <extension> of type <integer> to a parameter,  as  pointed
to by specified number.

Call: readifpnext(number,int_val,initial_val)
      readifpnext     (return value, boolean). true if .<integer> was
                      found  at  the  position given by number+1. See
                      ref 1.
      number          (call value, integer). The  number  of  the  fp
                      parameter.
      intval          (return  value,  integer). If the parameter was
                      .<integer> intval will be assigned the  integer
                      else it will be asssigned inittialval.
      initialval      (call value, integer). See above.

                      
  The  recommended  way  of using this procedure is to get hold of an
.<integer> after a call of readbfp, readifp or readsfp. This is  done
using the standard variable fpnr.

Example:

    readifp(<:integer:>,i1,5);
    readifpnext(number,i2,5);
    

After a call of the program as follows:
    program integer.6.9
the two variables i1 and i2 will be 6 and 9 respectively
  





Language
--------
ALGOL

Maintenance level
-----------------
user
\f


                                                                   13


                                                           1978-09-17
                                                      Anders Lindgård




                     boolean procedure readinfp




  The  <input parameter> specified is delivered as a textstring in an
array.

Call: readinfp(input,number)
      readinfp        (return value, boolean). true  if  the  program
                      was  called with at least number <input parame-
                      ter>'s, false otherwise.
      input           (return value, real array). Must be declared at
                      least from 1:2.  Contain  the  text  packed  in
                      element 1 and 2.
      number          (call value, integer). The number of the <input
                      parameter>  as counted from left towards right.
                      
                      
                        
  





Language
--------
ALGOL

Maintenance level
-----------------
user
\f


                                                                   14


                                                           1978-09-17
                                                      Anders Lindgård




                     boolean procedure readlsfp




  Examines the program call for a left side. If  found  the  name  is
delivered by the procedure.

Call: readlsfp(output)
      readlsfp        (return  value,  boolean).  true if the program
                      was called with a left  side  parameter,  false
                      otherwise.
      output          (return value, real array). Must be declared at
                      least  1:2.  Will contain the left side name in
                      element 1 and 2.

                      
                        
  





Language
--------
ALGOL

Maintenance level
-----------------
user
\f


                                                                   15


                                                           1978-09-17
                                                      Anders Lindgård




                       real procedure readrfp




  Searches the command list for  a  <real  parameter>,  where  <text>
matches  the  string  in  the call. If found the real variable in the
call is set according to the  value  in  the  command  list  and  the
procedure  becomes  true,  else  the  real  variable in the call will
obtain the specified initialvalue.
Only the leftmost matching parameter is used.

Call: readrfp(text,real_var,initial_val)
      readrfp         (return value, boolean).  true  if  a  matching
                      <real parameter> was found, else false.
      text            (call  value,  string).  The  string  which  is
                      matched with <SP><text> in the program call.
      realvar         (return  value,  real).  If  a  matching  <real
                      parameter>  was  found  it obtains the value of
                      <real>. If no  matching  <real  parameter>  was
                      found  the parameter initial_val is assigned to
                      real_var.
      initialval      (call value, real). If no matching <real  para-
                      meter>  was  found  this  value  is assigned to
                      real_var.

                      
                        
  





Language
--------
ALGOL

Maintenance level
-----------------
user
\f


                                                                   16


                                                           1978-09-17
                                                      Anders Lindgård




                      boolean procedure readsfp




  Searches the command list for an  <text  parameter>,  where  <text>
matches  the  string  in  the call. If found the text variable in the
call is set according to the  value  in  the  command  list  and  the
procedure  becomes  true,  else  the  text  variable in the call will
obtain the specified initialvalue.
Only the leftmost matching parameter is used.

Call: readsfp(text,text_var,initial_val)
      readsfp         (return value, boolean).  true  if  a  matching
                      <text parameter> was found, else false.
      text            (call  value,  string).  The  string  which  is
                      matched with <SP><text> in the program call.
      textvar         (return value, real array). Must be declared at
                      least  1:2.  If a matching <text parameter> was
                      found it obtains the value  of  <text>.  If  no
                      matching  <text  parameter>  was  found the the
                      string initialval is moved to textvar.
      initialval      (call value,  string).  If  no  matching  <text
                      parameter>  was  found  this  value is moved to
                      text_var.

                      
                        
  





Language
--------
ALGOL

Maintenance level
-----------------
user
\f


                                                                   17


                                                           1978-09-17
                                                      Anders Lindgård




                    boolean procedure readsfpnext




  Reads an <extension> of type <text> to a parameter, as  pointed  to
by specified number.

Call: readsfpnext(number,text_val,initial_val)
      readsfpnext     (return  value,  boolean).  true if .<text> was
                      found at the position given  by  number+1.  See
                      ref 1.
      number          (call  value,  integer).  The  number of the fp
                      parameter.
      textval         (return value, string). If  the  parameter  was
                      .<text>  textval will be assigned the text else
                      it will be asssigned inittialval.
      initialval      (call value, string). See above.

                      
  The recommended way of using this procedure is to get  hold  of  an
.<text>  after  a  call  of readbfp, readifp or readsfp. This is done
using the standard variable fpnr.

Example:

    readifp(<:text:>,A1,<: unknown:>);
    readifpnext(number,A2,<: unknown:>);
    

After a call of the program as follows:
    program text.first.last
the array A1 will contain  the  string  "first"  and  A2  the  string
"last".
  





Language
--------
ALGOL

Maintenance level
-----------------
user
\f


                                                                   18


                                                           1978-09-17
                                                      Anders Lindgård




                    boolean procedure takefpitem




  This  is  the  central  procedure  in  the  system,  which performs
matching of parameters and syntax checks.  It  is  not  intended  for
normal use so no detailed description will be given.

Call: takefpitem(text,type,int,A)
      takefpitem      (return  value,  boolean). true if an item with
                      specified type, and a <text> matching  text  is
                      found, false otherwise.
      type            (call value, integer). The type of the item.
      int             (return  value,  integer).  Used  by the number
                      handling procedures for obtaining .<integer>.
      A               (return value, real array). Used by  the  text-
                      handling procedures for obtaining .<text>.


  
  





Language
--------
ALGOL

Maintenance level
-----------------
user
\f

▶EOF◀