I/O code fixes; it now works on FreeBSD 4.11

cvs
Slava Pestov 2005-04-23 21:42:42 +00:00
parent 63047aea90
commit 9baf908d86
8 changed files with 98 additions and 69 deletions

View File

@ -1,18 +1,3 @@
- faster layout
- faster repaint
- linux/ppc and mac os x ffi
- stream server can hang because of exception handler limitations
- better i/o scheduler
- add a socket timeout
- unix ffi i/o
- powerpc has weird callstack residue
- console with presentations
- renumber types appopriately
- stop word needs a fix
- fix logging
- re-add httpd to bootstrap
- linux? freebsd? words, linux i/o stuff
+ plugin: + plugin:
- extract word: if selection empty, move caret to new word after - extract word: if selection empty, move caret to new word after
@ -21,6 +6,9 @@
+ ui: + ui:
- faster layout
- faster repaint
- console with presentations
- ui browser - ui browser
- auto-updating inspector - auto-updating inspector
- word preview for parsing words - word preview for parsing words
@ -79,6 +67,8 @@
+ kernel: + kernel:
- powerpc has weird callstack residue
- .factor-rc loading errors are not reported properly
- instances: do not use make-list - instances: do not use make-list
- unions containing tuples do not work properly - unions containing tuples do not work properly
- need G: combinations - need G: combinations
@ -86,7 +76,6 @@
- code walker & exceptions - code walker & exceptions
- string sub-primitives - string sub-primitives
- clean up metaclasses - clean up metaclasses
- unify unparse and prettyprint
- condition system with restarts - condition system with restarts
- nicer way to combine two paths - nicer way to combine two paths
- vectors: ensure its ok with bignum indices - vectors: ensure its ok with bignum indices
@ -95,6 +84,24 @@
- doc comments of generics - doc comments of generics
- proper ordering for classes - proper ordering for classes
+ i/o:
- separate words for writing characters and strings
- perhaps:
GENERIC: set-style ( style stream -- )
GENERIC: stream-write
GENERIC: stream-write-char
- linux/ppc and mac os x ffi
- stream server can hang because of exception handler limitations
- better i/o scheduler
- add a socket timeout
- unix ffi i/o
- renumber types appopriately
- linux? freebsd? words, linux i/o stuff
- clean up errors
- implement fcopy
- unify unparse and prettyprint
+ nice to have libraries: + nice to have libraries:
- regexps - regexps

View File

@ -38,11 +38,11 @@ hashtables ;
"/library/vocabularies.factor" "/library/vocabularies.factor"
"/library/errors.factor" "/library/errors.factor"
"/library/continuations.factor" "/library/continuations.factor"
"/library/threads.factor"
"/library/io/stream.factor" "/library/io/stream.factor"
"/library/io/stdio.factor" "/library/io/stdio.factor"
"/library/io/c-streams.factor" "/library/io/c-streams.factor"
"/library/io/files.factor" "/library/io/files.factor"
"/library/threads.factor"
"/library/syntax/parse-numbers.factor" "/library/syntax/parse-numbers.factor"
"/library/syntax/parse-words.factor" "/library/syntax/parse-words.factor"
"/library/syntax/parse-errors.factor" "/library/syntax/parse-errors.factor"

View File

@ -48,6 +48,8 @@ t [
"/library/alien/c-types.factor" "/library/alien/c-types.factor"
"/library/alien/compiler.factor" "/library/alien/compiler.factor"
"/library/alien/enums.factor"
"/library/alien/structs.factor"
] pull-in ] pull-in
cpu "x86" = [ cpu "x86" = [

View File

@ -1,10 +1,30 @@
! Copyright (C) 2004, 2005 Slava Pestov. ! Copyright (C) 2004, 2005 Slava Pestov.
! See http://factor.sf.net/license.txt for BSD license. ! See http://factor.sf.net/license.txt for BSD license.
USING: assembler compiler kernel lists namespaces parser USING: alien assembler compiler io-internals kernel lists
sequences stdio unparser ; namespaces parser sequences stdio unparser words ;
"Bootstrap stage 3..." print "Bootstrap stage 3..." print
os "unix" = [
"libc" "libc.so" "cdecl" add-library
] when
os "win32" = [
"kernel32" "kernel32.dll" "stdcall" add-library
"user32" "user32.dll" "stdcall" add-library
"gdi32" "gdi32.dll" "stdcall" add-library
"winsock" "ws2_32.dll" "stdcall" add-library
"mswsock" "mswsock.dll" "stdcall" add-library
"libc" "msvcrt.dll" "cdecl" add-library
"sdl" "SDL.dll" "cdecl" add-library
"sdl-gfx" "SDL_gfx.dll" "cdecl" add-library
"sdl-ttf" "SDL_ttf.dll" "cdecl" add-library
! FIXME: KLUDGE to get FFI-based IO going in Windows.
"/library/bootstrap/win32-io.factor" run-resource
] when
"/library/io/buffer.factor" run-resource
"compile" get supported-cpu? and [ "compile" get supported-cpu? and [
init-assembler init-assembler
\ car compile \ car compile
@ -12,12 +32,28 @@ sequences stdio unparser ;
\ length compile \ length compile
\ unparse compile \ unparse compile
\ scan compile \ scan compile
[
"imalloc" "ifree" "irealloc" "imemcpy"
] [
[ "io-internals" ] search compile
] each
os "unix" = [
"/library/unix/syscalls.factor"
"/library/unix/io.factor"
"/library/unix/sockets.factor"
"/library/unix/files.factor"
] pull-in
os "unix" = [
"unix-internals" words [ compile ] each
] when
init-io
] when ] when
t [ t [
"/library/alien/enums.factor"
"/library/alien/structs.factor"
"/library/math/constants.factor" "/library/math/constants.factor"
"/library/math/pow.factor" "/library/math/pow.factor"
"/library/math/trig-hyp.factor" "/library/math/trig-hyp.factor"
@ -27,8 +63,6 @@ t [
"/library/random.factor" "/library/random.factor"
"/library/io/directories.factor" "/library/io/directories.factor"
"/library/io/buffer.factor"
! "/library/io/logging.factor"
"/library/io/stdio-binary.factor" "/library/io/stdio-binary.factor"
"/library/eval-catch.factor" "/library/eval-catch.factor"
@ -39,29 +73,34 @@ t [
"/library/syntax/see.factor" "/library/syntax/see.factor"
"/library/test/test.factor" "/library/test/test.factor"
"/library/inference/test.factor" "/library/inference/test.factor"
! "/library/tools/telnetd.factor"
! "/library/tools/jedit-wire.factor"
"/library/tools/profiler.factor" "/library/tools/profiler.factor"
"/library/tools/walker.factor" "/library/tools/walker.factor"
"/library/tools/annotations.factor" "/library/tools/annotations.factor"
! "/library/tools/jedit.factor"
"/library/tools/dump.factor" "/library/tools/dump.factor"
"/library/bootstrap/image.factor" "/library/bootstrap/image.factor"
] pull-in
! "/library/httpd/url-encoding.factor" "compile" get "mini" get not and [
! "/library/httpd/mime.factor" "/library/io/logging.factor"
! "/library/httpd/html-tags.factor"
! "/library/httpd/html.factor" "/library/tools/telnetd.factor"
! "/library/httpd/http-common.factor" "/library/tools/jedit-wire.factor"
! "/library/httpd/responder.factor" "/library/tools/jedit.factor"
! "/library/httpd/httpd.factor"
! "/library/httpd/file-responder.factor" "/library/httpd/url-encoding.factor"
! "/library/httpd/test-responder.factor" "/library/httpd/mime.factor"
! "/library/httpd/quit-responder.factor" "/library/httpd/html-tags.factor"
! "/library/httpd/resource-responder.factor" "/library/httpd/html.factor"
! "/library/httpd/cont-responder.factor" "/library/httpd/http-common.factor"
! "/library/httpd/browser-responder.factor" "/library/httpd/responder.factor"
! "/library/httpd/default-responders.factor" "/library/httpd/httpd.factor"
"/library/httpd/file-responder.factor"
"/library/httpd/test-responder.factor"
"/library/httpd/quit-responder.factor"
"/library/httpd/resource-responder.factor"
"/library/httpd/cont-responder.factor"
"/library/httpd/browser-responder.factor"
"/library/httpd/default-responders.factor"
"/library/sdl/sdl.factor" "/library/sdl/sdl.factor"
"/library/sdl/sdl-video.factor" "/library/sdl/sdl-video.factor"
@ -115,10 +154,6 @@ os "win32" = [
"/library/win32/win32-server.factor" "/library/win32/win32-server.factor"
] pull-in ] pull-in
os "unix" = [
"/library/unix/syscalls.factor"
] pull-in
FORGET: pull-in FORGET: pull-in
"/library/bootstrap/boot-stage4.factor" dup print run-resource "/library/bootstrap/boot-stage4.factor" dup print run-resource

View File

@ -33,24 +33,6 @@ words ;
warm-boot warm-boot
os "win32" = [
"kernel32" "kernel32.dll" "stdcall" add-library
"user32" "user32.dll" "stdcall" add-library
"gdi32" "gdi32.dll" "stdcall" add-library
"winsock" "ws2_32.dll" "stdcall" add-library
"mswsock" "mswsock.dll" "stdcall" add-library
"libc" "msvcrt.dll" "cdecl" add-library
"sdl" "SDL.dll" "cdecl" add-library
"sdl-gfx" "SDL_gfx.dll" "cdecl" add-library
"sdl-ttf" "SDL_ttf.dll" "cdecl" add-library
! FIXME: KLUDGE to get FFI-based IO going in Windows.
"/library/bootstrap/win32-io.factor" run-resource
] when
os "unix" = [
"libc" "libc.so" "cdecl" add-library
] when
"Compiling system..." print "Compiling system..." print
"compile" get [ compile-all ] when "compile" get [ compile-all ] when

View File

@ -7,7 +7,7 @@ USING: io-internals namespaces parser stdio threads words ;
#! Initialize an interpreter with the basic services. #! Initialize an interpreter with the basic services.
global >n global >n
init-threads init-threads
init-c-io init-io
"HOME" os-env [ "." ] unless* "~" set "HOME" os-env [ "." ] unless* "~" set
init-search-path ; init-search-path ;

View File

@ -27,8 +27,7 @@ namespaces ;
next-thread [ next-thread [
call call
] [ ] [
"No more tasks" throw io-multiplex [ call ] [ stop ] ifte*
! next-io-task [ call ] [ stop ] ifte*
] ifte* ; ] ifte* ;
: yield ( -- ) : yield ( -- )

View File

@ -182,7 +182,7 @@ M: read-line-task io-task-events ( task -- events )
drop drop
] [ ] [
[ [
swap <read-line-task> add-io-task io-multiplex swap <read-line-task> add-io-task stop
] callcc0 drop ] callcc0 drop
] ifte ; ] ifte ;
@ -228,7 +228,7 @@ M: read-task io-task-events ( task -- events )
2drop 2drop
] [ ] [
[ [
swap <read-task> add-io-task io-multiplex swap <read-task> add-io-task stop
] callcc0 2drop ] callcc0 2drop
] ifte ; ] ifte ;
@ -296,7 +296,7 @@ M: write-task io-task-events ( task -- events )
M: writer stream-flush ( stream -- ) M: writer stream-flush ( stream -- )
[ [
swap <write-task> add-write-io-task io-multiplex swap <write-task> add-write-io-task stop
] callcc0 drop ; ] callcc0 drop ;
M: writer stream-auto-flush ( stream -- ) drop ; M: writer stream-auto-flush ( stream -- ) drop ;
@ -344,3 +344,7 @@ M: writer stream-close ( stream -- )
<namespace> io-tasks set <namespace> io-tasks set
0 1 t <fd-stream> stdio set 0 1 t <fd-stream> stdio set
] bind ; ] bind ;
IN: streams
: fcopy 2drop ;