[cairo-commit] cairo-demo/cairo_snippets cairo_snippets_html.c, NONE, 1.1 footer.html, NONE, 1.1 header.html, NONE, 1.1 ChangeLog, 1.7, 1.8 Makefile, 1.5, 1.6 README, 1.1, 1.2 cairo_snippets_png.c, 1.3, 1.4

OEyvind Kolaas commit at pdx.freedesktop.org
Tue May 18 14:55:00 PDT 2004


Committed by: pippin

Update of /cvs/cairo/cairo-demo/cairo_snippets
In directory pdx:/tmp/cvs-serv14491

Modified Files:
	ChangeLog Makefile README cairo_snippets_png.c 
Added Files:
	cairo_snippets_html.c footer.html header.html 
Log Message:
seperated the html generation from cairo_snippets_png


--- NEW FILE: cairo_snippets_html.c ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: footer.html ---
    </div><p />
    <a name='PageBottom'></a>
    <center>
            <a href='http://cairographics.org/cairo/glider-blue.svg'
                    ><img border='0' src='http://cairographics.org/cairo/glider-blue.png'>
            </a>
    </center>
</html>

--- NEW FILE: header.html ---
<html>
        <head><title>cairo: snippets</title>
                <style type='text/css'>
     @import url(http://cairographics.org/styles.css);
  </style>
  <body>
    <a name='PageTop'></a>
    <div id='main'>
      <div id='logo'><a href='http://cairographics.org/'><img border='0' src='http://cairographics.org/cairo/cairo_banner.png' alt='cairographics.org'/></a></div>

      <h1>cairo samples</h1>
    
      <p>This page contains cairo code snippets and the corresponding rendered output.
         The <em>user space</em> is the unit square ( (0,0) - (1, 1) ).
         The snippets are meant to be short, and easy to understand
      </p>
      
      <p>cairo_snippets is available as part of the <a
              href='http://cvs.cairographics.org/cairo-demo/cairo_snippets/'
              >cairo-demo module in cairo CVS</a>
      </p>
      
      <p>The snippet enviroment, and the original snippets were originally 
      created for a paper submitted to <a href='http://2004.guadec.org/'>GUADEC 2004</a>.
      </p>

Index: ChangeLog
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/ChangeLog,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** a/ChangeLog	18 May 2004 19:57:17 -0000	1.7
--- b/ChangeLog	18 May 2004 21:54:57 -0000	1.8
***************
*** 1,3 ****
--- 1,11 ----
  2004-05-18 OEyvind Kolaas <pippin at freedesktop.org>
+ 	* Makefile: general cleanup, added target html
+ 	* cairo_snippets_png.c: removed html stuff
+ 	* cairo_snippets_html.c: seperated out the html index generator
+ 	* header.html: header for the webpage
+ 	* footer.html: footer for the webpage
+ 	* README: added more information
+ 
+ 2004-05-18 OEyvind Kolaas <pippin at freedesktop.org>
  	* xxx_clipping.cairo xxx_image_clipping.cairo: removed
  	* clipping.cairo image_clipping.cairo: added

Index: Makefile
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/Makefile,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** a/Makefile	18 May 2004 15:21:30 -0000	1.5
--- b/Makefile	18 May 2004 21:54:57 -0000	1.6
***************
*** 1,2 ****
--- 1,8 ----
+ COMPILE_PROGS = cairo_snippets_gtk  \
+                 cairo_snippets_png  \
+ 				cairo_snippets_ps   \
+ 				cairo_snippets_html
+ #				cairo_snippets_pdf
+ 
  CFLAGS = `pkg-config --cflags cairo libpng libsvg-cairo`
  LIBS   = `pkg-config --libs   cairo libpng libsvg-cairo`
***************
*** 5,9 ****
  LIBS   += `pkg-config --libs gtkcairo`
  
! all: cairo_snippets_gtk cairo_snippets_png cairo_snippets_ps
  
  snippets.c: prepare_snippets *.cairo
--- 11,17 ----
  LIBS   += `pkg-config --libs gtkcairo`
  
! OBJS = png_io.o snippets.o
! 
! all:  $(COMPILE_PROGS)
  
  snippets.c: prepare_snippets *.cairo
***************
*** 11,29 ****
  
  clean:
! 	rm -f prepare_snippets cairo_snippets_png cairo_snippets_gtk cairo_snippets_pdf snippets.html snippets.c *.png *.o *~
  
! cairo_snippets_ps: cairo_snippets_ps.o snippets.o png_io.o
! 	gcc $< snippets.o png_io.o -o $@ $(LIBS)
  
! cairo_snippets_pdf: cairo_snippets_pdf.o snippets.o png_io.o
! 	gcc $< snippets.o png_io.o -o $@ $(LIBS)
  
! cairo_snippets_png: cairo_snippets_png.o snippets.o png_io.o
! 	gcc $< snippets.o png_io.o -o $@ $(LIBS)
  
! cairo_snippets_gtk: cairo_snippets_gtk.o snippets.o png_io.o
! 	gcc $< snippets.o png_io.o -o $@ $(LIBS)
  
! scp: pngs
  	scp *.png freedesktop.org:/home/www/cairo/samples/
  	scp snippets.html freedesktop.org:/home/www/cairo/samples/index.html
--- 19,55 ----
  
  clean:
! 	rm -f prepare_snippets $(COMPILE_PROGS) snippets.c snippets.html *.png *.eps *.o *~
  
! cairo_snippets_html: cairo_snippets_html.o $(OBJS)
! 	$(CC) $< $(OBJS) -o $@ $(LIBS)
  
! cairo_snippets_ps: cairo_snippets_ps.o $(OBJS)
! 	$(CC) $< $(OBJS) -o $@ $(LIBS)
  
! cairo_snippets_pdf: cairo_snippets_pdf.o $(OBJS)
! 	$(CC) $< $(OBJS) -o $@ $(LIBS)
  
! cairo_snippets_png: cairo_snippets_png.o $(OBJS)
! 	$(CC) $< $(OBJS) -o $@ $(LIBS)
  
! cairo_snippets_gtk: cairo_snippets_gtk.o $(OBJS)
! 	$(CC) $< $(OBJS) -o $@ $(LIBS)
! 
! snippets.ps: cairo_snippets_ps
! 	./cairo_snippets_ps
! 
! snippets.pdf: cairo_snippets_pdf
! 	./cairo_snippets_pdf
! 
! ## webpage at http://cairographics.org/samples/
! 
! all_tests: html snippets.ps
! 
! html: pngs snippets.html
! 
! snippets.html: cairo_snippets_html
! 	./cairo_snippets_html
! 
! scp: html
  	scp *.png freedesktop.org:/home/www/cairo/samples/
  	scp snippets.html freedesktop.org:/home/www/cairo/samples/index.html
***************
*** 31,34 ****
--- 57,63 ----
  pngs: cairo_snippets_png
  	./cairo_snippets_png
+ 
+ ## for compiling eps' includeable from LaTeX
+ 
  epss: pngs
  	for a in *.png; do \

Index: README
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/README,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** a/README	16 May 2004 19:09:50 -0000	1.1
--- b/README	18 May 2004 21:54:57 -0000	1.2
***************
*** 1,4 ****
  cairo_snippets is a collection of code for testing, and demonstrating
! the cairo rendering API.
  
  prepare_snippets - is a program used during the build process, it creates
--- 1,5 ----
  cairo_snippets is a collection of code for testing, and demonstrating
! the cairo rendering API. Examine the Makefile for additional hints about
! usage.
  
  prepare_snippets - is a program used during the build process, it creates
***************
*** 8,14 ****
      the snippet collection.
  
! cairo_snippets_png - processes all contained snippets, writing a png file
!     for each, in addition to a snippets.html index which simultanously displays
!     all snippets contained.
  
  cairo_snippets_gtk - a gui displaying a list of snippets, the source for the
--- 9,17 ----
      the snippet collection.
  
! cairo_snippets_png - writes a png file for each snippet
! 
! cairo_snippets_html - creates snippets.html, an index of the png's this is
!     the page located at http://cairographics.org/samples/ , the header and
!     footer of the page is read from header.html and footer.html
  
  cairo_snippets_gtk - a gui displaying a list of snippets, the source for the
***************
*** 18,25 ****
      will use the glitz backend instead
  
  *.cairo - are the actual snippets, adding a new snippet requires you to add the
      snippet, and recompile, the Makefile should figure out that things have
      changed.
- 
- 
- 
--- 21,28 ----
      will use the glitz backend instead
  
+ cairo_snippets_ps  - makes a multipage ps document from all snippets
+ cairo_snippets_pdf - makes a multipage pdf document from all snippets
+ 
  *.cairo - are the actual snippets, adding a new snippet requires you to add the
      snippet, and recompile, the Makefile should figure out that things have
      changed.

Index: cairo_snippets_png.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/cairo_snippets_png.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** a/cairo_snippets_png.c	18 May 2004 15:06:14 -0000	1.3
--- b/cairo_snippets_png.c	18 May 2004 21:54:57 -0000	1.4
***************
*** 1,3 ****
! /* png/html frontend for cairo_snippets
   * (c) Øyvind Kolås 2004, placed in the public domain
   */
--- 1,3 ----
! /* png frontend for cairo_snippets
   * (c) Øyvind Kolås 2004, placed in the public domain
   */
***************
*** 14,21 ****
  snippet_do_png (int no);
  
- /* write an snippets.html file, containing inline images, and source code */
- int
- write_html (void);
- 
  int
  main (void)
--- 14,17 ----
***************
*** 25,29 ****
          for (i=0;i<snippet_count;i++)
               snippet_do_png (i);
-         write_html ();
  
          return 0;
--- 21,24 ----
***************
*** 70,165 ****
          fclose (file);
  }
- 
- static char *html_header=
- "<html>\n"
- "<head><title>cairo: snippets</title>\n"
- "  <style type='text/css'>\n"
- "    @import url(http://cairographics.org/styles.css);\n"
- "  </style>\n"
- "  <body>\n"
- "<a name='PageTop'></a>\n"
- "<div id='main'>\n"
- 
- "<div id='logo'><a href='http://cairographics.org/'><img border='0' src='http://cairographics.org/cairo/cairo_banner.png' alt='cairographics.org'/></a></div>\n"
- 
- "<h1>cairo samples</h1>"
- "<p>This page contains cairo code snippets and the corresponding rendered output.\n"
- "The <em>user space</em> is the unit square ( (0,0) - (1, 1) ).\n"
- "The snippets are meant to be short, and easy to understand</p>\n"
- "<p>cairo_snippets is available as part of the <a href='http://cvs.cairographics.org/cairo-demo/cairo_snippets/'>cairo-demo module in cairo CVS</a></p>\n"
- "<p>The snippet enviroment, and the original snippets were originally "
- "created for a paper submitted to <a href='http://2004.guadec.org/'>GUADEC 2004</a>.</p>";
- 
- static char *html_footer="    </table>\n"
-                    "  </div><p />\n"
-                    "<a name='PageBottom'></a>\n"
-                    "<center>\n"
-                    "<a href='http://cairographics.org/cairo/glider-blue.svg'><img border='0' src='http://cairographics.org/cairo/glider-blue.png'></a>\n"
- "</center>\n"
-                    "<html>\n";
- 
- int
- write_html(void)
- {
-     int i=0;
-     FILE *file= fopen ("snippets.html", "w");
- 
-     fprintf (stdout, "writing snippets.html");
- 
-     fprintf (file, html_header);
-     fprintf (file, "<ul>\n");
- 
-     for (i=0;i<snippet_count;i++)
-         fprintf (file, "<li><a href='#%s'>%s</a></li>\n",
-                         snippet_name[i], snippet_name[i]);
- 
-     fprintf (file, "</ul>\n");
-     fprintf (file, "<table>\n");
- 
-     for (i=0;i<snippet_count;i++) {
-             const char *name=snippet_name[i];
-             char imgname[40];
-             FILE *srcfile;
-             int  size;
-             const char *c=&snippet_source[i][0];
-             sprintf (imgname, "%s.png", name);
- 
-             fprintf (file, "    <tr>\n");
-             fprintf (file, "       <td colspan='2'>\n");
-             fprintf (file, "         <h2><a href='#%s'><b>%s</b></a><a name='%s'></a></h2>\n", name,name,name);
-             fprintf (file, "       </td>\n");
-             fprintf (file, "    <tr>\n");
-             fprintf (file, "    <tr>\n");
-             fprintf (file, "       <td><pre>\n");
- 
-             while (*c){
-                     switch (*c){
-                         case '<':
-                             fprintf (file, "&lt;");
-                             break;
-                         case '>':
-                             fprintf (file, "&gt;");
-                             break;
-                         case '&':
-                             fprintf (file, "&amp;");
-                             break;
-                         default:
-                             fprintf (file, "%c", *c);
-                     }
-                     c++;
-             }
- 
-             fprintf (file, "       </pre></td>\n");
-             fprintf (file, "       <td>\n");
-             fprintf (file, "         <img src='%s'/>\n", imgname);
-             fprintf (file, "       </td>\n");
-             fprintf (file, "    </tr>\n");
-             fprintf (file, "    <tr><td>&nbsp;</td></tr>\n");
-     }
-     fprintf (file, html_footer);
-    fclose (file);
- 
-    fprintf (stdout, "\n");
- }
- 
- 
--- 65,66 ----





More information about the cairo-commit mailing list