minor inspector improvements and other stuff to end day

cvs
Slava Pestov 2004-08-16 03:09:06 +00:00
parent f8e91e95f9
commit 4cf12addb2
5 changed files with 31 additions and 17 deletions

View File

@ -1,5 +1,9 @@
0.62:
- read-line: handle \r\n
- flush output buffer before reading line
- print: only flush in stdio stream
- ignore errors from flush
- can-read-line?
- client connections broken
- vocabulary section: what is the dictionary?
@ -14,8 +18,6 @@
- listener backspace overzealous
- SIGBUS handler
- handle division by zero
- errors: don't show .factor-rc
- inspector: sort
- log-client: fix for native
- telnetd: needs own history
- multitasking
@ -54,7 +56,6 @@
+ native:
- broken pipe errors with httpd and telnetd in cfactor
- read#
- to_fixnum and friends: error on float
ERROR: I/O error: [ "primitive_read_line_fd_8" "Resource temporarily unavailable" ]

View File

@ -63,18 +63,31 @@ USE: vocabularies
: value. ( max name value -- )
>r var-name. ": " write r> . ;
: describe-assoc ( alist -- )
dup [ car ] inject max-str-length swap
: ?unparse ( obj -- str )
dup string? [ unparse ] unless ;
: alist-keys>str ( alist -- alist )
#! Unparse non-string keys.
[ unswons ?unparse swons ] inject ;
: alist-sort ( list -- list )
[ swap car swap car str-lexi> ] sort ;
: name-padding ( alist -- col )
[ car ] inject max-str-length ;
: (describe-assoc) ( alist -- )
dup name-padding swap
[ dupd uncons value. ] each drop ;
: describe-assoc ( alist -- )
alist-keys>str alist-sort (describe-assoc) ;
: describe-namespace ( namespace -- )
[ vars-values ] bind describe-assoc ;
: ?unparse ( obj -- str )
dup string? [ unparse ] unless ;
: describe-hashtable ( hashtables -- )
hash>alist [ unswons ?unparse swons ] inject describe-assoc ;
hash>alist describe-assoc ;
: describe ( obj -- )
[

View File

@ -78,12 +78,9 @@ DEFER: >n
: set ( value variable -- ) namespace set* ;
: put ( variable value -- ) namespace put* ;
: car-str-sort ( list -- list )
[ swap car swap car str-lexi> ] sort ;
: vars-values ( -- list ) namespace hash>alist car-str-sort ;
: vars ( -- list ) vars-values [ car ] inject ;
: values ( -- list ) vars-values [ cdr ] inject ;
: vars ( -- list ) namespace hash-keys ;
: values ( -- list ) namespace hash-values ;
: vars-values ( -- list ) namespace hash>alist ;
! We don't have bound objects in native Factor.
: namespace? hashtable? ;

View File

@ -63,7 +63,10 @@ USE: strings
: parse-stream ( name stream -- code )
#! Uses the current namespace for temporary variables.
>r "parse-name" set f r> [ (parse) ] read-lines nreverse ;
>r "parse-name" set f r>
[ (parse) ] read-lines nreverse
"parse-name" off
"line-number" off ;
: parse-file ( file -- code )
dup <filecr> parse-stream ;

View File

@ -54,7 +54,7 @@ USE: streams
[
quit-flag not
] [
dup accept telnet-client
dup >r accept telnet-client r>
] while ;
: telnetd ( port -- )