The great merge

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4141 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Dave Beazley 2002-11-30 22:01:28 +00:00
commit 12a43edc2d
1508 changed files with 125983 additions and 44037 deletions

View file

@ -0,0 +1,26 @@
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
clean::
$(MAKE) -f $(TOP)/Makefile MLFILE='$(MLFILE)' ocaml_clean
rm -f *.gif
check: all

Binary file not shown.

View file

@ -0,0 +1,34 @@
(* Draw some simple shapes *)
(* Use the wrapped GIFPlot library *)
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 ])
(* Make a red box *)
let _ = _FrameBuffer_box
(C_list [ f ; C_int 40 ; C_int 40 ; C_int 200 ; C_int 200 ; _RED ])
(* Make a blue circle *)
let _ = _FrameBuffer_circle
(C_list [ f ; C_int 200 ; C_int 200 ; C_int 40 ; _BLUE ])
(* Make green line *)
let _ = _FrameBuffer_line
(C_list [ f ; C_int 10 ; C_int 390 ; C_int 390 ; C_int 200 ; _GREEN ])
(* 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

View file

@ -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