diff --git a/basis/db/errors/postgresql/postgresql-tests.factor b/basis/db/errors/postgresql/postgresql-tests.factor index 9dbebe0712..f6668031e5 100644 --- a/basis/db/errors/postgresql/postgresql-tests.factor +++ b/basis/db/errors/postgresql/postgresql-tests.factor @@ -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 diff --git a/basis/editors/emacs/emacs.factor b/basis/editors/emacs/emacs.factor index fa717a70fa..05b879770e 100644 --- a/basis/editors/emacs/emacs.factor +++ b/basis/editors/emacs/emacs.factor @@ -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 diff --git a/core/io/encodings/encodings-docs.factor b/core/io/encodings/encodings-docs.factor index 509757c68a..e13e05bf40 100644 --- a/core/io/encodings/encodings-docs.factor +++ b/core/io/encodings/encodings-docs.factor @@ -1,4 +1,4 @@ -USING: help.markup help.syntax io quotations ; +USING: help.markup help.syntax io quotations math ; IN: io.encodings HELP: @@ -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" diff --git a/extra/cairo-demo/cairo-demo.factor b/extra/cairo-demo/cairo-demo.factor index cec6702ce0..da744e1d53 100644 --- a/extra/cairo-demo/cairo-demo.factor +++ b/extra/cairo-demo/cairo-demo.factor @@ -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 * * ; + 384 256 4 * * ; : 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 ; + +> - 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 ; : ( -- gadget ) - cairo-demo-gadget new-gadget ; + cairo-demo-gadget new-gadget ; : run ( -- ) - [ + [ "Hello World from Factor!" open-window - ] with-ui ; + ] with-ui ; MAIN: run