-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnew.for
30 lines (30 loc) · 1.03 KB
/
new.for
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
C **********************************************************************
C * *
C * NEW$ - ALLOCATE PERMANENT STRING OF SIZE N *
C * *
C * NEW$ ALLOCATES A NEW STRING OF SIZE N. UNLIKE STRINGS ALLOCATED *
C * WITH TEMP$, STORAGE CANNOT BE RECLAIMED. NEW$ AND TEMP$ STRING *
C * SHARE THE SAME STORAGE SPACE. THE STRING RETURNED IS OF LENGTH 0. *
C * *
C **********************************************************************
C
REAL FUNCTION NEW$(N)
INTEGER N
C
INTEGER I
REAL S$
INTEGER IS$(2), S$OFF, S$LEN
C
INCLUDE STRING.INC
C
EQUIVALENCE (S$, IS$(1)), (IS$(1), S$OFF), (IS$(2), S$LEN)
C
I = STRUSE
STRUSE = STRUSE + N
IF (STRUSE .GT. STRMAX) STOP SSPACE
S$OFF = I
S$LEN = 0
NEW$ = S$
RETURN
END