Check-in [279f834ea3]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Clipboard words (require Andriod 4.x)
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:279f834ea3c700beea06868702f19698a55a8ebc
User & Date: bernd 2014-06-30 23:28:00
Context
2014-07-01
19:14
Clipboard+color stuff check-in: 1929277a70 user: bernd tags: trunk
2014-06-30
23:28
Clipboard words (require Andriod 4.x) check-in: 279f834ea3 user: bernd tags: trunk
2014-05-14
21:02
Better keyboard handling check-in: c71e1435c8 user: bernd tags: trunk
Changes

Changes to gl-terminal.fs.

101
102
103
104
105
106
107

108

109
110
111
112


113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
...
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211



212
213
214
215
216
217
218
219



220
221
222
223
224
225
226
227
228
229

230
231
232
233
234
235
236
...
298
299
300
301
302
303
304
305

306
307
308
309
310
311







312


313
314
315
316
317
318
319
: term-load-textures ( addr u -- )
    chars-tex load-texture 2drop linear
    GL_TEXTURE2 glActiveTexture
    color-tex color-matrix $10 1 rgba-map nearest
    GL_TEXTURE0 glActiveTexture ;

Variable color-index

bl dup $70 and 5 lshift or $F0F and 4 lshift color-index !

Variable std-bg

: fg! ( index -- ) 4 lshift color-index 2 + c! ;
: bg! ( index -- ) 4 lshift color-index 3 + c! ;


: bg>clear ( index -- )
    $F and sfloats color-matrix +
    count s>f $FF fm/
    count s>f $FF fm/
    count s>f $FF fm/
    c@    s>f $FF fm/ glClearColor ;

: std-bg! ( index -- )  dup bg! dup std-bg ! bg>clear ;

: >white White std-bg! Black fg! ;
: >black Black std-bg! White fg! ;
>black \ make black default

128 Value videocols
0   Value videorows

2Variable gl-xy  0 0 gl-xy 2!
2Variable gl-wh 24 80 gl-wh 2!
................................................................................
    f2* rows fm/ >y-pos  need-sync on ;

: gl-char' ( -- addr )
    gl-xy 2@ videocols * + sfloats videomem + ;

: gl-form ( -- h w ) gl-wh 2@ ;

: gl-emit ( char -- )  dup 7 = IF  drop  EXIT  THEN
    resize-screen  need-sync on
    dup $70 and 5 lshift or $F0F and 4 lshift color-index @ $FFFF0000 and or
    gl-char' l!
    gl-xy 2@ >r 1+ dup cols = dup gl-lineend !
    IF  drop 0 r> 1+ >r  THEN
    r> gl-xy 2! ;




: gl-cr ( -- )
    gl-lineend @ 0= IF
	gl-xy 2@ 1+ nip 0 swap gl-xy 2! THEN
    resize-screen  need-sync on ;

: gl-type ( addr u -- )
    bounds ?DO  I c@ gl-emit  LOOP ;




: gl-atxy ( x y -- )  gl-xy 2! ;

: gl-at-deltaxy ( x y -- )  gl-xy 2@ rot + >r + r> gl-atxy ;

: gl-page ( -- )  0 0 gl-atxy  0 to videorows
    0e screen-scroll  0e fdup scroll-source f! scroll-dest f!
    videomem videocols sfloats resize throw to videomem
    resize-screen need-sync on ;

: gl-attr! ( attribute -- )  dup bg> bg! fg> fg! ;


0.25e FConstant scroll-deltat
: >scroll-pos ( -- 0..1 )
    ftime scroll-time f@ f- scroll-deltat f/
    1e fmin 0.5e f- pi f* fsin 1e f+ f2/ ;

: set-scroll ( r -- )
................................................................................
	    0
	endcase
    THEN  rdrop ;

:noname ( flag -- flag ) level# @ 0> ?EXIT
    screen-sync screen-slide scroll-slide ; IS screen-ops

' gl-type ' gl-emit ' gl-cr ' gl-form output: >screen


>screen
' gl-atxy IS at-xy
' gl-at-deltaxy IS at-deltaxy
' gl-page IS page
' gl-attr! IS attr!







default-out op-vector !



\ initialize

: term-init ( -- )
    [IFDEF] clazz clazz >o hideProgress o> [THEN]
    >screen-orientation
    create-terminal-program to terminal-program







>
|
>




>
>









|
|







 







|

|





>
>
>








>
>
>










>







 







|
>

|




>
>
>
>
>
>
>

>
>







101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
...
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
...
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
: term-load-textures ( addr u -- )
    chars-tex load-texture 2drop linear
    GL_TEXTURE2 glActiveTexture
    color-tex color-matrix $10 1 rgba-map nearest
    GL_TEXTURE0 glActiveTexture ;

Variable color-index
Variable err-color-index
bl dup $70 and 5 lshift or $F0F and 4 lshift
dup color-index ! err-color-index !
Variable std-bg

: fg! ( index -- ) 4 lshift color-index 2 + c! ;
: bg! ( index -- ) 4 lshift color-index 3 + c! ;
: err-fg! ( index -- ) 4 lshift err-color-index 2 + c! ;
: err-bg! ( index -- ) 4 lshift err-color-index 3 + c! ;
: bg>clear ( index -- )
    $F and sfloats color-matrix +
    count s>f $FF fm/
    count s>f $FF fm/
    count s>f $FF fm/
    c@    s>f $FF fm/ glClearColor ;

: std-bg! ( index -- )  dup bg! dup std-bg ! bg>clear ;

: >white White std-bg! White err-bg! Black fg! Red err-fg! ;
: >black Black std-bg! Black err-bg! White fg! Red err-fg! ;
>black \ make black default

128 Value videocols
0   Value videorows

2Variable gl-xy  0 0 gl-xy 2!
2Variable gl-wh 24 80 gl-wh 2!
................................................................................
    f2* rows fm/ >y-pos  need-sync on ;

: gl-char' ( -- addr )
    gl-xy 2@ videocols * + sfloats videomem + ;

: gl-form ( -- h w ) gl-wh 2@ ;

: (gl-emit) ( char color -- )  over 7 = IF  2drop  EXIT  THEN  >r
    resize-screen  need-sync on
    dup $70 and 5 lshift or $F0F and 4 lshift r> $FFFF0000 and or
    gl-char' l!
    gl-xy 2@ >r 1+ dup cols = dup gl-lineend !
    IF  drop 0 r> 1+ >r  THEN
    r> gl-xy 2! ;

: gl-emit ( char -- )  color-index @ (gl-emit) ;
: gl-emit-err ( char -- )  err-color-index @ (gl-emit) ;

: gl-cr ( -- )
    gl-lineend @ 0= IF
	gl-xy 2@ 1+ nip 0 swap gl-xy 2! THEN
    resize-screen  need-sync on ;

: gl-type ( addr u -- )
    bounds ?DO  I c@ gl-emit  LOOP ;

: gl-type-err ( addr u -- )
    bounds ?DO  I c@ gl-emit-err  LOOP ;

: gl-atxy ( x y -- )  gl-xy 2! ;

: gl-at-deltaxy ( x y -- )  gl-xy 2@ rot + >r + r> gl-atxy ;

: gl-page ( -- )  0 0 gl-atxy  0 to videorows
    0e screen-scroll  0e fdup scroll-source f! scroll-dest f!
    videomem videocols sfloats resize throw to videomem
    resize-screen need-sync on ;

: gl-attr! ( attribute -- )  dup bg> bg! fg> fg! ;
: gl-err-attr! ( attribute -- )  dup bg> err-bg! fg> err-fg! ;

0.25e FConstant scroll-deltat
: >scroll-pos ( -- 0..1 )
    ftime scroll-time f@ f- scroll-deltat f/
    1e fmin 0.5e f- pi f* fsin 1e f+ f2/ ;

: set-scroll ( r -- )
................................................................................
	    0
	endcase
    THEN  rdrop ;

:noname ( flag -- flag ) level# @ 0> ?EXIT
    screen-sync screen-slide scroll-slide ; IS screen-ops

' gl-type     ' gl-emit     ' gl-cr ' gl-form output: out>screen
' gl-type-err ' gl-emit-err ' gl-cr ' gl-form output: err>screen

out>screen
' gl-atxy IS at-xy
' gl-at-deltaxy IS at-deltaxy
' gl-page IS page
' gl-attr! IS attr!

err>screen
' gl-atxy IS at-xy
' gl-at-deltaxy IS at-deltaxy
' gl-page IS page
' gl-err-attr! IS attr!

default-out op-vector !

: >screen  err>screen op-vector @ debug-vector ! out>screen ;

\ initialize

: term-init ( -- )
    [IFDEF] clazz clazz >o hideProgress o> [THEN]
    >screen-orientation
    create-terminal-program to terminal-program

Changes to gles2/android.fs.

123
124
125
126
127
128
129


130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
...
233
234
235
236
237
238
239
240
241
242
243
244
245



246
247
248
249
250
251
252
...
307
308
309
310
311
312
313

314
315
316
317
318
319
320
...
321
322
323
324
325
326
327
328
329
330
331

332
333
334
335
336
337
338
339
  count rdrop ;

\ ainput implementation

Variable level#
Defer aback
:noname  -1 level# +!  level# @ 0< IF  bye  THEN ; IS aback



0 Value screen-orientation

: screen-orientation@ ( -- 0..3 )
    clazz >o getWindowManager >o getDefaultDisplay >o
    getRotation o> o> o> ;

$80 Constant FLAG_KEEP_SCREEN_ON

false value wake-lock \ doesn't work, why?

: screen+keep ( -- )  wake-lock IF
	clazz >o getWindow o> >o FLAG_KEEP_SCREEN_ON addFlags o> THEN ;
: screen-keep ( -- )  wake-lock IF
	clazz >o getWindow o> >o FLAG_KEEP_SCREEN_ON clearFlags o> THEN ;

\ callbacks

: $err ( xt -- )  $tmp stderr write-file throw ;

\ event handling

................................................................................
	APP_CMD_PAUSE of [: ." app pause" cr ;] $err endof
	APP_CMD_RESUME of [: ." app resume" cr ;] $err endof
	APP_CMD_START of [: ." app start" cr ;] $err endof
	APP_CMD_STOP of [: ." app stop" cr ;] $err endof
	dup [: ." app cmd " . cr ;] $err
    endcase ; is acmd

also jni

Variable setstring
: insstring ( -- )  setstring $@ inskeys setstring $off ;

: android-characters ( string -- )  jstring>sstring insstring  inskeys jfree ;



: android-setstring  ( string -- )  jstring>sstring setstring $! jfree ;
: android-unicode    ( uchar -- )   insstring  >xstring inskeys ;
: android-keycode    ( keycode -- ) insstring  keycode>keys inskeys ;

JValue key-event
JValue touch-event
JValue location
................................................................................
: android-surface-destroyed ( surface -- )
    >o  app window off  gref> ;
: android-global-layout ( 0 -- ) drop config-changed ;
: android-log# ( n -- ) ." log: " . cr ;
: android-log$ ( string -- )  jstring>sstring ." log: " type cr jfree ;
Defer android-w! ( n -- ) ' drop is recurse
Defer android-h! ( n -- ) ' drop is recurse


Create aevents
' android-key ,
' android-touch ,
' android-location ,
' android-sensor ,
' android-surface-created ,
................................................................................
' android-surface-changed ,
' android-surface-redraw ,
' android-surface-destroyed ,
' android-global-layout ,
' android-video-size ,
' android-log# ,
' android-log$ ,
' android-characters ,
' android-setstring ,
' android-w! ,
' android-h! ,

here aevents - cell/
' drop ,
Constant max-event#

:noname ( event type -- )
    max-event# umin cells aevents + perform ; is akey

previous previous set-current







>
>





|






|

|







 







<
<



|
>
>
>







 







>







 







|



>








123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
...
235
236
237
238
239
240
241


242
243
244
245
246
247
248
249
250
251
252
253
254
255
...
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
...
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
  count rdrop ;

\ ainput implementation

Variable level#
Defer aback
:noname  -1 level# +!  level# @ 0< IF  bye  THEN ; IS aback

also jni

0 Value screen-orientation

: screen-orientation@ ( -- 0..3 )
    clazz >o getWindowManager >o getDefaultDisplay >o
    getRotation ref> ref> o> ;

$80 Constant FLAG_KEEP_SCREEN_ON

false value wake-lock \ doesn't work, why?

: screen+keep ( -- )  wake-lock IF
	clazz >o getWindow o> >o FLAG_KEEP_SCREEN_ON addFlags ref> THEN ;
: screen-keep ( -- )  wake-lock IF
	clazz >o getWindow o> >o FLAG_KEEP_SCREEN_ON clearFlags ref> THEN ;

\ callbacks

: $err ( xt -- )  $tmp stderr write-file throw ;

\ event handling

................................................................................
	APP_CMD_PAUSE of [: ." app pause" cr ;] $err endof
	APP_CMD_RESUME of [: ." app resume" cr ;] $err endof
	APP_CMD_START of [: ." app start" cr ;] $err endof
	APP_CMD_STOP of [: ." app stop" cr ;] $err endof
	dup [: ." app cmd " . cr ;] $err
    endcase ; is acmd



Variable setstring
: insstring ( -- )  setstring $@ inskeys setstring $off ;

: android-characters ( string -- )  jstring>sstring
    insstring  inskeys jfree ;
: android-commit     ( string/0 -- )   ?dup-0=-IF  insstring  ELSE
	jstring>sstring inskeys jfree setstring $off  THEN ;
: android-setstring  ( string -- )  jstring>sstring setstring $! jfree ;
: android-unicode    ( uchar -- )   insstring  >xstring inskeys ;
: android-keycode    ( keycode -- ) insstring  keycode>keys inskeys ;

JValue key-event
JValue touch-event
JValue location
................................................................................
: android-surface-destroyed ( surface -- )
    >o  app window off  gref> ;
: android-global-layout ( 0 -- ) drop config-changed ;
: android-log# ( n -- ) ." log: " . cr ;
: android-log$ ( string -- )  jstring>sstring ." log: " type cr jfree ;
Defer android-w! ( n -- ) ' drop is recurse
Defer android-h! ( n -- ) ' drop is recurse
Defer clipboard! ( 0 -- ) ' drop is recurse

Create aevents
' android-key ,
' android-touch ,
' android-location ,
' android-sensor ,
' android-surface-created ,
................................................................................
' android-surface-changed ,
' android-surface-redraw ,
' android-surface-destroyed ,
' android-global-layout ,
' android-video-size ,
' android-log# ,
' android-log$ ,
' android-commit ,
' android-setstring ,
' android-w! ,
' android-h! ,
' clipboard! , \ primary clipboard changed
here aevents - cell/
' drop ,
Constant max-event#

:noname ( event type -- )
    max-event# umin cells aevents + perform ; is akey

previous previous set-current

Changes to gles2/gl-terminal.fs.

101
102
103
104
105
106
107

108

109
110
111
112


113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
...
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211



212
213
214
215
216
217
218
219



220
221
222
223
224
225
226
227
228
229

230
231
232
233
234
235
236
...
298
299
300
301
302
303
304
305

306
307
308
309
310
311







312


313
314
315
316
317
318
319
: term-load-textures ( addr u -- )
    chars-tex load-texture 2drop linear
    GL_TEXTURE2 glActiveTexture
    color-tex color-matrix $10 1 rgba-map nearest
    GL_TEXTURE0 glActiveTexture ;

Variable color-index

bl dup $70 and 5 lshift or $F0F and 4 lshift color-index !

Variable std-bg

: fg! ( index -- ) 4 lshift color-index 2 + c! ;
: bg! ( index -- ) 4 lshift color-index 3 + c! ;


: bg>clear ( index -- )
    $F and sfloats color-matrix +
    count s>f $FF fm/
    count s>f $FF fm/
    count s>f $FF fm/
    c@    s>f $FF fm/ glClearColor ;

: std-bg! ( index -- )  dup bg! dup std-bg ! bg>clear ;

: >white White std-bg! Black fg! ;
: >black Black std-bg! White fg! ;
>black \ make black default

128 Value videocols
0   Value videorows

2Variable gl-xy  0 0 gl-xy 2!
2Variable gl-wh 24 80 gl-wh 2!
................................................................................
    f2* rows fm/ >y-pos  need-sync on ;

: gl-char' ( -- addr )
    gl-xy 2@ videocols * + sfloats videomem + ;

: gl-form ( -- h w ) gl-wh 2@ ;

: gl-emit ( char -- )  dup 7 = IF  drop  EXIT  THEN
    resize-screen  need-sync on
    dup $70 and 5 lshift or $F0F and 4 lshift color-index @ $FFFF0000 and or
    gl-char' l!
    gl-xy 2@ >r 1+ dup cols = dup gl-lineend !
    IF  drop 0 r> 1+ >r  THEN
    r> gl-xy 2! ;




: gl-cr ( -- )
    gl-lineend @ 0= IF
	gl-xy 2@ 1+ nip 0 swap gl-xy 2! THEN
    resize-screen  need-sync on ;

: gl-type ( addr u -- )
    bounds ?DO  I c@ gl-emit  LOOP ;




: gl-atxy ( x y -- )  gl-xy 2! ;

: gl-at-deltaxy ( x y -- )  gl-xy 2@ rot + >r + r> gl-atxy ;

: gl-page ( -- )  0 0 gl-atxy  0 to videorows
    0e screen-scroll  0e fdup scroll-source f! scroll-dest f!
    videomem videocols sfloats resize throw to videomem
    resize-screen need-sync on ;

: gl-attr! ( attribute -- )  dup bg> bg! fg> fg! ;


0.25e FConstant scroll-deltat
: >scroll-pos ( -- 0..1 )
    ftime scroll-time f@ f- scroll-deltat f/
    1e fmin 0.5e f- pi f* fsin 1e f+ f2/ ;

: set-scroll ( r -- )
................................................................................
	    0
	endcase
    THEN  rdrop ;

:noname ( flag -- flag ) level# @ 0> ?EXIT
    screen-sync screen-slide scroll-slide ; IS screen-ops

' gl-type ' gl-emit ' gl-cr ' gl-form output: >screen


>screen
' gl-atxy IS at-xy
' gl-at-deltaxy IS at-deltaxy
' gl-page IS page
' gl-attr! IS attr!







default-out op-vector !



\ initialize

: term-init ( -- )
    [IFDEF] clazz clazz >o hideProgress o> [THEN]
    >screen-orientation
    create-terminal-program to terminal-program







>
|
>




>
>









|
|







 







|

|





>
>
>








>
>
>










>







 







|
>

|




>
>
>
>
>
>
>

>
>







101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
...
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
...
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
: term-load-textures ( addr u -- )
    chars-tex load-texture 2drop linear
    GL_TEXTURE2 glActiveTexture
    color-tex color-matrix $10 1 rgba-map nearest
    GL_TEXTURE0 glActiveTexture ;

Variable color-index
Variable err-color-index
bl dup $70 and 5 lshift or $F0F and 4 lshift
dup color-index ! err-color-index !
Variable std-bg

: fg! ( index -- ) 4 lshift color-index 2 + c! ;
: bg! ( index -- ) 4 lshift color-index 3 + c! ;
: err-fg! ( index -- ) 4 lshift err-color-index 2 + c! ;
: err-bg! ( index -- ) 4 lshift err-color-index 3 + c! ;
: bg>clear ( index -- )
    $F and sfloats color-matrix +
    count s>f $FF fm/
    count s>f $FF fm/
    count s>f $FF fm/
    c@    s>f $FF fm/ glClearColor ;

: std-bg! ( index -- )  dup bg! dup std-bg ! bg>clear ;

: >white White std-bg! White err-bg! Black fg! Red err-fg! ;
: >black Black std-bg! Black err-bg! White fg! Red err-fg! ;
>black \ make black default

128 Value videocols
0   Value videorows

2Variable gl-xy  0 0 gl-xy 2!
2Variable gl-wh 24 80 gl-wh 2!
................................................................................
    f2* rows fm/ >y-pos  need-sync on ;

: gl-char' ( -- addr )
    gl-xy 2@ videocols * + sfloats videomem + ;

: gl-form ( -- h w ) gl-wh 2@ ;

: (gl-emit) ( char color -- )  over 7 = IF  2drop  EXIT  THEN  >r
    resize-screen  need-sync on
    dup $70 and 5 lshift or $F0F and 4 lshift r> $FFFF0000 and or
    gl-char' l!
    gl-xy 2@ >r 1+ dup cols = dup gl-lineend !
    IF  drop 0 r> 1+ >r  THEN
    r> gl-xy 2! ;

: gl-emit ( char -- )  color-index @ (gl-emit) ;
: gl-emit-err ( char -- )  err-color-index @ (gl-emit) ;

: gl-cr ( -- )
    gl-lineend @ 0= IF
	gl-xy 2@ 1+ nip 0 swap gl-xy 2! THEN
    resize-screen  need-sync on ;

: gl-type ( addr u -- )
    bounds ?DO  I c@ gl-emit  LOOP ;

: gl-type-err ( addr u -- )
    bounds ?DO  I c@ gl-emit-err  LOOP ;

: gl-atxy ( x y -- )  gl-xy 2! ;

: gl-at-deltaxy ( x y -- )  gl-xy 2@ rot + >r + r> gl-atxy ;

: gl-page ( -- )  0 0 gl-atxy  0 to videorows
    0e screen-scroll  0e fdup scroll-source f! scroll-dest f!
    videomem videocols sfloats resize throw to videomem
    resize-screen need-sync on ;

: gl-attr! ( attribute -- )  dup bg> bg! fg> fg! ;
: gl-err-attr! ( attribute -- )  dup bg> err-bg! fg> err-fg! ;

0.25e FConstant scroll-deltat
: >scroll-pos ( -- 0..1 )
    ftime scroll-time f@ f- scroll-deltat f/
    1e fmin 0.5e f- pi f* fsin 1e f+ f2/ ;

: set-scroll ( r -- )
................................................................................
	    0
	endcase
    THEN  rdrop ;

:noname ( flag -- flag ) level# @ 0> ?EXIT
    screen-sync screen-slide scroll-slide ; IS screen-ops

' gl-type     ' gl-emit     ' gl-cr ' gl-form output: out>screen
' gl-type-err ' gl-emit-err ' gl-cr ' gl-form output: err>screen

out>screen
' gl-atxy IS at-xy
' gl-at-deltaxy IS at-deltaxy
' gl-page IS page
' gl-attr! IS attr!

err>screen
' gl-atxy IS at-xy
' gl-at-deltaxy IS at-deltaxy
' gl-page IS page
' gl-err-attr! IS attr!

default-out op-vector !

: >screen  err>screen op-vector @ debug-vector ! out>screen ;

\ initialize

: term-init ( -- )
    [IFDEF] clazz clazz >o hideProgress o> [THEN]
    >screen-orientation
    create-terminal-program to terminal-program

Changes to gles2/jni-helper.fs.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

26
27
28
29
30
31
32
..
67
68
69
70
71
72
73






















74
75
76
77
78
79
80
..
81
82
83
84
85
86
87

















88
89
90
91
92
93
94

gforth-class:

\ jni-sfield: INPUT_METHOD_SERVICE INPUT_METHOD_SERVICE Ljava/lang/String;
\ jni-sfield: POWER_SERVICE POWER_SERVICE Ljava/lang/String;
: INPUT_METHOD_SERVICE js" input_method" ;
: POWER_SERVICE        js" power" ;
: LOCATION_SERVICE     js" location" ;
: SENSOR_SERVICE       js" sensor" ;

jni-method: getSystemService getSystemService (Ljava/lang/String;)Ljava/lang/Object;
jni-method: getWindow getWindow ()Landroid/view/Window;
jni-method: hideProgress hideProgress ()V
jni-method: showIME showIME ()V
jni-method: hideIME hideIME ()V


jni-class: android/app/Activity
jni-method: getWindowManager getWindowManager ()Landroid/view/WindowManager;

jni-class: android/view/WindowManager
jni-method: getDefaultDisplay getDefaultDisplay ()Landroid/view/Display;

................................................................................
jni-method: getPressure getPressure (I)F

jni-class: java/util/List

jni-method: l-get get (I)Ljava/lang/Object;
jni-method: l-size size ()I























: l[] ( n list -- object )  >o l-get o> ;
: l# ( list -- n )  >o l-size o> ;

: l-map ( xt list -- )  >o { xt } ( -- )
    l-size 0 ?DO  I l-get >o xt execute ref>  LOOP o> ;

Variable kbflag kbflag on
................................................................................

: hidekb ( -- )  clazz >o hideIME o> kbflag off ;
: showkb ( -- )  clazz >o showIME o> kbflag on ;

: togglekb ( -- )
    kbflag @ IF  hidekb  ELSE  showkb  THEN ;


















0 [IF]
jni-class: android/os/PowerManager
jni-method: newWakeLock newWakeLock (ILjava/lang/String;)Landroid/os/PowerManager$WakeLock;

jni-class: android/os/PowerManager$WakeLock
jni-method: wl-acquire acquire ()V
jni-method: wl-release release ()V







<
<






>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







11
12
13
14
15
16
17


18
19
20
21
22
23
24
25
26
27
28
29
30
31
..
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
...
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132

gforth-class:

\ jni-sfield: INPUT_METHOD_SERVICE INPUT_METHOD_SERVICE Ljava/lang/String;
\ jni-sfield: POWER_SERVICE POWER_SERVICE Ljava/lang/String;
: INPUT_METHOD_SERVICE js" input_method" ;
: POWER_SERVICE        js" power" ;



jni-method: getSystemService getSystemService (Ljava/lang/String;)Ljava/lang/Object;
jni-method: getWindow getWindow ()Landroid/view/Window;
jni-method: hideProgress hideProgress ()V
jni-method: showIME showIME ()V
jni-method: hideIME hideIME ()V
jni-field: clipboardManager clipboardManager Landroid/content/ClipboardManager;

jni-class: android/app/Activity
jni-method: getWindowManager getWindowManager ()Landroid/view/WindowManager;

jni-class: android/view/WindowManager
jni-method: getDefaultDisplay getDefaultDisplay ()Landroid/view/Display;

................................................................................
jni-method: getPressure getPressure (I)F

jni-class: java/util/List

jni-method: l-get get (I)Ljava/lang/Object;
jni-method: l-size size ()I

jni-class: android/content/ClipboardManager

jni-method: getPrimaryClip getPrimaryClip ()Landroid/content/ClipData;
jni-method: hasPrimaryClip hasPrimaryClip ()Z

jni-class: android/content/ClipData

jni-method: getItemCount getItemCount ()I
jni-method: getItemAt getItemAt (I)Landroid/content/ClipData$Item;

jni-class: android/content/ClipData$Item

jni-method: getText getText ()Ljava/lang/CharSequence;
jni-method: getIntent getIntent ()Landroid/content/Intent;
jni-method: getHtmlText getHtmlText ()Ljava/lang/String;
jni-method: getUri getUri ()Landroid/net/Uri;
\ jni-method: coerceToText coerceToText ()Ljava/lang/CharSequence;

jni-class: java/lang/CharSequence

jni-method: toString toString ()Ljava/lang/String;

: l[] ( n list -- object )  >o l-get o> ;
: l# ( list -- n )  >o l-size o> ;

: l-map ( xt list -- )  >o { xt } ( -- )
    l-size 0 ?DO  I l-get >o xt execute ref>  LOOP o> ;

Variable kbflag kbflag on
................................................................................

: hidekb ( -- )  clazz >o hideIME o> kbflag off ;
: showkb ( -- )  clazz >o showIME o> kbflag on ;

: togglekb ( -- )
    kbflag @ IF  hidekb  ELSE  showkb  THEN ;

: getclip? ( addr u -- 0 0 )
    clazz .clipboardManager >o
    hasPrimaryClip IF
	getPrimaryClip >o
	getItemCount IF
	    0 getItemAt >o
	    getText dup IF
		>o toString jstring>sstring ref>
	    ELSE  0  THEN
	    ref>
	ELSE  0 0  THEN
	ref>
    ELSE 0 0 THEN o> ;

: paste ( -- )
    getclip? dup IF  inskeys  ELSE  2drop  THEN ;

0 [IF]
jni-class: android/os/PowerManager
jni-method: newWakeLock newWakeLock (ILjava/lang/String;)Landroid/os/PowerManager$WakeLock;

jni-class: android/os/PowerManager$WakeLock
jni-method: wl-acquire acquire ()V
jni-method: wl-release release ()V