Minor fixes

slava 2006-09-23 19:54:37 +00:00
parent b246a76199
commit 6d9f6f0246
9 changed files with 38 additions and 17 deletions

View File

@ -1,6 +1,5 @@
+ 0.85: + 0.85:
- :edit should apply to the innermost error
- doc sweep - doc sweep
- the editor should fill up the interior of the scroller completely - the editor should fill up the interior of the scroller completely
- pane output in UI should use less memory - pane output in UI should use less memory
@ -50,7 +49,6 @@
- roundoff is still not quite right with tracks - roundoff is still not quite right with tracks
- fix top level window positioning - fix top level window positioning
- x11.app has a problem with A+ keys - x11.app has a problem with A+ keys
- status bar showing number of words needing a recompile
- services do not launch if factor not running - services do not launch if factor not running
- fix ui listener delay - fix ui listener delay
- editor: - editor:
@ -97,7 +95,6 @@
- stdcall callbacks - stdcall callbacks
- see if alien calls can be made faster - see if alien calls can be made faster
- [ r> ] infer should throw an inference error
- compiler tests are not as reliable now because of try-compile usage - compiler tests are not as reliable now because of try-compile usage
- we can just do [ t ] [ \ foo compiled? ] unit-test - we can just do [ t ] [ \ foo compiled? ] unit-test
- [ [ dup call ] dup call ] infer hangs - [ [ dup call ] dup call ] infer hangs

View File

@ -17,9 +17,13 @@ M: unbalanced-branches-error error.
M: literal-expected summary M: literal-expected summary
drop "Literal value expected" ; drop "Literal value expected" ;
M: check-retain summary M: too-many->r summary
drop drop
"Quotation leaves elements behind on retain stack" ; "Quotation pushes elements on retain stack without popping them" ;
M: too-many-r> summary
drop
"Quotation pops retain stack elements which it did not push" ;
M: no-effect error. M: no-effect error.
"The word " write "The word " write

View File

@ -82,13 +82,20 @@ M: quotation infer-quot
recursive-state get >r swap recursive-state set recursive-state get >r swap recursive-state set
infer-quot r> recursive-state set ; infer-quot r> recursive-state set ;
TUPLE: check-retain ; TUPLE: too-many->r ;
: check-retain ( -- ) : check->r ( -- )
meta-r get empty? [ meta-r get empty? [
<check-retain> inference-error <too-many->r> inference-error
] unless ; ] unless ;
TUPLE: too-many-r> ;
: check-r> ( -- )
meta-r get empty? [
<too-many-r>> inference-error
] when ;
: undo-infer ( -- ) : undo-infer ( -- )
recorded get recorded get
[ "infer" word-prop not ] subset [ "infer" word-prop not ] subset
@ -101,7 +108,7 @@ TUPLE: check-retain ;
V{ } clone recorded set V{ } clone recorded set
f init-inference f init-inference
call call
check-retain check->r
] [ ] [
undo-infer undo-infer
rethrow rethrow

View File

@ -11,7 +11,8 @@ HELP: inference-error
{ $list { $list
{ $link no-effect } { $link no-effect }
{ $link literal-expected } { $link literal-expected }
{ $link check-retain } { $link too-many->r }
{ $link too-many-r> }
{ $link unbalanced-branches-error } { $link unbalanced-branches-error }
{ $link effect-error } { $link effect-error }
{ $link recursive-declare-error } { $link recursive-declare-error }
@ -25,9 +26,13 @@ HELP: literal-expected
HELP: terminated? HELP: terminated?
{ $var-description "During inference, a flag set to " { $link t } " if the current control flow path unconditionally throws an error." } ; { $var-description "During inference, a flag set to " { $link t } " if the current control flow path unconditionally throws an error." } ;
HELP: check-retain HELP: too-many->r
{ $error-description "Thrown if inference notices a quotation leaving behind elements on the retain stack." } { $error-description "Thrown if inference notices a quotation pushing elements on the retain stack without popping them at the end." }
{ $notes "Usually this error indicates a coding mistake; check that usages of " { $link >r } " and " { $link r> } " are balanced in this case. Writing code which intentionally does this is considered bad style." } ; { $notes "See " { $link "shuffle-words" } " for retain stack usage conventions." } ;
HELP: too-many-r>
{ $error-description "Thrown if inference notices a quotation popping elements from the return stack it did not place there." }
{ $notes "See " { $link "shuffle-words" } " for retain stack usage conventions." } ;
HELP: infer HELP: infer
{ $values { "quot" "a quotation" } { "effect" "a pair of integers" } } { $values { "quot" "a quotation" } { "effect" "a pair of integers" } }

View File

@ -50,6 +50,7 @@ sequences words parser words ;
\ >r { object } { } <effect> "infer-effect" set-word-prop \ >r { object } { } <effect> "infer-effect" set-word-prop
\ r> [ \ r> [
check-r>
#r> dup node, #r> dup node,
0 1 pick node-inputs 0 1 pick node-inputs
pop-r push-d pop-r push-d

View File

@ -223,7 +223,6 @@ M: read-task task-container drop read-tasks get-global ;
] when pending-error drop ; ] when pending-error drop ;
: stream-read-part ( count port -- string ) : stream-read-part ( count port -- string )
>r 0 max >fixnum r>
[ wait-to-read ] 2keep [ wait-to-read ] 2keep
[ dupd buffer> ] unless-eof nip ; [ dupd buffer> ] unless-eof nip ;
@ -243,6 +242,7 @@ M: read-task task-container drop read-tasks get-global ;
[ underlying ] [ >string ] if ; inline [ underlying ] [ >string ] if ; inline
M: input-port stream-read M: input-port stream-read
>r 0 max >fixnum r>
2dup stream-read-part dup [ 2dup stream-read-part dup [
pick over length > [ pick over length > [
pick <sbuf> pick <sbuf>

View File

@ -8,7 +8,12 @@ namespaces sequences words ;
"scratchpad" set-in { "syntax" "scratchpad" } set-use ; "scratchpad" set-in { "syntax" "scratchpad" } set-use ;
: with-parser ( quot -- ) : with-parser ( quot -- )
[ [ <parse-error> rethrow ] recover ] with-scope ; [
[
dup [ parse-error? ] is? [ <parse-error> ] unless
rethrow
] recover
] with-scope ;
: parse-lines ( lines -- quot ) : parse-lines ( lines -- quot )
[ [

View File

@ -3,4 +3,4 @@ USING: gadgets test ;
[ "A+a" ] [ T{ key-down f { A+ } "a" } gesture>string ] unit-test [ "A+a" ] [ T{ key-down f { A+ } "a" } gesture>string ] unit-test
[ "b" ] [ T{ key-down f f "b" } gesture>string ] unit-test [ "b" ] [ T{ key-down f f "b" } gesture>string ] unit-test
[ "Mouse Down 2" ] [ T{ button-down f f 2 } gesture>string ] unit-test [ "Press Button 2" ] [ T{ button-down f f 2 } gesture>string ] unit-test

View File

@ -122,7 +122,9 @@ M: editor model-changed
dup caret-loc swap caret-dim <rect> ; dup caret-loc swap caret-dim <rect> ;
: scroll>caret ( editor -- ) : scroll>caret ( editor -- )
dup caret-rect swap scroll>rect ; dup gadget-grafted? [
dup caret-rect over scroll>rect
] when drop ;
M: loc-monitor model-changed M: loc-monitor model-changed
loc-monitor-editor control-self scroll>caret ; loc-monitor-editor control-self scroll>caret ;