SWIG license change - The Examples and Lib move to a very permissive license in the LICENSE file, removing the BSD license restrictions as agreed by committers since it was inadvertently introduced. Remove some examples where the impact of the license change is not clear.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11874 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2010-02-27 23:26:02 +00:00
commit 4308dd03cf
346 changed files with 40 additions and 12158 deletions

View file

@ -1,28 +0,0 @@
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

File diff suppressed because it is too large Load diff

View file

@ -1,76 +0,0 @@
/* 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;
}
%}

View file

@ -1,41 +0,0 @@
(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)