Changeset 31 for branches/home
- Timestamp:
- 01/08/07 02:41:42 (18 years ago)
- Location:
- branches/home/psmith/restructure/src/protocol/yarpc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified branches/home/psmith/restructure/src/protocol/yarpc/nio-yarpc-package.lisp ¶
r27 r31 30 30 31 31 ;; yarpc-state-machine 32 yarpc-state-machine test-rpc 32 yarpc-state-machine test-rpc test-rpc-list test-rpc-string 33 33 )) -
TabularUnified branches/home/psmith/restructure/src/protocol/yarpc/yarpc-state-machine.lisp ¶
r30 r31 43 43 (defclass yarpc-state-machine (async-fd)()) 44 44 45 46 ;;TODO move somewhere suitable 47 48 (defparameter *remote-fns* nil) 49 50 (defun register-remote-fn(name) 51 (push name *remote-fns*)) 52 53 (defmacro defremote (name args &rest body) 54 `(progn 55 (defun ,name (,@args) ,@body) 56 (register-remote-fn #',name))) 57 58 (defremote test-rpc-list() 59 (list 3 "as" 's (code-char #x2211))) 60 61 (defremote test-rpc-string(a b c) 62 (format nil "response - ~A ~A ~A ~A~%" a b c (code-char #x2211))) 63 64 ;;end move TODO 65 66 67 ;;;Utils 68 69 (defun print-hashtable (table &optional (stream t)) 70 (maphash #'(lambda (k v) (format stream "~a -> ~a~%" k v)) table)) 71 ;;; 72 73 45 74 (defmethod print-object ((sm yarpc-state-machine) stream) 46 75 (format stream "#<YARPC-STATE-MACHINE ~A >" (call-next-method sm nil))) … … 54 83 55 84 85 (define-condition authorization-error (error) ()) 86 56 87 (defun execute-call (call-string) 57 (let* ((*package* (find-package :nio-yarpc)) 58 (rpc-call-list (read-from-string call-string ))) 59 (apply (first rpc-call-list) (rest rpc-call-list)))) 88 (handler-case 89 (let* ((rpc-call-list (read-from-string call-string )) 90 (fn (member (symbol-function (first rpc-call-list)) *remote-fns* ))) 91 (format t "fn - ~A authorised? : ~A~%" (symbol-function (first rpc-call-list)) fn) 92 (if fn 93 (apply (first rpc-call-list) (rest rpc-call-list)) 94 (error 'authorization-error))) 95 (reader-error (re) (format t "No such function ~A~%" call-string)))) 60 96 61 62 (defmacro defremote (name args &rest body)63 `(defun ,name (,@args) ,@body))64 65 66 (defremote test-rpc-list()67 (list 3 "as" 's (code-char #x2211)))68 69 (defremote test-rpc-string(a b c)70 (format nil "response - ~A ~A ~A ~A~%" a b c (code-char #x2211)))71 72 73 (defremote my-remote-fn (arg1 arg2)74 (format t "~A~A~%" arg1 arg2))
Note: See TracChangeset
for help on using the changeset viewer.