Merge commit 'littledan/master'

release
Slava Pestov 2007-12-12 00:36:59 -05:00
commit 37227b8e68
9 changed files with 116 additions and 5 deletions

View File

@ -57,12 +57,12 @@ default:
@echo "openbsd-x86-32"
@echo "openbsd-x86-64"
@echo "macosx-x86-32"
@echo "macosx-x86-64"
@echo "macosx-ppc"
@echo "solaris-x86-32"
@echo "solaris-x86-64"
@echo "windows-ce-arm"
@echo "windows-nt-x86-32"
@echo "windows-nt-x86-64"
@echo ""
@echo "Additional modifiers:"
@echo ""
@ -93,6 +93,9 @@ macosx-ppc: macosx-freetype
macosx-x86-32: macosx-freetype
$(MAKE) $(EXECUTABLE) macosx.app CONFIG=vm/Config.macosx.x86.32
macosx-x86-64: macosx-freetype
$(MAKE) $(EXECUTABLE) macosx.app CONFIG=vm/Config.macosx.x86.64
linux-x86-32:
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.linux.x86.32
@ -114,9 +117,6 @@ solaris-x86-64:
windows-nt-x86-32:
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.windows.nt.x86.32
windows-nt-x86-64:
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.windows.nt.x86.64
windows-ce-arm:
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.windows.ce.arm
@ -142,7 +142,7 @@ clean:
rm -f vm/*.o
vm/resources.o:
$(WINDRES) vm/factor.rs vm/resources.o
windres vm/factor.rs vm/resources.o
.c.o:
$(CC) -c $(CFLAGS) -o $@ $<

View File

@ -0,0 +1 @@
Daniel Ehrenberg

View File

@ -0,0 +1,21 @@
USING: help.markup help.syntax multiline ;
HELP: STRING:
{ $syntax "STRING: name\nfoo\n;" }
{ $description "Forms a multiline string literal, or 'here document' stored in the word called name. A semicolon is used to signify the end, and that semicolon must be on a line by itself, not preceeded or followed by any whitespace. The string will have newlines in between lines but not at the end, unless there is a blank line before the semicolon." } ;
HELP: <"
{ $syntax "<\" text \">" }
{ $description "This forms a multiline string literal ending in \">. Unlike the " { $link POSTPONE: STRING: } " form, you can end it in the middle of a line. This construct is non-nesting. In the example above, the string would be parsed as \"text\"." } ;
{ POSTPONE: <" POSTPONE: STRING: } related-words
HELP: parse-here
{ $values { "str" "a string" } }
{ $description "Parses a multiline string literal, as used by " { $link POSTPONE: STRING: } "." } ;
HELP: parse-multiline-string
{ $values { "end-text" "a string delineating the end" } { "str" "the parsed string" } }
{ $description "Parses a multiline string literal, as used by " { $link POSTPONE: <" } ". The end-text is the delimiter for the end." } ;
{ parse-here parse-multiline-string } related-words

View File

@ -0,0 +1,12 @@
USING: multiline tools.test ;
STRING: test-it
foo
bar
;
[ "foo\nbar\n" ] [ test-it ] unit-test
[ "foo\nbar\n" ] [ <" foo
bar
"> ] unit-test

View File

@ -0,0 +1,35 @@
! Copyright (C) 2007 Daniel Ehrenberg
! See http://factorcode.org/license.txt for BSD license.
USING: namespaces parser kernel sequences words quotations math ;
IN: multiline
: next-line-text ( -- str )
lexer get dup next-line line-text ;
: (parse-here) ( -- )
next-line-text dup ";" =
[ drop lexer get next-line ] [ % "\n" % (parse-here) ] if ;
: parse-here ( -- str )
[ (parse-here) ] "" make 1 head*
lexer get next-line ;
: STRING:
CREATE dup reset-generic
parse-here 1quotation define-compound ; parsing
: (parse-multiline-string) ( start-index end-text -- end-index )
lexer get line-text 2dup start
[ rot dupd >r >r swap subseq % r> r> length + ] [
rot tail % "\n" % 0
lexer get next-line swap (parse-multiline-string)
] if* ;
: parse-multiline-string ( end-text -- str )
[
lexer get lexer-column swap (parse-multiline-string)
lexer get set-lexer-column
] "" make 1 tail 1 head* ;
: <"
"\">" parse-multiline-string parsed ; parsing

View File

@ -0,0 +1 @@
Multiline string literals

3
vm/Config.macosx.x86.64 Normal file
View File

@ -0,0 +1,3 @@
include vm/Config.macosx
include vm/Config.x86.64
CFLAGS += -arch x86_64

35
vm/os-macosx-x86.64.h Normal file
View File

@ -0,0 +1,35 @@
/* Fault handler information. MacOSX version.
Copyright (C) 1993-1999, 2002-2003 Bruno Haible <clisp.org at bruno>
Copyright (C) 2003 Paolo Bonzini <gnu.org at bonzini>
Used under BSD license with permission from Paolo Bonzini and Bruno Haible,
2005-03-10:
http://sourceforge.net/mailarchive/message.php?msg_name=200503102200.32002.bruno%40clisp.org
Modified for Factor by Slava Pestov and Daniel Ehrenberg */
#define MACH_EXC_STATE_TYPE x86_exception_state64_t
#define MACH_EXC_STATE_FLAVOR x86_EXCEPTION_STATE64
#define MACH_EXC_STATE_COUNT x86_EXCEPTION_STATE64_COUNT
#define MACH_THREAD_STATE_TYPE x86_thread_state64_t
#define MACH_THREAD_STATE_FLAVOR x86_THREAD_STATE64
#define MACH_THREAD_STATE_COUNT MACHINE_THREAD_STATE_COUNT
#if __DARWIN_UNIX03
#define MACH_EXC_STATE_FAULT(exc_state) (exc_state)->__faultvaddr
#define MACH_STACK_POINTER(thr_state) (thr_state)->__rsp
#define MACH_PROGRAM_COUNTER(thr_state) (thr_state)->__rip
#define UAP_PROGRAM_COUNTER(ucontext) \
MACH_PROGRAM_COUNTER(&(((ucontext_t *)(ucontext))->uc_mcontext->__ss))
#else
#define MACH_EXC_STATE_FAULT(exc_state) (exc_state)->faultvaddr
#define MACH_STACK_POINTER(thr_state) (thr_state)->rsp
#define MACH_PROGRAM_COUNTER(thr_state) (thr_state)->rip
#define UAP_PROGRAM_COUNTER(ucontext) \
MACH_PROGRAM_COUNTER(&(((ucontext_t *)(ucontext))->uc_mcontext->ss))
#endif
INLINE CELL fix_stack_pointer(CELL sp)
{
return ((sp + 8) & ~15) - 8;
}

View File

@ -30,6 +30,8 @@
#include "os-macosx-x86.32.h"
#elif defined(FACTOR_PPC)
#include "os-macosx-ppc.h"
#elif defined(FACTOR_AMD64)
#include "os-macosx-x86.64.h"
#else
#error "Unsupported Mac OS X flavor"
#endif
@ -70,6 +72,7 @@
#elif defined(FACTOR_ARM)
#include "os-linux-arm.h"
#elif defined(FACTOR_AMD64)
#include "os-unix-ucontext.h"
#include "os-linux-x86-64.h"
#else
#error "Unsupported Linux flavor"