Skip to content

Commit 4c343c0

Browse files
committed
Fix bug in read. Support executing all regression tests. Update LispKit version to 1.6.
1 parent 2dde718 commit 4c343c0

File tree

12 files changed

+78
-17
lines changed

12 files changed

+78
-17
lines changed

CHANGELOG.md

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
# Changelog
22

3-
## 1.5.5 (2018-11-18)
4-
TODO
3+
## 1.6 (2019-01-04)
4+
- New libraries: `(lispkit log)`, `(lispkit char-set)`, `(scheme char)`, `(srfi 14 ascii)`, `(srfi 101)`, `(srfi 125)`
5+
- Support Scheme libraries from R7RS large/Red edition: `(scheme box)`, `(scheme charset)`,
6+
`(scheme comparator)`, `(scheme generator)`,
7+
`(scheme hash-table)`, `(scheme ideque)`, `(scheme list)`, `(scheme rlist)`, `(scheme set)`,
8+
`(scheme sort)`, `(scheme stream)`, `(scheme text)`, `(scheme vector)`
9+
- Extended library `(lispkit test)`: support nested test groups, approximate tests, and handle exceptions correctly
10+
- Handle closing of ports correctly in library `(lispkit port)`
11+
- Fix major bug in library `(lispkit system)` affecting the composition of file paths
12+
- Bug fixes affecting `fold-left`, `max`, `min`, `numerator`, `denominator`, `log`, `magnitude`, `gcd` and `lcm`, as well as the escaping of symbols
13+
- Move from `#\dx????` syntax to `#\x????` to represent character literals
14+
- Return more user-friendly error messages for operating system errors
515

616
## 1.5.4 (2018-11-03)
717
- Migrated project to Xcode 10.1 and ported code to Swift 4.2.1

LispKit.xcodeproj/project.pbxproj

+4
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
CC436C421FFD96800095559E /* Logic.scm in Resources */ = {isa = PBXBuildFile; fileRef = CC436C411FFD94870095559E /* Logic.scm */; };
6969
CC4385BC20BABAA600055289 /* HTTP.scm in Copy examples */ = {isa = PBXBuildFile; fileRef = CC4385BB20BAB79500055289 /* HTTP.scm */; };
7070
CC4385BE20BB5F3400055289 /* Compiler.scm in Copy examples */ = {isa = PBXBuildFile; fileRef = CC4385BD20BB5EE200055289 /* Compiler.scm */; };
71+
CC44E5B221DECD7B0009969C /* All.scm in Copy tests */ = {isa = PBXBuildFile; fileRef = CC44E5B121DECB850009969C /* All.scm */; };
7172
CC4575C620F00C4400116F0F /* DrawingLibrary.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC4575C520F00C4400116F0F /* DrawingLibrary.swift */; };
7273
CC4575C820F00EE000116F0F /* Color.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC4575C720F00EE000116F0F /* Color.swift */; };
7374
CC474EAF1ECFAC3F00B535E3 /* Pi.scm in Copy examples */ = {isa = PBXBuildFile; fileRef = CCFBE5C31ECBA8DA0032254B /* Pi.scm */; };
@@ -283,6 +284,7 @@
283284
dstPath = LispKit/Resources/Tests;
284285
dstSubfolderSpec = 7;
285286
files = (
287+
CC44E5B221DECD7B0009969C /* All.scm in Copy tests */,
286288
CC54924721DCDFE2004A0652 /* SRFI-14-Tests.scm in Copy tests */,
287289
CC54923B21D9828B004A0652 /* SRFI-101-Tests.scm in Copy tests */,
288290
CC2C73DF21A22D2B00B18661 /* SRFI-125-Tests.scm in Copy tests */,
@@ -620,6 +622,7 @@
620622
CC436C411FFD94870095559E /* Logic.scm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Logic.scm; sourceTree = "<group>"; };
621623
CC4385BB20BAB79500055289 /* HTTP.scm */ = {isa = PBXFileReference; lastKnownFileType = text; path = HTTP.scm; sourceTree = "<group>"; };
622624
CC4385BD20BB5EE200055289 /* Compiler.scm */ = {isa = PBXFileReference; lastKnownFileType = text; path = Compiler.scm; sourceTree = "<group>"; };
625+
CC44E5B121DECB850009969C /* All.scm */ = {isa = PBXFileReference; lastKnownFileType = text; path = All.scm; sourceTree = "<group>"; };
623626
CC4575C520F00C4400116F0F /* DrawingLibrary.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DrawingLibrary.swift; sourceTree = "<group>"; };
624627
CC4575C720F00EE000116F0F /* Color.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Color.swift; sourceTree = "<group>"; };
625628
CC474EB01ED0390200B535E3 /* Queens.scm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Queens.scm; sourceTree = "<group>"; };
@@ -859,6 +862,7 @@
859862
CC09ECF12198B7D300F84713 /* Tests */ = {
860863
isa = PBXGroup;
861864
children = (
865+
CC44E5B121DECB850009969C /* All.scm */,
862866
CC09ECF22198B87200F84713 /* R7RS-Tests.scm */,
863867
CC54924421DCDEA1004A0652 /* SRFI-14-Tests.scm */,
864868
CC54923A21D9823B004A0652 /* SRFI-101-Tests.scm */,

Sources/LispKit/Data/Equality.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ struct Equality: Hashable {
3434
}
3535

3636
func hash(into hasher: inout Hasher) {
37-
hasher.combine(ref1.hashValue &+ ref2.hashValue)
37+
let value: Int = ObjectIdentifier(ref1).hashValue ^ ObjectIdentifier(ref2).hashValue
38+
hasher.combine(value)
3839
}
3940

4041
static func ==(lhs: Equality, rhs: Equality) -> Bool {

Sources/LispKit/IO/TextInput.swift

+7
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ open class TextInput {
9999
return self.buffer[self.next]
100100
}
101101

102+
open func unread() {
103+
guard self.next > self.buffer.startIndex else {
104+
return
105+
}
106+
self.next = self.buffer.index(before: self.next)
107+
}
108+
102109
open func readString(_ n: Int) -> String? {
103110
assert(n >= 0, "TextInput.readString called with negative count")
104111
guard n > 0 else {

Sources/LispKit/Info.plist

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
<key>CFBundlePackageType</key>
2121
<string>FMWK</string>
2222
<key>CFBundleShortVersionString</key>
23-
<string>1.5.5</string>
23+
<string>1.6</string>
2424
<key>CFBundleSignature</key>
2525
<string>????</string>
2626
<key>CFBundleVersion</key>
2727
<string>$(CURRENT_PROJECT_VERSION)</string>
2828
<key>NSHumanReadableCopyright</key>
29-
<string>Copyright © 2016–2018 Matthias Zenger. All rights reserved.</string>
29+
<string>Copyright © 2016–2019 Matthias Zenger. All rights reserved.</string>
3030
<key>NSPrincipalClass</key>
3131
<string></string>
3232
</dict>

Sources/LispKit/Primitives/BytevectorLibrary.swift

+8-2
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,14 @@ public final class BytevectorLibrary: NativeLibrary {
169169
guard toStart + end - start - 1 < toVec.value.count else {
170170
throw RuntimeError.eval(.targetBytevectorTooSmall, to)
171171
}
172-
for i in start..<end {
173-
toVec.value[toStart + i - start] = fromVec.value[i]
172+
if toStart <= start {
173+
for i in start..<end {
174+
toVec.value[toStart + i - start] = fromVec.value[i]
175+
}
176+
} else if toStart > start {
177+
for i in (start..<end).reversed() {
178+
toVec.value[toStart + i - start] = fromVec.value[i]
179+
}
174180
}
175181
return .void
176182
}

Sources/LispKit/Primitives/PortLibrary.swift

+6-1
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,12 @@ public final class PortLibrary: NativeLibrary {
408408
let input = try self.textInputFrom(expr, open: true)
409409
let parser = Parser(symbols: self.context.symbols, input: input)
410410
do {
411-
return try parser.parse(false).datum
411+
let res = try parser.parse(false).datum
412+
if case .eof = res {
413+
return res
414+
}
415+
input.unread() // put the look-ahead character back into the input stream
416+
return res
412417
} catch let error as RuntimeError {
413418
guard case .syntax(.empty) = error.descriptor else {
414419
throw error
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
;;; LISPKIT REGRESSION TEST SUITE
2+
;;;
3+
;;; Author: Matthias Zenger
4+
;;; Copyright © 2019 Matthias Zenger. All rights reserved.
5+
;;;
6+
;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
7+
;;; except in compliance with the License. You may obtain a copy of the License at
8+
;;;
9+
;;; http://www.apache.org/licenses/LICENSE-2.0
10+
;;;
11+
;;; Unless required by applicable law or agreed to in writing, software distributed under the
12+
;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13+
;;; either express or implied. See the License for the specific language governing permissions
14+
;;; and limitations under the License.
15+
16+
(import (lispkit base)
17+
(lispkit test))
18+
19+
(test-begin "LispKit regression tests")
20+
21+
(load "Tests/R7RS-Tests")
22+
(load "Tests/SRFI-14-Tests")
23+
(load "Tests/SRFI-101-Tests")
24+
(load "Tests/SRFI-125-Tests")
25+
26+
(test-end)
27+
28+
;; Current number of failures: 26 (all from R7RS-Tests)

Sources/LispKit/Resources/Tests/SRFI-14-Tests.scm

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
(define (vowel? c) (member c '(#\a #\e #\i #\o #\u)))
3838

39-
(test-begin "srfi-14: char-sets")
39+
(test-begin "SRFI 14: Character sets")
4040

4141
(test-not (char-set? 5))
4242

Sources/LispKitRepl/AppInfo.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// LispKit
44
//
55
// Created by Matthias Zenger on 05/05/2016.
6-
// Copyright © 2016-2018 ObjectHub. All rights reserved.
6+
// Copyright © 2016-2019 ObjectHub. All rights reserved.
77
//
88
// Licensed under the Apache License, Version 2.0 (the "License");
99
// you may not use this file except in compliance with the License.
@@ -32,7 +32,7 @@ public struct AppInfo {
3232
// Version of the application
3333
public static let version =
3434
(Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String) ??
35-
"2.0.3"
35+
"2.0.4"
3636

3737
// Copyright message
3838
public static let copyright =

Sources/LispKitRepl/Info.plist

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
<key>CFBundlePackageType</key>
2121
<string>APPL</string>
2222
<key>CFBundleShortVersionString</key>
23-
<string>2.0.3</string>
23+
<string>2.0.4</string>
2424
<key>CFBundleSignature</key>
2525
<string>????</string>
2626
<key>CFBundleVersion</key>
27-
<string>2.0.3</string>
27+
<string>2.0.4</string>
2828
<key>LSMinimumSystemVersion</key>
2929
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
3030
<key>NSHumanReadableCopyright</key>
31-
<string>Copyright © 2016–2018 Matthias Zenger. All rights reserved.</string>
31+
<string>Copyright © 2016–2019 Matthias Zenger. All rights reserved.</string>
3232
</dict>
3333
</plist>

Sources/LispKitRepl/main.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// LispKitRepl
44
//
55
// Created by Matthias Zenger on 14/04/2016.
6-
// Copyright © 2016-2018 ObjectHub. All rights reserved.
6+
// Copyright © 2016-2019 ObjectHub. All rights reserved.
77
//
88
// Licensed under the Apache License, Version 2.0 (the "License");
99
// you may not use this file except in compliance with the License.
@@ -123,7 +123,7 @@ var cmdLineArgs = flags.parameters.isEmpty ? [CommandLine.arguments.first!] : fl
123123
#if SPM
124124
let context = Context(console: console,
125125
implementationName: "LispKit",
126-
implementationVersion: "1.5.5",
126+
implementationVersion: "1.6",
127127
commandLineArguments: cmdLineArgs,
128128
includeInternalResources: false,
129129
includeDocumentPath: searchDocs.wasSet ? "LispKit" : nil)
@@ -142,7 +142,7 @@ if !searchDocs.wasSet {
142142
.appendingPathComponent("lib", isDirectory: true)
143143
_ = context.fileHandler.addSearchPath(rootUrl.path)
144144
_ = context.fileHandler.addLibrarySearchPath(rootUrl
145-
.appendingPathComponent("Libraries", isDirectory: true).path)
145+
.appendingPathComponent("Libraries", isDirectory: true).path)
146146
if !prelude.wasSet {
147147
prelude.value = rootUrl.appendingPathComponent("Libraries", isDirectory: true)
148148
.appendingPathComponent("Prelude.scm", isDirectory: false).path

0 commit comments

Comments
 (0)