From 5dc8e497315ba791c8a8de021f3d2d292566fb56 Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Sat, 20 Sep 2008 12:20:13 +0200 Subject: Link ToiletKit with the SCM continuation support code. --- GNUmakefile | 10 ++++++++-- SCM/toilet-scm.c | 33 +++++++++++++++++++++++++++++++++ Toilet Lisp.xcodeproj/project.pbxproj | 28 ++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 SCM/toilet-scm.c diff --git a/GNUmakefile b/GNUmakefile index c6bc134..41d8fb1 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -19,7 +19,7 @@ export USE_LLVM ADDITIONAL_OBJCFLAGS ADDITIONAL_LDFLAGS LLVM_CONFIG -KIT_TARGETS = ToiletKit +KIT_TARGETS = SCM/continue.o SCM/toilet-scm.o ToiletKit USE_LLVM := YES ifeq ($(USE_LLVM),YES) @@ -83,7 +83,10 @@ ToiletKit_OBJC_FILES = functions.m globals.m MLKArray.m \ MLKUnboundVariableError.m MLKValuesFunction.m \ NSObject-MLKPrinting.m NSString-MLKPrinting.m ToiletKit_OBJCFLAGS = -Wall -ToiletKit_LDFLAGS = -lgmp -lffi -ldl +ToiletKit_LDFLAGS = -lgmp -lffi -ldl SCM/continue.o SCM/toilet-scm.o + +SCM/%.o: SCM/%.c + $(CC) -o $@ -c $< $(CFLAGS) $(ToiletKit_OBJCFLAGS) $(ADDITIONAL_OBJCFLAGS) -fPIC # We copy the whole Sacla directory, because copying individual files causes them to # lose their relative path. Does anyone else think this is retarded? @@ -206,6 +209,9 @@ before-Test:: ToiletKit #after-clean:: # -rmdir $(GNUSTEP_OBJ_DIR)/StepTalkShell +after-clean:: + rm -f SCM/continue.o SCM/toilet-scm.o + ifneq ($(BUILD_TOILET_LLVM),YES) after-clean:: $(MAKE) clean shared=no BUILD_TOILET_LLVM=YES diff --git a/SCM/toilet-scm.c b/SCM/toilet-scm.c new file mode 100644 index 0000000..b3f2f12 --- /dev/null +++ b/SCM/toilet-scm.c @@ -0,0 +1,33 @@ +/* -*- mode: objc; coding: utf-8 -*- */ +/* Toilet Lisp, a Common Lisp subset for the Étoilé runtime. + * Copyright (C) 2008 Matthias Andreas Benkard. + * + * 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 . + */ + +#include +#include + +char s_call_cc[] = "call-with-current-continuation"; + +char *must_malloc (size_t len, const char *what) +{ + return (char *)malloc(len); +} + +void must_free (char *obj, size_t len) +{ + if (obj) + free(obj); +} diff --git a/Toilet Lisp.xcodeproj/project.pbxproj b/Toilet Lisp.xcodeproj/project.pbxproj index af3a8bc..59d2770 100644 --- a/Toilet Lisp.xcodeproj/project.pbxproj +++ b/Toilet Lisp.xcodeproj/project.pbxproj @@ -173,6 +173,13 @@ A7E5C4A10E216C0F00A01D81 /* MLKNumber.m in Sources */ = {isa = PBXBuildFile; fileRef = A7E5C49F0E216C0F00A01D81 /* MLKNumber.m */; }; A7E5C55C0E21740C00A01D81 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7E5C55B0E21740C00A01D81 /* Foundation.framework */; }; A7E5C55D0E21740C00A01D81 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7E5C55B0E21740C00A01D81 /* Foundation.framework */; }; + A7EEFFD30E84FF650024E903 /* continue.c in Sources */ = {isa = PBXBuildFile; fileRef = A7EEFFD20E84FF650024E903 /* continue.c */; }; + A7EEFFD90E84FF7C0024E903 /* continue.h in Headers */ = {isa = PBXBuildFile; fileRef = A7EEFFD40E84FF7C0024E903 /* continue.h */; }; + A7EEFFDA0E84FF7C0024E903 /* scm.h in Headers */ = {isa = PBXBuildFile; fileRef = A7EEFFD50E84FF7C0024E903 /* scm.h */; }; + A7EEFFDB0E84FF7C0024E903 /* scmfig.h in Headers */ = {isa = PBXBuildFile; fileRef = A7EEFFD60E84FF7C0024E903 /* scmfig.h */; }; + A7EEFFDC0E84FF7C0024E903 /* scmflags.h in Headers */ = {isa = PBXBuildFile; fileRef = A7EEFFD70E84FF7C0024E903 /* scmflags.h */; }; + A7EEFFDD0E84FF7C0024E903 /* setjump.h in Headers */ = {isa = PBXBuildFile; fileRef = A7EEFFD80E84FF7C0024E903 /* setjump.h */; }; + A7EEFFED0E85025A0024E903 /* toilet-scm.c in Sources */ = {isa = PBXBuildFile; fileRef = A7EEFFEC0E85025A0024E903 /* toilet-scm.c */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -457,6 +464,13 @@ A7E5C49E0E216C0F00A01D81 /* MLKNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MLKNumber.h; sourceTree = ""; }; A7E5C49F0E216C0F00A01D81 /* MLKNumber.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MLKNumber.m; sourceTree = ""; }; A7E5C55B0E21740C00A01D81 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + A7EEFFD20E84FF650024E903 /* continue.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = continue.c; path = SCM/continue.c; sourceTree = ""; }; + A7EEFFD40E84FF7C0024E903 /* continue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = continue.h; path = SCM/continue.h; sourceTree = ""; }; + A7EEFFD50E84FF7C0024E903 /* scm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = scm.h; path = SCM/scm.h; sourceTree = ""; }; + A7EEFFD60E84FF7C0024E903 /* scmfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = scmfig.h; path = SCM/scmfig.h; sourceTree = ""; }; + A7EEFFD70E84FF7C0024E903 /* scmflags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = scmflags.h; path = SCM/scmflags.h; sourceTree = ""; }; + A7EEFFD80E84FF7C0024E903 /* setjump.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = setjump.h; path = SCM/setjump.h; sourceTree = ""; }; + A7EEFFEC0E85025A0024E903 /* toilet-scm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "toilet-scm.c"; path = "SCM/toilet-scm.c"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -607,6 +621,11 @@ A7E5C48C0E2169CE00A01D81 /* Headers */ = { isa = PBXGroup; children = ( + A7EEFFD40E84FF7C0024E903 /* continue.h */, + A7EEFFD50E84FF7C0024E903 /* scm.h */, + A7EEFFD60E84FF7C0024E903 /* scmfig.h */, + A7EEFFD70E84FF7C0024E903 /* scmflags.h */, + A7EEFFD80E84FF7C0024E903 /* setjump.h */, A7A8628C0E6E775F00021916 /* MLKNoSuchSymbolError.h */, A7A8628E0E6E776000021916 /* MLKStreamError.h */, A7A862900E6E776000021916 /* MLKUnboundVariableError.h */, @@ -675,6 +694,8 @@ A7E5C48D0E216A0E00A01D81 /* Source Files */ = { isa = PBXGroup; children = ( + A7EEFFEC0E85025A0024E903 /* toilet-scm.c */, + A7EEFFD20E84FF650024E903 /* continue.c */, A7A8628D0E6E776000021916 /* MLKNoSuchSymbolError.m */, A7A8628F0E6E776000021916 /* MLKStreamError.m */, A7A862910E6E776000021916 /* MLKUnboundVariableError.m */, @@ -805,6 +826,11 @@ A7A862920E6E776000021916 /* MLKNoSuchSymbolError.h in Headers */, A7A862940E6E776000021916 /* MLKStreamError.h in Headers */, A7A862960E6E776000021916 /* MLKUnboundVariableError.h in Headers */, + A7EEFFD90E84FF7C0024E903 /* continue.h in Headers */, + A7EEFFDA0E84FF7C0024E903 /* scm.h in Headers */, + A7EEFFDB0E84FF7C0024E903 /* scmfig.h in Headers */, + A7EEFFDC0E84FF7C0024E903 /* scmflags.h in Headers */, + A7EEFFDD0E84FF7C0024E903 /* setjump.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1015,6 +1041,8 @@ A7A862930E6E776000021916 /* MLKNoSuchSymbolError.m in Sources */, A7A862950E6E776000021916 /* MLKStreamError.m in Sources */, A7A862970E6E776000021916 /* MLKUnboundVariableError.m in Sources */, + A7EEFFD30E84FF650024E903 /* continue.c in Sources */, + A7EEFFED0E85025A0024E903 /* toilet-scm.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; -- cgit v1.2.3