2 FPAINT
FPAINT invokes the FPAINT editor. Upon exit, the source generator is
invoked. Command syntax is

    FPAINT FileName		( FileName is optional )
3 /NoSource
Disables execution of the source code generator.
3 Application_Library
The following describes some of the routines found in the FPaint
library. Applications that reference them should be linked with
Fpaint_Directory:FPaint.olb/lib or Fpaint_Directory:SMG_FPaint.olb/lib.
To obtain a hardcopy listing, print Fpaint_Directory:lib.doc.
4 TTYinit
Subroutine: TTYinit

Process: Clears CRT screen, homes cursor, sets default scrolling region,
	 sets normal display attribute, sets default character set and
	 opens an channel for the screen and keyboard I/O routines.
4 OutString
Subroutine: OutString( String )

Prerequisite: TTYinit must be called.

Input-Parameters: String [=] character*n   ( n>1, n<=80 )

Process: Output a character string to the terminal without carriage
	 return/linefeed ( Non-FORTRAN I/O ).
4 DelChar
Subroutine: DelChar(N)

Prerequisite: TTYinit must be called.

Input-Parameters: N [=] integer*2

Process: Deletes N characters at cursor position.
4 InsChar
Subroutine: InsChar(N)

Prerequisite: TTYinit must be called.

Input-Parameters: N [=] integer*2

Process: Inserts N spaces at cursor position.
4 DelLine
Subroutine: DelLine(N)

Prerequisite: TTYinit must be called.

Input-Parameters: N [=] integer*2

Process: Deletes N lines at cursor line.
4 InsLine
Subroutine: InsLine(N)

Prerequisite: TTYinit must be called.

Input-Parameters: N [=] integer*2

Process: Inserts N blank lines at cursor line.
4 ClrScr
Subroutine: ClrScr

Prerequisite: TTYinit must be called.

Process: Clears screen and homes cursor.
4 ClrTop
Subroutine: ClrTop

Prerequisite: TTYinit must be called.

Process: Clears from cursor position to top of page.
4 ClrEop
Subroutine: ClrEop

Prerequisite: TTYinit must be called.

Process: Clears from cursor position to end of page.
4 ClrLine
Subroutine: ClrLine

Prerequisite: TTYinit must be called.

Process: Clears cursor line.
4 ClrBol
Subroutine: ClrBol

Prerequisite: TTYinit must be called.

Process: Clears from cursor position to beginning of line.
4 ClrEol
Subroutine: ClrEol

Prerequisite: TTYinit must be called.

Process: Clears from cursor position to end of line.
4 EraseRegion
Subroutine: EraseRegion( UpperLeftRow, UpperLeftCol, LowerRightRow, LowerRightCol )

Prerequisite: TTYinit must be called.

Input-Parameters: UpperLeftRow [=] integer*2, UpperLeftCol [=] integer*2,
		  LowerRightRow [=] integer*2, LowerRightCol [=] integer*2

Process: Clears a region of the screen as efficiently as possible.
4 CsrLeft
Subroutine: CsrLeft(N)

Prerequisite: TTYinit must be called.

Input-Parameters: N [=] integer*2

Process: Moves cursor left N columns ( stops at left margin ).
4 CsrRight
Subroutine: CsrRight(N)

Prerequisite: TTYinit must be called.

Input-Parameters: N [=] integer*2

Process: Moves cursor right N columns ( stops at right margin ).
4 CsrUp
Subroutine: CsrUp(N)

Prerequisite: TTYinit must be called.

Input-Parameters: N [=] integer*2

Process: Moves cursor up N rows ( stops at top of scrolling region ).
4 CsrDown
Subroutine: CsrDown(N)

Prerequisite: TTYinit must be called.

Input-Parameters: N [=] integer*2

Process: Moves cursor down N rows ( stops at bottom of scrolling region ).
4 CsrPos
Subroutine: CsrPos(Row,Col)

Prerequisite: TTYinit must be called.

Input-Parameters: Row [=] integer*2, Col [=] integer*2

Process: Positions cursor at Row,Col.
4 CsrReport
Subroutine: CsrReport(Row,Col)

Prerequisite: TTYinit must be called.

Input-Parameters: Row [=] integer*2, Col [=] integer*2

Process: Returns current cursor position in Row,Col.
4 CsrSave
Subroutine: CsrSave

Prerequisite: TTYinit must be called.

Process: Saves current display attribute and cursor position.
4 CsrRestore
Subroutine: CsrRestore

Prerequisite: TTYinit must be called.

Process: Restores display attribute and cursor position from last CsrSave.
4 DspAttribute
Subroutine: DspAttribute( Attr )

Prerequisite: TTYinit must be called.

Input-Parameters: Attr [=] integer*2

Process: Sets display attribute.

	     Value of Attr		resulting display attribute
	     -----------		---------------------------
		0			normal
		1			reverse
		2			intense
		3			reverse, intense
		4			blink
		5			reverse, blink
		6			intense, blink
		7			reverse, intense, blink

		+8			Above with line drawing character set,
					i.e. 13 is reverse, blink with the
					line drawing character set enabled.
4 SaveAttribute
Subroutine: SaveAttribute

Prerequisite: TTYinit must be called.

Process: Saves the current display attribute.
4 RstAttribute
Subroutine: RstAttribute

Prerequisite: TTYinit must be called.

Process: Restores the last saved display attribute.
4 GetAttribute
Subroutine: GetAttribute( Attr )

Prerequisite: TTYinit must be called.

Input-Parameters: Attr [=] integer*2

Process: Returns the current display attribute.
4 ScrlRegion
Subroutine: ScrlRegion(top,left,bottom,right)

Prerequisite: TTYinit must be called.

Input-Parameters: top [=] integer*2, left [=] integer*2,
                  bottom [=] integer*2, right [=] integer*2

Process: Sets scrolling region window.
4 ScrollUp
Subroutine: ScrollUp(N)

Prerequisite: TTYinit must be called.

Input-Parameters: N [=] integer*2

Process: Scrolls window up N lines.
4 ScrollDown
Subroutine: ScrollDown(N)

Prerequisite: TTYinit must be called.

Input-Parameters: N [=] integer*2

Process: Scrolls window down N lines.
4 ScrollLeft
Subroutine: ScrollLeft(N)	(only available with SMG library)

Prerequisite: TTYinit must be called.

Input-Parameters: N [=] integer*2

Process: Scrolls window Left N columns.
4 ScrollRight
Subroutine: ScrollRight(N)	(only available with SMG library)

Prerequisite: TTYinit must be called.

Input-Parameters: N [=] integer*2

Process: Scrolls window right N columns.
4 InsMode
Subroutine: InsMode

Prerequisite: TTYinit must be called.

Process: Sets display mode to "insert". Subsequent characters displayed
	  on the terminal will be inserted at cursor position ( if
	  supported by your terminal ).
4 OvWrtMode
Subroutine: OvWrtMode

Prerequisite: TTYinit must be called.

Process: Sets display mode to "overwrite". Subsequent characters displayed
	  on the terminal will replace characters at cursor position.
4 ChrRdy 
logical*1 function: ChrRdy

Prerequisite: TTYinit must be called.

Process: Returns true if a character is available in the keyboard buffer.
4 FPGetChar
Subroutine: FPGetChar(Char)		( Previously, GetChar )

Prerequisite: TTYinit must be called.

Input-Parameters: Char [=] integer*2

Process: Gets a single character without waiting for a carriage return.
	   Char is returned as the ASCII value of the key pressed.


                 KEY              NUMERIC CODE

                 Up Arrow            128
                 Down Arrow          129
                 Left Arrow          130
                 Right Arrow         131

                 PF1                 141
                 PF2                 142
                 PF3                 143
                 PF4                 144

                 Key Pad 0           157
                 Key Pad 1           158
                 Key Pad 2           159
                 Key Pad 3           160
                 Key Pad 4           161
                 Key Pad 5           162
                 Key Pad 6           163
                 Key Pad 7           164
                 Key Pad 8           165
                 Key Pad 9           166
                 Key Pad -           167
                 Key Pad ,           168  ( 8 for VAX version )
                 Key Pad .           169
                 Key Pad Enter       170

                 Back Tab            132  ( generated by ^X )
                 Del Char at Cursor  127  ( generated by Del or Backspace )
                 Del Char Backward     8  ( generated by Backspace or key pad , )


                For IBM PC

                Keypad Keys

                Insert              23  (^W)
                Delete             127  (Del)
                Home                 2  (^B)
                End                  5  (^E)
                PgUp               133
                PgDn               134


                Function Keys   Un-Shifted      Shifted

                F1                 141            151
                F2                 142            152
                F3                 143            153
                F4                 144            154
                F5                 145            155
                F6                 146            156
                F7                 147            157
                F8                 148            158
                F9                 149            159
                F10                150            160
4 NextChar
Subroutine: NextChar(Char)

Prerequisite: TTYinit must be called.

Input-Parameters: Char [=] integer*2

Process: Returns the next character in the FPGetChar buffer WITHOUT removing
	  it from the buffer.
4 Echo
logical*1 Function: Echo(DummyArg)

Prerequisite: TTYinit must be called.

Parameters: DummyArg - for compatibility, may be a literal 0.

Process: Returns .true. if echo is on, .false. if echo is off.
4 EchoOff
Subroutine: EchoOff

Prerequisite: TTYinit must be called.

Process: turns terminal echo off, characters typed at keyboard are not echoed.
4 EchoOn
Subroutine: EchoOn

Prerequisite: TTYinit must be called.

Process: turns terminal echo on, charcters typed at keyboard are now echoed.
4 KpdOn
Subroutine: KpdOn

Prerequisite: TTYinit must be called.

Process: Turns on the application key pad.
4 KpdOff
Subroutine: KpdOff

Prerequisite: TTYinit must be called.

Process: Turns off the application key pad ( returns to numeric ).
4 beep
Subroutine: beep

Prerequisite: TTYinit must be called. In addition, when used with
              the SMG library, buffering must be off (i.e. if FPStartBuffer
              has been called, FPStopBuffer must be called before calling
              beep).

Process: Generates a beep.
4 ReadChangeFlag
Subroutine: ReadChangeFlag( FieldChanged )

Prerequisite: Fpaint screen edit must be performed.

Process: returns a parameter which indicates whether any change was made
	 to the Fpaint screen most recently edited.

Output-Parameters: FieldChanged [=] logical*1
4 DsablScrnHelpLine
Subroutine: DsablScrnHelpLine

Process: Disable the display of the FPaint screen help line that is
	 displayed during the edit operation.
4 EnablScrnHelpLine
Subroutine: EnablScrnHelpLine

Process: Enable the display of the FPaint screen help line that is
	 displayed during the edit operation ( this is the default
	 state ).
4 DsablHelpText
Subroutine: DsablHelpText

Process: Disable the display of the FPaint help text that is
	 displayed during the edit operation.
4 EnablHelpText
Subroutine: EnablHelpText

Process: Enable the display of the FPaint help text that is
	 displayed during the edit operation ( this is the default
	 state ).
4 ErrMsg
Subroutine: ErrMsg( String )

Prerequisite: TTYinit must be called.

Input-Parameters: String [=] character*n   ( n>1, n<=80 )

Process: Outputs String center justified on line 23, beeps terminal
	 and displays "Press Return" below String. Routine then waits
	 until a key is pressed before returning.
4 DspMessage
Subroutine: DspMessage( String1, String2 )

Prerequisite: TTYinit must be called.

Input-Parameters: String1 [=] character*n   ( n>1, n<=80 )
	   	  String2 [=] character*n   ( n>1, n<=80 )

Process: Outputs String1 on line 23 and String 2 on line 24. Both
	 are center justified.
4 Menu1
Subroutine: Menu1( Row, String, PossibleValues, ItemSelected, Selection, Abort )

Prerequisite: TTYinit must be called.

Input-Parameters:
	Row [=] integer*2 - row on CRT to display the menu.

	String [=] character*n - menu line.

	PossibleValues [=] character*n - list of single keys that correspond
	      		                 to each menu item ItemSelected.

Process:  Display a 'Lotus' type menu and return users choice.

Output-Parameters:
	ItemSelected [=] integer*2 - Number of menu item selected - should
			             be set to default menu item on entry.

	Selection [=] integer*2 - ASCII value of the "Possible Value"
			          that was selected.

	Abort [=] logical*1 - True if Esc key or PF1 was pressed.


Example of a possible call to menu:

	Row = 24
	String = 'First_Item     Second_Item     Third_Item'
	PossibleValues = 'FST'
	ItemSelected = 1

	call EraseRegion( 23,1, 24,80 )
	call CsrPos( 23, 1 )
	call OutString( 'Make your selection:' )
	call Menu1(Row, String, PossibleValues, ItemSelected, Selection, Abort)

	When Menu1 is called, String is displayed with the "ItemSelected"
 	menu item displayed in reverse video. The reverse video item may
	be changed with the left and right arrow keys. Hitting return will
	cause ItemSelected and Selection to correspond to the menu item.
	Alternatively, one of the "PossibleValues" keys may be pressed
	to select the item.

	Note that the underscore in the above example is displayed as a
	space. It is used to compose a single menu item that consists of
	more than one word.
4 RghtJustify
Subroutine: RghtJustify( String )

Input-Parameters: String [=] character*n   ( n>1, n<=80 )

Process: Right justifies String within the 'n' characters.

Output-Parameters: String [=] character*n   ( n>1, n<=80 )
4 LeftJustify
Subroutine: LeftJustify( String )

Input-Parameters: String [=] character*n   ( n>1, n<=80 )

Process: Left justifies the String within the 'n' characters.

Output-Parameters: String [=] character*n   ( n>1, n<=80 )
4 Cnter
Subroutine: Cnter( String )

Input-Parameters: String [=] character*n   ( n>1, n<=80 )

Process: Center justifies the String within the 'n' characters.

Output-Parameters: String [=] character*n   ( n>1, n<=80 )
4 CvtToUpCase
Subroutine: CvtToUpCase( String )

Input-Parameters: String [=] character*n   ( n>1, n<=80 )

Process:  Converts String to all uppercase characters.

Output-Parameters: String = character*n   ( n>1, n<=80 )
4 Length
integer*2 function: Length( String )

Input-Parameters: String [=] character*n   ( n>1, n<=80 )

Process: Returns the non-blank length of String, not the declared
	 size 'n'.
4 GetInteger
Subroutine: GetInteger( String, Int )

Input-Parameters: String [=] character*n

Process: return an integer*2 value from String.

OutPut-Parameters: Int [=] integer*2
4 GetReal
Subroutine: GetReal( String, Real )

Input-Parameters: String [=] character*n

Process: return a real value from String.

OutPut-Parameters: Real [=] real
4 ValidDat
logical*1 function: ValidDat( DateString )

Input-Parameters: DateString [=] character*n  ( n >= 9 )

Process: validate the DateString, returns .true. if the string contains
	 a valid DEC formatted date.  ( 4-JUL-87 )
4 ValidInt
logical*1 function: ValidInt( IntString )

Input-Parameters: IntString [=] character*n

Process: validate the IntString, returns .true. if the string contains
	 a valid integer value.
4 ValidRea
logical*1 function: ValidRea( RealString )

Input-Parameters: RealString [=] character*n

Process: validate the RealString, returns .true. if the string contains
	 a valid real value.
4 LoadCommands
Subroutine: LoadCommands( CommandList, NumCmds, Workspace1, Workspace2,
                          Workspace3, Error )

Input-Parameters:
	CommandList [=] character*n - List of commands separated by at
	                              one space.

	NumCmds [=] integer*2 - Number of commands in above list.

Process: This routine is used in conjuction with DecodeCmd. It loads commands
         ( or any list of tokens ) and determines the number of characters
         required for the unique identification of each. See DecodeCmd for
         further information.

OutPut-Parameters:
	Workspace1(2,NumCmds) [=] integer*2 - Used by DecodeCmd, do not modify.

	Workspace2(NumCmds) [=] integer*2 - Used by DecodeCmd, do not modify.

	Workspace3(NumCmds) [=] integer*2 - Used by DecodeCmd, do not modify.

	Error [=] integer*2 - 0 : no error
	                      1 : internal program error ( should not occur )
	                      2 : command list is empty
4 DecodeCmd
Subroutine: DecodeCmd( CommandList, NumCmds, InputCommand, Workspace1,
                       Workspace2, Workspace3, OutputCommand, CommandIndex,
                       Error )

Prerequisite: LoadCommands must be called.

Input-Parameters:
	CommandList [=] character*n - List of commands from LoadCommands.

	NumCmds [=] integer*2 - Number of commands in above list.

	InputCommand [=] character*n - Input command.

Process: This routine takes an input command, which need contain only enough
         characters to uniquely identify a token in the command list, and
         returns the entire upcased command from the command list along with
         its position in the list.

OutPut-Parameters:
	Workspace1(2,NumCmds) [=] integer*2 - From LoadCommands, do not modify.

	Workspace2(NumCmds) [=] integer*2 - From LoadCommands, do not modify.

	Workspace3(NumCmds) [=] integer*2 - From LoadCommands, do not modify.

	OutputCommand [=] character*n - Command found in the command list that
	                                corresponds to the input command.

	CommandIndex [=] integer*2 - Position of the command in the list.

	Error [=] integer*2 - 0 : no error
	                      1 : command not found
	                      2 : ambiguous command
4 Parse
Subroutine: Parse( Line, WhiteSpaceChars, QuoteChars, Separators, MaxTokens,
                   Pointer, TokenLength, NumTokensFound, Error )

Input-Parameters:
	Line [=] character*n - Line of text to be scanned.

	WhiteSpaceChars [=] character*n - Characters to be ignored during scan.

	QuoteChars [=] character*n - Characters used to delimit quoted strings.
	                             Quoted strings are marked as a single token.

	Separators [=] character*n - Single separator characters. Tokens usually
	                             consist of contiguous non-whitespace
	                             characters. Separators, however, are marked
	                             as individual, one character tokens.

	MaxTokens [=] integer*2 - Maximum number of tokens to be scanned for.
	                          Remaining information in Line is ignored.

Process: Parse scans a line of text and marks the position of each token in
         a pointer array. White space characters are ignored, quoted text is
         marked as a single token ( with the quote characters removed ), and
         separator characters are marked as individual, single character tokens.

OutPut-Parameters:
	Pointer(2,MaxTokens) [=] integer*2 -

		Pointer(1,i) Points to the first character of the ith token and
		Pointer(2,i) Points to the last character of the ith token.

	TokenLength(MaxTokens) [=] integer*2 - Length of each token

	NumTokensFound [=] integer*2 - Number of tokens in Line

	Error [=] integer*2 - 0 : successful
	                      any other value : quote parity error

	Example:

	integer*2 MaxTokens
	parameter ( MaxTokens=10 )

	character*132 Line
	character*1 WhiteSpaceChars, QuoteChars, Separators
	integer*2 Pointer(2,MaxTokens), TokenLength(MaxTokens)
	integer*2 NumTokensFound, Error

	integer*2 Index, Frst, Last, Length


	WhiteSpaceChars = ' '
	QuoteChars = '"'
	Separators = ','
	Line = 'this is a test "of routine parse"      one,two'

	call Parse( Line, WhiteSpaceChars, QuoteChars, Separators,
     &   MaxTokens, Pointer, TokenLength, NumTokensFound, Error )

	do 100 Index = 1 , NumTokensFound
	  Frst = Pointer(1,Index)
	  Last = Pointer(2,Index)
	  Length = TokenLength(Index)
	  type 10, Index, Line(Frst:Last), Length
10	  format( 1x, 'Token(', i2, ') = ', a, ' - Length = ', i2 )
100	continue

	end


    *** the following output results from the above program ***

	Token( 1) = this - Length =  4
	Token( 2) = is - Length =  2
	Token( 3) = a - Length =  1
	Token( 4) = test - Length =  4
	Token( 5) = of routine parse - Length = 16
	Token( 6) = one - Length =  3
	Token( 7) = , - Length =  1
	Token( 8) = two - Length =  3
4 SysLun
integer*2 function: SysLun( String )

Input-Parameters: String [=] character*n == 'Printer' or 'Display'
		  or 'KeyBoard' or 'Error'

Process: returns ForTran LUN for logical device.
4 Today
Subroutine: Today( Date )

Process: Get today's date from system in DEC format ( 23-AUG-87 ).

Output-Parameters: Date [=] character*9
4 Delay
Subroutine: Delay( MilSec )

Input-Parameters: MilSec [=] integer*2

Process: suspend program for MilSec miliseconds
4 Snooze
Subroutine: Snooze( MilSec )

Prerequisite: TTYinit must be called.

Input-Parameters: MilSec [=] integer*2

Process: suspend program for MilSec miliseconds, wakeup on key press.
4 FPStartBuffer
subroutine FPStartBuffer
      
Prerequisite: TTYinit must be called.

Process: Turns on buffering of screen output.

NOTE: Working routine is only available with the SMG library.
4 FPStopBuffer
subroutine FPStopBuffer
      
Process: Turns off screen output buffering and updates the screen.

NOTE: Working routine is only available with the SMG library.
4 FPFlushBuffer
subroutine FPFlushBuffer
      
Process: Updates screen during buffering.

NOTE: Working routine is only available with the SMG library.
4 FPBuffer
logical*1 function FPBuffer( integer*2 Dummy )
      
Input-Parameters: Dummy [=] integer*2

Process: Returns .true. if buffering is on.

NOTE: Working routine is only available with the SMG library.
4 FPRawMode
subroutine FPRawMode
      
Process: Call this routine prior to sending device specific formatted
         escape sequences to the  terminal  with  routines  in
         SMG_FPaint.olb (e.g. OutString, TTYO ).

NOTE: Working routine is only available with the SMG library.
4 FPCookedMode
subroutine FPCookedMode
      
Process: Call this routine after FPRawMode to return SMG to the default
         mode of trapping formatted escape sequences.

NOTE: Working routine is only available with the SMG library.
4 StNoCtlY
subroutine StNoCtlY

Process: Allows the SMG version of FPGetChar to read control Y's as input.
	 The VMS control Y AST is thus disabled.

	 NOTE: In this mode, typing control Y will NOT force an exit to VMS
	       under any condition.

NOTE: Working routine is only available with the SMG library.
4 StCtlY
subroutine StCtlY

Process: Prohibits the SMG version of FPGetChar from reading control Y's as
	 input. The VMS control Y AST is thus enabled (default). Typing a
	 control Y in this mode will force an exit to VMS.

NOTE: Working routine is only available with the SMG library.
4 StNoCtlT
subroutine StNoCtlT

Process: Allows the SMG version of FPGetChar to read control T's as input.
	 The VMS control T AST is thus disabled.

NOTE: Working routine is only available with the SMG library.
4 StCtlT
subroutine StCtlT

Process: Prohibits the SMG version of FPGetChar from reading control T's as
	 input. The VMS control Y AST is thus enabled (default). Typing a
	 control T in this mode will invoke a status typeout by VMS.

NOTE: Working routine is only available with the SMG library.
