-
Notifications
You must be signed in to change notification settings - Fork 7
/
cl-forth.asd
99 lines (94 loc) · 4.21 KB
/
cl-forth.asd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
;;; -*- Syntax: Common-Lisp; Base: 10 -*-
;;;
;;; Copyright (c) 2024 Gary Palter
;;;
;;; Licensed under the MIT License;
;;; you may not use this file except in compliance with the License.
;;; You may obtain a copy of the License at
;;;
;;; https://opensource.org/license/mit
(in-package #:asdf/user)
(defsystem #:cl-forth
:long-name "CL-Forth"
:description "Forth interpreter"
:version (:read-file-line "version.text")
:serial t
:depends-on (#:cffi #:trivial-gray-streams)
:components ((:file "packages")
(:file "in-memory-streams")
(:file "prefixed-stream" :if-feature (:not :ccl))
(:file "timestamped-stream" :if-feature (:not :ccl))
(:file "compatibility")
(:file "exceptions")
(:file "strings")
(:file "numbers")
(:file "memory")
(:file "stacks")
(:file "words")
(:file "files")
(:file "execution-tokens")
(:file "ffi")
(:file "optimizer")
(:file "system")
(:file "templates")
(:file "helpers")
(:file "asdf-support")
(:file "run")
(:module "forth-words"
:serial nil
:components ((:file "core")
(:file "environment")
(:file "double")
(:file "exceptions")
(:file "facility")
(:file "files")
(:file "float")
(:file "locals")
(:file "memory")
(:file "tools")
(:file "search")
(:file "strings")
(:file "ffi")
;; Useful words not defined in Forth 2012
(:file "extensions"))))
:in-order-to ((test-op (test-op #:cl-forth/test))))
#+SBCL
;;; Suppress compiler notes until I have time to figure out how to resolve them
(defmethod perform :around ((o compile-op) (c cl-source-file))
(handler-bind ((sb-ext:compiler-note #'(lambda (c)
(declare (ignore c))
(invoke-restart 'muffle-warning))))
(call-next-method)))
(defsystem #:cl-forth/application
:long-name "CL-Forth App"
:description "CL-Forth standalone application"
:version (:read-file-line "version.text")
:depends-on (#:cl-forth)
:serial t
:components ((:file "ccl-application" :if-feature :ccl)
(:file "sbcl-application" :if-feature :sbcl)
(:file "lw-application" :if-feature :lw))
)
(defsystem #:cl-forth/test
:description "Test Forth interpreter"
:pathname "tests/src"
:perform (test-op (o c)
(let ((tests-dir (component-pathname c)))
(uiop:with-current-directory (tests-dir)
(flet ((run-tests (optimized?)
(format t "~2&-------------------- Test Suite ~:[Without~;With~] Optimizer --------------------~%"
optimized?)
(with-input-from-string (text #.(format nil "The quick brown fox jumped over the lazy red dog.~%"))
;; Allow input from the console if any test raises a Forth exception
(let ((*standard-input* (make-concatenated-stream text *standard-input*))
(fs (symbol-call '#:forth '#:make-forth-system))
(phrases `("WARNING OFF"
"SHOW-BACKTRACES ON"
,@(when optimized? '("OPTIMIZER ON"))
"S\" runtests.fth\" INCLUDED"
"BYE")))
(time
(symbol-call '#:forth '#:forth-toplevel fs :interpret (reverse phrases)))))))
(run-tests nil)
(terpri) (terpri)
(run-tests t))))))