]> git.cworth.org Git - spritext/commitdiff
Rip out the libcgic stuff
authorCarl Worth <cworth@cworth.org>
Wed, 13 Feb 2008 18:07:25 +0000 (10:07 -0800)
committerCarl Worth <cworth@cworth.org>
Wed, 13 Feb 2008 18:07:25 +0000 (10:07 -0800)
We've got bigger bugs to fix before we turn this into a CGI
program.

Makefile
spritext.c

index 55cd6c8687c742de0f95976fb5cd0e6c47947805..9c7effc840d95860469ffeb5104ff6725c4a8344 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@ CFLAGS  += `freetype-config --cflags`
 LDFLAGS += `pkg-config cairo --libs`
 LDFLAGS += `freetype-config --libs`
 
-spritext: spritext.o -lcgic
+spritext: spritext.o
 
 clean:
        rm -f *.o spritext
index 0250fa90e1447003ed91c9f931e9ac82f858f709..ef7c9a2470608cabd2542061d25fa47de45fdfb4 100644 (file)
@@ -6,7 +6,6 @@
 #include <libgen.h>
 #include <cairo.h>
 #include <cairo-ft.h>
-#include <cgic.h>
 
 #ifndef CAIRO_HAS_PNG_FUNCTIONS
 #error This program requires cairo with PNG support
 #define TRUE (1==1)
 #define FALSE (!TRUE)
 
+#if USE_CGIC
 static cairo_status_t
 stdio_write (void *closure, const unsigned char *data, unsigned int length);
+#endif
 
 double
 get_max_width (cairo_t *cr, char *characters);
@@ -30,7 +31,7 @@ double
 get_max_height (cairo_t *cr, char *characters);
 
 int
-cgiMain ()
+main (void)
 {
     char outputJson = FALSE;
 
@@ -52,14 +53,17 @@ cgiMain ()
     int i;
 
     /* QueryString */
-    char fontname[20];
     int fontsize;
     char format[5];
     char fillcolor[20];
+
+#if USE_CGIG
+    char fontname[20];
     cgiFormStringNoNewlines("fontname", fontname, 20);
     cgiFormInteger("fontsize", &fontsize, 50);
     cgiFormStringNoNewlines("format", format, 5);
     cgiFormStringNoNewlines("fillcolor", fillcolor, 20);
+#endif
 
     int fillcolor_red;
     int fillcolor_green;
@@ -69,12 +73,14 @@ cgiMain ()
     if ( format[0] == 'j' && format[1] == 's' && format[2] == 'o' && format[3] == 'n' )
        outputJson = TRUE;
 
+#if USE_CGIC
     if (outputJson)
     {
        cgiHeaderContentType("application/json");
     } else {
        cgiHeaderContentType("image/png");
     }
+#endif
 
     int error;  
     FT_Library         library;
@@ -275,12 +281,15 @@ cairo_mask (cr, gradient);
 
 cairo_pattern_destroy (gradient);
 */
+
+#if USE_CGIC
     if (outputJson)
     {
        printf("}");
     } else {
        cairo_surface_write_to_png_stream (surface, stdio_write, cgiOut);
     }
+#endif
 
     cairo_destroy (cr);
 
@@ -289,6 +298,7 @@ cairo_pattern_destroy (gradient);
     return 0;
 }
 
+#if USE_CGIC
 static cairo_status_t
 stdio_write (void *closure, const unsigned char *data, unsigned int length)
 {
@@ -298,6 +308,7 @@ stdio_write (void *closure, const unsigned char *data, unsigned int length)
     else
        return CAIRO_STATUS_WRITE_ERROR;
 }
+#endif
 
 double
 get_max_width(cairo_t *cr, char *characters)