📄 staftest.cmd
字号:
STAFError.!Timeout.!Text = "Timeout" STAFError.!JavaError = 38 STAFError.!JavaError.!Text = "Java Error" STAFError.!ConverterError = 39 STAFError.!ConverterError.!Text = "Converter Error" STAFError.!TotalCodes = 39 STAFError.!UserStartCodes = 4000 RETURN 0/* End of STAFErrorText */InitParser: parse arg IP_ParserName call SetCurrentParser IP_ParserName OpString_Option.OpString_CurrentParser.0 = 0 OpString_OptionGroup.OpString_CurrentParser.0 = 0 OpString_OptionNeed.OpString_CurrentParser.0 = 0 OpString_MaxArguments.OpString_CurrentParser = 0 RETURN 0/* End of InitOptions */SetCurrentParser: parse arg OpString_CurrentParser if OpString_CurrentParser = "" then OpString_CurrentParser = "OPSTRING_DEFAULT" else OpString_CurrentParser = "OPSTRING_"OpString_CurrentParser OpString_CurrentParser = TRANSLATE(OpString_CurrentParser) RETURN 0/* End of SetCurrentParser */SetMaxArguments: parse arg SMA_NumArgs OpString_MaxArguments.OpString_CurrentParser = SMA_NumArgs RETURN 0/* End of SetMaxArguments */AddOption: parse arg AO_Name, AO_Times, AO_Required OpString_Option.OpString_CurrentParser.0 =, OpString_Option.OpString_CurrentParser.0 + 1 AO_Index = OpString_Option.OpString_CurrentParser.0 OpString_Option.OpString_CurrentParser.AO_Index.!Name = AO_Name OpString_Option.OpString_CurrentParser.AO_Index.!Times = AO_Times OpString_Option.OpString_CurrentParser.AO_Index.!ValueRequired =, TRANSLATE(AO_Required) RETURN 0/* End of AddOption */AddOptionGroup: parse arg AOG_Group, AOG_Minimum, AOG_Maximum OpString_OptionGroup.OpString_CurrentParser.0 =, OpString_OptionGroup.OpString_CurrentParser.0 + 1 AOG_Index = OpString_OptionGroup.OpString_CurrentParser.0 OpString_OptionGroup.OpString_CurrentParser.AOG_Index.!Group = AOG_Group OpString_OptionGroup.OpString_CurrentParser.AOG_Index.!Minimum =, AOG_Minimum OpString_OptionGroup.OpString_CurrentParser.AOG_Index.!Maximum =, AOG_Maximum RETURN 0/* End of AddOptionGroup */AddOptionNeed: parse arg AON_Needer, AON_Needee OpString_OptionNeed.OpString_CurrentParser.0 =, OpString_OptionNeed.OpString_CurrentParser.0 + 1 AON_Index = OpString_OptionNeed.OpString_CurrentParser.0 OpString_OptionNeed.OpString_CurrentParser.AON_Index.!Needer = AON_Needer OpString_OptionNeed.OpString_CurrentParser.AON_Index.!Needee = AON_Needee RETURN 0/* End of AddOptionGroup */NumInstances: RETURN OpString_Instance.OpString_CurrentParser.0/* End of NumInstances */InstanceName: parse arg IN_Num RETURN OpString_Instance.OpString_CurrentParser.IN_Num.!Name/* End of InstanceName */InstanceValue: parse arg IN_Num RETURN OpString_Instance.OpString_CurrentParser.IN_Num.!Value/* End of InstanceValue */NumArguments: RETURN OpString_Arg.OpString_CurrentParser.0/* End of NumArguments */Argument: parse arg ARG_Num RETURN OpString_Arg.OpString_CurrentParser.ARG_Num/* End of Argument *//***********************************************************************//* OptionTimes - Determins 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 OpString_Instance.OpString_CurrentParser.0 if TRANSLATE(OpString_Instance.OpString_CurrentParser.OT_i.!Name) =, TRANSLATE(OT_Name) then do OT_Times = OT_Times + 1 end end RETURN OT_Times/************************************************************************//* OptionValue - Determines the value of the specified occurance of the *//* specified option *//* *//* Accepts: The name of the option to determine the value of *//* 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 given on the command line) *//************************************************************************/OptionValue: parse arg OV_Name, OV_Occurance if OV_Occurance = '' then OV_Occurance = 1 OV_Times = 0 do OV_i = 1 to OpString_Instance.OpString_CurrentParser.0, UNTIL (OV_Times = OV_Occurance) if TRANSLATE(OpString_Instance.OpString_CurrentParser.OV_i.!Name) =, TRANSLATE(OV_Name) then do OV_Times = OV_Times + 1 end end if OV_Times \= OV_Occurance then RETURN '' RETURN OpString_Instance.OpString_CurrentParser.OV_i.!Value/* --- Internals --- *//* OpString_Option.OpString_CurrentParser.0 *//* OpString_Option.OpString_CurrentParser.i.!Name *//* OpString_Option.OpString_CurrentParser.i.!Times - 0=unlimited *//* OpString_Option.OpString_CurrentParser.i.!ValueRequired - Yes, No, *//* Allowed *//* OpString_OptionGroup.OpString_CurrentParser.0 *//* OpString_OptionGroup.OpString_CurrentParser.i.!Group *//* OpString_OptionGroup.OpString_CurrentParser.i.!Minimum *//* OpString_OptionGroup.OpString_CurrentParser.i.!Maximum *//* *//* OpString_OptionNeed.OpString_CurrentParser.0 *//* OpString_OptionNeed.OpString_CurrentParser.i.!Needer *//* OpString_OptionNeed.OpString_CurrentParser.i.!Needee *//* *//* OpString_MaxArguments.OpString_CurrentParser *//* *//* PS_Word.0 *//* PS_Word.i.!Data *//* PS_Word.i.!Type - Option, Value *//* *//* OpString_Instance.OpString_CurrentParser.0 *//* OpString_Instance.OpString_CurrentParser.i.!Name *//* OpString_Instance.OpString_CurrentParser.i.!Value *//* *//* OpString_Arg.OpString_CurrentParser.0 *//* OpString_Arg.OpString_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 OpString_Arg.OpString_CurrentParser.0 = 0 OpString_Instance.OpString_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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -