Clean up some of Dan's code after merge
parent
d95231cc43
commit
549a7538c7
|
@ -623,6 +623,7 @@ builtins get num-tags get tail f union-class define-class
|
||||||
{ "fopen" "io.streams.c" }
|
{ "fopen" "io.streams.c" }
|
||||||
{ "fgetc" "io.streams.c" }
|
{ "fgetc" "io.streams.c" }
|
||||||
{ "fread" "io.streams.c" }
|
{ "fread" "io.streams.c" }
|
||||||
|
{ "fputc" "io.streams.c" }
|
||||||
{ "fwrite" "io.streams.c" }
|
{ "fwrite" "io.streams.c" }
|
||||||
{ "fflush" "io.streams.c" }
|
{ "fflush" "io.streams.c" }
|
||||||
{ "fclose" "io.streams.c" }
|
{ "fclose" "io.streams.c" }
|
||||||
|
|
|
@ -538,6 +538,8 @@ set-primitive-effect
|
||||||
|
|
||||||
\ fwrite { string alien } { } <effect> set-primitive-effect
|
\ fwrite { string alien } { } <effect> set-primitive-effect
|
||||||
|
|
||||||
|
\ fputc { object alien } { } <effect> set-primitive-effect
|
||||||
|
|
||||||
\ fread { integer string } { object } <effect> set-primitive-effect
|
\ fread { integer string } { object } <effect> set-primitive-effect
|
||||||
|
|
||||||
\ fflush { alien } { } <effect> set-primitive-effect
|
\ fflush { alien } { } <effect> set-primitive-effect
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
USING: arrays io io.files kernel math parser strings system
|
USING: arrays io io.files kernel math parser strings system
|
||||||
tools.test words namespaces io.encodings.ascii io.encodings.binary ;
|
tools.test words namespaces io.encodings.latin1
|
||||||
|
io.encodings.binary ;
|
||||||
IN: io.tests
|
IN: io.tests
|
||||||
|
|
||||||
[ f ] [
|
[ f ] [
|
||||||
|
@ -8,7 +9,7 @@ IN: io.tests
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
: <resource-reader> ( resource -- stream )
|
: <resource-reader> ( resource -- stream )
|
||||||
resource-path binary <file-reader> ;
|
resource-path latin1 <file-reader> ;
|
||||||
|
|
||||||
[
|
[
|
||||||
"This is a line.\rThis is another line.\r"
|
"This is a line.\rThis is another line.\r"
|
||||||
|
@ -31,10 +32,10 @@ IN: io.tests
|
||||||
|
|
||||||
! [ ] [ "123" write 9000 CHAR: x <string> write flush ] unit-test
|
! [ ] [ "123" write 9000 CHAR: x <string> write flush ] unit-test
|
||||||
|
|
||||||
[ "" ] [
|
[
|
||||||
"/core/io/test/binary.txt" <resource-reader>
|
"/core/io/test/binary.txt" <resource-reader>
|
||||||
[ 0.2 read ] with-stream
|
[ 0.2 read ] with-stream
|
||||||
] unit-test
|
] must-fail
|
||||||
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
USING: tools.test io.files io io.streams.c io.encodings.ascii ;
|
USING: tools.test io.files io io.streams.c
|
||||||
|
io.encodings.ascii strings ;
|
||||||
IN: io.streams.c.tests
|
IN: io.streams.c.tests
|
||||||
|
|
||||||
[ "hello world" ] [
|
[ "hello world" ] [
|
||||||
|
@ -7,4 +8,5 @@ IN: io.streams.c.tests
|
||||||
] with-file-writer
|
] with-file-writer
|
||||||
|
|
||||||
"test.txt" temp-file "rb" fopen <c-reader> contents
|
"test.txt" temp-file "rb" fopen <c-reader> contents
|
||||||
|
>string
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
! Copyright (C) 2004, 2008 Slava Pestov.
|
! Copyright (C) 2004, 2008 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: kernel kernel.private namespaces io io.encodings
|
USING: kernel kernel.private namespaces io io.encodings
|
||||||
strings sequences math generic threads.private classes
|
sequences math generic threads.private classes io.backend
|
||||||
io.backend io.streams.duplex io.files continuations
|
io.streams.duplex io.files continuations byte-arrays ;
|
||||||
io.encodings.utf8 ;
|
|
||||||
IN: io.streams.c
|
IN: io.streams.c
|
||||||
|
|
||||||
TUPLE: c-writer handle ;
|
TUPLE: c-writer handle ;
|
||||||
|
@ -11,10 +10,10 @@ TUPLE: c-writer handle ;
|
||||||
C: <c-writer> c-writer
|
C: <c-writer> c-writer
|
||||||
|
|
||||||
M: c-writer stream-write1
|
M: c-writer stream-write1
|
||||||
>r 1string r> stream-write ;
|
c-writer-handle fputc ;
|
||||||
|
|
||||||
M: c-writer stream-write
|
M: c-writer stream-write
|
||||||
>r >string r> c-writer-handle fwrite ;
|
c-writer-handle fwrite ;
|
||||||
|
|
||||||
M: c-writer stream-flush
|
M: c-writer stream-flush
|
||||||
c-writer-handle fflush ;
|
c-writer-handle fflush ;
|
||||||
|
@ -27,7 +26,7 @@ TUPLE: c-reader handle ;
|
||||||
C: <c-reader> c-reader
|
C: <c-reader> c-reader
|
||||||
|
|
||||||
M: c-reader stream-read
|
M: c-reader stream-read
|
||||||
>r >fixnum r> c-reader-handle fread ;
|
c-reader-handle fread ;
|
||||||
|
|
||||||
M: c-reader stream-read-partial
|
M: c-reader stream-read-partial
|
||||||
stream-read ;
|
stream-read ;
|
||||||
|
@ -43,7 +42,7 @@ M: c-reader stream-read1
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
M: c-reader stream-read-until
|
M: c-reader stream-read-until
|
||||||
[ swap read-until-loop ] "" make swap
|
[ swap read-until-loop ] B{ } make swap
|
||||||
over empty? over not and [ 2drop f f ] when ;
|
over empty? over not and [ 2drop f f ] when ;
|
||||||
|
|
||||||
M: c-reader dispose
|
M: c-reader dispose
|
||||||
|
@ -76,4 +75,6 @@ M: object (file-appender)
|
||||||
#! print stuff from contexts where the I/O system would
|
#! print stuff from contexts where the I/O system would
|
||||||
#! otherwise not work (tools.deploy.shaker, the I/O
|
#! otherwise not work (tools.deploy.shaker, the I/O
|
||||||
#! multiplexer thread).
|
#! multiplexer thread).
|
||||||
"\r\n" append stdout-handle fwrite stdout-handle fflush ;
|
"\r\n" append >byte-array
|
||||||
|
stdout-handle fwrite
|
||||||
|
stdout-handle fflush ;
|
||||||
|
|
|
@ -4,7 +4,7 @@ USING: assocs kernel namespaces io io.timeouts strings splitting
|
||||||
threads http sequences prettyprint io.server logging calendar
|
threads http sequences prettyprint io.server logging calendar
|
||||||
new-slots html.elements accessors math.parser combinators.lib
|
new-slots html.elements accessors math.parser combinators.lib
|
||||||
vocabs.loader debugger html continuations random combinators
|
vocabs.loader debugger html continuations random combinators
|
||||||
destructors ;
|
destructors io.encodings.latin1 ;
|
||||||
IN: http.server
|
IN: http.server
|
||||||
|
|
||||||
GENERIC: call-responder ( request path responder -- response )
|
GENERIC: call-responder ( request path responder -- response )
|
||||||
|
@ -165,7 +165,7 @@ LOG: httpd-hit NOTICE
|
||||||
|
|
||||||
: httpd ( port -- )
|
: httpd ( port -- )
|
||||||
internet-server "http.server"
|
internet-server "http.server"
|
||||||
binary [ handle-client ] with-server ;
|
latin1 [ handle-client ] with-server ;
|
||||||
|
|
||||||
: httpd-main ( -- ) 8888 httpd ;
|
: httpd-main ( -- ) 8888 httpd ;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
IN: io.nonblocking
|
IN: io.nonblocking
|
||||||
USING: math kernel io sequences io.buffers io.timeouts generic
|
USING: math kernel io sequences io.buffers io.timeouts generic
|
||||||
sbufs system io.streams.duplex io.encodings
|
byte-vectors system io.streams.duplex io.encodings
|
||||||
io.backend continuations debugger classes byte-arrays namespaces
|
io.backend continuations debugger classes byte-arrays namespaces
|
||||||
splitting dlists assocs io.encodings.binary ;
|
splitting dlists assocs io.encodings.binary ;
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ GENERIC: (wait-to-read) ( port -- )
|
||||||
M: input-port stream-read1
|
M: input-port stream-read1
|
||||||
dup wait-to-read1 [ buffer-pop ] unless-eof ;
|
dup wait-to-read1 [ buffer-pop ] unless-eof ;
|
||||||
|
|
||||||
: read-step ( count port -- string/f )
|
: read-step ( count port -- byte-array/f )
|
||||||
[ wait-to-read ] 2keep
|
[ wait-to-read ] 2keep
|
||||||
[ dupd buffer> ] unless-eof nip ;
|
[ dupd buffer> ] unless-eof nip ;
|
||||||
|
|
||||||
|
@ -90,10 +90,10 @@ M: input-port stream-read
|
||||||
>r 0 max >fixnum r>
|
>r 0 max >fixnum r>
|
||||||
2dup read-step dup [
|
2dup read-step dup [
|
||||||
pick over length > [
|
pick over length > [
|
||||||
pick <sbuf>
|
pick <byte-vector>
|
||||||
[ push-all ] keep
|
[ push-all ] keep
|
||||||
[ read-loop ] keep
|
[ read-loop ] keep
|
||||||
"" like
|
B{ } like
|
||||||
] [
|
] [
|
||||||
2nip
|
2nip
|
||||||
] if
|
] if
|
||||||
|
@ -101,7 +101,7 @@ M: input-port stream-read
|
||||||
2nip
|
2nip
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
: read-until-step ( separators port -- string/f separator/f )
|
: read-until-step ( separators port -- byte-array/f separator/f )
|
||||||
dup wait-to-read1
|
dup wait-to-read1
|
||||||
dup port-eof? [
|
dup port-eof? [
|
||||||
f swap set-port-eof? drop f f
|
f swap set-port-eof? drop f f
|
||||||
|
@ -109,7 +109,7 @@ M: input-port stream-read
|
||||||
buffer-until
|
buffer-until
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
: read-until-loop ( seps port sbuf -- separator/f )
|
: read-until-loop ( seps port byte-vector -- separator/f )
|
||||||
2over read-until-step over [
|
2over read-until-step over [
|
||||||
>r over push-all r> dup [
|
>r over push-all r> dup [
|
||||||
>r 3drop r>
|
>r 3drop r>
|
||||||
|
@ -120,18 +120,20 @@ M: input-port stream-read
|
||||||
>r 2drop 2drop r>
|
>r 2drop 2drop r>
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
M: input-port stream-read-until ( seps port -- str/f sep/f )
|
M: input-port stream-read-until ( seps port -- byte-array/f sep/f )
|
||||||
2dup read-until-step dup [
|
2dup read-until-step dup [
|
||||||
>r 2nip r>
|
>r 2nip r>
|
||||||
] [
|
] [
|
||||||
over [
|
over [
|
||||||
drop >sbuf [ read-until-loop ] keep "" like swap
|
drop >byte-vector
|
||||||
|
[ read-until-loop ] keep
|
||||||
|
B{ } like swap
|
||||||
] [
|
] [
|
||||||
>r 2nip r>
|
>r 2nip r>
|
||||||
] if
|
] if
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
M: input-port stream-read-partial ( max stream -- string/f )
|
M: input-port stream-read-partial ( max stream -- byte-array/f )
|
||||||
>r 0 max >fixnum r> read-step ;
|
>r 0 max >fixnum r> read-step ;
|
||||||
|
|
||||||
: can-write? ( len writer -- ? )
|
: can-write? ( len writer -- ? )
|
||||||
|
@ -169,7 +171,7 @@ M: port dispose
|
||||||
[ dup port-type >r closed over set-port-type r> close-port ]
|
[ dup port-type >r closed over set-port-type r> close-port ]
|
||||||
if ;
|
if ;
|
||||||
|
|
||||||
TUPLE: server-port addr client encoding ;
|
TUPLE: server-port addr client client-addr encoding ;
|
||||||
|
|
||||||
: <server-port> ( handle addr encoding -- server )
|
: <server-port> ( handle addr encoding -- server )
|
||||||
rot f server-port <port>
|
rot f server-port <port>
|
||||||
|
|
|
@ -33,17 +33,19 @@ M: array client* [ (client) 2array ] attempt-all first2 ;
|
||||||
M: object client* (client) ;
|
M: object client* (client) ;
|
||||||
|
|
||||||
: <client> ( addrspec encoding -- stream )
|
: <client> ( addrspec encoding -- stream )
|
||||||
over client* rot <encoder-duplex> <client-stream> ;
|
>r client* r> <encoder-duplex> ;
|
||||||
|
|
||||||
HOOK: (server) io-backend ( addrspec -- handle )
|
HOOK: (server) io-backend ( addrspec -- handle )
|
||||||
|
|
||||||
: <server> ( addrspec encoding -- server )
|
: <server> ( addrspec encoding -- server )
|
||||||
>r [ (server) ] keep r> <server-port> ;
|
>r [ (server) ] keep r> <server-port> ;
|
||||||
|
|
||||||
HOOK: (accept) io-backend ( server -- stream-in stream-out )
|
HOOK: (accept) io-backend ( server -- addrspec handle )
|
||||||
|
|
||||||
: accept ( server -- client )
|
: accept ( server -- client )
|
||||||
[ (accept) ] keep server-port-encoding <encoder-duplex> ;
|
[ (accept) dup <reader&writer> ] keep
|
||||||
|
server-port-encoding <encoder-duplex>
|
||||||
|
<client-stream> ;
|
||||||
|
|
||||||
HOOK: <datagram> io-backend ( addrspec -- datagram )
|
HOOK: <datagram> io-backend ( addrspec -- datagram )
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ M: connect-task do-io-task
|
||||||
: wait-to-connect ( port -- )
|
: wait-to-connect ( port -- )
|
||||||
[ <connect-task> add-io-task ] with-port-continuation drop ;
|
[ <connect-task> add-io-task ] with-port-continuation drop ;
|
||||||
|
|
||||||
M: unix-io (client) ( addrspec -- stream )
|
M: unix-io (client) ( addrspec -- client-in client-out )
|
||||||
dup make-sockaddr/size >r >r
|
dup make-sockaddr/size >r >r
|
||||||
protocol-family SOCK_STREAM socket-fd
|
protocol-family SOCK_STREAM socket-fd
|
||||||
dup r> r> connect
|
dup r> r> connect
|
||||||
|
@ -71,10 +71,10 @@ TUPLE: accept-task ;
|
||||||
dup <c-object> [ swap heap-size <int> accept ] keep ; inline
|
dup <c-object> [ swap heap-size <int> accept ] keep ; inline
|
||||||
|
|
||||||
: do-accept ( port fd sockaddr -- )
|
: do-accept ( port fd sockaddr -- )
|
||||||
rot [
|
rot
|
||||||
server-port-addr parse-sockaddr
|
[ server-port-addr parse-sockaddr ] keep
|
||||||
swap dup <reader&writer> <duplex-stream> <client-stream>
|
[ set-server-port-client-addr ] keep
|
||||||
] keep set-server-port-client ;
|
set-server-port-client ;
|
||||||
|
|
||||||
M: accept-task do-io-task
|
M: accept-task do-io-task
|
||||||
io-task-port dup accept-sockaddr
|
io-task-port dup accept-sockaddr
|
||||||
|
@ -95,13 +95,13 @@ M: unix-io (server) ( addrspec -- handle )
|
||||||
SOCK_STREAM server-fd
|
SOCK_STREAM server-fd
|
||||||
dup 10 listen zero? [ dup close (io-error) ] unless ;
|
dup 10 listen zero? [ dup close (io-error) ] unless ;
|
||||||
|
|
||||||
M: unix-io (accept) ( server -- client-in client-out )
|
M: unix-io (accept) ( server -- addrspec handle )
|
||||||
#! Wait for a client connection.
|
#! Wait for a client connection.
|
||||||
dup check-server-port
|
dup check-server-port
|
||||||
dup wait-to-accept
|
dup wait-to-accept
|
||||||
dup pending-error
|
dup pending-error
|
||||||
server-port-client
|
dup server-port-client-addr
|
||||||
{ duplex-stream-in duplex-stream-out } get-slots ;
|
swap server-port-client ;
|
||||||
|
|
||||||
! Datagram sockets - UDP and Unix domain
|
! Datagram sockets - UDP and Unix domain
|
||||||
M: unix-io <datagram>
|
M: unix-io <datagram>
|
||||||
|
|
|
@ -45,13 +45,12 @@ TUPLE: ConnectEx-args port
|
||||||
"stdcall" alien-indirect drop
|
"stdcall" alien-indirect drop
|
||||||
winsock-error-string [ throw ] when* ;
|
winsock-error-string [ throw ] when* ;
|
||||||
|
|
||||||
: connect-continuation ( ConnectEx -- )
|
: connect-continuation ( ConnectEx port -- )
|
||||||
dup ConnectEx-args-lpOverlapped*
|
>r ConnectEx-args-lpOverlapped* r>
|
||||||
swap ConnectEx-args-port duplex-stream-in
|
2dup save-callback
|
||||||
[ save-callback ] 2keep
|
|
||||||
get-overlapped-result drop ;
|
get-overlapped-result drop ;
|
||||||
|
|
||||||
M: windows-nt-io (client) ( addrspec -- duplex-stream )
|
M: windows-nt-io (client) ( addrspec -- client-in client-out )
|
||||||
[
|
[
|
||||||
\ ConnectEx-args construct-empty
|
\ ConnectEx-args construct-empty
|
||||||
over make-sockaddr/size pick init-connect
|
over make-sockaddr/size pick init-connect
|
||||||
|
@ -61,14 +60,8 @@ M: windows-nt-io (client) ( addrspec -- duplex-stream )
|
||||||
dup ConnectEx-args-s* INADDR_ANY roll bind-socket
|
dup ConnectEx-args-s* INADDR_ANY roll bind-socket
|
||||||
dup (ConnectEx)
|
dup (ConnectEx)
|
||||||
|
|
||||||
dup ConnectEx-args-s* <win32-socket>
|
dup ConnectEx-args-s* <win32-socket> dup <reader&writer>
|
||||||
dup <reader&writer> <duplex-stream>
|
>r [ connect-continuation ] keep [ pending-error ] keep r>
|
||||||
over set-ConnectEx-args-port
|
|
||||||
|
|
||||||
dup connect-continuation
|
|
||||||
ConnectEx-args-port
|
|
||||||
[ duplex-stream-in pending-error ] keep
|
|
||||||
[ duplex-stream-out pending-error ] keep
|
|
||||||
] with-destructors ;
|
] with-destructors ;
|
||||||
|
|
||||||
TUPLE: AcceptEx-args port
|
TUPLE: AcceptEx-args port
|
||||||
|
@ -118,17 +111,15 @@ TUPLE: AcceptEx-args port
|
||||||
] keep *void*
|
] keep *void*
|
||||||
] keep AcceptEx-args-port server-port-addr parse-sockaddr ;
|
] keep AcceptEx-args-port server-port-addr parse-sockaddr ;
|
||||||
|
|
||||||
: accept-continuation ( AcceptEx -- client )
|
: accept-continuation ( AcceptEx -- addrspec client )
|
||||||
[ make-accept-continuation ] keep
|
[ make-accept-continuation ] keep
|
||||||
[ check-accept-error ] keep
|
[ check-accept-error ] keep
|
||||||
[ extract-remote-host ] keep
|
[ extract-remote-host ] keep
|
||||||
! addrspec AcceptEx
|
! addrspec AcceptEx
|
||||||
[
|
[ AcceptEx-args-sAcceptSocket* add-completion ] keep
|
||||||
AcceptEx-args-sAcceptSocket* add-completion
|
|
||||||
] keep
|
|
||||||
AcceptEx-args-sAcceptSocket* <win32-socket> ;
|
AcceptEx-args-sAcceptSocket* <win32-socket> ;
|
||||||
|
|
||||||
M: windows-nt-io (accept) ( server -- client-in client-out )
|
M: windows-nt-io (accept) ( server -- addrspec handle )
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
dup check-server-port
|
dup check-server-port
|
||||||
|
@ -137,8 +128,6 @@ M: windows-nt-io (accept) ( server -- client-in client-out )
|
||||||
[ ((accept)) ] keep
|
[ ((accept)) ] keep
|
||||||
[ accept-continuation ] keep
|
[ accept-continuation ] keep
|
||||||
AcceptEx-args-port pending-error
|
AcceptEx-args-port pending-error
|
||||||
dup duplex-stream-in pending-error
|
|
||||||
dup duplex-stream-out pending-error
|
|
||||||
] with-timeout
|
] with-timeout
|
||||||
] with-destructors ;
|
] with-destructors ;
|
||||||
|
|
||||||
|
|
39
vm/io.c
39
vm/io.c
|
@ -102,21 +102,46 @@ DEFINE_PRIMITIVE(fread)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dpush(tag_object(memory_to_char_string(
|
if(c != size)
|
||||||
(char *)(buf + 1),c)));
|
{
|
||||||
|
REGISTER_UNTAGGED(buf);
|
||||||
|
F_BYTE_ARRAY *new_buf = allot_byte_array(c);
|
||||||
|
UNREGISTER_UNTAGGED(buf);
|
||||||
|
memcpy(new_buf + 1, buf + 1,c);
|
||||||
|
buf = new_buf;
|
||||||
|
}
|
||||||
|
dpush(tag_object(buf));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFINE_PRIMITIVE(fputc)
|
||||||
|
{
|
||||||
|
FILE *file = unbox_alien();
|
||||||
|
F_FIXNUM ch = to_fixnum(dpop());
|
||||||
|
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
if(fputc(ch,file) == EOF)
|
||||||
|
{
|
||||||
|
io_error();
|
||||||
|
|
||||||
|
/* Still here? EINTR */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DEFINE_PRIMITIVE(fwrite)
|
DEFINE_PRIMITIVE(fwrite)
|
||||||
{
|
{
|
||||||
FILE* file = unbox_alien();
|
FILE *file = unbox_alien();
|
||||||
F_STRING* text = untag_string(dpop());
|
F_BYTE_ARRAY *text = untag_byte_array(dpop());
|
||||||
F_FIXNUM length = untag_fixnum_fast(text->length);
|
F_FIXNUM length = array_capacity(text);
|
||||||
char* string = to_char_string(text,false);
|
char *string = (char *)(text + 1);
|
||||||
|
|
||||||
if(string_capacity(text) == 0)
|
if(length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for(;;)
|
for(;;)
|
||||||
|
|
5
vm/io.h
5
vm/io.h
|
@ -3,11 +3,12 @@ void io_error(void);
|
||||||
int err_no(void);
|
int err_no(void);
|
||||||
|
|
||||||
DECLARE_PRIMITIVE(fopen);
|
DECLARE_PRIMITIVE(fopen);
|
||||||
|
DECLARE_PRIMITIVE(fgetc);
|
||||||
|
DECLARE_PRIMITIVE(fread);
|
||||||
|
DECLARE_PRIMITIVE(fputc);
|
||||||
DECLARE_PRIMITIVE(fwrite);
|
DECLARE_PRIMITIVE(fwrite);
|
||||||
DECLARE_PRIMITIVE(fflush);
|
DECLARE_PRIMITIVE(fflush);
|
||||||
DECLARE_PRIMITIVE(fclose);
|
DECLARE_PRIMITIVE(fclose);
|
||||||
DECLARE_PRIMITIVE(fgetc);
|
|
||||||
DECLARE_PRIMITIVE(fread);
|
|
||||||
|
|
||||||
/* Platform specific primitives */
|
/* Platform specific primitives */
|
||||||
DECLARE_PRIMITIVE(open_file);
|
DECLARE_PRIMITIVE(open_file);
|
||||||
|
|
|
@ -162,6 +162,7 @@ void *primitives[] = {
|
||||||
primitive_fopen,
|
primitive_fopen,
|
||||||
primitive_fgetc,
|
primitive_fgetc,
|
||||||
primitive_fread,
|
primitive_fread,
|
||||||
|
primitive_fputc,
|
||||||
primitive_fwrite,
|
primitive_fwrite,
|
||||||
primitive_fflush,
|
primitive_fflush,
|
||||||
primitive_fclose,
|
primitive_fclose,
|
||||||
|
|
Loading…
Reference in New Issue