[cairo-commit] boilerplate/make-cairo-boilerplate-constructors.c boilerplate/Makefile.am doc/public test/make-cairo-test-constructors.c test/Makefile.am util/cairo-script
Chris Wilson
ickle at kemper.freedesktop.org
Wed Jul 15 05:28:12 PDT 2009
boilerplate/Makefile.am | 10 +-
boilerplate/make-cairo-boilerplate-constructors.c | 19 +++--
doc/public/tmpl/cairo-surface.sgml | 2
doc/public/tmpl/cairo.sgml | 15 ++++
test/Makefile.am | 9 +-
test/make-cairo-test-constructors.c | 13 ++-
util/cairo-script/csi-bind.c | 76 ++++++++++++++++++++++
7 files changed, 125 insertions(+), 19 deletions(-)
New commits:
commit 1caa34103925c53b180cd614f5c6b425b5a3f271
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed Jul 15 13:26:34 2009 +0100
Fix build under distcheck
Need to play a little dance to get the sources included and paths correct
whilst building source files with objdir != srcdir under distcheck.
diff --git a/boilerplate/Makefile.am b/boilerplate/Makefile.am
index 523453a..763f9a6 100644
--- a/boilerplate/Makefile.am
+++ b/boilerplate/Makefile.am
@@ -49,15 +49,15 @@ endif
libcairoboilerplate_la_LIBADD += $(CAIROBOILERPLATE_LIBS)
make-cairo-boilerplate-constructors$(EXEEXT): make-cairo-boilerplate-constructors.c
- $(CC) -o $@ make-cairo-boilerplate-constructors.c
+ $(CC) $^ -o $@
cairo-boilerplate-constructors.c: Makefile $(enabled_cairo_boilerplate_sources) make-cairo-boilerplate-constructors$(EXEEXT)
- (cd $(srcdir) && ./make-cairo-boilerplate-constructors$(EXEEXT) $(enabled_cairo_boilerplate_sources)) > $@
+ echo '(cd $(srcdir) && $(top_builddir)/boilerplate/make-cairo-boilerplate-constructors$(EXEEXT) $(enabled_cairo_boilerplate_sources)) > $@'
+ ./make-cairo-boilerplate-constructors$(EXEEXT) $(srcdir) $(enabled_cairo_boilerplate_sources) > $@
BUILT_SOURCES += cairo-boilerplate-constructors.c
-EXTRA_DIST += $(BUILT_SOURCES)
-CLEANFILES += $(BUILT_SOURCES)
-CLEANFILES += make-cairo-boilerplate-constructors
+EXTRA_DIST += $(BUILT_SOURCES) make-cairo-boilerplate-constructors.c
+CLEANFILES += $(BUILT_SOURCES) make-cairo-boilerplate-constructors
test: check
diff --git a/boilerplate/make-cairo-boilerplate-constructors.c b/boilerplate/make-cairo-boilerplate-constructors.c
index 3306866..b954492 100644
--- a/boilerplate/make-cairo-boilerplate-constructors.c
+++ b/boilerplate/make-cairo-boilerplate-constructors.c
@@ -33,6 +33,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#define NAME "make-cairo-boilerplate-constructors.c"
@@ -67,8 +68,8 @@ add_name (const char *name)
}
static int
-scan_file (const char *filename,
- FILE *fp)
+scan_file (const char *filename,
+ FILE *fp)
{
int line_num = 0;
char linebuf[1024];
@@ -116,16 +117,22 @@ scan_file (const char *filename,
int
main (int argc, char **argv)
{
+ char buf[PATH_MAX];
int i;
int fail = 0;
struct name *node;
- for (i=1; i<argc; i++) {
- FILE *fp = fopen (argv[i], "r");
- if (fp) {
+ for (i = 2; i < argc; i++) {
+ FILE *fp;
+
+ snprintf (buf, sizeof (buf), "%s/%s", argv[1], argv[i]);
+
+ fp = fopen (buf, "r");
+ if (fp != NULL) {
fail |= scan_file (argv[i], fp);
fclose (fp);
- }
+ } else
+ fail = 1;
}
if (fail)
exit(1);
diff --git a/doc/public/tmpl/cairo-surface.sgml b/doc/public/tmpl/cairo-surface.sgml
index f7df829..00d5eff 100644
--- a/doc/public/tmpl/cairo-surface.sgml
+++ b/doc/public/tmpl/cairo-surface.sgml
@@ -215,6 +215,8 @@ The Portable Network Graphics image file format (ISO/IEC 15948). Since 1.10
@CAIRO_SURFACE_TYPE_WIN32_PRINTING:
@CAIRO_SURFACE_TYPE_QUARTZ_IMAGE:
@CAIRO_SURFACE_TYPE_SCRIPT:
+ at CAIRO_SURFACE_TYPE_QT:
+ at CAIRO_SURFACE_TYPE_META:
<!-- ##### FUNCTION cairo_surface_get_type ##### -->
<para>
diff --git a/doc/public/tmpl/cairo.sgml b/doc/public/tmpl/cairo.sgml
index 6faef6c..31f9d4e 100644
--- a/doc/public/tmpl/cairo.sgml
+++ b/doc/public/tmpl/cairo.sgml
@@ -383,6 +383,21 @@ The cairo drawing context
@CAIRO_OPERATOR_XOR:
@CAIRO_OPERATOR_ADD:
@CAIRO_OPERATOR_SATURATE:
+ at CAIRO_OPERATOR_MULTIPLY:
+ at CAIRO_OPERATOR_SCREEN:
+ at CAIRO_OPERATOR_OVERLAY:
+ at CAIRO_OPERATOR_DARKEN:
+ at CAIRO_OPERATOR_LIGHTEN:
+ at CAIRO_OPERATOR_COLOR_DODGE:
+ at CAIRO_OPERATOR_COLOR_BURN:
+ at CAIRO_OPERATOR_HARD_LIGHT:
+ at CAIRO_OPERATOR_SOFT_LIGHT:
+ at CAIRO_OPERATOR_DIFFERENCE:
+ at CAIRO_OPERATOR_EXCLUSION:
+ at CAIRO_OPERATOR_HSL_HUE:
+ at CAIRO_OPERATOR_HSL_SATURATION:
+ at CAIRO_OPERATOR_HSL_COLOR:
+ at CAIRO_OPERATOR_HSL_LUMINOSITY:
<!-- ##### FUNCTION cairo_set_operator ##### -->
<para>
diff --git a/test/Makefile.am b/test/Makefile.am
index 3b5f895..887cd10 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -70,10 +70,10 @@ test_sources += $(test)
TESTS += cairo-test-suite$(EXEEXT)
make-cairo-test-constructors$(EXEEXT): make-cairo-test-constructors.c
- $(CC) -o $@ make-cairo-test-constructors.c
+ $(CC) $^ -o $@
cairo-test-constructors.c: Makefile $(test_sources) make-cairo-test-constructors$(EXEEXT)
- (cd $(srcdir) && ./make-cairo-test-constructors$(EXEEXT) $(test_sources)) > $@
+ ./make-cairo-test-constructors$(EXEEXT) $(srcdir) $(test_sources) > $@
cairo_test_suite_SOURCES = \
$(cairo_test_suite_sources) \
@@ -121,9 +121,8 @@ cairo_test_trace_DEPENDENCIES = \
endif
BUILT_SOURCES += cairo-test-constructors.c
-EXTRA_DIST += $(BUILT_SOURCES) $(noinst_SCRIPTS) COPYING
-CLEANFILES += $(BUILT_SOURCES)
-CLEANFILES += make-cairo-test-constructors
+EXTRA_DIST += $(BUILT_SOURCES) $(noinst_SCRIPTS) COPYING make-cairo-test-constructors.c
+CLEANFILES += $(BUILT_SOURCES) make-cairo-test-constructors
# All tests which have a reference image go here.
REFERENCE_IMAGES = \
diff --git a/test/make-cairo-test-constructors.c b/test/make-cairo-test-constructors.c
index e19de37..15c6470 100644
--- a/test/make-cairo-test-constructors.c
+++ b/test/make-cairo-test-constructors.c
@@ -32,6 +32,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#define NAME "make-cairo-test-constructors.c"
@@ -115,16 +116,22 @@ scan_file (const char *filename,
int
main (int argc, char **argv)
{
+ char buf[PATH_MAX];
int i;
int fail = 0;
struct name *node;
- for (i=1; i<argc; i++) {
- FILE *fp = fopen (argv[i], "r");
+ for (i = 2; i < argc; i++) {
+ FILE *fp;
+
+ snprintf (buf, sizeof (buf), "%s/%s", argv[1], argv[i]);
+
+ fp = fopen (buf, "r");
if (fp) {
fail |= scan_file (argv[i], fp);
fclose (fp);
- }
+ } else
+ fail = 1;
}
if (fail)
exit(1);
diff --git a/util/cairo-script/csi-bind.c b/util/cairo-script/csi-bind.c
new file mode 100644
index 0000000..91b58fb
--- /dev/null
+++ b/util/cairo-script/csi-bind.c
@@ -0,0 +1,76 @@
+#include <cairo.h>
+#include <cairo-script-interpreter.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+static cairo_status_t
+write_func (void *closure,
+ const unsigned char *data,
+ unsigned int length)
+{
+ if (fwrite (data, length, 1, closure) != 1)
+ return CAIRO_STATUS_WRITE_ERROR;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+int
+main (int argc, char **argv)
+{
+ FILE *in = stdin, *out = stdout;
+ cairo_status_t status;
+ int i;
+
+ if (argc >= 3) {
+ if (strcmp (argv[argc-1], "-")) {
+ out = fopen (argv[argc-1], "w");
+ if (out == NULL) {
+ fprintf (stderr, "Failed to open output '%s'\n", argv[argc-1]);
+ return 1;
+ }
+ }
+ }
+
+ if (argc > 2) {
+ for (i = 1; i < argc - 1; i++) {
+ in = fopen (argv[i], "r");
+ if (in == NULL) {
+ fprintf (stderr, "Failed to open input '%s'\n", argv[i]);
+ return 1;
+ }
+
+ status = cairo_script_interpreter_translate_stream (in, write_func, out);
+ fclose (in);
+
+ if (status)
+ break;
+ }
+ } else {
+ if (argc > 1) {
+ if (strcmp (argv[1], "-")) {
+ in = fopen (argv[1], "r");
+ if (in == NULL) {
+ fprintf (stderr, "Failed to open input '%s'\n", argv[1]);
+ return 1;
+ }
+ }
+ }
+
+ status = cairo_script_interpreter_translate_stream (in, write_func, out);
+
+ if (in != stdin)
+ fclose (in);
+ }
+
+ if (out != stdout)
+ fclose (out);
+
+ if (status) {
+ fprintf (stderr, "Translation failed: %s\n",
+ cairo_status_to_string (status));
+ return status;
+ }
+
+ return status;
+}
More information about the cairo-commit
mailing list