anchor.diff:  			(if (zerop code)
   				(return-from extract-string)
   				(princ (code-char code) s))))))))
  +
  +(defun pack-wstring (string length buffer start)
  +  "Pack a string into the buffer."
  +  (let ((array (make-array length))
  +        (len (length string)))
  +    (dotimes (i length)
  +      (if (< i len)
  +		  (setf (elt array i) (char-code (char string i)))
  +		  (setf (elt array i) 0)))
  +    (pack-array array
  +				:uint16
  +				buffer
  +				start)))
  +
  +(defun unpack-wstring (length buffer start)
  +  "Unpack a string from the buffer."
  +  (let ((bytes (unpack-array length :uint16 buffer start)))
  +    (with-output-to-string (s)
  +      (block extract-string
  +		(dotimes (i (length bytes))
  +		  (let ((code (elt bytes i)))
  +			(if (zerop code)
  +				(return-from extract-string)
  +				(princ (code-char code) s))))))))
  +
  +
   
   ;; --------------------- packets / structures --------------------------
   
  
positive.code:        ',name)))
  
  
  (defun pack (object type)
    "Make a packet buffer from the initial object."
    (let ((buffer (make-array (type-size type) 
  							:element-type '(unsigned-byte 8)
  							:initial-element 0)))
      (pack-type object type buffer 0)
      buffer))
  
  (defun unpack (buffer type)
    "Unpack a buffer into an object."
    (let ((len (length buffer))
  		(size (type-size type)))
  	(if (<= len size)
  		(unpack-type type buffer 0)
  		(error "Buffer length ~S is smaller than ~S size ~S."
  			   len type size))))
  
  
negative.code: ;; the actual packing/unpacking is done by some special code in the closures
  ;; generated by %define-packet-type. There MUST be a better way of doing it!!!
  (define-alias :string :uint8)
  (define-alias :wstring :uint16)
  
  ;; it'd be nicer if we could just define :string as a packet type, but this isn't possible.
  ;; maybe we need to be able to define array types?
  