home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 19 / AACD19.BIN / AACD / Programming / YAEC / examples / nodelist.e < prev    next >
Encoding:
Text File  |  2001-02-23  |  534 b   |  35 lines

  1.  
  2. -> example of using the external linklib nodelist.o
  3.  
  4. EXTERN 'other/nodelist'
  5.  
  6. OBJECT node
  7.    next:PTR TO node
  8.    prev:PTR TO node
  9.    id:LONG
  10. ENDOBJECT
  11.  
  12. OBJECT list OF node
  13.    first:PTR TO node
  14.    last:PTR TO node
  15. ENDOBJECT
  16.  
  17. DEF l:list
  18.  
  19. PROC main()
  20.    DEF n:PTR TO node, a:LONG
  21.    FOR a := 10 TO 0 STEP -1
  22.       NEW n
  23.       n.id := a
  24.       AddOrd(l, n)
  25.    ENDFOR
  26.    Traverse(l, {bla})
  27. ENDPROC
  28.  
  29. PROC bla()
  30.    /* yaec evaluates args in reverse oreder so its okey to use A0 like we do */
  31.    PrintF('node.id=\d\n', A0::node.id)
  32. ENDPROC
  33.  
  34.  
  35.