Previous: uttik Up: ../plot79_u.html Next: uttsin


UTTS00

       INTEGER FUNCTION  UTTS00 (MAXKEY,NDAVRG)
 C$    (Symbol Table - Initialization)
 C$    Allocate and  initialize space  for  a symbol  table  large
 C$    enough to  hold  MAXKEY variables,  each  of which  has  on
 C$    average NDAVRG  double precision  value entries.   Routines
 C$    UTTSIN and UTTSLN may  be used later  to install or  lookup
 C$    entries in the table.
 C$
 C$    The function value returned is the number of keys for which
 C$    space is actually available (this may differ from  MAXKEY),
 C$    or 0 if space is insufficient.
 C$
 C$    Space is  allocated  dynamically  using  the  PORT  Library
 C$    Framework support routines.  The default PORT space of  500
 C$    doublewords  can  be  increased  by  enlarging  the  common
 C$    area by a declaration of the form
 C$    
 C$    COMMON /CSTAK/ DSTAK(nnn)
 C$
 C$    and informing PORT of this by a statement
 C$    
 C$    CALL ISTKIN (nnn,4)
 C$
 C$    The allocation  requires a  constant  block followed  by  4
 C$    vectors of length NKEY and then by the symbol table  string
 C$    area.  SMTOFF in COMMON / UTTS01 / is the index of the word
 C$    in ISTAK(*) in  COMMON /  CSTAK /  preceding the  allocated
 C$    block.
 C$
 C$    Because  dynamic  allocation  carries  with  it  a  storage
 C$    penalty of  2 words  for  each block,  it is  desirable  to
 C$    allocate  value  storage   from  somewhat  larger   blocks.
 C$    Therefore, when a new symbol is to be installed by  UTTSIN,
 C$    if insufficient space  is available for  its values, a  new
 C$    block is allocated and the  remaining space in the  current
 C$    block is  returned to  the system  if it  is the  last  one
 C$    allocated (the usual case) or is lost (which may happen  if
 C$    the caller is also using the stack package).
 C$
 C$    The first  15 words  contain index  and length  information
 C$    enabling  the  storage  to  be  accessed  and  managed,  as
 C$    follows.
 C$
 C$     1: OPKEY  -- offset of name pointer vector
 C$     2: OLKEY  -- offset of name length vector
 C$     3: OTKEY  -- offset of type and count vector
 C$     4: ODKEY  -- offset of data value index vector
 C$     5: OSKEY  -- offset of string area
 C$     6: MAXKEY -- number of keys available in vectors
 C$     7: MAXSTR -- number of characters available in string area
 C$     8: NKEY   -- number of keys in use
 C$     9: NSTR   -- number of characters in use
 C$    10: NDNEXT -- index of next available location in current
 C$                  data block in DSTAK(*).
 C$    11: NDLEFT -- number of locations left in current data
 C$                  block.
 C$    12: BLKSIZ -- number of locations acquired in last data block.
 C$    13: SIZE   -- number of locations acquired for symbol
 C$                  table. 
 C$    14: NCHRPW -- number of characters per INTEGER word.
 C$    15: NALLOC -- number of allocation of last data block (used
 C$                  to determined whether space can be  recovered
 C$                  when a new block is needed).
 C$
 C$    (27-APR-83)