File: MiscFeaturesCopy.fth

package info (click to toggle)
fcode-utils 1.0.2-7
  • links: PTS
  • area: main
  • in suites: buster, stretch
  • size: 46,976 kB
  • ctags: 1,402
  • sloc: ansic: 9,705; csh: 241; makefile: 106; sh: 17
file content (65 lines) | stat: -rw-r--r-- 905 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
\  Obvious pun intended...
\   Updated Tue, 19 Apr 2005 at 17:28 by David L. Paktor

fcode-version2

headers

char G emit
control G emit
control [ emit
: bell
    [char] G dup
    control G 3drop
;

: factl recursive  ( n -- n! )
    ?dup 0= if 1
    else  dup 1- * factl
    then
;

: factl ( n -- n! )
    ?dup 0= if 1 factl
    else  dup 1- recurse *
    then
;

variable naught
defer  do-nothing
20 value twenty
30 value thirty
40 buffer: forty
50 constant fifty
create three 0 , 00 , h# 000 ,
struct
4 field >four
constant /four

: peril
    ['] noop is  do-nothing
    100 is thirty
    5 is naught
;

: thirty ( new-val -- )
    dup to thirty
	alias .dec .d		\  Should this be allowed?
    ." Dirty"  .dec
;

: droop ( -- )
    twenty
    tokenizer[
	alias .x .h		\  Should this generate a warning?
    ]tokenizer
    0 ?do i .x loop
;
: ploop ( -- )
    fifty  0 do i drop 2 +loop
;

fcode-end