Check-in [bd42ea02bd]
Not logged in

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

Overview
Comment:Sensor stuff redesigned
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: bd42ea02bd989346ec44be0cfdb3bcc3af181cb7
User & Date: bernd 2014-01-12 00:10:15
Context
2014-01-12
00:36
Fix to field operations check-in: 5d978cd2dc user: bernd tags: trunk
00:10
Sensor stuff redesigned check-in: bd42ea02bd user: bernd tags: trunk
2014-01-11
00:17
negative .deg fixed check-in: fc5488ed40 user: bernd tags: trunk
Changes

Changes to gles2/.libs/libsoil.so.

cannot compute difference between binary files

Changes to gles2/android.fs.

326
327
328
329
330
331
332

333
334
335


336
337
338
339
340
341

342
343
344
	THEN
    THEN o> ;

Defer android-touch ( event -- )
' drop IS android-touch

0 Value location


Defer android-location ( location -- )
:noname to location ; IS android-location



:noname ( event type -- )
    CASE
	0 OF  android-key       ENDOF
	1 OF  android-touch     ENDOF
	2 OF  android-location  ENDOF

    nip ENDCASE ; is akey

previous previous set-current







>


|
>
>






>



326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
	THEN
    THEN o> ;

Defer android-touch ( event -- )
' drop IS android-touch

0 Value location
0 Value sensor

Defer android-location ( location -- )
:noname ." new location" cr to location ; IS android-location
Defer android-sensor ( sensor -- )
:noname ." new sensor" cr to sensor ; IS android-sensor

:noname ( event type -- )
    CASE
	0 OF  android-key       ENDOF
	1 OF  android-touch     ENDOF
	2 OF  android-location  ENDOF
	3 OF  android-sensor    ENDOF
    nip ENDCASE ; is akey

previous previous set-current

Changes to gles2/jni-location.fs.

1
2
3
4
5
6
7
8
..
18
19
20
21
22
23
24


25
26
27
28
29
30
31
32
33
34

35




36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
\ location services

require jni-helper.fs

also jni

jni-class: android/location/Location

................................................................................
jni-class: android/location/LocationManager

jni-method: getAllProviders getAllProviders ()Ljava/util/List;
jni-method: getProviders getProviders (Z)Ljava/util/List;
jni-method: lm-getProvider getProvider (Ljava/lang/String;)Landroid/location/LocationProvider;
jni-method: getLastKnownLocation getLastKnownLocation (Ljava/lang/String;)Landroid/location/Location;



jni-class: android/os/Handler

jni-method: post post (Ljava/lang/Runnable;)Z

gforth-class:

jni-field: gforth-handler handler Landroid/os/Handler;
jni-field: startgps startgps Ljava/lang/Runnable;
jni-field: stopgps stopgps Ljava/lang/Runnable;


jni-method: setgps setgps (JF)V





also android

: start-gps ( -- )
    clazz >o gforth-handler o> >o
    clazz >o startgps o> post o> ;

: stop-gps ( -- )
    clazz >o gforth-handler o> >o
    clazz >o stopgps o> post o> ;

: .deg ( degree -- )
    fdup f0< IF ." -" fnegate THEN
    fdup floor fdup f>s 0 .r '°' xemit f-  60e f*
    fdup floor fdup f>s 0 .r ''' xemit f-  60e f*
    f. ;

|







 







>
>









<
>
|
>
>
>
>





|



|







1
2
3
4
5
6
7
8
..
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
\ location+sensor services

require jni-helper.fs

also jni

jni-class: android/location/Location

................................................................................
jni-class: android/location/LocationManager

jni-method: getAllProviders getAllProviders ()Ljava/util/List;
jni-method: getProviders getProviders (Z)Ljava/util/List;
jni-method: lm-getProvider getProvider (Ljava/lang/String;)Landroid/location/LocationProvider;
jni-method: getLastKnownLocation getLastKnownLocation (Ljava/lang/String;)Landroid/location/Location;

jni-class: android/hardware/SensorManager

jni-class: android/os/Handler

jni-method: post post (Ljava/lang/Runnable;)Z

gforth-class:

jni-field: gforth-handler handler Landroid/os/Handler;
jni-field: startgps startgps Ljava/lang/Runnable;
jni-field: stopgps stopgps Ljava/lang/Runnable;

jni-field: startsensor startsensor Ljava/lang/Runnable;
jni-field: stopsensor stopsensor Ljava/lang/Runnable;
jni-field: args0 args0 Ljava/lang/String;
jni-field: argf0 argf0 D
jni-field: argj0 argj0 J
jni-field: argsensor argsensor Landroid/hardware/Sensor;

also android

: start-gps ( -- )
    clazz >o gforth-handler o> >o
    clazz >o startgps o> post o> drop ;

: stop-gps ( -- )
    clazz >o gforth-handler o> >o
    clazz >o stopgps o> post o> drop ;

: .deg ( degree -- )
    fdup f0< IF ." -" fnegate THEN
    fdup floor fdup f>s 0 .r '°' xemit f-  60e f*
    fdup floor fdup f>s 0 .r ''' xemit f-  60e f*
    f. ;

Changes to gles2/jni-tools.fs.

109
110
111
112
113
114
115










116
117
118



119
120
121
122
123
124
125
...
192
193
194
195
196
197
198




199




200
201

202
203
204
205
206
207
208
: s@f ( jobject jfid -- n )  fieldenv JNIEnv-GetShortField() ;
: i@f ( jobject jfid -- n )  fieldenv JNIEnv-GetIntField() ;
: j@f ( jobject jfid -- d )  fieldenv JNIEnv-GetLongField() ;
: f@f ( jobject jfid -- r )  fieldenv JNIEnv-GetFloatField() ;
: d@f ( jobject jfid -- r )  fieldenv JNIEnv-GetDoubleField() ;
: l@f ( jobject jfid -- object )  fieldenv JNIEnv-GetObjectField() ;











Create 'field@ '[' 1+ 'A'
[DO] "x@f" over [i] swap c! current @ search-wordlist 0= [IF] ' 2drop [THEN] , [LOOP]




: z@' ( jclass jfid -- c )  fieldenv JNIEnv-GetStaticBooleanField() ;
: b@' ( jclass jfid -- c )  fieldenv JNIEnv-GetStaticByteField() ;
: c@' ( jclass jfid -- utf16 )  fieldenv JNIEnv-GetStaticCharField() ;
: s@' ( jclass jfid -- n )  fieldenv JNIEnv-GetStaticShortField() ;
: i@' ( jclass jfid -- n )  fieldenv JNIEnv-GetStaticIntField() ;
: j@' ( jclass jfid -- d )  fieldenv JNIEnv-GetStaticLongField() ;
: f@' ( jclass jfid -- r )  fieldenv JNIEnv-GetStaticFloatField() ;
................................................................................

: jni-new: ( "forth-name" "signature" -- )
    : ( args -- jobject ) jni-new >r
    cstring1 $@ >argstring args,
    jniclass postpone Literal r> postpone literal
    postpone new() postpone ; ;





: jni-field: ( "forth-name" "name" "signature" -- )




    : ( o:jobject -- retval ) postpone o jni-fid postpone Literal
    cstring1 $@ drop c@ 'A' - cells 'field@ + @ compile, postpone ; ;


: jni-sfield: ( "forth-name" "name" "signature" -- )
    : ( o:jobject -- retval )
    postpone o jni-sfid postpone Literal
    cstring1 $@ drop c@ 'A' - cells 'sfield@ + @ compile, postpone ; ;

previous previous set-current







>
>
>
>
>
>
>
>
>
>



>
>
>







 







>
>
>
>

>
>
>
>
|
|
>




|


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
135
136
137
138
...
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
: s@f ( jobject jfid -- n )  fieldenv JNIEnv-GetShortField() ;
: i@f ( jobject jfid -- n )  fieldenv JNIEnv-GetIntField() ;
: j@f ( jobject jfid -- d )  fieldenv JNIEnv-GetLongField() ;
: f@f ( jobject jfid -- r )  fieldenv JNIEnv-GetFloatField() ;
: d@f ( jobject jfid -- r )  fieldenv JNIEnv-GetDoubleField() ;
: l@f ( jobject jfid -- object )  fieldenv JNIEnv-GetObjectField() ;

: z!f ( c jobject jfid -- )  rot >r fieldenv r> JNIEnv-SetBooleanField() ;
: b!f ( c jobject jfid -- )  rot >r fieldenv r> JNIEnv-SetByteField() ;
: c!f ( utf16 jobject jfid -- )  rot >r fieldenv r> JNIEnv-SetCharField() ;
: s!f ( n jobject jfid -- )  rot >r fieldenv r> JNIEnv-SetShortField() ;
: i!f ( n jobject jfid -- )  rot >r fieldenv r> JNIEnv-SetIntField() ;
: j!f ( d jobject jfid -- )  2swap 2>r fieldenv 2r> JNIEnv-SetLongField() ;
: f!f ( r jobject jfid -- )  fieldenv JNIEnv-SetFloatField() ;
: d!f ( r jobject jfid -- )  fieldenv JNIEnv-SetDoubleField() ;
: l!f ( object jobject jfid -- )  rot >r fieldenv r> JNIEnv-SetObjectField() ;

Create 'field@ '[' 1+ 'A'
[DO] "x@f" over [i] swap c! current @ search-wordlist 0= [IF] ' 2drop [THEN] , [LOOP]

Create 'field! '[' 1+ 'A'
[DO] "x!f" over [i] swap c! current @ search-wordlist 0= [IF] ' 2drop [THEN] , [LOOP]

: z@' ( jclass jfid -- c )  fieldenv JNIEnv-GetStaticBooleanField() ;
: b@' ( jclass jfid -- c )  fieldenv JNIEnv-GetStaticByteField() ;
: c@' ( jclass jfid -- utf16 )  fieldenv JNIEnv-GetStaticCharField() ;
: s@' ( jclass jfid -- n )  fieldenv JNIEnv-GetStaticShortField() ;
: i@' ( jclass jfid -- n )  fieldenv JNIEnv-GetStaticIntField() ;
: j@' ( jclass jfid -- d )  fieldenv JNIEnv-GetStaticLongField() ;
: f@' ( jclass jfid -- r )  fieldenv JNIEnv-GetStaticFloatField() ;
................................................................................

: jni-new: ( "forth-name" "signature" -- )
    : ( args -- jobject ) jni-new >r
    cstring1 $@ >argstring args,
    jniclass postpone Literal r> postpone literal
    postpone new() postpone ; ;

: cstring@1 ( -- index ) cstring1 $@ drop c@ 'A' - cells ;

: field-to, ( xt1 xt2 -- ) >r postpone literal r> :, ;

: jni-field: ( "forth-name" "name" "signature" -- )
    >in @ parse-name 2drop jni-fid >in @ { old-in fid new-in }
    :noname postpone drop postpone o fid postpone Literal
    cstring@1 'field! + @ compile, postpone ; >r ['] field-to, set-compiler
    old-in >in !
    : ( o:jobject -- retval ) postpone o fid postpone Literal
    cstring@1 'field@ + @ compile, postpone ;
    r> set-to  new-in >in ! ;

: jni-sfield: ( "forth-name" "name" "signature" -- )
    : ( o:jobject -- retval )
    postpone o jni-sfid postpone Literal
    cstring@1 'sfield@ + @ compile, postpone ; ;

previous previous set-current

Changes to gles2/libcc.android.

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
srcdir=.
DESTDIR=/home/bernd/proj/net2o
prefix= 
ARCH=""
exec_prefix=${prefix}
libexecdir=$package${exec_prefix}/lib
libccdir=$libexecdir/$VERSION/libcc-named/
LIBRARY="opengl.fs android.fs png.fs soillib.fs openmax.fs jni.fs freetype-gl.fs" #  openvglib.fs
ANDROID=${ANDROID-~/proj/gforths/gforth-android}

for i in $LIBRARY
do
    echo "generating library $i"
    $ENGINE -i $KERNL -p ".:~+:$ANDROID" exboot.fs startup.fs -e ": android ;" -e "also c-lib s\" `pwd`/lib/$VERSION/libcc-named/\" >libcc-named-dir libcc-path clear-path libcc-named-dir libcc-path also-path :noname 2drop s\" $DESTDIR$libccdir\" ; is replace-rpath previous" $srcdir/$i -e bye
done







|







6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
srcdir=.
DESTDIR=/home/bernd/proj/net2o
prefix= 
ARCH=""
exec_prefix=${prefix}
libexecdir=$package${exec_prefix}/lib
libccdir=$libexecdir/$VERSION/libcc-named/
LIBRARY="opengl.fs android.fs soillib.fs openmax.fs jni.fs freetype-gl.fs" #  openvglib.fs png.fs
ANDROID=${ANDROID-~/proj/gforths/gforth-android}

for i in $LIBRARY
do
    echo "generating library $i"
    $ENGINE -i $KERNL -p ".:~+:$ANDROID" exboot.fs startup.fs -e ": android ;" -e "also c-lib s\" `pwd`/lib/$VERSION/libcc-named/\" >libcc-named-dir libcc-path clear-path libcc-named-dir libcc-path also-path :noname 2drop s\" $DESTDIR$libccdir\" ; is replace-rpath previous" $srcdir/$i -e bye
done

Changes to jni-location.fs.

1
2
3
4
5
6
7
8
..
18
19
20
21
22
23
24


25
26
27
28
29
30
31
32
33
34

35




36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
\ location services

require jni-helper.fs

also jni

jni-class: android/location/Location

................................................................................
jni-class: android/location/LocationManager

jni-method: getAllProviders getAllProviders ()Ljava/util/List;
jni-method: getProviders getProviders (Z)Ljava/util/List;
jni-method: lm-getProvider getProvider (Ljava/lang/String;)Landroid/location/LocationProvider;
jni-method: getLastKnownLocation getLastKnownLocation (Ljava/lang/String;)Landroid/location/Location;



jni-class: android/os/Handler

jni-method: post post (Ljava/lang/Runnable;)Z

gforth-class:

jni-field: gforth-handler handler Landroid/os/Handler;
jni-field: startgps startgps Ljava/lang/Runnable;
jni-field: stopgps stopgps Ljava/lang/Runnable;


jni-method: setgps setgps (JF)V





also android

: start-gps ( -- )
    clazz >o gforth-handler o> >o
    clazz >o startgps o> post o> ;

: stop-gps ( -- )
    clazz >o gforth-handler o> >o
    clazz >o stopgps o> post o> ;

: .deg ( degree -- )
    fdup f0< IF ." -" fnegate THEN
    fdup floor fdup f>s 0 .r '°' xemit f-  60e f*
    fdup floor fdup f>s 0 .r ''' xemit f-  60e f*
    f. ;

|







 







>
>









<
>
|
>
>
>
>





|



|







1
2
3
4
5
6
7
8
..
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
\ location+sensor services

require jni-helper.fs

also jni

jni-class: android/location/Location

................................................................................
jni-class: android/location/LocationManager

jni-method: getAllProviders getAllProviders ()Ljava/util/List;
jni-method: getProviders getProviders (Z)Ljava/util/List;
jni-method: lm-getProvider getProvider (Ljava/lang/String;)Landroid/location/LocationProvider;
jni-method: getLastKnownLocation getLastKnownLocation (Ljava/lang/String;)Landroid/location/Location;

jni-class: android/hardware/SensorManager

jni-class: android/os/Handler

jni-method: post post (Ljava/lang/Runnable;)Z

gforth-class:

jni-field: gforth-handler handler Landroid/os/Handler;
jni-field: startgps startgps Ljava/lang/Runnable;
jni-field: stopgps stopgps Ljava/lang/Runnable;

jni-field: startsensor startsensor Ljava/lang/Runnable;
jni-field: stopsensor stopsensor Ljava/lang/Runnable;
jni-field: args0 args0 Ljava/lang/String;
jni-field: argf0 argf0 D
jni-field: argj0 argj0 J
jni-field: argsensor argsensor Landroid/hardware/Sensor;

also android

: start-gps ( -- )
    clazz >o gforth-handler o> >o
    clazz >o startgps o> post o> drop ;

: stop-gps ( -- )
    clazz >o gforth-handler o> >o
    clazz >o stopgps o> post o> drop ;

: .deg ( degree -- )
    fdup f0< IF ." -" fnegate THEN
    fdup floor fdup f>s 0 .r '°' xemit f-  60e f*
    fdup floor fdup f>s 0 .r ''' xemit f-  60e f*
    f. ;