diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2016-05-18 15:44:39 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2016-05-20 14:31:08 +0200 |
commit | 36f41bc1ace9a986d9f021a777c6b9cfe6b62f9c (patch) | |
tree | a7e8e4b76a8f54f096f5a7b65153b0e5c16f799e | |
parent | 0528bc575875c579408ab90bb2c2e3af0750545d (diff) | |
download | mupdf-36f41bc1ace9a986d9f021a777c6b9cfe6b62f9c.tar.xz |
murun: Add Buffer#writeBuffer to allow for concatenating buffers.
-rw-r--r-- | docs/mutool/run.html | 2 | ||||
-rw-r--r-- | source/tools/murun.c | 12 |
2 files changed, 14 insertions, 0 deletions
diff --git a/docs/mutool/run.html b/docs/mutool/run.html index 23286f07..c9ab103e 100644 --- a/docs/mutool/run.html +++ b/docs/mutool/run.html @@ -109,6 +109,8 @@ only store bytes. <dd>Append arguments to the end of the buffer, separated by spaces, ending with a newline. <dt>Buffer#write(...) <dd>Append arguments to the end of the buffer, separated by spaces. +<dt>Buffer#writeBuffer(data) +<dd>Append the contents of the 'data' buffer to the end of the buffer. <dt>Buffer#save(fileName) <dd>Write the contents of the buffer to a file. </dl> diff --git a/source/tools/murun.c b/source/tools/murun.c index 0adb8bc0..b8a7d991 100644 --- a/source/tools/murun.c +++ b/source/tools/murun.c @@ -1497,6 +1497,17 @@ static void ffi_Buffer_writeLine(js_State *J) rethrow(J); } +static void ffi_Buffer_writeBuffer(js_State *J) +{ + fz_context *ctx = js_getcontext(J); + fz_buffer *buf = js_touserdata(J, 0, "fz_buffer"); + fz_buffer *cat = js_touserdata(J, 1, "fz_buffer"); + fz_try(ctx) + fz_append_buffer(ctx, buf, cat); + fz_catch(ctx) + rethrow(J); +} + static void ffi_Buffer_save(js_State *J) { fz_context *ctx = js_getcontext(J); @@ -3054,6 +3065,7 @@ int murun_main(int argc, char **argv) jsB_propfun(J, "Buffer.writeByte", ffi_Buffer_writeByte, 1); jsB_propfun(J, "Buffer.writeRune", ffi_Buffer_writeRune, 1); jsB_propfun(J, "Buffer.writeLine", ffi_Buffer_writeLine, 1); + jsB_propfun(J, "Buffer.writeBuffer", ffi_Buffer_writeBuffer, 1); jsB_propfun(J, "Buffer.write", ffi_Buffer_write, 1); jsB_propfun(J, "Buffer.save", ffi_Buffer_save, 1); } |