	SUBROUTINE ERRMSG (MSG)
C COPYRIGHT (C) 1983 GLENN EVERHART
C PERMISSION IS GIVEN TO ANYONE TO USE, DISTRIBUTE, OR COPY THIS
C PROGRAM FREELY BUT NOT TO SELL IT COMMERCIALLY.
C
C	CJD1	Oct-90, Chris Doran, Sira, more-or-less complete
C			rewrite for SMG interface
C			Save & restore cursor around message, so that
C			in interactive CALC it doesn't put you at line 2.
C
	INCLUDE 'VKLUGPRM.FTN'
	PARAMETER CUP=1
	PARAMETER DECSC = 9, DECRC = 8					!CJD1
C	PARAMETER RRW = 32
C	PARAMETER RCL = 32
C RRW=MAX REAL ROWS
C RCL=MAX REAL COLS
C RRW MUST BE 1 LARGER TO HANDLE 1ST 27 VARIABLES IN AVBLS
C VBLS AND TYPE DIMENSIONED RRW,RCL
C **************************************************
C *                                                *
C *       SUBROUTINE  ERRMSG(MSG)                  *
C *                                                *
C **************************************************
C
C
C PRINTS OUT ERROR MESSAGES AS REQUESTED BY CODE IN MSG.
C
C
C
C
C
C ERRMSG IS CALLED BY THE FOLLOWING ROUTINES:
C
C AT
C BASCNG
C CALBIN
C CALC
C CALUN
C CMND
C CONTYP
C DECLR
C ERRCX
C INPOST
C MULADD
C MULDIV
C MULMUL
C NEXTEL
C POSTVL
C VAROUT
C ZNEG
C
C
C
C
C
C
C MODIFICATION CLASSES: M1
C
C
C
C    VARIABLE    USE
C
C   I         TEMPORARY VARIABLE TO AVOID SIDE-EFFECT WITH CALLS
C             THAT USE A CONSTANT FOR THE ARGUMENT.
C   MSG       ERROR MESSAGE CODE.
C
C
C
C  NOTE: USE CODE 25 FOR UNKNOWN CAUSES.
C
C
C
C	SUBROUTINE ERRMSG (MSG)
C
	InTEgeR*4 MSG,I
C
	CALL UVT100(DECSC)						!CJD1
	CALL UVT100(CUP,1,10)
	CALL LWRITE(1,14H*** ERROR *** ,14)
	GOTO (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21),MSG
	I=MSG-21
	GOTO (22,23,24,25,26,27), I
	GO TO 25
C
C
99	CALL UVT100(DECRC)						!CJD1
	RETURN
C
C
1	CALL LWRITE(1,26HFIRST CHARACTER IS ILLEGAL,26)
	GO TO 99
2	CALL LWRITE(1,29HTOO MANY INDIRECT FILE LEVELS,29)
	GO TO 99
3	CALL LWRITE(1,20HUNIDENTIFIED COMMAND,20)
	GO TO 99
4	CALL LWRITE(1,
     1	47HILLEGAL CHARACTER IN DECLARATION VARIABLES LIST,47)
	GO TO 99
5	CALL LWRITE(1,
     1	48HVARIABLES IN DECLARATION NOT SEPARATED BY COMMAS,48)
	GO TO 99
6	CALL LWRITE(1,22HUNBALANCED PARENTHESIS,22)
	GO TO 99
7	CALL LWRITE(1,16HSTACK 1 OVERFLOW,16)
	GO TO 99
8	CALL LWRITE(1,18HILLEGAL EXPRESSION,18)
	GO TO 99
9	CALL LWRITE(1,16HSTACK 2 OVERFLOW,16)
	GO TO 99
10	CALL LWRITE(1,63HFUNCTION IS ILLEGAL FOR INTEGRAL (BASE 10, 8, A
     1ND 16) ARGUMENTS,63)
	GO TO 99
11	CALL LWRITE(1,
     1	47HILLEGAL FUNCTION FOR MULTIPLE PRECISION NUMBERS,47)
	GO TO 99
12	CALL LWRITE(1,39HFUNCTION IS ILLEGAL WITH ASCII ARGUMENT,39)
	GO TO 99
13	CALL LWRITE(1,
     1	48HFUNCTION IS ILLEGAL WITH REAL (DECIMAL) ARGUMENT,48)
	GO TO 99
14	CALL LWRITE(1,33HSQUARE ROOT HAS NEGATIVE ARGUMENT,33)
	GO TO 99
15	CALL LWRITE(1,
     1	49HMULTIPLE PRECISION EXPONENTIATION, NEGATIVE POWER,49)
	GO TO 99
16	CALL LWRITE(1,18HVARIABLE UNDEFINED,18)
	GO TO 99
17	CALL LWRITE(1,21HILLEGAL USE OF = SIGN,21)
	GO TO 99
18	CALL LWRITE(1,21HUNIDENTIFIED FUNCTION,21)
	GO TO 99
19	CALL LWRITE(1,26HILLEGAL BASE SPECIFICATION,26)
	GO TO 99
20	CALL LWRITE(1,18HILLEGAL CHARACTER ,18)
	GO TO 99
21	CALL LWRITE(1,31H. MAY ONLY BE USED WITH BASE 10,31)
	GO TO 99
22	CALL LWRITE(1,
     1	46HMULTIPLE PRECISION LIMIT OF 99 DIGITS EXCEEDED,46)
	GO TO 99
23	CALL LWRITE(1,25HATTEMPT TO DIVIDE BY ZERO,25)
	GO TO 99
24	CALL LWRITE(1,37HILLEGAL REAL EXPONENT FIELD SPECIFIED,37)
	GO TO 99
25	CALL LWRITE(1,28HUNKNOWN -- NOTIFY MAINTAINER,28)
	GO TO 99
26	CALL LWRITE(1,28HILLEGAL CONVERSION ATTEMPTED,28)
	GO TO 99
27	CALL LWRITE(1,10HREAD ERROR,10)
	GO TO 99
C
C	
	END
