Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: e1580c9736
Fetching contributors…

Cannot retrieve contributors at this time

34 lines (28 sloc) 1.465 kB
\ FourK - Concatenative, stack based, Forth like language optimised for
\ non-interactive 4KB size demoscene presentations.
\ Copyright (C) 2009, 2010 Wojciech Meyer, Josef P. Bernhart
\ This program is free software: you can redistribute it and/or modify
\ it under the terms of the GNU General Public License as published by
\ the Free Software Foundation, either version 3 of the License, or
\ (at your option) any later version.
\ This program is distributed in the hope that it will be useful,
\ but WITHOUT ANY WARRANTY; without even the implied warranty of
\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\ GNU General Public License for more details.
\ You should have received a copy of the GNU General Public License
\ along with this program. If not, see <http://www.gnu.org/licenses/>.
forget mark
variable pad
0 pad !
variable pad-frac
0 pad-frac
: d. dup 10 < if . else 10 - c: A + emit then ;
: . dup 0= if drop 0 . ;; else -1 >r begin dup 0 <> while dup base @ % >r base @ / repeat drop begin r> dup -1 <> while d. repeat drop ;
: r1+ postpone r> postpone 1+ postpone >r ; immediate
: n[ -1 -1 ;
: %n dup -1 <> if pad ! dup -1 <> if pad-frac ! else drop then else drop then ;
: .n dup dup 0= if 1 ;; then 0 >r begin dup 0 <> while base @ / r> 1 + >r repeat drop r>
pad @ swap - dup 0 > if 1 do 0 . loop else drop then . ;
: %x b16 base! %n ;
: %d b10 base! %n ;
: ]n begin dup -1 = while drop repeat switch-base ;
Jump to Line
Something went wrong with that request. Please try again.