Annotation of gforth/chains.fs, revision 1.7

1.1       jwilke      1: \ chains.fs execution chains for gforth                        21jun97jaw
                      2: 
1.6       anton       3: \ Copyright (C) 1998,2000,2003 Free Software Foundation, Inc.
1.3       anton       4: 
                      5: \ This file is part of Gforth.
                      6: 
                      7: \ Gforth is free software; you can redistribute it and/or
                      8: \ modify it under the terms of the GNU General Public License
1.7     ! anton       9: \ as published by the Free Software Foundation, either version 3
1.3       anton      10: \ of the License, or (at your option) any later version.
                     11: 
                     12: \ This program is distributed in the hope that it will be useful,
                     13: \ but WITHOUT ANY WARRANTY; without even the implied warranty of
                     14: \ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     15: \ GNU General Public License for more details.
                     16: 
                     17: \ You should have received a copy of the GNU General Public License
1.7     ! anton      18: \ along with this program. If not, see http://www.gnu.org/licenses/.
1.3       anton      19: 
1.1       jwilke     20: 0 [IF]
                     21: This defines execution chains.
                     22: The first application for this is building initialization chains:
                     23: Think of many modules or program parts, each of it with some specific
                     24: initialization code. If we hardcode the initialization routines into a
                     25: "master-init" we will get unflexible and are not able only to load some
                     26: specific modules...
                     27: 
                     28: The chain is basicaly a linked-list. Define a Variable for the head of
                     29: linked-list. Name it "foo8" or "foo-chain" to indicate it is a execution
                     30: chain.
                     31: 
                     32: You can add a word to the list with "' my-init foo8 chained". You can
                     33: execute all the code with "foo8 chainperform".
                     34: [THEN]
                     35: 
1.2       pazsan     36: has? cross 
                     37: [IF]   e? compiler
                     38: [ELSE] true
                     39: [THEN]
                     40: 
                     41: [IF] \ only needed with compiler
                     42: 
1.1       jwilke     43: [IFUNDEF] linked
                     44: : linked        here over @ a, swap ! ;
                     45: [THEN]
                     46: 
                     47: \ generic chains
                     48: 
                     49: : chained      ( xt list -- ) \ gforth
                     50:   linked , ;
1.2       pazsan     51: 
                     52: [THEN]
1.1       jwilke     53: 
                     54: : chainperform ( list -- ) \ gforth
                     55:   BEGIN @ dup WHILE dup cell+ perform REPEAT drop ;
                     56: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>