<> <> <> <> <> <<<< Overview:>> <<>> <>>> DIRECTORY BasicTime USING [GMT, nullGMT], CHNameP2V0 USING [Name], NSString USING [nullString, String], Process USING [Seconds], Rope USING [ROPE], TTY USING [Handle], XMessage USING [StringArray], XNS USING [Host, Net, unknownHost, unknownNet]; TextInput: CEDAR DEFINITIONS = BEGIN OPEN CHName: CHNameP2V0; <<-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- >> <> <<-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- >> ROPE: TYPE ~ Rope.ROPE; ChoiceIndex: TYPE = [0..maxChoices]; Choices: TYPE = XMessage.StringArray; <> Chosen: TYPE = PACKED ARRAY ChoiceIndex OF BOOLEAN; <> HelpProc: TYPE = PROCEDURE [tty: TTY.Handle]; YesOrNo: TYPE = {yes, no, uncertain}; <<-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- >> <> <<-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -->> maxChoices: CARDINAL = 63; -- limited by the number of choices which can simultaneously be displayed on the tty screen values for specifying that no default exists, and for returning nil values. nilChoice: ChoiceIndex = maxChoices; nilDate: BasicTime.GMT = BasicTime.nullGMT; nilDecimal: INTEGER = FIRST[INTEGER]; -- (-32,768) nilLongDecimal: LONG INTEGER = FIRST[LONG INTEGER]; -- (-2,147,483,648); nilString: NSString.String = NSString.nullString; nilYesNo: YesOrNo = uncertain; --used only to specify that no default <<-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- >> <> <<-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- >> <<<< Although no signals or errors are defined in this interface, the user is expected to catch the signals and errors generated by calls on TTY.Handle. Specifically, the user should be prepared for TTY.Handle.Rubout and ABORTED.>>>> <<-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- >> <> <<-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- >> <<<< PARAMETER INPUT;>> <>>> Confirm: PROCEDURE [tty: TTY.Handle, prompt: NSString.String, default: YesOrNo _ nilYesNo, helpProc: HelpProc _ NIL] RETURNS [BOOLEAN] = INLINE {RETURN[GetYesNo[tty, prompt, default, helpProc] = yes]}; GetChoice: PROCEDURE [tty: TTY.Handle, prompt: NSString.String, choices: REF Choices, default: ChoiceIndex _ nilChoice, nilOK: BOOLEAN _ FALSE, helpProc: HelpProc _ NIL] RETURNS [ChoiceIndex]; <<<< Gives the user a numbered list of choices, and returns the index of the choice selected. The user selects a choice in the range [1..LENGTH[choices]], while the routine returns a choice in the range [0..LENGTH[choices]). default is given to the user as a default choice. nilChoice may be returned only if nilOK = TRUE. >>>> GetChoices: PROCEDURE [tty: TTY.Handle, prompt: NSString.String, choices: REF Choices, default: ChoiceIndex _ nilChoice, nilOK: BOOLEAN _ FALSE, helpProc: HelpProc _ NIL] RETURNS [Chosen]; <<<< choices are numbered 1 to LENGTH[Choices] and displayed to the user. The user selects choices in the range [1..LENGTH[choices]]. For each choice selected, chosen[selected] _ TRUE. nilChoice may be returned only if nilOK = TRUE. >>>> GetDate: PROCEDURE [tty: TTY.Handle, prompt: NSString.String, default: BasicTime.GMT _ nilDate, nilOK: BOOLEAN _ FALSE, helpProc: HelpProc _ NIL] RETURNS [BasicTime.GMT]; <> GetDateAndTime: PROCEDURE [tty: TTY.Handle, prompt: NSString.String, default: BasicTime.GMT _ nilDate, nilOK: BOOLEAN _ FALSE, helpProc: HelpProc _ NIL] RETURNS [BasicTime.GMT]; <> GetDecimal: PROCEDURE [tty: TTY.Handle, prompt: NSString.String, min: INTEGER _ FIRST[INTEGER], max: INTEGER _ LAST[INTEGER], default: INTEGER _ nilDecimal, nilOK: BOOLEAN _ FALSE, helpProc: HelpProc _ NIL] RETURNS [INTEGER]; <> GetHostNumber: PROCEDURE [tty: TTY.Handle, prompt: NSString.String, default: XNS.Host _ XNS.unknownHost, helpProc: HelpProc _ NIL] RETURNS [XNS.Host]; <> GetLongDecimal: PROCEDURE [tty: TTY.Handle, prompt: NSString.String, min: LONG INTEGER _ FIRST[LONG INTEGER], max: LONG INTEGER _ LAST[LONG INTEGER], default: LONG INTEGER _ nilLongDecimal, nilOK: BOOLEAN _ FALSE, helpProc: HelpProc _ NIL] RETURNS [LONG INTEGER]; <> GetNetworkNumber: PROCEDURE [tty: TTY.Handle, prompt: NSString.String, default: XNS.Net _ XNS.unknownNet, helpProc: HelpProc _ NIL] RETURNS [XNS.Net]; <> GetNSName: PROCEDURE [tty: TTY.Handle, prompt: NSString.String, name: CHName.Name, defaultName: CHName.Name _ [NIL, NIL, NIL], defaultFields: CHName.Name _ [NIL, NIL, NIL], promptFullyQualifiedDefault: BOOLEAN _ FALSE, helpProc: HelpProc _ NIL]; <<<< Obtains an NSName from the user, putting the result in "name", which must have been preallocated by the client. If "defaultName" is non-NIL, it is output and treated as the default input value. defaultFields is used for defaulting domain and org on input and/or output. If promptFullyQualifiedDefault is TRUE, domain and organization fields are never omitted when outputting default.>>>> GetPathName: PROCEDURE [tty: TTY.Handle, prompt: NSString.String, path: REF TEXT, defaultPath: NSString.String _ NSString.nullString, defaultFields: CHName.Name _ [NIL, NIL, NIL], promptFullyQualified, nilOK: BOOLEAN _ FALSE, helpProc: HelpProc _ NIL] RETURNS [newPath: REF TEXT]; GetText: PROCEDURE [tty: TTY.Handle, prompt: NSString.String, text: NSString.String, minLength: CARDINAL _ 1, maxLength: CARDINAL, echoStars: BOOLEAN _ FALSE, default: REF TEXT _ NIL, helpProc: HelpProc _ NIL] RETURNS [newText: NSString.String]; <<<< Inputs a text parameter, insuring that it is between minLength and maxLength characters long. echoStars is used to have asterisks echoed, as when entering passwords. It is safe to pass the same string as text and default in order to use the previous value of the string as the default. The returned string replaces the "text" parameter, which should no longer be used. If minLength = 0 and the user gives no input, the returned string will have a length of zero. >>>> GetTime: PROCEDURE [tty: TTY.Handle, prompt: NSString.String, default: BasicTime.GMT _ nilDate, nilOK: BOOLEAN _ FALSE, helpProc: HelpProc _ NIL] RETURNS [BasicTime.GMT]; <> GetTimedYesNo: PROCEDURE [tty: TTY.Handle, prompt: NSString.String, timeAllotted: Process.Seconds, valueIfTimedOut: YesOrNo, helpProc: HelpProc _ NIL] RETURNS [YesOrNo]; <> GetYesNo: PROCEDURE [tty: TTY.Handle, prompt: NSString.String, default: YesOrNo _ nilYesNo, helpProc: HelpProc _ NIL] RETURNS [YesOrNo]; <> TimedConfirm: PROCEDURE [tty: TTY.Handle, prompt: NSString.String, timeAllotted: Process.Seconds, valueIfTimedOut: YesOrNo, helpProc: HelpProc _ NIL] RETURNS [BOOLEAN] = INLINE { RETURN[GetTimedYesNo[tty, prompt, timeAllotted, valueIfTimedOut, helpProc] = yes]}; END. -- of TextInput.mesa LOG [Time - Person - Action] 26-Sep-83 9:48:45 - Alfvin - Created file from old NSCommand. 28-Oct-83 0:06:00 - McManis - Fixed up some comments. 7-Nov-83 23:11:30 - McManis - Allowed GetText to have minLength characters = 0. Added GetTime. 3-Jan-84 18:43:42 - Saund - Added NSName 29-Apr-85 16:03:17 - McManis - Added Confirm, GetPathName, and TimedConfirm.