1 SUB SMG_TITLE(STRING Text,LONG Vir_disp_num) !---------------------------------------------------------------& ! & ! SMG_TITLE & ! & ! Creation Date: 3-July-1985 & ! Author: Ken Messer & ! Purpose: Write a title at the top of a & ! virtual display. This assumes & ! that the virtual display is & ! 24 X 80, or at least 4 X 80 and & ! is pasted at 1,1 of a 24 X 80 & ! pasteboard. & ! & ! Modification history & ! & ! Date Description of change(s) & ! & !---------------------------------------------------------------& ! & ! Copyright (c) 1985 - Ken Messer, Allied Electronics, Inc., & ! 401 E. 8th St., Ft. Worth, TX 76102 & ! & ! This software may be copied and distributed freely to anyone & ! for non-commerical use provided that this copyright notice is & ! included. & !---------------------------------------------------------------& OPTION TYPE = INTEGER, SIZE = INTEGER LONG %include "SMG$LIBRARY:SMG.DFN" DECLARE LONG VT100_compatible, & Return_status, & DVI_Vector DECLARE LONG CONSTANT True = -1 DECLARE STRING Current_time DECLARE STRING CONSTANT & & Center_line = "'CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC" EXTERNAL LONG CONSTANT SS$_Normal, & TT2$M_Deccrt, & TT$M_Scope, & DVI$_DevDepend, & DVI$_DevDepend2 EXTERNAL LONG FUNCTION SMG$Draw_line, & SMG$Put_chars, & SMG$Put_chars_highwide, & LIB$Getdvi EXTERNAL STRING FUNCTION Get_Error_Message(LONG) !---------------------------------------------------------------& ! & ! M a i n P r o g r a m L o g i c & ! & !---------------------------------------------------------------& ! determine if we're a VT100 compatible terminal Return_status = LIB$Getdvi(DVI$_DevDepend2,,"TT",DVI_Vector,,) VT100_compatible = True IF DVI_Vector AND TT2$M_Deccrt ! if not, see if scope is set - could be a VT52 ! if not a scope, forget it - exit the routine IF NOT VT100_compatible THEN Return_status = LIB$Getdvi(DVI$_DevDepend,,"TT",DVI_Vector,,) GOTO Done UNLESS DVI_Vector AND TT$M_Scope END IF ! Set the time/date line Current_time = TIME$(0) Current_time = SEG$(Current_time,2,LEN(Current_time)) & IF SEG$(Current_time,1,1) = "0" ! Write the title in double-height double-width characters on rows 1 and 2 ! If it won't fit, or if we can't use double-height double-width, ! write it centered on row 1 IF VT100_compatible AND LEN(Text) <= 40 THEN Return_status = SMG$Put_chars_highwide(Display_id(Vir_disp_num),Text,1, & ((80-2*LEN(Text))/2)+1,0,0,) IF Return_status AND SS$_Normal = 0 THEN PRINT Get_Error_Message(Return_status) STOP END IF ELSE Return_status = SMG$Put_chars(Display_id(Vir_disp_num), & FORMAT$(Text,Center_line),1,1,0,0,) IF Return_status AND SS$_Normal = 0 THEN PRINT Get_Error_Message(Return_status) STOP END IF END IF ! Write the time/date on row 3 Return_status = SMG$Put_chars(Display_id(Vir_disp_num),Current_time,3,1,1,0,0,) IF Return_status AND SS$_Normal = 0 THEN PRINT Get_Error_Message(Return_status) STOP END IF Return_status = SMG$Put_chars(Display_id(Vir_disp_num),DATE$(0),3,72,0,0,0,) IF Return_status AND SS$_Normal = 0 THEN PRINT Get_Error_Message(Return_status) STOP END IF ! Write a horizontal line on row 4 Return_status = SMG$Draw_line(Display_id(Vir_disp_num),4,1,4,80,0,0) IF Return_status AND SS$_Normal = 0 THEN PRINT Get_Error_Message(Return_status) STOP END IF Done: SUBEXIT END SUB