1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
C
C
C +-----------------------------------------------------------------+
C | |
C | Copyright (C) 1986 by UCAR |
C | University Corporation for Atmospheric Research |
C | All Rights Reserved |
C | |
C | NCARGRAPHICS Version 1.00 |
C | |
C +-----------------------------------------------------------------+
C
C
C ---------------------------------------------------------------------
C
SUBROUTINE AGRPCH (CHST,LNCS,IDCS)
C
CHARACTER*(*) CHST
C
C This routine is used to replace a character string previously stored
C by the routine AGSTCH (which see). This could be done by an AGDLCH
C followed by an AGSTCH, and, in fact, under certain conditions, does
C exactly that. Only when it is easy to do so does AGRPCH operate more
C efficiently. Nevertheless, a user who (for example) repeatedly and
C perhaps redundantly defines x-axis labels of the same length may
C greatly benefit thereby; repeated deletes and stores would lead to
C frequent garbage collection by AGSTCH.
C
C AGRPCH has the following arguments:
C
C -- CHST is the new character string, to replace what was originally
C stored.
C
C -- LNCS is the length of the character string in CHST.
C
C -- IDCS is the identifier returned by AGSTCH when the original string
C was stored. The value of IDCS may be changed by the call.
C
C The following common blocks contain variables which are required for
C the character-storage-and-retrieval scheme of AUTOGRAPH.
C
COMMON /AGCHR1/ LNIC,INCH(2,50),LNCA,INCA
C
COMMON /AGCHR2/ CHRA(2000)
C
CHARACTER*1 CHRA
C
C If the identifier is positive or is negative but less than -LNIC, the
C original string was never stored in CHRA; just treat the replacement
C as a store and return a new value of IDCS.
C
IF (IDCS.GT.(-1).OR.IDCS.LT.(-LNIC)) THEN
CALL AGSTCH (CHST,LNCS,IDCS)
C
ELSE
C
C The absolute value of the identifier is the index, in INCH, of the
C descriptor of the character string stored in CHRA. If the new string
C is shorter than the old one, store it and zero remaining character
C positions. Otherwise, treat the replacement as a delete followed by
C a store.
C
I=-IDCS
IF (LNCS.LE.INCH(2,I)) THEN
J=INCH(1,I)-1
DO 101 K=1,LNCS
J=J+1
CHRA(J)=CHST(K:K)
101 CONTINUE
DO 102 K=LNCS+1,INCH(2,I)
J=J+1
CHRA(J)=CHAR(0)
102 CONTINUE
INCH(2,I)=LNCS
ELSE
CALL AGDLCH (IDCS)
CALL AGSTCH (CHST,LNCS,IDCS)
END IF
C
END IF
C
C Done.
C
RETURN
C
END
|