home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
EFFO
/
pd6.lzh
/
LIB
/
TILE
/
blocks.f83
< prev
next >
Wrap
Text File
|
1989-12-22
|
2KB
|
69 lines
\
\ CODE BLOCK DEFINITIONS
\
\ Copyright (c) 1989 by Mikael R.K. Patel
\
\ Computer Aided Design Laboratory (CADLAB)
\ Department of Computer and Information Science
\ Linkoping University
\ S-581 83 LINKOPING
\ SWEDEN
\
\ Email: mip@ida.liu.se
\
\ Started on: 30 June 1988
\
\ Last updated on: 29 November 1989
\
\ Dependencies:
\ (forth) compiler
\
\ Description:
\ Code blocks as an alternative to passing functions as parameters.
\
\ Copying:
\ This program is free software; you can redistribute it and\or modify
\ it under the terms of the GNU General Public License as published by
\ the Free Software Foundation; either version 1, or (at your option)
\ any later version.
\
\ This program is distributed in the hope that it will be useful,
\ but WITHOUT ANY WARRANTY; without even the implied warranty of
\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\ GNU General Public License for more details.
\
\ You should have received a copy of the GNU General Public License
\ along with this program; see the file COPYING. If not, write to
\ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
.( Loading Block definitions...) cr
vocabulary blocks
compiler blocks definitions
16 field +block ( addr1 -- addr2 )
: block[ ( -- )
compiling ( Check interpreter state)
if here +block [compile] literal ( If compiling then create literal)
compile (branch) >mark ( to code section and branch over)
true ( Mark code compilation state)
else
here ( Return pointer to code section)
false ( Mark non-code compilation state)
] ( Start compiling code for block)
then ; immediate
: ]; ( -- block)
[compile] ; ( Compile what semicolon does)
if >resolve ( If within code resolve branch)
] ( And Continue compiling)
then ; immediate
: call ( block -- )
>r ; ( Perform the block definition)
forth only