Merge branch 'master' of git://factorcode.org/git/factor

db4
Slava Pestov 2009-02-23 23:55:37 -06:00
commit 6ea93a6355
4 changed files with 56 additions and 39 deletions

View File

@ -5,7 +5,7 @@ db.errors.postgresql db.postgresql io.files.unique kernel namespaces
tools.test db.tester continuations ;
IN: db.errors.postgresql.tests
postgresql-test-db [
[
[ "drop table foo;" sql-command ] ignore-errors
[ "drop table ship;" sql-command ] ignore-errors
@ -29,4 +29,4 @@ postgresql-test-db [
sql-syntax-error?
] must-fail-with
] with-db
] test-postgresql

View File

@ -1,6 +1,6 @@
USING: definitions io.launcher kernel parser words sequences math
math.parser namespaces editors make system combinators.short-circuit
fry threads ;
fry threads vocabs.loader ;
IN: editors.emacs
SYMBOL: emacsclient-path
@ -22,3 +22,5 @@ M: object default-emacsclient ( -- path ) "emacsclient" ;
where first2 emacsclient ;
[ emacsclient ] edit-hook set-global
os windows? [ "editors.emacs.windows" require ] when

View File

@ -1,4 +1,4 @@
USING: help.markup help.syntax io quotations ;
USING: help.markup help.syntax io quotations math ;
IN: io.encodings
HELP: <encoder>
@ -71,6 +71,9 @@ HELP: with-encoded-output
{ $description "Creates a new encoder with the given encoding descriptor and calls the quotation using this encoder. The original encoder object is restored after the quotation returns and the stream is kept open for future output operations." } ;
HELP: replacement-char
{ $values
{ "value" integer }
}
{ $description "A code point that replaces input that could not be decoded. The presence of this character in the decoded data usually signifies an error." } ;
ARTICLE: "encodings-descriptors" "Encoding descriptors"

View File

@ -6,68 +6,80 @@
! http://cairographics.org/samples/text/
USING: cairo.ffi math math.constants byte-arrays kernel ui ui.render
ui.gadgets opengl.gl accessors ;
USING: cairo.ffi math math.constants byte-arrays kernel ui
ui.render combinators ui.gadgets opengl.gl accessors
namespaces opengl ;
IN: cairo-demo
: make-image-array ( -- array )
384 256 4 * * <byte-array> ;
384 256 4 * * <byte-array> ;
: convert-array-to-surface ( array -- cairo_surface_t )
CAIRO_FORMAT_ARGB32 384 256 over 4 *
cairo_image_surface_create_for_data ;
CAIRO_FORMAT_ARGB32 384 256 over 4 *
cairo_image_surface_create_for_data ;
TUPLE: cairo-demo-gadget < gadget image-array cairo-t ;
M: cairo-demo-gadget draw-gadget* ( gadget -- )
0 0 glRasterPos2i
1.0 -1.0 glPixelZoom
[ 384 256 GL_RGBA GL_UNSIGNED_BYTE ] dip
image-array>> glDrawPixels ;
origin get [
0 0 glRasterPos2i
1.0 -1.0 glPixelZoom
[ 384 256 GL_RGBA GL_UNSIGNED_BYTE ] dip
image-array>> glDrawPixels
] with-translation ;
: create-surface ( gadget -- cairo_surface_t )
make-image-array [ swap (>>image-array) ] keep
convert-array-to-surface ;
: init-cairo ( gadget -- cairo_t )
create-surface cairo_create ;
create-surface cairo_create ;
M: cairo-demo-gadget pref-dim* drop { 384 256 0 } ;
M: cairo-demo-gadget pref-dim* drop { 384 256 } ;
ERROR: no-cairo-t ;
<PRIVATE
: draw-hello-world ( gadget -- )
cairo-t>>
dup "Sans" CAIRO_FONT_SLANT_NORMAL CAIRO_FONT_WEIGHT_BOLD cairo_select_font_face
dup 90.0 cairo_set_font_size
dup 10.0 135.0 cairo_move_to
dup "Hello" cairo_show_text
dup 70.0 165.0 cairo_move_to
dup "World" cairo_text_path
dup 0.5 0.5 1 cairo_set_source_rgb
dup cairo_fill_preserve
dup 0 0 0 cairo_set_source_rgb
dup 2.56 cairo_set_line_width
dup cairo_stroke
dup 1 0.2 0.2 0.6 cairo_set_source_rgba
dup 10.0 135.0 5.12 0 pi 2 * cairo_arc
dup cairo_close_path
dup 70.0 165.0 5.12 0 pi 2 * cairo_arc
cairo_fill ;
cairo-t>> [ no-cairo-t ] unless*
{
[
"Sans" CAIRO_FONT_SLANT_NORMAL CAIRO_FONT_WEIGHT_BOLD
cairo_select_font_face
]
[ 90.0 cairo_set_font_size ]
[ 10.0 135.0 cairo_move_to ]
[ "Hello" cairo_show_text ]
[ 70.0 165.0 cairo_move_to ]
[ "World" cairo_text_path ]
[ 0.5 0.5 1 cairo_set_source_rgb ]
[ cairo_fill_preserve ]
[ 0 0 0 cairo_set_source_rgb ]
[ 2.56 cairo_set_line_width ]
[ cairo_stroke ]
[ 1 0.2 0.2 0.6 cairo_set_source_rgba ]
[ 10.0 135.0 5.12 0 pi 2 * cairo_arc ]
[ cairo_close_path ]
[ 70.0 165.0 5.12 0 pi 2 * cairo_arc ]
[ cairo_fill ]
} cleave ;
PRIVATE>
M: cairo-demo-gadget graft* ( gadget -- )
dup dup init-cairo swap (>>cairo-t) draw-hello-world ;
dup dup init-cairo swap (>>cairo-t) draw-hello-world ;
M: cairo-demo-gadget ungraft* ( gadget -- )
cairo-t>> cairo_destroy ;
cairo-t>> cairo_destroy ;
: <cairo-demo-gadget> ( -- gadget )
cairo-demo-gadget new-gadget ;
cairo-demo-gadget new-gadget ;
: run ( -- )
[
[
<cairo-demo-gadget> "Hello World from Factor!" open-window
] with-ui ;
] with-ui ;
MAIN: run