some unix i/o work

cvs
Slava Pestov 2005-04-06 02:18:36 +00:00
parent b1945f04ae
commit cc5246686f
7 changed files with 36 additions and 15 deletions

View File

@ -22,7 +22,7 @@
- fix up the min thumb size hack - fix up the min thumb size hack
- frame gap - frame gap
+ fii: + ffi:
- replace alien-address, local-alien? primitives with colon defs - replace alien-address, local-alien? primitives with colon defs
- auto-generate box/unbox, and alien accessors - auto-generate box/unbox, and alien accessors
@ -38,6 +38,7 @@
+ compiler/ffi: + compiler/ffi:
- linux? bsd?
- [ [ 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
@ -53,6 +54,7 @@
+ kernel: + kernel:
- code walker & exceptions
- string sub-primitives - string sub-primitives
- clean up metaclasses - clean up metaclasses
- unify unparse and prettyprint - unify unparse and prettyprint
@ -69,3 +71,21 @@
- vector-map, string-map, seq-each, vector-project: consing - vector-map, string-map, seq-each, vector-project: consing
- map, subset, project, append: not tail recursive - map, subset, project, append: not tail recursive
+ nice to have libraries:
- regexps
- XML
- matrices, vector math
- HTTP client
- real Unicode support (strings are already 16 bits and can be extended
to 21 if the need arises, but we need full character classification
predicates, comparison, case conversion, sorting...)
- full Win32 binding
- Cairo binding
+ httpd:
- virtual hosts
- keep alive

View File

@ -64,7 +64,7 @@ M: compound (compile) ( word -- )
drop drop
] ifte ; ] ifte ;
M: compound (undefine) M: compound (uncrossref)
dup f "infer-effect" set-word-prop dup f "infer-effect" set-word-prop
dup f "no-effect" set-word-prop dup f "no-effect" set-word-prop
decompile ; decompile ;

View File

@ -85,8 +85,9 @@ 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-pop ( buffer -- char )
buffer@ <alien> 0 alien-unsigned-1 ; [ buffer@ <alien> 0 alien-unsigned-1 1 ] keep
buffer-consume ;
: buffer-set ( string buffer -- ) : buffer-set ( string buffer -- )
2dup buffer-ptr string>memory 2dup buffer-ptr string>memory

View File

@ -28,4 +28,4 @@ USE: stdio
! [ [ "\"\" { } vector-nth" ] parse ] [ type-check-error ] catch ! [ [ "\"\" { } vector-nth" ] parse ] [ type-check-error ] catch
! This should not raise an error ! This should not raise an error
[ ] [ f throw ] unit-test [ 1 2 3 ] [ 1 2 3 f throw ] unit-test

View File

@ -17,11 +17,10 @@ C: reader ( buffer -- reader )
dup buffer-length 0 = [ dup buffer-length 0 = [
2drop f 2drop f
] [ ] [
dup buffer-peek dup CHAR: \n = [ dup buffer-pop dup CHAR: \n = [
3drop t 3drop t
] [ ] [
1 pick buffer-consume pick sbuf-append pick sbuf-append read-line-loop
read-line-loop
] ifte ] ifte
] ifte ; ] ifte ;
@ -85,7 +84,7 @@ GENERIC: refill* ( reader -- )
] ifte ; ] ifte ;
: pop-line ( reader -- str ) : pop-line ( reader -- str )
dup reader-line sbuf>string >r dup reader-line dup [ sbuf>string ] when >r
f over set-reader-line f over set-reader-line
f swap set-reader-ready? r> ; f swap set-reader-ready? r> ;

View File

@ -86,17 +86,17 @@ global [ <namespace> crossref set ] bind
#! the crossref hash. #! the crossref hash.
crossref get closure ; crossref get closure ;
GENERIC: (undefine) ( word -- ) GENERIC: (uncrossref) ( word -- )
M: word (undefine) drop ; M: word (uncrossref) drop ;
: undefine ( word -- ) : uncrossref ( word -- )
dup (undefine) usages [ (undefine) ] each ; dup (uncrossref) usages [ (uncrossref) ] each ;
! The word primitive combined with the word def specify what the ! The word primitive combined with the word def specify what the
! word does when invoked. ! word does when invoked.
: define ( word primitive parameter -- ) : define ( word primitive parameter -- )
pick undefine pick uncrossref
pick set-word-def pick set-word-def
over set-word-primitive over set-word-primitive
f "parsing" set-word-prop ; f "parsing" set-word-prop ;

View File

@ -54,7 +54,8 @@ void throw_error(CELL error, bool keep_stacks)
void primitive_throw(void) void primitive_throw(void)
{ {
CELL error = dpop(); CELL error = dpop();
throw_error(error,true); if(error != F)
throw_error(error,true);
} }
void primitive_die(void) void primitive_die(void)