[Commit] nickle Makefile.am,1.57,1.58 svg.5c,NONE,1.1

Bart Massey commit at keithp.com
Wed Jun 23 02:00:48 PDT 2004


Committed by: bart

Update of /local/src/CVS/nickle
In directory home.keithp.com:/tmp/cvs-serv7423

Modified Files:
	Makefile.am 
Added Files:
	svg.5c 
Log Message:
Added rudimentary SVG output namespace.
Added example: Floyd-Warshall all-pairs shortest-path algorithm.
Added example: program illustrating both of above.



Index: Makefile.am
===================================================================
RCS file: /local/src/CVS/nickle/Makefile.am,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- Makefile.am	18 Jun 2004 00:30:32 -0000	1.57
+++ Makefile.am	23 Jun 2004 09:00:45 -0000	1.58
@@ -12,7 +12,7 @@
 NICKLEFILES = builtin.5c math.5c scanf.5c mutex.5c \
 	arc4.5c prng.5c command.5c abort.5c \
         printf.5c history.5c ctype.5c string.5c socket.5c \
-	file.5c parse-args.5c
+	file.5c parse-args.5c svg.5c
 
 DEBIAN = debian/nickle.install debian/changelog debian/compat \
 	 debian/control debian/copyright debian/rules

--- NEW FILE: svg.5c ---
/*
 * SVG XML graphics output
 *  ala http://www.w3schools.com/svg/svg_intro.asp
 * Bart Massey 2004/06
 */

import File;

namespace SVG {
    public void start(file f, int width, int height) {
	fprintf(f,
		"<?xml version=\"1.0\" standalone=\"no\"?>\n" +
		"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n" +
		" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n" +
		"<svg xml:space=\"preserve\" " +
		"width=\"%d\" height=\"%d\" x=\"0\" y=\"0\">\n",
		width, height);
    }

    public void spot(file f, string color, int x, int y, int r) {
	fprintf(f, "<circle cx=\"%d\" cy=\"%d\" r=\"%d\" " +
		"stroke=\"black\" fill=\"%s\" stroke-width=\"2\"/>\n",
		x, y, r, color);
    }

    public void segment(file f, string color, int x1, int y1, int x2, int y2) {
	fprintf(f, "<line x1=\"%d\" y1=\"%d\" x2=\"%d\" y2=\"%d\" " +
		"stroke=\"%s\" stroke-width=\"2\"/>\n",
		x1, y1, x2, y2, color);
    }

    public void stop(file f) {
	fprintf(f, "</svg>\n");
    }
}




More information about the Commit mailing list