Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / openbios / forth / lib / lists.fs
1 \ tag: misc useful functions
2
3 \ Misc useful functions
4
5 \ Copyright (C) 2003 Samuel Rydh
6
7 \ See the file "COPYING" for further information about
8 \ the copyright and warranty status of this work.
9
10
11 \ -------------------------------------------------------------------------
12 \ statically allocated lists
13 \ -------------------------------------------------------------------------
14 \ list-head should be a variable
15
16 : list-add ( listhead -- )
17   here 0 , swap                  \ next, [data...]
18   ( here listhead )
19   begin dup @ while @ repeat !
20 ;
21
22 : list-get ( listptr -- nextlistptr dictptr true | false )
23   @ dup if
24     dup na1+ true
25   then
26 ;