cl-olefs

OLE File System tools for Common Lisp
git clone https://logand.com/git/cl-olefs.git/
Log | Files | Refs

commit 610fe1446a2acdd63cab0a94d81b7e4e2cd4b2ee
parent 48fb22a0feacf1fa6a954aa094e9c5ee2875ae39
Author: Tomas Hlavaty <tom@logand.com>
Date:   Sun, 12 Jun 2011 14:04:07 +0200

enums improved

Diffstat:
Mcdef.lisp | 20++++++++++----------
Menums.lisp | 32+++++++++++++++++++++++++++++++-
2 files changed, 41 insertions(+), 11 deletions(-)

diff --git a/cdef.lisp b/cdef.lisp @@ -55,23 +55,23 @@ (intern (symbol-name (car slot)) :keyword) (car slot)))))))) -(defvar *enums* nil) +(defgeneric enum-by-key (name key)) +(defgeneric enum-by-value (name value)) (defmacro defenum (name args &rest values) (declare (ignore args)) - (pushnew (cons name (mapcar (lambda (x) (cons (car x) (cadr x))) values)) - *enums* - :key #'car) `(progn + (defmethod enum-by-key ((name (eql ',name)) key) + (cdr (assoc key ',(loop + for (k v) in values + collect (cons k v))))) + (defmethod enum-by-value ((name (eql ',name)) value) + (cdr (assoc value ',(loop + for (k v) in values + collect (cons v k))))) ,@(loop for (k v) in values collect `(defconstant ,k ,v)))) -(defun enum-by-key (name key) - (cdr (assoc key (cdr (assoc name *enums*))))) - -(defun enum-by-value (name value) - (car (find value (cdr (assoc name *enums*)) :key #'cdr))) - ;;(enum-by-key 'RecordType 'RT_DocumentAtom) ;;(enum-by-value 'RecordType #x03E9) diff --git a/enums.lisp b/enums.lisp @@ -1,6 +1,7 @@ (in-package :olefs) (defenum RecordType () + ;; [MS-PST].pdf (RT_Document #x03E8) (RT_DocumentAtom #x03E9) (RT_EndDocumentAtom #x03EA) @@ -218,4 +219,33 @@ (RT_TimeVariant #xF142) (RT_TimeAnimationValue #xF143) (RT_TimeExtTimeNodeContainer #xF144) - (RT_TimeSlaveContainer #xF145)) + (RT_TimeSlaveContainer #xF145) + + ;; [MS-ODRAW].pdf + (RT_OfficeArtBlipEMF #xF01A) + (RT_OfficeArtBlipWMF #xF01B) + (RT_OfficeArtBlipPICT #xF01C) + (RT_OfficeArtBlipJPEG1 #xF01D) + (RT_OfficeArtBlipPNG #xF01E) + (RT_OfficeArtBlipDIB #xF01F) + (RT_OfficeArtBlipTIFF #xF029) + (RT_OfficeArtBlipJPEG2 #xF02A) + + (RT_OfficeArtDggContainer #xF000) + (RT_OfficeArtBStoreContainer #xF001) + (RT_OfficeArtDgContainer #xF002) + (RT_OfficeArtFDGGBlock #xF006) + (RT_OfficeArtFBSE #xF007) + (RT_OfficeArtFDG #xF008) + (RT_OfficeArtClientTextbox #xF00D) + (RT_OfficeArtClientAnchor #xF010) + (RT_OfficeArtClientData #xF011) + (RT_OfficeArtFRITContainer #xF118) + (RT_OfficeArtSpgrContainer #xF003) + (RT_OfficeArtSpContainer #xF004) + (RT_OfficeArtFSPGR #xF009) + (RT_OfficeArtFSP #xF00A) + (RT_OfficeArtFOPT #xF00B) + (RT_OfficeArtColorMRUContainer #xF11A) + (RT_OfficeArtSplitMenuColorContainer #xF11E) + (RT_OfficeArtTertiaryFOPT #xF122))