| 1 | ;;; -*-lisp-*- |
| 2 | ;;; |
| 3 | ;;; System definition for the Sensible Object Design translator |
| 4 | ;;; |
| 5 | ;;; (c) 2009 Straylight/Edgeware |
| 6 | ;;; |
| 7 | |
| 8 | ;;;----- Licensing notice --------------------------------------------------- |
| 9 | ;;; |
| 10 | ;;; This file is part of the Sensible Object Design, an object system for C. |
| 11 | ;;; |
| 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. |
| 16 | ;;; |
| 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. |
| 21 | ;;; |
| 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. |
| 25 | |
| 26 | (cl:defpackage #:sod-sysdef |
| 27 | (:use #:common-lisp #:asdf #:uiop) |
| 28 | (:export #:*version*)) |
| 29 | |
| 30 | (cl:in-package #:sod-sysdef) |
| 31 | |
| 32 | #|@-auto-@|# (load (make-pathname :name "AUTO" :type "LISP" :version :newest |
| 33 | #|@-del-@|# :case :common :defaults *load-pathname*)) |
| 34 | |
| 35 | #+cmu (require :gray-streams) |
| 36 | |
| 37 | ;;;-------------------------------------------------------------------------- |
| 38 | ;;; Definition. |
| 39 | |
| 40 | (defsystem sod |
| 41 | |
| 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@" |
| 47 | |
| 48 | ;; Documentation. |
| 49 | :description "A Sensible Object Design for C." |
| 50 | |
| 51 | :long-description |
| 52 | "This system implements a fairly simple, yet powerful, object system for |
| 53 | plain old C. Its main features are as follows. |
| 54 | |
| 55 | * Multiple inheritance, done properly (unlike C++, say), with a |
| 56 | superclass linearlization algorithm, and exactly one copy of any |
| 57 | superclass's slots. |
| 58 | |
| 59 | * Method combinations, and multiple flavours of methods, to make mixin |
| 60 | classes more useful. |
| 61 | |
| 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. |
| 67 | |
| 68 | * Minimal runtime support requirements, so that it's suitable for use |
| 69 | wherever C is -- e.g., interfacing to other languages." |
| 70 | |
| 71 | :depends-on ("uiop") |
| 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")))) |
| 77 | |
| 78 | :components |
| 79 | ((:file "utilities") |
| 80 | (:file "optparse") |
| 81 | |
| 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 |
| 84 | ;; library. |
| 85 | (:module "parser" |
| 86 | :depends-on ("utilities") |
| 87 | :components |
| 88 | ((:file "package") |
| 89 | |
| 90 | ;; File location protocol (including error reporting). |
| 91 | (:file "floc-proto" :depends-on ("package")) |
| 92 | (:file "floc-impl" :depends-on ("floc-proto")) |
| 93 | |
| 94 | ;; Position-aware streams. |
| 95 | (:file "streams-proto" :depends-on ("package")) |
| 96 | (:file "streams-impl" |
| 97 | :depends-on ("streams-proto" "floc-proto")) |
| 98 | |
| 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" |
| 103 | :depends-on |
| 104 | ("scanner-proto" "floc-proto" "streams-proto")) |
| 105 | (:file "scanner-token-impl" :depends-on ("scanner-proto")) |
| 106 | |
| 107 | ;; Parser notation macro support. |
| 108 | (:file "parser-proto" :depends-on ("package")) |
| 109 | (:file "parser-impl" :depends-on ("parser-proto")) |
| 110 | |
| 111 | ;; Expression parser support. |
| 112 | (:file "parser-expr-proto" :depends-on ("parser-proto")) |
| 113 | (:file "parser-expr-impl" :depends-on ("parser-expr-proto")) |
| 114 | |
| 115 | ;; Stitching parsers to scanners. |
| 116 | (:file "scanner-context-impl" |
| 117 | :depends-on ("parser-proto" "scanner-proto")))) |
| 118 | |
| 119 | (:file "package" :depends-on ("utilities" "parser")) |
| 120 | |
| 121 | ;; Lexical analysis. |
| 122 | (:file "lexer-proto" :depends-on ("package" "parser")) |
| 123 | (:file "lexer-impl" :depends-on ("lexer-proto")) |
| 124 | (:file "fragment-parse" :depends-on ("lexer-proto")) |
| 125 | |
| 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" |
| 130 | :depends-on |
| 131 | ("c-types-proto" "c-types-class-impl" "fragment-parse")) |
| 132 | |
| 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")) |
| 137 | |
| 138 | ;; Code generation protocol. |
| 139 | (:file "codegen-proto" :depends-on ("module-proto")) |
| 140 | (:file "codegen-impl" :depends-on ("codegen-proto")) |
| 141 | |
| 142 | ;; Modules. |
| 143 | (:file "module-proto" :depends-on ("pset-proto" "package")) |
| 144 | (:file "module-impl" |
| 145 | :depends-on |
| 146 | ("module-proto" "pset-proto" "c-types-class-impl" "builtin")) |
| 147 | (:file "builtin" |
| 148 | :depends-on |
| 149 | ("module-proto" "pset-proto" |
| 150 | "c-types-impl" "c-types-class-impl" |
| 151 | "classes" "class-layout-proto" "method-proto")) |
| 152 | (:file "module-parse" |
| 153 | :depends-on |
| 154 | ("class-make-proto" "class-finalize-proto" |
| 155 | "fragment-parse" "lexer-proto" "module-impl")) |
| 156 | (:file "module-output" :depends-on ("module-impl" "output-proto")) |
| 157 | |
| 158 | ;; Output. |
| 159 | (:file "output-proto" :depends-on ("package")) |
| 160 | (:file "output-impl" :depends-on ("output-proto")) |
| 161 | |
| 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" |
| 166 | :depends-on |
| 167 | ("classes" "codegen-impl" "pset-impl" |
| 168 | "c-types-impl" "c-types-class-impl")) |
| 169 | |
| 170 | ;; Class construction. |
| 171 | (:file "class-make-proto" :depends-on ("class-utilities")) |
| 172 | (:file "class-make-impl" :depends-on ("class-make-proto")) |
| 173 | |
| 174 | ;; Class layout. |
| 175 | (:file "class-layout-proto" :depends-on ("class-utilities")) |
| 176 | (:file "class-layout-impl" |
| 177 | :depends-on ("class-layout-proto" "method-proto")) |
| 178 | |
| 179 | ;; Class finalization. |
| 180 | (:file "class-finalize-proto" :depends-on ("class-utilities")) |
| 181 | (:file "class-finalize-impl" :depends-on ("class-finalize-proto")) |
| 182 | |
| 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")) |
| 187 | |
| 188 | ;; Class output. |
| 189 | (:file "class-output" |
| 190 | :depends-on |
| 191 | ("classes" "class-layout-impl" "method-impl" "output-proto")) |
| 192 | |
| 193 | ;; Finishing touches of various kinds. |
| 194 | (:file "final" :depends-on ("builtin" "module-output" "class-output")))) |
| 195 | |
| 196 | (defsystem sod/frontend |
| 197 | |
| 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@" |
| 203 | |
| 204 | ;; Documentation. |
| 205 | :description "A Sensible Object Design for C, command-line frontend." |
| 206 | |
| 207 | :long-description |
| 208 | "The Sensible Object Design (SOD) is a fairly simple, yet powerful object |
| 209 | system for plain old C. |
| 210 | |
| 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." |
| 214 | |
| 215 | :entry-point "sod-frontend:main" |
| 216 | :build-pathname "sod" |
| 217 | :depends-on ("uiop" "sod") |
| 218 | :components ((:file "frontend"))) |
| 219 | |
| 220 | ;;;-------------------------------------------------------------------------- |
| 221 | ;;; Testing. |
| 222 | |
| 223 | (defsystem sod/test |
| 224 | |
| 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@" |
| 230 | |
| 231 | ;; Documentation. |
| 232 | :description "Tests for the Sensible Object Design translator." |
| 233 | |
| 234 | :long-description |
| 235 | "This system provides unit tests for the Sod translator." |
| 236 | |
| 237 | :depends-on ("sod" "xlunit") |
| 238 | |
| 239 | :components |
| 240 | ((:file "test-base") |
| 241 | |
| 242 | ;; Test the parser edifice. |
| 243 | (:module "parser" |
| 244 | :depends-on ("test-base") |
| 245 | :components ((:file "parser-test") |
| 246 | (:file "scanner-charbuf-test"))) |
| 247 | |
| 248 | ;; The actual tests. |
| 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")))) |
| 252 | |
| 253 | ;;;----- That's all, folks -------------------------------------------------- |