File: control.fs

package info (click to toggle)
gforth 0.7.0%2Bds2-0.1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 5,808 kB
  • sloc: ansic: 8,506; sh: 3,660; lisp: 1,783; makefile: 993; yacc: 186; sed: 141; lex: 102; awk: 21
file content (22 lines) | stat: -rw-r--r-- 652 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
\ control-structure add-ons (ENDIF, ?DUP-IF etc.)

\ This file is in the public domain. NO WARRANTY.

\ Hmm, this would be a good application for ]] ... [[

\ The program uses the following words
\ from CORE :
\ : POSTPONE THEN ; immediate ?dup IF 0= 
\ from BLOCK-EXT :
\ \ 
\ from FILE :
\ ( 

: ENDIF ( compilation orig -- ; run-time -- ) \ gforth
    POSTPONE then ; immediate

: ?DUP-IF ( compilation -- orig ; run-time n -- n| ) \ gforth	question-dupe-if
    POSTPONE ?dup POSTPONE if ; immediate

: ?DUP-0=-IF ( compilation -- orig ; run-time n -- n| ) \ gforth	question-dupe-zero-equals-if
    POSTPONE ?dup POSTPONE 0= POSTPONE if ; immediate