Unix I/O fixes

cvs
Slava Pestov 2005-04-27 05:40:09 +00:00
parent beb9861feb
commit 4e8da1f829
5 changed files with 66 additions and 47 deletions

View File

@ -1,17 +1,27 @@
+ plugin: 0.74:
- if external factor is down, don't add tons of random shit to the dictionary
- extract word: if selection empty, move caret to new word after
- introduce quotation command
- set 'end' of artifacts/assets accurately
+ ui:
- faster layout - faster layout
- faster repaint - faster repaint
- linux? bsd? words
- forgotten words not removed from cross-reference
- get all-tests to run with -no-compile
- review errno
- mac os x ffi
- linux i/o
- implement fcopy
- fix httpd
- fix jedit plugin
- if external factor is down, don't add tons of random shit to the dictionary
- scalar * matrix, vector * matrix, matrix * vector need to work
- turning vectors into row and column matrices
- make-matrix is slow and ugly
- move 2repeat somewhere else
+ ui:
- console with presentations - console with presentations
- ui browser - ui browser
- auto-updating inspector - auto-updating inspector, mirrors abstraction
- word preview for parsing words - word preview for parsing words
- mouse enter onto overlapping with interior, but not child, gadget - mouse enter onto overlapping with interior, but not child, gadget
- menu dragging - menu dragging
@ -25,7 +35,7 @@
- ffi unicode strings: null char security hole - ffi unicode strings: null char security hole
- utf16 string boxing - utf16 string boxing
- value type structs - value type structs
- out parameters - out parameter cleanup
- bitfields in C structs - bitfields in C structs
- SDL_Rect** type - SDL_Rect** type
- setting struct members that are not * - setting struct members that are not *
@ -35,7 +45,6 @@
+ compiler: + compiler:
- alien primitives need a more general input type - alien primitives need a more general input type
- linux? bsd? words
- [ [ dup call ] dup call ] infer hangs - [ [ dup call ] dup call ] infer hangs
- more accurate types for various words - more accurate types for various words
- declarations - declarations
@ -69,8 +78,7 @@
+ kernel: + kernel:
- forgotten words not removed from cross-reference - rename prettyprint to pprint
- get all-tests to run with -no-compile
- powerpc has weird callstack residue - powerpc has weird callstack residue
- .factor-rc loading errors are not reported properly - .factor-rc loading errors are not reported properly
- instances: do not use make-list - instances: do not use make-list
@ -80,30 +88,24 @@
- code walker & exceptions - code walker & exceptions
- string sub-primitives - string sub-primitives
- clean up metaclasses - clean up metaclasses
- condition system with restarts
- nicer way to combine two paths
- vectors: ensure its ok with bignum indices - vectors: ensure its ok with bignum indices
- code gc - code gc
- generational gc - generational gc
- doc comments of generics - doc comments of generics
- proper ordering for classes
- M: object should not inhibit delegation - M: object should not inhibit delegation
+ i/o: + i/o:
- review errno - reader syntax for arrays, byte arrays, displaced aliens
- separate words for writing characters and strings - separate words for writing characters and strings
- perhaps: - perhaps:
GENERIC: set-style ( style stream -- ) GENERIC: set-style ( style stream -- )
GENERIC: stream-write GENERIC: stream-write
GENERIC: stream-write-char GENERIC: stream-write-char
- mac os x ffi
- stream server can hang because of exception handler limitations - stream server can hang because of exception handler limitations
- better i/o scheduler - better i/o scheduler
- add a socket timeout - add a socket timeout
- renumber types appopriately - renumber types appopriately
- linux? freebsd? words, linux i/o stuff
- implement fcopy
- unify unparse and prettyprint - unify unparse and prettyprint
+ nice to have libraries: + nice to have libraries:
@ -121,10 +123,3 @@
- virtual hosts - virtual hosts
- keep alive - keep alive
+ matrix lib:
- scalar * matrix, vector * matrix, matrix * vector need to work
- turning vectors into row and column matrices
- make-matrix is slow and ugly
- move 2repeat somewhere else

View File

@ -41,7 +41,7 @@ builtin [ 2drop t ] "class<" set-word-prop
] ifte ; ] ifte ;
: builtin-class ( symbol type# slotspec -- ) : builtin-class ( symbol type# slotspec -- )
>r 2dup builtins get nth r> >r 2dup builtins get set-nth r>
>r swap >r swap
dup intern-symbol dup intern-symbol
2dup builtin-predicate 2dup builtin-predicate

View File

@ -88,9 +88,11 @@ C: buffer ( size -- buffer )
: buffer-end ( buffer -- int ) dup buffer-ptr swap buffer-fill + ; : buffer-end ( buffer -- int ) dup buffer-ptr swap buffer-fill + ;
: buffer-peek ( buffer -- char )
buffer@ <alien> 0 alien-unsigned-1 ;
: buffer-pop ( buffer -- char ) : buffer-pop ( buffer -- char )
[ buffer@ <alien> 0 alien-unsigned-1 1 ] keep [ buffer-peek 1 ] keep buffer-consume ;
buffer-consume ;
: buffer-append ( buffer buffer -- ) : buffer-append ( buffer buffer -- )
#! Append first buffer to second buffer. #! Append first buffer to second buffer.

View File

@ -14,11 +14,13 @@ threads parser ;
[ accept telnet-connection ] keep telnetd-loop ; [ accept telnet-connection ] keep telnetd-loop ;
: telnetd ( port -- ) : telnetd ( port -- )
<server> [ [
telnetd-loop <server> [
] [ telnetd-loop
swap stream-close rethrow ] [
] catch ; swap stream-close rethrow
] catch
] with-logging ;
IN: shells IN: shells

View File

@ -171,13 +171,14 @@ C: reader ( handle -- reader )
drop drop
] ifte t swap set-reader-ready? ; ] ifte t swap set-reader-ready? ;
: read-step ( port -- ) : refill ( port -- )
>port< dup buffer-length 0 = [
tuck dup buffer-end swap buffer-capacity read >port<
dup 0 >= [ swap n>buffer ] [ drop postpone-error ] ifte ; tuck dup buffer-end swap buffer-capacity read
dup 0 >= [ swap n>buffer ] [ drop postpone-error ] ifte
: refill ( reader -- ) ] [
dup buffer-length 0 = [ read-step ] [ drop ] ifte ; drop
] ifte ;
: eof? ( buffer -- ? ) buffer-fill 0 = ; : eof? ( buffer -- ? ) buffer-fill 0 = ;
@ -204,22 +205,41 @@ M: read-line-task io-task-events ( task -- events )
M: reader stream-readln ( stream -- line ) M: reader stream-readln ( stream -- line )
dup wait-to-read-line read-fin ; dup wait-to-read-line read-fin ;
: trailing-cr ( reader -- )
#! Handle a corner case. If the previous request was a line
#! read and the line ends with \r\n, the reader stopped
#! reading at \r and set the reader-cr flag to true. But we
#! must ignore the \n.
dup buffer-length 1 >= over reader-cr and [
dup buffer-peek CHAR: \n = [
1 swap buffer-consume
] [
drop
] ifte
] [
drop
] ifte ;
! Reading character counts ! Reading character counts
: read-count-step ( count reader -- ? ) : read-loop ( count reader -- ? )
dup trailing-cr
dup reader-line -rot >r over length - ( remaining) r> dup reader-line -rot >r over length - ( remaining) r>
2dup buffer-fill <= [ 2dup buffer-length <= [
buffer> nappend t buffer> nappend t
] [ ] [
buffer>> nip nappend f buffer>> nip nappend f
] ifte ; ] ifte ;
: read-step ( count reader -- ? )
[ read-loop dup ] keep set-reader-ready? ;
: can-read-count? ( count reader -- ? ) : can-read-count? ( count reader -- ? )
dup pending-error dup pending-error
2dup init-reader 2dup init-reader
2dup reader-line length <= [ 2dup reader-line length <= [
t swap set-reader-ready? drop t t swap set-reader-ready? drop t
] [ ] [
read-count-step read-step
] ifte ; ] ifte ;
TUPLE: read-task count ; TUPLE: read-task count ;
@ -234,7 +254,7 @@ M: read-task do-io-task ( task -- ? )
>read-task< dup refill dup eof? [ >read-task< dup refill dup eof? [
nip reader-eof t nip reader-eof t
] [ ] [
[ read-count-step dup ] keep set-reader-ready? read-step
] ifte ; ] ifte ;
M: read-task io-task-events ( task -- events ) M: read-task io-task-events ( task -- events )
@ -333,7 +353,7 @@ M: writer stream-close ( stream -- )
! Copying from a reader to a writer ! Copying from a reader to a writer
: can-copy? ( from -- ? ) : can-copy? ( from -- ? )
dup eof? [ read-step ] [ drop t ] ifte ; dup eof? [ refill ] [ drop t ] ifte ;
: copy-from-task ( from to -- ? ) : copy-from-task ( from to -- ? )
over can-copy? [ over can-copy? [