Lines Matching +full:2 +full:- +full:cell

3 \ ** F I C L   2 . 0   C L A S S E S
13 object subclass c-ref
14 cell: .class
15 cell: .instance
17 : get ( inst class -- refinst refclass )
18 drop 2@ ;
19 : set ( refinst refclass inst class -- )
20 drop 2! ;
21 end-class
23 object subclass c-byte
28 end-class
30 object subclass c-2byte
31 2 chars: .payload
35 end-class
37 object subclass c-4byte
42 end-class
45 object subclass c-cell
46 cell: .payload
50 end-class
53 \ ** C - P T R
55 \ Note: use c-ref to make references to objects. C-ptr
62 \ @size ( inst class -- addr-units )
65 object subclass c-ptr
66 c-cell obj: .addr
69 : get-ptr ( inst class -- addr )
70 c-ptr => .addr
71 c-cell => get
75 : set-ptr ( addr inst class -- )
76 c-ptr => .addr
77 c-cell => set
81 : clr-ptr
82 0 -rot c-ptr => .addr c-cell => set
85 \ return flag indicating null-ness
86 : ?null ( inst class -- flag )
87 c-ptr => get-ptr 0=
91 : inc-ptr ( inst class -- )
92 2dup 2dup ( i c i c i c )
93 c-ptr => get-ptr -rot ( i c addr i c )
94 --> @size + -rot ( addr' i c )
95 c-ptr => set-ptr
99 : dec-ptr ( inst class -- )
100 2dup 2dup ( i c i c i c )
101 c-ptr => get-ptr -rot ( i c addr i c )
102 --> @size - -rot ( addr' i c )
103 c-ptr => set-ptr
107 : index-ptr { index 2:this -- }
108 this --> get-ptr ( addr )
109 this --> @size index * + ( addr' )
110 this --> set-ptr
113 end-class
116 \ ** C - C E L L P T R
117 \ Models a pointer to cell (a 32 or 64 bit scalar).
118 c-ptr subclass c-cellPtr
119 : @size 2drop 1 cells ;
121 : get ( inst class -- cell )
122 c-ptr => get-ptr @
124 : set ( value inst class -- )
125 c-ptr => get-ptr !
127 end-class
130 \ ** C - 4 B Y T E P T R
132 c-ptr subclass c-4bytePtr
133 : @size 2drop 4 ;
135 : get ( inst class -- value )
136 c-ptr => get-ptr q@
138 : set ( value inst class -- )
139 c-ptr => get-ptr q!
141 end-class
143 \ ** C - 2 B Y T E P T R
145 c-ptr subclass c-2bytePtr
146 : @size 2drop 2 ;
148 : get ( inst class -- value )
149 c-ptr => get-ptr w@
151 : set ( value inst class -- )
152 c-ptr => get-ptr w!
154 end-class
157 \ ** C - B Y T E P T R
159 c-ptr subclass c-bytePtr
160 : @size 2drop 1 ;
162 : get ( inst class -- value )
163 c-ptr => get-ptr c@
165 : set ( value inst class -- )
166 c-ptr => get-ptr c!
168 end-class