| 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) |
| 28 | (:export #:*version*)) |
| 29 | |
| 30 | (cl:in-package #:sod-sysdef) |
| 31 | |
| 32 | #|@-auto-@|# (load (merge-pathnames "auto.lisp" *load-pathname*)) |
| 33 | |
| 34 | #+cmu (require :gray-streams) |
| 35 | |
| 36 | ;;;-------------------------------------------------------------------------- |
| 37 | ;;; Definition. |
| 38 | |
| 39 | (defsystem sod |
| 40 | |
| 41 | ;; Boring copyright stuff. |
| 42 | :version #.*sysdef-version* |
| 43 | :author "Mark Wooding" |
| 44 | :license "GNU General Public License, version 2 or later" |
| 45 | #|@-path-@|# :pathname "@srcdir@" |
| 46 | |
| 47 | ;; Documentation. |
| 48 | :description "A Sensible Object Design for C." |
| 49 | |
| 50 | :long-description |
| 51 | "This system implements a fairly simple, yet powerful, object system for |
| 52 | plain old C. Its main features are as follows. |
| 53 | |
| 54 | * Multiple inheritance, done properly (unlike C++, say), with a |
| 55 | superclass linearlization algorithm, and exactly one copy of any |
| 56 | superclass's slots. |
| 57 | |
| 58 | * Method combinations, and multiple flavours of methods, to make mixin |
| 59 | classes more useful. |
| 60 | |
| 61 | * The default method combination doesn't depend on the programmer |
| 62 | statically predicting which superclass's method to delegate to. |
| 63 | Multiple inheritance makes this approach (taken by C++) fail: the |
| 64 | right next method might be an unknown sibling, and two siblings might |
| 65 | be in either order depending on descendents. |
| 66 | |
| 67 | * Minimal runtime support requirements, so that it's suitable for use |
| 68 | wherever C is -- e.g., interfacing to other languages." |
| 69 | |
| 70 | :components |
| 71 | ((:file "utilities") |
| 72 | |
| 73 | ;; Parser equipment. This is way more elaborate than it needs to be, but |
| 74 | ;; it was interesting, and it may well get split off into a separate |
| 75 | ;; library. |
| 76 | (:module "parser" :depends-on ("utilities") :components |
| 77 | ((:file "package") |
| 78 | |
| 79 | ;; File location protocol (including error reporting). |
| 80 | (:file "floc-proto" :depends-on ("package")) |
| 81 | (:file "floc-impl" :depends-on ("floc-proto")) |
| 82 | |
| 83 | ;; Position-aware streams. |
| 84 | (:file "streams-proto" :depends-on ("package")) |
| 85 | (:file "streams-impl" :depends-on ("streams-proto" "floc-proto")) |
| 86 | |
| 87 | ;; Scanner protocol, and various scanner implementations. |
| 88 | (:file "scanner-proto" :depends-on ("package")) |
| 89 | (:file "scanner-impl" :depends-on ("scanner-proto")) |
| 90 | (:file "scanner-charbuf-impl" :depends-on |
| 91 | ("scanner-proto" "floc-proto" "streams-proto")) |
| 92 | (:file "scanner-token-impl" :depends-on ("scanner-proto")) |
| 93 | |
| 94 | ;; Parser notation macro support. |
| 95 | (:file "parser-proto" :depends-on ("package")) |
| 96 | (:file "parser-impl" :depends-on ("parser-proto")) |
| 97 | |
| 98 | ;; Expression parser support. |
| 99 | (:file "parser-expr-proto" :depends-on ("parser-proto")) |
| 100 | (:file "parser-expr-impl" :depends-on ("parser-expr-proto")) |
| 101 | |
| 102 | ;; Stitching parsers to scanners. |
| 103 | (:file "scanner-context-impl" :depends-on |
| 104 | ("parser-proto" "scanner-proto")))) |
| 105 | |
| 106 | (:file "package" :depends-on ("utilities" "parser")) |
| 107 | |
| 108 | ;; Lexical analysis. |
| 109 | (:file "lexer-proto" :depends-on ("package" "parser")) |
| 110 | (:file "lexer-impl" :depends-on ("lexer-proto")) |
| 111 | (:file "fragment-parse" :depends-on ("lexer-proto")) |
| 112 | |
| 113 | ;; C type representation protocol. |
| 114 | (:file "c-types-proto" :depends-on ("package")) |
| 115 | (:file "c-types-impl" :depends-on ("c-types-proto" "codegen-proto")) |
| 116 | (:file "c-types-parse" :depends-on |
| 117 | ("c-types-proto" "c-types-class-impl" "fragment-parse")) |
| 118 | |
| 119 | ;; Property set protocol. |
| 120 | (:file "pset-proto" :depends-on ("package" "c-types-proto")) |
| 121 | (:file "pset-impl" :depends-on ("pset-proto")) |
| 122 | (:file "pset-parse" :depends-on ("pset-proto" "lexer-proto")) |
| 123 | |
| 124 | ;; Code generation protocol. |
| 125 | (:file "codegen-proto" :depends-on ("module-proto")) |
| 126 | (:file "codegen-impl" :depends-on ("codegen-proto")) |
| 127 | |
| 128 | ;; Modules. |
| 129 | (:file "module-proto" :depends-on ("package")) |
| 130 | (:file "module-impl" :depends-on |
| 131 | ("module-proto" "pset-proto" "c-types-class-impl" "builtin")) |
| 132 | (:file "builtin" :depends-on |
| 133 | ("module-proto" "pset-proto" "c-types-impl" "c-types-class-impl" |
| 134 | "classes" "class-layout-proto" "method-proto")) |
| 135 | (:file "module-parse" :depends-on |
| 136 | ("class-make-proto" "class-finalize-proto" |
| 137 | "fragment-parse" "lexer-proto" "module-impl")) |
| 138 | (:file "module-output" :depends-on ("module-impl" "output-proto")) |
| 139 | |
| 140 | ;; Output. |
| 141 | (:file "output-proto" :depends-on ("package")) |
| 142 | (:file "output-impl" :depends-on ("output-proto")) |
| 143 | |
| 144 | ;; Class representation. |
| 145 | (:file "classes" :depends-on ("package" "c-types-proto")) |
| 146 | (:file "c-types-class-impl" :depends-on ("classes" "module-proto")) |
| 147 | (:file "class-utilities" :depends-on |
| 148 | ("classes" "codegen-impl" "pset-impl" |
| 149 | "c-types-impl" "c-types-class-impl")) |
| 150 | |
| 151 | ;; Class construction. |
| 152 | (:file "class-make-proto" :depends-on ("class-utilities")) |
| 153 | (:file "class-make-impl" :depends-on ("class-make-proto")) |
| 154 | |
| 155 | ;; Class layout. |
| 156 | (:file "class-layout-proto" :depends-on ("class-utilities")) |
| 157 | (:file "class-layout-impl" :depends-on |
| 158 | ("class-layout-proto" "method-proto")) |
| 159 | |
| 160 | ;; Class finalization. |
| 161 | (:file "class-finalize-proto" :depends-on ("class-utilities")) |
| 162 | (:file "class-finalize-impl" :depends-on ("class-finalize-proto")) |
| 163 | |
| 164 | ;; Method generation. |
| 165 | (:file "method-proto" :depends-on ("class-make-proto")) |
| 166 | (:file "method-impl" :depends-on ("method-proto")) |
| 167 | (:file "method-aggregate" :depends-on ("method-impl")) |
| 168 | |
| 169 | ;; Class output. |
| 170 | (:file "class-output" :depends-on |
| 171 | ("classes" "class-layout-impl" "method-impl" "output-proto")) |
| 172 | |
| 173 | ;; Finishing touches of various kinds. |
| 174 | (:file "final" :depends-on ("builtin" "module-output" "class-output")))) |
| 175 | |
| 176 | ;;;-------------------------------------------------------------------------- |
| 177 | ;;; Testing. |
| 178 | |
| 179 | (defmethod perform ((op test-op) (component (eql (find-system "sod")))) |
| 180 | (declare (ignore op component)) |
| 181 | (handler-bind (((or warning style-warning) |
| 182 | (lambda (cond) |
| 183 | (declare (ignore cond)) |
| 184 | (invoke-restart 'muffle-warning)))) |
| 185 | (operate 'test-op "sod-test"))) |
| 186 | |
| 187 | ;;;----- That's all, folks -------------------------------------------------- |