module: remote-access-path synopsis: Making remote function calls in the application author: Paul Howard, Nosa Omo Copyright: Original Code is Copyright (c) 1995-2004 Functional Objects, Inc. All rights reserved. License: Functional Objects Library Public License Version 1.0 Dual-license: GNU Lesser General Public License Warranty: Distributed WITHOUT WARRANTY OF ANY KIND ///// REMOTE-CALL-ON-CONNECTION define method remote-call-on-connection (conn :: , thr :: , function :: , thread-was-suspended? :: , #rest arguments) => (ra :: , cookie :: ) // The arguments need to be converted from the #rest sequence // into a vector of objects. let arg-count :: = size(arguments); let arg-vector = make (, size: arg-count, fill: 0); for (i from 0 below arg-count) arg-vector[i] := as-integer(arguments[i]); end for; // We have everything we need to make the call. The return // value is a thread context cookie. The nub function is called // as a side-effect. let (ret-addr :: , context-cookie :: ) = Rtmgr/RemoteNub/setup-function-call (conn.nub, thr.rnub-descriptor, as-integer(function), arg-count, arg-vector); values (as-remote-value(ret-addr), make (, suspended?: thread-was-suspended?, nub-descriptor: as-remote-pointer(context-cookie))); end method; ///// REMOTE-CALL-RESULT-ON-CONNECTION define method remote-call-result-on-connection (conn :: , thr :: ) => (result :: ) as-remote-value(Rtmgr/RemoteNub/get-function-result(conn.nub, thr.rnub-descriptor)); end method; ///// REMOTE-RESTORE-CONTEXT-ON-CONNECTION define method remote-restore-context-on-connection (conn :: , thr :: , ctx :: ) => () Rtmgr/RemoteNub/restore-context(conn.nub, thr.rnub-descriptor, as-integer(ctx.nub-descriptor)); end method; ///// REMOTE-CALL-SPY-ON-CONNECTION define method remote-call-spy-on-connection (ap :: , conn :: , thr :: , function :: , #rest arguments) => (result :: , errcode :: ) let arg-vector :: = ap.%spy-function-argument-remote-vector; // Construct the vector of arguments let arg-count :: = size(arguments); if (arg-count > $max-spy-function-arguments) error("Serious internal debugger error: Exceeded maximum arg count " "in a spy call.") end if; for (i from 0 below arg-count) arg-vector[i] := as-integer(arguments[i]); end for; // And make the call, returning the results from the nub. let (result :: , errcode) = Rtmgr/RemoteNub/remote-call-spy(conn.nub, thr.rnub-descriptor, as-integer(function), arg-count, arg-vector); values(as-remote-value(result), errcode) end method;