]> gitweb.factorcode.org Git - factor.git/blob - extra/mttest/mttest.factor
quick test vocab for mt stuff
[factor.git] / extra / mttest / mttest.factor
1 USING: alien.syntax io io.encodings.utf16n io.encodings.utf8 io.files
2 kernel namespaces sequences system threads unix.utilities ;
3 IN: mttest
4
5 FUNCTION: void* start_standalone_factor_in_new_thread ( int argc, char** argv ) ;
6
7 HOOK: native-string-encoding os ( -- encoding )
8 M: windows native-string-encoding utf16n ;
9 M: unix native-string-encoding utf8 ;
10
11 : start-vm-in-os-thread ( args -- threadhandle )
12     \ vm get-global prefix 
13     [ length ] [ native-string-encoding strings>alien ] bi 
14      start_standalone_factor_in_new_thread ;
15
16 : start-tetris-in-os-thread ( -- )
17      { "-run=tetris" } start-vm-in-os-thread drop ;
18
19 : start-testthread-in-os-thread ( -- )
20      { "-run=mttest" } start-vm-in-os-thread drop ;
21  
22 : testthread ( -- )
23      "/tmp/hello" utf8 [ "hello!\n" write ] with-file-appender 5000000 sleep ;
24
25 MAIN: testthread