1: #include <stdio.h>
   2: #include "def.h"
   3: 
   4: struct list *consls(v,ls)       /* make list */
   5: VERT v;
   6: struct list *ls;
   7:     {
   8:     struct list *temp;
   9:     temp = challoc(sizeof(*temp));
  10:     temp->elt = v;
  11:     temp->nxtlist = ls;
  12:     return(temp);
  13:     }
  14: 
  15: struct list *append(v,ls)       /* return ls . v */
  16: VERT v;
  17: struct list *ls;
  18:     {
  19:     struct list *temp;
  20:     if (!ls) return(consls(v,0));
  21:     for (temp = ls; temp -> nxtlist; temp = temp->nxtlist)
  22:         ;
  23:     temp->nxtlist = consls(v,0);
  24:     return(ls);
  25:     }
  26: 
  27: 
  28: freelst(ls)
  29: struct list *ls;
  30:     {
  31:     if (!ls) return;
  32:     if (ls->nxtlist)
  33:         freelst(ls->nxtlist);
  34:     chfree(ls,sizeof(*ls));
  35:     }
  36: 
  37: 
  38: oneelt(ls)      /* return w if w is only elt of ls, UNDEFINED otherwise */
  39: struct list *ls;
  40:     {
  41:     if (!ls) return(UNDEFINED);
  42:     if (ls->nxtlist) return(UNDEFINED);
  43:     return(ls->elt);
  44:     }
  45: 
  46: 
  47: lslen(ls)       /* return number of elements in list ls */
  48: struct list *ls;
  49:     {
  50:     int count;
  51:     struct list *lp;
  52:     count = 0;
  53:     for (lp = ls; lp; lp = lp->nxtlist)
  54:         ++count;
  55:     return(count);
  56:     }
  57: 
  58: 
  59: prlst(ls)
  60: struct list *ls;
  61:     {
  62:     struct list *lp;
  63:     for (lp = ls; lp; lp = lp->nxtlist)
  64:         fprintf(stderr,"%d,",lp->elt);
  65:     fprintf(stderr,"\n");
  66:     }

Defined functions

append defined in line 15; used 3 times
consls defined in line 4; used 3 times
freelst defined in line 28; used 4 times
lslen defined in line 47; used 1 times
oneelt defined in line 38; used 1 times
prlst defined in line 59; never used
Last modified: 1981-07-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 738
Valid CSS Valid XHTML 1.0 Strict