1: #include "../h/rt.h"
   2: 
   3: /*
   4:  * [ ... ] - create an explicitly specified list.
   5:  */
   6: 
   7: llist(nargs)
   8: int nargs;
   9:    {
  10:    register int i;
  11:    register struct b_list *hp;
  12:    register struct b_lelem *bp;
  13:    extern struct b_list *alclist();
  14:    extern struct b_lelem *alclstb();
  15:    int nelem;
  16: 
  17:    SetBound;
  18: 
  19:    /*
  20:     * Round the number of elements in the list (as indicated by nargs)
  21:     *  up to LISTBLKSIZE and ensure space for the list.
  22:     */
  23:    nelem = nargs;
  24:    if (nelem < LISTBLKSIZE)
  25:       nelem = LISTBLKSIZE;
  26:    hneed(sizeof(struct b_list) + sizeof(struct b_lelem) +
  27:          nelem * sizeof(struct descrip));
  28: 
  29:    /*
  30:     * Allocate the list and a list block.
  31:     */
  32:    hp = alclist(nargs);
  33:    bp = alclstb(nelem, 0, nargs);
  34: 
  35:    /*
  36:     * Make the list block just allocated into the first and last blocks
  37:     *  for the list.
  38:     */
  39:    hp->listhead.type = hp->listtail.type = D_LELEM;
  40:    BLKLOC(hp->listhead) = BLKLOC(hp->listtail) = (union block *) bp;
  41:    /*
  42:     * Dereference each argument in turn and assign it to a list element.
  43:     */
  44:    for (i = 1; i <= nargs; i++) {
  45:       DeRef(ARG(i))
  46:       bp->lslots[i-1] = ARG(i);
  47:       }
  48:    /*
  49:     * Point arg0 at the new list and return it.
  50:     */
  51:    ARGTYPE(0) = D_LIST;
  52:    ARGVAL(0) = (int) hp;
  53:    ClearBound;
  54:    }

Defined functions

llist defined in line 7; never used
Last modified: 1984-11-18
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 888
Valid CSS Valid XHTML 1.0 Strict