From 06ca07d3814af6c0e79812fa933c5d97942271ff Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Fri, 22 May 2009 13:22:57 +0000 Subject: [PATCH] Fix import/export related stuff I forgot to update in the Ruby and PHP bindings. --- caca-php/php_caca.c | 8 ++++---- ruby/ruby-caca.dox | 8 ++++---- ruby/t/tc_canvas.rb | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/caca-php/php_caca.c b/caca-php/php_caca.c index 07ca292..0153112 100644 --- a/caca-php/php_caca.c +++ b/caca-php/php_caca.c @@ -1550,7 +1550,7 @@ PHP_FUNCTION(caca_file_read) { } caca_file_read(file, buffer, len); - RETURN_STRINGL(buffer, len, 1cac); + RETURN_STRINGL(buffer, len, 1); } PHP_FUNCTION(caca_file_write) { @@ -1608,7 +1608,7 @@ PHP_FUNCTION(caca_import_string) { caca_canvas_t *canvas; ZEND_FETCH_RESOURCE(canvas, caca_canvas_t*, &_zval, -1, PHP_CACA_CANVAS_RES_NAME, le_caca_canvas); - RETURN_LONG(caca_import_memory(canvas, src, src_len, format)); + RETURN_LONG(caca_import_canvas_from_memory(canvas, src, src_len, format)); } PHP_FUNCTION(caca_import_file) { @@ -1621,7 +1621,7 @@ PHP_FUNCTION(caca_import_file) { caca_canvas_t *canvas; ZEND_FETCH_RESOURCE(canvas, caca_canvas_t*, &_zval, -1, PHP_CACA_CANVAS_RES_NAME, le_caca_canvas); - RETURN_LONG(caca_import_file(canvas, filename, format)); + RETURN_LONG(caca_import_canvas_from_file(canvas, filename, format)); } PHP_FUNCTION(caca_get_import_list) { @@ -1647,7 +1647,7 @@ PHP_FUNCTION(caca_export_string) { void *buffer; size_t len = 0; - buffer = caca_export_memory(canvas, type, &len); + buffer = caca_export_canvas_to_memory(canvas, type, &len); if (!buffer) { RETURN_FALSE; } diff --git a/ruby/ruby-caca.dox b/ruby/ruby-caca.dox index 34d0153..7465995 100644 --- a/ruby/ruby-caca.dox +++ b/ruby/ruby-caca.dox @@ -56,11 +56,11 @@ irb(main):012:0>Caca::Canvas.my_instance_methods "dither_bitmap","draw_box", "draw_circle", "draw_cp437_box", "draw_ellipse", "draw_line","draw_polyline", "draw_thin_box", "draw_thin_ellipse", "draw_thin_line","draw_thin_polyline", "draw_thin_triangle", -"draw_triangle","export_memory", "fill_box", "fill_ellipse", +"draw_triangle","export_to_memory", "fill_box", "fill_ellipse", "fill_triangle","flip", "flop", "frame=", "frame_count", "frame_name", "frame_name=","free_frame", "get_attr", "get_char", "gotoxy", "handle_x","handle_y", "height", "height=", "import_file", -"import_memory","invert", "printf", "put_attr", "put_char", "put_str", +"import_from_memory","invert", "printf", "put_attr", "put_char", "put_str", "rotate_180","rotate_left", "rotate_right", "set_attr", "set_boundaries","set_color_ansi", "set_color_argb", "set_frame", "set_frame_name","set_handle", "set_height", "set_size", "set_width", @@ -122,7 +122,7 @@ irb(main):015:0>Caca::Event::Resize.my_instance_methods \code $ruby -rcaca -e 'c=Caca::Canvas.new(6, 3).fill_box(0,0,2,2,"#"[0]); c2=Caca::Canvas.new(1,1).put_str(0,0,"x"); c.blit(1,1,c2); puts -c.export_memory("irc")' +c.export_to_memory("irc")' ### #x# ### @@ -130,7 +130,7 @@ c.export_memory("irc")' \code $ruby -e 'puts Caca::Canvas.new(6,3).draw_thin_polyline([[0,0], [0,2], -[5,2],[0,0]]).export_memory("irc")' +[5,2],[0,0]]).export_to_memory("irc")' -. | `. ----`- diff --git a/ruby/t/tc_canvas.rb b/ruby/t/tc_canvas.rb index 3f222ba..56aab11 100644 --- a/ruby/t/tc_canvas.rb +++ b/ruby/t/tc_canvas.rb @@ -26,8 +26,8 @@ class TC_Canvas < Test::Unit::TestCase assert(@c.width == 100 && @c.height == 100, 'Failed to set size') end def test_import - @c.import_memory("foo", "") - assert_equal("foo\r\n", @c.export_memory("irc"), "Import/Export failed") + @c.import_from_memory("foo", "") + assert_equal("foo\r\n", @c.export_to_memory("irc"), "Import/Export failed") end def test_cursor @c.gotoxy(1,1) @@ -37,7 +37,7 @@ class TC_Canvas < Test::Unit::TestCase def test_clear @c.put_char(1, 1, 64) @c.clear - assert_equal("", @c.export_memory("irc").strip, "Failed to clear canvas") + assert_equal("", @c.export_to_memory("irc").strip, "Failed to clear canvas") end def test_char @c.put_char(1, 1, 42)