12 lines
12 KiB
JSON
12 lines
12 KiB
JSON
{
|
|
"header": {
|
|
"version": 1,
|
|
"type": "record",
|
|
"approw-key": "%SRP_TCLCMD_TEMPLATE%"
|
|
},
|
|
"body": {
|
|
"record1": {
|
|
"<1>": "Compile function SRP_TCLCMD_%1%(Message, Window, Parameters, Options, Status, RetData, HTMLRetData)\r\n\r\n/***********************************************************************************************\r\n*\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n* Name : SRP_TCLCMD_%1%\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n* Description: Called by the SRP_TCL_Processer to execute the %1% command.\t\t\t\t\t\t\r\n*\t\t\t\tLike all SRP TCL commands, this command must support all TCL messages (see \t\t\r\n*\t\t\t\tSRP_TCL_EQUATES insert):\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\t\t\t\tEQU SRP_TCLMSG_SYNTAX$\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\t\t\t\t\tStatus: \t <unused>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\t\t\t\t\tRetData:\t A single-line string showing the command's syntax\t\t\t\t\r\n*\t\t\t\t\tHTMLRetData: A single-line, HTML formatted string showing the command's\t\t\r\n*\t\t\t\t\t\t\t\t syntax\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\t\t\t\tEQU SRP_TCLMSG_HELP$\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\t\t\t\t\tStatus:\t\t <unused>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\t\t\t\t\tRetData:\t An @FM delimited list of descriptive text instructing the user \r\n*\t\t\t\t\t\t\t\t on how to use the command. Each Field in the list represents\t\r\n*\t\t\t\t\t\t\t\t one line of text. There is no limit on number of lines.\t\t\r\n*\t\t\t\t\tHTMLRetData: An HTML formatted string instructing the user on how to use\t\r\n*\t\t\t\t\t\t\t\t the command.\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\t\t\t\tEQU SRP_TCLMSG_PROCESS$\tto 3\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\t\t\t\t\tStatus: \t The final status of the command's processing, regardless of\t\r\n*\t\t\t\t\t\t\t\t success or failure\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\t\t\t\t\tRetData:\t An @FM delimited list of data to display to the user in\t\t\r\n*\t\t\t\t\t\t\t\t addition to the status. Each Field in the list represents one \t\r\n*\t\t\t\t\t\t\t\t line of text. There is no limit on number of lines.\t\t\t\r\n*\t\t\t\t\tHTMLRetData: HTML formatted data to display to the user in addition to the\t\r\n*\t\t\t\t\t\t\t\t status.\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\t\t\t\tEQU SRP_TCLMSG_AUTHOR$\tto 4\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\t\t\t\t\tStatus: \t <unused>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\t\t\t\t\tRetData:\t A single-line string showing the commands author\t\t\t\t\r\n*\t\t\t\t\tHTMLRetData: A single-line, HTML formatted string showing the commands\t\t\r\n*\t\t\t\t\t\t\t\t author\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\t\t\t\t!!!IMPORTANT!!!\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\t\t\t\tRetData and HTMLRetData are meant to provide 2 ways of displaying the SAME data.\r\n*\t\t\t\tThis way, a variety of user interfaces can display results. RetData is meant for\r\n*\t\t\t\tplain edit controls while HTMLRetData is meant for HTML controls. The only\t\t\r\n*\t\t\t\tdifference between the two is formatting.\t\t\t\t\t\t\t\t\t\t\r\n*\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n* Parameters:\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\tMessage\t\t\t[in] -- Message from SRP_TCL_Processor requesting info or processing\t\t\r\n*\tWindow\t\t\t[in] -- Fully qualified name of the TCL interface window\t\t\t\t\t\r\n*\tParameters\t\t[in] -- @FM delimited list of parameters parsed by the TCL processor. All\t\r\n*\t\t\t\t\t\t\t parameters are forced to UPPERCASE except for those surrounded by\t\r\n*\t\t\t\t\t\t\t quotation marks.\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\tOptions\t\t\t[in] -- A string whose individual characters represent an option; use\t\t\r\n*\t\t\t\t\t\t\t IndexC to see if an option exists in the string\t\t\t\t\t\r\n*\tStatus\t\t\t[out] -- The status text for the command line processing results\t\t\t\r\n*\t\t\t\t\t\t\t Output format is a single line of text\t\t\t\t\t\t\t\t\r\n*\tRetData\t\t\t[out] -- Data returned by the command, e.g., lists or other information\t\t\r\n*\t\t\t\t\t\t\t Output format is an @FM delimited list of data\t\t\t\t\t\t\r\n*\tHTMLRetData\t\t[out] -- Data returned by the command in HTML format\t\t\t\t\t\t\r\n*\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n* Returns:\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\tSuccess$ or Failure$\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n* History (Date, Initials, Notes)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\t03/23/05\tKRF\t\tAdded support for Options\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\t03/16/05\tKRF\t\tAdded support for Author signatures\t\t\t\t\t\t\t\t\t\t\r\n*\t03/12/05\tKRF\t\tAdd HTMLRetData for HTML output support; changed out SYNTAX and HELP are\r\n*\t\t\t\t\t\treturned (via RetData and HTMLRetData instead of Ans)\t\t\t\t\t\r\n*\t01/28/05\tKRF\t\tOriginal Programmer\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n************************************************************************************************/\r\n\r\n* Identifies TCL messages\r\n$insert SRP_TCL_EQUATES\r\n\r\n* Some useful equates\r\nEqu No$ \t\t\t\tto\t0\r\nEqu Yes$ \t\t\t\tto\t1\r\nEqu Failure$\t\t\tto\t0\r\nEqu Success$\t\t\tto\t1\r\nEqu Otherwise$\t\t\tto\t1\r\nEqu CRLF$\t\t\t\tto\t\\0D0A\\\r\n\r\n* Function and subroutine declarations\r\nDeclare subroutine SRP_TCL_Format_Syntax, SRP_TCL_Format_Help\r\nDeclare function Get_Property, IsWindow\r\n\r\n* Init the parameters\r\nIf Assigned(Message) else Message = 0\r\nIf Assigned(Window) AND IsWindow(Get_Property(Window, \"HANDLE\")) else Window = @Window\r\nIf Assigned(Parameters) else Parameters = \"\"\r\nIf Assigned(Options) else Options = \"\"\r\nStatus = \"\"\r\nRetData = \"\"\r\nHTMLRetData = \"\"\r\n\r\n* Process TCL message\r\nBegin Case\r\n\tCase Message EQ SRP_TCLMSG_SYNTAX$\r\n\t\tGoSub SYNTAX\r\n\t\tSRP_TCL_Format_Syntax(Command, Params, RetData, HTMLRetData, Options)\r\n\t\tAns = Success$\r\n\tCase Message EQ SRP_TCLMSG_HELP$\r\n\t\tGoSub HELP\r\n\t\tSRP_TCL_Format_Help(Command, Description, Params, ParamDesc, Remarks, RetData, HTMLRetData, Author, Options, OptionDesc)\r\n\t\tAns = Success$\r\n\tCase Message EQ SRP_TCLMSG_PROCESS$\r\n\t\tGoSub PROCESS\r\n\t\tIf RetData NE \"\" AND HTMLRetData EQ \"\" then\r\n\t\t\tHTMLRetData = RetData\r\n\t\t\tSwap @FM with \"<br>\" in HTMLRetData\r\n\t\t\tSwap \" \" with \" \" in HTMLRetData\r\n\t\tend\r\n\tCase Message EQ SRP_TCLMSG_AUTHOR$\r\n\t\tGoSub AUTHOR\r\n\t\tAns = Success$\r\n\t\tRetData = Author\r\n\t\tHTMLRetData = Author\r\nEnd Case\r\n\r\n* This ensures that Ans gets assigned, but it defaults to a failure. So set this as requested by the message\r\nIf Assigned(Ans) else Ans = Failure$\r\nReturn Ans\r\n\r\n\r\n/***********************************************************************************************\r\n* AUTHOR\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n* Set the author of the command here. SRP TCL uses this to differentiate between commands\t\t\r\n* created by SRP Computer Solutions, Inc. and command created by others. For instance, the SRP\t\r\n* Editor automatic update utility will use this to ensure that custom commands are not\t\t\t\r\n* overridden without the user's consent.\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n************************************************************************************************/\r\nAUTHOR:\r\n\r\n\tAuthor = \"%2%\"\r\n\r\nreturn\r\n\r\n\r\n/***********************************************************************************************\r\n* SYNTAX\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n* Returns a single-line string showing the command's syntax. SRP uses the following standard:\t\r\n*\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n* 1. First word is always the command and is always UPPERCASE\t\t\t\t\t\t\t\t\t\r\n* 2. Parameters are Title Cased\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n* 3. Optional Parameters are incased in [Square Brackets]\t\t\t\t\t\t\t\t\t\t\r\n*\t\tRequired Parameter:\t\tMyParameter\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\t\tOptional Parameter:\t\t[MyParameter]\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n* 4. Parameters showing a list of options are UPPERCASE, enclosed in {French Braces} and\t\t\r\n* separated by |pipes| (no spaces). However, if an option list is optional, it is surrounded \r\n*\t by [Sqaure Braces] instead.\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\t\tRequired Option List:\t{OPTION1|OPTION2|OPTION3}\t\t\t\t\t\t\t\t\t\t\r\n*\t\tOptional Option List:\t[OPTION1|OPTION2|OPTION3]\t\t\t\t\t\t\t\t\t\t\r\n* 5. Command Options is a single string of single character flags; the TCL parser extracts this\t\r\n*\t automatically and passes it to you via the Options parameter. Still, you should list all\t\r\n*\t possible options below.\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\t\tExample: \"CLPSX\" (five options)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n*\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n* NOTE: The command is already set for you. Just add each parameter to the Params array, and\t\r\n* \tremember to use the above formatting rules for consistency.\tDon't forget the Options\t\r\n*\t\teither.\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n************************************************************************************************/\r\nSYNTAX:\r\n\r\n\t* The command\r\n\tCommand = \"%1%\"\r\n\t\r\n\t* List of parameters\r\n\tParams = \"\"\r\n\tParams<-1> = \"\"\r\n\t\r\n\t* List of options (as a single string)\r\n\tOptions = \"\"\r\n\r\nreturn\r\n\r\n\r\n/***********************************************************************************************\r\n* HELP\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n* Returns descriptive text instructing the user on how to use the command.\t\t\t\t\t\t\r\n*\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n* Note: AUTHOR and SYNTAX are retreived for you. You only have to supply parameter descriptions,\r\n*\t\toption descriptions, and remarks.\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n************************************************************************************************/\r\nHELP:\r\n\r\n\t* Get the syntax and author (this prevents need to retype command and parameters)\r\n\tGoSub AUTHOR\r\n\tGoSub SYNTAX\r\n\t\r\n\t* The description (keep this short, you can elaborate in the remarks section below)\r\n\tDescription = \"\"\r\n\t\r\n\t* List of parameter descriptions (make sure this is in the same order as the Params above)\r\n\t* If you need multiple paragraphs for one parameter, then separate them using @VM\r\n\tParamDesc = \"\"\r\n\tParamDesc<-1> = \"\"\r\n\t\r\n\t* List of option descriptions (make sure this is in the same order as the Options above)\r\n\t* If you need multiple paragraphs for one parameter, then separate them using @VM\r\n\tOptionDesc = \"\"\r\n\tOptionDesc<-1> = \"\"\r\n\t\r\n\t* This is the remarks section. Add as much info as you want. Each field should be treated as\r\n\t* one paragraph (that is, the HTML formatter will do this)\r\n\tRemarks = \"\"\r\n\tRemarks<-1> = \"\"\r\n\t\r\nreturn\r\n\r\n\r\n/***********************************************************************************************\r\n* PROCESS\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n* Returns 1 for success, 0 for failure. This GoSub should set ALWAYS set the Status variable\t\r\n* to describe to the user the result of the process, even if there was no error. The RetData\t\r\n* is not required, but if the user needs additional information -- regardless of success or\t\t\r\n* failure -- then RetData is a good place to put it. RetData is always an @FM delimited array,\t\r\n* with each field representing one line of output. Additionally, HTMLRetData can be used to\t\t\r\n* return HTML formatted results. If you leave HTMLRetData blank, then the routine will\t\t\t\r\n* automatically generate it based on the contents of RetData.\t\t\t\t\t\t\t\t\t\r\n*\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n* !!!IMPORTANT!!!\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n* When successful, be sure to set Ans = Success$\t\t\t\t\t\t\t\t\t\t\t\t\r\n************************************************************************************************/\r\nPROCESS:\r\n\tStatus = \"PROCESS for Command %1% is undefined\"\r\nreturn"
|
|
}
|
|
}
|
|
} |