update vocabs so a load-all on macosx works without parsing c-type strings
parent
02b4503205
commit
630e5ecc3b
|
@ -1,6 +1,7 @@
|
|||
! Copyright (C) 2009 Doug Coleman.
|
||||
! 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
|
||||
|
||||
<< "zlib" {
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
! Copyright (C) 2007, 2008 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
! 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
|
||||
|
||||
<< "postgresql" {
|
||||
|
@ -69,6 +70,7 @@ TYPEDEF: void* PGnotify*
|
|||
TYPEDEF: void* PQArgBlock*
|
||||
TYPEDEF: void* PQprintOpt*
|
||||
TYPEDEF: void* SSL*
|
||||
TYPEDEF: void* FILE*
|
||||
|
||||
LIBRARY: postgresql
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
! Copyright (C) 2008 Matthew Willis.
|
||||
! Copyright (C) 2009 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license
|
||||
USING: alien alien.syntax alien.destructors combinators system
|
||||
alien.libraries ;
|
||||
USING: alien alien.c-types alien.syntax alien.destructors
|
||||
combinators system alien.libraries ;
|
||||
IN: glib
|
||||
|
||||
<<
|
||||
|
@ -27,12 +27,10 @@ TYPEDEF: void* gpointer
|
|||
TYPEDEF: int gint
|
||||
TYPEDEF: bool gboolean
|
||||
|
||||
FUNCTION: void
|
||||
g_free ( gpointer mem ) ;
|
||||
FUNCTION: void g_free ( gpointer mem ) ;
|
||||
|
||||
LIBRARY: gobject
|
||||
|
||||
FUNCTION: void
|
||||
g_object_unref ( gpointer object ) ;
|
||||
FUNCTION: void g_object_unref ( gpointer object ) ;
|
||||
|
||||
DESTRUCTOR: g_object_unref
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2009 Doug Coleman.
|
||||
! 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
|
||||
io.binary io.encodings.8-bit io.encodings.binary
|
||||
io.encodings.string io.streams.limited kernel math math.bitwise
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
USING: iokit alien alien.syntax alien.c-types kernel
|
||||
system core-foundation core-foundation.data
|
||||
core-foundation.dictionaries ;
|
||||
USING: iokit alien alien.syntax alien.c-types kernel system
|
||||
core-foundation core-foundation.arrays core-foundation.data
|
||||
core-foundation.dictionaries core-foundation.run-loop
|
||||
core-foundation.strings core-foundation.time ;
|
||||
IN: iokit.hid
|
||||
|
||||
CONSTANT: kIOHIDDeviceKey "IOHIDDevice"
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
USING: accessors alien alien.c-types alien.data arrays
|
||||
byte-arrays combinators combinators.short-circuit fry
|
||||
kernel locals macros math math.blas.ffi math.blas.vectors
|
||||
math.blas.vectors.private math.complex math.functions
|
||||
math.order functors words sequences sequences.merged
|
||||
sequences.private shuffle parser prettyprint.backend
|
||||
prettyprint.custom ascii specialized-arrays ;
|
||||
USING: accessors alien alien.c-types alien.complex
|
||||
alien.data arrays byte-arrays combinators
|
||||
combinators.short-circuit fry kernel locals macros math
|
||||
math.blas.ffi math.blas.vectors math.blas.vectors.private
|
||||
math.complex math.functions math.order functors words
|
||||
sequences sequences.merged sequences.private shuffle
|
||||
parser prettyprint.backend prettyprint.custom ascii
|
||||
specialized-arrays ;
|
||||
FROM: alien.c-types => float ;
|
||||
SPECIALIZED-ARRAY: float
|
||||
SPECIALIZED-ARRAY: double
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
USING: accessors alien alien.c-types arrays ascii byte-arrays combinators
|
||||
combinators.short-circuit fry kernel math math.blas.ffi
|
||||
math.complex math.functions math.order sequences sequences.private
|
||||
functors words locals parser prettyprint.backend prettyprint.custom
|
||||
specialized-arrays ;
|
||||
USING: accessors alien alien.c-types alien.complex arrays ascii
|
||||
byte-arrays combinators combinators.short-circuit fry kernel
|
||||
math math.blas.ffi math.complex math.functions math.order
|
||||
sequences sequences.private functors words locals parser
|
||||
prettyprint.backend prettyprint.custom specialized-arrays ;
|
||||
FROM: alien.c-types => float ;
|
||||
SPECIALIZED-ARRAY: float
|
||||
SPECIALIZED-ARRAY: double
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
USING: accessors alien.syntax arrays assocs biassocs
|
||||
classes.struct combinators cpu.x86.features kernel literals
|
||||
math math.bitwise math.floats.env math.floats.env.private
|
||||
system ;
|
||||
USING: accessors alien.c-types alien.syntax arrays assocs
|
||||
biassocs classes.struct combinators cpu.x86.features kernel
|
||||
literals math math.bitwise math.floats.env
|
||||
math.floats.env.private system ;
|
||||
IN: math.floats.env.x86
|
||||
|
||||
STRUCT: sse-env
|
||||
|
|
|
@ -3,8 +3,12 @@
|
|||
! See http://factorcode.org/license.txt for BSD license.
|
||||
!
|
||||
! pangocairo bindings, from pango/pangocairo.h
|
||||
USING: alien alien.syntax combinators system cairo.ffi
|
||||
alien.libraries ;
|
||||
USING: arrays sequences alien alien.c-types alien.destructors
|
||||
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
|
||||
|
||||
<< {
|
||||
|
@ -15,6 +19,9 @@ IN: pango.cairo
|
|||
|
||||
LIBRARY: pangocairo
|
||||
|
||||
TYPEDEF: void* PangoCairoFontMap*
|
||||
TYPEDEF: void* PangoCairoFont*
|
||||
|
||||
FUNCTION: PangoFontMap*
|
||||
pango_cairo_font_map_new ( ) ;
|
||||
|
||||
|
@ -87,3 +94,150 @@ pango_cairo_layout_path ( cairo_t* cr, PangoLayout* layout ) ;
|
|||
|
||||
FUNCTION: void
|
||||
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
|
||||
|
|
|
@ -15,6 +15,15 @@ PANGO_STYLE_OBLIQUE
|
|||
PANGO_STYLE_ITALIC ;
|
||||
|
||||
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_ULTRALIGHT 200
|
||||
CONSTANT: PANGO_WEIGHT_LIGHT 300
|
||||
|
@ -102,4 +111,4 @@ MEMO: (cache-font-description) ( font -- description )
|
|||
: cache-font-description ( 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
|
||||
|
|
|
@ -4,12 +4,16 @@
|
|||
USING: arrays sequences alien alien.c-types alien.destructors
|
||||
alien.syntax math math.functions math.vectors destructors combinators
|
||||
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 ;
|
||||
IN: pango.layouts
|
||||
|
||||
LIBRARY: pango
|
||||
|
||||
TYPEDEF: void* PangoLayout*
|
||||
TYPEDEF: void* PangoLayoutIter*
|
||||
TYPEDEF: void* PangoLayoutLine*
|
||||
|
||||
FUNCTION: PangoLayout*
|
||||
pango_layout_new ( PangoContext* context ) ;
|
||||
|
||||
|
@ -60,149 +64,3 @@ pango_layout_iter_free ( PangoLayoutIter* iter ) ;
|
|||
|
||||
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
|
||||
|
|
|
@ -23,8 +23,9 @@ CONSTANT: PANGO_SCALE 1024
|
|||
: pango>float ( n -- x ) PANGO_SCALE /f ; inline
|
||||
: float>pango ( x -- n ) PANGO_SCALE * >integer ; inline
|
||||
|
||||
FUNCTION: PangoContext*
|
||||
pango_context_new ( ) ;
|
||||
TYPEDEF: void* PangoContext*
|
||||
|
||||
FUNCTION: PangoContext* pango_context_new ( ) ;
|
||||
|
||||
STRUCT: PangoRectangle
|
||||
{ x int }
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
USING: kernel accessors math math.vectors locals sequences
|
||||
specialized-arrays colors arrays combinators
|
||||
opengl opengl.gl ui.pens ui.pens.caching ;
|
||||
FROM: alien.c-types => float ;
|
||||
SPECIALIZED-ARRAY: float
|
||||
IN: ui.pens.gradient
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
! Copyright (C) 2009 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors colors help.markup help.syntax kernel opengl
|
||||
opengl.gl sequences math.vectors ui.gadgets ui.pens
|
||||
specialized-arrays ;
|
||||
USING: accessors alien.c-types colors help.markup help.syntax
|
||||
kernel opengl opengl.gl sequences math.vectors ui.gadgets
|
||||
ui.pens specialized-arrays ;
|
||||
SPECIALIZED-ARRAY: float
|
||||
IN: ui.pens.polygon
|
||||
|
||||
|
@ -36,4 +36,4 @@ M: polygon draw-interior
|
|||
|
||||
: <polygon-gadget> ( color points -- gadget )
|
||||
[ <polygon> ] [ { 0 0 } [ vmax ] reduce ] bi
|
||||
[ <gadget> ] 2dip [ >>interior ] [ >>dim ] bi* ;
|
||||
[ <gadget> ] 2dip [ >>interior ] [ >>dim ] bi* ;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
! Based on X.h
|
||||
|
||||
USING: alien alien.syntax math x11.xlib ;
|
||||
USING: alien alien.c-types alien.syntax math x11.xlib ;
|
||||
IN: x11.constants
|
||||
|
||||
TYPEDEF: ulong Mask
|
||||
|
@ -406,4 +406,4 @@ CONSTANT: MSBFirst 1
|
|||
! * 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 ;
|
||||
|
|
|
@ -410,10 +410,6 @@ STRUCT: XCharStruct
|
|||
{ descent short }
|
||||
{ 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
|
||||
{ ext_data XExtData* }
|
||||
{ fid Font }
|
||||
|
@ -432,6 +428,10 @@ STRUCT: XFontStruct
|
|||
{ ascent 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 ) ;
|
||||
|
||||
! 8.6 - Drawing Text
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
USING: sequences kernel math specialized-arrays fry ;
|
||||
USING: alien.c-types sequences kernel math specialized-arrays
|
||||
fry ;
|
||||
SPECIALIZED-ARRAY: int
|
||||
IN: benchmark.dawes
|
||||
|
||||
|
|
|
@ -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 ;
|
||||
SPECIALIZED-ARRAY: double
|
||||
IN: benchmark.dispatch2
|
||||
|
@ -29,4 +29,4 @@ IN: benchmark.dispatch2
|
|||
1000000 sequences
|
||||
[ [ 0 swap nth don't-flush-me ] each ] curry times ;
|
||||
|
||||
MAIN: dispatch-test
|
||||
MAIN: dispatch-test
|
||||
|
|
|
@ -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
|
||||
specialized-arrays bit-arrays ;
|
||||
SPECIALIZED-ARRAY: double
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
! 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
|
||||
sequences.private benchmark.reverse-complement hints
|
||||
io.encodings.ascii byte-arrays specialized-arrays ;
|
||||
USING: alien.c-types math kernel io io.files locals multiline
|
||||
assocs sequences sequences.private benchmark.reverse-complement
|
||||
hints io.encodings.ascii byte-arrays specialized-arrays ;
|
||||
SPECIALIZED-ARRAY: double
|
||||
IN: benchmark.fasta
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
! Copyright (C) 2008, 2009 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors fry kernel locals math math.constants
|
||||
math.functions math.vectors math.vectors.simd prettyprint
|
||||
combinators.smart sequences hints classes.struct
|
||||
USING: accessors alien.c-types fry kernel locals math
|
||||
math.constants math.functions math.vectors math.vectors.simd
|
||||
prettyprint combinators.smart sequences hints classes.struct
|
||||
specialized-arrays ;
|
||||
SIMD: double
|
||||
IN: benchmark.nbody-simd
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
! Copyright (C) 2008, 2009 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors specialized-arrays fry kernel locals math
|
||||
math.constants math.functions math.vectors prettyprint
|
||||
combinators.smart sequences hints arrays ;
|
||||
USING: accessors specialized-arrays fry kernel
|
||||
locals math math.constants math.functions math.vectors
|
||||
prettyprint combinators.smart sequences hints arrays ;
|
||||
FROM: alien.c-types => double ;
|
||||
SPECIALIZED-ARRAY: double
|
||||
IN: benchmark.nbody
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
! Factor port of the raytracer benchmark from
|
||||
! http://www.ffconsultancy.com/free/ray_tracer/languages.html
|
||||
|
||||
USING: arrays accessors specialized-arrays io io.files
|
||||
io.files.temp io.encodings.binary kernel math math.constants
|
||||
math.functions math.vectors math.parser make sequences
|
||||
sequences.private words hints ;
|
||||
USING: arrays accessors specialized-arrays io
|
||||
io.files io.files.temp io.encodings.binary kernel math
|
||||
math.constants math.functions math.vectors math.parser make
|
||||
sequences sequences.private words hints ;
|
||||
FROM: alien.c-types => double ;
|
||||
SPECIALIZED-ARRAY: double
|
||||
IN: benchmark.raytracer
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
! Factor port of
|
||||
! http://shootout.alioth.debian.org/gp4/benchmark.php?test=spectralnorm&lang=all
|
||||
USING: specialized-arrays kernel math math.functions
|
||||
math.vectors sequences prettyprint words hints locals ;
|
||||
USING: alien.c-types specialized-arrays kernel math
|
||||
math.functions math.vectors sequences prettyprint words hints
|
||||
locals ;
|
||||
SPECIALIZED-ARRAY: double
|
||||
IN: benchmark.spectral-norm
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
USING: accessors classes.struct combinators.smart fry kernel
|
||||
math math.functions math.order math.parser sequences
|
||||
specialized-arrays io ;
|
||||
FROM: alien.c-types => float ;
|
||||
IN: benchmark.struct-arrays
|
||||
|
||||
STRUCT: point { x float } { y float } { z float } ;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2005, 2007 Slava Pestov.
|
||||
! 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 ;
|
||||
IN: freetype
|
||||
|
||||
|
@ -38,8 +38,8 @@ TYPEDEF: long FT_F26Dot6
|
|||
FUNCTION: FT_Error FT_Init_FreeType ( void* library ) ;
|
||||
|
||||
! circular reference between glyph and face
|
||||
TYPEDEF: void face
|
||||
TYPEDEF: void glyph
|
||||
TYPEDEF: void* face*
|
||||
TYPEDEF: void* glyph*
|
||||
|
||||
STRUCT: glyph
|
||||
{ library void* }
|
||||
|
@ -166,6 +166,8 @@ STRUCT: FT_Bitmap
|
|||
{ palette_mode char }
|
||||
{ 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_Memory_Face ( void* library, FT_Byte* file_base, FT_Long file_size, FT_Long face_index, FT_Face* aface ) ;
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
! (c)2009 Joe Groff bsd license
|
||||
USING: alien alien.syntax byte-arrays classes gpu.buffers
|
||||
gpu.framebuffers gpu.shaders gpu.textures help.markup
|
||||
USING: alien alien.c-types alien.syntax byte-arrays classes
|
||||
gpu.buffers gpu.framebuffers gpu.shaders gpu.textures help.markup
|
||||
help.syntax images kernel math sequences
|
||||
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: uint
|
||||
SPECIALIZED-ARRAY: ulong
|
||||
|
@ -49,7 +51,7 @@ $nl
|
|||
"Uniform parameters are passed from Factor to the shader program through the uniform tuple as follows:"
|
||||
{ $list
|
||||
{ { $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 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."
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
! (c)2009 Joe Groff bsd license
|
||||
USING: gpu.buffers gpu.render gpu.shaders gpu.textures images kernel
|
||||
specialized-arrays ;
|
||||
FROM: alien.c-types => float ;
|
||||
SPECIALIZED-ARRAY: float
|
||||
IN: gpu.util
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ gpu.render gpu.state kernel literals
|
|||
locals math math.constants math.functions math.matrices
|
||||
math.order math.vectors opengl.gl sequences
|
||||
ui ui.gadgets.worlds specialized-arrays ;
|
||||
FROM: alien.c-types => float ;
|
||||
SPECIALIZED-ARRAY: float
|
||||
IN: gpu.util.wasd
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
! (c)2009 Joe Groff bsd license
|
||||
USING: accessors arrays destructors kernel math opengl
|
||||
opengl.gl sequences sequences.product specialized-arrays ;
|
||||
FROM: alien.c-types => float ;
|
||||
SPECIALIZED-ARRAY: float
|
||||
IN: grid-meshes
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
! Copyright (C) 2009 Doug Coleman
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: kernel accessors grouping sequences combinators math
|
||||
byte-arrays fry images half-floats specialized-arrays ;
|
||||
USING: alien.c-types kernel accessors grouping sequences
|
||||
combinators math byte-arrays fry images half-floats
|
||||
specialized-arrays ;
|
||||
FROM: alien.c-types => float ;
|
||||
SPECIALIZED-ARRAY: uint
|
||||
SPECIALIZED-ARRAY: ushort
|
||||
SPECIALIZED-ARRAY: float
|
||||
|
|
|
@ -4,7 +4,8 @@ USING: accessors colors.constants combinators jamshred.log
|
|||
jamshred.oint jamshred.sound jamshred.tunnel kernel locals math
|
||||
math.constants math.order math.ranges math.vectors math.matrices
|
||||
sequences shuffle specialized-arrays strings system ;
|
||||
SPECIALIZED-ARRAY: float
|
||||
QUALIFIED-WITH: alien.c-types c
|
||||
SPECIALIZED-ARRAY: c:float
|
||||
IN: jamshred.player
|
||||
|
||||
TUPLE: player < oint
|
||||
|
|
|
@ -5,6 +5,7 @@ kernel literals locals math math.constants math.matrices
|
|||
math.order math.quadratic math.ranges math.vectors random
|
||||
sequences specialized-arrays vectors ;
|
||||
FROM: jamshred.oint => distance ;
|
||||
FROM: alien.c-types => float ;
|
||||
SPECIALIZED-ARRAY: float
|
||||
IN: jamshred.tunnel
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
USING: alien.syntax io io.encodings.utf16n io.encodings.utf8 io.files
|
||||
kernel namespaces sequences system threads unix.utilities ;
|
||||
USING: alien.c-types alien.syntax io io.encodings.utf16n
|
||||
io.encodings.utf8 io.files kernel namespaces sequences system threads
|
||||
unix.utilities ;
|
||||
IN: native-thread-test
|
||||
|
||||
FUNCTION: void* start_standalone_factor_in_new_thread ( int argc, char** argv ) ;
|
||||
|
@ -22,4 +23,4 @@ M: unix native-string-encoding utf8 ;
|
|||
: testthread ( -- )
|
||||
"/tmp/hello" utf8 [ "hello!\n" write ] with-file-appender 5000000 sleep ;
|
||||
|
||||
MAIN: testthread
|
||||
MAIN: testthread
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
! (c)2009 Joe Groff bsd license
|
||||
USING: accessors arrays grouping kernel locals math math.order
|
||||
math.ranges math.vectors math.vectors.homogeneous sequences
|
||||
specialized-arrays ;
|
||||
USING: accessors alien.c-types arrays grouping kernel locals
|
||||
math math.order math.ranges math.vectors
|
||||
math.vectors.homogeneous sequences specialized-arrays ;
|
||||
FROM: alien.c-types => float ;
|
||||
SPECIALIZED-ARRAY: float
|
||||
IN: nurbs
|
||||
|
||||
|
|
|
@ -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_packetout ( 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_reset ( ogg-stream-state* os ) ;
|
||||
FUNCTION: int ogg_stream_reset_serialno ( ogg-stream-state* os, int serialno ) ;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
! Copyright (C) 2007 Chris Double.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: alien.c-types kernel alien alien.syntax shuffle
|
||||
openal.backend namespaces system generalizations ;
|
||||
openal openal.backend namespaces system generalizations ;
|
||||
IN: openal.macosx
|
||||
|
||||
LIBRARY: alut
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
! Copyright (C) 2007 Chris Double.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: alien.c-types alien.syntax combinators generalizations
|
||||
kernel openal.backend ;
|
||||
kernel openal openal.backend ;
|
||||
IN: openal.other
|
||||
|
||||
LIBRARY: alut
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
! Copyright (C) 2005 Alex Chapman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: alien alien.libraries alien.syntax kernel sequences words system
|
||||
combinators ;
|
||||
USING: alien alien.c-types alien.libraries alien.syntax kernel
|
||||
sequences words system combinators opengl.gl ;
|
||||
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 ) ;
|
||||
|
||||
: gl-look-at ( eye focus up -- )
|
||||
[ first3 ] tri@ gluLookAt ;
|
||||
[ first3 ] tri@ gluLookAt ;
|
||||
|
|
|
@ -9,6 +9,7 @@ terrain.generation terrain.shaders ui ui.gadgets
|
|||
ui.gadgets.worlds ui.pixel-formats game-worlds method-chains
|
||||
math.affine-transforms noise ui.gestures combinators.short-circuit
|
||||
destructors grid-meshes ;
|
||||
FROM: alien.c-types => float ;
|
||||
SPECIALIZED-ARRAY: float
|
||||
IN: terrain
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ IN: tokyo.alien.tchdb
|
|||
|
||||
LIBRARY: tokyocabinet
|
||||
|
||||
TYPEDEF: void* TCXSTR*
|
||||
TYPEDEF: void* TCHDB*
|
||||
|
||||
CONSTANT: HDBFOPEN 1
|
||||
|
|
|
@ -8,6 +8,7 @@ LIBRARY: tokyocabinet
|
|||
|
||||
TYPEDEF: void* TDBIDX*
|
||||
TYPEDEF: void* TCTDB*
|
||||
TYPEDEF: void* TCMAP*
|
||||
|
||||
CONSTANT: TDBFOPEN HDBFOPEN
|
||||
CONSTANT: TDBFFATAL HDBFFATAL
|
||||
|
|
Loading…
Reference in New Issue