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 ; tools.test db.tester continuations ;
IN: db.errors.postgresql.tests IN: db.errors.postgresql.tests
postgresql-test-db [ [
[ "drop table foo;" sql-command ] ignore-errors [ "drop table foo;" sql-command ] ignore-errors
[ "drop table ship;" sql-command ] ignore-errors [ "drop table ship;" sql-command ] ignore-errors
@ -29,4 +29,4 @@ postgresql-test-db [
sql-syntax-error? sql-syntax-error?
] must-fail-with ] must-fail-with
] with-db ] test-postgresql

View File

@ -1,6 +1,6 @@
USING: definitions io.launcher kernel parser words sequences math USING: definitions io.launcher kernel parser words sequences math
math.parser namespaces editors make system combinators.short-circuit math.parser namespaces editors make system combinators.short-circuit
fry threads ; fry threads vocabs.loader ;
IN: editors.emacs IN: editors.emacs
SYMBOL: emacsclient-path SYMBOL: emacsclient-path
@ -22,3 +22,5 @@ M: object default-emacsclient ( -- path ) "emacsclient" ;
where first2 emacsclient ; where first2 emacsclient ;
[ emacsclient ] edit-hook set-global [ 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 IN: io.encodings
HELP: <encoder> 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." } ; { $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 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." } ; { $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" ARTICLE: "encodings-descriptors" "Encoding descriptors"

View File

@ -6,12 +6,12 @@
! http://cairographics.org/samples/text/ ! http://cairographics.org/samples/text/
USING: cairo.ffi math math.constants byte-arrays kernel ui ui.render USING: cairo.ffi math math.constants byte-arrays kernel ui
ui.gadgets opengl.gl accessors ; ui.render combinators ui.gadgets opengl.gl accessors
namespaces opengl ;
IN: cairo-demo IN: cairo-demo
: make-image-array ( -- array ) : make-image-array ( -- array )
384 256 4 * * <byte-array> ; 384 256 4 * * <byte-array> ;
@ -19,14 +19,15 @@ IN: cairo-demo
CAIRO_FORMAT_ARGB32 384 256 over 4 * CAIRO_FORMAT_ARGB32 384 256 over 4 *
cairo_image_surface_create_for_data ; cairo_image_surface_create_for_data ;
TUPLE: cairo-demo-gadget < gadget image-array cairo-t ; TUPLE: cairo-demo-gadget < gadget image-array cairo-t ;
M: cairo-demo-gadget draw-gadget* ( gadget -- ) M: cairo-demo-gadget draw-gadget* ( gadget -- )
origin get [
0 0 glRasterPos2i 0 0 glRasterPos2i
1.0 -1.0 glPixelZoom 1.0 -1.0 glPixelZoom
[ 384 256 GL_RGBA GL_UNSIGNED_BYTE ] dip [ 384 256 GL_RGBA GL_UNSIGNED_BYTE ] dip
image-array>> glDrawPixels ; image-array>> glDrawPixels
] with-translation ;
: create-surface ( gadget -- cairo_surface_t ) : create-surface ( gadget -- cairo_surface_t )
make-image-array [ swap (>>image-array) ] keep make-image-array [ swap (>>image-array) ] keep
@ -35,26 +36,37 @@ M: cairo-demo-gadget draw-gadget* ( gadget -- )
: init-cairo ( gadget -- cairo_t ) : 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 -- ) : draw-hello-world ( gadget -- )
cairo-t>> cairo-t>> [ no-cairo-t ] unless*
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 "Sans" CAIRO_FONT_SLANT_NORMAL CAIRO_FONT_WEIGHT_BOLD
dup "Hello" cairo_show_text cairo_select_font_face
dup 70.0 165.0 cairo_move_to ]
dup "World" cairo_text_path [ 90.0 cairo_set_font_size ]
dup 0.5 0.5 1 cairo_set_source_rgb [ 10.0 135.0 cairo_move_to ]
dup cairo_fill_preserve [ "Hello" cairo_show_text ]
dup 0 0 0 cairo_set_source_rgb [ 70.0 165.0 cairo_move_to ]
dup 2.56 cairo_set_line_width [ "World" cairo_text_path ]
dup cairo_stroke [ 0.5 0.5 1 cairo_set_source_rgb ]
dup 1 0.2 0.2 0.6 cairo_set_source_rgba [ cairo_fill_preserve ]
dup 10.0 135.0 5.12 0 pi 2 * cairo_arc [ 0 0 0 cairo_set_source_rgb ]
dup cairo_close_path [ 2.56 cairo_set_line_width ]
dup 70.0 165.0 5.12 0 pi 2 * cairo_arc [ cairo_stroke ]
cairo_fill ; [ 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 -- ) 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 ;