Add new attachment

Only authorized users are allowed to upload new attachments.

This page (revision-5) was last changed on 08-Aug-2010 11:26 by Carsten Strotmann  

This page was created on 08-Aug-2010 10:30 by Carsten Strotmann

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Difference between version and

At line 120 added 59 lines
Figure 6
{{{
: ?OUT ( c -- ) 127 AND
CASE 0= 13 ( return ) 0O
OF ?NEW-LINE EXIT THEN
CASE 10 ( linefeed ) = 12 ( formfeed ) = OR
OF #BLANK-LINES @ 0=
IF ?NEW-LINE THEN
EXIT THEN
0 #BLANK-LINES !
CASE 32 < OF ( do nothing ) EXIT THEN
EXIT ;
}}}
Figure 7
{{{
( #YEAR is a variable holding the year )
:LEAPYEAR? ( -- tf : true if the year is a leap year )
#YEAR @
CASE 400 MOD 0= OF TRUE EXIT THEN
CASE 100 MOD 0= OF FALSE EXIT THEN
CASE 4 MOD 0= OF TRUE EXIT THEN
DROP FALSE ;
: DAYS ( month# -- days-in-month )
CASE 9 = 4 =OR 6 =OR 1 =OR OF 30 EXIT THEN
CASE 2 = NOT OF 31 EXIT THEN
DROP LEAPYEAR? IF 29 ELSE 28 THEN ;
}}}
Figure 8
{{{
: CBASE! ( a c -- a' )
CASE ASCII $ = OF HEX 1+ EXIT THEN
CASE ASCII @ = OF OCTAL 1+ EXIT THEN
CASE ASCII % = OF BINARY 1+ EXIT THEN
CASE ASCII & = OF DECIMAL 1+ EXIT THEN
DROP ;
: BASE-NUMBER ( a -- d )
BASE @ >R DUP 1+ C@ CBASE!
NUMBER? R> BASE ! 0= ABORT" ?" ;
}}}
Figure 9
{{{
HEX
: CLASSIFY ( n -- )
CASE 20 < 7F =OR OF ." Control character" EXIT THEN
CASE 20 2f BETWEEN
OVER 3A 40 BETWEEN OR
OVER 5B 60 BETWEEN OR
OVER 7B 7E BETWEEN OR OF ." Punctuation" EXIT THEN
CASE 30 39 BETWEEN OF ." Digit" EXIT THEN
CASE 41 5A BETWEEN OF ." Upper case letter" EXIT THEN
CASE 61 7A BETWEEN OF ." Lower case letter" EXIT THEN
DROP ." Not a character" ;
}}}
At line 181 added 15 lines
Figure 10a
{{{
CREATE CASE ' DUP ( CFA ) @ ' CASE (CFA ) !
}}}
Figure 10b
{{{
: =OR ( n tf n -- n tf ) 3 PICK = OR ;
}}}
Figure 10c
{{{
: =OR ( n tf n -- n tf ) >R OVER R> = OR ;
}}}
At line 205 added 23 lines
Figure 11a
{{{
: WITHIN ( n n1 n2 -- tf : true when n1 <= n & n < n2 )
over - >R - R> U< ;
:BETWEEN ( n n1 n2 -- tf : true when n1 <= n & n <= n2 )
WITHIN 1+ ;
: ASCII ( ^ c -- c : integer value for character c )
BL WORD COUNT 1- ABORT" ?" C@ STATE @
IF [COMPILE] LITERAL THEN ; IMMEDIATE
}}}
Figure 11b
{{{
: HEX ( -- ) 16 BASE ! ;
: OCTAL ( -- ) 8 BASE ! ;
: BINARY ( -- ) 2 BASE ! ;
: DECIMAL ( -- ) 10 BASE ! ;
: NUMBER? ( addr -- dn tf ) 0 0 ROT CONVERT C@ BL = ;
}}}
Version Date Modified Size Author Changes ... Change note
5 08-Aug-2010 11:26 9.406 kB Carsten Strotmann to previous
4 08-Aug-2010 11:02 7.089 kB Carsten Strotmann to previous | to last
3 08-Aug-2010 10:46 5.883 kB Carsten Strotmann to previous | to last
2 08-Aug-2010 10:34 2.953 kB Carsten Strotmann to previous | to last
1 08-Aug-2010 10:30 2.667 kB Carsten Strotmann to last
« This page (revision-5) was last changed on 08-Aug-2010 11:26 by Carsten Strotmann  
G’day (anonymous guest) My Prefs
© 2010-2017 AtariWiki
All content in the Wiki is licensed under Creative Commons Share Alike License, unless otherwise noted.
JSPWiki v2.8.3