diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/cairo-script/cairo-script-interpreter.c | 22 | ||||
-rw-r--r-- | util/cairo-script/cairo-script-interpreter.h | 4 |
2 files changed, 26 insertions, 0 deletions
diff --git a/util/cairo-script/cairo-script-interpreter.c b/util/cairo-script/cairo-script-interpreter.c index 44c33f32..adb10952 100644 --- a/util/cairo-script/cairo-script-interpreter.c +++ b/util/cairo-script/cairo-script-interpreter.c @@ -565,6 +565,28 @@ cairo_script_interpreter_run (csi_t *ctx, const char *filename) } cairo_status_t +cairo_script_interpreter_feed_stream (csi_t *ctx, FILE *stream) +{ + csi_object_t file; + + if (ctx->status) + return ctx->status; + if (ctx->finished) + return ctx->status = CSI_STATUS_INTERPRETER_FINISHED; + + ctx->status = csi_file_new_for_stream (ctx, &file, stream); + if (ctx->status) + return ctx->status; + + file.type |= CSI_OBJECT_ATTR_EXECUTABLE; + + ctx->status = csi_object_execute (ctx, &file); + csi_object_free (ctx, &file); + + return ctx->status; +} + +cairo_status_t cairo_script_interpreter_feed_string (csi_t *ctx, const char *line, int len) { csi_object_t file; diff --git a/util/cairo-script/cairo-script-interpreter.h b/util/cairo-script/cairo-script-interpreter.h index b7950aa1..52e6b3a4 100644 --- a/util/cairo-script/cairo-script-interpreter.h +++ b/util/cairo-script/cairo-script-interpreter.h @@ -86,6 +86,10 @@ cairo_script_interpreter_run (cairo_script_interpreter_t *ctx, const char *filename); cairo_public cairo_status_t +cairo_script_interpreter_feed_stream (cairo_script_interpreter_t *ctx, + FILE *stream); + +cairo_public cairo_status_t cairo_script_interpreter_feed_string (cairo_script_interpreter_t *ctx, const char *line, int len); |