Skip to content

Commit 0ea87fe

Browse files
authored
Merge pull request #474 from yamacir-kit/release-candidate
Release candidate
2 parents 5e27098 + fe177f4 commit 0ea87fe

File tree

159 files changed

+1406
-1582
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+1406
-1582
lines changed

CMakeLists.txt

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
cmake_minimum_required(VERSION 3.16.3) # Ubuntu 20.04 LTS default
22

33
execute_process(
4-
COMMAND cat ${CMAKE_CURRENT_SOURCE_DIR}/VERSION
5-
COMMAND tr -d "\n"
4+
COMMAND head -c -1 ${CMAKE_CURRENT_SOURCE_DIR}/VERSION
65
OUTPUT_VARIABLE CURRENT_VERSION)
76

87
project(meevax
@@ -13,8 +12,7 @@ project(meevax
1312

1413
include(GNUInstallDirs)
1514

16-
string(JOIN " " AGGRESSIVE_OPTIMIZATION_OPTIONS
17-
# "-flto" # This optimization causes a SEGV when compiling with Clang 10.
15+
string(JOIN " " ${PROJECT_NAME}_RELEASE_PLUS
1816
# "-fmerge-all-constants" # This optimization is very effective in reducing binary size, but non-standard to the C++ standard.
1917
# "-march=native" # This optimization causes "Illegal instruction" error (is Valgrind's bug) on CI.
2018
# "-mtune=native"
@@ -23,8 +21,8 @@ string(JOIN " " AGGRESSIVE_OPTIMIZATION_OPTIONS
2321
set(CMAKE_CXX_EXTENSIONS OFF)
2422
set(CMAKE_CXX_FLAGS_DEBUG "-Og -gdwarf-4") # NOTE: The `-gdwarf-4` option is set due to the following issues with Clang 14 and Valgrind versions below 3.20: https://bugzilla.mozilla.org/show_bug.cgi?id=1758782
2523
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
26-
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG ${AGGRESSIVE_OPTIMIZATION_OPTIONS}")
27-
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -gdwarf-4 -DNDEBUG")
24+
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -flto -DNDEBUG ${${PROJECT_NAME}_RELEASE_PLUS}")
25+
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} -gdwarf-4")
2826
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wpedantic -pipe")
2927
set(CMAKE_CXX_STANDARD 17)
3028
set(CMAKE_CXX_STANDARD_REQUIRED ON)

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Procedures for each standard are provided by the following R7RS-style libraries:
9191
cmake -B build -DCMAKE_BUILD_TYPE=Release
9292
cd build
9393
make package
94-
sudo apt install build/meevax_0.5.119_amd64.deb
94+
sudo apt install build/meevax_0.5.159_amd64.deb
9595
```
9696

9797
or
@@ -123,9 +123,9 @@ sudo rm -rf /usr/local/share/meevax
123123

124124
| Target Name | Description
125125
|-------------|-------------
126-
| `all` | Build shared-library `libmeevax.0.5.119.so` and executable `meevax`
126+
| `all` | Build shared-library `libmeevax.0.5.159.so` and executable `meevax`
127127
| `test` | Test executable `meevax`
128-
| `package` | Generate debian package `meevax_0.5.119_amd64.deb`
128+
| `package` | Generate debian package `meevax_0.5.159_amd64.deb`
129129
| `install` | Copy files into `/usr/local` directly
130130

131131
## Usage

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.5.119
1+
0.5.159

basis/include/meevax/basis.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2018-2023 Tatsuya Yamasaki.
2+
Copyright 2018-2024 Tatsuya Yamasaki.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

basis/meevax.ss

+42
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,45 @@
9898
((cdr before/after)))
9999
(current-dynamic-extents))
100100
(emergency-exit . xs)))))
101+
102+
(define-library (meevax apply)
103+
(import (only (meevax core) define if lambda)
104+
(only (meevax list) append null? reverse)
105+
(only (meevax pair) car cdr cons))
106+
107+
(export apply)
108+
109+
(begin (define (apply f x . xs)
110+
(if (null? xs)
111+
(f . x)
112+
((lambda (xs)
113+
((lambda (x)
114+
(f . x))
115+
(append (reverse (cdr xs))
116+
(car xs))))
117+
(reverse (cons x xs)))))))
118+
119+
(define-library (meevax map)
120+
(import (only (meevax apply) apply)
121+
(only (meevax core) define if quote)
122+
(only (meevax list) memq null? reverse)
123+
(only (meevax pair) car cdr cons))
124+
125+
(export map)
126+
127+
(begin (define (map f . xs)
128+
(define (map f x a)
129+
(if (null? x)
130+
(reverse a)
131+
(map f
132+
(cdr x)
133+
(cons (f (car x)) a))))
134+
(define (map* f xs a)
135+
(if (memq '() xs)
136+
(reverse a)
137+
(map* f
138+
(map cdr xs '())
139+
(cons (apply f (map car xs '())) a))))
140+
(if (null? (cdr xs))
141+
(map f (car xs) '())
142+
(map* f xs '())))))

basis/r4rs.ss

+18-51
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
|#
3636

3737
(define-library (scheme r4rs)
38-
(import (only (meevax boolean) boolean? not)
38+
(import (only (meevax apply) apply)
39+
(only (meevax boolean) boolean? not)
3940
(only (meevax character) char? char=? char<? char>? char<=? char>=? char-ci=? char-ci<? char-ci>? char-ci<=? char-ci>=? char-alphabetic? char-numeric? char-whitespace? char-upper-case? char-lower-case? char->integer integer->char char-upcase char-downcase)
4041
(only (meevax comparator) eq? eqv? equal?)
4142
(only (meevax complex) make-rectangular make-polar real-part imag-part magnitude angle)
@@ -44,16 +45,18 @@
4445
(only (meevax inexact) exp log sqrt sin cos tan asin acos atan)
4546
(only (meevax list) null? list? list length append reverse list-tail list-ref memq memv assq assv)
4647
(only (meevax macro-transformer) er-macro-transformer identifier?)
48+
(only (meevax map) map)
4749
(only (meevax number) number? complex? real? rational? integer? exact? inexact? = < > <= >= zero? positive? negative? odd? even? max min + * - / abs quotient remainder modulo gcd lcm numerator denominator floor ceiling truncate round expt exact inexact number->string string->number)
4850
(only (meevax pair) pair? cons car cdr set-car! set-cdr! caar cadr cdar cddr caaar caadr cadar caddr cdaar cdadr cddar cdddr caaaar caaadr caadar caaddr cadaar cadadr caddar cadddr cdaaar cdaadr cdadar cdaddr cddaar cddadr cdddar cddddr)
4951
(only (meevax port) input-port? output-port? standard-input-port standard-output-port open-input-file open-output-file close eof-object?)
5052
(only (meevax procedure) procedure?)
5153
(only (meevax string) string? make-string string string-length string-ref string-set! string=? string<? string>? string<=? string>=? string-ci=? string-ci<? string-ci>? string-ci<=? string-ci>=? string-append string->list list->string string-copy string-fill!)
5254
(only (meevax symbol) symbol? symbol->string string->symbol)
5355
(only (meevax vector) vector? make-vector vector vector-length vector-ref vector-set! vector->list list->vector vector-fill!)
54-
(prefix (only (meevax environment) load) %)
5556
(prefix (meevax read) %)
5657
(prefix (meevax write) %)
58+
(prefix (only (meevax environment) load) %)
59+
(only (srfi 39) make-parameter parameterize)
5760
(only (srfi 45) delay force))
5861

5962
(export quote lambda if set! cond case and or let let* letrec begin do delay
@@ -183,39 +186,6 @@
183186
(else x)))
184187
(expand (cadr form) 0))))
185188

186-
(define (every f xs)
187-
(if (pair? xs)
188-
(and (f (car xs))
189-
(every f (cdr xs)))
190-
#t))
191-
192-
(define (map f x . xs) ; Chibi-Scheme
193-
(define (map f x a)
194-
(if (pair? x)
195-
(map f
196-
(cdr x)
197-
(cons (f (car x)) a))
198-
(reverse a)))
199-
(define (map* f xs a)
200-
(if (every pair? xs)
201-
(map* f
202-
(map cdr xs '())
203-
(cons (apply f (map car xs '())) a))
204-
(reverse a)))
205-
(if (null? xs)
206-
(map f x '())
207-
(map* f (cons x xs) '())))
208-
209-
(define (apply f x . xs) ; Chibi-Scheme
210-
(letrec ((apply (lambda (f xs)
211-
(f . xs))))
212-
(if (null? xs)
213-
(apply f x)
214-
((lambda (xs)
215-
(apply f (append (reverse (cdr xs))
216-
(car xs))))
217-
(reverse (cons x xs))))))
218-
219189
(define-syntax let ; Chibi-Scheme
220190
(er-macro-transformer
221191
(lambda (form rename compare)
@@ -310,8 +280,7 @@
310280
(else (+ 1 fx)))))
311281
(cond ((< y x)
312282
(simplest-rational y x))
313-
((not (< x y))
314-
(if (rational? x) x (error x)))
283+
((not (< x y)) x)
315284
((positive? x)
316285
(simplest-rational-internal x y))
317286
((negative? x)
@@ -348,25 +317,23 @@
348317
result))
349318
(call-with-output-port (open-output-file path) f))
350319

351-
(define %current-input-port (standard-input-port))
352-
353-
(define (current-input-port) %current-input-port)
354-
355-
(define %current-output-port (standard-output-port))
320+
(define current-input-port
321+
(make-parameter (standard-input-port)))
356322

357-
(define (current-output-port) %current-output-port)
323+
(define current-output-port
324+
(make-parameter (standard-output-port)))
358325

359326
(define (with-input-from-file path thunk)
360-
(let ((previous-input-port (current-input-port)))
361-
(set! %current-input-port (open-input-file path))
362-
(thunk)
363-
(set! %current-input-port previous-input-port)))
327+
(parameterize ((current-input-port (open-input-file path)))
328+
(let ((result (thunk)))
329+
(close-input-port (current-input-port))
330+
result)))
364331

365332
(define (with-output-to-file path thunk)
366-
(let ((previous-output-port (current-output-port)))
367-
(set! %current-output-port (open-output-file path))
368-
(thunk)
369-
(set! %current-output-port previous-output-port)))
333+
(parameterize ((current-output-port (open-output-file path)))
334+
(let ((result (thunk)))
335+
(close-output-port (current-output-port))
336+
result)))
370337

371338
(define close-input-port close)
372339

basis/r7rs.ss

+5-40
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
(define-library (scheme base)
22
(import (only (meevax core) include include-case-insensitive)
33
(only (meevax error) error-object? read-error? file-error?)
4-
(only (meevax macro-transformer) er-macro-transformer)
54
(only (meevax list) make-list list-copy)
5+
(only (meevax macro-transformer) er-macro-transformer)
66
(only (meevax number) exact-integer? exact-integer-square-root)
77
(only (meevax port) binary-port? eof-object flush get-output-u8vector open-input-u8vector open-output-u8vector open? port? standard-error-port standard-input-port standard-output-port textual-port?)
8-
(prefix (meevax read) %)
98
(only (meevax string) string-copy!)
109
(only (meevax vector homogeneous) u8vector? make-u8vector u8vector u8vector-length u8vector-ref u8vector-set! u8vector-copy u8vector-copy! u8vector-append u8vector->string string->u8vector)
1110
(only (meevax vector) vector-append vector-copy vector-copy! vector->string string->vector)
1211
(only (meevax version) features)
12+
(prefix (meevax read) %)
1313
(prefix (meevax write) %)
1414
(scheme r5rs)
1515
(srfi 0)
@@ -250,32 +250,8 @@
250250

251251
(define output-port-open? open?)
252252

253-
(define current-input-port
254-
(make-parameter (standard-input-port)
255-
(lambda (x)
256-
(cond ((not (input-port? x))
257-
(error "not an input-port" x))
258-
((not (input-port-open? x))
259-
(error "not an opened input-port" x))
260-
(else x)))))
261-
262-
(define current-output-port
263-
(make-parameter (standard-output-port)
264-
(lambda (x)
265-
(cond ((not (output-port? x))
266-
(error "not an output-port" x))
267-
((not (output-port-open? x))
268-
(error "not an opened output-port" x))
269-
(else x)))))
270-
271253
(define current-error-port
272-
(make-parameter (standard-error-port)
273-
(lambda (x)
274-
(cond ((not (output-port? x))
275-
(error "not an output-port" x))
276-
((not (output-port-open? x))
277-
(error "not an opened output-port" x))
278-
(else x)))))
254+
(make-parameter (standard-error-port)))
279255

280256
(define (close-port x)
281257
(cond ((input-port? x) (close-input-port x))
@@ -440,21 +416,10 @@
440416
(import (only (meevax file) delete-file file-exists?)
441417
(only (meevax port) open-binary-input-file open-binary-output-file)
442418
(only (scheme base) close-input-port close-output-port current-input-port current-output-port define parameterize)
443-
(only (scheme r5rs) call-with-input-file call-with-output-file open-input-file open-output-file))
444-
419+
(only (scheme r5rs) call-with-input-file call-with-output-file open-input-file open-output-file with-input-from-file with-output-to-file))
445420
(export call-with-input-file call-with-output-file delete-file file-exists?
446421
open-binary-input-file open-binary-output-file open-input-file
447-
open-output-file with-input-from-file with-output-to-file)
448-
449-
(begin (define (with-input-from-file path thunk)
450-
(parameterize ((current-input-port (open-input-file path)))
451-
(thunk)
452-
(close-input-port (current-input-port))))
453-
454-
(define (with-output-to-file path thunk)
455-
(parameterize ((current-output-port (open-output-file path)))
456-
(thunk)
457-
(close-output-port (current-output-port))))))
422+
open-output-file with-input-from-file with-output-to-file))
458423

459424
(define-library (scheme inexact)
460425
(import (only (meevax inexact) finite? infinite? nan?)

basis/srfi-39.ss

+2-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@
2626
(only (meevax core) define define-syntax if lambda letrec quote)
2727
(only (meevax list) null? list append assq)
2828
(only (meevax macro-transformer) er-macro-transformer)
29-
(only (meevax pair) cons car cdr cadr cddr set-car! set-cdr!)
30-
(only (scheme r5rs) map)
31-
)
29+
(only (meevax map) map)
30+
(only (meevax pair) cons car cdr cadr cddr set-car! set-cdr!))
3231

3332
(export make-parameter parameterize)
3433

configure/basis.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2018-2023 Tatsuya Yamasaki.
2+
Copyright 2018-2024 Tatsuya Yamasaki.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

configure/version.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2018-2023 Tatsuya Yamasaki.
2+
Copyright 2018-2024 Tatsuya Yamasaki.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

include/meevax/bit/bit_cast.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2018-2023 Tatsuya Yamasaki.
2+
Copyright 2018-2024 Tatsuya Yamasaki.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

include/meevax/bit/log2.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2018-2023 Tatsuya Yamasaki.
2+
Copyright 2018-2024 Tatsuya Yamasaki.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

include/meevax/bitset/simple_bitset.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2018-2023 Tatsuya Yamasaki.
2+
Copyright 2018-2024 Tatsuya Yamasaki.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

include/meevax/chrono/duration.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2018-2023 Tatsuya Yamasaki.
2+
Copyright 2018-2024 Tatsuya Yamasaki.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

include/meevax/functional/combinator.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2018-2023 Tatsuya Yamasaki.
2+
Copyright 2018-2024 Tatsuya Yamasaki.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

include/meevax/functional/compose.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2018-2023 Tatsuya Yamasaki.
2+
Copyright 2018-2024 Tatsuya Yamasaki.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

include/meevax/functional/curry.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2018-2023 Tatsuya Yamasaki.
2+
Copyright 2018-2024 Tatsuya Yamasaki.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

include/meevax/iostream/escape_sequence.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2018-2023 Tatsuya Yamasaki.
2+
Copyright 2018-2024 Tatsuya Yamasaki.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

include/meevax/iostream/is_console.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2018-2023 Tatsuya Yamasaki.
2+
Copyright 2018-2024 Tatsuya Yamasaki.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

include/meevax/iostream/lexical_cast.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2018-2023 Tatsuya Yamasaki.
2+
Copyright 2018-2024 Tatsuya Yamasaki.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)