--- /dev/null
+CFLAGS = -Wall -g -O0
+
+test: inkpot_scheme.o inkpot_value.o inkpot_xlate.o test.o
+
+inkpot_scheme.o: inkpot_scheme.c inkpot_scheme.h inkpot.h inkpot_define.h \
+ inkpot_value.h inkpot_xlate.h inkpot_table.h
+
+inkpot_value.o: inkpot_value.c inkpot_value.h inkpot.h inkpot_define.h
+
+inkpot_xlate.o: inkpot_xlate.c inkpot_xlate.h inkpot.h
+
+test.o: test.c inkpot.h
+
+
+
+inkpot_scheme.c: ../inkpot_scheme.c
+ cp ../inkpot_scheme.c .
+
+inkpot_value.c: ../inkpot_value.c
+ cp ../inkpot_value.c .
+
+inkpot_xlate.c: ../inkpot_xlate.c
+ cp ../inkpot_xlate.c .
+
+inkpot_scheme.h: ../inkpot_scheme.h
+ cp ../inkpot_scheme.h .
+
+inkpot_value.h: ../inkpot_value.h
+ cp ../inkpot_value.h .
+
+inkpot_xlate.h: ../inkpot_xlate.h
+ cp ../inkpot_xlate.h .
+
+inkpot.h: ../inkpot.h
+ cp ../inkpot.h .
+
+
+
+clean:
+ rm -rf *.o test inkpot_xlate.h inkpot_value.h inkpot_scheme.h \
+ inkpot_xlate.c inkpot_value.c inkpot_scheme.c inkpot.h
--- /dev/null
+/* $Id$ $Revision$ */
+/* vim:set shiftwidth=4 ts=8: */
+
+/***********************************************************
+ * This software is part of the graphviz package *
+ * http://www.graphviz.org/ *
+ * *
+ * Copyright (c) 1994-2008 AT&T Corp. *
+ * and is licensed under the *
+ * Common Public License, Version 1.0 *
+ * by AT&T Corp. *
+ * *
+ * Information and Software Systems Research *
+ * AT&T Research, Florham Park NJ *
+ **********************************************************/
+
+typedef unsigned int IDX_STRINGS;
+#define SZT_STRINGS 79
+#define SZL_STRINGS 6
+
+typedef unsigned short MSK_SCHEMES_NAME;
+typedef unsigned char IDX_SCHEMES_NAME;
+#define SZT_SCHEMES_NAME 3
+
+typedef unsigned char IDX_SCHEMES_INDEX;
+#define SZT_SCHEMES_INDEX 2
+
+typedef unsigned int IDX_NAMES;
+#define SZT_NAMES 11
+
+typedef unsigned char IDX_NAME_ALTS;
+#define SZT_NAME_ALTS 2
+
+typedef unsigned int IDX_MRU_CACHE;
+#define SZT_MRU_CACHE 4
+
+typedef unsigned int IDX_IXVALUES;
+#define SZT_IXVALUES 7
+typedef unsigned int IDX_TONAMES;
+#define SZT_TONAMES 7
+
+typedef unsigned int IDX_VALUES;
+#define SZT_VALUES 7
+#define SZT_NONAME_VALUES 4
--- /dev/null
+/* $Id$ $Revision$ */
+/* vim:set shiftwidth=4 ts=8: */
+
+/***********************************************************
+ * This software is part of the graphviz package *
+ * http://www.graphviz.org/ *
+ * *
+ * Copyright (c) 1994-2008 AT&T Corp. *
+ * and is licensed under the *
+ * Common Public License, Version 1.0 *
+ * by AT&T Corp. *
+ * *
+ * Information and Software Systems Research *
+ * AT&T Research, Florham Park NJ *
+ **********************************************************/
+
+const char TAB_STRINGS[SZT_STRINGS] = {
+ "french\0"
+ "svg\0"
+ "x11\0"
+ "black\0"
+ "bleu\0"
+ "blue\0"
+ "green\0"
+ "jaune\0"
+ "red\0"
+ "rouge\0"
+ "vert\0"
+ "yellow\0"
+ "white\0"
+ "xxx\0"
+ "yyy\0"
+};
+
+inkpot_scheme_name_t TAB_SCHEMES_NAME[SZT_SCHEMES_NAME] = { /* schemes of named colors */
+ { 0, }, /* french */
+ { 7, }, /* svg */
+ { 11, }, /* x11 */
+};
+
+inkpot_scheme_index_t TAB_SCHEMES_INDEX[SZT_SCHEMES_INDEX] = { /* schemes of indexed colors */
+ { 71, 0, }, /* xxx */
+ { 75, 5, }, /* yyy */
+};
+
+inkpot_name_t TAB_NAMES[SZT_NAMES] = { /* Must be LC_ALL=C sort'ed by name with each alt */
+ { 15, 0, 0x6, /* black */ 0, /* black */ }, /* 0 */
+ { 21, 1, 0x1, /* bleu */ 1, /* bleu, blue */ }, /* 1 */
+ { 26, 1, 0x6, /* blue */ 2, }, /* 2 */
+ { 31, 2, 0x6, /* green */ 3, /* green, vert */ }, /* 3 */
+ { 37, 5, 0x1, /* jaune */ 7, }, /* 4 */
+ { 43, 3, 0x6, /* red */ 5, /* red, rouge */ }, /* 5 */
+ { 47, 3, 0x1, /* rouge */ 6, }, /* 6 */
+ { 53, 2, 0x1, /* vert */ 10, /* yellow(alt1) */ }, /* 7 */
+ { 65, 6, 0x6, /* white */ 4, /* jaune, yellow */ }, /* 8 */
+ { 58, 5, 0x4, /* yellow */ 9, }, /* 9 */
+/* alt1 */
+ { 58, 4, 0x2, /* yellow */ 8, /* white */ }, /* 10 */
+};
+
+IDX_NAMES TAB_NAME_ALTS[SZT_NAME_ALTS] = {
+ 0, 10,
+};
+
+IDX_TONAMES TAB_TONAMES[SZT_TONAMES] = {
+ 0, /* black */
+ 1, /* bleu, blue */
+ 3, /* green, vert */
+ 5, /* red, rouge */
+ 7, /* yellow (svg) */
+ 8, /* yellow (x11), jaune */
+ 10, /* white */
+};
+
+IDX_VALUES TAB_IXVALUES[SZT_IXVALUES] = {
+ 7, 8, 9, 10, 1, /* xxx */
+ 0, 6, /* yyy */
+};
+
+unsigned long TAB_VALUES[SZT_VALUES] = {
+ 0x000000000000ffff, /* black */
+ 0x00000000ffffffff, /* bleu, blue */
+ 0x0000ffff0000ffff, /* green, vert */
+ 0xffff00000000ffff, /* red, rouge */
+ 0xffffcf000000ffff, /* yellow (svg) */
+ 0xffffffff0000ffff, /* yellow (x11), jaune */
+ 0xffffffffffffffff, /* white */
+};
+
+unsigned long TAB_NONAME_VALUES[SZT_NONAME_VALUES] = {
+ 0x000000008000ffff,
+ 0x00000000a400ffff,
+ 0x00000000c800ffff,
+ 0x00000000ea00ffff,
+};
--- /dev/null
+/* $Id$ $Revision$ */
+/* vim:set shiftwidth=4 ts=8: */
+
+/***********************************************************
+ * This software is part of the graphviz package *
+ * http://www.graphviz.org/ *
+ * *
+ * Copyright (c) 1994-2008 AT&T Corp. *
+ * and is licensed under the *
+ * Common Public License, Version 1.0 *
+ * by AT&T Corp. *
+ * *
+ * Information and Software Systems Research *
+ * AT&T Research, Florham Park NJ *
+ **********************************************************/
+
+#include <stdio.h>
+#include <assert.h>
+
+#include "inkpot.h"
+
+int main (int argc, char *argv[])
+{
+ inkpot_t *inkpot;
+ inkpot_status_t rc;
+ char *color;
+ int i;
+ double rgba[4], hsva[4], cmyk[4];
+
+ inkpot = inkpot_init();
+ if (!inkpot) {
+ fprintf(stderr, "failure to initialize inkpot\n");
+ return 0;
+ }
+
+ if (argc < 2)
+ color = NULL;
+ else
+ color = argv[1];
+
+ if (argc < 3) {
+ rc = inkpot_translate(inkpot, "x11");
+ assert(rc == INKPOT_SUCCESS);
+ }
+ else {
+ rc = inkpot_translate(inkpot, argv[2]);
+ if (rc == INKPOT_SCHEME_UNKNOWN)
+ inkpot_debug_error(inkpot);
+ else
+ assert(rc == INKPOT_SUCCESS);
+ }
+
+ if (argc < 4) {
+ rc = inkpot_schemes(inkpot, "x11");
+ assert(rc == INKPOT_SUCCESS);
+ }
+ else {
+ for (i = 3; i < argc; i++) {
+ rc = inkpot_schemes(inkpot, argv[i]);
+ if (rc == INKPOT_SCHEME_UNKNOWN)
+ inkpot_debug_error(inkpot);
+ else
+ assert(rc == INKPOT_SUCCESS);
+ }
+ }
+
+ inkpot_debug_schemes(inkpot);
+
+#if 0
+ inkpot_debug_names(inkpot);
+
+ inkpot_debug_out_names(inkpot);
+
+ inkpot_debug_values(inkpot);
+#endif
+
+ fprintf(stdout, "%s ", color); /* ' ' after %s so it doesn't crash on NULL */
+ rc = inkpot_set(inkpot, color);
+ if (rc == INKPOT_COLOR_UNKNOWN)
+ fprintf(stdout, "(unknown)");
+ fprintf(stdout, "\n text: ");
+
+ rc = inkpot_write(inkpot);
+ if (rc == INKPOT_COLOR_NONAME || rc == INKPOT_NOPALETTE) {
+ fprintf(stdout, "#");
+ rc = inkpot_write_rgba8(inkpot);
+ }
+ assert (rc == INKPOT_SUCCESS);
+
+ rc = inkpot_get_rgba(inkpot, rgba);
+ assert (rc == INKPOT_SUCCESS);
+ fprintf(stdout, "\n rgba: %.3f,%.3f,%.3f,%.3f\n",
+ rgba[0], rgba[1], rgba[2], rgba[3]);
+
+ rc = inkpot_get_hsva(inkpot, hsva);
+ assert (rc == INKPOT_SUCCESS);
+ fprintf(stdout, " hsva: %.3f,%.3f,%.3f,%.3f\n",
+ hsva[0], hsva[1], hsva[2], hsva[3]);
+
+ rc = inkpot_get_cmyk(inkpot, cmyk);
+ assert (rc == INKPOT_SUCCESS);
+ fprintf(stdout, " cmyk: %.3f,%.3f,%.3f,%.3f\n",
+ cmyk[0], cmyk[1], cmyk[2], cmyk[3]);
+
+ inkpot_destroy(inkpot);
+ return 0;
+}