Merge branch 'master' of git://factorcode.org/git/factor into clean-linux-x86-32
commit
48232399b2
56
Makefile
56
Makefile
|
@ -4,6 +4,7 @@ LD = ld
|
||||||
|
|
||||||
EXECUTABLE = factor
|
EXECUTABLE = factor
|
||||||
CONSOLE_EXECUTABLE = factor-console
|
CONSOLE_EXECUTABLE = factor-console
|
||||||
|
TEST_LIBRARY = factor-ffi-test
|
||||||
VERSION = 0.92
|
VERSION = 0.92
|
||||||
|
|
||||||
IMAGE = factor.image
|
IMAGE = factor.image
|
||||||
|
@ -35,7 +36,6 @@ DLL_OBJS = $(PLAF_DLL_OBJS) \
|
||||||
vm/debug.o \
|
vm/debug.o \
|
||||||
vm/errors.o \
|
vm/errors.o \
|
||||||
vm/factor.o \
|
vm/factor.o \
|
||||||
vm/ffi_test.o \
|
|
||||||
vm/image.o \
|
vm/image.o \
|
||||||
vm/io.o \
|
vm/io.o \
|
||||||
vm/math.o \
|
vm/math.o \
|
||||||
|
@ -48,6 +48,8 @@ DLL_OBJS = $(PLAF_DLL_OBJS) \
|
||||||
|
|
||||||
EXE_OBJS = $(PLAF_EXE_OBJS)
|
EXE_OBJS = $(PLAF_EXE_OBJS)
|
||||||
|
|
||||||
|
TEST_OBJS = vm/ffi_test.o
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$(MAKE) `./build-support/factor.sh make-target`
|
$(MAKE) `./build-support/factor.sh make-target`
|
||||||
|
|
||||||
|
@ -81,64 +83,60 @@ help:
|
||||||
@echo "X11=1 force link with X11 libraries instead of Cocoa (only on Mac OS X)"
|
@echo "X11=1 force link with X11 libraries instead of Cocoa (only on Mac OS X)"
|
||||||
|
|
||||||
openbsd-x86-32:
|
openbsd-x86-32:
|
||||||
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.openbsd.x86.32
|
$(MAKE) $(EXECUTABLE) $(TEST_LIBRARY) CONFIG=vm/Config.openbsd.x86.32
|
||||||
|
|
||||||
openbsd-x86-64:
|
openbsd-x86-64:
|
||||||
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.openbsd.x86.64
|
$(MAKE) $(EXECUTABLE) $(TEST_LIBRARY) CONFIG=vm/Config.openbsd.x86.64
|
||||||
|
|
||||||
freebsd-x86-32:
|
freebsd-x86-32:
|
||||||
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.freebsd.x86.32
|
$(MAKE) $(EXECUTABLE) $(TEST_LIBRARY) CONFIG=vm/Config.freebsd.x86.32
|
||||||
|
|
||||||
freebsd-x86-64:
|
freebsd-x86-64:
|
||||||
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.freebsd.x86.64
|
$(MAKE) $(EXECUTABLE) $(TEST_LIBRARY) CONFIG=vm/Config.freebsd.x86.64
|
||||||
|
|
||||||
netbsd-x86-32:
|
netbsd-x86-32:
|
||||||
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.netbsd.x86.32
|
$(MAKE) $(EXECUTABLE) $(TEST_LIBRARY) CONFIG=vm/Config.netbsd.x86.32
|
||||||
|
|
||||||
netbsd-x86-64:
|
netbsd-x86-64:
|
||||||
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.netbsd.x86.64
|
$(MAKE) $(EXECUTABLE) $(TEST_LIBRARY) CONFIG=vm/Config.netbsd.x86.64
|
||||||
|
|
||||||
macosx-freetype:
|
macosx-ppc:
|
||||||
ln -sf libfreetype.6.dylib \
|
$(MAKE) $(EXECUTABLE) $(TEST_LIBRARY) macosx.app CONFIG=vm/Config.macosx.ppc
|
||||||
Factor.app/Contents/Frameworks/libfreetype.dylib
|
|
||||||
|
|
||||||
macosx-ppc: macosx-freetype
|
macosx-x86-32:
|
||||||
$(MAKE) $(EXECUTABLE) macosx.app CONFIG=vm/Config.macosx.ppc
|
$(MAKE) $(EXECUTABLE) $(TEST_LIBRARY) macosx.app CONFIG=vm/Config.macosx.x86.32
|
||||||
|
|
||||||
macosx-x86-32: macosx-freetype
|
macosx-x86-64:
|
||||||
$(MAKE) $(EXECUTABLE) macosx.app CONFIG=vm/Config.macosx.x86.32
|
$(MAKE) $(EXECUTABLE) $(TEST_LIBRARY) macosx.app CONFIG=vm/Config.macosx.x86.64
|
||||||
|
|
||||||
macosx-x86-64: macosx-freetype
|
|
||||||
$(MAKE) $(EXECUTABLE) macosx.app CONFIG=vm/Config.macosx.x86.64
|
|
||||||
|
|
||||||
linux-x86-32:
|
linux-x86-32:
|
||||||
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.linux.x86.32
|
$(MAKE) $(EXECUTABLE) $(TEST_LIBRARY) CONFIG=vm/Config.linux.x86.32
|
||||||
|
|
||||||
linux-x86-64:
|
linux-x86-64:
|
||||||
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.linux.x86.64
|
$(MAKE) $(EXECUTABLE) $(TEST_LIBRARY) CONFIG=vm/Config.linux.x86.64
|
||||||
|
|
||||||
linux-ppc:
|
linux-ppc:
|
||||||
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.linux.ppc
|
$(MAKE) $(EXECUTABLE) $(TEST_LIBRARY) CONFIG=vm/Config.linux.ppc
|
||||||
|
|
||||||
linux-arm:
|
linux-arm:
|
||||||
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.linux.arm
|
$(MAKE) $(EXECUTABLE) $(TEST_LIBRARY) CONFIG=vm/Config.linux.arm
|
||||||
|
|
||||||
solaris-x86-32:
|
solaris-x86-32:
|
||||||
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.solaris.x86.32
|
$(MAKE) $(EXECUTABLE) $(TEST_LIBRARY) CONFIG=vm/Config.solaris.x86.32
|
||||||
|
|
||||||
solaris-x86-64:
|
solaris-x86-64:
|
||||||
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.solaris.x86.64
|
$(MAKE) $(EXECUTABLE) $(TEST_LIBRARY) CONFIG=vm/Config.solaris.x86.64
|
||||||
|
|
||||||
winnt-x86-32:
|
winnt-x86-32:
|
||||||
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.windows.nt.x86.32
|
$(MAKE) $(EXECUTABLE) $(TEST_LIBRARY) CONFIG=vm/Config.windows.nt.x86.32
|
||||||
$(MAKE) $(CONSOLE_EXECUTABLE) CONFIG=vm/Config.windows.nt.x86.32
|
$(MAKE) $(CONSOLE_EXECUTABLE) CONFIG=vm/Config.windows.nt.x86.32
|
||||||
|
|
||||||
winnt-x86-64:
|
winnt-x86-64:
|
||||||
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.windows.nt.x86.64
|
$(MAKE) $(EXECUTABLE) $(TEST_LIBRARY) CONFIG=vm/Config.windows.nt.x86.64
|
||||||
$(MAKE) $(CONSOLE_EXECUTABLE) CONFIG=vm/Config.windows.nt.x86.64
|
$(MAKE) $(CONSOLE_EXECUTABLE) CONFIG=vm/Config.windows.nt.x86.64
|
||||||
|
|
||||||
wince-arm:
|
wince-arm:
|
||||||
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.windows.ce.arm
|
$(MAKE) $(EXECUTABLE) $(TEST_LIBRARY) CONFIG=vm/Config.windows.ce.arm
|
||||||
|
|
||||||
macosx.app: factor
|
macosx.app: factor
|
||||||
mkdir -p $(BUNDLE)/Contents/MacOS
|
mkdir -p $(BUNDLE)/Contents/MacOS
|
||||||
|
@ -161,6 +159,9 @@ factor-console: $(DLL_OBJS) $(EXE_OBJS)
|
||||||
$(CC) $(LIBS) $(LIBPATH) -L. $(LINK_WITH_ENGINE) \
|
$(CC) $(LIBS) $(LIBPATH) -L. $(LINK_WITH_ENGINE) \
|
||||||
$(CFLAGS) $(CFLAGS_CONSOLE) -o factor$(EXE_SUFFIX)$(CONSOLE_EXTENSION) $(EXE_OBJS)
|
$(CFLAGS) $(CFLAGS_CONSOLE) -o factor$(EXE_SUFFIX)$(CONSOLE_EXTENSION) $(EXE_OBJS)
|
||||||
|
|
||||||
|
factor-ffi-test: vm/ffi_test.o
|
||||||
|
$(CC) $(LIBPATH) $(CFLAGS) $(FFI_TEST_CFLAGS) $(SHARED_FLAG) -o libfactor-ffi-test$(DLL_EXTENSION) $(TEST_OBJS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f vm/*.o
|
rm -f vm/*.o
|
||||||
rm -f factor*.dll libfactor.{a,so,dylib}
|
rm -f factor*.dll libfactor.{a,so,dylib}
|
||||||
|
@ -168,6 +169,9 @@ clean:
|
||||||
vm/resources.o:
|
vm/resources.o:
|
||||||
$(WINDRES) vm/factor.rs vm/resources.o
|
$(WINDRES) vm/factor.rs vm/resources.o
|
||||||
|
|
||||||
|
vm/ffi_test.o: vm/ffi_test.c
|
||||||
|
$(CC) -c $(CFLAGS) $(FFI_TEST_CFLAGS) -o $@ $<
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
$(CC) -c $(CFLAGS) -o $@ $<
|
$(CC) -c $(CFLAGS) -o $@ $<
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ byte-arrays combinators combinators.short-circuit fry generalizations
|
||||||
kernel lexer macros math math.parser namespaces parser sequences
|
kernel lexer macros math math.parser namespaces parser sequences
|
||||||
splitting stack-checker vectors vocabs.parser words locals
|
splitting stack-checker vectors vocabs.parser words locals
|
||||||
io.encodings.ascii io.encodings.string shuffle effects math.ranges
|
io.encodings.ascii io.encodings.string shuffle effects math.ranges
|
||||||
math.order sorting strings system ;
|
math.order sorting strings system alien.libraries ;
|
||||||
IN: alien.fortran
|
IN: alien.fortran
|
||||||
|
|
||||||
SINGLETONS: f2c-abi gfortran-abi intel-unix-abi intel-windows-abi ;
|
SINGLETONS: f2c-abi gfortran-abi intel-unix-abi intel-windows-abi ;
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
! Copyright (C) 2009 Slava Pestov.
|
||||||
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
|
USING: accessors alien alien.syntax assocs help.markup
|
||||||
|
help.syntax io.backend kernel namespaces ;
|
||||||
|
IN: alien.libraries
|
||||||
|
|
||||||
|
HELP: <library>
|
||||||
|
{ $values
|
||||||
|
{ "path" "a pathname string" } { "abi" "the ABI used by the library, either " { $snippet "cdecl" } " or " { $snippet "stdcall" } }
|
||||||
|
{ "library" library } }
|
||||||
|
{ $description "Opens a C library using the path and ABI parameters and outputs a library tuple." }
|
||||||
|
{ $notes "User code should use " { $link add-library } " so that the opened library is added to a global hashtable, " { $link libraries } "." } ;
|
||||||
|
|
||||||
|
HELP: libraries
|
||||||
|
{ $description "A global hashtable that keeps a list of open libraries. Use the " { $link add-library } " word to construct a library and add it with a single call." } ;
|
||||||
|
|
||||||
|
HELP: library
|
||||||
|
{ $values { "name" "a string" } { "library" "a hashtable" } }
|
||||||
|
{ $description "Looks up a library by its logical name. The library object is a hashtable with the following keys:"
|
||||||
|
{ $list
|
||||||
|
{ { $snippet "name" } " - the full path of the C library binary" }
|
||||||
|
{ { $snippet "abi" } " - the ABI used by the library, either " { $snippet "cdecl" } " or " { $snippet "stdcall" } }
|
||||||
|
{ { $snippet "dll" } " - an instance of the " { $link dll } " class; only set if the library is loaded" }
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
|
||||||
|
HELP: dlopen ( path -- dll )
|
||||||
|
{ $values { "path" "a pathname string" } { "dll" "a DLL handle" } }
|
||||||
|
{ $description "Opens a native library and outputs a handle which may be passed to " { $link dlsym } " or " { $link dlclose } "." }
|
||||||
|
{ $errors "Throws an error if the library could not be found, or if loading fails for some other reason." }
|
||||||
|
{ $notes "This is the low-level facility used to implement " { $link load-library } ". Use the latter instead." } ;
|
||||||
|
|
||||||
|
HELP: dlsym ( name dll -- alien )
|
||||||
|
{ $values { "name" "a C symbol name" } { "dll" "a DLL handle" } { "alien" "an alien pointer" } }
|
||||||
|
{ $description "Looks up a symbol in a native library. If " { $snippet "dll" } " is " { $link f } " looks for the symbol in the runtime executable." }
|
||||||
|
{ $errors "Throws an error if the symbol could not be found." } ;
|
||||||
|
|
||||||
|
HELP: dlclose ( dll -- )
|
||||||
|
{ $values { "dll" "a DLL handle" } }
|
||||||
|
{ $description "Closes a DLL handle created by " { $link dlopen } ". This word might not be implemented on all platforms." } ;
|
||||||
|
|
||||||
|
HELP: load-library
|
||||||
|
{ $values { "name" "a string" } { "dll" "a DLL handle" } }
|
||||||
|
{ $description "Loads a library by logical name and outputs a handle which may be passed to " { $link dlsym } " or " { $link dlclose } ". If the library is already loaded, returns the existing handle." } ;
|
||||||
|
|
||||||
|
HELP: add-library
|
||||||
|
{ $values { "name" "a string" } { "path" "a string" } { "abi" "one of " { $snippet "\"cdecl\"" } " or " { $snippet "\"stdcall\"" } } }
|
||||||
|
{ $description "Defines a new logical library named " { $snippet "name" } " located in the file system at " { $snippet "path" } "and the specified ABI." }
|
||||||
|
{ $notes "Because the entire source file is parsed before top-level forms are executed, " { $link add-library } " cannot be used in the same file as " { $link POSTPONE: FUNCTION: } " definitions from that library. The " { $link add-library } " call will happen too late, after compilation, and the alien calls will not work."
|
||||||
|
$nl
|
||||||
|
"Instead, " { $link add-library } " calls must either be placed in different source files from those that use that library, or alternatively, " { $link "syntax-immediate" } " can be used to load the library before compilation." }
|
||||||
|
{ $examples "Here is a typical usage of " { $link add-library } ":"
|
||||||
|
{ $code
|
||||||
|
"<< \"freetype\" {"
|
||||||
|
" { [ os macosx? ] [ \"libfreetype.6.dylib\" \"cdecl\" add-library ] }"
|
||||||
|
" { [ os windows? ] [ \"freetype6.dll\" \"cdecl\" add-library ] }"
|
||||||
|
" [ drop ]"
|
||||||
|
"} cond >>"
|
||||||
|
}
|
||||||
|
"Note the parse time evaluation with " { $link POSTPONE: << } "." } ;
|
|
@ -0,0 +1,21 @@
|
||||||
|
! Copyright (C) 2009 Slava Pestov.
|
||||||
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
|
USING: accessors alien assocs io.backend kernel namespaces ;
|
||||||
|
IN: alien.libraries
|
||||||
|
|
||||||
|
SYMBOL: libraries
|
||||||
|
|
||||||
|
libraries [ H{ } clone ] initialize
|
||||||
|
|
||||||
|
TUPLE: library path abi dll ;
|
||||||
|
|
||||||
|
: library ( name -- library ) libraries get at ;
|
||||||
|
|
||||||
|
: <library> ( path abi -- library )
|
||||||
|
over dup [ dlopen ] when \ library boa ;
|
||||||
|
|
||||||
|
: load-library ( name -- dll )
|
||||||
|
library dup [ dll>> ] when ;
|
||||||
|
|
||||||
|
: add-library ( name path abi -- )
|
||||||
|
<library> swap libraries get set-at ;
|
|
@ -4,7 +4,7 @@ USING: accessors arrays alien alien.c-types alien.structs
|
||||||
alien.arrays alien.strings kernel math namespaces parser
|
alien.arrays alien.strings kernel math namespaces parser
|
||||||
sequences words quotations math.parser splitting grouping
|
sequences words quotations math.parser splitting grouping
|
||||||
effects assocs combinators lexer strings.parser alien.parser
|
effects assocs combinators lexer strings.parser alien.parser
|
||||||
fry vocabs.parser words.constant ;
|
fry vocabs.parser words.constant alien.libraries ;
|
||||||
IN: alien.syntax
|
IN: alien.syntax
|
||||||
|
|
||||||
SYNTAX: DLL" lexer get skip-blank parse-string dlopen parsed ;
|
SYNTAX: DLL" lexer get skip-blank parse-string dlopen parsed ;
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
! License: http://factorcode.org/license.txt
|
! License: http://factorcode.org/license.txt
|
||||||
|
|
||||||
USING: system combinators alien alien.syntax alien.c-types
|
USING: system combinators alien alien.syntax alien.c-types
|
||||||
alien.destructors kernel accessors sequences arrays ui.gadgets ;
|
alien.destructors kernel accessors sequences arrays ui.gadgets
|
||||||
|
alien.libraries ;
|
||||||
|
|
||||||
IN: cairo.ffi
|
IN: cairo.ffi
|
||||||
<< {
|
<< {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
USING: namespaces make math math.order math.parser sequences accessors
|
USING: namespaces make math math.order math.parser sequences accessors
|
||||||
kernel kernel.private layouts assocs words summary arrays
|
kernel kernel.private layouts assocs words summary arrays
|
||||||
combinators classes.algebra alien alien.c-types alien.structs
|
combinators classes.algebra alien alien.c-types alien.structs
|
||||||
alien.strings alien.arrays alien.complex sets libc
|
alien.strings alien.arrays alien.complex sets libc alien.libraries
|
||||||
continuations.private fry cpu.architecture
|
continuations.private fry cpu.architecture
|
||||||
compiler.errors
|
compiler.errors
|
||||||
compiler.alien
|
compiler.alien
|
||||||
|
|
|
@ -1,10 +1,27 @@
|
||||||
IN: compiler.tests
|
|
||||||
USING: alien alien.c-types alien.syntax compiler kernel
|
USING: alien alien.c-types alien.syntax compiler kernel
|
||||||
namespaces namespaces tools.test sequences stack-checker
|
namespaces namespaces tools.test sequences stack-checker
|
||||||
stack-checker.errors words arrays parser quotations
|
stack-checker.errors words arrays parser quotations
|
||||||
continuations effects namespaces.private io io.streams.string
|
continuations effects namespaces.private io io.streams.string
|
||||||
memory system threads tools.test math accessors combinators
|
memory system threads tools.test math accessors combinators
|
||||||
specialized-arrays.float ;
|
specialized-arrays.float alien.libraries io.pathnames
|
||||||
|
io.backend ;
|
||||||
|
IN: compiler.tests
|
||||||
|
|
||||||
|
<<
|
||||||
|
: libfactor-ffi-tests-path ( -- string )
|
||||||
|
"resource:" normalize-path
|
||||||
|
{
|
||||||
|
{ [ os winnt? ] [ "libfactor-ffi-test.dll" ] }
|
||||||
|
{ [ os macosx? ] [ "libfactor-ffi-test.dylib" ] }
|
||||||
|
{ [ os unix? ] [ "libfactor-ffi-test.so" ] }
|
||||||
|
} cond append-path ;
|
||||||
|
|
||||||
|
"f-cdecl" libfactor-ffi-tests-path "cdecl" add-library
|
||||||
|
|
||||||
|
"f-stdcall" libfactor-ffi-tests-path "stdcall" add-library
|
||||||
|
>>
|
||||||
|
|
||||||
|
LIBRARY: f-cdecl
|
||||||
|
|
||||||
FUNCTION: void ffi_test_0 ;
|
FUNCTION: void ffi_test_0 ;
|
||||||
[ ] [ ffi_test_0 ] unit-test
|
[ ] [ ffi_test_0 ] unit-test
|
||||||
|
@ -107,9 +124,9 @@ unit-test
|
||||||
"int" { "int" "int" "int" "int" } "stdcall" alien-indirect
|
"int" { "int" "int" "int" "int" } "stdcall" alien-indirect
|
||||||
gc ;
|
gc ;
|
||||||
|
|
||||||
<< "f-stdcall" f "stdcall" add-library >>
|
LIBRARY: f-stdcall
|
||||||
|
|
||||||
[ f ] [ "f-stdcall" load-library ] unit-test
|
[ f ] [ "f-stdcall" load-library f = ] unit-test
|
||||||
[ "stdcall" ] [ "f-stdcall" library abi>> ] unit-test
|
[ "stdcall" ] [ "f-stdcall" library abi>> ] unit-test
|
||||||
|
|
||||||
: ffi_test_18 ( w x y z -- int )
|
: ffi_test_18 ( w x y z -- int )
|
||||||
|
@ -149,7 +166,7 @@ FUNCTION: void ffi_test_20 double x1, double x2, double x3,
|
||||||
|
|
||||||
: ffi_test_31 ( a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a -- result y )
|
: ffi_test_31 ( a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a -- result y )
|
||||||
"int"
|
"int"
|
||||||
f "ffi_test_31"
|
"f-stdcall" "ffi_test_31"
|
||||||
{ "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" }
|
{ "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" }
|
||||||
alien-invoke gc 3 ;
|
alien-invoke gc 3 ;
|
||||||
|
|
||||||
|
@ -157,7 +174,7 @@ FUNCTION: void ffi_test_20 double x1, double x2, double x3,
|
||||||
|
|
||||||
: ffi_test_31_point_5 ( a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a -- result )
|
: ffi_test_31_point_5 ( a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a -- result )
|
||||||
"float"
|
"float"
|
||||||
f "ffi_test_31_point_5"
|
"f-stdcall" "ffi_test_31_point_5"
|
||||||
{ "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" }
|
{ "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" }
|
||||||
alien-invoke ;
|
alien-invoke ;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
IN: compiler.tree.debugger.tests
|
IN: compiler.tree.debugger.tests
|
||||||
USING: compiler.tree.debugger tools.test ;
|
USING: compiler.tree.debugger tools.test sorting sequences io math.order ;
|
||||||
|
|
||||||
\ optimized. must-infer
|
\ optimized. must-infer
|
||||||
\ optimizer-report. must-infer
|
\ optimizer-report. must-infer
|
||||||
|
|
||||||
|
[ [ <=> ] sort ] optimized.
|
||||||
|
[ <reversed> [ print ] each ] optimizer-report.
|
|
@ -160,7 +160,7 @@ SYMBOL: node-count
|
||||||
{ [ dup generic? ] [ generics-called ] }
|
{ [ dup generic? ] [ generics-called ] }
|
||||||
{ [ dup method-body? ] [ methods-called ] }
|
{ [ dup method-body? ] [ methods-called ] }
|
||||||
[ words-called ]
|
[ words-called ]
|
||||||
} cond inc-at
|
} cond get inc-at
|
||||||
] [ drop ] if
|
] [ drop ] if
|
||||||
] each-node
|
] each-node
|
||||||
node-count set
|
node-count set
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
! Copyright (C) 2009 Doug Coleman.
|
! Copyright (C) 2009 Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: alien alien.syntax combinators system ;
|
USING: alien alien.syntax combinators system alien.libraries ;
|
||||||
IN: compression.zlib.ffi
|
IN: compression.zlib.ffi
|
||||||
|
|
||||||
<< "zlib" {
|
<< "zlib" {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
! Copyright (C) 2009 Slava Pestov.
|
! Copyright (C) 2009 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: words parser alien alien.c-types kernel fry accessors ;
|
USING: words parser alien alien.c-types kernel fry accessors
|
||||||
|
alien.libraries ;
|
||||||
IN: core-text.utilities
|
IN: core-text.utilities
|
||||||
|
|
||||||
SYNTAX: C-GLOBAL:
|
SYNTAX: C-GLOBAL:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
! Copyright (C) 2007, 2008 Doug Coleman.
|
! Copyright (C) 2007, 2008 Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
! tested on debian linux with postgresql 8.1
|
! tested on debian linux with postgresql 8.1
|
||||||
USING: alien alien.syntax combinators system ;
|
USING: alien alien.syntax combinators system alien.libraries ;
|
||||||
IN: db.postgresql.ffi
|
IN: db.postgresql.ffi
|
||||||
|
|
||||||
<< "postgresql" {
|
<< "postgresql" {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
! An interface to the sqlite database. Tested against sqlite v3.1.3.
|
! An interface to the sqlite database. Tested against sqlite v3.1.3.
|
||||||
! Not all functions have been wrapped.
|
! Not all functions have been wrapped.
|
||||||
USING: alien compiler kernel math namespaces sequences strings alien.syntax
|
USING: alien compiler kernel math namespaces sequences strings alien.syntax
|
||||||
system combinators alien.c-types ;
|
system combinators alien.c-types alien.libraries ;
|
||||||
IN: db.sqlite.ffi
|
IN: db.sqlite.ffi
|
||||||
|
|
||||||
<< "sqlite" {
|
<< "sqlite" {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
USING: alien arrays generic generic.math help.markup help.syntax
|
USING: alien arrays generic generic.math help.markup help.syntax
|
||||||
kernel math memory strings sbufs vectors io io.files classes
|
kernel math memory strings sbufs vectors io io.files classes
|
||||||
help generic.standard continuations io.files.private listener ;
|
help generic.standard continuations io.files.private listener
|
||||||
|
alien.libraries ;
|
||||||
IN: debugger
|
IN: debugger
|
||||||
|
|
||||||
ARTICLE: "debugger" "The debugger"
|
ARTICLE: "debugger" "The debugger"
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
IN: definitions.icons
|
||||||
|
USING: help.markup help.syntax ;
|
||||||
|
|
||||||
|
ARTICLE: "definitions.icons" "Definition icons"
|
||||||
|
"The " { $vocab-link "definitions.icons" } " vocabulary associates common definition types with icons."
|
||||||
|
{ $definition-icons }
|
||||||
|
"Looking up the icon associated with a definition:"
|
||||||
|
{ $subsection definition-icon }
|
||||||
|
"Defining new icons:"
|
||||||
|
{ $subsection POSTPONE: ICON: } ;
|
||||||
|
|
||||||
|
ABOUT: "definitions.icons"
|
|
@ -2,22 +2,29 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: assocs classes.predicate fry generic io.pathnames kernel
|
USING: assocs classes.predicate fry generic io.pathnames kernel
|
||||||
macros sequences vocabs words words.symbol words.constant
|
macros sequences vocabs words words.symbol words.constant
|
||||||
lexer parser help.topics ;
|
lexer parser help.topics help.markup namespaces sorting ;
|
||||||
IN: definitions.icons
|
IN: definitions.icons
|
||||||
|
|
||||||
GENERIC: definition-icon ( definition -- path )
|
GENERIC: definition-icon ( definition -- path )
|
||||||
|
|
||||||
<PRIVATE
|
|
||||||
|
|
||||||
: definition-icon-path ( string -- string' )
|
: definition-icon-path ( string -- string' )
|
||||||
"resource:basis/definitions/icons/" prepend-path ".tiff" append ;
|
"vocab:definitions/icons/" prepend-path ".tiff" append ;
|
||||||
|
|
||||||
<<
|
<<
|
||||||
|
|
||||||
SYNTAX: ICON:
|
SYMBOL: icons
|
||||||
scan-word \ definition-icon create-method
|
|
||||||
scan '[ drop _ definition-icon-path ]
|
icons [ H{ } clone ] initialize
|
||||||
define ;
|
|
||||||
|
: define-icon ( class name -- )
|
||||||
|
[ swap icons get set-at ]
|
||||||
|
[
|
||||||
|
[ \ definition-icon create-method ]
|
||||||
|
[ '[ drop _ definition-icon-path ] ] bi*
|
||||||
|
define
|
||||||
|
] 2bi ;
|
||||||
|
|
||||||
|
SYNTAX: ICON: scan-word scan define-icon ;
|
||||||
|
|
||||||
>>
|
>>
|
||||||
|
|
||||||
|
@ -29,12 +36,15 @@ ICON: primitive primitive-word
|
||||||
ICON: symbol symbol-word
|
ICON: symbol symbol-word
|
||||||
ICON: constant constant-word
|
ICON: constant constant-word
|
||||||
ICON: word normal-word
|
ICON: word normal-word
|
||||||
ICON: vocab-link unopen-vocab
|
|
||||||
ICON: word-link word-help-article
|
ICON: word-link word-help-article
|
||||||
ICON: link help-article
|
ICON: link help-article
|
||||||
|
ICON: runnable-vocab runnable-vocab
|
||||||
|
ICON: vocab open-vocab
|
||||||
|
ICON: vocab-link unopen-vocab
|
||||||
|
|
||||||
PRIVATE>
|
: $definition-icons ( element -- )
|
||||||
|
drop
|
||||||
M: vocab definition-icon
|
icons get >alist sort-keys
|
||||||
vocab-main "runnable-vocab" "open-vocab" ? definition-icon-path ;
|
[ [ <$link> ] [ definition-icon-path <$image> ] bi* swap ] assoc-map
|
||||||
|
{ "" "Definition class" } prefix
|
||||||
|
$table ;
|
|
@ -1,7 +1,8 @@
|
||||||
! Copyright (C) 2008 Matthew Willis.
|
! Copyright (C) 2008 Matthew Willis.
|
||||||
! Copyright (C) 2009 Slava Pestov.
|
! Copyright (C) 2009 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license
|
! See http://factorcode.org/license.txt for BSD license
|
||||||
USING: alien alien.syntax alien.destructors combinators system ;
|
USING: alien alien.syntax alien.destructors combinators system
|
||||||
|
alien.libraries ;
|
||||||
IN: glib
|
IN: glib
|
||||||
|
|
||||||
<<
|
<<
|
||||||
|
|
|
@ -11,10 +11,7 @@ HELP: article-parent
|
||||||
|
|
||||||
HELP: help-path
|
HELP: help-path
|
||||||
{ $values { "topic" "an article name or a word" } { "seq" "a new sequence" } }
|
{ $values { "topic" "an article name or a word" } { "seq" "a new sequence" } }
|
||||||
{ $description "Outputs a sequence of all help articles which contain " { $snippet "topic" } " as a subsection, traversing all the way up to the root." }
|
{ $description "Outputs a sequence of all help articles which contain " { $snippet "topic" } " as a subsection, traversing all the way up to the root." } ;
|
||||||
{ $examples
|
|
||||||
{ $example "USING: help.crossref prettyprint ;" "\"sequences\" help-path ." "{ \"collections\" \"handbook-language-reference\" \"handbook\" }" }
|
|
||||||
} ;
|
|
||||||
|
|
||||||
HELP: xref-article
|
HELP: xref-article
|
||||||
{ $values { "topic" "an article name or a word" } }
|
{ $values { "topic" "an article name or a word" } }
|
||||||
|
|
|
@ -69,12 +69,6 @@ ARTICLE: "element-types" "Element types"
|
||||||
IN: help.markup
|
IN: help.markup
|
||||||
ABOUT: "element-types"
|
ABOUT: "element-types"
|
||||||
|
|
||||||
ARTICLE: "browsing-help" "Browsing documentation"
|
|
||||||
"The easiest way to browse the help is from the help browser tool in the UI, however you can also display help topics in the listener. Help topics are identified by article name strings, or words. You can request a specific help topic:"
|
|
||||||
{ $subsection help }
|
|
||||||
"You can also display the main help article for a vocabulary:"
|
|
||||||
{ $subsection about } ;
|
|
||||||
|
|
||||||
ARTICLE: "writing-help" "Writing documentation"
|
ARTICLE: "writing-help" "Writing documentation"
|
||||||
"By convention, documentation is written in files whose names end with " { $snippet "-docs.factor" } ". Vocabulary documentation should be placed in the same directory as the vocabulary source code; see " { $link "vocabs.loader" } "."
|
"By convention, documentation is written in files whose names end with " { $snippet "-docs.factor" } ". Vocabulary documentation should be placed in the same directory as the vocabulary source code; see " { $link "vocabs.loader" } "."
|
||||||
$nl
|
$nl
|
||||||
|
@ -148,11 +142,6 @@ HELP: help
|
||||||
{ $description
|
{ $description
|
||||||
"Displays a help topic."
|
"Displays a help topic."
|
||||||
} ;
|
} ;
|
||||||
HELP: about
|
|
||||||
{ $values { "vocab" "a vocabulary specifier" } }
|
|
||||||
{ $description
|
|
||||||
"Displays the main help article for the vocabulary. The main help article is set with the " { $link POSTPONE: ABOUT: } " parsing word."
|
|
||||||
} ;
|
|
||||||
|
|
||||||
HELP: :help
|
HELP: :help
|
||||||
{ $description "Displays documentation for the most recent error." } ;
|
{ $description "Displays documentation for the most recent error." } ;
|
||||||
|
|
|
@ -127,15 +127,6 @@ help-hook [ [ print-topic ] ] initialize
|
||||||
: help ( topic -- )
|
: help ( topic -- )
|
||||||
help-hook get call( topic -- ) ;
|
help-hook get call( topic -- ) ;
|
||||||
|
|
||||||
: about ( vocab -- )
|
|
||||||
dup require
|
|
||||||
dup vocab [ ] [ no-vocab ] ?if
|
|
||||||
dup vocab-help [ help ] [
|
|
||||||
"The " write vocab-name write
|
|
||||||
" vocabulary does not define a main help article." print
|
|
||||||
"To define one, refer to \\ ABOUT: help" print
|
|
||||||
] ?if ;
|
|
||||||
|
|
||||||
: ($index) ( articles -- )
|
: ($index) ( articles -- )
|
||||||
sort-articles [ \ $subsection swap 2array ] map print-element ;
|
sort-articles [ \ $subsection swap 2array ] map print-element ;
|
||||||
|
|
||||||
|
|
|
@ -2,18 +2,22 @@ IN: help.home
|
||||||
USING: help.markup help.syntax ;
|
USING: help.markup help.syntax ;
|
||||||
|
|
||||||
ARTICLE: "help.home" "Factor documentation"
|
ARTICLE: "help.home" "Factor documentation"
|
||||||
{ $heading "Starting points" }
|
"If this is your first time with Factor, you can start by writing " { $link "first-program" } "."
|
||||||
|
{ $heading "Reference" }
|
||||||
{ $list
|
{ $list
|
||||||
{ $link "ui-listener" }
|
|
||||||
{ $link "handbook" }
|
{ $link "handbook" }
|
||||||
{ $link "vocab-index" }
|
{ $link "vocab-index" }
|
||||||
|
{ $link "ui-tools" }
|
||||||
|
{ $link "handbook-library-reference" }
|
||||||
}
|
}
|
||||||
{ $heading "Recently visited" }
|
{ $heading "Recently visited" }
|
||||||
{ $table
|
{ $table
|
||||||
{ "Words" "Articles" "Vocabs" }
|
{ "Words" "Articles" "Vocabs" }
|
||||||
{ { $recent recent-words } { $recent recent-articles } { $recent recent-vocabs } }
|
{ { $recent recent-words } { $recent recent-articles } { $recent recent-vocabs } }
|
||||||
} print-element
|
}
|
||||||
|
"The browser, completion popups and other tools use a common set of " { $link "definitions.icons" } "."
|
||||||
{ $heading "Recent searches" }
|
{ $heading "Recent searches" }
|
||||||
{ $recent-searches } ;
|
{ $recent-searches }
|
||||||
|
"Use the search field in the top-right of the " { $link "ui-browser" } " window to search for words, vocabularies and help articles." ;
|
||||||
|
|
||||||
ABOUT: "help.home"
|
ABOUT: "help.home"
|
|
@ -24,7 +24,7 @@ M: object add-recent-where f ;
|
||||||
first get [ nl ] [ 1array $pretty-link ] interleave ;
|
first get [ nl ] [ 1array $pretty-link ] interleave ;
|
||||||
|
|
||||||
: $recent-searches ( element -- )
|
: $recent-searches ( element -- )
|
||||||
drop recent-searches get [ nl ] [ ($link) ] interleave ;
|
drop recent-searches get [ <$link> ] map $list ;
|
||||||
|
|
||||||
: redisplay-recent-page ( -- )
|
: redisplay-recent-page ( -- )
|
||||||
"help.home" >link dup associate
|
"help.home" >link dup associate
|
||||||
|
|
|
@ -140,6 +140,9 @@ ALIAS: $slot $snippet
|
||||||
: $image ( element -- )
|
: $image ( element -- )
|
||||||
[ [ "" ] dip first image associate format ] ($span) ;
|
[ [ "" ] dip first image associate format ] ($span) ;
|
||||||
|
|
||||||
|
: <$image> ( path -- element )
|
||||||
|
1array \ $image prefix ;
|
||||||
|
|
||||||
! Some links
|
! Some links
|
||||||
: write-link ( string object -- )
|
: write-link ( string object -- )
|
||||||
link-style get [ write-object ] with-style ;
|
link-style get [ write-object ] with-style ;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
IN: help.tips
|
IN: help.tips
|
||||||
USING: help.markup help.syntax debugger ;
|
USING: help.markup help.syntax debugger prettyprint see help help.vocabs
|
||||||
|
help.apropos tools.time stack-checker editors ;
|
||||||
|
|
||||||
TIP: "To look at the most recent error, run " { $link :error } ". To look at the most recent error's callstack, run " { $link :c } "." ;
|
TIP: "To look at the most recent error, run " { $link :error } ". To look at the most recent error's callstack, run " { $link :c } "." ;
|
||||||
|
|
||||||
|
@ -15,6 +16,8 @@ TIP: "You can write documentation for your own code using the " { $link "help" }
|
||||||
|
|
||||||
TIP: "You can write graphical applications using the " { $link "ui" } "." ;
|
TIP: "You can write graphical applications using the " { $link "ui" } "." ;
|
||||||
|
|
||||||
|
TIP: "Power tools: " { $links see edit help about apropos time infer. } ;
|
||||||
|
|
||||||
ARTICLE: "all-tips-of-the-day" "All tips of the day"
|
ARTICLE: "all-tips-of-the-day" "All tips of the day"
|
||||||
{ $tips-of-the-day } ;
|
{ $tips-of-the-day } ;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
USING: help.markup help.syntax io strings ;
|
USING: help help.topics help.markup help.syntax io strings ;
|
||||||
IN: help.vocabs
|
IN: help.vocabs
|
||||||
|
|
||||||
ARTICLE: "vocab-tags" "Vocabulary tags"
|
ARTICLE: "vocab-tags" "Vocabulary tags"
|
||||||
|
@ -15,3 +15,24 @@ ARTICLE: "vocab-index" "Vocabulary index"
|
||||||
HELP: words.
|
HELP: words.
|
||||||
{ $values { "vocab" "a vocabulary name" } }
|
{ $values { "vocab" "a vocabulary name" } }
|
||||||
{ $description "Printings a listing of all the words in a vocabulary, categorized by type." } ;
|
{ $description "Printings a listing of all the words in a vocabulary, categorized by type." } ;
|
||||||
|
|
||||||
|
HELP: about
|
||||||
|
{ $values { "vocab" "a vocabulary specifier" } }
|
||||||
|
{ $description
|
||||||
|
"Displays the main help article for the vocabulary. The main help article is set with the " { $link POSTPONE: ABOUT: } " parsing word."
|
||||||
|
} ;
|
||||||
|
|
||||||
|
ARTICLE: "browsing-help" "Browsing documentation"
|
||||||
|
"Help topics are instances of a mixin:"
|
||||||
|
{ $subsection topic }
|
||||||
|
"Most commonly, topics are article name strings, or words. You can display a specific help topic:"
|
||||||
|
{ $subsection help }
|
||||||
|
"You can also display the help for a vocabulary:"
|
||||||
|
{ $subsection about }
|
||||||
|
"To list a vocabulary's words only:"
|
||||||
|
{ $subsection words. }
|
||||||
|
{ $examples
|
||||||
|
{ $code "\"evaluator\" help" }
|
||||||
|
{ $code "\\ + help" }
|
||||||
|
{ $code "\"io.files\" about" }
|
||||||
|
} ;
|
|
@ -9,6 +9,9 @@ make namespaces prettyprint sequences sets sorting summary
|
||||||
tools.vocabs vocabs vocabs.loader words words.symbol definitions.icons ;
|
tools.vocabs vocabs vocabs.loader words words.symbol definitions.icons ;
|
||||||
IN: help.vocabs
|
IN: help.vocabs
|
||||||
|
|
||||||
|
: about ( vocab -- )
|
||||||
|
[ require ] [ vocab help ] bi ;
|
||||||
|
|
||||||
: $pretty-link ( element -- )
|
: $pretty-link ( element -- )
|
||||||
[ first definition-icon 1array $image " " print-element ]
|
[ first definition-icon 1array $image " " print-element ]
|
||||||
[ $definition-link ]
|
[ $definition-link ]
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
USING: alien alien.fortran kernel system combinators ;
|
USING: alien alien.fortran kernel system combinators
|
||||||
|
alien.libraries ;
|
||||||
IN: math.blas.ffi
|
IN: math.blas.ffi
|
||||||
|
|
||||||
<<
|
<<
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
USING: kernel alien ;
|
USING: kernel alien alien.libraries ;
|
||||||
IN: opengl.gl.macosx
|
IN: opengl.gl.macosx
|
||||||
|
|
||||||
: gl-function-context ( -- context ) 0 ; inline
|
: gl-function-context ( -- context ) 0 ; inline
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
!
|
!
|
||||||
! export LD_LIBRARY_PATH=/opt/local/lib
|
! export LD_LIBRARY_PATH=/opt/local/lib
|
||||||
|
|
||||||
USING: alien alien.syntax combinators kernel system ;
|
USING: alien alien.syntax combinators kernel system
|
||||||
|
alien.libraries ;
|
||||||
|
|
||||||
IN: openssl.libcrypto
|
IN: openssl.libcrypto
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
! Portions copyright (C) 2008 Slava Pestov
|
! Portions copyright (C) 2008 Slava Pestov
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: alien alien.syntax combinators kernel system namespaces
|
USING: alien alien.syntax combinators kernel system namespaces
|
||||||
assocs parser lexer sequences words quotations math.bitwise ;
|
assocs parser lexer sequences words quotations math.bitwise
|
||||||
|
alien.libraries ;
|
||||||
|
|
||||||
IN: openssl.libssl
|
IN: openssl.libssl
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
!
|
!
|
||||||
! pangocairo bindings, from pango/pangocairo.h
|
! pangocairo bindings, from pango/pangocairo.h
|
||||||
USING: alien alien.syntax combinators system cairo.ffi ;
|
USING: alien alien.syntax combinators system cairo.ffi
|
||||||
|
alien.libraries ;
|
||||||
IN: pango.cairo
|
IN: pango.cairo
|
||||||
|
|
||||||
<< {
|
<< {
|
||||||
|
@ -85,4 +86,4 @@ FUNCTION: void
|
||||||
pango_cairo_layout_path ( cairo_t* cr, PangoLayout* layout ) ;
|
pango_cairo_layout_path ( cairo_t* cr, PangoLayout* layout ) ;
|
||||||
|
|
||||||
FUNCTION: void
|
FUNCTION: void
|
||||||
pango_cairo_error_underline_path ( cairo_t* cr, double x, double y, double width, double height ) ;
|
pango_cairo_error_underline_path ( cairo_t* cr, double x, double y, double width, double height ) ;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
! Copyright (C) 2009 Slava Pestov.
|
! Copyright (C) 2009 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license
|
! See http://factorcode.org/license.txt for BSD license
|
||||||
USING: arrays system alien.destructors alien.c-types alien.syntax alien
|
USING: arrays system alien.destructors alien.c-types alien.syntax alien
|
||||||
combinators math.rectangles kernel math ;
|
combinators math.rectangles kernel math alien.libraries ;
|
||||||
IN: pango
|
IN: pango
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
@ -34,4 +34,4 @@ C-STRUCT: PangoRectangle
|
||||||
: PangoRectangle>rect ( PangoRectangle -- rect )
|
: PangoRectangle>rect ( PangoRectangle -- rect )
|
||||||
[ [ PangoRectangle-x pango>float ] [ PangoRectangle-y pango>float ] bi 2array ]
|
[ [ PangoRectangle-x pango>float ] [ PangoRectangle-y pango>float ] bi 2array ]
|
||||||
[ [ PangoRectangle-width pango>float ] [ PangoRectangle-height pango>float ] bi 2array ] bi
|
[ [ PangoRectangle-width pango>float ] [ PangoRectangle-height pango>float ] bi 2array ] bi
|
||||||
<rect> ;
|
<rect> ;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
! Copyright (C) 2008 Slava Pestov.
|
! Copyright (C) 2008 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: kernel sequences accessors combinators math namespaces
|
USING: kernel sequences accessors combinators math namespaces
|
||||||
init sets words
|
init sets words alien.libraries
|
||||||
alien alien.c-types
|
alien alien.c-types
|
||||||
stack-checker.backend stack-checker.errors stack-checker.visitor ;
|
stack-checker.backend stack-checker.errors stack-checker.visitor ;
|
||||||
IN: stack-checker.alien
|
IN: stack-checker.alien
|
||||||
|
|
|
@ -12,6 +12,7 @@ classes.tuple.private vectors vectors.private words definitions
|
||||||
words.private assocs summary compiler.units system.private
|
words.private assocs summary compiler.units system.private
|
||||||
combinators locals locals.backend locals.types words.private
|
combinators locals locals.backend locals.types words.private
|
||||||
quotations.private combinators.private stack-checker.values
|
quotations.private combinators.private stack-checker.values
|
||||||
|
alien.libraries
|
||||||
stack-checker.alien
|
stack-checker.alien
|
||||||
stack-checker.state
|
stack-checker.state
|
||||||
stack-checker.errors
|
stack-checker.errors
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: tools.disassembler namespaces combinators
|
USING: tools.disassembler namespaces combinators
|
||||||
alien alien.syntax alien.c-types lexer parser kernel
|
alien alien.syntax alien.c-types lexer parser kernel
|
||||||
sequences layouts math math.order
|
sequences layouts math math.order alien.libraries
|
||||||
math.parser system make fry arrays ;
|
math.parser system make fry arrays ;
|
||||||
IN: tools.disassembler.udis
|
IN: tools.disassembler.udis
|
||||||
|
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
USING: dlists ui.gadgets ui.gadgets.private
|
|
||||||
kernel ui namespaces io.streams.string io ;
|
|
||||||
IN: tools.test.ui
|
|
||||||
|
|
||||||
! We can't print to output-stream here because that might be a pane
|
|
||||||
! stream, and our graft-queue rebinding here would be captured
|
|
||||||
! by code adding children to the pane...
|
|
||||||
: with-grafted-gadget ( gadget quot -- )
|
|
||||||
[
|
|
||||||
<dlist> \ graft-queue [
|
|
||||||
over
|
|
||||||
graft notify-queued
|
|
||||||
dip
|
|
||||||
ungraft notify-queued
|
|
||||||
] with-variable
|
|
||||||
] with-string-writer print ;
|
|
|
@ -2,9 +2,23 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors arrays colors.constants combinators kernel
|
USING: accessors arrays colors.constants combinators kernel
|
||||||
opengl sequences ui ui.baseline-alignment ui.gadgets
|
opengl sequences ui ui.baseline-alignment ui.gadgets
|
||||||
ui.gadgets.buttons ui.gadgets.labels ui.pens ui.render ui.text ;
|
ui.gadgets.buttons ui.gadgets.labels ui.pens ui.render ui.text
|
||||||
|
ui.gadgets.private dlists namespaces io.streams.string io ;
|
||||||
IN: ui.gadgets.debug
|
IN: ui.gadgets.debug
|
||||||
|
|
||||||
|
! We can't print to output-stream here because that might be a pane
|
||||||
|
! stream, and our graft-queue rebinding here would be captured
|
||||||
|
! by code adding children to the pane...
|
||||||
|
: with-grafted-gadget ( gadget quot -- )
|
||||||
|
[
|
||||||
|
<dlist> \ graft-queue set
|
||||||
|
<dlist> \ layout-queue set
|
||||||
|
over
|
||||||
|
graft notify-queued
|
||||||
|
dip
|
||||||
|
ungraft notify-queued
|
||||||
|
] with-string-writer print ; inline
|
||||||
|
|
||||||
TUPLE: baseline-gadget < gadget baseline cap-height ;
|
TUPLE: baseline-gadget < gadget baseline cap-height ;
|
||||||
|
|
||||||
M: baseline-gadget baseline baseline>> ;
|
M: baseline-gadget baseline baseline>> ;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
USING: accessors ui.gadgets.editors tools.test kernel io
|
USING: accessors ui.gadgets.editors tools.test kernel io
|
||||||
io.streams.plain definitions namespaces ui.gadgets
|
io.streams.plain definitions namespaces ui.gadgets
|
||||||
ui.gadgets.grids prettyprint documents ui.gestures tools.test.ui
|
ui.gadgets.grids prettyprint documents ui.gestures ui.gadgets.debug
|
||||||
models documents.elements ui.gadgets.scrollers ui.gadgets.line-support
|
models documents.elements ui.gadgets.scrollers ui.gadgets.line-support
|
||||||
sequences ;
|
sequences ;
|
||||||
IN: ui.gadgets.editors.tests
|
IN: ui.gadgets.editors.tests
|
||||||
|
|
|
@ -214,7 +214,8 @@ M: gadget ungraft* drop ;
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
|
||||||
: graft-queue ( -- dlist ) \ graft-queue get ;
|
: graft-queue ( -- dlist )
|
||||||
|
\ graft-queue get [ "UI not running" throw ] unless* ;
|
||||||
|
|
||||||
: unqueue-graft ( gadget -- )
|
: unqueue-graft ( gadget -- )
|
||||||
[ graft-node>> graft-queue delete-node ]
|
[ graft-node>> graft-queue delete-node ]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
USING: alien ui.gadgets.panes ui.gadgets namespaces
|
USING: alien ui.gadgets.panes ui.gadgets namespaces
|
||||||
kernel sequences io io.styles io.streams.string tools.test
|
kernel sequences io io.styles io.streams.string tools.test
|
||||||
prettyprint definitions help help.syntax help.markup
|
prettyprint definitions help help.syntax help.markup
|
||||||
help.stylesheet splitting tools.test.ui models math summary
|
help.stylesheet splitting ui.gadgets.debug models math summary
|
||||||
inspector accessors help.topics see ;
|
inspector accessors help.topics see ;
|
||||||
IN: ui.gadgets.panes.tests
|
IN: ui.gadgets.panes.tests
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
USING: ui.gadgets ui.gadgets.scrollers namespaces tools.test
|
USING: ui.gadgets ui.gadgets.scrollers namespaces tools.test
|
||||||
kernel models models.product models.range ui.gadgets.viewports
|
kernel models models.product models.range ui.gadgets.viewports
|
||||||
ui.gadgets.labels ui.gadgets.grids ui.gadgets.sliders math
|
ui.gadgets.labels ui.gadgets.grids ui.gadgets.sliders math
|
||||||
math.vectors arrays sequences tools.test.ui math.rectangles
|
math.vectors arrays sequences ui.gadgets.debug math.rectangles
|
||||||
accessors ui.gadgets.buttons ui.gadgets.packs
|
accessors ui.gadgets.buttons ui.gadgets.packs
|
||||||
ui.gadgets.scrollers.private ;
|
ui.gadgets.scrollers.private ;
|
||||||
IN: ui.gadgets.scrollers.tests
|
IN: ui.gadgets.scrollers.tests
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
IN: ui.tools.browser.tests
|
IN: ui.tools.browser.tests
|
||||||
USING: tools.test tools.test.ui ui.tools.browser math ;
|
USING: tools.test ui.gadgets.debug ui.tools.browser math ;
|
||||||
|
|
||||||
\ <browser-gadget> must-infer
|
\ <browser-gadget> must-infer
|
||||||
[ ] [ \ + <browser-gadget> [ ] with-grafted-gadget ] unit-test
|
[ ] [ \ + <browser-gadget> [ ] with-grafted-gadget ] unit-test
|
||||||
|
|
|
@ -78,7 +78,7 @@ M: browser-gadget focusable-child* search-field>> ;
|
||||||
<browser-gadget> "Browser" open-status-window ;
|
<browser-gadget> "Browser" open-status-window ;
|
||||||
|
|
||||||
: browser-window ( -- )
|
: browser-window ( -- )
|
||||||
"handbook" (browser-window) ;
|
"help.home" (browser-window) ;
|
||||||
|
|
||||||
\ browser-window H{ { +nullary+ t } } define-command
|
\ browser-window H{ { +nullary+ t } } define-command
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ M: browser-gadget focusable-child* search-field>> ;
|
||||||
|
|
||||||
: show-browser ( -- )
|
: show-browser ( -- )
|
||||||
[ browser-gadget? ] find-window
|
[ browser-gadget? ] find-window
|
||||||
[ raise-window ] [ browser-window ] if* ;
|
[ [ raise-window ] [ request-focus ] bi ] [ browser-window ] if* ;
|
||||||
|
|
||||||
\ show-browser H{ { +nullary+ t } } define-command
|
\ show-browser H{ { +nullary+ t } } define-command
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ M: browser-gadget focusable-child* search-field>> ;
|
||||||
|
|
||||||
: com-forward ( browser -- ) model>> go-forward ;
|
: com-forward ( browser -- ) model>> go-forward ;
|
||||||
|
|
||||||
: com-documentation ( browser -- ) "help.home" swap show-help ;
|
: com-home ( browser -- ) "help.home" swap show-help ;
|
||||||
|
|
||||||
: browser-help ( -- ) "ui-browser" com-browse ;
|
: browser-help ( -- ) "ui-browser" com-browse ;
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ M: browser-gadget focusable-child* search-field>> ;
|
||||||
browser-gadget "toolbar" f {
|
browser-gadget "toolbar" f {
|
||||||
{ T{ key-down f { A+ } "LEFT" } com-back }
|
{ T{ key-down f { A+ } "LEFT" } com-back }
|
||||||
{ T{ key-down f { A+ } "RIGHT" } com-forward }
|
{ T{ key-down f { A+ } "RIGHT" } com-forward }
|
||||||
{ f com-documentation }
|
{ T{ key-down f { A+ } "H" } com-home }
|
||||||
{ T{ key-down f f "F1" } browser-help }
|
{ T{ key-down f f "F1" } browser-help }
|
||||||
} define-command-map
|
} define-command-map
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
USING: continuations documents
|
USING: continuations documents
|
||||||
ui.tools.listener hashtables kernel namespaces parser sequences
|
ui.tools.listener hashtables kernel namespaces parser sequences
|
||||||
tools.test ui.commands ui.gadgets ui.gadgets.editors
|
tools.test ui.commands ui.gadgets ui.gadgets.editors
|
||||||
ui.gadgets.panes vocabs words tools.test.ui slots.private
|
ui.gadgets.panes vocabs words ui.gadgets.debug slots.private
|
||||||
threads arrays generic threads accessors listener math
|
threads arrays generic threads accessors listener math
|
||||||
calendar concurrency.promises io ui.tools.common ;
|
calendar concurrency.promises io ui.tools.common ;
|
||||||
IN: ui.tools.listener.tests
|
IN: ui.tools.listener.tests
|
||||||
|
|
|
@ -210,4 +210,4 @@ profiler-gadget "toolbar" f {
|
||||||
|
|
||||||
: com-profile ( quot -- ) profile profiler-window ;
|
: com-profile ( quot -- ) profile profiler-window ;
|
||||||
|
|
||||||
MAIN: profiler-window
|
MAIN: profiler-window
|
||||||
|
|
|
@ -57,8 +57,12 @@ ARTICLE: "ui-tools" "UI developer tools"
|
||||||
"The " { $vocab-link "ui.tools" } " vocabulary hierarchy implements a collection of simple developer tools."
|
"The " { $vocab-link "ui.tools" } " vocabulary hierarchy implements a collection of simple developer tools."
|
||||||
$nl
|
$nl
|
||||||
"To take full advantage of the UI tools, you should be using a supported text editor. See " { $link "editor" } "."
|
"To take full advantage of the UI tools, you should be using a supported text editor. See " { $link "editor" } "."
|
||||||
|
$nl
|
||||||
|
"Common functionality:"
|
||||||
{ $subsection "ui-shortcuts" }
|
{ $subsection "ui-shortcuts" }
|
||||||
{ $subsection "ui-presentations" }
|
{ $subsection "ui-presentations" }
|
||||||
|
{ $subsection "definitions.icons" }
|
||||||
|
"Tools:"
|
||||||
{ $subsection "ui-listener" }
|
{ $subsection "ui-listener" }
|
||||||
{ $subsection "ui-browser" }
|
{ $subsection "ui-browser" }
|
||||||
{ $subsection "ui-inspector" }
|
{ $subsection "ui-inspector" }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
USING: alien sequences ;
|
USING: alien sequences alien.libraries ;
|
||||||
{
|
{
|
||||||
{ "advapi32" "\\windows\\coredll.dll" "stdcall" }
|
{ "advapi32" "\\windows\\coredll.dll" "stdcall" }
|
||||||
{ "gdi32" "\\windows\\coredll.dll" "stdcall" }
|
{ "gdi32" "\\windows\\coredll.dll" "stdcall" }
|
||||||
|
@ -10,6 +10,5 @@ USING: alien sequences ;
|
||||||
{ "libm" "\\windows\\coredll.dll" "stdcall" }
|
{ "libm" "\\windows\\coredll.dll" "stdcall" }
|
||||||
! { "gl" "libGLES_CM.dll" "stdcall" }
|
! { "gl" "libGLES_CM.dll" "stdcall" }
|
||||||
! { "glu" "libGLES_CM.dll" "stdcall" }
|
! { "glu" "libGLES_CM.dll" "stdcall" }
|
||||||
! { "freetype" "libfreetype-6.dll" "stdcall" }
|
|
||||||
{ "ole32" "ole32.dll" "stdcall" }
|
{ "ole32" "ole32.dll" "stdcall" }
|
||||||
} [ first3 add-library ] each
|
} [ first3 add-library ] each
|
||||||
|
|
|
@ -2,12 +2,6 @@ USING: windows.kernel32 windows.ole32 windows.com windows.com.syntax
|
||||||
alien alien.c-types alien.syntax kernel system namespaces math ;
|
alien alien.c-types alien.syntax kernel system namespaces math ;
|
||||||
IN: windows.dinput
|
IN: windows.dinput
|
||||||
|
|
||||||
<<
|
|
||||||
os windows?
|
|
||||||
[ "dinput" "dinput8.dll" "stdcall" add-library ]
|
|
||||||
when
|
|
||||||
>>
|
|
||||||
|
|
||||||
LIBRARY: dinput
|
LIBRARY: dinput
|
||||||
|
|
||||||
TYPEDEF: void* LPDIENUMDEVICESCALLBACKW
|
TYPEDEF: void* LPDIENUMDEVICESCALLBACKW
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
USING: alien sequences ;
|
USING: alien sequences alien.libraries ;
|
||||||
{
|
{
|
||||||
{ "advapi32" "advapi32.dll" "stdcall" }
|
{ "advapi32" "advapi32.dll" "stdcall" }
|
||||||
|
{ "dinput" "dinput8.dll" "stdcall" }
|
||||||
{ "gdi32" "gdi32.dll" "stdcall" }
|
{ "gdi32" "gdi32.dll" "stdcall" }
|
||||||
{ "user32" "user32.dll" "stdcall" }
|
{ "user32" "user32.dll" "stdcall" }
|
||||||
{ "kernel32" "kernel32.dll" "stdcall" }
|
{ "kernel32" "kernel32.dll" "stdcall" }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
USING: byte-arrays arrays help.syntax help.markup
|
USING: byte-arrays arrays help.syntax help.markup
|
||||||
alien.syntax compiler definitions math libc
|
alien.syntax compiler definitions math libc eval
|
||||||
debugger parser io io.backend system
|
debugger parser io io.backend system alien.accessors
|
||||||
alien.accessors eval ;
|
alien.libraries ;
|
||||||
IN: alien
|
IN: alien
|
||||||
|
|
||||||
HELP: alien
|
HELP: alien
|
||||||
|
@ -22,16 +22,6 @@ HELP: <bad-alien>
|
||||||
{ $values { "alien" c-ptr } }
|
{ $values { "alien" c-ptr } }
|
||||||
{ $description "Constructs an invalid alien pointer that has expired." } ;
|
{ $description "Constructs an invalid alien pointer that has expired." } ;
|
||||||
|
|
||||||
HELP: <library>
|
|
||||||
{ $values
|
|
||||||
{ "path" "a pathname string" } { "abi" "the ABI used by the library, either " { $snippet "cdecl" } " or " { $snippet "stdcall" } }
|
|
||||||
{ "library" library } }
|
|
||||||
{ $description "Opens a C library using the path and ABI parameters and outputs a library tuple." }
|
|
||||||
{ $notes "User code should use " { $link add-library } " so that the opened library is added to a global hashtable, " { $link libraries } "." } ;
|
|
||||||
|
|
||||||
HELP: libraries
|
|
||||||
{ $description "A global hashtable that keeps a list of open libraries. Use the " { $link add-library } " word to construct a library and add it with a single call." } ;
|
|
||||||
|
|
||||||
HELP: <displaced-alien> ( displacement c-ptr -- alien )
|
HELP: <displaced-alien> ( displacement c-ptr -- alien )
|
||||||
{ $values { "displacement" "an integer" } { "c-ptr" c-ptr } { "alien" "a new alien" } }
|
{ $values { "displacement" "an integer" } { "c-ptr" c-ptr } { "alien" "a new alien" } }
|
||||||
{ $description "Creates a new alien address object, wrapping a raw memory address. The alien points to a location in memory which is offset by " { $snippet "displacement" } " from the address of " { $snippet "c-ptr" } "." }
|
{ $description "Creates a new alien address object, wrapping a raw memory address. The alien points to a location in memory which is offset by " { $snippet "displacement" } " from the address of " { $snippet "c-ptr" } "." }
|
||||||
|
@ -54,61 +44,6 @@ HELP: <alien>
|
||||||
HELP: c-ptr
|
HELP: c-ptr
|
||||||
{ $class-description "Class of objects consisting of aliens, byte arrays and " { $link f } ". These objects can convert to pointer C types, which are all aliases of " { $snippet "void*" } "." } ;
|
{ $class-description "Class of objects consisting of aliens, byte arrays and " { $link f } ". These objects can convert to pointer C types, which are all aliases of " { $snippet "void*" } "." } ;
|
||||||
|
|
||||||
HELP: library
|
|
||||||
{ $values { "name" "a string" } { "library" "a hashtable" } }
|
|
||||||
{ $description "Looks up a library by its logical name. The library object is a hashtable with the following keys:"
|
|
||||||
{ $list
|
|
||||||
{ { $snippet "name" } " - the full path of the C library binary" }
|
|
||||||
{ { $snippet "abi" } " - the ABI used by the library, either " { $snippet "cdecl" } " or " { $snippet "stdcall" } }
|
|
||||||
{ { $snippet "dll" } " - an instance of the " { $link dll } " class; only set if the library is loaded" }
|
|
||||||
}
|
|
||||||
} ;
|
|
||||||
|
|
||||||
HELP: dlopen ( path -- dll )
|
|
||||||
{ $values { "path" "a pathname string" } { "dll" "a DLL handle" } }
|
|
||||||
{ $description "Opens a native library and outputs a handle which may be passed to " { $link dlsym } " or " { $link dlclose } "." }
|
|
||||||
{ $errors "Throws an error if the library could not be found, or if loading fails for some other reason." }
|
|
||||||
{ $notes "This is the low-level facility used to implement " { $link load-library } ". Use the latter instead." } ;
|
|
||||||
|
|
||||||
HELP: dlsym ( name dll -- alien )
|
|
||||||
{ $values { "name" "a C symbol name" } { "dll" "a DLL handle" } { "alien" "an alien pointer" } }
|
|
||||||
{ $description "Looks up a symbol in a native library. If " { $snippet "dll" } " is " { $link f } " looks for the symbol in the runtime executable." }
|
|
||||||
{ $errors "Throws an error if the symbol could not be found." } ;
|
|
||||||
|
|
||||||
HELP: dlclose ( dll -- )
|
|
||||||
{ $values { "dll" "a DLL handle" } }
|
|
||||||
{ $description "Closes a DLL handle created by " { $link dlopen } ". This word might not be implemented on all platforms." } ;
|
|
||||||
|
|
||||||
HELP: load-library
|
|
||||||
{ $values { "name" "a string" } { "dll" "a DLL handle" } }
|
|
||||||
{ $description "Loads a library by logical name and outputs a handle which may be passed to " { $link dlsym } " or " { $link dlclose } ". If the library is already loaded, returns the existing handle." } ;
|
|
||||||
|
|
||||||
HELP: add-library
|
|
||||||
{ $values { "name" "a string" } { "path" "a string" } { "abi" "one of " { $snippet "\"cdecl\"" } " or " { $snippet "\"stdcall\"" } } }
|
|
||||||
{ $description "Defines a new logical library named " { $snippet "name" } " located in the file system at " { $snippet "path" } "and the specified ABI." }
|
|
||||||
{ $notes "Because the entire source file is parsed before top-level forms are executed, " { $link add-library } " cannot be used in the same file as " { $link POSTPONE: FUNCTION: } " definitions from that library. The " { $link add-library } " call will happen too late, after compilation, and the alien calls will not work."
|
|
||||||
$nl
|
|
||||||
"Instead, " { $link add-library } " calls must either be placed in different source files from those that use that library, or alternatively, " { $link "syntax-immediate" } " can be used to load the library before compilation." }
|
|
||||||
{ $examples "Here is a typical usage of " { $link add-library } ":"
|
|
||||||
{ $code
|
|
||||||
"<< \"freetype\" {"
|
|
||||||
" { [ os macosx? ] [ \"libfreetype.6.dylib\" \"cdecl\" add-library ] }"
|
|
||||||
" { [ os windows? ] [ \"freetype6.dll\" \"cdecl\" add-library ] }"
|
|
||||||
" [ drop ]"
|
|
||||||
"} cond >>"
|
|
||||||
}
|
|
||||||
"Note the parse time evaluation with " { $link POSTPONE: << } "." } ;
|
|
||||||
|
|
||||||
HELP: alien-invoke-error
|
|
||||||
{ $error-description "Thrown if the word calling " { $link alien-invoke } " was not compiled with the optimizing compiler. This may be a result of one of several failure conditions:"
|
|
||||||
{ $list
|
|
||||||
{ "This can happen when experimenting with " { $link alien-invoke } " in this listener. To fix the problem, place the " { $link alien-invoke } " call in a word; word definitions are automatically compiled with the optimizing compiler." }
|
|
||||||
{ "The return type or parameter list references an unknown C type." }
|
|
||||||
{ "The symbol or library could not be found." }
|
|
||||||
{ "One of the four inputs to " { $link alien-invoke } " is not a literal value. To call functions which are not known at compile-time, use " { $link alien-indirect } "." }
|
|
||||||
}
|
|
||||||
} ;
|
|
||||||
|
|
||||||
HELP: alien-invoke
|
HELP: alien-invoke
|
||||||
{ $values { "..." "zero or more objects passed to the C function" } { "return" "a C return type" } { "library" "a logical library name" } { "function" "a C function name" } { "parameters" "a sequence of C parameter types" } }
|
{ $values { "..." "zero or more objects passed to the C function" } { "return" "a C return type" } { "library" "a logical library name" } { "function" "a C function name" } { "parameters" "a sequence of C parameter types" } }
|
||||||
{ $description "Calls a C library function with the given name. Input parameters are taken from the data stack, and the return value is pushed on the data stack after the function returns. A return type of " { $snippet "\"void\"" } " indicates that no value is to be expected." }
|
{ $description "Calls a C library function with the given name. Input parameters are taken from the data stack, and the return value is pushed on the data stack after the function returns. A return type of " { $snippet "\"void\"" } " indicates that no value is to be expected." }
|
||||||
|
@ -226,6 +161,16 @@ ARTICLE: "alien-invoke" "Calling C from Factor"
|
||||||
{ $subsection alien-indirect }
|
{ $subsection alien-indirect }
|
||||||
"There are some details concerning the conversion of Factor objects to C values, and vice versa. See " { $link "c-data" } "." ;
|
"There are some details concerning the conversion of Factor objects to C values, and vice versa. See " { $link "c-data" } "." ;
|
||||||
|
|
||||||
|
HELP: alien-invoke-error
|
||||||
|
{ $error-description "Thrown if the word calling " { $link alien-invoke } " was not compiled with the optimizing compiler. This may be a result of one of several failure conditions:"
|
||||||
|
{ $list
|
||||||
|
{ "This can happen when experimenting with " { $link alien-invoke } " in this listener. To fix the problem, place the " { $link alien-invoke } " call in a word; word definitions are automatically compiled with the optimizing compiler." }
|
||||||
|
{ "The return type or parameter list references an unknown C type." }
|
||||||
|
{ "The symbol or library could not be found." }
|
||||||
|
{ "One of the four inputs to " { $link alien-invoke } " is not a literal value. To call functions which are not known at compile-time, use " { $link alien-indirect } "." }
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
|
||||||
ARTICLE: "alien-callback-gc" "Callbacks and code GC"
|
ARTICLE: "alien-callback-gc" "Callbacks and code GC"
|
||||||
"A callback consits of two parts; the callback word, which pushes the address of the callback on the stack when executed, and the callback body itself. If the callback word is redefined, removed from the dictionary using " { $link forget } ", or recompiled, the callback body will not be reclaimed by the garbage collector, since potentially C code may be holding a reference to the callback body."
|
"A callback consits of two parts; the callback word, which pushes the address of the callback on the stack when executed, and the callback body itself. If the callback word is redefined, removed from the dictionary using " { $link forget } ", or recompiled, the callback body will not be reclaimed by the garbage collector, since potentially C code may be holding a reference to the callback body."
|
||||||
$nl
|
$nl
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
IN: alien.tests
|
|
||||||
USING: accessors alien alien.accessors alien.syntax byte-arrays arrays
|
USING: accessors alien alien.accessors alien.syntax byte-arrays arrays
|
||||||
kernel kernel.private namespaces tools.test sequences libc math
|
kernel kernel.private namespaces tools.test sequences libc math
|
||||||
system prettyprint layouts ;
|
system prettyprint layouts alien.libraries ;
|
||||||
|
IN: alien.tests
|
||||||
|
|
||||||
[ t ] [ -1 <alien> alien-address 0 > ] unit-test
|
[ t ] [ -1 <alien> alien-address 0 > ] unit-test
|
||||||
|
|
||||||
|
@ -85,4 +85,4 @@ f initialize-test set-global
|
||||||
|
|
||||||
[ ] [ initialize-test get BAD-ALIEN >>alien drop ] unit-test
|
[ ] [ initialize-test get BAD-ALIEN >>alien drop ] unit-test
|
||||||
|
|
||||||
[ 7575 ] [ initialize-test [ 7575 ] initialize-alien ] unit-test
|
[ 7575 ] [ initialize-test [ 7575 ] initialize-alien ] unit-test
|
||||||
|
|
|
@ -49,23 +49,6 @@ M: alien equal?
|
||||||
2drop f
|
2drop f
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
SYMBOL: libraries
|
|
||||||
|
|
||||||
libraries [ H{ } clone ] initialize
|
|
||||||
|
|
||||||
TUPLE: library path abi dll ;
|
|
||||||
|
|
||||||
: library ( name -- library ) libraries get at ;
|
|
||||||
|
|
||||||
: <library> ( path abi -- library )
|
|
||||||
over dup [ dlopen ] when \ library boa ;
|
|
||||||
|
|
||||||
: load-library ( name -- dll )
|
|
||||||
library dup [ dll>> ] when ;
|
|
||||||
|
|
||||||
: add-library ( name path abi -- )
|
|
||||||
<library> swap libraries get set-at ;
|
|
||||||
|
|
||||||
ERROR: alien-callback-error ;
|
ERROR: alien-callback-error ;
|
||||||
|
|
||||||
: alien-callback ( return parameters abi quot -- alien )
|
: alien-callback ( return parameters abi quot -- alien )
|
||||||
|
@ -99,4 +82,4 @@ PRIVATE>
|
||||||
: initialize-alien ( symbol quot -- )
|
: initialize-alien ( symbol quot -- )
|
||||||
swap dup get-global dup recompute-value?
|
swap dup get-global dup recompute-value?
|
||||||
[ drop [ call dup 31337 <alien> expiry-check boa ] dip set-global ]
|
[ drop [ call dup 31337 <alien> expiry-check boa ] dip set-global ]
|
||||||
[ 2nip object>> ] if ; inline
|
[ 2nip object>> ] if ; inline
|
||||||
|
|
|
@ -62,6 +62,7 @@ bootstrapping? on
|
||||||
{
|
{
|
||||||
"alien"
|
"alien"
|
||||||
"alien.accessors"
|
"alien.accessors"
|
||||||
|
"alien.libraries"
|
||||||
"arrays"
|
"arrays"
|
||||||
"byte-arrays"
|
"byte-arrays"
|
||||||
"classes.private"
|
"classes.private"
|
||||||
|
@ -458,9 +459,9 @@ tuple
|
||||||
{ "code-room" "memory" (( -- code-free code-total )) }
|
{ "code-room" "memory" (( -- code-free code-total )) }
|
||||||
{ "micros" "system" (( -- us )) }
|
{ "micros" "system" (( -- us )) }
|
||||||
{ "modify-code-heap" "compiler.units" (( alist -- )) }
|
{ "modify-code-heap" "compiler.units" (( alist -- )) }
|
||||||
{ "dlopen" "alien" (( path -- dll )) }
|
{ "dlopen" "alien.libraries" (( path -- dll )) }
|
||||||
{ "dlsym" "alien" (( name dll -- alien )) }
|
{ "dlsym" "alien.libraries" (( name dll -- alien )) }
|
||||||
{ "dlclose" "alien" (( dll -- )) }
|
{ "dlclose" "alien.libraries" (( dll -- )) }
|
||||||
{ "<byte-array>" "byte-arrays" (( n -- byte-array )) }
|
{ "<byte-array>" "byte-arrays" (( n -- byte-array )) }
|
||||||
{ "(byte-array)" "byte-arrays" (( n -- byte-array )) }
|
{ "(byte-array)" "byte-arrays" (( n -- byte-array )) }
|
||||||
{ "<displaced-alien>" "alien" (( displacement c-ptr -- alien )) }
|
{ "<displaced-alien>" "alien" (( displacement c-ptr -- alien )) }
|
||||||
|
|
|
@ -168,6 +168,7 @@ SYMBOL: interactive-vocabs
|
||||||
"help"
|
"help"
|
||||||
"help.apropos"
|
"help.apropos"
|
||||||
"help.lint"
|
"help.lint"
|
||||||
|
"help.vocabs"
|
||||||
"inspector"
|
"inspector"
|
||||||
"io"
|
"io"
|
||||||
"io.files"
|
"io.files"
|
||||||
|
|
|
@ -56,6 +56,7 @@ $nl
|
||||||
"Application vocabularies can define a main entry point, giving the user a convenient way to run the application:"
|
"Application vocabularies can define a main entry point, giving the user a convenient way to run the application:"
|
||||||
{ $subsection POSTPONE: MAIN: }
|
{ $subsection POSTPONE: MAIN: }
|
||||||
{ $subsection run }
|
{ $subsection run }
|
||||||
|
{ $subsection runnable-vocab }
|
||||||
{ $see-also "vocabularies" "parser-files" "source-files" } ;
|
{ $see-also "vocabularies" "parser-files" "source-files" } ;
|
||||||
|
|
||||||
ABOUT: "vocabs.loader"
|
ABOUT: "vocabs.loader"
|
||||||
|
|
|
@ -96,3 +96,6 @@ $nl
|
||||||
HELP: >vocab-link
|
HELP: >vocab-link
|
||||||
{ $values { "name" string } { "vocab" "a vocabulary specifier" } }
|
{ $values { "name" string } { "vocab" "a vocabulary specifier" } }
|
||||||
{ $description "If the vocabulary is loaded, outputs the corresponding " { $link vocab } " instance, otherwise creates a new " { $link vocab-link } "." } ;
|
{ $description "If the vocabulary is loaded, outputs the corresponding " { $link vocab } " instance, otherwise creates a new " { $link vocab-link } "." } ;
|
||||||
|
|
||||||
|
HELP: runnable-vocab
|
||||||
|
{ $class-description "The class of vocabularies with a " { $slot "main" } " word." } ;
|
|
@ -105,4 +105,7 @@ M: vocab-spec forget* forget-vocab ;
|
||||||
|
|
||||||
SYMBOL: load-vocab-hook ! ( name -- vocab )
|
SYMBOL: load-vocab-hook ! ( name -- vocab )
|
||||||
|
|
||||||
: load-vocab ( name -- vocab ) load-vocab-hook get call( name -- vocab ) ;
|
: load-vocab ( name -- vocab ) load-vocab-hook get call( name -- vocab ) ;
|
||||||
|
|
||||||
|
PREDICATE: runnable-vocab < vocab
|
||||||
|
vocab-main >boolean ;
|
|
@ -0,0 +1 @@
|
||||||
|
Slava Pestov
|
|
@ -0,0 +1,65 @@
|
||||||
|
! Copyright (C) 2009 Slava Pestov.
|
||||||
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
|
USING: slides help.markup ;
|
||||||
|
IN: chicago-talk
|
||||||
|
|
||||||
|
CONSTANT: chicago-slides
|
||||||
|
{
|
||||||
|
{ $slide "factor"
|
||||||
|
|
||||||
|
{ $url "http://factorcode.org" }
|
||||||
|
|
||||||
|
}
|
||||||
|
{ $slide "goals"
|
||||||
|
|
||||||
|
"high level language"
|
||||||
|
"expressive and extensible"
|
||||||
|
"reasonable performance"
|
||||||
|
"interactive development with arbitrary redefinition"
|
||||||
|
"standalone app deployment (strip out compiler and REPL)"
|
||||||
|
|
||||||
|
}
|
||||||
|
{ $slide "challenges"
|
||||||
|
|
||||||
|
"higher-order functions"
|
||||||
|
"dynamic typing"
|
||||||
|
"memory allocation"
|
||||||
|
"float boxing/unboxing"
|
||||||
|
"integer overflow checks"
|
||||||
|
"user-defined abstractions"
|
||||||
|
|
||||||
|
}
|
||||||
|
{ $slide "implementation"
|
||||||
|
|
||||||
|
"VM: 12 kloc of C, library: >100 kloc of Factor"
|
||||||
|
"generational copying garbage collection, card marking write barrier"
|
||||||
|
"full continuations, tail calls"
|
||||||
|
"simple non-optimizing “bootstrap” compiler"
|
||||||
|
"optimizing compiler"
|
||||||
|
|
||||||
|
}
|
||||||
|
{ $slide "optimizing compiler"
|
||||||
|
|
||||||
|
"about 12,000 lines of Factor code"
|
||||||
|
"targets x86-32, x86-64, PowerPC"
|
||||||
|
"factor code ⇒ high-level SSA ⇒ low-level SSA ⇒ machine code"
|
||||||
|
|
||||||
|
}
|
||||||
|
{ $slide "high-level optimizer"
|
||||||
|
|
||||||
|
"macro expansion, defunctionalization"
|
||||||
|
"type and interval inference, sparse conditional constant propagation, method inlining"
|
||||||
|
"escape analysis and tuple unboxing"
|
||||||
|
|
||||||
|
}
|
||||||
|
{ $slide "low-level optimizer"
|
||||||
|
|
||||||
|
"alias analysis, value numbering, write barrier elimination"
|
||||||
|
"linear scan register allocation"
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
: chicago-talk ( -- ) chicago-slides slides-window ;
|
||||||
|
|
||||||
|
MAIN: chicago-talk
|
|
@ -1,6 +1,7 @@
|
||||||
! Copyright (C) 2008 Doug Coleman.
|
! Copyright (C) 2008 Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors alien alien.syntax combinators kernel system ;
|
USING: accessors alien alien.syntax combinators kernel system
|
||||||
|
alien.libraries ;
|
||||||
IN: curses.ffi
|
IN: curses.ffi
|
||||||
|
|
||||||
<< "curses" {
|
<< "curses" {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
! Copyright (C) 2005, 2007 Slava Pestov.
|
! Copyright (C) 2005, 2007 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: alien alien.syntax kernel system combinators ;
|
USING: alien alien.syntax kernel system combinators
|
||||||
|
alien.libraries ;
|
||||||
IN: freetype
|
IN: freetype
|
||||||
|
|
||||||
<< "freetype" {
|
<< "freetype" {
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
USING: tools.deploy.config ;
|
||||||
|
H{
|
||||||
|
{ deploy-word-defs? f }
|
||||||
|
{ deploy-reflection 1 }
|
||||||
|
{ deploy-word-props? f }
|
||||||
|
{ deploy-compiler? t }
|
||||||
|
{ deploy-threads? t }
|
||||||
|
{ deploy-unicode? f }
|
||||||
|
{ "stop-after-last-window?" t }
|
||||||
|
{ deploy-name "hello-unicode" }
|
||||||
|
{ deploy-math? t }
|
||||||
|
{ deploy-ui? t }
|
||||||
|
{ deploy-io 2 }
|
||||||
|
{ deploy-c-types? f }
|
||||||
|
}
|
|
@ -15,6 +15,6 @@ IN: hello-unicode
|
||||||
] with-style
|
] with-style
|
||||||
] make-pane { 10 10 } <border> ;
|
] make-pane { 10 10 } <border> ;
|
||||||
|
|
||||||
: hello-unicode ( -- ) <hello-gadget> "გამარჯობა" open-window ;
|
: hello-unicode ( -- ) [ <hello-gadget> "გამარჯობა" open-window ] with-ui ;
|
||||||
|
|
||||||
MAIN: hello-unicode
|
MAIN: hello-unicode
|
|
@ -5,15 +5,18 @@ io.directories io.files.temp kernel io.streams.string calendar
|
||||||
debugger combinators.smart sequences ;
|
debugger combinators.smart sequences ;
|
||||||
IN: site-watcher.db
|
IN: site-watcher.db
|
||||||
|
|
||||||
TUPLE: account account-id account-name email ;
|
TUPLE: account account-id account-name email twitter sms ;
|
||||||
|
|
||||||
: <account> ( account-name -- account )
|
: <account> ( account-name email -- account )
|
||||||
account new
|
account new
|
||||||
|
swap >>email
|
||||||
swap >>account-name ;
|
swap >>account-name ;
|
||||||
|
|
||||||
account "ACCOUNT" {
|
account "ACCOUNT" {
|
||||||
{ "account-name" "ACCOUNT_NAME" VARCHAR +user-assigned-id+ }
|
{ "account-name" "ACCOUNT_NAME" VARCHAR +user-assigned-id+ }
|
||||||
{ "email" "EMAIL" VARCHAR }
|
{ "email" "EMAIL" VARCHAR }
|
||||||
|
{ "twitter" "TWITTER" VARCHAR }
|
||||||
|
{ "sms" "SMS" VARCHAR }
|
||||||
} define-persistent
|
} define-persistent
|
||||||
|
|
||||||
TUPLE: site site-id url up? changed? last-up error last-error ;
|
TUPLE: site site-id url up? changed? last-up error last-error ;
|
||||||
|
@ -72,7 +75,7 @@ TUPLE: reporting-site email url up? changed? last-up? error last-error ;
|
||||||
: insert-site ( url -- site )
|
: insert-site ( url -- site )
|
||||||
<site> dup select-tuple [ ] [ dup t >>up? insert-tuple ] ?if ;
|
<site> dup select-tuple [ ] [ dup t >>up? insert-tuple ] ?if ;
|
||||||
|
|
||||||
: insert-account ( account-name -- ) <account> insert-tuple ;
|
: insert-account ( account-name email -- ) <account> insert-tuple ;
|
||||||
|
|
||||||
: find-sites ( -- seq ) f <site> select-tuples ;
|
: find-sites ( -- seq ) f <site> select-tuples ;
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ IN: site-watcher.tests
|
||||||
site ensure-table
|
site ensure-table
|
||||||
watching-site ensure-table
|
watching-site ensure-table
|
||||||
|
|
||||||
"erg@factorcode.org" insert-account
|
"erg" "erg@factorcode.org" insert-account
|
||||||
"http://asdfasdfasdfasdfqwerqqq.com" insert-site drop
|
"http://asdfasdfasdfasdfqwerqqq.com" insert-site drop
|
||||||
"http://fark.com" insert-site drop
|
"http://fark.com" insert-site drop
|
||||||
|
|
||||||
|
@ -22,4 +22,4 @@ IN: site-watcher.tests
|
||||||
f <site> select-tuples
|
f <site> select-tuples
|
||||||
] with-db ;
|
] with-db ;
|
||||||
|
|
||||||
[ f ] [ fake-sites empty? ] unit-test
|
[ f ] [ fake-sites empty? ] unit-test
|
||||||
|
|
|
@ -71,7 +71,7 @@ CONSTANT: site-list-url URL" $site-watcher-app/"
|
||||||
: <update-notify-action> ( -- action )
|
: <update-notify-action> ( -- action )
|
||||||
<page-action>
|
<page-action>
|
||||||
[
|
[
|
||||||
username <account> select-tuple from-object
|
username f <account> select-tuple from-object
|
||||||
] >>init
|
] >>init
|
||||||
{ site-watcher-app "update-notify" } >>template
|
{ site-watcher-app "update-notify" } >>template
|
||||||
[
|
[
|
||||||
|
@ -82,8 +82,10 @@ CONSTANT: site-list-url URL" $site-watcher-app/"
|
||||||
} validate-params
|
} validate-params
|
||||||
] >>validate
|
] >>validate
|
||||||
[
|
[
|
||||||
username <account> select-tuple
|
username f <account> select-tuple
|
||||||
"email" value >>email
|
"email" value >>email
|
||||||
|
"twitter" value >>twitter
|
||||||
|
"sms" value >>sms
|
||||||
update-tuple
|
update-tuple
|
||||||
site-list-url <redirect>
|
site-list-url <redirect>
|
||||||
] >>submit
|
] >>submit
|
||||||
|
@ -122,6 +124,10 @@ CONSTANT: site-list-url URL" $site-watcher-app/"
|
||||||
site-watcher-db <alloy>
|
site-watcher-db <alloy>
|
||||||
main-responder set-global
|
main-responder set-global
|
||||||
|
|
||||||
|
M: site-watcher-app init-user-profile
|
||||||
|
drop
|
||||||
|
"username" value "email" value <account> insert-tuple ;
|
||||||
|
|
||||||
: init-db ( -- )
|
: init-db ( -- )
|
||||||
site-watcher-db [
|
site-watcher-db [
|
||||||
{ site account watching-site } [ ensure-table ] each
|
{ site account watching-site } [ ensure-table ] each
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
include vm/Config.linux
|
include vm/Config.linux
|
||||||
include vm/Config.x86.64
|
include vm/Config.x86.64
|
||||||
LIBPATH = -L/usr/X11R6/lib64 -L/usr/X11R6/lib
|
LIBPATH = -L/usr/X11R6/lib64 -L/usr/X11R6/lib
|
||||||
|
FFI_TEST_CFLAGS = -fPIC
|
||||||
|
|
|
@ -5,6 +5,8 @@ PLAF_DLL_OBJS += vm/os-macosx.o vm/mach_signal.o
|
||||||
|
|
||||||
DLL_EXTENSION = .dylib
|
DLL_EXTENSION = .dylib
|
||||||
|
|
||||||
|
SHARED_FLAG = -dynamiclib
|
||||||
|
|
||||||
ifdef X11
|
ifdef X11
|
||||||
LIBS = -lm -framework Cocoa -L/opt/local/lib $(X11_UI_LIBS) -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib
|
LIBS = -lm -framework Cocoa -L/opt/local/lib $(X11_UI_LIBS) -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib
|
||||||
else
|
else
|
||||||
|
|
|
@ -6,6 +6,7 @@ EXE_SUFFIX =
|
||||||
DLL_PREFIX = lib
|
DLL_PREFIX = lib
|
||||||
DLL_EXTENSION = .a
|
DLL_EXTENSION = .a
|
||||||
# DLL_EXTENSION = .so
|
# DLL_EXTENSION = .so
|
||||||
|
SHARED_FLAG = -shared
|
||||||
|
|
||||||
PLAF_DLL_OBJS = vm/os-unix.o
|
PLAF_DLL_OBJS = vm/os-unix.o
|
||||||
PLAF_EXE_OBJS += vm/main-unix.o
|
PLAF_EXE_OBJS += vm/main-unix.o
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
CFLAGS += -DWINDOWS -mno-cygwin
|
CFLAGS += -DWINDOWS -mno-cygwin
|
||||||
LIBS = -lm
|
LIBS = -lm
|
||||||
PLAF_DLL_OBJS += vm/os-windows.o
|
PLAF_DLL_OBJS += vm/os-windows.o
|
||||||
|
SHARED_FLAG = -shared
|
||||||
EXE_EXTENSION=.exe
|
EXE_EXTENSION=.exe
|
||||||
CONSOLE_EXTENSION=.com
|
CONSOLE_EXTENSION=.com
|
||||||
DLL_EXTENSION=.dll
|
DLL_EXTENSION=.dll
|
||||||
|
|
Loading…
Reference in New Issue