Browse files

Rename %string-field% to %sf%.

  • Loading branch information...
1 parent 9e326ba commit 5a4b0bdcb49fe4593f7876621f83a5cb540cb1fa @brown committed Feb 5, 2012
Showing with 16 additions and 22 deletions.
  1. +1 −1 message-test.lisp
  2. +1 −1 protoc/lisp/
  3. +14 −20 protocol-buffer.lisp
@@ -128,7 +128,7 @@
(repeated-cord ,(sf "225") ,(sf "325") ,(sf "525"))))
(defun field-equal (value expected)
- (cond ((eq (type-of expected) 'pb::%string-field%)
+ (cond ((eq (type-of expected) 'pb::%sf%)
(is (string= (pb:string-value value) (pb:string-value expected))))
((vectorp value) (is (equalp value expected)))
(t (is (eql value expected)))))
@@ -181,7 +181,7 @@ const char* PrimitiveTypeName(const FieldDescriptor* field) {
if (field->type() == FieldDescriptor::TYPE_BYTES) {
return "(cl:simple-array (cl:unsigned-byte 8) (cl:*))";
} else {
- return "pb::%string-field%";
+ return "pb::%sf%";
case FieldDescriptor::CPPTYPE_MESSAGE:
return NULL;
@@ -109,57 +109,51 @@ beyond LIMIT, then signals PROTOCOL-BUFFER-READ-ERROR."))
;;;; Protocol buffer string fields
-(cl:defclass %string-field% ()
+(cl:defclass %sf% ()
((%octets% :accessor %octets%
:initarg :octets
:initform (cl:make-array 0 :element-type '(cl:unsigned-byte 8))
:documentation "Octet vector that holds the string field's value."))
(:documentation "A protocol buffer string field."))
-(cl:defmethod cl:print-object ((string-field %string-field%) stream)
+(cl:defmethod cl:print-object ((string-field %sf%) stream)
(cl:print-unreadable-object (string-field stream :type cl:t :identity cl:nil)
(cl:format stream "~S" (string-value string-field))))
-(cl:declaim (cl:ftype (cl:function ((cl:or
- cl:string
- %string-field%))
- (cl:values %string-field% cl:&optional))
+(cl:declaim (cl:ftype (cl:function ((cl:or cl:string %sf%))
+ (cl:values %sf% cl:&optional))
(cl:defun string-field (value)
- "Returns a new %STRING-FIELD% instance initialized to hold VALUE, which much
-be either a Lisp string or a vector of UTF-8 encoded octets."
+ "Returns a new %SF% instance initialized to hold VALUE, which much be either a Lisp
+string or a vector of UTF-8 encoded octets."
(cl:let ((octets
(cl:etypecase value
(cl:string ( value))
( value)
- (%string-field% (utf8-string-value value)))))
- (cl:make-instance '%string-field% :octets octets)))
+ (%sf% (utf8-string-value value)))))
+ (cl:make-instance '%sf% :octets octets)))
-(cl:declaim (cl:ftype (cl:function (%string-field%) (cl:values cl:string cl:&optional))
- string-value))
+(cl:declaim (cl:ftype (cl:function (%sf%) (cl:values cl:string cl:&optional)) string-value))
(cl:defun string-value (string-field)
"Returns STRING-FIELD's value as a Lisp string."
- (cl:declare (cl:type %string-field% string-field))
+ (cl:declare (cl:type %sf% string-field))
( (%octets% string-field)))
-(cl:declaim (cl:ftype (cl:function (%string-field%)
- (cl:values cl:&optional))
+(cl:declaim (cl:ftype (cl:function (%sf%) (cl:values cl:&optional))
(cl:defun utf8-string-value (string-field)
"Returns STRING-FIELD's value as a UTF-8 encoded vector of octets."
- (cl:declare (cl:type %string-field% string-field))
+ (cl:declare (cl:type %sf% string-field))
(cl:copy-seq (cl:slot-value string-field '%octets%)))
-(cl:declaim (cl:ftype (cl:function (%string-field%)
- (cl:values cl:&optional))
+(cl:declaim (cl:ftype (cl:function (%sf%) (cl:values cl:&optional))
(cl:defun %utf8-string-length% (string-field)
"Returns the length in octets of STRING-FIELD's value."
- (cl:declare (cl:type %string-field% string-field))
+ (cl:declare (cl:type %sf% string-field))
(cl:length (cl:slot-value string-field '%octets%)))

0 comments on commit 5a4b0bd

Please sign in to comment.