You are looking at historical revision 13621 of this page. It may differ significantly from its current revision.
This is a port of the Stalin to CHICKEN, that is, Stalin hosted on the CHICKEN Scheme system. Stalin compiles a subset of R4RS Scheme to C code, which can subsequently be compiled to highly efficient self-contained executables.
libgc, the Boehm garbage collector must be installed and available in your linker path.
chicken-stalin [OPTION ...] FILENAME
See the Stalin manual for information about the available command line options and general usage information.
Interfacing to CHICKEN code
A preliminary and rather clunky way of interfacing Stalin code with chicken-compiled code is provided. The extension stalin-externals provides a macro named define-stalin-external that allows defining entry-points which Stalin code can call in an embedded CHICKEN-compiled library.
Consider the file mixed.scm:
; mixed.scm - CHICKEN code (require-extension stalin-externals) (define-stalin-external (foo (int x) (c-string y)) c-string (print "got: " x " and " y) "hello") (return-to-host)
A Stalin application uses this interface:
(include "mixed-externals.scm") (display "starting...\n") (define x (foo 33 "test")) (display x) (newline)
Compiling mixed.scm will generate two files named mixed-externals.scm and mixed-externals.h. The C header file is used by the Stalin foreign-procedure interface and mixed-externals.scm defines the calling procedures for the CHICKEN entry points. Now we compiled mixed.scm as an embedded (that is without a main function) program:
% csc -ce mixed.scm -X stalin-externals.scm % chicken-stalin -On -c mixed-stalin.scm % csc mixed.o mixed-stalin.c -C -I. -o mixed % ./mixed
- On some systems (notably debian-based Linux), the libgc headers are not in the default location. Add -copt -I/usr/include/gc to the invocation of chicken-stalin (or in whatever path gc.h is location) to set the proper include path
- On some systems libgc requires libdl, add -copt -ldl in this case.
The following extensions have been added to this version of stalin:
- support for \n (newline), \r (carriage return), \t (tab) and \e (escape) character sequences in string literals
- |SRFI-0 (cond-expand) The feature identifiers stalin, srfi-0 and chicken-stalin are defined.
The compiler has been tested on Mac OS X 10.4 (ppc), and Linux (x86, amd64)
- The compiler is extremely slow
- The Xlib and OpenGL interfaces provided with the original Stalin are not available
Jeffrey Mark Siskind, port to CHICKEN by felix winkelmann
- Initial version
Copyright 1993, 1994, and 1995 University of Toronto. All rights reserved. Copyright 1996 Technion. All rights reserved. Copyright 1996 and 1997 University of Vermont. All rights reserved. Copyright 1997, 1998, 1999, 2000, and 2001 NEC Research Institute, Inc. All rights reserved. Copyright 2002, 2003, 2004, 2005, and 2006 Purdue University. All rights reserved.
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 2 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, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.