X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/9ec578d9fe450b7e7f9030dc9d930185593aa991..ac8ddb83cbc699b3d82ae1be837076b41d90757d:/src/frontend.lisp diff --git a/src/frontend.lisp b/src/frontend.lisp index 5430285..68c8a96 100644 --- a/src/frontend.lisp +++ b/src/frontend.lisp @@ -7,7 +7,7 @@ ;;;----- Licensing notice --------------------------------------------------- ;;; -;;; This file is part of the Sensble Object Design, an object system for C. +;;; This file is part of the Sensible Object Design, an object system for C. ;;; ;;; SOD is free software; you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by @@ -23,7 +23,17 @@ ;;; along with SOD; if not, write to the Free Software Foundation, ;;; Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -(cl:in-package #:sod) +(cl:defpackage #:sod-frontend + (:use #:common-lisp #:optparse #:sod #:sod-parser) + (:shadowing-import-from #:optparse #:int)) + +(cl:in-package #:sod-frontend) + +;;;-------------------------------------------------------------------------- +;;; Preparation for dumping. + +(clear-the-decks) +(exercise) ;;;-------------------------------------------------------------------------- ;;; The main program. @@ -76,12 +86,12 @@ ;; Option definitions. (define-program - :help "Probably ought to write this." - :version "0.1.0" + :help "Process SOD input files to produce (e.g.) C output." + :version *sod-version* :usage "SOURCES..." :options (options (help-options :short-version #\V) - "Crazy options" + "Translator options" (#\I "include" (:arg "DIR") ("Search DIR for module imports.") (list *module-dirs* 'string)) @@ -106,9 +116,6 @@ (or builtinsp args)) (die-usage)) - ;; Prepare the builtins. - (make-builtin-module) - ;; Do the main parsing job. (multiple-value-bind (hunoz nerror nwarn) (count-and-report-errors () @@ -162,15 +169,17 @@ reason)) nil))))) + ;; If there are no output types then there's nothing to do. + (unless output-reasons + (error "No output types given: nothing to do")) + ;; If we're writing the builtin module then now seems like a ;; good time to do that. (when builtinsp - (clear-the-decks) (hack-module *builtin-module*)) ;; Parse and write out the remaining modules. (dolist (arg args) - (clear-the-decks) (hack-module (read-module arg)))))) ;; Report on how well everything worked.