[INHERIT('sys$library:starlet', 'sys$library:pascal$lib_routines', 'sys$library:pascal$smg_routines')] PROGRAM SMG_Example; {+} { { SMG_EXAMPLE.PAS { This program shows the use of the RTL Screen Management { Package, SMG. { {-} TYPE Cond_Code = UNSIGNED; Display_Id_Type = UNSIGNED; Pasteboard_Id_Type = UNSIGNED; Keyboard_Id_Type = UNSIGNED; Key_Table_Id_Type = UNSIGNED; VAR Status : Cond_Code; Text : VARYING [132] OF CHAR; Keyboard_Id : Keyboard_Id_Type; Pasteboard_Id : Pasteboard_Id_Type; Key_Table_Id : Key_Table_Id_Type; Display_Id_1 : Display_Id_Type; Display_Id_2 : Display_Id_Type; Pb_Rows : INTEGER; Pb_Columns : INTEGER; Display_Rows : INTEGER; BEGIN {+} { { Create the basic data-structures needed by SMG; { the PASTEBOARD, KEYBOARD, and KEY-TABLE. { {-} Status := SMG$Create_Pasteboard( Pasteboard_Id, {1} Number_of_Pasteboard_Rows := Pb_Rows, Number_of_Pasteboard_Columns := Pb_Columns ); IF NOT ODD(Status) THEN LIB$Stop(Status); Status := SMG$Create_Virtual_Keyboard(Keyboard_Id); IF NOT ODD(Status) THEN LIB$Stop(Status); Status := SMG$Create_Key_Table(Key_Table_Id); IF NOT ODD(Status) THEN LIB$Stop(Status); {+} { { Create and paste two VIRTUAL-DISPLAYs; one for top half of { screen and another for bottom half of screen. Label { the bottom display with "ECHO" { {-} Display_Rows := (Pb_Rows-4) DIV 2; {2} Status := SMG$Create_Virtual_Display(Display_Rows, Pb_Columns, Display_Id_1); IF NOT ODD(Status) THEN LIB$Stop(Status); Status := SMG$Create_Virtual_Display(Display_Rows, Pb_Columns, Display_Id_2); IF NOT ODD(Status) THEN LIB$Stop(Status); Status := SMG$Paste_Virtual_Display(Display_Id_1, Pasteboard_Id, 1, 1); IF NOT ODD(Status) THEN LIB$Stop(Status); Status := SMG$Paste_Virtual_Display(Display_Id_2, Pasteboard_Id, Pb_Rows DIV 2, 1); IF NOT ODD(Status) THEN LIB$Stop(Status); Status := SMG$Label_Border(Display_Id_2, 'ECHO'); IF NOT ODD(Status) THEN LIB$Stop(Status); {+} { { Read (and echo) lines in top part of screen and also echo { in bottom half of screen. { {-} WHILE ODD( SMG$Read_Composed_Line( Keyboard_Id, Key_Table_Id, {3} Text.Body, '> ', Text.Length, Display_Id_1)) DO BEGIN Status := SMG$Put_Line(Display_Id_2, Text); IF NOT ODD(Status) THEN LIB$Stop(Status); END; { move cursor to bottom of screen before exiting } {4} SMG$Set_Physical_Cursor(Pasteboard_Id, Pb_Rows-1, 1); END.