diff --git a/ANNOUNCE b/ANNOUNCE index 2595f7a55..9ef41142a 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,10 +1,10 @@ -*** ANNOUNCE: SWIG 2.0.0 (in progress) *** +*** ANNOUNCE: SWIG 1.3.40 (in progress) *** http://www.swig.org -We're pleased to announce SWIG-2.0.0, the latest installment in the -SWIG development effort. SWIG-2.0.0 includes a number of bug fixes +We're pleased to announce SWIG-1.3.40, the latest installment in the +SWIG development effort. SWIG-1.3.40 includes a number of bug fixes and enhancements. What is SWIG? @@ -24,11 +24,11 @@ Availability: ------------- The release is available for download on Sourceforge at - http://prdownloads.sourceforge.net/swig/swig-2.0.0.tar.gz + http://prdownloads.sourceforge.net/swig/swig-1.3.40.tar.gz A Windows version is also available at - http://prdownloads.sourceforge.net/swig/swigwin-2.0.0.zip + http://prdownloads.sourceforge.net/swig/swigwin-1.3.40.zip Please report problems with this release to the swig-dev mailing list, details at http://www.swig.org/mail.html. diff --git a/COPYRIGHT b/COPYRIGHT deleted file mode 100644 index 45f9d6b45..000000000 --- a/COPYRIGHT +++ /dev/null @@ -1,63 +0,0 @@ -SWIG Copyright and Authors --------------------------- - -Copyright (c) 1995-2010 The SWIG Developers -Copyright (c) 2005-2006 Arizona Board of Regents (University of Arizona). -Copyright (c) 1998-2005 University of Chicago. -Copyright (c) 1995-1998 The University of Utah and the Regents of the University of California - -Portions also copyrighted by: - Network Applied Communication Laboratory, Inc - Information-technology Promotion Agency, Japan - -Active SWIG Developers: - William Fulton (wsf@fultondesigns.co.uk) (SWIG core, Java, C#, Windows, Cygwin) - Olly Betts (olly@survex.com) (PHP) - Joseph Wang (joequant@gmail.com) (R) - Xavier Delacour (xavier.delacour@gmail.com) (Octave) - -Past SWIG developers and major contributors include: - Dave Beazley (dave-swig@dabeaz.com) (SWIG core, Python, Tcl, Perl) - Henning Thielemann (swig@henning-thielemann.de) (Modula3) - Matthias Köppe (mkoeppe@mail.math.uni-magdeburg.de) (Guile, MzScheme) - Luigi Ballabio (luigi.ballabio@fastwebnet.it) (STL wrapping) - Mikel Bancroft (mikel@franz.com) (Allegro CL) - Surendra Singhi (efuzzyone@netscape.net) (CLISP, CFFI) - Marcelo Matus (mmatus@acms.arizona.edu) (SWIG core, Python, UTL[python,perl,tcl,ruby]) - Art Yerkes (ayerkes@speakeasy.net) (Ocaml) - Lyle Johnson (lyle@users.sourceforge.net) (Ruby) - Charlie Savage (cfis@interserv.com) (Ruby) - Thien-Thi Nguyen (ttn@glug.org) (build/test/misc) - Richard Palmer (richard@magicality.org) (PHP) - Sam Liddicott - Anonova Ltd (saml@liddicott.com) (PHP) - Tim Hockin - Sun Microsystems (thockin@sun.com) (PHP) - Kevin Ruland (PHP) - Shibukawa Yoshiki (Japanese Translation) - Jason Stewart (jason@openinformatics.com) (Perl5) - Loic Dachary (Perl5) - David Fletcher (Perl5) - Gary Holt (Perl5) - Masaki Fukushima (Ruby) - Scott Michel (scottm@cs.ucla.edu) (Java directors) - Tiger Feng (songyanf@cs.uchicago.edu) (SWIG core) - Mark Rose (mrose@stm.lbl.gov) (Directors) - Jonah Beckford (beckford@usermail.com) (CHICKEN) - Ahmon Dancy (dancy@franz.com) (Allegro CL) - Dirk Gerrits (Allegro CL) - Neil Cawse (C#) - Harco de Hilster (Java) - Alexey Dyachenko (dyachenko@fromru.com) (Tcl) - Bob Techentin (Tcl) - Martin Froehlich (Guile) - Marcio Luis Teixeira (Guile) - Duncan Temple Lang (R) - Miklos Vajna (PHP directors) - Mark Gossage (mark@gossage.cjb.net) (Lua) - Gonzalo Garramuno (ggarra@advancedsl.com.ar) (Ruby, Ruby's UTL) - John Lenz (Guile, MzScheme updates, Chicken module, runtime system) - -Past contributors include: - James Michael DuPont, Clark McGrew, Dustin Mitchell, Ian Cooke, Catalin Dumitrescu, Baran - Kovuk, Oleg Tolmatcev, Tal Shalif, Lluis Padro, Chris Seatory, Igor Bely, Robin Dunn - (See CHANGES and CHANGES.current for a more complete list). - diff --git a/Doc/Manual/Sections.html b/Doc/Manual/Sections.html index ab47ed8ee..789efc129 100644 --- a/Doc/Manual/Sections.html +++ b/Doc/Manual/Sections.html @@ -6,7 +6,7 @@

SWIG-1.3 Development Documentation

-Last update : SWIG-2.0.0 (in progress) +Last update : SWIG-1.3.40 (in progress)

Sections

diff --git a/Examples/GIFPlot/C/Makefile b/Examples/GIFPlot/C/Makefile new file mode 100644 index 000000000..f45d360cf --- /dev/null +++ b/Examples/GIFPlot/C/Makefile @@ -0,0 +1,17 @@ +TOP = ../.. +SWIG = $(TOP)/../preinst-swig +SWIGOPT = -I../Include +SRCS = +TARGET = gifplot +INTERFACE = gifplot.i +LIBS = -L.. -lgifplot +INCLUDES = -I../Include + +all:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' LIBS='$(LIBS)' \ + SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' c + +clean: + rm -f *.o *.out *.so *.a *.dll *.dylib *.exe *_wrap* *_proxy* *~ runme + +check: all diff --git a/Examples/GIFPlot/C/gifplot.i b/Examples/GIFPlot/C/gifplot.i new file mode 100644 index 000000000..356edd7f1 --- /dev/null +++ b/Examples/GIFPlot/C/gifplot.i @@ -0,0 +1,15 @@ +/* Oh what the heck, let's just grab the whole darn header file + and see what happens. */ + +%module gifplot +%{ + +/* Note: You still need this part because the %include directive + merely causes SWIG to interpret the contents of a file. It doesn't + include the right include headers for the resulting C code */ + +#include "../Include/gifplot.h" + +%} + +%include gifplot.h diff --git a/Examples/GIFPlot/Chicken/check.list b/Examples/GIFPlot/Chicken/check.list new file mode 100644 index 000000000..e75ee586a --- /dev/null +++ b/Examples/GIFPlot/Chicken/check.list @@ -0,0 +1,3 @@ +# see top-level Makefile.in +full +simple diff --git a/Examples/GIFPlot/Chicken/full/Makefile b/Examples/GIFPlot/Chicken/full/Makefile new file mode 100644 index 000000000..2ae4fd7ea --- /dev/null +++ b/Examples/GIFPlot/Chicken/full/Makefile @@ -0,0 +1,28 @@ +TOP = ../../.. +SWIG = $(TOP)/../preinst-swig +INTERFACE = gifplot.i +SRCS = +CXXSRCS = +TARGET = gifplot +INCLUDE = -I. -I../../Include +SWIGOPT = -I../../Include +CFLAGS = +VARIANT = +LIBS = -L../.. -lgifplot -lm + +# comment the following two lines to build a dynamic so file +CHICKEN_MAIN = test-gifplot.scm +VARIANT = _static + +all:: $(TARGET) + +$(TARGET): $(INTERFACE) $(SRCS) + $(MAKE) -f $(TOP)/Makefile \ + SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \ + INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='$(TARGET)' \ + SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT) + +clean:: + $(MAKE) -f $(TOP)/Makefile chicken_clean + rm -f gifplot.scm image.gif + rm -f $(TARGET) diff --git a/Examples/GIFPlot/Chicken/full/README b/Examples/GIFPlot/Chicken/full/README new file mode 100644 index 000000000..e5ddd7af1 --- /dev/null +++ b/Examples/GIFPlot/Chicken/full/README @@ -0,0 +1,6 @@ +This example runs the entire gifplot.h header file through SWIG without +any changes. The Scheme program 'test-gifplot.scm' does something a +little more interesting. You'll have to go look at the header file to +get a complete listing of the functions. + +`make' will build a static binary. Run ./gifplot to test it. diff --git a/Examples/GIFPlot/Chicken/full/cmap b/Examples/GIFPlot/Chicken/full/cmap new file mode 100644 index 000000000..a20c331a9 Binary files /dev/null and b/Examples/GIFPlot/Chicken/full/cmap differ diff --git a/Examples/GIFPlot/Chicken/full/gifplot.i b/Examples/GIFPlot/Chicken/full/gifplot.i new file mode 100644 index 000000000..f6741864a --- /dev/null +++ b/Examples/GIFPlot/Chicken/full/gifplot.i @@ -0,0 +1,26 @@ +/* Oh what the heck, let's just grab the whole darn header file + and see what happens. */ + +%module gifplot +%{ + +/* Note: You still need this part because the %include directive + merely causes SWIG to interpret the contents of a file. It doesn't + include the right include headers for the resulting C code */ + +#include "gifplot.h" + +%} + +/* Pixel is typedef'd to unsigned char, and SWIG will translate this + type into Scheme characters. We would like to translate Pixels to + Scheme integers instead, so: */ + +SIMPLE_TYPEMAP(Pixel, C_unfix, C_fix, C_swig_is_fixnum, (int), 0); + +%{ +static Pixel int_to_Pixel (int v) { return (Pixel) v; } +%} +extern Pixel int_to_Pixel (int v); + +%include gifplot.h diff --git a/Examples/GIFPlot/Chicken/full/test-gifplot.scm b/Examples/GIFPlot/Chicken/full/test-gifplot.scm new file mode 100644 index 000000000..c290af54d --- /dev/null +++ b/Examples/GIFPlot/Chicken/full/test-gifplot.scm @@ -0,0 +1,66 @@ +;;; Plot a 3D function + +(declare (uses gifplot)) + +;; Here is the function to plot +(define (func x y) + (* 5 + (cos (* 2 (sqrt (+ (* x x) (* y y))))) + (exp (* -0.3 (sqrt (+ (* x x) (* y y))))))) + +;; Here are some plotting parameters +(define xmin -5.0) +(define xmax 5.0) +(define ymin -5.0) +(define ymax 5.0) +(define zmin -5.0) +(define zmax 5.0) + +;; Grid resolution +(define nxpoints 60) +(define nypoints 60) + +(define cmap (gifplot:new-ColorMap "cmap")) +(define frame (gifplot:new-FrameBuffer 500 500)) +(gifplot:FrameBuffer-clear frame (gifplot:BLACK)) + +(define p3 (gifplot:new-Plot3D frame xmin ymin zmin xmax ymax zmax)) +(gifplot:Plot3D-lookat p3 (* 2 (- zmax zmin))) +(gifplot:Plot3D-autoperspective p3 40.0) +(gifplot:Plot3D-rotu p3 60.0) +(gifplot:Plot3D-rotr p3 30.0) +(gifplot:Plot3D-rotd p3 10.0) + +(define (drawsolid) + (gifplot:Plot3D-clear p3 (gifplot:BLACK)) + (gifplot:Plot3D-start p3) + (let ((dx (/ (- xmax xmin) nxpoints)) + (dy (/ (- ymax ymin) nypoints)) + (cscale (/ 240 (- zmax zmin)))) + (let x-loop ((x xmin) (i 0)) + (cond + ((< i nxpoints) + (let y-loop ((y ymin) (j 0)) + (cond + ((< j nypoints) + (let* ((z1 (func x y)) + (z2 (func (+ x dx) y)) + (z3 (func (+ x dx) (+ y dy))) + (z4 (func x (+ y dy))) + (c1 (* cscale (- z1 zmin))) + (c2 (* cscale (- z2 zmin))) + (c3 (* cscale (- z3 zmin))) + (c4 (* cscale (- z4 zmin))) + (cc (/ (+ c1 c2 c3 c4) 4)) + (c (inexact->exact (round (max (min cc 239) 0))))) + (gifplot:Plot3D-solidquad p3 x y z1 (+ x dx) y z2 (+ x dx) (+ y dy) + z3 x (+ y dy) z4 + (gifplot:int->Pixel (+ c 16)))) + (y-loop (+ y dy) (+ j 1))))) + (x-loop (+ x dx) (+ i 1))))))) + +(display "Making a nice 3D plot...\n") +(drawsolid) + +(gifplot:FrameBuffer-writeGIF frame cmap "image.gif") +(display "Wrote image.gif\n") diff --git a/Examples/GIFPlot/Chicken/simple/Makefile b/Examples/GIFPlot/Chicken/simple/Makefile new file mode 100644 index 000000000..484e58390 --- /dev/null +++ b/Examples/GIFPlot/Chicken/simple/Makefile @@ -0,0 +1,28 @@ +TOP = ../../.. +SWIG = $(TOP)/../preinst-swig +INTERFACE = simple.i +SRCS = +CXXSRCS = +TARGET = simple +INCLUDE = -I. -I../../Include +SWIGOPT = -I../../Include +CFLAGS = +VARIANT = +LIBS = -L../.. -lgifplot -lm + +# comment the following two lines to build a dynamic so file +CHICKEN_MAIN = test-simple.scm +VARIANT = _static + +all:: $(TARGET) + +$(TARGET): $(INTERFACE) $(SRCS) + $(MAKE) -f $(TOP)/Makefile \ + SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \ + INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='$(TARGET)' \ + SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT) + +clean:: + $(MAKE) -f $(TOP)/Makefile chicken_clean + rm -f simple.scm image.gif + rm -f $(TARGET) diff --git a/Examples/GIFPlot/Chicken/simple/README b/Examples/GIFPlot/Chicken/simple/README new file mode 100644 index 000000000..3b138f381 --- /dev/null +++ b/Examples/GIFPlot/Chicken/simple/README @@ -0,0 +1,5 @@ +This is a very minimalistic example in which just a few functions +and constants from library are wrapped and used to draw some simple +shapes. + +`make' will build an exe. Run ./simple to test it. diff --git a/Examples/GIFPlot/Chicken/simple/simple.i b/Examples/GIFPlot/Chicken/simple/simple.i new file mode 100644 index 000000000..23ac8a856 --- /dev/null +++ b/Examples/GIFPlot/Chicken/simple/simple.i @@ -0,0 +1,34 @@ +/* This example shows a very simple interface wrapping a few + primitive declarations */ + +%module simple +%{ +#include "gifplot.h" +%} + +typedef unsigned int Pixel; + +/* Here are a few useful functions */ + +ColorMap *new_ColorMap(char *filename = 0); +void delete_ColorMap(ColorMap *cmap); + +FrameBuffer *new_FrameBuffer(unsigned int width, unsigned int height); +void delete_FrameBuffer(FrameBuffer *frame); +void FrameBuffer_clear(FrameBuffer *frame, Pixel color); +void FrameBuffer_line(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); +void FrameBuffer_box(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); +void FrameBuffer_circle(FrameBuffer *frame, int x1, int y1, int radius, Pixel color); +int FrameBuffer_writeGIF(FrameBuffer *f, ColorMap *c, char *filename); + +/* And some useful constants, which we redefine (from gifplot.h) so + that SWIG sees them */ +#define BLACK 0 +#define WHITE 1 +#define RED 2 +#define GREEN 3 +#define BLUE 4 +#define YELLOW 5 +#define CYAN 6 +#define MAGENTA 7 + diff --git a/Examples/GIFPlot/Chicken/simple/test-simple.scm b/Examples/GIFPlot/Chicken/simple/test-simple.scm new file mode 100644 index 000000000..43250d8e9 --- /dev/null +++ b/Examples/GIFPlot/Chicken/simple/test-simple.scm @@ -0,0 +1,29 @@ +;;; Draw some simple shapes + +(declare (uses simple)) + +(display "Drawing some basic shapes\n") + +(define cmap (simple:new-ColorMap #f)) +(define f (simple:new-FrameBuffer 400 400)) + +;; Clear the picture +(simple:FrameBuffer-clear f (simple:BLACK)) + +;; Make a red box +(simple:FrameBuffer-box f 40 40 200 200 (simple:RED)) + +;; Make a blue circle +(simple:FrameBuffer-circle f 200 200 40 (simple:BLUE)) + +;; Make green line +(simple:FrameBuffer-line f 10 390 390 200 (simple:GREEN)) + +;; Write an image out to disk + +(simple:FrameBuffer-writeGIF f cmap "image.gif") +(display "Wrote image.gif\n") + +(simple:delete-FrameBuffer f) +(simple:delete-ColorMap cmap) + diff --git a/Examples/GIFPlot/Common-Lisp/full/cmap b/Examples/GIFPlot/Common-Lisp/full/cmap new file mode 100644 index 000000000..a20c331a9 Binary files /dev/null and b/Examples/GIFPlot/Common-Lisp/full/cmap differ diff --git a/Examples/GIFPlot/Common-Lisp/full/gifplot.i b/Examples/GIFPlot/Common-Lisp/full/gifplot.i new file mode 100644 index 000000000..e5c15aa2b --- /dev/null +++ b/Examples/GIFPlot/Common-Lisp/full/gifplot.i @@ -0,0 +1,21 @@ +/* Oh what the heck, let's just grab the whole darn header file + and see what happens. */ + +%module gifplot +%{ + +/* Note: You still need this part because the %include directive + merely causes SWIG to interpret the contents of a file. It doesn't + include the right include headers for the resulting C code */ + +#include "gifplot.h" + +%} + +/* Pixel is typedef'd to unsigned char, and SWIG will translate this + type into Scheme characters. We would like to translate Pixels to + Scheme integers instead, so: */ + +SIMPLE_MAP(Pixel, gh_scm2int, gh_int2scm, integer); + +%include gifplot.h diff --git a/Examples/GIFPlot/Common-Lisp/full/runme.lisp b/Examples/GIFPlot/Common-Lisp/full/runme.lisp new file mode 100644 index 000000000..48f804201 --- /dev/null +++ b/Examples/GIFPlot/Common-Lisp/full/runme.lisp @@ -0,0 +1,59 @@ +;;; Plot a 3D function + +;; Here is the function to plot +(defun func (x y) + (* 5 + (cos (* 2 (sqrt (+ (* x x) (* y y))))) + (exp (* -0.3 (sqrt (+ (* x x) (* y y))))))) + +;; Here are some plotting parameters +(defvar xmin -5D0) +(defvar xmax 5D0) +(defvar ymin -5D0) +(defvar ymax 5D0) +(defvar zmin -5D0) +(defvar zmax 5D0) + +;; Grid resolution +(defvar nxpoints 60) +(defvar nypoints 60) + +(defun drawsolid (p3) + (Plot3D-clear p3 0) + (Plot3D-start p3) + (let ((dx (/ (- xmax xmin) nxpoints)) + (dy (/ (- ymax ymin) nypoints)) + (cscale (/ 240 (- zmax zmin)))) + (loop for x from xmin by dx + repeat nxpoints + do (loop for y from ymin by dy + repeat nypoints + do (let* ((z1 (func x y)) + (z2 (func (+ x dx) y)) + (z3 (func (+ x dx) (+ y dy))) + (z4 (func x (+ y dy))) + (c1 (* cscale (- z1 zmin))) + (c2 (* cscale (- z2 zmin))) + (c3 (* cscale (- z3 zmin))) + (c4 (* cscale (- z4 zmin))) + (cc (/ (+ c1 c2 c3 c4) 4)) + (c (round (max (min cc 239) 0)))) + (Plot3D-solidquad p3 x y z1 (+ x dx) y z2 (+ x dx) (+ y dy) + z3 x (+ y dy) z4 (+ c 16))))))) + +(defun action (cmap-filename) + (let ((cmap (new-ColorMap cmap-filename)) + (frame (new-FrameBuffer 500 500))) + (format t "Making a nice 3D plot...~%") + (FrameBuffer-clear frame 0) + (let ((p3 (new-Plot3D frame xmin ymin zmin xmax ymax zmax))) + (Plot3D-lookat p3 (* 2 (- zmax zmin))) + (Plot3D-autoperspective p3 40D0) + (Plot3D-rotu p3 60D0) + (Plot3D-rotr p3 30D0) + (Plot3D-rotd p3 10D0) + (drawsolid p3)) + (FrameBuffer-writeGIF frame cmap "/tmp/image.gif") + (format t "Wrote image.gif~%"))) + + diff --git a/Examples/GIFPlot/Guile/check.list b/Examples/GIFPlot/Guile/check.list new file mode 100644 index 000000000..e75ee586a --- /dev/null +++ b/Examples/GIFPlot/Guile/check.list @@ -0,0 +1,3 @@ +# see top-level Makefile.in +full +simple diff --git a/Examples/GIFPlot/Guile/full/Makefile b/Examples/GIFPlot/Guile/full/Makefile new file mode 100644 index 000000000..1fcdf58d2 --- /dev/null +++ b/Examples/GIFPlot/Guile/full/Makefile @@ -0,0 +1,28 @@ +TOP = ../../.. +SWIG = $(TOP)/../swig +SWIGOPT = -I../../Include +SRCS = +TARGET = gifplot +INTERFACE = gifplot.i +LIBS = -L../.. -lgifplot -lm +INCLUDES = -I../../Include + +all:: static + +dynamic:: + $(MAKE) -f $(TOP)/Makefile TOP='$(TOP)' \ + SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile + +static:: + $(MAKE) -f $(TOP)/Makefile TOP='$(TOP)' \ + SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_static + +clean:: + $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_clean + rm -f *.gif + +check: all diff --git a/Examples/GIFPlot/Guile/full/README b/Examples/GIFPlot/Guile/full/README new file mode 100644 index 000000000..9780988d2 --- /dev/null +++ b/Examples/GIFPlot/Guile/full/README @@ -0,0 +1,8 @@ +This example runs the entire gifplot.h header file through SWIG without +any changes. The Scheme program 'runme.scm' does something a little more +interesting. You'll have to go look at the header file to get a complete +listing of the functions. + + + + diff --git a/Examples/GIFPlot/Guile/full/cmap b/Examples/GIFPlot/Guile/full/cmap new file mode 100644 index 000000000..a20c331a9 Binary files /dev/null and b/Examples/GIFPlot/Guile/full/cmap differ diff --git a/Examples/GIFPlot/Guile/full/gifplot.i b/Examples/GIFPlot/Guile/full/gifplot.i new file mode 100644 index 000000000..e5c15aa2b --- /dev/null +++ b/Examples/GIFPlot/Guile/full/gifplot.i @@ -0,0 +1,21 @@ +/* Oh what the heck, let's just grab the whole darn header file + and see what happens. */ + +%module gifplot +%{ + +/* Note: You still need this part because the %include directive + merely causes SWIG to interpret the contents of a file. It doesn't + include the right include headers for the resulting C code */ + +#include "gifplot.h" + +%} + +/* Pixel is typedef'd to unsigned char, and SWIG will translate this + type into Scheme characters. We would like to translate Pixels to + Scheme integers instead, so: */ + +SIMPLE_MAP(Pixel, gh_scm2int, gh_int2scm, integer); + +%include gifplot.h diff --git a/Examples/GIFPlot/Guile/full/runme.scm b/Examples/GIFPlot/Guile/full/runme.scm new file mode 100644 index 000000000..0ffe92167 --- /dev/null +++ b/Examples/GIFPlot/Guile/full/runme.scm @@ -0,0 +1,66 @@ +;;; Plot a 3D function + +;; Use the wrapped GIFPlot library +(use-modules (gifplot)) + +;; Here is the function to plot +(define (func x y) + (* 5 + (cos (* 2 (sqrt (+ (* x x) (* y y))))) + (exp (* -0.3 (sqrt (+ (* x x) (* y y))))))) + +;; Here are some plotting parameters +(define xmin -5.0) +(define xmax 5.0) +(define ymin -5.0) +(define ymax 5.0) +(define zmin -5.0) +(define zmax 5.0) + +;; Grid resolution +(define nxpoints 60) +(define nypoints 60) + +(define cmap (new-ColorMap "cmap")) +(define frame (new-FrameBuffer 500 500)) +(FrameBuffer-clear frame (BLACK)) + +(define p3 (new-Plot3D frame xmin ymin zmin xmax ymax zmax)) +(Plot3D-lookat p3 (* 2 (- zmax zmin))) +(Plot3D-autoperspective p3 40) +(Plot3D-rotu p3 60) +(Plot3D-rotr p3 30) +(Plot3D-rotd p3 10) + +(define (drawsolid) + (Plot3D-clear p3 (BLACK)) + (Plot3D-start p3) + (let ((dx (/ (- xmax xmin) nxpoints)) + (dy (/ (- ymax ymin) nypoints)) + (cscale (/ 240 (- zmax zmin)))) + (let x-loop ((x xmin) (i 0)) + (cond + ((< i nxpoints) + (let y-loop ((y ymin) (j 0)) + (cond + ((< j nypoints) + (let* ((z1 (func x y)) + (z2 (func (+ x dx) y)) + (z3 (func (+ x dx) (+ y dy))) + (z4 (func x (+ y dy))) + (c1 (* cscale (- z1 zmin))) + (c2 (* cscale (- z2 zmin))) + (c3 (* cscale (- z3 zmin))) + (c4 (* cscale (- z4 zmin))) + (cc (/ (+ c1 c2 c3 c4) 4)) + (c (round (max (min cc 239) 0)))) + (Plot3D-solidquad p3 x y z1 (+ x dx) y z2 (+ x dx) (+ y dy) + z3 x (+ y dy) z4 (+ c 16))) + (y-loop (+ y dy) (+ j 1))))) + (x-loop (+ x dx) (+ i 1))))))) + +(display "Making a nice 3D plot...\n") +(drawsolid) + +(FrameBuffer-writeGIF frame cmap "image.gif") +(display "Wrote image.gif\n") diff --git a/Examples/GIFPlot/Guile/simple/Makefile b/Examples/GIFPlot/Guile/simple/Makefile new file mode 100644 index 000000000..7986214a0 --- /dev/null +++ b/Examples/GIFPlot/Guile/simple/Makefile @@ -0,0 +1,28 @@ +TOP = ../../.. +SWIG = $(TOP)/../swig +SWIGOPT = +SRCS = +TARGET = simple +INTERFACE = simple.i +LIBS = -L../.. -lgifplot +INCLUDES = -I../../Include + +all:: static + +dynamic:: + $(MAKE) -f $(TOP)/Makefile TOP='$(TOP)' \ + SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile + +static:: + $(MAKE) -f $(TOP)/Makefile TOP='$(TOP)' \ + SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_static + +clean:: + $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_clean + rm -f *.gif + +check: all diff --git a/Examples/GIFPlot/Guile/simple/README b/Examples/GIFPlot/Guile/simple/README new file mode 100644 index 000000000..1925efa93 --- /dev/null +++ b/Examples/GIFPlot/Guile/simple/README @@ -0,0 +1,11 @@ +This is a very minimalistic example in which just a few functions +and constants from library are wrapped and used to draw some simple +shapes. + +`make' will build a version of Guile which defines an additional +module (simple). Run `./simple-guile -s runme.scm' to test it. + +`make dynamic' will build a dynamically loadable module, which can be +loaded from any Guile interpreter. Run `guile -s runme.scm' to test +it. The `use-modules' call in `runme.scm' dynamically loads the +module. diff --git a/Examples/GIFPlot/Guile/simple/runme.scm b/Examples/GIFPlot/Guile/simple/runme.scm new file mode 100644 index 000000000..40ec18101 --- /dev/null +++ b/Examples/GIFPlot/Guile/simple/runme.scm @@ -0,0 +1,30 @@ +;;; Draw some simple shapes + +;; Use the wrapped GIFPlot library +(use-modules (simple)) + +(display "Drawing some basic shapes\n") + +(define cmap (new-ColorMap)) +(define f (new-FrameBuffer 400 400)) + +;; Clear the picture +(FrameBuffer-clear f (BLACK)) + +;; Make a red box +(FrameBuffer-box f 40 40 200 200 (RED)) + +;; Make a blue circle +(FrameBuffer-circle f 200 200 40 (BLUE)) + +;; Make green line +(FrameBuffer-line f 10 390 390 200 (GREEN)) + +;; Write an image out to disk + +(FrameBuffer-writeGIF f cmap "image.gif") +(display "Wrote image.gif\n") + +(delete-FrameBuffer f) +(delete-ColorMap cmap) + diff --git a/Examples/GIFPlot/Guile/simple/simple.i b/Examples/GIFPlot/Guile/simple/simple.i new file mode 100644 index 000000000..86eaabdc0 --- /dev/null +++ b/Examples/GIFPlot/Guile/simple/simple.i @@ -0,0 +1,34 @@ +/* This example shows a very simple interface wrapping a few + primitive declarations */ + +%module simple +%{ +#include "gifplot.h" +%} + +typedef unsigned int Pixel; + +/* Here are a few useful functions */ + +ColorMap *new_ColorMap(char *filename = 0); +void delete_ColorMap(ColorMap *cmap); + +FrameBuffer *new_FrameBuffer(unsigned int width, unsigned int height); +void delete_FrameBuffer(FrameBuffer *frame); +void FrameBuffer_clear(FrameBuffer *frame, Pixel color); +void FrameBuffer_line(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); +void FrameBuffer_box(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); +void FrameBuffer_circle(FrameBuffer *frame, int x1, int y1, int radius, Pixel color); +int FrameBuffer_writeGIF(FrameBuffer *f, ColorMap *c, char *filename); + +/* And some useful constants */ + +#define BLACK 0 +#define WHITE 1 +#define RED 2 +#define GREEN 3 +#define BLUE 4 +#define YELLOW 5 +#define CYAN 6 +#define MAGENTA 7 + diff --git a/Examples/GIFPlot/Include/gifplot.h b/Examples/GIFPlot/Include/gifplot.h new file mode 100644 index 000000000..85e4c10b3 --- /dev/null +++ b/Examples/GIFPlot/Include/gifplot.h @@ -0,0 +1,333 @@ +/* ----------------------------------------------------------------------------- + * gifplot.h + * + * Main header file for the GIFPlot library. + * + * Author(s) : David Beazley (beazley@cs.uchicago.edu) + * Copyright (C) 1995-1996 + * + * See the file LICENSE for information on usage and redistribution. + * ----------------------------------------------------------------------------- */ + +#include +#include +#include +#include +#include +#include + +#ifndef GIFPLOT_H + +#ifdef SWIG +%nodefault; +#endif + +/* Pixel is 8-bits */ + +typedef unsigned char Pixel; +typedef float Zvalue; + +/* ------------------------------------------------------------------------ + ColorMap + + Definition and methods for colormaps + ------------------------------------------------------------------------ */ + +typedef struct ColorMap { + unsigned char *cmap; + char *name; +} ColorMap; + +extern ColorMap *new_ColorMap(char *filename); +extern void delete_ColorMap(ColorMap *c); +extern void ColorMap_default(ColorMap *c); +extern void ColorMap_assign(ColorMap *c, int index, int r, int g, int b); +extern int ColorMap_getitem(ColorMap *c, int index); +extern void ColorMap_setitem(ColorMap *c, int index, int value); +extern int ColorMap_write(ColorMap *c, char *filename); + +/* Some default colors */ + +#define BLACK 0 +#define WHITE 1 +#define RED 2 +#define GREEN 3 +#define BLUE 4 +#define YELLOW 5 +#define CYAN 6 +#define MAGENTA 7 + +/*------------------------------------------------------------------------- + FrameBuffer + + This structure defines a simple 8 bit framebuffer. + ------------------------------------------------------------------------- */ + +typedef struct FrameBuffer { + Pixel **pixels; + Zvalue **zbuffer; + unsigned int height; + unsigned int width; + int xmin; /* These are used for clipping */ + int ymin; + int xmax; + int ymax; +} FrameBuffer; + +#define ZMIN 1e+36 + +/* FrameBuffer Methods */ + +extern FrameBuffer *new_FrameBuffer(unsigned int width, unsigned int height); +extern void delete_FrameBuffer(FrameBuffer *frame); +extern int FrameBuffer_resize(FrameBuffer *frame, int width, int height); +extern void FrameBuffer_clear(FrameBuffer *frame, Pixel color); +extern void FrameBuffer_plot(FrameBuffer *frame, int x, int y, Pixel color); +extern void FrameBuffer_horizontal(FrameBuffer *frame, int xmin, int xmax, int y, Pixel color); +extern void FrameBuffer_horizontalinterp(FrameBuffer *f, int xmin, int xmax, int y, Pixel c1, Pixel c2); +extern void FrameBuffer_vertical(FrameBuffer *frame, int ymin, int ymax, int x, Pixel color); +extern void FrameBuffer_box(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); +extern void FrameBuffer_solidbox(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); +extern void FrameBuffer_interpbox(FrameBuffer *f, int x1, int y1, int x2, int y2, Pixel c1, Pixel c2, Pixel c3, Pixel c4); +extern void FrameBuffer_circle(FrameBuffer *frame, int x1, int y1, int radius, Pixel color); +extern void FrameBuffer_solidcircle(FrameBuffer *frame, int x1, int y1, int radius, Pixel color); +extern void FrameBuffer_line(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); +extern void FrameBuffer_setclip(FrameBuffer *frame, int xmin, int ymin, int xmax, int ymax); +extern void FrameBuffer_noclip(FrameBuffer *frame); +extern int FrameBuffer_makeGIF(FrameBuffer *frame, ColorMap *cmap, void *buffer, unsigned int maxsize); +extern int FrameBuffer_writeGIF(FrameBuffer *f, ColorMap *c, char *filename); +extern void FrameBuffer_zresize(FrameBuffer *f, int width, int height); +extern void FrameBuffer_zclear(FrameBuffer *f); +extern void FrameBuffer_solidtriangle(FrameBuffer *f, int x1, int y1, int x2, int y2, int x3, int y3, Pixel c); +extern void FrameBuffer_interptriangle(FrameBuffer *f, int tx1, int ty1, Pixel c1, + int tx2, int ty2, Pixel c2, int tx3, int ty3, Pixel c3); + +#define HORIZONTAL 1 +#define VERTICAL 2 + +extern void FrameBuffer_drawchar(FrameBuffer *frame, int x, int y, int fgcolor, int bgcolor, char chr, int orientation); +extern void FrameBuffer_drawstring(FrameBuffer *f, int x, int y, int fgcolor, int bgcolor, char *text, int orientation); + +/* ------------------------------------------------------------------------ + PixMap + + The equivalent of "bit-maps". + ------------------------------------------------------------------------ */ + +typedef struct PixMap { + int width; + int height; + int centerx; + int centery; + int *map; +} PixMap; + +/* PIXMAP methods */ + +extern PixMap *new_PixMap(int width, int height, int centerx, int centery); +extern void delete_PixMap(PixMap *pm); +extern void PixMap_set(PixMap *pm, int x, int y, int pix); +extern void FrameBuffer_drawpixmap(FrameBuffer *f, PixMap *pm, int x, int y, int fgcolor, int bgcolor); + +#define GIFPLOT_TRANSPARENT 0 +#define GIFPLOT_FOREGROUND 1 +#define GIFPLOT_BACKGROUND 2 + +/* ------------------------------------------------------------------------ + Plot2D + + Definition and methods for 2D plots. + ------------------------------------------------------------------------ */ + +typedef struct Plot2D { + FrameBuffer *frame; /* what frame buffer are we using */ + int view_xmin; /* Minimum coordinates of view region */ + int view_ymin; + int view_xmax; /* Maximum coordinates of view region */ + int view_ymax; + double xmin; /* Minimum coordinates of plot region */ + double ymin; + double xmax; /* Maximum coordinates of plot region */ + double ymax; + int xscale; /* Type of scaling (LINEAR, LOG, etc..) */ + int yscale; + double dx; /* Private scaling parameters */ + double dy; +} Plot2D; + +/* 2D Plot methods */ + +extern Plot2D *new_Plot2D(FrameBuffer *frame,double xmin,double ymin, double xmax, double ymax); +extern void delete_Plot2D(Plot2D *p2); +extern Plot2D *Plot2D_copy(Plot2D *p2); +extern void Plot2D_clear(Plot2D *p2, Pixel c); +extern void Plot2D_setview(Plot2D *p2, int vxmin, int vymin, int vxmax, int vymax); +extern void Plot2D_setrange(Plot2D *p2, double xmin, double ymin, double xmax, double ymax); +extern void Plot2D_setscale(Plot2D *p2, int xscale, int yscale); +extern void Plot2D_plot(Plot2D *p2, double x, double y, Pixel color); +extern void Plot2D_box(Plot2D *p2, double x1, double y1, double x2, double y2, Pixel color); +extern void Plot2D_solidbox(Plot2D *p2, double x1, double y1,double x2, double y2, Pixel color); +extern void Plot2D_interpbox(Plot2D *p2, double x1, double y1, double x2, double y2, Pixel c1, Pixel c2, Pixel c3, Pixel c4); +extern void Plot2D_circle(Plot2D *p2, double x, double y, double radius, Pixel color); +extern void Plot2D_solidcircle(Plot2D *p2, double x, double y, double radius, Pixel color); +extern void Plot2D_line(Plot2D *p2, double x1, double y1, double x2, double y2, Pixel color); +extern void Plot2D_start(Plot2D *p2); +extern void Plot2D_drawpixmap(Plot2D *p2, PixMap *pm, double x, double y, Pixel color, Pixel bgcolor); +extern void Plot2D_xaxis(Plot2D *p2, double x, double y, double xtick, int ticklength, Pixel c); +extern void Plot2D_yaxis(Plot2D *p2, double x, double y, double ytick, int ticklength, Pixel c); +extern void Plot2D_triangle(Plot2D *p2, double x1, double y1, double x2, double y2, double x3, double y3, Pixel c); +extern void Plot2D_solidtriangle(Plot2D *p2, double x1, double y1, double x2, double y2, double x3, double y3, Pixel c); +extern void Plot2D_interptriangle(Plot2D *p2, double x1, double y1, Pixel c1, + double x2, double y2, Pixel c2, + double x3, double y3, Pixel c3); + +#define LINEAR 10 +#define LOG 11 + +/* ----------------------------------------------------------------------- + Matrix + + Operations on 4x4 transformation matrices and vectors. + Matrices are represented as a double array of 16 elements + ----------------------------------------------------------------------- */ + +typedef double *Matrix; +typedef struct GL_Vector { + double x; + double y; + double z; + double w; +} GL_Vector; + +extern Matrix new_Matrix(); +extern void delete_Matrix(Matrix a); +extern Matrix Matrix_copy(Matrix a); +extern void Matrix_multiply(Matrix a, Matrix b, Matrix c); +extern void Matrix_identity(Matrix a); +extern void Matrix_zero(Matrix a); +extern void Matrix_transpose(Matrix a, Matrix result); +extern void Matrix_invert(Matrix a, Matrix inva); +extern void Matrix_transform(Matrix a, GL_Vector *r, GL_Vector *t); +extern void Matrix_transform4(Matrix a, double rx, double ry, double rz, + double rw, GL_Vector *t); + +extern void Matrix_print(Matrix a); +extern void Matrix_translate(Matrix a, double tx, double ty, double tz); +extern void Matrix_rotatex(Matrix a, double deg); +extern void Matrix_rotatey(Matrix a, double deg); +extern void Matrix_rotatez(Matrix a, double deg); + +/* ----------------------------------------------------------------------- + Plot3D + + Data Structure for 3-D plots + ------------------------------------------------------------------------ */ + +typedef struct Plot3D { + FrameBuffer *frame; /* Frame buffer being used */ + int view_xmin; /* Viewing region */ + int view_ymin; + int view_xmax; + int view_ymax; + double xmin; /* Bounding box */ + double ymin; + double zmin; + double xmax; + double ymax; + double zmax; + double xcenter; /* Center point */ + double ycenter; + double zcenter; + double fovy; /* Field of view */ + double aspect; /* Aspect ratio */ + double znear; /* near "clipping" plane */ + double zfar; /* far "clipping" plane */ + Matrix center_mat; /* Matrix used for centering the model */ + Matrix model_mat; /* Model rotation matrix */ + Matrix view_mat; /* Viewing matrix */ + Matrix fullmodel_mat; /* Full model matrix. Used by sphere plot */ + Matrix trans_mat; /* Total transformation matrix */ + double lookatz; /* Where is the z-lookat point */ + double xshift; /* Used for translation and stuff */ + double yshift; + double zoom; + int width; + int height; + int pers_mode; /* Perspective mode (private) */ + double ortho_left,ortho_right,ortho_bottom,ortho_top; +} Plot3D; + +extern Plot3D *new_Plot3D(FrameBuffer *frame, double xmin, double ymin, double zmin, + double xmax, double ymax, double zmax); +extern void delete_Plot3D(Plot3D *p3); +extern Plot3D *Plot3D_copy(Plot3D *p3); +extern void Plot3D_clear(Plot3D *p3, Pixel Color); +extern void Plot3D_perspective(Plot3D *p3, double fovy, double znear, double zfar); +extern void Plot3D_ortho(Plot3D *p3, double left, double right, double top, double bottom); +extern void Plot3D_lookat(Plot3D *p3, double z); +extern void Plot3D_autoperspective(Plot3D *p3, double fovy); +extern void Plot3D_autoortho(Plot3D *p3); +extern void Plot3D_rotx(Plot3D *p3, double deg); +extern void Plot3D_roty(Plot3D *p3, double deg); +extern void Plot3D_rotz(Plot3D *p3, double deg); +extern void Plot3D_rotl(Plot3D *p3, double deg); +extern void Plot3D_rotr(Plot3D *p3, double deg); +extern void Plot3D_rotd(Plot3D *p3, double deg); +extern void Plot3D_rotu(Plot3D *p3, double deg); +extern void Plot3D_rotc(Plot3D *p3, double deg); +extern void Plot3D_zoom(Plot3D *p3, double percent); +extern void Plot3D_left(Plot3D *p3, double percent); +extern void Plot3D_right(Plot3D *p3, double percent); +extern void Plot3D_down(Plot3D *p3, double percent); +extern void Plot3D_up(Plot3D *p3, double percent); +extern void Plot3D_center(Plot3D *p3, double cx, double cy); + +extern void Plot3D_plot(Plot3D *p3, double x, double y, double z, Pixel Color); + +extern void Plot3D_setview(Plot3D *p3, int vxmin, int vymin, int vxmax, int vymax); +extern void Plot3D_start(Plot3D *p3); +extern void Plot3D_line(Plot3D *p3, double x1, double y1, double z1, + double x2, double y2, double z2, Pixel color); +extern void Plot3D_triangle(Plot3D *p3, double x1, double y1, double z1, + double x2, double y2, double z2, + double x3, double y3, double z3, Pixel color); +extern void Plot3D_solidtriangle(Plot3D *p3, double x1, double y1, double z1, + double x2, double y2, double z2, + double x3, double y3, double z3, Pixel color); + +extern void Plot3D_interptriangle(Plot3D *p3, + double x1, double y1, double z1, Pixel c1, + double x2, double y2, double z2, Pixel c2, + double x3, double y3, double z3, Pixel c3); + +extern void Plot3D_quad(Plot3D *p3, double x1, double y1, double z1, + double x2, double y2, double z2, + double x3, double y3, double z3, + double x4, double y4, double z4, + Pixel color); + +extern void Plot3D_solidquad(Plot3D *p3, double x1, double y1, double z1, + double x2, double y2, double z2, + double x3, double y3, double z3, + double x4, double y4, double z4, + Pixel color); + +extern void Plot3D_interpquad(Plot3D *p3, double x1, double y1, double z1, Pixel c1, + double x2, double y2, double z2, Pixel c2, + double x3, double y3, double z3, Pixel c3, + double x4, double y4, double z4, Pixel c4); + + +extern void Plot3D_solidsphere(Plot3D *p3, double x, double y, double z, double radius,Pixel c); + +extern void Plot3D_outlinesphere(Plot3D *p3, double x, double y, double z, double radius,Pixel c, Pixel bc); + +extern PixMap PixMap_SQUARE; +extern PixMap PixMap_TRIANGLE; +extern PixMap PixMap_CROSS; + +#endif +#define GIFPLOT_H + + + diff --git a/Examples/GIFPlot/Interface/gifplot.i b/Examples/GIFPlot/Interface/gifplot.i new file mode 100644 index 000000000..fdf661c5e --- /dev/null +++ b/Examples/GIFPlot/Interface/gifplot.i @@ -0,0 +1,264 @@ +// +// Graphics module +// +%module gifplot +%{ +#include "gifplot.h" +%} + +#if defined(SWIGJAVA ) || defined(SWIGPHP) + %rename(make_default) ColorMap::default(); +#endif + +%rename(__getitem__) ColorMap::getitem(int index); +%rename(__setitem__) ColorMap::setitem(int index, int value); + +/* Pixel is 8-bits */ + +typedef unsigned char Pixel; +typedef float Zvalue; + +/* ------------------------------------------------------------------------ + ColorMap + + Definition and methods for colormaps + ------------------------------------------------------------------------ */ + +typedef struct ColorMap { + char *name; + +// +// %extend adds some C methods to this structure to make it +// look like a C++ class in Python. +// These are really named things like ColorMap_default, ColorMap_assign, etc... + + %extend { + ColorMap(char *filename); + ~ColorMap(); + void default(); + void assign(int index,int r, int g, int b); + int getitem(int index); + void setitem(int index, int value); + int write(char *filename); + } +} ColorMap; + +/* Some default colors */ + +#define BLACK 0 +#define WHITE 1 +#define RED 2 +#define GREEN 3 +#define BLUE 4 +#define YELLOW 5 +#define CYAN 6 +#define MAGENTA 7 + +/*------------------------------------------------------------------------- + FrameBuffer + + This structure defines a simple 8 bit framebuffer. + ------------------------------------------------------------------------- */ + +typedef struct FrameBuffer { + unsigned int height; + unsigned int width; + int xmin; /* These are used for clipping */ + int ymin; + int xmax; + int ymax; + %extend { + FrameBuffer(unsigned int width, unsigned int height); + ~FrameBuffer(); + void resize(int width, int height); + void clear(Pixel color); + void plot(int x, int y, Pixel color); + void horizontal(int xmin, int xmax, int y, Pixel color); + void horizontalinterp(int xmin, int xmax, int y, Pixel c1, Pixel c2); + void vertical(int ymin, int ymax, int x, Pixel color); + void box(int x1, int y1, int x2, int y2, Pixel color); + void solidbox(int x1, int y1, int x2, int y2, Pixel color); + void interpbox(int x1, int y1, int x2, int y2, Pixel c1, Pixel c2, Pixel c3, Pixel c4); + void circle(int x1, int y1, int radius, Pixel color); + void solidcircle(int x1, int y1, int radius, Pixel color); + void line(int x1, int y1, int x2, int y2, Pixel color); + void setclip(int xmin, int ymin, int xmax, int ymax); + void noclip(); + int makeGIF(ColorMap *cmap, void *buffer, unsigned int maxsize); + void zresize(int width, int height); + void zclear(); + void drawchar(int x, int y, int fgcolor, int bgcolor, char chr, int orientation); + void drawstring(int x, int y, int fgcolor, int bgcolor, char *text, int orientation); + void drawpixmap(PixMap *pm, int x, int y, int fgcolor, int bgcolor); + int writeGIF(ColorMap *cmap, char *filename); + } +} FrameBuffer; + +#define HORIZONTAL 1 +#define VERTICAL 2 + +/* -------------------------------------------------------------------------- + PixMap + + The equivalent of "bit-maps". + -------------------------------------------------------------------------- */ + +/* PIXMAP methods */ + +extern PixMap *new_PixMap(int width, int height, int centerx, int centery); +extern void delete_PixMap(PixMap *pm); +extern void PixMap_set(PixMap *pm, int x, int y, int pix); + +#define GIFPLOT_TRANSPARENT 0 +#define GIFPLOT_FOREGROUND 1 +#define GIFPLOT_BACKGROUND 2 + +/* -------------------------------------------------------------------------- + Plot2D + + Definition and methods for 2D plots. + --------------------------------------------------------------------------- */ + +typedef struct Plot2D { + FrameBuffer *frame; + int view_xmin; /* Minimum coordinates of view region */ + int view_ymin; + int view_xmax; /* Maximum coordinates of view region */ + int view_ymax; + double xmin; /* Minimum coordinates of plot region */ + double ymin; + double xmax; /* Maximum coordinates of plot region */ + double ymax; + int xscale; /* Type of scaling (LINEAR, LOG, etc..) */ + int yscale; + %extend { + Plot2D(FrameBuffer *frame,double xmin,double ymin, double xmax, double ymax); + ~Plot2D(); + Plot2D *copy(); + void clear(Pixel c); + void setview(int vxmin, int vymin, int vxmax, int vymax); + void setrange(double xmin, double ymin, double xmax, double ymax); + void setscale(int xscale, int yscale); + void plot(double x, double y, Pixel color); + void box(double x1, double y1, double x2, double y2, Pixel color); + void solidbox(double x1, double y1, double x2, double y2, Pixel color); + void interpbox(double x1, double y1, double x2, double y2, Pixel c1, Pixel c2, Pixel c3, Pixel c4); + + void circle(double x, double y, double radius, Pixel color); + void solidcircle(double x, double y, double radius, Pixel color); + void line(double x1, double y1, double x2, double y2, Pixel color); + void start(); + void drawpixmap(PixMap *pm, double x, double y, Pixel color, Pixel bgcolor); + void xaxis(double x, double y, double xtick, int ticklength, Pixel color); + void yaxis(double x, double y, double ytick, int ticklength, Pixel color); + void triangle(double x1, double y1, double x2, double y2, double x3, double y3, Pixel c); + + void solidtriangle(double x1, double y1, double x2, double y2, double x3, double y3, Pixel c); + + void interptriangle(double x1, double y1, Pixel c1, + double x2, double y2, Pixel c2, + double x3, double y3, Pixel c3); + + } +} Plot2D; + +#define LINEAR 10 +#define LOG 11 + +/* ------------------------------------------------------------------------------ + Plot3D + + Data Structure for 3-D plots + ------------------------------------------------------------------------------ */ + +typedef struct Plot3D { + FrameBuffer *frame; + int view_xmin; /* Viewing region */ + int view_ymin; + int view_xmax; + int view_ymax; + double xmin; /* Bounding box */ + double ymin; + double zmin; + double xmax; + double ymax; + double zmax; + double xcenter; /* Center point */ + double ycenter; + double zcenter; + double fovy; /* Field of view */ + double aspect; /* Aspect ratio */ + double znear; /* near "clipping" plane */ + double zfar; /* far "clipping" plane */ + double lookatz; /* Where is the z-lookat point */ + double xshift; /* Used for translation and stuff */ + double yshift; + %extend { + Plot3D(FrameBuffer *frame, double xmin, double ymin, double zmin, double xmax, double ymax, double zmax); + ~Plot3D(); + Plot3D *copy(); + void clear(Pixel bgcolor); + void perspective( double fovy, double znear, double zfar); + void lookat( double z); + void autoperspective( double fovy); + void ortho(double left, double right, double bottom, double top); + void autoortho(); + void rotx( double deg); + void roty( double deg); + void rotz( double deg); + void rotl( double deg); + void rotr( double deg); + void rotd( double deg); + void rotu( double deg); + void rotc( double deg); + void zoom( double percent); + void left( double percent); + void right( double percent); + void down( double percent); + void up( double percent); + void center( double cx, double cy); + void plot( double x, double y, double z, Pixel Color); + void setview( int vxmin, int vymin, int vxmax, int vymax); + void start(); + void line( double x1, double y1, double z1, + double x2, double y2, double z2, Pixel color); + void triangle( double x1, double y1, double z1, + double x2, double y2, double z2, + double x3, double y3, double z3, Pixel color); + void solidtriangle( double x1, double y1, double z1, + double x2, double y2, double z2, + double x3, double y3, double z3, Pixel color); + void interptriangle(double x1, double y1, double z1, Pixel c1, + double x2, double y2, double z2, Pixel c2, + double x3, double y3, double z3, Pixel c3); + void quad( double x1, double y1, double z1, + double x2, double y2, double z2, + double x3, double y3, double z3, + double x4, double y4, double z4, + Pixel color); + void solidquad( double x1, double y1, double z1, + double x2, double y2, double z2, + double x3, double y3, double z3, + double x4, double y4, double z4, + Pixel color); + void interpquad( double x1, double y1, double z1, Pixel c1, + double x2, double y2, double z2, Pixel c2, + double x3, double y3, double z3, Pixel c3, + double x4, double y4, double z4, Pixel c4); + void solidsphere( double x, double y, double z, double radius,Pixel c); + void outlinesphere( double x, double y, double z, double radius,Pixel c, Pixel bc); + } +} Plot3D; + +#ifndef SWIGJAVA +/* These directives create constants of a specific type. They + do not correspond to any C variable or declared constant in the + header file */ +%constant PixMap * SQUARE = &PixMap_SQUARE; +%constant PixMap * TRIANGLE = &PixMap_TRIANGLE; +%constant PixMap * CROSS = &PixMap_CROSS; +#endif + + + + diff --git a/Examples/GIFPlot/Java/check.list b/Examples/GIFPlot/Java/check.list new file mode 100644 index 000000000..13de977af --- /dev/null +++ b/Examples/GIFPlot/Java/check.list @@ -0,0 +1,4 @@ +# see top-level Makefile.in +full +shadow +simple diff --git a/Examples/GIFPlot/Java/full/Makefile b/Examples/GIFPlot/Java/full/Makefile new file mode 100644 index 000000000..8f167237d --- /dev/null +++ b/Examples/GIFPlot/Java/full/Makefile @@ -0,0 +1,20 @@ +TOP = ../../.. +SWIG = $(TOP)/../swig +SWIGOPT = -I../../Include -noproxy +SRCS = +TARGET = gifplot +INTERFACE = gifplot.i +LIBS = -L../.. -lgifplot +INCLUDES = -I../../Include + +all:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java + javac *.java + +clean:: + $(MAKE) -f $(TOP)/Makefile java_clean + rm -f *.gif + +check: all diff --git a/Examples/GIFPlot/Java/full/README b/Examples/GIFPlot/Java/full/README new file mode 100644 index 000000000..93463ea30 --- /dev/null +++ b/Examples/GIFPlot/Java/full/README @@ -0,0 +1,8 @@ +This example runs the entire gifplot.h header file through SWIG without +any changes. The program 'runme.java' does something a little more +interesting. After doing a make, run it using 'java runme'. You'll have to go +look at the header file to get a complete listing of the functions. + +Note the differences in the runme.java files between this example and the +'full' example. This example does not use shadow classes. + diff --git a/Examples/GIFPlot/Java/full/cmap b/Examples/GIFPlot/Java/full/cmap new file mode 100644 index 000000000..a20c331a9 Binary files /dev/null and b/Examples/GIFPlot/Java/full/cmap differ diff --git a/Examples/GIFPlot/Java/full/gifplot.i b/Examples/GIFPlot/Java/full/gifplot.i new file mode 100644 index 000000000..5a7f5008f --- /dev/null +++ b/Examples/GIFPlot/Java/full/gifplot.i @@ -0,0 +1,15 @@ +/* Oh what the heck, let's just grab the whole darn header file + and see what happens. */ + +%module gifplot +%{ + +/* Note: You still need this part because the %include directive + merely causes SWIG to interpret the contents of a file. It doesn't + include the right include headers for the resulting C code */ + +#include "gifplot.h" + +%} + +%include gifplot.h diff --git a/Examples/GIFPlot/Java/full/runme.java b/Examples/GIFPlot/Java/full/runme.java new file mode 100644 index 000000000..c47c1e672 --- /dev/null +++ b/Examples/GIFPlot/Java/full/runme.java @@ -0,0 +1,75 @@ +// Plot a 3D function +import java.lang.Math; + +public class runme { + + static { + try { + System.loadLibrary("gifplot"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String argv[]) { + + // Here are some plotting parameters + double xmin = -5.0; + double xmax = 5.0; + double ymin = -5.0; + double ymax = 5.0; + double zmin = -5.0; + double zmax = 5.0; + + // Grid resolution + int nxpoints = 60; + int nypoints = 60; + + SWIGTYPE_p_ColorMap cmap = gifplot.new_ColorMap("cmap"); + SWIGTYPE_p_FrameBuffer frame = gifplot.new_FrameBuffer(500,500); + gifplot.FrameBuffer_clear(frame,(short)gifplot.BLACK); + + SWIGTYPE_p_Plot3D p3 = gifplot.new_Plot3D(frame,xmin,ymin,zmin,xmax,ymax,zmax); + gifplot.Plot3D_lookat(p3,2*(zmax-zmin)); + gifplot.Plot3D_autoperspective(p3,40); + gifplot.Plot3D_rotu(p3,60); + gifplot.Plot3D_rotr(p3,30); + gifplot.Plot3D_rotd(p3,10); + + System.out.println( "Making a nice 3D plot..." ); + gifplot.Plot3D_clear(p3,(short)gifplot.BLACK); + gifplot.Plot3D_start(p3); + double dx = 1.0*(xmax-xmin)/nxpoints; + double dy = 1.0*(ymax-ymin)/nypoints; + double cscale = 240.0/(zmax-zmin); + double x = xmin; + for (int i = 0; i < nxpoints; i++) { + double y = ymin; + for (int j = 0; j < nypoints; j++) { + double z1 = func(x,y); + double z2 = func(x+dx,y); + double z3 = func(x+dx,y+dy); + double z4 = func(x,y+dy); + double c1 = cscale*(z1-zmin); + double c2 = cscale*(z2-zmin); + double c3 = cscale*(z3-zmin); + double c4 = cscale*(z4-zmin); + double c = (c1+c2+c3+c4)/4; + if (c < 0) c = 0; + if (c > 239) c = 239; + gifplot.Plot3D_solidquad(p3,x,y,z1,x+dx,y,z2,x+dx,y+dy,z3,x,y+dy,z4,(short)(c+16)); + y = y + dy; + } + x = x + dx; + } + + gifplot.FrameBuffer_writeGIF(frame,cmap,"image.gif"); + System.out.println( "Wrote image.gif" ); + } + + // Here is the function to plot + public static double func(double x, double y) { + return 5*java.lang.Math.cos(2*java.lang.Math.sqrt(x*x+y*y))*java.lang.Math.exp(-0.3*java.lang.Math.sqrt(x*x+y*y)); + } +} diff --git a/Examples/GIFPlot/Java/shadow/Makefile b/Examples/GIFPlot/Java/shadow/Makefile new file mode 100644 index 000000000..8062c2700 --- /dev/null +++ b/Examples/GIFPlot/Java/shadow/Makefile @@ -0,0 +1,21 @@ +TOP = ../../.. +SWIG = $(TOP)/../swig +SWIGOPT = -outcurrentdir +SRCS = +TARGET = gifplot +INTERFACEDIR = ../../Interface/ +INTERFACE = gifplot.i +LIBS = -L../.. -lgifplot +INCLUDES = -I../../Include + +all:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' INTERFACEDIR='$(INTERFACEDIR)' java + javac *.java + +clean:: + $(MAKE) -f $(TOP)/Makefile java_clean + rm -f *.gif + +check: all diff --git a/Examples/GIFPlot/Java/shadow/README b/Examples/GIFPlot/Java/shadow/README new file mode 100644 index 000000000..b06c5a8f1 --- /dev/null +++ b/Examples/GIFPlot/Java/shadow/README @@ -0,0 +1,5 @@ +This example uses the file in ../../Interface/gifplot.i to build +an interface with shadow classes. After doing a make, run the program runme, ie: 'java runme'. + +Note the differences in the runme.java files between this example and the +'full' example. This example uses the shadow classes. diff --git a/Examples/GIFPlot/Java/shadow/cmap b/Examples/GIFPlot/Java/shadow/cmap new file mode 100644 index 000000000..a20c331a9 Binary files /dev/null and b/Examples/GIFPlot/Java/shadow/cmap differ diff --git a/Examples/GIFPlot/Java/shadow/runme.java b/Examples/GIFPlot/Java/shadow/runme.java new file mode 100644 index 000000000..91db03898 --- /dev/null +++ b/Examples/GIFPlot/Java/shadow/runme.java @@ -0,0 +1,76 @@ +// Plot a 3D function + +import java.lang.Math; + +public class runme { + + static { + try { + System.loadLibrary("gifplot"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String argv[]) { + + // Here are some plotting parameters + double xmin = -5.0; + double xmax = 5.0; + double ymin = -5.0; + double ymax = 5.0; + double zmin = -5.0; + double zmax = 5.0; + + // Grid resolution + int nxpoints = 60; + int nypoints = 60; + + ColorMap cmap = new ColorMap("cmap"); + FrameBuffer frame = new FrameBuffer(500,500); + frame.clear((short)gifplot.BLACK); + + Plot3D p3 = new Plot3D(frame,xmin,ymin,zmin,xmax,ymax,zmax); + p3.lookat(2*(zmax-zmin)); + p3.autoperspective(40); + p3.rotu(60); + p3.rotr(30); + p3.rotd(10); + + System.out.println( "Making a nice 3D plot..." ); + p3.clear((short)gifplot.BLACK); + p3.start(); + double dx = 1.0*(xmax-xmin)/nxpoints; + double dy = 1.0*(ymax-ymin)/nypoints; + double cscale = 240.0/(zmax-zmin); + double x = xmin; + for (int i = 0; i < nxpoints; i++) { + double y = ymin; + for (int j = 0; j < nypoints; j++) { + double z1 = func(x,y); + double z2 = func(x+dx,y); + double z3 = func(x+dx,y+dy); + double z4 = func(x,y+dy); + double c1 = cscale*(z1-zmin); + double c2 = cscale*(z2-zmin); + double c3 = cscale*(z3-zmin); + double c4 = cscale*(z4-zmin); + double c = (c1+c2+c3+c4)/4; + if (c < 0) c = 0; + if (c > 239) c = 239; + p3.solidquad(x,y,z1,x+dx,y,z2,x+dx,y+dy,z3,x,y+dy,z4,(short)(c+16)); + y = y + dy; + } + x = x + dx; + } + + frame.writeGIF(cmap,"image.gif"); + System.out.println( "Wrote image.gif" ); + } + + // Here is the function to plot + public static double func(double x, double y) { + return 5*java.lang.Math.cos(2*java.lang.Math.sqrt(x*x+y*y))*java.lang.Math.exp(-0.3*java.lang.Math.sqrt(x*x+y*y)); + } +} diff --git a/Examples/GIFPlot/Java/simple/Makefile b/Examples/GIFPlot/Java/simple/Makefile new file mode 100644 index 000000000..d707fd458 --- /dev/null +++ b/Examples/GIFPlot/Java/simple/Makefile @@ -0,0 +1,21 @@ +TOP = ../../.. +SWIG = $(TOP)/../swig +SWIGOPT = -noproxy +SRCS = +TARGET = simple +INTERFACE = simple.i +LIBS = -L../.. -lgifplot +INCLUDES = -I../../Include + +all:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java + javac *.java + + +clean:: + $(MAKE) -f $(TOP)/Makefile java_clean + rm -f *.gif + +check: all diff --git a/Examples/GIFPlot/Java/simple/README b/Examples/GIFPlot/Java/simple/README new file mode 100644 index 000000000..13ff49611 --- /dev/null +++ b/Examples/GIFPlot/Java/simple/README @@ -0,0 +1,5 @@ +This is a very minimalistic example in which just a few functions +and constants from library are wrapped and used to draw some simple +shapes. After doing a make, run the java program, ie 'java runme'. + + diff --git a/Examples/GIFPlot/Java/simple/runme.java b/Examples/GIFPlot/Java/simple/runme.java new file mode 100644 index 000000000..2d8d2bb48 --- /dev/null +++ b/Examples/GIFPlot/Java/simple/runme.java @@ -0,0 +1,41 @@ + +public class runme { + + static { + try { + System.loadLibrary("simple"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String argv[]) { + + // Draw some simple shapes + System.out.println( "Drawing some basic shapes" ); + + SWIGTYPE_p_ColorMap cmap = simple.new_ColorMap(null); + SWIGTYPE_p_FrameBuffer f = simple.new_FrameBuffer(400,400); + + // Clear the picture + simple.FrameBuffer_clear(f,(short)simple.BLACK); + + // Make a red box + simple.FrameBuffer_box(f,40,40,200,200,(short)simple.RED); + + // Make a blue circle + simple.FrameBuffer_circle(f,200,200,40,(short)simple.BLUE); + + // Make green line + simple.FrameBuffer_line(f,10,390,390,200, (short)simple.GREEN); + + // Write an image out to disk + + simple.FrameBuffer_writeGIF(f,cmap,"image.gif"); + System.out.println( "Wrote image.gif" ); + + simple.delete_FrameBuffer(f); + simple.delete_ColorMap(cmap); + } +} diff --git a/Examples/GIFPlot/Java/simple/simple.i b/Examples/GIFPlot/Java/simple/simple.i new file mode 100644 index 000000000..457bc4c09 --- /dev/null +++ b/Examples/GIFPlot/Java/simple/simple.i @@ -0,0 +1,38 @@ +/* This example shows a very simple interface wrapping a few + primitive declarations */ + +%module simple +%{ +#include "gifplot.h" +%} + +typedef unsigned char Pixel; + +/* Here are a few useful functions */ + +ColorMap *new_ColorMap(char *filename = 0); +void delete_ColorMap(ColorMap *cmap); + +FrameBuffer *new_FrameBuffer(unsigned int width, unsigned int height); +void delete_FrameBuffer(FrameBuffer *frame); +void FrameBuffer_clear(FrameBuffer *frame, Pixel color); +void FrameBuffer_line(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); +void FrameBuffer_box(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); +void FrameBuffer_circle(FrameBuffer *frame, int x1, int y1, int radius, Pixel color); +int FrameBuffer_writeGIF(FrameBuffer *f, ColorMap *c, char *filename); + +/* And some useful constants */ + +#define BLACK 0 +#define WHITE 1 +#define RED 2 +#define GREEN 3 +#define BLUE 4 +#define YELLOW 5 +#define CYAN 6 +#define MAGENTA 7 + + + + + diff --git a/Examples/GIFPlot/Lib/Makefile.in b/Examples/GIFPlot/Lib/Makefile.in new file mode 100644 index 000000000..9db828eb2 --- /dev/null +++ b/Examples/GIFPlot/Lib/Makefile.in @@ -0,0 +1,22 @@ +CC = @CC@ +CCSHARED= @CCSHARED@ +INCLUDES= -I../Include +CFLAGS = -O +SRCS = frame.c color.c plot2d.c plot3d.c font.c pixmap.c matrix.c gif.c +OBJS = $(SRCS:.c=.@OBJEXT@) +AR = @AR@ +RANLIB = @RANLIB@ +TARGET = ../libgifplot.a + +.c.@OBJEXT@: + $(CC) $(CCSHARED) $(INCLUDES) $(CFLAGS) -c -o $*.@OBJEXT@ $< + +all: $(OBJS) + @rm -f ../libgifplot.a + $(AR) cr $(TARGET) $(OBJS) + $(RANLIB) $(TARGET) + +clean: + rm -f *.@OBJEXT@ *~ $(TARGET) + +check: all diff --git a/Examples/GIFPlot/Lib/color.c b/Examples/GIFPlot/Lib/color.c new file mode 100644 index 000000000..7d79baca9 --- /dev/null +++ b/Examples/GIFPlot/Lib/color.c @@ -0,0 +1,143 @@ +/* ----------------------------------------------------------------------------- + * color.c + * + * Colormaps + * + * Author(s) : David Beazley (beazley@cs.uchicago.edu) + * Copyright (C) 1995-1996 + * + * See the file LICENSE for information on usage and redistribution. + * ----------------------------------------------------------------------------- */ + +#define COLORMAP +#include "gifplot.h" +#include + +/* ------------------------------------------------------------------------ + ColorMap *new_ColorMap(char *filename) + + Read a colormap from a file. + ------------------------------------------------------------------------ */ + +ColorMap *new_ColorMap(char *filename) { + ColorMap *c; + FILE *cm; + void ColorMap_default(ColorMap *); + + if (!filename) { + c = (ColorMap *) malloc(sizeof(ColorMap)); + c->cmap = (unsigned char *) malloc(768*sizeof(char)); + c->name = 0; + ColorMap_default(c); + return c; + } + if (strlen(filename) == 0) { + c = (ColorMap *) malloc(sizeof(ColorMap)); + c->cmap = (unsigned char *) malloc(768*sizeof(char)); + ColorMap_default(c); + return c; + } + if ((cm = fopen(filename,"rb")) == NULL) { + return (ColorMap *) 0; + } + c = (ColorMap *) malloc(sizeof(ColorMap)); + c->cmap = (unsigned char *) malloc(768*sizeof(char)); + if (fread(c->cmap, 768, 1, cm) != 1) { + free((char *)c->cmap); + free((char *)c); + fclose(cm); + return (ColorMap *) 0; + } + fclose(cm); + c->name = (char *) malloc(strlen(filename)+1); + strcpy(c->name, filename); + ColorMap_default(c); + return c; +} + +/* -------------------------------------------------------------------------- + delete_ColorMap(ColorMap *cm) + + Destroy a ColorMap + -------------------------------------------------------------------------- */ + +void delete_ColorMap(ColorMap *cm) { + if (cm) { + free((char *)cm->cmap); + if (cm->name) + free((char *)cm->name); + free((char *)cm); + } +} + +/* -------------------------------------------------------------------------- + ColorMap_default(ColorMap *cm) + + This function fills in default values for the first 8 entries of the + colormap. These are *fixed* values---used internally. + -------------------------------------------------------------------------- */ + +void ColorMap_default(ColorMap *cm) { + unsigned char *r,*g,*b; + if (cm) { + r = cm->cmap; + g = cm->cmap+256; + b = cm->cmap+512; + + r[0] = 0; g[0] = 0; b[0] = 0; /* BLACK */ + r[1] = 255; g[1] = 255; b[1] = 255; /* WHITE */ + r[2] = 255; g[2] = 0; b[2] = 0; /* RED */ + r[3] = 0; g[3] = 255; b[3] = 0; /* GREEN */ + r[4] = 0; g[4] = 0; b[4] = 255; /* BLUE */ + r[5] = 255; g[5] = 255; b[5] = 0; /* YELLOW */ + r[6] = 0; g[6] = 255; b[6] = 255; /* CYAN */ + r[7] = 255; g[7] = 0; b[7] = 255; /* MAGENTA */ + } +} + +void ColorMap_assign(ColorMap *cm, int index, int r, int g, int b) { + unsigned char *rb,*gb,*bb; + + rb = cm->cmap; + gb = cm->cmap+256; + bb = cm->cmap+512; + + rb[index] = r; + gb[index] = g; + bb[index] = b; +} + +int ColorMap_getitem(ColorMap *cm, int index) { + if ((index < 0) && (index >= 768)) return -1; + return cm->cmap[index]; +} + +void ColorMap_setitem(ColorMap *cm, int index, int value) { + if ((index < 0) && (index >= 768)) return; + cm->cmap[index]=value; +} + +/* -------------------------------------------------------------------- + ColorMap_write(ColorMap *cm, char *filename) + + Write out a colormap to disk. + -------------------------------------------------------------------- */ + +int ColorMap_write(ColorMap *cm, char *filename) { + + FILE *f; + if (!cm) return -1; + if (!filename) return -1; + if (strlen(filename) == 0) return -1; + + f = fopen(filename,"w"); + + if (fwrite(cm->cmap,768,1,f) != 1) { + fclose(f); + return -1; + } + fclose(f); + return 0; +} + +#undef COLORMAP diff --git a/Examples/GIFPlot/Lib/font.c b/Examples/GIFPlot/Lib/font.c new file mode 100644 index 000000000..b30ee9b14 --- /dev/null +++ b/Examples/GIFPlot/Lib/font.c @@ -0,0 +1,705 @@ +/* ----------------------------------------------------------------------------- + * font.c + * + * Some basic fonts. + * + * Author(s) : David Beazley (beazley@cs.uchicago.edu) + * Copyright (C) 1995-1996 + * + * See the file LICENSE for information on usage and redistribution. + * ----------------------------------------------------------------------------- */ + +#define FONT +#include "gifplot.h" + +static char Char_A[80] = "\ +...x....\ +...x....\ +..x.x...\ +..x.x...\ +.x...x..\ +.xxxxx..\ +x.....x.\ +x.....x.\ +x.....x.\ +........"; + +static char Char_B[80] = "\ +xxxxxx..\ +x.....x.\ +x.....x.\ +x.....x.\ +xxxxxx..\ +x.....x.\ +x.....x.\ +x.....x.\ +xxxxxx..\ +........"; + +static char Char_C[80] = "\ +..xxxx..\ +.x....x.\ +x.......\ +x.......\ +x.......\ +x.......\ +x.......\ +.x....x.\ +..xxxx..\ +........"; + +static char Char_D[80] = "\ +xxxxx...\ +x....x..\ +x.....x.\ +x.....x.\ +x.....x.\ +x.....x.\ +x.....x.\ +x....x..\ +xxxxx...\ +........"; +static char Char_E[80] = "\ +xxxxxxx.\ +x.......\ +x.......\ +x.......\ +xxxxx...\ +x.......\ +x.......\ +x.......\ +xxxxxxx.\ +........"; +static char Char_F[80] = "\ +xxxxxxx.\ +x.......\ +x.......\ +x.......\ +xxxxx...\ +x.......\ +x.......\ +x.......\ +x.......\ +........"; +static char Char_G[80] = "\ +.xxxxx..\ +x.....x.\ +x.......\ +x.......\ +x...xxx.\ +x.....x.\ +x.....x.\ +x.....x.\ +.xxxxx..\ +........"; +static char Char_H[80] = "\ +x.....x.\ +x.....x.\ +x.....x.\ +x.....x.\ +xxxxxxx.\ +x.....x.\ +x.....x.\ +x.....x.\ +x.....x.\ +........"; +static char Char_I[80] = "\ +xxxxxxx.\ +...x....\ +...x....\ +...x....\ +...x....\ +...x....\ +...x....\ +...x....\ +xxxxxxx.\ +........"; +static char Char_J[80] = "\ +......x.\ +......x.\ +......x.\ +......x.\ +......x.\ +......x.\ +x.....x.\ +.x...x..\ +..xxx...\ +........"; +static char Char_K[80] = "\ +x.....x.\ +x....x..\ +x...x...\ +x..x....\ +xxx.....\ +x..x....\ +x...x...\ +x....x..\ +x.....x.\ +........"; +static char Char_L[80] = "\ +x.......\ +x.......\ +x.......\ +x.......\ +x.......\ +x.......\ +x.......\ +x.......\ +xxxxxxx.\ +........"; +static char Char_M[80] = "\ +x.....x.\ +xx...xx.\ +xx...xx.\ +x.x.x.x.\ +x.x.x.x.\ +x..x..x.\ +x..x..x.\ +x.....x.\ +x.....x.\ +........"; +static char Char_N[80] = "\ +x.....x.\ +xx....x.\ +x.x...x.\ +x.x...x.\ +x..x..x.\ +x...x.x.\ +x...x.x.\ +x....xx.\ +x.....x.\ +........"; +static char Char_O[80] = "\ +.xxxxx..\ +x.....x.\ +x.....x.\ +x.....x.\ +x.....x.\ +x.....x.\ +x.....x.\ +x.....x.\ +.xxxxx..\ +........"; +static char Char_P[80] = "\ +xxxxxx..\ +x.....x.\ +x.....x.\ +x.....x.\ +xxxxxx..\ +x.......\ +x.......\ +x.......\ +x.......\ +........"; +static char Char_Q[80] = "\ +.xxxxx..\ +x.....x.\ +x.....x.\ +x.....x.\ +x.....x.\ +x.....x.\ +x...x.x.\ +x....x..\ +.xxxx.x.\ +........"; +static char Char_R[80] = "\ +xxxxxx..\ +x.....x.\ +x.....x.\ +x.....x.\ +xxxxxx..\ +x..x....\ +x...x...\ +x....x..\ +x.....x.\ +........"; +static char Char_S[80] = "\ +.xxxxx..\ +x.....x.\ +x.......\ +x.......\ +.xxxxx..\ +......x.\ +......x.\ +x.....x.\ +.xxxxx..\ +........"; +static char Char_T[80] = "\ +xxxxxxx.\ +...x....\ +...x....\ +...x....\ +...x....\ +...x....\ +...x....\ +...x....\ +...x....\ +........"; +static char Char_U[80] = "\ +x.....x.\ +x.....x.\ +x.....x.\ +x.....x.\ +x.....x.\ +x.....x.\ +x.....x.\ +x.....x.\ +.xxxxx..\ +........"; +static char Char_V[80] = "\ +x.....x.\ +x.....x.\ +.x...x..\ +.x...x..\ +..x.x...\ +..x.x...\ +...x....\ +...x....\ +...x....\ +........"; +static char Char_W[80] = "\ +x.....x.\ +x.....x.\ +x.....x.\ +x.....x.\ +x.....x.\ +x..x..x.\ +x..x..x.\ +x.x.x.x.\ +.x...x..\ +........"; +static char Char_X[80] = "\ +x.....x.\ +x.....x.\ +.x...x..\ +..x.x...\ +...x....\ +..x.x...\ +.x...x..\ +x.....x.\ +x.....x.\ +........"; +static char Char_Y[80] = "\ +x.....x.\ +x.....x.\ +.x...x..\ +..x.x...\ +...x....\ +...x....\ +...x....\ +...x....\ +...x....\ +........"; +static char Char_Z[80] = "\ +xxxxxxx.\ +......x.\ +.....x..\ +....x...\ +...x....\ +..x.....\ +.x......\ +x.......\ +xxxxxxx.\ +........"; +static char Char_0[80] = "\ +.xxxxx..\ +x....xx.\ +x...x.x.\ +x..x..x.\ +x..x..x.\ +x.x...x.\ +x.x...x.\ +xx....x.\ +.xxxxx..\ +........"; +static char Char_1[80] = "\ +...x....\ +..xx....\ +...x....\ +...x....\ +...x....\ +...x....\ +...x....\ +...x....\ +..xxx...\ +........"; +static char Char_2[80] = "\ +..xxxx..\ +.x....x.\ +x.....x.\ +.....x..\ +....x...\ +...x....\ +..x.....\ +.x......\ +xxxxxxx.\ +........"; +static char Char_3[80] = "\ +.xxxxx..\ +x.....x.\ +......x.\ +......x.\ +...xxx..\ +......x.\ +......x.\ +x.....x.\ +.xxxxx..\ +........"; +static char Char_4[80] = "\ +....xx..\ +...x.x..\ +..x..x..\ +.x...x..\ +xxxxxxx.\ +.....x..\ +.....x..\ +.....x..\ +.....x..\ +........"; +static char Char_5[80] = "\ +xxxxxxx.\ +x.......\ +x.......\ +x.......\ +xxxxxx..\ +......x.\ +......x.\ +x.....x.\ +.xxxxx..\ +........"; +static char Char_6[80] = "\ +....xxx.\ +..xx....\ +.x......\ +x.......\ +x.xxx...\ +xx...x..\ +x.....x.\ +.x...x..\ +..xxx...\ +........"; +static char Char_7[80] = "\ +xxxxxxx.\ +x.....x.\ +.....x..\ +....x...\ +...x....\ +..x.....\ +.x......\ +x.......\ +x.......\ +........"; +static char Char_8[80] = "\ +.xxxxx..\ +x.....x.\ +x.....x.\ +x.....x.\ +.xxxxx..\ +x.....x.\ +x.....x.\ +x.....x.\ +.xxxxx..\ +........"; +static char Char_9[80] = "\ +..xxxx..\ +.x....x.\ +x.....x.\ +x....xx.\ +.xxxx.x.\ +......x.\ +......x.\ +....xx..\ +.xxx....\ +........"; +static char Char_MINUS[80] = "\ +........\ +........\ +........\ +........\ +.xxxxxx.\ +........\ +........\ +........\ +........\ +........"; +static char Char_PLUS[80] = "\ +........\ +........\ +...x....\ +...x....\ +.xxxxx..\ +...x....\ +...x....\ +........\ +........\ +........"; +static char Char_EQUAL[80] = "\ +........\ +........\ +........\ +.xxxxx..\ +........\ +.xxxxx..\ +........\ +........\ +........\ +........"; +static char Char_LPAREN[80] = "\ +....x...\ +...x....\ +..x.....\ +.x......\ +.x......\ +.x......\ +..x.....\ +...x....\ +....x...\ +........"; +static char Char_RPAREN[80] = "\ +...x....\ +....x...\ +.....x..\ +......x.\ +......x.\ +......x.\ +.....x..\ +....x...\ +...x....\ +........"; +static char Char_QUOTE[80] = "\ +..x.x...\ +..x.x...\ +........\ +........\ +........\ +........\ +........\ +........\ +........\ +........"; +static char Char_COLON[80] = "\ +........\ +........\ +...xx...\ +...xx...\ +........\ +...xx...\ +...xx...\ +........\ +........\ +........"; +static char Char_PERIOD[80] = "\ +........\ +........\ +........\ +........\ +........\ +........\ +........\ +...xx...\ +...xx...\ +........"; +static char Char_COMMA[80] = "\ +........\ +........\ +........\ +........\ +........\ +........\ +...xx...\ +...xx...\ +....x...\ +...x...."; + +static char Char_SLASH[80] = "\ +........\ +......x.\ +.....x..\ +....x...\ +...x....\ +..x.....\ +.x......\ +x.......\ +........\ +........"; + +static char Char_SPACE[80] = "\ +........\ +........\ +........\ +........\ +........\ +........\ +........\ +........\ +........\ +........"; + +static char *GP_Font[128]; +static int InitGP_Font = 0; + +static void initGP_Fonts(void) { + + int i; + for (i = 0; i < 128; i++) + GP_Font[i] = (char *) 0; + + GP_Font['A'] = GP_Font['a'] = Char_A; + GP_Font['B'] = GP_Font['b'] = Char_B; + GP_Font['C'] = GP_Font['c'] = Char_C; + GP_Font['D'] = GP_Font['d'] = Char_D; + GP_Font['E'] = GP_Font['e'] = Char_E; + GP_Font['F'] = GP_Font['f'] = Char_F; + GP_Font['G'] = GP_Font['g'] = Char_G; + GP_Font['H'] = GP_Font['h'] = Char_H; + GP_Font['I'] = GP_Font['i'] = Char_I; + GP_Font['J'] = GP_Font['j'] = Char_J; + GP_Font['K'] = GP_Font['k'] = Char_K; + GP_Font['L'] = GP_Font['l'] = Char_L; + GP_Font['M'] = GP_Font['m'] = Char_M; + GP_Font['N'] = GP_Font['n'] = Char_N; + GP_Font['O'] = GP_Font['o'] = Char_O; + GP_Font['P'] = GP_Font['p'] = Char_P; + GP_Font['Q'] = GP_Font['q'] = Char_Q; + GP_Font['R'] = GP_Font['r'] = Char_R; + GP_Font['S'] = GP_Font['s'] = Char_S; + GP_Font['T'] = GP_Font['t'] = Char_T; + GP_Font['U'] = GP_Font['u'] = Char_U; + GP_Font['V'] = GP_Font['v'] = Char_V; + GP_Font['W'] = GP_Font['w'] = Char_W; + GP_Font['X'] = GP_Font['x'] = Char_X; + GP_Font['Y'] = GP_Font['y'] = Char_Y; + GP_Font['Z'] = GP_Font['z'] = Char_Z; + GP_Font['0'] = Char_0; + GP_Font['1'] = Char_1; + GP_Font['2'] = Char_2; + GP_Font['3'] = Char_3; + GP_Font['4'] = Char_4; + GP_Font['5'] = Char_5; + GP_Font['6'] = Char_6; + GP_Font['7'] = Char_7; + GP_Font['8'] = Char_8; + GP_Font['9'] = Char_9; + GP_Font['.'] = Char_PERIOD; + GP_Font[','] = Char_COMMA; + GP_Font['='] = Char_EQUAL; + GP_Font['-'] = Char_MINUS; + GP_Font['+'] = Char_PLUS; + GP_Font['\"'] = Char_QUOTE; + GP_Font['('] = Char_LPAREN; + GP_Font[')'] = Char_RPAREN; + GP_Font[':'] = Char_COLON; + GP_Font['/'] = Char_SLASH; + GP_Font[' '] = Char_SPACE; + InitGP_Font = 1; +} + +/* ----------------------------------------------------------------------- + void FrameBuffer_drawchar(FrameBuffer *f, int x, int y, Pixel fgcolor, Pixel bgcolor, char chr, int orientation) + + Draws a character at location x, y with given color and orientation parameters. + Orientation can either be HORIZONTAL or VERTICAL + ----------------------------------------------------------------------- */ +void FrameBuffer_drawchar(FrameBuffer *f, int x, int y, int fgcolor, + int bgcolor, char chr, int orientation) { + + Pixel c, bc,*p,*p1; + char *ch; + int i,j; + int xpixels,ypixels; + + if (!InitGP_Font) initGP_Fonts(); + + c = (Pixel) fgcolor; + bc = (Pixel) bgcolor; + xpixels = f->width; + ypixels = f->height; + + if (orientation == HORIZONTAL) { + if ((x < f->xmin) || (x > f->xmax-8) || + (y < f->ymin) || (y > f->ymax-10)) return; + + ch = GP_Font[(int) chr]; + if (!ch) return; + p = &f->pixels[y+9][x]; + for (i = 0; i < 10; i++) { + p1 = p; + for (j = 0; j< 8; j++) { + if (*(ch++) == 'x') *p= c; + else if (bgcolor >= 0) + *p = bc; + p++; + } + p = (p1 - xpixels); + } + } else { + if ((x < f->xmin+10) || (x >= f->xmax) || + (y < f->ymin) || (y > f->ymax-8)) return; + + ch = GP_Font[(int) chr]; + if (!ch) return; + p = &f->pixels[y][x-9]; + for (i = 0; i < 10; i++) { + p1 = p; + for (j = 0; j< 8; j++) { + if (*(ch++) == 'x') *p= c; + else if (bgcolor >= 0) + *p = bc; + p+=xpixels; + } + p = p1 + 1; + } + } +} + +/* ---------------------------------------------------------------------- + void FrameBuffer_drawstring(FrameBuffer *f, int x, int y, int fgcolor, + int bgcolor, char *text, int orientation) + + Draws an ASCII string on the framebuffer. Can be oriented either horizontally + or vertically. + ---------------------------------------------------------------------- */ + +void FrameBuffer_drawstring(FrameBuffer *f, int x, int y, int fgcolor, int bgcolor, char *text, int orientation) { + + char *c; + int x1, y1; + int xpixels, ypixels; + + x1 = x; + y1 = y; + xpixels = f->width; + ypixels = f->height; + c = text; + while (*c) { + if (*c == '\n') { + if (orientation == HORIZONTAL) { + x1 = x; y1= y1- 10*xpixels; + } else { + y1 = y; x1= x1 + 10*ypixels; + } + } else { + FrameBuffer_drawchar(f, x1,y1,fgcolor, bgcolor,*c, orientation); + if (orientation == HORIZONTAL) { + x1+=8; + if (x1 >= (xpixels-8)) { + x1 = x; y1= y1- 10;} + if (y1 < 0) return; + } else { + y1 += 8; + if (y1 >= (ypixels-8)) { + y1 = y; x1 = x1 + 10;} + if (x1 > (xpixels-10)) return; + } + } + c++; + } +} + + + + + + + + diff --git a/Examples/GIFPlot/Lib/frame.c b/Examples/GIFPlot/Lib/frame.c new file mode 100644 index 000000000..e006f0daf --- /dev/null +++ b/Examples/GIFPlot/Lib/frame.c @@ -0,0 +1,924 @@ +/* ----------------------------------------------------------------------------- + * frame.c + * + * Frame buffer management + * + * Author(s) : David Beazley (beazley@cs.uchicago.edu) + * Copyright (C) 1995-1996 + * + * See the file LICENSE for information on usage and redistribution. + * ----------------------------------------------------------------------------- */ + +#define FRAME +#include "gifplot.h" +#include + +/* ------------------------------------------------------------------------ + FrameBuffer *new_FrameBuffer(int width, int height) + + Creates a new framebuffer for storing data. + ------------------------------------------------------------------------ */ + +FrameBuffer *new_FrameBuffer(unsigned int width, unsigned int height) { + + FrameBuffer *f; + int FrameBuffer_resize(FrameBuffer *f, int width, int height); + + /* Create a new frame buffer */ + + f = (FrameBuffer *) malloc(sizeof(FrameBuffer)); + f->pixels = (Pixel **) 0; + f->zbuffer = (Zvalue **) 0; + /* Set its size */ + + if (FrameBuffer_resize(f, width, height) == -1) { + free((char *) f); + return (FrameBuffer *) 0; + } + + f->xmin = 0; + f->ymin = 0; + f->xmax = width; + f->ymax = height; + return f; +} + +/* ------------------------------------------------------------------------ + void delete_FrameBuffer(FrameBuffer *f) + + Destroys the given framebuffer + ------------------------------------------------------------------------ */ + +void delete_FrameBuffer(FrameBuffer *f) { + + if (f) { + if (f->pixels) { + free((char *) f->pixels[0]); + free((char *) f->pixels); + } + if (f->zbuffer) { + free((char *) f->zbuffer[0]); + free((char *) f->zbuffer); + } + free((char *)f); + } +} + +/* ------------------------------------------------------------------------ + int *FrameBuffer_resize(FrameBuffer *f, int width, int height) + + Resize the given framebuffer. Returns 0 on success, -1 on failure. + ------------------------------------------------------------------------ */ + +int FrameBuffer_resize(FrameBuffer *f, int width, int height) { + int i; + if ((f) && (width > 0) && (height > 0)) { + if (f->pixels) { + free((char *)f->pixels[0]); + free((char *)f->pixels); + } + f->pixels = (Pixel **) malloc (height*sizeof(Pixel *)); + if (!f->pixels) return -1; + f->pixels[0] = (Pixel *) malloc(height*width*sizeof(Pixel)); + if (!f->pixels[0]) { + free((char *)f->pixels); + return -1; + } + for (i = 0; i < height; i++) + f->pixels[i] = f->pixels[0] + i*width; + f->width = width; + f->height = height; + if (f->zbuffer) { + FrameBuffer_zresize(f,width,height); + } + return 0; + } else { + return -1; + } +} + +/* ------------------------------------------------------------------------ + void FrameBuffer_clear(FrameBuffer *f, Pixel color) + + Clears the current FrameBuffer + ------------------------------------------------------------------------ */ + +void FrameBuffer_clear(FrameBuffer *f, Pixel color) { + Pixel *p; + unsigned int i; + p = &f->pixels[0][0]; + + for (i = 0; i < f->width*f->height; i++, p++) + *p = color; +} + +/* ------------------------------------------------------------------------ + void FrameBuffer_plot(FrameBuffer *f, int x1, int y1, Pixel color) + + Plots a point and does a bounds check. + ------------------------------------------------------------------------ */ + +void FrameBuffer_plot(FrameBuffer *f, int x1, int y1, Pixel color) { + + if ((x1 < f->xmin) || (x1 >= f->xmax) || (y1 < f->ymin) || (y1 >= f->ymax)) + return; + f->pixels[y1][x1] = color; + +} + +/* ------------------------------------------------------------------------ + FrameBuffer_horizontal(Framebuffer *f, int xmin, int xmax, int y, Pixel color) + + Draw a horizontal line (clipped) + ------------------------------------------------------------------------ */ + +void FrameBuffer_horizontal(FrameBuffer *f, int xmin, int xmax, int y, Pixel color) { + + Pixel *p; + int i; + + if ((y < f->ymin) || (y >= f->ymax)) return; + if (xmin < f->xmin) xmin = f->xmin; + if (xmax >= f->xmax) xmax = f->xmax - 1; + + p = &f->pixels[y][xmin]; + for (i = xmin; i <= xmax; i++, p++) + *p = color; + +} + +/* ------------------------------------------------------------------------ + FrameBuffer_horizontalinterp(Framebuffer *f, int xmin, int xmax, int y, + Pixel c1, Pixel c2) + + Draw a horizontal line (clipped) with color interpolation. + ------------------------------------------------------------------------ */ + +void FrameBuffer_horizontalinterp(FrameBuffer *f, int xmin, int xmax, int y, + Pixel c1, Pixel c2) { + + Pixel *p; + int i; + double mc; + int x1; + if ((y < f->ymin) || (y >= f->ymax)) return; + + x1 = xmin; + if (xmin < f->xmin) xmin = f->xmin; + if (xmax >= f->xmax) xmax = f->xmax - 1; + if (xmax < f->xmin) return; + if (xmin >= f->xmax) return; + + if (xmin != xmax) + mc = (double)(c2 - c1)/(double) (xmax - xmin); + else + mc = 0.0; + + p = &f->pixels[y][xmin]; + for (i = xmin; i <= xmax; i++, p++) + *p = (Pixel) (mc*(i-x1) + c1); + +} + + +/* ------------------------------------------------------------------------ + FrameBuffer_vertical(Framebuffer *f, int xmin, int xmax, int y, Pixel color) + + Draw a Vertical line (clipped) + ------------------------------------------------------------------------ */ + +void FrameBuffer_vertical(FrameBuffer *f, int ymin, int ymax, int x, Pixel color) { + + Pixel *p; + int i; + + if ((x < f->xmin) || (x >= f->xmax)) return; + if (ymax < f->ymin) return; + if (ymin > f->ymax) return; + if (ymin < f->ymin) ymin = f->ymin; + if (ymax >= f->ymax) ymax = f->ymax - 1; + + p = &f->pixels[ymin][x]; + for (i = 0; i <= (ymax - ymin); i++, p+=f->width) + *p = color; + +} + +/* ------------------------------------------------------------------------ + void FrameBuffer_box(FrameBuffer *f, int x1, int y1, int x2, int y2, Pixel color) + + Makes an outline box. + ------------------------------------------------------------------------ */ + +void FrameBuffer_box(FrameBuffer *f, int x1, int y1, int x2, int y2, Pixel color) { + + int xt, yt; + + /* Make sure points are in correct order */ + + if (x2 < x1) { + xt = x2; + x2 = x1; + x1 = xt; + } + if (y2 < y1) { + yt = y2; + y2 = y1; + y1 = yt; + } + + /* Draw lower edge */ + + FrameBuffer_horizontal(f,x1,x2,y1,color); + + /* Draw upper edge */ + + FrameBuffer_horizontal(f,x1,x2,y2,color); + + /* Draw left side */ + + FrameBuffer_vertical(f,y1,y2,x1,color); + + /* Draw right side */ + + FrameBuffer_vertical(f,y1,y2,x2,color); + +} + +/* ------------------------------------------------------------------------ + void FrameBuffer_solidbox(FrameBuffer *f, int x1, int y1, int x2, int y2, Pixel color) + + Makes an solid box. + ------------------------------------------------------------------------ */ + +void FrameBuffer_solidbox(FrameBuffer *f, int x1, int y1, int x2, int y2, Pixel color) { + + int xt, yt; + + /* Make sure points are in correct order */ + + if (x2 < x1) { + xt = x2; + x2 = x1; + x1 = xt; + } + if (y2 < y1) { + yt = y2; + y2 = y1; + y1 = yt; + } + + /* Now perform some clipping */ + + if (y1 < f->ymin) y1 = f->ymin; + if (y2 >= f->ymax) y2 = f->ymax - 1; + + /* Fill it in using horizontal lines */ + + for (yt = y1; yt <= y2; yt++) + FrameBuffer_horizontal(f,x1,x2,yt,color); + +} + +/* ------------------------------------------------------------------------ + void FrameBuffer_interpbox(FrameBuffer *f, int x1, int y1, int x2, int y2 + Pixel c1, Pixel c2, Pixel c3, Pixel c4) + + Makes a box with interpolated color. Colors are assigned as follows : + (x1,y1) = c1 + (x1,y2) = c2 + (x2,y1) = c3 + (x2,y2) = c4 + ------------------------------------------------------------------------ */ + +void FrameBuffer_interpbox(FrameBuffer *f, int x1, int y1, int x2, int y2, + Pixel c1, Pixel c2, Pixel c3, Pixel c4) { + + int xt, yt; + Pixel ct; + double mc1,mc2; + int ystart; + /* Make sure points are in correct order */ + + if (x2 < x1) { + xt = x2; + x2 = x1; + x1 = xt; + ct = c1; + c1 = c3; + c3 = ct; + ct = c2; + c2 = c4; + c4 = ct; + } + if (y2 < y1) { + yt = y2; + y2 = y1; + y1 = yt; + ct = c1; + c1 = c2; + c2 = ct; + ct = c3; + c3 = c4; + c4 = ct; + } + + /* Now perform some clipping */ + + ystart = y1; + mc1 = (double) (c2 - c1)/(double) (y2 - y1); + mc2 = (double) (c4 - c3)/(double) (y2 - y1); + if (y1 < f->ymin) y1 = f->ymin; + if (y2 >= f->ymax) y2 = f->ymax - 1; + + /* Fill it in using horizontal lines */ + + for (yt = y1; yt <= y2; yt++) + FrameBuffer_horizontalinterp(f,x1,x2,yt,(Pixel) ((mc1*(yt - ystart)) + c1), + (Pixel) ((mc2*(yt-ystart))+c3)); + +} + +/* --------------------------------------------------------------------------- + FrameBuffer_line(FrameBuffer *f, int x1, int y1, int x2, int y2, color) + + Draws a line on the framebuffer using the Bresenham line algorithm. The + line is clipped to fit within the current view window. + ---------------------------------------------------------------------------- */ + +void FrameBuffer_line(FrameBuffer *f, int x1, int y1, int x2, int y2, Pixel c) { + + int dx,dy,dxneg,dyneg, inc1,inc2,di; + int x, y, xpixels, ypixels, xt, yt; + Pixel *p; + double m; + int end1 = 0, end2 = 0; + + /* Need to figure out where in the heck this line is */ + + dx = x2 - x1; + dy = y2 - y1; + + if (dx == 0) { + /* Draw a Vertical Line */ + if (y1 < y2) + FrameBuffer_vertical(f,y1,y2,x1,c); + else + FrameBuffer_vertical(f,y2,y1,x1,c); + return; + } + if (dy == 0) { + /* Draw a Horizontal Line */ + if (x1 < x2) + FrameBuffer_horizontal(f,x1,x2,y1,c); + else + FrameBuffer_horizontal(f,x2,x1,y1,c); + return; + } + + /* Figure out where in the heck these lines are using the + Cohen-Sutherland Line Clipping Scheme. */ + + end1 = ((x1 - f->xmin) < 0) | + (((f->xmax- 1 - x1) < 0) << 1) | + (((y1 - f->ymin) < 0) << 2) | + (((f->ymax-1 - y1) < 0) << 3); + + end2 = ((x2 - f->xmin) < 0) | + (((f->xmax-1 - x2) < 0) << 1) | + (((y2 - f->ymin) < 0) << 2) | + (((f->ymax-1 - y2) < 0) << 3); + + if (end1 & end2) return; /* Nope : Not visible */ + + /* Make sure points have a favorable orientation */ + + if (x1 > x2) { + xt = x1; + x1 = x2; + x2 = xt; + yt = y1; + y1 = y2; + y2 = yt; + } + + /* Clip against the boundaries */ + m = (y2 - y1)/(double) (x2-x1); + if (x1 < f->xmin) { + y1 = (int) ((f->xmin - x1)*m + y1); + x1 = (int) f->xmin; + } + if (x2 >= f->xmax) { + y2 = (int) ((f->xmax -1 -x1)*m + y1); + x2 = (int) (f->xmax - 1); + } + + if (y1 > y2) { + xt = x1; + x1 = x2; + x2 = xt; + yt = y1; + y1 = y2; + y2 = yt; + } + + m = 1/m; + if (y1 < f->ymin) { + x1 = (int) ((f->ymin - y1)*m + x1); + y1 = (int) f->ymin; + } + if (y2 >= f->ymax) { + x2 = (int) ((f->ymax-1-y1)*m + x1); + y2 = (int) (f->ymax-1); + } + + if ((x1 < f->xmin) || (x1 >= f->xmax) || (y1 < f->ymin) || (y1 >= f->ymax) || + (x2 < f->xmin) || (x2 >= f->xmax) || (y2 < f->ymin) || (y2 >= f->ymax)) return; + + dx = x2 - x1; + dy = y2 - y1; + xpixels = f->width; + ypixels = f->height; + + dxneg = (dx < 0) ? 1 : 0; + dyneg = (dy < 0) ? 1 : 0; + + dx = abs(dx); + dy = abs(dy); + if (dx >= dy) { + /* Slope between -1 and 1. */ + if (dxneg) { + x = x1; + y = y1; + x1 = x2; + y1 = y2; + x2 = x; + y2 = y; + dyneg = !dyneg; + } + inc1 = 2*dy; + inc2 = 2*(dy-dx); + di = 2*dy-dx; + + /* Draw a line using x as independent variable */ + + p = &f->pixels[y1][x1]; + x = x1; + while (x <= x2) { + *(p++) = c; + if (di < 0) { + di = di + inc1; + } else { + if (dyneg) { + p = p - xpixels; + di = di + inc2; + } else { + p = p + xpixels; + di = di + inc2; + } + } + x++; + } + } else { + /* Slope < -1 or > 1 */ + if (dyneg) { + x = x1; + y = y1; + x1 = x2; + y1 = y2; + x2 = x; + y2 = y; + dxneg = !dxneg; + } + inc1 = 2*dx; + inc2 = 2*(dx-dy); + di = 2*dx-dy; + + /* Draw a line using y as independent variable */ + + p = &f->pixels[y1][x1]; + y = y1; + while (y <= y2) { + *p = c; + p = p + xpixels; + if (di < 0) { + di = di + inc1; + } else { + if (dxneg) { + p = p - 1; + di = di + inc2; + } else { + p = p + 1; + di = di + inc2; + } + } + y++; + } + } +} + + +/* ------------------------------------------------------------------------- + FrameBuffer_circle(FrameBuffer f, int xc, int yc, int radius, Pixel c) + + Create an outline circle + ------------------------------------------------------------------------- */ + +#define plot_circle(x,y,c) \ + if ((x >= xmin) && (x < xmax) && \ + (y >= ymin) && (y < ymax)) \ + pixels[y][x] = c; + +void FrameBuffer_circle(FrameBuffer *f, int xc, int yc, int radius, Pixel c) { + + int xpixels, ypixels, x, y, p; + int xmin, ymin, xmax, ymax; + Pixel **pixels; + + if (radius <= 0) return; + xpixels = f->width; + ypixels = f->height; + pixels = f->pixels; + xmin = f->xmin; + ymin = f->ymin; + xmax = f->xmax; + ymax = f->ymax; + x = 0; + y = radius; + p = 3-2*radius; + while (x <= y) { + plot_circle(xc+x,yc+y,c); + plot_circle(xc-x,yc+y,c); + plot_circle(xc+x,yc-y,c); + plot_circle(xc-x,yc-y,c); + plot_circle(xc+y,yc+x,c); + plot_circle(xc-y,yc+x,c); + plot_circle(xc+y,yc-x,c); + plot_circle(xc-y,yc-x,c); + if (p < 0) p = p + 4*x + 6; + else { + p = p + 4*(x-y) + 10; + y = y -1; + } + x++; + } +} + + +/* ------------------------------------------------------------------------- + FrameBuffer_solidcircle(FrameBuffer f, int xc, int yc, int radius, Pixel c) + + Create an filled circle + ------------------------------------------------------------------------- */ + + +#define fill_circle(x,y,c) \ + x1 = xc - x; \ + x2 = xc + x; \ + FrameBuffer_horizontal(f,x1,x2,y,c); + +void FrameBuffer_solidcircle(FrameBuffer *f, int xc, int yc, int radius, Pixel c) { + + int xpixels, ypixels, x, y, p; + int x1,x2; + int xmin, ymin, xmax, ymax; + Pixel **pixels; + + if (radius <= 0) return; + xpixels = f->width; + ypixels = f->height; + pixels = f->pixels; + xmin = f->xmin; + ymin = f->ymin; + xmax = f->xmax; + ymax = f->ymax; + x = 0; + y = radius; + p = 3-2*radius; + while (x <= y) { + fill_circle(x,yc+y,c); + fill_circle(x,yc-y,c); + fill_circle(y,yc+x,c); + fill_circle(y,yc-x,c); + if (p < 0) p = p + 4*x + 6; + else { + p = p + 4*(x-y) + 10; + y = y -1; + } + x++; + } +} + +/* ------------------------------------------------------------------------ + void FrameBuffer_setclip(f,xmin,ymin,xmax,ymax) + + Set clipping region for plotting + ------------------------------------------------------------------------ */ + +void FrameBuffer_setclip(FrameBuffer *f, int xmin, int ymin, int xmax, int ymax) { + + if (xmin >= xmax) return; + if (ymin >= ymax) return; + + if (xmin < 0) xmin = 0; + if (ymin < 0) ymin = 0; + if (xmax > (int) f->width) xmax = f->width; + if (ymax > (int) f->height) ymax = f->height; + + f->xmin = xmin; + f->ymin = ymin; + f->xmax = xmax; + f->ymax = ymax; +} + +/* ------------------------------------------------------------------------ + void FrameBuffer_noclip(f) + + Disable clipping region + ------------------------------------------------------------------------ */ + +void FrameBuffer_noclip(FrameBuffer *f) { + f->xmin = 0; + f->ymin = 0; + f->xmax = f->width; + f->ymax = f->height; +} + + +/* ------------------------------------------------------------------------ + FrameBuffer_zresize(FrameBuffer *f, int width, int height) + + This function resizes the framebuffer's zbuffer. If none exist, it + creates a new one. + ------------------------------------------------------------------------ */ + +void FrameBuffer_zresize(FrameBuffer *f, int width, int height) { + int i; + + if (f->zbuffer) { + free((char *)f->zbuffer[0]); + free((char *)f->zbuffer); + } + f->zbuffer = (Zvalue **) malloc(height*sizeof(Zvalue *)); + f->zbuffer[0] = (Zvalue *) malloc(height*width*sizeof(Zvalue)); + for (i = 0; i < height; i++) + f->zbuffer[i] = f->zbuffer[0]+i*width; +} + +/* ------------------------------------------------------------------------ + FrameBuffer_zclear(FrameBuffer *f) + + Clears the z-buffer for a particular frame. Sets all of the z-values to + ZMIN. + ------------------------------------------------------------------------- */ + +void FrameBuffer_zclear(FrameBuffer *f) { + unsigned int i,j; + if (f) { + if (f->zbuffer) { + for (i = 0; i < f->width; i++) + for (j = 0; j < f->height; j++) + f->zbuffer[j][i] = ZMIN; + } + } +} + + + +/* ------------------------------------------------------------------------- + FrameBuffer_solidtriangle(FrameBuffer *f, int tx1, int ty2, + int tx2, int ty2, + int tx3, int ty3, Pixel color) + + This function draws a 2D filled triangle. + + General idea : + 1. Transform the three points into screen coordinates + 2. Order three points vertically on screen. + 3. Check for degenerate cases (where 3 points are colinear). + 4. Fill in the resulting triangle using horizontal lines. + -------------------------------------------------------------------------- */ + +void FrameBuffer_solidtriangle(FrameBuffer *f, int tx1, int ty1, + int tx2, int ty2, + int tx3, int ty3, Pixel color) { + int tempx, tempy; + double m1,m2,m3; + int y; + int ix1, ix2; + + /* Figure out which point has the greatest "y" value */ + + if (ty2 > ty1) { /* Swap points 1 and 2 if 2 is higher */ + tempx = tx1; + tempy = ty1; + tx1 = tx2; + ty1 = ty2; + tx2 = tempx; + ty2 = tempy; + } + if (ty3 > ty1) { /* Swap points 1 and 3 if 3 is higher */ + tempx = tx1; + tempy = ty1; + tx1 = tx3; + ty1 = ty3; + tx3 = tempx; + ty3 = tempy; + } + if (ty3 > ty2) { /* Swap points 2 and 3 if 3 is higher */ + tempx = tx2; + tempy = ty2; + tx2 = tx3; + ty2 = ty3; + tx3 = tempx; + ty3 = tempy; + } + + /* Points are now order so that t_1 is the highest point, t_2 is the + middle point, and t_3 is the lowest point */ + + /* Check for degenerate cases here */ + + if ((ty1 == ty2) && (ty2 == ty3)) { + + /* Points are aligned horizontally. Handle as a special case */ + /* Just draw three lines using the outline color */ + + FrameBuffer_line(f,tx1,ty1,tx2,ty2,color); + FrameBuffer_line(f,tx1,ty1,tx3,ty3,color); + FrameBuffer_line(f,tx2,ty2,tx3,ty3,color); + + } else { + + if (ty2 < ty1) { + /* First process line segments between (x1,y1)-(x2,y2) + And between (x1,y1),(x3,y3) */ + + m1 = (double) (tx2 - tx1)/(double) (ty2 - ty1); + m2 = (double) (tx3 - tx1)/(double) (ty3 - ty1); + + y = ty1; + while (y >= ty2) { + /* Calculate x values from slope */ + ix1 = (int) (m1*(y-ty1)+0.5) + tx1; + ix2 = (int) (m2*(y-ty1)+0.5) + tx1; + if (ix1 > ix2) + FrameBuffer_horizontal(f,ix2,ix1,y,color); + else + FrameBuffer_horizontal(f,ix1,ix2,y,color); + y--; + } + } + if (ty3 < ty2) { + /* Draw lower half of the triangle */ + m2 = (double) (tx3 - tx1)/(double) (ty3 - ty1); + m3 = (double) (tx3 - tx2)/(double)(ty3 - ty2); + y = ty2; + while (y >= ty3) { + ix1 = (int) (m3*(y-ty2)+0.5)+tx2; + ix2 = (int) (m2*(y-ty1)+0.5)+tx1; + if (ix1 > ix2) + FrameBuffer_horizontal(f,ix2,ix1,y,color); + else + FrameBuffer_horizontal(f,ix1,ix2,y,color); + y--; + } + } + } +} + +/* ------------------------------------------------------------------------- + FrameBuffer_interptriangle(FrameBuffer *f, + int tx1, int ty2, Pixel c1, + int tx2, int ty2, Pixel c2, + int tx3, int ty3, Pixel c3) + + This function draws a filled triangle with color + interpolation. + + General idea : + 1. Transform the three points into screen coordinates + 2. Order three points vertically on screen. + 3. Check for degenerate cases (where 3 points are colinear). + 4. Fill in the resulting triangle using horizontal lines. + 5. Colors are interpolated between end points + -------------------------------------------------------------------------- */ + +void FrameBuffer_interptriangle(FrameBuffer *f, + int tx1, int ty1, Pixel c1, + int tx2, int ty2, Pixel c2, + int tx3, int ty3, Pixel c3) { + int tempx, tempy; + double m1,m2,m3; + double mc1,mc2,mc3; + Pixel ic1,ic2,tempc; + int y; + int ix1, ix2; + + /* Figure out which point has the greatest "y" value */ + + if (ty2 > ty1) { /* Swap points 1 and 2 if 2 is higher */ + tempx = tx1; + tempy = ty1; + tempc = c1; + tx1 = tx2; + ty1 = ty2; + c1 = c2; + tx2 = tempx; + ty2 = tempy; + c2 = tempc; + } + if (ty3 > ty1) { /* Swap points 1 and 3 if 3 is higher */ + tempx = tx1; + tempy = ty1; + tempc = c1; + tx1 = tx3; + ty1 = ty3; + c1 = c3; + tx3 = tempx; + ty3 = tempy; + c3 = tempc; + } + if (ty3 > ty2) { /* Swap points 2 and 3 if 3 is higher */ + tempx = tx2; + tempy = ty2; + tempc = c2; + tx2 = tx3; + ty2 = ty3; + c2 = c3; + tx3 = tempx; + ty3 = tempy; + c3 = tempc; + } + + /* Points are now order so that t_1 is the highest point, t_2 is the + middle point, and t_3 is the lowest point */ + + /* Check for degenerate cases here */ + + if ((ty1 == ty2) && (ty2 == ty3)) { + + /* Points are aligned horizontally. Handle as a special case */ + /* Just draw three lines using the outline color */ + + if (tx2 > tx1) + FrameBuffer_horizontalinterp(f,tx1,tx2,ty1,c1,c2); + else + FrameBuffer_horizontalinterp(f,tx2,tx1,ty1,c2,c1); + if (tx3 > tx1) + FrameBuffer_horizontalinterp(f,tx1,tx3,ty1,c1,c3); + else + FrameBuffer_horizontalinterp(f,tx3,tx1,ty1,c3,c1); + if (tx3 > tx2) + FrameBuffer_horizontalinterp(f,tx2,tx3,ty2,c2,c3); + else + FrameBuffer_horizontalinterp(f,tx3,tx2,ty2,c3,c2); + + } else { + + /* First process line segments between (x1,y1)-(x2,y2) + And between (x1,y1),(x3,y3) */ + + if (ty2 < ty1) { + m1 = (double) (tx2 - tx1)/(double) (ty2 - ty1); + m2 = (double) (tx3 - tx1)/(double) (ty3 - ty1); + mc1 = (c2 - c1)/(double) (ty2 - ty1); + mc2 = (c3 - c1)/(double) (ty3 - ty1); + + y = ty1; + while (y >= ty2) { + /* Calculate x values from slope */ + ix1 = (int) (m1*(y-ty1)+0.5) + tx1; + ix2 = (int) (m2*(y-ty1)+0.5) + tx1; + ic1 = (int) (mc1*(y-ty1) + c1); + ic2 = (int) (mc2*(y-ty1) + c1); + if (ix1 > ix2) + FrameBuffer_horizontalinterp(f,ix2,ix1,y,ic2,ic1); + else + FrameBuffer_horizontalinterp(f,ix1,ix2,y,ic1,ic2); + y--; + } + } + if (ty3 < ty2) { + /* Draw lower half of the triangle */ + m2 = (double) (tx3 - tx1)/(double) (ty3 - ty1); + mc2 = (c3 - c1)/(double) (ty3 - ty1); + m3 = (double) (tx3 - tx2)/(double)(ty3 - ty2); + mc3 = (c3 - c2)/(double) (ty3 - ty2); + y = ty2; + while (y >= ty3) { + ix1 = (int) (m3*(y-ty2)+0.5)+tx2; + ix2 = (int) (m2*(y-ty1)+0.5)+tx1; + ic1 = (int) (mc3*(y-ty2)+c2); + ic2 = (int) (mc2*(y-ty1)+c1); + if (ix1 > ix2) + FrameBuffer_horizontalinterp(f,ix2,ix1,y,ic2,ic1); + else + FrameBuffer_horizontalinterp(f,ix1,ix2,y,ic1,ic2); + y--; + } + } + } +} + + diff --git a/Examples/GIFPlot/Lib/gif.c b/Examples/GIFPlot/Lib/gif.c new file mode 100644 index 000000000..7953e5ce9 --- /dev/null +++ b/Examples/GIFPlot/Lib/gif.c @@ -0,0 +1,672 @@ + +/********************************************************************** + * GIFPlot 0.0 + * + * Dave Beazley + * + * Department of Computer Science Theoretical Division (T-11) + * University of Utah Los Alamos National Laboratory + * Salt Lake City, Utah 84112 Los Alamos, New Mexico 87545 + * beazley@cs.utah.edu beazley@lanl.gov + * + * Copyright (c) 1996 + * The Regents of the University of California and the University of Utah + * All Rights Reserved + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that + * (1) The above copyright notice and the following two paragraphs + * appear in all copies of the source code and (2) redistributions + * including binaries reproduces these notices in the supporting + * documentation. Substantial modifications to this software may be + * copyrighted by their authors and need not follow the licensing terms + * described here, provided that the new terms are clearly indicated in + * all files where they apply. + * + * IN NO EVENT SHALL THE AUTHOR, THE UNIVERSITY OF CALIFORNIA, THE + * UNIVERSITY OF UTAH OR DISTRIBUTORS OF THIS SOFTWARE BE LIABLE TO ANY + * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, + * EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + * THE AUTHOR, THE UNIVERSITY OF CALIFORNIA, AND THE UNIVERSITY OF UTAH + * SPECIFICALLY DISCLAIM ANY WARRANTIES,INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND + * THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, + * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + **************************************************************************/ + +/******************************************************************* + * Creates a GIF format file. + * + * Dave Beazley (T-11) + * August 11, 1995 + * + * Rather than writing directly to files, this module fills out + * output buffer. + * + * Note : To save memory, this routine uses approximately 50K of the + * output buffer as temporary storage (for hash tables and compression codes). + * The remainder of the output buffer is used to store the final image. + * This feature allows GIF images to be created with no additional + * memory overhead. + * + * -- Revision History + * $Log$ + * Revision 1.2 2003/09/01 16:23:31 beazley + * Restored the 'mojo'. + * + * Revision 1.2 1996/09/25 22:39:30 dmb + * Fixed prototypes and use of void pointers for compatibility with the Cray T3D + * + * Revision 1.1 1996/09/10 17:44:00 dmb + * Initial revision + * + * Revision 1.2 1995/08/31 14:46:07 beazley + * Minor changes to support comments and a few bug fixes. + * + * + ******************************************************************/ + + +/* + * xvgifwr.c - handles writing of GIF files. based on flgife.c and + * flgifc.c from the FBM Library, by Michael Maudlin + * + * Contains: + * WriteGIF(fp, pic, ptype, w, h, rmap, gmap, bmap, numcols, colorstyle, + * comment) + * + * Note: slightly brain-damaged, in that it'll only write non-interlaced + * GIF files (in the interests of speed, or something) + * + */ + + + +/***************************************************************** + * Portions of this code Copyright (C) 1989 by Michael Mauldin. + * Permission is granted to use this file in whole or in + * part for any purpose, educational, recreational or commercial, + * provided that this copyright notice is retained unchanged. + * This software is available to all free of charge by anonymous + * FTP and in the UUNET archives. + * + * + * Authors: Michael Mauldin (mlm@cs.cmu.edu) + * David Rowley (mgardi@watdcsu.waterloo.edu) + * + * Based on: compress.c - File compression ala IEEE Computer, June 1984. + * + * Spencer W. Thomas (decvax!harpo!utah-cs!utah-gr!thomas) + * Jim McKie (decvax!mcvax!jim) + * Steve Davies (decvax!vax135!petsd!peora!srd) + * Ken Turkowski (decvax!decwrl!turtlevax!ken) + * James A. Woods (decvax!ihnp4!ames!jaw) + * Joe Orost (decvax!vax135!petsd!joe) + *****************************************************************/ + +#include "gifplot.h" +#include +typedef long int count_int; +typedef unsigned char byte; + +static int gif_error; +static unsigned char *op; +static int Width, Height; +static int curx, cury; +static int Interlace; + +static void putgifword(int); +static void compress(int, byte **, int); +static void output_GIF(int); +static void cl_block(void); +static void cl_hash(count_int); +static void char_init(void); +static void char_out(int); +static void flush_char(void); +static void *OutBuffer; +static int OutBufSize; +static FrameBuffer *GIF_frame; + +static unsigned char pc2nc[256],r1[256],g1[256],b1[256]; + +/*************************************************************/ +int FrameBuffer_makeGIF(FrameBuffer *f, ColorMap *c, void *outbuffer, unsigned int outbufsize) +{ + int RWidth, RHeight; + int LeftOfs, TopOfs; + int ColorMapSize, InitCodeSize, Background, BitsPerPixel; + int i,j,nc; + char *rmap, *gmap, *bmap; + char *cmap; + int count; + + Interlace = 0; + Background = 0; + OutBuffer = outbuffer; + OutBufSize = outbufsize; + GIF_frame = f; + cmap = (char *) c->cmap; + + op = (unsigned char *) outbuffer; + gif_error = 0; + for (i=0; i<256; i++) { pc2nc[i] = r1[i] = g1[i] = b1[i] = 0; } + + /* compute number of unique colors */ + nc = 0; + rmap = &cmap[0]; + gmap = &cmap[256]; + bmap = &cmap[512]; + + for (i=0; i<256; i++) { + /* see if color #i is already used */ + for (j=0; j= nc) break; + + BitsPerPixel = i; + + ColorMapSize = 1 << BitsPerPixel; + + RWidth = Width = f->width; + RHeight = Height = f->height; + LeftOfs = TopOfs = 0; + + if (BitsPerPixel <= 1) InitCodeSize = 2; + else InitCodeSize = BitsPerPixel; + + curx = 0; + cury = f->height - 1; + + strcpy((char *) op,"GIF89a"); /* Put in GIF magic number */ + op+=6; + putgifword(RWidth); /* screen descriptor */ + putgifword(RHeight); + + i = 0x80; /* Yes, there is a color map */ + i |= (8-1)<<4; /* OR in the color resolution (hardwired 8) */ + i |= (BitsPerPixel - 1); /* OR in the # of bits per pixel */ + *(op++) = i; + *(op++) = Background; /* background color */ + *(op++) = 0; + for (i=0; ipixels, f->width*f->height); + + *(op++) = 0; + *(op++) = ';'; + + count = (op - (unsigned char *) OutBuffer); + if (gif_error) return -1; + else return count; +} + +/******************************/ +static void putgifword(w) +int w; +{ + /* writes a 16-bit integer in GIF order (LSB first) */ + *(op++) = w & 0xff; + *(op++) = (w>>8)&0xff; +} + +/***********************************************************************/ + + +static unsigned long cur_accum = 0; +static int cur_bits = 0; + + + + +#define GP_BITS 12 /* BITS was already defined on some systems */ + +#define HSIZE 5003 /* 80% occupancy */ + +typedef unsigned char char_type; + +static int n_bits; /* number of bits/code */ +static int maxbits = GP_BITS; /* user settable max # bits/code */ +static int maxcode; /* maximum code, given n_bits */ +static int maxmaxcode = 1 << GP_BITS; /* NEVER generate this */ + +#define MAXCODE(n_bits) ( (1 << (n_bits)) - 1) + +static count_int *htab; +static unsigned short *codetab; +static int GIFOutBufSize; + +/* static count_int htab [HSIZE]; +static unsigned short codetab [HSIZE]; */ + +#define HashTabOf(i) htab[i] +#define CodeTabOf(i) codetab[i] + +static int hsize = HSIZE; /* for dynamic table sizing */ + +/* + * To save much memory, we overlay the table used by compress() with those + * used by decompress(). The tab_prefix table is the same size and type + * as the codetab. The tab_suffix table needs 2**BITS characters. We + * get this from the beginning of htab. The output stack uses the rest + * of htab, and contains characters. There is plenty of room for any + * possible stack (stack used to be 8000 characters). + */ + +#define tab_prefixof(i) CodeTabOf(i) +#define tab_suffixof(i) ((char_type *)(htab))[i] +#define de_stack ((char_type *)&tab_suffixof(1<= GIF_frame->width) { + curx = 0; + cury--; + } + len--; + + hshift = 0; + for ( fcode = (long) hsize; fcode < 65536L; fcode *= 2L ) + hshift++; + hshift = 8 - hshift; /* set hash code range bound */ + + hsize_reg = hsize; + cl_hash( (count_int) hsize_reg); /* clear hash table */ + + output_GIF(ClearCode); + while (len) { + c = pc2nc[data[cury][curx]]; + curx++; + if (curx >= GIF_frame->width) { + curx = 0; + cury--; + } + len--; + + fcode = (long) ( ( (long) c << maxbits) + ent); + i = (((int) c << hshift) ^ ent); /* xor hashing */ + + if ( HashTabOf (i) == fcode ) { + ent = CodeTabOf (i); + continue; + } + + if ( (long)HashTabOf (i) < 0 ) /* empty slot */ + goto nomatch; + + disp = hsize_reg - i; /* secondary hash (after G. Knott) */ + if ( i == 0 ) + disp = 1; + +probe: + if ( (i -= disp) < 0 ) + i += hsize_reg; + + if ( HashTabOf (i) == fcode ) { + ent = CodeTabOf (i); + continue; + } + + if ( (long)HashTabOf (i) >= 0 ) + goto probe; + +nomatch: + output_GIF(ent); + out_count++; + ent = c; + + if ( free_ent < maxmaxcode ) { + CodeTabOf (i) = free_ent++; /* code -> hashtable */ + HashTabOf (i) = fcode; + } + else + cl_block(); + + } + /* Put out the final code */ + output_GIF(ent); + output_GIF(EOFCode); +} + + +/***************************************************************** + * TAG( output_GIF ) + * + * Output the given code. + * Inputs: + * code: A n_bits-bit integer. If == -1, then EOF. This assumes + * that n_bits =< (long)wordsize - 1. + * Outputs: + * Outputs code to the file. + * Assumptions: + * Chars are 8 bits long. + * Algorithm: + * Maintain a BITS character long buffer (so that 8 codes will + * fit in it exactly). Use the VAX insv instruction to insert each + * code in turn. When the buffer fills up empty it and start over. + */ + +static +unsigned long masks[] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000F, + 0x001F, 0x003F, 0x007F, 0x00FF, + 0x01FF, 0x03FF, 0x07FF, 0x0FFF, + 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF }; + +static void output_GIF(code) +int code; +{ + cur_accum &= masks[cur_bits]; + + if (cur_bits > 0) + cur_accum |= ((long)code << cur_bits); + else + cur_accum = code; + + cur_bits += n_bits; + + while( cur_bits >= 8 ) { + char_out( (int) (cur_accum & 0xff) ); + cur_accum >>= 8; + cur_bits -= 8; + } + + /* + * If the next entry is going to be too big for the code size, + * then increase it, if possible. + */ + + if (free_ent > maxcode || clear_flg) { + + if( clear_flg ) { + maxcode = MAXCODE (n_bits = g_init_bits); + clear_flg = 0; + } + else { + n_bits++; + if ( n_bits == maxbits ) + maxcode = maxmaxcode; + else + maxcode = MAXCODE(n_bits); + } + } + + if( code == EOFCode ) { + /* At EOF, write the rest of the buffer */ + while( cur_bits > 0 ) { + char_out( (int)(cur_accum & 0xff) ); + cur_accum >>= 8; + cur_bits -= 8; + } + + flush_char(); + } +} + + +/********************************/ +static void cl_block () /* table clear for block compress */ +{ + /* Clear out the hash table */ + + cl_hash ( (count_int) hsize ); + free_ent = ClearCode + 2; + clear_flg = 1; + + output_GIF(ClearCode); +} + + +/********************************/ +static void cl_hash(hsize) /* reset code table */ +register count_int hsize; +{ + register count_int *htab_p = htab+hsize; + register long i; + register long m1 = -1; + + i = hsize - 16; + do { /* might use Sys V memset(3) here */ + *(htab_p-16) = m1; + *(htab_p-15) = m1; + *(htab_p-14) = m1; + *(htab_p-13) = m1; + *(htab_p-12) = m1; + *(htab_p-11) = m1; + *(htab_p-10) = m1; + *(htab_p-9) = m1; + *(htab_p-8) = m1; + *(htab_p-7) = m1; + *(htab_p-6) = m1; + *(htab_p-5) = m1; + *(htab_p-4) = m1; + *(htab_p-3) = m1; + *(htab_p-2) = m1; + *(htab_p-1) = m1; + htab_p -= 16; + } while ((i -= 16) >= 0); + + for ( i += 16; i > 0; i-- ) + *--htab_p = m1; +} + + +/****************************************************************************** + * + * GIF Specific routines + * + ******************************************************************************/ + +/* + * Number of characters so far in this 'packet' + */ +static int a_count; + +/* + * Set up the 'byte output' routine + */ +static void char_init() +{ + a_count = 0; +} + +/* + * Define the storage for the packet accumulator + */ +static char accum[ 256 ]; + +/* + * Add a character to the end of the current packet, and if it is 254 + * characters, flush the packet to disk. + */ +static void char_out(c) +int c; +{ + accum[ a_count++ ] = c; + if( a_count >= 254 ) + flush_char(); +} + +/* + * Flush the packet to disk, and reset the accumulator + */ +static void flush_char() +{ + if (gif_error) return; + if( a_count > 0 ) { + *(op++) = a_count; + memcpy(op,accum,a_count); + op+=a_count; + a_count = 0; + + if (op > (unsigned char *) ((char *) OutBuffer + (GIFOutBufSize - 2048))) { + gif_error = 1; + } + } +} + + +/* ---------------------------------------------------------------------- + int FrameBuffer_writeGIF(char *filename) + + Write a GIF file to filename + ----------------------------------------------------------------------- */ + +int FrameBuffer_writeGIF(FrameBuffer *f, ColorMap *c, char *filename) { + + FILE *file; + void *buffer; + int nbytes; + int bufsize; + + file = fopen(filename,"wb"); + if (file == NULL) return -1; + + bufsize = (f->width*f->height*3)/2; + buffer = (void *) malloc(bufsize); + nbytes = FrameBuffer_makeGIF(f,c,buffer,bufsize); + if (nbytes == -1) { + free(buffer); + fclose(file); + return -1; + } + if (fwrite(buffer,nbytes,1,file) != 1) { + free(buffer); + fclose(file); + return -1; + } + fclose(file); + free(buffer); + return 0; +} + + + + + diff --git a/Examples/GIFPlot/Lib/matrix.c b/Examples/GIFPlot/Lib/matrix.c new file mode 100644 index 000000000..ef0cf3aab --- /dev/null +++ b/Examples/GIFPlot/Lib/matrix.c @@ -0,0 +1,343 @@ +/* ----------------------------------------------------------------------------- + * matrix.c + * + * Some 4x4 matrix operations + * + * Author(s) : David Beazley (beazley@cs.uchicago.edu) + * Copyright (C) 1995-1996 + * + * See the file LICENSE for information on usage and redistribution. + * ----------------------------------------------------------------------------- */ + +#define MATRIX +#include "gifplot.h" +#include + +/* ------------------------------------------------------------------------ + Matrix new_Matrix() + + Create a new 4x4 matrix. + ------------------------------------------------------------------------ */ +Matrix +new_Matrix() { + Matrix m; + m = (Matrix) malloc(16*sizeof(double)); + return m; +} + +/* ------------------------------------------------------------------------ + delete_Matrix(Matrix *m); + + Destroy a matrix + ------------------------------------------------------------------------ */ + +void +delete_Matrix(Matrix m) { + if (m) + free((char *) m); +} + +/* ------------------------------------------------------------------------ + Matrix Matrix_copy(Matrix a) + + Makes a copy of matrix a and returns it. + ------------------------------------------------------------------------ */ + +Matrix Matrix_copy(Matrix a) { + int i; + Matrix r = 0; + if (a) { + r = new_Matrix(); + if (r) { + for (i = 0; i < 16; i++) + r[i] = a[i]; + } + } + return r; +} + +/* ------------------------------------------------------------------------ + Matrix_multiply(Matrix a, Matrix b, Matrix c) + + Multiplies a*b = c + c may be one of the source matrices + ------------------------------------------------------------------------ */ +void +Matrix_multiply(Matrix a, Matrix b, Matrix c) { + double temp[16]; + int i,j,k; + + for (i =0; i < 4; i++) + for (j = 0; j < 4; j++) { + temp[i*4+j] = 0.0; + for (k = 0; k < 4; k++) + temp[i*4+j] += a[i*4+k]*b[k*4+j]; + } + for (i = 0; i < 16; i++) + c[i] = temp[i]; +} + +/* ------------------------------------------------------------------------ + Matrix_identity(Matrix a) + + Puts an identity matrix in matrix a + ------------------------------------------------------------------------ */ + +void +Matrix_identity(Matrix a) { + int i; + for (i = 0; i < 16; i++) a[i] = 0; + a[0] = 1; + a[5] = 1; + a[10] = 1; + a[15] = 1; +} + +/* ------------------------------------------------------------------------ + Matrix_zero(Matrix a) + + Puts a zero matrix in matrix a + ------------------------------------------------------------------------ */ +void +Matrix_zero(Matrix a) { + int i; + for (i = 0; i < 16; i++) a[i] = 0; +} + +/* ------------------------------------------------------------------------ + Matrix_transpose(Matrix a, Matrix result) + + Transposes matrix a and puts it in result. + ------------------------------------------------------------------------ */ +void +Matrix_transpose(Matrix a, Matrix result) { + double temp[16]; + int i,j; + + for (i = 0; i < 4; i++) + for (j = 0; j < 4; j++) + temp[4*i+j] = a[4*j+i]; + + for (i = 0; i < 16; i++) + result[i] = temp[i]; +} + + +/* ------------------------------------------------------------------------ + Matrix_gauss(Matrix a, Matrix b) + + Solves ax=b for x, using Gaussian elimination. Destroys a. + Really only used for calculating inverses of 4x4 transformation + matrices. + ------------------------------------------------------------------------ */ + +void Matrix_gauss(Matrix a, Matrix b) { + int ipiv[4], indxr[4], indxc[4]; + int i,j,k,l,ll; + int irow=0, icol=0; + double big, pivinv; + double dum; + for (j = 0; j < 4; j++) + ipiv[j] = 0; + for (i = 0; i < 4; i++) { + big = 0; + for (j = 0; j < 4; j++) { + if (ipiv[j] != 1) { + for (k = 0; k < 4; k++) { + if (ipiv[k] == 0) { + if (fabs(a[4*j+k]) >= big) { + big = fabs(a[4*j+k]); + irow = j; + icol = k; + } + } else if (ipiv[k] > 1) + return; /* Singular matrix */ + } + } + } + ipiv[icol] = ipiv[icol]+1; + if (irow != icol) { + for (l = 0; l < 4; l++) { + dum = a[4*irow+l]; + a[4*irow+l] = a[4*icol+l]; + a[4*icol+l] = dum; + } + for (l = 0; l < 4; l++) { + dum = b[4*irow+l]; + b[4*irow+l] = b[4*icol+l]; + b[4*icol+l] = dum; + } + } + indxr[i] = irow; + indxc[i] = icol; + if (a[4*icol+icol] == 0) return; + pivinv = 1.0/a[4*icol+icol]; + a[4*icol+icol] = 1.0; + for (l = 0; l < 4; l++) + a[4*icol+l] = a[4*icol+l]*pivinv; + for (l = 0; l < 4; l++) + b[4*icol+l] = b[4*icol+l]*pivinv; + for (ll = 0; ll < 4; ll++) { + if (ll != icol) { + dum = a[4*ll+icol]; + a[4*ll+icol] = 0; + for (l = 0; l < 4; l++) + a[4*ll+l] = a[4*ll+l] - a[4*icol+l]*dum; + for (l = 0; l < 4; l++) + b[4*ll+l] = b[4*ll+l] - b[4*icol+l]*dum; + } + } + } + for (l = 3; l >= 0; l--) { + if (indxr[l] != indxc[l]) { + for (k = 0; k < 4; k++) { + dum = a[4*k+indxr[l]]; + a[4*k+indxr[l]] = a[4*k+indxc[l]]; + a[4*k+indxc[l]] = dum; + } + } + } +} + +/* ------------------------------------------------------------------------ + Matrix_invert(Matrix a, Matrix inva) + + Inverts Matrix a and places the result in inva. + Relies on the Gaussian Elimination code above. (See Numerical recipes). + ------------------------------------------------------------------------ */ +void +Matrix_invert(Matrix a, Matrix inva) { + + double temp[16]; + int i; + + for (i = 0; i < 16; i++) + temp[i] = a[i]; + Matrix_identity(inva); + Matrix_gauss(temp,inva); +} + +/* ------------------------------------------------------------------------ + Matrix_transform(Matrix a, GL_Vector *r, GL_Vector *t) + + Transform a vector. a*r ----> t + ------------------------------------------------------------------------ */ + +void Matrix_transform(Matrix a, GL_Vector *r, GL_Vector *t) { + + double rx, ry, rz, rw; + + rx = r->x; + ry = r->y; + rz = r->z; + rw = r->w; + t->x = a[0]*rx + a[1]*ry + a[2]*rz + a[3]*rw; + t->y = a[4]*rx + a[5]*ry + a[6]*rz + a[7]*rw; + t->z = a[8]*rx + a[9]*ry + a[10]*rz + a[11]*rw; + t->w = a[12]*rx + a[13]*ry + a[14]*rz + a[15]*rw; +} + +/* ------------------------------------------------------------------------ + Matrix_transform4(Matrix a, double x, double y, double z, double w, GL_Vector *t) + + Transform a vector from a point specified as 4 doubles + ------------------------------------------------------------------------ */ + +void Matrix_transform4(Matrix a, double rx, double ry, double rz, double rw, + GL_Vector *t) { + + t->x = a[0]*rx + a[1]*ry + a[2]*rz + a[3]*rw; + t->y = a[4]*rx + a[5]*ry + a[6]*rz + a[7]*rw; + t->z = a[8]*rx + a[9]*ry + a[10]*rz + a[11]*rw; + t->w = a[12]*rx + a[13]*ry + a[14]*rz + a[15]*rw; +} + +/* --------------------------------------------------------------------- + Matrix_translate(Matrix a, double tx, double ty, double tz) + + Put a translation matrix in Matrix a + ---------------------------------------------------------------------- */ + +void Matrix_translate(Matrix a, double tx, double ty, double tz) { + Matrix_identity(a); + a[3] = tx; + a[7] = ty; + a[11] = tz; + a[15] = 1; +} + +/* ----------------------------------------------------------------------- + Matrix_rotatex(Matrix a, double deg) + + Produce an x-rotation matrix for given angle in degrees. + ----------------------------------------------------------------------- */ +void +Matrix_rotatex(Matrix a, double deg) { + double r; + + r = 3.1415926*deg/180.0; + Matrix_zero(a); + a[0] = 1.0; + a[5] = cos(r); + a[6] = -sin(r); + a[9] = sin(r); + a[10] = cos(r); + a[15] = 1.0; +} + +/* ----------------------------------------------------------------------- + Matrix_rotatey(Matrix a, double deg) + + Produce an y-rotation matrix for given angle in degrees. + ----------------------------------------------------------------------- */ +void +Matrix_rotatey(Matrix a, double deg) { + double r; + + r = 3.1415926*deg/180.0; + Matrix_zero(a); + a[0] = cos(r); + a[2] = sin(r); + a[5] = 1.0; + a[8] = -sin(r); + a[10] = cos(r); + a[15] = 1; + +} +/* ----------------------------------------------------------------------- + Matrix_RotateZ(Matrix a, double deg) + + Produce an z-rotation matrix for given angle in degrees. + ----------------------------------------------------------------------- */ +void +Matrix_rotatez(Matrix a, double deg) { + double r; + + r = 3.1415926*deg/180.0; + Matrix_zero(a); + a[0] = cos(r); + a[1] = -sin(r); + a[4] = sin(r); + a[5] = cos(r); + a[10] = 1.0; + a[15] = 1.0; +} + + +/* A debugging routine */ + +void Matrix_set(Matrix a, int i, int j, double val) { + a[4*j+i] = val; +} + +void Matrix_print(Matrix a) { + int i,j; + for (i = 0; i < 4; i++) { + for (j = 0; j < 4; j++) { + fprintf(stdout,"%10f ",a[4*i+j]); + } + fprintf(stdout,"\n"); + } + fprintf(stdout,"\n"); +} + diff --git a/Examples/GIFPlot/Lib/pixmap.c b/Examples/GIFPlot/Lib/pixmap.c new file mode 100644 index 000000000..a55cf041f --- /dev/null +++ b/Examples/GIFPlot/Lib/pixmap.c @@ -0,0 +1,159 @@ +/* ----------------------------------------------------------------------------- + * pixmap.c + * + * Pixel maps (i.e., bitmaps) + * + * Author(s) : David Beazley (beazley@cs.uchicago.edu) + * Copyright (C) 1995-1996 + * + * See the file LICENSE for information on usage and redistribution. + * ----------------------------------------------------------------------------- */ + +#define PIXMAP +#include "gifplot.h" + +/* ----------------------------------------------------------------------- + PixMap *new_PixMap(int width, int height, int centerx, int centery) + + Create a new pixmap of given size + ----------------------------------------------------------------------- */ +PixMap *new_PixMap(int width, int height, int centerx, int centery) { + PixMap *pm; + if ((width > 0) && (height > 0)) { + pm = (PixMap *) malloc(sizeof(PixMap)); + pm->width = width; + pm->height = height; + pm->centerx = centerx; + pm->centery = centery; + pm->map = (int *) malloc(height*width*sizeof(int)); + return pm; + } + return (PixMap *) 0; +} + +/* -------------------------------------------------------------------------- + void delete_PixMap(PixMap *pm) + + Destroy a pixmap + -------------------------------------------------------------------------- */ + +void delete_PixMap(PixMap *pm) { + if (pm) { + free((char *) pm->map); + free((char *) pm); + } +} + +/* --------------------------------------------------------------------------- + void PixMap_set(PixMap *pm, int x, int y, int pix) + + Set a pixel in the bitmap + --------------------------------------------------------------------------- */ +void +PixMap_set(PixMap *pm, int x, int y, int pix) { + if ((x < 0) || (x>=pm->width)) return; + if ((y < 0) || (y>=pm->height)) return; + + pm->map[pm->width*y + x] = pix; +} + +/* ----------------------------------------------------------------------------- + void FrameBuffer_drawpixmap(FrameBuffer *f, PixMap *pm, int x, int y, int fgcolor, int bgcolor) + + Draw a pixmap onto the framebuffer. This is somewhat optimized for speed. + ------------------------------------------------------------------------------ */ + +void +FrameBuffer_drawpixmap(FrameBuffer *f, PixMap *pm, int x, int y, int fgcolor, int bgcolor) { + + int startx, starty; /* Starting location on framebuffer */ + int startpixx = 0, startpixy = 0; /* Starting location in pixmap */ + int endx, endy; /* Ending location on framebuffer */ + int i,j, px, py; + int c; + + startx = x - pm->centerx; + starty = y + pm->centery; + endx = startx + pm->width; + endy = starty - pm->height; + + /* Figure out if we need to clip */ + + if (startx < f->xmin) { + startpixx = f->xmin - startx; + startx = f->xmin; + } + if (starty >= f->ymax) { + startpixy = starty - f->ymax; + starty = f->ymax-1; + } + if (endx >= f->xmax) { + endx = f->xmax-1; + } + if (endy < f->ymin) { + endy = f->ymin; + } + py = startpixy; + for (j = starty; j >= endy; j--) { + px = startpixx; + for (i = startx; i < endx; i++) { + c = pm->map[py*pm->width + px]; + switch (c) { + case GIFPLOT_FOREGROUND: + f->pixels[j][i] = fgcolor; + break; + case GIFPLOT_BACKGROUND: + f->pixels[j][i] = bgcolor; + break; + default: + break; + } + px++; + } + py++; + } +} + +/************************************************************************** + * Some common PixMaps (for plotting) + * + **************************************************************************/ + +int _SQUARE_MAP[] = { + 0,1,1,1,1,1,1,1, + 0,1,1,1,1,1,1,1, + 0,1,1,1,1,1,1,1, + 0,1,1,1,1,1,1,1, + 0,1,1,1,1,1,1,1, + 0,1,1,1,1,1,1,1, + 0,1,1,1,1,1,1,1, + 0,0,0,0,0,0,0,0 }; + +PixMap PixMap_SQUARE = { 8,8,4,4, _SQUARE_MAP}; + +int _TRIANGLE_MAP[] = { + 0,0,0,1,0,0,0,0, + 0,0,0,1,0,0,0,0, + 0,0,1,1,1,0,0,0, + 0,0,1,1,1,0,0,0, + 0,1,1,1,1,1,0,0, + 0,1,1,1,1,1,0,0, + 1,1,1,1,1,1,1,0, + 0,0,0,0,0,0,0,0 }; + +PixMap PixMap_TRIANGLE = { 8,8,4,4,_TRIANGLE_MAP}; + +int _CROSS_MAP[] = { + 0,0,0,1,0,0,0,0, + 0,0,0,1,0,0,0,0, + 0,0,0,1,0,0,0,0, + 1,1,1,1,1,1,1,0, + 0,0,0,1,0,0,0,0, + 0,0,0,1,0,0,0,0, + 0,0,0,1,0,0,0,0, + 0,0,0,0,0,0,0,0 }; + +PixMap PixMap_CROSS = { 8,8,4,4,_CROSS_MAP}; + + + diff --git a/Examples/GIFPlot/Lib/plot2d.c b/Examples/GIFPlot/Lib/plot2d.c new file mode 100644 index 000000000..e78107bf1 --- /dev/null +++ b/Examples/GIFPlot/Lib/plot2d.c @@ -0,0 +1,445 @@ +/* ----------------------------------------------------------------------------- + * plot2d.c + * + * 2-Dimensional plotting + * + * Author(s) : David Beazley (beazley@cs.uchicago.edu) + * Copyright (C) 1995-1996 + * + * See the file LICENSE for information on usage and redistribution. + * ----------------------------------------------------------------------------- */ + +#define PLOT2D + +#include "gifplot.h" + +/* ------------------------------------------------------------------------ + Plot2D *new_Plot2D(FrameBuffer *frame, xmin, ymin, xmax, ymax) + + Create a new 2D plot with given minimum and maximum coordinates. + ------------------------------------------------------------------------ */ +Plot2D *new_Plot2D(FrameBuffer *frame,double xmin,double ymin,double xmax,double ymax) { + Plot2D *p2; + if (frame) { + if (xmax <= xmin) return (Plot2D *) 0; + if (ymax <= ymin) return (Plot2D *) 0; + p2 = (Plot2D *) malloc(sizeof(Plot2D)); + p2->frame = frame; + p2->xmin = xmin; + p2->ymin = ymin; + p2->xmax = xmax; + p2->ymax = ymax; + p2->view_xmin = 0; + p2->view_xmax = frame->width; + p2->view_ymin = 0; + p2->view_ymax = frame->height; + p2->xscale = LINEAR; + p2->yscale = LINEAR; + p2->dx = (p2->view_xmax - p2->view_xmin)/(p2->xmax - p2->xmin); + p2->dy = (p2->view_ymax - p2->view_ymin)/(p2->ymax - p2->ymin); + return p2; + } + return (Plot2D *) 0; +} + +/* ---------------------------------------------------------------------------- + delete_Plot2D(Plot2D *p2) + + Delete a 2D plot + ---------------------------------------------------------------------------- */ +void +delete_Plot2D(Plot2D *p2) { + if (p2) + free((char *) p2); +} + +/* ----------------------------------------------------------------------------- + Plot2D *Plot2D_copy(Plot2D *p2) + + Makes a copy of the Plot2D data structure. + ----------------------------------------------------------------------------- */ + +Plot2D *Plot2D_copy(Plot2D *p2) { + Plot2D *c2; + if (p2) { + c2 = (Plot2D *) malloc(sizeof(Plot2D)); + if (c2) { + c2->frame = p2->frame; + c2->view_xmin = p2->view_xmin; + c2->view_ymin = p2->view_ymin; + c2->view_xmax = p2->view_xmax; + c2->view_ymax = p2->view_ymax; + c2->xmin = p2->xmin; + c2->ymin = p2->ymin; + c2->xmax = p2->xmax; + c2->ymax = p2->ymax; + c2->xscale = p2->xscale; + c2->yscale = p2->yscale; + c2->dx = p2->dx; + c2->dy = p2->dy; + } + return c2; + } else { + return (Plot2D *) 0; + } +} + +/* ----------------------------------------------------------------------------- + Plot2D_clear(Plot2D *p2, Pixel c) + + Clear the region assigned to this plot to the given color. + -------------------------------------------------------------------------- */ + +void Plot2D_clear(Plot2D *p2, Pixel c) { + int i,j; + for (i = p2->view_xmin; i < p2->view_xmax; i++) + for (j = p2->view_ymin; j < p2->view_ymax; j++) { + p2->frame->pixels[j][i] = c; + } +} + +/* ------------------------------------------------------------------------------ + Plot2D_setview + + Sets the plot region on the framebuffer + ------------------------------------------------------------------------------ */ + +void +Plot2D_setview(Plot2D *p2, int vxmin, int vymin, int vxmax, int vymax) { + if (p2) { + p2->view_xmin = vxmin; + p2->view_ymin = vymin; + p2->view_xmax = vxmax; + p2->view_ymax = vymax; + p2->dx = (p2->view_xmax - p2->view_xmin)/(p2->xmax - p2->xmin); + p2->dy = (p2->view_ymax - p2->view_ymin)/(p2->ymax - p2->ymin); + FrameBuffer_setclip(p2->frame,vxmin,vymin,vxmax,vymax); + } +} + +/* ------------------------------------------------------------------------------- + Plot2D_setrange(Plot2D *p2, double xmin, double ymin, double xmax, double ymax) + + Sets the plotting range. + ------------------------------------------------------------------------------- */ + +void +Plot2D_setrange(Plot2D *p2, double xmin, double ymin, double xmax, double ymax) { + if (p2) { + p2->xmin = xmin; + p2->ymin = ymin; + p2->xmax = xmax; + p2->ymax = ymax; + p2->dx = (p2->view_xmax - p2->view_xmin)/(p2->xmax - p2->xmin); + p2->dy = (p2->view_ymax - p2->view_ymin)/(p2->ymax - p2->ymin); + } +} + +/* ------------------------------------------------------------------------------- + Plot2D_setscale(Plot2D *p2, int xscale, int yscale) + + Sets the plotting scaling method + ------------------------------------------------------------------------------- */ + +void +Plot2D_setscale(Plot2D *p2, int xscale, int yscale) { + if (p2) { + p2->xscale = xscale; + p2->yscale = yscale; + } +} + +/* ---------------------------------------------------------------------------- + Plot2D_transform(Plot2D *p2, double x, double y, int *px, int *py) + + Transforms x,y into screen coordinates px and py. Result is returned + in px and py. Rounds to the nearest pixel instead of truncating. + ----------------------------------------------------------------------------- */ + +void +Plot2D_transform(Plot2D *p2, double x, double y, int *px, int *py) { + if (p2) { + *px = p2->view_xmin + (int) (p2->dx*(x-p2->xmin) + 0.5); + *py = p2->view_ymin + (int) (p2->dy*(y-p2->ymin) + 0.5); + } +} + +/* ------------------------------------------------------------------------------- + Plot2D_plot(Plot2D *p2, double x, double y, Pixel color) + + Plot a 2D Point of a given color + ------------------------------------------------------------------------------- */ +void +Plot2D_plot(Plot2D *p2, double x, double y, Pixel color) { + int px, py; + + Plot2D_transform(p2,x,y,&px,&py); + FrameBuffer_plot(p2->frame, px, py, color); +} + +/* ------------------------------------------------------------------------------- + Plot2D_box(Plot2D *p2, double x1, double y1, double x2, double y2, Pixel Color) + + Plot an outline box on the 2D plot + ------------------------------------------------------------------------------- */ +void +Plot2D_box(Plot2D *p2, double x1, double y1,double x2, double y2, Pixel color) { + int ix1, ix2,iy1, iy2; + + Plot2D_transform(p2,x1,y1,&ix1,&iy1); + Plot2D_transform(p2,x2,y2,&ix2,&iy2); + FrameBuffer_box(p2->frame,ix1,iy1,ix2,iy2,color); +} + +/* ------------------------------------------------------------------------------- + Plot2D_solidbox(Plot2D *p2, double x1, double y1, double x2, double y2, Pixel Color) + + Plot a solid box box on the 2D plot + ------------------------------------------------------------------------------- */ +void +Plot2D_solidbox(Plot2D *p2, double x1, double y1,double x2, double y2, Pixel color) { + int ix1, ix2,iy1, iy2; + + Plot2D_transform(p2,x1,y1,&ix1,&iy1); + Plot2D_transform(p2,x2,y2,&ix2,&iy2); + FrameBuffer_solidbox(p2->frame,ix1,iy1,ix2,iy2,color); +} + +/* ------------------------------------------------------------------------------- + Plot2D_interpbox(Plot2D *p2, double x1, double y1, double x2, double y2, + Pixel c1, Pixel c2, Pixel c3, Pixel c4) + + Plot a color-interpolated box on the 2D plot + ------------------------------------------------------------------------------- */ +void +Plot2D_interpbox(Plot2D *p2, double x1, double y1,double x2, double y2, + Pixel c1, Pixel c2, Pixel c3, Pixel c4) { + int ix1, ix2,iy1, iy2; + + Plot2D_transform(p2,x1,y1,&ix1,&iy1); + Plot2D_transform(p2,x2,y2,&ix2,&iy2); + FrameBuffer_interpbox(p2->frame,ix1,iy1,ix2,iy2,c1,c2,c3,c4); +} + +/* ------------------------------------------------------------------------------- + Plot2D_circle(Plot2D *p2, double x, double y, double radius, Pixel color) + + Make an outline circle on the 2D plot. + ------------------------------------------------------------------------------- */ +void +Plot2D_circle(Plot2D *p2, double x, double y, double radius, Pixel color) { + int ix, iy, ir; + + Plot2D_transform(p2,x,y,&ix,&iy); + ir = p2->dx * radius; /* This is really incorrect. Will need ellipse */ + if (ir > 1) + FrameBuffer_circle(p2->frame,ix,iy,ir,color); + else + FrameBuffer_plot(p2->frame,ix,iy,color); + +} + +/* ------------------------------------------------------------------------------- + Plot2D_solidcircle(Plot2D *p2, double x, double y, double radius, Pixel color) + + Make an solid circle on the 2D plot. + ------------------------------------------------------------------------------- */ +void +Plot2D_solidcircle(Plot2D *p2, double x, double y, double radius, Pixel color) { + int ix, iy, ir; + + Plot2D_transform(p2,x,y,&ix,&iy); + ir = p2->dx * radius; /* This is really incorrect. Will need ellipse */ + if (ir > 1) + FrameBuffer_solidcircle(p2->frame,ix,iy,ir,color); + else + FrameBuffer_plot(p2->frame,ix,iy,color); +} + +/* ------------------------------------------------------------------------------- + Plot2D_line(Plot2D *p2, double x1, double y1, double x2, double y2, Pixel color) + + Draw a line + ------------------------------------------------------------------------------- */ + +void +Plot2D_line(Plot2D *p2, double x1, double y1, double x2, double y2, Pixel color) { + int ix1, ix2, iy1, iy2; + + Plot2D_transform(p2,x1,y1,&ix1,&iy1); + Plot2D_transform(p2,x2,y2,&ix2,&iy2); + FrameBuffer_line(p2->frame,ix1,iy1,ix2,iy2,color); +} + + + +/* ------------------------------------------------------------------------------- + Plot2D_start(Plot2D *p2) + + This should be called before starting to make a 2D plot. It will change + the viewport coordinates for the framebuffer and do other stuff. + ------------------------------------------------------------------------------- */ + +void Plot2D_start(Plot2D *p2) { + if (p2) { + FrameBuffer_setclip(p2->frame, p2->view_xmin,p2->view_ymin,p2->view_xmax, p2->view_ymax); + p2->dx = (p2->view_xmax - p2->view_xmin)/(p2->xmax - p2->xmin); + p2->dy = (p2->view_ymax - p2->view_ymin)/(p2->ymax - p2->ymin); + } +} + +/* -------------------------------------------------------------------------- + void Plot2D_drawpixmap(Plot2D *p2, PixMap *pm, double x, double y, Pixel color, Pixel bgcolor) + + Draw a pixel map at the given coordinates. (Used for putting symbols on 2D + plots). + -------------------------------------------------------------------------- */ +void +Plot2D_drawpixmap(Plot2D *p2, PixMap *pm, double x, double y, Pixel color, Pixel bgcolor) { + int ix, iy; + + Plot2D_transform(p2,x,y,&ix,&iy); + FrameBuffer_drawpixmap(p2->frame,pm,ix,iy,color,bgcolor); +} + +/* ---------------------------------------------------------------------------- + void Plot2D_xaxis(Plot2D *p2, double x, double y, double xtick, int ticklength, Pixel color) + + Draw an X axis bar at location x,y with ticks spaced every xtick units. + Ticks are spaced starting at "x" + ----------------------------------------------------------------------------- */ + +void Plot2D_xaxis(Plot2D *p2, double x, double y, double xtick, int ticklength, Pixel color) { + int ix, iy,iy2; + double xt; + + /* Draw a line fox the axis */ + + Plot2D_line(p2,p2->xmin,y,p2->xmax,y,color); + xt = x; + while (xt >= p2->xmin) { + Plot2D_transform(p2,xt,y,&ix,&iy); + iy2 = iy+ticklength; + iy = iy-ticklength; + FrameBuffer_line(p2->frame,ix,iy,ix,iy2,color); + xt = xt - xtick; + } + xt = x + xtick; + while (xt < p2->xmax) { + Plot2D_transform(p2,xt,y,&ix,&iy); + iy2 = iy+ticklength; + iy = iy-ticklength; + FrameBuffer_line(p2->frame,ix,iy,ix,iy2,color); + xt = xt + xtick; + } +} + + +/* ---------------------------------------------------------------------------- + void Plot2D_yaxis(Plot2D *p2, double x, double y, double ytick, int ticklength, Pixel c) + + Draw an Y axis bar at location x,y with ticks spaced every xtick units. + Ticks are spaced starting at "y" + ----------------------------------------------------------------------------- */ + +void Plot2D_yaxis(Plot2D *p2, double x, double y, double ytick, int ticklength, Pixel color) { + int ix, iy, ix2; + double yt; + + /* Draw a line fox the axis */ + + Plot2D_line(p2,x,p2->ymin,x,p2->ymax,color); + yt = y; + while (yt >= p2->ymin) { + Plot2D_transform(p2,x,yt,&ix,&iy); + ix2 = ix+ticklength; + ix = ix-ticklength; + FrameBuffer_line(p2->frame,ix,iy,ix2,iy,color); + yt = yt - ytick; + } + yt = y + ytick; + while (yt < p2->ymax) { + Plot2D_transform(p2,x,yt,&ix,&iy); + ix2 = ix+ticklength; + ix = ix-ticklength; + FrameBuffer_line(p2->frame,ix,iy,ix2,iy,color); + yt = yt + ytick; + } +} + + +/* ------------------------------------------------------------------------- + Plot2D_triangle(Plot2D *p2, double x1, double y1, + double x2, double y2, + double x3, double y3, + Pixel fillcolor) + + This function draws a 2D outline triangle. + -------------------------------------------------------------------------- */ + +void Plot2D_triangle(Plot2D *p2, double x1, double y1, + double x2, double y2, + double x3, double y3, Pixel color) { + + Plot2D_line(p2,x1,y1,x2,y2,color); + Plot2D_line(p2,x2,y2,x3,y3,color); + Plot2D_line(p2,x3,y3,x1,y1,color); + +} + + +/* ------------------------------------------------------------------------- + Plot2D_solidtriangle(Plot2D *p2, double x1, double y1, + double x2, double y2, + double x3, double y3, + Pixel color) + + This function draws a 2D filled triangle. Can be used to + draw other primitives such as quadralaterals, etc... + + -------------------------------------------------------------------------- */ + +void Plot2D_solidtriangle(Plot2D *p2, double x1, double y1, + + double x2, double y2, + double x3, double y3, Pixel color) { + + int tx1, tx2, tx3, ty1, ty2, ty3; + + /* Transform the three points into screen coordinates */ + + Plot2D_transform(p2,x1,y1,&tx1,&ty1); + Plot2D_transform(p2,x2,y2,&tx2,&ty2); + Plot2D_transform(p2,x3,y3,&tx3,&ty3); + + FrameBuffer_solidtriangle(p2->frame,tx1,ty1,tx2,ty2,tx3,ty3,color); + +} + +/* ------------------------------------------------------------------------- + Plot2D_interptriangle(Plot2D *p2, double x1, double y1, Pixel c1, + double x2, double y2, Pixel c2, + double x3, double y3, Pixel c3); + + This function draws a 2D filled triangle with color interpolation. + Can be used to draw other primitives such as quadralaterals, etc... + -------------------------------------------------------------------------- */ + +void Plot2D_interptriangle(Plot2D *p2, double x1, double y1, Pixel c1, + double x2, double y2, Pixel c2, + double x3, double y3, Pixel c3) { + + int tx1, tx2, tx3, ty1, ty2, ty3; + + /* Transform the three points into screen coordinates */ + + Plot2D_transform(p2,x1,y1,&tx1,&ty1); + Plot2D_transform(p2,x2,y2,&tx2,&ty2); + Plot2D_transform(p2,x3,y3,&tx3,&ty3); + + FrameBuffer_interptriangle(p2->frame,tx1,ty1,c1,tx2,ty2,c2,tx3,ty3,c3); + +} + + + diff --git a/Examples/GIFPlot/Lib/plot3d.c b/Examples/GIFPlot/Lib/plot3d.c new file mode 100644 index 000000000..387e420e2 --- /dev/null +++ b/Examples/GIFPlot/Lib/plot3d.c @@ -0,0 +1,2181 @@ +/* ----------------------------------------------------------------------------- + * plot3d.c + * + * Three-dimensional plotting. + * + * Author(s) : David Beazley (beazley@cs.uchicago.edu) + * Copyright (C) 1995-1996 + * + * See the file LICENSE for information on usage and redistribution. + * ----------------------------------------------------------------------------- */ + +#define PLOT3D +#include "gifplot.h" +#include +#include + +#define ORTHO 1 +#define PERSPECTIVE 2 +/* ------------------------------------------------------------------------ + Plot3D *new_Plot3D(FrameBuffer *f, double xmin, double ymin, double zmin, + double xmax, double ymax, double zmax) + + Creates a new 3D plot. Min and max coordinates are primarily used to + pick some default parameters. Returns NULL on failure + ------------------------------------------------------------------------- */ + +Plot3D *new_Plot3D(FrameBuffer *f, double xmin, double ymin, double zmin, + double xmax, double ymax, double zmax) { + + Plot3D *p3; + void Plot3D_maketransform(Plot3D *p3); + + /* Check to make sure the framebuffer and min/max parameters are valid */ + + if (!f) return (Plot3D *) 0; + if ((xmin > xmax) || (ymin > ymax) || (zmin > zmax)) return (Plot3D *) 0; + + p3 = (Plot3D *) malloc(sizeof(Plot3D)); + p3->frame = f; + p3->xmin = xmin; + p3->ymin = ymin; + p3->zmin = zmin; + p3->xmax = xmax; + p3->ymax = ymax; + p3->zmax = zmax; + + /* Set view region to the entire size of the framebuffer */ + + p3->view_xmin = 0; + p3->view_ymin = 0; + p3->view_xmax = f->width; + p3->view_ymax = f->height; + p3->width = f->width; + p3->height = f->height; + + /* Calculate a center point based off the min and max coordinates given */ + + p3->xcenter = (xmax - xmin)/2.0 + xmin; + p3->ycenter = (ymax - ymin)/2.0 + ymin; + p3->zcenter = (zmax - zmin)/2.0 + zmin; + + /* Calculate the aspect ratio of the viewing region */ + + p3->aspect = (double) f->width/(double) f->height; + + /* Set default view parameters */ + p3->xshift = 1.0; + p3->yshift = 1.0; + p3->zoom = 0.5; + p3->fovy = 40.0; /* 40 degree field of view */ + + /* Create matrices */ + + p3->model_mat = new_Matrix(); + p3->view_mat = new_Matrix(); + p3->center_mat = new_Matrix(); + p3->fullmodel_mat = new_Matrix(); + p3->trans_mat = new_Matrix(); + p3->pers_mode = ORTHO; + + FrameBuffer_zresize(p3->frame,p3->width, p3->height); + Matrix_identity(p3->view_mat); + Matrix_identity(p3->model_mat); + Matrix_translate(p3->center_mat, -p3->xcenter,-p3->ycenter,-p3->zcenter); + Plot3D_maketransform(p3); + return p3; +} + +/* --------------------------------------------------------------------- + delete_Plot3D(Plot3D *p3) + + Deletes a 3D plot + --------------------------------------------------------------------- */ + +void delete_Plot3D(Plot3D *p3) { + if (p3) { + delete_Matrix(p3->view_mat); + delete_Matrix(p3->model_mat); + delete_Matrix(p3->trans_mat); + free((char *) p3); + } +} + +/* --------------------------------------------------------------------- + Plot3D *Plot3D_copy(Plot3D *p3) + + This makes a copy of the 3D plot structure and returns a pointer to it. + --------------------------------------------------------------------- */ + +Plot3D *Plot3D_copy(Plot3D *p3) { + Plot3D *c3; + if (p3) { + c3 = (Plot3D *) malloc(sizeof(Plot3D)); + if (c3) { + c3->frame = p3->frame; + c3->view_xmin = p3->view_xmin; + c3->view_ymin = p3->view_ymin; + c3->view_xmax = p3->view_xmax; + c3->view_ymax = p3->view_ymax; + c3->xmin = p3->xmin; + c3->ymin = p3->ymin; + c3->zmin = p3->zmin; + c3->xmax = p3->xmax; + c3->ymax = p3->ymax; + c3->zmax = p3->zmax; + c3->xcenter = p3->xcenter; + c3->ycenter = p3->ycenter; + c3->zcenter = p3->zcenter; + c3->fovy = p3->fovy; + c3->aspect = p3->aspect; + c3->znear = p3->znear; + c3->zfar = p3->zfar; + c3->center_mat = Matrix_copy(p3->center_mat); + c3->model_mat = Matrix_copy(p3->model_mat); + c3->view_mat = Matrix_copy(p3->view_mat); + c3->fullmodel_mat = Matrix_copy(p3->fullmodel_mat); + c3->trans_mat = Matrix_copy(p3->trans_mat); + c3->lookatz = p3->lookatz; + c3->xshift = p3->xshift; + c3->yshift = p3->yshift; + c3->zoom = p3->zoom; + c3->width = p3->width; + c3->height = p3->height; + c3->pers_mode = p3->pers_mode; + } + return c3; + } else { + return (Plot3D *) 0; + } +} + +/* ---------------------------------------------------------------------- + Plot3D_clear(Plot3D *p3, Pixel bgcolor) + + Clear the pixel and zbuffer only for the view region of this image. + ---------------------------------------------------------------------- */ +void +Plot3D_clear(Plot3D *p3, Pixel bgcolor) { + int i,j; + + for (i = p3->view_xmin; i < p3->view_xmax; i++) + for (j = p3->view_ymin; j < p3->view_ymax; j++) { + p3->frame->pixels[j][i] = bgcolor; + p3->frame->zbuffer[j][i] = ZMIN; + } +} + +/* --------------------------------------------------------------------- + Plot3D_maketransform(Plot3D *p3) + + This function builds the total 3D transformation matrix from a + collection of components. + + Trans = View * Rotation * Center + + Where View is the viewing transformation matrix, Rotation is the + model rotation matrix, Center is the translation matrix used to + center the Model at the origin. + --------------------------------------------------------------------- */ + +void +Plot3D_maketransform(Plot3D *p3) { + + Matrix_multiply(p3->model_mat,p3->center_mat, p3->fullmodel_mat); + Matrix_multiply(p3->view_mat,p3->fullmodel_mat, p3->trans_mat); +} + +/* --------------------------------------------------------------------- + Plot3D_perspective(Plot3D *p3, double fovy, double znear, double zfar) + + Sets up the perspective viewing transformation. Assumes "lookat" + has already been called. + --------------------------------------------------------------------- */ + +void +Plot3D_perspective(Plot3D *p3, double fovy, double znear, double zfar) { + double theta; + double mat[16]; + + p3->fovy = fovy; + p3->znear = znear; + p3->zfar = zfar; + + theta = 3.1415926*fovy/180.0; + + Matrix_identity(mat); + mat[0] = cos(theta/2.0)/(sin(theta/2.0)*p3->aspect); + mat[5] = cos(theta/2.0)/(sin(theta/2.0)); + mat[10] = -(zfar + znear)/(zfar-znear); + mat[14] = -1.0; + mat[11] = -(2*zfar*znear)/(zfar - znear); + mat[15] = 0.0; + + /* Update the view transformation matrix */ + + Matrix_multiply(mat,p3->view_mat,p3->view_mat); + + /* Update the global transformation matrix */ + + Plot3D_maketransform(p3); + p3->pers_mode = PERSPECTIVE; + +} + +/* --------------------------------------------------------------------- + Plot3D_lookat(Plot3D *p3, double z) + + A greatly simplified version of (lookat). Specifies the position + of the viewpoint. (can be used for moving image in or out). + + Destroys the current viewing transformation matrix, so it will have + to be recalculated. + --------------------------------------------------------------------- */ + +void +Plot3D_lookat(Plot3D *p3, double z) { + if (p3) { + Matrix_translate(p3->view_mat, 0,0,-z); + p3->lookatz = z; + Plot3D_maketransform(p3); + } +} + +/* ------------------------------------------------------------------------- + Plot3D_autoperspective(Plot3D *p3, double fovy) + + Automatically figures out a semi-decent viewpoint given the + min,max parameters currently set for this image + ------------------------------------------------------------------------- */ + +void +Plot3D_autoperspective(Plot3D *p3, double fovy) { + + /* Make a perspective transformation matrix for this system */ + + double zfar; + double znear; + double d, dmax; + double cx,cy,cz; + double xmin,xmax,ymin,ymax,zmin,zmax; + + xmin = p3->xmin; + ymin = p3->ymin; + zmin = p3->zmin; + xmax = p3->xmax; + ymax = p3->ymax; + zmax = p3->zmax; + cx = p3->xcenter; + cy = p3->ycenter; + cz = p3->zcenter; + + /* Calculate longest point from center point */ + + dmax = (xmin-cx)*(xmin-cx) + (ymin-cy)*(ymin-cy) + (zmin-cz)*(zmin-cz); + d = (xmax-cx)*(xmax-cx) + (ymin-cy)*(ymin-cy) + (zmin-cz)*(zmin-cz); + if (d > dmax) dmax = d; + d = (xmin-cx)*(xmin-cx) + (ymax-cy)*(ymax-cy) + (zmin-cz)*(zmin-cz); + if (d > dmax) dmax = d; + d = (xmax-cx)*(xmax-cx) + (ymax-cy)*(ymax-cy) + (zmin-cz)*(zmin-cz); + if (d > dmax) dmax = d; + d = (xmin-cx)*(xmin-cx) + (ymin-cy)*(ymin-cy) + (zmax-cz)*(zmax-cz); + if (d > dmax) dmax = d; + d = (xmax-cx)*(xmax-cx) + (ymin-cy)*(ymin-cy) + (zmax-cz)*(zmax-cz); + if (d > dmax) dmax = d; + d = (xmin-cx)*(xmin-cx) + (ymax-cy)*(ymax-cy) + (zmax-cz)*(zmax-cz); + if (d > dmax) dmax = d; + d = (xmax-cx)*(xmax-cx) + (ymax-cy)*(ymax-cy) + (zmax-cz)*(zmax-cz); + if (d > dmax) dmax = d; + + dmax = sqrt(dmax); + d = p3->lookatz; + + znear = d - dmax; + zfar = znear+1.5*dmax; + Plot3D_perspective(p3, fovy,znear,zfar); + +} + + +/* --------------------------------------------------------------------- + Plot3D_ortho(Plot3D *p3, double left, double right, double bottom, double top) + + Sets up an orthographic viewing transformation. + --------------------------------------------------------------------- */ + +void +Plot3D_ortho(Plot3D *p3, double left, double right, double bottom, double top) { + + + Matrix_identity(p3->view_mat); + p3->view_mat[0] = (2.0/(right - left))/p3->aspect; + p3->view_mat[5] = 2.0/(top - bottom); + p3->view_mat[10] = -1; + p3->view_mat[15] = 1.0; + p3->view_mat[3] = -(right+left)/(right-left); + p3->view_mat[7] = -(top+bottom)/(top-bottom); + + /* Update the global transformation matrix */ + + Plot3D_maketransform(p3); + p3->pers_mode = ORTHO; + p3->ortho_left = left; + p3->ortho_right = right; + p3->ortho_bottom = bottom; + p3->ortho_top = top; + +} + +/* --------------------------------------------------------------------- + Plot3D_autoortho(Plot3D *p3) + + Automatically pick an orthographic projection that's probably + pretty good. + --------------------------------------------------------------------- */ + +void +Plot3D_autoortho(Plot3D *p3) { + + /* Make a perspective transformation matrix for this system */ + + double d, dmax; + double cx,cy,cz; + double xmin,xmax,ymin,ymax,zmin,zmax; + + xmin = p3->xmin; + ymin = p3->ymin; + zmin = p3->zmin; + xmax = p3->xmax; + ymax = p3->ymax; + zmax = p3->zmax; + cx = p3->xcenter; + cy = p3->ycenter; + cz = p3->zcenter; + + /* Calculate longest point from center point */ + + dmax = (xmin-cx)*(xmin-cx) + (ymin-cy)*(ymin-cy) + (zmin-cz)*(zmin-cz); + d = (xmax-cx)*(xmax-cx) + (ymin-cy)*(ymin-cy) + (zmin-cz)*(zmin-cz); + if (d > dmax) dmax = d; + d = (xmin-cx)*(xmin-cx) + (ymax-cy)*(ymax-cy) + (zmin-cz)*(zmin-cz); + if (d > dmax) dmax = d; + d = (xmax-cx)*(xmax-cx) + (ymax-cy)*(ymax-cy) + (zmin-cz)*(zmin-cz); + if (d > dmax) dmax = d; + d = (xmin-cx)*(xmin-cx) + (ymin-cy)*(ymin-cy) + (zmax-cz)*(zmax-cz); + if (d > dmax) dmax = d; + d = (xmax-cx)*(xmax-cx) + (ymin-cy)*(ymin-cy) + (zmax-cz)*(zmax-cz); + if (d > dmax) dmax = d; + d = (xmin-cx)*(xmin-cx) + (ymax-cy)*(ymax-cy) + (zmax-cz)*(zmax-cz); + if (d > dmax) dmax = d; + d = (xmax-cx)*(xmax-cx) + (ymax-cy)*(ymax-cy) + (zmax-cz)*(zmax-cz); + if (d > dmax) dmax = d; + + dmax = sqrt(dmax); + + Plot3D_ortho(p3,-dmax,dmax,-dmax,dmax); + +} + + + +/* ------------------------------------------------------------------------- + Plot3D_setview(Plot3D *p3, int vxmin, int vymin, int vxmax, int vymax) + + Sets the viewport for this 3D graph. Will recalculate all of the + local viewing transformation matrices accordingly. + ------------------------------------------------------------------------- */ +void +Plot3D_setview(Plot3D *p3, int vxmin, int vymin, int vxmax, int vymax) { + if (p3) { + if ((vxmin > vxmax) || (vymin >vymax)) return; + p3->view_xmin = vxmin; + p3->view_ymin = vymin; + p3->view_xmax = vxmax; + p3->view_ymax = vymax; + p3->width = (vxmax - vxmin); + p3->height = (vymax - vymin); + p3->aspect = (double) p3->width/(double) p3->height; + + /* Fix up the viewing transformation matrix */ + + if (p3->pers_mode == PERSPECTIVE) { + Plot3D_lookat(p3,p3->lookatz); + Plot3D_perspective(p3,p3->fovy,p3->znear,p3->zfar); + } else { + Plot3D_ortho(p3,p3->ortho_left,p3->ortho_right,p3->ortho_bottom, p3->ortho_top); + } + FrameBuffer_setclip(p3->frame,vxmin,vymin,vxmax,vymax); + } +} + +/* --------------------------------------------------------------------------- + Plot2D_start(Plot2D *p3) + + Set up viewing region and other parameters for this image. + --------------------------------------------------------------------------- */ + +void +Plot3D_start(Plot3D *p3) { + if (p3) + FrameBuffer_setclip(p3->frame, p3->view_xmin,p3->view_ymin,p3->view_xmax, p3->view_ymax); + +} + +/* ------------------------------------------------------------------------- + Plot3D_plot(Plot3D *p3, double x, double y, double z, Pixel Color) + + Plot a 3D point + ------------------------------------------------------------------------- */ + +void +Plot3D_plot(Plot3D *p3, double x, double y, double z, Pixel color) { + + GL_Vector t; + int ix, iy; + double invw; + FrameBuffer *f; + + /* Perform a transformation */ + + Matrix_transform4(p3->trans_mat,x,y,z,1,&t); + + /* Scale the coordinates into unit cube */ + + invw = 1.0/t.w; + t.x = t.x *invw; + t.y = t.y *invw; + t.z = t.z *invw; +#ifdef GL_DEBUG + fprintf(stdout,"t.x = %g, t.y = %g, t.z = %g\n", t.x,t.y,t.z); +#endif + /* Calculate the x and y coordinates */ + + ix = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5); + iy = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5); + + if ((ix >= 0) && (ix < p3->width) && + (iy >= 0) && (ix < p3->height)) { + ix += p3->view_xmin; + iy += p3->view_ymin; + f = p3->frame; + if (t.z <= f->zbuffer[iy][ix]) { + f->pixels[iy][ix] = color; + f->zbuffer[iy][ix] = t.z; + } + } +} + +/* ---------------------------------------------------------------------- + Plot3D_rotx(Plot3D *p3, double deg) + + Rotate the model around its x axis. + ---------------------------------------------------------------------- */ + +void +Plot3D_rotx(Plot3D *p3, double deg) { + double temp[16]; + + Matrix_rotatex(temp,deg); /* Construct a x rotation matrix */ + Matrix_multiply(p3->model_mat,temp,p3->model_mat); + Plot3D_maketransform(p3); + +} + +/* ---------------------------------------------------------------------- + Plot3D_roty(Plot3D *p3, double deg) + + Rotate the model around its y axis. + ---------------------------------------------------------------------- */ + +void +Plot3D_roty(Plot3D *p3, double deg) { + double temp[16]; + + Matrix_rotatey(temp,deg); /* Construct a y rotation matrix */ + Matrix_multiply(p3->model_mat,temp,p3->model_mat); + Plot3D_maketransform(p3); + +} + +/* ---------------------------------------------------------------------- + Plot3D_rotz(Plot3D *p3, double deg) + + Rotate the model around its z axis. + ---------------------------------------------------------------------- */ + +void +Plot3D_rotz(Plot3D *p3, double deg) { + double temp[16]; + + Matrix_rotatez(temp,deg); /* Construct a z rotation matrix */ + Matrix_multiply(p3->model_mat,temp,p3->model_mat); + Plot3D_maketransform(p3); + +} + + +/* ---------------------------------------------------------------------- + Plot3D_rotd(Plot3D *p3, double deg) + + Rotate the model down + ---------------------------------------------------------------------- */ + +void +Plot3D_rotd(Plot3D *p3, double deg) { + double temp[16]; + + Matrix_rotatex(temp,deg); /* Construct a x rotation matrix */ + Matrix_multiply(temp, p3->model_mat,p3->model_mat); + Plot3D_maketransform(p3); + +} + + +/* ---------------------------------------------------------------------- + Plot3D_rotu(Plot3D *p3, double deg) + + Rotate the model up + ---------------------------------------------------------------------- */ + +void +Plot3D_rotu(Plot3D *p3, double deg) { + double temp[16]; + + Matrix_rotatex(temp,-deg); /* Construct a x rotation matrix */ + Matrix_multiply(temp,p3->model_mat,p3->model_mat); + Plot3D_maketransform(p3); + +} + + +/* ---------------------------------------------------------------------- + Plot3D_rotr(Plot3D *p3, double deg) + + Rotate the model down + ---------------------------------------------------------------------- */ + +void +Plot3D_rotr(Plot3D *p3, double deg) { + double temp[16]; + + Matrix_rotatey(temp,deg); /* Construct a y rotation matrix */ + Matrix_multiply(temp, p3->model_mat,p3->model_mat); + Plot3D_maketransform(p3); + +} + + +/* ---------------------------------------------------------------------- + Plot3D_rotl(Plot3D *p3, double deg) + + Rotate the model left + ---------------------------------------------------------------------- */ + +void +Plot3D_rotl(Plot3D *p3, double deg) { + double temp[16]; + + Matrix_rotatey(temp,-deg); /* Construct a y rotation matrix */ + Matrix_multiply(temp,p3->model_mat,p3->model_mat); + Plot3D_maketransform(p3); + +} + + +/* ---------------------------------------------------------------------- + Plot3D_rotc(Plot3D *p3, double deg) + + Rotate the model around center point + ---------------------------------------------------------------------- */ + +void +Plot3D_rotc(Plot3D *p3, double deg) { + double temp[16]; + + Matrix_rotatez(temp,-deg); /* Construct a z rotation matrix */ + Matrix_multiply(temp,p3->model_mat,p3->model_mat); + Plot3D_maketransform(p3); +} + +/* ------------------------------------------------------------------------- + Plot3D_zoom(Plot3D *p3, double percent) + + Zooms in or out the current image. percent defines a percentage of + zoom. + + Zooming is actually done by adjusting the perspective field of view + instead of scaling the model or moving in the viewpoint. This + seems to work the best. + ------------------------------------------------------------------------- */ + +void +Plot3D_zoom(Plot3D *p3, double percent) { + + double scale; + double dx; + if (percent <= 0) return; + scale = percent/100.0; + + dx = (1.0/scale - 1.0)/(2*p3->zoom); /* Don't even ask where this came from */ + p3->xshift += dx; + p3->yshift += dx; + p3->zoom = p3->zoom*scale; + +#ifdef OLD + p3->fovy = p3->fovy*scale; + if (p3->fovy > 170.0) p3->fovy = 170.0; + if (p3->fovy == 0) p3->fovy = 0.0001; + Plot3D_lookat(p3,p3->lookatz); + Plot3D_perspective(p3,p3->fovy,p3->znear,p3->zfar); +#endif +} + +/* -------------------------------------------------------------------------- + Plot3D_left(Plot3D *p3, double s) + + Shifts the image to the left by s units. This is a little funky. + + s is scaled so that s = 100 equals one full screen. + -------------------------------------------------------------------------- */ +void +Plot3D_left(Plot3D *p3, double s) { + p3->xshift -= (s/100.0)/p3->zoom; +} + +/* -------------------------------------------------------------------------- + Plot3D_right(Plot3D *p3, double s) + + Shifts the image to the right by s units. + + s is scaled so that s = 100 equals one full screen. + -------------------------------------------------------------------------- */ +void +Plot3D_right(Plot3D *p3, double s) { + p3->xshift += (s/100.0)/p3->zoom; +} + +/* -------------------------------------------------------------------------- + Plot3D_up(Plot3D *p3, double s) + + Shifts the image up left by s units. + + s is scaled so that s = 100 equals one full screen. + -------------------------------------------------------------------------- */ +void +Plot3D_up(Plot3D *p3, double s) { + p3->yshift += (s/100.0)/p3->zoom; +} + +/* -------------------------------------------------------------------------- + Plot3D_down(Plot3D *p3, double s) + + Shifts the image down by s units. + + s is scaled so that s = 100 equals one full screen. + -------------------------------------------------------------------------- */ +void +Plot3D_down(Plot3D *p3, double s) { + p3->yshift -= (s/100.0)/p3->zoom; +} + +/* ------------------------------------------------------------------------- + Plot3D_center(Plot3D *p3, double cx, double cy) + + Centers the image on a point in the range (0,0) - (100,100) + ------------------------------------------------------------------------- */ +void +Plot3D_center(Plot3D *p3, double cx, double cy) { + Plot3D_left(p3,cx-50); + Plot3D_down(p3,cy-50); +} + + + +/*************************************************************************** + * 3d Primitives * + ***************************************************************************/ + +/* ------------------------------------------------------------------------- + Plot3D_horizontal(Plot3D *p3, int xmin, int xmax, int y, double z1, double z2, Pixel color) + + Draws a "Horizontal" line on the framebuffer between two screen coordinates, + but also supplies z-values and zbuffering. This function probably isn't + too useful by itself, but will be used by a number of other primitives. + -------------------------------------------------------------------------- */ + +void Plot3D_horizontal(Plot3D *p3, int xmin, int xmax, int y, Zvalue z1, Zvalue z2, Pixel color) { + Pixel *p; + FrameBuffer *f; + int i; + Zvalue *zbuf,z,mz; + int startx, endx; + + f = p3->frame; + if ((y < f->ymin) || (y >= f->ymax)) return; + if (xmin > f->xmax) return; + if (xmin < f->xmin) startx = f->xmin; + else startx = xmin; + if (xmax < f->xmin) return; + if (xmax >= f->xmax) endx = f->xmax - 1; + else endx = xmax; + + /* Calculate z slope */ + + if (xmax != xmin) { + mz = (Zvalue) ((double) (z2 - z1)/(double) (xmax - xmin)); + } else { + mz = 0; + } + + /* Draw it */ + + p = &f->pixels[y][startx]; + zbuf = &f->zbuffer[y][startx]; + z = (Zvalue) (mz*(startx-xmin) + z1); + for (i = startx; i <= endx; i++, p++, zbuf++,z+=mz) { + if (z <= *zbuf) { + *p = color; + *zbuf = z; + } + } +} + + +/* ------------------------------------------------------------------------- + Plot3D_vertical(Plot3D *p3, int ymin, int ymax, int x, double z1, double z2, Pixel color) + + Draws a "Vertical" line on the framebuffer between two screen coordinates, + but also supplies z-values and zbuffering. This function probably isn't + too useful by itself, but will be used by a number of other primitives. + -------------------------------------------------------------------------- */ + +void Plot3D_vertical(Plot3D *p3, int ymin, int ymax, int x, Zvalue z1, Zvalue z2, Pixel color) { + Pixel *p; + FrameBuffer *f; + int i; + Zvalue *zbuf,z,mz; + int starty, endy; + + f = p3->frame; + if ((x < f->xmin) || (x >= f->xmax)) return; + if (ymin >= f->ymax) return; + if (ymin < f->ymin) starty = f->ymin; + else starty = ymin; + if (ymax < f->ymin) return; + if (ymax >= f->ymax) endy = f->ymax - 1; + else endy = ymax; + + /* Calculate z slope */ + + mz = (double) (z2 - z1)/(double) (ymax - ymin); + + /* Draw it */ + + p = &f->pixels[starty][x]; + zbuf = &f->zbuffer[starty][x]; + for (i = starty; i <= endy; i++, p+=f->width, zbuf+=f->width) { + z = (Zvalue) (mz*(i-ymin) + z1); + if (z <= *zbuf) { + *p = color; + *zbuf = z; + } + } +} + +/* ------------------------------------------------------------------------------- + Plot3D_linetransform(Plot3D *p3, int x1, int y1, Zvalue z1, + int x2, int y2, Zvalue z2, Pixel c) + + Draw a 3D line between points that have already been transformed into + 3D space. + + Uses a Bresenham line algorithm, but with linear interpolation between + Zvalues. + ------------------------------------------------------------------------------- */ + +void +Plot3D_linetransform(Plot3D *p3, int x1, int y1, Zvalue z1, int x2, int y2, Zvalue z2, Pixel c) { + + int orig_x1, orig_y1, orig_x2,orig_y2; + Zvalue zt; + + /* Bresenham line drawing parameters */ + FrameBuffer *f; + int dx,dy,dxneg,dyneg, inc1,inc2,di; + int x, y, xpixels, ypixels, xt, yt; + Pixel *p; + double m; + int end1 = 0, end2 = 0; + Zvalue *zbuf,mz,z; + + f = p3->frame; + + /* Need to figure out where in the heck this line is */ + + dx = x2 - x1; + dy = y2 - y1; + + if ((dx == 0) && (dy == 0)) { + if ((x1 < f->xmin) || (x1 >= f->xmax) || + (y1 < f->ymin) || (y1 >= f->ymax)) return; + if (z1 <= f->zbuffer[y1][x1]) { + f->pixels[y1][x1] = c; + } + return; + } + if (dx == 0) { + /* Draw a Vertical Line */ + if (y1 < y2) + Plot3D_vertical(p3,y1,y2,x1,z1,z2,c); + else + Plot3D_vertical(p3,y2,y1,x1,z2,z1,c); + return; + } + if (dy == 0) { + /* Draw a Horizontal Line */ + if (x1 < x2) + Plot3D_horizontal(p3,x1,x2,y1,z1,z2,c); + else + Plot3D_horizontal(p3,x2,x1,y1,z2,z1,c); + return; + } + + /* Figure out where in the heck these lines are using the + Cohen-Sutherland Line Clipping Scheme. */ + + end1 = ((x1 - f->xmin) < 0) | + (((f->xmax- 1 - x1) < 0) << 1) | + (((y1 - f->ymin) < 0) << 2) | + (((f->ymax-1 - y1) < 0) << 3); + + end2 = ((x2 - f->xmin) < 0) | + (((f->xmax-1 - x2) < 0) << 1) | + (((y2 - f->ymin) < 0) << 2) | + (((f->ymax-1 - y2) < 0) << 3); + + if (end1 & end2) return; /* Nope : Not visible */ + + /* Make sure points have a favorable orientation */ + + if (x1 > x2) { + xt = x1; + x1 = x2; + x2 = xt; + yt = y1; + y1 = y2; + y2 = yt; + zt = z1; + z1 = z2; + z2 = zt; + } + + /* Save original points before we clip them off */ + orig_x1 = x1; + orig_y1 = y1; + orig_x2 = x2; + orig_y2 = y2; + + /* Clip against the boundaries */ + m = (y2 - y1)/(double) (x2-x1); + if (x1 < f->xmin) { + y1 = (f->xmin - x1)*m + y1; + x1 = f->xmin; + } + if (x2 >= f->xmax) { + y2 = (f->xmax -1 -x1)*m + y1; + x2 = f->xmax - 1; + } + + if (y1 > y2) { + xt = x1; + x1 = x2; + x2 = xt; + yt = y1; + y1 = y2; + y2 = yt; + zt = z1; + z1 = z2; + z2 = zt; + + /* Swap original points */ + + xt = orig_x1; + orig_x1 = orig_x2; + orig_x2 = xt; + yt = orig_y1; + orig_y1 = orig_y2; + orig_y2 = yt; + } + + m = 1/m; + if (y1 < f->ymin) { + x1 = (f->ymin - y1)*m + x1; + y1 = f->ymin; + } + if (y2 >= f->ymax) { + x2 = (f->ymax-1-y1)*m + x1; + y2 = f->ymax-1; + } + + if ((x1 < f->xmin) || (x1 >= f->xmax) || (y1 < f->ymin) || (y1 >= f->ymax) || + (x2 < f->xmin) || (x2 >= f->xmax) || (y2 < f->ymin) || (y2 >= f->ymax)) return; + + dx = x2 - x1; + dy = y2 - y1; + xpixels = f->width; + ypixels = f->height; + + dxneg = (dx < 0) ? 1 : 0; + dyneg = (dy < 0) ? 1 : 0; + + dx = abs(dx); + dy = abs(dy); + if (dx >= dy) { + /* Slope between -1 and 1. */ + mz = (z2 - z1)/(orig_x2 - orig_x1); /* Z interpolation slope */ + if (dxneg) { + x = x1; + y = y1; + x1 = x2; + y1 = y2; + x2 = x; + y2 = y; + dyneg = !dyneg; + } + inc1 = 2*dy; + inc2 = 2*(dy-dx); + di = 2*dy-dx; + + /* Draw a line using x as independent variable */ + + p = &f->pixels[y1][x1]; + zbuf = &f->zbuffer[y1][x1]; + x = x1; + while (x <= x2) { + /* Do a z-buffer check */ + z = mz*(x-orig_x1)+z1; + if (z <= *zbuf){ + *p = c; + *zbuf = z; + } + p++; + zbuf++; + if (di < 0) { + di = di + inc1; + } else { + if (dyneg) { + p = p - xpixels; + zbuf = zbuf - xpixels; + di = di + inc2; + } else { + p = p + xpixels; + zbuf = zbuf + xpixels; + di = di + inc2; + } + } + x++; + } + } else { + /* Slope < -1 or > 1 */ + mz = (z2 - z1)/(double) (orig_y2 - orig_y1); + if (dyneg) { + x = x1; + y = y1; + x1 = x2; + y1 = y2; + x2 = x; + y2 = y; + dxneg = !dxneg; + } + inc1 = 2*dx; + inc2 = 2*(dx-dy); + di = 2*dx-dy; + + /* Draw a line using y as independent variable */ + + p = &f->pixels[y1][x1]; + zbuf = &f->zbuffer[y1][x1]; + y = y1; + while (y <= y2) { + /* Do a z-buffer check */ + z = mz*(y-orig_y1)+z1; + if (z <= *zbuf) { + *p = c; + *zbuf = z; + } + p = p + xpixels; + zbuf = zbuf + xpixels; + if (di < 0) { + di = di + inc1; + } else { + if (dxneg) { + p = p - 1; + zbuf = zbuf - 1; + di = di + inc2; + } else { + p = p + 1; + zbuf = zbuf + 1; + di = di + inc2; + } + } + y++; + } + } +} + +/* --------------------------------------------------------------------------- + Plot3D_line(Plot3D *p3, double x1, double y1, double z1, double x2, double y2, double z2,int color) + + Draws a line in 3D space. This is done as follows (for lack of a better + method). + + 1. The points (x1,y1,z1) and (x2,y2,z2) are transformed into screen coordinates + 2. We draw the line using a modified Bresenham line algorithm. + 3. Zbuffer values are linearly interpolated between the two points. + ---------------------------------------------------------------------------- */ + +void +Plot3D_line(Plot3D *p3, double fx1, double fy1, double fz1, double fx2, double fy2, + double fz2, Pixel c) { + + /* 3D Transformation parameters */ + GL_Vector t; + double invw; + int x1,y1,x2,y2; + Zvalue z1,z2; + + /* Transform the two points into screen coordinates */ + + Matrix_transform4(p3->trans_mat,fx1,fy1,fz1,1,&t); /* Point 1 */ + invw = 1.0/t.w; + t.x = t.x *invw; + t.y = t.y *invw; + t.z = t.z *invw; + x1 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; + y1 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; + z1 = t.z; + + Matrix_transform4(p3->trans_mat,fx2,fy2,fz2,1,&t); /* Point 2 */ + invw = 1.0/t.w; + t.x = t.x *invw; + t.y = t.y *invw; + t.z = t.z *invw; + x2 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; + y2 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; + z2 = t.z; + Plot3D_linetransform(p3,x1,y1,z1,x2,y2,z2,c); +} + + +/* ------------------------------------------------------------------------- + Plot3D_triangle(Plot3D *p3, double x1, double y1, double z1, + double x2, double y2, double z2, + double x3, double y3, double z3, + Pixel fillcolor) + + This function draws a 3D z-buffered outline triangle. + -------------------------------------------------------------------------- */ + +void Plot3D_triangle(Plot3D *p3, double x1, double y1, double z1, + double x2, double y2, double z2, + double x3, double y3, double z3, Pixel color) { + + int tx1, tx2, tx3, ty1, ty2, ty3; + Zvalue tz1, tz2, tz3; + GL_Vector t; + double invw; + + /* Transform the three points into screen coordinates */ + + Matrix_transform4(p3->trans_mat,x1,y1,z1,1,&t); /* Point 1 */ + invw = 1.0/t.w; + t.x = t.x *invw; + t.y = t.y *invw; + t.z = t.z *invw; + tx1 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; + ty1 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; + tz1 = (Zvalue) t.z; + + Matrix_transform4(p3->trans_mat,x2,y2,z2,1,&t); /* Point 2 */ + invw = 1.0/t.w; + t.x = t.x *invw; + t.y = t.y *invw; + t.z = t.z *invw; + tx2 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; + ty2 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; + tz2 = (Zvalue) t.z; + + Matrix_transform4(p3->trans_mat,x3,y3,z3,1,&t); /* Point 3 */ + invw = 1.0/t.w; + t.x = t.x *invw; + t.y = t.y *invw; + t.z = t.z *invw; + tx3 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; + ty3 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; + tz3 = (Zvalue) t.z; + + + Plot3D_linetransform(p3,tx1,ty1,tz1,tx2,ty2,tz2,color); + Plot3D_linetransform(p3,tx1,ty1,tz1,tx3,ty3,tz3,color); + Plot3D_linetransform(p3,tx2,ty2,tz2,tx3,ty3,tz3,color); +} + + +/* ------------------------------------------------------------------------- + Plot3D_solidtriangletransform(Plot3D *p3, int tx1, int ty2, Zvalue tz1, + int tx2, int ty2, Zvalue tz2, + int tx3, int ty3, Zvalue tz3, Pixel color) + + This function draws a 3D z-buffered filled triangle. Assumes three + points have already been transformed into screen coordinates. + + General idea : + 1. Transform the three points into screen coordinates + 2. Order three points vertically on screen. + 3. Check for degenerate cases (where 3 points are colinear). + 4. Fill in the resulting triangle using horizontal lines. + -------------------------------------------------------------------------- */ + +void Plot3D_solidtriangletransform(Plot3D *p3, int tx1, int ty1, Zvalue tz1, + int tx2, int ty2, Zvalue tz2, + int tx3, int ty3, Zvalue tz3, Pixel color) { + int tempx, tempy; + Zvalue tempz; + double m1,m2,m3, mz1, mz2, mz3; + int y; + int ix1, ix2; + Zvalue zz1, zz2; + FrameBuffer *f; + register double fy1,fy2; + register Zvalue fz1,fz2; + + f = p3->frame; + + /* Check for degenerate cases here */ + + if ((ty1 == ty2) && (ty2 == ty3)) { + if (tx2 < tx1) { /* Swap points 1 and 2 if 2 is higher */ + tempx = tx1; + tempz = tz1; + tx1 = tx2; + tz1 = tz2; + tx2 = tempx; + tz2 = tempz; + } + if (tx3 < tx1) { /* Swap points 1 and 3 if 3 is higher */ + tempx = tx1; + tempz = tz1; + tx1 = tx3; + tz1 = tz3; + tx3 = tempx; + tz3 = tempz; + } + if (tx3 < tx2) { /* Swap points 2 and 3 if 3 is higher */ + tempx = tx2; + tempz = tz2; + tx2 = tx3; + tz2 = tz3; + tx3 = tempx; + tz3 = tempz; + } + + /* Points are aligned horizontally. Handle as a special case */ + /* Just draw three lines using the outline color */ + + Plot3D_horizontal(p3,tx1,tx2,ty1,tz1,tz3,color); + + /* Plot3D_linetransform(p3,tx1,ty1,tz1,tx2,ty2,tz2,color); + Plot3D_linetransform(p3,tx1,ty1,tz1,tx3,ty3,tz3,color); + Plot3D_linetransform(p3,tx2,ty2,tz2,tx3,ty3,tz3,color); + */ + + return; + } + + /* Figure out which point has the greatest "y" value */ + + if (ty2 > ty1) { /* Swap points 1 and 2 if 2 is higher */ + tempx = tx1; + tempy = ty1; + tempz = tz1; + tx1 = tx2; + ty1 = ty2; + tz1 = tz2; + tx2 = tempx; + ty2 = tempy; + tz2 = tempz; + } + if (ty3 > ty1) { /* Swap points 1 and 3 if 3 is higher */ + tempx = tx1; + tempy = ty1; + tempz = tz1; + tx1 = tx3; + ty1 = ty3; + tz1 = tz3; + tx3 = tempx; + ty3 = tempy; + tz3 = tempz; + } + if (ty3 > ty2) { /* Swap points 2 and 3 if 3 is higher */ + tempx = tx2; + tempy = ty2; + tempz = tz2; + tx2 = tx3; + ty2 = ty3; + tz2 = tz3; + tx3 = tempx; + ty3 = tempy; + tz3 = tempz; + } + + /* Points are now order so that t_1 is the highest point, t_2 is the + middle point, and t_3 is the lowest point */ + + if (ty2 < ty1) { + /* First process line segments between (x1,y1)-(x2,y2) + And between (x1,y1),(x3,y3) */ + + m1 = (double) (tx2 - tx1)/(double) (ty2 - ty1); + m2 = (double) (tx3 - tx1)/(double) (ty3 - ty1); + mz1 = (tz2 - tz1)/(double) (ty2 - ty1); + mz2 = (tz3 - tz1)/(double) (ty3 - ty1); + + y = ty1; + fy1 = m1*(y-ty1)+0.5 + tx1; + fy2 = m2*(y-ty1)+0.5 + tx1; + fz1 = mz1*(y-ty1) + tz1; + fz2 = mz2*(y-ty1) + tz1; + while (y >= ty2) { + /* Replace with bresenham scheme */ + /* Calculate x values from slope */ + ix1 = (int) fy1; + ix2 = (int) fy2; + zz1 = fz1; + zz2 = fz2; + fy1-= m1; + fy2-= m2; + fz1-= mz1; + fz2-= mz2; + if (ix1 > ix2) + Plot3D_horizontal(p3,ix2,ix1,y,zz2,zz1,color); + else + Plot3D_horizontal(p3,ix1,ix2,y,zz1,zz2,color); + y--; + } + } + if (ty3 < ty2) { + /* Draw lower half of the triangle */ + m2 = (double) (tx3 - tx1)/(double) (ty3 - ty1); + m3 = (double) (tx3 - tx2)/(double)(ty3 - ty2); + mz2 = (tz3 - tz1)/(double) (ty3 - ty1); + mz3 = (tz3 - tz2)/(double) (ty3 - ty2); + y = ty2; + while (y >= ty3) { + ix1 = (int) (m3*(y-ty2)+0.5)+tx2; + ix2 = (int) (m2*(y-ty1)+0.5)+tx1; + zz1 = mz3*(y-ty2)+tz2; + zz2 = mz2*(y-ty1)+tz1; + if (ix1 > ix2) + Plot3D_horizontal(p3,ix2,ix1,y,zz2,zz1,color); + else + Plot3D_horizontal(p3,ix1,ix2,y,zz1,zz2,color); + y--; + } + } +} + +/* ------------------------------------------------------------------------- + Plot3D_solidtriangle(Plot3D *p3, double x1, double y1, double z1, + double x2, double y2, double z2, + double x3, double y3, double z3, + Pixel color) + + This function draws a 3D z-buffered filled triangle. Can be used to + draw other primitives such as quadralaterals, etc... + + This function simply transforms the given points and calls + Plot3D_SolidTriangleTransform(). + -------------------------------------------------------------------------- */ + +void Plot3D_solidtriangle(Plot3D *p3, double x1, double y1, double z1, + double x2, double y2, double z2, + double x3, double y3, double z3, Pixel color) { + + int tx1, tx2, tx3, ty1, ty2, ty3; + Zvalue tz1, tz2, tz3; + GL_Vector t; + double invw; + Matrix a; + register double xshift, yshift, zoom, width, height, view_xmin, view_ymin; + + a = p3->trans_mat; + xshift = p3->xshift; + yshift = p3->yshift; + zoom = p3->zoom; + height = p3->height; + width = p3->width; + view_xmin = p3->view_xmin; + view_ymin = p3->view_ymin; + + /* Transform the three points into screen coordinates */ + + t.w = a[12]*x1 + a[13]*y1 + a[14]*z1 + a[15]; + invw = 1.0/t.w; + t.x = (a[0]*x1 + a[1]*y1 + a[2]*z1 + a[3])*invw; + t.y = (a[4]*x1 + a[5]*y1 + a[6]*z1 + a[7])*invw; + t.z = (a[8]*x1 + a[9]*y1 + a[10]*z1 + a[11])*invw; + + tx1 = (int) ((t.x +xshift)*zoom*width + 0.5) + view_xmin; + ty1 = (int) ((t.y +yshift)*zoom*height + 0.5) + view_ymin; + tz1 = (Zvalue) t.z; + + + t.w = a[12]*x2 + a[13]*y2 + a[14]*z2 + a[15]; + invw = 1.0/t.w; + t.x = (a[0]*x2 + a[1]*y2 + a[2]*z2 + a[3])*invw; + t.y = (a[4]*x2 + a[5]*y2 + a[6]*z2 + a[7])*invw; + t.z = (a[8]*x2 + a[9]*y2 + a[10]*z2 + a[11])*invw; + tx2 = (int) ((t.x +xshift)*zoom*width + 0.5) + view_xmin; + ty2 = (int) ((t.y +yshift)*zoom*height + 0.5) + view_ymin; + tz2 = (Zvalue) t.z; + + t.w = a[12]*x3 + a[13]*y3 + a[14]*z3 + a[15]; + invw = 1.0/t.w; + t.x = (a[0]*x3 + a[1]*y3 + a[2]*z3 + a[3])*invw; + t.y = (a[4]*x3 + a[5]*y3 + a[6]*z3 + a[7])*invw; + t.z = (a[8]*x3 + a[9]*y3 + a[10]*z3 + a[11])*invw; + tx3 = (int) ((t.x +xshift)*zoom*width + 0.5) + view_xmin; + ty3 = (int) ((t.y +yshift)*zoom*height + 0.5) + view_ymin; + tz3 = (Zvalue) t.z; + + Plot3D_solidtriangletransform(p3,tx1,ty1,tz1,tx2,ty2,tz2,tx3,ty3,tz3,color); + +} + + +/* ------------------------------------------------------------------------- + Plot3D_horizontalinterp(Plot3D *p3, int xmin, int xmax, int y, + double z1, double z2, Pixel c1, Pixel c2) + + Draws a "Horizontal" line on the framebuffer between two screen coordinates, + but also supplies z-values and zbuffering. Performs a color interpolation + between c1 and c2. This is primarily used by the SolidTriangleInterp() + function to give the illusion of smooth surfaces. + -------------------------------------------------------------------------- */ + +void Plot3D_horizontalinterp(Plot3D *p3, int xmin, int xmax, int y, + Zvalue z1, Zvalue z2, Pixel c1, Pixel c2) { + Pixel *p; + FrameBuffer *f; + int i; + Zvalue *zbuf,z,mz; + double mc; + int startx, endx; + double invdx; + + f = p3->frame; + if ((y < f->ymin) || (y >= f->ymax)) return; + if (xmin >= f->xmax) return; + if (xmin < f->xmin) startx = f->xmin; + else startx = xmin; + if (xmax < f->xmin) return; + if (xmax >= f->xmax) endx = f->xmax - 1; + else endx = xmax; + + /* Calculate z slope */ + if (xmax != xmin) { + invdx = 1.0/(double) (xmax-xmin); + } else { + invdx = 0; + } + + mz = (Zvalue) (z2 - z1)*invdx; + + /* Calculate c slope */ + + mc = (double) (c2 - c1)*invdx; + + /* Draw it */ + + p = &f->pixels[y][startx]; + zbuf = &f->zbuffer[y][startx]; + for (i = startx; i <= endx; i++, p++, zbuf++) { + z = (Zvalue) (mz*(i-xmin) + z1); + if (z <= *zbuf) { + *p = (Pixel) (mc*(i-xmin)+c1); + *zbuf = z; + } + } +} + +/* ------------------------------------------------------------------------- + Plot3D_interptriangletransform(Plot3D *p3, + int tx1, int ty2, Zvalue tz1, Pixel c1, + int tx2, int ty2, Zvalue tz2, Pixel c2, + int tx3, int ty3, Zvalue tz3, Pixel c3) + + This function draws a 3D z-buffered filled triangle with color + interpolation. Assumes three points have already been transformed + into screen coordinates. + + General idea : + 1. Transform the three points into screen coordinates + 2. Order three points vertically on screen. + 3. Check for degenerate cases (where 3 points are colinear). + 4. Fill in the resulting triangle using horizontal lines. + 5. Colors are interpolated between end points + -------------------------------------------------------------------------- */ + +void Plot3D_interptriangletransform(Plot3D *p3, + int tx1, int ty1, Zvalue tz1, Pixel c1, + int tx2, int ty2, Zvalue tz2, Pixel c2, + int tx3, int ty3, Zvalue tz3, Pixel c3) { + int tempx, tempy; + Zvalue tempz; + double m1,m2,m3, mz1, mz2, mz3; + double mc1,mc2,mc3; + Pixel ic1,ic2,tempc; + int y; + int ix1, ix2; + Zvalue zz1, zz2; + FrameBuffer *f; + + f = p3->frame; + + /* Figure out which point has the greatest "y" value */ + + if (ty2 > ty1) { /* Swap points 1 and 2 if 2 is higher */ + tempx = tx1; + tempy = ty1; + tempz = tz1; + tempc = c1; + tx1 = tx2; + ty1 = ty2; + tz1 = tz2; + c1 = c2; + tx2 = tempx; + ty2 = tempy; + tz2 = tempz; + c2 = tempc; + } + if (ty3 > ty1) { /* Swap points 1 and 3 if 3 is higher */ + tempx = tx1; + tempy = ty1; + tempz = tz1; + tempc = c1; + tx1 = tx3; + ty1 = ty3; + tz1 = tz3; + c1 = c3; + tx3 = tempx; + ty3 = tempy; + tz3 = tempz; + c3 = tempc; + } + if (ty3 > ty2) { /* Swap points 2 and 3 if 3 is higher */ + tempx = tx2; + tempy = ty2; + tempz = tz2; + tempc = c2; + tx2 = tx3; + ty2 = ty3; + tz2 = tz3; + c2 = c3; + tx3 = tempx; + ty3 = tempy; + tz3 = tempz; + c3 = tempc; + } + + /* Points are now order so that t_1 is the highest point, t_2 is the + middle point, and t_3 is the lowest point */ + + /* Check for degenerate cases here */ + + if ((ty1 == ty2) && (ty2 == ty3)) { + + /* Points are aligned horizontally. Handle as a special case */ + /* Just draw three lines using the outline color */ + + if (tx2 > tx1) + Plot3D_horizontalinterp(p3,tx1,tx2,ty1,tz1,tz2,c1,c2); + else + Plot3D_horizontalinterp(p3,tx2,tx1,ty1,tz2,tz1,c2,c1); + if (tx3 > tx1) + Plot3D_horizontalinterp(p3,tx1,tx3,ty1,tz1,tz3,c1,c3); + else + Plot3D_horizontalinterp(p3,tx3,tx1,ty1,tz3,tz1,c3,c1); + if (tx3 > tx2) + Plot3D_horizontalinterp(p3,tx2,tx3,ty2,tz2,tz3,c2,c3); + else + Plot3D_horizontalinterp(p3,tx3,tx2,ty2,tz3,tz2,c3,c2); + + } else { + + /* First process line segments between (x1,y1)-(x2,y2) + And between (x1,y1),(x3,y3) */ + + if (ty2 < ty1) { + m1 = (double) (tx2 - tx1)/(double) (ty2 - ty1); + m2 = (double) (tx3 - tx1)/(double) (ty3 - ty1); + mz1 = (tz2 - tz1)/(double) (ty2 - ty1); + mz2 = (tz3 - tz1)/(double) (ty3 - ty1); + mc1 = (c2 - c1)/(double) (ty2 - ty1); + mc2 = (c3 - c1)/(double) (ty3 - ty1); + + y = ty1; + while (y >= ty2) { + /* Calculate x values from slope */ + ix1 = (int) (m1*(y-ty1)+0.5) + tx1; + ix2 = (int) (m2*(y-ty1)+0.5) + tx1; + zz1 = mz1*(y-ty1) + tz1; + zz2 = mz2*(y-ty1) + tz1; + ic1 = mc1*(y-ty1) + c1; + ic2 = mc2*(y-ty1) + c1; + if (ix1 > ix2) + Plot3D_horizontalinterp(p3,ix2,ix1,y,zz2,zz1,ic2,ic1); + else + Plot3D_horizontalinterp(p3,ix1,ix2,y,zz1,zz2,ic1,ic2); + y--; + } + } + if (ty3 < ty2) { + /* Draw lower half of the triangle */ + m2 = (double) (tx3 - tx1)/(double) (ty3 - ty1); + mz2 = (tz3 - tz1)/(double) (ty3 - ty1); + mc2 = (c3 - c1)/(double) (ty3 - ty1); + m3 = (double) (tx3 - tx2)/(double)(ty3 - ty2); + mz3 = (tz3 - tz2)/(double) (ty3 - ty2); + mc3 = (c3 - c2)/(double) (ty3 - ty2); + y = ty2; + while (y >= ty3) { + ix1 = (int) (m3*(y-ty2)+0.5)+tx2; + ix2 = (int) (m2*(y-ty1)+0.5)+tx1; + zz1 = mz3*(y-ty2)+tz2; + zz2 = mz2*(y-ty1)+tz1; + ic1 = mc3*(y-ty2)+c2; + ic2 = mc2*(y-ty1)+c1; + if (ix1 > ix2) + Plot3D_horizontalinterp(p3,ix2,ix1,y,zz2,zz1,ic2,ic1); + else + Plot3D_horizontalinterp(p3,ix1,ix2,y,zz1,zz2,ic1,ic2); + y--; + } + } + } +} + +/* ------------------------------------------------------------------------- + Plot3D_interptriangle(Plot3D *p3, + double x1, double y1, double z1, Pixel c1, + double x2, double y2, double z2, Pixel c2, + double x3, double y3, double z3, Pixel c3) + + This function draws a 3D z-buffered filled triangle with color + interpolation. + + This function simply transforms the given points and calls + Plot3D_InterpTriangleTransform(). + -------------------------------------------------------------------------- */ + +void Plot3D_interptriangle(Plot3D *p3, + double x1, double y1, double z1, Pixel c1, + double x2, double y2, double z2, Pixel c2, + double x3, double y3, double z3, Pixel c3) { + + int tx1, tx2, tx3, ty1, ty2, ty3; + Zvalue tz1, tz2, tz3; + GL_Vector t; + double invw; + + /* Transform the three points into screen coordinates */ + + Matrix_transform4(p3->trans_mat,x1,y1,z1,1,&t); /* Point 1 */ + invw = 1.0/t.w; + t.x = t.x *invw; + t.y = t.y *invw; + t.z = t.z *invw; + tx1 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; + ty1 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; + tz1 = (Zvalue) t.z; + + Matrix_transform4(p3->trans_mat,x2,y2,z2,1,&t); /* Point 2 */ + invw = 1.0/t.w; + t.x = t.x *invw; + t.y = t.y *invw; + t.z = t.z *invw; + tx2 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; + ty2 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; + tz2 = (Zvalue) t.z; + + Matrix_transform4(p3->trans_mat,x3,y3,z3,1,&t); /* Point 3 */ + invw = 1.0/t.w; + t.x = t.x *invw; + t.y = t.y *invw; + t.z = t.z *invw; + tx3 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; + ty3 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; + tz3 = (Zvalue) t.z; + + Plot3D_interptriangletransform(p3,tx1,ty1,tz1,c1,tx2,ty2,tz2,c2,tx3,ty3,tz3,c3); +} + +/* ------------------------------------------------------------------------- + Plot3D_quad(Plot3D *p3, double x1, double y1, double z1, + double x2, double y2, double z2, + double x3, double y3, double z3, + double x4, double y4, double z4, + Pixel fillcolor) + + This function draws a 3D outlined Quadralateral. Used primarily for + drawing meshes and other things. + + Plotting is done in the following order : + (x1,y1,z1) --> (x2,y2,z2) + (x2,y2,z2) --> (x3,y3,z3) + (x3,y3,z3) --> (x4,y4,z4) + (x4,y4,z4) --> (x1,y1,z1) + -------------------------------------------------------------------------- */ + +void Plot3D_quad(Plot3D *p3, double x1, double y1, double z1, + double x2, double y2, double z2, + double x3, double y3, double z3, + double x4, double y4, double z4, + Pixel color) { + + int tx1, tx2, tx3, tx4, ty1, ty2, ty3, ty4; + Zvalue tz1, tz2, tz3, tz4; + GL_Vector t; + double invw; + + /* Transform the three points into screen coordinates */ + + Matrix_transform4(p3->trans_mat,x1,y1,z1,1,&t); /* Point 1 */ + invw = 1.0/t.w; + t.x = t.x *invw; + t.y = t.y *invw; + t.z = t.z *invw; + tx1 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; + ty1 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; + tz1 = (Zvalue) t.z; + + Matrix_transform4(p3->trans_mat,x2,y2,z2,1,&t); /* Point 2 */ + invw = 1.0/t.w; + t.x = t.x *invw; + t.y = t.y *invw; + t.z = t.z *invw; + tx2 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; + ty2 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; + tz2 = (Zvalue) t.z; + + Matrix_transform4(p3->trans_mat,x3,y3,z3,1,&t); /* Point 3 */ + invw = 1.0/t.w; + t.x = t.x *invw; + t.y = t.y *invw; + t.z = t.z *invw; + tx3 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; + ty3 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; + tz3 = (Zvalue) t.z; + + Matrix_transform4(p3->trans_mat,x4,y4,z4,1,&t); /* Point 3 */ + invw = 1.0/t.w; + t.x = t.x *invw; + t.y = t.y *invw; + t.z = t.z *invw; + tx4 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; + ty4 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; + tz4 = (Zvalue) t.z; + + Plot3D_linetransform(p3,tx1,ty1,tz1,tx2,ty2,tz2,color); + Plot3D_linetransform(p3,tx2,ty2,tz2,tx3,ty3,tz3,color); + Plot3D_linetransform(p3,tx3,ty3,tz3,tx4,ty4,tz4,color); + Plot3D_linetransform(p3,tx4,ty4,tz4,tx1,ty1,tz1,color); + +} + + +/* ------------------------------------------------------------------------- + Plot3D_solidquad(Plot3D *p3, double x1, double y1, double z1, + double x2, double y2, double z2, + double x3, double y3, double z3, + double x4, double y4, double z4, + Pixel fillcolor) + + This function draws a 3D solid Quadralateral. Uses the function + Plot3D_SolidTriangleTransform() to fill in the region. + + Plotting is done in the following order : + (x1,y1,z1) --> (x2,y2,z2) + (x2,y2,z2) --> (x3,y3,z3) + (x3,y3,z3) --> (x4,y4,z4) + (x4,y4,z4) --> (x1,y1,z1) + -------------------------------------------------------------------------- */ + +void Plot3D_solidquad(Plot3D *p3, double x1, double y1, double z1, + double x2, double y2, double z2, + double x3, double y3, double z3, + double x4, double y4, double z4, + Pixel color) { + + int tx1, tx2, tx3, tx4, ty1, ty2, ty3, ty4; + Zvalue tz1, tz2, tz3, tz4; + GL_Vector t; + double invw; + + /* Transform the three points into screen coordinates */ + + Matrix_transform4(p3->trans_mat,x1,y1,z1,1,&t); /* Point 1 */ + invw = 1.0/t.w; + t.x = t.x *invw; + t.y = t.y *invw; + t.z = t.z *invw; + tx1 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; + ty1 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; + tz1 = (Zvalue) t.z; + + Matrix_transform4(p3->trans_mat,x2,y2,z2,1,&t); /* Point 2 */ + invw = 1.0/t.w; + t.x = t.x *invw; + t.y = t.y *invw; + t.z = t.z *invw; + tx2 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; + ty2 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; + tz2 = (Zvalue) t.z; + + Matrix_transform4(p3->trans_mat,x3,y3,z3,1,&t); /* Point 3 */ + invw = 1.0/t.w; + t.x = t.x *invw; + t.y = t.y *invw; + t.z = t.z *invw; + tx3 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; + ty3 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; + tz3 = (Zvalue) t.z; + + Matrix_transform4(p3->trans_mat,x4,y4,z4,1,&t); /* Point 3 */ + invw = 1.0/t.w; + t.x = t.x *invw; + t.y = t.y *invw; + t.z = t.z *invw; + tx4 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; + ty4 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; + tz4 = (Zvalue) t.z; + + Plot3D_solidtriangletransform(p3,tx1,ty1,tz1,tx2,ty2,tz2,tx3,ty3,tz3,color); + Plot3D_solidtriangletransform(p3,tx1,ty1,tz1,tx4,ty4,tz4,tx3,ty3,tz3,color); +} + +/* ------------------------------------------------------------------------- + Plot3D_interpquad(Plot3D *p3, double x1, double y1, double z1, Pixel c1, + double x2, double y2, double z2, Pixel c2, + double x3, double y3, double z3, Pixel c3, + double x4, double y4, double z4, Pixel c4) + + This function draws a 3D color-interpolated Quadralateral. Uses the function + Plot3D_InterpTriangleTransform() to fill in the region. + + Plotting is done in the following order : + (x1,y1,z1) --> (x2,y2,z2) + (x2,y2,z2) --> (x3,y3,z3) + (x3,y3,z3) --> (x4,y4,z4) + (x4,y4,z4) --> (x1,y1,z1) + -------------------------------------------------------------------------- */ + +void Plot3D_interpquad(Plot3D *p3, double x1, double y1, double z1, Pixel c1, + double x2, double y2, double z2, Pixel c2, + double x3, double y3, double z3, Pixel c3, + double x4, double y4, double z4, Pixel c4) { + + + int tx1, tx2, tx3, tx4, ty1, ty2, ty3, ty4; + Zvalue tz1, tz2, tz3, tz4; + GL_Vector t; + double invw; + + /* Transform the three points into screen coordinates */ + + Matrix_transform4(p3->trans_mat,x1,y1,z1,1,&t); /* Point 1 */ + invw = 1.0/t.w; + t.x = t.x *invw; + t.y = t.y *invw; + t.z = t.z *invw; + tx1 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; + ty1 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; + tz1 = (Zvalue) t.z; + + Matrix_transform4(p3->trans_mat,x2,y2,z2,1,&t); /* Point 2 */ + invw = 1.0/t.w; + t.x = t.x *invw; + t.y = t.y *invw; + t.z = t.z *invw; + tx2 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; + ty2 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; + tz2 = (Zvalue) t.z; + + Matrix_transform4(p3->trans_mat,x3,y3,z3,1,&t); /* Point 3 */ + invw = 1.0/t.w; + t.x = t.x *invw; + t.y = t.y *invw; + t.z = t.z *invw; + tx3 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; + ty3 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; + tz3 = (Zvalue) t.z; + + Matrix_transform4(p3->trans_mat,x4,y4,z4,1,&t); /* Point 3 */ + invw = 1.0/t.w; + t.x = t.x *invw; + t.y = t.y *invw; + t.z = t.z *invw; + tx4 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; + ty4 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; + tz4 = (Zvalue) t.z; + + Plot3D_interptriangletransform(p3,tx1,ty1,tz1,c1,tx2,ty2,tz2,c2,tx3,ty3,tz3,c3); + Plot3D_interptriangletransform(p3,tx1,ty1,tz1,c1,tx4,ty4,tz4,c4,tx3,ty3,tz3,c3); + +} + +/* -------------------------------------------------------------------------- + Plot3D_solidsphere(Plot3 *p3, double x, double y, double z, double radius, + Pixel c) + + Makes a 3D sphere at x,y,z with given radius and color. + + Basic strategy : + 1. Transform point to screen coordinates + 2. Figure out what the radius is in screen coordinates + 3. Use bresenham algorithm for large spheres + 4. Use bitmaps for small spheres + -------------------------------------------------------------------------- */ + +/* This is used to fill in spheres */ +static int s_xmin; +static int s_ymin; +static int s_xmax; +static int s_ymax; +static Pixel **s_pixels; +static Zvalue **s_zbuffer; + +void Plot3D_spherehorizontal(int xmin, int xmax, int y, Zvalue z, Pixel color) { + int i; + int startx, endx; + Pixel *p; + Zvalue *zbuf; + + if ((y < s_ymin) || (y >= s_ymax)) return; + if (xmin < s_xmin) startx = s_xmin; + else startx = xmin; + if (xmax >= s_xmax) endx = s_xmax - 1; + else endx = xmax; + + /* Draw it */ + + p = &s_pixels[y][xmin]; + zbuf = &s_zbuffer[y][xmin]; + for (i = startx; i <= endx; i++, p++, zbuf++) { + if (z <= *zbuf) { + *p = color; + *zbuf = z; + } + } +} + +void Plot3D_solidsphere(Plot3D *p3, double x, double y, double z, double radius, + Pixel c) { + + GL_Vector t,r; + double rad; + int tx,ty, irad; + Zvalue tz; + double invw; + int ix, iy, ix1,ix2,p; + FrameBuffer *f; + + /* First transform the point into model coordinates */ + + Matrix_transform4(p3->fullmodel_mat,x,y,z,1,&t); + + /* Now transform two points in order to find proper sphere radius */ + + Matrix_transform4(p3->view_mat,t.x+radius,t.y,t.z,t.w,&r); /* transform radius */ + Matrix_transform4(p3->view_mat,t.x,t.y,t.z,t.w,&t); + + invw = 1.0/t.w; + t.x = t.x*invw; + t.y = t.y*invw; + t.z = t.z*invw; + invw = 1.0/r.w; + r.x = r.x*invw; + r.y = r.y*invw; + r.z = r.z*invw; + invw = 1.0/r.w; + + rad = fabs(t.x - r.x); + + /* Transform everything into screen coordinates */ + + tx = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; + ty = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; + tz = (Zvalue) t.z; + irad = (int) (p3->zoom*(rad*p3->width + 0.5)); + + /* This is only a temporary solution (maybe). */ + +#define fill_zcircle(x,y,c) \ + ix1 = tx - x; \ + ix2 = tx + x; \ + if (ix1 < s_xmin) ix1 = s_xmin; \ + if (ix2 >= s_xmax) ix2 = s_xmax; \ + Plot3D_spherehorizontal(ix1,ix2,y,tz,c); + + f = p3->frame; + s_xmin = f->xmin; + s_ymin = f->ymin; + s_xmax = f->xmax; + s_ymax = f->ymax; + s_pixels = f->pixels; + s_zbuffer = f->zbuffer; + if (irad <= 1) { + /* Plot a single pixel */ + if ((tx >= f->xmin) && (tx < f->xmax)) { + if ((ty >= f->ymin) && (ty ymax)) { + if (tz <= f->zbuffer[ty][tx]) { + f->pixels[ty][tx] = c; + f->zbuffer[ty][tx] = tz; + } + } + } + return; + } + ix = 0; + iy = irad; + p = 3-2*irad; + while (ix <= iy) { + fill_zcircle(ix,ty+iy,c); + fill_zcircle(ix,ty-iy,c); + fill_zcircle(iy,ty+ix,c); + fill_zcircle(iy,ty-ix,c); + if (p < 0) p = p + 4*ix + 6; + else { + p = p + 4*(ix-iy) + 10; + iy = iy -1; + } + ix++; + } +} + + +/* -------------------------------------------------------------------- + Plot3D_outlinesphere(Plot3D *p3, double x, double y, double z, + double radius, Pixel color, Pixel bc) + + Draws an outlined sphere. + -------------------------------------------------------------------- */ + +void Plot3D_outlinesphere(Plot3D *p3, double x, double y, double z, + double radius, Pixel c, Pixel bc) +{ + GL_Vector t,r; + double rad; + int tx,ty, irad; + Zvalue tz; + double invw; + int ix, iy, ix1,ix2,p; + + FrameBuffer *f; + + /* First transform the point into model coordinates */ + + Matrix_transform4(p3->fullmodel_mat,x,y,z,1,&t); + + /* Now transform two points in order to find proper sphere radius */ + + Matrix_transform4(p3->view_mat,t.x+radius,t.y,t.z,t.w,&r); /* transform radius */ + Matrix_transform4(p3->view_mat,t.x,t.y,t.z,t.w,&t); + + invw = 1.0/t.w; + t.x = t.x*invw; + t.y = t.y*invw; + t.z = t.z*invw; + invw = 1.0/r.w; + r.x = r.x*invw; + r.y = r.y*invw; + r.z = r.z*invw; + invw = 1.0/r.w; + + rad = fabs(t.x - r.x); + + /* Transform everything into screen coordinates */ + + tx = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; + ty = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; + tz = (Zvalue) t.z; + irad = (int) (p3->zoom*(rad*p3->width + 0.5)); + + /* This is only a temporary solution (maybe). */ +#define plot_zcircle(x,y,c) \ + if ((x >= s_xmin) && (x < s_xmax) && \ + (y >= s_ymin) && (y < s_ymax)) {\ + if (tz <= s_zbuffer[y][x]) { \ + s_pixels[y][x] = c; \ + s_zbuffer[y][x] = tz; } \ + } + + f = p3->frame; + s_xmin = f->xmin; + s_ymin = f->ymin; + s_xmax = f->xmax; + s_ymax = f->ymax; + s_pixels = f->pixels; + s_zbuffer = f->zbuffer; + + if (irad <= 1) { + /* Plot a single pixel */ + if ((tx >= f->xmin) && (tx < f->xmax)) { + if ((ty >= f->ymin) && (ty ymax)) { + if (tz <= f->zbuffer[ty][tx]) { + f->pixels[ty][tx] = c; + f->zbuffer[ty][tx] = tz; + } + } + } + return; + } + ix = 0; + iy = irad; + p = 3-2*irad; + while (ix <= iy) { + fill_zcircle(ix,ty+iy,c); + fill_zcircle(ix,ty-iy,c); + fill_zcircle(iy,ty+ix,c); + fill_zcircle(iy,ty-ix,c); + + plot_zcircle(tx+ix,ty+iy,bc); + plot_zcircle(tx-ix,ty+iy,bc); + plot_zcircle(tx+ix,ty-iy,bc); + plot_zcircle(tx-ix,ty-iy,bc); + plot_zcircle(tx+iy,ty+ix,bc); + plot_zcircle(tx-iy,ty+ix,bc); + plot_zcircle(tx+iy,ty-ix,bc); + plot_zcircle(tx-iy,ty-ix,bc); + if (p < 0) p = p + 4*ix + 6; + else { + p = p + 4*(ix-iy) + 10; + iy = iy -1; + } + ix++; + } +} + +/* QUAD Test + Test out quad functions for graphing */ + +double zf(double x, double y) { + return cos(sqrt(x*x + y*y)*10.0)/(sqrt(x*x+y*y)+1); +} + +void Quad_Test(Plot3D *p3, int npoints) { + int i,j; + double dx; + double x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4,za; + int c; + dx = 2.0/npoints; + + + for (i = 0; i < npoints; i++) + for (j = 0; j < npoints; j++) { + x1 = i*dx + -1.0; + y1 = j*dx + -1.0; + x2 = x1 + dx; + x3 = x1 + dx; + x4 = x1; + y2 = y1; + y3 = y1 + dx; + y4 = y1 + dx; + z1 = zf(x1,y1); + z2 = zf(x2,y2); + z3 = zf(x3,y3); + z4 = zf(x4,y4); + za = 0.25*(z1+z2+z3+z4); + c = 16+((za + 1)*120); + if (c > 254) c = 254; + Plot3D_quad(p3,x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4,(Pixel) c); + } +} + + +void Quad_SolidTest(Plot3D *p3, int npoints) { + int i,j; + double dx; + double x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4,za; + int c; + dx = 2.0/npoints; + + + for (i = 0; i < npoints; i++) + for (j = 0; j < npoints; j++) { + x1 = i*dx + -1.0; + y1 = j*dx + -1.0; + x2 = x1 + dx; + x3 = x1 + dx; + x4 = x1; + y2 = y1; + y3 = y1 + dx; + y4 = y1 + dx; + z1 = zf(x1,y1); + z2 = zf(x2,y2); + z3 = zf(x3,y3); + z4 = zf(x4,y4); + za = 0.25*(z1+z2+z3+z4); + c = 16+((za + 1)*120); + if (c > 254) c = 254; + Plot3D_solidquad(p3,x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4,(Pixel) c); + } +} + + + +void Quad_InterpTest(Plot3D *p3, int npoints) { + int i,j; + double dx; + double x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4; + int c1,c2,c3,c4; + dx = 2.0/npoints; + + + for (i = 0; i < npoints; i++) + for (j = 0; j < npoints; j++) { + x1 = i*dx + -1.0; + y1 = j*dx + -1.0; + x2 = x1 + dx; + x3 = x1 + dx; + x4 = x1; + y2 = y1; + y3 = y1 + dx; + y4 = y1 + dx; + z1 = zf(x1,y1); + z2 = zf(x2,y2); + z3 = zf(x3,y3); + z4 = zf(x4,y4); + c1 = 16+((z1 + 1)*120); + c2 = 16+((z2 + 1)*120); + c3 = 16+((z3 + 1)*120); + c4 = 16+((z4 + 1)*120); + if (c1 > 254) c1 = 254; + if (c2 > 254) c2 = 254; + if (c3 > 254) c3 = 254; + if (c4 > 254) c4 = 254; + Plot3D_interpquad(p3,x1,y1,z1,(Pixel) c1,x2,y2,z2,(Pixel) c2,x3,y3,z3,(Pixel) c3,x4,y4,z4,(Pixel) c4); + } +} + + + + + + + + + + + + diff --git a/Examples/GIFPlot/Makefile.in b/Examples/GIFPlot/Makefile.in new file mode 100644 index 000000000..4e51360c8 --- /dev/null +++ b/Examples/GIFPlot/Makefile.in @@ -0,0 +1,23 @@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +RANLIB = @RANLIB@ +OPT = + +INSTALL = ../install-sh -c +INSTALL_DATA = ${INSTALL} -m 644 +SHELL = /bin/sh + +all: + cd Lib && $(MAKE) OPT="$(OPT)" + +install: + $(INSTALL_DATA) Include/gifplot.h $(prefix)/include/gifplot.h + $(INSTALL_DATA) libgifplot.a $(exec_prefix)/lib/libgifplot.a + $(RANLIB) $(exec_prefix)/lib/libgifplot.a + +clean:: + rm -f *.@OBJEXT@ *~ libgifplot.a *_wrap* *_man* + cd Lib && $(MAKE) clean + rm -f config.log config.status config.cache + +check: all diff --git a/Examples/GIFPlot/Ocaml/check.list b/Examples/GIFPlot/Ocaml/check.list new file mode 100644 index 000000000..e75ee586a --- /dev/null +++ b/Examples/GIFPlot/Ocaml/check.list @@ -0,0 +1,3 @@ +# see top-level Makefile.in +full +simple diff --git a/Examples/GIFPlot/Ocaml/full/Makefile b/Examples/GIFPlot/Ocaml/full/Makefile new file mode 100644 index 000000000..4f35c43f9 --- /dev/null +++ b/Examples/GIFPlot/Ocaml/full/Makefile @@ -0,0 +1,33 @@ +TOP = ../../.. +SWIG = $(TOP)/../swig +SWIGOPT = -I../../Include +SRCS = +TARGET = gifcaml +INTERFACE = gifplot.i +LIBS = -L../.. -lgifplot -lm +INCLUDES = -I../../Include +MLFILE = gifplot.ml +IOBJS = runme.cmo +PROGFILE = runme.ml + +all:: static + +static:: + $(MAKE) -f $(TOP)/Makefile TOP='$(TOP)' \ + IOBJS='$(IOBJS)' PROGFILE='$(PROGFILE)' \ + SRCS='$(SRCS)' SWIG='$(SWIG)' MLFILE='$(MLFILE)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ocaml_static + +dynamic:: + $(MAKE) -f $(TOP)/Makefile TOP='$(TOP)' \ + IOBJS='$(IOBJS)' PROGFILE='$(PROGFILE)' \ + SRCS='$(SRCS)' SWIG='$(SWIG)' MLFILE='$(MLFILE)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ocaml_dynamic + +clean:: + $(MAKE) -f $(TOP)/Makefile MLFILE='$(MLFILE)' ocaml_clean + rm -f *.gif + +check: all diff --git a/Examples/GIFPlot/Ocaml/full/README b/Examples/GIFPlot/Ocaml/full/README new file mode 100644 index 000000000..4a2b400b5 --- /dev/null +++ b/Examples/GIFPlot/Ocaml/full/README @@ -0,0 +1,8 @@ +This example runs the entire gifplot.h header file through SWIG without +any changes. The ocaml program 'runme.ml' does something a little more +interesting. You'll have to go look at the header file to get a complete +listing of the functions. + + + + diff --git a/Examples/GIFPlot/Ocaml/full/cmap b/Examples/GIFPlot/Ocaml/full/cmap new file mode 100644 index 000000000..a20c331a9 Binary files /dev/null and b/Examples/GIFPlot/Ocaml/full/cmap differ diff --git a/Examples/GIFPlot/Ocaml/full/gifplot.i b/Examples/GIFPlot/Ocaml/full/gifplot.i new file mode 100644 index 000000000..22f4df672 --- /dev/null +++ b/Examples/GIFPlot/Ocaml/full/gifplot.i @@ -0,0 +1,15 @@ +/* Oh what the heck, let's just grab the whole darn header file + and see what happens. */ + +%module gifplot +%{ + +/* Note: You still need this part because the %include directive + merely causes SWIG to interpret the contents of a file. It doesn't + include the right include headers for the resulting C code */ + +#include "gifplot.h" +%} + +typedef int Pixel; +%include gifplot.h diff --git a/Examples/GIFPlot/Ocaml/full/runme.ml b/Examples/GIFPlot/Ocaml/full/runme.ml new file mode 100644 index 000000000..0dfa98569 --- /dev/null +++ b/Examples/GIFPlot/Ocaml/full/runme.ml @@ -0,0 +1,87 @@ +(* Plot a 3D Function *) + +(* Use the wrapped GIFPlot library *) +open Swig +open Gifplot +open Int32 + +(* Here is the function to plot *) +let func x y = + 5.0 *. + (cos (2.0 *. (sqrt (x *. x) +. (y *. y)))) *. + (exp (-0.3 *. (sqrt (x *. x) +. (y *. y)))) + +(* Here are some plotting parameters *) + +let xmin = -5.0 +let xmax = 5.0 +let ymin = -5.0 +let ymax = 5.0 +let zmin = -5.0 +let zmax = 5.0 + +(* Grid resolution *) +let nxpoints = 60 +let nypoints = 60 + +let cmap = _new_ColorMap (C_string "cmap") +let frame = _new_FrameBuffer (C_list [ C_int 500 ; + C_int 500 ]) +let _ = _FrameBuffer_clear (C_list [ frame ; _BLACK C_void ]) + +let p2 = _new_Plot3D (C_list [ frame ; + C_float xmin ; C_float ymin ; C_float zmin ; + C_float xmax ; C_float ymax ; C_float zmax ]) +let _ = _Plot3D_lookat (C_list [ p2 ; C_float (2.0 *. (zmax -. zmin)) ]) +let _ = _Plot3D_autoperspective (C_list [ p2 ; C_float 40.0 ]) +let _ = _Plot3D_rotu (C_list [ p2 ; C_float 60.0 ]) +let _ = _Plot3D_rotr (C_list [ p2 ; C_float 30.0 ]) +let _ = _Plot3D_rotd (C_list [ p2 ; C_float 10.0 ]) + +let drawsolid () = + begin + _Plot3D_clear (C_list [ p2 ; _BLACK C_void ]) ; + _Plot3D_start p2 ; + let dx = ((xmax -. xmin) /. (float_of_int nxpoints)) + and dy = ((ymax -. ymin) /. (float_of_int nypoints)) + and cscale = (240.0 /. (zmax -. zmin)) in + let rec x_loop x i = + if i < nxpoints then + begin + let rec y_loop y j = + begin + if j < nypoints then + let z1 = func x y + and z2 = func (x +. dx) y + and z3 = func (x +. dx) (y +. dy) + and z4 = func x (y +. dy) in + let c1 = cscale *. (z1 -. zmin) + and c2 = cscale *. (z2 -. zmin) + and c3 = cscale *. (z3 -. zmin) + and c4 = cscale *. (z4 -. zmin) in + let cc = (c1 +. c2 +. c3 +. c4) /. 4.0 in + let c = (max (min (int_of_float cc) 239) 0) in + _Plot3D_solidquad + (C_list (p2 :: + (List.map + (fun x -> C_float x) + [ x ; y ; z1 ; + (x +. dx) ; y ; z2 ; + (x +. dx) ; (y +. dy) ; z3 ; + x ; (y +. dx) ; z4 ; + (float_of_int (c + 16)) ]))) ; + y_loop (y +. dy) (j + 1) + end in + begin + y_loop ymin 0 ; + x_loop (x +. dx) (i + 1) + end + end in + x_loop xmin 0 + end + +let _ = print_endline "Making a nice 3D plot..." +let _ = drawsolid () + +let _ = _FrameBuffer_writeGIF (C_list [ frame ; cmap ; C_string "image.gif" ]) +let _ = print_endline "Write image.gif" diff --git a/Examples/GIFPlot/Ocaml/simple/Makefile b/Examples/GIFPlot/Ocaml/simple/Makefile new file mode 100644 index 000000000..50492efc7 --- /dev/null +++ b/Examples/GIFPlot/Ocaml/simple/Makefile @@ -0,0 +1,33 @@ +TOP = ../../.. +SWIG = $(TOP)/../swig +SWIGOPT = -I../../Include +SRCS = +TARGET = gifsimple +INTERFACE = simple.i +LIBS = -L../.. -lgifplot -lm +INCLUDES = -I../../Include +MLFILE = simple.ml +IOBJS = simple_wrap.o simple.cmo runme.cmo +PROGFILE = runme.ml + +all:: static + +static:: + $(MAKE) -f $(TOP)/Makefile TOP='$(TOP)' \ + IOBJS='$(IOBJS)' PROGFILE='$(PROGFILE)' \ + SRCS='$(SRCS)' SWIG='$(SWIG)' MLFILE='$(MLFILE)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ocaml_static + +dynamic:: + $(MAKE) -f $(TOP)/Makefile TOP='$(TOP)' \ + IOBJS='$(IOBJS)' PROGFILE='$(PROGFILE)' \ + SRCS='$(SRCS)' SWIG='$(SWIG)' MLFILE='$(MLFILE)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ocaml_static + +clean:: + $(MAKE) -f $(TOP)/Makefile MLFILE='$(MLFILE)' ocaml_clean + rm -f *.gif + +check: all diff --git a/Examples/GIFPlot/Ocaml/simple/cmap b/Examples/GIFPlot/Ocaml/simple/cmap new file mode 100644 index 000000000..a20c331a9 Binary files /dev/null and b/Examples/GIFPlot/Ocaml/simple/cmap differ diff --git a/Examples/GIFPlot/Ocaml/simple/runme.ml b/Examples/GIFPlot/Ocaml/simple/runme.ml new file mode 100644 index 000000000..3b6602cbc --- /dev/null +++ b/Examples/GIFPlot/Ocaml/simple/runme.ml @@ -0,0 +1,35 @@ +(* Draw some simple shapes *) + +(* Use the wrapped GIFPlot library *) +open Swig +open Simple +open Int32 + +let _ = print_endline "Drawing some basic shapes" + +let cmap = _new_ColorMap (C_string "cmap") +let f = _new_FrameBuffer (C_list [ C_int 400 ; C_int 400 ]) + +(* Clear the picture *) +let _ = _FrameBuffer_clear (C_list [ f ; _BLACK C_void ]) + +(* Make a red box *) +let _ = _FrameBuffer_box + (C_list [ f ; C_int 40 ; C_int 40 ; C_int 200 ; C_int 200 ; _RED C_void ]) + +(* Make a blue circle *) +let _ = _FrameBuffer_circle + (C_list [ f ; C_int 200 ; C_int 200 ; C_int 40 ; _BLUE C_void ]) + +(* Make green line *) +let _ = _FrameBuffer_line + (C_list [ f ; C_int 10 ; C_int 390 ; C_int 390 ; C_int 200 ; _GREEN C_void ]) + +(* Write an image out to disk *) + +let _ = _FrameBuffer_writeGIF (C_list [ f ; cmap ; C_string "image.gif" ]) +let _ = print_endline "Wrote image.gif" + +let _ = _delete_FrameBuffer f +let _ = _delete_ColorMap cmap + diff --git a/Examples/GIFPlot/Ocaml/simple/simple.i b/Examples/GIFPlot/Ocaml/simple/simple.i new file mode 100644 index 000000000..33297f491 --- /dev/null +++ b/Examples/GIFPlot/Ocaml/simple/simple.i @@ -0,0 +1,33 @@ +/* This example shows a very simple interface wrapping a few + primitive declarations */ + +%module simple +%{ +#include "gifplot.h" +%} + +typedef int Pixel; + +/* Here are a few useful functions */ + +ColorMap *new_ColorMap(char *filename = 0); +void delete_ColorMap(ColorMap *cmap); + +FrameBuffer *new_FrameBuffer(unsigned int width, unsigned int height); +void delete_FrameBuffer(FrameBuffer *frame); +void FrameBuffer_clear(FrameBuffer *frame, Pixel color); +void FrameBuffer_line(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); +void FrameBuffer_box(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); +void FrameBuffer_circle(FrameBuffer *frame, int x1, int y1, int radius, Pixel color); +int FrameBuffer_writeGIF(FrameBuffer *f, ColorMap *c, char *filename); + +/* And some useful constants */ + +#define BLACK 0 +#define WHITE 1 +#define RED 2 +#define GREEN 3 +#define BLUE 4 +#define YELLOW 5 +#define CYAN 6 +#define MAGENTA 7 diff --git a/Examples/GIFPlot/Perl5/check.list b/Examples/GIFPlot/Perl5/check.list new file mode 100644 index 000000000..13de977af --- /dev/null +++ b/Examples/GIFPlot/Perl5/check.list @@ -0,0 +1,4 @@ +# see top-level Makefile.in +full +shadow +simple diff --git a/Examples/GIFPlot/Perl5/full/Makefile b/Examples/GIFPlot/Perl5/full/Makefile new file mode 100644 index 000000000..0e0878d03 --- /dev/null +++ b/Examples/GIFPlot/Perl5/full/Makefile @@ -0,0 +1,24 @@ +TOP = ../../.. +SWIG = $(TOP)/../swig +SWIGOPT = -I../../Include -noproxy +SRCS = +TARGET = gifplot +INTERFACE = gifplot.i +LIBS = -L../.. -lgifplot -lm +INCLUDES = -I../../Include + +all:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' perl5 + +static:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_static + +clean:: + $(MAKE) -f $(TOP)/Makefile perl5_clean + rm -f *.gif + +check: all diff --git a/Examples/GIFPlot/Perl5/full/README b/Examples/GIFPlot/Perl5/full/README new file mode 100644 index 000000000..05c685a80 --- /dev/null +++ b/Examples/GIFPlot/Perl5/full/README @@ -0,0 +1,8 @@ +This example runs the entire gifplot.h header file through SWIG without +any changes. The script 'runme.pl' does something a little more +interesting. You'll have to go look at the header file to get a complete +listing of the functions. + + + + diff --git a/Examples/GIFPlot/Perl5/full/cmap b/Examples/GIFPlot/Perl5/full/cmap new file mode 100644 index 000000000..a20c331a9 Binary files /dev/null and b/Examples/GIFPlot/Perl5/full/cmap differ diff --git a/Examples/GIFPlot/Perl5/full/gifplot.i b/Examples/GIFPlot/Perl5/full/gifplot.i new file mode 100644 index 000000000..5a7f5008f --- /dev/null +++ b/Examples/GIFPlot/Perl5/full/gifplot.i @@ -0,0 +1,15 @@ +/* Oh what the heck, let's just grab the whole darn header file + and see what happens. */ + +%module gifplot +%{ + +/* Note: You still need this part because the %include directive + merely causes SWIG to interpret the contents of a file. It doesn't + include the right include headers for the resulting C code */ + +#include "gifplot.h" + +%} + +%include gifplot.h diff --git a/Examples/GIFPlot/Perl5/full/runme.pl b/Examples/GIFPlot/Perl5/full/runme.pl new file mode 100644 index 000000000..77fd321c9 --- /dev/null +++ b/Examples/GIFPlot/Perl5/full/runme.pl @@ -0,0 +1,68 @@ +# Plot a 3D function +use gifplot; +package gifplot; + +# Here is the function to plot +sub func { + my $x = shift; + my $y = shift; + return 5*cos(2*sqrt($x*$x+$y*$y))*exp(-0.3*sqrt($x*$x+$y*$y)); +} + +# Here are some plotting parameters +$xmin = -5.0; +$xmax = 5.0; +$ymin = -5.0; +$ymax = 5.0; +$zmin = -5.0; +$zmax = 5.0; + +# Grid resolution +$nxpoints = 60; +$nypoints = 60; + +$cmap = new_ColorMap("cmap"); +$frame = new_FrameBuffer(500,500); +FrameBuffer_clear($frame,$BLACK); + +$p3 = new_Plot3D($frame,$xmin,$ymin,$zmin,$xmax,$ymax,$zmax); +Plot3D_lookat($p3,2*($zmax-$zmin)); +Plot3D_autoperspective($p3,40); +Plot3D_rotu($p3,60); +Plot3D_rotr($p3,30); +Plot3D_rotd($p3,10); + +sub drawsolid { + Plot3D_clear($p3,$BLACK); + Plot3D_start($p3); + my $dx = 1.0*($xmax-$xmin)/$nxpoints; + my $dy = 1.0*($ymax-$ymin)/$nypoints; + my $cscale = 240.0/($zmax-$zmin); + my $x = $xmin; + for ($i = 0; $i < $nxpoints; $i++) { + my $y = $ymin; + for ($j = 0; $j < $nypoints; $j++) { + my $z1 = func($x,$y); + my $z2 = func($x+$dx,$y); + my $z3 = func($x+$dx,$y+$dy); + my $z4 = func($x,$y+$dy); + my $c1 = $cscale*($z1-$zmin); + my $c2 = $cscale*($z2-$zmin); + my $c3 = $cscale*($z3-$zmin); + my $c4 = $cscale*($z4-$zmin); + my $c = ($c1+$c2+$c3+$c4)/4; + if ($c < 0) { $c = 0; } + if ($c > 239) { $c = 239; } + Plot3D_solidquad($p3,$x,$y,$z1,$x+$dx,$y,$z2,$x+$dx,$y+$dy,$z3,$x,$y+$dy,$z4,$c+16); + $y = $y + $dy; + } + $x = $x + $dx; + } +} + +print "Making a nice 3D plot...\n"; +drawsolid(); + +FrameBuffer_writeGIF($frame,$cmap,"image.gif"); +print "Wrote image.gif\n"; + diff --git a/Examples/GIFPlot/Perl5/shadow/Makefile b/Examples/GIFPlot/Perl5/shadow/Makefile new file mode 100644 index 000000000..c39eac52c --- /dev/null +++ b/Examples/GIFPlot/Perl5/shadow/Makefile @@ -0,0 +1,25 @@ +TOP = ../../.. +SWIG = $(TOP)/../swig +SWIGOPT = -outcurrentdir +SRCS = +TARGET = gifplot +INTERFACEDIR = ../../Interface/ +INTERFACE = gifplot.i +LIBS = -L../.. -lgifplot -lm +INCLUDES = -I../../Include + +all:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' INTERFACEDIR='$(INTERFACEDIR)' perl5 + +static:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='myperl' INTERFACE='$(INTERFACE)' INTERFACEDIR='$(INTERFACEDIR)' perl5_static + +clean:: + $(MAKE) -f $(TOP)/Makefile perl5_clean + rm -f *.gif + +check: all diff --git a/Examples/GIFPlot/Perl5/shadow/README b/Examples/GIFPlot/Perl5/shadow/README new file mode 100644 index 000000000..ab12e344e --- /dev/null +++ b/Examples/GIFPlot/Perl5/shadow/README @@ -0,0 +1,2 @@ +This example use the file in ../../Interface/gifplot.i to build +an interface with shadow classes. Run the script 'runme.pl'. diff --git a/Examples/GIFPlot/Perl5/shadow/cmap b/Examples/GIFPlot/Perl5/shadow/cmap new file mode 100644 index 000000000..a20c331a9 Binary files /dev/null and b/Examples/GIFPlot/Perl5/shadow/cmap differ diff --git a/Examples/GIFPlot/Perl5/shadow/runme.pl b/Examples/GIFPlot/Perl5/shadow/runme.pl new file mode 100644 index 000000000..c396251af --- /dev/null +++ b/Examples/GIFPlot/Perl5/shadow/runme.pl @@ -0,0 +1,68 @@ +# Plot a 3D function +use gifplot; +package gifplot; + +# Here is the function to plot +sub func { + my $x = shift; + my $y = shift; + return 5*cos(2*sqrt($x*$x+$y*$y))*exp(-0.3*sqrt($x*$x+$y*$y)); +} + +# Here are some plotting parameters +$xmin = -5.0; +$xmax = 5.0; +$ymin = -5.0; +$ymax = 5.0; +$zmin = -5.0; +$zmax = 5.0; + +# Grid resolution +$nxpoints = 60; +$nypoints = 60; + +$cmap = new gifplot::ColorMap("cmap"); +$frame = new gifplot::FrameBuffer(500,500); +$frame->clear($BLACK); + +$p3 = new gifplot::Plot3D($frame,$xmin,$ymin,$zmin,$xmax,$ymax,$zmax); +$p3->lookat(2*($zmax-$zmin)); +$p3->autoperspective(40); +$p3->rotu(60); +$p3->rotr(30); +$p3->rotd(10); + +sub drawsolid { + $p3->clear($BLACK); + $p3->start(); + my $dx = 1.0*($xmax-$xmin)/$nxpoints; + my $dy = 1.0*($ymax-$ymin)/$nypoints; + my $cscale = 240.0/($zmax-$zmin); + my $x = $xmin; + for ($i = 0; $i < $nxpoints; $i++) { + my $y = $ymin; + for ($j = 0; $j < $nypoints; $j++) { + my $z1 = func($x,$y); + my $z2 = func($x+$dx,$y); + my $z3 = func($x+$dx,$y+$dy); + my $z4 = func($x,$y+$dy); + my $c1 = $cscale*($z1-$zmin); + my $c2 = $cscale*($z2-$zmin); + my $c3 = $cscale*($z3-$zmin); + my $c4 = $cscale*($z4-$zmin); + my $c = ($c1+$c2+$c3+$c4)/4; + if ($c < 0) { $c = 0; } + if ($c > 239) { $c = 239; } + $p3->solidquad($x,$y,$z1,$x+$dx,$y,$z2,$x+$dx,$y+$dy,$z3,$x,$y+$dy,$z4,$c+16); + $y = $y + $dy; + } + $x = $x + $dx; + } +} + +print "Making a nice 3D plot...\n"; +drawsolid(); + +$frame->writeGIF($cmap,"image.gif"); +print "Wrote image.gif\n"; + diff --git a/Examples/GIFPlot/Perl5/simple/Makefile b/Examples/GIFPlot/Perl5/simple/Makefile new file mode 100644 index 000000000..36a8fa938 --- /dev/null +++ b/Examples/GIFPlot/Perl5/simple/Makefile @@ -0,0 +1,24 @@ +TOP = ../../.. +SWIG = $(TOP)/../swig +SWIGOPT = +SRCS = +TARGET = simple +INTERFACE = simple.i +LIBS = -L../.. -lgifplot +INCLUDES = -I../../Include + +all:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' perl5 + +static:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_static + +clean:: + $(MAKE) -f $(TOP)/Makefile perl5_clean + rm -f *.gif + +check: all diff --git a/Examples/GIFPlot/Perl5/simple/README b/Examples/GIFPlot/Perl5/simple/README new file mode 100644 index 000000000..c2c799a70 --- /dev/null +++ b/Examples/GIFPlot/Perl5/simple/README @@ -0,0 +1,5 @@ +This is a very minimalistic example in which just a few functions +and constants from library are wrapped and used to draw some simple +shapes. The script 'runme.pl' runs the example. + + diff --git a/Examples/GIFPlot/Perl5/simple/runme.pl b/Examples/GIFPlot/Perl5/simple/runme.pl new file mode 100644 index 000000000..f28255e7c --- /dev/null +++ b/Examples/GIFPlot/Perl5/simple/runme.pl @@ -0,0 +1,28 @@ +# Draw some simple shapes +print "Drawing some basic shapes\n"; + +use simple; + +$cmap = simple::new_ColorMap(); +$f = simple::new_FrameBuffer(400,400); + +# Clear the picture +simple::FrameBuffer_clear($f,$simple::BLACK); + +# Make a red box +simple::FrameBuffer_box($f,40,40,200,200,$simple::RED); + +# Make a blue circle +simple::FrameBuffer_circle($f,200,200,40,$simple::BLUE); + +# Make green line +simple::FrameBuffer_line($f,10,390,390,200, $simple::GREEN); + +# Write an image out to disk + +simple::FrameBuffer_writeGIF($f,$cmap,"image.gif"); +print "Wrote image.gif\n"; + +simple::delete_FrameBuffer($f); +simple::delete_ColorMap($cmap); + diff --git a/Examples/GIFPlot/Perl5/simple/simple.i b/Examples/GIFPlot/Perl5/simple/simple.i new file mode 100644 index 000000000..457bc4c09 --- /dev/null +++ b/Examples/GIFPlot/Perl5/simple/simple.i @@ -0,0 +1,38 @@ +/* This example shows a very simple interface wrapping a few + primitive declarations */ + +%module simple +%{ +#include "gifplot.h" +%} + +typedef unsigned char Pixel; + +/* Here are a few useful functions */ + +ColorMap *new_ColorMap(char *filename = 0); +void delete_ColorMap(ColorMap *cmap); + +FrameBuffer *new_FrameBuffer(unsigned int width, unsigned int height); +void delete_FrameBuffer(FrameBuffer *frame); +void FrameBuffer_clear(FrameBuffer *frame, Pixel color); +void FrameBuffer_line(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); +void FrameBuffer_box(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); +void FrameBuffer_circle(FrameBuffer *frame, int x1, int y1, int radius, Pixel color); +int FrameBuffer_writeGIF(FrameBuffer *f, ColorMap *c, char *filename); + +/* And some useful constants */ + +#define BLACK 0 +#define WHITE 1 +#define RED 2 +#define GREEN 3 +#define BLUE 4 +#define YELLOW 5 +#define CYAN 6 +#define MAGENTA 7 + + + + + diff --git a/Examples/GIFPlot/Php/check.list b/Examples/GIFPlot/Php/check.list new file mode 100644 index 000000000..e75ee586a --- /dev/null +++ b/Examples/GIFPlot/Php/check.list @@ -0,0 +1,3 @@ +# see top-level Makefile.in +full +simple diff --git a/Examples/GIFPlot/Php/full/Makefile b/Examples/GIFPlot/Php/full/Makefile new file mode 100644 index 000000000..e33e7a730 --- /dev/null +++ b/Examples/GIFPlot/Php/full/Makefile @@ -0,0 +1,20 @@ +TOP = ../../.. +SWIG = $(TOP)/../swig +SWIGOPT = -I../../Include -noproxy +SRCS = +TARGET = php_gifplot +INTERFACE = gifplot.i +LIBS = -L../.. -lgifplot -lm +INCLUDES = -I../../Include + +all:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' php + +clean:: + $(MAKE) -f $(TOP)/Makefile php_clean + rm -f *.gif + rm -f php_gifplot.h + +check: all diff --git a/Examples/GIFPlot/Php/full/README b/Examples/GIFPlot/Php/full/README new file mode 100644 index 000000000..f8d38d9af --- /dev/null +++ b/Examples/GIFPlot/Php/full/README @@ -0,0 +1,4 @@ +This example runs the entire gifplot.h header file through SWIG without +any changes. The script 'runme.php3' does something a little more +interesting. You'll have to go look at the header file to get a complete +listing of the functions. diff --git a/Examples/GIFPlot/Php/full/cmap b/Examples/GIFPlot/Php/full/cmap new file mode 100644 index 000000000..a20c331a9 Binary files /dev/null and b/Examples/GIFPlot/Php/full/cmap differ diff --git a/Examples/GIFPlot/Php/full/gifplot.i b/Examples/GIFPlot/Php/full/gifplot.i new file mode 100644 index 000000000..5a7f5008f --- /dev/null +++ b/Examples/GIFPlot/Php/full/gifplot.i @@ -0,0 +1,15 @@ +/* Oh what the heck, let's just grab the whole darn header file + and see what happens. */ + +%module gifplot +%{ + +/* Note: You still need this part because the %include directive + merely causes SWIG to interpret the contents of a file. It doesn't + include the right include headers for the resulting C code */ + +#include "gifplot.h" + +%} + +%include gifplot.h diff --git a/Examples/GIFPlot/Php/full/runme.php b/Examples/GIFPlot/Php/full/runme.php new file mode 100644 index 000000000..de5371ee8 --- /dev/null +++ b/Examples/GIFPlot/Php/full/runme.php @@ -0,0 +1,78 @@ + 239) { $c = 239; } + Plot3D_solidquad($p3, $x,$y,$z1,$x+$dx,$y,$z2,$x+$dx,$y+$dy,$z3,$x,$y+$dy,$z4,$c+16); + $y = $y + $dy; + } + $x = $x + $dx; + } +} + +print "Making a nice 3D plot...\n"; +drawsolid(); + +FrameBuffer_writeGIF($frame, $cmap,"image.gif"); +print "Wrote image.gif\n"; + +?> diff --git a/Examples/GIFPlot/Php/shadow/Makefile b/Examples/GIFPlot/Php/shadow/Makefile new file mode 100644 index 000000000..df8ee30c0 --- /dev/null +++ b/Examples/GIFPlot/Php/shadow/Makefile @@ -0,0 +1,19 @@ +TOP = ../../.. +SWIG = $(TOP)/../swig +SWIGOPT = -I../../Interface +SRCS = +TARGET = php_gifplot +INTERFACE = gifplot.i +LIBS = -L../.. -lgifplot -lm +INCLUDES = -I../../Include + +all:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' php + +clean:: + $(MAKE) -f $(TOP)/Makefile php_clean + rm -f *.gif + +check: all diff --git a/Examples/GIFPlot/Php/shadow/README b/Examples/GIFPlot/Php/shadow/README new file mode 100644 index 000000000..3e91f7d59 --- /dev/null +++ b/Examples/GIFPlot/Php/shadow/README @@ -0,0 +1,2 @@ +This example use the file in ../../Interface/gifplot.i to build +an interface with shadow classes. Run the script 'runme.php3'. diff --git a/Examples/GIFPlot/Php/shadow/cmap b/Examples/GIFPlot/Php/shadow/cmap new file mode 100644 index 000000000..a20c331a9 Binary files /dev/null and b/Examples/GIFPlot/Php/shadow/cmap differ diff --git a/Examples/GIFPlot/Php/shadow/runme.php b/Examples/GIFPlot/Php/shadow/runme.php new file mode 100644 index 000000000..3dffba050 --- /dev/null +++ b/Examples/GIFPlot/Php/shadow/runme.php @@ -0,0 +1,79 @@ +clear(BLACK); + + +$p3 = new Plot3D($frame,$xmin,$ymin,$zmin,$xmax,$ymax,$zmax); +$p3->lookat(2*($zmax-$zmin)); +$p3->autoperspective(40); +$p3->rotu(60); +$p3->rotr(30); +$p3->rotd(10); + +function drawsolid() { + global $xmax; + global $xmin; + global $ymax; + global $ymin; + global $zmin; + global $zmax; + global $nxpoints; + global $nypoints; + global $p3; + + $p3->clear(BLACK); + $p3->start(); + $dx = 1.0*($xmax-$xmin)/$nxpoints; + $dy = 1.0*($ymax-$ymin)/$nypoints; + $cscale = 240.0/($zmax-$zmin); + $x = $xmin; + for ($i = 0; $i < $nxpoints; $i++) { + $y = $ymin; + for ($j = 0; $j < $nypoints; $j++) { + $z1 = func($x,$y); + $z2 = func($x+$dx,$y); + $z3 = func($x+$dx,$y+$dy); + $z4 = func($x,$y+$dy); + $c1 = $cscale*($z1-$zmin); + $c2 = $cscale*($z2-$zmin); + $c3 = $cscale*($z3-$zmin); + $c4 = $cscale*($z4-$zmin); + $c = ($c1+$c2+$c3+$c4)/4; + if ($c < 0) { $c = 0; } + if ($c > 239) { $c = 239; } + $p3->solidquad($x,$y,$z1,$x+$dx,$y,$z2,$x+$dx,$y+$dy,$z3,$x,$y+$dy,$z4,$c+16); + $y = $y + $dy; + } + $x = $x + $dx; + } +} + +print "Making a nice 3D plot...\n"; +drawsolid(); + +$frame->writeGIF($cmap,"image.gif"); +print "Wrote image.gif\n"; + +?> diff --git a/Examples/GIFPlot/Php/simple/Makefile b/Examples/GIFPlot/Php/simple/Makefile new file mode 100644 index 000000000..e60b641fa --- /dev/null +++ b/Examples/GIFPlot/Php/simple/Makefile @@ -0,0 +1,20 @@ +TOP = ../../.. +SWIG = $(TOP)/../swig +SWIGOPT = -noproxy +SRCS = +TARGET = php_simple +INTERFACE = simple.i +LIBS = -L../.. -lgifplot +INCLUDES = -I../../Include + +all:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' php + +clean:: + $(MAKE) -f $(TOP)/Makefile php_clean + rm -f *.gif + rm -f php_simple.h + +check: all diff --git a/Examples/GIFPlot/Php/simple/README b/Examples/GIFPlot/Php/simple/README new file mode 100644 index 000000000..c2c799a70 --- /dev/null +++ b/Examples/GIFPlot/Php/simple/README @@ -0,0 +1,5 @@ +This is a very minimalistic example in which just a few functions +and constants from library are wrapped and used to draw some simple +shapes. The script 'runme.pl' runs the example. + + diff --git a/Examples/GIFPlot/Php/simple/runme.php b/Examples/GIFPlot/Php/simple/runme.php new file mode 100644 index 000000000..cf21a0927 --- /dev/null +++ b/Examples/GIFPlot/Php/simple/runme.php @@ -0,0 +1,32 @@ + + diff --git a/Examples/GIFPlot/Php/simple/simple.i b/Examples/GIFPlot/Php/simple/simple.i new file mode 100644 index 000000000..457bc4c09 --- /dev/null +++ b/Examples/GIFPlot/Php/simple/simple.i @@ -0,0 +1,38 @@ +/* This example shows a very simple interface wrapping a few + primitive declarations */ + +%module simple +%{ +#include "gifplot.h" +%} + +typedef unsigned char Pixel; + +/* Here are a few useful functions */ + +ColorMap *new_ColorMap(char *filename = 0); +void delete_ColorMap(ColorMap *cmap); + +FrameBuffer *new_FrameBuffer(unsigned int width, unsigned int height); +void delete_FrameBuffer(FrameBuffer *frame); +void FrameBuffer_clear(FrameBuffer *frame, Pixel color); +void FrameBuffer_line(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); +void FrameBuffer_box(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); +void FrameBuffer_circle(FrameBuffer *frame, int x1, int y1, int radius, Pixel color); +int FrameBuffer_writeGIF(FrameBuffer *f, ColorMap *c, char *filename); + +/* And some useful constants */ + +#define BLACK 0 +#define WHITE 1 +#define RED 2 +#define GREEN 3 +#define BLUE 4 +#define YELLOW 5 +#define CYAN 6 +#define MAGENTA 7 + + + + + diff --git a/Examples/GIFPlot/Pike/check.list b/Examples/GIFPlot/Pike/check.list new file mode 100644 index 000000000..d38998cab --- /dev/null +++ b/Examples/GIFPlot/Pike/check.list @@ -0,0 +1,2 @@ +# see top-level Makefile.in +simple diff --git a/Examples/GIFPlot/Pike/simple/Makefile b/Examples/GIFPlot/Pike/simple/Makefile new file mode 100644 index 000000000..d339e0333 --- /dev/null +++ b/Examples/GIFPlot/Pike/simple/Makefile @@ -0,0 +1,24 @@ +TOP = ../../.. +SWIG = $(TOP)/../swig +SWIGOPT = +SRCS = +TARGET = simple +INTERFACE = simple.i +LIBS = -L../.. -lgifplot +INCLUDES = -I../../Include + +all:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' pike + +static:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='mypike' INTERFACE='$(INTERFACE)' pike_static + +clean:: + $(MAKE) -f $(TOP)/Makefile pike_clean + rm -f *.gif + +check: all diff --git a/Examples/GIFPlot/Pike/simple/README b/Examples/GIFPlot/Pike/simple/README new file mode 100644 index 000000000..177b3633b --- /dev/null +++ b/Examples/GIFPlot/Pike/simple/README @@ -0,0 +1,5 @@ +This is a very minimalistic example in which just a few functions +and constants from library are wrapped and used to draw some simple +shapes. The script 'runme.pike' runs the example. + + diff --git a/Examples/GIFPlot/Pike/simple/runme.pike b/Examples/GIFPlot/Pike/simple/runme.pike new file mode 100644 index 000000000..0e70235f1 --- /dev/null +++ b/Examples/GIFPlot/Pike/simple/runme.pike @@ -0,0 +1,30 @@ +int main() +{ + // Draw some simple shapes + write("Drawing some basic shapes\n"); + + .simple.ColorMap cmap = .simple.new_ColorMap(); + .simple.FrameBuffer f = .simple.new_FrameBuffer(400, 400); + + // Clear the picture + .simple.FrameBuffer_clear(f, .simple.BLACK); + + // Make a red box + .simple.FrameBuffer_box(f, 40, 40, 200, 200, .simple.RED); + + // Make a blue circle + .simple.FrameBuffer_circle(f, 200, 200, 40, .simple.BLUE); + + // Make green line + .simple.FrameBuffer_line(f, 10, 390, 390, 200, .simple.GREEN); + + // Write an image out to disk + .simple.FrameBuffer_writeGIF(f, cmap, "image.gif"); + write("Wrote image.gif\n"); + + .simple.delete_FrameBuffer(f); + .simple.delete_ColorMap(cmap); + + return 0; +} + diff --git a/Examples/GIFPlot/Pike/simple/simple.i b/Examples/GIFPlot/Pike/simple/simple.i new file mode 100644 index 000000000..457bc4c09 --- /dev/null +++ b/Examples/GIFPlot/Pike/simple/simple.i @@ -0,0 +1,38 @@ +/* This example shows a very simple interface wrapping a few + primitive declarations */ + +%module simple +%{ +#include "gifplot.h" +%} + +typedef unsigned char Pixel; + +/* Here are a few useful functions */ + +ColorMap *new_ColorMap(char *filename = 0); +void delete_ColorMap(ColorMap *cmap); + +FrameBuffer *new_FrameBuffer(unsigned int width, unsigned int height); +void delete_FrameBuffer(FrameBuffer *frame); +void FrameBuffer_clear(FrameBuffer *frame, Pixel color); +void FrameBuffer_line(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); +void FrameBuffer_box(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); +void FrameBuffer_circle(FrameBuffer *frame, int x1, int y1, int radius, Pixel color); +int FrameBuffer_writeGIF(FrameBuffer *f, ColorMap *c, char *filename); + +/* And some useful constants */ + +#define BLACK 0 +#define WHITE 1 +#define RED 2 +#define GREEN 3 +#define BLUE 4 +#define YELLOW 5 +#define CYAN 6 +#define MAGENTA 7 + + + + + diff --git a/Examples/GIFPlot/Python/check.list b/Examples/GIFPlot/Python/check.list new file mode 100644 index 000000000..13de977af --- /dev/null +++ b/Examples/GIFPlot/Python/check.list @@ -0,0 +1,4 @@ +# see top-level Makefile.in +full +shadow +simple diff --git a/Examples/GIFPlot/Python/full/Makefile b/Examples/GIFPlot/Python/full/Makefile new file mode 100644 index 000000000..83a7c864b --- /dev/null +++ b/Examples/GIFPlot/Python/full/Makefile @@ -0,0 +1,26 @@ +TOP = ../../.. +SWIG = $(TOP)/../preinst-swig +SWIGOPT = -I../../Include +SRCS = +TARGET = gifplot +INTERFACE = gifplot.i +LIBS = -L../.. -lgifplot +INCLUDES = -I../../Include + +all:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python + +static:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='mypython' INTERFACE='$(INTERFACE)' python_static + +clean:: + $(MAKE) -f $(TOP)/Makefile python_clean + rm -f $(TARGET).py + rm -f *.gif + +check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/GIFPlot/Python/full/README b/Examples/GIFPlot/Python/full/README new file mode 100644 index 000000000..52971e40a --- /dev/null +++ b/Examples/GIFPlot/Python/full/README @@ -0,0 +1,8 @@ +This example runs the entire gifplot.h header file through SWIG without +any changes. The script 'runme.py' does something a little more +interesting. You'll have to go look at the header file to get a complete +listing of the functions. + + + + diff --git a/Examples/GIFPlot/Python/full/cmap b/Examples/GIFPlot/Python/full/cmap new file mode 100644 index 000000000..a20c331a9 Binary files /dev/null and b/Examples/GIFPlot/Python/full/cmap differ diff --git a/Examples/GIFPlot/Python/full/gifplot.i b/Examples/GIFPlot/Python/full/gifplot.i new file mode 100644 index 000000000..5a7f5008f --- /dev/null +++ b/Examples/GIFPlot/Python/full/gifplot.i @@ -0,0 +1,15 @@ +/* Oh what the heck, let's just grab the whole darn header file + and see what happens. */ + +%module gifplot +%{ + +/* Note: You still need this part because the %include directive + merely causes SWIG to interpret the contents of a file. It doesn't + include the right include headers for the resulting C code */ + +#include "gifplot.h" + +%} + +%include gifplot.h diff --git a/Examples/GIFPlot/Python/full/runme.py b/Examples/GIFPlot/Python/full/runme.py new file mode 100644 index 000000000..cb324c814 --- /dev/null +++ b/Examples/GIFPlot/Python/full/runme.py @@ -0,0 +1,64 @@ +# Plot a 3D function +# This example uses the low-level C interface. + +from _gifplot import * +from math import * + +# Here is the function to plot +def func(x,y): + return 5*cos(2*sqrt(x*x+y*y))*exp(-0.3*sqrt(x*x+y*y)) + +# Here are some plotting parameters +xmin = -5.0 +xmax = 5.0 +ymin = -5.0 +ymax = 5.0 +zmin = -5.0 +zmax = 5.0 + +# Grid resolution +nxpoints = 60 +nypoints = 60 + +cmap = new_ColorMap("cmap") +frame = new_FrameBuffer(500,500) +FrameBuffer_clear(frame,BLACK) + +p3 = new_Plot3D(frame,xmin,ymin,zmin,xmax,ymax,zmax) +Plot3D_lookat(p3,2*max([xmax-xmin,ymax-ymin,zmax-zmin])) +Plot3D_autoperspective(p3,40) +Plot3D_rotu(p3,60) +Plot3D_rotr(p3,30) +Plot3D_rotd(p3,10) + +def drawsolid(): + Plot3D_clear(p3,BLACK) + Plot3D_start(p3) + dx = 1.0*(xmax-xmin)/nxpoints + dy = 1.0*(ymax-ymin)/nypoints + cscale = 240.0/(zmax-zmin) + x = xmin + for i in xrange(0,nxpoints): + y = ymin + for j in xrange(0,nypoints): + z1 = func(x,y) + z2 = func(x+dx,y) + z3 = func(x+dx,y+dy) + z4 = func(x,y+dy) + c1 = cscale*(z1-zmin) + c2 = cscale*(z2-zmin) + c3 = cscale*(z3-zmin) + c4 = cscale*(z4-zmin) + c = int((c1+c2+c3+c4)/4) + if (c < 0) : c = 0 + if c > 239 : c = 239 + Plot3D_solidquad(p3,x,y,z1,x+dx,y,z2,x+dx,y+dy,z3,x,y+dy,z4,c+16) + y = y + dy + x = x + dx + +print "Making a nice 3D plot..." +drawsolid() + +FrameBuffer_writeGIF(frame,cmap,"image.gif") +print "Wrote image.gif" + diff --git a/Examples/GIFPlot/Python/shadow/Makefile b/Examples/GIFPlot/Python/shadow/Makefile new file mode 100644 index 000000000..3ae9a9897 --- /dev/null +++ b/Examples/GIFPlot/Python/shadow/Makefile @@ -0,0 +1,27 @@ +TOP = ../../.. +SWIG = $(TOP)/../preinst-swig +SWIGOPT = -outcurrentdir +SRCS = +TARGET = gifplot +INTERFACEDIR = ../../Interface/ +INTERFACE = gifplot.i +LIBS = -L../.. -lgifplot +INCLUDES = -I../../Include + +all:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' INTERFACEDIR='$(INTERFACEDIR)' python + +static:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='mypython' INTERFACE='$(INTERFACE)' INTERFACEDIR='$(INTERFACEDIR)' python_static + +clean:: + $(MAKE) -f $(TOP)/Makefile python_clean + rm -f $(TARGET).py + rm -f *.gif + +check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/GIFPlot/Python/shadow/README b/Examples/GIFPlot/Python/shadow/README new file mode 100644 index 000000000..aa761e240 --- /dev/null +++ b/Examples/GIFPlot/Python/shadow/README @@ -0,0 +1,8 @@ +This example illustrates Python shadow classes. Take a look at +the file GIFPlot/Interface/gifplot.i + + + + + + diff --git a/Examples/GIFPlot/Python/shadow/cmap b/Examples/GIFPlot/Python/shadow/cmap new file mode 100644 index 000000000..a20c331a9 Binary files /dev/null and b/Examples/GIFPlot/Python/shadow/cmap differ diff --git a/Examples/GIFPlot/Python/shadow/runme.py b/Examples/GIFPlot/Python/shadow/runme.py new file mode 100644 index 000000000..d91460121 --- /dev/null +++ b/Examples/GIFPlot/Python/shadow/runme.py @@ -0,0 +1,62 @@ +# Plot a 3D function +import gifplot +from math import * + +# Here is the function to plot +def func(x,y): + return 5*cos(2*sqrt(x*x+y*y))*exp(-0.3*sqrt(x*x+y*y)) + +# Here are some plotting parameters +xmin = -5.0 +xmax = 5.0 +ymin = -5.0 +ymax = 5.0 +zmin = -5.0 +zmax = 5.0 + +# Grid resolution +nxpoints = 60 +nypoints = 60 + +cmap = gifplot.ColorMap("cmap") +frame = gifplot.FrameBuffer(500,500) +frame.clear(gifplot.BLACK) + +p3 = gifplot.Plot3D(frame,xmin,ymin,zmin,xmax,ymax,zmax) +p3.lookat(2*max([xmax-xmin,ymax-ymin,zmax-zmin])) +p3.autoperspective(40) +p3.rotu(60) +p3.rotr(30) +p3.rotd(10) + +def drawsolid(): + p3.clear(gifplot.BLACK) + p3.start() + dx = 1.0*(xmax-xmin)/nxpoints + dy = 1.0*(ymax-ymin)/nypoints + cscale = 240.0/(zmax-zmin) + x = xmin + for i in xrange(0,nxpoints): + y = ymin + for j in xrange(0,nypoints): + z1 = func(x,y) + z2 = func(x+dx,y) + z3 = func(x+dx,y+dy) + z4 = func(x,y+dy) + c1 = cscale*(z1-zmin) + c2 = cscale*(z2-zmin) + c3 = cscale*(z3-zmin) + c4 = cscale*(z4-zmin) + c = int((c1+c2+c3+c4)/4) + if (c < 0) : c = 0 + if c > 239 : c = 239 + p3.solidquad(x,y,z1,x+dx,y,z2,x+dx,y+dy,z3,x,y+dy,z4,c+16) + y = y + dy + x = x + dx + +print "Making a nice 3D plot..." +drawsolid() + +frame.writeGIF(cmap,"image.gif") +print "Wrote image.gif" + diff --git a/Examples/GIFPlot/Python/simple/Makefile b/Examples/GIFPlot/Python/simple/Makefile new file mode 100644 index 000000000..9fc9a6c72 --- /dev/null +++ b/Examples/GIFPlot/Python/simple/Makefile @@ -0,0 +1,26 @@ +TOP = ../../.. +SWIG = $(TOP)/../preinst-swig +SWIGOPT = +SRCS = +TARGET = simple +INTERFACE = simple.i +LIBS = -L../.. -lgifplot +INCLUDES = -I../../Include + +all:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python + +static:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='mypython' INTERFACE='$(INTERFACE)' python_static + +clean:: + $(MAKE) -f $(TOP)/Makefile python_clean + rm -f $(TARGET).py + rm -f *.gif + +check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/GIFPlot/Python/simple/README b/Examples/GIFPlot/Python/simple/README new file mode 100644 index 000000000..22152c665 --- /dev/null +++ b/Examples/GIFPlot/Python/simple/README @@ -0,0 +1,5 @@ +This is a very minimalistic example in which just a few functions +and constants from library are wrapped and used to draw some simple +shapes. The script 'runme.py' runs the example. + + diff --git a/Examples/GIFPlot/Python/simple/runme.py b/Examples/GIFPlot/Python/simple/runme.py new file mode 100644 index 000000000..dade67767 --- /dev/null +++ b/Examples/GIFPlot/Python/simple/runme.py @@ -0,0 +1,27 @@ +# Draw some simple shapes +print "Drawing some basic shapes" +import simple + +cmap = simple.new_ColorMap() +f = simple.new_FrameBuffer(400,400) + +# Clear the picture +simple.FrameBuffer_clear(f,simple.BLACK) + +# Make a red box +simple.FrameBuffer_box(f,40,40,200,200,simple.RED) + +# Make a blue circle +simple.FrameBuffer_circle(f,200,200,40,simple.BLUE) + +# Make green line +simple.FrameBuffer_line(f,10,390,390,200, simple.GREEN) + +# Write an image out to disk + +simple.FrameBuffer_writeGIF(f,cmap,"image.gif") +print "Wrote image.gif" + +simple.delete_FrameBuffer(f) +simple.delete_ColorMap(cmap) + diff --git a/Examples/GIFPlot/Python/simple/simple.i b/Examples/GIFPlot/Python/simple/simple.i new file mode 100644 index 000000000..457bc4c09 --- /dev/null +++ b/Examples/GIFPlot/Python/simple/simple.i @@ -0,0 +1,38 @@ +/* This example shows a very simple interface wrapping a few + primitive declarations */ + +%module simple +%{ +#include "gifplot.h" +%} + +typedef unsigned char Pixel; + +/* Here are a few useful functions */ + +ColorMap *new_ColorMap(char *filename = 0); +void delete_ColorMap(ColorMap *cmap); + +FrameBuffer *new_FrameBuffer(unsigned int width, unsigned int height); +void delete_FrameBuffer(FrameBuffer *frame); +void FrameBuffer_clear(FrameBuffer *frame, Pixel color); +void FrameBuffer_line(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); +void FrameBuffer_box(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); +void FrameBuffer_circle(FrameBuffer *frame, int x1, int y1, int radius, Pixel color); +int FrameBuffer_writeGIF(FrameBuffer *f, ColorMap *c, char *filename); + +/* And some useful constants */ + +#define BLACK 0 +#define WHITE 1 +#define RED 2 +#define GREEN 3 +#define BLUE 4 +#define YELLOW 5 +#define CYAN 6 +#define MAGENTA 7 + + + + + diff --git a/Examples/GIFPlot/README b/Examples/GIFPlot/README new file mode 100644 index 000000000..ac1025a42 --- /dev/null +++ b/Examples/GIFPlot/README @@ -0,0 +1,59 @@ +GIFPlot +======= + +To illustrate various SWIG features, the following examples involve +building an interface to a small, but somewhat useful graphics library +for creating 2D and 3D images in the form of GIF files. The Perl, +Python, Tcl, Java, Ruby etc. directories contain various examples specific to +those languages. + +This library was originally developed as part of the SPaSM molecular +dynamics project at Los Alamos National Laboratory. However, due to +patent enforcement issues related to LZW encoding and a general lack +of time on the part of the author, the library was never officially +released. On the plus side, a number of people have found it to be a +useful easter egg within the SWIG distribution :-). + + +DUE TO PATENT RESTRICTIONS ON THE LZW COMPRESSION ALGORITHM, THIS +LIBRARY ONLY PRODUCES UNCOMPRESSED GIF FILES. SO THERE. + + +Building the Library +==================== + +In order to run the examples, it is first necessary to build the GIFPlot +C library. To do this, simply run make: + + make + +Running the Examples +==================== + +Once the library has been built, go to your chosen language directory, +that is, Perl, Python, Tcl, Java, Ruby etc. Each example should have a +README file with a description. + +Each example can be compiled using the makefile in each example directory. This +makefile uses the top level makefile in the "Examples" directory of the distribution. +If the example doesn't compile, you will need to adjust the settings in this file. + +Documentation +============= + +Read the source Luke. The examples should be pretty much self-explanatory. +The header file Include/gifplot.h contains the full API. + +The original documentation for the library can be found online at: + + http://www.dabeaz.com/gifplot/index.html + + +Let me know what you think! +=========================== +If you found this example to be useful, confusing, or otherwise, I would like to know +about it. Suggestions for improvement are welcome. + +-- Dave (dave@dabeaz.com) + + diff --git a/Examples/GIFPlot/Ruby/check.list b/Examples/GIFPlot/Ruby/check.list new file mode 100644 index 000000000..13de977af --- /dev/null +++ b/Examples/GIFPlot/Ruby/check.list @@ -0,0 +1,4 @@ +# see top-level Makefile.in +full +shadow +simple diff --git a/Examples/GIFPlot/Ruby/full/Makefile b/Examples/GIFPlot/Ruby/full/Makefile new file mode 100644 index 000000000..5af8bc832 --- /dev/null +++ b/Examples/GIFPlot/Ruby/full/Makefile @@ -0,0 +1,24 @@ +TOP = ../../.. +SWIG = $(TOP)/../swig +SWIGOPT = -I../../Include +SRCS = +TARGET = gifplot +INTERFACE = gifplot.i +LIBS = -L../.. -lgifplot +INCLUDES = -I../../Include + +all:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby + +static:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_static + +clean:: + $(MAKE) -f $(TOP)/Makefile ruby_clean + rm -f *.gif + +check: all diff --git a/Examples/GIFPlot/Ruby/full/README b/Examples/GIFPlot/Ruby/full/README new file mode 100644 index 000000000..22af6cb06 --- /dev/null +++ b/Examples/GIFPlot/Ruby/full/README @@ -0,0 +1,8 @@ +This example runs the entire gifplot.h header file through SWIG without +any changes. The script 'runme.rb' does something a little more +interesting. You'll have to go look at the header file to get a complete +listing of the functions. + + + + diff --git a/Examples/GIFPlot/Ruby/full/cmap b/Examples/GIFPlot/Ruby/full/cmap new file mode 100644 index 000000000..a20c331a9 Binary files /dev/null and b/Examples/GIFPlot/Ruby/full/cmap differ diff --git a/Examples/GIFPlot/Ruby/full/gifplot.i b/Examples/GIFPlot/Ruby/full/gifplot.i new file mode 100644 index 000000000..5a7f5008f --- /dev/null +++ b/Examples/GIFPlot/Ruby/full/gifplot.i @@ -0,0 +1,15 @@ +/* Oh what the heck, let's just grab the whole darn header file + and see what happens. */ + +%module gifplot +%{ + +/* Note: You still need this part because the %include directive + merely causes SWIG to interpret the contents of a file. It doesn't + include the right include headers for the resulting C code */ + +#include "gifplot.h" + +%} + +%include gifplot.h diff --git a/Examples/GIFPlot/Ruby/full/runme.rb b/Examples/GIFPlot/Ruby/full/runme.rb new file mode 100644 index 000000000..5c118b2fa --- /dev/null +++ b/Examples/GIFPlot/Ruby/full/runme.rb @@ -0,0 +1,66 @@ +# Plot a 3D function +require 'gifplot' +include Gifplot +include Math + +# Here is the function to plot +def func(x,y) + return 5*cos(2*sqrt(x*x+y*y))*exp(-0.3*sqrt(x*x+y*y)) +end + +# Here are some plotting parameters +XMIN = -5.0 +XMAX = 5.0 +YMIN = -5.0 +YMAX = 5.0 +ZMIN = -5.0 +ZMAX = 5.0 + +# Grid resolution +NXPOINTS = 60 +NYPOINTS = 60 + +cmap = new_ColorMap("cmap") +frame = new_FrameBuffer(500,500) +FrameBuffer_clear(frame,BLACK) + +P3 = new_Plot3D(frame,XMIN,YMIN,ZMIN,XMAX,YMAX,ZMAX) +Plot3D_lookat(P3,2*[XMAX-XMIN,YMAX-YMIN,ZMAX-ZMIN].max) +Plot3D_autoperspective(P3,40) +Plot3D_rotu(P3,60) +Plot3D_rotr(P3,30) +Plot3D_rotd(P3,10) + +def drawsolid() + Plot3D_clear(P3,BLACK) + Plot3D_start(P3) + dx = 1.0*(XMAX-XMIN)/NXPOINTS + dy = 1.0*(YMAX-YMIN)/NYPOINTS + cscale = 240.0/(ZMAX-ZMIN) + x = XMIN + for i in 0...NXPOINTS + y = YMIN + for j in 0...NYPOINTS + z1 = func(x,y) + z2 = func(x+dx,y) + z3 = func(x+dx,y+dy) + z4 = func(x,y+dy) + c1 = cscale*(z1-ZMIN) + c2 = cscale*(z2-ZMIN) + c3 = cscale*(z3-ZMIN) + c4 = cscale*(z4-ZMIN) + c = (c1+c2+c3+c4)/4 + c = 0 if (c < 0) + c = 239 if c > 239 + Plot3D_solidquad(P3,x,y,z1,x+dx,y,z2,x+dx,y+dy,z3,x,y+dy,z4,c+16) + y = y + dy + end + x = x + dx + end +end + +puts "Making a nice 3D plot..." +drawsolid() + +FrameBuffer_writeGIF(frame,cmap,"image.gif") +puts "Wrote image.gif" diff --git a/Examples/GIFPlot/Ruby/shadow/Makefile b/Examples/GIFPlot/Ruby/shadow/Makefile new file mode 100644 index 000000000..8cbea2a57 --- /dev/null +++ b/Examples/GIFPlot/Ruby/shadow/Makefile @@ -0,0 +1,25 @@ +TOP = ../../.. +SWIG = $(TOP)/../swig +SWIGOPT = -outcurrentdir +SRCS = +TARGET = gifplot +INTERFACEDIR = ../../Interface/ +INTERFACE = gifplot.i +LIBS = -L../.. -lgifplot +INCLUDES = -I../../Include + +all:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' INTERFACEDIR='$(INTERFACEDIR)' ruby + +static:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='myruby' INTERFACE='$(INTERFACE)' INTERFACEDIR='$(INTERFACEDIR)' ruby_static + +clean:: + $(MAKE) -f $(TOP)/Makefile ruby_clean + rm -f *.gif + +check: all diff --git a/Examples/GIFPlot/Ruby/shadow/README b/Examples/GIFPlot/Ruby/shadow/README new file mode 100644 index 000000000..7a33e137f --- /dev/null +++ b/Examples/GIFPlot/Ruby/shadow/README @@ -0,0 +1,5 @@ +This example illustrates Ruby shadow classes. Take a look at +the file GIFPlot/Interface/gifplot.i + +Actually Ruby module of SWIG needs no shadow class. But this example +is named "shadow" in order to be consistent with other languages. diff --git a/Examples/GIFPlot/Ruby/shadow/cmap b/Examples/GIFPlot/Ruby/shadow/cmap new file mode 100644 index 000000000..a20c331a9 Binary files /dev/null and b/Examples/GIFPlot/Ruby/shadow/cmap differ diff --git a/Examples/GIFPlot/Ruby/shadow/runme.rb b/Examples/GIFPlot/Ruby/shadow/runme.rb new file mode 100644 index 000000000..0afcceef9 --- /dev/null +++ b/Examples/GIFPlot/Ruby/shadow/runme.rb @@ -0,0 +1,66 @@ +# Plot a 3D function +require 'gifplot' +include Math + +# Here is the function to plot +def func(x,y) + return 5*cos(2*sqrt(x*x+y*y))*exp(-0.3*sqrt(x*x+y*y)) +end + +# Here are some plotting parameters +XMIN = -5.0 +XMAX = 5.0 +YMIN = -5.0 +YMAX = 5.0 +ZMIN = -5.0 +ZMAX = 5.0 + +# Grid resolution +NXPOINTS = 60 +NYPOINTS = 60 + +cmap = Gifplot::ColorMap.new("cmap") +frame = Gifplot::FrameBuffer.new(500,500) +frame.clear(Gifplot::BLACK) + +P3 = Gifplot::Plot3D.new(frame,XMIN,YMIN,ZMIN,XMAX,YMAX,ZMAX) +P3.lookat(2*[XMAX-XMIN,YMAX-YMIN,ZMAX-ZMIN].max) +P3.autoperspective(40) +P3.rotu(60) +P3.rotr(30) +P3.rotd(10) + +def drawsolid() + P3.clear(Gifplot::BLACK) + P3.start() + dx = 1.0*(XMAX-XMIN)/NXPOINTS + dy = 1.0*(YMAX-YMIN)/NYPOINTS + cscale = 240.0/(ZMAX-ZMIN) + x = XMIN + for i in 0...NXPOINTS + y = YMIN + for j in 0...NYPOINTS + z1 = func(x,y) + z2 = func(x+dx,y) + z3 = func(x+dx,y+dy) + z4 = func(x,y+dy) + c1 = cscale*(z1-ZMIN) + c2 = cscale*(z2-ZMIN) + c3 = cscale*(z3-ZMIN) + c4 = cscale*(z4-ZMIN) + c = (c1+c2+c3+c4)/4 + c = 0 if (c < 0) + c = 239 if c > 239 + P3.solidquad(x,y,z1,x+dx,y,z2,x+dx,y+dy,z3,x,y+dy,z4,c+16) + y = y + dy + end + x = x + dx + end +end + +puts "Making a nice 3D plot..." +drawsolid() + +frame.writeGIF(cmap,"image.gif") +puts "Wrote image.gif" + diff --git a/Examples/GIFPlot/Ruby/simple/Makefile b/Examples/GIFPlot/Ruby/simple/Makefile new file mode 100644 index 000000000..f7ca1a7d8 --- /dev/null +++ b/Examples/GIFPlot/Ruby/simple/Makefile @@ -0,0 +1,24 @@ +TOP = ../../.. +SWIG = $(TOP)/../swig +SWIGOPT = +SRCS = +TARGET = simple +INTERFACE = simple.i +LIBS = -L../.. -lgifplot +INCLUDES = -I../../Include + +all:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby + +static:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_static + +clean:: + $(MAKE) -f $(TOP)/Makefile ruby_clean + rm -f *.gif + +check: all diff --git a/Examples/GIFPlot/Ruby/simple/README b/Examples/GIFPlot/Ruby/simple/README new file mode 100644 index 000000000..9b51038bf --- /dev/null +++ b/Examples/GIFPlot/Ruby/simple/README @@ -0,0 +1,5 @@ +This is a very minimalistic example in which just a few functions +and constants from library are wrapped and used to draw some simple +shapes. The script 'runme.rb' runs the example. + + diff --git a/Examples/GIFPlot/Ruby/simple/runme.rb b/Examples/GIFPlot/Ruby/simple/runme.rb new file mode 100644 index 000000000..e8bf5a40f --- /dev/null +++ b/Examples/GIFPlot/Ruby/simple/runme.rb @@ -0,0 +1,27 @@ +# Draw some simple shapes +puts "Drawing some basic shapes" +require 'simple' + +cmap = Simple.new_ColorMap() +f = Simple.new_FrameBuffer(400,400) + +# Clear the picture +Simple.FrameBuffer_clear(f,Simple::BLACK) + +# Make a red box +Simple.FrameBuffer_box(f,40,40,200,200,Simple::RED) + +# Make a blue circle +Simple.FrameBuffer_circle(f,200,200,40,Simple::BLUE) + +# Make green line +Simple.FrameBuffer_line(f,10,390,390,200, Simple::GREEN) + +# Write an image out to disk + +Simple.FrameBuffer_writeGIF(f,cmap,"image.gif") +puts "Wrote image.gif" + +Simple.delete_FrameBuffer(f) +Simple.delete_ColorMap(cmap) + diff --git a/Examples/GIFPlot/Ruby/simple/simple.i b/Examples/GIFPlot/Ruby/simple/simple.i new file mode 100644 index 000000000..457bc4c09 --- /dev/null +++ b/Examples/GIFPlot/Ruby/simple/simple.i @@ -0,0 +1,38 @@ +/* This example shows a very simple interface wrapping a few + primitive declarations */ + +%module simple +%{ +#include "gifplot.h" +%} + +typedef unsigned char Pixel; + +/* Here are a few useful functions */ + +ColorMap *new_ColorMap(char *filename = 0); +void delete_ColorMap(ColorMap *cmap); + +FrameBuffer *new_FrameBuffer(unsigned int width, unsigned int height); +void delete_FrameBuffer(FrameBuffer *frame); +void FrameBuffer_clear(FrameBuffer *frame, Pixel color); +void FrameBuffer_line(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); +void FrameBuffer_box(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); +void FrameBuffer_circle(FrameBuffer *frame, int x1, int y1, int radius, Pixel color); +int FrameBuffer_writeGIF(FrameBuffer *f, ColorMap *c, char *filename); + +/* And some useful constants */ + +#define BLACK 0 +#define WHITE 1 +#define RED 2 +#define GREEN 3 +#define BLUE 4 +#define YELLOW 5 +#define CYAN 6 +#define MAGENTA 7 + + + + + diff --git a/Examples/GIFPlot/Tcl/check.list b/Examples/GIFPlot/Tcl/check.list new file mode 100644 index 000000000..2b6e3d28a --- /dev/null +++ b/Examples/GIFPlot/Tcl/check.list @@ -0,0 +1,4 @@ +# see top-level Makefile.in +full +mandel +simple diff --git a/Examples/GIFPlot/Tcl/full/Makefile b/Examples/GIFPlot/Tcl/full/Makefile new file mode 100644 index 000000000..0c016e364 --- /dev/null +++ b/Examples/GIFPlot/Tcl/full/Makefile @@ -0,0 +1,24 @@ +TOP = ../../.. +SWIG = $(TOP)/../swig +SWIGOPT = -I../../Include +SRCS = +TARGET = gifplot +INTERFACE = gifplot.i +LIBS = -L../.. -lgifplot +INCLUDES = -I../../Include + +all:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tcl + +static:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='mytclsh' INTERFACE='$(INTERFACE)' tclsh + +clean:: + $(MAKE) -f $(TOP)/Makefile tcl_clean + rm -f *.gif + +check: all diff --git a/Examples/GIFPlot/Tcl/full/README b/Examples/GIFPlot/Tcl/full/README new file mode 100644 index 000000000..bdba4e8b0 --- /dev/null +++ b/Examples/GIFPlot/Tcl/full/README @@ -0,0 +1,8 @@ +This example runs the entire gifplot.h header file through SWIG without +any changes. The script 'runme.tcl' does something a little more +interesting. You'll have to go look at the header file to get a complete +listing of the functions. + + + + diff --git a/Examples/GIFPlot/Tcl/full/cmap b/Examples/GIFPlot/Tcl/full/cmap new file mode 100644 index 000000000..a20c331a9 Binary files /dev/null and b/Examples/GIFPlot/Tcl/full/cmap differ diff --git a/Examples/GIFPlot/Tcl/full/gifplot.i b/Examples/GIFPlot/Tcl/full/gifplot.i new file mode 100644 index 000000000..5a7f5008f --- /dev/null +++ b/Examples/GIFPlot/Tcl/full/gifplot.i @@ -0,0 +1,15 @@ +/* Oh what the heck, let's just grab the whole darn header file + and see what happens. */ + +%module gifplot +%{ + +/* Note: You still need this part because the %include directive + merely causes SWIG to interpret the contents of a file. It doesn't + include the right include headers for the resulting C code */ + +#include "gifplot.h" + +%} + +%include gifplot.h diff --git a/Examples/GIFPlot/Tcl/full/runme.tcl b/Examples/GIFPlot/Tcl/full/runme.tcl new file mode 100644 index 000000000..f469e71dd --- /dev/null +++ b/Examples/GIFPlot/Tcl/full/runme.tcl @@ -0,0 +1,67 @@ +# Plot a 3D function + +catch { load ./gifplot[info sharedlibextension] gifplot} + +# Here is the function to plot +proc func { x y } { + return [expr { 5*cos(2*sqrt($x*$x+$y*$y))*exp(-0.3*sqrt($x*$x+$y*$y)) }] +} + +# Here are some plotting parameters +set xmin -5.0 +set xmax 5.0 +set ymin -5.0 +set ymax 5.0 +set zmin -5.0 +set zmax 5.0 + +# Grid resolution +set nxpoints 60 +set nypoints 60 + +set cmap [new_ColorMap cmap] +set frame [new_FrameBuffer 500 500] +FrameBuffer_clear $frame $BLACK + +set p3 [new_Plot3D $frame $xmin $ymin $zmin $xmax $ymax $zmax ] +Plot3D_lookat $p3 [expr {2*($zmax-$zmin)}] +Plot3D_autoperspective $p3 40 +Plot3D_rotu $p3 60 +Plot3D_rotr $p3 30 +Plot3D_rotd $p3 10 + +proc drawsolid { } { + global xmin ymin zmin xmax ymax zmax nxpoints nypoints p3 BLACK + Plot3D_clear $p3 $BLACK + Plot3D_start $p3 + set dx [expr {1.0*($xmax-$xmin)/$nxpoints}] + set dy [expr {1.0*($ymax-$ymin)/$nypoints}] + set cscale [expr {240.0/($zmax-$zmin)}] + set x $xmin + for {set i 0} {$i < $nxpoints} {incr i 1} { + set y $ymin + for {set j 0} {$j < $nypoints} {incr j 1} { + set z1 [func $x $y] + set z2 [func [expr {$x+$dx}] $y] + set z3 [func [expr {$x+$dx}] [expr {$y+$dy}]] + set z4 [func $x [expr {$y+$dy}]] + set c1 [expr {$cscale*($z1-$zmin)}] + set c2 [expr {$cscale*($z2-$zmin)}] + set c3 [expr {$cscale*($z3-$zmin)}] + set c4 [expr {$cscale*($z4-$zmin)}] + set c [expr {int(($c1+$c2+$c3+$c4)/4)}] + if {$c < 0} { set c 0 } + if {$c > 239} { set c 239 } + Plot3D_solidquad $p3 $x $y $z1 [expr {$x+$dx}] $y $z2 [expr {$x+$dx}] [expr {$y+$dy}] $z3 $x [expr {$y+$dy}] $z4 [expr {$c+16}] + set y [expr {$y + $dy}] + } + set x [expr {$x + $dx}] + } +} + +puts "Making a nice 3D plot..." +drawsolid + +FrameBuffer_writeGIF $frame $cmap "image.gif" +puts "Wrote image.gif" + diff --git a/Examples/GIFPlot/Tcl/mandel/Makefile b/Examples/GIFPlot/Tcl/mandel/Makefile new file mode 100644 index 000000000..9280d7bb2 --- /dev/null +++ b/Examples/GIFPlot/Tcl/mandel/Makefile @@ -0,0 +1,24 @@ +TOP = ../../.. +SWIG = $(TOP)/../swig +SWIGOPT = -I../../Interface +SRCS = +TARGET = gifplot +INTERFACE = mandel.i +LIBS = -L../.. -lgifplot +INCLUDES = -I../../Include + +all:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tcl + +static:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='mywish' INTERFACE='$(INTERFACE)' wish + +clean:: + $(MAKE) -f $(TOP)/Makefile tcl_clean + rm -f *.gif + +check: all diff --git a/Examples/GIFPlot/Tcl/mandel/README b/Examples/GIFPlot/Tcl/mandel/README new file mode 100644 index 000000000..a533d09b8 --- /dev/null +++ b/Examples/GIFPlot/Tcl/mandel/README @@ -0,0 +1,6 @@ +Kill lots of time exploring the Mandelbrot set. This example uses +the full SWIG interface file located in ../../Interface. To run +the program, type 'wish mandel.tcl'. + + + diff --git a/Examples/GIFPlot/Tcl/mandel/cmap b/Examples/GIFPlot/Tcl/mandel/cmap new file mode 100644 index 000000000..a20c331a9 Binary files /dev/null and b/Examples/GIFPlot/Tcl/mandel/cmap differ diff --git a/Examples/GIFPlot/Tcl/mandel/display.tcl b/Examples/GIFPlot/Tcl/mandel/display.tcl new file mode 100644 index 000000000..89eedf044 --- /dev/null +++ b/Examples/GIFPlot/Tcl/mandel/display.tcl @@ -0,0 +1,68 @@ +# Tcl code to display a image in a widget + +set __imageno 0 + +proc dismiss {t i} { + destroy $t + image delete $i +} + +proc BoxInit { c p2 mxmin mymin mxmax mymax func } { + bind $c {BoxBegin %W %x %y} + bind $c {BoxDrag %W %x %y} + bind $c "BoxFinish %W %x %y $p2 $mxmin $mymin $mxmax $mymax $func" +} + +proc BoxBegin {w x y} { + global box + set box(anchor) [list $x $y] + catch {unset box(last)} +} + +proc BoxDrag { w x y} { + global box + catch {$w delete $box(last)} + set box(last) [eval {$w create rect} $box(anchor) {$x $y -tag box -outline white}] +} + +proc BoxFinish {w x y p2 mxmin mymin mxmax mymax func } { + global box + set start $box(anchor) + set x1 [lrange $start 0 0] + set y1 [lrange $start 1 1] + catch {$w delete $box(last)} +# Call the handler function + $func $p2 $mxmin $mymin $mxmax $mymax $x1 $y1 $x $y +} + +proc display_image {filename p2 handler} { + global __imageno __images + set i [image create photo -file $filename] + set tl .image$__imageno + toplevel $tl + frame $tl.img + frame $tl.button + + set width [image width $i] + set height [image height $i] + canvas $tl.img.c -width [expr {$width+0}] -height [expr {$height+0}] + pack $tl.img.c + $tl.img.c create image 0 0 -image $i -anchor nw + label $tl.button.label -text $filename + pack $tl.button.label -side left + button $tl.button.dismiss -text "Dismiss" -command "dismiss $tl $i" -width 10 + pack $tl.button.dismiss -side right + pack $tl.img $tl.button -side top -fill x + BoxInit $tl.img.c $p2 [$p2 cget -xmin] [$p2 cget -ymin] [$p2 cget -xmax] [$p2 cget -ymax] $handler + bind $tl "dismiss $tl $i" + bind $tl "dismiss $tl $i" + + # Bind some actions to the canvas + + incr __imageno 1 +} + +proc test {} { + puts "hello" +} + diff --git a/Examples/GIFPlot/Tcl/mandel/mandel.i b/Examples/GIFPlot/Tcl/mandel/mandel.i new file mode 100644 index 000000000..0b19f4727 --- /dev/null +++ b/Examples/GIFPlot/Tcl/mandel/mandel.i @@ -0,0 +1,47 @@ +// Special module to run the mandlebrot set +%module gifplot +%include gifplot.i + +%inline %{ + +void mandel(Plot2D *p2, int tol) { + double scalingx; + double scalingy; + double zr,zi,ztr,zti,cr,ci; + double cscale; + int i,j,n; + FrameBuffer *f; + + f = p2->frame; + scalingx = (p2->xmax-p2->xmin)/f->width; + scalingy = (p2->ymax-p2->ymin)/f->height; + + cscale = 239.0/tol; + printf("working...\n"); + for (i = 0; i < f->width; i++) { + for (j = 0; j < f->height; j++) { + zr = scalingx*i + p2->xmin; + zi = scalingy*j + p2->ymin; + cr = zr; + ci = zi; + n = 0; + while (n < tol) { + ztr = zr*zr-zi*zi + cr; + zti = 2*zr*zi + ci; + zr = ztr; + zi = zti; + if (ztr*ztr + zti*zti > 20) break; + n = n + 1; + } + + if (n >= tol) FrameBuffer_plot(f,i,j,BLACK); + else FrameBuffer_plot(f,i,j,16+(int) (n*cscale)); + } + if ((i % 10) == 0) printf("%d\n",i); + } + +} + +%} + + diff --git a/Examples/GIFPlot/Tcl/mandel/mandel.tcl b/Examples/GIFPlot/Tcl/mandel/mandel.tcl new file mode 100644 index 000000000..3e1600bc1 --- /dev/null +++ b/Examples/GIFPlot/Tcl/mandel/mandel.tcl @@ -0,0 +1,170 @@ +catch { load ./gifplot[info sharedlibextension] } +source display.tcl +set tcl_precision 17 +set f [FrameBuffer -args 400 400] +set cmap [ColorMap -args cmap] +set p2 [Plot2D -args $f -3 -2 1 2] + +set xmin -3 +set xmax 1 +set ymin -2.0 +set ymax 2.0 +set tolerance 240 +set filename mandel.gif + +# Make a plot from the above parms + +proc make_plot {} { + global p2 cmap tolerance + global xmin ymin xmax ymax filename + $p2 setrange $xmin $ymin $xmax $ymax + $p2 start + . config -cursor watch + update + mandel $p2 $tolerance + . config -cursor arrow + [$p2 cget -frame] writeGIF $cmap $filename + display_image $filename $p2 set_zoom +} + + +# Take some screen coordinates and set global min and max values + +proc set_zoom {p2 mxmin mymin mxmax mymax x1 y1 x2 y2} { + global xmin ymin xmax ymax + + set frame [$p2 cget -frame] + set width [$frame cget -width] + set height [$frame cget -height] + + if {$x1 < 0} {set x1 0} + if {$x1 > ($width)} {set x1 $width} + if {$x2 < 0} {set x2 0} + if {$x2 > ($width)} {set x2 $width} + if {$x1 < $x2} {set ixmin $x1; set ixmax $x2} {set ixmin $x2; set ixmax $x1} + + if {$y1 < 0} {set y1 0} + if {$y1 > ($height)} {set y1 $height} + if {$y2 < 0} {set y2 0} + if {$y2 > ($height)} {set y2 $height} + if {$y1 < $y2} {set iymin $y1; set iymax $y2} {set iymin $y2; set iymax $y1} + + # Now determine new min and max values based on screen location + + set xmin [expr {$mxmin + ($mxmax-$mxmin)*($ixmin)/($width)}] + set xmax [expr {$mxmin + ($mxmax-$mxmin)*($ixmax)/($width)}] + set ymin [expr {$mymin + ($mymax-$mymin)*(($height)-($iymax))/($height)}] + set ymax [expr {$mymin + ($mymax-$mymin)*(($height)-($iymin))/($height)}] + + catch {make_plot} +} + +# Box drag constrained to a square +proc BoxDrag { w x y} { + global box + catch {$w delete $box(last)} + set x1 [lrange $box(anchor) 0 0] + set y1 [lrange $box(anchor) 1 1] + set dx [expr {$x - $x1}] + set dy [expr {$y - $y1}] + if {abs($dy) > abs($dx)} {set dx $dy} + set newx [expr {$x1 + $dx}] + set newy [expr {$y1 + $dx}] + set box(last) [eval {$w create rect} $box(anchor) {$newx $newy -tag box -outline white}] +} + + +proc BoxFinish {w x y p2 mxmin mymin mxmax mymax func } { + global box + set start $box(anchor) + set x1 [lrange $box(anchor) 0 0] + set y1 [lrange $box(anchor) 1 1] + set dx [expr {$x - $x1}] + set dy [expr {$y - $y1}] + if {($dx == 0) || ($dy == 0)} { + catch {$w delete $box(last)} + return + } + if {abs($dy) > abs($dx)} {set dx $dy} + set newx [expr {$x1 + $dx}] + set newy [expr {$y1 + $dx}] + $w config -cursor watch + update +# Call the handler function + $func $p2 $mxmin $mymin $mxmax $mymax $x1 $y1 $newx $newy + catch {$w delete $box(last)} + $w config -cursor arrow +} + + +# Create a few frames + +wm title . Mandelbrot +frame .title -relief groove -borderwidth 1 +label .title.name -text "Mandelbrot Set" +button .title.quit -text "Quit" -command "exit" +button .title.about -text "About" -command "about" +pack .title.name -side left +pack .title.quit .title.about -side right + +frame .func -relief groove -borderwidth 1 + +frame .func.xrange +label .func.xrange.xrlabel -text "X range" -width 12 +entry .func.xrange.xmin -textvar xmin -width 8 +label .func.xrange.xtolabel -text "to" +entry .func.xrange.xmax -textvar xmax -width 8 +pack .func.xrange.xrlabel .func.xrange.xmin .func.xrange.xtolabel .func.xrange.xmax -side left + +frame .func.yrange +label .func.yrange.yrlabel -text "Y range" -width 12 +entry .func.yrange.ymin -textvar ymin -width 8 +label .func.yrange.ytolabel -text "to" +entry .func.yrange.ymax -textvar ymax -width 8 +pack .func.yrange.yrlabel .func.yrange.ymin .func.yrange.ytolabel .func.yrange.ymax -side left + +frame .func.npoints +label .func.npoints.label -text "Tolerance " -width 12 +entry .func.npoints.npoints -textvar tolerance -width 8 +scale .func.npoints.scale -from 0 -to 2500 -variable tolerance -orient horizontal -showvalue false \ + -sliderlength 13 -bigincrement 10 -resolution 10 +pack .func.npoints.label .func.npoints.npoints .func.npoints.scale -side left + +pack .func.xrange .func.yrange .func.npoints -side top -fill x + +# Filename dialog + +frame .save -relief groove -borderwidth 1 + +frame .save.file +label .save.file.label -text "Save as" -width 12 +entry .save.file.filename -textvar filename -width 20 +pack .save.file.label .save.file.filename -side left +pack .save.file -side left -fill x +button .save.go -text "Plot" -command "make_plot" +pack .save.go -side right + +bind .save.file.filename {make_plot} + +pack .title .func .save -side top -fill both + +proc about { } { + toplevel .about -width 350 + + message .about.m -text "\ +Mandelbrot Set\n\n\ +Copyright (c) 1997\n\ +Dave Beazley\n\ +University of Utah\n\n\ +Creates a plot of the Mandelbrot set. Any displayed image can be zoomed by clicking and \ +dragging. Although the main calculation is written in C, it may take awhile for each \ +image to be calculated (be patient). Image quality can be improved at the expense of speed \ +by increasing the tolerance value.\n" + +button .about.okay -text "Ok" -command {destroy .about} + +pack .about.m .about.okay -side top +focus .about.okay +} + +make_plot diff --git a/Examples/GIFPlot/Tcl/simple/Makefile b/Examples/GIFPlot/Tcl/simple/Makefile new file mode 100644 index 000000000..752d79c10 --- /dev/null +++ b/Examples/GIFPlot/Tcl/simple/Makefile @@ -0,0 +1,24 @@ +TOP = ../../.. +SWIG = $(TOP)/../swig +SWIGOPT = +SRCS = +TARGET = simple +INTERFACE = simple.i +LIBS = -L../.. -lgifplot +INCLUDES = -I../../Include + +all:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tcl + +static:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ + TARGET='mytclsh' INTERFACE='$(INTERFACE)' tclsh + +clean:: + $(MAKE) -f $(TOP)/Makefile tcl_clean + rm -f *.gif + +check: all diff --git a/Examples/GIFPlot/Tcl/simple/README b/Examples/GIFPlot/Tcl/simple/README new file mode 100644 index 000000000..d6b291c92 --- /dev/null +++ b/Examples/GIFPlot/Tcl/simple/README @@ -0,0 +1,5 @@ +This is a very minimalistic example in which just a few functions +and constants from library are wrapped and used to draw some simple +shapes. The script 'runme.tcl' runs the example. + + diff --git a/Examples/GIFPlot/Tcl/simple/runme.tcl b/Examples/GIFPlot/Tcl/simple/runme.tcl new file mode 100644 index 000000000..e3f41266c --- /dev/null +++ b/Examples/GIFPlot/Tcl/simple/runme.tcl @@ -0,0 +1,27 @@ +# Draw some simple shapes +puts "Drawing some basic shapes" + +catch { load ./simple[info sharedlibextension] simple} + +set cmap [new_ColorMap] +set f [new_FrameBuffer 400 400] + +# Clear the picture +FrameBuffer_clear $f $BLACK + +# Make a red box +FrameBuffer_box $f 40 40 200 200 $RED + +# Make a blue circle +FrameBuffer_circle $f 200 200 40 $BLUE + +# Make green line +FrameBuffer_line $f 10 390 390 200 $GREEN + +# Write an image out to disk +FrameBuffer_writeGIF $f $cmap image.gif +puts "Wrote image.gif" + +delete_FrameBuffer $f +delete_ColorMap $cmap + diff --git a/Examples/GIFPlot/Tcl/simple/simple.i b/Examples/GIFPlot/Tcl/simple/simple.i new file mode 100644 index 000000000..457bc4c09 --- /dev/null +++ b/Examples/GIFPlot/Tcl/simple/simple.i @@ -0,0 +1,38 @@ +/* This example shows a very simple interface wrapping a few + primitive declarations */ + +%module simple +%{ +#include "gifplot.h" +%} + +typedef unsigned char Pixel; + +/* Here are a few useful functions */ + +ColorMap *new_ColorMap(char *filename = 0); +void delete_ColorMap(ColorMap *cmap); + +FrameBuffer *new_FrameBuffer(unsigned int width, unsigned int height); +void delete_FrameBuffer(FrameBuffer *frame); +void FrameBuffer_clear(FrameBuffer *frame, Pixel color); +void FrameBuffer_line(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); +void FrameBuffer_box(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); +void FrameBuffer_circle(FrameBuffer *frame, int x1, int y1, int radius, Pixel color); +int FrameBuffer_writeGIF(FrameBuffer *f, ColorMap *c, char *filename); + +/* And some useful constants */ + +#define BLACK 0 +#define WHITE 1 +#define RED 2 +#define GREEN 3 +#define BLUE 4 +#define YELLOW 5 +#define CYAN 6 +#define MAGENTA 7 + + + + + diff --git a/Examples/chicken/zlib/Makefile b/Examples/chicken/zlib/Makefile new file mode 100644 index 000000000..720701444 --- /dev/null +++ b/Examples/chicken/zlib/Makefile @@ -0,0 +1,28 @@ +TOP = ../.. +SWIG = $(TOP)/../preinst-swig +INTERFACE = example.i +SRCS = +CXXSRCS = +TARGET = zlib +INCLUDE = +SWIGOPT = -I/usr/include +CFLAGS = +VARIANT = +LIBS = -lz +VARIANT = _direct + +all:: $(TARGET) + +$(TARGET): $(INTERFACE) $(SRCS) + $(MAKE) -f $(TOP)/Makefile \ + SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' \ + INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='$(TARGET)' \ + SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT) + +clean:: + $(MAKE) -f $(TOP)/Makefile chicken_clean + rm -f example.scm + rm -f $(TARGET) + +check:: + csi test-zlib.scm diff --git a/Examples/chicken/zlib/README.html b/Examples/chicken/zlib/README.html new file mode 100644 index 000000000..b082a310c --- /dev/null +++ b/Examples/chicken/zlib/README.html @@ -0,0 +1,1666 @@ + + + + zlib - Chicken - SWIG example + + +

zlib - Chicken - SWIG

+ +

Table of Contents

+ Building the example
+ zlib.h
+ How the zlib wrapper was developed
+ +

Building the example

+ + zlib must be installed for this example to work.
+ + Just type make to build this example.
+ + If zlib is not installed in /usr/lib and /usr/include, then do + something similar to the following: + +
+
make SWIGOPT="-I/usr/local/include" LIBS="-L/usr/local/lib -lz"
+
+ +

zlib.h

+
+
+001: /* zlib.h -- interface of the 'zlib' general purpose compression library
+002:   version 1.1.4, March 11th, 2002
+003: 
+004:   Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler
+005: 
+006:   This software is provided 'as-is', without any express or implied
+007:   warranty.  In no event will the authors be held liable for any damages
+008:   arising from the use of this software.
+009: 
+010:   Permission is granted to anyone to use this software for any purpose,
+011:   including commercial applications, and to alter it and redistribute it
+012:   freely, subject to the following restrictions:
+013: 
+014:   1. The origin of this software must not be misrepresented; you must not
+015:      claim that you wrote the original software. If you use this software
+016:      in a product, an acknowledgment in the product documentation would be
+017:      appreciated but is not required.
+018:   2. Altered source versions must be plainly marked as such, and must not be
+019:      misrepresented as being the original software.
+020:   3. This notice may not be removed or altered from any source distribution.
+021: 
+022:   Jean-loup Gailly        Mark Adler
+023:   jloup@gzip.org          madler@alumni.caltech.edu
+024: 
+025: 
+026:   The data format used by the zlib library is described by RFCs (Request for
+027:   Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt
+028:   (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
+029: */
+030: 
+031: #ifndef _ZLIB_H
+032: #define _ZLIB_H
+033: 
+034: #include "zconf.h"
+035: 
+036: #ifdef __cplusplus
+037: extern "C" {
+038: #endif
+039: 
+040: #define ZLIB_VERSION "1.1.4"
+041: 
+042: /* 
+043:      The 'zlib' compression library provides in-memory compression and
+044:   decompression functions, including integrity checks of the uncompressed
+045:   data.  This version of the library supports only one compression method
+046:   (deflation) but other algorithms will be added later and will have the same
+047:   stream interface.
+048: 
+049:      Compression can be done in a single step if the buffers are large
+050:   enough (for example if an input file is mmap'ed), or can be done by
+051:   repeated calls of the compression function.  In the latter case, the
+052:   application must provide more input and/or consume the output
+053:   (providing more output space) before each call.
+054: 
+055:      The library also supports reading and writing files in gzip (.gz) format
+056:   with an interface similar to that of stdio.
+057: 
+058:      The library does not install any signal handler. The decoder checks
+059:   the consistency of the compressed data, so the library should never
+060:   crash even in case of corrupted input.
+061: */
+062: 
+063: typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
+064: typedef void   (*free_func)  OF((voidpf opaque, voidpf address));
+065: 
+066: struct internal_state;
+067: 
+068: typedef struct z_stream_s {
+069:     Bytef    *next_in;  /* next input byte */
+070:     uInt     avail_in;  /* number of bytes available at next_in */
+071:     uLong    total_in;  /* total nb of input bytes read so far */
+072: 
+073:     Bytef    *next_out; /* next output byte should be put there */
+074:     uInt     avail_out; /* remaining free space at next_out */
+075:     uLong    total_out; /* total nb of bytes output so far */
+076: 
+077:     char     *msg;      /* last error message, NULL if no error */
+078:     struct internal_state FAR *state; /* not visible by applications */
+079: 
+080:     alloc_func zalloc;  /* used to allocate the internal state */
+081:     free_func  zfree;   /* used to free the internal state */
+082:     voidpf     opaque;  /* private data object passed to zalloc and zfree */
+083: 
+084:     int     data_type;  /* best guess about the data type: ascii or binary */
+085:     uLong   adler;      /* adler32 value of the uncompressed data */
+086:     uLong   reserved;   /* reserved for future use */
+087: } z_stream;
+088: 
+089: typedef z_stream FAR *z_streamp;
+090: 
+091: /*
+092:    The application must update next_in and avail_in when avail_in has
+093:    dropped to zero. It must update next_out and avail_out when avail_out
+094:    has dropped to zero. The application must initialize zalloc, zfree and
+095:    opaque before calling the init function. All other fields are set by the
+096:    compression library and must not be updated by the application.
+097: 
+098:    The opaque value provided by the application will be passed as the first
+099:    parameter for calls of zalloc and zfree. This can be useful for custom
+100:    memory management. The compression library attaches no meaning to the
+101:    opaque value.
+102: 
+103:    zalloc must return Z_NULL if there is not enough memory for the object.
+104:    If zlib is used in a multi-threaded application, zalloc and zfree must be
+105:    thread safe.
+106: 
+107:    On 16-bit systems, the functions zalloc and zfree must be able to allocate
+108:    exactly 65536 bytes, but will not be required to allocate more than this
+109:    if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
+110:    pointers returned by zalloc for objects of exactly 65536 bytes *must*
+111:    have their offset normalized to zero. The default allocation function
+112:    provided by this library ensures this (see zutil.c). To reduce memory
+113:    requirements and avoid any allocation of 64K objects, at the expense of
+114:    compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
+115: 
+116:    The fields total_in and total_out can be used for statistics or
+117:    progress reports. After compression, total_in holds the total size of
+118:    the uncompressed data and may be saved for use in the decompressor
+119:    (particularly if the decompressor wants to decompress everything in
+120:    a single step).
+121: */
+122: 
+123:                         /* constants */
+124: 
+125: #define Z_NO_FLUSH      0
+126: #define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */
+127: #define Z_SYNC_FLUSH    2
+128: #define Z_FULL_FLUSH    3
+129: #define Z_FINISH        4
+130: /* Allowed flush values; see deflate() below for details */
+131: 
+132: #define Z_OK            0
+133: #define Z_STREAM_END    1
+134: #define Z_NEED_DICT     2
+135: #define Z_ERRNO        (-1)
+136: #define Z_STREAM_ERROR (-2)
+137: #define Z_DATA_ERROR   (-3)
+138: #define Z_MEM_ERROR    (-4)
+139: #define Z_BUF_ERROR    (-5)
+140: #define Z_VERSION_ERROR (-6)
+141: /* Return codes for the compression/decompression functions. Negative
+142:  * values are errors, positive values are used for special but normal events.
+143:  */
+144: 
+145: #define Z_NO_COMPRESSION         0
+146: #define Z_BEST_SPEED             1
+147: #define Z_BEST_COMPRESSION       9
+148: #define Z_DEFAULT_COMPRESSION  (-1)
+149: /* compression levels */
+150: 
+151: #define Z_FILTERED            1
+152: #define Z_HUFFMAN_ONLY        2
+153: #define Z_DEFAULT_STRATEGY    0
+154: /* compression strategy; see deflateInit2() below for details */
+155: 
+156: #define Z_BINARY   0
+157: #define Z_ASCII    1
+158: #define Z_UNKNOWN  2
+159: /* Possible values of the data_type field */
+160: 
+161: #define Z_DEFLATED   8
+162: /* The deflate compression method (the only one supported in this version) */
+163: 
+164: #define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
+165: 
+166: #define zlib_version zlibVersion()
+167: /* for compatibility with versions < 1.0.2 */
+168: 
+169:                         /* basic functions */
+170: 
+171: ZEXTERN const char * ZEXPORT zlibVersion OF((void));
+172: /* The application can compare zlibVersion and ZLIB_VERSION for consistency.
+173:    If the first character differs, the library code actually used is
+174:    not compatible with the zlib.h header file used by the application.
+175:    This check is automatically made by deflateInit and inflateInit.
+176:  */
+177: 
+178: /* 
+179: ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
+180: 
+181:      Initializes the internal stream state for compression. The fields
+182:    zalloc, zfree and opaque must be initialized before by the caller.
+183:    If zalloc and zfree are set to Z_NULL, deflateInit updates them to
+184:    use default allocation functions.
+185: 
+186:      The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
+187:    1 gives best speed, 9 gives best compression, 0 gives no compression at
+188:    all (the input data is simply copied a block at a time).
+189:    Z_DEFAULT_COMPRESSION requests a default compromise between speed and
+190:    compression (currently equivalent to level 6).
+191: 
+192:      deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
+193:    enough memory, Z_STREAM_ERROR if level is not a valid compression level,
+194:    Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
+195:    with the version assumed by the caller (ZLIB_VERSION).
+196:    msg is set to null if there is no error message.  deflateInit does not
+197:    perform any compression: this will be done by deflate().
+198: */
+199: 
+200: 
+201: ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
+202: /*
+203:     deflate compresses as much data as possible, and stops when the input
+204:   buffer becomes empty or the output buffer becomes full. It may introduce some
+205:   output latency (reading input without producing any output) except when
+206:   forced to flush.
+207: 
+208:     The detailed semantics are as follows. deflate performs one or both of the
+209:   following actions:
+210: 
+211:   - Compress more input starting at next_in and update next_in and avail_in
+212:     accordingly. If not all input can be processed (because there is not
+213:     enough room in the output buffer), next_in and avail_in are updated and
+214:     processing will resume at this point for the next call of deflate().
+215: 
+216:   - Provide more output starting at next_out and update next_out and avail_out
+217:     accordingly. This action is forced if the parameter flush is non zero.
+218:     Forcing flush frequently degrades the compression ratio, so this parameter
+219:     should be set only when necessary (in interactive applications).
+220:     Some output may be provided even if flush is not set.
+221: 
+222:   Before the call of deflate(), the application should ensure that at least
+223:   one of the actions is possible, by providing more input and/or consuming
+224:   more output, and updating avail_in or avail_out accordingly; avail_out
+225:   should never be zero before the call. The application can consume the
+226:   compressed output when it wants, for example when the output buffer is full
+227:   (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK
+228:   and with zero avail_out, it must be called again after making room in the
+229:   output buffer because there might be more output pending.
+230: 
+231:     If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
+232:   flushed to the output buffer and the output is aligned on a byte boundary, so
+233:   that the decompressor can get all input data available so far. (In particular
+234:   avail_in is zero after the call if enough output space has been provided
+235:   before the call.)  Flushing may degrade compression for some compression
+236:   algorithms and so it should be used only when necessary.
+237: 
+238:     If flush is set to Z_FULL_FLUSH, all output is flushed as with
+239:   Z_SYNC_FLUSH, and the compression state is reset so that decompression can
+240:   restart from this point if previous compressed data has been damaged or if
+241:   random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
+242:   the compression.
+243: 
+244:     If deflate returns with avail_out == 0, this function must be called again
+245:   with the same value of the flush parameter and more output space (updated
+246:   avail_out), until the flush is complete (deflate returns with non-zero
+247:   avail_out).
+248: 
+249:     If the parameter flush is set to Z_FINISH, pending input is processed,
+250:   pending output is flushed and deflate returns with Z_STREAM_END if there
+251:   was enough output space; if deflate returns with Z_OK, this function must be
+252:   called again with Z_FINISH and more output space (updated avail_out) but no
+253:   more input data, until it returns with Z_STREAM_END or an error. After
+254:   deflate has returned Z_STREAM_END, the only possible operations on the
+255:   stream are deflateReset or deflateEnd.
+256:   
+257:     Z_FINISH can be used immediately after deflateInit if all the compression
+258:   is to be done in a single step. In this case, avail_out must be at least
+259:   0.1% larger than avail_in plus 12 bytes.  If deflate does not return
+260:   Z_STREAM_END, then it must be called again as described above.
+261: 
+262:     deflate() sets strm->adler to the adler32 checksum of all input read
+263:   so far (that is, total_in bytes).
+264: 
+265:     deflate() may update data_type if it can make a good guess about
+266:   the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered
+267:   binary. This field is only for information purposes and does not affect
+268:   the compression algorithm in any manner.
+269: 
+270:     deflate() returns Z_OK if some progress has been made (more input
+271:   processed or more output produced), Z_STREAM_END if all input has been
+272:   consumed and all output has been produced (only when flush is set to
+273:   Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
+274:   if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible
+275:   (for example avail_in or avail_out was zero).
+276: */
+277: 
+278: 
+279: ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
+280: /*
+281:      All dynamically allocated data structures for this stream are freed.
+282:    This function discards any unprocessed input and does not flush any
+283:    pending output.
+284: 
+285:      deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
+286:    stream state was inconsistent, Z_DATA_ERROR if the stream was freed
+287:    prematurely (some input or output was discarded). In the error case,
+288:    msg may be set but then points to a static string (which must not be
+289:    deallocated).
+290: */
+291: 
+292: 
+293: /* 
+294: ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
+295: 
+296:      Initializes the internal stream state for decompression. The fields
+297:    next_in, avail_in, zalloc, zfree and opaque must be initialized before by
+298:    the caller. If next_in is not Z_NULL and avail_in is large enough (the exact
+299:    value depends on the compression method), inflateInit determines the
+300:    compression method from the zlib header and allocates all data structures
+301:    accordingly; otherwise the allocation will be deferred to the first call of
+302:    inflate.  If zalloc and zfree are set to Z_NULL, inflateInit updates them to
+303:    use default allocation functions.
+304: 
+305:      inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
+306:    memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
+307:    version assumed by the caller.  msg is set to null if there is no error
+308:    message. inflateInit does not perform any decompression apart from reading
+309:    the zlib header if present: this will be done by inflate().  (So next_in and
+310:    avail_in may be modified, but next_out and avail_out are unchanged.)
+311: */
+312: 
+313: 
+314: ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
+315: /*
+316:     inflate decompresses as much data as possible, and stops when the input
+317:   buffer becomes empty or the output buffer becomes full. It may some
+318:   introduce some output latency (reading input without producing any output)
+319:   except when forced to flush.
+320: 
+321:   The detailed semantics are as follows. inflate performs one or both of the
+322:   following actions:
+323: 
+324:   - Decompress more input starting at next_in and update next_in and avail_in
+325:     accordingly. If not all input can be processed (because there is not
+326:     enough room in the output buffer), next_in is updated and processing
+327:     will resume at this point for the next call of inflate().
+328: 
+329:   - Provide more output starting at next_out and update next_out and avail_out
+330:     accordingly.  inflate() provides as much output as possible, until there
+331:     is no more input data or no more space in the output buffer (see below
+332:     about the flush parameter).
+333: 
+334:   Before the call of inflate(), the application should ensure that at least
+335:   one of the actions is possible, by providing more input and/or consuming
+336:   more output, and updating the next_* and avail_* values accordingly.
+337:   The application can consume the uncompressed output when it wants, for
+338:   example when the output buffer is full (avail_out == 0), or after each
+339:   call of inflate(). If inflate returns Z_OK and with zero avail_out, it
+340:   must be called again after making room in the output buffer because there
+341:   might be more output pending.
+342: 
+343:     If the parameter flush is set to Z_SYNC_FLUSH, inflate flushes as much
+344:   output as possible to the output buffer. The flushing behavior of inflate is
+345:   not specified for values of the flush parameter other than Z_SYNC_FLUSH
+346:   and Z_FINISH, but the current implementation actually flushes as much output
+347:   as possible anyway.
+348: 
+349:     inflate() should normally be called until it returns Z_STREAM_END or an
+350:   error. However if all decompression is to be performed in a single step
+351:   (a single call of inflate), the parameter flush should be set to
+352:   Z_FINISH. In this case all pending input is processed and all pending
+353:   output is flushed; avail_out must be large enough to hold all the
+354:   uncompressed data. (The size of the uncompressed data may have been saved
+355:   by the compressor for this purpose.) The next operation on this stream must
+356:   be inflateEnd to deallocate the decompression state. The use of Z_FINISH
+357:   is never required, but can be used to inform inflate that a faster routine
+358:   may be used for the single inflate() call.
+359: 
+360:      If a preset dictionary is needed at this point (see inflateSetDictionary
+361:   below), inflate sets strm-adler to the adler32 checksum of the
+362:   dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise 
+363:   it sets strm->adler to the adler32 checksum of all output produced
+364:   so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or
+365:   an error code as described below. At the end of the stream, inflate()
+366:   checks that its computed adler32 checksum is equal to that saved by the
+367:   compressor and returns Z_STREAM_END only if the checksum is correct.
+368: 
+369:     inflate() returns Z_OK if some progress has been made (more input processed
+370:   or more output produced), Z_STREAM_END if the end of the compressed data has
+371:   been reached and all uncompressed output has been produced, Z_NEED_DICT if a
+372:   preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
+373:   corrupted (input stream not conforming to the zlib format or incorrect
+374:   adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent
+375:   (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not
+376:   enough memory, Z_BUF_ERROR if no progress is possible or if there was not
+377:   enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR
+378:   case, the application may then call inflateSync to look for a good
+379:   compression block.
+380: */
+381: 
+382: 
+383: ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
+384: /*
+385:      All dynamically allocated data structures for this stream are freed.
+386:    This function discards any unprocessed input and does not flush any
+387:    pending output.
+388: 
+389:      inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
+390:    was inconsistent. In the error case, msg may be set but then points to a
+391:    static string (which must not be deallocated).
+392: */
+393: 
+394:                         /* Advanced functions */
+395: 
+396: /*
+397:     The following functions are needed only in some special applications.
+398: */
+399: 
+400: /*   
+401: ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
+402:                                      int  level,
+403:                                      int  method,
+404:                                      int  windowBits,
+405:                                      int  memLevel,
+406:                                      int  strategy));
+407: 
+408:      This is another version of deflateInit with more compression options. The
+409:    fields next_in, zalloc, zfree and opaque must be initialized before by
+410:    the caller.
+411: 
+412:      The method parameter is the compression method. It must be Z_DEFLATED in
+413:    this version of the library.
+414: 
+415:      The windowBits parameter is the base two logarithm of the window size
+416:    (the size of the history buffer).  It should be in the range 8..15 for this
+417:    version of the library. Larger values of this parameter result in better
+418:    compression at the expense of memory usage. The default value is 15 if
+419:    deflateInit is used instead.
+420: 
+421:      The memLevel parameter specifies how much memory should be allocated
+422:    for the internal compression state. memLevel=1 uses minimum memory but
+423:    is slow and reduces compression ratio; memLevel=9 uses maximum memory
+424:    for optimal speed. The default value is 8. See zconf.h for total memory
+425:    usage as a function of windowBits and memLevel.
+426: 
+427:      The strategy parameter is used to tune the compression algorithm. Use the
+428:    value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
+429:    filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no
+430:    string match).  Filtered data consists mostly of small values with a
+431:    somewhat random distribution. In this case, the compression algorithm is
+432:    tuned to compress them better. The effect of Z_FILTERED is to force more
+433:    Huffman coding and less string matching; it is somewhat intermediate
+434:    between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects
+435:    the compression ratio but not the correctness of the compressed output even
+436:    if it is not set appropriately.
+437: 
+438:       deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+439:    memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid
+440:    method). msg is set to null if there is no error message.  deflateInit2 does
+441:    not perform any compression: this will be done by deflate().
+442: */
+443:                             
+444: ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
+445:                                              const Bytef *dictionary,
+446:                                              uInt  dictLength));
+447: /*
+448:      Initializes the compression dictionary from the given byte sequence
+449:    without producing any compressed output. This function must be called
+450:    immediately after deflateInit, deflateInit2 or deflateReset, before any
+451:    call of deflate. The compressor and decompressor must use exactly the same
+452:    dictionary (see inflateSetDictionary).
+453: 
+454:      The dictionary should consist of strings (byte sequences) that are likely
+455:    to be encountered later in the data to be compressed, with the most commonly
+456:    used strings preferably put towards the end of the dictionary. Using a
+457:    dictionary is most useful when the data to be compressed is short and can be
+458:    predicted with good accuracy; the data can then be compressed better than
+459:    with the default empty dictionary.
+460: 
+461:      Depending on the size of the compression data structures selected by
+462:    deflateInit or deflateInit2, a part of the dictionary may in effect be
+463:    discarded, for example if the dictionary is larger than the window size in
+464:    deflate or deflate2. Thus the strings most likely to be useful should be
+465:    put at the end of the dictionary, not at the front.
+466: 
+467:      Upon return of this function, strm->adler is set to the Adler32 value
+468:    of the dictionary; the decompressor may later use this value to determine
+469:    which dictionary has been used by the compressor. (The Adler32 value
+470:    applies to the whole dictionary even if only a subset of the dictionary is
+471:    actually used by the compressor.)
+472: 
+473:      deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
+474:    parameter is invalid (such as NULL dictionary) or the stream state is
+475:    inconsistent (for example if deflate has already been called for this stream
+476:    or if the compression method is bsort). deflateSetDictionary does not
+477:    perform any compression: this will be done by deflate().
+478: */
+479: 
+480: ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
+481:                                     z_streamp source));
+482: /*
+483:      Sets the destination stream as a complete copy of the source stream.
+484: 
+485:      This function can be useful when several compression strategies will be
+486:    tried, for example when there are several ways of pre-processing the input
+487:    data with a filter. The streams that will be discarded should then be freed
+488:    by calling deflateEnd.  Note that deflateCopy duplicates the internal
+489:    compression state which can be quite large, so this strategy is slow and
+490:    can consume lots of memory.
+491: 
+492:      deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
+493:    enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
+494:    (such as zalloc being NULL). msg is left unchanged in both source and
+495:    destination.
+496: */
+497: 
+498: ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
+499: /*
+500:      This function is equivalent to deflateEnd followed by deflateInit,
+501:    but does not free and reallocate all the internal compression state.
+502:    The stream will keep the same compression level and any other attributes
+503:    that may have been set by deflateInit2.
+504: 
+505:       deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
+506:    stream state was inconsistent (such as zalloc or state being NULL).
+507: */
+508: 
+509: ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
+510: 				      int level,
+511: 				      int strategy));
+512: /*
+513:      Dynamically update the compression level and compression strategy.  The
+514:    interpretation of level and strategy is as in deflateInit2.  This can be
+515:    used to switch between compression and straight copy of the input data, or
+516:    to switch to a different kind of input data requiring a different
+517:    strategy. If the compression level is changed, the input available so far
+518:    is compressed with the old level (and may be flushed); the new level will
+519:    take effect only at the next call of deflate().
+520: 
+521:      Before the call of deflateParams, the stream state must be set as for
+522:    a call of deflate(), since the currently available input may have to
+523:    be compressed and flushed. In particular, strm->avail_out must be non-zero.
+524: 
+525:      deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
+526:    stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
+527:    if strm->avail_out was zero.
+528: */
+529: 
+530: /*   
+531: ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
+532:                                      int  windowBits));
+533: 
+534:      This is another version of inflateInit with an extra parameter. The
+535:    fields next_in, avail_in, zalloc, zfree and opaque must be initialized
+536:    before by the caller.
+537: 
+538:      The windowBits parameter is the base two logarithm of the maximum window
+539:    size (the size of the history buffer).  It should be in the range 8..15 for
+540:    this version of the library. The default value is 15 if inflateInit is used
+541:    instead. If a compressed stream with a larger window size is given as
+542:    input, inflate() will return with the error code Z_DATA_ERROR instead of
+543:    trying to allocate a larger window.
+544: 
+545:       inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+546:    memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative
+547:    memLevel). msg is set to null if there is no error message.  inflateInit2
+548:    does not perform any decompression apart from reading the zlib header if
+549:    present: this will be done by inflate(). (So next_in and avail_in may be
+550:    modified, but next_out and avail_out are unchanged.)
+551: */
+552: 
+553: ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
+554:                                              const Bytef *dictionary,
+555:                                              uInt  dictLength));
+556: /*
+557:      Initializes the decompression dictionary from the given uncompressed byte
+558:    sequence. This function must be called immediately after a call of inflate
+559:    if this call returned Z_NEED_DICT. The dictionary chosen by the compressor
+560:    can be determined from the Adler32 value returned by this call of
+561:    inflate. The compressor and decompressor must use exactly the same
+562:    dictionary (see deflateSetDictionary).
+563: 
+564:      inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
+565:    parameter is invalid (such as NULL dictionary) or the stream state is
+566:    inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
+567:    expected one (incorrect Adler32 value). inflateSetDictionary does not
+568:    perform any decompression: this will be done by subsequent calls of
+569:    inflate().
+570: */
+571: 
+572: ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
+573: /* 
+574:     Skips invalid compressed data until a full flush point (see above the
+575:   description of deflate with Z_FULL_FLUSH) can be found, or until all
+576:   available input is skipped. No output is provided.
+577: 
+578:     inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
+579:   if no more input was provided, Z_DATA_ERROR if no flush point has been found,
+580:   or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
+581:   case, the application may save the current current value of total_in which
+582:   indicates where valid compressed data was found. In the error case, the
+583:   application may repeatedly call inflateSync, providing more input each time,
+584:   until success or end of the input data.
+585: */
+586: 
+587: ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
+588: /*
+589:      This function is equivalent to inflateEnd followed by inflateInit,
+590:    but does not free and reallocate all the internal decompression state.
+591:    The stream will keep attributes that may have been set by inflateInit2.
+592: 
+593:       inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
+594:    stream state was inconsistent (such as zalloc or state being NULL).
+595: */
+596: 
+597: 
+598:                         /* utility functions */
+599: 
+600: /*
+601:      The following utility functions are implemented on top of the
+602:    basic stream-oriented functions. To simplify the interface, some
+603:    default options are assumed (compression level and memory usage,
+604:    standard memory allocation functions). The source code of these
+605:    utility functions can easily be modified if you need special options.
+606: */
+607: 
+608: ZEXTERN int ZEXPORT compress OF((Bytef *dest,   uLongf *destLen,
+609:                                  const Bytef *source, uLong sourceLen));
+610: /*
+611:      Compresses the source buffer into the destination buffer.  sourceLen is
+612:    the byte length of the source buffer. Upon entry, destLen is the total
+613:    size of the destination buffer, which must be at least 0.1% larger than
+614:    sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the
+615:    compressed buffer.
+616:      This function can be used to compress a whole file at once if the
+617:    input file is mmap'ed.
+618:      compress returns Z_OK if success, Z_MEM_ERROR if there was not
+619:    enough memory, Z_BUF_ERROR if there was not enough room in the output
+620:    buffer.
+621: */
+622: 
+623: ZEXTERN int ZEXPORT compress2 OF((Bytef *dest,   uLongf *destLen,
+624:                                   const Bytef *source, uLong sourceLen,
+625:                                   int level));
+626: /*
+627:      Compresses the source buffer into the destination buffer. The level
+628:    parameter has the same meaning as in deflateInit.  sourceLen is the byte
+629:    length of the source buffer. Upon entry, destLen is the total size of the
+630:    destination buffer, which must be at least 0.1% larger than sourceLen plus
+631:    12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
+632: 
+633:      compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+634:    memory, Z_BUF_ERROR if there was not enough room in the output buffer,
+635:    Z_STREAM_ERROR if the level parameter is invalid.
+636: */
+637: 
+638: ZEXTERN int ZEXPORT uncompress OF((Bytef *dest,   uLongf *destLen,
+639:                                    const Bytef *source, uLong sourceLen));
+640: /*
+641:      Decompresses the source buffer into the destination buffer.  sourceLen is
+642:    the byte length of the source buffer. Upon entry, destLen is the total
+643:    size of the destination buffer, which must be large enough to hold the
+644:    entire uncompressed data. (The size of the uncompressed data must have
+645:    been saved previously by the compressor and transmitted to the decompressor
+646:    by some mechanism outside the scope of this compression library.)
+647:    Upon exit, destLen is the actual size of the compressed buffer.
+648:      This function can be used to decompress a whole file at once if the
+649:    input file is mmap'ed.
+650: 
+651:      uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
+652:    enough memory, Z_BUF_ERROR if there was not enough room in the output
+653:    buffer, or Z_DATA_ERROR if the input data was corrupted.
+654: */
+655: 
+656: 
+657: typedef voidp gzFile;
+658: 
+659: ZEXTERN gzFile ZEXPORT gzopen  OF((const char *path, const char *mode));
+660: /*
+661:      Opens a gzip (.gz) file for reading or writing. The mode parameter
+662:    is as in fopen ("rb" or "wb") but can also include a compression level
+663:    ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for
+664:    Huffman only compression as in "wb1h". (See the description
+665:    of deflateInit2 for more information about the strategy parameter.)
+666: 
+667:      gzopen can be used to read a file which is not in gzip format; in this
+668:    case gzread will directly read from the file without decompression.
+669: 
+670:      gzopen returns NULL if the file could not be opened or if there was
+671:    insufficient memory to allocate the (de)compression state; errno
+672:    can be checked to distinguish the two cases (if errno is zero, the
+673:    zlib error is Z_MEM_ERROR).  */
+674: 
+675: ZEXTERN gzFile ZEXPORT gzdopen  OF((int fd, const char *mode));
+676: /*
+677:      gzdopen() associates a gzFile with the file descriptor fd.  File
+678:    descriptors are obtained from calls like open, dup, creat, pipe or
+679:    fileno (in the file has been previously opened with fopen).
+680:    The mode parameter is as in gzopen.
+681:      The next call of gzclose on the returned gzFile will also close the
+682:    file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
+683:    descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
+684:      gzdopen returns NULL if there was insufficient memory to allocate
+685:    the (de)compression state.
+686: */
+687: 
+688: ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
+689: /*
+690:      Dynamically update the compression level or strategy. See the description
+691:    of deflateInit2 for the meaning of these parameters.
+692:      gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
+693:    opened for writing.
+694: */
+695: 
+696: ZEXTERN int ZEXPORT    gzread  OF((gzFile file, voidp buf, unsigned len));
+697: /*
+698:      Reads the given number of uncompressed bytes from the compressed file.
+699:    If the input file was not in gzip format, gzread copies the given number
+700:    of bytes into the buffer.
+701:      gzread returns the number of uncompressed bytes actually read (0 for
+702:    end of file, -1 for error). */
+703: 
+704: ZEXTERN int ZEXPORT    gzwrite OF((gzFile file, 
+705: 				   const voidp buf, unsigned len));
+706: /*
+707:      Writes the given number of uncompressed bytes into the compressed file.
+708:    gzwrite returns the number of uncompressed bytes actually written
+709:    (0 in case of error).
+710: */
+711: 
+712: ZEXTERN int ZEXPORTVA   gzprintf OF((gzFile file, const char *format, ...));
+713: /*
+714:      Converts, formats, and writes the args to the compressed file under
+715:    control of the format string, as in fprintf. gzprintf returns the number of
+716:    uncompressed bytes actually written (0 in case of error).
+717: */
+718: 
+719: ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
+720: /*
+721:       Writes the given null-terminated string to the compressed file, excluding
+722:    the terminating null character.
+723:       gzputs returns the number of characters written, or -1 in case of error.
+724: */
+725: 
+726: ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
+727: /*
+728:       Reads bytes from the compressed file until len-1 characters are read, or
+729:    a newline character is read and transferred to buf, or an end-of-file
+730:    condition is encountered.  The string is then terminated with a null
+731:    character.
+732:       gzgets returns buf, or Z_NULL in case of error.
+733: */
+734: 
+735: ZEXTERN int ZEXPORT    gzputc OF((gzFile file, int c));
+736: /*
+737:       Writes c, converted to an unsigned char, into the compressed file.
+738:    gzputc returns the value that was written, or -1 in case of error.
+739: */
+740: 
+741: ZEXTERN int ZEXPORT    gzgetc OF((gzFile file));
+742: /*
+743:       Reads one byte from the compressed file. gzgetc returns this byte
+744:    or -1 in case of end of file or error.
+745: */
+746: 
+747: ZEXTERN int ZEXPORT    gzflush OF((gzFile file, int flush));
+748: /*
+749:      Flushes all pending output into the compressed file. The parameter
+750:    flush is as in the deflate() function. The return value is the zlib
+751:    error number (see function gzerror below). gzflush returns Z_OK if
+752:    the flush parameter is Z_FINISH and all output could be flushed.
+753:      gzflush should be called only when strictly necessary because it can
+754:    degrade compression.
+755: */
+756: 
+757: ZEXTERN z_off_t ZEXPORT    gzseek OF((gzFile file,
+758: 				      z_off_t offset, int whence));
+759: /* 
+760:       Sets the starting position for the next gzread or gzwrite on the
+761:    given compressed file. The offset represents a number of bytes in the
+762:    uncompressed data stream. The whence parameter is defined as in lseek(2);
+763:    the value SEEK_END is not supported.
+764:      If the file is opened for reading, this function is emulated but can be
+765:    extremely slow. If the file is opened for writing, only forward seeks are
+766:    supported; gzseek then compresses a sequence of zeroes up to the new
+767:    starting position.
+768: 
+769:       gzseek returns the resulting offset location as measured in bytes from
+770:    the beginning of the uncompressed stream, or -1 in case of error, in
+771:    particular if the file is opened for writing and the new starting position
+772:    would be before the current position.
+773: */
+774: 
+775: ZEXTERN int ZEXPORT    gzrewind OF((gzFile file));
+776: /*
+777:      Rewinds the given file. This function is supported only for reading.
+778: 
+779:    gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
+780: */
+781: 
+782: ZEXTERN z_off_t ZEXPORT    gztell OF((gzFile file));
+783: /*
+784:      Returns the starting position for the next gzread or gzwrite on the
+785:    given compressed file. This position represents a number of bytes in the
+786:    uncompressed data stream.
+787: 
+788:    gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
+789: */
+790: 
+791: ZEXTERN int ZEXPORT gzeof OF((gzFile file));
+792: /*
+793:      Returns 1 when EOF has previously been detected reading the given
+794:    input stream, otherwise zero.
+795: */
+796: 
+797: ZEXTERN int ZEXPORT    gzclose OF((gzFile file));
+798: /*
+799:      Flushes all pending output if necessary, closes the compressed file
+800:    and deallocates all the (de)compression state. The return value is the zlib
+801:    error number (see function gzerror below).
+802: */
+803: 
+804: ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
+805: /*
+806:      Returns the error message for the last error which occurred on the
+807:    given compressed file. errnum is set to zlib error number. If an
+808:    error occurred in the file system and not in the compression library,
+809:    errnum is set to Z_ERRNO and the application may consult errno
+810:    to get the exact error code.
+811: */
+812: 
+813:                         /* checksum functions */
+814: 
+815: /*
+816:      These functions are not related to compression but are exported
+817:    anyway because they might be useful in applications using the
+818:    compression library.
+819: */
+820: 
+821: ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
+822: 
+823: /*
+824:      Update a running Adler-32 checksum with the bytes buf[0..len-1] and
+825:    return the updated checksum. If buf is NULL, this function returns
+826:    the required initial value for the checksum.
+827:    An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
+828:    much faster. Usage example:
+829: 
+830:      uLong adler = adler32(0L, Z_NULL, 0);
+831: 
+832:      while (read_buffer(buffer, length) != EOF) {
+833:        adler = adler32(adler, buffer, length);
+834:      }
+835:      if (adler != original_adler) error();
+836: */
+837: 
+838: ZEXTERN uLong ZEXPORT crc32   OF((uLong crc, const Bytef *buf, uInt len));
+839: /*
+840:      Update a running crc with the bytes buf[0..len-1] and return the updated
+841:    crc. If buf is NULL, this function returns the required initial value
+842:    for the crc. Pre- and post-conditioning (one's complement) is performed
+843:    within this function so it shouldn't be done by the application.
+844:    Usage example:
+845: 
+846:      uLong crc = crc32(0L, Z_NULL, 0);
+847: 
+848:      while (read_buffer(buffer, length) != EOF) {
+849:        crc = crc32(crc, buffer, length);
+850:      }
+851:      if (crc != original_crc) error();
+852: */
+853: 
+854: 
+855:                         /* various hacks, don't look :) */
+856: 
+857: /* deflateInit and inflateInit are macros to allow checking the zlib version
+858:  * and the compiler's view of z_stream:
+859:  */
+860: ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
+861:                                      const char *version, int stream_size));
+862: ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
+863:                                      const char *version, int stream_size));
+864: ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int  level, int  method,
+865:                                       int windowBits, int memLevel,
+866:                                       int strategy, const char *version,
+867:                                       int stream_size));
+868: ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int  windowBits,
+869:                                       const char *version, int stream_size));
+870: #define deflateInit(strm, level) \
+871:         deflateInit_((strm), (level),       ZLIB_VERSION, sizeof(z_stream))
+872: #define inflateInit(strm) \
+873:         inflateInit_((strm),                ZLIB_VERSION, sizeof(z_stream))
+874: #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
+875:         deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
+876:                       (strategy),           ZLIB_VERSION, sizeof(z_stream))
+877: #define inflateInit2(strm, windowBits) \
+878:         inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
+879: 
+880: 
+881: #if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL)
+882:     struct internal_state {int dummy;}; /* hack for buggy compilers */
+883: #endif
+884: 
+885: ZEXTERN const char   * ZEXPORT zError           OF((int err));
+886: ZEXTERN int            ZEXPORT inflateSyncPoint OF((z_streamp z));
+887: ZEXTERN const uLongf * ZEXPORT get_crc_table    OF((void));
+888: 
+889: #ifdef __cplusplus
+890: }
+891: #endif
+892: 
+893: #endif /* _ZLIB_H */
+      
+
+ +

How the zlib wrapper was developed

+ +

Attempt #1

+
+
+/* File : example.i */
+%module example
+%{
+/* Put headers and other declarations here */
+#include "zlib.h"
+%}
+
+%include typemaps.i
+
+%include "zlib.h"
+      
+
+ + The result is: + +
+
+% swig -chicken -I/usr/include example.i
+/usr/include/zlib.h:63: Syntax error in input.
+/usr/include/zlib.h:78: Syntax error in input.
+/usr/include/zlib.h:80: Syntax error in input.
+      
+
+ + The first problem we see is that the macro OF(...) is + not defined. + +

Attempt #2

+ + We make sure to include zconf.h so that SWIG can see the + definition of OF(...). We try again. + +
+
+/* File : example.i */
+%module example
+%{
+/* Put headers and other declarations here */
+#include "zlib.h"
+%}
+
+%include typemaps.i
+
+%include "zconf.h"
+%include "zlib.h"
+      
+
+ + The result is: + +
+
+% swig -chicken -I/usr/include example.i
+      
+
+ + This seems to work! But we should take a peek inside the generated + example_wrap.c to see what the names of the Scheme + procedures will be. + +
+
+% grep C_intern example_wrap.c
+  C_word err = C_intern2 (&a, errorhook);
+    sym = C_intern (&a, 21, "example:max-mem-level");
+    sym = C_intern (&a, 17, "example:max-wbits");
+    sym = C_intern (&a, 16, "example:seek-set");
+    sym = C_intern (&a, 16, "example:seek-cur");
+    sym = C_intern (&a, 16, "example:seek-end");
+    sym = C_intern (&a, 20, "example:zlib-version");
+    sym = C_intern (&a, 28, "example:z-stream-next-in-set");
+    sym = C_intern (&a, 28, "example:z-stream-next-in-get");
+    sym = C_intern (&a, 29, "example:z-stream-avail-in-set");
+    sym = C_intern (&a, 29, "example:z-stream-avail-in-get");
+    sym = C_intern (&a, 29, "example:z-stream-total-in-set");
+    sym = C_intern (&a, 29, "example:z-stream-total-in-get");
+    sym = C_intern (&a, 29, "example:z-stream-next-out-set");
+    sym = C_intern (&a, 29, "example:z-stream-next-out-get");
+    sym = C_intern (&a, 30, "example:z-stream-avail-out-set");
+    sym = C_intern (&a, 30, "example:z-stream-avail-out-get");
+    sym = C_intern (&a, 30, "example:z-stream-total-out-set");
+    sym = C_intern (&a, 30, "example:z-stream-total-out-get");
+    sym = C_intern (&a, 24, "example:z-stream-msg-set");
+    sym = C_intern (&a, 24, "example:z-stream-msg-get");
+    sym = C_intern (&a, 26, "example:z-stream-state-set");
+    sym = C_intern (&a, 26, "example:z-stream-state-get");
+    sym = C_intern (&a, 27, "example:z-stream-zalloc-set");
+    sym = C_intern (&a, 27, "example:z-stream-zalloc-get");
+    sym = C_intern (&a, 26, "example:z-stream-zfree-set");
+    sym = C_intern (&a, 26, "example:z-stream-zfree-get");
+    sym = C_intern (&a, 27, "example:z-stream-opaque-set");
+    sym = C_intern (&a, 27, "example:z-stream-opaque-get");
+    sym = C_intern (&a, 30, "example:z-stream-data-type-set");
+    sym = C_intern (&a, 30, "example:z-stream-data-type-get");
+    sym = C_intern (&a, 26, "example:z-stream-adler-set");
+    sym = C_intern (&a, 26, "example:z-stream-adler-get");
+    sym = C_intern (&a, 29, "example:z-stream-reserved-set");
+    sym = C_intern (&a, 29, "example:z-stream-reserved-get");
+    sym = C_intern (&a, 20, "example:new-z-stream");
+    sym = C_intern (&a, 23, "example:delete-z-stream");
+    sym = C_intern (&a, 18, "example:z-no-flush");
+    sym = C_intern (&a, 23, "example:z-partial-flush");
+    sym = C_intern (&a, 20, "example:z-sync-flush");
+    sym = C_intern (&a, 20, "example:z-full-flush");
+    sym = C_intern (&a, 16, "example:z-finish");
+    sym = C_intern (&a, 12, "example:z-ok");
+    sym = C_intern (&a, 20, "example:z-stream-end");
+    sym = C_intern (&a, 19, "example:z-need-dict");
+    sym = C_intern (&a, 15, "example:z-errno");
+    sym = C_intern (&a, 22, "example:z-stream-error");
+    sym = C_intern (&a, 20, "example:z-data-error");
+    sym = C_intern (&a, 19, "example:z-mem-error");
+    sym = C_intern (&a, 19, "example:z-buf-error");
+    sym = C_intern (&a, 23, "example:z-version-error");
+    sym = C_intern (&a, 24, "example:z-no-compression");
+    sym = C_intern (&a, 20, "example:z-best-speed");
+    sym = C_intern (&a, 26, "example:z-best-compression");
+    sym = C_intern (&a, 29, "example:z-default-compression");
+    sym = C_intern (&a, 18, "example:z-filtered");
+    sym = C_intern (&a, 22, "example:z-huffman-only");
+    sym = C_intern (&a, 26, "example:z-default-strategy");
+    sym = C_intern (&a, 16, "example:z-binary");
+    sym = C_intern (&a, 15, "example:z-ascii");
+    sym = C_intern (&a, 17, "example:z-unknown");
+    sym = C_intern (&a, 18, "example:z-deflated");
+    sym = C_intern (&a, 14, "example:z-null");
+    sym = C_intern (&a, 19, "example:zlibversion");
+    sym = C_intern (&a, 15, "example:deflate");
+    sym = C_intern (&a, 18, "example:deflateend");
+    sym = C_intern (&a, 15, "example:inflate");
+    sym = C_intern (&a, 18, "example:inflateend");
+    sym = C_intern (&a, 28, "example:deflatesetdictionary");
+    sym = C_intern (&a, 19, "example:deflatecopy");
+    sym = C_intern (&a, 20, "example:deflatereset");
+    sym = C_intern (&a, 21, "example:deflateparams");
+    sym = C_intern (&a, 28, "example:inflatesetdictionary");
+    sym = C_intern (&a, 19, "example:inflatesync");
+    sym = C_intern (&a, 20, "example:inflatereset");
+    sym = C_intern (&a, 16, "example:compress");
+    sym = C_intern (&a, 17, "example:compress2");
+    sym = C_intern (&a, 18, "example:uncompress");
+    sym = C_intern (&a, 14, "example:gzopen");
+    sym = C_intern (&a, 15, "example:gzdopen");
+    sym = C_intern (&a, 19, "example:gzsetparams");
+    sym = C_intern (&a, 14, "example:gzread");
+    sym = C_intern (&a, 15, "example:gzwrite");
+    sym = C_intern (&a, 16, "example:gzprintf");
+    sym = C_intern (&a, 14, "example:gzputs");
+    sym = C_intern (&a, 14, "example:gzgets");
+    sym = C_intern (&a, 14, "example:gzputc");
+    sym = C_intern (&a, 14, "example:gzgetc");
+    sym = C_intern (&a, 15, "example:gzflush");
+    sym = C_intern (&a, 14, "example:gzseek");
+    sym = C_intern (&a, 16, "example:gzrewind");
+    sym = C_intern (&a, 14, "example:gztell");
+    sym = C_intern (&a, 13, "example:gzeof");
+    sym = C_intern (&a, 15, "example:gzclose");
+    sym = C_intern (&a, 15, "example:gzerror");
+    sym = C_intern (&a, 15, "example:adler32");
+    sym = C_intern (&a, 13, "example:crc32");
+    sym = C_intern (&a, 20, "example:deflateinit-");
+    sym = C_intern (&a, 20, "example:inflateinit-");
+    sym = C_intern (&a, 21, "example:deflateinit2-");
+    sym = C_intern (&a, 21, "example:inflateinit2-");
+    sym = C_intern (&a, 32, "example:internal-state-dummy-set");
+    sym = C_intern (&a, 32, "example:internal-state-dummy-get");
+    sym = C_intern (&a, 26, "example:new-internal-state");
+    sym = C_intern (&a, 29, "example:delete-internal-state");
+    sym = C_intern (&a, 14, "example:zerror");
+    sym = C_intern (&a, 24, "example:inflatesyncpoint");
+    sym = C_intern (&a, 21, "example:get-crc-table");
+      
+
+ + In fact, we want the Scheme procedure names to begin with + zlib instead of example. For + example:zlib-version, we want + zlib-version. And we want dashes when the case + switches to/from upper/lowercase; ex. the function + deflateEnd() should be the Scheme procedure + zlib-deflate-end. + +

Attempt #3

+ + We make sure to add -prefix zlib -mixed to the + swig command line, and we rename + ZLIB_VERSION to VERSION. We try again. + +
+
+/* File : example.i */
+%module example
+%{
+/* Put headers and other declarations here */
+#include "zlib.h"
+%}
+
+%include typemaps.i
+
+%rename(VERSION) ZLIB_VERSION;
+
+%include "zconf.h"
+%include "zlib.h"
+      
+
+ + The result is: + +
+
+% swig -chicken -prefix zlib -mixed -I/usr/include example.i
+% grep C_intern example_wrap.c
+  C_word err = C_intern2 (&a, errorhook);
+    sym = C_intern (&a, 18, "zlib:max-mem-level");
+    sym = C_intern (&a, 14, "zlib:max-wbits");
+    sym = C_intern (&a, 13, "zlib:seek-set");
+    sym = C_intern (&a, 13, "zlib:seek-cur");
+    sym = C_intern (&a, 13, "zlib:seek-end");
+    sym = C_intern (&a, 12, "zlib:version");
+    sym = C_intern (&a, 25, "zlib:z-stream-next-in-set");
+    sym = C_intern (&a, 25, "zlib:z-stream-next-in-get");
+    sym = C_intern (&a, 26, "zlib:z-stream-avail-in-set");
+    sym = C_intern (&a, 26, "zlib:z-stream-avail-in-get");
+    sym = C_intern (&a, 26, "zlib:z-stream-total-in-set");
+    sym = C_intern (&a, 26, "zlib:z-stream-total-in-get");
+    sym = C_intern (&a, 26, "zlib:z-stream-next-out-set");
+    sym = C_intern (&a, 26, "zlib:z-stream-next-out-get");
+    sym = C_intern (&a, 27, "zlib:z-stream-avail-out-set");
+    sym = C_intern (&a, 27, "zlib:z-stream-avail-out-get");
+    sym = C_intern (&a, 27, "zlib:z-stream-total-out-set");
+    sym = C_intern (&a, 27, "zlib:z-stream-total-out-get");
+    sym = C_intern (&a, 21, "zlib:z-stream-msg-set");
+    sym = C_intern (&a, 21, "zlib:z-stream-msg-get");
+    sym = C_intern (&a, 23, "zlib:z-stream-state-set");
+    sym = C_intern (&a, 23, "zlib:z-stream-state-get");
+    sym = C_intern (&a, 24, "zlib:z-stream-zalloc-set");
+    sym = C_intern (&a, 24, "zlib:z-stream-zalloc-get");
+    sym = C_intern (&a, 23, "zlib:z-stream-zfree-set");
+    sym = C_intern (&a, 23, "zlib:z-stream-zfree-get");
+    sym = C_intern (&a, 24, "zlib:z-stream-opaque-set");
+    sym = C_intern (&a, 24, "zlib:z-stream-opaque-get");
+    sym = C_intern (&a, 27, "zlib:z-stream-data-type-set");
+    sym = C_intern (&a, 27, "zlib:z-stream-data-type-get");
+    sym = C_intern (&a, 23, "zlib:z-stream-adler-set");
+    sym = C_intern (&a, 23, "zlib:z-stream-adler-get");
+    sym = C_intern (&a, 26, "zlib:z-stream-reserved-set");
+    sym = C_intern (&a, 26, "zlib:z-stream-reserved-get");
+    sym = C_intern (&a, 17, "zlib:new-z-stream");
+    sym = C_intern (&a, 20, "zlib:delete-z-stream");
+    sym = C_intern (&a, 15, "zlib:z-no-flush");
+    sym = C_intern (&a, 20, "zlib:z-partial-flush");
+    sym = C_intern (&a, 17, "zlib:z-sync-flush");
+    sym = C_intern (&a, 17, "zlib:z-full-flush");
+    sym = C_intern (&a, 13, "zlib:z-finish");
+    sym = C_intern (&a, 9, "zlib:z-ok");
+    sym = C_intern (&a, 17, "zlib:z-stream-end");
+    sym = C_intern (&a, 16, "zlib:z-need-dict");
+    sym = C_intern (&a, 12, "zlib:z-errno");
+    sym = C_intern (&a, 19, "zlib:z-stream-error");
+    sym = C_intern (&a, 17, "zlib:z-data-error");
+    sym = C_intern (&a, 16, "zlib:z-mem-error");
+    sym = C_intern (&a, 16, "zlib:z-buf-error");
+    sym = C_intern (&a, 20, "zlib:z-version-error");
+    sym = C_intern (&a, 21, "zlib:z-no-compression");
+    sym = C_intern (&a, 17, "zlib:z-best-speed");
+    sym = C_intern (&a, 23, "zlib:z-best-compression");
+    sym = C_intern (&a, 26, "zlib:z-default-compression");
+    sym = C_intern (&a, 15, "zlib:z-filtered");
+    sym = C_intern (&a, 19, "zlib:z-huffman-only");
+    sym = C_intern (&a, 23, "zlib:z-default-strategy");
+    sym = C_intern (&a, 13, "zlib:z-binary");
+    sym = C_intern (&a, 12, "zlib:z-ascii");
+    sym = C_intern (&a, 14, "zlib:z-unknown");
+    sym = C_intern (&a, 15, "zlib:z-deflated");
+    sym = C_intern (&a, 11, "zlib:z-null");
+    sym = C_intern (&a, 17, "zlib:zlib-version");
+    sym = C_intern (&a, 12, "zlib:deflate");
+    sym = C_intern (&a, 16, "zlib:deflate-end");
+    sym = C_intern (&a, 12, "zlib:inflate");
+    sym = C_intern (&a, 16, "zlib:inflate-end");
+    sym = C_intern (&a, 27, "zlib:deflate-set-dictionary");
+    sym = C_intern (&a, 17, "zlib:deflate-copy");
+    sym = C_intern (&a, 18, "zlib:deflate-reset");
+    sym = C_intern (&a, 19, "zlib:deflate-params");
+    sym = C_intern (&a, 27, "zlib:inflate-set-dictionary");
+    sym = C_intern (&a, 17, "zlib:inflate-sync");
+    sym = C_intern (&a, 18, "zlib:inflate-reset");
+    sym = C_intern (&a, 13, "zlib:compress");
+    sym = C_intern (&a, 14, "zlib:compress2");
+    sym = C_intern (&a, 15, "zlib:uncompress");
+    sym = C_intern (&a, 11, "zlib:gzopen");
+    sym = C_intern (&a, 12, "zlib:gzdopen");
+    sym = C_intern (&a, 16, "zlib:gzsetparams");
+    sym = C_intern (&a, 11, "zlib:gzread");
+    sym = C_intern (&a, 12, "zlib:gzwrite");
+    sym = C_intern (&a, 13, "zlib:gzprintf");
+    sym = C_intern (&a, 11, "zlib:gzputs");
+    sym = C_intern (&a, 11, "zlib:gzgets");
+    sym = C_intern (&a, 11, "zlib:gzputc");
+    sym = C_intern (&a, 11, "zlib:gzgetc");
+    sym = C_intern (&a, 12, "zlib:gzflush");
+    sym = C_intern (&a, 11, "zlib:gzseek");
+    sym = C_intern (&a, 13, "zlib:gzrewind");
+    sym = C_intern (&a, 11, "zlib:gztell");
+    sym = C_intern (&a, 10, "zlib:gzeof");
+    sym = C_intern (&a, 12, "zlib:gzclose");
+    sym = C_intern (&a, 12, "zlib:gzerror");
+    sym = C_intern (&a, 12, "zlib:adler32");
+    sym = C_intern (&a, 10, "zlib:crc32");
+    sym = C_intern (&a, 18, "zlib:deflate-init-");
+    sym = C_intern (&a, 18, "zlib:inflate-init-");
+    sym = C_intern (&a, 19, "zlib:deflate-init2-");
+    sym = C_intern (&a, 19, "zlib:inflate-init2-");
+    sym = C_intern (&a, 29, "zlib:internal-state-dummy-set");
+    sym = C_intern (&a, 29, "zlib:internal-state-dummy-get");
+    sym = C_intern (&a, 23, "zlib:new-internal-state");
+    sym = C_intern (&a, 26, "zlib:delete-internal-state");
+    sym = C_intern (&a, 12, "zlib:ze-rror");
+    sym = C_intern (&a, 23, "zlib:inflate-sync-point");
+    sym = C_intern (&a, 18, "zlib:get-crc-table");
+      
+
+ + Much better. The only problem is the identifier + zlib:ze-rror, and we are missing + zlib:deflate-init and zlib:inflate-init + because they are defined as macros (see macro definitions). + +

Attempt #4

+ + We make sure to rename zError to + z_error, and we inline some helper functions for the + zlib:...-init macros. We try again. + +
+
+/* File : example.i */
+%module example
+%{
+/* Put headers and other declarations here */
+#include "zlib.h"
+%}
+
+%include typemaps.i
+
+%rename(VERSION) ZLIB_VERSION;
+%rename(z_error) zError;
+
+%include "zconf.h"
+%include "zlib.h"
+
+%inline %{
+/* %inline blocks are seen by SWIG and are inserted into the header
+   portion of example_wrap.c, so that they are also seen by the C
+   compiler. */
+int deflate_init(z_streamp strm, int level) {
+  return deflateInit(strm,level); /* call macro */
+}
+int inflate_init(z_streamp strm) {
+  return inflateInit(strm); /* call macro */
+}
+%}
+
+
+      
+
+ + The result is: + +
+
+% swig -chicken -prefix zlib -mixed -I/usr/include example.i
+% grep C_intern example_wrap.c
+  C_word err = C_intern2 (&a, errorhook);
+    sym = C_intern (&a, 18, "zlib:max-mem-level");
+    sym = C_intern (&a, 14, "zlib:max-wbits");
+    sym = C_intern (&a, 13, "zlib:seek-set");
+    sym = C_intern (&a, 13, "zlib:seek-cur");
+    sym = C_intern (&a, 13, "zlib:seek-end");
+    sym = C_intern (&a, 12, "zlib:version");
+    sym = C_intern (&a, 25, "zlib:z-stream-next-in-set");
+    sym = C_intern (&a, 25, "zlib:z-stream-next-in-get");
+    sym = C_intern (&a, 26, "zlib:z-stream-avail-in-set");
+    sym = C_intern (&a, 26, "zlib:z-stream-avail-in-get");
+    sym = C_intern (&a, 26, "zlib:z-stream-total-in-set");
+    sym = C_intern (&a, 26, "zlib:z-stream-total-in-get");
+    sym = C_intern (&a, 26, "zlib:z-stream-next-out-set");
+    sym = C_intern (&a, 26, "zlib:z-stream-next-out-get");
+    sym = C_intern (&a, 27, "zlib:z-stream-avail-out-set");
+    sym = C_intern (&a, 27, "zlib:z-stream-avail-out-get");
+    sym = C_intern (&a, 27, "zlib:z-stream-total-out-set");
+    sym = C_intern (&a, 27, "zlib:z-stream-total-out-get");
+    sym = C_intern (&a, 21, "zlib:z-stream-msg-set");
+    sym = C_intern (&a, 21, "zlib:z-stream-msg-get");
+    sym = C_intern (&a, 23, "zlib:z-stream-state-set");
+    sym = C_intern (&a, 23, "zlib:z-stream-state-get");
+    sym = C_intern (&a, 24, "zlib:z-stream-zalloc-set");
+    sym = C_intern (&a, 24, "zlib:z-stream-zalloc-get");
+    sym = C_intern (&a, 23, "zlib:z-stream-zfree-set");
+    sym = C_intern (&a, 23, "zlib:z-stream-zfree-get");
+    sym = C_intern (&a, 24, "zlib:z-stream-opaque-set");
+    sym = C_intern (&a, 24, "zlib:z-stream-opaque-get");
+    sym = C_intern (&a, 27, "zlib:z-stream-data-type-set");
+    sym = C_intern (&a, 27, "zlib:z-stream-data-type-get");
+    sym = C_intern (&a, 23, "zlib:z-stream-adler-set");
+    sym = C_intern (&a, 23, "zlib:z-stream-adler-get");
+    sym = C_intern (&a, 26, "zlib:z-stream-reserved-set");
+    sym = C_intern (&a, 26, "zlib:z-stream-reserved-get");
+    sym = C_intern (&a, 17, "zlib:new-z-stream");
+    sym = C_intern (&a, 20, "zlib:delete-z-stream");
+    sym = C_intern (&a, 15, "zlib:z-no-flush");
+    sym = C_intern (&a, 20, "zlib:z-partial-flush");
+    sym = C_intern (&a, 17, "zlib:z-sync-flush");
+    sym = C_intern (&a, 17, "zlib:z-full-flush");
+    sym = C_intern (&a, 13, "zlib:z-finish");
+    sym = C_intern (&a, 9, "zlib:z-ok");
+    sym = C_intern (&a, 17, "zlib:z-stream-end");
+    sym = C_intern (&a, 16, "zlib:z-need-dict");
+    sym = C_intern (&a, 12, "zlib:z-errno");
+    sym = C_intern (&a, 19, "zlib:z-stream-error");
+    sym = C_intern (&a, 17, "zlib:z-data-error");
+    sym = C_intern (&a, 16, "zlib:z-mem-error");
+    sym = C_intern (&a, 16, "zlib:z-buf-error");
+    sym = C_intern (&a, 20, "zlib:z-version-error");
+    sym = C_intern (&a, 21, "zlib:z-no-compression");
+    sym = C_intern (&a, 17, "zlib:z-best-speed");
+    sym = C_intern (&a, 23, "zlib:z-best-compression");
+    sym = C_intern (&a, 26, "zlib:z-default-compression");
+    sym = C_intern (&a, 15, "zlib:z-filtered");
+    sym = C_intern (&a, 19, "zlib:z-huffman-only");
+    sym = C_intern (&a, 23, "zlib:z-default-strategy");
+    sym = C_intern (&a, 13, "zlib:z-binary");
+    sym = C_intern (&a, 12, "zlib:z-ascii");
+    sym = C_intern (&a, 14, "zlib:z-unknown");
+    sym = C_intern (&a, 15, "zlib:z-deflated");
+    sym = C_intern (&a, 11, "zlib:z-null");
+    sym = C_intern (&a, 17, "zlib:zlib-version");
+    sym = C_intern (&a, 12, "zlib:deflate");
+    sym = C_intern (&a, 16, "zlib:deflate-end");
+    sym = C_intern (&a, 12, "zlib:inflate");
+    sym = C_intern (&a, 16, "zlib:inflate-end");
+    sym = C_intern (&a, 27, "zlib:deflate-set-dictionary");
+    sym = C_intern (&a, 17, "zlib:deflate-copy");
+    sym = C_intern (&a, 18, "zlib:deflate-reset");
+    sym = C_intern (&a, 19, "zlib:deflate-params");
+    sym = C_intern (&a, 27, "zlib:inflate-set-dictionary");
+    sym = C_intern (&a, 17, "zlib:inflate-sync");
+    sym = C_intern (&a, 18, "zlib:inflate-reset");
+    sym = C_intern (&a, 13, "zlib:compress");
+    sym = C_intern (&a, 14, "zlib:compress2");
+    sym = C_intern (&a, 15, "zlib:uncompress");
+    sym = C_intern (&a, 11, "zlib:gzopen");
+    sym = C_intern (&a, 12, "zlib:gzdopen");
+    sym = C_intern (&a, 16, "zlib:gzsetparams");
+    sym = C_intern (&a, 11, "zlib:gzread");
+    sym = C_intern (&a, 12, "zlib:gzwrite");
+    sym = C_intern (&a, 13, "zlib:gzprintf");
+    sym = C_intern (&a, 11, "zlib:gzputs");
+    sym = C_intern (&a, 11, "zlib:gzgets");
+    sym = C_intern (&a, 11, "zlib:gzputc");
+    sym = C_intern (&a, 11, "zlib:gzgetc");
+    sym = C_intern (&a, 12, "zlib:gzflush");
+    sym = C_intern (&a, 11, "zlib:gzseek");
+    sym = C_intern (&a, 13, "zlib:gzrewind");
+    sym = C_intern (&a, 11, "zlib:gztell");
+    sym = C_intern (&a, 10, "zlib:gzeof");
+    sym = C_intern (&a, 12, "zlib:gzclose");
+    sym = C_intern (&a, 12, "zlib:gzerror");
+    sym = C_intern (&a, 12, "zlib:adler32");
+    sym = C_intern (&a, 10, "zlib:crc32");
+    sym = C_intern (&a, 18, "zlib:deflate-init-");
+    sym = C_intern (&a, 18, "zlib:inflate-init-");
+    sym = C_intern (&a, 19, "zlib:deflate-init2-");
+    sym = C_intern (&a, 19, "zlib:inflate-init2-");
+    sym = C_intern (&a, 29, "zlib:internal-state-dummy-set");
+    sym = C_intern (&a, 29, "zlib:internal-state-dummy-get");
+    sym = C_intern (&a, 23, "zlib:new-internal-state");
+    sym = C_intern (&a, 26, "zlib:delete-internal-state");
+    sym = C_intern (&a, 12, "zlib:z-error");
+    sym = C_intern (&a, 23, "zlib:inflate-sync-point");
+    sym = C_intern (&a, 18, "zlib:get-crc-table");
+    sym = C_intern (&a, 17, "zlib:deflate-init");
+    sym = C_intern (&a, 17, "zlib:inflate-init");
+      
+
+ + Perfect! Now let's integrate this zlib extension into a + CHICKEN interpreter. To save some time, in this + Examples/chicken/zlib directory: +
    +
  1. Backup the original example.i.
  2. +
  3. Copy and paste the example.i text from above and + put it into the file called example.i
  4. +
  5. Run 'make' as per Building the + example.
  6. +
  7. Run the resultant executable zlib.
  8. +
+ + The interpreter interaction is as follows: + +
+
+% ./zlib
+zlib
+
+  A SWIG example for the CHICKEN compiler
+  Author: Jonah Beckford, February 2003
+
+Scheme Procedures:
+
+zlib:max-mem-level
+zlib:max-wbits
+zlib:seek-set
+zlib:seek-cur
+zlib:seek-end
+zlib:version
+zlib:z-stream-next-in-set
+zlib:z-stream-next-in-get
+zlib:z-stream-avail-in-set
+...
+zlib:get-crc-table
+zlib:deflate-init
+zlib:inflate-init
+; This is the CHICKEN interpreter - Version 0, Build 1095 - windows-cygwin-x86
+; (c)2000-2003 Felix L. Winkelmann
+>>> (define s (zlib:new-z-stream))
+>>> s
+#<tagged pointer #<c++ "z_stream *">(#<pointer 6d9290>)>
+>>> (zlib:z-stream-next-in-get s)
+#f
+>>> (zlib:z-stream-next-in-set s "some dummy stream data")
+Error: Type error. Expected _p_Bytef: "bad argument type"
+>>> (exit)
+      
+
+ + Apparently we cannot use Scheme strings as Bytef *. The SWIG + manual shows many ways how to handle strings and byte arrays, but + to be simplistic, let's just make the Bytef * look + like a char *, which is automatically handled as a + string by SWIG CHICKEN. + +

Attempt #5

+ + We make sure to add an %apply construct so that Bytef + * is handled the same as char * to SWIG. We + try again. + +
+
+/* File : example.i */
+%module example
+%{
+/* Put headers and other declarations here */
+#include "zlib.h"
+%}
+
+%include typemaps.i
+
+%rename(VERSION) ZLIB_VERSION;
+%rename(z_error) zError;
+%apply char * { Bytef * };
+
+%include "zconf.h"
+%include "zlib.h"
+
+%inline %{
+/* %inline blocks are seen by SWIG and are inserted into the header
+   portion of example_wrap.c, so that they are also seen by the C
+   compiler. */
+int deflate_init(z_streamp strm, int level) {
+  return deflateInit(strm,level); /* call macro */
+}
+int inflate_init(z_streamp strm) {
+  return inflateInit(strm); /* call macro */
+}
+%}
+      
+
+ + Build the example once more.
+ + The interpreter interaction is as follows: + +
+
+% ./zlib
+zlib
+
+  A SWIG example for the CHICKEN compiler
+  Author: Jonah Beckford, February 2003
+
+Scheme Procedures:
+
+zlib:max-mem-level
+zlib:max-wbits
+zlib:seek-set
+zlib:seek-cur
+zlib:seek-end
+zlib:version
+zlib:z-stream-next-in-set
+zlib:z-stream-next-in-get
+zlib:z-stream-avail-in-set
+...
+zlib:get-crc-table
+zlib:deflate-init
+zlib:inflate-init
+; This is the CHICKEN interpreter - Version 0, Build 1095 - windows-cygwin-x86
+; (c)2000-2003 Felix L. Winkelmann
+>>> (define s (zlib:new-z-stream))
+Init zstream
+>>> (zlib:z-stream-zalloc-set s #f) 
+>>> (zlib:z-stream-zfree-set s #f)
+>>> (zlib:z-stream-opaque-set s #f)
+>>> (zlib:deflate-init s (zlib:z-default-compression))
+0
+Deflate something small so we don't need to loop/stream data
+>>> (define in "some dummy data")
+>>> (define out (make-string 1000))
+>>> (zlib:z-stream-next-in-set s in)
+>>> (zlib:z-stream-avail-in-set s (string-length in))
+>>> (zlib:z-stream-next-out-set s out)
+>>> (zlib:z-stream-avail-out-set s (string-length out))
+>>> (zlib:deflate s (zlib:z-finish))
+1 ;; (zlib:z-stream-end) == 1, which is good
+>>> (zlib:z-stream-total-out-get s)
+23.
+>>> out
+"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        "
+      
+
+ + We see the problem ... the compression is occurring as it should, + but we cannot see any of the compressed output. This is because + when SWIG CHICKEN passes a Scheme string to a C function, it + duplicates the string before calling the C function. We want to + save the memory address that + zlib:z-stream-next-out-set is using, so we can + display this later. While we are at it, we can foresee that + compress, compress2 and + uncompress will all need some finessing to work with + mutating strings. + +

Attempt #6

+ + When we have to finesse strings, we must use typemaps. As well, + we define some functions to save and restore the + next_out element. We try again. + +
+
+/* File : example.i */
+%module example
+%{
+/* Put headers and other declarations here */
+#include "zlib.h"
+%}
+
+%include typemaps.i
+
+%rename(VERSION) ZLIB_VERSION;
+%rename(z_error) zError;
+%apply char * { Bytef * };
+	
+/* Allow the sourceLen to be automatically filled in from the length
+   of the 'source' string */
+%typemap(in) (const Bytef *source, uLong sourceLen)
+%{  if (!C_swig_is_string ($input)) {
+    swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE, "Argument $input is not a string");
+  }
+  $2 = (uLong) C_header_size ($input);
+  $1 = C_c_string ($input);
+%}
+
+/* Allocate space the size of which is determined by the Scheme
+   integer argument, and make a temporary integer so we can set
+   destLen. */
+%typemap(in) (Bytef *dest, uLongf *destLen) (uLong len)
+%{  if (!C_swig_is_fixnum ($input)) {
+    swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE, "Argument $input is not a integer");
+  }
+  len = (uLong) C_unfix ($input);
+  $2 = &len;
+  $1 = (char *) malloc (*$2);
+%}
+
+/* Return the mutated string as a new object. */
+%typemap(argout) (Bytef *dest, uLongf *destLen) 
+(C_word *scmstr) 
+%{  scmstr = C_alloc (C_SIZEOF_STRING (*$2));
+  SWIG_APPEND_VALUE(C_string (&scmstr, *$2, $1));
+  free ($1);
+%}
+	
+%include "zconf.h"
+%include "zlib.h"
+	
+/* Ignore destLen as an input argument, and make a temporary integer so
+   we can set destLen. */
+%typemap(in, numinputs=0) uLongf *destLen (uLong len)
+"$1 = &len;";
+
+/* Return a sized string as a new object. */
+%typemap(argout)
+(void *outstr, uLongf *destLen) (C_word *scmstr) 
+%{  scmstr = C_alloc (C_SIZEOF_STRING (*$2));
+  SWIG_APPEND_VALUE(C_string (&scmstr, *$2, $1));
+%}
+	
+%inline %{
+/* %inline blocks are seen by SWIG and are inserted into the header
+   portion of example_wrap.c, so that they are also seen by the C
+   compiler. */
+int deflate_init(z_streamp strm, int level) {
+  return deflateInit(strm,level); /* call macro */
+}
+int inflate_init(z_streamp strm) {
+  return inflateInit(strm); /* call macro */
+}
+void* z_stream_save_next_out(z_streamp strm) {
+  return (void*) strm->next_out;
+}
+void z_stream_get_next_chunk(z_streamp strm, void *outstr, uLongf *destLen) {
+  *destLen = strm->next_out - (Bytef*)outstr;
+}
+%}
+      
+
+ + And that's it. Try building the entire example from the + Makefile. Run ./zlib test-zlib.scm to test it out. + + + diff --git a/Examples/chicken/zlib/example.i b/Examples/chicken/zlib/example.i new file mode 100644 index 000000000..dd962ad56 --- /dev/null +++ b/Examples/chicken/zlib/example.i @@ -0,0 +1,76 @@ +/* File : example.i */ +%module example +%{ +/* Put headers and other declarations here */ +#include "zlib.h" +%} + +%include typemaps.i + +%rename(VERSION) ZLIB_VERSION; +%rename(z_error) zError; +%apply char * { Bytef * }; + +/* Allow the sourceLen to be automatically filled in from the length + of the 'source' string */ +%typemap(in) (const Bytef *source, uLong sourceLen) +%{ if (!C_swig_is_string ($input)) { + swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE, "Argument $input is not a string"); + } + $2 = (uLong) C_header_size ($input); + $1 = C_c_string ($input); +%} + +/* Allocate space the size of which is determined by the Scheme + integer argument, and make a temporary integer so we can set + destLen. */ +%typemap(in) (Bytef *dest, uLongf *destLen) (uLong len) +%{ if (!C_swig_is_fixnum ($input)) { + swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE, "Argument $input is not a integer"); + } + len = (uLong) C_unfix ($input); + $2 = &len; + $1 = (char *) malloc (*$2); +%} + +/* Return the mutated string as a new object. */ +%typemap(argout) (Bytef *dest, uLongf *destLen) +(C_word *scmstr) +%{ scmstr = C_alloc (C_SIZEOF_STRING (*$2)); + SWIG_APPEND_VALUE(C_string (&scmstr, *$2, $1)); + free ($1); +%} + +%include "zconf.h" +%include "zlib.h" + +/* Ignore destLen as an input argument, and make a temporary integer so + we can set destLen. */ +%typemap(numinputs=0) uLongf *destLen (uLong len) +"$1 = &len;"; + +/* Return a sized string as a new object. */ +%typemap(argout) +(void *outstr, uLongf *destLen) (C_word *scmstr) +%{ scmstr = C_alloc (C_SIZEOF_STRING (*$2)); + SWIG_APPEND_VALUE(C_string (&scmstr, *$2, $1)); +%} + +%inline %{ +/* %inline blocks are seen by SWIG and are inserted into the header + portion of example_wrap.c, so that they are also seen by the C + compiler. */ +int deflate_init(z_streamp strm, int level) { + return deflateInit(strm,level); /* call macro */ +} +int inflate_init(z_streamp strm) { + return inflateInit(strm); /* call macro */ +} +void* z_stream_save_next_out(z_streamp strm) { + return (void*) strm->next_out; +} +void z_stream_get_next_chunk(z_streamp strm, void *outstr, uLongf *destLen) { + *destLen = strm->next_out - (Bytef*)outstr; +} +%} + diff --git a/Examples/chicken/zlib/test-zlib.scm b/Examples/chicken/zlib/test-zlib.scm new file mode 100644 index 000000000..a13d801b8 --- /dev/null +++ b/Examples/chicken/zlib/test-zlib.scm @@ -0,0 +1,41 @@ +(load-library 'example "./zlib.so") + +;; Init zstream +(define s (new-z-stream)) +(z-stream-zalloc-set s #f) +(z-stream-zfree-set s #f) +(z-stream-opaque-set s #f) +(deflate-init s (Z-DEFAULT-COMPRESSION)) + +;; Deflate something small so we don't need to loop/stream data +(define in "some pony et jumping et jack et flash et had a jack pony") +(define out (make-string 1000)) +(printf "to be compressed: ~A~%to be compressed bytes: ~A~%~%" in (string-length in)) +(z-stream-next-in-set s in) +(z-stream-avail-in-set s (string-length in)) +(z-stream-next-out-set s out) +(z-stream-avail-out-set s (string-length out)) +(let* + ((saved-out (z-stream-save-next-out s)) + (ret (deflate s (Z-FINISH)))) + (cond + ((= ret (Z-STREAM-END)) + (printf "deflated properly!~%compressed bytes: ~A~%compressed stream: ~A~%" + (z-stream-total-out-get s) (z-stream-get-next-chunk s saved-out))) + ((= ret (Z-OK)) + (display "only partial deflation ... not enough output space\n")) + (else + (printf "deflate error(~D): ~A ~%" ret (z-stream-msg-get s))))) + +;; Use simple compress routine, and set max output size to 100 +(newline) +(call-with-values (lambda () (compress 100 in)) + (lambda (ret compressed) + (cond + ((= ret (Z-OK)) + (printf "compressed properly!~%compressed bytes: ~A~%compressed stream: ~A~%" + (string-length compressed) compressed)) + (else + (printf "compress error(~D): ~A ~%" ret (z-error ret)))))) + +(exit 0) diff --git a/Examples/guile/check.list b/Examples/guile/check.list index 7ccd0730a..d35b2d693 100644 --- a/Examples/guile/check.list +++ b/Examples/guile/check.list @@ -1,5 +1,6 @@ # see top-level Makefile.in constants +matrix simple port multimap diff --git a/Examples/lua/lua.c b/Examples/lua/lua.c index 8cffaa503..e06e2c5fc 100644 --- a/Examples/lua/lua.c +++ b/Examples/lua/lua.c @@ -1,4 +1,5 @@ /* +** $Id$ ** Lua stand-alone interpreter ** See Copyright Notice in lua.h */ diff --git a/Examples/test-suite/li_std_queue.i b/Examples/test-suite/li_std_queue.i index 6bf71afca..2d322b4d9 100644 --- a/Examples/test-suite/li_std_queue.i +++ b/Examples/test-suite/li_std_queue.i @@ -1,4 +1,13 @@ -// test of std::queue +/** + * @file std_queue.i + * @author gga + * @date Sun May 6 01:52:44 2007 + * + * @brief test of std::queue + * + * + */ + %module li_std_queue %include std_queue.i diff --git a/Examples/test-suite/li_std_set.i b/Examples/test-suite/li_std_set.i index 2dcc2f17c..8c335b24c 100644 --- a/Examples/test-suite/li_std_set.i +++ b/Examples/test-suite/li_std_set.i @@ -1,12 +1,18 @@ -/* - * a test of set containers. - * Languages should define swig::LANGUAGE_OBJ to be - * an entity of their native pointer type which can be - * included in a STL container. +/** + * @file li_std_set.i + * @author gga + * @date Tue May 1 02:52:47 2007 + * + * @brief a test of set containers. + * Languages should define swig::LANGUAGE_OBJ to be + * an entity of their native pointer type which can be + * included in a STL container. * - * For example: - * swig::LANGUAGE_OBJ is GC_VALUE in Ruby - * swig::LANGUAGE_OBJ is SwigPtr_PyObject in python + * For example: + * swig::LANGUAGE_OBJ is GC_VALUE in Ruby + * swig::LANGUAGE_OBJ is SwigPtr_PyObject in python + * + * */ %module li_std_set diff --git a/Examples/test-suite/li_std_stack.i b/Examples/test-suite/li_std_stack.i index 19b45d46f..d29254089 100644 --- a/Examples/test-suite/li_std_stack.i +++ b/Examples/test-suite/li_std_stack.i @@ -1,4 +1,13 @@ -// test of std::stack +/** + * @file std_stack.i + * @author gga + * @date Sun May 6 01:52:44 2007 + * + * @brief test of std::stack + * + * + */ + %module li_std_stack %include std_stack.i diff --git a/Examples/test-suite/ruby/ruby_li_std_speed_runme.rb b/Examples/test-suite/ruby/ruby_li_std_speed_runme.rb index e79cb46a8..825f3c593 100755 --- a/Examples/test-suite/ruby/ruby_li_std_speed_runme.rb +++ b/Examples/test-suite/ruby/ruby_li_std_speed_runme.rb @@ -3,6 +3,9 @@ # This is a simple speed benchmark suite for std containers, # to verify their O(n) performance. # It is not part of the standard tests. +# +# License:: SWIG +# require 'benchmark' diff --git a/Examples/test-suite/ruby_li_std_speed.i b/Examples/test-suite/ruby_li_std_speed.i index bfb0b2776..3c8e60643 100644 --- a/Examples/test-suite/ruby_li_std_speed.i +++ b/Examples/test-suite/ruby_li_std_speed.i @@ -1,4 +1,13 @@ -// A speed test of the ruby stl +/** + * @file ruby_li_std_speed.i + * @author gga + * @date Fri May 18 18:03:15 2007 + * + * @brief A speed test of the ruby stl + * + * + */ + %module ruby_li_std_speed %include diff --git a/Examples/xml/example_gif.i b/Examples/xml/example_gif.i new file mode 100644 index 000000000..f0fb3b183 --- /dev/null +++ b/Examples/xml/example_gif.i @@ -0,0 +1,329 @@ +/* ----------------------------------------------------------------------------- + * gifplot.h + * + * Main header file for the GIFPlot library. + * + * Author(s) : David Beazley (beazley@cs.uchicago.edu) + * Copyright (C) 1995-1996 + * + * See the file LICENSE for information on usage and redistribution. + * ----------------------------------------------------------------------------- */ + +#include +#include +#include +#include +#include +#include + +#ifndef GIFPLOT_H + +/* Pixel is 8-bits */ + +typedef unsigned char Pixel; +typedef float Zvalue; + +/* ------------------------------------------------------------------------ + ColorMap + + Definition and methods for colormaps + ------------------------------------------------------------------------ */ + +typedef struct ColorMap { + unsigned char *cmap; + char *name; +} ColorMap; + +extern ColorMap *new_ColorMap(char *filename); +extern void delete_ColorMap(ColorMap *c); +extern void ColorMap_default(ColorMap *c); +extern void ColorMap_assign(ColorMap *c, int index, int r, int g, int b); +extern int ColorMap_getitem(ColorMap *c, int index); +extern void ColorMap_setitem(ColorMap *c, int index, int value); +extern int ColorMap_write(ColorMap *c, char *filename); + +/* Some default colors */ + +#define BLACK 0 +#define WHITE 1 +#define RED 2 +#define GREEN 3 +#define BLUE 4 +#define YELLOW 5 +#define CYAN 6 +#define MAGENTA 7 + +/*------------------------------------------------------------------------- + FrameBuffer + + This structure defines a simple 8 bit framebuffer. + ------------------------------------------------------------------------- */ + +typedef struct FrameBuffer { + Pixel **pixels; + Zvalue **zbuffer; + unsigned int height; + unsigned int width; + int xmin; /* These are used for clipping */ + int ymin; + int xmax; + int ymax; +} FrameBuffer; + +#define ZMIN 1e+36 + +/* FrameBuffer Methods */ + +extern FrameBuffer *new_FrameBuffer(unsigned int width, unsigned int height); +extern void delete_FrameBuffer(FrameBuffer *frame); +extern int FrameBuffer_resize(FrameBuffer *frame, int width, int height); +extern void FrameBuffer_clear(FrameBuffer *frame, Pixel color); +extern void FrameBuffer_plot(FrameBuffer *frame, int x, int y, Pixel color); +extern void FrameBuffer_horizontal(FrameBuffer *frame, int xmin, int xmax, int y, Pixel color); +extern void FrameBuffer_horizontalinterp(FrameBuffer *f, int xmin, int xmax, int y, Pixel c1, Pixel c2); +extern void FrameBuffer_vertical(FrameBuffer *frame, int ymin, int ymax, int x, Pixel color); +extern void FrameBuffer_box(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); +extern void FrameBuffer_solidbox(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); +extern void FrameBuffer_interpbox(FrameBuffer *f, int x1, int y1, int x2, int y2, Pixel c1, Pixel c2, Pixel c3, Pixel c4); +extern void FrameBuffer_circle(FrameBuffer *frame, int x1, int y1, int radius, Pixel color); +extern void FrameBuffer_solidcircle(FrameBuffer *frame, int x1, int y1, int radius, Pixel color); +extern void FrameBuffer_line(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); +extern void FrameBuffer_setclip(FrameBuffer *frame, int xmin, int ymin, int xmax, int ymax); +extern void FrameBuffer_noclip(FrameBuffer *frame); +extern int FrameBuffer_makeGIF(FrameBuffer *frame, ColorMap *cmap, void *buffer, unsigned int maxsize); +extern int FrameBuffer_writeGIF(FrameBuffer *f, ColorMap *c, char *filename); +extern void FrameBuffer_zresize(FrameBuffer *f, int width, int height); +extern void FrameBuffer_zclear(FrameBuffer *f); +extern void FrameBuffer_solidtriangle(FrameBuffer *f, int x1, int y1, int x2, int y2, int x3, int y3, Pixel c); +extern void FrameBuffer_interptriangle(FrameBuffer *f, int tx1, int ty1, Pixel c1, + int tx2, int ty2, Pixel c2, int tx3, int ty3, Pixel c3); + +#define HORIZONTAL 1 +#define VERTICAL 2 + +extern void FrameBuffer_drawchar(FrameBuffer *frame, int x, int y, int fgcolor, int bgcolor, char chr, int orientation); +extern void FrameBuffer_drawstring(FrameBuffer *f, int x, int y, int fgcolor, int bgcolor, char *text, int orientation); + +/* ------------------------------------------------------------------------ + PixMap + + The equivalent of "bit-maps". + ------------------------------------------------------------------------ */ + +typedef struct PixMap { + int width; + int height; + int centerx; + int centery; + int *map; +} PixMap; + +/* PIXMAP methods */ + +extern PixMap *new_PixMap(int width, int height, int centerx, int centery); +extern void delete_PixMap(PixMap *pm); +extern void PixMap_set(PixMap *pm, int x, int y, int pix); +extern void FrameBuffer_drawpixmap(FrameBuffer *f, PixMap *pm, int x, int y, int fgcolor, int bgcolor); + +#define TRANSPARENT 0 +#define FOREGROUND 1 +#define BACKGROUND 2 + +/* ------------------------------------------------------------------------ + Plot2D + + Definition and methods for 2D plots. + ------------------------------------------------------------------------ */ + +typedef struct Plot2D { + FrameBuffer *frame; /* what frame buffer are we using */ + int view_xmin; /* Minimum coordinates of view region */ + int view_ymin; + int view_xmax; /* Maximum coordinates of view region */ + int view_ymax; + double xmin; /* Minimum coordinates of plot region */ + double ymin; + double xmax; /* Maximum coordinates of plot region */ + double ymax; + int xscale; /* Type of scaling (LINEAR, LOG, etc..) */ + int yscale; + double dx; /* Private scaling parameters */ + double dy; +} Plot2D; + +/* 2D Plot methods */ + +extern Plot2D *new_Plot2D(FrameBuffer *frame,double xmin,double ymin, double xmax, double ymax); +extern void delete_Plot2D(Plot2D *p2); +extern Plot2D *Plot2D_copy(Plot2D *p2); +extern void Plot2D_clear(Plot2D *p2, Pixel c); +extern void Plot2D_setview(Plot2D *p2, int vxmin, int vymin, int vxmax, int vymax); +extern void Plot2D_setrange(Plot2D *p2, double xmin, double ymin, double xmax, double ymax); +extern void Plot2D_setscale(Plot2D *p2, int xscale, int yscale); +extern void Plot2D_plot(Plot2D *p2, double x, double y, Pixel color); +extern void Plot2D_box(Plot2D *p2, double x1, double y1, double x2, double y2, Pixel color); +extern void Plot2D_solidbox(Plot2D *p2, double x1, double y1,double x2, double y2, Pixel color); +extern void Plot2D_interpbox(Plot2D *p2, double x1, double y1, double x2, double y2, Pixel c1, Pixel c2, Pixel c3, Pixel c4); +extern void Plot2D_circle(Plot2D *p2, double x, double y, double radius, Pixel color); +extern void Plot2D_solidcircle(Plot2D *p2, double x, double y, double radius, Pixel color); +extern void Plot2D_line(Plot2D *p2, double x1, double y1, double x2, double y2, Pixel color); +extern void Plot2D_start(Plot2D *p2); +extern void Plot2D_drawpixmap(Plot2D *p2, PixMap *pm, double x, double y, Pixel color, Pixel bgcolor); +extern void Plot2D_xaxis(Plot2D *p2, double x, double y, double xtick, int ticklength, Pixel c); +extern void Plot2D_yaxis(Plot2D *p2, double x, double y, double ytick, int ticklength, Pixel c); +extern void Plot2D_triangle(Plot2D *p2, double x1, double y1, double x2, double y2, double x3, double y3, Pixel c); +extern void Plot2D_solidtriangle(Plot2D *p2, double x1, double y1, double x2, double y2, double x3, double y3, Pixel c); +extern void Plot2D_interptriangle(Plot2D *p2, double x1, double y1, Pixel c1, + double x2, double y2, Pixel c2, + double x3, double y3, Pixel c3); + +#define LINEAR 10 +#define LOG 11 + +/* ----------------------------------------------------------------------- + Matrix + + Operations on 4x4 transformation matrices and vectors. + Matrices are represented as a double array of 16 elements + ----------------------------------------------------------------------- */ + +typedef double *Matrix; +typedef struct GL_Vector { + double x; + double y; + double z; + double w; +} GL_Vector; + +extern Matrix new_Matrix(); +extern void delete_Matrix(Matrix a); +extern Matrix Matrix_copy(Matrix a); +extern void Matrix_multiply(Matrix a, Matrix b, Matrix c); +extern void Matrix_identity(Matrix a); +extern void Matrix_zero(Matrix a); +extern void Matrix_transpose(Matrix a, Matrix result); +extern void Matrix_invert(Matrix a, Matrix inva); +extern void Matrix_transform(Matrix a, GL_Vector *r, GL_Vector *t); +extern void Matrix_transform4(Matrix a, double rx, double ry, double rz, + double rw, GL_Vector *t); + +extern void Matrix_print(Matrix a); +extern void Matrix_translate(Matrix a, double tx, double ty, double tz); +extern void Matrix_rotatex(Matrix a, double deg); +extern void Matrix_rotatey(Matrix a, double deg); +extern void Matrix_rotatez(Matrix a, double deg); + +/* ----------------------------------------------------------------------- + Plot3D + + Data Structure for 3-D plots + ------------------------------------------------------------------------ */ + +typedef struct Plot3D { + FrameBuffer *frame; /* Frame buffer being used */ + int view_xmin; /* Viewing region */ + int view_ymin; + int view_xmax; + int view_ymax; + double xmin; /* Bounding box */ + double ymin; + double zmin; + double xmax; + double ymax; + double zmax; + double xcenter; /* Center point */ + double ycenter; + double zcenter; + double fovy; /* Field of view */ + double aspect; /* Aspect ratio */ + double znear; /* near "clipping" plane */ + double zfar; /* far "clipping" plane */ + Matrix center_mat; /* Matrix used for centering the model */ + Matrix model_mat; /* Model rotation matrix */ + Matrix view_mat; /* Viewing matrix */ + Matrix fullmodel_mat; /* Full model matrix. Used by sphere plot */ + Matrix trans_mat; /* Total transformation matrix */ + double lookatz; /* Where is the z-lookat point */ + double xshift; /* Used for translation and stuff */ + double yshift; + double zoom; + int width; + int height; + int pers_mode; /* Perspective mode (private) */ + double ortho_left,ortho_right,ortho_bottom,ortho_top; +} Plot3D; + +extern Plot3D *new_Plot3D(FrameBuffer *frame, double xmin, double ymin, double zmin, + double xmax, double ymax, double zmax); +extern void delete_Plot3D(Plot3D *p3); +extern Plot3D *Plot3D_copy(Plot3D *p3); +extern void Plot3D_clear(Plot3D *p3, Pixel Color); +extern void Plot3D_perspective(Plot3D *p3, double fovy, double znear, double zfar); +extern void Plot3D_ortho(Plot3D *p3, double left, double right, double top, double bottom); +extern void Plot3D_lookat(Plot3D *p3, double z); +extern void Plot3D_autoperspective(Plot3D *p3, double fovy); +extern void Plot3D_autoortho(Plot3D *p3); +extern void Plot3D_rotx(Plot3D *p3, double deg); +extern void Plot3D_roty(Plot3D *p3, double deg); +extern void Plot3D_rotz(Plot3D *p3, double deg); +extern void Plot3D_rotl(Plot3D *p3, double deg); +extern void Plot3D_rotr(Plot3D *p3, double deg); +extern void Plot3D_rotd(Plot3D *p3, double deg); +extern void Plot3D_rotu(Plot3D *p3, double deg); +extern void Plot3D_rotc(Plot3D *p3, double deg); +extern void Plot3D_zoom(Plot3D *p3, double percent); +extern void Plot3D_left(Plot3D *p3, double percent); +extern void Plot3D_right(Plot3D *p3, double percent); +extern void Plot3D_down(Plot3D *p3, double percent); +extern void Plot3D_up(Plot3D *p3, double percent); +extern void Plot3D_center(Plot3D *p3, double cx, double cy); + +extern void Plot3D_plot(Plot3D *p3, double x, double y, double z, Pixel Color); + +extern void Plot3D_setview(Plot3D *p3, int vxmin, int vymin, int vxmax, int vymax); +extern void Plot3D_start(Plot3D *p3); +extern void Plot3D_line(Plot3D *p3, double x1, double y1, double z1, + double x2, double y2, double z2, Pixel color); +extern void Plot3D_triangle(Plot3D *p3, double x1, double y1, double z1, + double x2, double y2, double z2, + double x3, double y3, double z3, Pixel color); +extern void Plot3D_solidtriangle(Plot3D *p3, double x1, double y1, double z1, + double x2, double y2, double z2, + double x3, double y3, double z3, Pixel color); + +extern void Plot3D_interptriangle(Plot3D *p3, + double x1, double y1, double z1, Pixel c1, + double x2, double y2, double z2, Pixel c2, + double x3, double y3, double z3, Pixel c3); + +extern void Plot3D_quad(Plot3D *p3, double x1, double y1, double z1, + double x2, double y2, double z2, + double x3, double y3, double z3, + double x4, double y4, double z4, + Pixel color); + +extern void Plot3D_solidquad(Plot3D *p3, double x1, double y1, double z1, + double x2, double y2, double z2, + double x3, double y3, double z3, + double x4, double y4, double z4, + Pixel color); + +extern void Plot3D_interpquad(Plot3D *p3, double x1, double y1, double z1, Pixel c1, + double x2, double y2, double z2, Pixel c2, + double x3, double y3, double z3, Pixel c3, + double x4, double y4, double z4, Pixel c4); + + +extern void Plot3D_solidsphere(Plot3D *p3, double x, double y, double z, double radius,Pixel c); + +extern void Plot3D_outlinesphere(Plot3D *p3, double x, double y, double z, double radius,Pixel c, Pixel bc); + +extern PixMap PixMap_SQUARE; +extern PixMap PixMap_TRIANGLE; +extern PixMap PixMap_CROSS; + +#endif +#define GIFPLOT_H + + + diff --git a/LICENSE b/LICENSE index d7a422fda..fdb73d916 100644 --- a/LICENSE +++ b/LICENSE @@ -1,22 +1,95 @@ -SWIG is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. See the LICENSE-GPL file for -the full terms of the GNU General Public license version 3. +SWIG is distributed under the following terms: -Portions of SWIG are also licensed under the terms of the licenses -in the file LICENSE-UNIVERSITIES. You must observe the terms of -these licenses, as well as the terms of the GNU General Public License, -when you distribute SWIG. +I. -The SWIG library and examples, under the Lib and Examples top level -directories, are distributed under the following terms: +Copyright (c) 1995-1998 +The University of Utah and the Regents of the University of California +All Rights Reserved - You may copy, modify, distribute, and make derivative works based on - this software, in source code or object code form, without - restriction. If you distribute the software to others, you may do - so according to the terms of your choice. This software is offered as - is, without warranty of any kind. +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that +(1) The above copyright notice and the following two paragraphs +appear in all copies of the source code and (2) redistributions +including binaries reproduces these notices in the supporting +documentation. Substantial modifications to this software may be +copyrighted by their authors and need not follow the licensing terms +described here, provided that the new terms are clearly indicated in +all files where they apply. + +IN NO EVENT SHALL THE AUTHOR, THE UNIVERSITY OF CALIFORNIA, THE +UNIVERSITY OF UTAH OR DISTRIBUTORS OF THIS SOFTWARE BE LIABLE TO ANY +PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, +EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. + +THE AUTHOR, THE UNIVERSITY OF CALIFORNIA, AND THE UNIVERSITY OF UTAH +SPECIFICALLY DISCLAIM ANY WARRANTIES,INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND +THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, +SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + + +II. + +This software includes contributions that are Copyright (c) 1998-2005 +University of Chicago. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. Redistributions +in binary form must reproduce the above copyright notice, this list of +conditions and the following disclaimer in the documentation and/or +other materials provided with the distribution. Neither the name of +the University of Chicago nor the names of its contributors may be +used to endorse or promote products derived from this software without +specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF CHICAGO AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF +CHICAGO OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +III. + +This software includes contributions that are Copyright (c) 2005-2006 +Arizona Board of Regents (University of Arizona). +All Rights Reserved + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that +(1) The above copyright notice and the following two paragraphs +appear in all copies of the source code and (2) redistributions +including binaries reproduces these notices in the supporting +documentation. Substantial modifications to this software may be +copyrighted by their authors and need not follow the licensing terms +described here, provided that the new terms are clearly indicated in +all files where they apply. + +THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF ARIZONA AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF +ARIZONA OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -See the COPYRIGHT file for a list of contributors to SWIG and their -copyright notices. diff --git a/LICENSE-GPL b/LICENSE-GPL deleted file mode 100644 index 94a9ed024..000000000 --- a/LICENSE-GPL +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/LICENSE-UNIVERSITIES b/LICENSE-UNIVERSITIES deleted file mode 100644 index fdb73d916..000000000 --- a/LICENSE-UNIVERSITIES +++ /dev/null @@ -1,95 +0,0 @@ -SWIG is distributed under the following terms: - -I. - -Copyright (c) 1995-1998 -The University of Utah and the Regents of the University of California -All Rights Reserved - -Permission is hereby granted, without written agreement and without -license or royalty fees, to use, copy, modify, and distribute this -software and its documentation for any purpose, provided that -(1) The above copyright notice and the following two paragraphs -appear in all copies of the source code and (2) redistributions -including binaries reproduces these notices in the supporting -documentation. Substantial modifications to this software may be -copyrighted by their authors and need not follow the licensing terms -described here, provided that the new terms are clearly indicated in -all files where they apply. - -IN NO EVENT SHALL THE AUTHOR, THE UNIVERSITY OF CALIFORNIA, THE -UNIVERSITY OF UTAH OR DISTRIBUTORS OF THIS SOFTWARE BE LIABLE TO ANY -PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL -DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, -EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN ADVISED OF -THE POSSIBILITY OF SUCH DAMAGE. - -THE AUTHOR, THE UNIVERSITY OF CALIFORNIA, AND THE UNIVERSITY OF UTAH -SPECIFICALLY DISCLAIM ANY WARRANTIES,INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND -THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, -SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - - -II. - -This software includes contributions that are Copyright (c) 1998-2005 -University of Chicago. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -Redistributions of source code must retain the above copyright notice, -this list of conditions and the following disclaimer. Redistributions -in binary form must reproduce the above copyright notice, this list of -conditions and the following disclaimer in the documentation and/or -other materials provided with the distribution. Neither the name of -the University of Chicago nor the names of its contributors may be -used to endorse or promote products derived from this software without -specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF CHICAGO AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF -CHICAGO OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -III. - -This software includes contributions that are Copyright (c) 2005-2006 -Arizona Board of Regents (University of Arizona). -All Rights Reserved - -Permission is hereby granted, without written agreement and without -license or royalty fees, to use, copy, modify, and distribute this -software and its documentation for any purpose, provided that -(1) The above copyright notice and the following two paragraphs -appear in all copies of the source code and (2) redistributions -including binaries reproduces these notices in the supporting -documentation. Substantial modifications to this software may be -copyrighted by their authors and need not follow the licensing terms -described here, provided that the new terms are clearly indicated in -all files where they apply. - -THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF ARIZONA AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF -ARIZONA OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/Lib/allegrocl/allegrocl.swg b/Lib/allegrocl/allegrocl.swg index 266303113..4479f6ac2 100644 --- a/Lib/allegrocl/allegrocl.swg +++ b/Lib/allegrocl/allegrocl.swg @@ -289,6 +289,8 @@ $body)" #endif %insert("lisphead") %{ +;; $Id$ + (eval-when (:compile-toplevel :load-toplevel :execute) ;; avoid compiling ef-templates at runtime diff --git a/Lib/allegrocl/longlongs.i b/Lib/allegrocl/longlongs.i index 4aa54660b..b887a8a0a 100644 --- a/Lib/allegrocl/longlongs.i +++ b/Lib/allegrocl/longlongs.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * longlongs.i * * Typemap addition for support of 'long long' type and 'unsigned long long diff --git a/Lib/allegrocl/std_list.i b/Lib/allegrocl/std_list.i index 4e260897f..c8ab45649 100644 --- a/Lib/allegrocl/std_list.i +++ b/Lib/allegrocl/std_list.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_list.i * * SWIG typemaps for std::list types diff --git a/Lib/allegrocl/std_string.i b/Lib/allegrocl/std_string.i index becc322e9..4da0148fe 100644 --- a/Lib/allegrocl/std_string.i +++ b/Lib/allegrocl/std_string.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_string.i * * SWIG typemaps for std::string diff --git a/Lib/attribute.i b/Lib/attribute.i index 0cc3ff1a3..45c3c5b64 100644 --- a/Lib/attribute.i +++ b/Lib/attribute.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * attribute.i * * SWIG library file for implementing attributes. diff --git a/Lib/carrays.i b/Lib/carrays.i index 5fc78877c..738b4577a 100644 --- a/Lib/carrays.i +++ b/Lib/carrays.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * carrays.i * * SWIG library file containing macros that can be used to manipulate simple diff --git a/Lib/cdata.i b/Lib/cdata.i index 41e8f86ce..67601f737 100644 --- a/Lib/cdata.i +++ b/Lib/cdata.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * cdata.i * * SWIG library file containing macros for manipulating raw C data as strings. diff --git a/Lib/chicken/chicken.swg b/Lib/chicken/chicken.swg index 68f022570..a8d1b5a57 100644 --- a/Lib/chicken/chicken.swg +++ b/Lib/chicken/chicken.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * chicken.swg * * CHICKEN configuration module. diff --git a/Lib/chicken/chickenrun.swg b/Lib/chicken/chickenrun.swg index f4e94d6f6..8703ea65a 100644 --- a/Lib/chicken/chickenrun.swg +++ b/Lib/chicken/chickenrun.swg @@ -1,5 +1,9 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * chickenrun.swg + * * ----------------------------------------------------------------------------- */ #include diff --git a/Lib/chicken/multi-generic.scm b/Lib/chicken/multi-generic.scm index 9d2e31d34..ae822f37b 100644 --- a/Lib/chicken/multi-generic.scm +++ b/Lib/chicken/multi-generic.scm @@ -21,7 +21,7 @@ ;; which functions are used when. ;; Comments, bugs, suggestions: send either to chicken-users@nongnu.org or to -;; Most code copied from TinyCLOS +;; Author: John Lenz , most code copied from TinyCLOS (define (make 'name "multi-generic" diff --git a/Lib/chicken/std_string.i b/Lib/chicken/std_string.i index ce24cba32..2955d0e2f 100644 --- a/Lib/chicken/std_string.i +++ b/Lib/chicken/std_string.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_string.i * * SWIG typemaps for std::string diff --git a/Lib/chicken/typemaps.i b/Lib/chicken/typemaps.i index 56cd18a5d..d79e20184 100644 --- a/Lib/chicken/typemaps.i +++ b/Lib/chicken/typemaps.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * typemaps.i * * Pointer handling diff --git a/Lib/clisp/clisp.swg b/Lib/clisp/clisp.swg index e1d330cb3..fb6cdbf2a 100644 --- a/Lib/clisp/clisp.swg +++ b/Lib/clisp/clisp.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * clisp.swg * ----------------------------------------------------------------------------- */ diff --git a/Lib/cmalloc.i b/Lib/cmalloc.i index 9f58bc03c..03a61351c 100644 --- a/Lib/cmalloc.i +++ b/Lib/cmalloc.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * cmalloc.i * * SWIG library file containing macros that can be used to create objects using diff --git a/Lib/constraints.i b/Lib/constraints.i index 8bc7f9159..2deb1168a 100644 --- a/Lib/constraints.i +++ b/Lib/constraints.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * constraints.i * * SWIG constraints library. diff --git a/Lib/cpointer.i b/Lib/cpointer.i index 6b15a8417..1a6e51741 100644 --- a/Lib/cpointer.i +++ b/Lib/cpointer.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * cpointer.i * * SWIG library file containing macros that can be used to manipulate simple diff --git a/Lib/csharp/arrays_csharp.i b/Lib/csharp/arrays_csharp.i index 513330e4e..ea22da584 100644 --- a/Lib/csharp/arrays_csharp.i +++ b/Lib/csharp/arrays_csharp.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * arrays_csharp.i * * This file contains a two approaches to marshaling arrays. The first uses diff --git a/Lib/csharp/csharp.swg b/Lib/csharp/csharp.swg index 4ca55fa77..94f76a3ad 100644 --- a/Lib/csharp/csharp.swg +++ b/Lib/csharp/csharp.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * csharp.swg * * C# typemaps diff --git a/Lib/csharp/csharphead.swg b/Lib/csharp/csharphead.swg index eec4a2f2c..ffff70372 100644 --- a/Lib/csharp/csharphead.swg +++ b/Lib/csharp/csharphead.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * csharphead.swg * * Support code for exceptions if the SWIG_CSHARP_NO_EXCEPTION_HELPER is not defined diff --git a/Lib/csharp/director.swg b/Lib/csharp/director.swg index 7768d8c02..8957ecf42 100644 --- a/Lib/csharp/director.swg +++ b/Lib/csharp/director.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * director.swg * * This file contains support for director classes so that C# proxy diff --git a/Lib/csharp/enums.swg b/Lib/csharp/enums.swg index 6605da8c8..be2a6063b 100644 --- a/Lib/csharp/enums.swg +++ b/Lib/csharp/enums.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * enums.swg * * Include this file in order for C/C++ enums to be wrapped by proper C# enums. diff --git a/Lib/csharp/enumsimple.swg b/Lib/csharp/enumsimple.swg index 2b1cb182b..f50849892 100644 --- a/Lib/csharp/enumsimple.swg +++ b/Lib/csharp/enumsimple.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * enumsimple.swg * * This file provides backwards compatible enum wrapping. SWIG versions 1.3.21 diff --git a/Lib/csharp/enumtypesafe.swg b/Lib/csharp/enumtypesafe.swg index a6bf64b9a..8ba7838ef 100644 --- a/Lib/csharp/enumtypesafe.swg +++ b/Lib/csharp/enumtypesafe.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * enumtypesafe.swg * * Include this file in order for C/C++ enums to be wrapped by the so called diff --git a/Lib/csharp/std_except.i b/Lib/csharp/std_except.i index 27eb84bc2..c86e97a54 100644 --- a/Lib/csharp/std_except.i +++ b/Lib/csharp/std_except.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_except.i * * Typemaps used by the STL wrappers that throw exceptions. These typemaps are diff --git a/Lib/csharp/std_map.i b/Lib/csharp/std_map.i index b19414597..c35f21dc7 100644 --- a/Lib/csharp/std_map.i +++ b/Lib/csharp/std_map.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_map.i * * SWIG typemaps for std::map diff --git a/Lib/csharp/std_pair.i b/Lib/csharp/std_pair.i index 0712ad762..78142ffa6 100644 --- a/Lib/csharp/std_pair.i +++ b/Lib/csharp/std_pair.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_pair.i * * SWIG typemaps for std::pair diff --git a/Lib/csharp/std_string.i b/Lib/csharp/std_string.i index 0d804518b..d29692717 100644 --- a/Lib/csharp/std_string.i +++ b/Lib/csharp/std_string.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_string.i * * Typemaps for std::string and const std::string& diff --git a/Lib/csharp/std_vector.i b/Lib/csharp/std_vector.i index 448226860..f4ad88bae 100644 --- a/Lib/csharp/std_vector.i +++ b/Lib/csharp/std_vector.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_vector.i * * SWIG typemaps for std::vector diff --git a/Lib/csharp/std_wstring.i b/Lib/csharp/std_wstring.i index 9142d36a5..938070e4b 100644 --- a/Lib/csharp/std_wstring.i +++ b/Lib/csharp/std_wstring.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_wstring.i * * Typemaps for std::wstring and const std::wstring& diff --git a/Lib/csharp/stl.i b/Lib/csharp/stl.i index 9d2e91eee..66b72e073 100644 --- a/Lib/csharp/stl.i +++ b/Lib/csharp/stl.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * stl.i * * Initial STL definition. extended as needed in each language diff --git a/Lib/csharp/typemaps.i b/Lib/csharp/typemaps.i index ac8398021..ddfbd1b0c 100644 --- a/Lib/csharp/typemaps.i +++ b/Lib/csharp/typemaps.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * typemaps.i * * Pointer and reference handling typemap library diff --git a/Lib/csharp/wchar.i b/Lib/csharp/wchar.i index f02c09a53..be87560c3 100644 --- a/Lib/csharp/wchar.i +++ b/Lib/csharp/wchar.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * wchar.i * * Typemaps for the wchar_t type diff --git a/Lib/cstring.i b/Lib/cstring.i index 6829f7597..4ebdf6857 100644 --- a/Lib/cstring.i +++ b/Lib/cstring.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * cstring.i * ----------------------------------------------------------------------------- */ diff --git a/Lib/cwstring.i b/Lib/cwstring.i index f0631d328..a6b08ae40 100644 --- a/Lib/cwstring.i +++ b/Lib/cwstring.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * cwstring.i * ----------------------------------------------------------------------------- */ diff --git a/Lib/exception.i b/Lib/exception.i index e9ba189a1..18b08994f 100644 --- a/Lib/exception.i +++ b/Lib/exception.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * exception.i * * SWIG library file providing language independent exception handling diff --git a/Lib/gcj/cni.swg b/Lib/gcj/cni.swg index 4bd07df06..247909a4a 100644 --- a/Lib/gcj/cni.swg +++ b/Lib/gcj/cni.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * cni.swg * ----------------------------------------------------------------------------- */ diff --git a/Lib/guile/common.scm b/Lib/guile/common.scm index 17c9ab580..a51d3a71d 100644 --- a/Lib/guile/common.scm +++ b/Lib/guile/common.scm @@ -3,6 +3,12 @@ ;;;* ;;;* This file contains generic SWIG GOOPS classes for generated ;;;* GOOPS file support +;;;* +;;;* Copyright (C) 2003 John Lenz (jelenz@wisc.edu) +;;;* Copyright (C) 2004 Matthias Koeppe (mkoeppe@mail.math.uni-magdeburg.de) +;;;* +;;;* This file may be freely redistributed without license or fee provided +;;;* this copyright message remains intact. ;;;************************************************************************ (define-module (Swig swigrun)) diff --git a/Lib/guile/cplusplus.i b/Lib/guile/cplusplus.i index 0dfe71754..cb4cf7434 100644 --- a/Lib/guile/cplusplus.i +++ b/Lib/guile/cplusplus.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * cplusplus.i * * SWIG typemaps for C++ diff --git a/Lib/guile/guile.i b/Lib/guile/guile.i index ef270d74b..1bf28d6f3 100644 --- a/Lib/guile/guile.i +++ b/Lib/guile/guile.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * guile.i * * SWIG Configuration File for Guile. diff --git a/Lib/guile/guile_gh.swg b/Lib/guile/guile_gh.swg index 3b65af897..6412a4c61 100644 --- a/Lib/guile/guile_gh.swg +++ b/Lib/guile/guile_gh.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * guile_gh.swg * * This SWIG interface file is processed if the Guile module is run diff --git a/Lib/guile/guile_gh_run.swg b/Lib/guile/guile_gh_run.swg index 0eba1f97e..5b1fca0aa 100644 --- a/Lib/guile/guile_gh_run.swg +++ b/Lib/guile/guile_gh_run.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * guile_gh_run.swg * * Guile GH runtime file diff --git a/Lib/guile/guile_scm.swg b/Lib/guile/guile_scm.swg index d12401451..caded728d 100644 --- a/Lib/guile/guile_scm.swg +++ b/Lib/guile/guile_scm.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * guile_scm.swg * * This SWIG interface file is processed if the Guile module is run diff --git a/Lib/guile/guile_scm_run.swg b/Lib/guile/guile_scm_run.swg index 91b74095d..5da8558fc 100644 --- a/Lib/guile/guile_scm_run.swg +++ b/Lib/guile/guile_scm_run.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * guile_scm_run.swg * ----------------------------------------------------------------------------- */ diff --git a/Lib/guile/guilemain.i b/Lib/guile/guilemain.i index 925b81fee..6f4e4d94d 100644 --- a/Lib/guile/guilemain.i +++ b/Lib/guile/guilemain.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * guilemain.i * * The main functions for a user augmented guile diff --git a/Lib/guile/interpreter.i b/Lib/guile/interpreter.i index 524e0694a..7e8f0777a 100644 --- a/Lib/guile/interpreter.i +++ b/Lib/guile/interpreter.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * interpreter.i * * SWIG file for a simple Guile interpreter diff --git a/Lib/guile/list-vector.i b/Lib/guile/list-vector.i index c2cd1aea2..d98cae59a 100644 --- a/Lib/guile/list-vector.i +++ b/Lib/guile/list-vector.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * list_vector.i * * Guile typemaps for converting between arrays and Scheme lists or vectors diff --git a/Lib/guile/pointer-in-out.i b/Lib/guile/pointer-in-out.i index d8a631ca9..bc6438759 100644 --- a/Lib/guile/pointer-in-out.i +++ b/Lib/guile/pointer-in-out.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * pointer-in-out.i * * Guile typemaps for passing pointers indirectly diff --git a/Lib/guile/ports.i b/Lib/guile/ports.i index 5940b4d3b..0d0e142e1 100644 --- a/Lib/guile/ports.i +++ b/Lib/guile/ports.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * ports.i * * Guile typemaps for handling ports diff --git a/Lib/guile/std_common.i b/Lib/guile/std_common.i index a46c42c69..ace5d65a8 100644 --- a/Lib/guile/std_common.i +++ b/Lib/guile/std_common.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_common.i * * SWIG typemaps for STL - common utilities diff --git a/Lib/guile/std_map.i b/Lib/guile/std_map.i index 19c863096..cc53e1560 100644 --- a/Lib/guile/std_map.i +++ b/Lib/guile/std_map.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_map.i * * SWIG typemaps for std::map diff --git a/Lib/guile/std_pair.i b/Lib/guile/std_pair.i index 35f0cfad5..f8c2ea688 100644 --- a/Lib/guile/std_pair.i +++ b/Lib/guile/std_pair.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_pair.i * * SWIG typemaps for std::pair diff --git a/Lib/guile/std_string.i b/Lib/guile/std_string.i index c10806e98..f80a65ca5 100644 --- a/Lib/guile/std_string.i +++ b/Lib/guile/std_string.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_string.i * * SWIG typemaps for std::string diff --git a/Lib/guile/std_vector.i b/Lib/guile/std_vector.i index 6801daee8..145db945b 100644 --- a/Lib/guile/std_vector.i +++ b/Lib/guile/std_vector.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_vector.i * * SWIG typemaps for std::vector diff --git a/Lib/guile/stl.i b/Lib/guile/stl.i index 9d2e91eee..66b72e073 100644 --- a/Lib/guile/stl.i +++ b/Lib/guile/stl.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * stl.i * * Initial STL definition. extended as needed in each language diff --git a/Lib/guile/typemaps.i b/Lib/guile/typemaps.i index 4f306f7f8..d9f972850 100644 --- a/Lib/guile/typemaps.i +++ b/Lib/guile/typemaps.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * typemaps.i * * Guile-specific typemaps diff --git a/Lib/inttypes.i b/Lib/inttypes.i index 8450cb840..0cc81948e 100644 --- a/Lib/inttypes.i +++ b/Lib/inttypes.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * inttypes.i * * SWIG library file for ISO C99 types: 7.8 Format conversion of integer types diff --git a/Lib/java/arrays_java.i b/Lib/java/arrays_java.i index ddaf7408c..95510c3f9 100644 --- a/Lib/java/arrays_java.i +++ b/Lib/java/arrays_java.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * arrays_java.i * * These typemaps give more natural support for arrays. The typemaps are not efficient diff --git a/Lib/java/director.swg b/Lib/java/director.swg index 07e5a1af1..fa588671d 100644 --- a/Lib/java/director.swg +++ b/Lib/java/director.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * director.swg * * This file contains support for director classes that proxy diff --git a/Lib/java/enums.swg b/Lib/java/enums.swg index edb67c417..1a8f89b3a 100644 --- a/Lib/java/enums.swg +++ b/Lib/java/enums.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * enums.swg * * Include this file in order for C/C++ enums to be wrapped by proper Java enums. diff --git a/Lib/java/enumsimple.swg b/Lib/java/enumsimple.swg index e08401869..f45774d0c 100644 --- a/Lib/java/enumsimple.swg +++ b/Lib/java/enumsimple.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * enumsimple.swg * * This file provides backwards compatible enum wrapping. SWIG versions 1.3.21 diff --git a/Lib/java/enumtypesafe.swg b/Lib/java/enumtypesafe.swg index d6c6e5190..a49a9d134 100644 --- a/Lib/java/enumtypesafe.swg +++ b/Lib/java/enumtypesafe.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * enumtypesafe.swg * * Include this file in order for C/C++ enums to be wrapped by the so called diff --git a/Lib/java/enumtypeunsafe.swg b/Lib/java/enumtypeunsafe.swg index d9a7c4d29..bda055113 100644 --- a/Lib/java/enumtypeunsafe.swg +++ b/Lib/java/enumtypeunsafe.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * enumtypeunsafe.swg * * Include this file in order for C/C++ enums to be wrapped by integers values. diff --git a/Lib/java/java.swg b/Lib/java/java.swg index 6173502ca..bd2357a86 100644 --- a/Lib/java/java.swg +++ b/Lib/java/java.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * java.swg * * Java typemaps diff --git a/Lib/java/javahead.swg b/Lib/java/javahead.swg index d2ea560b6..fc4c4e267 100644 --- a/Lib/java/javahead.swg +++ b/Lib/java/javahead.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * javahead.swg * * Java support code diff --git a/Lib/java/std_except.i b/Lib/java/std_except.i index 9e23d50e6..15be1deb8 100644 --- a/Lib/java/std_except.i +++ b/Lib/java/std_except.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_except.i * * Typemaps used by the STL wrappers that throw exceptions. diff --git a/Lib/java/std_map.i b/Lib/java/std_map.i index a7020532c..00967d3f9 100644 --- a/Lib/java/std_map.i +++ b/Lib/java/std_map.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_map.i * * SWIG typemaps for std::map diff --git a/Lib/java/std_pair.i b/Lib/java/std_pair.i index fe45ee676..dc0604dc5 100644 --- a/Lib/java/std_pair.i +++ b/Lib/java/std_pair.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_pair.i * * SWIG typemaps for std::pair diff --git a/Lib/java/std_string.i b/Lib/java/std_string.i index f0d837696..789e17a65 100644 --- a/Lib/java/std_string.i +++ b/Lib/java/std_string.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_string.i * * Typemaps for std::string and const std::string& diff --git a/Lib/java/std_vector.i b/Lib/java/std_vector.i index 3f29b19c7..29439606b 100644 --- a/Lib/java/std_vector.i +++ b/Lib/java/std_vector.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_vector.i * ----------------------------------------------------------------------------- */ diff --git a/Lib/java/std_wstring.i b/Lib/java/std_wstring.i index 12d8fc14f..989176500 100644 --- a/Lib/java/std_wstring.i +++ b/Lib/java/std_wstring.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_wstring.i * * Typemaps for std::wstring and const std::wstring& diff --git a/Lib/java/stl.i b/Lib/java/stl.i index 04f86014f..b8d7a654c 100644 --- a/Lib/java/stl.i +++ b/Lib/java/stl.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * stl.i * ----------------------------------------------------------------------------- */ diff --git a/Lib/java/typemaps.i b/Lib/java/typemaps.i index 74ed99374..59f7af99a 100644 --- a/Lib/java/typemaps.i +++ b/Lib/java/typemaps.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * typemaps.i * * Pointer and reference handling typemap library diff --git a/Lib/java/various.i b/Lib/java/various.i index 7c396de3e..733b8fa79 100644 --- a/Lib/java/various.i +++ b/Lib/java/various.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * various.i * * SWIG Typemap library for Java. diff --git a/Lib/lua/_std_common.i b/Lib/lua/_std_common.i index e552d0c8f..33cc513c3 100644 --- a/Lib/lua/_std_common.i +++ b/Lib/lua/_std_common.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * _std_common.i * * std::helpers for LUA diff --git a/Lib/lua/lua.swg b/Lib/lua/lua.swg index c3f5cecc5..b6d888670 100644 --- a/Lib/lua/lua.swg +++ b/Lib/lua/lua.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * lua.swg * * SWIG Configuration File for Lua. diff --git a/Lib/lua/lua_fnptr.i b/Lib/lua/lua_fnptr.i index 7e9facdf3..c7df6f5a3 100644 --- a/Lib/lua/lua_fnptr.i +++ b/Lib/lua/lua_fnptr.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * lua_fnptr.i * * SWIG Library file containing the main typemap code to support Lua modules. diff --git a/Lib/lua/luarun.swg b/Lib/lua/luarun.swg index 4c9aa5144..32e1b1617 100644 --- a/Lib/lua/luarun.swg +++ b/Lib/lua/luarun.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * luarun.swg * * This file contains the runtime support for Lua modules diff --git a/Lib/lua/luaruntime.swg b/Lib/lua/luaruntime.swg index 5823d4fcf..b82cd56d7 100644 --- a/Lib/lua/luaruntime.swg +++ b/Lib/lua/luaruntime.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * luaruntime.swg * * all the runtime code for . diff --git a/Lib/lua/luatypemaps.swg b/Lib/lua/luatypemaps.swg index 401541267..caa2a6ce1 100644 --- a/Lib/lua/luatypemaps.swg +++ b/Lib/lua/luatypemaps.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * luatypemaps.swg * * basic typemaps for Lua. diff --git a/Lib/lua/std_except.i b/Lib/lua/std_except.i index 9c736b9ef..ce148ef63 100644 --- a/Lib/lua/std_except.i +++ b/Lib/lua/std_except.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * Typemaps used by the STL wrappers that throw exceptions. * These typemaps are used when methods are declared with an STL exception * specification, such as: diff --git a/Lib/lua/std_map.i b/Lib/lua/std_map.i index 84b0c74ff..dd22443d5 100644 --- a/Lib/lua/std_map.i +++ b/Lib/lua/std_map.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_map.i * * SWIG typemaps for std::map diff --git a/Lib/lua/std_pair.i b/Lib/lua/std_pair.i index c76361554..1b20f74e0 100644 --- a/Lib/lua/std_pair.i +++ b/Lib/lua/std_pair.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_pair.i * * std::pair typemaps for LUA diff --git a/Lib/lua/std_string.i b/Lib/lua/std_string.i index 92f27d738..fa58f10bb 100644 --- a/Lib/lua/std_string.i +++ b/Lib/lua/std_string.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_string.i * * std::string typemaps for LUA diff --git a/Lib/lua/std_vector.i b/Lib/lua/std_vector.i index f248f0340..c6778087f 100644 --- a/Lib/lua/std_vector.i +++ b/Lib/lua/std_vector.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_vector.i * * std::vector typemaps for LUA diff --git a/Lib/lua/stl.i b/Lib/lua/stl.i index 04f86014f..b8d7a654c 100644 --- a/Lib/lua/stl.i +++ b/Lib/lua/stl.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * stl.i * ----------------------------------------------------------------------------- */ diff --git a/Lib/lua/typemaps.i b/Lib/lua/typemaps.i index 084726e58..fa0c0d0e5 100644 --- a/Lib/lua/typemaps.i +++ b/Lib/lua/typemaps.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * typemaps.swg * * SWIG Library file containing the main typemap code to support Lua modules. diff --git a/Lib/lua/wchar.i b/Lib/lua/wchar.i index 5021c1604..5b206eb71 100644 --- a/Lib/lua/wchar.i +++ b/Lib/lua/wchar.i @@ -1,8 +1,12 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * wchar.i * * Typemaps for the wchar_t type * These are mapped to a Lua string and are passed around by value. + * * ----------------------------------------------------------------------------- */ // note: only support for pointer right now, not fixed length strings @@ -39,4 +43,4 @@ if ($1==0) {lua_pushfstring(L,"Error in converting to wchar (arg %d)",$input);go free($1); %} -%typemap(typecheck) wchar_t * = char *; +%typemap(typecheck) wchar_t * = char *; \ No newline at end of file diff --git a/Lib/math.i b/Lib/math.i index a37c92d19..be931d71b 100644 --- a/Lib/math.i +++ b/Lib/math.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * math.i * * SWIG library file for floating point operations. diff --git a/Lib/modula3/modula3.swg b/Lib/modula3/modula3.swg index 599a12e5a..6a1b4d94d 100644 --- a/Lib/modula3/modula3.swg +++ b/Lib/modula3/modula3.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * modula3.swg * * Modula3 typemaps diff --git a/Lib/modula3/modula3head.swg b/Lib/modula3/modula3head.swg index af96a78d1..b2426be5f 100644 --- a/Lib/modula3/modula3head.swg +++ b/Lib/modula3/modula3head.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * modula3head.swg * * Modula3 support code diff --git a/Lib/modula3/typemaps.i b/Lib/modula3/typemaps.i index 1d76ab5e0..79ddfda0f 100644 --- a/Lib/modula3/typemaps.i +++ b/Lib/modula3/typemaps.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * typemaps.i * * Pointer and reference handling typemap library diff --git a/Lib/mzscheme/mzrun.swg b/Lib/mzscheme/mzrun.swg index a5128da56..3b05d2406 100644 --- a/Lib/mzscheme/mzrun.swg +++ b/Lib/mzscheme/mzrun.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * mzrun.swg * ----------------------------------------------------------------------------- */ diff --git a/Lib/mzscheme/mzscheme.swg b/Lib/mzscheme/mzscheme.swg index 9ae242845..ed4b2ec9d 100644 --- a/Lib/mzscheme/mzscheme.swg +++ b/Lib/mzscheme/mzscheme.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * mzscheme.swg * * SWIG Configuration File for MzScheme. diff --git a/Lib/mzscheme/std_common.i b/Lib/mzscheme/std_common.i index 1f1ae1ab7..8732f811c 100644 --- a/Lib/mzscheme/std_common.i +++ b/Lib/mzscheme/std_common.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_common.i * * SWIG typemaps for STL - common utilities diff --git a/Lib/mzscheme/std_map.i b/Lib/mzscheme/std_map.i index b2c894509..aff720db6 100644 --- a/Lib/mzscheme/std_map.i +++ b/Lib/mzscheme/std_map.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_map.i * * SWIG typemaps for std::map diff --git a/Lib/mzscheme/std_pair.i b/Lib/mzscheme/std_pair.i index d5a65470d..2ac331e71 100644 --- a/Lib/mzscheme/std_pair.i +++ b/Lib/mzscheme/std_pair.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_pair.i * * SWIG typemaps for std::pair diff --git a/Lib/mzscheme/std_string.i b/Lib/mzscheme/std_string.i index b8b99d9ad..c9a82efe4 100644 --- a/Lib/mzscheme/std_string.i +++ b/Lib/mzscheme/std_string.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_string.i * * SWIG typemaps for std::string types diff --git a/Lib/mzscheme/std_vector.i b/Lib/mzscheme/std_vector.i index 22e1fa96b..90a52fc0a 100644 --- a/Lib/mzscheme/std_vector.i +++ b/Lib/mzscheme/std_vector.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_vector.i * * SWIG typemaps for std::vector diff --git a/Lib/mzscheme/stl.i b/Lib/mzscheme/stl.i index b19eae58b..946e4b7f0 100644 --- a/Lib/mzscheme/stl.i +++ b/Lib/mzscheme/stl.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * stl.i * * Initial STL definition. extended as needed in each language diff --git a/Lib/mzscheme/typemaps.i b/Lib/mzscheme/typemaps.i index b9f22440c..334893242 100644 --- a/Lib/mzscheme/typemaps.i +++ b/Lib/mzscheme/typemaps.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * typemaps.i * ----------------------------------------------------------------------------- */ diff --git a/Lib/ocaml/cstring.i b/Lib/ocaml/cstring.i index 0d6aa4b69..e56258264 100644 --- a/Lib/ocaml/cstring.i +++ b/Lib/ocaml/cstring.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * cstring.i * * This file provides typemaps and macros for dealing with various forms diff --git a/Lib/ocaml/director.swg b/Lib/ocaml/director.swg index a21f62102..87333168f 100644 --- a/Lib/ocaml/director.swg +++ b/Lib/ocaml/director.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * director.swg * * This file contains support for director classes that proxy diff --git a/Lib/ocaml/ocaml.i b/Lib/ocaml/ocaml.i index e099f7c10..a46e239d1 100644 --- a/Lib/ocaml/ocaml.i +++ b/Lib/ocaml/ocaml.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * ocaml.i * * SWIG Configuration File for Ocaml diff --git a/Lib/ocaml/ocamldec.swg b/Lib/ocaml/ocamldec.swg index 8e452d3f9..3b5290fa1 100644 --- a/Lib/ocaml/ocamldec.swg +++ b/Lib/ocaml/ocamldec.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * ocamldec.swg * * Ocaml runtime code -- declarations diff --git a/Lib/ocaml/std_common.i b/Lib/ocaml/std_common.i index 1c397050c..b2dff61d2 100644 --- a/Lib/ocaml/std_common.i +++ b/Lib/ocaml/std_common.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_common.i * * SWIG typemaps for STL - common utilities diff --git a/Lib/ocaml/std_deque.i b/Lib/ocaml/std_deque.i index 5b38962bf..baadb4e53 100644 --- a/Lib/ocaml/std_deque.i +++ b/Lib/ocaml/std_deque.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_deque.i * * Default std_deque wrapper diff --git a/Lib/ocaml/std_list.i b/Lib/ocaml/std_list.i index 06181cca8..0aea90767 100644 --- a/Lib/ocaml/std_list.i +++ b/Lib/ocaml/std_list.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_list.i * * SWIG typemaps for std::list types diff --git a/Lib/ocaml/std_map.i b/Lib/ocaml/std_map.i index f202e74ed..f174f2872 100644 --- a/Lib/ocaml/std_map.i +++ b/Lib/ocaml/std_map.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_map.i * * SWIG typemaps for std::map diff --git a/Lib/ocaml/std_pair.i b/Lib/ocaml/std_pair.i index fe45ee676..dc0604dc5 100644 --- a/Lib/ocaml/std_pair.i +++ b/Lib/ocaml/std_pair.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_pair.i * * SWIG typemaps for std::pair diff --git a/Lib/ocaml/std_string.i b/Lib/ocaml/std_string.i index e75e95304..7add3a070 100644 --- a/Lib/ocaml/std_string.i +++ b/Lib/ocaml/std_string.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_string.i * * SWIG typemaps for std::string diff --git a/Lib/ocaml/std_vector.i b/Lib/ocaml/std_vector.i index 53d107447..91c335562 100644 --- a/Lib/ocaml/std_vector.i +++ b/Lib/ocaml/std_vector.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_vector.i * * SWIG typemaps for std::vector types diff --git a/Lib/ocaml/stl.i b/Lib/ocaml/stl.i index 9d2e91eee..66b72e073 100644 --- a/Lib/ocaml/stl.i +++ b/Lib/ocaml/stl.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * stl.i * * Initial STL definition. extended as needed in each language diff --git a/Lib/ocaml/typecheck.i b/Lib/ocaml/typecheck.i index 4c3500690..51e66061b 100644 --- a/Lib/ocaml/typecheck.i +++ b/Lib/ocaml/typecheck.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * typecheck.i * * Typechecking rules diff --git a/Lib/ocaml/typemaps.i b/Lib/ocaml/typemaps.i index 39544de94..7f978bf7f 100644 --- a/Lib/ocaml/typemaps.i +++ b/Lib/ocaml/typemaps.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * typemaps.i * * The Ocaml module handles all types uniformly via typemaps. Here diff --git a/Lib/octave/octcontainer.swg b/Lib/octave/octcontainer.swg index 6613fcfff..afc3ed147 100644 --- a/Lib/octave/octcontainer.swg +++ b/Lib/octave/octcontainer.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * octcontainer.swg * * Octave cell <-> C++ container wrapper diff --git a/Lib/octave/octiterators.swg b/Lib/octave/octiterators.swg index 0e3fe7033..926361e10 100644 --- a/Lib/octave/octiterators.swg +++ b/Lib/octave/octiterators.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * octiterators.swg * * Users can derive form the OctSwigIterator to implemet their diff --git a/Lib/perl5/perlmain.i b/Lib/perl5/perlmain.i index 18ecb7eb5..f224b9c75 100644 --- a/Lib/perl5/perlmain.i +++ b/Lib/perl5/perlmain.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * perlmain.i * * Code to statically rebuild perl5. diff --git a/Lib/perl5/reference.i b/Lib/perl5/reference.i index 06712bbd5..d3d745cfc 100644 --- a/Lib/perl5/reference.i +++ b/Lib/perl5/reference.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * reference.i * * Accept Perl references as pointers diff --git a/Lib/perl5/std_common.i b/Lib/perl5/std_common.i index c36513912..bc25b353f 100644 --- a/Lib/perl5/std_common.i +++ b/Lib/perl5/std_common.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_common.i * * SWIG typemaps for STL - common utilities diff --git a/Lib/perl5/std_list.i b/Lib/perl5/std_list.i index c6bca18f6..633e40d9a 100644 --- a/Lib/perl5/std_list.i +++ b/Lib/perl5/std_list.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_list.i * * SWIG typemaps for std::list types diff --git a/Lib/perl5/std_map.i b/Lib/perl5/std_map.i index b19414597..c35f21dc7 100644 --- a/Lib/perl5/std_map.i +++ b/Lib/perl5/std_map.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_map.i * * SWIG typemaps for std::map diff --git a/Lib/perl5/std_pair.i b/Lib/perl5/std_pair.i index 0712ad762..78142ffa6 100644 --- a/Lib/perl5/std_pair.i +++ b/Lib/perl5/std_pair.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_pair.i * * SWIG typemaps for std::pair diff --git a/Lib/perl5/std_vector.i b/Lib/perl5/std_vector.i index 0a61c31e0..7c4f72919 100644 --- a/Lib/perl5/std_vector.i +++ b/Lib/perl5/std_vector.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_vector.i * * SWIG typemaps for std::vector types diff --git a/Lib/perl5/stl.i b/Lib/perl5/stl.i index b19eae58b..946e4b7f0 100644 --- a/Lib/perl5/stl.i +++ b/Lib/perl5/stl.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * stl.i * * Initial STL definition. extended as needed in each language diff --git a/Lib/perl5/typemaps.i b/Lib/perl5/typemaps.i index 7d96f2ace..fc6d8f874 100644 --- a/Lib/perl5/typemaps.i +++ b/Lib/perl5/typemaps.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * typemaps.i * * The SWIG typemap library provides a language independent mechanism for diff --git a/Lib/php/const.i b/Lib/php/const.i index 08096c98b..6ddd403d0 100644 --- a/Lib/php/const.i +++ b/Lib/php/const.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * const.i * * Typemaps for constants diff --git a/Lib/php/globalvar.i b/Lib/php/globalvar.i index 34bd5f994..df8cfade7 100644 --- a/Lib/php/globalvar.i +++ b/Lib/php/globalvar.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * globalvar.i * * Global variables - add the variable to PHP diff --git a/Lib/php/php.swg b/Lib/php/php.swg index 99181472d..087525be4 100644 --- a/Lib/php/php.swg +++ b/Lib/php/php.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * php.swg * * PHP configuration file diff --git a/Lib/php/phpkw.swg b/Lib/php/phpkw.swg index e7d4f2fda..3d1a62511 100644 --- a/Lib/php/phpkw.swg +++ b/Lib/php/phpkw.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * phpkw.swg * * The 'keywords' in PHP are global, ie, the following names are fine diff --git a/Lib/php/phprun.swg b/Lib/php/phprun.swg index 22f23f729..5196b95b4 100644 --- a/Lib/php/phprun.swg +++ b/Lib/php/phprun.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * phprun.swg * * PHP runtime library diff --git a/Lib/php/std_common.i b/Lib/php/std_common.i index 092bf012b..a779649dd 100644 --- a/Lib/php/std_common.i +++ b/Lib/php/std_common.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_common.i * * SWIG typemaps for STL - common utilities diff --git a/Lib/php/std_map.i b/Lib/php/std_map.i index ede5fbe30..c6721806b 100644 --- a/Lib/php/std_map.i +++ b/Lib/php/std_map.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_map.i * * SWIG typemaps for std::map diff --git a/Lib/php/std_pair.i b/Lib/php/std_pair.i index fe45ee676..dc0604dc5 100644 --- a/Lib/php/std_pair.i +++ b/Lib/php/std_pair.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_pair.i * * SWIG typemaps for std::pair diff --git a/Lib/php/std_string.i b/Lib/php/std_string.i index 22c953bf5..08a7cdac9 100644 --- a/Lib/php/std_string.i +++ b/Lib/php/std_string.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_string.i * * SWIG typemaps for std::string types diff --git a/Lib/php/std_vector.i b/Lib/php/std_vector.i index 4cfc94f74..b54181618 100644 --- a/Lib/php/std_vector.i +++ b/Lib/php/std_vector.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_vector.i * * SWIG typemaps for std::vector types diff --git a/Lib/php/stl.i b/Lib/php/stl.i index 9d2e91eee..66b72e073 100644 --- a/Lib/php/stl.i +++ b/Lib/php/stl.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * stl.i * * Initial STL definition. extended as needed in each language diff --git a/Lib/php/typemaps.i b/Lib/php/typemaps.i index 7bb8c9fa3..7af301d0d 100644 --- a/Lib/php/typemaps.i +++ b/Lib/php/typemaps.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * typemaps.i. * * SWIG Typemap library for PHP. diff --git a/Lib/pike/pike.swg b/Lib/pike/pike.swg index 2ba27671e..e72da8fba 100644 --- a/Lib/pike/pike.swg +++ b/Lib/pike/pike.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * pike.swg * * Pike configuration module. diff --git a/Lib/pike/pikerun.swg b/Lib/pike/pikerun.swg index 451a4e092..875fcf4e2 100644 --- a/Lib/pike/pikerun.swg +++ b/Lib/pike/pikerun.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * pikerun.swg * * This file contains the runtime support for Pike modules diff --git a/Lib/pike/std_string.i b/Lib/pike/std_string.i index 0694035bf..ca1fad822 100644 --- a/Lib/pike/std_string.i +++ b/Lib/pike/std_string.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_string.i * * SWIG typemaps for std::string diff --git a/Lib/pointer.i b/Lib/pointer.i index 8015317d7..16e11b7d1 100644 --- a/Lib/pointer.i +++ b/Lib/pointer.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * pointer.i * ----------------------------------------------------------------------------- */ diff --git a/Lib/python/ccomplex.i b/Lib/python/ccomplex.i index 28872b985..30f797d74 100644 --- a/Lib/python/ccomplex.i +++ b/Lib/python/ccomplex.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * ccomplex.i * * C complex typemaps diff --git a/Lib/python/director.swg b/Lib/python/director.swg index 090da0205..836d107ce 100644 --- a/Lib/python/director.swg +++ b/Lib/python/director.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * director.swg * * This file contains support for director classes that proxy diff --git a/Lib/python/embed15.i b/Lib/python/embed15.i index 4abfbba75..f677d166e 100644 --- a/Lib/python/embed15.i +++ b/Lib/python/embed15.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * embed15.i * * SWIG file embedding the Python interpreter in something else. diff --git a/Lib/python/file.i b/Lib/python/file.i index 359c34d2c..294ab9178 100644 --- a/Lib/python/file.i +++ b/Lib/python/file.i @@ -1,7 +1,11 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * file.i * * Typemaps for FILE* + * From the ideas of Luigi Ballabio * ----------------------------------------------------------------------------- */ %types(FILE *); diff --git a/Lib/python/pycontainer.swg b/Lib/python/pycontainer.swg index 39a91522e..6fd1d56f9 100644 --- a/Lib/python/pycontainer.swg +++ b/Lib/python/pycontainer.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * pycontainer.swg * * Python sequence <-> C++ container wrapper diff --git a/Lib/python/pyiterators.swg b/Lib/python/pyiterators.swg index 3ff822d35..9cd795d7c 100644 --- a/Lib/python/pyiterators.swg +++ b/Lib/python/pyiterators.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * pyiterators.swg * * Implement a python 'output' iterator for Python 2.2 or higher. diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg index cab7dd468..5a1b1230e 100644 --- a/Lib/python/pyrun.swg +++ b/Lib/python/pyrun.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * pyrun.swg * * This file contains the runtime support for Python modules diff --git a/Lib/python/typemaps.i b/Lib/python/typemaps.i index 5d438ecab..1c87de61d 100644 --- a/Lib/python/typemaps.i +++ b/Lib/python/typemaps.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * typemaps.i * * Pointer handling diff --git a/Lib/ruby/director.swg b/Lib/ruby/director.swg index 60c086f5b..9a6371ad9 100644 --- a/Lib/ruby/director.swg +++ b/Lib/ruby/director.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * director.swg * * This file contains support for director classes that proxy diff --git a/Lib/ruby/rubyautodoc.swg b/Lib/ruby/rubyautodoc.swg index 1e6b0d9dc..ade4bde1d 100644 --- a/Lib/ruby/rubyautodoc.swg +++ b/Lib/ruby/rubyautodoc.swg @@ -1,8 +1,13 @@ -/* ----------------------------------------------------------------------------- - * rubyautodoc.swg - * - * This file implements autodoc typemaps for some common ruby methods. - * ----------------------------------------------------------------------------- */ +/** + * @file rubyautodoc.swg + * @author gga + * @date Wed May 2 16:41:59 2007 + * + * @brief This file implements autodoc typemaps for some common + * ruby methods. + * + * + */ %define AUTODOC(func, str) %feature("autodoc", str) func; diff --git a/Lib/ruby/rubycontainer.swg b/Lib/ruby/rubycontainer.swg index c93094aeb..919695ec2 100644 --- a/Lib/ruby/rubycontainer.swg +++ b/Lib/ruby/rubycontainer.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * rubycontainer.swg * * Ruby sequence <-> C++ container wrapper diff --git a/Lib/ruby/rubycontainer_extended.swg b/Lib/ruby/rubycontainer_extended.swg index 09be64aee..360e399ce 100644 --- a/Lib/ruby/rubycontainer_extended.swg +++ b/Lib/ruby/rubycontainer_extended.swg @@ -1,13 +1,17 @@ -/* ----------------------------------------------------------------------------- - * rubycontainer_extended.swg - * - * This file contains additional functions that make containers - * behave closer to ruby primitive types. - * However, some of these functions place some restrictions on - * the underlying object inside of the container and the iterator - * (that it has to have an == comparison function, that it has to have - * an = assignment operator, etc). - * ----------------------------------------------------------------------------- */ +/** + * @file rubycontainer_extended.swg + * @author gga + * @date Sat May 5 05:36:01 2007 + * + * @brief This file contains additional functions that make containers + * behave closer to ruby primitive types. + * However, some of these functions place some restrictions on + * the underlying object inside of the container and the iterator + * (that it has to have an == comparison function, that it has to have + * an = assignment operator, etc). + * + */ + /** * Macro used to add extend functions that require operator== in object. diff --git a/Lib/ruby/rubyiterators.swg b/Lib/ruby/rubyiterators.swg index aba156a2b..466ae221b 100644 --- a/Lib/ruby/rubyiterators.swg +++ b/Lib/ruby/rubyiterators.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * rubyiterators.swg * * Implement a C++ 'output' iterator for Ruby. diff --git a/Lib/ruby/rubyprimtypes.swg b/Lib/ruby/rubyprimtypes.swg index aff35dcf1..c2d577995 100644 --- a/Lib/ruby/rubyprimtypes.swg +++ b/Lib/ruby/rubyprimtypes.swg @@ -1,5 +1,9 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * rubyprimtypes.swg + * * ----------------------------------------------------------------------------- */ /* ------------------------------------------------------------ * Primitive Types diff --git a/Lib/ruby/rubyrun.swg b/Lib/ruby/rubyrun.swg index ccc997a71..24d861d5a 100644 --- a/Lib/ruby/rubyrun.swg +++ b/Lib/ruby/rubyrun.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * rubyrun.swg * * This file contains the runtime support for Ruby modules diff --git a/Lib/ruby/rubystdautodoc.swg b/Lib/ruby/rubystdautodoc.swg index e14f65902..ad70f7f8b 100644 --- a/Lib/ruby/rubystdautodoc.swg +++ b/Lib/ruby/rubystdautodoc.swg @@ -1,8 +1,12 @@ -/* ----------------------------------------------------------------------------- - * rubystdautodoc.swg +/** + * @file rubystdautodoc.swg + * @author gga + * @date Wed May 2 17:20:39 2007 * - * This file contains autodocs for standard STL functions. - * ----------------------------------------------------------------------------- */ + * @brief This file contains autodocs for standard STL functions. + * + * + */ // // For STL autodocumentation diff --git a/Lib/ruby/rubytracking.swg b/Lib/ruby/rubytracking.swg index 0a36f4a05..959d2087e 100644 --- a/Lib/ruby/rubytracking.swg +++ b/Lib/ruby/rubytracking.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * rubytracking.swg * * This file contains support for tracking mappings from diff --git a/Lib/ruby/rubywstrings.swg b/Lib/ruby/rubywstrings.swg index bb44fbc6e..862928c95 100644 --- a/Lib/ruby/rubywstrings.swg +++ b/Lib/ruby/rubywstrings.swg @@ -1,11 +1,15 @@ -/* ----------------------------------------------------------------------------- - * rubywstrings.swg - * - * Currently, Ruby does not support Unicode or WChar properly, so these - * are still treated as char arrays for now. - * There are other libraries available that add support to this in - * ruby including WString, FXString, etc. - * ----------------------------------------------------------------------------- */ +/** + * @file rubywstrings.swg + * @author + * @date Fri May 4 17:49:40 2007 + * + * @brief Currently, Ruby does not support Unicode or WChar properly, so these + * are still treated as char arrays for now. + * There are other libraries available that add support to this in + * ruby including WString, FXString, etc. + * + * + */ /* ------------------------------------------------------------ * utility methods for wchar_t strings diff --git a/Lib/ruby/stl.i b/Lib/ruby/stl.i index 9d2e91eee..66b72e073 100644 --- a/Lib/ruby/stl.i +++ b/Lib/ruby/stl.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * stl.i * * Initial STL definition. extended as needed in each language diff --git a/Lib/ruby/typemaps.i b/Lib/ruby/typemaps.i index c4db82161..2492e2e03 100644 --- a/Lib/ruby/typemaps.i +++ b/Lib/ruby/typemaps.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * typemaps.i * * Pointer handling diff --git a/Lib/std/_std_deque.i b/Lib/std/_std_deque.i index c30523c0d..026f373d6 100644 --- a/Lib/std/_std_deque.i +++ b/Lib/std/_std_deque.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * _std_deque.i * * This file contains a generic definition of std::deque along with diff --git a/Lib/std_except.i b/Lib/std_except.i index 769a68995..af9803a62 100644 --- a/Lib/std_except.i +++ b/Lib/std_except.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_except.i * * SWIG library file with typemaps to handle and throw STD exceptions in a diff --git a/Lib/stdint.i b/Lib/stdint.i index 14fe6195e..7b48ca388 100644 --- a/Lib/stdint.i +++ b/Lib/stdint.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * stdint.i * * SWIG library file for ISO C99 types: 7.18 Integer types diff --git a/Lib/stl.i b/Lib/stl.i index 0b236afda..c3ade01ea 100644 --- a/Lib/stl.i +++ b/Lib/stl.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * stl.i * ----------------------------------------------------------------------------- */ diff --git a/Lib/swigarch.i b/Lib/swigarch.i index f5aea4678..260b60880 100644 --- a/Lib/swigarch.i +++ b/Lib/swigarch.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * swigarch.i * * SWIG library file for 32bit/64bit code specialization and checking. diff --git a/Lib/swigrun.i b/Lib/swigrun.i index 6026a9151..17a140968 100644 --- a/Lib/swigrun.i +++ b/Lib/swigrun.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * swigrun.i * * Empty module (for now). Placeholder for runtime libs diff --git a/Lib/tcl/mactclinit.c b/Lib/tcl/mactclinit.c new file mode 100644 index 000000000..5dcf8e7f3 --- /dev/null +++ b/Lib/tcl/mactclinit.c @@ -0,0 +1,93 @@ +/* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * + * mactclinit.c + * ----------------------------------------------------------------------------- */ + +/* + * tclMacAppInit.c -- + * + * Provides a version of the Tcl_AppInit procedure for the example shell. + * + * Copyright (c) 1993-1994 Lockheed Missle & Space Company, AI Center + * Copyright (c) 1995-1997 Sun Microsystems, Inc. + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * + * SCCS: @(#) tclMacAppInit.c 1.17 97/01/21 18:13:34 + */ + +#include "tcl.h" +#include "tclInt.h" +#include "tclMacInt.h" + +#if defined(THINK_C) +# include +#elif defined(__MWERKS__) +# include +short InstallConsole _ANSI_ARGS_((short fd)); +#endif + + + +/* + *---------------------------------------------------------------------- + * + * MacintoshInit -- + * + * This procedure calls initalization routines to set up a simple + * console on a Macintosh. This is necessary as the Mac doesn't + * have a stdout & stderr by default. + * + * Results: + * Returns TCL_OK if everything went fine. If it didn't the + * application should probably fail. + * + * Side effects: + * Inits the appropiate console package. + * + *---------------------------------------------------------------------- + */ + +#ifdef __cplusplus +extern "C" +#endif +extern int +MacintoshInit() +{ +#if defined(THINK_C) + + /* Set options for Think C console package */ + /* The console package calls the Mac init calls */ + console_options.pause_atexit = 0; + console_options.title = "\pTcl Interpreter"; + +#elif defined(__MWERKS__) + + /* Set options for CodeWarrior SIOUX package */ + SIOUXSettings.autocloseonquit = true; + SIOUXSettings.showstatusline = true; + SIOUXSettings.asktosaveonclose = false; + InstallConsole(0); + SIOUXSetTitle("\pTcl Interpreter"); + +#elif defined(applec) + + /* Init packages used by MPW SIOW package */ + InitGraf((Ptr)&qd.thePort); + InitFonts(); + InitWindows(); + InitMenus(); + TEInit(); + InitDialogs(nil); + InitCursor(); + +#endif + + TclMacSetEventProc((TclMacConvertEventPtr) SIOUXHandleOneEvent); + + /* No problems with initialization */ + return TCL_OK; +} diff --git a/Lib/tcl/mactkinit.c b/Lib/tcl/mactkinit.c index 78391d445..bfe74029c 100644 --- a/Lib/tcl/mactkinit.c +++ b/Lib/tcl/mactkinit.c @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * mactkinit.c * * This is a support file needed to build a new version of Wish. diff --git a/Lib/tcl/std_common.i b/Lib/tcl/std_common.i index 0718facb8..3a6f47042 100644 --- a/Lib/tcl/std_common.i +++ b/Lib/tcl/std_common.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_common.i * * SWIG typemaps for STL - common utilities diff --git a/Lib/tcl/std_pair.i b/Lib/tcl/std_pair.i index 1448d6524..52e96674f 100644 --- a/Lib/tcl/std_pair.i +++ b/Lib/tcl/std_pair.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_pair.i * * Typemaps for std::pair diff --git a/Lib/tcl/std_vector.i b/Lib/tcl/std_vector.i index 3c8dd24b7..d913f00cc 100644 --- a/Lib/tcl/std_vector.i +++ b/Lib/tcl/std_vector.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * std_vector.i * ----------------------------------------------------------------------------- */ diff --git a/Lib/tcl/stl.i b/Lib/tcl/stl.i index 40c7584ec..afd121341 100644 --- a/Lib/tcl/stl.i +++ b/Lib/tcl/stl.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * stl.i * ----------------------------------------------------------------------------- */ diff --git a/Lib/tcl/tcl8.swg b/Lib/tcl/tcl8.swg index 5da1bc07c..c33cc7681 100644 --- a/Lib/tcl/tcl8.swg +++ b/Lib/tcl/tcl8.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * tcl8.swg * * Tcl configuration module. diff --git a/Lib/tcl/tclinterp.i b/Lib/tcl/tclinterp.i index 3b45b6d4b..48cdb6066 100644 --- a/Lib/tcl/tclinterp.i +++ b/Lib/tcl/tclinterp.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * tclinterp.i * * Tcl_Interp *interp diff --git a/Lib/tcl/tclopers.swg b/Lib/tcl/tclopers.swg index f113ccd19..26b74203d 100644 --- a/Lib/tcl/tclopers.swg +++ b/Lib/tcl/tclopers.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * tclopers.swg * * C++ overloaded operators. diff --git a/Lib/tcl/tclresult.i b/Lib/tcl/tclresult.i index c63b3ee19..ca0106432 100644 --- a/Lib/tcl/tclresult.i +++ b/Lib/tcl/tclresult.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * tclresult.i * ----------------------------------------------------------------------------- */ diff --git a/Lib/tcl/tclrun.swg b/Lib/tcl/tclrun.swg index eb8bd253c..6387fb008 100644 --- a/Lib/tcl/tclrun.swg +++ b/Lib/tcl/tclrun.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * tclrun.swg * * This file contains the runtime support for Tcl modules and includes diff --git a/Lib/tcl/tclsh.i b/Lib/tcl/tclsh.i index 160ba8d8f..2e8ed3316 100644 --- a/Lib/tcl/tclsh.i +++ b/Lib/tcl/tclsh.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * tclsh.i * * SWIG File for building new tclsh program diff --git a/Lib/tcl/tclwstrings.swg b/Lib/tcl/tclwstrings.swg index b3b682e30..2d344c20f 100644 --- a/Lib/tcl/tclwstrings.swg +++ b/Lib/tcl/tclwstrings.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * tclwstrings.wg * * Utility methods for wchar strings diff --git a/Lib/tcl/typemaps.i b/Lib/tcl/typemaps.i index 8bee672cc..7c9e04a8b 100644 --- a/Lib/tcl/typemaps.i +++ b/Lib/tcl/typemaps.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * typemaps.i * * Swig typemap library for Tcl8. This file contains various sorts diff --git a/Lib/tcl/wish.i b/Lib/tcl/wish.i index 260032a81..077ded61f 100644 --- a/Lib/tcl/wish.i +++ b/Lib/tcl/wish.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * wish.i * * SWIG File for making wish diff --git a/Lib/typemaps/attribute.swg b/Lib/typemaps/attribute.swg index 4dcf15e2d..4bc6315b7 100644 --- a/Lib/typemaps/attribute.swg +++ b/Lib/typemaps/attribute.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * attribute.swg * * Attribute implementation diff --git a/Lib/typemaps/carrays.swg b/Lib/typemaps/carrays.swg index cdeab36b7..27ca11779 100644 --- a/Lib/typemaps/carrays.swg +++ b/Lib/typemaps/carrays.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * carrays.swg * * This library file contains macros that can be used to manipulate simple diff --git a/Lib/typemaps/cdata.swg b/Lib/typemaps/cdata.swg index 5baf7904c..32b3f5a77 100644 --- a/Lib/typemaps/cdata.swg +++ b/Lib/typemaps/cdata.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * cdata.swg * * This library file contains macros for manipulating raw C data as strings. diff --git a/Lib/typemaps/cmalloc.swg b/Lib/typemaps/cmalloc.swg index 45a6ab990..15f962930 100644 --- a/Lib/typemaps/cmalloc.swg +++ b/Lib/typemaps/cmalloc.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * cmalloc.swg * * This library file contains macros that can be used to create objects using diff --git a/Lib/typemaps/cpointer.swg b/Lib/typemaps/cpointer.swg index f797a6895..ce1af169e 100644 --- a/Lib/typemaps/cpointer.swg +++ b/Lib/typemaps/cpointer.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * cpointer.swg * * This library file contains macros that can be used to manipulate simple diff --git a/Lib/typemaps/cstrings.swg b/Lib/typemaps/cstrings.swg index c60ef6496..9144da790 100644 --- a/Lib/typemaps/cstrings.swg +++ b/Lib/typemaps/cstrings.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * cstrings.swg * * This file provides typemaps and macros for dealing with various forms diff --git a/Lib/typemaps/exception.swg b/Lib/typemaps/exception.swg index 12c4ea658..17a819cd7 100644 --- a/Lib/typemaps/exception.swg +++ b/Lib/typemaps/exception.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * exceptions.swg * * This SWIG library file provides language independent exception handling diff --git a/Lib/typemaps/ptrtypes.swg b/Lib/typemaps/ptrtypes.swg index e1bc476ed..803377afe 100644 --- a/Lib/typemaps/ptrtypes.swg +++ b/Lib/typemaps/ptrtypes.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * ptrtypes.swg * * Value typemaps (Type, const Type&) for "Ptr" types, such as swig diff --git a/Lib/typemaps/swigtypemaps.swg b/Lib/typemaps/swigtypemaps.swg index 0e39afe4c..08abab028 100644 --- a/Lib/typemaps/swigtypemaps.swg +++ b/Lib/typemaps/swigtypemaps.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * swigtypemaps.swg * * Unified Typemap Library frontend diff --git a/Lib/typemaps/typemaps.swg b/Lib/typemaps/typemaps.swg index 4629e8dfa..6e7505765 100644 --- a/Lib/typemaps/typemaps.swg +++ b/Lib/typemaps/typemaps.swg @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * typemaps.swg * * Tcl Pointer handling diff --git a/Lib/uffi/uffi.swg b/Lib/uffi/uffi.swg index 41b085998..78bd23534 100644 --- a/Lib/uffi/uffi.swg +++ b/Lib/uffi/uffi.swg @@ -27,6 +27,8 @@ typedef long size_t; %wrapper %{ +;; $Id$ + (eval-when (compile eval) ;;; You can define your own identifier converter if you want. diff --git a/Lib/wchar.i b/Lib/wchar.i index 14de34634..f106a3529 100644 --- a/Lib/wchar.i +++ b/Lib/wchar.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * wchar.i * ----------------------------------------------------------------------------- */ diff --git a/Lib/windows.i b/Lib/windows.i index 2c093dacc..08ddc2b22 100644 --- a/Lib/windows.i +++ b/Lib/windows.i @@ -1,4 +1,7 @@ /* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * * windows.i * * SWIG library file to support types found in windows.h as well as Microsoft diff --git a/Makefile.in b/Makefile.in index a540ceb68..b56272b11 100644 --- a/Makefile.in +++ b/Makefile.in @@ -188,6 +188,51 @@ java.actionexample: (cd Examples/$(LANGUAGE)/java && $(MAKE) -s $(chk-set-env) $(ACTION)) \ fi; \ +gifplot-library: + @echo $(ACTION)ing Examples/GIFPlot/Lib + @cd Examples/GIFPlot/Lib && $(MAKE) -k -s $(ACTION) + +check-gifplot: \ + check-tcl-gifplot \ + check-perl5-gifplot \ + check-python-gifplot \ + check-java-gifplot \ + check-guile-gifplot \ + check-mzscheme-gifplot \ + check-ruby-gifplot \ + check-ocaml-gifplot \ + check-octave-gifplot \ + check-php-gifplot \ + check-pike-gifplot \ + check-chicken-gifplot \ +# check-lua-gifplot \ +# check-csharp-gifplot \ +# check-modula3-gifplot \ +# check-c-gifplot + +check-%-gifplot: gifplot-library + @if test -z "$(skip-$*)"; then \ + echo $* unknown; \ + exit 1; \ + fi + @passed=true; \ + up=`$(srcdir)/Tools/capitalize $*`; \ + dir="Examples/GIFPlot/$$up"; \ + if $(skip-$*); then \ + echo skipping $$up $(ACTION); \ + elif [ ! -f $$dir/check.list ]; then \ + echo skipping $$up $(ACTION) "(no $$dir/check.list)"; \ + else \ + all=`sed '/^#/d' $$dir/check.list`; \ + for a in $$all; do \ + echo $(ACTION)ing $$dir/$$a; \ + (cd $$dir/$$a && \ + $(MAKE) -k -s $(chk-set-env) $(ACTION)) \ + || passed=false; \ + done; \ + fi; \ + test $$passed = true + # Checks testcases in the test-suite excluding those which are known to be broken check-test-suite: \ check-tcl-test-suite \ @@ -238,7 +283,7 @@ partialcheck-test-suite: partialcheck-%-test-suite: @$(MAKE) -k -s check-$*-test-suite ACTION=partialcheck NOSKIP=1 -check: check-aliveness check-ccache check-examples check-test-suite +check: check-aliveness check-ccache check-examples check-gifplot check-test-suite # Run known-to-be-broken as well as not broken testcases in the test-suite all-test-suite: \ @@ -300,7 +345,7 @@ broken-%-test-suite: # CLEAN ##################################################################### -clean: clean-objects clean-libfiles clean-examples clean-test-suite clean-docs +clean: clean-objects clean-libfiles clean-examples clean-gifplot clean-test-suite clean-docs clean-objects: clean-source clean-ccache @@ -315,6 +360,9 @@ clean-libfiles: clean-examples: @$(MAKE) -k -s check-examples ACTION=clean +clean-gifplot: + @$(MAKE) -k -s check-gifplot ACTION=clean + clean-test-suite: @$(MAKE) -k -s check-test-suite ACTION=clean NOSKIP=1 @@ -324,6 +372,9 @@ clean-%-examples: clean-%-test-suite: @$(MAKE) -k -s check-$*-test-suite ACTION=clean NOSKIP=1 +clean-%-gifplot: + @$(MAKE) -k -s check-$*-gifplot ACTION=clean + clean-ccache: test -z "$(ENABLE_CCACHE)" || (cd $(CCACHE) && $(MAKE) -s clean) @@ -345,7 +396,7 @@ maintainer-clean: clean-libfiles DISTCLEAN-DEAD = config.status config.log config.cache swig.spec Makefile mkmf.log libtool -distclean: distclean-objects clean-examples distclean-test-suite clean-docs distclean-dead distclean-ccache +distclean: distclean-objects clean-examples clean-gifplot distclean-test-suite clean-docs distclean-dead distclean-ccache distclean-objects: distclean-source diff --git a/README b/README index e7b79d2d2..3df9e506a 100644 --- a/README +++ b/README @@ -1,6 +1,6 @@ SWIG (Simplified Wrapper and Interface Generator) -Version: 2.0.0 (in progress) +Version: 1.3.40 (in progress) Tagline: SWIG is a compiler that integrates C and C++ with languages including Perl, Python, Tcl, Ruby, PHP, Java, Ocaml, Lua, @@ -13,6 +13,61 @@ the listed languages, or to extend C/C++ programs with a scripting language. This distribution represents the latest development release of SWIG. +The guilty parties working on this are: + +Active Developers: + William Fulton (wsf@fultondesigns.co.uk) (SWIG core, Java, C#, Windows, Cygwin) + Olly Betts (olly@survex.com) (PHP) + John Lenz (Guile, MzScheme updates, Chicken module, runtime system) + Mark Gossage (mark@gossage.cjb.net) (Lua) + Joseph Wang (joe@gnacademy.org) (R) + Gonzalo Garramuno (ggarra@advancedsl.com.ar) (Ruby, Ruby's UTL) + Xavier Delacour (xavier.delacour@gmail.com) (Octave) + +Major contributors include: + Dave Beazley (dave-swig@dabeaz.com) (SWIG core, Python, Tcl, Perl) + Henning Thielemann (swig@henning-thielemann.de) (Modula3) + Matthias Köppe (mkoeppe@mail.math.uni-magdeburg.de) (Guile, MzScheme) + Luigi Ballabio (luigi.ballabio@fastwebnet.it) (STL wrapping) + Mikel Bancroft (mikel@franz.com) (Allegro CL) + Surendra Singhi (efuzzyone@netscape.net) (CLISP, CFFI) + Marcelo Matus (mmatus@acms.arizona.edu) (SWIG core, Python, UTL[python,perl,tcl,ruby]) + Art Yerkes (ayerkes@speakeasy.net) (Ocaml) + Lyle Johnson (lyle@users.sourceforge.net) (Ruby) + Charlie Savage (cfis@interserv.com) (Ruby) + Thien-Thi Nguyen (ttn@glug.org) (build/test/misc) + Richard Palmer (richard@magicality.org) (PHP) + Sam Liddicott - Anonova Ltd (saml@liddicott.com) (PHP) + Tim Hockin - Sun Microsystems (thockin@sun.com) (PHP) + Kevin Ruland (PHP) + Shibukawa Yoshiki (Japanese Translation) + Jason Stewart (jason@openinformatics.com) (Perl5) + Loic Dachary (Perl5) + David Fletcher (Perl5) + Gary Holt (Perl5) + Masaki Fukushima (Ruby) + Scott Michel (scottm@cs.ucla.edu) (Java directors) + Tiger Feng (songyanf@cs.uchicago.edu) (SWIG core) + Mark Rose (mrose@stm.lbl.gov) (Directors) + Jonah Beckford (beckford@usermail.com) (CHICKEN) + Ahmon Dancy (dancy@franz.com) (Allegro CL) + Dirk Gerrits (Allegro CL) + Neil Cawse (C#) + Harco de Hilster (Java) + Alexey Dyachenko (dyachenko@fromru.com) (Tcl) + Bob Techentin (Tcl) + Martin Froehlich (Guile) + Marcio Luis Teixeira (Guile) + Duncan Temple Lang (R) + +Past contributors include: + James Michael DuPont, Clark McGrew, Dustin Mitchell, Ian Cooke, Catalin Dumitrescu, Baran + Kovuk, Oleg Tolmatcev, Tal Shalif, Lluis Padro, Chris Seatory, Igor Bely, Robin Dunn + (See CHANGES for a more complete list). + +Portions also copyrighted by companies/corporations; + Network Applied Communication Laboratory, Inc + Information-technology Promotion Agency, Japan Up-to-date SWIG related information can be found at diff --git a/Source/CParse/cparse.h b/Source/CParse/cparse.h index c17577d8c..9be41c60e 100644 --- a/Source/CParse/cparse.h +++ b/Source/CParse/cparse.h @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * cparse.h * diff --git a/Source/CParse/cscanner.c b/Source/CParse/cscanner.c index 36c5f7d6c..8734c7d0e 100644 --- a/Source/CParse/cscanner.c +++ b/Source/CParse/cscanner.c @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * scanner.c * diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index b365cfc08..0babfbbb8 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * parser.y * diff --git a/Source/CParse/templ.c b/Source/CParse/templ.c index d3b9b3d99..14886605f 100644 --- a/Source/CParse/templ.c +++ b/Source/CParse/templ.c @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * templ.c * diff --git a/Source/CParse/util.c b/Source/CParse/util.c index fa934ffc0..efae41051 100644 --- a/Source/CParse/util.c +++ b/Source/CParse/util.c @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * util.c * diff --git a/Source/DOH/base.c b/Source/DOH/base.c index 245004f87..15827f328 100644 --- a/Source/DOH/base.c +++ b/Source/DOH/base.c @@ -1,15 +1,13 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. - * * base.c * * This file contains the function entry points for dispatching methods on * DOH objects. A number of small utility functions are also included. + * + * Author(s) : David Beazley (beazley@cs.uchicago.edu) + * + * Copyright (C) 1999-2000. The University of Chicago + * See the file LICENSE for information on usage and redistribution. * ----------------------------------------------------------------------------- */ char cvsroot_base_c[] = "$Id$"; diff --git a/Source/DOH/doh.h b/Source/DOH/doh.h index 1ed196058..766e12a34 100644 --- a/Source/DOH/doh.h +++ b/Source/DOH/doh.h @@ -1,14 +1,14 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. - * * doh.h * * This file describes of the externally visible functions in DOH. + * + * Author(s) : David Beazley (beazley@cs.uchicago.edu) + * + * Copyright (C) 1999-2000. The University of Chicago + * See the file LICENSE for information on usage and redistribution. + * + * $Id$ * ----------------------------------------------------------------------------- */ #ifndef _DOH_H diff --git a/Source/DOH/dohint.h b/Source/DOH/dohint.h index 661bed075..1fc5eb7c9 100644 --- a/Source/DOH/dohint.h +++ b/Source/DOH/dohint.h @@ -1,14 +1,15 @@ + /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. - * * dohint.h * * This file describes internally managed objects. + * + * Author(s) : David Beazley (beazley@cs.uchicago.edu) + * + * Copyright (C) 1999-2000. The University of Chicago + * See the file LICENSE for information on usage and redistribution. + * + * $Id$ * ----------------------------------------------------------------------------- */ #ifndef _DOHINT_H diff --git a/Source/DOH/file.c b/Source/DOH/file.c index a9ee332bf..65c2336a4 100644 --- a/Source/DOH/file.c +++ b/Source/DOH/file.c @@ -1,15 +1,13 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. - * * file.c * * This file implements a file-like object that can be built around an * ordinary FILE * or integer file descriptor. + * + * Author(s) : David Beazley (beazley@cs.uchicago.edu) + * + * Copyright (C) 1999-2000. The University of Chicago + * See the file LICENSE for information on usage and redistribution. * ----------------------------------------------------------------------------- */ char cvsroot_file_c[] = "$Id$"; diff --git a/Source/DOH/fio.c b/Source/DOH/fio.c index 2ef605c32..f544cee64 100644 --- a/Source/DOH/fio.c +++ b/Source/DOH/fio.c @@ -1,15 +1,13 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. - * * fio.c * * This file implements a number of standard I/O operations included * formatted output, readline, and splitting. + * + * Author(s) : David Beazley (beazley@cs.uchicago.edu) + * + * Copyright (C) 1999-2000. The University of Chicago + * See the file LICENSE for information on usage and redistribution. * ----------------------------------------------------------------------------- */ char cvsroot_fio_c[] = "$Id$"; diff --git a/Source/DOH/hash.c b/Source/DOH/hash.c index 87f8e3c40..045de8b5b 100644 --- a/Source/DOH/hash.c +++ b/Source/DOH/hash.c @@ -1,14 +1,12 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. - * * hash.c * * Implements a simple hash table object. + * + * Author(s) : David Beazley (beazley@cs.uchicago.edu) + * + * Copyright (C) 1999-2000. The University of Chicago + * See the file LICENSE for information on usage and redistribution. * ----------------------------------------------------------------------------- */ char cvsroot_hash_c[] = "$Id$"; diff --git a/Source/DOH/list.c b/Source/DOH/list.c index a08cadb5a..7a1786299 100644 --- a/Source/DOH/list.c +++ b/Source/DOH/list.c @@ -1,14 +1,12 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. - * * list.c * * Implements a simple list object. + * + * Author(s) : David Beazley (beazley@cs.uchicago.edu) + * + * Copyright (C) 1999-2000. The University of Chicago + * See the file LICENSE for information on usage and redistribution. * ----------------------------------------------------------------------------- */ char cvsroot_list_c[] = "$Id$"; diff --git a/Source/DOH/memory.c b/Source/DOH/memory.c index fcacd6170..1c6063ef3 100644 --- a/Source/DOH/memory.c +++ b/Source/DOH/memory.c @@ -1,15 +1,13 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. - * * memory.c * * This file implements all of DOH's memory management including allocation * of objects and checking of objects. + * + * Author(s) : David Beazley (beazley@cs.uchicago.edu) + * + * Copyright (C) 1999-2000. The University of Chicago + * See the file LICENSE for information on usage and redistribution. * ----------------------------------------------------------------------------- */ char cvsroot_memory_c[] = "$Id$"; diff --git a/Source/DOH/string.c b/Source/DOH/string.c index bd36c4094..141cd58e8 100644 --- a/Source/DOH/string.c +++ b/Source/DOH/string.c @@ -1,15 +1,13 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. - * * string.c * * Implements a string object that supports both sequence operations and * file semantics. + * + * Author(s) : David Beazley (beazley@cs.uchicago.edu) + * + * Copyright (C) 1999-2000. The University of Chicago + * See the file LICENSE for information on usage and redistribution. * ----------------------------------------------------------------------------- */ char cvsroot_string_c[] = "$Id$"; diff --git a/Source/DOH/void.c b/Source/DOH/void.c index 2d684b9cd..0be01561a 100644 --- a/Source/DOH/void.c +++ b/Source/DOH/void.c @@ -1,15 +1,13 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. - * * void.c * * Implements a "void" object that is really just a DOH container around * an arbitrary C object represented as a void *. + * + * Author(s) : David Beazley (beazley@cs.uchicago.edu) + * + * Copyright (C) 1999-2000. The University of Chicago + * See the file LICENSE for information on usage and redistribution. * ----------------------------------------------------------------------------- */ char cvsroot_void_c[] = "$Id$"; diff --git a/Source/Include/swigwarn.h b/Source/Include/swigwarn.h index 481f67da3..ebcd2fe7c 100644 --- a/Source/Include/swigwarn.h +++ b/Source/Include/swigwarn.h @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * swigwarn.h * @@ -20,6 +16,8 @@ * numbers in this file. * ----------------------------------------------------------------------------- */ +/* $Id$ */ + #ifndef SWIGWARN_H_ #define SWIGWARN_H_ diff --git a/Source/Modules/allegrocl.cxx b/Source/Modules/allegrocl.cxx index 36441b1fe..878e30a67 100644 --- a/Source/Modules/allegrocl.cxx +++ b/Source/Modules/allegrocl.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * allegrocl.cxx * diff --git a/Source/Modules/allocate.cxx b/Source/Modules/allocate.cxx index 31f27e1eb..e8397e6a6 100644 --- a/Source/Modules/allocate.cxx +++ b/Source/Modules/allocate.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * allocate.cxx * diff --git a/Source/Modules/browser.cxx b/Source/Modules/browser.cxx index 592e12783..b1bc7349c 100644 --- a/Source/Modules/browser.cxx +++ b/Source/Modules/browser.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * browser.cxx * diff --git a/Source/Modules/cffi.cxx b/Source/Modules/cffi.cxx index c8c431e47..0aa933c56 100644 --- a/Source/Modules/cffi.cxx +++ b/Source/Modules/cffi.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * cffi.cxx * diff --git a/Source/Modules/chicken.cxx b/Source/Modules/chicken.cxx index 1d9e9c620..12ef4b454 100644 --- a/Source/Modules/chicken.cxx +++ b/Source/Modules/chicken.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * chicken.cxx * diff --git a/Source/Modules/clisp.cxx b/Source/Modules/clisp.cxx index 95ee66bc9..fa73b3a0b 100644 --- a/Source/Modules/clisp.cxx +++ b/Source/Modules/clisp.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * clisp.cxx * diff --git a/Source/Modules/contract.cxx b/Source/Modules/contract.cxx index 7a8543928..518dc2997 100644 --- a/Source/Modules/contract.cxx +++ b/Source/Modules/contract.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * contract.cxx * diff --git a/Source/Modules/csharp.cxx b/Source/Modules/csharp.cxx index 06cec96ac..2730b55d4 100644 --- a/Source/Modules/csharp.cxx +++ b/Source/Modules/csharp.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * csharp.cxx * diff --git a/Source/Modules/directors.cxx b/Source/Modules/directors.cxx index 6064e1758..158b53502 100644 --- a/Source/Modules/directors.cxx +++ b/Source/Modules/directors.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * directors.cxx * diff --git a/Source/Modules/emit.cxx b/Source/Modules/emit.cxx index fde3b2457..a4cf8cebc 100644 --- a/Source/Modules/emit.cxx +++ b/Source/Modules/emit.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * emit.cxx * diff --git a/Source/Modules/guile.cxx b/Source/Modules/guile.cxx index 05ceced22..0c72de8d0 100644 --- a/Source/Modules/guile.cxx +++ b/Source/Modules/guile.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * guile.cxx * diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index e12c9072b..8dfa19624 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * java.cxx * diff --git a/Source/Modules/lang.cxx b/Source/Modules/lang.cxx index 479615908..38658ce9c 100644 --- a/Source/Modules/lang.cxx +++ b/Source/Modules/lang.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * lang.cxx * diff --git a/Source/Modules/lua.cxx b/Source/Modules/lua.cxx index 4640d9ed7..78cd7ce96 100644 --- a/Source/Modules/lua.cxx +++ b/Source/Modules/lua.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * lua.cxx * diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx index 2437b35c7..c824db6f9 100644 --- a/Source/Modules/main.cxx +++ b/Source/Modules/main.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * main.cxx * diff --git a/Source/Modules/modula3.cxx b/Source/Modules/modula3.cxx index e650edcb2..b3568c0bf 100644 --- a/Source/Modules/modula3.cxx +++ b/Source/Modules/modula3.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * modula3.cxx * diff --git a/Source/Modules/module.cxx b/Source/Modules/module.cxx index f4ab560dd..6a0d6bbb9 100644 --- a/Source/Modules/module.cxx +++ b/Source/Modules/module.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * module.cxx * diff --git a/Source/Modules/mzscheme.cxx b/Source/Modules/mzscheme.cxx index d17ccd33c..28dd8ecd2 100644 --- a/Source/Modules/mzscheme.cxx +++ b/Source/Modules/mzscheme.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * mzscheme.cxx * diff --git a/Source/Modules/ocaml.cxx b/Source/Modules/ocaml.cxx index 7108484b3..b925328a3 100644 --- a/Source/Modules/ocaml.cxx +++ b/Source/Modules/ocaml.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * ocaml.cxx * diff --git a/Source/Modules/octave.cxx b/Source/Modules/octave.cxx index d9483c974..c5ff2eb44 100644 --- a/Source/Modules/octave.cxx +++ b/Source/Modules/octave.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * octave.cxx * diff --git a/Source/Modules/overload.cxx b/Source/Modules/overload.cxx index 57d7fac90..511e55004 100644 --- a/Source/Modules/overload.cxx +++ b/Source/Modules/overload.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * overload.cxx * diff --git a/Source/Modules/perl5.cxx b/Source/Modules/perl5.cxx index d0c019195..eace179a7 100644 --- a/Source/Modules/perl5.cxx +++ b/Source/Modules/perl5.cxx @@ -1,10 +1,10 @@ +/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- + * vim:expandtab:shiftwidth=2:tabstop=8:smarttab: + */ + /* ---------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * perl5.cxx * diff --git a/Source/Modules/php.cxx b/Source/Modules/php.cxx index 9f91f12d4..ee69c1864 100644 --- a/Source/Modules/php.cxx +++ b/Source/Modules/php.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * php.cxx * diff --git a/Source/Modules/pike.cxx b/Source/Modules/pike.cxx index e59248e95..98f63056c 100644 --- a/Source/Modules/pike.cxx +++ b/Source/Modules/pike.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * pike.cxx * diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index f3735ff00..ffeea430d 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * python.cxx * diff --git a/Source/Modules/r.cxx b/Source/Modules/r.cxx index f1fdff662..8e9aa557d 100644 --- a/Source/Modules/r.cxx +++ b/Source/Modules/r.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * r.cxx * diff --git a/Source/Modules/ruby.cxx b/Source/Modules/ruby.cxx index 9badc0d0a..1c13747e5 100644 --- a/Source/Modules/ruby.cxx +++ b/Source/Modules/ruby.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * ruby.cxx * diff --git a/Source/Modules/s-exp.cxx b/Source/Modules/s-exp.cxx index 62b93f7c7..90791ec70 100644 --- a/Source/Modules/s-exp.cxx +++ b/Source/Modules/s-exp.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * s-exp.cxx * diff --git a/Source/Modules/swigmain.cxx b/Source/Modules/swigmain.cxx index 3a28fbdde..b121dc9b7 100644 --- a/Source/Modules/swigmain.cxx +++ b/Source/Modules/swigmain.cxx @@ -1,15 +1,11 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. - * - * swigmain.cxx + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * Simplified Wrapper and Interface Generator (SWIG) * + * swigmain.cxx + * * This file is the main entry point to SWIG. It collects the command * line options, registers built-in language modules, and instantiates * a module for code generation. If adding new language modules diff --git a/Source/Modules/swigmod.h b/Source/Modules/swigmod.h index 075a209d2..8dec8d0af 100644 --- a/Source/Modules/swigmod.h +++ b/Source/Modules/swigmod.h @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * swigmod.h * diff --git a/Source/Modules/tcl8.cxx b/Source/Modules/tcl8.cxx index efbe28c50..015ac5e45 100644 --- a/Source/Modules/tcl8.cxx +++ b/Source/Modules/tcl8.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * tcl8.cxx * diff --git a/Source/Modules/typepass.cxx b/Source/Modules/typepass.cxx index e972cea05..d663aed6e 100644 --- a/Source/Modules/typepass.cxx +++ b/Source/Modules/typepass.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * typepass.cxx * diff --git a/Source/Modules/uffi.cxx b/Source/Modules/uffi.cxx index f793b5643..d3f8401f0 100644 --- a/Source/Modules/uffi.cxx +++ b/Source/Modules/uffi.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * uffi.cxx * diff --git a/Source/Modules/utils.cxx b/Source/Modules/utils.cxx index 3fe7a2709..bf8211903 100644 --- a/Source/Modules/utils.cxx +++ b/Source/Modules/utils.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * utils.cxx * diff --git a/Source/Modules/xml.cxx b/Source/Modules/xml.cxx index bcfac1acc..2edd01cf0 100644 --- a/Source/Modules/xml.cxx +++ b/Source/Modules/xml.cxx @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * xml.cxx * diff --git a/Source/Preprocessor/cpp.c b/Source/Preprocessor/cpp.c index bcb1061c8..81646171a 100644 --- a/Source/Preprocessor/cpp.c +++ b/Source/Preprocessor/cpp.c @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * cpp.c * diff --git a/Source/Preprocessor/expr.c b/Source/Preprocessor/expr.c index 3e3f39480..4da24a774 100644 --- a/Source/Preprocessor/expr.c +++ b/Source/Preprocessor/expr.c @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * expr.c * diff --git a/Source/Preprocessor/preprocessor.h b/Source/Preprocessor/preprocessor.h index 8f98dae15..3579eede2 100644 --- a/Source/Preprocessor/preprocessor.h +++ b/Source/Preprocessor/preprocessor.h @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * preprocessor.h * diff --git a/Source/Swig/cwrap.c b/Source/Swig/cwrap.c index 208842121..7c6837a2b 100644 --- a/Source/Swig/cwrap.c +++ b/Source/Swig/cwrap.c @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * cwrap.c * diff --git a/Source/Swig/deprecate.c b/Source/Swig/deprecate.c index f25b9a650..475d2c6cf 100644 --- a/Source/Swig/deprecate.c +++ b/Source/Swig/deprecate.c @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * deprecate.c * diff --git a/Source/Swig/error.c b/Source/Swig/error.c index 80eede4e3..156fe06a7 100644 --- a/Source/Swig/error.c +++ b/Source/Swig/error.c @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * error.c * diff --git a/Source/Swig/fragment.c b/Source/Swig/fragment.c index 896461b30..510a01875 100644 --- a/Source/Swig/fragment.c +++ b/Source/Swig/fragment.c @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * fragment.c * diff --git a/Source/Swig/getopt.c b/Source/Swig/getopt.c index f6f196bfd..cbd051d9f 100644 --- a/Source/Swig/getopt.c +++ b/Source/Swig/getopt.c @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * getopt.c * diff --git a/Source/Swig/include.c b/Source/Swig/include.c index 710a7ad71..f42eb5d45 100644 --- a/Source/Swig/include.c +++ b/Source/Swig/include.c @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * include.c * diff --git a/Source/Swig/misc.c b/Source/Swig/misc.c index 3a78fe7ab..050e5357a 100644 --- a/Source/Swig/misc.c +++ b/Source/Swig/misc.c @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * misc.c * diff --git a/Source/Swig/naming.c b/Source/Swig/naming.c index 9af0354e2..013ce5929 100644 --- a/Source/Swig/naming.c +++ b/Source/Swig/naming.c @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * naming.c * diff --git a/Source/Swig/parms.c b/Source/Swig/parms.c index cb8176377..9b58f5fcb 100644 --- a/Source/Swig/parms.c +++ b/Source/Swig/parms.c @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * parms.c * diff --git a/Source/Swig/scanner.c b/Source/Swig/scanner.c index 72984b27e..53f1ad4a0 100644 --- a/Source/Swig/scanner.c +++ b/Source/Swig/scanner.c @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * scanner.c * diff --git a/Source/Swig/stype.c b/Source/Swig/stype.c index 023148f8d..8a7700bec 100644 --- a/Source/Swig/stype.c +++ b/Source/Swig/stype.c @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * stype.c * diff --git a/Source/Swig/swig.h b/Source/Swig/swig.h index a7b90c4aa..2b2c797c9 100644 --- a/Source/Swig/swig.h +++ b/Source/Swig/swig.h @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * swig.h * diff --git a/Source/Swig/swigfile.h b/Source/Swig/swigfile.h index 632e821e2..92c7945e6 100644 --- a/Source/Swig/swigfile.h +++ b/Source/Swig/swigfile.h @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * swigfile.h * diff --git a/Source/Swig/swigopt.h b/Source/Swig/swigopt.h index 586f8bbc4..11eb5ba99 100644 --- a/Source/Swig/swigopt.h +++ b/Source/Swig/swigopt.h @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * swigopt.h * diff --git a/Source/Swig/swigparm.h b/Source/Swig/swigparm.h index 3e6269eae..49ae7992e 100644 --- a/Source/Swig/swigparm.h +++ b/Source/Swig/swigparm.h @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * swigparm.h * diff --git a/Source/Swig/swigscan.h b/Source/Swig/swigscan.h index faec4fe48..3403098df 100644 --- a/Source/Swig/swigscan.h +++ b/Source/Swig/swigscan.h @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * swigscan.h * diff --git a/Source/Swig/swigtree.h b/Source/Swig/swigtree.h index 6799398c9..5b43006a9 100644 --- a/Source/Swig/swigtree.h +++ b/Source/Swig/swigtree.h @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * swigtree.h * diff --git a/Source/Swig/swigwrap.h b/Source/Swig/swigwrap.h index b1f596f72..0dcf88059 100644 --- a/Source/Swig/swigwrap.h +++ b/Source/Swig/swigwrap.h @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * swigwrap.h * diff --git a/Source/Swig/symbol.c b/Source/Swig/symbol.c index 50dde9159..055af854f 100644 --- a/Source/Swig/symbol.c +++ b/Source/Swig/symbol.c @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * symbol.c * diff --git a/Source/Swig/tree.c b/Source/Swig/tree.c index c80c61081..14d231afa 100644 --- a/Source/Swig/tree.c +++ b/Source/Swig/tree.c @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * tree.c * diff --git a/Source/Swig/typemap.c b/Source/Swig/typemap.c index a44ecdf6d..401a99801 100644 --- a/Source/Swig/typemap.c +++ b/Source/Swig/typemap.c @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * typemap.c * diff --git a/Source/Swig/typeobj.c b/Source/Swig/typeobj.c index cafecb9a6..8ff31bc0b 100644 --- a/Source/Swig/typeobj.c +++ b/Source/Swig/typeobj.c @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * typeobj.c * diff --git a/Source/Swig/typesys.c b/Source/Swig/typesys.c index 3eb21b57b..2562e12f8 100644 --- a/Source/Swig/typesys.c +++ b/Source/Swig/typesys.c @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * typesys.c * diff --git a/Source/Swig/wrapfunc.c b/Source/Swig/wrapfunc.c index 2c9f7c86a..11518bfc2 100644 --- a/Source/Swig/wrapfunc.c +++ b/Source/Swig/wrapfunc.c @@ -1,10 +1,6 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. * * wrapfunc.c * diff --git a/configure.in b/configure.in index 738db1281..c6f2c2970 100644 --- a/configure.in +++ b/configure.in @@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script. dnl The macros which aren't shipped with the autotools are stored in the dnl Tools/config directory in .m4 files. -AC_INIT([swig],[2.0.0],[http://www.swig.org]) +AC_INIT([swig],[1.3.40],[http://www.swig.org]) AC_PREREQ(2.58) AC_CONFIG_SRCDIR([Source/Swig/swig.h]) AC_CONFIG_AUX_DIR([Tools/config]) @@ -2186,6 +2186,8 @@ AC_CONFIG_FILES([ \ Examples/Makefile \ Examples/guile/Makefile \ Examples/xml/Makefile \ + Examples/GIFPlot/Makefile \ + Examples/GIFPlot/Lib/Makefile \ Examples/test-suite/chicken/Makefile \ Examples/test-suite/csharp/Makefile \ Examples/test-suite/guile/Makefile \