update vocabs so a load-all on macosx works without parsing c-type strings

db4
Joe Groff 2009-09-27 15:11:21 -05:00
parent 02b4503205
commit 630e5ecc3b
42 changed files with 278 additions and 232 deletions

View File

@ -1,6 +1,7 @@
! 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 alien.libraries ; USING: alien alien.c-types alien.syntax combinators system
alien.libraries ;
IN: compression.zlib.ffi IN: compression.zlib.ffi
<< "zlib" { << "zlib" {

View File

@ -1,7 +1,8 @@
! 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 alien.libraries ; USING: alien alien.c-types alien.syntax combinators system
alien.libraries ;
IN: db.postgresql.ffi IN: db.postgresql.ffi
<< "postgresql" { << "postgresql" {
@ -69,6 +70,7 @@ TYPEDEF: void* PGnotify*
TYPEDEF: void* PQArgBlock* TYPEDEF: void* PQArgBlock*
TYPEDEF: void* PQprintOpt* TYPEDEF: void* PQprintOpt*
TYPEDEF: void* SSL* TYPEDEF: void* SSL*
TYPEDEF: void* FILE*
LIBRARY: postgresql LIBRARY: postgresql

View File

@ -1,8 +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.c-types alien.syntax alien.destructors
alien.libraries ; combinators system alien.libraries ;
IN: glib IN: glib
<< <<
@ -27,12 +27,10 @@ TYPEDEF: void* gpointer
TYPEDEF: int gint TYPEDEF: int gint
TYPEDEF: bool gboolean TYPEDEF: bool gboolean
FUNCTION: void FUNCTION: void g_free ( gpointer mem ) ;
g_free ( gpointer mem ) ;
LIBRARY: gobject LIBRARY: gobject
FUNCTION: void FUNCTION: void g_object_unref ( gpointer object ) ;
g_object_unref ( gpointer object ) ;
DESTRUCTOR: g_object_unref DESTRUCTOR: g_object_unref

View File

@ -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: accessors arrays byte-arrays combinators USING: accessors alien.c-types arrays byte-arrays combinators
compression.run-length fry grouping images images.loader io compression.run-length fry grouping images images.loader io
io.binary io.encodings.8-bit io.encodings.binary io.binary io.encodings.8-bit io.encodings.binary
io.encodings.string io.streams.limited kernel math math.bitwise io.encodings.string io.streams.limited kernel math math.bitwise

View File

@ -1,6 +1,7 @@
USING: iokit alien alien.syntax alien.c-types kernel USING: iokit alien alien.syntax alien.c-types kernel system
system core-foundation core-foundation.data core-foundation core-foundation.arrays core-foundation.data
core-foundation.dictionaries ; core-foundation.dictionaries core-foundation.run-loop
core-foundation.strings core-foundation.time ;
IN: iokit.hid IN: iokit.hid
CONSTANT: kIOHIDDeviceKey "IOHIDDevice" CONSTANT: kIOHIDDeviceKey "IOHIDDevice"

View File

@ -1,10 +1,11 @@
USING: accessors alien alien.c-types alien.data arrays USING: accessors alien alien.c-types alien.complex
byte-arrays combinators combinators.short-circuit fry alien.data arrays byte-arrays combinators
kernel locals macros math math.blas.ffi math.blas.vectors combinators.short-circuit fry kernel locals macros math
math.blas.vectors.private math.complex math.functions math.blas.ffi math.blas.vectors math.blas.vectors.private
math.order functors words sequences sequences.merged math.complex math.functions math.order functors words
sequences.private shuffle parser prettyprint.backend sequences sequences.merged sequences.private shuffle
prettyprint.custom ascii specialized-arrays ; parser prettyprint.backend prettyprint.custom ascii
specialized-arrays ;
FROM: alien.c-types => float ; FROM: alien.c-types => float ;
SPECIALIZED-ARRAY: float SPECIALIZED-ARRAY: float
SPECIALIZED-ARRAY: double SPECIALIZED-ARRAY: double

View File

@ -1,8 +1,8 @@
USING: accessors alien alien.c-types arrays ascii byte-arrays combinators USING: accessors alien alien.c-types alien.complex arrays ascii
combinators.short-circuit fry kernel math math.blas.ffi byte-arrays combinators combinators.short-circuit fry kernel
math.complex math.functions math.order sequences sequences.private math math.blas.ffi math.complex math.functions math.order
functors words locals parser prettyprint.backend prettyprint.custom sequences sequences.private functors words locals parser
specialized-arrays ; prettyprint.backend prettyprint.custom specialized-arrays ;
FROM: alien.c-types => float ; FROM: alien.c-types => float ;
SPECIALIZED-ARRAY: float SPECIALIZED-ARRAY: float
SPECIALIZED-ARRAY: double SPECIALIZED-ARRAY: double

View File

@ -1,7 +1,7 @@
USING: accessors alien.syntax arrays assocs biassocs USING: accessors alien.c-types alien.syntax arrays assocs
classes.struct combinators cpu.x86.features kernel literals biassocs classes.struct combinators cpu.x86.features kernel
math math.bitwise math.floats.env math.floats.env.private literals math math.bitwise math.floats.env
system ; math.floats.env.private system ;
IN: math.floats.env.x86 IN: math.floats.env.x86
STRUCT: sse-env STRUCT: sse-env

View File

@ -3,8 +3,12 @@
! 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: arrays sequences alien alien.c-types alien.destructors
alien.libraries ; alien.libraries alien.syntax math math.functions math.vectors
destructors combinators colors fonts accessors assocs namespaces
kernel pango pango.fonts pango.layouts glib unicode.data images
cache init system math.rectangles fry memoize io.encodings.utf8
classes.struct cairo cairo.ffi ;
IN: pango.cairo IN: pango.cairo
<< { << {
@ -15,6 +19,9 @@ IN: pango.cairo
LIBRARY: pangocairo LIBRARY: pangocairo
TYPEDEF: void* PangoCairoFontMap*
TYPEDEF: void* PangoCairoFont*
FUNCTION: PangoFontMap* FUNCTION: PangoFontMap*
pango_cairo_font_map_new ( ) ; pango_cairo_font_map_new ( ) ;
@ -87,3 +94,150 @@ 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 ) ;
TUPLE: layout < disposable font string selection layout metrics ink-rect logical-rect image ;
SYMBOL: dpi
72 dpi set-global
: set-layout-font ( font layout -- )
swap cache-font-description pango_layout_set_font_description ;
: set-layout-text ( str layout -- )
#! Replace nulls with something else since Pango uses null-terminated
#! strings
swap -1 pango_layout_set_text ;
: layout-extents ( layout -- ink-rect logical-rect )
PangoRectangle <struct>
PangoRectangle <struct>
[ pango_layout_get_extents ] 2keep
[ PangoRectangle>rect ] bi@ ;
: layout-baseline ( layout -- baseline )
pango_layout_get_iter &pango_layout_iter_free
pango_layout_iter_get_baseline
pango>float ;
: set-foreground ( cr font -- )
foreground>> set-source-color ;
: fill-background ( cr font dim -- )
[ background>> set-source-color ]
[ [ { 0 0 } ] dip <rect> fill-rect ] bi-curry* bi ;
: rect-translate-x ( rect x -- rect' )
'[ _ 0 2array v- ] change-loc ;
: first-line ( layout -- line )
layout>> 0 pango_layout_get_line_readonly ;
: line-offset>x ( layout n -- x )
#! n is an index into the UTF8 encoding of the text
[ drop first-line ] [ swap string>> >utf8-index ] 2bi
0 0 <int> [ pango_layout_line_index_to_x ] keep
*int pango>float ;
: x>line-offset ( layout x -- n )
#! n is an index into the UTF8 encoding of the text
[
[ first-line ] dip
float>pango 0 <int> 0 <int>
[ pango_layout_line_x_to_index drop ] 2keep
[ *int ] bi@ swap
] [ drop string>> ] 2bi utf8-index> + ;
: selection-start/end ( selection -- start end )
selection>> [ start>> ] [ end>> ] bi ;
: selection-rect ( layout -- rect )
[ ink-rect>> dim>> ] [ ] [ selection-start/end ] tri [ line-offset>x ] bi-curry@ bi
[ drop nip 0 2array ] [ swap - swap second 2array ] 3bi <rect> ;
: fill-selection-background ( cr layout -- )
dup selection>> [
[ selection>> color>> set-source-color ]
[
[ selection-rect ] [ ink-rect>> loc>> first ] bi
rect-translate-x
fill-rect
] 2bi
] [ 2drop ] if ;
: text-position ( layout -- loc )
[ logical-rect>> ] [ ink-rect>> ] bi [ loc>> ] bi@ v- ;
: set-text-position ( cr loc -- )
first2 cairo_move_to ;
: draw-layout ( layout -- image )
dup ink-rect>> dim>> [ >fixnum ] map [
swap {
[ layout>> pango_cairo_update_layout ]
[ [ font>> ] [ ink-rect>> dim>> ] bi fill-background ]
[ fill-selection-background ]
[ text-position set-text-position ]
[ font>> set-foreground ]
[ layout>> pango_cairo_show_layout ]
} 2cleave
] make-bitmap-image ;
: escape-nulls ( str -- str' )
{ { 0 CHAR: zero-width-no-break-space } } substitute ;
: unpack-selection ( layout string/selection -- layout )
dup selection? [
[ string>> escape-nulls >>string ] [ >>selection ] bi
] [ escape-nulls >>string ] if ; inline
: set-layout-resolution ( layout -- )
pango_layout_get_context dpi get pango_cairo_context_set_resolution ;
: <PangoLayout> ( text font -- layout )
dummy-cairo pango_cairo_create_layout |g_object_unref
[ set-layout-resolution ] keep
[ set-layout-font ] keep
[ set-layout-text ] keep ;
: glyph-height ( font string -- y )
swap <PangoLayout> &g_object_unref layout-extents drop dim>> second ;
MEMO: missing-font-metrics ( font -- metrics )
#! Pango doesn't provide x-height and cap-height but Core Text does, so we
#! simulate them on Pango.
[
[ metrics new ] dip
[ "x" glyph-height >>x-height ]
[ "Y" glyph-height >>cap-height ] bi
] with-destructors ;
: layout-metrics ( layout -- metrics )
dup font>> missing-font-metrics clone
swap
[ layout>> layout-baseline >>ascent ]
[ logical-rect>> dim>> [ first >>width ] [ second >>height ] bi ] bi
dup [ height>> ] [ ascent>> ] bi - >>descent ;
: <layout> ( font string -- line )
[
layout new-disposable
swap unpack-selection
swap >>font
dup [ string>> ] [ font>> ] bi <PangoLayout> >>layout
dup layout>> layout-extents [ >>ink-rect ] [ >>logical-rect ] bi*
dup layout-metrics >>metrics
dup draw-layout >>image
] with-destructors ;
M: layout dispose* layout>> g_object_unref ;
SYMBOL: cached-layouts
: cached-layout ( font string -- layout )
cached-layouts get [ <layout> ] 2cache ;
: cached-line ( font string -- line )
cached-layout layout>> first-line ;
[ <cache-assoc> cached-layouts set-global ] "pango.cairo" add-init-hook

View File

@ -15,6 +15,15 @@ PANGO_STYLE_OBLIQUE
PANGO_STYLE_ITALIC ; PANGO_STYLE_ITALIC ;
TYPEDEF: int PangoWeight TYPEDEF: int PangoWeight
TYPEDEF: void* PangoFont*
TYPEDEF: void* PangoFontFamily*
TYPEDEF: void* PangoFontFace*
TYPEDEF: void* PangoFontMap*
TYPEDEF: void* PangoFontMetrics*
TYPEDEF: void* PangoFontDescription*
TYPEDEF: void* PangoGlyphString*
TYPEDEF: void* PangoLanguage*
CONSTANT: PANGO_WEIGHT_THIN 100 CONSTANT: PANGO_WEIGHT_THIN 100
CONSTANT: PANGO_WEIGHT_ULTRALIGHT 200 CONSTANT: PANGO_WEIGHT_ULTRALIGHT 200
CONSTANT: PANGO_WEIGHT_LIGHT 300 CONSTANT: PANGO_WEIGHT_LIGHT 300
@ -102,4 +111,4 @@ MEMO: (cache-font-description) ( font -- description )
: cache-font-description ( font -- description ) : cache-font-description ( font -- description )
strip-font-colors (cache-font-description) ; strip-font-colors (cache-font-description) ;
[ \ (cache-font-description) reset-memoized ] "pango.fonts" add-init-hook [ \ (cache-font-description) reset-memoized ] "pango.fonts" add-init-hook

View File

@ -4,12 +4,16 @@
USING: arrays sequences alien alien.c-types alien.destructors USING: arrays sequences alien alien.c-types alien.destructors
alien.syntax math math.functions math.vectors destructors combinators alien.syntax math math.functions math.vectors destructors combinators
colors fonts accessors assocs namespaces kernel pango pango.fonts colors fonts accessors assocs namespaces kernel pango pango.fonts
pango.cairo cairo cairo.ffi glib unicode.data images cache init glib unicode.data images cache init
math.rectangles fry memoize io.encodings.utf8 classes.struct ; math.rectangles fry memoize io.encodings.utf8 classes.struct ;
IN: pango.layouts IN: pango.layouts
LIBRARY: pango LIBRARY: pango
TYPEDEF: void* PangoLayout*
TYPEDEF: void* PangoLayoutIter*
TYPEDEF: void* PangoLayoutLine*
FUNCTION: PangoLayout* FUNCTION: PangoLayout*
pango_layout_new ( PangoContext* context ) ; pango_layout_new ( PangoContext* context ) ;
@ -60,149 +64,3 @@ pango_layout_iter_free ( PangoLayoutIter* iter ) ;
DESTRUCTOR: pango_layout_iter_free DESTRUCTOR: pango_layout_iter_free
TUPLE: layout < disposable font string selection layout metrics ink-rect logical-rect image ;
SYMBOL: dpi
72 dpi set-global
: set-layout-font ( font layout -- )
swap cache-font-description pango_layout_set_font_description ;
: set-layout-text ( str layout -- )
#! Replace nulls with something else since Pango uses null-terminated
#! strings
swap -1 pango_layout_set_text ;
: set-layout-resolution ( layout -- )
pango_layout_get_context dpi get pango_cairo_context_set_resolution ;
: <PangoLayout> ( text font -- layout )
dummy-cairo pango_cairo_create_layout |g_object_unref
[ set-layout-resolution ] keep
[ set-layout-font ] keep
[ set-layout-text ] keep ;
: layout-extents ( layout -- ink-rect logical-rect )
PangoRectangle <struct>
PangoRectangle <struct>
[ pango_layout_get_extents ] 2keep
[ PangoRectangle>rect ] bi@ ;
: glyph-height ( font string -- y )
swap <PangoLayout> &g_object_unref layout-extents drop dim>> second ;
MEMO: missing-font-metrics ( font -- metrics )
#! Pango doesn't provide x-height and cap-height but Core Text does, so we
#! simulate them on Pango.
[
[ metrics new ] dip
[ "x" glyph-height >>x-height ]
[ "Y" glyph-height >>cap-height ] bi
] with-destructors ;
: layout-baseline ( layout -- baseline )
pango_layout_get_iter &pango_layout_iter_free
pango_layout_iter_get_baseline
pango>float ;
: set-foreground ( cr font -- )
foreground>> set-source-color ;
: fill-background ( cr font dim -- )
[ background>> set-source-color ]
[ [ { 0 0 } ] dip <rect> fill-rect ] bi-curry* bi ;
: rect-translate-x ( rect x -- rect' )
'[ _ 0 2array v- ] change-loc ;
: first-line ( layout -- line )
layout>> 0 pango_layout_get_line_readonly ;
: line-offset>x ( layout n -- x )
#! n is an index into the UTF8 encoding of the text
[ drop first-line ] [ swap string>> >utf8-index ] 2bi
0 0 <int> [ pango_layout_line_index_to_x ] keep
*int pango>float ;
: x>line-offset ( layout x -- n )
#! n is an index into the UTF8 encoding of the text
[
[ first-line ] dip
float>pango 0 <int> 0 <int>
[ pango_layout_line_x_to_index drop ] 2keep
[ *int ] bi@ swap
] [ drop string>> ] 2bi utf8-index> + ;
: selection-start/end ( selection -- start end )
selection>> [ start>> ] [ end>> ] bi ;
: selection-rect ( layout -- rect )
[ ink-rect>> dim>> ] [ ] [ selection-start/end ] tri [ line-offset>x ] bi-curry@ bi
[ drop nip 0 2array ] [ swap - swap second 2array ] 3bi <rect> ;
: fill-selection-background ( cr layout -- )
dup selection>> [
[ selection>> color>> set-source-color ]
[
[ selection-rect ] [ ink-rect>> loc>> first ] bi
rect-translate-x
fill-rect
] 2bi
] [ 2drop ] if ;
: text-position ( layout -- loc )
[ logical-rect>> ] [ ink-rect>> ] bi [ loc>> ] bi@ v- ;
: set-text-position ( cr loc -- )
first2 cairo_move_to ;
: layout-metrics ( layout -- metrics )
dup font>> missing-font-metrics clone
swap
[ layout>> layout-baseline >>ascent ]
[ logical-rect>> dim>> [ first >>width ] [ second >>height ] bi ] bi
dup [ height>> ] [ ascent>> ] bi - >>descent ;
: draw-layout ( layout -- image )
dup ink-rect>> dim>> [ >fixnum ] map [
swap {
[ layout>> pango_cairo_update_layout ]
[ [ font>> ] [ ink-rect>> dim>> ] bi fill-background ]
[ fill-selection-background ]
[ text-position set-text-position ]
[ font>> set-foreground ]
[ layout>> pango_cairo_show_layout ]
} 2cleave
] make-bitmap-image ;
: escape-nulls ( str -- str' )
{ { 0 CHAR: zero-width-no-break-space } } substitute ;
: unpack-selection ( layout string/selection -- layout )
dup selection? [
[ string>> escape-nulls >>string ] [ >>selection ] bi
] [ escape-nulls >>string ] if ; inline
: <layout> ( font string -- line )
[
layout new-disposable
swap unpack-selection
swap >>font
dup [ string>> ] [ font>> ] bi <PangoLayout> >>layout
dup layout>> layout-extents [ >>ink-rect ] [ >>logical-rect ] bi*
dup layout-metrics >>metrics
dup draw-layout >>image
] with-destructors ;
M: layout dispose* layout>> g_object_unref ;
SYMBOL: cached-layouts
: cached-layout ( font string -- layout )
cached-layouts get [ <layout> ] 2cache ;
: cached-line ( font string -- line )
cached-layout layout>> first-line ;
[ <cache-assoc> cached-layouts set-global ] "pango.layouts" add-init-hook

View File

@ -23,8 +23,9 @@ CONSTANT: PANGO_SCALE 1024
: pango>float ( n -- x ) PANGO_SCALE /f ; inline : pango>float ( n -- x ) PANGO_SCALE /f ; inline
: float>pango ( x -- n ) PANGO_SCALE * >integer ; inline : float>pango ( x -- n ) PANGO_SCALE * >integer ; inline
FUNCTION: PangoContext* TYPEDEF: void* PangoContext*
pango_context_new ( ) ;
FUNCTION: PangoContext* pango_context_new ( ) ;
STRUCT: PangoRectangle STRUCT: PangoRectangle
{ x int } { x int }

View File

@ -3,6 +3,7 @@
USING: kernel accessors math math.vectors locals sequences USING: kernel accessors math math.vectors locals sequences
specialized-arrays colors arrays combinators specialized-arrays colors arrays combinators
opengl opengl.gl ui.pens ui.pens.caching ; opengl opengl.gl ui.pens ui.pens.caching ;
FROM: alien.c-types => float ;
SPECIALIZED-ARRAY: float SPECIALIZED-ARRAY: float
IN: ui.pens.gradient IN: ui.pens.gradient

View File

@ -1,8 +1,8 @@
! 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: accessors colors help.markup help.syntax kernel opengl USING: accessors alien.c-types colors help.markup help.syntax
opengl.gl sequences math.vectors ui.gadgets ui.pens kernel opengl opengl.gl sequences math.vectors ui.gadgets
specialized-arrays ; ui.pens specialized-arrays ;
SPECIALIZED-ARRAY: float SPECIALIZED-ARRAY: float
IN: ui.pens.polygon IN: ui.pens.polygon
@ -36,4 +36,4 @@ M: polygon draw-interior
: <polygon-gadget> ( color points -- gadget ) : <polygon-gadget> ( color points -- gadget )
[ <polygon> ] [ { 0 0 } [ vmax ] reduce ] bi [ <polygon> ] [ { 0 0 } [ vmax ] reduce ] bi
[ <gadget> ] 2dip [ >>interior ] [ >>dim ] bi* ; [ <gadget> ] 2dip [ >>interior ] [ >>dim ] bi* ;

View File

@ -3,7 +3,7 @@
! Based on X.h ! Based on X.h
USING: alien alien.syntax math x11.xlib ; USING: alien alien.c-types alien.syntax math x11.xlib ;
IN: x11.constants IN: x11.constants
TYPEDEF: ulong Mask TYPEDEF: ulong Mask
@ -406,4 +406,4 @@ CONSTANT: MSBFirst 1
! * EXTENDED WINDOW MANAGER HINTS ! * EXTENDED WINDOW MANAGER HINTS
! ***************************************************************** ! *****************************************************************
C-ENUM: _NET_WM_STATE_REMOVE _NET_WM_STATE_ADD _NET_WM_STATE_TOGGLE ; C-ENUM: _NET_WM_STATE_REMOVE _NET_WM_STATE_ADD _NET_WM_STATE_TOGGLE ;

View File

@ -410,10 +410,6 @@ STRUCT: XCharStruct
{ descent short } { descent short }
{ attributes ushort } ; { attributes ushort } ;
X-FUNCTION: Font XLoadFont ( Display* display, char* name ) ;
X-FUNCTION: XFontStruct* XQueryFont ( Display* display, XID font_ID ) ;
X-FUNCTION: XFontStruct* XLoadQueryFont ( Display* display, char* name ) ;
STRUCT: XFontStruct STRUCT: XFontStruct
{ ext_data XExtData* } { ext_data XExtData* }
{ fid Font } { fid Font }
@ -432,6 +428,10 @@ STRUCT: XFontStruct
{ ascent int } { ascent int }
{ descent int } ; { descent int } ;
X-FUNCTION: Font XLoadFont ( Display* display, char* name ) ;
X-FUNCTION: XFontStruct* XQueryFont ( Display* display, XID font_ID ) ;
X-FUNCTION: XFontStruct* XLoadQueryFont ( Display* display, char* name ) ;
X-FUNCTION: int XTextWidth ( XFontStruct* font_struct, char* string, int count ) ; X-FUNCTION: int XTextWidth ( XFontStruct* font_struct, char* string, int count ) ;
! 8.6 - Drawing Text ! 8.6 - Drawing Text

View File

@ -1,4 +1,5 @@
USING: sequences kernel math specialized-arrays fry ; USING: alien.c-types sequences kernel math specialized-arrays
fry ;
SPECIALIZED-ARRAY: int SPECIALIZED-ARRAY: int
IN: benchmark.dawes IN: benchmark.dawes

View File

@ -1,4 +1,4 @@
USING: make math sequences splitting grouping USING: alien.c-types make math sequences splitting grouping
kernel columns specialized-arrays bit-arrays ; kernel columns specialized-arrays bit-arrays ;
SPECIALIZED-ARRAY: double SPECIALIZED-ARRAY: double
IN: benchmark.dispatch2 IN: benchmark.dispatch2
@ -29,4 +29,4 @@ IN: benchmark.dispatch2
1000000 sequences 1000000 sequences
[ [ 0 swap nth don't-flush-me ] each ] curry times ; [ [ 0 swap nth don't-flush-me ] each ] curry times ;
MAIN: dispatch-test MAIN: dispatch-test

View File

@ -1,4 +1,4 @@
USING: sequences math mirrors splitting grouping USING: alien.c-types sequences math mirrors splitting grouping
kernel make assocs alien.syntax columns kernel make assocs alien.syntax columns
specialized-arrays bit-arrays ; specialized-arrays bit-arrays ;
SPECIALIZED-ARRAY: double SPECIALIZED-ARRAY: double

View File

@ -1,7 +1,7 @@
! Based on http://shootout.alioth.debian.org/gp4/benchmark.php?test=fasta&lang=java&id=2 ! Based on http://shootout.alioth.debian.org/gp4/benchmark.php?test=fasta&lang=java&id=2
USING: math kernel io io.files locals multiline assocs sequences USING: alien.c-types math kernel io io.files locals multiline
sequences.private benchmark.reverse-complement hints assocs sequences sequences.private benchmark.reverse-complement
io.encodings.ascii byte-arrays specialized-arrays ; hints io.encodings.ascii byte-arrays specialized-arrays ;
SPECIALIZED-ARRAY: double SPECIALIZED-ARRAY: double
IN: benchmark.fasta IN: benchmark.fasta

View File

@ -1,8 +1,8 @@
! Copyright (C) 2008, 2009 Slava Pestov. ! Copyright (C) 2008, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors fry kernel locals math math.constants USING: accessors alien.c-types fry kernel locals math
math.functions math.vectors math.vectors.simd prettyprint math.constants math.functions math.vectors math.vectors.simd
combinators.smart sequences hints classes.struct prettyprint combinators.smart sequences hints classes.struct
specialized-arrays ; specialized-arrays ;
SIMD: double SIMD: double
IN: benchmark.nbody-simd IN: benchmark.nbody-simd

View File

@ -1,8 +1,9 @@
! Copyright (C) 2008, 2009 Slava Pestov. ! Copyright (C) 2008, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors specialized-arrays fry kernel locals math USING: accessors specialized-arrays fry kernel
math.constants math.functions math.vectors prettyprint locals math math.constants math.functions math.vectors
combinators.smart sequences hints arrays ; prettyprint combinators.smart sequences hints arrays ;
FROM: alien.c-types => double ;
SPECIALIZED-ARRAY: double SPECIALIZED-ARRAY: double
IN: benchmark.nbody IN: benchmark.nbody

View File

@ -1,10 +1,10 @@
! Factor port of the raytracer benchmark from ! Factor port of the raytracer benchmark from
! http://www.ffconsultancy.com/free/ray_tracer/languages.html ! http://www.ffconsultancy.com/free/ray_tracer/languages.html
USING: arrays accessors specialized-arrays io
USING: arrays accessors specialized-arrays io io.files io.files io.files.temp io.encodings.binary kernel math
io.files.temp io.encodings.binary kernel math math.constants math.constants math.functions math.vectors math.parser make
math.functions math.vectors math.parser make sequences sequences sequences.private words hints ;
sequences.private words hints ; FROM: alien.c-types => double ;
SPECIALIZED-ARRAY: double SPECIALIZED-ARRAY: double
IN: benchmark.raytracer IN: benchmark.raytracer

View File

@ -1,7 +1,8 @@
! Factor port of ! Factor port of
! http://shootout.alioth.debian.org/gp4/benchmark.php?test=spectralnorm&lang=all ! http://shootout.alioth.debian.org/gp4/benchmark.php?test=spectralnorm&lang=all
USING: specialized-arrays kernel math math.functions USING: alien.c-types specialized-arrays kernel math
math.vectors sequences prettyprint words hints locals ; math.functions math.vectors sequences prettyprint words hints
locals ;
SPECIALIZED-ARRAY: double SPECIALIZED-ARRAY: double
IN: benchmark.spectral-norm IN: benchmark.spectral-norm

View File

@ -3,6 +3,7 @@
USING: accessors classes.struct combinators.smart fry kernel USING: accessors classes.struct combinators.smart fry kernel
math math.functions math.order math.parser sequences math math.functions math.order math.parser sequences
specialized-arrays io ; specialized-arrays io ;
FROM: alien.c-types => float ;
IN: benchmark.struct-arrays IN: benchmark.struct-arrays
STRUCT: point { x float } { y float } { z float } ; STRUCT: point { x float } { y float } { z float } ;

View File

@ -1,6 +1,6 @@
! 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.c-types alien.syntax kernel system combinators
alien.libraries classes.struct ; alien.libraries classes.struct ;
IN: freetype IN: freetype
@ -38,8 +38,8 @@ TYPEDEF: long FT_F26Dot6
FUNCTION: FT_Error FT_Init_FreeType ( void* library ) ; FUNCTION: FT_Error FT_Init_FreeType ( void* library ) ;
! circular reference between glyph and face ! circular reference between glyph and face
TYPEDEF: void face TYPEDEF: void* face*
TYPEDEF: void glyph TYPEDEF: void* glyph*
STRUCT: glyph STRUCT: glyph
{ library void* } { library void* }
@ -166,6 +166,8 @@ STRUCT: FT_Bitmap
{ palette_mode char } { palette_mode char }
{ palette void* } ; { palette void* } ;
TYPEDEF: void* FT_Face*
FUNCTION: FT_Error FT_New_Face ( void* library, FT_Char* font, FT_Long index, face* face ) ; FUNCTION: FT_Error FT_New_Face ( void* library, FT_Char* font, FT_Long index, face* face ) ;
FUNCTION: FT_Error FT_New_Memory_Face ( void* library, FT_Byte* file_base, FT_Long file_size, FT_Long face_index, FT_Face* aface ) ; FUNCTION: FT_Error FT_New_Memory_Face ( void* library, FT_Byte* file_base, FT_Long file_size, FT_Long face_index, FT_Face* aface ) ;

View File

@ -1,9 +1,11 @@
! (c)2009 Joe Groff bsd license ! (c)2009 Joe Groff bsd license
USING: alien alien.syntax byte-arrays classes gpu.buffers USING: alien alien.c-types alien.syntax byte-arrays classes
gpu.framebuffers gpu.shaders gpu.textures help.markup gpu.buffers gpu.framebuffers gpu.shaders gpu.textures help.markup
help.syntax images kernel math sequences help.syntax images kernel math sequences
specialized-arrays strings ; specialized-arrays strings ;
SPECIALIZED-ARRAY: float QUALIFIED-WITH: alien.c-types c
QUALIFIED-WITH: math m
SPECIALIZED-ARRAY: c:float
SPECIALIZED-ARRAY: int SPECIALIZED-ARRAY: int
SPECIALIZED-ARRAY: uint SPECIALIZED-ARRAY: uint
SPECIALIZED-ARRAY: ulong SPECIALIZED-ARRAY: ulong
@ -49,7 +51,7 @@ $nl
"Uniform parameters are passed from Factor to the shader program through the uniform tuple as follows:" "Uniform parameters are passed from Factor to the shader program through the uniform tuple as follows:"
{ $list { $list
{ { $link int-uniform } "s and " { $link uint-uniform } "s take their values from Factor " { $link integer } "s." } { { $link int-uniform } "s and " { $link uint-uniform } "s take their values from Factor " { $link integer } "s." }
{ { $link float-uniform } "s take their values from Factor " { $link float } "s." } { { $link float-uniform } "s take their values from Factor " { $link m:float } "s." }
{ { $link bool-uniform } "s take their values from Factor " { $link boolean } "s." } { { $link bool-uniform } "s take their values from Factor " { $link boolean } "s." }
{ { $link texture-uniform } "s take their values from " { $link texture } " objects." } { { $link texture-uniform } "s take their values from " { $link texture } " objects." }
{ "Vector uniforms take their values from Factor " { $link sequence } "s of the corresponding component type." { "Vector uniforms take their values from Factor " { $link sequence } "s of the corresponding component type."

View File

@ -1,6 +1,7 @@
! (c)2009 Joe Groff bsd license ! (c)2009 Joe Groff bsd license
USING: gpu.buffers gpu.render gpu.shaders gpu.textures images kernel USING: gpu.buffers gpu.render gpu.shaders gpu.textures images kernel
specialized-arrays ; specialized-arrays ;
FROM: alien.c-types => float ;
SPECIALIZED-ARRAY: float SPECIALIZED-ARRAY: float
IN: gpu.util IN: gpu.util

View File

@ -5,6 +5,7 @@ gpu.render gpu.state kernel literals
locals math math.constants math.functions math.matrices locals math math.constants math.functions math.matrices
math.order math.vectors opengl.gl sequences math.order math.vectors opengl.gl sequences
ui ui.gadgets.worlds specialized-arrays ; ui ui.gadgets.worlds specialized-arrays ;
FROM: alien.c-types => float ;
SPECIALIZED-ARRAY: float SPECIALIZED-ARRAY: float
IN: gpu.util.wasd IN: gpu.util.wasd

View File

@ -1,6 +1,7 @@
! (c)2009 Joe Groff bsd license ! (c)2009 Joe Groff bsd license
USING: accessors arrays destructors kernel math opengl USING: accessors arrays destructors kernel math opengl
opengl.gl sequences sequences.product specialized-arrays ; opengl.gl sequences sequences.product specialized-arrays ;
FROM: alien.c-types => float ;
SPECIALIZED-ARRAY: float SPECIALIZED-ARRAY: float
IN: grid-meshes IN: grid-meshes

View File

@ -1,7 +1,9 @@
! 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: kernel accessors grouping sequences combinators math USING: alien.c-types kernel accessors grouping sequences
byte-arrays fry images half-floats specialized-arrays ; combinators math byte-arrays fry images half-floats
specialized-arrays ;
FROM: alien.c-types => float ;
SPECIALIZED-ARRAY: uint SPECIALIZED-ARRAY: uint
SPECIALIZED-ARRAY: ushort SPECIALIZED-ARRAY: ushort
SPECIALIZED-ARRAY: float SPECIALIZED-ARRAY: float

View File

@ -4,7 +4,8 @@ USING: accessors colors.constants combinators jamshred.log
jamshred.oint jamshred.sound jamshred.tunnel kernel locals math jamshred.oint jamshred.sound jamshred.tunnel kernel locals math
math.constants math.order math.ranges math.vectors math.matrices math.constants math.order math.ranges math.vectors math.matrices
sequences shuffle specialized-arrays strings system ; sequences shuffle specialized-arrays strings system ;
SPECIALIZED-ARRAY: float QUALIFIED-WITH: alien.c-types c
SPECIALIZED-ARRAY: c:float
IN: jamshred.player IN: jamshred.player
TUPLE: player < oint TUPLE: player < oint

View File

@ -5,6 +5,7 @@ kernel literals locals math math.constants math.matrices
math.order math.quadratic math.ranges math.vectors random math.order math.quadratic math.ranges math.vectors random
sequences specialized-arrays vectors ; sequences specialized-arrays vectors ;
FROM: jamshred.oint => distance ; FROM: jamshred.oint => distance ;
FROM: alien.c-types => float ;
SPECIALIZED-ARRAY: float SPECIALIZED-ARRAY: float
IN: jamshred.tunnel IN: jamshred.tunnel

View File

@ -1,5 +1,6 @@
USING: alien.syntax io io.encodings.utf16n io.encodings.utf8 io.files USING: alien.c-types alien.syntax io io.encodings.utf16n
kernel namespaces sequences system threads unix.utilities ; io.encodings.utf8 io.files kernel namespaces sequences system threads
unix.utilities ;
IN: native-thread-test IN: native-thread-test
FUNCTION: void* start_standalone_factor_in_new_thread ( int argc, char** argv ) ; FUNCTION: void* start_standalone_factor_in_new_thread ( int argc, char** argv ) ;
@ -22,4 +23,4 @@ M: unix native-string-encoding utf8 ;
: testthread ( -- ) : testthread ( -- )
"/tmp/hello" utf8 [ "hello!\n" write ] with-file-appender 5000000 sleep ; "/tmp/hello" utf8 [ "hello!\n" write ] with-file-appender 5000000 sleep ;
MAIN: testthread MAIN: testthread

View File

@ -1,7 +1,8 @@
! (c)2009 Joe Groff bsd license ! (c)2009 Joe Groff bsd license
USING: accessors arrays grouping kernel locals math math.order USING: accessors alien.c-types arrays grouping kernel locals
math.ranges math.vectors math.vectors.homogeneous sequences math math.order math.ranges math.vectors
specialized-arrays ; math.vectors.homogeneous sequences specialized-arrays ;
FROM: alien.c-types => float ;
SPECIALIZED-ARRAY: float SPECIALIZED-ARRAY: float
IN: nurbs IN: nurbs

View File

@ -122,7 +122,7 @@ FUNCTION: int ogg_sync_pageout ( ogg-sync-state* oy, ogg-page* og ) ;
FUNCTION: int ogg_stream_pagein ( ogg-stream-state* os, ogg-page* og ) ; FUNCTION: int ogg_stream_pagein ( ogg-stream-state* os, ogg-page* og ) ;
FUNCTION: int ogg_stream_packetout ( ogg-stream-state* os, ogg-packet* op ) ; FUNCTION: int ogg_stream_packetout ( ogg-stream-state* os, ogg-packet* op ) ;
FUNCTION: int ogg_stream_packetpeek ( ogg-stream-state* os, ogg-packet* op ) ; FUNCTION: int ogg_stream_packetpeek ( ogg-stream-state* os, ogg-packet* op ) ;
FUNCTION: int ogg_stream_init (ogg-stream-state* os, int serialno ) ; FUNCTION: int ogg_stream_init ( ogg-stream-state* os, int serialno ) ;
FUNCTION: int ogg_stream_clear ( ogg-stream-state* os ) ; FUNCTION: int ogg_stream_clear ( ogg-stream-state* os ) ;
FUNCTION: int ogg_stream_reset ( ogg-stream-state* os ) ; FUNCTION: int ogg_stream_reset ( ogg-stream-state* os ) ;
FUNCTION: int ogg_stream_reset_serialno ( ogg-stream-state* os, int serialno ) ; FUNCTION: int ogg_stream_reset_serialno ( ogg-stream-state* os, int serialno ) ;

View File

@ -1,7 +1,7 @@
! Copyright (C) 2007 Chris Double. ! Copyright (C) 2007 Chris Double.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien.c-types kernel alien alien.syntax shuffle USING: alien.c-types kernel alien alien.syntax shuffle
openal.backend namespaces system generalizations ; openal openal.backend namespaces system generalizations ;
IN: openal.macosx IN: openal.macosx
LIBRARY: alut LIBRARY: alut

View File

@ -1,7 +1,7 @@
! Copyright (C) 2007 Chris Double. ! Copyright (C) 2007 Chris Double.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien.c-types alien.syntax combinators generalizations USING: alien.c-types alien.syntax combinators generalizations
kernel openal.backend ; kernel openal openal.backend ;
IN: openal.other IN: openal.other
LIBRARY: alut LIBRARY: alut

View File

@ -1,7 +1,7 @@
! Copyright (C) 2005 Alex Chapman. ! Copyright (C) 2005 Alex Chapman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.libraries alien.syntax kernel sequences words system USING: alien alien.c-types alien.libraries alien.syntax kernel
combinators ; sequences words system combinators opengl.gl ;
IN: opengl.glu IN: opengl.glu
<< <<
@ -268,4 +268,4 @@ FUNCTION: GLint gluUnProject ( GLdouble winX, GLdouble winY, GLdouble winZ, GLdo
! FUNCTION: GLint gluUnProject4 ( GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble clipW, GLdouble* model, GLdouble* proj, GLint* view, GLdouble nearVal, GLdouble farVal, GLdouble* objX, GLdouble* objY, GLdouble* objZ, GLdouble* objW ) ; ! FUNCTION: GLint gluUnProject4 ( GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble clipW, GLdouble* model, GLdouble* proj, GLint* view, GLdouble nearVal, GLdouble farVal, GLdouble* objX, GLdouble* objY, GLdouble* objZ, GLdouble* objW ) ;
: gl-look-at ( eye focus up -- ) : gl-look-at ( eye focus up -- )
[ first3 ] tri@ gluLookAt ; [ first3 ] tri@ gluLookAt ;

View File

@ -9,6 +9,7 @@ terrain.generation terrain.shaders ui ui.gadgets
ui.gadgets.worlds ui.pixel-formats game-worlds method-chains ui.gadgets.worlds ui.pixel-formats game-worlds method-chains
math.affine-transforms noise ui.gestures combinators.short-circuit math.affine-transforms noise ui.gestures combinators.short-circuit
destructors grid-meshes ; destructors grid-meshes ;
FROM: alien.c-types => float ;
SPECIALIZED-ARRAY: float SPECIALIZED-ARRAY: float
IN: terrain IN: terrain

View File

@ -6,6 +6,7 @@ IN: tokyo.alien.tchdb
LIBRARY: tokyocabinet LIBRARY: tokyocabinet
TYPEDEF: void* TCXSTR*
TYPEDEF: void* TCHDB* TYPEDEF: void* TCHDB*
CONSTANT: HDBFOPEN 1 CONSTANT: HDBFOPEN 1

View File

@ -8,6 +8,7 @@ LIBRARY: tokyocabinet
TYPEDEF: void* TDBIDX* TYPEDEF: void* TDBIDX*
TYPEDEF: void* TCTDB* TYPEDEF: void* TCTDB*
TYPEDEF: void* TCMAP*
CONSTANT: TDBFOPEN HDBFOPEN CONSTANT: TDBFOPEN HDBFOPEN
CONSTANT: TDBFFATAL HDBFFATAL CONSTANT: TDBFFATAL HDBFFATAL