X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/52a79ab8b310a785f2c2f1a11069f3a5ad53810c..01e3faf9aaf5674955083ae7b190fcc84d35afbd:/src/builtin.lisp diff --git a/src/builtin.lisp b/src/builtin.lisp index 8b4407b..1dde0d5 100644 --- a/src/builtin.lisp +++ b/src/builtin.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 @@ -95,7 +95,7 @@ static void *~A__imprint(void *p) { struct ~A *sod__obj = p; - ~:{sod__obj->~A.~A._vt = &~A;~:^~% ~} + ~:{sod__obj->~A.~A._vt = &~A.~A;~:^~% ~} return (p); }~2%" class @@ -105,7 +105,8 @@ static void *~A__imprint(void *p) (tail (ichain-tail ichain))) (list (sod-class-nickname head) (sod-class-nickname tail) - (vtable-name class head)))) + (vtable-name class head) + (sod-class-nickname tail)))) (ilayout-ichains ilayout))))) (define-class-slot "init" (class stream) @@ -139,19 +140,22 @@ static void *~A__init(void *p)~%{~%" class) " struct ~A *sod__obj = ~A__imprint(p);~2%" (ilayout-struct-tag class) class) (setf used t)) - (format stream " ~A.~A =" isl - (sod-slot-name dslot)) + (format stream " {~% ~A ~A =" + (sod-slot-type dslot) + *sod-tmp-val*) (ecase (sod-initializer-value-kind init) (:simple (write (sod-initializer-value-form init) :stream stream :pretty nil :escape nil) (format stream ";~%")) - (:compound (format stream " (~A) {" - (sod-slot-type dslot)) + (:compound (format stream " {") (write (sod-initializer-value-form init) :stream stream :pretty nil :escape nil) - (format stream "};~%")))))))))))) + (format stream " };~%"))) + (format stream " ~A.~A = ~A;~% }~%" + isl (sod-slot-name dslot) + *sod-tmp-val*)))))))))) (unless used (format stream " ~A__imprint(p);~%" class)) (format stream "~&~: @@ -312,7 +316,7 @@ static const SodClass *const ~A__cpl[] = { :case :common) :state nil))) (with-module-environment (module) - (dolist (name '("va_list" "size_t" "ptrdiff_t")) + (dolist (name '("va_list" "size_t" "ptrdiff_t" "wchar_t")) (add-to-module module (make-instance 'type-item :name name))) (flet ((header-name (name) (concatenate 'string "\"" (string-downcase name) ".h\"")) @@ -331,4 +335,7 @@ static const SodClass *const ~A__cpl[] = { (bootstrap-classes module)) (setf *builtin-module* module))) +(define-clear-the-decks builtin-module + (unless *builtin-module* (make-builtin-module))) + ;;;----- That's all, folks --------------------------------------------------