[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

weird rpc behavior



Here's an rpc entry that works:

(rpc:define-remote-entry remote-get-attribute-value browser-db
  (:number 4)
  (:arguments (request attribute-request))
  (:values (result object-attribute-value))
  (:lisp
    (:server
      (scl:condition-case (condition)
	   (multiple-value-bind (value type)
	       (let ((attribute (attribute-request-attribute request))
		     (object (object-handle-object request)))
		 (let ((attr (validate-attribute attribute)))
		   (get-attribute-value object attr)))
	     (scl:using-resource (result object-attribute-value
					 :status T
					 :value (if (symbolp value)
	                                            (format nil "~a" value) ;; ****
	                                            value))
	       (rpc:rpc-values result)))
	 (dbg:condition
	   (scl:using-resource (result object-attribute-value
				       :status nil
				       :message (with-output-to-string (str)
						  (dbg:report condition str))
				       :value nil)
	     (rpc:rpc-values result))))))))


and here's a very similar version that doesn't:

(rpc:define-remote-entry remote-get-attribute-value browser-db
  (:number 4)
  (:arguments (request attribute-request))
  (:values (result object-attribute-value))
  (:lisp
    (:server
      (scl:condition-case (condition)
	   (multiple-value-bind (value type)
	       (let ((attribute (attribute-request-attribute request))
		     (object (object-handle-object request)))
		 (let ((attr (validate-attribute attribute)))
		   (get-attribute-value object attr)))
	     (scl:using-resource (result object-attribute-value
					 :status T
					 :value (if (symbolp value)
                                                    (symbol-name value) ;; ****
	                                            value))
	       (rpc:rpc-values result)))
	 (dbg:condition
	   (scl:using-resource (result object-attribute-value
				       :status nil
				       :message (with-output-to-string (str)
						  (dbg:report condition str))
				       :value nil)
	     (rpc:rpc-values result))))))))



where:


(rpc:define-remote-type object-attribute-value ()
  (:abbreviation-for '(structure
			(status rpc:boolean)
			(message string)
			(value (or rpc:boolean string rpc:integer-32 single-float)))))



Note the difference: in the first case, I translate symbols into strings
via format; in the second case I use symbol-name. The first case works
fine. The second generates the following error:

"INTERNAL ERROR: Translation from Lisp representation to External Data Representation
attempted to access past the end of the block"



What's going on here? Are the strings returned by symbol-name somehow
different from the ones generated by (format nil ... ) ? 

Pleas cc replies to me directly (rshapiro@arris.com)