From 630e5ecc3bb8022e7c01bb8761e856026aa13c01 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Sun, 27 Sep 2009 15:11:21 -0500 Subject: [PATCH] update vocabs so a load-all on macosx works without parsing c-type strings --- basis/compression/zlib/ffi/ffi.factor | 3 +- basis/db/postgresql/ffi/ffi.factor | 4 +- basis/glib/glib.factor | 10 +- basis/images/bitmap/loading/loading.factor | 2 +- basis/iokit/hid/hid.factor | 7 +- basis/math/blas/matrices/matrices.factor | 15 +- basis/math/blas/vectors/vectors.factor | 10 +- basis/math/floats/env/x86/x86.factor | 8 +- basis/pango/cairo/cairo.factor | 158 +++++++++++++++++- basis/pango/fonts/fonts.factor | 11 +- basis/pango/layouts/layouts.factor | 152 +---------------- basis/pango/pango.factor | 5 +- basis/ui/pens/gradient/gradient.factor | 1 + basis/ui/pens/polygon/polygon.factor | 8 +- basis/x11/constants/constants.factor | 4 +- basis/x11/xlib/xlib.factor | 8 +- extra/benchmark/dawes/dawes.factor | 3 +- extra/benchmark/dispatch2/dispatch2.factor | 4 +- extra/benchmark/dispatch3/dispatch3.factor | 2 +- extra/benchmark/fasta/fasta.factor | 6 +- extra/benchmark/nbody-simd/nbody-simd.factor | 6 +- extra/benchmark/nbody/nbody.factor | 7 +- extra/benchmark/raytracer/raytracer.factor | 10 +- .../spectral-norm/spectral-norm.factor | 5 +- .../struct-arrays/struct-arrays.factor | 1 + extra/freetype/freetype.factor | 8 +- extra/gpu/render/render-docs.factor | 10 +- extra/gpu/util/util.factor | 1 + extra/gpu/util/wasd/wasd.factor | 1 + extra/grid-meshes/grid-meshes.factor | 1 + .../images/normalization/normalization.factor | 6 +- extra/jamshred/player/player.factor | 3 +- extra/jamshred/tunnel/tunnel.factor | 1 + .../native-thread-test.factor | 7 +- extra/nurbs/nurbs.factor | 7 +- extra/ogg/ogg.factor | 2 +- extra/openal/macosx/macosx.factor | 2 +- extra/openal/other/other.factor | 2 +- extra/opengl/glu/glu.factor | 6 +- extra/terrain/terrain.factor | 1 + extra/tokyo/alien/tchdb/tchdb.factor | 1 + extra/tokyo/alien/tctdb/tctdb.factor | 1 + 42 files changed, 278 insertions(+), 232 deletions(-) diff --git a/basis/compression/zlib/ffi/ffi.factor b/basis/compression/zlib/ffi/ffi.factor index a472f9a2fe..553b55cf6e 100755 --- a/basis/compression/zlib/ffi/ffi.factor +++ b/basis/compression/zlib/ffi/ffi.factor @@ -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" { diff --git a/basis/db/postgresql/ffi/ffi.factor b/basis/db/postgresql/ffi/ffi.factor index 1e7f4d5b82..88618c6212 100644 --- a/basis/db/postgresql/ffi/ffi.factor +++ b/basis/db/postgresql/ffi/ffi.factor @@ -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 diff --git a/basis/glib/glib.factor b/basis/glib/glib.factor index ca481cb900..157a426e19 100755 --- a/basis/glib/glib.factor +++ b/basis/glib/glib.factor @@ -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 diff --git a/basis/images/bitmap/loading/loading.factor b/basis/images/bitmap/loading/loading.factor index 823cfcd03a..91e0cb882d 100644 --- a/basis/images/bitmap/loading/loading.factor +++ b/basis/images/bitmap/loading/loading.factor @@ -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 diff --git a/basis/iokit/hid/hid.factor b/basis/iokit/hid/hid.factor index a1a4b942b7..b3894d7b49 100644 --- a/basis/iokit/hid/hid.factor +++ b/basis/iokit/hid/hid.factor @@ -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" diff --git a/basis/math/blas/matrices/matrices.factor b/basis/math/blas/matrices/matrices.factor index aa9681bb2e..0a6fc147ad 100755 --- a/basis/math/blas/matrices/matrices.factor +++ b/basis/math/blas/matrices/matrices.factor @@ -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 diff --git a/basis/math/blas/vectors/vectors.factor b/basis/math/blas/vectors/vectors.factor index 20ee7925b0..8d057de720 100755 --- a/basis/math/blas/vectors/vectors.factor +++ b/basis/math/blas/vectors/vectors.factor @@ -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 diff --git a/basis/math/floats/env/x86/x86.factor b/basis/math/floats/env/x86/x86.factor index e9120567aa..2b73628b4c 100644 --- a/basis/math/floats/env/x86/x86.factor +++ b/basis/math/floats/env/x86/x86.factor @@ -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 diff --git a/basis/pango/cairo/cairo.factor b/basis/pango/cairo/cairo.factor index 45b7a9cb31..2ad730ee6e 100644 --- a/basis/pango/cairo/cairo.factor +++ b/basis/pango/cairo/cairo.factor @@ -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 + PangoRectangle + [ 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 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 [ 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 0 + [ 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 ; + +: 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 ; + +: ( 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 &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 ; + +: ( font string -- line ) + [ + layout new-disposable + swap unpack-selection + swap >>font + dup [ string>> ] [ font>> ] bi >>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 [ ] 2cache ; + +: cached-line ( font string -- line ) + cached-layout layout>> first-line ; + +[ cached-layouts set-global ] "pango.cairo" add-init-hook diff --git a/basis/pango/fonts/fonts.factor b/basis/pango/fonts/fonts.factor index abfc086820..eb3e2208b1 100644 --- a/basis/pango/fonts/fonts.factor +++ b/basis/pango/fonts/fonts.factor @@ -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 \ No newline at end of file +[ \ (cache-font-description) reset-memoized ] "pango.fonts" add-init-hook diff --git a/basis/pango/layouts/layouts.factor b/basis/pango/layouts/layouts.factor index 7a7bd86aea..a03d26fb67 100644 --- a/basis/pango/layouts/layouts.factor +++ b/basis/pango/layouts/layouts.factor @@ -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 ; - -: ( 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 - PangoRectangle - [ pango_layout_get_extents ] 2keep - [ PangoRectangle>rect ] bi@ ; - -: glyph-height ( font string -- y ) - swap &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 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 [ 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 0 - [ 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 ; - -: 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 - -: ( font string -- line ) - [ - layout new-disposable - swap unpack-selection - swap >>font - dup [ string>> ] [ font>> ] bi >>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 [ ] 2cache ; - -: cached-line ( font string -- line ) - cached-layout layout>> first-line ; - -[ cached-layouts set-global ] "pango.layouts" add-init-hook diff --git a/basis/pango/pango.factor b/basis/pango/pango.factor index 11e15ae951..03134ed787 100644 --- a/basis/pango/pango.factor +++ b/basis/pango/pango.factor @@ -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 } diff --git a/basis/ui/pens/gradient/gradient.factor b/basis/ui/pens/gradient/gradient.factor index 53b4357d44..7f7bd02204 100644 --- a/basis/ui/pens/gradient/gradient.factor +++ b/basis/ui/pens/gradient/gradient.factor @@ -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 diff --git a/basis/ui/pens/polygon/polygon.factor b/basis/ui/pens/polygon/polygon.factor index a39a5cb7cd..c1e1ada61b 100644 --- a/basis/ui/pens/polygon/polygon.factor +++ b/basis/ui/pens/polygon/polygon.factor @@ -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 : ( color points -- gadget ) [ ] [ { 0 0 } [ vmax ] reduce ] bi - [ ] 2dip [ >>interior ] [ >>dim ] bi* ; \ No newline at end of file + [ ] 2dip [ >>interior ] [ >>dim ] bi* ; diff --git a/basis/x11/constants/constants.factor b/basis/x11/constants/constants.factor index 1fe825d6af..763cddaaf1 100644 --- a/basis/x11/constants/constants.factor +++ b/basis/x11/constants/constants.factor @@ -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 ; \ No newline at end of file +C-ENUM: _NET_WM_STATE_REMOVE _NET_WM_STATE_ADD _NET_WM_STATE_TOGGLE ; diff --git a/basis/x11/xlib/xlib.factor b/basis/x11/xlib/xlib.factor index 0cd7704cf8..2b90b1bff2 100644 --- a/basis/x11/xlib/xlib.factor +++ b/basis/x11/xlib/xlib.factor @@ -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 diff --git a/extra/benchmark/dawes/dawes.factor b/extra/benchmark/dawes/dawes.factor index ebfa37cdbc..31c202b803 100644 --- a/extra/benchmark/dawes/dawes.factor +++ b/extra/benchmark/dawes/dawes.factor @@ -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 diff --git a/extra/benchmark/dispatch2/dispatch2.factor b/extra/benchmark/dispatch2/dispatch2.factor index 5dcefdda5a..87848cee9d 100644 --- a/extra/benchmark/dispatch2/dispatch2.factor +++ b/extra/benchmark/dispatch2/dispatch2.factor @@ -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 \ No newline at end of file +MAIN: dispatch-test diff --git a/extra/benchmark/dispatch3/dispatch3.factor b/extra/benchmark/dispatch3/dispatch3.factor index 58301b57af..d5b5432f07 100644 --- a/extra/benchmark/dispatch3/dispatch3.factor +++ b/extra/benchmark/dispatch3/dispatch3.factor @@ -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 diff --git a/extra/benchmark/fasta/fasta.factor b/extra/benchmark/fasta/fasta.factor index 5b1a50c9e6..1ad769173b 100755 --- a/extra/benchmark/fasta/fasta.factor +++ b/extra/benchmark/fasta/fasta.factor @@ -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 diff --git a/extra/benchmark/nbody-simd/nbody-simd.factor b/extra/benchmark/nbody-simd/nbody-simd.factor index c47cdf4ee8..6648c52639 100644 --- a/extra/benchmark/nbody-simd/nbody-simd.factor +++ b/extra/benchmark/nbody-simd/nbody-simd.factor @@ -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 diff --git a/extra/benchmark/nbody/nbody.factor b/extra/benchmark/nbody/nbody.factor index fc1cbaa12c..c7ffed2bb3 100644 --- a/extra/benchmark/nbody/nbody.factor +++ b/extra/benchmark/nbody/nbody.factor @@ -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 diff --git a/extra/benchmark/raytracer/raytracer.factor b/extra/benchmark/raytracer/raytracer.factor index 96f345510f..2413e7fd1e 100755 --- a/extra/benchmark/raytracer/raytracer.factor +++ b/extra/benchmark/raytracer/raytracer.factor @@ -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 diff --git a/extra/benchmark/spectral-norm/spectral-norm.factor b/extra/benchmark/spectral-norm/spectral-norm.factor index 41ae5b3578..68efffe083 100644 --- a/extra/benchmark/spectral-norm/spectral-norm.factor +++ b/extra/benchmark/spectral-norm/spectral-norm.factor @@ -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 diff --git a/extra/benchmark/struct-arrays/struct-arrays.factor b/extra/benchmark/struct-arrays/struct-arrays.factor index 24c3ec965d..942f78a483 100644 --- a/extra/benchmark/struct-arrays/struct-arrays.factor +++ b/extra/benchmark/struct-arrays/struct-arrays.factor @@ -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 } ; diff --git a/extra/freetype/freetype.factor b/extra/freetype/freetype.factor index 6644596828..6105381f86 100644 --- a/extra/freetype/freetype.factor +++ b/extra/freetype/freetype.factor @@ -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 ) ; diff --git a/extra/gpu/render/render-docs.factor b/extra/gpu/render/render-docs.factor index 35b529df5f..e34b9b119d 100755 --- a/extra/gpu/render/render-docs.factor +++ b/extra/gpu/render/render-docs.factor @@ -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." diff --git a/extra/gpu/util/util.factor b/extra/gpu/util/util.factor index 862c94d4b3..1c9c8e629c 100644 --- a/extra/gpu/util/util.factor +++ b/extra/gpu/util/util.factor @@ -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 diff --git a/extra/gpu/util/wasd/wasd.factor b/extra/gpu/util/wasd/wasd.factor index 9145434d90..496735f0db 100644 --- a/extra/gpu/util/wasd/wasd.factor +++ b/extra/gpu/util/wasd/wasd.factor @@ -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 diff --git a/extra/grid-meshes/grid-meshes.factor b/extra/grid-meshes/grid-meshes.factor index 94638de346..4eaa702468 100644 --- a/extra/grid-meshes/grid-meshes.factor +++ b/extra/grid-meshes/grid-meshes.factor @@ -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 diff --git a/extra/images/normalization/normalization.factor b/extra/images/normalization/normalization.factor index 8706ac5834..f557e979dd 100755 --- a/extra/images/normalization/normalization.factor +++ b/extra/images/normalization/normalization.factor @@ -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 diff --git a/extra/jamshred/player/player.factor b/extra/jamshred/player/player.factor index 536974952e..e4c954d793 100644 --- a/extra/jamshred/player/player.factor +++ b/extra/jamshred/player/player.factor @@ -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 diff --git a/extra/jamshred/tunnel/tunnel.factor b/extra/jamshred/tunnel/tunnel.factor index 2767444c8f..742f834622 100644 --- a/extra/jamshred/tunnel/tunnel.factor +++ b/extra/jamshred/tunnel/tunnel.factor @@ -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 diff --git a/extra/native-thread-test/native-thread-test.factor b/extra/native-thread-test/native-thread-test.factor index 16eff168d4..508e590d01 100644 --- a/extra/native-thread-test/native-thread-test.factor +++ b/extra/native-thread-test/native-thread-test.factor @@ -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 \ No newline at end of file +MAIN: testthread diff --git a/extra/nurbs/nurbs.factor b/extra/nurbs/nurbs.factor index b8f2f1cb5f..0df063e2c6 100644 --- a/extra/nurbs/nurbs.factor +++ b/extra/nurbs/nurbs.factor @@ -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 diff --git a/extra/ogg/ogg.factor b/extra/ogg/ogg.factor index 6cd6964721..24227167c9 100644 --- a/extra/ogg/ogg.factor +++ b/extra/ogg/ogg.factor @@ -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 ) ; diff --git a/extra/openal/macosx/macosx.factor b/extra/openal/macosx/macosx.factor index 81d360eca1..f0a6b928e9 100644 --- a/extra/openal/macosx/macosx.factor +++ b/extra/openal/macosx/macosx.factor @@ -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 diff --git a/extra/openal/other/other.factor b/extra/openal/other/other.factor index 0936c94150..ada8d6b1fb 100644 --- a/extra/openal/other/other.factor +++ b/extra/openal/other/other.factor @@ -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 diff --git a/extra/opengl/glu/glu.factor b/extra/opengl/glu/glu.factor index a8404bb13a..a62745cb6a 100644 --- a/extra/opengl/glu/glu.factor +++ b/extra/opengl/glu/glu.factor @@ -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 ; \ No newline at end of file + [ first3 ] tri@ gluLookAt ; diff --git a/extra/terrain/terrain.factor b/extra/terrain/terrain.factor index 95322e423a..050a835422 100644 --- a/extra/terrain/terrain.factor +++ b/extra/terrain/terrain.factor @@ -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 diff --git a/extra/tokyo/alien/tchdb/tchdb.factor b/extra/tokyo/alien/tchdb/tchdb.factor index 3793846050..b9503bdab4 100755 --- a/extra/tokyo/alien/tchdb/tchdb.factor +++ b/extra/tokyo/alien/tchdb/tchdb.factor @@ -6,6 +6,7 @@ IN: tokyo.alien.tchdb LIBRARY: tokyocabinet +TYPEDEF: void* TCXSTR* TYPEDEF: void* TCHDB* CONSTANT: HDBFOPEN 1 diff --git a/extra/tokyo/alien/tctdb/tctdb.factor b/extra/tokyo/alien/tctdb/tctdb.factor index e43ed9c765..8373a6aaaa 100755 --- a/extra/tokyo/alien/tctdb/tctdb.factor +++ b/extra/tokyo/alien/tctdb/tctdb.factor @@ -8,6 +8,7 @@ LIBRARY: tokyocabinet TYPEDEF: void* TDBIDX* TYPEDEF: void* TCTDB* +TYPEDEF: void* TCMAP* CONSTANT: TDBFOPEN HDBFOPEN CONSTANT: TDBFFATAL HDBFFATAL