Annotation of gforth/chains.fs, revision 1.5

1.1       jwilke      1: \ chains.fs execution chains for gforth                        21jun97jaw
                      2: 
1.5     ! anton       3: \ Copyright (C) 1998,2000 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
                      9: \ as published by the Free Software Foundation; either version 2
                     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
                     18: \ along with this program; if not, write to the Free Software
1.4       anton      19: \ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
1.3       anton      20: 
1.1       jwilke     21: 0 [IF]
                     22: This defines execution chains.
                     23: The first application for this is building initialization chains:
                     24: Think of many modules or program parts, each of it with some specific
                     25: initialization code. If we hardcode the initialization routines into a
                     26: "master-init" we will get unflexible and are not able only to load some
                     27: specific modules...
                     28: 
                     29: The chain is basicaly a linked-list. Define a Variable for the head of
                     30: linked-list. Name it "foo8" or "foo-chain" to indicate it is a execution
                     31: chain.
                     32: 
                     33: You can add a word to the list with "' my-init foo8 chained". You can
                     34: execute all the code with "foo8 chainperform".
                     35: [THEN]
                     36: 
1.2       pazsan     37: has? cross 
                     38: [IF]   e? compiler
                     39: [ELSE] true
                     40: [THEN]
                     41: 
                     42: [IF] \ only needed with compiler
                     43: 
1.1       jwilke     44: [IFUNDEF] linked
                     45: : linked        here over @ a, swap ! ;
                     46: [THEN]
                     47: 
                     48: \ generic chains
                     49: 
                     50: : chained      ( xt list -- ) \ gforth
                     51:   linked , ;
1.2       pazsan     52: 
                     53: [THEN]
1.1       jwilke     54: 
                     55: : chainperform ( list -- ) \ gforth
                     56:   BEGIN @ dup WHILE dup cell+ perform REPEAT drop ;
                     57: 

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