FFI:\r
\r
+- wordpreview: don't show for string literals and comments\r
+- listener: use console shell api\r
+- add a socket timeout\r
+- fix error postoning -- not all errors thrown by i/o code are\r
+ postponed\r
+- file responder: don't show full path in title\r
+- quit responder breaks with multithreading\r
+\r
+ compiler/ffi:\r
\r
- is signed -vs- unsigned pointers an issue?\r
- clean up listener's action popups\r
- accept multi-line input in listener\r
- don't show listener on certain commands\r
-- wordpreview: don't show for string literals and comments\r
- NPE in ErrorHighlight\r
- some way to not have previous definitions from a source file\r
clutter the namespace\r
- use inferior.factor for everything not just listener\r
- fedit broken with listener\r
- maple-like: press enter at old commands to evaluate there\r
-- input style after clicking link\r
-- listener backspace overzealous\r
- completion in the listener\r
- special completion for USE:/IN:\r
- inspector links when describe called without object path\r
\r
- profiler is inaccurate: wrong word on cs\r
- better i/o scheduler\r
-- move some s48_ functions into bignum.c\r
-- remove unused functions\r
- >lower, >upper for strings\r
-- add a socket timeout\r
-- fix error postoning -- not all errors thrown by i/o code are\r
- postponed\r
- don't rehash strings on every startup\r
\r
+ misc:\r
- jedit ==> jedit-word, jedit takes a file name\r
- 'cascading' styles\r
- command line parsing cleanup\r
-- > 1 ( ) inside word def\r
-- parsing-word test fails\r
-- doc comments in image, inferior\r
-- eval with multilien strings and #!\r
- nicer way to combine two paths\r
- alist -vs- assoc terminology\r
\r
+ httpd:\r
\r
-- file responder: don't show full path in title\r
- wiki responder:\r
- port to native\r
- text styles\r
- log with date\r
basic authentication, using httpdAuth function from a config file\r
- file responder; last-modified field\r
-- quit responder breaks with multithreading\r
\r
+ java factor is going away:\r
\r
--- /dev/null
+! DeJong attractor renderer.
+! To run this code, start your interpreter like so:
+!
+! ./f -library:sdl=libSDL.so -library:sdl-gfx=libSDL_gfx.so
+!
+! Then, enter this at the interpreter prompt:
+!
+! "contrib/dejong.factor" run-file
+
+! For details on DeJong attractors, see
+! http://www.complexification.net/gallery/machines/peterdejong/
+
+IN: dejong
+
+USE: sdl
+USE: namespaces
+USE: math
+USE: stack
+
+SYMBOL: a
+SYMBOL: b
+SYMBOL: c
+SYMBOL: d
+SYMBOL: width
+SYMBOL: height
+
+: next-x ( x y -- x ) a get * sin swap b get * cos - ;
+: next-y ( x y -- y ) swap c get * sin swap d get * cos - ;
+
+: white ( -- rgb )
+ HEX: ffffffff ;
+
+: pixel ( #{ x y } color -- )
+ >r >r surface get r> >rect r> pixelColor ;
+
+: iterate-dejong ( x y -- x y )
+ 2dup next-y >r next-x r> ;
+
+: scale-dejong ( x y -- x y )
+ swap width get 4 / * width get 2 / + >fixnum
+ swap height get 4 / * height get 2 / + >fixnum ;
+
+: draw-dejong ( x0 y0 iterations -- )
+ [
+ iterate-dejong 2dup scale-dejong rect> white pixel
+ ] times 2drop ;
+
+: dejong ( -- )
+ ! Fiddle with these four values!
+ 1.4 a set
+ -2.3 b set
+ 2.4 c set
+ -2.1 d set
+
+ 640 dup width set
+ 480 dup height set
+ 32 SDL_HWSURFACE SDL_SetVideoMode drop
+
+ [
+ 0 0 100000 draw-dejong
+ ] with-surface
+
+ <event> event-loop
+ SDL_Quit ;
+
+dejong
Buffer buffer = view.getBuffer();
int lastUseOffset = 0;
- boolean trailingNewline = false;
+ boolean leadingNewline = false;
for(int i = 0; i < buffer.getLineCount(); i++)
{
if(text.startsWith("IN:") || text.startsWith("USE:"))
{
lastUseOffset = buffer.getLineEndOffset(i) - 1;
+ leadingNewline = true;
}
- else if(text.startsWith("!") || text.length() == 0)
+ else if(text.startsWith("!"))
+ {
+ lastUseOffset = buffer.getLineEndOffset(i) - 1;
+ leadingNewline = true;
+ }
+ else if(text.length() == 0)
{
if(i == 0)
lastUseOffset = 0;
else
- lastUseOffset = buffer.getLineEndOffset(i-1) - 1;
+ lastUseOffset = buffer.getLineEndOffset(i - 1) - 1;
}
else
{
- trailingNewline = true;
break;
}
}
String decl = "USE: " + vocab;
- if(lastUseOffset != 0)
+ if(leadingNewline)
decl = "\n" + decl;
- if(trailingNewline)
- decl = decl + "\n";
buffer.insert(lastUseOffset,decl);
showStatus(view,"inserted-use",decl);
} //}}}
return;
int start = asset.start.getOffset();
+ /* Hack */
+ start = buffer.getLineStartOffset(
+ buffer.getLineOfOffset(start));
String indent = MiscUtilities.createWhiteSpace(
buffer.getIndentSize(),
String newDef = ": " + newWord + "\n" + indent
+ selection.trim() + " ;\n\n" ;
- buffer.insert(start,newDef);
- textArea.setSelectedText(newWord);
+ try
+ {
+ buffer.beginCompoundEdit();
+
+ buffer.insert(start,newDef);
+ textArea.setSelectedText(newWord);
+ }
+ finally
+ {
+ buffer.endCompoundEdit();
+ }
} //}}}
}
! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+! This library allows one to generate a new set of bootstrap
+! images (boot.image.{le32,le64,be32,be64}.
+!
+! It does this by parsing the set of source files needed to
+! generate the minimal image, and writing the cons cells, words,
+! strings etc to the image file in the CFactor object memory
+! format.
+!
+! What is a bootstrap image? It basically contains enough code
+! to parse a source file. See platform/native/boot.factor --
+! It initializes the core interpreter services, and proceeds to
+! run platform/native/boot-stage2.factor.
+
IN: namespaces
( Java Factor doesn't have this )
USE: strings
USE: styles
+! The purpose of this library is to allow CFactor to be embedded
+! inside the Java Factor listener in jEdit.
+!
+! Eg, in Java Factor, you could evaluate this after fixing the
+! paths accordingly:
+!
+! : (inf
+! [
+! "/home/slava/Factor/f"
+! "/home/slava/Factor/factor.image"
+! "-no-ansi"
+! ] pipe inferior-client ;
+!
+! Details:
+!
! Packets have the following form:
! 1 byte -- type. CHAR: w: write, CHAR: r: read
! 4 bytes -- for write only -- length of write request
: CREATE ( -- word )
scan "in" get create dup set-word
dup f "documentation" set-word-property
- dup f "stack-effect" set-word-property ;
-
-: remember-where ( word -- )
+ dup f "stack-effect" set-word-property
dup "line-number" get "line" set-word-property
dup "col" get "col" set-word-property
- "file" get "file" set-word-property ;
+ dup "file" get "file" set-word-property ;
! \x
: unicode-escape>ch ( -- esc )
: parsed-stack-effect ( parsed str -- parsed )
over doc-comment-here? [
- word swap "stack-effect" set-word-property
+ word stack-effect [
+ drop
+ ] [
+ word swap "stack-effect" set-word-property
+ ] ifte
] [
drop
] ifte ;
: :
#! Begin a word definition. Word name follows.
- CREATE dup remember-where [ ]
- "in-definition" on ; parsing
+ CREATE [ ] "in-definition" on ; parsing
: ;-hook ( word def -- )
";-hook" get [ call ] [ define-compound ] ifte* ;
: ;
#! End a word definition.
- "in-definition" off
- reverse
- ;-hook ; parsing
+ "in-definition" off reverse ;-hook ; parsing
! Symbols
: SYMBOL: CREATE define-symbol ; parsing
: until ( ch -- str )
ch-search (until) ;
+: (until-eol) ( -- index )
+ "\n" ch-search dup -1 = [ drop "line" get str-length ] when ;
+
: until-eol ( -- str )
- "line" get str-length (until) ;
+ #! This is just a hack to get "eval" to work with multiline
+ #! strings from jEdit with EOL comments. Normally, input to
+ #! the parser is already line-tokenized.
+ (until-eol) (until) ;
: next-ch ( -- ch )
end? [ "Unexpected EOF" throw ] [ ch advance ] ifte ;
: define-compound ( word def -- )
over set-word-parameter
- ( dup f "parsing" set-word-property )
- 1 swap set-word-primitive ;
+ 1 over set-word-primitive
+ f "parsing" set-word-property ;
: define-symbol ( word -- )
dup dup set-word-parameter
[ 2 ] [ "[ 1 | 2 ]" parse car cdr ] unit-test
[ "hello" ] [ "[ 1 | \"hello\" ]" parse car cdr ] unit-test
[ #{ 1 2 } ] [ "[ 1 | #{ 1 2 } ]" parse car cdr ] unit-test
+
+! Test EOL comments in multiline strings.
+[ [ "Hello" ] ] [ "#! This calls until-eol.\n\"Hello\"" parse ] unit-test
USE: parser
USE: test
+USE: stack
+USE: words
+USE: strings
DEFER: foo
": foo 2 2 + . ;" eval
[ [ foo ] ] [ "foo" parse ] unit-test
+
+! Test > 1 ( ) comment; only the first one should be used.
+[ t ] [
+ "a" ": foo ( a ) ( b ) ;" parse drop word stack-effect str-contains?
+] unit-test
"crashes" test
"sbuf" test
"threads" test
- ! "parsing-word" test
+ "parsing-word" test
cpu "x86" = [
[