📄 stafcpar.rxl
字号:
#Function InstanceValue/******************************************************************************//* InstanceValue - Determines the value of the specified option instance *//* *//* Accepts: The option instance number *//* *//* Returns: The value of the specified option instance *//******************************************************************************/InstanceValue: parse arg IN_Num RETURN STAFCommandParser.!Instance.SCP_CurrentParser.IN_Num.!Value/* End of InstanceValue */#End#Function NumArguments/******************************************************************************//* NumArguments - Determines the number of arguments specified in the parsed *//* string *//* *//* Accepts: Nothing *//* *//* Returns: The number of arguments specified in the parsed string *//******************************************************************************/NumArguments: RETURN STAFCommandParser.!Arg.SCP_CurrentParser.0/* End of NumArguments */#End#Function Argument/******************************************************************************//* Argument - Determines the value of the specified argument *//* *//* Accepts: The number of the argument *//* *//* Returns: The value of the argument *//******************************************************************************/Argument: parse arg ARG_Num RETURN STAFCommandParser.!Arg.SCP_CurrentParser.ARG_Num/* End of Argument */#End#Function OptionTimes/************************************************************************//* OptionTimes - Determines how many times a given option was specified *//* *//* Accepts: The name of the option *//* *//* Returns: The number of times the option was specified. *//************************************************************************/OptionTimes: parse arg OT_Name OT_Times = 0 do OT_i = 1 to STAFCommandParser.!Instance.SCP_CurrentParser.0 if TRANSLATE(STAFCommandParser.!Instance.SCP_CurrentParser.OT_i.!Name) =, TRANSLATE(OT_Name) then do OT_Times = OT_Times + 1 end end RETURN OT_Times#End#Function OptionValue/************************************************************************//* OptionValue - Determines the value of the specified occurance of the *//* specified option *//* *//* Accepts: The name of the option of which to determine the value *//* Which occurance of the option to look for *//* *//* Returns: The value of the specified occurance of the given option. *//* Returns '' if the specified occurance does not exist (and *//* thus was not specified in the request string ) *//************************************************************************/OptionValue: parse arg OV_Name, OV_Occurance if OV_Occurance = '' then OV_Occurance = 1 OV_Times = 0 do OV_i = 1 to STAFCommandParser.!Instance.SCP_CurrentParser.0, UNTIL (OV_Times = OV_Occurance) if TRANSLATE(STAFCommandParser.!Instance.SCP_CurrentParser.OV_i.!Name) =, TRANSLATE(OV_Name) then do OV_Times = OV_Times + 1 end end if OV_Times \= OV_Occurance then RETURN '' RETURN STAFCommandParser.!Instance.SCP_CurrentParser.OV_i.!Value#End#Function ParseString/****************************************************************************//* ParseString - Parses a request string *//* *//* Accepts: The request string *//* The name of a variable in which to place error text *//* *//* Returns: 0 , if successful *//* >0, if an error occurs *//****************************************************************************//* --- Internals --- *//* STAFCommandParser.!Option.SCP_CurrentParser.0 *//* STAFCommandParser.!Option.SCP_CurrentParser.i.!Name *//* STAFCommandParser.!Option.SCP_CurrentParser.i.!Times - 0 = unlimited *//* STAFCommandParser.!Option.SCP_CurrentParser.i.!ValueRequired - Yes, No, *//* Allowed *//* STAFCommandParser.!OptionGroup.SCP_CurrentParser.0 *//* STAFCommandParser.!OptionGroup.SCP_CurrentParser.i.!Group *//* STAFCommandParser.!OptionGroup.SCP_CurrentParser.i.!Minimum *//* STAFCommandParser.!OptionGroup.SCP_CurrentParser.i.!Maximum *//* *//* STAFCommandParser.!OptionNeed.SCP_CurrentParser.0 *//* STAFCommandParser.!OptionNeed.SCP_CurrentParser.i.!Needer *//* STAFCommandParser.!OptionNeed.SCP_CurrentParser.i.!Needee *//* *//* STAFCommandParser.!MaxArguments.SCP_CurrentParser *//* *//* PS_Word.0 *//* PS_Word.i.!Data *//* PS_Word.i.!Type - Option, Value *//* *//* STAFCommandParser.!Instance.SCP_CurrentParser.0 *//* STAFCommandParser.!Instance.SCP_CurrentParser.i.!Name *//* STAFCommandParser.!Instance.SCP_CurrentParser.i.!Value *//* *//* STAFCommandParser.!Arg.SCP_CurrentParser.0 *//* STAFCommandParser.!Arg.SCP_CurrentParser.i *//****************************************************************************/ParseString: parse arg PS_ParseString, PS_ErrorBuffer PS_WhiteSpace = '0D0A20'x /* WhiteSpace = CR LF Space */ PS_Word.0 = 0 PS_CurrType = "Value" PS_CurrData = "" PS_InQuotes = 0 PS_InEscape = 0 PS_IsLiteral = 0 PS_InLengthField = 0 PS_InDataField = 0 PS_DataLength = 0 STAFCommandParser.!Arg.SCP_CurrentParser.0 = 0 STAFCommandParser.!Instance.SCP_CurrentParser.0 = 0 do PS_i = 1 to LENGTH(PS_ParseString) PS_Char = SUBSTR(PS_ParseString, PS_i, 1) if (PS_Char = ':') & (PS_InQuotes = 0) & (PS_InEscape = 0) &, (PS_InDataField = 0) & (PS_CurrData = "") then do PS_InLengthField = 1 end else if PS_InLengthField then do if PS_Char = ':' then do PS_InLengthField = 0 PS_InDataField = 1 if PS_CurrData = "" then do call VALUE PS_ErrorBuffer, "Invalid length delimited", "data specifier" RETURN 1 end PS_DataLength = PS_CurrData PS_CurrType = "Value" PS_CurrData = "" end else if VERIFY(PS_Char, "0123456789") = 0 then do PS_CurrData = PS_CurrData || PS_Char end else do call VALUE PS_ErrorBuffer, "Invalid length delimited", "data specifier" RETURN 1 end end /* In length field */ else if PS_InDataField then do PS_CurrData = PS_CurrData || PS_Char PS_DataLength = PS_DataLength - 1 if PS_DataLength = 0 then do PS_Word.0 = PS_Word.0 + 1 PS_WordIndex = PS_Word.0 PS_Word.PS_WordIndex.!Type = PS_CurrType PS_Word.PS_WordIndex.!Data = PS_CurrData PS_CurrType = "Value" PS_CurrData = "" PS_InDataField = 0 end end else if VERIFY(PS_Char, PS_WhiteSpace) = 0 then do PS_InEscape = 0 if PS_InQuotes then PS_CurrData = PS_CurrData || PS_Char else if PS_CurrData \== "" then do if PS_IsLiteral then PS_CurrType = "Value" else if ValueIsOption(PS_CurrData) \= 0 then PS_CurrType = "Option" PS_Word.0 = PS_Word.0 + 1 PS_WordIndex = PS_Word.0 PS_Word.PS_WordIndex.!Type = PS_CurrType PS_Word.PS_WordIndex.!Data = PS_CurrData PS_CurrType = "Value" PS_CurrData = "" PS_IsLiteral = 0 end end /* if whitespace */ else if PS_Char = '\' then do if PS_InQuotes & \PS_InEscape then PS_InEscape = 1 else do PS_CurrData = PS_CurrData || PS_Char PS_InEscape = 0 end end else if PS_Char = '"' then do if PS_InEscape then PS_CurrData = PS_CurrData || PS_Char else if PS_InQuotes & PS_CurrData \== "" then do
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -