RPL Global User-defined Functions -- 4-30-2009 (a) http://cadswes2.colorado.edu/~philw/2009/GlobalRplFunctions/ (1) Adding RCL command to open Global Function Sets. (2) Enhanced error message applying to situations of a necessary Global Function Set not being opened. ----------------- Rcl/RclProcs.hpp Rcl/RclPolicy.cpp ----------------- Added Tcl processing function: // OpenGlobalSet int Rcl_OpenGblSet(ClientData, Tcl_Interp *, int, char **); ... Parallel to: ... // LoadOptSet ... int Rcl_LoadOptSet(ClientData, Tcl_Interp *, int, char **); ----------------- Rcl/RclInterp.cpp ----------------- Added to const struct RclCommandEntry RclCommandStrings[]: { "OpenGlobalSet", Rcl_OpenGblSet }, // Global Function Set Also added to RclInterp constructor, in a redundant ifdef'ed out section: registerCmd("OpenGlobalSet", Rcl_OpenGblSet); ------------------ Rcl/libRclMsgs.cpp Rcl/libRclMsgs.hpp ------------------ { RCL_RULES_SYNTAX, "" }, { RCL_OPTSET_SYNTAX, "" }, { RCL_GBLSET_SYNTAX, "" }, <<< ADDED ALSO: { RCL_GBLSET_OPEN_FAILED, "Opening the global function set " "%s failed: %s" }, ----------------- Rpl/RplSetMgr.hpp Rpl/RplSetMgr.cpp ----------------- Added method for opening a Global Function Set (called from RCL): See the third method: bool loadRBSSet (const rwFile&, cwfpointer&, RWCString& error); bool loadOptSet (const rwFile&, cwfpointer&, RWCString& error); bool openGblSet (const rwFile&, cwfpointer&, RWCString& error); <<< ADDED ------------------------------ RplExpression/FuncCallExpr.cpp ------------------------------ Enhanced message for errors which occur when the Global Function Set containing a called user defined function is NOT OPENED (i.e. does not exist in the RiverWare session). This includes the condition of an incorrect ordering of Rcl commands, i.e. if the necessary OpenGlobalSet commands do not come before the LoadRules command. In: RplFunction* FuncCallExpr::getFunction( const RplNameSpace& nameSpace, RWCString& explanation ) const ... added last clause to this message: "The function \"" + funcName + "\" can not be called at this point in the expression " "(perhaps it is disabled or has limited visibility, " "or is in a global function set which has not yet " <<< ADDED "been opened)."; <<< ADDED This condition was tested (and this error message is shown) with both batch (Rcl) or interactive RiverWare operation. ======================== RPL Global User-defined Functions -- 4-30-2009 (a) REVISED http://cadswes2.colorado.edu/~philw/2009/GlobalRplFunctions/ For the new RCL command (to open a Global Function Set), use 'OpenGlobalSet' instead of 'OpenFunctionSet' vi substitutions: :1,$s/OpenFuncSet/OpenGblSet/g :1,$s/OpenFunctionSet/OpenGlobalSet/g :1,$s/FUNCSET/GBLSET/g Files: Rcl/RclInterp.cpp Rcl/RclPolicy.cpp Rcl/RclProcs.hpp Rcl/libRclMsgs.cpp Rcl/libRclMsgs.hpp ---