source: project/wiki/stalin @ 7843

Last change on this file since 7843 was 7843, checked in by svnwiki, 12 years ago

Changes applied for sven (132.176.72.220) through svnwiki:

File size: 3.9 KB
Line 
1[[tags: egg]]
2
3
4== Introduction
5
6This is a port of the [[http://cobweb.ecn.purdue.edu/~qobi/software.html|Stalin]]
7to CHICKEN, that is, Stalin hosted on the CHICKEN Scheme system. Stalin
8compiles a subset of R4RS Scheme to C code, which can subsequently be compiled
9to highly efficient self-contained executables.
10
11== Requirements
12
13{{libgc}}, the [[http://www.hpl.hp.com/personal/Hans_Boehm/gc/|Boehm garbage collector]]
14must be installed and available in your linker path.
15
16== Usage
17
18  chicken-stalin [OPTION ...] FILENAME
19
20See the Stalin [[stalin.1.html|manual]] for information about the available
21command line options and general usage information.
22
23== Interfacing to CHICKEN code
24
25A preliminary and rather clunky way of interfacing Stalin code with chicken-compiled code is provided.
26The extension {{stalin-externals}} provides a macro named {{define-stalin-external}} that
27allows defining entry-points which Stalin code can call in an embedded CHICKEN-compiled library.
28
29Consider the file {{mixed.scm}}:
30
31  ; mixed.scm - CHICKEN code
32 
33  (require-extension stalin-externals)
34 
35  (define-stalin-external (foo (int x) (c-string y)) c-string
36    (print "got: " x " and " y)
37    "hello")
38 
39  (return-to-host)
40
41A Stalin application uses this interface:
42
43  ; mixed-stalin.scm
44
45  (include "mixed-externals.scm")
46 
47  (display "starting...\n")
48  (define x (foo 33 "test"))
49  (display x)
50  (newline)
51
52Compiling {{mixed.scm}} will generate two files named {{mixed-externals.scm}}
53and {{mixed-externals.h}}. The C header file is used by the Stalin foreign-procedure
54interface and {{mixed-externals.scm}} defines the calling procedures for the
55CHICKEN entry points. Now we compiled {{mixed.scm}} as an embedded (that is without
56a {{main}} function) program:
57
58  % csc -ce mixed.scm -X stalin-externals.scm
59  % chicken-stalin -On -c mixed-stalin.scm
60  % csc mixed.o mixed-stalin.c -C -I. -o mixed
61  % ./mixed
62
63== Notes
64
65* 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
66* On some systems libgc requires {{libdl}}, add {{-copt -ldl}} in this case.
67
68== Extensions
69
70The following extensions have been added to this version of stalin:
71
72* support for {{\n}} (newline), {{\r}} (carriage return), {{\t}} (tab) and {{\e}} (escape) character sequences in string literals
73* [[http://srfi.schemers.org/srfi-0||SRFI-0]] ({{cond-expand}}) The feature identifiers {{stalin}}, {{srfi-0}} and {{chicken-stalin}} are defined.
74
75== Platforms
76
77The compiler has been tested on Mac OS X 10.4 (ppc), and Linux (x86, amd64)
78
79== Limitations
80
81* The compiler is extremely slow
82* The Xlib and OpenGL interfaces provided with the original Stalin are not available
83
84== Authors
85
86Jeffrey Mark Siskind, port to CHICKEN by [[felix winkelmann]]
87
88== Version
89
90; 0.11.1 : Initial version
91
92== License
93
94 Copyright 1993, 1994, and 1995 University of Toronto. All rights reserved.
95 Copyright 1996 Technion. All rights reserved.
96 Copyright 1996 and 1997 University of Vermont. All rights reserved.
97 Copyright 1997, 1998, 1999, 2000, and 2001 NEC Research Institute, Inc. All
98 rights reserved.
99 Copyright 2002, 2003, 2004, 2005, and 2006 Purdue University. All rights
100 reserved.
101
102 This program is free software; you can redistribute it and/or
103 modify it under the terms of the GNU General Public License
104 as published by the Free Software Foundation; either version 2
105 of the License, or (at your option) any later version.
106
107 This program is distributed in the hope that it will be useful,
108 but WITHOUT ANY WARRANTY; without even the implied warranty of
109 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
110 GNU General Public License for more details.
111
112 You should have received a copy of the GNU General Public License
113 along with this program; if not, write to the Free Software
114 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
Note: See TracBrowser for help on using the repository browser.