3 ;;; System definition for the Sensible Object Design translator
5 ;;; (c) 2009 Straylight/Edgeware
8 ;;;----- Licensing notice ---------------------------------------------------
10 ;;; This file is part of the Sensible Object Design, an object system for C.
12 ;;; SOD is free software; you can redistribute it and/or modify
13 ;;; it under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 2 of the License, or
15 ;;; (at your option) any later version.
17 ;;; SOD is distributed in the hope that it will be useful,
18 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with SOD; if not, write to the Free Software Foundation,
24 ;;; Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 (cl:defpackage #:sod-sysdef
27 (:use #:common-lisp #:asdf #:uiop)
28 (:export #:*version*))
30 (cl:in-package #:sod-sysdef)
32 #|@-auto-@|# (load (make-pathname :name "AUTO" :type "LISP" :version :newest
33 #|@-del-@|# :case :common :defaults *load-pathname*))
35 #+cmu (require :gray-streams)
37 ;;;--------------------------------------------------------------------------
42 ;; Boring copyright stuff.
43 :version #.*sysdef-version*
44 :author "Mark Wooding"
45 :license "GNU General Public License, version 2 or later"
46 #|@-path-@|# :pathname "@srcdir@"
49 :description "A Sensible Object Design for C."
52 "This system implements a fairly simple, yet powerful, object system for
53 plain old C. Its main features are as follows.
55 * Multiple inheritance, done properly (unlike C++, say), with a
56 superclass linearlization algorithm, and exactly one copy of any
59 * Method combinations, and multiple flavours of methods, to make mixin
62 * The default method combination doesn't depend on the programmer
63 statically predicting which superclass's method to delegate to.
64 Multiple inheritance makes this approach (taken by C++) fail: the
65 right next method might be an unknown sibling, and two siblings might
66 be in either order depending on descendants.
68 * Minimal runtime support requirements, so that it's suitable for use
69 wherever C is -- e.g., interfacing to other languages."
72 :in-order-to ((test-op (load-op "sod/test")))
73 :perform (test-op (op comp)
74 (let ((result (symbol-call :sod-test :run-tests)))
75 (unless (symbol-call :xlunit :was-successful result)
76 (error "Failed test"))))
82 ;; Parser equipment. This is way more elaborate than it needs to be,
83 ;; but it was interesting, and it may well get split off into a separate
86 :depends-on ("utilities")
90 ;; File location protocol (including error reporting).
91 (:file "floc-proto" :depends-on ("package"))
92 (:file "floc-impl" :depends-on ("floc-proto"))
94 ;; Position-aware streams.
95 (:file "streams-proto" :depends-on ("package"))
97 :depends-on ("streams-proto" "floc-proto"))
99 ;; Scanner protocol, and various scanner implementations.
100 (:file "scanner-proto" :depends-on ("package"))
101 (:file "scanner-impl" :depends-on ("scanner-proto"))
102 (:file "scanner-charbuf-impl"
104 ("scanner-proto" "floc-proto" "streams-proto"))
105 (:file "scanner-token-impl" :depends-on ("scanner-proto"))
107 ;; Parser notation macro support.
108 (:file "parser-proto" :depends-on ("package"))
109 (:file "parser-impl" :depends-on ("parser-proto"))
111 ;; Expression parser support.
112 (:file "parser-expr-proto" :depends-on ("parser-proto"))
113 (:file "parser-expr-impl" :depends-on ("parser-expr-proto"))
115 ;; Stitching parsers to scanners.
116 (:file "scanner-context-impl"
117 :depends-on ("parser-proto" "scanner-proto"))))
119 (:file "package" :depends-on ("utilities" "parser"))
122 (:file "lexer-proto" :depends-on ("package" "parser"))
123 (:file "lexer-impl" :depends-on ("lexer-proto"))
124 (:file "fragment-parse" :depends-on ("lexer-proto"))
126 ;; C type representation protocol.
127 (:file "c-types-proto" :depends-on ("package"))
128 (:file "c-types-impl" :depends-on ("c-types-proto" "codegen-proto"))
129 (:file "c-types-parse"
131 ("c-types-proto" "c-types-class-impl" "fragment-parse"))
133 ;; Property set protocol.
134 (:file "pset-proto" :depends-on ("package" "c-types-proto"))
135 (:file "pset-impl" :depends-on ("pset-proto" "module-proto"))
136 (:file "pset-parse" :depends-on ("pset-proto" "lexer-proto"))
138 ;; Code generation protocol.
139 (:file "codegen-proto" :depends-on ("module-proto"))
140 (:file "codegen-impl" :depends-on ("codegen-proto"))
143 (:file "module-proto" :depends-on ("pset-proto" "package"))
146 ("module-proto" "pset-proto" "c-types-class-impl" "builtin"))
149 ("module-proto" "pset-proto"
150 "c-types-impl" "c-types-class-impl"
151 "classes" "class-layout-proto" "method-proto"))
152 (:file "module-parse"
154 ("class-make-proto" "class-finalize-proto"
155 "fragment-parse" "lexer-proto" "module-impl"))
156 (:file "module-output" :depends-on ("module-impl" "output-proto"))
159 (:file "output-proto" :depends-on ("package"))
160 (:file "output-impl" :depends-on ("output-proto"))
162 ;; Class representation.
163 (:file "classes" :depends-on ("package" "c-types-proto"))
164 (:file "c-types-class-impl" :depends-on ("classes" "module-proto"))
165 (:file "class-utilities"
167 ("classes" "codegen-impl" "pset-impl"
168 "c-types-impl" "c-types-class-impl"))
170 ;; Class construction.
171 (:file "class-make-proto" :depends-on ("class-utilities"))
172 (:file "class-make-impl" :depends-on ("class-make-proto"))
175 (:file "class-layout-proto" :depends-on ("class-utilities"))
176 (:file "class-layout-impl"
177 :depends-on ("class-layout-proto" "method-proto"))
179 ;; Class finalization.
180 (:file "class-finalize-proto" :depends-on ("class-utilities"))
181 (:file "class-finalize-impl" :depends-on ("class-finalize-proto"))
183 ;; Method generation.
184 (:file "method-proto" :depends-on ("class-make-proto"))
185 (:file "method-impl" :depends-on ("method-proto"))
186 (:file "method-aggregate" :depends-on ("method-impl"))
189 (:file "class-output"
191 ("classes" "class-layout-impl" "method-impl" "output-proto"))
193 ;; Finishing touches of various kinds.
194 (:file "final" :depends-on ("builtin" "module-output" "class-output"))))
196 (defsystem sod/frontend
198 ;; Boring copyright stuff.
199 :version #.*sysdef-version*
200 :author "Mark Wooding"
201 :license "GNU General Public License, version 2 or later"
202 #|@-path-@|# :pathname "@srcdir@"
205 :description "A Sensible Object Design for C, command-line frontend."
208 "The Sensible Object Design (SOD) is a fairly simple, yet powerful object
209 system for plain old C.
211 This system provides a command-line interface to the SOD translator. It's
212 a separate system because it has additional dependencies and
213 Lisp-system-specific code."
215 :entry-point "sod-frontend:main"
216 :build-pathname "sod"
217 :depends-on ("uiop" "sod")
218 :components ((:file "frontend")))
220 ;;;--------------------------------------------------------------------------
225 ;; Boring copyright stuff.
226 :version #.*sysdef-version*
227 :author "Mark Wooding"
228 :license "GNU General Public License, version 2 or later"
229 #|@-path-@|# :pathname "@srcdir@"
232 :description "Tests for the Sensible Object Design translator."
235 "This system provides unit tests for the Sod translator."
237 :depends-on ("sod" "xlunit")
242 ;; Test the parser edifice.
244 :depends-on ("test-base")
245 :components ((:file "parser-test")
246 (:file "scanner-charbuf-test")))
249 (:file "c-types-test" :depends-on ("test-base"))
250 (:file "codegen-test" :depends-on ("test-base"))
251 (:file "lexer-test" :depends-on ("test-base"))))
253 ;;;----- That's all, folks --------------------------------------------------