tldm-universe/Ardent/UV/APP.PROGS/UVPRINTMSG
2024-09-09 17:51:08 -04:00

126 lines
4.1 KiB
Plaintext
Executable File

******************************************************************************
*
* Subroutine to print a message from sys.message file
*
* Module %M% Version %I% Date %H%
*
* (c) Copyright 1998 Ardent Software Inc. - All Rights Reserved
* This is unpublished proprietary source code of Ardent Software Inc.
* The copyright notice above does not evidence any actual or intended
* publication of such source code.
*
*******************************************************************************
*
* Maintenence log - insert most recent change descriptions at top
*
* Date.... GTAR# WHO Description.........................................
* 05/05/99 24820 DTM Modified to support 64bit message format
* 10/14/98 23801 SAP Change copyrights.
* 12/14/92 10714 PVW Support of BELL OFF/BELL ON command.
* 11/23/92 10214 PVW Make UV.INTERNAL common block a separate entity
* and include PI/open DEVSYS common block.
* 08/13/92 9584 JWT Set flag once sys message file is opened
* 11/01/91 8871 DTM Made it correctly handle formatted messages
* 04/13/90 6709 JWT Make delete BASIC so indexs get updated
*
*******************************************************************************
SUBROUTINE UVPRINTMSG( MESSAGE.NO, MESSAGE.PARAM)
ID = "%W%"
$INCLUDE UNIVERSE.INCLUDE UV.COM
MESSAGE.ID = MESSAGE.NO "R%6"
READ MESSAGE.REC FROM SYS.MESSAGE, MESSAGE.ID
ELSE
PRINT "[":MESSAGE.ID:"]":
RETURN
END
* if BELL is toggled off then remove bells from message
*
IF NOT(@SYS.BELL) THEN
MESSAGE.REC = CONVERT(CHAR(7),"",MESSAGE.REC)
END
MESSAGE.LEN = LEN(MESSAGE.REC)
MESSAGE.TEXT = ""
PARAM.COUNT = 0
FOR I = 1 TO MESSAGE.LEN
M.CHAR = MESSAGE.REC[I,1]
BEGIN CASE
CASE M.CHAR = @FM
PRINT MESSAGE.TEXT
MESSAGE.TEXT = ""
CASE M.CHAR = "%"
IF I = MESSAGE.LEN THEN MESSAGE.TEXT := M.CHAR
ELSE
I += 1
M.CHAR2 = MESSAGE.REC[I,1]
IF M.CHAR2 = "%"
THEN MESSAGE.TEXT := "%"
ELSE
PARAM.COUNT += 1
NEXT.PARAM = MESSAGE.PARAM<PARAM.COUNT>
PARAM.FORMAT = ""
IF M.CHAR2 = "("
THEN
LOOP
IF I = MESSAGE.LEN
THEN
PRINT MESSAGE.TEXT:"[MESSAGE ":MESSAGE.ID:", SCAN ERROR]":
RETURN
END
I += 1
M.CHAR2 = MESSAGE.REC[I,1]
UNTIL M.CHAR2 = ")" DO
PARAM.FORMAT := M.CHAR2
REPEAT
IF I = MESSAGE.LEN
THEN
PRINT MESSAGE.TEXT:"[MESSAGE ":MESSAGE.ID:", SCAN ERROR]":
RETURN
END
I += 1
M.CHAR2 = MESSAGE.REC[I,1]
END
BEGIN CASE
CASE M.CHAR2 = "I" OR M.CHAR2 = "i"
NEXT.PARAM = INT(NEXT.PARAM)
CASE M.CHAR2 = "A" OR M.CHAR2 = "a"
NEXT.PARAM = INT(NEXT.PARAM)
CASE M.CHAR2 = "L" OR M.CHAR2 = "l"
NEXT.PARAM = INT(NEXT.PARAM)
CASE M.CHAR2 = "D" OR M.CHAR2 = "d"
NEXT.PARAM = NEXT.PARAM + 0
CASE M.CHAR2 = "F" OR M.CHAR2 = "f"
NEXT.PARAM = NEXT.PARAM + 0
CASE M.CHAR2 = "X" OR M.CHAR2 = "x"
NEXT.PARAM = OCONV(INT(NEXT.PARAM),"MX0C")
CASE M.CHAR2 = "B" OR M.CHAR2 = "b"
NEXT.PARAM = OCONV(INT(NEXT.PARAM),"MX0C")
CASE M.CHAR2 = "S" OR M.CHAR2 = "s"
NULL
CASE M.CHAR2 = "N" OR M.CHAR2 = "n"
NULL
CASE M.CHAR2 = "C" OR M.CHAR2 = "c"
NEXT.PARAM = NEXT.PARAM[1,1]
CASE 1
NEXT.PARAM = "[MESSAGE ":MESSAGE.ID:", BAD FORMAT %":M.CHAR2:" ]"
END CASE
IF PARAM.FORMAT THEN NEXT.PARAM = NEXT.PARAM PARAM.FORMAT
MESSAGE.TEXT := NEXT.PARAM
END
END
CASE 1
MESSAGE.TEXT := M.CHAR
END CASE
NEXT I
PRINT MESSAGE.TEXT:
RETURN