Permalink
Browse files

Rename rcell to cell (4 bytes len) to be a bit more standard.

  • Loading branch information...
danmey committed Jun 9, 2011
1 parent 3462ad5 commit 81e821c8e9b8147c4146eb985e2d32e87d817cd9
View
@@ -53,13 +53,13 @@ token : (:) token (:) ;
: rliteral 4 c, , ;
: sliteral swap rliteral literal ;
: allot there @ + there ! ;
-: rcell 4 ;
-: rcells rcell * ;
-: rcells+ rcells + ;
+: cell 4 ;
+: cells cell * ;
+: cells+ cells + ;
: (create) make there @ rliteral postpone ; ;
: create token (create) ;
-: variable : there @ rliteral postpone ; rcell allot ;
+: variable : there @ rliteral postpone ; cell allot ;
: const : rliteral postpone ; ;
: bconst : literal postpone ; ;
@@ -113,7 +113,7 @@ variable #section
| please note this changes MUST BE HERE! (for some reason i forgot hehehe)
| : (create) make there @ rliteral postpone ; ;
| : create token (create) ;
-| : variable : there @ rliteral postpone ; rcell allot ;
+| : variable : there @ rliteral postpone ; cell allot ;
| : const : rliteral postpone ; ;
@@ -305,8 +305,8 @@ variable #ithere
| ." index: " #ithere @ 2 / . cr
| over 0 = if ." ERROR: handle is 0" cr 2drop ;; then over ." handle: " . cr
- ithere @ 1 #ithere @ + rcells+ !
- ithere @ #ithere @ rcells+ !
+ ithere @ 1 #ithere @ + cells+ !
+ ithere @ #ithere @ cells+ !
#ithere @ 2 + #ithere !
;
View
@@ -18,7 +18,7 @@
include" src/imports.4k"
lib: libc.so
-rcell func: printf
+cell func: printf
: main
load-functions
View
@@ -29,10 +29,10 @@ mark
: test create data: 1 , data; does> @ . ;
test a
-| : rcell+ rcell + ;
-| : class create 1 rcells allot does> @ ;
+| : cell+ cell + ;
+| : class create 1 cells allot does> @ ;
| variable current-class
-| : method dup const rcell+ ;
-| : last-token last @ rcells 2 * vtab @ ;
+| : method dup const cell+ ;
+| : last-token last @ cells 2 * vtab @ ;
| : implements token execute current-class @ + last @ swap ! ;
save-image im.4ki
View
@@ -38,7 +38,7 @@ mark
| load our symbols from dll
| Must be in the same order as above
: libSDL " /usr/lib/libSDL.so" lib ;
-: function >r sym r> rcells add-handle ;
+: function >r sym r> cells add-handle ;
: load-symbols ( -- )
" libc.so" lib " _exit" 1 function
libSDL " SDL_SetVideoMode" 4 function
@@ -64,11 +64,11 @@ variable screen
| allot needed stuff for SDL
create event 20 bytes allot
| and for pallete
-create pallete 256 rcells allot
+create pallete 256 cells allot
| get the linear offset
: points point * ;
| put the pixel in right place with pallete colour
-: pixel ( col x y -- ) width * + points screen @ s>pixels + swap rcells pallete + @ swap ! ;
+: pixel ( col x y -- ) width * + points screen @ s>pixels + swap cells pallete + @ swap ! ;
| set the video mode
: video 0 bpp height width SDL_SetVideoMode ;
| alias for convenience
@@ -122,7 +122,7 @@ height 2 / i>f fconst h/2
;
3.1415 fconst pi
: col> ( i f:fac -- f:c ) i>>f pi f* f* sin ;
-: col! ( c i -- ) rcells pallete + + f> f>i swap c! ;
+: col! ( c i -- ) cells pallete + + f> f>i swap c! ;
: color ( i f ) dup >r col> r> col! ;
| init our pallete
: init-pallete
View
@@ -33,17 +33,17 @@ create event 20 bytes allot
: sdl-init ( -- )
" libc.so" lib " _exit" sym
- rcell add-handle
+ cell add-handle
" libc.so" lib " printf" sym
- 1 rcells add-handle
+ 1 cells add-handle
" libdl.so" lib " dlerror" sym
- 0 rcells add-handle
+ 0 cells add-handle
" /usr/lib/libSDL.so" lib " SDL_SetVideoMode" sym
- 4 rcells add-handle
- " /usr/lib/libSDL.so" lib " SDL_PollEvent" sym 1 rcells add-handle
+ 4 cells add-handle
+ " /usr/lib/libSDL.so" lib " SDL_PollEvent" sym 1 cells add-handle
;
: render-loop
View
@@ -185,9 +185,9 @@ require" demos/robots/camera.4k"
>r >r >r >r >r >r
GL_MODELVIEW glMatrixMode drop
glLoadIdentity drop
- up-vec 2 rcells + @ f>d
- up-vec 1 rcells + @ f>d
- up-vec 0 rcells + @ f>d
+ up-vec 2 cells + @ f>d
+ up-vec 1 cells + @ f>d
+ up-vec 0 cells + @ f>d
r> f>d r> f>d r> f>d
| T fsincos 6 i>>f f* f> f>d 0 f>d 6 i>>f f* f> f>d gluLookAt drop
r> f>d r> f>d r> f>d gluLookAt drop
@@ -308,9 +308,9 @@ variable board-rot
: FaderOut 100 -15 Linear f>i dup 0 >= if Fade then ;
: Up
3>f
- up-vec 2 rcells + !
- up-vec 1 rcells + !
- up-vec 0 rcells + !
+ up-vec 2 cells + !
+ up-vec 1 cells + !
+ up-vec 0 cells + !
;
: UpCamera
View
@@ -45,7 +45,7 @@ include" demos/robots/imph.4k"
| this for making happy my ans-loving Emacs mode ;) ( but I really like the | for a comment )
: \ postpone | ; immediate
-: hdl ( lib bytes -- ) >r sym r> rcells add-handle ;
+: hdl ( lib bytes -- ) >r sym r> cells add-handle ;
: imports ( -- )
libc " _exit" 1 hdl
libGL " glClear" 1 hdl
@@ -126,7 +126,7 @@ variable screen
\ allot needed stuff for SDL
create event 20 bytes allot
\ and for pallete
-create pallete 256 rcells allot
+create pallete 256 cells allot
\ set the video mode
: video SDL_OPENGL (* SDL_FULLSCREEN or *) bpp height width SDL_SetVideoMode ;
View
@@ -72,11 +72,11 @@ variable temp
: >/dev/dsp ( ctl val -- ) temp ! temp swap audio @ ioctl drop ;
: init-synth
- " libc.so" lib " malloc" sym rcell add-handle
- " libc.so" lib " printf" sym 2 rcells add-handle
- " libc.so" lib " open" sym 3 rcells add-handle
- " libc.so" lib " ioctl" sym 3 rcells add-handle
- " libc.so" lib " write" sym 3 rcells add-handle
+ " libc.so" lib " malloc" sym cell add-handle
+ " libc.so" lib " printf" sym 2 cells add-handle
+ " libc.so" lib " open" sym 3 cells add-handle
+ " libc.so" lib " ioctl" sym 3 cells add-handle
+ " libc.so" lib " write" sym 3 cells add-handle
#samples samples malloc buffer !
#samples 0
@@ -90,17 +90,17 @@ variable temp
SNDCTL_DSP_SPEED 11024 >/dev/dsp
;
: init ( -- )
- " libc.so" lib " _exit" sym rcell add-handle
+ " libc.so" lib " _exit" sym cell add-handle
- " /usr/lib/libSDL.so" lib " SDL_SetVideoMode" sym 4 rcells add-handle
+ " /usr/lib/libSDL.so" lib " SDL_SetVideoMode" sym 4 cells add-handle
- " /usr/lib/libSDL.so" lib " SDL_PollEvent" sym rcell add-handle
+ " /usr/lib/libSDL.so" lib " SDL_PollEvent" sym cell add-handle
- " /usr/lib/libSDL.so" lib " SDL_Flip" sym rcell add-handle
+ " /usr/lib/libSDL.so" lib " SDL_Flip" sym cell add-handle
- " /usr/lib/libSDL.so" lib " SDL_LockSurface" sym rcell add-handle
+ " /usr/lib/libSDL.so" lib " SDL_LockSurface" sym cell add-handle
- " /usr/lib/libSDL.so" lib " SDL_UnlockSurface" sym rcell add-handle
+ " /usr/lib/libSDL.so" lib " SDL_UnlockSurface" sym cell add-handle
init-synth
;
@@ -129,12 +129,12 @@ variable screen
\ allot needed stuff for SDL
create event 20 bytes allot
\ and for pallete
-create pallete 256 rcells allot
+create pallete 256 cells allot
\ get the linear offset
: points point * ;
\ put the pixel in right place with pallete colour
-: pixel ( col x y -- ) width * + points screen @ s>pixels + swap rcells pallete + @ swap ! ;
+: pixel ( col x y -- ) width * + points screen @ s>pixels + swap cells pallete + @ swap ! ;
\ set the video mode
: video 0 bpp height width SDL_SetVideoMode ;
@@ -206,7 +206,7 @@ variable time
3.1415 fconst pi
: col> ( i f:fac -- f:c ) i>>f pi f* f* sin ;
-: col! ( c i -- ) rcells pallete + + f> f>i swap c! ;
+: col! ( c i -- ) cells pallete + + f> f>i swap c! ;
: color ( i f ) dup >r col> r> col! ;
\ init our pallete
: init-pallete
View
@@ -20,7 +20,7 @@
: fswap f> f> swap >f >f ;
| Declare list of variables
-| : vars: begin token 2dup 1 = if c: ; swap c@ = if drop drop ;; then else drop then (create) postpone ; rcell allot repeat ;
+| : vars: begin token 2dup 1 = if c: ; swap c@ = if drop drop ;; then else drop then (create) postpone ; cell allot repeat ;
variable top
variable bottom
View
@@ -131,9 +131,9 @@ frq bpm / const frame
: sconst : sliteral postpone ; ;
variable current-song
-: song there @ current-song ! 4 rcells allot 0 data: ;
+: song there @ current-song ! 4 cells allot 0 data: ;
: pattern here @ ;
-: endp over current-song @ + ! rcell + ;
+: endp over current-song @ + ! cell + ;
: end-song data; drop ;
create track data: 1 c, 0 c, 1 c, 1 c, 0 c, 1 c, 1 c, 1 c, 0 c, 1 c, 0 c, 1 c, 0 c, 1 c, 0 c, 1 c, data;
@@ -146,15 +146,15 @@ end-song
0 variable now
-2 rcells const channel
+2 cells const channel
4 channel * create channels allot
variable current
0 current !
: current-channel current @ channel * ;
-: current-track current-song @ current @ rcells + @ ;
+: current-track current-song @ current @ cells + @ ;
: time ( #ch -- F:t ) channels + ;
-: which-frame time rcell + ;
+: which-frame time cell + ;
: reset 3 0 do 0.0 i channel time ! -1 i channel which-frame ! loop ;
@@ -226,7 +226,7 @@ variable tmp
;
| create Instruments data: ' HiHat , ' BassDrum , data;
-| : play finit current-channel which-frame @ -1 <> if Instruments current @ rcells + @ execute ;; then 0.0 >f ;
+| : play finit current-channel which-frame @ -1 <> if Instruments current @ cells + @ execute ;; then 0.0 >f ;
: play1 ( token -- ) current-channel which-frame @ -1 <> if HiHat tick ;; then 0.0 >f tick ;
: play ( token -- )
@@ -19,7 +19,7 @@
3 ccall: fflush
4 ccall: reent
-: hdl ( lib bytes -- ) >r sym r> rcells add-handle ;
+: hdl ( lib bytes -- ) >r sym r> cells add-handle ;
: libc " libc.so" lib ;
@@ -34,7 +34,7 @@
import
" Hello world!
" drop printf drop
- reent 2 rcells + @ fflush drop
+ reent 2 cells + @ fflush drop
;
main
View
@@ -31,7 +31,7 @@ variable matched
: match: -1 literal postpone >r ; immediate
: |: postpone r postpone if 0 ; immediate
: |= postpone over postpone = postpone if postpone >r ; immediate
-: clear-rstack s@ begin dup @ while postpone rdrop rcell + repeat drop ;
+: clear-rstack s@ begin dup @ while postpone rdrop cell + repeat drop ;
: |a $a-var ! ;
: |b $b-var ! ;
: -> ; immediate
View
@@ -16,7 +16,7 @@
\ You should have received a copy of the GNU General Public License
\ along with this program. If not, see <http://www.gnu.org/licenses/>.
create s-stack
-32 rcells allot
+32 cells allot
variable #ptr
@@ -32,8 +32,8 @@ variable bytecode
times
; immediate
-: push ( e -- ) s-stack #ptr @ rcells + ! #ptr @ 1+ 31 and #ptr ! ;
-: pop ( -- e ) #ptr @ 1- 31 and #ptr ! s-stack #ptr @ rcells + @ ;
+: push ( e -- ) s-stack #ptr @ cells + ! #ptr @ 1+ 31 and #ptr ! ;
+: pop ( -- e ) #ptr @ 1- 31 and #ptr ! s-stack #ptr @ cells + @ ;
| pushes the given number of elements
: pushnum ( num -- ) times push ;
View
@@ -29,18 +29,18 @@
: wname ( token -- adr c ) 32 * ntab @ + dup count ;
-: lit4. ." lit4: " 1+ dup @ . space rcell + ;
+: lit4. ." lit4: " 1+ dup @ . space cell + ;
: lit. ." lit: " 1+ dup c@ . space 1+ ;
: prefix. ." prefix: " 1+ dup c@ MAX_VALID_TOKEN + wname type space 1+ ;
: branch. ." branch: " 1+ dup c@ . space 1+ ;
: branch0. ." branch0: " 1+ dup c@ . space 1+ ;
-: lbranch. of ." lbranch: " 1+ dup c@ . space rcell + ;
-: lbranch0. of ." lbranch0: " 1+ dup c@ . space rcell + ;
+: lbranch. of ." lbranch: " 1+ dup c@ . space cell + ;
+: lbranch0. of ." lbranch0: " 1+ dup c@ . space cell + ;
: show ( token -- )
c: : emit space dup wname type space
- rcells vtab @ + @
+ cells vtab @ + @
1+
begin
dup c@ EOW_TOKEN <>
View
@@ -36,7 +36,7 @@ section functions
512 allot
section relations
-256 rcell * allot
+256 cell * allot
variable #functions
variable #libraries
@@ -78,7 +78,7 @@ variable symbols
*)
-2 rcell + const $relentry | size of a rel entry
+2 cell + const $relentry | size of a rel entry
: add-relation ( stackfix findx lindx -- )
" relations" find-section th table in >r r :pointer @ r :offset @ +
@@ -196,8 +196,8 @@ variable libhandle
lib: libc.so.6
-rcell func: printf
-rcell func: exit
+cell func: printf
+cell func: exit
: moo
" hello world!!" drop cr
View
@@ -33,8 +33,8 @@ mark
32 const section
: table ( -- ptr ) stab @ ;
: th ( section# -- ofs ) section * ;
-: pointer ( section* -- sec-pointer ) section + rcell - ;
-: offset ( section* -- sec-offset ) pointer rcell - ;
+: pointer ( section* -- sec-pointer ) section + cell - ;
+: offset ( section* -- sec-offset ) pointer cell - ;
: 1+! ( ptr -- ) 1 swap +! ;
: in ( ofs ptr -- ptr ) + ;
: >imrel ( ptr -- ofs ) imbase @ - ;
Oops, something went wrong.

0 comments on commit 81e821c

Please sign in to comment.