| 1 |
C Copyright(C) 1999-2020 National Technology & Engineering Solutions |
| 2 |
C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with |
| 3 |
C NTESS, the U.S. Government retains certain rights in this software. |
| 4 |
C |
| 5 |
C See packages/seacas/LICENSE for details |
| 6 |
SUBROUTINE MXLONG (NAME1, NEWLEN, NEWLOC, MYV, MYCHAR, MYLOC, |
| 7 |
* MYCLOC, UCLOC, COFFST, OFFSET, |
| 8 |
* DICT, DPOINT, LDICT, NNAMES, VOID, LVOID, NVOIDS, |
| 9 |
* FILL, FDATA, CFILL, CFDATA, CHRNUM, CHRCOL, LASTER) |
| 10 |
|
| 11 |
IMPLICIT INTEGER (A-Z) |
| 12 |
INCLUDE 'params.inc' |
| 13 |
|
| 14 |
C*********************************************************************** |
| 15 |
|
| 16 |
C NAME1 Name of the vector which changes length |
| 17 |
CHARACTER*8 NAME1 |
| 18 |
C NEWLEN The new length of the vector |
| 19 |
C NEWLOC The new location of the vector (returned) |
| 20 |
C MYV Internal reference array |
| 21 |
DIMENSION MYV(*) |
| 22 |
C MYCHAR Internal reference array. |
| 23 |
CHARACTER MYCHAR(*) |
| 24 |
C MYLOC Address of internal array |
| 25 |
C MYCLOC Address of internal character array. |
| 26 |
C UCLOC Address of user's character array. |
| 27 |
C COFFST Offset between internal numeric array and user's |
| 28 |
C character array. |
| 29 |
C OFFSET Address offset from internal array to user's array |
| 30 |
C DICT Dictionary name table |
| 31 |
C DPOINT Dictionary pointer table |
| 32 |
C LDICT Dimension of dictionary |
| 33 |
C NNAMES Number of names in the dictionary |
| 34 |
CHARACTER DICT(LDICT,CHRCOL) |
| 35 |
DIMENSION DPOINT(LDICT,CHRCOL,3), NNAMES(2) |
| 36 |
C VOID Void table |
| 37 |
C LVOID Dimension of void table |
| 38 |
C NVOIDS Number of voids |
| 39 |
DIMENSION VOID(LVOID,CHRCOL,2), NVOIDS(2) |
| 40 |
C FILL Flag for data fill. |
| 41 |
C FDATA Data for fill. |
| 42 |
LOGICAL FILL |
| 43 |
C CFILL Flag for character data fill. |
| 44 |
C CFDATA Data for fill. |
| 45 |
LOGICAL CFILL |
| 46 |
CHARACTER*1 CFDATA |
| 47 |
C CHRNUM Number of characters per numeric storage unit |
| 48 |
C CHRCOL Number of column for character names. |
| 49 |
C LASTER Error return |
| 50 |
|
| 51 |
C*********************************************************************** |
| 52 |
|
| 53 |
C Get current location and length. |
| 54 |
|
| 55 |
CALL MXFIND (NAME1, DICT, DPOINT, LDICT, NNAMES, |
| 56 |
* CHRCOL, LASTER, ROW) |
| 57 |
IF (LASTER .NE. SUCCESS) RETURN |
| 58 |
|
| 59 |
C Save the current location of the array. |
| 60 |
|
| 61 |
OLDLOC = DPOINT(ROW,1,1) |
| 62 |
OLDLEN = DPOINT(ROW,1,2) |
| 63 |
|
| 64 |
LASTER = SUCCESS |
| 65 |
oldadr = oldloc+myloc-1 |
| 66 |
memret = -998 |
| 67 |
memlen = newlen |
| 68 |
|
| 69 |
C ... If the old length == 0, then we don't have a valid pointer. |
| 70 |
C Need to call malloc instead of realloc. |
| 71 |
if (oldlen .eq. 0) then |
| 72 |
memret = 0 |
| 73 |
if (memlen .gt. 0) then |
| 74 |
call exmemy(memlen, oldadr, memret) |
| 75 |
end if |
| 76 |
else |
| 77 |
call exmemy(-memlen, oldadr, memret) |
| 78 |
end if |
| 79 |
|
| 80 |
if (memret .lt. 0 .or. memret .gt. memlen) then |
| 81 |
laster = ilblk |
| 82 |
write (*,*) 'ERROR in mxlong ', memret, memlen |
| 83 |
return |
| 84 |
end if |
| 85 |
|
| 86 |
IF (LASTER .NE. SUCCESS) RETURN |
| 87 |
|
| 88 |
DPOINT(ROW,1,1) = oldadr+1-myloc |
| 89 |
NEWLOC = DPOINT(ROW,1,1) + OFFSET |
| 90 |
DPOINT(ROW,1,2) = NEWLEN |
| 91 |
|
| 92 |
C Perform data fill if appropriate. |
| 93 |
|
| 94 |
IF (FILL) THEN |
| 95 |
DO J = DPOINT(ROW,1,1)+OLDLEN, DPOINT(ROW,1,1)+NEWLEN-1 |
| 96 |
MYV(J) = FDATA |
| 97 |
end do |
| 98 |
END IF |
| 99 |
|
| 100 |
RETURN |
| 101 |
END |