Merge slava@10.0.0.2:factor into smart_recompile

db4
Slava Pestov 2007-12-16 15:25:52 -05:00
commit 81de7fc696
12 changed files with 73 additions and 27 deletions

View File

@ -3,7 +3,7 @@
USING: kernel.private ;
IN: kernel
: version ( -- str ) "0.91" ; foldable
: version ( -- str ) "0.92" ; foldable
! Stack stuff
: roll ( x y z t -- y z t x ) >r rot r> swap ; inline

View File

@ -195,11 +195,11 @@ TUPLE: one-word-elt ;
M: one-word-elt prev-elt
drop
[ [ f -rot >r 1- r> (prev-word) ] (word-elt) ] (prev-char) ;
[ f -rot >r 1- r> (prev-word) ] (word-elt) ;
M: one-word-elt next-elt
drop
[ [ f -rot (next-word) ] (word-elt) ] (next-char) ;
[ f -rot (next-word) ] (word-elt) ;
TUPLE: word-elt ;

View File

@ -0,0 +1,13 @@
USING: tools.deploy.config ;
H{
{ deploy-compiler? t }
{ deploy-word-props? f }
{ deploy-ui? t }
{ deploy-reflection 1 }
{ deploy-name "springies.models.2x2snake" }
{ deploy-c-types? f }
{ deploy-word-defs? f }
{ "stop-after-last-window?" t }
{ deploy-math? t }
{ deploy-io 1 }
}

View File

@ -30,6 +30,16 @@ tools.test.inference tools.test.ui models ;
] with-grafted-gadget
] unit-test
[ "bar" ] [
<editor> "editor" set
"editor" get [
"bar\nbaz quux" "editor" get set-editor-string
{ 0 3 } "editor" get editor-caret set-model
"editor" get select-word
"editor" get gadget-selection
] with-grafted-gadget
] unit-test
{ 0 1 } [ <editor> ] unit-test-effect
"hello" <model> <field> "field" set

View File

@ -34,14 +34,10 @@ focused? ;
: field-theme ( gadget -- )
gray <solid> swap set-gadget-boundary ;
: construct-editor ( class -- tuple )
>r <editor> { set-gadget-delegate } r> construct
: construct-editor ( object class -- tuple )
>r { set-gadget-delegate } r> construct
dup dup set-editor-self ; inline
TUPLE: source-editor ;
: <source-editor> source-editor construct-editor ;
: activate-editor-model ( editor model -- )
2dup add-connection
dup activate-model
@ -320,11 +316,6 @@ M: editor gadget-text* editor-string % ;
: end-of-document ( editor -- ) T{ doc-elt } editor-next ;
: selected-word ( editor -- string )
dup gadget-selection? [
dup T{ one-word-elt } select-elt
] unless gadget-selection ;
: position-caret ( editor -- )
mouse-elt dup T{ one-char-elt } =
[ drop dup extend-selection dup editor-mark click-loc ]
@ -345,9 +336,6 @@ M: editor gadget-text* editor-string % ;
: delete-to-end-of-line T{ one-line-elt } editor-backspace ;
editor "general" f {
{ T{ key-down f f "RET" } insert-newline }
{ T{ key-down f { S+ } "RET" } insert-newline }
{ T{ key-down f f "ENTER" } insert-newline }
{ T{ key-down f f "DELETE" } delete-next-character }
{ T{ key-down f { S+ } "DELETE" } delete-next-character }
{ T{ key-down f f "BACKSPACE" } delete-previous-character }
@ -408,6 +396,11 @@ editor "caret-motion" f {
: select-word T{ one-word-elt } select-elt ;
: selected-word ( editor -- string )
dup gadget-selection?
[ dup select-word ] unless
gadget-selection ;
: select-previous-character T{ char-elt } editor-select-prev ;
: select-next-character T{ char-elt } editor-select-next ;
@ -448,6 +441,23 @@ editor "selection" f {
{ T{ key-down f { S+ C+ } "END" } select-end-of-document }
} define-command-map
! Multi-line editors
TUPLE: multiline-editor ;
: <multiline-editor> ( -- editor )
<editor> multiline-editor construct-editor ;
multiline-editor "general" f {
{ T{ key-down f f "RET" } insert-newline }
{ T{ key-down f { S+ } "RET" } insert-newline }
{ T{ key-down f f "ENTER" } insert-newline }
} define-command-map
TUPLE: source-editor ;
: <source-editor> ( -- editor )
<multiline-editor> source-editor construct-editor ;
! Fields are like editors except they edit an external model
TUPLE: field model editor ;

View File

@ -95,7 +95,7 @@ deploy-gadget "toolbar" f {
{ f com-help }
{ f com-revert }
{ f com-save }
{ T{ key-down f f "RETURN" } com-deploy }
{ T{ key-down f f "RET" } com-deploy }
} define-command-map
: buttons,

View File

@ -33,9 +33,8 @@ help ;
: <interactor> ( output -- gadget )
<source-editor>
{ set-interactor-output set-gadget-delegate }
interactor construct
dup dup set-editor-self
interactor construct-editor
tuck set-interactor-output
dup init-interactor-history
dup init-caret-help ;

View File

@ -33,7 +33,8 @@ M: live-search handle-gesture* ( gadget gesture delegate -- ? )
TUPLE: search-field ;
: <search-field> ( -- gadget ) search-field construct-editor ;
: <search-field> ( -- gadget )
<editor> search-field construct-editor ;
search-field H{
{ T{ key-down f f "UP" } [ find-search-list select-previous ] }

View File

@ -2,16 +2,18 @@ source misc/version.sh
TARGET=$1
if [ "$TARGET" = "x86" ]; then
if [ "$1" = "x86" ]; then
CPU="x86.32"
TARGET=macosx-x86-32
else
CPU="macosx-ppc"
TARGET=macosx-ppc
fi
BOOT_IMAGE=boot.$CPU.image
wget http://factorcode.org/images/$VERSION/$BOOT_IMAGE
make macosx-$TARGET
make $TARGET
Factor.app/Contents/MacOS/factor -i=$BOOT_IMAGE -no-user-init
DISK_IMAGE_DIR=Factor-$VERSION
@ -28,3 +30,6 @@ find core extra fonts misc unmaintained -type f \
-exec ./cp_dir {} $DISK_IMAGE_DIR/Factor/{} \;
hdiutil create -srcfolder "$DISK_IMAGE_DIR" -fs HFS+ \
-volname "$DISK_IMAGE_DIR" "$DISK_IMAGE"
ssh linode mkdir -p w/downloads/$VERSION/
scp $DISK_IMAGE linode:w/downloads/$VERSION/

View File

@ -1,4 +1,7 @@
source misc/version.sh
rm -rf .git
cd ..
tar cfz Factor-$VERSION.tgz factor/
tar cfz Factor-$VERSION.tar.gz factor/
ssh linode mkdir -p w/downloads/$VERSION/
scp Factor-$VERSION.tar.gz linode:w/downloads/$VERSION/

View File

@ -1 +1 @@
export VERSION=0.91
export VERSION=0.92

View File

@ -22,5 +22,10 @@ rm -f Makefile
rm -f cp_dir
rm -f boot.*.image
FILE=Factor-$VERSION-win32-$CPU.zip
cd ..
zip -r Factor-$VERSION-win32-$CPU.zip Factor/
zip -r $FILE Factor/
ssh linode mkdir -p w/downloads/$VERSION/
scp $FILE linode:w/downloads/$VERSION/