mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-02 20:08:08 +02:00
[script] Read from a FILE stream
For ease of implementing the interpreter inside a pipeline, add a method to execute a FILE *.
This commit is contained in:
parent
a9d997fecd
commit
fee647c985
2 changed files with 26 additions and 0 deletions
|
|
@ -564,6 +564,28 @@ cairo_script_interpreter_run (csi_t *ctx, const char *filename)
|
|||
return ctx->status;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -85,6 +85,10 @@ cairo_public cairo_status_t
|
|||
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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue