diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index 6ae1dc57be..1a33ba4525 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -1,31 +1,27 @@ -- gc call in the middle of some ops might affect callstack +- bitwise operations +- clone-hashtable +- sidekick: error source not removed +- lineno/file for native +- jedit for native with socket communication +- input style after clicking link +- fedit broken with listener +- maple-like: press enter at old commands to evaluate there - sending ^C on socket -- postpone errors until actual read/write op +- read# +- describe-word +- enforce bottom-up in native bootstrap +- standalone listener input style +- log-client: fix for native +- add a socket timeout + ++ docs: + - vector-each/map examples - unparse examples - finish second practical - sbuf-hashcode - vector-hashcode -- listener backspace overzealous -- multitasking - review doc formatting with latex2html -- sidekick: error source not removed - -[error] AWT-EventQueue-0: java.lang.NullPointerException -[error] AWT-EventQueue-0: at sidekick.SideKickParsedData.getTreePathForPosition(Unknown Source) -[error] AWT-EventQueue-0: at sidekick.SideKickParsedData.getTreePathForPosition(Unknown Source) -[error] AWT-EventQueue-0: at sidekick.SideKickTree.expandTreeAt(Unknown Source) -[error] AWT-EventQueue-0: at sidekick.SideKickTree.access$100(Unknown Source) -[error] AWT-EventQueue-0: at sidekick.SideKickTree$1.actionPerformed(Unknown Source) -[error] AWT-EventQueue-0: at javax.swing.Timer.fireActionPerformed(Timer.java:271) -[error] AWT-EventQueue-0: at javax.swing.Timer$DoPostEvent.run(Timer.java:201) -[error] AWT-EventQueue-0: at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178) -[error] AWT-EventQueue-0: at java.awt.EventQueue.dispatchEvent(EventQueue.java:454) -[error] AWT-EventQueue-0: at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201) -[error] AWT-EventQueue-0: at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) -[error] AWT-EventQueue-0: at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145) -[error] AWT-EventQueue-0: at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137) -[error] AWT-EventQueue-0: at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) + tests: @@ -33,34 +29,24 @@ - FactorLib.equal() not very good - do nset-nth, nremove-nth, nsubstitute, ninject - IN: format base: work with all types of numbers -- bitwise operations - -- rethink strhead/strtail&co + listener/plugin: -- lineno/file for native -- jedit for native with socket communication +- listener backspace overzealous - lineno/file for shuffle defs - balance needs USE: -- input style after clicking link - completion: enter no good - completion: don't show automatically - completion in the listener - special completion for USE:/IN: -- fedit broken with listener -- maple-like: press enter at old commands to evaluate there - inspector links when describe called without object path + native: -- read# +- gc call in the middle of some ops might affect callstack +- postpone errors until actual read/write op +- multitasking - parsing should be parsing -- see: show word flags and IN: -- describe-word -- contains ==> contains? -- telnetd: send errors on socket -- enforce bottom-up in native bootstrap + JVM compiler: @@ -77,21 +63,23 @@ + misc: +- rethink strhead/strtail&co - namespace clone drops static var bindings - ditch map - ditch expand - set-object-path - more readable traces - 'cascading' styles -- standalone listener input style +- telnetd: send errors on socket +- contains ==> contains? + httpd: -- log-client: fix for native +- file responder: + - port to native + - if a directory is requested and URL does not end with /, redirect - if user clicks stop in browser, doesn't stop sending? - log with date -- add a socket timeout -- if a directory is requested and URL does not end with /, redirect - return more header fields, like Content-Length, Last-Modified, and so on - HEAD request - basic authentication, using httpdAuth function from a config file diff --git a/library/httpd/responder.factor b/library/httpd/responder.factor index 03d00d2cc3..c920346dcc 100644 --- a/library/httpd/responder.factor +++ b/library/httpd/responder.factor @@ -58,6 +58,10 @@ USE: httpd : serving-text ( -- ) "200 Document follows" "text/plain" response print ; +: redirect ( to -- ) + "301 Moved Permanently" "text/plain" response write + "Location: " write print ; + : get-responder ( name -- responder ) "httpd-responders" get get* ; @@ -80,9 +84,15 @@ USE: httpd "Calling responder " swap cat2 log ; : serve-responder ( argument method -- ) - over log-responder - swap trim-/ "/" split1 over get-responder dup [ - rot drop call-responder + swap + dup log-responder + trim-/ "/" split1 dup [ + over get-responder dup [ + rot drop call-responder + ] [ + 2drop no-such-responder drop + ] ifte ] [ - 2drop no-such-responder drop + ! Argument is just a responder name without / + drop "/" swap "/" cat3 redirect drop ] ifte ; diff --git a/library/platform/native/prettyprint.factor b/library/platform/native/prettyprint.factor index 837ec50088..2502437605 100644 --- a/library/platform/native/prettyprint.factor +++ b/library/platform/native/prettyprint.factor @@ -35,16 +35,11 @@ USE: unparser USE: words : see-compound ( word -- ) - 0 swap dup word-parameter - [ - [ prettyprint-: ] dip prettyprint-word - dup prettyprint-newline - ] dip - prettyprint-list prettyprint-; + 0 swap dup word-parameter prettyprint-:; prettyprint-newline ; : see-primitive ( word -- ) - "Primitive: " write unparse print ; + "PRIMITIVE: " write unparse print ; : see-undefined ( word -- ) drop "Not defined" print ; diff --git a/library/prettyprint.factor b/library/prettyprint.factor index c28c311e18..d8c2f03943 100644 --- a/library/prettyprint.factor +++ b/library/prettyprint.factor @@ -174,6 +174,20 @@ DEFER: prettyprint* : prettyprint ( obj -- ) 0 swap prettyprint* drop terpri ; +: vocab-link ( vocab -- link ) + <% "vocabularies'" % % %> ; + +: vocab-attrs ( word -- attrs ) + default-style clone [ vocab-link "link" set ] extend ; + +: prettyprint-vocab ( vocab -- ) + dup vocab-attrs [ write-attr ] bind ; + +: prettyprint-IN: ( indent word -- indent ) + "IN:" write prettyprint-space + word-vocabulary prettyprint-vocab + dup prettyprint-newline ; + : prettyprint-: ( indent -- indent ) ":" write prettyprint-space tab-size + ; @@ -182,11 +196,18 @@ DEFER: prettyprint* ";" write tab-size - ; +: prettyprint-plist ( word -- ) + "parsing" over word-property [ " parsing" write ] when + "inline" over word-property [ " inline" write ] when + drop ; + : prettyprint-:; ( indent word list -- indent ) - >r - >r prettyprint-: r> - prettyprint-word prettyprint-space r> - prettyprint-list prettyprint-; ; + over >r >r dup + >r prettyprint-IN: prettyprint-: r> + prettyprint-word + native? [ dup prettyprint-newline ] [ prettyprint-space ] ifte + r> + prettyprint-list prettyprint-; r> prettyprint-plist ; : . ( obj -- ) [ diff --git a/library/test/httpd/httpd.factor b/library/test/httpd/httpd.factor index 42360fd16b..5453c47c0a 100644 --- a/library/test/httpd/httpd.factor +++ b/library/test/httpd/httpd.factor @@ -62,10 +62,3 @@ USE: url-encoding [ ] [ "GET /index.html" parse-request ] unit-test [ ] [ "GET ../index.html" parse-request ] unit-test [ ] [ "POO" parse-request ] unit-test - -[ ] [ "/" "get" ] [ serve-responder ] test-word -[ ] [ "" "get" ] [ serve-responder ] test-word -[ ] [ "does-not-exist!" "get" ] [ serve-responder ] test-word -[ ] [ "does-not-exist!/" "get" ] [ serve-responder ] test-word - -[ ] [ "inspect/global" "get" ] [ serve-responder ] test-word diff --git a/library/words.factor b/library/words.factor index cd7226b272..33d1a39e8d 100644 --- a/library/words.factor +++ b/library/words.factor @@ -36,10 +36,10 @@ USE: stack : word-name ( word -- name ) "name" swap word-property ; -: set-word-name ( word -- vocab ) +: set-word-name ( word name -- ) "name" swap set-word-property ; -: word-vocabulary ( word name -- ) +: word-vocabulary ( word -- vocab ) "vocabulary" swap word-property ; : set-word-vocabulary ( word vocab -- )