[Slightly less useless implementation clinton@unknownlamer.org**20090501001750 Ignore-this: ad8ad5c57024258af338ff46f1fb5cd7 Still horrible ] hunk ./src/xmlisp2.lisp 38 - (break "xn-s: (~A ~A) [~A] p=~A" uri lname normal package) + #+nil(break "xn-s: (~A ~A) [~A] p=~A" uri lname normal package) hunk ./src/xmlisp2.lisp 40 - (break "found symbol: ~A" sym) + #+nil(break "found symbol: ~A" sym) hunk ./src/xmlisp2.lisp 46 - (break "found class: ~A" class) + #+nil(break "found class: ~A" class) hunk ./src/xmlisp2.lisp 70 - (break "MAP-ATTRIBUTES (~A ~A)=~A" uri lname value) + #+nil(break "MAP-ATTRIBUTES (~A ~A)=~A" uri lname value) hunk ./src/xmlisp2.lisp 75 - (break "scanning children") + #+nil(break "scanning children") hunk ./src/xmlisp2.lisp 79 - (break "... event = ~A" ev) + #+nil(break "... event = ~A" ev) hunk ./src/xmlisp2.lisp 86 - (break "subobject: (~A ~A) / ev ~A" uri lname key) + #+nil(break "subobject: (~A ~A) / ev ~A" uri lname key) hunk ./src/xmlisp2.lisp 92 - (break "chars: ~S" (current-characters source)) + #+nil(break "chars: ~S" (current-characters source)) hunk ./src/xmlisp2.lisp 101 - (break "created instance ~A" instance) + #+nil(break "created instance ~A" instance) hunk ./src/xmlisp2.lisp 104 - hunk ./src/xmlisp2.lisp 109 +;; todo: use PARSE-NUMBER or similar for number subtypes +(defmethod xml-value->lisp-value (xml-value (lisp-type (eql 'number))) + (let ((number (read-from-string xml-value))) + (assert (numberp number)) + number)) + +(defmethod xml-value->lisp-value (xml-value (lisp-type (eql 'float))) + (let ((number (read-from-string xml-value))) + (assert (floatp number)) + number)) + +;;; todo: short-float single-float double-float + +(defmethod xml-value->lisp-value (xml-value (lisp-type (eql 'integer))) + (parse-integer xml-value)) + +(defmethod xml-value->lisp-value (xml-value (lisp-type (eql 'boolean))) + (cond ((string= xml-value "true") t) + ((string= xml-value "false") nil) + (t (error "invalid boolean value")))) + +(defmethod xml-value->lisp-value (xml-value (lisp-type (eql 'character))) + (assert (= 1 (length xml-value))) + (char xml-value 0)) + +(defmethod xml-value->lisp-value (xml-value (lisp-type (eql 'string))) + xml-value) + +;;; todo: pathname + +;;; todo: lists, arrays, etc + hunk ./src/xmlisp2.lisp 171 +;; todo: non-terrible implementation hunk ./src/xmlisp2.lisp 189 - ((moo :initform nil))) + ((moo :initform nil :type character) + (hem :initform nil :type boolean))) hunk ./src/xmlisp2.lisp 193 - ((meh :initform nil))) + ((meh :initform nil :type number))) hunk ./src/xmlisp2.lisp 196 - ((bar :initform nil) + ((bar :initform 0 :type integer) adddir ./tests addfile ./tests/test.xml hunk ./tests/test.xml 1 - + +