On Wed, 13 Jan 2010, Angel Pais wrote:
Hi,
> >STATIC FUNCTION MYRPC_FILTER( sFuncSym, ... )
> > STATIC s_hLegal := { "DATE"=>, "TIME"=> }
> > IF sFuncSym:name $ s_hLegal
> > RETURN sFuncSym:exec( ... )
> > ENDIF
> > RETURN "<<unsupported function>>"
> Would this also work ?
> STATIC FUNCTION MYRPC_FILTER( sFuncSym, ... )
> sFuncSym := 'rpc_'+sFuncSym
> IF IsFunction(sFuncSym)
> RETURN sFuncSym:exec( ... )
> ENDIF
> RETURN "<<unsupported function>>"
sFuncSym is function symbol not string so you should modify this code.
I guess that IsFunction() works like __DYNSISFUN( <cFuncName> ) and
you wanted to create code like:
STATIC FUNCTION MYRPC_FILTER( sFuncSym, ... )
LOCAL cFuncName := "rpc_" + sFuncSym:name
IF __DYNSISFUN( cFuncName )
RETURN &cFuncName( ... )
ENDIF
RETURN "<<unsupported function>>"
> So all you have to do to enable a function to be remotely callable
> is name it beginnign with 'rpc_'
> Am I missing something ?
One small thing. Before MYRPC_FILTER() is called NETIO_SERVER()
checks if given function exists. If not then it returns to client
NETIO_ERR_NOT_EXISTS error code. It means that if you create
function RPC_MYFUNC() and client request to execute MYFUNC()
then MYRPC_FILTER() will be executed only if MYFUNC() exists.
best regards,
Przemek
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour