license
15.6.1.1280 DUMP

TOOLS

( addr u -- )

Display the contents of u consecutive addresses starting at addr. The format of the display is implementation dependent.

DUMP may be implemented using pictured numeric output words. Consequently, its use may corrupt the transient region identified by #>.

COLDFORTH It uses the pictured number words but the pictured number words do not corrupt a transient reqion.

 
    : DUMP ( addr n --)
    	SWAP -2 AND  DUP ROT + SWAP DO
    		CR I .h I 10 +  I     
    		DO  
    			I @  .h  four  
    		+LOOP
    	 	four SPACES I 10 + I DO
    			I C@ 7F AND DUP BL <  IF
    				DROP 2E 
    			THEN
    		 	DUP 07F = IF 
    		 		DROP 2E 
    		 	THEN  EMIT
      		LOOP ^C  
      	10 +LOOP 
      	send  
    ;
    
	' DUMP (dump) t!
	 
 
    
	 
6.1.0680 ABORT"

abort-quote CORE

Interpretation: Interpretation semantics for this word are undefined.

Compilation: ( "ccc"" -- )

Parse ccc delimited by a " (double-quote). Append the run-time semantics given below to the current definition.

Run-time: ( i*x x1 -- | i*x ) ( R: j*x -- | j*x )

Remove x1 from the stack. If any bit of x1 is not zero, display ccc and perform an implementation-defined abort sequence that includes the function of ABORT.

 
Typical use: : X ... test ABORT" ccc" ... ; 
 
9.6.2.0680 ABORT"

abort-quote EXCEPTION EXT

Extend the semantics of 6.1.0680 ABORT" to be:

Interpretation: Interpretation semantics for this word are undefined.

Compilation: ( "ccc" -- )

Parse ccc delimited by a " (double-quote). Append the run-time semantics given below to the current definition.

Run-time: ( i*x x1 -- | i*x ) ( R: j*x -- | j*x )

Remove x1 from the stack. If any bit of x1 is not zero, perform the function of -2 THROW, displaying ccc if there is no exception frame on the exception stack.

Notes COLDFORTH

THROW performs an implementation-dependent message if the stackitem is not -2 -1 or zero. In this system it treats the stack item as the address of a counted string. ABORT" will THROW with the address of the counted string.

    
    : ABORT" ( flag--)   
    	COMPILE abort" ," 
    ;  IMMEDIATE 

	 
6.1.0670 ABORT

CORE

( i*x -- ) ( R: j*x -- )

Empty the data stack and perform the function of QUIT, which includes emptying the return stack, without displaying a message.

9.6.2.0670 ABORT

EXCEPTION EXT

Extend the semantics of 6.1.0670 ABORT to be:

( i*x -- ) ( R: j*x -- )

Perform the function of -1 THROW .

 
	: ABORT ( --)
		-1 THROW
	;
	 
 

	
    ??HEX

	 
6.2.2530 [COMPILE]

bracket-compile CORE EXT

Intrepretation: Interpretation semantics for this word are undefined.

Compilation: ( " name" -- )

Skip leading space delimiters. Parse name delimited by a space. Find name. If name has other than default compilation semantics, append them to the current definition; otherwise append the execution semantics of name. An ambiguous condition exists if name is not found.

 
Typical use: : name2 ... [COMPILE] name1 ... ; IMMEDIATE 
 
 
    : [COMPILE] ( --)
    	' COMPILE, 
    ;    IMMEDIATE 
     
6.1.2033 POSTPONE

CORE

Interpretation: Interpretation semantics for this word are undefined.

Compilation: ( " name" -- )

Skip leading space delimiters. Parse name delimited by a space. Find name. Append the compilation semantics of name to the current definition. An ambiguous condition exists if name is not found.

Typical use:

 
: ENDIF  POSTPONE THEN ;  IMMEDIATE

: X  ... IF ... ENDIF ... ;
  

POSTPONE replaces most of the functionality of COMPILE and [COMPILE]. COMPILE and [COMPILE] are used for the same purpose: postpone the compilation behavior of the next word in the parse area. COMPILE was designed to be applied to non-immediate words and [COMPILE] to immediate words. This burdens the programmer with needing to know which words in a system are immediate. Consequently, Forth standards have had to specify the immediacy or non-immediacy of all words covered by the Standard. This unnecessarily constrains implementors.

A second problem with COMPILE is that some programmers have come to expect and exploit a particular implementation, namely:

 
:  COMPILE  R>  DUP  @  ,  CELL+  >R  ;
 

This implementation will not work on native code Forth systems. In a native code Forth using inline code expansion and peephole optimization, the size of the object code produced varies; this information is difficult to communicate to a dumb COMPILE. A smart (i.e., immediate) COMPILE would not have this problem, but this was forbidden in previous standards.

For these reasons, COMPILE has not been included in the Standard and [COMPILE] has been moved in favor of POSTPONE. Additional discussion can be found in Hayes, J.R., Postpone, Proceedings of the 1989 Rochester Forth Conference.

 
	: POSTPONE
		_defined              \ false|xt true (-- 
		DUP 0= ?token            \ abort if word not there
		0< IF                \ not IMMEDIATE 
		    ['] _do_compile COMPILE, , 
		ELSE
			COMPILE,
		THEN 
	; IMMEDIATE
	 
6.2.0200 .(

dot-paren CORE EXT

Compilation: Perform the execution semantics given below.

Execution: ( "ccc)" -- )

Parse and display ccc delimited by ) (right parenthesis). .( is an immediate word.

 
Typical use: .( ccc) 
 
 
    : .(	( --)   
    	[CHAR] ) (word) TYPE 
    ;   IMMEDIATE
    
    
    
    	
	 
6.1.2520 [CHAR]

CORE

Interpretation: Interpretation semantics for this word are undefined.

Compilation: ( " < spaces > name" -- )

Skip leading space delimiters. Parse name delimited by a space. Append the run-time semantics given below to the current definition.

Run-time: ( -- char )

Place char, the value of the first character of name, on the stack.

 
Typical use: : X ... [CHAR] ccc ... ; 
 
 
    : [CHAR] ( --char) 
		BL (word) DROP C@ 
		[COMPILE] LITERAL  
    ;  IMMEDIATE 
    
    ( create options) HEX
    : (CREATE) ( --)
		ALIGN                      \ Move to word boundry 
		BL WORD
		DUP COUNT NIP _#name_count_bits > ABORT" Word name too large" 
		DUP COUNT current @ hash   \ $ head<-)
		DUP last !                 \ $ head (-- 

		\ name string
	  	SWAP                   \ head $(--
		COUNT                  \ head addr n (--
		TUCK                   \ head n addr n (--
		DUP #$count_length  +   \ head n addr n total$(--
		DUP ALIGNED ALLOT        \ head n addr n total$(--
		HERE SWAP -            \ head n addr n to<-
		SWAP                   \ head n from to n (--
		MOVE                   \ head n (--
		HERE #$count_length  - $count!   \ 
		
		\ fix link
		DUP @ ,
		HERE cell- SWAP !      \ (--
		
		\ hash value
		%name_hash @ ,                ( hash value)
		
		\ cfa
		4EB9 W,    \ AB L. JMP                
		zero ,
		init_assembler
		['] _do_create xt>cfa use ;
    
    
    : ?CREATE ( --)   
		>IN @ _defined IF
			DROP
			\ >in(--
			CR                      \ send current data and CR
			DUP >IN ! BL (word) TYPE 
			."  Redefined " send  
		THEN                        \ xt|addr(-- 
		>IN !  
		(CREATE) 
	;
    
	\ used to set 'create in the abort word
    ' ?CREATE (create) t!