Skip to content

Commit

Permalink
Merge pull request #474 from yamacir-kit/release-candidate
Browse files Browse the repository at this point in the history
Release candidate
  • Loading branch information
yamacir-kit authored Mar 26, 2024
2 parents 5e27098 + fe177f4 commit 0ea87fe
Show file tree
Hide file tree
Showing 159 changed files with 1,406 additions and 1,582 deletions.
10 changes: 4 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
cmake_minimum_required(VERSION 3.16.3) # Ubuntu 20.04 LTS default

execute_process(
COMMAND cat ${CMAKE_CURRENT_SOURCE_DIR}/VERSION
COMMAND tr -d "\n"
COMMAND head -c -1 ${CMAKE_CURRENT_SOURCE_DIR}/VERSION
OUTPUT_VARIABLE CURRENT_VERSION)

project(meevax
Expand All @@ -13,8 +12,7 @@ project(meevax

include(GNUInstallDirs)

string(JOIN " " AGGRESSIVE_OPTIMIZATION_OPTIONS
# "-flto" # This optimization causes a SEGV when compiling with Clang 10.
string(JOIN " " ${PROJECT_NAME}_RELEASE_PLUS
# "-fmerge-all-constants" # This optimization is very effective in reducing binary size, but non-standard to the C++ standard.
# "-march=native" # This optimization causes "Illegal instruction" error (is Valgrind's bug) on CI.
# "-mtune=native"
Expand All @@ -23,8 +21,8 @@ string(JOIN " " AGGRESSIVE_OPTIMIZATION_OPTIONS
set(CMAKE_CXX_EXTENSIONS OFF)
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
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG ${AGGRESSIVE_OPTIMIZATION_OPTIONS}")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -gdwarf-4 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -flto -DNDEBUG ${${PROJECT_NAME}_RELEASE_PLUS}")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} -gdwarf-4")
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wpedantic -pipe")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Procedures for each standard are provided by the following R7RS-style libraries:
cmake -B build -DCMAKE_BUILD_TYPE=Release
cd build
make package
sudo apt install build/meevax_0.5.119_amd64.deb
sudo apt install build/meevax_0.5.159_amd64.deb
```

or
Expand Down Expand Up @@ -123,9 +123,9 @@ sudo rm -rf /usr/local/share/meevax

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

## Usage
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.119
0.5.159
2 changes: 1 addition & 1 deletion basis/include/meevax/basis.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2018-2023 Tatsuya Yamasaki.
Copyright 2018-2024 Tatsuya Yamasaki.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
42 changes: 42 additions & 0 deletions basis/meevax.ss
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,45 @@
((cdr before/after)))
(current-dynamic-extents))
(emergency-exit . xs)))))

(define-library (meevax apply)
(import (only (meevax core) define if lambda)
(only (meevax list) append null? reverse)
(only (meevax pair) car cdr cons))

(export apply)

(begin (define (apply f x . xs)
(if (null? xs)
(f . x)
((lambda (xs)
((lambda (x)
(f . x))
(append (reverse (cdr xs))
(car xs))))
(reverse (cons x xs)))))))

(define-library (meevax map)
(import (only (meevax apply) apply)
(only (meevax core) define if quote)
(only (meevax list) memq null? reverse)
(only (meevax pair) car cdr cons))

(export map)

(begin (define (map f . xs)
(define (map f x a)
(if (null? x)
(reverse a)
(map f
(cdr x)
(cons (f (car x)) a))))
(define (map* f xs a)
(if (memq '() xs)
(reverse a)
(map* f
(map cdr xs '())
(cons (apply f (map car xs '())) a))))
(if (null? (cdr xs))
(map f (car xs) '())
(map* f xs '())))))
69 changes: 18 additions & 51 deletions basis/r4rs.ss
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
|#

(define-library (scheme r4rs)
(import (only (meevax boolean) boolean? not)
(import (only (meevax apply) apply)
(only (meevax boolean) boolean? not)
(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)
(only (meevax comparator) eq? eqv? equal?)
(only (meevax complex) make-rectangular make-polar real-part imag-part magnitude angle)
Expand All @@ -44,16 +45,18 @@
(only (meevax inexact) exp log sqrt sin cos tan asin acos atan)
(only (meevax list) null? list? list length append reverse list-tail list-ref memq memv assq assv)
(only (meevax macro-transformer) er-macro-transformer identifier?)
(only (meevax map) map)
(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)
(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)
(only (meevax port) input-port? output-port? standard-input-port standard-output-port open-input-file open-output-file close eof-object?)
(only (meevax procedure) procedure?)
(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!)
(only (meevax symbol) symbol? symbol->string string->symbol)
(only (meevax vector) vector? make-vector vector vector-length vector-ref vector-set! vector->list list->vector vector-fill!)
(prefix (only (meevax environment) load) %)
(prefix (meevax read) %)
(prefix (meevax write) %)
(prefix (only (meevax environment) load) %)
(only (srfi 39) make-parameter parameterize)
(only (srfi 45) delay force))

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

(define (every f xs)
(if (pair? xs)
(and (f (car xs))
(every f (cdr xs)))
#t))

(define (map f x . xs) ; Chibi-Scheme
(define (map f x a)
(if (pair? x)
(map f
(cdr x)
(cons (f (car x)) a))
(reverse a)))
(define (map* f xs a)
(if (every pair? xs)
(map* f
(map cdr xs '())
(cons (apply f (map car xs '())) a))
(reverse a)))
(if (null? xs)
(map f x '())
(map* f (cons x xs) '())))

(define (apply f x . xs) ; Chibi-Scheme
(letrec ((apply (lambda (f xs)
(f . xs))))
(if (null? xs)
(apply f x)
((lambda (xs)
(apply f (append (reverse (cdr xs))
(car xs))))
(reverse (cons x xs))))))

(define-syntax let ; Chibi-Scheme
(er-macro-transformer
(lambda (form rename compare)
Expand Down Expand Up @@ -310,8 +280,7 @@
(else (+ 1 fx)))))
(cond ((< y x)
(simplest-rational y x))
((not (< x y))
(if (rational? x) x (error x)))
((not (< x y)) x)
((positive? x)
(simplest-rational-internal x y))
((negative? x)
Expand Down Expand Up @@ -348,25 +317,23 @@
result))
(call-with-output-port (open-output-file path) f))

(define %current-input-port (standard-input-port))

(define (current-input-port) %current-input-port)

(define %current-output-port (standard-output-port))
(define current-input-port
(make-parameter (standard-input-port)))

(define (current-output-port) %current-output-port)
(define current-output-port
(make-parameter (standard-output-port)))

(define (with-input-from-file path thunk)
(let ((previous-input-port (current-input-port)))
(set! %current-input-port (open-input-file path))
(thunk)
(set! %current-input-port previous-input-port)))
(parameterize ((current-input-port (open-input-file path)))
(let ((result (thunk)))
(close-input-port (current-input-port))
result)))

(define (with-output-to-file path thunk)
(let ((previous-output-port (current-output-port)))
(set! %current-output-port (open-output-file path))
(thunk)
(set! %current-output-port previous-output-port)))
(parameterize ((current-output-port (open-output-file path)))
(let ((result (thunk)))
(close-output-port (current-output-port))
result)))

(define close-input-port close)

Expand Down
45 changes: 5 additions & 40 deletions basis/r7rs.ss
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
(define-library (scheme base)
(import (only (meevax core) include include-case-insensitive)
(only (meevax error) error-object? read-error? file-error?)
(only (meevax macro-transformer) er-macro-transformer)
(only (meevax list) make-list list-copy)
(only (meevax macro-transformer) er-macro-transformer)
(only (meevax number) exact-integer? exact-integer-square-root)
(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?)
(prefix (meevax read) %)
(only (meevax string) string-copy!)
(only (meevax vector homogeneous) u8vector? make-u8vector u8vector u8vector-length u8vector-ref u8vector-set! u8vector-copy u8vector-copy! u8vector-append u8vector->string string->u8vector)
(only (meevax vector) vector-append vector-copy vector-copy! vector->string string->vector)
(only (meevax version) features)
(prefix (meevax read) %)
(prefix (meevax write) %)
(scheme r5rs)
(srfi 0)
Expand Down Expand Up @@ -250,32 +250,8 @@

(define output-port-open? open?)

(define current-input-port
(make-parameter (standard-input-port)
(lambda (x)
(cond ((not (input-port? x))
(error "not an input-port" x))
((not (input-port-open? x))
(error "not an opened input-port" x))
(else x)))))

(define current-output-port
(make-parameter (standard-output-port)
(lambda (x)
(cond ((not (output-port? x))
(error "not an output-port" x))
((not (output-port-open? x))
(error "not an opened output-port" x))
(else x)))))

(define current-error-port
(make-parameter (standard-error-port)
(lambda (x)
(cond ((not (output-port? x))
(error "not an output-port" x))
((not (output-port-open? x))
(error "not an opened output-port" x))
(else x)))))
(make-parameter (standard-error-port)))

(define (close-port x)
(cond ((input-port? x) (close-input-port x))
Expand Down Expand Up @@ -440,21 +416,10 @@
(import (only (meevax file) delete-file file-exists?)
(only (meevax port) open-binary-input-file open-binary-output-file)
(only (scheme base) close-input-port close-output-port current-input-port current-output-port define parameterize)
(only (scheme r5rs) call-with-input-file call-with-output-file open-input-file open-output-file))

(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))
(export call-with-input-file call-with-output-file delete-file file-exists?
open-binary-input-file open-binary-output-file open-input-file
open-output-file with-input-from-file with-output-to-file)

(begin (define (with-input-from-file path thunk)
(parameterize ((current-input-port (open-input-file path)))
(thunk)
(close-input-port (current-input-port))))

(define (with-output-to-file path thunk)
(parameterize ((current-output-port (open-output-file path)))
(thunk)
(close-output-port (current-output-port))))))
open-output-file with-input-from-file with-output-to-file))

(define-library (scheme inexact)
(import (only (meevax inexact) finite? infinite? nan?)
Expand Down
5 changes: 2 additions & 3 deletions basis/srfi-39.ss
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@
(only (meevax core) define define-syntax if lambda letrec quote)
(only (meevax list) null? list append assq)
(only (meevax macro-transformer) er-macro-transformer)
(only (meevax pair) cons car cdr cadr cddr set-car! set-cdr!)
(only (scheme r5rs) map)
)
(only (meevax map) map)
(only (meevax pair) cons car cdr cadr cddr set-car! set-cdr!))

(export make-parameter parameterize)

Expand Down
2 changes: 1 addition & 1 deletion configure/basis.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2018-2023 Tatsuya Yamasaki.
Copyright 2018-2024 Tatsuya Yamasaki.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion configure/version.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2018-2023 Tatsuya Yamasaki.
Copyright 2018-2024 Tatsuya Yamasaki.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion include/meevax/bit/bit_cast.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2018-2023 Tatsuya Yamasaki.
Copyright 2018-2024 Tatsuya Yamasaki.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion include/meevax/bit/log2.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2018-2023 Tatsuya Yamasaki.
Copyright 2018-2024 Tatsuya Yamasaki.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion include/meevax/bitset/simple_bitset.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2018-2023 Tatsuya Yamasaki.
Copyright 2018-2024 Tatsuya Yamasaki.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion include/meevax/chrono/duration.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2018-2023 Tatsuya Yamasaki.
Copyright 2018-2024 Tatsuya Yamasaki.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion include/meevax/functional/combinator.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2018-2023 Tatsuya Yamasaki.
Copyright 2018-2024 Tatsuya Yamasaki.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion include/meevax/functional/compose.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2018-2023 Tatsuya Yamasaki.
Copyright 2018-2024 Tatsuya Yamasaki.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion include/meevax/functional/curry.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2018-2023 Tatsuya Yamasaki.
Copyright 2018-2024 Tatsuya Yamasaki.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion include/meevax/iostream/escape_sequence.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2018-2023 Tatsuya Yamasaki.
Copyright 2018-2024 Tatsuya Yamasaki.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion include/meevax/iostream/is_console.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2018-2023 Tatsuya Yamasaki.
Copyright 2018-2024 Tatsuya Yamasaki.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion include/meevax/iostream/lexical_cast.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2018-2023 Tatsuya Yamasaki.
Copyright 2018-2024 Tatsuya Yamasaki.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Loading

0 comments on commit 0ea87fe

Please sign in to comment.