Sujet : Re: Parsing timestamps?
De : oh2aun (at) *nospam* gmail.com (FFmike)
Groupes : comp.lang.forthDate : 07. Oct 2024, 04:29:34
Autres entêtes
Organisation : novaBBS
Message-ID : <9531b46a687bdbe61cbe032e0135571f@www.novabbs.com>
References : 1 2 3 4
User-Agent : Rocksolid Light
On Mon, 7 Oct 2024 2:10:56 +0000, dxf wrote:
The problem is handling the partial forms.
>
s" 6:0:0" /t
s" 6:0" /t
s" 6" /t
Not a problem on my system.
s" 12" /t . . . 0 0 12 ok<$,ram>
s" 12:13" /t . . . 0 13 12 ok<$,ram>
s" 12:13:0" /t . . . 0 13 12 ok<$,ram>
I made up EXECUTE-PARSING so now it looks like this.
: execute-parsing ( c-addr u xt -- )
'source 2@ >r >r >in @ >r
>r pad place pad c@+ 'source 2! 0 >in !
r> execute
r> >in ! r> r> 'source 2!
;
: (/t) ( addr len -- hrs mins secs)
3 for
[char] : word number?
dup 1 = if
drop
else
2 = if drop else drop 0 then
then
next
;
: /t ( addr len -- hrs mins secs )
['] (/t) execute-parsing
;