summaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
authorAngelo Rossi <angelo.rossi.homelab@gmail.com>2023-06-21 12:04:16 +0000
committerAngelo Rossi <angelo.rossi.homelab@gmail.com>2023-06-21 12:04:16 +0000
commitb18347ffc9db9641e215995edea1c04c363b2bdf (patch)
treef3908dc911399f1a21e17d950355ee56dc0919ee /sources
Initial commit.
Diffstat (limited to 'sources')
-rw-r--r--sources/Makefile144
-rw-r--r--sources/algebra.cpp362
-rw-r--r--sources/blkcom.cpp200
-rw-r--r--sources/comlock.cpp13
-rw-r--r--sources/datain.cpp1397
-rw-r--r--sources/dekplt.cpp265
-rw-r--r--sources/dekspy.cpp164
-rw-r--r--sources/emtp.cpp1130
-rw-r--r--sources/freedom.cpp64
-rw-r--r--sources/labcom.cpp101
-rw-r--r--sources/labl02.cpp36
-rw-r--r--sources/labl29.cpp50
-rw-r--r--sources/location.cpp65
-rw-r--r--sources/main.cpp387
-rw-r--r--sources/movecopy.cpp306
-rw-r--r--sources/newmods.cpp325
-rw-r--r--sources/over1.cpp767
-rw-r--r--sources/over20.cpp1909
-rw-r--r--sources/over51.cpp147
-rw-r--r--sources/plot.cpp172
-rw-r--r--sources/random.cpp236
-rw-r--r--sources/strcom.cpp33
-rw-r--r--sources/tacsar.cpp52
-rw-r--r--sources/time.cpp153
-rw-r--r--sources/umdeck.cpp32
-rw-r--r--sources/utilities.cpp356
-rw-r--r--sources/vardim.cpp219
-rw-r--r--sources/volt45.cpp15
28 files changed, 9100 insertions, 0 deletions
diff --git a/sources/Makefile b/sources/Makefile
new file mode 100644
index 0000000..68ac40a
--- /dev/null
+++ b/sources/Makefile
@@ -0,0 +1,144 @@
+#-*- mode: makefile; indent-tabs-mode: t; coding: utf-8; show-trailing-whitespace: t -*-
+# Makefile
+# Copyright 2022 Angelo Rossi <angelo.rossi.homelab@gmail.com>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+# Some utilities
+OS=${shell uname -s}
+
+# Debug enabled
+DEBUG=1
+
+# Defines verbose
+VERBOSE=
+
+# Defines the target name.
+TARGET=gemtp++
+
+# Linker script name.
+LINKER_SCRIPT=
+
+# Is a toolchain defined?
+ifndef TOOLCHAIN
+ TOOLCHAIN=gnu
+endif
+
+# The base directory for ST libraries.
+ROOT=..
+
+# Where to find source files that do not live in this directory.
+SOURCES_PATH=${ROOT}/sources
+
+# Where to find header files that do not live in the source directory.
+INCLUDES_PATH=${ROOT}/includes
+
+# Libraries path
+LIBRARIES_PATH=${ROOT}/libraries
+
+# Scripts path
+SCRIPTS_PATH=${ROOT}/scripts
+
+# Project definitions
+WITH_OVER1=1
+WITH_OVER20=1
+WITH_OVER51=1
+
+# Include common Makefile definitions.
+include ${ROOT}/Makefile.global
+
+# The default rule, which causes the Vibro Application to be built.
+all: ${TOOLCHAIN}
+all: ${TOOLCHAIN}/${TARGET}
+
+# List rule
+lst: all
+lst: ${TOOLCHAIN}/${TARGET}.lst
+
+# The rule to clean out all the build products.
+clean:
+ @if [ 'x${VERBOSE}' = x ]; \
+ then \
+ echo " [ CLEAN ] ${<}"; \
+ else \
+ echo "rm -rf ${TOOLCHAIN} ${wildcard *~} ${<}"; \
+ fi
+ @rm -rf ${TOOLCHAIN} ${wildcard *~} ${<}
+
+# The rule which creates the .o and executable directory.
+${TOOLCHAIN}:
+ @if [ 'x${VERBOSE}' = x ]; \
+ then \
+ echo " [ MKDIR ] ${TOOLCHAIN}"; \
+ else \
+ echo "mkdir -p ${TOOLCHAIN}"; \
+ fi
+ @mkdir -p ${TOOLCHAIN}
+
+# Rules for building the system code.
+${TOOLCHAIN}/${TARGET}: ${TOOLCHAIN}/utilities.o
+${TOOLCHAIN}/${TARGET}: ${TOOLCHAIN}/volt45.o
+${TOOLCHAIN}/${TARGET}: ${TOOLCHAIN}/blkcom.o
+${TOOLCHAIN}/${TARGET}: ${TOOLCHAIN}/dekspy.o
+${TOOLCHAIN}/${TARGET}: ${TOOLCHAIN}/dekplt.o
+${TOOLCHAIN}/${TARGET}: ${TOOLCHAIN}/tacsar.o
+${TOOLCHAIN}/${TARGET}: ${TOOLCHAIN}/comlock.o
+${TOOLCHAIN}/${TARGET}: ${TOOLCHAIN}/time.o
+${TOOLCHAIN}/${TARGET}: ${TOOLCHAIN}/strcom.o
+${TOOLCHAIN}/${TARGET}: ${TOOLCHAIN}/freedom.o
+${TOOLCHAIN}/${TARGET}: ${TOOLCHAIN}/movecopy.o
+${TOOLCHAIN}/${TARGET}: ${TOOLCHAIN}/location.o
+${TOOLCHAIN}/${TARGET}: ${TOOLCHAIN}/algebra.o
+${TOOLCHAIN}/${TARGET}: ${TOOLCHAIN}/random.o
+${TOOLCHAIN}/${TARGET}: ${TOOLCHAIN}/labcom.o
+${TOOLCHAIN}/${TARGET}: ${TOOLCHAIN}/newmods.o
+${TOOLCHAIN}/${TARGET}: ${TOOLCHAIN}/umdeck.o
+${TOOLCHAIN}/${TARGET}: ${TOOLCHAIN}/labl02.o
+${TOOLCHAIN}/${TARGET}: ${TOOLCHAIN}/plot.o
+
+ifdef WITH_OVER1
+${TOOLCHAIN}/${TARGET}: ${TOOLCHAIN}/over1.o
+endif
+
+ifdef WITH_OVER20
+${TOOLCHAIN}/${TARGET}: ${TOOLCHAIN}/over20.o
+endif
+
+ifdef WITH_OVER51
+${TOOLCHAIN}/${TARGET}: ${TOOLCHAIN}/over51.o
+endif
+
+
+${TOOLCHAIN}/${TARGET}: ${TOOLCHAIN}/datain.o
+${TOOLCHAIN}/${TARGET}: ${TOOLCHAIN}/emtp.o
+${TOOLCHAIN}/${TARGET}: ${TOOLCHAIN}/main.o
+
+# Include the automatically generated dependency files.
+ifneq (${MAKECMDGOALS},clean)
+-include ${wildcard ${TOOLCHAIN}/*.d} __dummy__
+endif
+# DO NOT DELETE
diff --git a/sources/algebra.cpp b/sources/algebra.cpp
new file mode 100644
index 0000000..b927435
--- /dev/null
+++ b/sources/algebra.cpp
@@ -0,0 +1,362 @@
+//-*- mode: c++; indent-tabs-mode: t; coding: utf-8; show-trailing-whitespace: t -*-
+
+// file algebra.cpp
+
+#include "algebra.hpp"
+
+namespace algebra {
+
+ // subroutine cdiz.
+
+ bool cdivz (double *ar, double *ai, const double &br, const double &bi, const double &cr, const double &ci, const int &nKSn)
+ {
+ bool bReturnValue = false;
+ double nFAC;
+ double nSR;
+ //
+ if (ar && ai) {
+ nFAC = cr * cr + ci * ci;
+ nFAC = 1.0 / nFAC;
+ nSR = br * nFAC * cr + bi * nFAC * ci;
+ *ai = bi * nFAC * cr - br * nFAC * ci;
+ *ar = nSR;
+ if (nKSn < 0) {
+ *ar = -*ar;
+ *ai = -*ai;
+ }
+ bReturnValue = true;
+ }
+ return bReturnValue;
+ }
+
+ // subroutine cmultz.
+
+ bool cmultz (double *ar, double *ai, const double &br, const double &bi, const double &cr, const double &ci, const int &nKSn)
+ {
+ bool bReturnValue = false;
+ //
+ if (ar && ai) {
+ *ar = br * cr - bi * ci;
+ *ai = bi * cr - br * ci;
+ if (nKSn < 0) {
+ *ar = -*ar;
+ *ai = -*ai;
+ }
+ }
+ return bReturnValue;
+ }
+
+ // subroutine trgwnd.
+
+ bool trgwnd (const double &x, double *d17)
+ {
+ bool bReturnValue = false;
+ int n13;
+ //
+ if (d17) {
+ *d17 = x;
+ if (fabs(x) >= 25000.0) {
+ n13 = x / (2.0 * M_PI);
+ *d17 -= 2.0 * n13 * M_PI;
+ if (blkcom::nIprsUp >= 1)
+ *((std::ostream *) blkcom::pLFiles[ 5 ]) << " Angle unwind in \"trgwnd\" called by \"rfunl1\". nchain, x, d17 =" << blkcom::nChain << x << *d17 << std::endl;
+ }
+ bReturnValue = true;
+ }
+ return bReturnValue;
+ }
+
+ // subroutine multmx.
+ bool multmx(std::vector<double> &sA, \
+ std::vector<double> &sB, \
+ std::vector<double> &sC, \
+ std::vector<double> &sTemp, \
+ const size_t &n)
+ {
+ // Subroutine multmx forms the matrix product (c) = (a)(b) where
+ // matrices (a), (b), and (c) are all n by n square arrays.
+ // Array 'temp' is a scratch working area of not less than 2n
+ // cells. Arrays (b) and (c) may be identical, thereby placing
+ // the product (a)(b) back into (b) . See subroutine 'mult'
+ // which is called herein, for details about the storage scheme used
+ // for these real, symmetric matrices.
+ bool bReturnValue = false;
+ long int l, ll0;
+ size_t i, ii;
+ size_t j;
+ size_t m;
+ //
+ ll0 = 0;
+ ii = 0;
+ for(j = 1; j <= n; j++) {
+ for(i = 1; i <= n; i++) {
+ if(i > j) {
+ l += (i - 1);
+ } else {
+ l = ii + i;
+ }
+ sTemp[ i - 1 ] = sB[ l - 1 ];
+ }
+ m = n + i;
+ std::vector<double> sTempX(sTemp.begin(), sTemp.begin() + n);
+ std::vector<double> sTempY(sTemp.begin() + m - 1, sTemp.begin() + n);
+ bReturnValue = algebra::mult(sA, \
+ sTempX, \
+ sTempY, \
+ n, \
+ ll0) && \
+ movecopy::move(sTemp.data() + m - 1, sC.data() + ii, j);
+ ii += j;
+ }
+ return bReturnValue;
+ }
+
+ // subroutine mult.
+ bool mult(std::vector<double> &sA, \
+ std::vector<double> &sX, \
+ std::vector<double> &sY, \
+ const size_t &n, \
+ long int &icheck)
+ {
+ bool bReturnValue = false;
+ double xx;
+ double yy;
+ size_t i, ii;
+ size_t k;
+ //
+ ii = 0;
+ k = 0;
+ FOREVER {
+ ++k;
+ if(k > n)
+ break;
+ xx = sX[ k - 1 ];
+ yy = sY[ k - 1 ];
+ if(icheck == 0)
+ yy = 0.0;
+ if(icheck < 0)
+ yy = -yy;
+ for(i = 1; i <= k; i++) {
+ ++ii;
+ sY[ i - 1 ] += sA[ ii - 1 ] * xx;
+ yy += sA[ ii - 1 ] * sX[ i - 1 ];
+ sY[ k - 1 ] = yy;
+ }
+ bReturnValue = true;
+ }
+ return bReturnValue;
+ }
+
+ // subroutine dgelg.
+ void dgelg(std::vector<double> &sR, \
+ std::vector<double> &sA, \
+ const size_t &m, \
+ const size_t &n, \
+ const float &eps, \
+ int &ier)
+ {
+ /*
+ * Purpose:
+ * to solve a general system of simultaneous linear equations.
+ *
+ * Usage:
+ * call dgelg(r, a, m, n, eps, ier)
+ *
+ * Description of parameters:
+ * r - double precision m by n right hand side matrix
+ * (destroyed). On return r contains the solutions
+ * of the equations.
+ * a - double precision m by m coefficient matrix
+ * (destroyed).
+ * m - the number of equations in the system.
+ * n - the number of right hand side vectors.
+ * eps - single precision input constant which is used as
+ * relative tolerance for test on loss of
+ * significance.
+ * ier - resulting error parameter coded as follows
+ * ier=0 - no error,
+ * ier=-1 - no result because of m less than 1 or
+ * pivot element at any elimination step
+ * equal to 0,
+ * ier=k - warning due to possible loss of signifi-
+ * cance indicated at elimination step k+1,
+ * where pivot element was less than or
+ * equal to the internal tolerance eps times
+ * absolutely greatest element of matrix a.
+ *
+ * Remarks:
+ * Input matrices r and a are assumed to be stored columnwise
+ * in m*n resp. m*m successive storage locations. On return
+ * solution matrix r is stored columnwise too.
+ * The procedure gives results if the number of equations m is
+ * greater than 0 and pivot elements at all elimination steps
+ * are different from 0. However warning ier=k - if given -
+ * indicates possible loss of significance. In case of a well
+ * scaled matrix a and appropriate tolerance eps, ier=k may be
+ * interpreted that matrix a has the rank k. No warning is
+ * given in case m=1.
+ *
+ * Method:
+ * Solution is done by means of gauss-elimination with
+ * complete pivoting.
+ */
+ size_t i, ii, ist, j, k, l, lend, ll, lst, mm, nm;
+ double piv, pivi, tb, tol;
+ /*
+ */
+ if(m <= 0)
+ goto a23;
+ ier = 0;
+ piv = 0.0;
+ mm = m * m;
+ nm = n * m;
+ for(l = 1; l <= mm; l++) {
+ tb = fabs(sA[ l - 1 ]);
+ if(tb > piv) {
+ piv = tb;
+ i = l;
+ }
+ }
+ tol = eps * piv;
+ lst = 1;
+ for(k = 1; k <= m; k++) {
+ if(piv <= 0.0)
+ goto a23;
+ if(ier != 0)
+ goto a7;
+ if(piv > tol)
+ goto a7;
+ ier = (long int) k - 1;
+
+ a7:
+ pivi = 1.0 / sA[ i - 1 ];
+ j = (i - 1) / m;
+ i = i - j * m - k;
+ j = j + 1 - k;
+ for(l = k; l <= nm; l += m) {
+ ll = l + i;
+ tb = pivi * sR[ ll - 1 ];
+ sR[ ll - 1 ] = sR[ l - 1 ];
+ sR[ l - 1 ] = tb;
+ }
+ if(k >= m)
+ goto a18;
+ lend = lst + m - k;
+ if(j <= 0)
+ goto a12;
+ ii = j * m;
+ for(l = lst; l <= lend; l++) {
+ tb = sA[ l - 1 ];
+ ll = l + ii;
+ sA[ l - 1 ] = sA[ ll - 1 ];
+ sA[ ll - 1 ] = tb;
+ }
+
+ a12:
+ for(l = lst; l <= mm; l += m) {
+ ll = l + i;
+ tb = pivi * sA[ ll - 1 ];
+ sA[ ll - 1 ] = sA[ l - 1 ];
+ sA[ l - 1 ] = tb;
+ }
+ sA[ lst - 1 ] = j;
+ piv = 0.0;
+ ++lst;
+ j = 0;
+ for(ii = lst; ii <= lend; ii++) {
+ pivi = -sA[ ii - 1 ];
+ ist = ii + m;
+ ++j;
+ for(l = ist; l <= mm; l += m) {
+ ll = l - j;
+ sA[ l - 1 ] += pivi * sA[ ll - 1 ];
+ tb = fabs(sA[ l - 1 ]);
+ if(tb > piv) {
+ piv = tb;
+ i = l;
+ }
+ }
+ for(l = k; l <= nm; l += m) {
+ ll = l + j;
+ sR[ ll - 1 ] += pivi * sR[ l - 1 ];
+ }
+ }
+ lst += m;
+ }
+
+ a18:
+ if(m > 1)
+ goto a19;
+ if (m == 1)
+ goto a22;
+ goto a23;
+
+ a19:
+ ist = mm + m;
+ lst = m + 1;
+ for(i = 2; i <= m; i++) {
+ ii = lst - i;
+ ist -= lst;
+ l = ist - m;
+ l = (long int) (sA[ l - 1 ] + 0.5);
+ for(j = ii; j <= nm; j += m) {
+ tb = sR[ j - 1 ];
+ ll = j;
+ for(k = ist; k <= mm; k += mm) {
+ ++ll;
+ tb -= sA[ k - 1 ] * sR[ ll - 1 ];
+ }
+ k = j + l;
+ sR[ j - 1 ] = sR[ k - 1 ];
+ sR[ k - 1 ] = tb;
+ }
+ }
+
+ a22:
+ return;
+
+ a23:
+ ier = -1;
+ }
+
+ // subroutine matmul
+ void matmul (double aum[ 3 ][ 3 ], double bum[ 3 ][ 3 ])
+ {
+ size_t n1, n2, n3, n5;
+ double cum[ 3 ][ 3 ];
+ //
+ n5 = 3;
+ for(n1 = 1; n1 <= n5; n1++) {
+ for(n2 = 1; n2 <= n5; n2++) {
+ cum[ n1 - 1 ][ n2 - 1 ] = aum[ n1 - 1 ][ 0 ] * bum[ 0 ][ n2 - 1 ];
+ for (n3 = 2; n3 <= n5; n3++) {
+ cum[ n1 - 1 ][ n2 - 1 ] = cum[ n1 - 1 ][ n2 - 1 ] + aum[ n1 - 1 ][ n3 - 1 ] * bum[ n3 - 1 ][ n2 - 1 ];
+ }
+ }
+ }
+ for(n1 =1; n1 <= n5; n1++) {
+ for(n2 = 1; n2 <= n5; n2++) {
+ aum[ n1 - 1 ][ n2 - 2 ] = cum[ n1 - 1 ][ n2 - 1 ];
+ }
+ }
+ }
+
+ // subroutine matvec.
+ void matvec(float aum[ 3 ][ 3 ], float yum[ 15 ])
+ {
+ size_t n1, n2, n3;
+ float x[ 3 ];
+ //
+ n1 = 3;
+ for (n2 = 1; n2 <= n1; n2++) {
+ for (n3 = 1; n3 <= n1; n3++) {
+ x[ n2 - 1 ] = x[ n2 - 1 ] + aum[ n2 - 1 ][ n3 - 1 ] * yum[ n3 - 1 ];
+ }
+ }
+ for (n2 = 1; n2 <= n1; n2++)
+ yum[ n2 - 1 ] = x[ n2 - 1 ];
+ }
+
+}
+
+// end of file algebra.cpp
diff --git a/sources/blkcom.cpp b/sources/blkcom.cpp
new file mode 100644
index 0000000..bd3952f
--- /dev/null
+++ b/sources/blkcom.cpp
@@ -0,0 +1,200 @@
+//-*- mode: c++; indent-tabs-mode: t; coding: utf-8; show-trailing-whitespace: t -*-
+
+// file blkcom.cpp
+
+#include "blkcom.hpp"
+
+namespace comthl {
+
+ int nSwTpe;
+ //
+ double nAngTpe;
+
+}
+
+namespace comld {
+
+ int nNewTAC;
+
+}
+
+namespace blkcom {
+
+ char cCSepar;
+ //
+ void *pIAlter;
+ void *pIDistX;
+ void *pInEcho;
+ void *pLFiles[ 24 ] = {
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ };
+ void *pKFile6;
+ void *pLFilesSave[ 24 ];
+ void *pMFilesSave[ 24 ];
+ void *pMonCar[ 90 ];
+ //
+ char pVSTACS[ 24 ];
+ //
+ long int nChain;
+ long int nEnerg;
+ long int nIAdd;
+ long int nIAverg;
+ long int nIBr;
+ long int nICat;
+ long int nIFDep;
+ long int nIFDep2;
+ long int nIFSem;
+ long int nIFX;
+ long int nIndStp;
+ long int nINOnL;
+ long int nIofbnd;
+ long int nIoffd;
+ long int nIofgnd;
+ long int nIPlot;
+ long int nIprsUp;
+ long int nIPunch;
+ long int nIsPlot;
+ long int nIsPrin;
+ long int nIStep;
+ long int nIt;
+ long int nIt1;
+ long int nIt2;
+ long int nKanal;
+ long int nKCount;
+ long int nKill;
+ long int nKol132;
+ long int nKolBeg;
+ long int nKPartB;
+ long int nKSwtch;
+ long int nKTRef;
+ long int nKWTSpy;
+ long int nLastOV;
+ long int nLBrnch;
+ long int nLBus;
+ long int nLHist;
+ long int nLLBuff;
+ long int nLTLabl;
+ long int nM4Plot;
+ long int nNComp;
+ long int nNFrFld;
+ long int nNSTACS;
+ long int nNTCSex;
+ long int nNumDCD;
+ long int nNWord1;
+ long int nNWord2;
+ long int nNOutPR;
+ long int nIType;
+ long int nIbr;
+ long int nJFLSOS;
+ long int nJST;
+ long int nJST1;
+ long int nKTab;
+ long int nKBurro;
+ long int nMax99m;
+ long int nMaxBus;
+ long int nMaxZNO;
+ long int nMemSav;
+ long int nModOut;
+ long int nNRight;
+ long int nNum99;
+ long int nNumOut;
+ long int nNumSM;
+ long int nNumUM;
+ long int nTot;
+ long int nMolDat;
+ //
+ long int pIpnTV[ 11 ];
+ long int pIprsOV[ 39 ];
+ long int pLoopSS[ 13 ];
+ long int pKPrChg[ 6 ];
+ long int pKTRLSW[ 8 ];
+ long int pNByte[ 6 ];
+ long int pVoltBC[ 50 ];
+ //
+ double nAIncr;
+ double nAngle;
+ double nCI1;
+ double nCK1;
+ double nCOpt;
+ double nDegMin;
+ double nDegMax;
+ double nDelta2;
+ double nDeltaT;
+ double nEpsilon;
+ double nEpStop;
+ double nEpsZNo;
+ double nEpWarn;
+ double nFMaxFS;
+ double nFreqCS;
+ double nOmega;
+ double nOneHaf;
+ double nSglFir;
+ double nStatFR;
+ double nT;
+ double nTEnerg;
+ double nTenM3;
+ double nTenM6;
+ double nTMax;
+ double nTolMat;
+ double nUnity;
+ double nXMaxMX;
+ double nXOpt;
+ //
+ double pBegMax[ 6 ];
+ double pPeakND[ 3 ];
+ double pZNoLim[ 2 ];
+ //
+ std::vector<long int> sLStat(80);
+ std::vector<double> sFLStat(20);
+ //
+ std::string sBlank(" ");
+ std::string sBus1;
+ std::string sBus2;
+ std::string sBus3;
+ std::string sBus4;
+ std::string sBus5;
+ std::string sBus6;
+ std::string sChCont;
+ std::string sChCopy;
+ std::string sCopy;
+ std::string sTrash;
+ std::string sTerra;
+ std::string sUserID;
+ std::string sBranch;
+ std::string sTexCol;
+ //
+ std::string pDate1[ 2 ];
+ std::string pTClock[ 2 ];
+ std::string pTextA6[ 15 ];
+ //
+ std::stringstream sABuff;
+ //
+ tMonCar sMonCar;
+ tStat *pSStat;
+
+}
+
+// end of file blkcom.cpp
diff --git a/sources/comlock.cpp b/sources/comlock.cpp
new file mode 100644
index 0000000..e83d57b
--- /dev/null
+++ b/sources/comlock.cpp
@@ -0,0 +1,13 @@
+//-*- mode: c++; indent-tabs-mode: t; coding: utf-8; show-trailing-whitespace: t -*-
+
+// file comlock.cpp
+
+#include "comlock.hpp"
+
+namespace comlock {
+
+ std::string pLocker[ 2 ];
+
+}
+
+// end of file comlock.cpp
diff --git a/sources/datain.cpp b/sources/datain.cpp
new file mode 100644
index 0000000..1d3ad11
--- /dev/null
+++ b/sources/datain.cpp
@@ -0,0 +1,1397 @@
+//-*- mode: c++; indent-tabs-mode: t; coding: utf-8; show-trailing-whitespace: t -*-
+
+// file datain.cpp
+
+#include "datain.hpp"
+
+namespace datain {
+
+ void datain(void)
+ {
+ // Universal module of interactive EMTP (spy of "emtspy").
+ // If non-interactive version, module can be destroyed.
+ // First EMTP data input, and "spy" choice, are made here.
+ // Module is called only by installation-dependent "erexit".
+ int ll;
+ int n;
+ int n1, n2, n3, n4, n7, n10, n11, n15, n16, n22, n26;
+ int nn1, nn2;
+ int nKRDOff;
+ int nKRDCom;
+ int nKCut = 0;
+ int nKntDum;
+ int nKntMax;
+ int nKntOld;
+ int nKExact;
+ int nNumRun;
+ int nChPre = 0;
+ int nChSuf = 0;
+ int nMaxZno;
+ int pKArg[ 200 ], pKBeg[ 200 ], pKEnd[ 200 ], pKKKDum[ 35 ], pKTex[ 200 ];
+ int pLenTyp[ 18 ];
+ int pModArg[ 35 ];
+ int nNTACS;
+ //
+ int32_t nKomLev = -1;
+ //
+ size_t ip;
+ size_t j;
+ size_t k;
+ size_t l;
+ size_t m;
+ size_t n5, n6, n8, n12, n13, n14, n17, n18, n19, n20, n24;
+ size_t nLimArg;
+ size_t nNumHLD = 0;
+ size_t nNumArg;
+ size_t nNumTyp = 14;
+ size_t pKard[ 200 ];
+ size_t pKolInc[ 35 ];
+ //
+ std::string pArgInc[ 35 ];
+ std::string sChLMFS;
+ std::string sChar80;
+ std::string sDumNam = "dum";
+ std::string sFileSave;
+ std::string sPrefix;
+ std::string sSuffix;
+ std::string pTank[ 1000 ];
+ std::string pTypDat[ 18 ] = {
+ "request",
+ "function",
+ "TACS source",
+ "supplemental",
+ "TACS output",
+ "TACS initial",
+ "branch",
+ "switch",
+ "load flow"
+ "initial"
+ "output"
+ "plot"
+ "statistics"
+ };
+ //
+ std::fstream sFile12;
+ //
+ std::stringstream sMFile5;
+ //
+ spycom::pMFiles[ 5 ] = reinterpret_cast<void *>(&sMFile5);
+ if(nKExact != 88333)
+ nNumRun = 0;
+ if((nKExact == 88333) && (nNumRun > 0))
+ goto a5266;
+ if(nNumHLD == -8899)
+ emtp::stoptp();
+ if(nNumHLD == 0)
+ goto a5244;
+ for(j = 1; j <= nNumHLD; j++) {
+ if((strcom::toLower(pTank[ j - 1 ].substr(0, 19)) == "begin new data case") && (j > 3))
+ break;
+ spyf77::sFile6[ j - 1 ] = pTank[ j - 1 ];
+ }
+
+ a3389:
+ spycom::nNumCRD = j - 1;
+ for(k = j; k <= nNumHLD; k++)
+ pTank[ k - spycom::nNumCRD - 1 ] = pTank[ k - 1 ];
+ nNumHLD -= spycom::nNumCRD;
+ if(nNumHLD <= 0)
+ nNumHLD = -8899;
+ blkcom::nNumDCD = 0;
+ goto a1774;
+
+ a5266:
+ nKCut = 0;
+ if(sFileSave.empty())
+ goto a1712;
+ reinterpret_cast<std::fstream *>(spycom::pMFiles[ 4 ]) -> open(sFileSave.c_str(), std::ios::in);
+
+ a1712:
+ if (blkcom::nLLBuff == -3333)
+ reinterpret_cast<std::fstream *>(spycom::pMFiles[ 4 ]) -> seekg(std::ios::beg);
+
+ a5244:
+ if((blkcom::nLLBuff != -3333) && (strcom::toLower(spyf77::sFile6[ spycom::nNumCRD ].substr(0, 4)) != "eof "))
+ goto a1708;
+ spycom::nKVerfy = -4545;
+ nLimArg = 35;
+ blkcom::nNumDCD = 0;
+ spycom::pMFiles[ 4 ] = reinterpret_cast<void *>(&std::cin);
+ spycom::nLimCRD = 30000;
+ n13 = 0;
+ nNTACS = 0;
+ date_time::date44 (blkcom::pDate1);
+ date_time::time44 (blkcom::pTClock);
+ over20::initsp();
+
+ a1311:
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " EMTP begins. Send (spy, $attach, debug, help, module, junk, stop) :" << std::endl << std::flush;
+ std::getline(*reinterpret_cast<std::istream *>(spycom::pMFiles[ 4 ]), spyf77::sBuff77);
+ if(!reinterpret_cast<std::fstream *>(spycom::pMFiles[ 4 ]) -> good()) {
+ *(reinterpret_cast<std::fstream *>(blkcom::pLFiles[ 5 ])) << " Could not read from stdin." << std::endl << std::flush;
+ exit (EXIT_FAILURE);
+ }
+ if(strcom::toLower(spyf77::sBuff77.substr(0, 5)) == "stop ")
+ emtp::stoptp();
+ if(strcom::toLower(spyf77::sBuff77.substr(0, 5)) != "disk ")
+ goto a51329;
+ nMaxZno = 4545;
+ goto a1311;
+
+ a51329:
+ if(strcom::toLower(spyf77::sBuff77.substr(0, 7)) == "$attach")
+ goto a1347;
+ if(strcom::toLower(spyf77::sBuff77.substr(0, 5)) != "junk ")
+ goto a1332;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Send root word to over-ride \"junk\" for spy and plot windows :" << std::endl << std::flush;
+ (*reinterpret_cast<std::istream *>(spycom::pMFiles[ 4 ])) >> spyf77::sJunker;
+ spyf77::sBuff77 = "spy ";
+
+ a1332:
+ if(spycom::nKVerfy == 0)
+ goto a41332;
+ spycom::nKVerfy = -34543;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ spycom::nKVerfy = 0;
+
+ a41332:
+ if(strcom::toLower(spyf77::sBuff77.substr(0, 6)) == "module")
+ goto a2613;
+ if(strcom::toLower(spyf77::sBuff77.substr(0, 5)) != "module")
+ goto a1342;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Greetings, greetings. Welcome to the wonderful new world of interactive" << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " EMTP execution, observation, and control. After sending \"spy\", send" << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " \"help\", and then \"all\" to receive some 500 lines of instruction. Also," << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " see Section 9 of the Rule Book dated June 1984. Also see \"Apollo\"." << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ goto a1311;
+
+ a1342:
+ if(strcom::toLower(spyf77::sBuff77.substr(0, 6)) != "debug ")
+ goto a1347;
+ n13 = 99;
+ goto a1311;
+
+ a1347:
+ spycom::nIprSpy = n13;
+ blkcom::nIprsUp = n13;
+ blkcom::pIprsOV[ 0 ] = n13;
+ if(strcom::toLower(spyf77::sBuff77.substr(0, 3)) != "spy")
+ goto a1724;
+ // Begin interactive control sequence, leading to "emtspy":
+ blkcom::nM4Plot = 1;
+ spyf77::sProm80 = " spy:";
+ utilities::prompt(*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 6 ]), \
+ spyf77::sProm80);
+
+ a1708:
+ if(blkcom::nM4Plot != 1)
+ goto a2320;
+ spycom::nLockBR = 1;
+ over20::emtspy();
+ if(spycom::nLockBR == 1)
+ goto a1708;
+ goto a1774;
+ // Begin non-interactive variable initialization:
+
+ a1724:
+ blkcom::nM4Plot = 2;
+ blkcom::pLFiles[ 12 ] = reinterpret_cast<void *>(&std::cin);
+ spycom::nNumCRD = 1;
+ spyf77::sFile6.push_back(spyf77::sBuff77);
+ if(strcom::toLower(spyf77::sBuff77.substr(0, 7)) != "$attach")
+ goto a1753;
+ // "$attach,filename,5" usage requires extraction of name:
+ blkcom::pLFiles[ 12 ] = reinterpret_cast<void *> (&sFile12);
+ n16 = 0;
+ for(j = 9; j <= 40; j++) {
+ if((spyf77::sBuff77[ j - 1 ] != ' ') && (n16 == 0))
+ n16 = j;
+ if(spyf77::sBuff77[ j - 1 ] == ',')
+ goto a1746;
+ }
+
+ a1736:
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " ---- Illegal file name. Try again ...." << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ goto a1311;
+
+ a1746:
+ n14 = j - n16;
+ spyf77::sANSI32.str().replace(0, n14, spyf77::sBuff77.substr(n16 - 1, j - n16));
+ spyf77::sANSI32.str().resize(n14 + 1);
+ sFileSave = spyf77::sANSI32.str();
+ if(blkcom::nIprsUp >= 1)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Extracted file name ansi32(1:32) =" << spyf77::sANSI32.str() << std::endl << std::flush;
+ if(!utilities::exists(spyf77::sANSI32.str().c_str()))
+ goto a1736;
+ spyf77::sSpyCD2 = spyf77::sANSI32.str();
+ sFile12 = std::fstream(spyf77::sANSI32.str().c_str(), std::ios::in);
+ blkcom::pLFiles[ 12 ] = reinterpret_cast<void *>(&sFile12);
+ spyf77::sFile6[ 0 ] = "c " + spyf77::sBuff77.substr(0, 78);
+ nKCut = 0;
+
+ a1753:
+ ;
+ nKRDOff = spycom::nNumCRD;
+ nKRDCom = 0;
+ for(j = 1; j <= spycom::nLimCRD; j++) {
+ std::string sTemp;
+ //std::getline(*reinterpret_cast<std::istream *>(blkcom::pLFiles[ 12 ]), spyf77::sFile6[ nKRDOff + j - 1 ]);
+ std::getline(*reinterpret_cast<std::istream *>(blkcom::pLFiles[ 12 ]), sTemp);
+ spyf77::sFile6.push_back(sTemp);
+ if(reinterpret_cast<std::istream *>(blkcom::pLFiles[ 12 ]) -> eof())
+ goto a1766;
+ if(nKCut == 1)
+ goto a5486;
+ if(strcom::toLower(spyf77::sFile6[ nKRDOff + j - 1 ].substr(0, 2)) == "c ")
+ ++nKRDCom;
+ if((strcom::toLower(spyf77::sFile6[ nKRDOff + j - 1 ].substr(0, 19)) != "begin new data case") || (j - nKRDCom) <= 3)
+ goto a1756;
+ nKCut = 1;
+
+ a5486:
+ ++nNumHLD;
+ if(nNumHLD > 1000) {
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Input data cards overflow tank(1000). Halt." << std::endl <<std::flush;
+ emtp::stoptp();
+ }
+ pTank[ nNumHLD - 1 ] = spyf77::sFile6[ nKRDOff + j - 1 ];
+ // If all EMTP data (e.g., "kill codes" use) comes via key
+ // board, it is ended with "eof"; when solved, mode keyboard.
+
+ a1756:
+ if(strcom::toLower(spyf77::sFile6[ nKRDOff + j - 1 ].substr(0, 4)) == "eof ")
+ goto a1766;
+ if(nKCut == 0)
+ ++spycom::nNumCRD;
+ }
+
+ a1760:
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " & & & & & Input buffer overflow. Limit =" << std::setw(6) << spycom::nLimCRD << ". Reject this data, and reprompt ...." << std::endl << std::flush;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ if (blkcom::pLFiles[ 12 ] != nullptr)
+ goto a1311;
+ emtp::stoptp();
+
+ a1766:
+ ++spycom::nNumCRD;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Done reading disk file into EMTP cache. numcrd =" << std::setw(5) << spycom::nNumCRD << " cards." << std::endl << std::flush;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ if(blkcom::pLFiles[ 12 ] != reinterpret_cast<void *>(&std::cin))
+ if(reinterpret_cast<std::fstream *>(blkcom::pLFiles[ 12 ]) -> is_open())
+ reinterpret_cast<std::fstream *>(blkcom::pLFiles[ 12 ]) -> close();
+
+ a1774:
+ n22 = 1;
+ n13 = 1;
+ // begin loop to replace next presently-visible $include:
+
+ a1776:
+ n17 = 0;
+ for(j = n13; j <= spycom::nNumCRD; j++) {
+
+ a1777:
+ if(spyf77::sFile6[ j - 1 ][ 0 ] != '$')
+ goto a1786;
+ spyf77::sBuff77 = spyf77::sFile6[ j - 1 ];
+ if(spycom::nIprSpy < 3)
+ goto a41777;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " j =" << std::setw(4) << j << " next $-card =" << spyf77::sBuff77.substr(0, 80) << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+
+ a41777:
+ if(strcom::toLower(spyf77::sBuff77.substr(0, 8)) == "$include")
+ goto a1787;
+ if((strcom::toLower(spyf77::sBuff77.substr(0, 7)) != "$prefix") && (strcom::toLower(spyf77::sBuff77.substr(0, 7)) != "$suffix") && (strcom::toLower(spyf77::sBuff77.substr(0, 6)) != "$level") && (strcom::toLower(spyf77::sBuff77.substr(0, 6)) != "$dummy"))
+ goto a1786;
+ k = 8;
+
+ a1778:
+ if((spyf77::sBuff77[ k - 1 ] != ' ') && (spyf77::sBuff77[ k - 1 ] != ','))
+ goto a1779;
+ ++k;
+ if (k < 80)
+ goto a1778;
+ k = 10;
+ l = 4;
+ if(strcom::toLower(spyf77::sBuff77.substr(4, 3)) == "fix")
+ goto a31779;
+ blkcom::nIStep = j;
+ over20::stopin ();
+ if(blkcom::nKill > 0)
+ goto a9200;
+ goto a1777;
+
+ a1779:
+ if((strcom::toLower(spyf77::sBuff77.substr(0, 7)) != "$prefix") && \
+ (strcom::toLower(spyf77::sBuff77.substr(0, 7)) != "$suffix"))
+ goto a1783;
+ l = spyf77::sBuff77.substr(k - 1, std::string::npos).find(" ");
+ m = spyf77::sBuff77.substr(k - 1, std::string::npos).find(",");
+ if (m != std::string::npos)
+ if (m < l)
+ l = m;
+ --l;
+
+ a31779:
+ n5 = k - 1 + l;
+ if(strcom::toLower(spyf77::sBuff77.substr(0, 7)) != "$prefix")
+ goto a1782;
+ sPrefix = spyf77::sBuff77.substr(k - 1, n5 - k + 1);
+ nChPre = l;
+ goto a1785;
+
+ a1782:
+ sSuffix = spyf77::sBuff77.substr(k - 1, n5 - k + 1);
+ nChSuf = l;
+ goto a1785;
+
+ a1783:
+ if(strcom::toLower(spyf77::sBuff77.substr(0, 6)) != "$level")
+ goto a1784;
+ spyf77::sProm80 = spyf77::sBuff77.substr(k - 1, 80 - k + 1);
+ freedom::freeIn(spyf77::sProm80, nKomLev);
+ goto a1785;
+
+ a1784:
+ if(strcom::toLower(spyf77::sBuff77.substr(0, 6)) != "$dummy")
+ goto a1786;
+ sDumNam.replace(0, 3, spyf77::sBuff77.substr(k - 1, 3));
+ spyf77::sANSI8.str().replace(0, 3, spyf77::sBuff77.substr(k + 2, 3));
+ nKntDum = std::stoi(spyf77::sANSI8.str());
+
+ a1785:
+ spyf77::sFile6[ j - 1 ] = "c " + spyf77::sBuff77.substr(0, 78);
+
+ a1786:
+ ;
+ }
+ goto a2320;
+
+ a1787:
+ n13 = j;
+
+ a1788:
+ n26 = 9;
+
+ a1789:
+ if((spyf77::sBuff77[ n26 - 1 ] != ' ') && (spyf77::sBuff77[ n26 - 1 ] != ','))
+ goto a1797;
+ ++n26;
+ if (n26 < 40)
+ goto a1789;
+
+ a1794:
+ blkcom::nIStep = j;
+ over20::stopin();
+ if (blkcom::nKill > 0)
+ goto a9200;
+ goto a1776;
+
+ a1797:
+ k = n26 + 1;
+
+ a1801:
+ if((spyf77::sBuff77[ k - 1 ] == ',') || (spyf77::sBuff77[ k - 1 ] == ' '))
+ goto a1804;
+ ++k;
+ if(k > 60)
+ goto a1794;
+ goto a1801;
+
+ a1804:
+ if (nChPre > 0)
+ spyf77::sANSW80.replace(0, nChPre, sPrefix.substr(0, nChPre));
+ n7 = nChPre + k - n26;
+ spyf77::sANSW80.replace(nChPre, n7 - nChPre, spyf77::sBuff77.substr(n26 - 1, k - n26));
+ if(nChSuf > 0)
+ spyf77::sANSW80.replace(n7, n8 - n7, sSuffix.substr(0, nChSuf));
+ spyf77::sANSW80.resize(n8 + 1);
+
+ a1811:
+ if(n17 == 1)
+ goto a1819;
+ l = spycom::nNumCRD;
+ n19 = spycom::nLimCRD;
+ for(m = j + 1; m <= spycom::nNumCRD; m++) {
+ spyf77::sFile6[ n19 - 1 ] = spyf77::sFile6[ l - 1 ];
+ --l;
+ --n19;
+ }
+ ++n19;
+
+ a1819:
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " --- Pass" << std::setw(3) << n22 << ", card =" << std::setw(4) << j << ". Ready to open $include =" << spyf77::sANSW80.substr(0, n8) << std::endl;
+ if(utilities::exists(spyf77::sANSW80.substr(0, n8).c_str()))
+ goto a1794;
+ spyf77::sProm80 = spyf77::sFile6[ j - 1 ];
+ spyf77::sFile6[ j - 1 ] = "c " + spyf77::sProm80.substr(0, 78);
+ reinterpret_cast<std::fstream *>(blkcom::pLFiles[ 12 ]) -> open(spyf77::sANSW80.substr(0, n8).c_str(), std::ios::in);
+ n16 = 0;
+ n26 = k + 1;
+
+ a4203:
+ for(l = n26; l <= 80; l++)
+ if((spyf77::sBuff77[ l - 1 ] != ',') && (spyf77::sBuff77[ l - 1 ] != ' '))
+ goto a4208;
+ goto a4226;
+
+ a4208:
+ ++n16;
+ if(n16 > 10)
+ emtp::stoptp();
+ n12 = spyf77::sBuff77.substr(l - 1, std::string::npos).find(",");
+ n13 = spyf77::sBuff77.substr(l - 1, std::string::npos).find(" ");
+ n14 = n12;
+ if(n12 != std::string::npos)
+ goto a4214;
+ n14 = n13;
+ if(n13 != std::string::npos)
+ goto a4220;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " No bounding symbol. Stop after display." << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Done with argument. l, n12, n13, n14, n26 =" << std::setw(6) << l << n12 << n13 << n14 << n26 << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ emtp::stoptp();
+
+ a4214:
+ if((n13 != std::string::npos) && (n13 < n14))
+ n14 = n13;
+
+ a4220:
+ n15 = n14 - 1;
+ pKolInc[ n16 - 1 ] = n15;
+ n18 = l - 1 + n15;
+ pArgInc[ n16 - 1 ] = " ";
+ pArgInc[ n16 - 1 ].replace(0, n15, spyf77::sBuff77.substr(l - 1, n18 - l + 1));
+ n26 = n18 + 1;
+ if(spycom::nIprSpy < 5)
+ goto a4224;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Done with argument. l, n12, n13, n14, n26 =" << std::setw(6) << l << n12 << n13 << n14 << n26 << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+
+ a4224:
+ goto a4203;
+
+ a4226:
+ pKard[ 0 ] = 999999;
+ n1 = 0;
+ if(n16 == 0)
+ goto a4239;
+
+ a4228:
+ for(l = 1; l <= 25; l++)
+ (*reinterpret_cast<std::istream *>(blkcom::pLFiles[ 12 ])) >> pKBeg[ l - 1 ];
+ for(l = 1; l <= 25; l++)
+ if(pKBeg[ l - 1 ] == 0)
+ goto a4230;
+ n1 += 25;
+ if(n1 <= 175)
+ // Overflow. 199 is max number of replacements, temporarily
+ emtp::stoptp();
+
+ a4230:
+ reinterpret_cast<std::fstream *>(blkcom::pLFiles[ 12 ]) -> seekg(std::ios::beg);
+ n6 = n1 + l - 1;
+ for (k = 1; k <= n6; k++)
+ (*reinterpret_cast<std::fstream *>(blkcom::pLFiles[ 12 ])) >> pKard[ k - 1 ];
+ for(k = 1; k <= n6; k++)
+ (*reinterpret_cast<std::fstream *>(blkcom::pLFiles[ 12 ])) >> pKArg[ k - 1 ];
+ for(k = 1; k <= n6; k++)
+ (*reinterpret_cast<std::fstream *>(blkcom::pLFiles[ 12 ])) >> pKBeg[ k - 1 ];
+ for(k = 1; k <= n6; k++)
+ (*reinterpret_cast<std::fstream *>(blkcom::pLFiles[ 12 ])) >> pKEnd[ k - 1 ];
+ for(k = 1; k <= n6; k++)
+ (*reinterpret_cast<std::fstream *>(blkcom::pLFiles[ 12 ])) >> pKTex[ k - 1 ];
+ if(spycom::nIprSpy < 1)
+ goto a4235;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Done reading argument usage vectors. n4 =" << std::setw(5) << n6 << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+
+ a4235:
+ if(spycom::nIprSpy < 5)
+ goto a4238;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Vectors kard, karg, kbeg, kend, ktext(1:25) ..." << std::setw(5) << n6 << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ for(k = 1; k <= n5; k++)
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << pKard[ k - 1 ];
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ for(k = 1; k <= n5; k++)
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << pKArg[ k - 1 ];
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ for(k = 1; k <= n5; k++)
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << pKBeg[ k - 1 ];
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ for(k = 1; k <= n5; k++)
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << pKEnd[ k - 1 ];
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ for(k = 1; k <= n5; k++)
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << pKTex[ k - 1 ];
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+
+ a4238:
+ pKard[ n6 ] = 999999;
+
+ a4239:
+ n20 = 0;
+ n24 = 1;
+ n5 = 0;
+ n18 = j + 1;
+ nKntMax = 0;
+ nKntOld = nKntDum;
+ for(k = n18; k <= spycom::nLimCRD; k++) {
+ (*reinterpret_cast<std::fstream *>(blkcom::pLFiles[ 12 ])) >> spyf77::sBuff77;
+ if(reinterpret_cast<std::fstream *>(blkcom::pLFiles[ 12 ]) -> eof())
+ goto a1828;
+ if(strcom::toLower(spyf77::sBuff77.substr(0, 4)) == "$eof")
+ goto a1828;
+ if(spyf77::sBuff77[ 0 ] == '/')
+ n5 = 1;
+ if(tolower(spyf77::sBuff77[ 0 ]) != 'c')
+ goto a4247;
+ for(l = 1; l <= 10; l++)
+ if(spyf77::sBuff77[ 1 ] == spyf77::pDigit[ l - 1 ])
+ goto a4244;
+ goto a4247;
+
+ a4244:
+ if (l == 10)
+ l = 0;
+ if(l < (size_t) nKomLev)
+ goto a4273;
+ spyf77::sBuff77[ 1 ] = ' ';
+
+ a4247:
+ ++j;
+ spyf77::sFile6[ j - 1 ] = spyf77::sBuff77;
+ if (tolower(spyf77::sBuff77[ 0 ]) == 'c')
+ goto a4273;
+ ++n20;
+ if(spycom::nIprSpy < 3)
+ goto a4249;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Ready with next card. n20, n24, kard(n24) =" << std::setw(8) << n20 << n24 << pKard[ n24 - 1 ] << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+
+ a4249:
+ if(n20 < pKard[ n24 - 1 ])
+ goto a4273;
+ n1 = pKBeg[ n24 - 1 ];
+ n2 = pKEnd[ n24 - 1 ];
+ n4 = pKArg[ n24 - 1 ];
+ n3 = pKolInc[ n4 - 1 ];
+ if(n4 <= n16)
+ goto a34250;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " ? ? ? ? Error stop at s.n. 4250 of \"datain\". Insufficient number of $include arguments." << std::endl << " n24, n4, n16 =" << std::setw(8) << n24 << n4 << n16 << std::endl;
+ emtp::stoptp();
+
+ a34250:
+ if(n4 > 0)
+ goto a4252;
+ nKntDum = nKntOld - n4;
+ if(-n4 > nKntMax)
+ nKntMax = -n4;
+ char pTemp[ 4 ];
+ snprintf(pTemp, 4, "%03u", nKntDum);
+ spyf77::sANSI8 << std::string(pTemp);
+ if((n2 - n1) != 5)
+ emtp::stoptp();
+ sDumNam.replace(3, 6, spyf77::sANSI8.str().substr(0, 3));
+ spyf77::sFile6[ j - 1 ].replace(n1 - 1, n2, sDumNam);
+ goto a4249;
+
+ a4252:
+ if(((n2 - n1) != (n3 - 1)) && (pKTex[ n24 - 1 ] == 1))
+ goto a4253;
+ if((n2 - n1) >= (n3 - 1))
+ goto a4261;
+
+ a4253:
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " +++ Argument" << std::setw(4) << n4 << " length-mismatch error. Used on card" << std::setw(4) << n20 << " ." << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " n24 =" << std::setw(4) << n24 << " kbeg, kend =" << std::setw(4) << n1 << n2 << " Length from $include =" << std::setw(4) << n3 << " ." << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ spyf77::sProm80 = " Send correct argument (stop) :";
+ utilities::prompt(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ spyf77::sProm80);
+ if(blkcom::nM4Plot == 1)
+ goto a4259;
+ blkcom::nKill = 79;
+ blkcom::sLStat[ 18 ] = 4259;
+ goto a9200;
+
+ a4259:
+ reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 4 ]) -> read(&pArgInc[ n4 - 1 ][ 0 ], 20);
+ if(strcom::toLower(pArgInc[ n4 - 1 ].substr(0, 5)) == "stop ")
+ emtp::stoptp();
+
+ a4261:
+ n = n2;
+ if(spycom::nIprSpy < 4)
+ goto a34261;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Argument now processed, arginc(n4) =" << pArgInc[ n4 - 1 ].substr(0, 20) << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+
+ a34261:
+ for(ip = 1; ip <= 20; ip++) {
+ m = 21 - ip;
+ spyf77::cChar1 = pArgInc[ n4 - 1 ][ m - 1 ];
+ if(spyf77::cChar1 == ' ')
+ goto a4263;
+ if(spycom::nIprSpy < 8)
+ goto a54262;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Next non-blank digit. ip, n, digit =" << std::setw(6) << ip << m << "\"" << spyf77::cChar1 << "\"" << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+
+ a54262:
+ if(spyf77::cChar1 == '#')
+ spyf77::cChar1 = ' ';
+ if(n < n1)
+ goto a4253;
+ spyf77::sFile6[ j - 1 ][ n - 1 ] = spyf77::cChar1;
+ --n;
+
+ a4263:
+ ;
+ }
+ if(((n + 1) > n1) && (pKTex[ n24 - 1 ] == 1))
+ goto a4253;
+ if(n >= n1)
+ spyf77::sFile6[ j - 1 ].replace(n1 - 1, n - n1, n - n1, ' ');
+ ++n24;
+ goto a4249;
+
+ a4273:
+ ;
+ }
+ goto a1760;
+
+ a1828:
+ reinterpret_cast<std::fstream *>(blkcom::pLFiles[ 12 ]) -> close();
+ if(spycom::nIprSpy < 1)
+ goto a1832;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Done with disk file (close). j, n19 =" << std::setw(8) << j << n19 << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+
+ a1832:
+ nKntOld += nKntMax;
+ if(n5 == 1)
+ goto a1833;
+ spyf77::sBuff77.replace(0, 32, "c end of $include. File name = ");
+ spyf77::sBuff77.replace(32, 80, spyf77::sANSW80.substr(0, 48));
+ ++j;
+ spyf77::sFile6[ j - 1 ] = spyf77::sBuff77;
+
+ a1833:
+ if(j > n19)
+ goto a1760;
+ for(m = n19; m <= spycom::nLimCRD; m++) {
+ ++j;
+ spyf77::sFile6[ j - 1 ] = spyf77::sFile6[ m - 1 ];
+ if(strcom::toLower(spyf77::sFile6[ j ].substr(0, 8)) == "$include")
+ goto a1841;
+ }
+ spycom::nNumCRD = j;
+ ++n22;
+ goto a1776;
+
+ a1841:
+ n19 = m + 1;
+ if(spycom::nIprSpy < 1)
+ goto a1847;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Next $include recognized in do 1835. m =" << std::setw(6) << m << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+
+ a1847:
+ spyf77::sBuff77 = spyf77::sFile6[ j - 1 ];
+ n17 = 1;
+ goto a1788;
+ // Following code processes any $spy usage:
+
+ a2320:
+ j = 1;
+ n7 = 0;
+ n17 = 0;
+
+ a2347:
+ do {
+ if(j > spycom::nNumCRD)
+ goto a2415;
+ if(spyf77::sFile6[ j - 1 ].substr (0, 3) != "$spy")
+ goto a2378;
+ ++n7;
+ if(n7 > 9)
+ emtp::stoptp ();
+ spyf77::sFile6[ j - 1 ] = "$spy, spyfile .dat, 0,";
+ spyf77::sFile6[ j - 1 ][ 13 ] = spyf77::pDigit[ n7 - 1 ];
+ spyf77::sANSI32 << "spyfile .dat";
+ spyf77::sANSI32.str()[ 7 ] = spyf77::pDigit[ n7 - 1 ];
+ if(blkcom::nIprsUp < 1)
+ goto a2353;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Prepare to open for $spy. ansi32 =" << spyf77::sANSI32.str().substr(0, 32) << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+
+ a2353:
+ blkcom::pLFiles[ 12 ] = reinterpret_cast<void *> (new std::fstream);
+ if(!blkcom::pLFiles[ 12 ]) {
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 0 ])) << " Could not reserve memory for stream in datain a2353. Exiting.\n";
+ exit(EXIT_FAILURE);
+ }
+ reinterpret_cast<std::fstream *>(blkcom::pLFiles[ 12 ]) -> open(spyf77::sANSI32.str().c_str(), std::ios::in);
+ for(k = j + 1; k <= spycom::nNumCRD; k++) {
+ if(strcom::toLower(spyf77::sFile6[ k - 1 ].substr(0, 7)) != "$spyend") {
+ reinterpret_cast<std::fstream *>(blkcom::pLFiles[ 12 ]) -> close();
+ n24 = k - j;
+ for(l = k + 1; l <= spycom::nNumCRD; l++)
+ spyf77::sFile6[ l - n24 - 1 ] = spyf77::sFile6[ l - 1 ];
+ spycom::nNumCRD -= n24;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Done with upward shift. n24, k, numcrd =" << std::setw(8) << n24 << j << spycom::nNumCRD << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ break;
+ } else
+ (*reinterpret_cast<std::fstream *>(blkcom::pLFiles[ 12 ])) << spyf77::sFile6[ k - 1 ].substr(0, 80) << std::endl;
+ }
+
+ a2378:
+ if(spyf77::sFile6[ j - 1 ][ 0 ] == '/')
+ n17 = 1;
+ if(strcom::toLower(spyf77::sFile6[ j - 1 ].substr (0, 8)) != "tacs old")
+ goto a2410;
+ nNTACS = 2;
+ spyf77::sFile6[ j - 1 ].replace(0, 2, "c ");
+
+ a2410:
+ ++j;
+ } while(1);
+
+ a2415:
+ if (n17 == 0)
+ goto a9800;
+ // Begin code to sort EMTP data according to class :
+ n1 = 0;
+ n10 = 0;
+ n11 = 0;
+ n12 = 0;
+ if (blkcom::nIprsUp >= 9)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Entire input file as we start sorting ..." << std::endl << std::setw(5);
+ for(j = 1; j <= spycom::nNumCRD; j++)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << j << spyf77::sFile6[ j - 1 ];
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::endl;
+ for(j = 1; j <= spycom::nNumCRD; j++) {
+
+ a2418:
+ if(spyf77::sFile6[ j - 1 ][ 0 ] != '/')
+ goto a2431;
+ ++n12;
+ labcom::pKSSFrq[ n12 - 1 ] = j;
+ labcom::pKPSour[ n12 - 1 ] = 0;
+ if(n12 == 1)
+ goto a2420;
+ if(labcom::pKPSour[ n12 - 2 ] == 0)
+ labcom::pKPSour[ n12 - 2 ] = j - 1;
+
+ a2420:
+ for(k = 1; k <= nNumTyp; k++)
+ if(spyf77::sFile6[ j - 1 ].substr(1, 12) == pTypDat[ k - 1 ])
+ goto a2428;
+ if(strcom::toLower(spyf77::sFile6[ j - 1 ].substr(1, 9)) != "tacs data")
+ goto a2424;
+ k = 6;
+ nNTACS = 1;
+ goto a2428;
+
+ a2424:
+ if(spycom::pMFiles[ 3 ] == nullptr)
+ emtp::stoptp();
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " ---- Illegal file name. Try again ...." << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 4 ]) -> read(&spyf77::sFile6[ j - 1 ][ 0 ], 80);
+ goto a2418;
+
+ a2428:
+ labcom::pKode[ n12 - 1 ] = k;
+ if(k == 1)
+ n1 = 1;
+ if(k == 10)
+ n10 = 1;
+ if(k == 11)
+ n11 = 1;
+
+ a2431:
+ if((n12 >= 1) && (labcom::pKPSour[ n12 - 1 ] == 0) && (strcom::toLower(spyf77::sFile6[j - 1 ].substr(0, 6)) == "blank "))
+ labcom::pKPSour[ n12 - 1 ] = j - 1;
+ }
+ if(labcom::pKPSour[ n12 - 1 ] == 0)
+ labcom::pKPSour[ n12 - 1 ] = spycom::nNumCRD;
+ l = 0;
+ if(spycom::nIprSpy < 2)
+ goto a12438;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " row kssfrq kpsour kode" << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ for(j = 1; j <= n12; j++) {
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::setw(8) << j << labcom::pKSSFrq[ j - 1 ] << labcom::pKPSour[ j - 1 ] << labcom::pKode[ j - 1 ] << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ }
+
+ a12438:
+ ++l;
+ if(l > n12)
+ goto a2444;
+ if((labcom::pKode[ l - 1 ] <= 1) || (labcom::pKode[ l - 1 ] > 6))
+ goto a12438;
+ if(nNTACS == 1)
+ goto a12438;
+ nn1 = labcom::pKSSFrq[ l - 1 ] + 1;
+ nn2 = labcom::pKPSour[ l - 1 ];
+ if(labcom::pKode[ l - 1 ] > 2)
+ goto a12448;
+ for(ll = nn1; ll <= nn2; ll++) {
+ if(spyf77::sFile6[ ll - 1 ].substr(0, 2) != "99")
+ spyf77::sFile6[ ll - 1 ].replace (0, 2, " ");
+ }
+ goto a12438;
+
+ a12448:
+ if(labcom::pKode[ l - 1 ] > 3)
+ goto a12458;
+ for(ll = nn1; ll <= nn2; ll++) {
+ if((spyf77::sFile6[ ll - 1 ][ 0 ] == '$') || (spyf77::sFile6[ ll - 1 ][ 0 ] == '9') || (tolower(spyf77::sFile6[ ll - 1 ][ 0 ]) == 'c'))
+ goto a12456;
+ if(spyf77::sFile6[ ll - 1 ][ 1 ] != '1')
+ goto a12450;
+ spyf77::sFile6[ ll - 1 ][ 0 ] = '1';
+ goto a12456;
+
+ a12450:
+ if(spyf77::sFile6[ ll - 1 ][ 1 ] != '2')
+ goto a12452;
+ spyf77::sFile6[ ll - 1 ].replace(0, 2, "14");
+ goto a12456;
+
+ a12452:
+ spyf77::sFile6[ ll - 1 ][ 0 ] = '2';
+
+ a12456:
+ ;
+ }
+ goto a12438;
+
+ a12458:
+ if(labcom::pKode[ l - 1 ] > 4)
+ goto a12468;
+ goto a12438;
+
+ a12468:
+ if(labcom::pKode[ l - 1 ] > 5)
+ goto a12478;
+ for(ll = nn1; ll <= nn2; ll++) {
+ if(spyf77::sFile6[ ll - 1 ][ 0 ] == ' ')
+ spyf77::sFile6[ ll - 1 ].replace(0, 1, "33");
+ }
+ goto a12438;
+
+ a12478:
+ for(ll = nn1; ll <= nn2; ll++) {
+ if(spyf77::sFile6[ ll - 1 ][ 0 ] == ' ')
+ spyf77::sFile6[ ll - 1 ].replace(0, 2, "77");
+ }
+ goto a12438;
+
+ a2444:
+ n17 = 1;
+ n18 = labcom::pKSSFrq[ n17 - 1 ];
+ n8 = 0;
+ n24 = spycom::nNumCRD;
+ j = 0;
+ if(strcom::toLower(spyf77::sFile6[ 0 ].substr(0, 9)) != "c $attach")
+ goto a2445;
+ ++n24;
+ spyf77::sFile6[ n24 - 1 ] = spyf77::sFile6[ 0 ];
+ j = 1;
+
+ a2445:
+ if(strcom::toLower(spyf77::sFile6[ j ].substr(0, 16)) != "begin new data c")
+ goto a2446;
+ ++n24;
+ spyf77::sFile6[ n24 - 1 ] = spyf77::sFile6[ j ];
+ ++j;
+
+ a2446:
+ if(n1 == 0)
+ goto a2453;
+ n8 = 1;
+ goto a2472;
+
+ a2453:
+ ++j;
+ if(j > spycom::nNumCRD)
+ goto a2497;
+ if(j != n18)
+ goto a2456;
+ j = labcom::pKPSour[ n17 - 1 ];
+ ++n17;
+ n18 = labcom::pKSSFrq[ n17 - 1 ];
+ goto a2453;
+
+ a2456:
+ if(n8 != 9)
+ goto a2458;
+ if(n10 == 0)
+ goto a2460;
+ n8 = n10;
+ goto a2472;
+
+ a2458:
+ if(n8 != 10)
+ goto a2462;
+
+ a2460:
+ if(n11 == 0)
+ goto a2462;
+ n8 = n11;
+ goto a2472;
+
+ a2462:
+ if(strcom::toLower(spyf77::sFile6[ j - 1 ].substr(0, 6)) != "blank ")
+ goto a2493;
+ if(spycom::nIprSpy < 2)
+ goto a2465;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Blank card recognized. j =" << std::setw(6) << j << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+
+ a2465:
+ for(k = 1; k < nNumTyp; k++) {
+ n8 = pLenTyp[ k - 1 ];
+ n14 = spyf77::sFile6[ j - 1 ].find(pTypDat[ k - 1 ].substr(0, n8));
+ if(n14 != std::string::npos)
+ goto a2469;
+ }
+ n14 = strcom::toLower(spyf77::sFile6[ j - 1 ]).find("tacs data");
+ if(n14 == std::string::npos)
+ goto a2493;
+ k = 6;
+
+ a2469:
+ n8 = k;
+ // Convert end of class blank card in old TACS data to comment card
+ if((k == 2) || (k == 3) || (k == 4) || (k == 5))
+ spyf77::sFile6[ j - 1 ].replace(0, 2, "c ");
+
+ a2472:
+ if(spycom::nIprSpy < 3)
+ goto a2475;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Data class needs consideration. n8 =" << std::setw(6) << n8 << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+
+ a2475:
+ for(k = 1; k <= n12; k++) {
+ if(labcom::pKode[ k - 1 ] == n8) {
+ n5 = labcom::pKSSFrq[ k - 1 ] + 1;
+ n6 = labcom::pKPSour[ k - 1 ];
+ if((n24 + n6 - n5) >= spycom::nLimCRD)
+ goto a1760;
+ for(l = n5; l <= n6; l++) {
+ ++n24;
+ spyf77::sFile6[ n24 - 1 ] = spyf77::sFile6[ l - 1 ];
+ }
+ if(spycom::nIprSpy >= 3) {
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Done with \"/\" copy below. n5, n6, n24 =" << std::setw(6) << n5 << n6 << n24 << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ }
+ }
+ }
+ if((n8 == 10) || (n8 == 11))
+ goto a2456;
+ if(j <= 2)
+ goto a2453;
+
+ a2493:
+ ++n24;
+ spyf77::sFile6[ n24 - 1 ] = spyf77::sFile6[ j - 1 ];
+ if(n24 >= spycom::nLimCRD)
+ goto a1760;
+ if(j < spycom::nNumCRD)
+ goto a2453;
+
+ a2497:
+ if(spycom::nIprSpy < 9)
+ goto a2500;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Done with lower assembly. n24 =" << std::setw(8) << n24 <<std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+
+ a2500:
+ j = 0;
+ for(k = spycom::nNumCRD + 1; k <= n24; k++) {
+ ++j;
+ spyf77::sFile6[ j - 1 ] = spyf77::sFile6[ k - 1 ];
+ if(spycom::nIprSpy >= 9) {
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Card" << std::setw(3) << j << "." << spyf77::sFile6[ j - 1 ].substr(0, 80) << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ }
+ }
+ spycom::nNumCRD = j;
+ if(spycom::nIprSpy < 1)
+ goto a2509;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Done with all \"/\" processing. numcrd =" << std::setw(8) << spycom::nNumCRD << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+
+ a2509:
+ if(blkcom::nM4Plot == 1)
+ over20::spying();
+ goto a9800;
+ // Begin code to process "module" of user. Convert user data
+ // from "arg", "dum", and "num" character declarations to
+ // the vectors kard/karg/kbeg/kend/ktex as needed by $include
+
+ a2613:
+ spycom::nIprSpy = n13;
+ spycom::nNumCRD = 0;
+ over20::spying();
+ n8 = 0;
+ nNumArg = 0;
+ n11 = spycom::nLimCRD + 1;
+ n13 = 0;
+ n4 = 1;
+ movecopy::copy(n4, pModArg, nLimArg);
+ goto a2628;
+
+ a2621:
+ --n11;
+ spyf77::sFile6[ n11 - 1 ] = spyf77::sBuff77;
+
+ a2628:
+ ++n13;
+ if(n13 > spycom::nNumCRD)
+ goto a2703;
+ spyf77::sBuff77 = spyf77::sFile6[ n13 - 1 ];
+ if((strcom::toLower(spyf77::sBuff77.substr(0, 3)) != "arg") && (strcom::toLower(spyf77::sBuff77.substr(0, 3)) != "dum") && (strcom::toLower(spyf77::sBuff77.substr(0, 3)) != "num"))
+ goto a2621;
+ k = 4;
+ ++n8;
+ spyf77::sFile6[ n8 - 1 ] = spyf77::sBuff77;
+
+ a2637:
+ if((spyf77::sBuff77[ k - 1 ] != ' ') && (spyf77::sBuff77[ k - 1 ] != ','))
+ goto a2648;
+ ++k;
+ if(k <= 80)
+ goto a2637;
+ goto a2628;
+
+ a2648:
+ l = k + 1;
+
+ a2656:
+ if((spyf77::sBuff77[ l - 1 ] != ' ') || (spyf77::sBuff77[ l - 1 ] != ','))
+ goto a2664;
+ ++l;
+ if(l <= 80)
+ goto a2656;
+
+ a2664:
+ --l;
+ if(strcom::toLower(spyf77::sBuff77.substr(0, 3)) != "num")
+ goto a2687;
+ for(m = 1; m <= nNumArg; m++) {
+ n6 = l - k + 1;
+ if((pKolInc[ m - 1 ] == n6) && (pArgInc[ m - 1 ].substr(0, n6) == spyf77::sBuff77.substr(k - 1, l - k + 1))) {
+ pModArg[ m - 1 ] = 0;
+ goto a2695;
+ }
+ }
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " ??? Illegal \"num\" declaration. Unrecognized name = " << spyf77::sBuff77.substr(k - 1, l - k + 1) << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ emtp::stoptp();
+
+ a2687:
+ ++nNumArg;
+ if(nNumArg <= nLimArg)
+ goto a2692;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Overflow error stop. Argument usage is limited in number to limarg =" << std::setw(5) << nLimArg;
+
+ a2692:
+ pArgInc[ nNumArg - 1 ] = spyf77::sBuff77.substr(k - 1, l - k + 1);
+ pKolInc[ nNumArg - 1 ] = l - k + 1;
+ if(strcom::toLower(spyf77::sBuff77.substr(0, 3)) == "dum")
+ pKKKDum[ nNumArg - 1 ] = 1;
+
+ a2695:
+ k = l + 1;
+ goto a2637;
+
+ a2703:
+ --n11;
+ spyf77::sANSI32 << blkcom::pDate1[ 0 ].substr (0, 4) + blkcom::pDate1[ 1 ].substr (0, 4) + std::string(2, ' ') + blkcom::pTClock[ 0 ].substr (0, 4) + blkcom::pTClock[ 1 ].substr(0, 4);
+ spyf77::sFile6[ n11 - 1 ] = "$eof user-supplied header cards follow. ";
+ spyf77::sFile6[ n11 - 1 ].replace(50, 18, spyf77::sANSI32.str().substr(0, 18));
+ for(j = 1; j <= n8; j++) {
+ --n11;
+ spyf77::sFile6[ n11 - 1 ] = spyf77::sFile6[ j - 1 ];
+ }
+ if(spycom::nIprSpy < 1)
+ goto a2721;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Done processing declarations. n8, n11, limcrd =" << std::setw(5) << n8 << n11 << spycom::nLimCRD << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " row kolinc kkkdum modarg arginc ...." << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ for(j = 1; j <= nNumArg; j++) {
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << j << pKolInc[ j - 1 ] << pKKKDum[ j - 1 ] << pModArg[ j - 1 ] << pArgInc[ j - 1 ].substr(0, 20) << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ }
+
+ a2721:
+ n20 = 0;
+ n16 = spycom::nLimCRD + 1;
+ n13 = 0;
+ for(n17 = n11; n17 <= spycom::nLimCRD; n17++) {
+ --n16;
+ spyf77::sBuff77 = spyf77::sFile6[ n16 - 1 ];
+ if(tolower(spyf77::sBuff77[ 0 ]) == 'c')
+ goto a2766;
+ ++n13;
+ if(spyf77::sBuff77[ 0 ] == '/')
+ goto a2766;
+ if(strcom::toLower(spyf77::sBuff77.substr(0, 4)) == "$eof")
+ goto a2772;
+ for(j = 1; j <= nNumArg; j++) {
+ l = 1;
+ n15 = pKolInc[ j - 1 ];
+
+ a2724:
+ k = spyf77::sBuff77.substr(l - 1, std::string::npos).find(pArgInc[ j - 1 ].substr(0, n15));
+ if(k == std::string::npos)
+ goto a2754;
+ ++n20;
+ if(n20 <= 200)
+ goto a2737;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " ==== Overflow error stop at card number" << std::setw(6) << n16 << " over 200 arguments." << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ emtp::stoptp();
+
+ a2737:
+ pKArg[ n20 - 1 ] = j;
+ if(j > nNumArg)
+ pKArg[ n20 - 1 ] = -(j - nNumArg);
+ pKard[ n20 - 1 ] = n13;
+ pKBeg[ n20 - 1 ] = l - 1 + k;
+ pKEnd[ n20 - 1 ] = pKBeg[ n20 ] + n15 - 1;
+ if(j <= nNumArg)
+ pKTex[ n20 - 1 ] = pModArg[ j - 1 ];
+ l = pKEnd[ n20 - 1 ] + 1;
+ if(spycom::nIprSpy < 6)
+ goto a2749;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Another string found. n16, j, l, k, n20 =" << std::setw(6) << n16 << j << l << k << n20 << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+
+ a2749:
+ goto a2724;
+
+ a2754:
+ ;
+ }
+ if(spycom::nIprSpy < 2)
+ goto a2766;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Done with this card. n16, n20 =" << std::setw(5) << n16 << n20 << " buff77=" << spyf77::sBuff77.substr(0, 80) << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+
+ a2766:
+ ;
+ }
+
+ a2772:
+ if(spycom::nIprSpy < 1)
+ goto a2778;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Done with identifying all arguments of all cards. n20 =" << std::setw(4) << n20 << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+
+ a2778:
+ if(((n20 / 25) * 25) != n20)
+ goto a2783;
+ // Extra zero entry must be added, since otherwise card is full:
+ ++n20;
+ pKard[ n20 - 1 ] = 0;
+ pKArg[ n20 - 1 ] = 0;
+ pKBeg[ n20 - 1 ] = 0;
+ pKEnd[ n20 - 1 ] = 0;
+ pKTex[ n20 - 1 ] = 0;
+
+ a2783:
+ spyf77::sProm80 = " Send output file name for final $include file :";
+ utilities::prompt(*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ]), \
+ spyf77::sProm80);
+ reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 4 ]) -> read(&spyf77::sBuff77[ 0 ], 80);
+ reinterpret_cast<std::fstream *>(blkcom::pLFiles[ 12 ]) -> open(spyf77::sBuff77.c_str(), std::ios::in);
+ reinterpret_cast<std::fstream *>(blkcom::pLFiles[ 12 ]) -> seekg(std::ios::beg);
+ spyf77::sANSI8.str().replace(0, 4, "kard");
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 4 ])) << spyf77::sANSI8.str().substr(0, 4);
+ for(j = 1; j <= n20; j++)
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 4 ])) << pKard[ j - 1 ];
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 4 ])) << std::endl;
+ spyf77::sANSI8.str().replace(0, 4, "karg");
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 4 ])) << spyf77::sANSI8.str().substr(0, 4);
+ for(j = 1; j <= n20; j++)
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 4 ])) << pKArg[ j - 1 ];
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 4 ])) << std::endl;
+ spyf77::sANSI8.str().replace(0, 4, "kbeg");
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 4 ])) << spyf77::sANSI8.str().substr(0, 4);
+ for(j = 1; j <= n20; j++)
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 4 ])) << pKBeg[ j - 1 ];
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 4 ])) << std::endl;
+ spyf77::sANSI8.str().replace(0, 4, "kend");
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 4 ])) << spyf77::sANSI8.str().substr(0, 4);
+ for(j = 1; j <= n20; j++)
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 4 ])) << pKEnd[ j - 1 ];
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 4 ])) << std::endl;
+ spyf77::sANSI8.str().replace(0, 4, "ktex");
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 4 ])) << spyf77::sANSI8.str().substr(0, 4);
+ for(j = 1; j <= n20; j++)
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 4 ])) << pKTex[ j - 1 ];
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 4 ])) << std::endl;
+ for(j = n11; j <= spycom::nLimCRD; j++)
+ (*reinterpret_cast<std::fstream *>(blkcom::pLFiles[ 12 ])) << spyf77::sFile6[ spycom::nLimCRD + n11 - j - 1 ].substr(0, 80) << std::endl;
+ reinterpret_cast<std::fstream *>(blkcom::pLFiles[ 12 ]) -> close();
+ goto a1311;
+
+ a9200:
+ blkcom::nChain = 51;
+ blkcom::sLStat[ 17 ] = -1;
+
+ a9800:
+ if(nNTACS != 2)
+ goto a9002;
+ k = 1;
+ for(j = 1; j <= spycom::nNumCRD; j++) {
+ if((strcom::toLower(spyf77::sFile6[ j - 1 ].substr(0, 5)) != "blank") && !spyf77::sFile6[ j - 1 ].empty())
+ goto a3005;
+ ++k;
+ if(k >= 6)
+ goto a9002;
+ spyf77::sFile6[ j - 1 ].replace(0, 2, "c ");
+ goto a3500;
+
+ a3005:
+ switch(k) {
+ case 1:
+ goto a3010;
+
+ case 2:
+ goto a3020;
+
+ case 3:
+ goto a3500;
+
+ case 4:
+ goto a3040;
+
+ case 5:
+ goto a3050;
+ }
+
+ a3010:
+ if(spyf77::sFile6[ j - 1 ].substr(0, 2) == "99")
+ spyf77::sFile6[ j - 1 ].replace(0, 2, " ");
+ goto a3500;
+
+ a3020:
+ if((tolower(spyf77::sFile6[ j - 1 ][ 0 ]) == 'c') || (spyf77::sFile6[ j - 1 ][ 0 ] == '9') || (spyf77::sFile6[ j - 1 ][ 0 ] == '$'))
+ ;
+ else {
+ if(spyf77::sFile6[ j - 1 ][ 0 ] != '1')
+ goto a3022;
+ spyf77::sFile6[ j - 1 ][ 0 ] = '1';
+ }
+ break;
+
+ a3022:
+ if(spyf77::sFile6[ j - 1 ][ 1 ] != '2')
+ goto a3024;
+ spyf77::sFile6[ j - 1 ].replace(0, 2, "14");
+ break;
+
+ a3024:
+ spyf77::sFile6[ j - 1 ][ 0 ] = '2';
+ break;
+
+ a3040:
+ if(spyf77::sFile6[ j - 1 ][ 0 ] != ' ')
+ goto a3500;
+ spyf77::sFile6[ j - 1 ].replace(0, 2, "33");
+ break;
+
+ a3050:
+ if(spyf77::sFile6[ j - 1 ][ 0 ] != ' ')
+ goto a3500;
+ spyf77::sFile6[ j - 1 ].replace(0, 2, "77");
+ break;
+ }
+
+ a3500:
+ ;
+
+ a9002:
+ if(blkcom::nIprsUp < 1)
+ goto a9007;
+ (*reinterpret_cast<std::stringstream *> (spycom::pMFiles[ 5 ])) << " Exit \"datain\". numcrd, limcrd, kill =" << std::setw(8) << spycom::nNumCRD << spycom::nLimCRD << blkcom::nKill << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+
+ a9007:
+ return;
+ }
+
+}
+
+// end of file datain.cpp
diff --git a/sources/dekplt.cpp b/sources/dekplt.cpp
new file mode 100644
index 0000000..bded79d
--- /dev/null
+++ b/sources/dekplt.cpp
@@ -0,0 +1,265 @@
+//-*- mode: c++; indent-tabs-mode: t; coding: utf-8; show-trailing-whitespace: t -*-
+
+// file dekplt.cpp
+
+#include "dekplt.hpp"
+
+namespace dekplt {
+
+ char pBBus[ 300 ];
+ char pBusLst[ 1000 ];
+ //
+ int nIBaud;
+ int nIBrnch;
+ int nIBsOut;
+ int nICHEnd;
+ int nICHRef;
+ int nICP;
+ int nICurse;
+ int nIHS;
+ int nInchPX;
+ int nInchPY;
+ int nInd1;
+ int nIndExp;
+ int nInWait;
+ int nIPrsrt;
+ int nITerm;
+ int nIZgr1;
+ int nIZgr2;
+ int nIZid;
+ int nZtit;
+ int nIzxax;
+ int nIzyax;
+ int nJhmsp = 0;
+ int nKLevl = 0;
+ int nKExtr = 0;
+ int nL4Plot;
+ int nLchfil;
+ int nLchid;
+ int nLchlim;
+ int nLchsup;
+ int nLchtit;
+ int nLchxax;
+ int nLchyax;
+ int nLdshg1;
+ int nLdshg2;
+ int nLimCol;
+ int nLimFix = 0;
+ int nLook;
+ int nLSymb;
+ int nLTic;
+ int nLu7Plt;
+ int nLinePR;
+ int nLTek;
+ int nMaxEv;
+ int nMaxEw;
+ int nMaxIp;
+ int nMaxIsx;
+ int nMaxIsy;
+ int nMaxSym;
+ int nMFake;
+ int nMGrid1;
+ int nMGrid2;
+ int nMid;
+ int nMLine;
+ int nMSuper;
+ int nMTit;
+ int nMu6Sav;
+ int nMu6Std;
+ int nMxypl;
+ int nNamVar;
+ int nNc;
+ int nChSup;
+ int nChVer;
+ int nCut;
+ int nCut1;
+ int nCut2;
+ int nNewFil;
+ int nNoLabl;
+ int nSmplt = 50;
+ int nNT2;
+ int nNumBrn;
+ int nNumFlt;
+ int nNumNVO;
+ int nNumOut;
+ int nNumRaw;
+ int nNumTek;
+ int nNumTit;
+ int nV;
+ int nXEnd;
+ int nXId6;
+ int nXInch;
+ int nXMax;
+ int nXOff;
+ int nXVern;
+ int nYEnd;
+ int nYId6;
+ int nYInch;
+ int nYMax;
+ int nYOff;
+ int pIVCom[ 60 ];
+ int pLabrtm[ 20 ];
+ int pMCurve[ 20 ];
+ int pMLevel[ 20 ];
+ int pMMM[ 20 ];
+ int nMPlot[ 20 ];
+ int pMStart[ 20 ];
+ int pMSymbT[ 20 ];
+ int pNumPts[ 20 ];
+ //
+ double nDX;
+ double nDXGrd1;
+ double nDXGrd2;
+ double nDY;
+ double nDYGrd1;
+ double nDYGrd2;
+ double nEvnByt;
+ double nFact;
+ double nFHTax;
+ double nFill;
+ double nFill1;
+ double nFill2;
+ double nFinFin = 1.0e12;
+ double nFLine;
+ double nFSymb;
+ double nFTCarr;
+ double nFVAxtt;
+ double nFXId;
+ double nFXNumH;
+ double nFXNumV;
+ double nFXSup;
+ double nFXTit;
+ double nFXVert;
+ double nFYId;
+ double nFYSup;
+ double nFYTit;
+ double nGMax;
+ double nGMin;
+ double nHA;
+ double nHMax;
+ double nHMin;
+ double nHPI;
+ double nHTax;
+ double nPapLim = 36.0;
+ double nPapMax;
+ double nSizID;
+ double nSizSup;
+ double nSizTit;
+ double nTAxisL = 5.0;
+ double nTimeBeg = 0.0;
+ double nTimeEnd = 1.0e20;
+ double nTMult;
+ double nTolrce = 8.0e-5;
+ double nTStep;
+ double nVaxIsl;
+ double nVH = 6.0;
+ double nVL = 5.0;
+ double nVMax;
+ double nVMaxR;
+ double nVMin;
+ double nVMinR;
+ double nVS = 1.0;
+ double nXId;
+ double nXSuper;
+ double nXTit;
+ double nYId;
+ double nYSuper;
+ double nYTit;
+ double pAAA[ 20 ];
+ double pBBB[ 20 ];
+ double pBX[ 150 ];
+ double pDatePL[ 2 ];
+ double pDYOld[ 20 ];
+ double pEV[ 15000 ];
+ double pEW[ 15000 ];
+ double pFVCom[ 50 ];
+ double pFXRef[ 25 ];
+ double pFYRef[ 25 ];
+ double pTClop[ 2 ];
+ double pTTLev[ 20 ];
+ double pTTMax[ 20 ];
+ double pTTMin[ 20 ];
+ double pYLevel[ 20 ];
+ double pYYMax[ 20 ];
+ double pYYMin[ 20 ];
+ //
+ extern std::string sFilNam;
+ std::string sAlpha;
+ std::string sBuffIn;
+ std::string sVertL;
+ std::string sHeadL;
+ std::string sXYTitl;
+ std::string sTextD1;
+ std::string sTextD2;
+ std::string sCurren;
+ std::string sVoltag;
+ std::string sBrClas;
+ std::string sDate;
+ std::string sTime;
+ std::string sANSI;
+ std::string pSlot1[ 20 ];
+ std::string pSext[ 6 ];
+ std::string pHorzL[ 8 ];
+ std::string pIBuff[ 20 ];
+ std::string pABuff77[ 10 ];
+ std::string pAnPlt[] = {
+ "choice",
+ "stop",
+ "purge",
+ "help",
+ "smooth",
+ "size",
+ "show",
+ "line",
+ "copy",
+ "end",
+ "repeat",
+ "flush",
+ "playback",
+ "pen",
+ "factor",
+ "offset",
+ "limits",
+ "time",
+ "timespan",
+ "debug",
+ "tek",
+ "stack",
+ "printer",
+ "metric",
+ "all time",
+ "column",
+ "set colu",
+ "out",
+ "longer",
+ "average",
+ "in",
+ "rescale",
+ "last",
+ "batch",
+ "punch",
+ "extrema",
+ "level",
+ "no plot",
+ "message",
+ "time uni",
+ "label",
+ "cursor",
+ "x-y plot",
+ "slope",
+ "back",
+ "set data"
+ };
+ //
+ tIVCom sIVCom = {
+ .m_nXInch = 74,
+ .m_nYInch = 68,
+ .m_nXOff = 100,
+ .m_nYOff = 40,
+ .m_nXVern = 30,
+ };
+ //
+}
+
+
+// end of file dekplt.cpp
diff --git a/sources/dekspy.cpp b/sources/dekspy.cpp
new file mode 100644
index 0000000..aeacd05
--- /dev/null
+++ b/sources/dekspy.cpp
@@ -0,0 +1,164 @@
+//-*- mode: c++; indent-tabs-mode: t; coding: utf-8; show-trailing-whitespace: t -*-
+
+// file dekspy.cpp
+
+#include "dekspy.hpp"
+
+char *cFilByt;
+double *pPltBuf;
+double pForByt[ 600 ];
+bool bLogVar;
+
+namespace spycom {
+
+ void *pMFiles[ 16 ] = {
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr
+ };
+ //
+ char cChar1;
+ char pByteBuf[ 20 ];
+ //
+ long int nITExp;
+ long int nNumSym;
+ long int nJJRoll;
+ long int nMaxArg;
+ long int nKilPer;
+ long int nKFile5;
+ long int nKLevel;
+ long int nKVerfy;
+ long int nJWord;
+ long int nIBegCL;
+ long int nIEndCL;
+ long int nLIdnt1;
+ long int nLIdnt2;
+ long int nNBreak;
+ long int nLinNow;
+ long int nLinSPN;
+ long int nNumKey;
+ long int nIndBuf;
+ long int nIndBeg;
+ long int nMFlush;
+ long int nNewVec;
+ long int nMaxFLG;
+ long int nKSPSav;
+ long int nMemKAR;
+ long int nNoBack;
+ long int nLSerLC;
+ long int nKSerLC;
+ long int nKBRSer;
+ long int nLockBR;
+ long int nKErase;
+ long int nKomAdd;
+ long int nIprSpy;
+ long int nMonitR;
+ long int nMonitS;
+ long int nKBreak;
+ long int nLimBuf;
+ long int nKOLOut;
+ long int nNumex;
+ long int nNexMod;
+ long int nNextSN;
+ long int nIncHlp;
+ long int nKSymbl;
+ long int nKopyIt;
+ long int nKSlowR;
+ long int nKWTSpy;
+ long int nNumRMP;
+ long int nLUntSP;
+ long int nLogVar;
+ long int nLimCRD;
+ long int nNumCRD;
+ //
+ long int pIASCII[ 1000 ];
+ long int pIndXRP[ 20 ];
+ long int pIVec[ 1000 ];
+ long int pLabels[ 15];
+ long int pLocate[ 1000 ];
+ long int pNLine[ 1000 ];
+ long int pLimArr[ 4 ];
+ long int pIMin[ 55 ];
+ long int pIMax[ 55 ];
+ long int pKSMSpy[ 3 ];
+ long int pLocOut[ 55 ];
+ long int pIntOut[ 55 ];
+ long int pLoopRP[ 20 ];
+ long int pN10RMP[ 20 ];
+ long int pKonTAC[ 14 ];
+ long int pKonAdd[ 14 ];
+ long int pKBegTX[ 85 ];
+ long int pKar1[ 1 ];
+ long int pKar2[ 2 ];
+ long int pKYRamp[ 20 ];
+ //
+ double *pFKar1;
+ double *pFKar2;
+ double *pPltBuf;
+ // equivalence (kar1, fkar1), (kar2, fkar2)
+ double nTMinRP;
+ double nTMaxRP;
+ double nTBreak;
+ double nEPSKOn[ 14 ];
+ double pFBegRP[ 20 ];
+ double pFEndRP[ 20 ];
+ double pForByt[ 600 ];
+ double pRampCN[ 20 ];
+ double pRampSL[ 20 ];
+ double pTBegRP[ 20 ];
+ double pTEndRP[ 20 ];
+ //
+ std::vector<long int> sMemRMP(20);
+
+}
+
+namespace spyf77 {
+
+ char cChar1;
+ char pDigit[ 10 ] = { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' };
+ char pCol[ 25 ];
+ char pFilExt[ 10 ];
+ //
+ std::string sANSW80;
+ std::string sBlan80;
+ std::string sBroBus;
+ std::string sBuff77;
+ std::string sBytBuf;
+ std::string sBytFnd;
+ std::string pSymb[ 1000 ];
+ std::string sSymbRP[ 20 ];
+ std::string sABufSV;
+ std::string sJunker;
+ std::string sOutLin;
+ std::string pFile6B[ 20 ];
+ std::string sProm80;
+ std::string pTexPar[ 10 ];
+ std::string sSpyCD2;
+ std::string pTexSpy[ 1250 ];
+ //
+ std::stringstream sANSI8;
+ std::stringstream sANSI16;
+ std::stringstream sANSI32;
+ std::stringstream sMFile5;
+ std::stringstream sOutSav;
+ std::stringstream sHeding;
+ //
+ std::vector<std::string> sSpyKWD;
+ //
+ std::vector<std::string> sFile6;
+}
+
+// end of file dekspy.cpp
diff --git a/sources/emtp.cpp b/sources/emtp.cpp
new file mode 100644
index 0000000..5364890
--- /dev/null
+++ b/sources/emtp.cpp
@@ -0,0 +1,1130 @@
+//-*- mode: c++; indent-tabs-mode: t; coding: utf-8; show-trailing-whitespace: t -*-
+
+// file emtp.cpp
+
+#include "emtp.hpp"
+
+// The EMTP solution process proper consists of numerous secondary-
+// level overlays, each called from module main10 using
+// module number 'nchain' as the indicator of where control is to
+// pass next. The following is a tabulation of valid 'nchain'
+// values, along with the function of the corresponding code. With
+// the possible exception of the time-step loop, 'nchain' is the
+// utpf overlay number of the code to which control is to be
+// transfered next. The overlay number of the time-step loop
+// is given by 'nchain' corresponding to the first quarter of
+// the time-step-loop segmentation, on machines not using ecs
+// overlaying.
+//
+// 1. Input of miscellaneous data cards.
+// 2. Input branch data.
+// 3. Code associated with the cascading of pi-circuits for
+// steady-state phasor solutions only.
+// 4. Input and processing of frequency-dependence data for
+// distributed-parameter line mode.
+// 5. Input of switch and source data cards.
+// 6. Network connectivity output. Setup of transient-network
+// renumbering tables.
+// 7. Network node renumbering routine (John Walker's old
+// subroutine number).
+// 8. Convert tables to new node numbers. Find steady-state
+// phasor equivalents for distributed branches.
+// 9. Set up steady-state phasor network renumbering tables.
+// 10. Form the steady-state admittance matrix (y). Solve for
+// steady-state phasor voltages.
+// 11. Output steady-state phasor solution (if requested).
+// 12. Branch-table and switch-table processing, as preparation
+// for the integration in time-step loop.
+// 13. Setup initial conditions on lumped elements, and past
+// history for distributed lines.
+// 14. Form (Y) for the transients network. Triangularize the
+// first partition (nonswitch/source nodes).
+// 15. Final setup operations before time-step loop.
+// 16. First quarter of time-step loop (checking for changes of
+// switches and pseudo-nonlinear elements, retriangularization
+// of Ybb and calculation of thevenin impedance vectors).
+// 17. Second quarter of time-step loop (branch-table history
+// updating, addition of branch contributions to nodal
+// injected current vector i ).
+// 18. Third quarter of time-step loop (source update, repeat
+// solution of (Y)v = i for node voltage vector v ).
+// 19. Fourth quarter of time-step loop (solution of 3-phase
+// nonlinearities and compensation-based rotating
+// machinery [type-50 s.m., u.m.], superposition to
+// give the total solution including compensation).
+// 20. Punch and print terminal conditions (if requested).
+// Catalog plot-data points on the disk as a permanent file, if
+// misc. data parameter 'icat' is positive.
+
+namespace emtp {
+
+ const long int nLL34 = 34;
+ std::string sSizesFileName;
+ tWords pWords[ 24 ] = {
+ { "a", "attach", 1 },
+ { "p", "punch", 2 },
+ { "out", "output", 3 },
+ { "s", "save", 4 },
+ { "spy", "spydata", 5 },
+ { "d", "disable", 7 },
+ { "r", "return", 10 },
+ { "n", "newfile", 11 },
+ { "ne", "new epsln", 13 },
+ { "de", "delete", 15 },
+ { "m", "monitor", 16 },
+ { "lf", "listoff", 18 },
+ { "ln", "liston", 20 },
+ { "v", "vintage", 21 },
+ { "old", "oldfile", 23 },
+ { "st", "stop", 25 },
+ { "w", "watch5", 26 },
+ { "com", "comment", 27 },
+ { "wi", "width", 29 },
+ { "u", "units", 30 },
+ { "", "", 31 },
+ { "", "", 0 }
+ };
+
+ // subroutine ioerr.
+ void ioerr(const long int &nAddr)
+ {
+ ;
+ }
+
+ // subroutine caterr.
+ void caterr(const long int &nAddr, const long int &nKodErr)
+ {
+ ;
+ }
+
+ void stoptp(void)
+ {
+ // Temporary stop statements of EMTP have been converted to
+ // "CALL STOPTP", allowing installation-dependent clean up.
+ blkcom::sTexCol = blkcom::sABuff.str().substr(0, 80);
+ if((blkcom::nChain == 31) && (blkcom::nLastOV == 1) && (blkcom::nKill == 9999))
+ exit(EXIT_FAILURE);
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Temporary error stop in \"stoptp\"., nchain, lastov =";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << blkcom::nChain << blkcom::nLastOV;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Last-read card image ABUFF follows ...." << std::endl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << blkcom::sABuff.str() << std::endl << std::flush;
+ exit(EXIT_FAILURE);
+ }
+
+ // subroutine nextcard.
+ void nextcard(void)
+ {
+ long int n7;
+ // This entry is used only for interactive EMTP. It gets
+ // next card image from memory rather than unit 5.
+ n7 = blkcom::nNumDCD + 1;
+
+ a1472:
+ if(spycom::nIprSpy < 5)
+ goto a1486;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " in \"nextcard\":";
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::setfill(' ') << std::setw(5) << std::dec << n7;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::setfill(' ') << std::setw(80) << spyf77::sFile6[ n7 - 1 ] << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+
+ a1486:
+ if(n7 <= spycom::nNumCRD)
+ goto a1488;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " **** **** Data crisis. Last card has been read. numcrd =";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << spycom::nNumCRD << std::endl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Use \"data\" command of spy to read in next block of data." << std::endl;
+ if(blkcom::nM4Plot != 1)
+ goto a9000;
+ over20::emtspy();
+ goto a1472;
+
+ a1488:
+ blkcom::sABuff.str(spyf77::sFile6[ n7 - 1 ]);
+ goto a9200;
+
+ a9000:
+ blkcom::nKill = 7654;
+
+ a9200:
+ return;
+ }
+
+ // subroutine cimage.
+ void cimage(void)
+ {
+ // VAX-11 installation-dependent EMTP module which serves
+ // to return the next input card. All systems will substitute.
+ //
+ //char pBuff10[ 80 ];
+ //
+ long int i;
+ long int j;
+ long int k;
+ long int l;
+ long int n1, n2, n3, n8 = 0, n11 = 0, n12 = 99999, n13 = 99999;
+ //
+ double d1;
+ double d11 = 0.0;
+ //
+ std::string sBuff10;
+ std::string sFileName;
+ std::string sText1;
+ std::string sText2;
+ std::string sText4("9");
+ std::string sText5("blank");
+ std::string sCharC("c");
+ std::string sChTACS("tacs");
+ //
+ std::fstream *pTempFile1 = nullptr, *pTempFile2 = nullptr, *pTempFile7 = nullptr;
+ //
+ auto a4209 = [ & ](void)
+ {
+ //
+ blkcom::nNFrFld = 1;
+ free((void *) &d11);
+
+ a4225:
+ if(d11 < 0.0)
+ pTempFile1 = pTempFile2;
+ else
+ pTempFile1 = reinterpret_cast<std::fstream *>(blkcom::pLFiles[ (int) d11 ]);
+ if(n8 == 8) {
+ utilities::closeFile(reinterpret_cast<std::fstream *>(pTempFile1));
+ if(blkcom::nNOutPR == 0)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "+Close file on unit 0x" << std::setfill('0') << std::setw(8) << std::hex << pTempFile1 << " ." << std::endl;
+ if(pTempFile1 == blkcom::pLFiles[ 4 ])
+ blkcom::nNOutPR = 1;
+ } else {
+ if(blkcom::nNOutPR == 0) {
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "+Copy file";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "0x" << std::setfill('0') << std::setw(8) << std::hex << pTempFile1;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " to" << sText1 << " ." << std::endl;
+ }
+ utilities::copyFile(pTempFile1, \
+ pTempFile7, \
+ sFileName);
+ }
+ };
+ auto a4206 = [ & ](void)
+ {
+ pTempFile2 = reinterpret_cast<std::fstream *>(blkcom::pLFiles[ 6 ]);
+ a4209();
+ };
+ auto a4506 = [ & ](void)
+ {
+ long int i;
+ long int k;
+ long int n4;
+ //
+ std::fstream *pTempFile6 = nullptr;
+ std::fstream *pTempFile7 = nullptr;
+ //
+ n4 = 0;
+ sFileName = std::string(25, ' ');
+ for(k = blkcom::nKolBeg; k <= 80; k++) {
+ if(blkcom::sTexCol[ k - 1 ] != ' ') {
+ if((blkcom::sTexCol[ k - 1 ] == blkcom::cCSepar) || \
+ (blkcom::sTexCol[ k - 1 ] == '('))
+ goto a4536;
+ ++n4;
+ sFileName[ n4 - 1 ] = blkcom::sTexCol[ k - 1 ];
+ }
+ }
+ k = 80;
+
+ a4536:
+ blkcom::nKolBeg = k + 1;
+ blkcom::nNFrFld = 1;
+ free((void *) &d11);
+ pTempFile7 = reinterpret_cast<std::fstream *>(blkcom::pLFiles[ (int) d11 - 1 ]);
+ if(n8 == 4) {
+ free((void *) &d11);
+ pTempFile6 = reinterpret_cast<std::fstream *>(blkcom::pLFiles[ (int) d11 - 1 ]);
+ } else {
+ if(!pTempFile6)
+ pTempFile6 = reinterpret_cast<std::fstream *>(blkcom::pLFiles[ 6 ]);
+ if(n8 == 5)
+ pTempFile7 = reinterpret_cast<std::fstream *>(spycom::pMFiles[ 4 ]);
+ if(!pTempFile7) {
+ for(k = 1; k <= 15; k++)
+ if(blkcom::pLFilesSave[ k - 1 ] == nullptr)
+ goto a4568;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::endl;
+ for(i = 1; i <= 10; i++)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Error, ";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::endl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::string(5, ' ') << " All I/O channels occupied. Kill run at s.n. 4566 of \"cimage\" ." << std::endl;
+ for(i = 1; i <= 20; i++)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(5) << std::dec << blkcom::pLFilesSave[ i - 1 ];
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::endl;
+ stoptp();
+
+ a4568:
+ pTempFile7 = reinterpret_cast<std::fstream *>(blkcom::pLFiles[ k - 1 ]);
+ } else {
+ if(blkcom::nNOutPR == 0)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "+" << sText1.substr(0, 6) << " file:" << sFileName.substr(0, 25) << " unit = 0x" << std::setfill('0') << std::setw(8) << std::hex << pTempFile7 << std::endl;
+ switch(n8) {
+ case 4:
+ utilities::copyFile(pTempFile6, pTempFile7, sFileName); // label 4423
+ break;
+
+ case 9:
+ utilities::openFile(pTempFile7, sFileName, std::ios::out); // label 4907
+ break;
+
+ case 11:
+ utilities::deleteFile(sFileName); // label 5106
+ break;
+
+ case 16:
+ utilities::closeFile(pTempFile7); // label 5608
+ utilities::openFile(pTempFile7, sFileName, std::ios::out);
+ break;
+
+ default:
+ utilities::closeFile(pTempFile7);
+ utilities::openFile(pTempFile7, sFileName, std::ios::out);
+ pTempFile7 -> seekp(0, std::ios::beg);
+ if(n8 == 5)
+ over20::spying();
+ break;
+ }
+ }
+ }
+ };
+ auto cattach = [ & ](void)
+ {
+ sText1 = "attach";
+ a4506();
+ };
+ auto cpunch = [ & ](void)
+ {
+ long int n1;
+ //
+ sText1 = "punch";
+ a4206();
+ };
+ auto coutput = [ & ](void)
+ {
+ sText1 = "output";
+ a4206();
+ };
+ auto csave = [ & ](void)
+ {
+ sText1 = "saved";
+ a4506();
+ };
+ auto cspydata = [ & ](void)
+ {
+ sText1 = "spying";
+ blkcom::pMFilesSave[ 1 ] = nullptr; // remember $spy for eof time in "spying (2288)"
+ blkcom::pMFilesSave[ 0 ] = spycom::pMFiles[ 4 ]; // remember spy input channel till now
+ spycom::pMFiles[ 4 ] = blkcom::pLFiles[ 16 ]; // special I/O unit used for $spy connection
+ spycom::nKFile5 = 1; // flag so "spying" knows munit5 opened to disk
+ a4506();
+ };
+ auto cdisable = [ & ](void)
+ {
+ if(blkcom::nNOutPR == 0)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "+Begin data to be ignored." << std::endl;
+ };
+ auto cenable = [ & ](void)
+ {
+ if(blkcom::nNOutPR == 0)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "+End of data to be ignored." << std::endl;
+ };
+ auto creturn = [ & ](void)
+ {
+ pTempFile2 = reinterpret_cast<std::fstream *>(blkcom::pLFiles[ 3 ]);
+ a4209();
+ };
+ auto cnewfile = [ & ](void)
+ {
+ sText1 = "newfil";
+ pTempFile2 = reinterpret_cast<std::fstream *>(blkcom::pLFiles[ 3 ]);
+ a4506();
+ };
+ auto cnew_epsilon = [ & ](void)
+ {
+ double d1;
+ //
+ blkcom::nNFrFld = 1;
+ d1 = blkcom::nEpsilon;
+ freedom::freeOne(blkcom::nEpsilon);
+ if(blkcom::nNOutPR == 0)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "+ Epsiln change. old, new =" << std::setfill(' ') << std::setw(13) << d1 << blkcom::nEpsilon << std::endl;
+ };
+ auto cdelete = [ & ](void)
+ {
+ sText1 = "delete";
+ a4506();
+ utilities::deleteFile(sFileName);
+ };
+ auto cmonitor = [ & ](void)
+ {
+ if(blkcom::nNOutPR != 0) {
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << sBuff10 << std::endl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "+CRT Monitor. Card number = " << std::setfill(' ') << std::setw(5) << std::dec << blkcom::nNumDCD << std::endl;
+ }
+ };
+ auto clistoff = [ & ](void)
+ {
+ if(blkcom::nNOutPR == 0) {
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "+Turn off input listing at card" << std::setfill(' ') << std::setw(5) << std::dec << blkcom::nNumDCD << std::endl;
+ blkcom::nNOutPR = 1;
+ }
+ };
+ auto cliston = [ & ](void)
+ {
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::string(51, ' ') << "|$liston"<< std::endl;
+ blkcom::nNOutPR = 0;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "+Turn on input listing at card" << std::setfill(' ') << std::setw(5) << std::dec << blkcom::nNumDCD << std::endl;
+ };
+ auto cvintage = [ & ](void)
+ {
+ ;
+ };
+ auto coldfile = [ & ](void)
+ {
+ ;
+ };
+ auto cstop = [ & ](void)
+ {
+ ;
+ };
+ auto cwatch5 = [ & ](void)
+ {
+ ;
+ };
+ auto ccomment = [ & ](void)
+ {
+ ;
+ };
+ auto cwidth = [ & ](void)
+ {
+ ;
+ };
+ auto cunits = [ & ](void)
+ {
+ ;
+ };
+ tRequest pRequests[] = {
+ { "a", "attach", 1, cattach },
+ { "p", "punch", 2, cpunch },
+ { "out", "output", 3, coutput },
+ { "s", "save", 4, csave },
+ { "spy", "spydata", 5, cspydata },
+ { "d", "disable", 7, cdisable },
+ { "e", "enable", 9, cenable },
+ { "r", "return", 10, creturn },
+ { "n", "newfile", 11, cnewfile },
+ { "ne", "new epsiln", 13, cnew_epsilon },
+ { "de", "delete", 15, cdelete },
+ { "m", "monitor", 16, cmonitor },
+ { "lf", "listoff", 18, clistoff },
+ { "ln", "liston", 20, cliston },
+ { "v", "vintage", 21, cvintage },
+ { "old", "oldfile", 23, coldfile },
+ { "st", "stop", 25, cstop },
+ { "w", "watch5", 26, cwatch5 },
+ { "com", "comment", 27, ccomment },
+ { "wi", "width", 29, cwidth },
+ { "u", "units", 30, cunits }
+ };
+ std::list<tRequest> sRequests(pRequests, pRequests + sizeof(pRequests) / sizeof(tRequest));
+ auto cecho = [ & ](void)
+ {
+ if(blkcom::nChain <= 15)
+ ++blkcom::pIpnTV[ 10 ] + 1;
+ reinterpret_cast<std::fstream *>(blkcom::pInEcho) -> write(blkcom::sABuff.str().c_str(), 80);
+ };
+ auto ibrinc = [ & ](void)
+ {
+ ++blkcom::nIBr;
+ labcom::sXOptBR[ blkcom::nIBr - 1 ] = blkcom::nXOpt;
+ labcom::sCOptBR[ blkcom::nIBr - 1 ] = blkcom::nCOpt;
+ };
+ //
+ // The main body of cimage subroutine.
+ //
+ if(blkcom::nIprsUp >= 10) {
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Begin cimage. lunit5, lunit6, noutpr, numdcd =";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "0x" << std::setfill('0') << std::setw(8) << std::hex << blkcom::pLFiles[ 4 ];
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "0x" << std::setfill('0') << std::setw(8) << std::hex << blkcom::pLFiles[ 5 ];
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(5) << std::dec << blkcom::nNOutPR;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(5) << std::dec << blkcom::nNumDCD << std::endl << std::flush;
+ }
+
+ a1000:
+ if(blkcom::nM4Plot == 1)
+ over20::emtspy();
+ if(blkcom::pLFiles[ 4 ] != nullptr) {
+ if(reinterpret_cast<std::ifstream *>(blkcom::pLFiles[ 4 ]) -> is_open()) {
+ std::getline(*reinterpret_cast<std::istream *>(blkcom::pLFiles[ 4 ]), sBuff10, '\n');
+ if(reinterpret_cast<std::ifstream *>(blkcom::pLFiles[ 4 ]) -> eof())
+ goto a4000;
+ }
+ }
+ if(blkcom::pLFiles[ 4 ]) {
+ if(!reinterpret_cast<std::ifstream *>(blkcom::pLFiles[ 4 ]) -> is_open())
+ nextcard();
+ } else
+ nextcard();
+ if(blkcom::nKill > 0)
+ goto a4000;
+ if(!blkcom::pLFilesSave[ 4 ])
+ ++blkcom::nNumDCD;
+ sBuff10 = blkcom::sABuff.str();
+ sText1 = sBuff10[ 0 ];
+ sText2 = sBuff10[ 1 ];
+ if(sText1 != CHARC)
+ goto a3034;
+ if(sText2 != BLANK)
+ goto a3034;
+
+ a1036:
+ if(blkcom::nNOutPR != 0)
+ goto a1000;
+ if(n11 != 0)
+ goto a1000;
+ if(blkcom::nKol132 == 132)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Comment card. " << std::string(37, ' ') << "|" << sBuff10.substr(0, 80) << std::endl;
+ else
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Comment card. " << std::string(37, ' ') << "|" << sBuff10.substr(0, 29) << std::endl;
+ goto a1000;
+
+ a3034:
+ if(blkcom::nNOutPR != 0)
+ goto a3035;
+ if(blkcom::nKol132 == 132)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::string(52, ' ') << "|" << sBuff10.substr(0, 80) << std::endl;
+ else
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::string(52, ' ') << "|" << sBuff10.substr(0, 29) << std::endl;
+
+ a3035:
+ if(n13 > 0)
+ goto a3011;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " " << std::setfill(' ') << std::setw(5) << std::dec << blkcom::nNumDCD << " :" << blkcom::sABuff.str().substr(0, 72) << std::endl;
+ n13 = n12;
+
+ a3011:
+ --n13;
+ blkcom::sABuff >> sText2;
+ if(strcom::toLower(sText2) != sText5)
+ goto a3040;
+ if(n8 == 6)
+ goto a3044;
+
+ a3039:
+ blkcom::sABuff.str("");
+ goto a3233;
+
+ a3040:
+ if(blkcom::sChCont == strcom::toLower(sText4))
+ goto a3233;
+ blkcom::sTexCol = blkcom::sABuff.str().substr(0, 80);
+ if((strcom::toLower(blkcom::sABuff.str()) != "$listoff") && \
+ (strcom::toLower(blkcom::sABuff.str()) != "$liston"))
+ goto a3042;
+ goto a3246;
+
+ a3042:
+ if(blkcom::sChCont == sChTACS)
+ goto a3233;
+ if(blkcom::sTexCol == blkcom::sChCont)
+ goto a3246;
+ if(n8 != 6)
+ goto a1144;
+
+ a3044:
+ if(blkcom::nNOutPR == 0)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "+Comment card (impicit)." << std::endl;
+ goto a1000;
+
+ a1144:
+ for(k = 1; k <= 80; k++) {
+ if(blkcom::sTexCol[ k - 1 ] == blkcom::cCSepar)
+ goto a3237;
+ if(blkcom::sTexCol.substr(k - 1, blkcom::sChCont.size()) == blkcom::sChCont)
+ goto a3237;
+ }
+
+ a3233:
+ blkcom::nKolBeg = -std::numeric_limits<long int>::infinity();
+ goto a7014;
+
+ a3237:
+ blkcom::nKolBeg = 1;
+ goto a7014;
+
+ a3246:
+ blkcom::nKolBeg = 2;
+
+ a3251:
+ blkcom::nNRight = -2;
+ freedom::freeOne(d1);
+ if(blkcom::nIprsUp >= 1)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::endl << " nfrfld = " << std::setfill(' ') << std::setw(8) << blkcom::nNFrFld << std::string(5, ' ') << "texta6 = " << blkcom::pTextA6[ 0 ].substr(0, 7) << blkcom::pTextA6[ 1 ].substr(0, 7) << std::endl;
+ blkcom::nNRight = 0;
+ for(i = 1; i <= 200; i++) {
+ n1 = pRequests[ i - 1 ].m_nPointer;
+ n2 = pRequests[ i ].m_nPointer - 1;
+ if(n2 < 0)
+ goto a3319;
+ if(blkcom::nIprsUp >= 35) {
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Special-request word" << std::setfill(' ') << std::setw(4) << i << " .";
+ for(j = n1; j <= n2; j++)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << pRequests[ j - 1 ].m_sLongName;
+ }
+ if(strcom::toLower(pRequests[ n1 - 1 ].m_sLongName) == BLANK)
+ goto a3306;
+ l = 0;
+ n2 = n2 - n1 + 1;
+ if(n3 != blkcom::nNFrFld)
+ goto a3306;
+ for(j = n1; j <= n2; j++) {
+ ++l;
+ if(strcom::toLower(blkcom::pTextA6[ l - 1 ]) != pRequests[ j - 1 ].m_sLongName)
+ goto a3306;
+ }
+ if(blkcom::nIprsUp >= 2) {
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::endl << " key-word found. i, n8 =" << std::setfill(' ') << std::setw(5) << i << n8;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::string(5, ' ') << "texta6, textay = " << blkcom::pTextA6[ 0 ] << pRequests[ i - 1 ].m_sLongName << std::endl;
+ }
+
+ a3294:
+ if(n8 != 6)
+ goto a3301;
+ if(i != 7)
+ goto a1036;
+
+ a3301:
+ n8 = i;
+ switch(n8) {
+ case 1: // ***** Request no. 1. "$attach" *****
+ cattach();
+ break;
+
+ case 2: // ***** Request no. 2. "$punch" *****
+ cpunch();
+ break;
+
+ case 3: // ***** Request no. 3. "$output" *****
+ coutput();
+ break;
+
+ case 4: // ***** Request no. 4. "$save" *****
+ csave();
+ break;
+
+ case 5: // ***** Request no. 5. "$spy" *****
+ cspydata();
+ break;
+
+ case 6: // ***** Request no. 6. "$disable" *****
+ cdisable();
+ break;
+
+ case 7: // ***** Request no. 7. "$enable" *****
+ cenable();
+ break;
+
+ case 8: // ***** Request no. 8. "$return" *****
+ creturn();
+ break;
+
+ case 9: // ***** Request no. 9. "$newfile" *****
+ cnewfile();
+ break;
+
+ case 10: // ***** Request no. 10. "new epsiln" *****
+ cnew_epsilon();
+ break;
+
+ case 11: // ***** Request no. 11. "delete" *****
+ cdelete();
+ break;
+
+ case 12: // ***** Request no. 12. "monitor" *****
+ cmonitor();
+ break;
+
+ case 13: // ***** Request no. 13. "listoff" *****
+ clistoff();
+ break;
+
+ case 14: // ***** Request no. 14. "liston" *****
+ cliston();
+ break;
+
+ case 15: // ***** Request no. 15. "vintage" *****
+ cvintage();
+ break;
+
+ case 16: // ***** Request no. 16. "oldfile" *****
+ coldfile();
+ break;
+
+ case 17: // ***** Request no. 17. "stop" *****
+ cstop();
+ break;
+
+ case 18: // ***** Request no. 18. "watch5" *****
+ cwatch5();
+ break;
+
+ case 19: // ***** Request no. 19. "comment" *****
+ ccomment();
+ break;
+
+ case 21: // ***** Request no. 21. "units" *****
+ cunits();
+ break;
+ }
+ if((n8 >= 1) && (n8 <= 21))
+ goto a1000;
+
+ a3306:
+ if(strcom::toLower(blkcom::pTextA6[ 0 ]) == pRequests[ i - 1 ].m_sLongName)
+ goto a3294;
+ }
+
+ a3319:
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Illegal $-card. Stop at s.n. 3319 of \"cimage\" ." << std::endl;
+ stoptp();
+ cattach();
+ goto a1000;
+
+ a4000:
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::endl << " " << std::string(85, '=') << std::endl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " End of file encounted in \"cimage\" while, attempting to read another data card. Stop." << std::endl << " " << std::string(85, '=') << std::endl;
+ stoptp();
+
+ a7014:
+ if(blkcom::pInEcho == nullptr)
+ return;
+ cecho();
+ }
+
+ void erexit(void)
+ {
+ // VAX-11 installation-dependent EMTP module. This is
+ // called by the top of "MAIN00", before any EMTP data input.
+ //int idum[ 3 ];
+ //nKWTVAX = 0;
+ datain::datain();
+ }
+
+ void dummy(void)
+ {
+ std::stringstream sTemp;
+ //
+ //(*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Dummy overlay function called. nchain = " << blkcom::nChain << ". Exiting." << std::endl << std::flush;
+ sTemp << " Dummy overlay function called. nchain = " << blkcom::nChain << ". Exiting." << std::endl << std::flush;
+ throw(std::runtime_error(sTemp.str().c_str()));
+ blkcom::nKill = 60;
+ }
+
+ // subroutine tapsav.
+ void tapsav(char *narray, std::fstream &n1, const long int &n2, const long int &n3)
+ {
+ // Near-universal module for dumping or restoring (central memory
+ // vs. disk) of /label/ . This does not work for those
+ // computers like Prime and Burroughs where common blocks
+ // are not ordered regularly in memory. Switch "KBURRO"
+ // selects between disk or virtual memory (/C29B01/).
+ int i;
+ int j;
+ int k;
+ int nKVecSv, n13;
+ //
+ long int n4, n9;
+ //
+ std::vector<long int> sKPen(5);
+ //
+ auto a5448 = [&](void)
+ {
+ if(n3 <= 1)
+ n1.write(&narray[ 0 ], n2);
+ else
+ n1.read(&narray[ 0 ], n2);
+ };
+ auto a6327 = [&](void)
+ {
+ if((blkcom::nChain == 20) && (blkcom::nMemSav == 1))
+ a5448 ();
+ else {
+ if(blkcom::nChain == 1)
+ a5448 ();
+ else {
+ if(!((blkcom::nChain == 6) || (blkcom::nChain == 8))) {
+ n13 = 29;
+ emtp::dimens(sKPen, n13, blkcom::sTrash, blkcom::sTrash);
+ nKVecSv = 2 * (blkcom::nIt + blkcom::nIt + blkcom::nIBr + blkcom::nTot + blkcom::nIoffd) + blkcom::nKSwtch + blkcom::nLHist;
+ n9 = blkcom::sSStat.m_nTLabl + nKVecSv * blkcom::pNByte[ 2 ] / blkcom::pNByte[ 3 ];
+ if(n9 >= sKPen[ 1 ] + 50) {
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Error stop in \"tapsav\". Overflow of /c29b01/ storage. n2, kpen(2) =";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw (8) << n2 << sKPen[ 1 ];
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " needed storage n9 =";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw (8) << n9;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "\n memory requirement in integer words for virtual computer implementation of tapsav. Storage must\n";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "provide for all of --/label/--( deck \"labcom\" ), the several usages \"vecrsv\" and \"vecisv\" (over6-11), plus 50 extra cells.\n";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "nchain =" << std::setw (5) << blkcom::nChain << std::endl << std::flush;
+ emtp::stoptp();
+ } else {
+ j = 50;
+ if(n3 <= 1) {
+ for(k = 1; k <= n2; k++) {
+ ++j;
+ labcom::pKArray[ j - 1 ] = narray[ k - 1 ];
+ }
+ } else {
+ for(k = 1; k <= n2; k++) {
+ ++j;
+ narray[ k - 1 ] = labcom::pKArray[ j - 1 ];
+ }
+ }
+ }
+ }
+ }
+ }
+ };
+ //
+ if(narray) {
+ if(blkcom::nIprsUp >= 1) {
+ n9 = 0;
+ sKPen[ 1 ] = 0;
+ n4 = (size_t) narray;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "\n Top of \"tapsav\". n1 n2 n3 kburro n4" << std::endl << std::flush;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "0x" << std::setw(8) << std::setfill('0') << std::hex << &n1 << " " << n2;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " " << n3 << " " << blkcom::nKBurro << std::setw(8) << " " << n4 << std::endl << std::flush;
+ } else {
+ if(blkcom::nKBurro != 1)
+ a5448();
+ else
+ a6327();
+ }
+ if (blkcom::nIprsUp >= 1)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Exit \"tapsav\". n9, kpen(2) = " << n9 << " " << sKPen[ 1 ] << std:: endl << std::flush;
+ }
+ }
+
+ /* subroutine main10. */
+
+ void main10(void)
+ {
+ subr10();
+ }
+
+ /* subroutine subr10. */
+
+ void subr10(void)
+ {
+ int nIprCBL;
+ int n24;
+ //
+ try {
+ blkcom::nKTab = 0;
+ FOREVER {
+ if(blkcom::nChain <= 20) {
+ if(blkcom::nKill != 0)
+ blkcom::nChain = 51;
+ else {
+ n24 = blkcom::nChain;
+ if(n24 < 1)
+ n24 = 1;
+ blkcom::nIprsUp = blkcom::pIprsOV[ n24 - 1 ];
+ nIprCBL = blkcom::nIprsUp;
+ if(blkcom::nM4Plot == 1)
+ over20::emtspy ();
+ if(blkcom::nChain == 0)
+ blkcom::nChain = 1;
+ switch (blkcom::nChain) {
+ case 1:
+#ifdef WITH_OVER1
+ over1::over1();
+#else
+ dummy();
+#endif
+ break;
+
+ case 2:
+#ifdef WITH_OVER2
+ over2();
+#else
+ dummy();
+#endif
+ break;
+
+ case 3:
+ case 4:
+ emtp::stoptp();
+ break;
+
+#ifdef WITH_OVER5
+ over5();
+#else
+ dummy();
+#endif
+ break;
+
+#ifdef WITH_OVER6
+ over6();
+#else
+ dummy();
+#endif
+ break;
+
+#ifdef WITH_OVER7
+ over7();
+#else
+ dummy();
+#endif
+ break;
+
+#ifdef WITH_OVER8
+ over8();
+#else
+ dummy();
+#endif
+ break;
+
+#ifdef WITH_OVER9
+ over9();
+#else
+ dummy();
+#endif
+ break;
+
+#ifdef WITH_OVER10
+ over10();
+#else
+ dummy();
+#endif
+ break;
+
+#ifdef WITH_OVER11
+ over11();
+#else
+ dummy();
+#endif
+ break;
+
+ case 12:
+#ifdef WITH_OVER12
+ over12();
+#else
+ dummy();
+#endif
+ break;
+
+ case 13:
+#ifdef WITH_OVER13
+ over13();
+#else
+ dummy();
+#endif
+ break;
+
+ case 14:
+#ifdef WITH_OVER14
+ over14();
+#else
+ dummy ();
+#endif
+ break;
+
+ case 15:
+#ifdef WITH_OVER15
+ over15();
+#else
+ dummy();
+#endif
+ break;
+
+ case 16:
+ case 17:
+ case 18:
+ case 19:
+#ifdef WITH_OVER16
+ over16();
+#else
+ dummy();
+#endif
+ break;
+
+ case 20:
+#ifdef WITH_OVER20
+ over20::over20();
+#else
+ dummy();
+#endif
+ break;
+ }
+ }
+ } else
+ break;
+ }
+ }
+ catch(std::exception &e) {
+ std::cerr << e.what() << std::endl;
+ exit(EXIT_FAILURE);
+ }
+ }
+ void setmar(int *n)
+ {
+ if (*n)
+ *n = 0;
+ }
+
+ void chrsiz(int *n)
+ {
+ if (*n)
+ *n = 0;
+ }
+
+ void setplt(void)
+ {
+ ;
+ }
+
+ void setstd (void)
+ {
+ ;
+ }
+
+ void interp(void)
+ {
+ ;
+ }
+
+ void namea6(const std::string &sText1, long int *n24)
+ {
+ // module for maintainance of alphanumeric vector texvec of
+ // "labcom". maxbus of "blkcom" is last used cell. n24 chooses
+ // mode of use: 0 will add text1, positive will locate it,
+ // and negative will destroy (remove) it.
+ int j;
+ int n17 = 0;
+ //
+ std::string sText2("unused");
+ //
+ if(blkcom::nMaxBus <= 0)
+ goto a3423;
+ for(j = 1; j <= blkcom::nMaxBus; j++)
+ if(strcom::toLower(sText1) == strcom::toLower(labcom::sTexVec[ j - 1 ]))
+ goto a3446;
+
+ a3423:
+ if(*n24 != 0)
+ goto a3438;
+ if (n17 == 0)
+ goto a3434;
+ labcom::sTexVec[ n17 - 1 ] = strcom::toLower (sText1);
+ *n24 = n17;
+ for(j = 1; j <= blkcom::nMaxBus; j++)
+ if(strcom::toLower(labcom::sTexVec[ j - 1 ]) != strcom::toLower(sText2)) {
+ ;
+ } else {
+ n17 = j;
+ goto a9000;
+ }
+ n17 = 0;
+ goto a9000;
+
+ a3434:
+ ++blkcom::nMaxBus;
+ if (blkcom::nMaxBus > blkcom::sSStat.m_nSize7)
+ exit(EXIT_FAILURE);
+ labcom::sTexVec[ blkcom::nMaxBus - 1 ] = strcom::toLower(sText1);
+ *n24 = blkcom::nMaxBus;
+ goto a9000;
+
+ a3438:
+ if(blkcom::nIprsUp >= 1) {
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " +++++ Search of EMTP name vector bus through cell";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw (5) << blkcom::nMaxBus;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " in \"namea6\" shows no match for\n";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " . \"";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw (6) << sText1;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "\". Return -intinf.";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw (10) << *n24 << std::endl << std::flush;
+ }
+ *n24 = std::numeric_limits<int>::min();
+ goto a9000;
+
+ a3446:
+ if (*n24 < 0)
+ goto a3455;
+ *n24 = j;
+ goto a9000;
+
+ a3455:
+ labcom::sTexVec[ j - 1 ] = strcom::toLower (sText2);
+ n17 = j;
+
+ a9000:
+ if(blkcom::nIprsUp >= 6) {
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Exit \"namea6\". text1, maxbus, n24, j =";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw (6) << sText1;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw (10) << blkcom::nMaxBus << *n24 << j << std::endl << std::flush;
+ }
+ }
+
+ void tables(void)
+ {
+ // Utility which is used to both dump and restore EMTP
+ // tables (central memory vs. disk). Usage is for both
+ // "statistics" (over12, over15, over20) and "start again"
+ // (over1, over20). Call to "tapsav" dumps /label/ .
+ // Also used by $restart request of "cimage" (called
+ // from "lookie" which is called by "subts3" of ov16).
+ // Also used by "restore" request of rtm, where table
+ // restoration is in "katalg" of overlay 20.
+ // Note about deck "synmac". If EMTP s.m. modeling
+ // Brandwajn (type-59), is to be deleted,
+ // then all s.m. subroutines ( smdat, smout, smpfit,
+ // smint, uncor, premec, elec, past,
+ // update, increm ) are to be destroyed, and
+ // deck "synmac" is to be removed from the present module.
+ // but then "dimension z(1)" should be added in its
+ // place, and the "n4 =" calculation involving "locint"
+ // should be replaced by the simple statements "n4 = 1" .
+ // comment card immediately preceding "synmac" -------------
+ // comment card immediately following "synmac" -------------
+ long int i, iprsav[] = { 0, 0, 0, 0 };
+ long int j;
+ long int ll0, ll1, ll2, ll4;
+ long int n1, n2, n3, n4, n5, n9, n24;
+ //
+ char *pBusOne = &blkcom::sBus1[ 0 ];
+ long int *pIDistX = &blkcom::nEnerg;
+ long int *pKBase = &blkcom::sMonCar.m_nKBase;
+ std::vector<long int> sIntegX;
+ std::vector<long int> sITemp;
+ std::vector<long int> sJTemp;
+ std::vector<long int> sKTemp;
+ std::vector<long int> sKPen;
+ //
+ ll1 = 1;
+ ll2 = 2;
+ ll4 = 4;
+ blkcom::nNWord1 = (size_t) blkcom::pVoltBC - (size_t) &sKPen;
+ blkcom::nNWord2 = (size_t) blkcom::pIDistX - (size_t) &blkcom::pLFilesSave[ 14 ];
+ // ... to complete.
+ }
+
+ // subroutine csup.
+
+ void csup(const long int &l)
+ {
+ ;
+ }
+
+}
+
+// end of file emtp.hpp
diff --git a/sources/freedom.cpp b/sources/freedom.cpp
new file mode 100644
index 0000000..fb65cad
--- /dev/null
+++ b/sources/freedom.cpp
@@ -0,0 +1,64 @@
+//-*- mode: c++; indent-tabs-mode: t; coding: utf-8; show-trailing-whitespace: t -*-
+
+// file freedom.cpp
+
+#include "freedom.hpp"
+
+namespace freedom {
+
+ template <> bool freeName<int>(int &a)
+ {
+ bool bReturnValue = false;
+ //
+ return bReturnValue;
+ }
+
+ template <> bool freeName<double>(double &a)
+ {
+ bool bReturnValue = false;
+ //
+ ;
+ return bReturnValue;
+ }
+
+ bool freeIn(const std::string &sANSI, int32_t &n12)
+ {
+ int32_t n8;
+ double d12;
+ bool bReturnValue = false;
+ //
+ if(n12) {
+ n8 = 1;
+ freeFix(sANSI, n8);
+ std::sscanf(sANSI.substr(0, 80).c_str (), "%lf", &d12);
+ n12 = (uint32_t) d12;
+ bReturnValue = true;
+ }
+ return bReturnValue;
+ }
+
+ bool freeIn(const std::string &, int32_t &, int32_t &)
+ {
+ bool bReturnValue = false;
+ //
+ return bReturnValue;
+ }
+
+ bool freeFix(const std::string &, int32_t &)
+ {
+ bool bReturnValue = false;
+ //
+ return bReturnValue;
+ }
+
+ bool freeOne(double &d)
+ {
+ bool bReturnValue = false;
+ //
+ //bReturnValue = freeFLD(sANSI, d);
+ return bReturnValue;
+ }
+
+}
+
+// end of file freedom.cpp
diff --git a/sources/labcom.cpp b/sources/labcom.cpp
new file mode 100644
index 0000000..62695ff
--- /dev/null
+++ b/sources/labcom.cpp
@@ -0,0 +1,101 @@
+//-*- mode: c++; indent-tabs-mode: t; coding: utf-8; show-trailing-whitespace: t -*-
+
+// file labcom.cpp
+
+#include "labcom.hpp"
+
+namespace labcom {
+
+ char *pKArray;
+ char *pNArray;
+ char *pSpace;
+ //
+ int *pKPSour;
+ int *pKSSFrq;
+ //
+ size_t *pKode;
+ //
+ std::vector<int> sIARDUB;
+ std::vector<int> sIBSOut;
+ std::vector<int> sIModel;
+ std::vector<int> sIndHst;
+ std::vector<int> sISkip;
+ std::vector<int> sISourc;
+ std::vector<int> sIWTent;
+ std::vector<int> sKBegSw;
+ std::vector<int> sKBus;
+ std::vector<int> sKDEPSw;
+ std::vector<int> sKENTNB;
+ std::vector<int> sKM;
+ std::vector<int> sKMSwit;
+ std::vector<int> sKode;
+ std::vector<int> sKodeBR;
+ std::vector<int> sKodSem;
+ std::vector<int> sKOutVP;
+ std::vector<int> sKPos;
+ std::vector<int> sKSWTyp;
+ std::vector<int> sLastSw;
+ std::vector<int> sLength;
+ std::vector<int> sMBus;
+ std::vector<int> sModSwt;
+ std::vector<int> sNameNL;
+ std::vector<int> sNextSw;
+ std::vector<int> sNBHDSw;
+ std::vector<int> sNHist;
+ std::vector<int> sNLType;
+ std::vector<int> sNOnLAD;
+ std::vector<int> sNOnLE;
+ std::vector<int> sNOnLK;
+ std::vector<int> sNOnLM;
+ //
+ std::vector<double> sADelay;
+ std::vector<double> sANOnL;
+ std::vector<double> sARDUBE;
+ std::vector<double> sBNRG;
+ std::vector<double> sBValue;
+ std::vector<double> sCChar;
+ std::vector<double> sCIK;
+ std::vector<double> sCI;
+ std::vector<double> sCK;
+ std::vector<double> sCNVHst;
+ std::vector<double> sCOn1;
+ std::vector<double> sCOptBR;
+ std::vector<double> sCrit;
+ std::vector<double> sCurr;
+ std::vector<double> sE;
+ std::vector<double> sEnergy;
+ std::vector<double> sEta;
+ std::vector<double> sGSlope;
+ std::vector<double> sHSFD;
+ std::vector<double> sQFD;
+ std::vector<double> sSCOnST;
+ std::vector<double> sSemAux;
+ std::vector<double> sSPTACS;
+ std::vector<double> sStailK;
+ std::vector<double> sStailM;
+ std::vector<double> sTClose;
+ std::vector<double> sTDNS;
+ std::vector<double> sTOpen;
+ std::vector<double> sVChar;
+ std::vector<double> sVecNL1;
+ std::vector<double> sVecNL2;
+ std::vector<double> sVoltI;
+ std::vector<double> sVOnL;
+ std::vector<double> sVZero;
+ std::vector<double> sWeight;
+ std::vector<double> sX;
+ std::vector<double> sXK;
+ std::vector<double> sXM;
+ std::vector<double> sXMax;
+ std::vector<double> sXOptBR;
+ std::vector<double> sYKM;
+ std::vector<double> sZInf;
+ //
+ std::vector<size_t> sNR;
+ //
+ std::vector<std::string> sBus;
+ std::vector<std::string> sTexVec;
+
+}
+
+// end of file labcom.cpp
diff --git a/sources/labl02.cpp b/sources/labl02.cpp
new file mode 100644
index 0000000..09b07ac
--- /dev/null
+++ b/sources/labl02.cpp
@@ -0,0 +1,36 @@
+//-*- mode: c++; indent-tabs-mode: t; coding: utf-8; show-trailing-whitespace: t -*-
+
+// file labl02.cpp
+
+#include "labl02.hpp"
+
+namespace com2 {
+
+ int nN1;
+ int nN2;
+ int nN3;
+ int nN4;
+ int nLCount;
+ int nModel;
+ int nL27Dep;
+ int nIBR1;
+ int nNRecur;
+ int nKGroup;
+ int nNC4;
+ int nNC5;
+ int nIFQ;
+ int nN13;
+ int nIDA;
+ int nIFKC;
+ int nIDY;
+ int nIDM;
+ int nIDQ;
+ int nIDU;
+ int nIDT;
+ int nIQ;
+ int nNC6;
+ int nNC3;
+
+}
+
+// end of file labl02.cpp
diff --git a/sources/labl29.cpp b/sources/labl29.cpp
new file mode 100644
index 0000000..5216d11
--- /dev/null
+++ b/sources/labl29.cpp
@@ -0,0 +1,50 @@
+//-*- mode: c++; indent-tabs-mode: t; coding: utf-8; show-trailing-whitespace: t -*-
+
+// file labl29.cpp
+
+#include "labl29.hpp"
+
+namespace com29 {
+
+ // Variables.
+ int nLimInc;
+ int nIOFArr;
+ int nVar;
+ int nKey;
+ int nMaxo29;
+ //
+ double nPer;
+ double nXmean1;
+ double nXVar1;
+ double nStDev1;
+ double nVMax;
+
+ // subroutine guts29.
+
+ void guts29(std::string &sBus, \
+ std::vector<int> &sKMSwit, \
+ std::vector<int> &sKdepsw, \
+ int &mIBrnch, \
+ int &nJBrnch, \
+ double &nAKey, \
+ std::vector<double> &sTStat, \
+ std::vector<double> &sTClose, \
+ std::vector<double> &sTOpen)
+ {
+ vector<double> sArray(reinterpret_cast<double *> (labcom::sKArray.data()), reinterpret_cast<double *> (labcom::sKArray.data () + labcom::sKArray.size ()));
+ //
+ std::string sText1 = "misc.";
+ std::string sText2 = "statistics d";
+ std::string sText5 = "begin";
+ std::string sText6 = "new da";
+ std::string sText7 = "bndc";
+ //
+ // missing other vars;
+ //
+
+
+ }
+
+}
+
+// end of file labl29.cpp
diff --git a/sources/location.cpp b/sources/location.cpp
new file mode 100644
index 0000000..3d13e38
--- /dev/null
+++ b/sources/location.cpp
@@ -0,0 +1,65 @@
+//-*- mode: c++; indent-tabs-mode: t; coding: utf-8; show-trailing-whitespace: t -*-
+
+// file location.cpp
+
+#include "location.hpp"
+
+namespace location {
+
+ std::vector<size_t> sLocate = std::vector<size_t> ({
+ reinterpret_cast<size_t>(&blkcom::sBus1),
+ reinterpret_cast<size_t>(&blkcom::sBus2),
+ reinterpret_cast<size_t>(&blkcom::sBus3),
+ reinterpret_cast<size_t>(&blkcom::sBus4),
+ reinterpret_cast<size_t>(&blkcom::sBus5),
+ reinterpret_cast<size_t>(&blkcom::sBus6),
+ reinterpret_cast<size_t>(&blkcom::sTrash),
+ reinterpret_cast<size_t>(&blkcom::sBlank),
+ reinterpret_cast<size_t>(&blkcom::sTerra),
+ reinterpret_cast<size_t>(&blkcom::sUserID),
+ reinterpret_cast<size_t>(&blkcom::sBranch),
+ reinterpret_cast<size_t>(&blkcom::sChCopy),
+ reinterpret_cast<size_t>(&blkcom::cCSepar),
+ reinterpret_cast<size_t>(&blkcom::sChCont),
+ reinterpret_cast<size_t>(&blkcom::sTexCol),
+ reinterpret_cast<size_t>(&blkcom::pTextA6[ 0 ]),
+ reinterpret_cast<size_t>(&blkcom::pDate1[ 0 ]),
+ reinterpret_cast<size_t>(&blkcom::pTClock[ 0 ]),
+ // To be continued
+ });
+
+ void locatn(void)
+ {
+ //
+ }
+
+ //
+
+ template <> size_t index<char>(char *a)
+ {
+ return ((size_t) &a[ 0 ] / sizeof(char));
+ }
+
+ template <> size_t index<int>(int *a)
+ {
+ return ((size_t) &a[ 0 ] / sizeof(int));
+ }
+
+ template <> size_t index<long int>(long int *a)
+ {
+ return ((size_t) &a[ 0 ] / sizeof(long int));
+ }
+
+ template <> size_t index<double>(double *a)
+ {
+ return ((size_t) &a[ 0 ] / sizeof(double));
+ }
+
+ template <> size_t index<std::string>(std::string *a)
+ {
+ return index((char *) a -> c_str());
+ }
+
+}
+
+// end of file location.cpp
diff --git a/sources/main.cpp b/sources/main.cpp
new file mode 100644
index 0000000..2d52703
--- /dev/null
+++ b/sources/main.cpp
@@ -0,0 +1,387 @@
+//-*- mode: c++; indent-tabs-mode: t; coding: utf-8; show-trailing-whitespace: t -*-
+
+// file main.cpp
+
+#include "main.hpp"
+
+//**********************************************************************
+// *
+// --------------- Electromagnetic Transients Program ------------ *
+// methods development branch, route eogb *
+// division of system engineering *
+// Bonneville Power Administration *
+// P. O. Box 3621 *
+// Portland, Oregon 97208 *
+// U.S.A. phone: (503) 230-4404 *
+// *
+// The fortran comment-card text now being read represents a *
+// summary introduction and explanation which applies to a very *
+// large program development referred to by the title of *
+// 'electromagnetic transients program' (abbreviated 'EMTP' , *
+// or 't.p.' in the older notation). *
+// *
+// In general terms, the purpose of this work is to simulate *
+// transient phenomena in power system networks, taking into *
+// account traveling waves (electromagnetic transients) on *
+// transmission lines, saturation of transformers, nonlinearities *
+// of surge arresters, etc. While not so restricted in theory, *
+// the most common program application is for the simulation of *
+// switching surges which propagate on power network transmission *
+// lines. for a more detailed explantion of the modeling *
+// techniques which are used, the reader is referred to the *
+// manual for this program (840 pages for the version dated *
+// march, 1983). ). while older issues were titled *
+// "EMTP user's manual", beginning in september of 1980 *
+// this work is now called the "EMTP rule book" . *
+// *
+// The utpf is a large 80-column bcd card-image file, to be used *
+// as input to e/t programs. E/t programs machine translate this *
+// utpf code into legal fortran for most computer systems of *
+// interest (ibm, cdc, univac, honeywell, dec pdp-10, dec vax-11, *
+// prime, sel, apollo, hitachi, facom, harris, etc.). *
+// *
+// In conformity with long-standing bpa policy, as well as the *
+// more recent (february 19, 1975) federal freedom of information *
+// act, dissemination of these program materials is freely made *
+// to any and all interested parties. a fee to cover reproduction,*
+// handling, and mailing costs may be assessed against the *
+// organization receiving the material, however. No claim or *
+// warranty as to the usefulness, accuracy, fidelity, or *
+// completeness of these materials is (or ever has been) in any *
+// way expressed or implied. *
+// *
+//**********************************************************************
+//
+// The present module main00 is always in memory. It is the
+// highest level module of a program which has two levels of
+// overlaying. It calls primary level overlays only (directly),
+// based on the value of variable 'nchain' . The following
+// legitimate values, and the meaning of the associated overlay
+// calls, exist .....
+// 1-20. For overlays 1, 2, ..., 20, which are secondary-level
+// overlays, a call must be first made to the controlling
+// primary-level overlay. Thus for such 'nchain' values,
+// control is transfered first to module main10 . This
+// is the only case where calls to overlays are not made
+// directly.
+//
+// 29. Completion of statistics (Monte Carlo) study, where variable
+// maxima of the different case solutions are read off the
+// disk, and are processed statistically to produce
+// cumulative distribution functions, etc.
+//
+// 31. Plot routine, for graphical output of transients.
+// The program also terminates execution here, usually,
+// after writing an end-of-information mark on the
+// plot tape (whether or not the user has plotted anything).
+//
+// 39. Supporting routine which generates EMTP branch
+// cards for the frequency-dependent representation of
+// an untransposed transmission line. this is the
+// "marti setup" code, named after dr. jose marti of
+// vancouver and caracas (see 1981 ieee pica paper).
+//
+// 41. Supporting routine which calculates transformer matrices (R)
+// and (L) from short-circuit and open-circuit data.
+//
+// 42. Supporting routine which converts an rms voltage vs. current
+// saturation characteristic into an instantaneous flux vs.
+// current characteristic.
+//
+// 43. Supporting routine which calculates weighting functions
+// a1(t) and a2(2) for the zero-sequence mode of a
+// distributed line which has frequency-dependent line
+// constants r and l .
+//
+// 44. Supporting routine which calculates line constants for
+// overhead transmission lines by means of carson's formula.
+// this is a modified version of what was originally (until
+// january 1975) the completely-separate bpa line-constants
+// program.
+//
+// 45. Supporting routine of 'Semlyen setup' code. the output
+// is a group of punched cards, as are required for the EMTP
+// simulation of a transmission circuit using semlyen
+// recursive convolution modeling.
+//
+// 47. Supporting routine of 'cable constants' code. the
+// primary function is to calculate (r), (l), % (c)
+// matrices for a multi-phase system of single-core coaxial
+// cables.
+//
+// 51. Printing of introductory paragraph of error-message
+// termination ('you lose, fella, ... '), plus error-message
+// texts for 'kill' codes numbered 1 through 50 .
+// the exiting linkage is to the last error overlay.
+//
+// 52. Error message texts for 'kill' codes numbered 51
+// the exiting linkage is to the last error overlay.
+//
+// 53. Error message texts for 'kill' codes numbered 91
+// through 150. the exiting linkage is to the last
+// error overlay.
+//
+// 54. Error message texts for 'kill' codes numbered 151
+// through 200. the exiting linkage is to the
+// last error overlay.
+//
+// 55. Final error overlay. Messages for kill = 201
+// onward are contained, as well as summary statistics
+// --- table sizes and timing figures for the run.
+// The exiting linkage is generally to module over1 (to read
+// a new data case), but may be to module over31 (for final
+// case termination).
+//**********************************************************************
+
+int main(int argc, char *argv[])
+{
+ char c;
+ char optopt;
+ int n1;
+ long int nReturnValue = EXIT_FAILURE;
+ static struct option long_options[] = {
+ { "dimensioning-file", optional_argument, nullptr, 'd' },
+ { "case-file", optional_argument, nullptr, 'f' },
+ { "help", optional_argument, nullptr, 'h' },
+ { "output-file", optional_argument, nullptr, 'o' },
+ { "verbose", optional_argument, nullptr, 'v' },
+ { "version", optional_argument, nullptr, 'V' },
+ { nullptr, 0, nullptr, 0 }
+ };
+ struct winsize sWindow;
+ //
+ auto a2010 = [&](void)
+ {
+ if(blkcom::nM4Plot == 1)
+ ;//emtspy();
+ switch(blkcom::nChain) {
+ case 29:
+#ifdef WITH_OVER29
+ over29();
+#else
+ emtp::dummy();
+#endif
+ break;
+
+ case 31:
+#ifdef WITH_OVER31
+ over31();
+#else
+ emtp::dummy();
+#endif
+ break;
+
+ case 39:
+#ifdef WITH_OVER39
+ over39();
+#else
+ emtp::dummy();
+#endif
+ break;
+
+ case 41:
+#ifdef WITH_OVER41
+ over41();
+#else
+ emtp::dummy();
+#endif
+ break;
+
+ case 42:
+#ifdef WITH_OVER42
+ over42();
+#else
+ emtp::dummy();
+#endif
+ break;
+
+ case 44:
+#ifdef WITH_OVER44
+ over44();
+#else
+ emtp::dummy();
+#endif
+ break;
+
+ case 45:
+#ifdef WITH_OVER45
+ over45();
+#else
+ emtp::dummy();
+#endif
+ break;
+
+ case 47:
+#ifdef WITH_OVER47
+ over47();
+#else
+ emtp::dummy();
+#endif
+ break;
+
+ case 51:
+#ifdef WITH_OVER51
+ over51::over51();
+#else
+ emtp::dummy();
+#endif
+ break;
+
+ case 52:
+#ifdef WITH_OVER52
+ over52();
+#else
+ emtp::dummy();
+#endif
+ break;
+
+ case 53:
+#ifdef WITH_OVER53
+ over53();
+#else
+ emtp::dummy();
+#endif
+ break;
+
+ case 54:
+#ifdef WITH_OVER54
+ over54();
+#else
+ emtp::dummy();
+#endif
+ break;
+
+ case 55:
+#ifdef WITH_OVER55
+ over55();
+#else
+ emtp::dummy();
+#endif
+ break;
+
+ default:
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::endl << " Illegal NCHAIN in MAIN00." << blkcom::nChain << std::endl << std::flush;
+ break;
+ }
+ };
+ auto a2001 = [&](void)
+ {
+ //
+ n1 = blkcom::nChain;
+ if(n1 > 30)
+ n1 -= 30;
+ if(n1 <= 0)
+ n1 = 1;
+ if(blkcom::nIprsUp == 0)
+ blkcom::nIprsUp = blkcom::pIprsOV[ n1 - 1 ];
+ if(blkcom::nChain > 20)
+ a2010();
+ else {
+ if((blkcom::nChain == 12) || (blkcom::nChain == 2))
+ emtp::main10();
+ else {
+ if(blkcom::nChain == -1)
+ ;//movecopy::move0(&blkcom::pIprsOv[ 0 ], nLL34);
+ emtp::vardim(emtp::sSizesFileName, blkcom::sLStat);
+ emtp::erexit();
+ blkcom::nChain = 0;
+ if (blkcom::nChain <= 20)
+ emtp::main10();
+ }
+ }
+ };
+ //
+ opterr = 0;
+ optind = 0;
+ blkcom::nLLBuff = -3333;
+ blkcom::nChain = -1;
+ blkcom::nLastOV = 0;
+ blkcom::nKill = 0;
+ blkcom::pLFiles[ 0 ] = reinterpret_cast<void *>(&std::cerr);
+ blkcom::pLFiles[ 4 ] = reinterpret_cast<void *>(&std::cin);
+ blkcom::pLFiles[ 5 ] = reinterpret_cast<void *>(&std::cout);
+ sWindow = utilities::getTerminalSize();
+ if(sWindow.ws_col >= 132)
+ blkcom::nKol132 = 132;
+ else if(sWindow.ws_col >= 80)
+ blkcom::nKol132 = 80;
+ else
+ blkcom::nKol132 = sWindow.ws_col;
+ while((c = getopt_long(argc, argv, "d:f:ho:vV", long_options, &optind)) != -1) {
+ switch(c) {
+ case 0:
+ // If this option set a flag, do nothing else now.
+ if(long_options[ optind ].flag != 0)
+ break;
+ std::cout << "Option " << long_options[ optind ].name;
+ if(optarg)
+ std::cout << " with arg " << optarg;
+ std::cout << std::endl;
+ break;
+
+ case 'd':
+ {
+ std::stringstream sTemp(optarg);
+ if(sTemp.str().empty()) {
+ blkcom::nChain = 51;
+ blkcom::nKill = 100;
+ emtp::sSizesFileName = "";
+ } else {
+ emtp::sSizesFileName = sTemp.str();
+ }
+ }
+ break;
+
+ case 'f':
+ // To do.
+ break;
+
+ case 'h':
+ std::cout << "Usage: gemtp++ [-d|--dimensioning-file dimfile] [-f|--case-file infile] [-h|--help] [-o|--output-file outfile] [-v|--verbose] [-V|--Version] [< infile]" << std::endl;
+ emtp::stoptp();
+ exit(EXIT_SUCCESS);
+ break;
+
+ case 'o':
+ // To do.
+ break;
+
+ case 'v':
+ ++blkcom::nIprsUp;
+ break;
+
+ case 'V':
+ // To do.
+ break;
+ }
+ }
+ FOREVER {
+ switch(blkcom::nKill) {
+ case 0:
+ case 9999:
+ a2001();
+ break;
+
+ case 7733:
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " \"main\" intercept of \"begin\" request." << std::endl << std::flush;
+ blkcom::nKill = 0;
+ blkcom::nNumDCD = 0;
+ blkcom::nChain = 1;
+ emtp::main10();
+ break;
+
+ default:
+ if(blkcom::nChain > 51)
+ a2001();
+ else {
+ blkcom::nChain = 51;
+ a2001();
+ }
+ break;
+ }
+ }
+ ;;
+ return nReturnValue;
+}
+
+// end of file main.cpp
diff --git a/sources/movecopy.cpp b/sources/movecopy.cpp
new file mode 100644
index 0000000..470e815
--- /dev/null
+++ b/sources/movecopy.cpp
@@ -0,0 +1,306 @@
+//-*- mode: c++; indent-tabs-mode: t; coding: utf-8; show-trailing-whitespace: t -*-
+
+// file movecopy.cpp
+
+#include "movecopy.hpp"
+
+namespace movecopy {
+
+ template <> size_t copy<double>(const double &from, double *to, const size_t &n)
+ {
+ size_t i;
+ size_t nReturnValue = 0L;
+
+ if(to) {
+ for (i = 0; i < n; i++)
+ to[ i ] = from;
+ nReturnValue = n;
+ }
+ return nReturnValue;
+ }
+
+ template <> size_t copy<int>(const int &from, int *to, const size_t &n)
+ {
+ size_t i;
+ size_t nReturnValue = 0L;
+
+ if(to) {
+ for (i = 0; i < n; i++)
+ to[ i ] = from;
+ nReturnValue = n;
+ }
+ return nReturnValue;
+ }
+
+ template <> size_t copy<long int>(const long int &from, long int *to, const size_t &n)
+ {
+ size_t i;
+ size_t nReturnValue = 0L;
+
+ if(to) {
+ for (i = 0; i < n; i++)
+ to[ i ] = from;
+ nReturnValue = n;
+ }
+ return nReturnValue;
+ }
+
+ template <> size_t copy<size_t>(const size_t &from, size_t *to, const size_t &n)
+ {
+ size_t i;
+ size_t nReturnValue = 0L;
+
+ if(to) {
+ for (i = 0; i < n; i++)
+ to[ i ] = from;
+ nReturnValue = n;
+ }
+ return nReturnValue;
+ }
+
+ template <> size_t copy<std::string>(const std::string &from, std::string *to, const size_t &n)
+ {
+ size_t i;
+ size_t nReturnValue = 0;
+
+ if (to) {
+ for (i = 0; i < n; i++)
+ to[ i ] = from;
+ nReturnValue = n;
+ }
+ return nReturnValue;
+ }
+
+ template <> size_t copy<double>(const double &from, std::vector<double> &to, const size_t &n)
+ {
+ size_t i;
+ size_t nReturnValue = 0L;
+
+ if(to.size() >= n) {
+ for(i = 0; i < n; i++)
+ to[ i ] = from;
+ nReturnValue = n;
+ }
+ return nReturnValue;
+ }
+
+ template <> size_t copy<int>(const int &from, std::vector<int> &to, const size_t &n)
+ {
+ size_t i;
+ size_t nReturnValue = 0L;
+
+ if(to.size() >= n) {
+ for(i = 0; i < n; i++)
+ to[ i ] = from;
+ nReturnValue = n;
+ }
+ return nReturnValue;
+ }
+
+ template <> size_t copy<long int>(const long int &from, std::vector<long int> &to, const size_t &n)
+ {
+ size_t i;
+ size_t nReturnValue = 0L;
+
+ if(to.size() >= n) {
+ for(i = 0; i < n; i++)
+ to[ i ] = from;
+ nReturnValue = n;
+ }
+ return nReturnValue;
+ }
+
+ template <> size_t copy<size_t>(const size_t &from, std::vector<size_t> &to, const size_t &n)
+ {
+ size_t i;
+ size_t nReturnValue = 0L;
+
+ if(to.size() >= n) {
+ for(i = 0; i < n; i++)
+ to[ i ] = from;
+ nReturnValue = n;
+ }
+ return nReturnValue;
+ }
+
+ template <> size_t copy<std::string>(const std::string &from, std::vector<std::string> &to, const size_t &n)
+ {
+ size_t i;
+ size_t nReturnValue = 0;
+ //
+ if(to.size() >= n) {
+ for(i = 0; i < n; i++)
+ to[ i ] = from;
+ nReturnValue = n;
+ }
+ return nReturnValue;
+ }
+
+ template <> size_t move<double>(const double from[], double *to, const size_t &n)
+ {
+ size_t i;
+ size_t nReturnValue = 0;
+
+ if (from) {
+ if (to) {
+ for (i = 0; i < n; i++)
+ to[ i ] = from[ i ];
+ nReturnValue = n;
+ }
+ }
+ return nReturnValue;
+ }
+
+ template <> size_t move<int>(const int from[], int *to, const size_t &n)
+ {
+ size_t i;
+ size_t nReturnValue = 0;
+
+ if (from) {
+ if (to) {
+ for (i = 0; i < n; i++)
+ to[ i ] = from[ i ];
+ nReturnValue = n;
+ }
+ }
+ return nReturnValue;
+ }
+
+ template <> size_t move<long int>(const long int from[], long int *to, const size_t &n)
+ {
+ size_t i;
+ size_t nReturnValue = 0;
+
+ if (from) {
+ if (to) {
+ for (i = 0; i < n; i++)
+ to[ i ] = from[ i ];
+ nReturnValue = n;
+ }
+ }
+ return nReturnValue;
+ }
+
+ template <> size_t move<std::string>(const std::string from[], std::string *to, const size_t &n)
+ {
+ size_t i;
+ size_t nReturnValue = 0;
+
+ if (from) {
+ if (to) {
+ for (i = 0; i < n; i++)
+ to[ i ] = from[ i ];
+ nReturnValue = n;
+ }
+ }
+ return nReturnValue;
+ }
+
+ template <> size_t move0<double>(double *to, const size_t &n)
+ {
+ return copy(0.0, to, n);
+ }
+
+ template <> size_t move0<int>(int *to, const size_t &n)
+ {
+ return copy((int) 0, to, n);
+ }
+
+ template <> size_t move0<long int>(long int *to, const size_t &n)
+ {
+ return copy((long int) 0, to, n);
+ }
+
+ template <> size_t move0<size_t>(size_t *to, const size_t &n)
+ {
+ return copy((size_t) 0, to, n);
+ }
+
+ template <> size_t move<double>(const std::vector<double> &from, std::vector<double> &to, const size_t &n)
+ {
+ size_t i;
+ size_t nReturnValue = 0;
+ //
+ if(from.size() == to.size()) {
+ for(i = 0; i < n; i++)
+ to[ i ] = from[ i ];
+ nReturnValue = n;
+ }
+ return nReturnValue;
+ }
+
+ template <> size_t move<int>(const std::vector<int> &from, std::vector<int> &to, const size_t &n)
+ {
+ size_t i;
+ size_t nReturnValue = 0;
+ //
+ if(from.size() == to.size()) {
+ for(i = 0; i < n; i++)
+ to[ i ] = from[ i ];
+ nReturnValue = n;
+ }
+ return nReturnValue;
+ }
+
+ template <> size_t move<long int>(const std::vector<long int> &from, std::vector<long int> &to, const size_t &n)
+ {
+ size_t i;
+ size_t nReturnValue = 0;
+ //
+ if(from.size() == to.size()) {
+ for(i = 0; i < n; i++)
+ to[ i ] = from[ i ];
+ nReturnValue = n;
+ }
+ return nReturnValue;
+ }
+
+ template <> size_t move<std::string>(const std::vector<std::string> &from, std::vector<std::string> &to, const size_t &n)
+ {
+ size_t i;
+ size_t nReturnValue = 0;
+ //
+ if(from.size() == to.size()) {
+ for(i = 0; i < n; i++)
+ to[ i ] = from[ i ];
+ nReturnValue = n;
+ }
+ return nReturnValue;
+ }
+
+ template <> size_t move<size_t>(const std::vector<size_t> &from, std::vector<size_t> &to, const size_t &n)
+ {
+ size_t i;
+ size_t nReturnValue = 0;
+ //
+ if(from.size() == to.size()) {
+ for(i = 0; i < n; i++)
+ to[ i ] = from[ i ];
+ nReturnValue = n;
+ }
+ return nReturnValue;
+ }
+
+ template <> size_t move0<double>(std::vector<double> &to, const size_t &n)
+ {
+ return copy(0.0, to, n);
+ }
+
+ template <> size_t move0<int>(std::vector<int> &to, const size_t &n)
+ {
+ return copy((int) 0, to, n);
+ }
+
+ template <> size_t move0<long int>(std::vector<long int> &to, const size_t &n)
+ {
+ return copy((long int) 0, to, n);
+ }
+
+ template <> size_t move0<size_t>(std::vector<size_t> &to, const size_t &n)
+ {
+ return copy((size_t) 0, to, n);
+ }
+
+}
+
+// end of file movecopy.cpp
diff --git a/sources/newmods.cpp b/sources/newmods.cpp
new file mode 100644
index 0000000..e8d38f8
--- /dev/null
+++ b/sources/newmods.cpp
@@ -0,0 +1,325 @@
+//-*- mode: c++; indent-tabs-mode: t; coding: utf-8; show-trailing-whitespace: t -*-
+
+// file newmods.cpp
+
+#include "newmods.hpp"
+
+//
+
+namespace emtp {
+
+ tVariable pVariables[] = {
+ { "x", "c0b001", 3, JBLTYPE_DOUBLE },
+ { "ykm", "c0b002", 5, JBLTYPE_DOUBLE },
+ { "km", "c0b003", 5, JBLTYPE_DOUBLE },
+ { "xk", "c0b004", 72, JBLTYPE_DOUBLE },
+ { "xm", "c0b005", 72, JBLTYPE_DOUBLE },
+ { "weight", "c0b006", 14, JBLTYPE_DOUBLE },
+ { "iwtent", "c0b007", 52, JBLTYPE_DOUBLE },
+ { "con1", "c0b008", 51, JBLTYPE_DOUBLE },
+ { "iskip", "c0b009", 13, JBLTYPE_DOUBLE },
+ { "zinf", "c0b010", 13, JBLTYPE_DOUBLE },
+ { "eta", "c0b011", 13, JBLTYPE_DOUBLE },
+ // To do.
+ { "itbtb3", "c44b25", 72, JBLTYPE_COMPLEX_DOUBLE },
+ { "tbtext", "c44b26", 73, JBLTYPE_COMPLEX_DOUBLE },
+ { "karray", "c45b01", 9, JBLTYPE_DOUBLE },
+ { "karray", "c47b01", 9, JBLTYPE_DOUBLE }
+ };
+
+ //
+
+ bool vardim(const std::string &sFileName, std::vector<long int> &sListNew)
+ {
+ long int i;
+ long int j;
+ long int n4, n9, n37;
+ bool bReturnValue = false;
+ long int n1;
+ long int nMTot;
+ long int pKExtra[ NUMKEX ];
+ long int pDefaultSizes[ NUMLST ] = {
+ 250, 300, 500, 100,
+ 2500, 40, 550, 1750,
+ 75, 160, 50, 50,
+ 5, 460, 50, 40,
+ 4, 5, 1600, 650,
+ 100, 150, 4000, 3,
+ 400, 50, 50, 1080
+ };
+ std::fstream sSizesFile;
+ std::vector<long int> sKExtra(NUMKEX);
+ std::vector<long int> sDefaultSizes(&pDefaultSizes[ 0 ], &pDefaultSizes[ NUMLST ]);
+ //
+ if(blkcom::nIprsUp >= 1)
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " Begin of vardim." << std::endl;
+ sListNew.resize(99);
+ sSizesFile.open(sFileName.c_str(), std::ios::in);
+ if(sSizesFile.good()) {
+ for(i = 1; i <= NUMLST; i++)
+ sSizesFile >> std::setw(8) >> sListNew[ i - 1 ];
+ if((sListNew[ 0 ] / 10e6) == 9) {
+ for(i = 1; i <= NUMKEX; i++)
+ sSizesFile >> sKExtra[ i - 1 ];
+ sListNew[ 0 ] -= 90e6;
+ }
+ sSizesFile.close();
+ } else {
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Using default data sizes." << std::endl;
+ for(i = 1; i <= NUMLST; i++)
+ sListNew[ i - 1 ] = sDefaultSizes[ i - 1 ];
+ }
+ if(blkcom::nIprsUp >= 1) {
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::endl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Pseudo-listing of data cards";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " which have been read by the variable";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "-dimensioning program 'vardim' . Only" << std::endl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " if all data fields are punched with";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " 'clean' i8 integer information will";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " this be a true listing. Data cards" << std::endl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " are in fact read in and then printed out";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " using integer variables and 10i8";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " format." << std::endl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " " << std::string(111, '-') << std::endl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::string(31, ' ') << "0";
+ for(i = 1; i <= 8; i++)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::string(9, ' ') << std::setw(1) << i;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::endl << std::string(31, ' ') << "0";
+ for(i = 1; i <= 8; i++)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::string(9, ' ') << "0";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::endl << std::string(31, ' ') << std::string(81, '-') << std::endl;
+ for(j = 0; j < 3; j++) {
+ switch(j) {
+ case 0:
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " 1st card (lists 1-10)." << std::string(7, ' ') << "|";
+ break;
+
+ case 1:
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " 2nd card (lists 11-20)." << std::string(7, ' ') << "|";
+ break;
+
+ case 2:
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " 3rd card (lists 21-30)." << std::string(7, ' ') << "|";
+ break;
+ }
+ for(i = 0; i < 8; i++)
+ if((i + 8 * j) < NUMLST)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(10) << std::setfill(' ') << sListNew[ i + 8 * j ];
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::endl;
+ }
+ }
+ if((sListNew[ 0 ] / 10e6) != 9)
+ goto a5294;
+ if(blkcom::nIprsUp >= 1) {
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Supplemental offsets." << std::string(9, ' ') << "|";
+ for (i = 1; i <= NUMKEX; i++)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << pKExtra[ i - 1 ];
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::endl;
+ }
+ sListNew[ 0 ] -= 90e6;
+
+ a5294:
+ if((sListNew[ 10 ] / 10e6) == 9) {
+ n4 = sListNew[ 10 ] - 90e6;
+ for(j = 1; j <= NUMLST; j++) // 5296
+ sListNew[ j - 1 ] = pDefaultSizes[ j - 1 ] * n4; // end 5296
+ }
+ if(sListNew[ 0 ] > 0)
+ sListNew[ 0 ] += 2;
+ for(i = 1; i <= NUMLST; i++) {
+ n1 = i;
+ if(sListNew[ i - 1 ] >= 1e6)
+ return false;
+ if(sListNew[ i - 1 ] <= 0)
+ sListNew[ i - 1 ] = pDefaultSizes[ i - 1 ];
+ }
+ if(sListNew[ 18 ] <= 23)
+ sListNew[ 18 ] = 23;
+ if(sListNew[ 25 ] <= 10)
+ sListNew[ 25 ] = 10;
+ n1 = sListNew[ 15 ] / 2;
+ if(2 * n1 != sListNew[ 15 ])
+ sListNew[ 15 ] += 1;
+ n1 = sListNew[ 26 ] / 2;
+ if(2 * n1 != sListNew[ 26 ])
+ sListNew[ 26 ] += 1;
+ // list number 51 is a dependent list, always twice
+ // the size of list number 13.
+ // This is for frequency-dependence arrays
+ // 'con1' , 'con2' , and 'con3' .
+ sListNew[ 50 ] = 6 * sListNew[ 12 ];
+ // list number 52 is a dependent list, always twice
+ // the size of list number 1, plus one.
+ // This is for frequency-dependence array 'iwtent' .
+ sListNew[ 51 ] += 1;
+ // list number 7 also serves for storage as part of
+ // list number 3. Hence list 7 must not be shorter.
+ // if (lstnew(3) .gt. lstnew(7))
+ // 1 lstnew(7) = lstnew(3)
+ // List number 53 is for terminal pairs
+ // associated with compensation elements.
+ sListNew[ 52 ] = sListNew[ 8 ] + 3 * sListNew[ 16 ];
+ // cable adds 5 list-2 extensions to 'namebr'
+ sListNew[ 53 ] = 6 * sListNew[ 1 ];
+ // list 55 has one entry for each subnetwork.
+ sListNew[ 54 ] = sListNew[ 8 ] + sListNew[ 16 ];
+ // list 56 is for vladimir's "cikfd" and "rmfd"
+ // arrays for freq-depend. generator equivalent
+ sListNew[ 55 ] = sListNew[ 1 ] * sListNew[ 26 ] / 2;
+ // list 57 maps #phases into znonl size.
+ sListNew[ 56 ] = sListNew[ 0 ] * sListNew[ 23 ];
+ // list 58 is for extrema vector "xmax" .
+ sListNew[ 57 ] = 4 * sListNew[ 11 ];
+ // list 59 is extended working vector "volti"
+ sListNew[ 58 ] = 2 * sListNew[ 25 ];
+ // list 60 provides double-length "kmswit" as
+ // replacement for earlier "klow" and "khigh"
+ sListNew[ 59 ] = 3 * sListNew[ 5 ];
+ // list 61 is for ontario hydro freq-dep source
+ sListNew[ 60 ] = 1;
+ // list 62 is for power/energy ("koutvp" which
+ // now includes former, separate "koutie")
+ sListNew[ 61 ] = 2 * sListNew[ 17 ];
+ sListNew[ 62 ] = 3 * sListNew[ 5 ];
+ sListNew[ 63 ] = 4 * sListNew[ 5 ];
+ // list 65 is for type-59 s.m. electrical data:
+ sListNew[ 64 ] = 101 * sListNew[ 16 ];
+ // list 66 is for type-59 s.m. electrical variables:
+ sListNew[ 65 ] = 24 * sListNew[ 16 ];
+ // list 67 is for type-59 s.m. mechanical data:
+ sListNew[ 66 ] = 12 * sListNew[ 15 ];
+ // list 68 is for type-59 s.m. mechanical variables:
+ sListNew[ 67 ] = 6 * sListNew[ 15 ];
+ // list 69 is for type-59 s.m. pointers:
+ sListNew[ 68 ] = 30 * sListNew[ 16 ];
+ // list 70 is for type-59 s.m. output pointers:
+ sListNew[ 69 ] = 5 * sListNew[ 10 ] + 2;
+ // list 71 is to extend list 21 for Ljg (18 aug 1987):
+ sListNew[ 70 ] = 2 * sListNew[ 20 ];
+ sListNew[ 71 ] = sListNew[ 7 ] + sListNew[ 27 ];
+ // list 73 is to extend list 22 for Ljg (10 mar 1988):
+ sListNew[ 72 ] = sListNew[ 21 ] + sListNew[ 20 ];
+ nMTot = 0;
+ std::vector<tVariable> sVariables(pVariables, pVariables + sizeof(pVariables) / sizeof(tVariable));
+ std::vector<tVariable>::iterator pI;
+ for(pI = sVariables.begin(); pI != sVariables.end(); pI++) {
+ n9 = pI -> m_nSize;
+ if((n9 != 0) && (n9 != 98)) {
+ n37 = 3;
+ if(pI -> m_sType != 0)
+ n37 = (long int) pI -> m_sType;
+ nMTot += (size_t) (n37 * sListNew[ n9 - 1 ]);
+ }
+ }
+ sListNew[ 28 ] = nMTot;
+ labcom::sX.resize(sListNew[ sVariables[ 0 ].m_nSize ]);
+ labcom::sYKM.resize(sListNew[ sVariables[ 1 ].m_nSize ]);
+ labcom::sKM.resize(sListNew[ sVariables[ 2 ].m_nSize ]);
+ labcom::sXK.resize(sListNew[ sVariables[ 3 ].m_nSize ]);
+ labcom::sXM.resize(sListNew[ sVariables[ 4 ].m_nSize ]);
+ labcom::sWeight.resize(sListNew[ sVariables[ 5 ].m_nSize ]);
+ labcom::sIWTent.resize(sListNew[ sVariables[ 6 ].m_nSize ]);
+ labcom::sCOn1.resize(sListNew[ sVariables[ 7 ].m_nSize ]);
+ labcom::sISkip.resize(sListNew[ sVariables[ 8 ].m_nSize ]);
+ labcom::sZInf.resize(sListNew[ sVariables[ 9 ].m_nSize ]);
+ labcom::sEta.resize(sListNew[ sVariables[ 10 ].m_nSize ]);
+ labcom::sNHist.resize(sListNew[ sVariables[ 11 ].m_nSize ]);
+ labcom::sStailM.resize(sListNew[ sVariables[ 12 ].m_nSize ]);
+ labcom::sStailK.resize(sListNew[ sVariables[ 13 ].m_nSize ]);
+ labcom::sXMax.resize(sListNew[ sVariables[ 14 ].m_nSize ]);
+ labcom::sKOutVP.resize(sListNew[ sVariables[ 15 ].m_nSize ]);
+ labcom::sBNRG.resize(sListNew[ sVariables[ 16 ].m_nSize ]);
+ labcom::sSCOnST.resize(sListNew[ sVariables[ 17 ].m_nSize ]);
+ labcom::sCNVHst.resize(sListNew[ sVariables[ 18 ].m_nSize ]);
+ labcom::sHSFD.resize(sListNew[ sVariables[ 19 ].m_nSize ]);
+ labcom::sQFD.resize(sListNew[ sVariables[ 20 ].m_nSize ]);
+ labcom::sSemAux.resize(sListNew[ sVariables[ 21 ].m_nSize ]);
+ labcom::sIBSOut.resize(sListNew[ sVariables[ 22 ].m_nSize ]);
+ labcom::sBValue.resize(sListNew[ sVariables[ 23 ].m_nSize ]);
+ labcom::sSPTACS.resize(sListNew[ sVariables[ 24 ].m_nSize ]);
+ labcom::sKSWTyp.resize(sListNew[ sVariables[ 25 ].m_nSize ]);
+ labcom::sModSwt.resize(sListNew[ sVariables[ 26 ].m_nSize ]);
+ labcom::sKBegSw.resize(sListNew[ sVariables[ 27 ].m_nSize ]);
+ labcom::sLastSw.resize(sListNew[ sVariables[ 28 ].m_nSize ]);
+ labcom::sKENTNB.resize(sListNew[ sVariables[ 29 ].m_nSize ]);
+ labcom::sNBHDSw.resize(sListNew[ sVariables[ 30 ].m_nSize ]);
+ labcom::sTOpen.resize(sListNew[ sVariables[ 31 ].m_nSize ]);
+ labcom::sCrit.resize(sListNew[ sVariables[ 32 ].m_nSize ]);
+ labcom::sKDEPSw.resize(sListNew[ sVariables[ 33 ].m_nSize ]);
+ labcom::sTDNS.resize(sListNew[ sVariables[ 34 ].m_nSize ]);
+ labcom::sISourc.resize(sListNew[ sVariables[ 35 ].m_nSize ]);
+ labcom::sEnergy.resize(sListNew[ sVariables[ 36 ].m_nSize ]);
+ labcom::sIARDUB.resize(sListNew[ sVariables[ 37 ].m_nSize ]);
+ labcom::sARDUBE.resize(sListNew[ sVariables[ 38 ].m_nSize ]);
+ labcom::sNOnLAD.resize(sListNew[ sVariables[ 39 ].m_nSize ]);
+ labcom::sNOnLE.resize(sListNew[ sVariables[ 40 ].m_nSize ]);
+ labcom::sVOnL.resize(sListNew[ sVariables[ 41 ].m_nSize ]);
+ labcom::sCurr.resize(sListNew[ sVariables[ 42 ].m_nSize ]);
+ labcom::sANOnL.resize(sListNew[ sVariables[ 43 ].m_nSize ]);
+ labcom::sVecNL1.resize(sListNew[ sVariables[ 44 ].m_nSize ]);
+ labcom::sVecNL2.resize(sListNew[ sVariables[ 45 ].m_nSize ]);
+ labcom::sNameNL.resize(sListNew[ sVariables[ 46 ].m_nSize ]);
+ labcom::sVZero.resize(sListNew[ sVariables[ 47 ].m_nSize ]);
+ bReturnValue = true;
+ return bReturnValue;
+ }
+
+ bool dimens(std::vector<long int> &sLSizes, \
+ const int &nChain, \
+ std::string &sBus1, \
+ std::string &sBus2)
+ {
+ long int n7;
+ bool bReturnValue = false;
+ //
+ if(sLSizes.size() > 0) {
+ if(blkcom::nChain < 29) {
+ n7 = 29;
+ sLSizes.push_back(0);
+ sBus1 = "91205";
+ sBus2 = "123093";
+ bReturnValue = true;
+ } else if(blkcom::nChain <= 29) {
+ sLSizes[ 0 ] = 0;
+ sLSizes[ 1 ] = 1992869;
+ sLSizes[ 2 ] = 23;
+ sLSizes[ 3 ] = 30000;
+ sLSizes[ 4 ] = 1;
+ sLSizes[ 5 ] = 3002;
+ sLSizes[ 6 ] = 9;
+ sLSizes[ 7 ] = 300;
+ bReturnValue = true;
+ } else if(blkcom::nChain <= 39) {
+ // To do.
+ } else if(blkcom::nChain <= 10) {
+ // To do.
+ } else if(blkcom::nChain <= 44) {
+ // To do.
+ } else if(blkcom::nChain <= 45) {
+ // To do.
+ } else if(blkcom::nChain <= 47) {
+ // To do.
+ } else {
+ sLSizes[ 0 ] = (size_t) &sBus1 - (size_t) &sBus2;
+ }
+ }
+ if(blkcom::nIprsUp >= 1)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Exiting vardim." << std::endl;
+ return bReturnValue;
+ }
+
+ bool cleanup(void)
+ {
+ bool bReturnValue = false;
+ //
+ if (labcom::pSpace) {
+ delete [] labcom::pSpace;
+ labcom::pSpace = nullptr;
+ bReturnValue = true;
+ }
+ return bReturnValue;
+ }
+
+}
+
+// end of file newmods.cpp
diff --git a/sources/over1.cpp b/sources/over1.cpp
new file mode 100644
index 0000000..35b6ced
--- /dev/null
+++ b/sources/over1.cpp
@@ -0,0 +1,767 @@
+//-*- mode: c++; indent-tabs-mode: t; coding: utf-8; show-trailing-whitespace: t -*-
+
+// file over1.cpp
+
+#include "over1.hpp"
+
+namespace over1 {
+
+ // subroutine over1.
+ void over1(void)
+ {
+ long int i;
+ long int j;
+ long int ll1, ll8, ll80;
+ long int n1, n5, n6, n7, n9;
+ long int nIAdQQ;
+ long int nIDA;
+ long int nIFKC;
+ long int nIP;
+ long int nIsWent;
+ long int nIY;
+ long int nNFDBR;
+ long int nNFDHST;
+ long int nNFDPH;
+ long int nNFDPol;
+ long int nNGroup;
+ long int nNK;
+ long int nNMAuto;
+ long int nNTLin;
+ long int nNTurn;
+ long int nNumBCO;
+ long int nNumNam;
+ long int pLSTACS[] = { 20, 90, 100, 20, 30, 250, 350, 60 };
+ double d1, d2, d3, d13;
+ double nPU;
+ double nZNVRef;
+ void *pLU2 = nullptr;
+ void *pLU6 = nullptr;
+ std::string sBus;
+ std::string sDiskFileName;
+ std::string sText2("name ");
+ std::string sText6("copy ");
+ std::string sText1("tacs o");
+ std::string sText3("tacs h");
+ std::string sText4("tacs s");
+ std::string sText5("4 ");
+ std::string sText7("tacs ");
+ //
+ auto start_again = [ & ](void)
+ {
+ long int j;
+ //
+ blkcom::pIAlter = blkcom::pLFiles[ 1 ];
+ if(blkcom::nNOutPR == 0)
+ (*reinterpret_cast<std::ostream *>(blkcom::pKFile6)) << "+Continue partially-completed data case." << std::endl;
+ if(blkcom::sTexCol[ 12 ] == sText5[ 0 ])
+ goto a2861;
+ blkcom::sABuff >> sDiskFileName;
+ for(j = 1; j <= 2; j++) {
+ n7 = sDiskFileName.find(',');
+ sDiskFileName.replace(0, n7, " ");
+ }
+ for(j = n7; j <= 80; j++)
+ if(sDiskFileName[ j - 1 ] != ' ')
+ break;
+ std::cout << " name of old pl4 file disk_file(j : 80) = " << sDiskFileName.substr(j, 80) << std::endl;
+ blkcom::pLFiles[ 76 ] = nullptr;
+ blkcom::pLFiles[ 76 ] = (void *) new std::ifstream;
+ if(blkcom::pLFiles[ 76 ]) {
+ reinterpret_cast<std::ifstream *>(blkcom::pLFiles[ 76 ]) -> open(sDiskFileName.substr(j, 80).c_str(), std::ios::in);
+ }
+ std::cout << " 1st record. numnam, numnvo, numbco, numbrn =" << nNumNam << dekplt::nNumNVO << nNumBCO << dekplt::nNumBrn << std::endl;
+ if(((blkcom::nLBus + blkcom::pSStat -> m_nSize7) >= nNumNam) && \
+ (blkcom::pSStat -> m_nSize12 >= dekplt::nNumNVO) && \
+ (blkcom::nLBranch >= dekplt::nNumBrn))
+ goto a2859;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Temporary error stop in \"over1\". Program dimensioning is inadequate. numnam, numnvo, numbrn =" << std::setfill(' ') << std::setw(8) << blkcom::nNumName << blkcom::nNumNVO << blkcom::nNumBRN << std::endl;
+ if(blkcom::pLFiles[ 76 ]) {
+ reinterpret_cast<std::ifstream *>(blkcom::pLFiles) -> close();
+ delete blkcom::pLFiles[ 76 ];
+ }
+ stoptp();
+
+ a2859:
+ reinterpret_cast<std::ifstream *>(blkcom::pLFiles[ 76 ]) -> seekg(0, std::ios::beg);
+ n8 = blkcom::nLBus;
+ if(blkcom::nLBus >= blkcom::nNumNam)
+ n8 = blkcom::nNumNam - 1;
+ std::cout << " New name logic. n8, numnam, lbus =" << n8 << blkcom::nNumNam << blkcom::nLBus << std::endl;
+ (*reinterpret_cast<std::ifstream *>(blkcom::pLFiles[ 76 ])) << datexx << tcloxx << blkcom::nNumNam << blkcom << nNumNVO << blkcom::nNumBCO << blkcom::nNumBRN;
+ for(j = 1; j <= n8; j++)
+ (*reinterpret_cast<std::ifstream *>(blkcom::pLFiles[ 76 ])) >> blkcom::sBus[ j - 1 ];
+ std::cout << " bus(1 : n8) =";
+ for(j = 1; j <= n8; j++)
+ std::cout << blkcom::sBus[ j - 1 ] << " ";
+ std::cout << std::endl;
+
+ a2859:
+ reinterpret_cast<std::ifstream *>(blkcom::pLFiles[ 76 ]) -> seekg(0, std::ios::beg);
+ blkcom::nNum888 = blkcom::nNumNam - n8;
+ std::cout << " Ready for final, full read with num888 =" << blkcom::nNum888 << std::endl;
+ (*reinterpret_cast<std::ifstream *>(blkcom::pLFiles[ 76 ])) >> datexx >> tcloxx >> blkcom::nNumNam >> blckom::nNumNVO >> blkcom::nNumBCO >> blkcom::nNumBRN;
+ for(j = 1; j <= n8; j++)
+ (*reinterpret_cast<std::ifstream *>(blkcom::pLFiles[ 76 ])) >> blkcom::sBus[ j - 1 ];
+ for(j = 1; j <= blkcom::nNum888; j++)
+ (*reinterpret_cast<std::ifstream *>(blkcom::pLFiles[ 76 ])) >> blkcom::pTexVec[ j - 1 ];
+ std::cout << " After all named are read. Next, ibsout." << std::endl;
+ if(blkcom::nNumNVO > 0)
+ for(j = 1; j <= blkcom::nNumNVO)
+ (*reinterpret_cast<std::ifstream *>(blkcom::pLFiles[ 76 ])) >> blkcom::pIBSOut[ j - 1 ];
+ std::cout << " After ibsout. Next, ...." << std::endl;
+ if(blkcom::nNumBRN > 0)
+ for(j = 1; j <= blkcom::nNumBRN)
+ (*reinterpret_cast<std::ifstream *>(blkcom::pLFiles[ 76 ])) >> blkcom::sMBus[ j - 1 ];
+ std::cout << " After kbus, mbus." << std::endl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 3 ])) << blkcom::sDate1 << blkcom::sTClock << blkcom::nNumNam << blkcom::nNumNVO << blkcom::nNumBCO << blkcom::nNumBRN;
+ for(j = 1; j <= n8; j++)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 3 ])) << blkcom::sBus[ j - 1 ];
+ for(j = 1; j <= blkcom::nNum888; j++)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 3 ])) << blkcom::sTexVec[ j - 1 ];
+ std::cout << " over1, lunit4 date and time =" << blkcom::pDate1[ 0 ] << blkcom::pDate1[ 1 ] << " " << blkcom::pTClock[ 0 ] << blkcom::pTClock[ 1 ] << std::endl;
+ if(blkcom::nNumNVO > 0)
+ for(j = 1; j <= blkcom::nNumNVO; j++)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 3 ])) << blkcom::pIBSOut[ j - 1 ];
+ if(blkcom::nNumBRN > 0)
+ for(j = 1; j <= blkcom::nNumBRN; j++)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 3 ])) << blkcom::pKBus[ j - 1 ] << blkcom::pMBus[ j - 1 ];
+ n18 = blkcom::nNumNVO + blkcom::nNumBRN + 1;
+ std::cout << " Enter loop over numbers. n18 =" << n18 << std::endl;
+ j = 1;
+ FOREVER {
+ for(k = 1; k <= n18; k++) {
+ (*reinterpret_cast<std::ifstream *>(blkcom::pLFiles[ 76 ])) >> labcom::sR4[ k - 1 ];
+ if(reinterpret_cast<std::ifstream *>(blkcom::pLFiles[ 76 ]) -> eof())
+ goto a6539;
+ }
+ if((blkcom::nIprsUp == 7) || (blkcom::nIprsUp > 9))
+ std::cout << " j, r4(1) =" << j << labcom::sR4[ 0 ];\
+ if(sR4[ 0 ] == -9999.0e0)
+ break;
+ for(k = 1; k <= n18; k++)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 3 ])) << labcom::sR4[ k - 1 ];
+ ++j;
+ }
+
+ a6539:
+ std::cout << " Done transferring lun77 to lunit(4). j =" << j << std::endl;
+ runtym(d1, d2);
+ n18 = pLocker[ 0 ];
+ n19 = pLocker[ 1 ];
+ pfatch();
+ tables();
+ std::cout << " n18, n19, locker(1), locker(2) =" << n18 << n19 << pLocker[ 0 ] << pLocker[ 1 ] << std::endl;
+ blkcom::pFLStat[ 0 ] = -d1;
+ blkcom::pFLStat[ 1 ] = -d2;
+ if((n18 == pLocker[ 0 ]) && (n19 == pLocker[ 1 ]))
+ goto a2863;
+ blkcom::nKill = 201;
+ blkcom::sStat.m_nTACST = 2861;
+ };
+ auto absolute_TACS_dimensions = [ & ](void)
+ {
+ if(blkcom::nNOutPR == 0)
+ (*reinterpret_cast<std::ostream *>(blkcom::pKFile6)) << "+Set absolute TACS list size limits." << std::endl;
+ // To do.
+ };
+ auto relative_TACS_dimensions = [ & ](void)
+ {
+ if(blkcom::nNOutPR == 0)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFile6)) << "+Proportional allocation of total TACS storage." << std::endl;
+ cimage();
+ if(blkcom::nKolBeg > 0)
+ goto a7120;
+ expchk(ll1, ll80, ll8);
+ if(blkcom::nKill > 0)
+ goto a9200;
+ for(i = 1; i <= 10; i++)
+ blkcom::sABuff >> labcom::sVoltBC[ i - 1 ];
+ goto a7130;
+
+ a7120:
+ blkcom::nNFrFld = 10;
+ freeOne(sVoltBC);
+
+ a7130:
+ if(blkcom::nNOutPR == 0)
+ (*reinterpret_cast<std::ostream *>(blkcom::pKFile6)) "+Relative list sizes." << labcom::sVoltBC[ 0 ] << labcom::sVoltBC[ 1 ] << labcom::sVoltBC[ 2 ] << std::endl;
+ d1 = 0.0e0;
+ for(i = 1; i <= 8; i++)
+ d1 += labcom::sVoltBC[ i - 1 ];
+ d1 = blckom::nLTACST * blkcom::pNByte[ 2 ] / d1;
+ pLSTACS[ 0 ] = (long int) (labcom::sVoltBC[ 0 ] * d1 / (4 * blkcom::pNByte[ 2 ] + 8 * blkcom::pNByte[ 3 ]));
+ pLSTACS[ 1 ] = (long int) (labcom::sVoltBC[ 1 ] * d1 / (2 * blkcom::pNByte[ 2 ] + blkcom::pNByte[ 3 ]));
+ pLSTACS[ 2 ] = (long int) (labcom::sVoltBC[ 2 ] * d1 / (2 * blkcom::pNByte[ 3 ]));
+ pLSTACS[ 3 ] = (long int) (labcom::sVoltBC[ 3 ] * d1 / (5 * blkcom::pNByte[ 2 ] + blkcom::pNByte[ 3 ]));
+ pLSTACS[ 4 ] = (long int) (labcom::sVoltBC[ 4 ] * d1 / (3 * blkcom::pNByte[ 3 ]));
+ pLSTACS[ 5 ] = (long int) (labcom::sVoltBC[ 5 ] * d1 / blkcom::pNByte[ 3 ]);
+ PLSTACS[ 6 ] = (long int) (labcom::sVoltBC[ 6 ] * d1 / blkcom::pNByte[ 2 ]);
+ pLSTACS[ 7 ] = (long int) (labcom::sVoltBC[ 7 ] * d1 / (6 * blkcom::pNByte[ 2 ] + 2 * blkcom::pNByte[ 3 ]));
+ };
+ auto read_input_card = [ & ](void)
+ {
+ cimage();
+ for(i = 1; i <= 14; i++)
+ blkcom::sABuff >> blkcom::sAUpper[ i - 1 ];
+ if(strcom::toLower(blkcom::sAUpper[ 0 ]) == sText1)
+ goto a2697;
+ if(strcom::toLower(blkcom::sAUpper[ 0 ]) == sText3)
+ goto a2697;
+ if(strcom::toLower(blkcom::sAUpper[ 0 ]) == sText4)
+ goto a2699;
+ if(strcom::toLower(blkcom::sAUpper[ 0 ]) == sText6)
+ goto a7722;
+ (*reinterpret_cast<std::ostream *>(blkcom::pKFile6)) << " Begin TACS. " << std::string(27, ' ') << std::endl;
+ blkcom::nNewTAC = 1;
+ blkcom::nNTCSEX = 1;
+ blkcom::nNIUNRS = 1;
+ std::cout << " Prepare to call ntacs1 from over1." << std::endl;
+ ntacs1();
+ std::cout << " Back from ntacs1, back in over1." << std::endl;
+ goto a4284;
+
+ a2697:
+ blkcom::nNTCSEX = 1;
+
+ a2699:
+ n1 = 1;
+ if(blkcom::nNOutPR != 0)
+ goto a2691;
+ if(blckom::nNTCSEX == 0)
+ goto a22699;
+ if(blckom::nNOutPR == 0)
+ (*reinterpret_cast<std::ostream *>(blkcom::pKFile6)) << "+TACS hyvrid setup. TACS data cards follow." << std::endl;
+ // 1984 format(18x, i2)
+
+ char *pTemp[ 20 ];
+ blkcom::sABuff.read(pTemp, 18);
+ blkcom::sABuff >> blkcom::sLStat[ 51 ];
+ goto a2691;
+
+ a4281:
+ if(n1 == 0)
+ goto a4284;
+ move(blkcom::pLSTACS, &blkcom::pLStat[ 60 ], ll8);
+ blkcom::nKTab = 1;
+ tacs1();
+ if(blkcom::nKill > 0)
+ goto a9200;
+ if((blkcom::nNTCSEX + blkcom::nNSTACS) > 0)
+ goto a4276;
+ blkcom::nIndStp = 1;
+ blkcom::LimStp = blkcom::pKprChg[ 0 ];
+ runtym(d1, d2);
+ blkcom::pFLStat[ 0 ] += d1;
+ blkcom::pFLStat[ 1 ] += d2;
+ blkcom::pFLStat[ 6 ] -= d1;
+ blkcom::pFLStat[ 7 ] -= d2;
+ blkcom::nChain = 12;
+ };
+ //
+ // over1 main function body.
+ //
+ ll8 = LL8;
+ ll80 = LL80;
+ //
+ if(blkcom::nIprsUp >= 1)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "Begin module over1." << std::endl;
+ nPU = std::numeric_limits<double>::infinity();
+ movecopy::move0<long int>(blkcom::pKTRLSW, LL6);
+ movecopy::move0<long int>(blkcom::pIpnTV, LL11);
+ movecopy::move0<long int>(blkcom::pLoopSS, LL11);
+ blkcom::sMonCar.m_nUserSST = 0;
+ nNMAuto = 0;
+ umcom::pBUSUM[ 0 ] = sText2;
+ blkcom::nNRight = 0;
+ blkcom::nIofgnd = 0;
+ blkcom::nMolDat = 0;
+ blkcom::nIStep = 0;
+ blkcom::sMonCar.m_nKLoaEP = 0;
+ blkcom::nTEnerg = 1e+20;
+ blkcom::sBranch = sText2;
+ blkcom::sCopy = sText6;
+ blkcom::nIAlter = 0;
+ blkcom::nIsPrin = 0;
+ blkcom::nIsPlot = 0;
+ blkcom::nIndStp = 1;
+ blkcom::nNOutPR = 0;
+ blkcom::pLFiles[ 0 ] = reinterpret_cast<void *>(&std::cerr);
+ blkcom::pLFiles[ 4 ] = reinterpret_cast<void *>(&std::cin);
+ blkcom::pLFiles[ 5 ] = reinterpret_cast<void *>(&std::cout);
+ blkcom::pKFile6 = blkcom::pLFiles[ 5 ];
+ blkcom::pPeakND[ 0 ] = 0.0;
+ blkcom::nKBurro = 0;
+ // Assign default relative precision for 6 EMTP variable types.
+ // 1 --- alphanumeric 2 --- complex
+ // 3 --- floating-point numeric 4 --- integer numeric
+ // 5 --- 3 of 'subr31' 6 --- 4 of 'subr31'
+ // setting all equal to unity means that all have equal length.
+ for(j = 1; j <= 6; j++)
+ blkcom::pNByte[ j - 1 ] = 1;
+ emtp::dimens(blkcom::sLStat, \
+ blkcom::nChain, \
+ blkcom::sBus1, \
+ blkcom::sBus2);
+ /*
+ blkcom::nLBus = blkcom::sLStat[ 0 ];
+ blkcom::nLBrnch = blkcom::sLStat[ 1 ];
+ blkcom::nLData = blkcom::sLStat[ 2 ];
+ blkcom::nLExct = blkcom::sLStat[ 3 ];
+ blkcom::nLYMat = blkcom::sLStat[ 4 ];
+ blkcom::nLSwtch = blkcom::sLStat[ 5 ];
+ blkcom::nLSize7 = blkcom::sLStat[ 6 ];
+ blkcom::nLPast = blkcom::sLStat[ 7 ];
+ blkcom::nLNonL = blkcom::sLStat[ 8 ];
+ blkcom::nLChar = blkcom::sLStat[ 9 ];
+ blkcom::nLSMOut = blkcom::sLStat[ 10 ];
+ blkcom::nLSize12 = blkcom::sLStat[ 11 ];
+ blkcom::nLFDep = blkcom::sLStat[ 12 ];
+ blkcom::nLWT = blkcom::sLStat[ 13 ];
+ blkcom::nLTails = blkcom::sLStat[ 14 ];
+ blkcom::nLIMass = blkcom::sLStat[ 15 ];
+ blkcom::nLSyn = blkcom::sLStat[ 16 ];
+ blkcom::nMaxPE = blkcom::sLStat[ 17 ];
+ blkcom::nLTCST = blkcom::sLStat[ 18 ];
+ blkcom::nLFSem = blkcom::sLStat[ 19 ];
+ blkcom::nLFD = blkcom::sLStat[ 20 ];
+ blkcom::nLHist = blkcom::sLStat[ 21 ];
+ blkcom::nLSize23 = blkcom::sLStat[ 22 ];
+ blkcom::nLComp = blkcom::sLStat[ 23 ];
+ blkcom::nLSPCum = blkcom::sLStat[ 24 ];
+ blkcom::nLSize26 = blkcom::sLStat[ 25 ];
+ blkcom::nLSize27 = blkcom::sLStat[ 26 ];
+ blkcom::nLSize28 = blkcom::sLStat[ 27 ];
+ */
+ // memcpy((void *) &blkcom::sSStat, \
+ // (void *) blkcom::sLStat.data(), \
+ //sizeof(blkcom::tStat));
+ blkcom::pSStat = blkcom::sLStat.data()
+ // Assign 'n1' equal to the number of EMTP lists of variable
+ // dimensioning (of the solution overlays).
+ //n1 = 27;
+ //blkcom::nLTLabl = blkcom::sLStat[ n1 + 1 ];
+ comlock::pLocker[ 0 ] = blkcom::sBus1;
+ comlock::pLocker[ 1 ] = blkcom::sBus2;
+ d13 = blkcom::pSStat -> m_nTACST;
+ d13 /= 1600.;
+ for(j = 1; j <= 8; j++)
+ pLSTACS[ j - 1 ] *= d13;
+ n1 = -9999;
+ movecopy::copy<long int>(n1, blkcom::sLStat, LL60);
+ sysdep();
+ movecopy::move0<double>(blkcom::sFLStat, LL20);
+ date_time::runtym(d1, d2);
+ blkcom::sFLStat[ 0 ] -= d1;
+ blkcom::sFLStat[ 1 ] -= d2;
+ blkcom::nTenM6 = pow(blkcom::nTenM3, 2.0);
+ blkcom::nMaxZNO = 50;
+ blkcom::nEpsZNo = blkcom::nEpsilon;
+ blkcom::nEpWarn = blkcom::nTenM3;
+ blkcom::nEpStop = 0.1;
+ blkcom::pZNoLim[ 0 ] = 1.0;
+ blkcom::pZNoLim[ 1 ] = 1.5;
+ blkcom::sMonCar.m_nKBase = 0;
+ blkcom::sMonCar.m_nISW = 0;
+ blkcom::pKPrChg[ 0 ] = -7777;
+ blkcom::nJFLSOS = 0;
+ // rewind lunit1
+ // rewind lunit3
+ // rewind lunit4
+ blkcom::sMonCar.m_nKnt = 1;
+ blkcom::sMonCar.m_pMTape = blkcom::pLFiles[ 4 ];
+ blkcom::nIFDep = 0;
+ blkcom::nNTCSex = 0;
+ blkcom::nNSTACS = 0;
+ blkcom::nKanal = 0;
+
+ // Initialize KPARTB with nonzero value so later minus
+ // sign can be applied as flag of "renumber bypass" usage:
+ blkcom::nKPartB = 1000;
+
+ // SYSDEP will redefine if low-prec. Complex ("cable constants"):
+ nZNVRef = 0.0;
+ blkcom::nFMaxFS = 0.0;
+ blkcom::pBegMax[ 0 ] = 0.0;
+ blkcom::pBegMax[ 1 ] = 0.0;
+ blkcom::pBegMax[ 2 ] = std::numeric_limits<double>::infinity();
+ blkcom::nKTRef = 0;
+ blkcom::nNComp = 0;
+ blkcom::nNumSM = 0;
+ blkcom::nNumUM = 0;
+ blkcom::nNumOut = 0;
+ blkcom::nKill = 0;
+ blkcom::nNum99 = 0;
+ blkcom::nModOut = 0;
+ blkcom::pInEcho = nullptr;
+ sBus = blkcom::sBlank;
+ blkcom::nIAverg = 0;
+ movecopy::move0<int>(labcom::sISourc, blkcom::sSStat.m_nSwitch);
+ movecopy::move0<int>(labcom::sKodeBR, blkcom::sSStat.m_nBranch);
+ movecopy::move0<int>(labcom::sKodSem, blkcom::sSStat.m_nBranch);
+ movecopy::move0<int>(labcom::sLength, blkcom::sSStat.m_nBranch);
+ movecopy::move0<int>(labcom::sIndHst, blkcom::sSStat.m_nBranch);
+ movecopy::move0<double>(labcom::sBValue, blkcom::sSStat.m_nSize12);
+ nIsWent = 1;
+ blkcom::nOmega = 0.0;
+ blkcom::nDegMin = 0.0;
+ blkcom::nDegMax = 0.0;
+ blkcom::nSglFir = 2.0 * M_PI;
+ blkcom::nJST = 0;
+ blkcom::nJST1 = 1;
+ blkcom::nIFDep2 = 1;
+ blkcom::nIAdd = 0;
+ blkcom::nIFSem = 0;
+ //
+ com2::nIDM = 1;
+ com2::nIDQ = 1;
+ com2::nIDU = 1;
+ com2::nIDT = 1;
+ nIAdQQ = 1;
+ com2::nIQ = 0;
+ com2::nIDA = 0;
+ com2::nIDY = 0;
+ com2::nIFKC = 0;
+ nNK = 0;
+ nNGroup = 0;
+ nNTurn = 0;
+ nNFDBR = 0;
+ nNFDPH = 9;
+ nNFDHST = 5400;
+ // nNFDPOL = 25;
+ nNFDPol = 30;
+ nNTLin = 0;
+ // pLU2 = ...
+ pLU6 = blkcom::pLFiles[ 5 ];
+
+ a5223:
+ blkcom::nIFX = 0;
+ nIP = 2;
+ nIY = 2;
+ blkcom::nICat = 0;
+ if(blkcom::nNOutPR != 0)
+ goto a15;
+ if(blkcom::nKol132 == 132)
+ goto a6452;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " ********* Begin \"M40.\" EMTP solution.";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Size /label/ =";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(7) << std::setfill(' ') << std::dec;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << blkcom::sSStat.m_nTLabl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " integer words." << std::endl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " list limits 1-10 :";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nBus;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nBranch;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nData;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nExct;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nYMat;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nSwitch;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nSize7;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nPast;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nNOnL;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nChar << std::endl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " list limits 11-20 :";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nSMOut;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nSize12;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nFDep;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nWT;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nTails;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nIMass;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nSyn;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nMaxPE;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nTACST;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nFSem << std::endl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " list limits 21-end:";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nFD;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nHist;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nSize23;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nComp;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nSPCum;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nSize26;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nSize27;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nSize28 << std::endl;
+ goto a15;
+
+ a6452:
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Associated user documentation is the 864-page EMTP rule book dated June, 1984. Version M43. Vardim time/date =";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << comlock::pLocker[ 0 ] << comlock::pLocker[ 1 ] << std::endl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Independent list limits follow. Total length of /label/ equals ";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(8) << std::dec << blkcom::sSStat.m_nTLabl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " integer words. ";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nBus;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nBranch;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nData;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nExct;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nYMat;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nSwitch << std::endl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " " << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nSize7;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nPast;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nNOnL;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nChar;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nSMOut;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nSize12;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nFDep;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nWT;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nTails;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nIMass;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nSyn;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nMaxPE;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nTACST;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nFSem;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nFD;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nHist;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nSize23;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nComp;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nSPCum;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nSize26;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nSize27;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nSize28 << std::endl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " " << std::string(51, '-') << "+" << std::string(80, '-') << std::endl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Descriptive interpretation of new-case input data |" << std::flush;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " input data card images printed below, all 80 columns, character by character." << std::endl << std::flush;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " " << std::string(51, ' ') << "|" << std::flush;
+ for(i = 1; i <= 8; i++) {
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::string(9, ' ') << std::flush;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(1) << std::dec << i << std::flush;
+ }
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::endl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " " << std::string(51, ' ') << "|" << std::flush;
+ for(i = 1; i <= 8; i++)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::string(9, ' ') << "0" << std::flush;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::endl << std::flush;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " " << std::string(51, '-') << "+" << std::string(80, '-') << std::endl;
+
+ a15:
+ FOREVER {
+ emtp::cimage();
+ if(blkcom::nKill > 0)
+ goto a9200;
+ blkcom::nNRight = -2;
+ n9 = blkcom::nKolBeg;
+ blkcom::nKolBeg = 1;
+ blkcom::sTexCol = blkcom::sABuff.str().substr(0, 80);
+ freedom::freeOne(d1);
+
+ a3247:
+ blkcom::nNRight = 0;
+ if(n9 == -std::numeric_limits<long int>::infinity())
+ blkcom::nKolBeg = n9;
+ if(blkcom::nNFrFld > 0)
+ goto a3280;
+ if(blkcom::nNOutPR == 0)
+ (*reinterpret_cast<std::ostream *>(blkcom::pKFile6)) << "+Blank termination-of-run card." << std::endl;
+ interp();
+ blkcom::nIVolt = 7777;
+
+ a3273:
+ blkcom::nKill = 9999;
+ blkcom::nChain = 31;
+ goto a9800;
+
+ a3280:
+ reques();
+ i = sStat.m_nMaxPE;
+ switch(i) {
+ case 0:
+
+ a2843:
+ if((blkcom::nNOutPR != 0) && (blkcom::nIprsUp > 0))
+ blkcom::nNOutPR = 0;
+ blkcom::nXOpt = blkcom::nStatFR;
+ blkcom::nCOpt = blkcom::nStatFR;
+ blkcom::nKolBeg = n9;
+ if(blkcom::nKolBeg > 0)
+ goto a4201;
+ utilities::expchk(ll1, ll80, ll8);
+ if(blkcom::nKill > 0)
+ goto a9200;
+ blkcom::sABuff >> blkcom::nDeltaT >> blkcom::nTMax >> d1 >> d2 >> d3 >> blkcom::nTolMat >> blkcom::nT;
+ if(blkcom::nT == 0.0)
+ blkcom::nT = 0.0e0;
+ goto a4202;
+
+ a4201:
+ blkcom::nNFrFld = 1;
+ blkcom::nNRight = 0;
+ freedom::freeOne(blkcom::nDeltaT);
+ freedom::freeOne(blkcom::nTMax);
+ freedom::freeOne(d1);
+ freedom::freeOne(d2);
+ freedom::freeOne(d3);
+ freedom::freeOne(blkcom::nTolMat);
+ freedom::freeOne(blkcom::nT);
+
+ a4202:
+ if(blkcom::nNOutPR == 0)
+ (*reinterpret_cast<std::ostream *>(blkcom::pKFile6)) << "+Misc. data." << std::setfill(' ') << std::setw(12) << blkcom::nDeltaT << blkcom::nTMax << d1 << std::endl;
+ if(blkcom::nIofbnd != 33666)
+ goto a4206;
+ blkcom::nChain = 41;
+ blkcom::nXOpt = d1;
+ goto a9800;
+ break;
+
+ case 11:
+ goto a3273;
+ break;
+
+ case 15:
+ start_again();
+ goto a9200;
+ break;
+
+ case 28:
+ goto a3247;
+ break;
+
+ case 32:
+ absolute_TACS_dimensions();
+ goto a15;
+ break;
+
+ case 33:
+ relative_TACS_dimensions();
+ goto a15;
+ break;
+
+ case 34:
+ goto a523;
+ break;
+
+ case 38:
+ goto a15;
+ break;
+
+ case 40:
+ goto a4308;
+ break;
+ }
+ if(blkcom::nKill > 0)
+ goto a9200;
+ if(blkcom::nChain != 1)
+ goto a9800;
+ }
+
+ a4276:
+ blkcom::nChain = 12;
+ goto a9800;
+
+ a4284:
+ blkcom::nChain = 2;
+ goto a9800;
+
+ a9200:
+ blkcom::nChain = 51;
+ blkcom::sLStat[ 17 ] = 1;
+
+ a9800:
+ blkcom::nLastOV = 1;
+ n5 = (size_t) &nIDA;
+ n6 = (size_t) &nIFKC;
+ if(blkcom::nIprsUp >= 1)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "Exit module over1." << std::endl;
+
+ a99999:
+ return;
+ }
+
+ // subroutine tacs1c.
+ void tacs1c(void)
+ {
+ // To do.
+ }
+
+ // subroutine swmodf.
+ void swmodf(void)
+ {
+ // To do.
+ }
+
+ // subroutine reques.
+ void reques(void)
+ {
+ // To do.
+ }
+
+ // subroutine sysdep.
+ void sysdep(void)
+ {
+ std::string sCol("");
+ std::string sColXXX("plt00000000000.pl4");
+ std::string sLettra("a");
+ std::string sLettrb("b");
+ std::string sLettrc("c");
+ std::string sBusNM1(" ");
+ std::string sBusNM2("........");
+ std::string sBusNM3("terra");
+ std::string sText1 = ",";
+ std::string sText2 = "$";
+ //
+ sCol = sColXXX;
+ // To do.
+ blkcom::sBlank = sBusNM1;
+ blkcom::sTrash = sBusNM2;
+ blkcom::sTerra = sBusNM3;
+ blkcom::cCSepar = sText1[ 0 ];
+ blkcom::sChCont = sText2;
+ blkcom::nTenM3 = 1.0e-3;
+ blkcom::nUnity = 1.0e0;
+ blkcom::nOneHaf = 0.5e0;
+ blkcom::pNByte[ 0 ] = 2;
+ blkcom::pNByte[ 1 ] = 2;
+ blkcom::pKTRLSW[ 5 ] = 0;
+ blkcom::pNByte[ 2 ] = 2;
+ blkcom::nEpsilon = 1.0e-8;
+ //blkcom::nTwoPI = 2.0 * M_PI;
+ // To do.
+ }
+
+ // subroutine midov1.
+ void midov1(void)
+ {
+ // To do.
+ }
+
+ // subroutine nmincr.
+ void nmincr(std::string &, int &)
+ {
+ // To do.
+ }
+
+ // subroutine tacs1.
+ void tacs1(void)
+ {
+ // To do.
+ }
+
+ // subroutine tacs1a.
+ void tacs1a(void)
+ {
+ // To do.
+ }
+
+ // subroutine tacs1b.
+ void tacs1b(void)
+ {
+ // To do.
+ }
+
+ // subroutine expchk.
+ void expchk(int &, int &, int &)
+ {
+ // To do.
+ }
+
+ // subroutine intchk.
+ void intchk(int &, int &, int &)
+ {
+ // To do.
+ }
+
+ // subroutine pfatch.
+ void pfatch(void)
+ {
+ // To do.
+ }
+
+}
+
+// end of file over1.cpp
diff --git a/sources/over20.cpp b/sources/over20.cpp
new file mode 100644
index 0000000..65330a5
--- /dev/null
+++ b/sources/over20.cpp
@@ -0,0 +1,1909 @@
+//-*- mode: c++; indent-tabs-mode: t; coding: utf-8; show-trailing-whitespace: t -*-
+
+// file over20.cpp
+
+#include "over20.hpp"
+
+namespace over20 {
+
+ // subroutine over20.
+ void over20(void)
+ {
+ int i;
+ int k, kn1;
+ int l, ll1 = 1, ll9 = 9, ll10 = 10;
+ int m;
+ int nIOld, npl, nStat;
+ //
+ size_t n1, n2, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14, ndx1, ndx2, ndx3;
+ //
+ double a;
+ double d1;
+ double d2;
+ double zero = 0.0;
+ //
+ std::fstream sFile79;
+ //
+ long int *pKnt = &blkcom::sMonCar.m_nKnt;
+ long int *pKBase = &blkcom::sMonCar.m_nKBase;
+ long int *pLTDelt = &blkcom::sMonCar.m_nLTDelt;
+ long int *pISW = &blkcom::sMonCar.m_nISW;
+ long int *pLSwtch = &blkcom::sMonCar.m_nLSwtch;
+ std::ostream *pMTape = reinterpret_cast<std::ostream *>(blkcom::sMonCar.m_pMTape);
+ //
+ if (blkcom::nIprsUp >= 1)
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " Begin module \"over20\"." << std::endl << std::flush;
+ date_time::runtym (d1, d2);
+ n10 = 1;
+ if (blkcom::nIprsUp >= 1)
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " iplot nenerg kbase m4plot mtape icat lstat32" << std::string (14, ' ') << "t" << std::string (10, ' ') << "aincr\n" << " " << blkcom::nIPlot << " " << blkcom::nEnerg << " " << *pKBase << " " << blkcom::nM4Plot << " " << "0x" << std::hex << pMTape << " " << blkcom::nICat << " " << blkcom::sLStat[ 31 ] << " " << blkcom::nT << " " << blkcom::nAIncr << std::endl << std::flush;
+ if (blkcom::nMax99m < 0)
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " ++++ Number of suppressed type-99 flashover or clearing messages is negative of " << blkcom::nMax99m << std::endl << std::flush;
+ if (blkcom::pPeakND[ 0 ] == 0.0)
+ goto a5019;
+ n6 = (int) blkcom::pPeakND[ 2 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (8, ' ') << "Overall simulation peak node voltage = " << std::fixed << std::setw (15) << std::setprecision (6) << blkcom::pPeakND[ 0 ] << " . Time (sec) = " << std::fixed << std::setw (14) << std::setprecision (5) << blkcom::pPeakND[ 1 ] << " . bus = \"" << labcom::sBus[ n6 - 1 ] << "\" ." << std::endl << std::flush;
+
+ a5019:
+ k = blkcom::sLStat[ 31 ] + 1;
+ if (blkcom::nIPlot < 0)
+ goto a8005;
+ labcom::sVoltI[ 0 ] = -9999.0;
+ if (blkcom::nM4Plot == 0)
+ goto a5022;
+ plot::pltfil(k);
+ goto a8005;
+
+ a5022:
+ for (std::vector<double>::iterator nI = labcom::sVoltI.begin (); nI != labcom::sVoltI.begin () + k; nI++)
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 3 ])) << *nI << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 3 ])) << std::endl << std::flush;
+
+ a8005:
+ if ((blkcom::nICat > 0) || (blkcom::nMemSav > 0))
+ katalg ();
+ sFile79.close ();
+ k = blkcom::sLStat[ 31 ];
+ if ((*pKBase == 2) && (blkcom::nAIncr < 55.0))
+ goto a3614;
+ if (blkcom::pBegMax[ 0 ] <= 0.0)
+ goto a3614;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "\n Maxima and minima which occurred during the simulation follow. The order and column positioning are the" << std::endl << std::flush;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " same as for the regular printed output vs. time." << std::endl << std::flush;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " Variable maxima :" << std::endl << std::flush;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (15, ' ');
+ for (std::vector<double>::iterator nI = labcom::sXMax.begin (); nI != labcom::sXMax.begin () + k; nI++)
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (13) << std::setprecision (6) << *nI << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::endl << std::flush;
+ ndx1 = blkcom::sSStat.m_nSize12 + 1;
+ ndx2 = blkcom::sSStat.m_nSize12 + k;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " Times of maxima :" << std::endl << std::flush;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (15, ' ');
+ for (std::vector<double>::iterator nI = labcom::sXMax.begin () + ndx1; nI != labcom::sXMax.begin () + ndx2; nI++)
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (13) << std::setprecision (6) << *nI << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::endl << std::flush;
+ ndx1 += blkcom::sSStat.m_nSize12;
+ ndx2 += blkcom::sSStat.m_nSize12;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " Variable minima :" << std::endl << std::flush;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (15, ' ');
+ for (std::vector<double>::iterator nI = labcom::sXMax.begin () + ndx1; nI != labcom::sXMax.begin () + ndx2; nI++)
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (13) << std::setprecision (6) << *nI << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::endl << std::flush;
+ ndx1 += blkcom::sSStat.m_nSize12;
+ ndx2 += blkcom::sSStat.m_nSize12;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " Times of minima :" << std::endl << std::flush;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (15, ' ');
+ for (std::vector<double>::iterator nI = labcom::sXMax.begin () + ndx1; nI != labcom::sXMax.begin () + ndx2; nI++)
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (13) << std::setprecision (6) << *nI << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::endl << std::flush;
+
+ a3614:
+ if (blkcom::nEnerg != 0)
+ goto a605;
+ blkcom::sFLStat[ 8 ] = d1;
+ blkcom::sFLStat[ 9 ] = d2;
+ if ((blkcom::pBegMax[ 0 ] != 0.0) && (blkcom::pBegMax[ 1 ] != 0.0))
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (56, ' ') << "Search for extrema began at time " << std::fixed << std::setw (15) << std::setprecision (6) << blkcom::pBegMax[ 1 ] << " sec." << std::endl << std::flush;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " " << std::endl << std::flush;
+ if (blkcom::nIPunch <= 0)
+ goto a9800;
+ blkcom::nKCount = 2;
+ nIOld = 3;
+ if (n10 != 0) {
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "\n Printout of the saving of terminal conditions for all components, at time";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (15) << std::setprecision (7) << blkcom::nT;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " seconds.\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " Begin with all node voltages.\n";
+ for (i = 0; i < 3; i++)
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (21, ' ') << "node\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (19, ' ') << "number" << std::string (21, ' ') << "name" << std::string (18, ' ') << "voltage" << std::endl << std::flush;
+ }
+ for (k = 2; k <= blkcom::nTot; k++) {
+ if (n10 != 0) {
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " " << std::setw (6) << labcom::sBus[ k - 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (13) << std::setprecision (5) << labcom::sE[ k - 1 ] << " " << zero;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (41, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " " << k << std::endl << std::flush;
+ }
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::setw (2) << blkcom::nKCount;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::setw (6) << labcom::sBus[ k - 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::fixed << std::setw (15) << std::setprecision (8) << labcom::sE[ k - 1 ] << zero << zero;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::string (21, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::setw (6) << k << std::endl << std::flush;
+ }
+ if (n10 != 0) {
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "\n Linear branch table state variables ( 'currents' ) follow.\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (7, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "row";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (9, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "'from' node";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (11, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "'to' node";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (9, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "linear branch parameters, identified by the Fortran vector storage\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (9, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "i";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (8, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "bus(kbus(i))";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (8, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "bus(mbus(i))";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (19, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "cik(i)";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (20, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "ci(i)";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (20, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "ck(i)" << std::endl << std::flush;
+ }
+ k = 1;
+
+ a7014:
+ blkcom::nIt2 = 1;
+ if (labcom::sKBus[ k - 1 ] < 0)
+ goto a7024;
+ if (labcom::sNR[ 4 ] >= 0)
+ goto a7022;
+ blkcom::nCI1 = labcom::sCI[ k - 1 ];
+ blkcom::nCK1 = labcom::sCK[ k - 1 ];
+ if ((blkcom::nCI1 == 0.0) && (blkcom::nCK1 == 0.0))
+ goto a7025;
+ l = labcom::sKBus[ k - 1 ];
+ m = abs (labcom::sMBus[ k - 1 ]);
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::setw (2) << nIOld;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::setw (6) << labcom::sBus[ l - 1 ] << labcom::sBus[ m - 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::fixed << std::setw (15) << std::setprecision (8) << blkcom::nCI1 << blkcom::nCK1 << zero << zero;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::setw (6) << k << std::endl << std::flush;
+ if (n10 != 0) {
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::setw (6) << labcom::sBus[ l - 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::setw (6) << labcom::sBus[ m - 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (13) << std::setprecision (5) << blkcom::nCI1 << blkcom::nCK1 << zero << zero;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::setw (6) << k << std::endl << std::flush;
+ }
+ goto a7025;
+
+ a7022:
+ blkcom::nIt2 = abs (labcom::sLength[ k - 1 ]);
+ blkcom::nIt1 = k + blkcom::nIt2 - 1;
+ for (i = k; i <= blkcom::nIt1; i++) {
+ n1 = labcom::sKBus[ i - 1 ];
+ n2 = abs (labcom::sMBus[ i - 1 ]);
+ if (n10 != 0) {
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::setw (6) << labcom::sBus[ n1 - 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::setw (6) << labcom::sBus[ n2 - 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (13) << std::setprecision (5) << labcom::sCIK[ i - 1 ] << labcom::sCI[ i - 1 ] << labcom::sCK[ i - 1 ] << zero;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::setw (6) << i << std::endl << std::flush;
+ }
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::setw (2) << nIOld;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::setw (12) << labcom::sBus[ n1 - 1 ] << labcom::sBus[ n2 - 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::fixed << std::setw (15) << std::setprecision (8) << labcom::sCIK[ i - 1 ] << labcom::sCI[ i - 1 ] << labcom::sCK[ i - 1 ] << zero;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::setw (6) << i << std::endl << std::flush;
+ }
+ goto a7025;
+
+ a7024:
+ n1 = abs (labcom::sKBus[ k - 1 ]);
+ n2 = abs (labcom::sMBus[ k - 1 ]);
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " **** Warning. **** No currents will be punched for the distributed line connecting nodes ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "\"" << std::setw (6) << labcom::sBus[ n1 - 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "\" and \"";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::setw (6) << labcom::sBus[ n2 - 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " . " << std::endl << std::flush;
+ blkcom::nIt2 = labcom::sLength[ k - 1 ];
+ if (blkcom::nIt2 < 0)
+ blkcom::nIt2 = -blkcom::nIt2;
+ if (labcom::sLength[ k - 1 ] > 0)
+ blkcom::nIt2 = 1;
+ if ((labcom::sKodSem[ k - 1 ] != 0) && (labcom::sIModel[ k - 1 ] != 2))
+ blkcom::nIt2 = abs (labcom::sKodeBR[ k - 1 ]);
+
+ a7025:
+ k += blkcom::nIt2;
+ if (k <= blkcom::nIBr)
+ goto a7014;
+ if (blkcom::nINOnL == 0)
+ goto a9207;
+ if (n10 != 0)
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "\n Nonlinear element table state variables follow." << std::endl << std::flush;
+ nIOld = 4;
+ for (k = 1; k <= blkcom::nINOnL; k++) {
+ if (labcom::sNOnLE[ k - 1 ] >= 0)
+ ;
+ else {
+ n1 = labcom::sNOnLK[ k - 1 ];
+ n2 = abs (labcom::sNOnLM[ k - 1 ]);
+ if (labcom::sNLType[ k - 1 ] != -96)
+ goto a7031;
+ n5 = labcom::sNOnLAD[ k - 1 ];
+ n6 = n5 + 1;
+ n7 = n5 + 2;
+ n8 = n5 + 3;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::setw (2) << nIOld;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::setw (6) << labcom::sBus[ n1 - 1 ] << labcom::sBus[ n2 - 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::fixed << std::setw (15) << std::setprecision (8) << labcom::sVChar[ n7 - 1 ] << labcom::sCChar[ n8 - 1 ] << std::endl << std::flush;
+ n9 = (int) labcom::sCChar[ n6 - 1 ];
+ n11 = (int) labcom::sCChar[ n7 - 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::setw (10) << n9 << n11;
+ for (std::vector<double>::iterator nI = labcom::sVChar.begin () + n5; nI != labcom::sVChar.begin () + n8; nI++)
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::fixed << std::setw (15) << std::setprecision (8) << *nI;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::endl << std::flush;
+ n12 = n5 + 4;
+ n13 = n5 + 5;
+ n14 = (int) labcom::sCChar[ n12 - 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::setw (10) << n9 << n11;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::fixed << std::setw (15) << std::setprecision (8) << labcom::sVChar[ n12 - 1 ] << labcom::sVChar[ n13 - 1 ] << labcom::sGSlope[ n12 - 1 ] << labcom::sGSlope[ n13 - 1 ] << std::endl << std::flush;
+ if (n10 == 0) {
+ ;
+ } else {
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::setw (6) << labcom::sBus[ n1 - 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::setw (6) << labcom::sBus[ n2 - 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (13) << std::setprecision (5) << labcom::sVChar[ n7 - 1 ] << labcom::sCChar[ n8 - 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::endl << std::flush;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::setw (10) << n9;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::setw (10) << n11;
+ for (std::vector<double>::iterator nI = labcom::sVChar.begin () + n5; nI != labcom::sVChar.begin () + n8; nI++) {
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (15) << std::setprecision (8) << *nI;
+ }
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::endl << std::flush;
+
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::setw (10) << n14;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " " << std::fixed << std::setw (15) << std::setprecision (8) << labcom::sVChar[ n13 - 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " " << std::fixed << std::setw (15) << std::setprecision (8) << labcom::sVChar[ n13 - 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " " << std::fixed << std::setw (15) << std::setprecision (8) << labcom::sGSlope[ n12 - 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " " << std::fixed << std::setw (15) << std::setprecision (8) << labcom::sGSlope[ n13 - 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::endl << std::flush;
+ // cycle
+ goto a7032;
+
+ a7031:
+ a = labcom::sCurr[ k - 1 ];
+ if (a == 0.0) {
+ ;
+ } else {
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::setw (2) << nIOld;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::setw (6) << labcom::sBus[ n1 - 1 ] << labcom::sBus[ n2 - 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::fixed << std::setw (15) << std::setprecision (8) << a;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::endl << std::flush;
+ if (n10 != 0) {
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::setw (6) << labcom::sBus[ n1 - 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::setw (6) << labcom::sBus[ n2 - 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (13) << std::setprecision (5) << a;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::endl << std::flush;
+ }
+ }
+ }
+
+ a7032:
+ ;
+ }
+ }
+
+ a9207:
+ if (blkcom::nKSwtch == 0)
+ goto a4020;
+ if (n10 != 0) {
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " Status variables for switches follow.\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "bus(l)";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "bus(m)";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "kpos(k)";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " kode(l)";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " kode(m)";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (14, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "tclose";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (14, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "adelay";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (14, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "energy";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (16, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "crit" << std::endl << std::flush;
+ }
+ for (k = 1; k <= blkcom::nKSwtch; k++) {
+ l = abs (labcom::sKMSwit[ k - 1 ]);
+ kn1 = *pLSwtch + k;
+ m = abs (labcom::sKMSwit[ kn1 - 1 ]);
+ npl = labcom::sNextSw[ k - 1 ];
+ if (npl != 0)
+ npl = 87;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << " 5";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::setw (6) << labcom::sBus[ l - 1 ] << labcom::sBus[ m - 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::setw (4) << labcom::sKPos[ k - 1 ] << labcom::sKode[ l - 1 ] << labcom::sKode[ m - 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::fixed << std::setw (13) << std::setprecision (6) << labcom::sTClose[ k - 1 ] << labcom::sADelay[ k - 1 ] << labcom::sEnergy[ k - 1 ] << labcom::sCrit[ k - 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << "\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::string (14, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::setw (4) << npl;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 6 ])) << std::endl << std::flush;
+ if (n10 == 0) {
+ ;
+ } else {
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::setw (6) << labcom::sBus[ l - 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::setw (6) << labcom::sBus[ m - 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::setw (10) << labcom::sKPos[ k - 1 ] << labcom::sKode[ l - 1 ] << labcom::sKode[ m - 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (20) << std::setprecision (10) << labcom::sTClose[ k - 1 ] << labcom::sADelay[ k - 1 ] << labcom::sEnergy[ k - 1 ] << labcom::sCrit[ k - 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (14, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::setw (10) << labcom::sNextSw[ k - 1];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::endl << std::flush;
+ }
+ }
+
+ a4020:
+ goto a9800;
+
+ a605:
+ nStat = k;
+ for (l = 1; l <= nStat; l++) {
+ ndx1 = 2 * blkcom::sSStat.m_nSize12 + l;
+ if (-labcom::sXMax[ ndx1 - 1 ] <= labcom::sXMax[ l - 1 ]) {
+ ;
+ } else {
+ labcom::sXMax[ l - 1 ] = labcom::sXMax[ ndx1 - 1 ];
+ ndx3 = blkcom::sSStat.m_nSize12 + l;
+ ndx2 = ndx1 + blkcom::sSStat.m_nSize12;
+ labcom::sXMax[ ndx3 - 1 ] = labcom::sXMax[ ndx2 - 1 ];
+ }
+ }
+ if (blkcom::nIprsUp > 0) {
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " isw, nstat, knt, nenerg = ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::setw (10) << *pISW << nStat << *pKnt << blkcom::nEnerg;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " (xmax(i), i=1, nstat) =\n";
+ for (std::vector<double>::iterator nI = labcom::sXMax.begin (); nI != labcom::sXMax.begin () + nStat; nI++)
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (5, ' ') << std::setw (15) << std::setprecision (8) << *nI;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::endl << std::flush;
+ }
+ ++*pKnt;
+ for (std::vector<double>::iterator nI = labcom::sXMax.begin (); nI != labcom::sXMax.end () + nStat; nI++)
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 8 ])) << *nI;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 8 ])) << std::endl << std::flush;
+ if (blkcom::pBegMax[ 0 ] == 0.0)
+ goto a627;
+ if (blkcom::nEnerg < 0)
+ goto a612;
+ if (comthl::nSwTpe <= 1)
+ goto a1610;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (6) << std::setprecision (2) << blkcom::nAngle;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (6) << std::setprecision (2) << comthl::nAngTpe;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " ";
+ for (std::vector<double>::iterator nI = labcom::sXMax.begin (); nI != labcom::sXMax.begin () + ll9; nI++)
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (13) << std::setprecision (6) << *nI;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::endl << std::flush;
+ goto a611;
+
+ a1610:
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (9) << std::setprecision (4) << blkcom::nAngle;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (5, ' ');
+ for (std::vector<double>::iterator nI = labcom::sXMax.begin (); nI != labcom::sXMax.begin () + ll9; nI++)
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << *nI;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::endl << std::flush;
+
+ a611:
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (15, ' ');
+ for (std::vector<double>::iterator nI = labcom::sXMax.begin () + ll10; nI != labcom::sXMax.begin () + nStat; nI++)
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (13) << std::setprecision (6) << *nI;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::endl << std::flush;
+ goto a624;
+
+ a612:
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (15, ' ');
+ for (std::vector<double>::iterator nI = labcom::sXMax.begin (); nI != labcom::sXMax.begin () + ll9; nI++)
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (13) << std::setprecision (6) << *nI;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::endl << std::flush;
+ goto a611;
+
+ a609:
+ if (blkcom::nEnerg < 0)
+ goto a614;
+ if (comthl::nSwTpe <= 1)
+ goto a1620;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (6) << std::setprecision (2) << blkcom::nAngle;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (6) << std::setprecision (2) << comthl::nAngTpe;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " ";
+ for (std::vector<double>::iterator nI = labcom::sXMax.begin (); nI != labcom::sXMax.begin () + nStat; nI++)
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (13) << std::setprecision (6) << *nI;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::endl << std::flush;
+ goto a624;
+
+ a1620:
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (9) << std::setprecision (4) << blkcom::nAngle;
+ for (std::vector<double>::iterator nI = labcom::sXMax.begin (); nI != labcom::sXMax.begin () + nStat; nI++)
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (13) << std::setprecision (6) << *nI;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::endl << std::flush;
+ goto a624;
+
+ a614:
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (15, ' ');
+ for (std::vector<double>::iterator nI = labcom::sXMax.begin (); nI != labcom::sXMax.begin () + nStat; nI++)
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (13) << std::setprecision (6) << *nI;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::endl << std::flush;
+
+ a624:
+ ndx1 = blkcom::sSStat.m_nSize12 + 1;
+ ndx2 = blkcom::sSStat.m_nSize12 + nStat;
+ if (blkcom::pBegMax[ 0 ] > 0.0) {
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " Times of maxima :\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (15, ' ');
+ for (std::vector<double>::iterator nI = labcom::sXMax.begin () + ndx1; nI != labcom::sXMax.begin () + ndx2; nI++)
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (13) << std::setprecision (6) << *nI;
+ }
+
+ a627:
+ if (*pKnt > abs (blkcom::nEnerg))
+ goto a610;
+ blkcom::nLastOV = blkcom::nChain;
+ blkcom::nChain = 12;
+ if (blkcom::nIprsUp >= 1)
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " Exit \"over20\"." << std::endl << std::flush;
+ goto a99999;
+
+ a610:
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "\n\n" << std::endl << std::flush;
+ blkcom::pLFiles[ 4 ] = pMTape;
+ if (blkcom::sLStat[ 14 ] != std::numeric_limits<int>::max ())
+ blkcom::nNumDCD -= blkcom::pIpnTV[ 10 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " " << std::string (131, '-') << "\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " Simulation of all 'nenerg' =";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::setw (4) << blkcom::nEnerg;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " energizations is now complete, and the EMTP is ready to begin statistical\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " processing of the voltage solutions. But before doing so, two cautions about discretization of continuous\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " variables are probably appropriate to mention at this point.\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (5, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "1. The switch closing times which are printed along with peak voltages of each energization are only desired\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (9, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "times, just as with all such times which are punched on data cards which define switches upon data input. Since\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (9, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "time is discretized in multiples of time-step-size 'deltat' , actual closure will occur at the first discrete\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (9, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "step which does not precede the requested time.\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (5, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "2. In the tabulation of voltage distributions which follow, an arbitrary decision had to be made concerning the\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (9, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "column which is labeled 'frequency' . The continuous variable voltage has been discretized, divided into\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (9, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "compartments of size 'aincr' (read from columns 25-32 of the special statistics misc. data card). For an entry";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (9, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "which is printed in a row marked as being for voltage 'vrow' , the associated compartment contains all\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (9, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "voltages 'v' which satisfy vrow .le. v .lt. (vrow + aincr) .\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (5, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "3. floating-point counting (t = t + deltat) is used to increment time. Switching times which are an exact multiple\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (9, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "of the time-step thus are ambiguous; different computers may switch one step later, then." << std::endl << std::flush;
+ if (*pLTDelt <= 0)
+ goto a7314;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "\n\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " *********************************************************** Look, look ************************************************************\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " During this run, a total of";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::setw (4) << *pLTDelt;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " random switch closings less than time zero were generated by the random\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " number generator. But the EMTP has no way of handling such closures. All such illegal closing times were converted\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " to time zero (they should show up in the printout that way) for simulation purposes. The implications of this\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " modification should be understood by the user. If in any doubt, the user is strongly advised to seek experienced\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " counsel on this subject.\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " *********************************************************** Look, look ************************************************************\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "\n\n";
+
+ a7314:
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " " << std::string (131, '-') << "\n" << std::endl << std::flush;
+ blkcom::sFLStat[ 8 ] = d1;
+ blkcom::sFLStat[ 9 ] = d2;
+ blkcom::nLastOV = blkcom::nChain;
+ blkcom::nChain = 29;
+ blkcom::sFLStat[ 6 ] = blkcom::sFLStat[ 6 ] + d1;
+ blkcom::sFLStat[ 7 ] = blkcom::sFLStat[ 7 ] + d2;
+ if (blkcom::nIprsUp >= 1)
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " Exit \"over20\"." << std::endl << std::flush;
+ goto a99999;
+
+ a9800:
+ if (blkcom::nM4Plot != 1)
+ goto a9810;
+ if (*pKBase == 1)
+ goto a9810;
+ blkcom::nLastOV = blkcom::nChain;
+ blkcom::nChain = 16;
+ if (blkcom::nIprsUp >= 1)
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " Exit \"over20\"." << std::endl << std::flush;
+ goto a99999;
+
+ a9810:
+ if (blkcom::nLastOV > blkcom::nChain)
+ goto a9850;
+ blkcom::sFLStat[ 6 ] = blkcom::sFLStat[ 6 ] + d1;
+ blkcom::sFLStat[ 7 ] = blkcom::sFLStat[ 7 ] + d1;
+
+ a9850:
+ blkcom::nLastOV = blkcom::nChain;
+ blkcom::nChain = 31;
+ if (blkcom::nIprsUp >= 1)
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " Exit \"over20\"." << std::endl << std::flush;
+
+ a99999:
+ ;
+ }
+
+ // subroutine katalg.
+ void katalg(void)
+ {
+ // VAX-11/780 installation-dependent module which is used
+ // to honor the miscellaneous data card request for EMTP table
+ // saving, for later "start again" usage. A call to the
+ // universal module "tables" actually dumps memory onto disk.
+ // Logic associated with other than memsav=0 or memsav=1
+ // can generally be ignored by other systems; it applies
+ // only to rtm (real time monitor) use of BPA VAX.
+ int j;
+ //
+ char pANSI132[ 132 ];
+ //
+ std::fstream sFile79;
+ //
+ if(blkcom::nIprsUp >=1 ) {
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " Enter \"katalg\". icat memsav lunit2 ltlabl\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (18, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::setw (10) << blkcom::nICat << blkcom::nMemSav;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "0x" << std::hex << blkcom::pLFiles[ 1 ];
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::setw (10) << blkcom::sSStat.m_nTLabl << std::endl << std::flush;
+ }
+ if(blkcom::nMemSav == 0)
+ goto a9800;
+ if(blkcom::nM4Plot == 1)
+ blkcom::nTMax = std::numeric_limits<double>::infinity ();
+ if (blkcom::nMemSav == 1016)
+ goto a2634;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "\n";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (20, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "----- memsav = 1 represents request for table dumping on disk.";
+ (*reinterpret_cast<std::fstream *> (blkcom::pLFiles[ 1 ])).close();
+ (*reinterpret_cast<std::fstream *> (blkcom::pLFiles[ 1 ])).open ("tptables.bin", std::ios_base::out | std::ios_base::trunc | std::ios_base::binary);
+ emtp::tables ();
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 2 ])) << comlock::pLocker[ 0 ] << comlock::pLocker[ 1 ] << std::endl << std::flush;
+ sFile79.seekg (sFile79.beg);
+ do {
+ sFile79.read (&pANSI132[ 0 ], 132);
+ if (sFile79.eof ())
+ break;
+ (*reinterpret_cast<std::fstream *> (blkcom::pLFiles[ 1 ])).write (&pANSI132[ 0 ], 132);
+ } while (1);
+ (*reinterpret_cast<std::fstream *> (blkcom::pLFiles[ 1 ])).close ();
+ //labcom::pKArray[ 0 * sizeof (int) ] = blkcom::nIndBuf;
+ //labcom::pKArray[ 1 * sizeof (int) ] = blkcom::nMFlush;
+ //labcom::pKArray[ 2 * sizeof (int) ] = blkcom::nNewVec;
+ memcpy (reinterpret_cast<void *> (&labcom::pKArray[ 0 * sizeof (int) ]), reinterpret_cast<void *> (&spycom::nIndBuf), sizeof (int));
+ memcpy (reinterpret_cast<void *> (&labcom::pKArray[ 1 * sizeof (int) ]), reinterpret_cast<void *> (&spycom::nMFlush), sizeof (int));
+ memcpy (reinterpret_cast<void *> (&labcom::pKArray[ 2 * sizeof (int) ]), reinterpret_cast<void *> (&spycom::nNewVec), sizeof (int));
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::string (26, ' ');
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << "Successful saving of EMTP tables as file \"tptables.bin\" . ltlabl =";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::setw (8) << blkcom::sSStat.m_nTLabl << std::endl << std::flush;
+ if (blkcom::nMemSav == 1)
+ goto a9800;
+ goto a9700;
+
+ a2634:
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " Begin EMTP table restoration. ltlabl =";
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::setw (7) << blkcom::sSStat.m_nTLabl;
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " . Wait for completion." << std::endl << std::flush;
+ (*reinterpret_cast<std::fstream *> (blkcom::pLFiles[ 2 ])).close ();
+ (*reinterpret_cast<std::fstream *> (blkcom::pLFiles[ 2 ])).open ("tptables.bin", std::ios_base::out | std::ios_base::in);
+ emtp::tables ();
+ (*reinterpret_cast<std::fstream *> (blkcom::pLFiles[ 2 ])).close ();
+ (*reinterpret_cast<std::fstream *> (blkcom::pLFiles[ 2 ])).open ("tptables.bin", std::ios_base::in | std::ios_base::out | std::ios_base::binary);
+ emtp::tables ();
+ (*reinterpret_cast<std::fstream *> (blkcom::pLFiles[ 2 ])).close ();
+ //blkcom::nIndBuf = labcom::pKArray[ 0 * sizeof (int) ];
+ //blkcom::nMFlush = labcom::pKArray[ 1 * sizeof (int) ];
+ //blkcom::nNewVec = labcom::pKArray[ 2 * sizeof (int) ];
+ memcpy (reinterpret_cast<void *> (&spycom::nIndBuf), reinterpret_cast<void *> (labcom::pKArray[ 0 * sizeof (int) ]), sizeof (int));
+ memcpy (reinterpret_cast<void *> (&spycom::nMFlush), reinterpret_cast<void *> (labcom::pKArray[ 1 * sizeof (int) ]), sizeof (int));
+ memcpy (reinterpret_cast<void *> (&spycom::nNewVec), reinterpret_cast<void *> (labcom::pKArray[ 2 * sizeof (int) ]), sizeof (int));
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << " Restoration complete, user can now begin depositing EMTP variables via spy ." << std::endl << std::flush;
+ blkcom::nMemSav = 0;
+
+ a9700:
+ spycom::nKBreak = 1;
+
+ a9800:
+ ;
+ }
+
+ // subroutine emtspy.
+ void emtspy(void)
+ {
+ // Module of interactive EMTP only, which services "emtspy".
+ // If no interactive use, convert to dummy module ("return").
+ int n18 = 0;
+ //
+ ++n18;
+ if (n18 < spycom::nMaxFLG)
+ n18 = 0;
+ if(spycom::nIprSpy >= 9) {
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 6 ])) << " Top \"emtspy\". kbreak, kwtspy, nbreak, lockbr jjroll, nchain =" << spycom::nKBreak << blkcom::nKWTSpy << spycom::nNBreak << spycom::nLockBR << blkcom::nChain << spycom::nJJRoll << " t, tbreak =" << blkcom::nT << spycom::nTBreak << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 6 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 6 ]));
+ }
+ if(spycom::nJJRoll <= 0) {
+ if(spycom::nKBreak != 1) {
+ if((spycom::nLockBR == 1) || (blkcom::nT < spycom::nTBreak))
+ goto a5623;
+ // ok, now we service "break" of spy (time and place to do it):
+ spycom::nTBreak = 8877.0e33;
+ }
+ spycom::nLockBR = 1;
+ (*reinterpret_cast<std::stringstream *> (spycom::pMFiles[ 5 ])) << " // Start \"break\" service in \"emtspy\". nchain =" << std::setw(3) << blkcom::nChain << " t =" << std::setprecision(5) << blkcom::nT << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *> (spycom::pMFiles[ 5 ]));
+ if(spycom::nKFile5 == 1)
+ goto a6258;
+
+ a5617:
+ spyf77::sProm80 = " spy:";
+ utilities::prompt(*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ]), \
+ spyf77::sProm80);
+
+ a5623:
+ if(spycom::pKSMSpy[ 2 ] == 1)
+ ;//goto a5632;
+ utilities::flager();
+ if(blkcom::nKWTSpy == 1)
+ ;//goto a5632;
+ if(spycom::nKFile5 == 1)
+ goto a6258;
+ goto a9000;
+ }
+ blkcom::nKWTSpy = 0;
+ spying();
+ if(spycom::nJJRoll > 0)
+ goto a9000;
+ if(spycom::nLockBR == 1)
+ goto a5623;
+ goto a9000;
+ // Entry point for pre-defined spy commands ($spy or "@"):
+
+ a6258:
+ do {
+ if(spycom::nKomAdd != 0) {
+ ++spycom::nKomAdd;
+ spyf77::sBuff77 = spyf77::sFile6[ spycom::nKomAdd - 1 ];
+ if(strcom::toLower(spyf77::sBuff77.substr(0, 3)) == "eof ")
+ goto a6278;
+ } else {
+ (*reinterpret_cast<std::stringstream *> (spycom::pMFiles[ 4 ])).read(&spyf77::sBuff77[ 0 ], 80);
+ if((*reinterpret_cast<std::stringstream *> (spycom::pMFiles[ 4 ])).eof())
+ goto a6274;
+ }
+
+ a6264:
+ if(spycom::nKFile5 == 1)
+ percnt(&spyf77::sBuff77, 80);
+ if (spycom::nKilPer != 0)
+ goto a6274;
+
+ a6266:
+ spying();
+ } while (spycom::nLockBR == 1);
+ goto a9000;
+ // End-of-file during disk read, so switch to keyboard input:
+
+ a6274:
+ ;//((std::stringstream *) spycom::pMFiles[ 4 ]) -> close();
+
+ a6278:
+ spycom::pMFiles[ 4 ] = blkcom::pMFilesSave[ 0 ];
+ spycom::nKFile5 = 0;
+ spycom::nKilPer = 0;
+ if(blkcom::pMFilesSave[ 1 ] == nullptr)
+ goto a5617;
+ blkcom::pMFilesSave[ 1 ] = nullptr;
+
+ a9000:
+ if(spycom::nIprSpy >= 1) {
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Exit \"emtspy\". kbreak, nchain, lastov, m4plot =" << spycom::nKBreak << blkcom::nChain << blkcom::nLastOV << blkcom::nM4Plot << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ }
+ }
+
+ // subroutine spying.
+ void spying(void)
+ {
+ int j;
+ int nIComm;
+ std::string sCharD7;
+ std::string sSpyTim[ 2 ];
+ std::string sPDate[ 2 ];
+ //
+ if (spycom::nIprSpy < 1)
+ goto a31006;
+ *((std::stringstream *) spycom::pMFiles[ 5 ]) << " Enter \"spying\". nchain, jjroll, kbreak, lockbr, nexmod =" << blkcom::nChain << spycom::nJJRoll << spycom::nKBreak << spycom::nLockBR << spycom::nNexMod << " buff77(1:20) =" << spyf77::sBuff77.substr(0, 20) << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ std::cout << " Top spying, ksmspy(1:3) =";
+ for (j = 1; j <= 3; j++)
+ std::cout << spycom::pKSMSpy[ j - 1 ];
+ std::cout << std::endl;
+
+ a31006:
+ if (spyf77::sBuff77.substr(0, 4) != "spy ")
+ goto a51006;
+ spycom::nNexMod = 0;
+ spycom::pKSMSpy[ 0 ] = 2;
+ spycom::pKSMSpy[ 2 ] = 0;
+
+ a51006:
+ if (spycom::nNexMod != 2)
+ goto a1007;
+ spycom::nNexMod = 0;
+ switch(spycom::nNextSN) {
+ case 31269:
+ goto a31269;
+
+ ;
+ }
+
+ a1007:
+ switch(spycom::nNexMod) {
+ case 1:
+ ;//goto a3208;
+
+ case 3:
+ ;//goto a8500;
+
+ case 7:
+ ;//goto a1320;
+
+ default:
+ if (spycom::nNexMod >= 4)
+ ;//goto a1319;
+ break;
+ }
+ if (spycom::nJJRoll > 0)
+ ;//goto a1520;
+ if (spycom::nKBRSer != 2)
+ goto a1009;
+ spycom::nJWord = 52;
+ ;//goto a8500;
+
+ a1009:
+ spycom::nMemKAR = location::index(&spycom::pKar1[ 0 ]);
+ if (spycom::nKFile5 != 2)
+ goto a1240;
+ spycom::nKFile5 = 0;
+ goto a31269;
+
+ a1240:
+ spycom::nNextSN = 31269;
+ spyf77::sProm80 = " spy:";
+
+ a51269:
+ goto a9800;
+
+ a31269:
+ spyf77::sANSW80 = spyf77::sBuff77;
+ if (spycom::nIprSpy <= 9)
+ goto a39843;
+ *((std::stringstream *) spycom::pMFiles[ 5 ]) << " --- Just read answ80: " << spyf77::sANSW80.substr(0, 80) << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+
+ a39843:
+ if (strcom::toLower(spyf77::sANSW80.substr(0, 4)) == "type")
+ ;//goto a2506;
+ if (strcom::toLower(spyf77::sANSW80.substr(0, 2)) != "c ")
+ goto a1275;
+ if ((spycom::nKFile5 == 1) && (spycom::nKVerfy == 0))
+ goto a51269;
+ if (nIComm != 0)
+ goto a51269;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Comment:" << spyf77::sANSW80.substr(0, 80) << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ goto a51269;
+
+ a1275:
+ if (spyf77::sANSW80[ 0 ] != '@')
+ ;//goto a1289;
+ ;
+ ;
+ ;
+ a9800:
+ ;
+ }
+
+ // subroutine spyink.
+ void spyink(void)
+ {
+ ;
+ }
+
+ // subroutine initsp.
+ void initsp(void)
+ {
+ // Module of interactive EMTP only, which services "emtspy".
+ // If no interactive EMTP use, this module can be deleted.
+ // Universal initialization module for "spying". Constants
+ // must be set only once, at the beginning of execution only.
+ int j;
+ int n3;
+ double nTDRoll;
+ std::vector<std::string> sTextAY({
+ "heading",
+ "stop",
+ "plot",
+ "help",
+ "examine",
+ "deposit",
+ "switch",
+ "append",
+ "save",
+ "restore",
+ "go",
+ "echo",
+ "find",
+ "list",
+ "spy",
+ "break",
+ "when",
+ "comment",
+ "@?",
+ "roll",
+ "type?",
+ "verify",
+ "files",
+ "sleep",
+ "source",
+ "edit",
+ "wake",
+ "language",
+ "catalog",
+ "begin",
+ "step",
+ "debug",
+ "data",
+ "ramp",
+ "time",
+ "tek",
+ "branch",
+ "yform",
+ "noy",
+ "factor",
+ "nof",
+ "rlc",
+ "width",
+ "bus",
+ "size",
+ "limit",
+ "iout",
+ "node",
+ "nonlin",
+ "space",
+ "lock",
+ "[y]",
+ "[f]",
+ "noroll",
+ "open",
+ "close",
+ "sm",
+ "honk",
+ "choice",
+ "tacs",
+ "wait",
+ "v-i"});
+ //
+ n3 = 29;
+ if(emtp::dimens(spycom::sMemRMP, n3, blkcom::sBus1, blkcom::sBus1)) {
+ spycom::nLimBuf = spycom::sMemRMP[ 1 ];
+ if(spycom::nIprSpy < 1)
+ goto a1144;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Near top of \"initsp\". limbuf =" << spycom::nLimBuf << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+
+ a1144:
+ spycom::nLockBR = 1;
+ spycom::nKBreak = 0;
+ spycom::nIndBuf = 0;
+ spycom::nNoBack = 0;
+ spycom::nMonitR = 0;
+ spycom::nMonitS = 0;
+ spycom::nIncHlp = 0;
+ spycom::nKSlowR = 5;
+ spycom::nMaxFLG = 1;
+ spycom::nTBreak = 8877e33;
+ spycom::nKSPSav = 0;
+ spycom::nNumRMP = 0;
+ spycom::nKBRSer = 0;
+ spycom::nKSerLC = 0;
+ spycom::nLSerLC = 0;
+ spycom::nKomAdd = 0;
+ spyf77::sBlan80 = std::string(80, ' ');
+ spyf77::sSpyKWD = sTextAY;
+ spycom::nNumKey = sTextAY.size();
+ spycom::nNexMod = 0;
+ spyf77::sJunker = "junker";
+ location::locatn();
+ for(j = 1; j <= 9; j++)
+ spyf77::pFilExt[ j - 1 ] = ' ';
+ spyf77::sANSI32 << std::string("inclspy") << std::to_string(j) << std::string(".dat");
+ if(utilities::exists(spyf77::sANSI32.str().c_str()))
+ spyf77::pFilExt[ j - 1 ] = 'x';
+ if(spycom::nIprSpy < 1)
+ goto a2795;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Next use of \"inquire\". j, ansi32 =" << j << " " << spyf77::sANSI32.str() << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+
+ a2795:
+ blkcom::nKWTSpy = 0;
+ spycom::nJJRoll = 0;
+ nTDRoll = 1.0;
+ spycom::nKFile5 = 0;
+ spycom::nLIdnt1 = 1;
+ spycom::nLIdnt2 = 1;
+ spycom::nLinSPN = 1;
+ }
+ }
+
+ // subroutine quiter.
+ void quiter(void)
+ {
+ // Module of interactive EMTP only, which services "emtspy".
+ // if no interactive use, convert to dummy module ("return").
+ // this module provides a special-purpose connection to the
+ // more general "flager". Here, we only want to sense a
+ // user-keyed interrupt (no spy input is to be read).
+ int n24, n25;
+ //
+ n24 = spycom::nLockBR; // save current time-slicing flag value
+ n25 = spycom::nKFile5; // save current status of input connection
+ spycom::nLockBR = 0; // temporarily turn time-sharing on
+ utilities::flager(); // check for user-keyed interrupt, and return
+ spycom::nLockBR = n24; // restore original value of b4 flager use
+ spycom::nKFile5 = n25; // restore original value of b4 flager use
+ }
+
+ // subroutine kwiter.
+ void kwiter(long int idum[ 3 ])
+ {
+ // VAX-11 installation-dependent EMTP module which serves
+ // control interactive usage. if none, destroy the module.
+ // Purpose is to sense user-keyed interrupt, and set flag.
+ // Name "comkwt" is reserved (connected to "controlc.obj")
+ kwtcom::nKWTVAX = 1;
+ std::cout << idum[ 0 ] << idum[ 1 ] << idum[ 3 ];
+ }
+
+ // subroutine percnt.
+ void percnt(std::string *pVByte, const int &n7)
+ {
+ // Module of interactive EMTP usage only, which services "emtspy".
+ // utility which serves to replace "%%%%%%%%" strings of disk
+ // files by parameters of "@?" call. Columns 1, ... n7 are
+ // searched, of character vector "vbyte" .
+ // For non-interactive emtp, this module can be destroyed.
+ int j;
+ int k;
+ //
+ if(pVByte) {
+ for(k = 1; k <= n7; k++) {
+ if((*pVByte)[ k - 1 ] != '%')
+ ;//goto a1297;
+ for(j = 1; j <= 7; j++) {
+ if((*pVByte)[ k + j - 1 ] != '%')
+ ;//goto a1297;
+ }
+ // We exit do 1253 with string of 8 "%" beginning in column k
+ ++spycom::nITExp;
+ if (spycom::nITExp <= spycom::nMaxArg)
+ goto a1284;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " ???? Trouble. \"@?\" usage only defined" << spycom::nMaxArg << " arguments, while the disk" << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " file has more %-strings. Trouble detected in following:" << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " >>>" << pVByte -> substr(0, 80) << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));;
+ spycom::nKilPer = 1;
+ ;//goto a1313;
+
+ a1284:
+ spyf77::sANSI8 << spyf77::pTexPar[ spycom::nITExp - 1 ];
+ pVByte -> replace(k + j - 1, k + 7, spyf77::sANSI8.str());
+ }
+ if(spycom::nKVerfy != 0)
+ ;//goto a1313;
+ (*reinterpret_cast<std::stringstream *> (spycom::pMFiles[ 5 ])) << " @>>>" << pVByte -> substr(0, n7) << std::endl;
+ }
+ }
+
+ // subroutine numchk.
+ void numchk(std::string *pVByte, const int &nchar, int &nKill)
+ {
+ // Module of interactive EMTP usage only, which services "emtspy".
+ // This utility serves to scrutinize the input character string
+ // (vbyte(j), j=1, nchar) to see if it is a legal floating-point
+ // number. If so, "kill" is to be set to zero; if number is
+ // structurally deficient, "kill" is to be set positive.
+ // For non-interactive EMTP, this module can be destroyed.
+ int i;
+ int k;
+ int kk, nKoldig, nKolep, nKolexp, nKolper;
+ int nPer, nSign, nNume;
+ //
+ nKill = 0;
+ nKoldig = 0;
+ nPer = 0;
+ nSign = 0;
+ nNume = 0;
+ kk = 0;
+ for(i = 1; i <= nchar; i++) {
+ if((*pVByte)[ i - 1 ] == ' ') {
+ goto a3439;
+ } else {
+ ++kk;
+ if(((*pVByte)[ i - 1 ] == '+') && ((*pVByte)[ i - 1 ] != '-'))
+ goto a3412;
+ ++nSign;
+ if(nSign > 2)
+ nKill = 1;
+ if(kk == 1) {
+ goto a3439;
+ } else {
+ if(nKolep == (i - 1)) {
+ goto a3439;
+ } else {
+ nKill = 1;
+ goto a3439;
+ }
+ }
+ }
+
+ a3412:
+ if((strcom::toLower(*pVByte)[ i - 1 ] != 'e') && (strcom::toLower(*pVByte)[ i - 1 ] == 'd'))
+ goto a3425;
+ ++nNume;
+ nKolep = i;
+ if (nNume > 1)
+ nKill = 1;
+ goto a3439;
+
+ a3425:
+ if ((*pVByte)[ i - 1 ] != '.')
+ goto a3428;
+ ++nPer;
+ if (nPer > 1)
+ nKill = 1;
+ nKolper = i;
+ goto a3439;
+
+ a3428:
+ for(size_t j = 1; j <= 10; j++)
+ if((*pVByte)[ i - 1 ] == spyf77::pDigit[ j ])
+ goto a3438;
+ nKill = 1;
+ goto a3439;
+
+ a3438:
+ nKoldig = 1;
+ }
+ if((nNume == 1) && (nKolep > nKoldig))
+ nKill = 1;
+ if((nNume == 1) && (nKolper > nKolep))
+ nKill = 1;
+ if(nKill == 0)
+ goto a9000;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " ??? Sorry, illegal numeric just read:";
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::setw (50) << (*pVByte).substr (0, 50) << std::endl << std::flush;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Make a second try, please ...." << std::endl << std::flush;
+
+ a3439:
+ ;
+
+ a9000:
+ ;
+ }
+
+ // subroutine getnum.
+ void getnum(int &nNum)
+ {
+ // Module of interactive EMTP usage only, which services "emtspy".
+ // For non-interactive EMTP, this module can be destroyed.
+ char c4;
+ //
+ int i;
+ int j;
+ int n1;
+ //
+ if(spycom::nIprSpy > 1)
+ goto a4204;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Begin \"getnum\". ibegcl =";
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::setw (5) << spycom::nIBegCL;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " bytbuf(ibegcl) =";
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::setw (1) << spycom::pByteBuf[ spycom::nIBegCL - 1 ] << std::endl << std::flush;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));;
+
+ a4204:
+ n1 = 1;
+ nNum = 0;
+ for (i = spycom::nIBegCL; i <= 20; i++) {
+ c4 = spycom::pByteBuf[ i - 1 ];
+ switch (c4) {
+ case ' ':
+ case ':':
+ case '#':
+ case ',':
+ goto a4286;
+ break;
+
+ case '+':
+ ;
+ break;
+
+ case '-':
+ goto a4218;
+ break;
+ }
+ n1 = -1;
+ goto a4219;
+
+ a4218:
+ for(j = 1; j <= 10; j++)
+ if(c4 == spyf77::pDigit[ j - 1 ])
+ goto a4256;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " -- Illegal byte in \"number\".";
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::setw (4) << i;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::setw (1) << c4;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << "Try again ..." << std::endl << std::flush;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ nNum = -87654;
+ goto a4294;
+
+ a4256:
+ if (j == 10)
+ j = 0;
+ nNum = 10 * nNum + j;
+ if (spycom::nIprSpy < 2) {
+ ;
+ } else {
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Next digit. j, num =";
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::setw (8) << j << nNum;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::endl << std::flush;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ }
+
+ a4219:
+ ;
+ }
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Stop at 4271 of \"getnum\". num =";
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::setw (8) << spycom::nIEndCL << nNum;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+
+ a4286:
+ if(n1 < 0)
+ nNum = -nNum;
+ spycom::nIEndCL = i - 1;
+ if(spycom::nIprSpy < 1)
+ goto a4294;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Exit \"number\". iendcl, num = " << spycom::nIEndCL << ", " << nNum << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+
+ a4294:
+ return;
+ }
+
+ // subroutine spylin.
+ void spylin(void)
+ {
+ // Module of interactive emtp usage only, which services "emtspy".
+ // For non-interactive emtp, this module can be destroyed.
+ // One blank line is written on spy screen by this module.
+ // Temporarily, until we learn how to write to a 2nd crt for
+ // VAX/VMS, we will just write to lunit6 in universal form:
+ // write (unit = lunit(6), fmt = 5624)
+ ;
+ }
+
+ //subroutine spyout.
+ void spyout(const int &n1, const int &n2)
+ {
+ // Module of interactive EMTP only, which services "emtspy".
+ // If no interactive use, this module can be deleted.
+ // Arguments n1 and n2 are node nos., with possible "-" signs.
+ // Purpose is to load and print corresponding names for "output"
+ int k;
+ int n11, n12;
+ //
+ std::string sTerra = "terra", sText10[ 10 ];
+ //
+ n11 = n1;
+ n12 = n2;
+ if (n11 != 7878)
+ goto a4618;
+ k = 0;
+ goto a9000;
+
+ a4618:
+ if (n11 != -7878)
+ goto a4626;
+
+ a4621:
+ if (k <= 0)
+ goto a9000;
+ for (size_t j = 1; j <= k; j++) {
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::string (7, ' ');
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::setw (7) << sText10[ j - 1 ];
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::endl << std::flush;
+ }
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ k = 0;
+ goto a9000;
+
+ a4626:
+ if (n11 < 0)
+ n11 = -n11;
+ ++k;
+ sText10[ k - 1 ] = labcom::sBus[ n11 - 1 ];
+ if (n11 == 1)
+ sText10[ k - 1 ] = sTerra;
+ if (k == 10)
+ goto a4621;
+ if (n12 == 0)
+ goto a9000;
+ if (n12 < 0)
+ n12 = -n12;
+ ++k;
+ sText10[ k - 1 ] = labcom::sBus[ n12 - 1 ];
+ if (n12 == 1)
+ sText10[ k - 1 ] = sTerra;
+ if (k == 10)
+ goto a4621;
+
+ a9000:
+ if (spycom::nIprSpy < 3)
+ goto a9007;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Exit \"spyout\". n1, n2, k, n11, n12 =";
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::setw(6) << n1 << n2 << k << n11 << n12 << std::endl << std::flush;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));;
+
+ a9007:
+ ;
+ }
+
+ // subroutine examin.
+ void examin(void)
+ {
+ // Module of interactive EMTP usage only, which services "emtspy".
+ // For non-interactive emtp, this module can be destroyed.
+ // This near-universal module serves to build the character*132
+ // output vector outlin of the "examine" command of spy.
+ // Computers with index problems (e.g., prime) need replacement
+ int jj;
+ int n3, n5, n8, n9, n10, n17;
+ //
+ if(spycom::nIprSpy < 1)
+ goto a1718;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Top of \"examin\". numex, imin(1), locout(1) =";
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::setw(6) << spycom::nNumex << spycom::pIMin[ 0 ] << spycom::pLocOut[ 0 ] << std::endl << std::flush;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));;
+
+ a1718:
+ jj = 0;
+ spyf77::sOutLin[ 0 ] = ' ';
+ spycom::nKOLOut = 2;
+ if (spycom::nNumex <= 0)
+ goto a9000;
+
+ a1540:
+ ++jj;
+ n5 = spycom::pIMin[ jj - 1 ];
+ n3 = spycom::pLocOut[ jj - 1 ];
+ n8 = location::sLocate[ n3 ] + n5 - 1;
+ if(spycom::pIntOut[ jj - 1 ] == 0)
+ n8 = n8 + n5 - 1;
+ if(spycom::nIprSpy < 3)
+ goto a1560;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Next examine. jj, n5, n3, n8, intout(jj)";
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::setw (8) << jj << n5 << n3 << n8 << spycom::pIntOut[ jj - 1 ] << std::endl << std::flush;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+
+ a1560:
+ if(spycom::pIntOut[ jj - 1 ] == 0)
+ goto a1600;
+ n9 = n8 - spycom::nMemKAR;
+ ++n8;
+ if(spycom::pIVec[ n3 - 1 ] == 1)
+ goto a1577;
+ if((n5 == 1) && (spycom::pIMax[ jj - 1 ] == 1))
+ goto a1640;
+
+ a1577:
+ spyf77::sANSI16 << std::setw(10) << spycom::pKar1[ n9 ];
+ spyf77::sOutLin.substr(spycom::nKOLOut, 9) = spyf77::sANSI16.str().substr(0, 10);
+ spyf77::sOutLin.substr(spycom::nKOLOut + 10, 4) = spyf77::sBlan80.substr(0, 5);
+ spycom::nKOLOut += 15;
+ goto a1664;
+
+ a1600:
+ n9 = (n8 - spycom::nMemKAR) / 2;
+ n10 = spycom::nMemKAR + 2 * n9 - n8;
+ n8 += 2;
+ if(n10 != 0)
+ goto a1628;
+ if(spycom::pIASCII[ n3 - 1 ] == 0)
+ spyf77::sANSI16 << std::setw (15) << std::setprecision (6) << spycom::pFKar1[ n9 ];
+ if(spycom::pIASCII[ n3 - 1 ] == 1)
+ spyf77::sANSI16 << " \"" << spycom::pFKar1[ n9 ] << "\" ";
+ goto a1633;
+
+ a1628:
+ if (n9 < 0)
+ --n9;
+ if (spycom::pIASCII[ n3 - 1 ] == 0)
+ spyf77::sANSI16 << spycom::pFKar2[ n9 ];
+ if (spycom::pIASCII[ n3 - 1 ] == 1)
+ spyf77::sANSI16 << spycom::pFKar2[ n9 ];
+
+ a1633:
+ spyf77::sOutLin.substr (spycom::nKOLOut, 14) = spyf77::sANSI16.str().substr(0, 15);
+ spycom::nKOLOut += 15;
+ goto a1664;
+
+ a1640:
+ spyf77::sANSI8 << std::setw(6) << spycom::pKar1[ n9 ];
+ spyf77::sOutLin.substr(spycom::nKOLOut, 5) = spyf77::sANSI8.str().substr(0, 6);
+ if(spycom::nIprSpy < 3)
+ goto a1662;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " i6 integer encoded for examine. n9,kar1(1 + n9) =";
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::setw (8) << n9 << spycom::pKar1[ n9 ];
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));;
+
+ a1662:
+ spycom::nKOLOut += 6;
+
+ a1664:
+ ++n5;
+ if (n5 <= spycom::pIMax[ jj - 1 ])
+ goto a1560;
+ if (jj < spycom::nNumex)
+ goto a1540;
+ if (spycom::nKOLOut < 132)
+ spyf77::sOutLin.substr (spycom::nKOLOut, 132 - spycom::nKOLOut) = std::string(132 - spycom::nKOLOut, ' ');
+ if (spycom::nIprSpy < 1)
+ goto a9000;
+ n17 = spycom::nIprSpy;
+ if (n17 > 80)
+ n17 = 80;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Exit \"examin\". kolout =";
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::setw (5) << spycom::nKOLOut;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " outlin(1:80) =";
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << spyf77::sOutLin.substr(0, n17);
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));;
+
+ a9000:
+ ;
+ }
+
+ // subroutine deposi.
+ void deposi(const int &ind, int &n1, int &n2, double &d4)
+ {
+ // Module of interactive EMTP usage only, which services "emtspy".
+ // For non-interactive EMTP, this module can be destroyed.
+ // This near-universal module services "deposit", to actually
+ // perform the tampering. Symbol is in row ind. if it is
+ // of type alphanumeric, ansi8(1 : 6) in "dekspy" carries the
+ // new contents. Otherwise, d4 is the numeric value to be
+ // deposited, and intype gives the mode (1=integer, 0=real).
+ // Bounding subscripts on the deposit are n1 and n2, respectively.
+ // Computers with index problems (e.g., prime) need replacement
+ int intype;
+ int n8, n9, n10;
+ //
+ if (spycom::nIprSpy < 1)
+ goto a1846;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Top of \"deposi\". ind, intype, iascii(ind), d4, ansi8 =";
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::setw(8) << ind << intype << spycom::pIASCII[ ind - 1 ];
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::setw(15) << std::setprecision(4) << d4;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::setw(8) << spyf77::sANSI8.str();
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));;
+
+ a1846:
+ n8 = spycom::pLocate[ ind ];
+ if (spycom::pIASCII[ ind - 1 ] == 1)
+ spyf77::sANSI8 >> std::setw(6) >> d4;
+ if(intype == 0)
+ goto a1880;
+ n9 = n8 - spycom::nMemKAR + n1;
+
+ a1854:
+ spycom::pKar1[ n9 - 1 ] = (int) d4;
+ ++n1;
+ ++n9;
+ if(n1 <= n2)
+ goto a1854;
+ goto a8000;
+
+ a1880:
+ n9 = (n8 - spycom::nMemKAR) / 2 + n1;
+ n10 = spycom::nMemKAR + 2 * (n9 - n1) - n8;
+
+ a1904:
+ if(n10 == 0)
+ spycom::pFKar2[ n9 - 1 ] = d4;
+ ++n1;
+ ++n9;
+ if(n1 <= n2)
+ goto a1904;
+
+ a8000:
+ if (spycom::nIprSpy < 1)
+ goto a9000;
+ (*reinterpret_cast<std::stringstream *> (spycom::pMFiles[ 5 ])) << " Exit \"deposi\".";
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+
+ a9000:
+ ;
+ }
+
+ // subroutine intpar.
+ void intpar(const int &max, int &n1, int &n2, int &kill)
+ {
+ // Module of interactive EMTP usage only, which services "emtspy".
+ // this module is designed to extract two free-format row numbers
+ // from bytbuf(20) input buffer of common. These numbers must
+ // be positive, ordered (1st less than or equal to 2nd), and not
+ // in excess of the last table row "max". The to row numbers are
+ // passed back as "n1" and "n2" arguments. if this extraction
+ // was successful, "kill" is set to zero; if it failed, kill = 1.
+ // for non-interactive emtp, this module can be destroyed.
+ int i;
+ int j;
+ int n6, n13, n17, n22, n33;
+ //
+ kill = 0;
+ if(strcom::toLower(spycom::pByteBuf)[ 0 ] != 't')
+ goto a2071;
+ n1 = 1;
+ n2 = 1;
+ goto a2110;
+
+ a2071:
+ if(strcom::toLower(spycom::pByteBuf)[ 0 ] != 'b')
+ goto a2075;
+ n1 = max;
+ n2 = max;
+ goto a2110;
+
+ a2075:
+ if(strcom::toLower(spycom::pByteBuf)[ 0 ] != 'a')
+ goto a2088;
+ n1 = 1;
+ n2 = max;
+ goto a2110;
+
+ a2088:
+ for(i = 1; i <= 20; i++) {
+ n13 = 21 - i;
+ if(spycom::pByteBuf[ n13 - 1 ] == ' ') {
+ ;
+ } else {
+ if(spycom::pByteBuf[ n13 - 1 ] != ',')
+ goto a2054;
+ n6 = 20 - i;
+ for(j = 1; j <= n6; j++) {
+ n13 = 21 - i + j;
+ spycom::pByteBuf[ n13 - 1 ] = spycom::pByteBuf[ j - 1 ];
+ }
+ goto a2054;
+ }
+ }
+
+ a2054:
+ n22 = 0;
+ n13 = 0;
+ for(i = 1; i <= 20; i++) {
+ n17 = i - 1;
+ if(spycom::pByteBuf[ i - 1 ] != ' ')
+ goto a2091;
+ if(n22 == 0)
+ goto a2104;
+ if (spycom::pByteBuf[ n17 - 1 ] == ' ')
+ goto a2104;
+ if(spycom::pByteBuf[ n17 - 1 ] == ',')
+ goto a2104;
+ ++n13;
+ goto a2104;
+
+ a2091:
+ ++n22;
+ if(spycom::pByteBuf[ i - 1 ] == ',')
+ goto a2093;
+ if(spycom::pByteBuf[ n17 - 1 ] == ' ')
+ goto a2104;
+ ++n13;
+ goto a2104;
+
+ a2093:
+ for(j = 1; j <= 10; j++)
+ if(spycom::pByteBuf[ i - 1 ] == spyf77::pDigit[ j - 1 ])
+ goto a2104;
+
+ a2104:
+ ;
+ }
+ if (n22 > 0)
+ goto a2109;
+ n1 = n2 + 1;
+ if(n1 <= max)
+ goto a2107;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " ---- Wrap around, end to beginning ----";
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));;
+ n1 = 1;
+
+ a2107:
+ n2 = n1 + n33;
+ goto a2110;
+
+ a2109:
+ if(n13 == 2)
+ goto a2132;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " ???? Illegal data (not blank or two dec free-format integers. Try again.";
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Is it possible user's data has no such table (other cause of message)?";
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));;
+ kill = 1;
+ goto a9000;
+
+ a2132:
+ freedom::freeIn(spycom::pByteBuf, n1, n2);
+ n33 = n2 - n1;
+
+ a2110:
+ if(n1 <= 0)
+ n1 = 1;
+ if(n2 > max)
+ n2 = max;
+
+ a9000:
+ if (spycom::nIprSpy < 1)
+ goto a9006;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Return from \"intpar\". max, n1, n2, kill =";
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::setw(6) << max << n1 << n2 << kill;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+
+ a9006:
+ ;
+ }
+
+ // subroutine append.
+ void append(void)
+ {
+ // implicit real(8) (a-h, o-z), integer(4) (i-n)
+ // module connected to key word "append" of spy. others
+ // can perfect and use their own installation-dependent
+ // (and perhaps proprietary) extensions via this module.
+ ;
+ }
+
+ // subroutine sosrng.
+ void sosrng (int *kill)
+ {
+ // Module of interactive EMTP usage only, which services "emtspy".
+ // This module serves to extract a beginning and ending line number
+ // for sos-like editing operations of "edit" command. These two
+ // integer outputs are (lidnt1, lidnt2) of common. The only
+ // argument is "kill", which tells whether the operation was a
+ // success: "0" means success, "1" means error.
+ // For non-interactive EMTP, this module can be destroyed.
+ char char2;
+ int n1, n12, n13, n24;
+ //
+ if(spycom::nIprSpy < 1)
+ goto a2615;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Top \"sosrange\". bytbuf(a20) =";
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::setw(20) << spycom::pByteBuf;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " numsym, lidnt1, linnow, char1 =";
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::setw(5) << spycom::nNumSym << spycom::nLIdnt1 << spycom::nLinNow;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::setw(1) << spycom::cChar1;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+
+ a2615:
+ blkcom::nKill = 0;
+ if(spycom::cChar1 != ' ')
+ goto a2629;
+ n12 = spycom::nLinSPN;
+ spycom::nLIdnt1 = spycom::nLIdnt2 + 1;
+ spycom::nLIdnt2 = spycom::nLIdnt1 + n12;
+ goto a2662;
+
+ a2629:
+ if(spycom::pByteBuf[ 0 ] != '#')
+ goto a2632;
+ spycom::nIBegCL = 2;
+ getnum (n1);
+ if (n1 != -87654)
+ goto a2630;
+
+ a2621:
+ do {
+ blkcom::nKill = 1;
+ goto a9000;
+
+ a2630:
+ spycom::nLIdnt1 = spycom::nLinNow + 1;
+ spycom::nLIdnt2 = spycom::nLinNow + n1;
+ goto a2662;
+
+ a2632:
+ if (spycom::pByteBuf[ 0 ] != ' ')
+ goto a2635;
+ if (spycom::nLinNow < spycom::nNumCRD)
+ goto a2634;
+ std::cout << " No such lines exist." << std::endl << std::flush;
+ goto a2621;
+
+ a2634:
+ n1 = 16;
+ goto a2630;
+
+ a2635:
+ spycom::nIBegCL = 0;
+ n13 = 0;
+ spycom::nLIdnt1 = 0;
+ spycom::nLIdnt2 = 0;
+
+ a2636:
+ ++spycom::nIBegCL;
+ n24 = 0;
+ if (spycom::nIprSpy < 2)
+ goto a2644;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 6 ])) << " Begin next lidnt. ibeg n13 lidnt1 jpoint n1 n24";
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 6 ])) << std::string(18, ' ');
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 6 ])) << std::setw(8) << spycom::nIBegCL << n13 << spycom::nLIdnt1 << spycom::nLinNow << n1 << n24;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));;
+
+ a2644:
+ if (spycom::pByteBuf[ spycom::nIBegCL - 1 ] != '.')
+ goto a2645;
+ n24 = spycom::nLinNow;
+ goto a2654;
+
+ a2645:
+ if (spycom::pByteBuf[ spycom::nIBegCL - 1 ] != '^')
+ goto a2648;
+ n24 = 1;
+ goto a2654;
+
+ a2648:
+ if (spycom::pByteBuf[ spycom::nIBegCL - 1 ] != '*')
+ goto a2657;
+ n24 = spycom::nNumCRD;
+
+ a2654:
+ ++spycom::nIBegCL;
+
+ a2657:
+ getnum(n1);
+ if (n1 == -87654)
+ goto a2621;
+ ++n13;
+ if(n13 == 1)
+ spycom::nLIdnt1 = n24 + n1;
+ if(n13 == 2)
+ spycom::nLIdnt2 = n24 + n1;
+ if(n13 == 2)
+ goto a2662;
+ ++spycom::nIBegCL;
+ if(spycom::pByteBuf[ spycom::nIBegCL - 1 ] == ':')
+ goto a2636;
+ if(spycom::pByteBuf[ spycom::nIBegCL - 1 ] != '#')
+ goto a2659;
+ ++spycom::nIBegCL;
+ getnum(n1);
+ if(n1 == -87654)
+ goto a2621;
+ spycom::nLIdnt2 = spycom::nLIdnt1 + n1 - 1;
+ goto a2662;
+
+ a2659:
+ spycom::nLIdnt2 = spycom::nLIdnt1;
+
+ a2662:
+ if(spycom::nLIdnt1 >= 1)
+ goto a2663;
+ std::cout << " Illegal syntax of command." << std::endl << std::flush;
+ } while(1);
+
+ a2663:
+ if(spycom::nLIdnt1 <= spycom::nNumCRD)
+ spycom::nLIdnt2 = spycom::nNumCRD;
+
+ a9000:
+ if(spycom::nIprSpy >= 1) {
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Exit \"sosrng\". lidnt1, lidnt2, kill, char2 =";
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::setw(6) << spycom::nLIdnt1 << spycom::nLIdnt2 << kill;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::setw(1) << char2 << std::endl << std::flush;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));;
+ }
+ }
+
+ // subroutine stopin.
+ void stopin(void)
+ {
+ // Universal module of interactive EMTP (spy of "emtspy").
+ // If non-interactive version, module can be destroyed. This
+ // module is called only to display erroneous file6(istep), &
+ // prompt user to send a corrected copy. Called by "datain".
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " ? ? ? Trouble with input data. Last card number" << std::setw (5) << blkcom::nIStep;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " is in error." << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " 12345678901234567890123456789012345678901234567890123456789012345678901234567890" << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << spyf77::sFile6[ blkcom::nIStep - 1 ].substr(0, 80) << std::endl;
+ utilities::window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ if(blkcom::nM4Plot != 1) {
+ blkcom::nKill = 79;
+ blkcom::sLStat[ 18 ] = 1218;
+ } else {
+ spyf77::sProm80 = " Send corrected card (spy, stop) :";
+ utilities::prompt(*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 6 ]), \
+ spyf77::sProm80);
+ (*reinterpret_cast<std::istream *>(spycom::pMFiles[ 4 ])).read(&spyf77::sBuff77[ 0 ], 80);
+ if(strcom::toLower(spyf77::sBuff77.substr(0, 4)) == "stop")
+ emtp::stoptp();
+ else {
+ if(strcom::toLower(spyf77::sBuff77.substr(0, 4)) == "spy ")
+ spying();
+ else
+ spyf77::sFile6[ blkcom::nIStep - 1 ] = spyf77::sBuff77;
+ }
+ }
+ }
+
+ // subroutine helper.
+ void helper(int &n1)
+ {
+ int k;
+ int n8, n23, n24;
+ //
+ n8 = n1;
+ if(dekplt::sBuffIn.substr(5, 10) != " ")
+ goto a3618;
+
+ a3613:
+ k = spycom::nNumKey + n8 + 1;
+ n23 = spycom::pKBegTX[ k - 1 ];
+ n24 = spycom::pKBegTX[ k ] - 1;
+ goto a3673;
+
+ a3618:
+ if(strcom::toLower(dekplt::sBuffIn.substr(6, 10)) != "outer")
+ goto a3622;
+ n8 = 1;
+ goto a3613;
+
+ a3622:
+ if(strcom::toLower(dekplt::sBuffIn.substr(6, 11)) != "middle")
+ goto a3627;
+ n8 = 2;
+ goto a3613;
+
+ a3627:
+ if(strcom::toLower(dekplt::sBuffIn.substr(6, 10)) != "inner")
+ goto a3634;
+ n8 = 3;
+ goto a3613;
+
+ a3634:
+ n23 = spycom::pKBegTX[ spycom::nNumKey ];
+ n24 = spycom::pKBegTX[ spycom::nNumKey + 4 ] - 1;
+
+ // To do.
+ a3673:
+ ;
+ }
+
+ // subroutine timval.
+ void timval(void)
+ {
+ // To do.
+ }
+
+ // subroutine back14.
+ void back14(void)
+ {
+ // To do.
+ }
+
+ // subroutine setrtm.
+ void setrtm(void)
+ {
+ // To do.
+ }
+
+ // subroutine flatbd.
+ void flatbd(void)
+ {
+ // To do.
+ }
+
+}
+
+// end of file over20.cpp
diff --git a/sources/over51.cpp b/sources/over51.cpp
new file mode 100644
index 0000000..601a25b
--- /dev/null
+++ b/sources/over51.cpp
@@ -0,0 +1,147 @@
+//-*- mode: c++; indent-tabs-mode: nil; coding: utf-8; show-trailing-whitespace: t -*-
+
+// file over51.cpp
+
+#include "over51.hpp"
+
+namespace over51 {
+
+ // subroutine over51.
+
+ void over51(void)
+ {
+ double nVMin;
+ double nVMax;
+ //
+ if (blkcom::nIprsUp >= 1)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Begin \"over51\". kill = " << blkcom::nKill << std::endl << std::flush;
+ date_time::runtym(nVMin, nVMax);
+ blkcom::sFLStat[ 8 ] = nVMin - blkcom::sFLStat[ 8 ];
+ blkcom::sFLStat[ 9 ] = nVMax - blkcom::sFLStat[ 9 ];
+ if (blkcom::nKill == 0)
+ goto a4521;
+ subr51 ();
+ goto a4536;
+
+ a4521:
+ blkcom::nLastOV = blkcom::nChain;
+ blkcom::nChain = 55;
+
+ a4536:
+ if (blkcom::nIprsUp >= 1)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Exit module \"over51\"." << std::endl << std::flush;
+ }
+
+ // subroutine subr51.
+
+ void subr51 (void)
+ {
+ //
+ // Note. --- As the structure of the EMTP error overlays change,
+ // the following assignments may have to be altered ...
+ // nfrfld ---- total number of error overlays
+ // kpen(j) ---- storage for the highest kill-code
+ // number handled by error overlay
+ // number 50+j , for all but the
+ // last error overlay.
+ int i;
+ int j;
+ int nKSat;
+ //
+ double nD1;
+ double nVMin;
+ double nVMax;
+ //
+ size_t pKPen[ 5 ] = { 50, 90, 150, 200 };
+ //
+ try {
+ blkcom::nNFrFld = 5;
+ if(blkcom::nIprsUp >= 1)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Begin \"subr51\". kill = " << blkcom::nKill << std::endl << std::flush;
+ if ((blkcom::nKill == 99) && blkcom::sLStat[ 18 ] == 11111)
+ emtp::stoptp ();
+ pKPen[ blkcom::nNFrFld ] = std::numeric_limits<size_t>::max ();
+ date_time::runtym (nVMin, nVMax);
+ blkcom::sFLStat[ 8 ] = nVMin - blkcom::sFLStat[ 8 ];
+ if (blkcom::pIpnTV[ 0 ] != -8888)
+ goto a1643;
+ if (blkcom::nKill == 38)
+ blkcom::sFLStat[ 12 ] = 1.0;
+ if (blkcom::nKill == 41)
+ blkcom::sLStat[ 10 ] = 1;
+ if (blkcom::nKill == 43)
+ blkcom::sFLStat[ 12 ] = 1.0;
+ if ((blkcom::nKill - 1) != blkcom::pIpnTV[ 2 ])
+ goto a1643;
+ blkcom::pIpnTV[ 2 ] = blkcom::nKill;
+ goto a1649;
+
+ a1643:
+ if (blkcom::nLastOV >= blkcom::nChain)
+ goto a1649;
+ blkcom::nNOutPR = 0;
+ emtp::interp ();
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " " << std::endl << std::flush;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::string (132, '-') << std::endl << std::flush;
+ for (i = 1; i <= 2; i++) {
+ for (j = 1; j <= 22; j++)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "error/";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::endl;
+ }
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::flush;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::string (132, '-') << std::endl << std::flush;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "0You lose, fella. The EMTP logic has detected an error condition, and is going to terminate your run. The following\n";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " printout message summarizes the data difficulty leading to this program decision. By studying this message, the problem\n";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " data, and the rules delineated by the 840-page EMTP rule book, it is hoped that the user can rectify the problem.\n";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " If still in doubt after some study, come see program maintenance for assistance.\n" << std::flush;
+ blkcom::sTexCol = blkcom::sABuff.str ().substr (0, 80);
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Where an otherwise-unidentified card is referred to, or is called the 'last' card, this means the most-recently-\n";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " read card of the input data deck. The 80-column card image in question is the last one printed out before this\n";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " termination message. A copy follows.... " << blkcom::sTexCol << std::endl << std::flush;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::string (14, ' ') << "kill code number" << std::string (16, ' ') << "overlay number " << std::string (10, ' ') << "nearby statement no.\n" << blkcom::nKill << " " << blkcom::sLStat[ 17 ] << " " << blkcom::sLStat[ 18 ] << std::endl << std::flush;
+
+ a1649:
+ for(j = 1; j <= blkcom::nNFrFld; j++) {
+ if(blkcom::nKill > pKPen[ j - 1 ])
+ goto a1658;
+ if(j == 1)
+ goto a1684;
+ blkcom::nLastOV = blkcom::nChain;
+ blkcom::nChain = 50 + j;
+ if(blkcom::nIprsUp >= 1)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Error overlay found. kill, j, kpen(j), nchain = " << blkcom::nKill << " " << j << " " << pKPen[ j - 1 ] << " " << blkcom::nChain << std::endl << std::flush;
+ goto a9000;
+ }
+
+ a1658:
+ ;
+
+ a1684:
+ ;
+
+ switch (blkcom::nKill) {
+ case 1:
+ throw emtp::storage_exceeded_error();
+ break;
+
+ case 60:
+ throw emtp::dummy_function_called_error();
+ break;
+ }
+ }
+ catch (const std::runtime_error &e) {
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 0 ])) << e.what () << std::endl << std::flush;
+ }
+
+ blkcom::nLastOV = blkcom::nChain;
+ blkcom::nChain = blkcom::nNFrFld + 50;
+ if (blkcom::nIprsUp >= 1)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Exit \"subr51\". nchain, kill = " << blkcom::nChain << " " << blkcom::nKill << std::endl << std::flush;
+
+ a9000:
+ return;
+ }
+
+}
+
+// end of file over51.f90
diff --git a/sources/plot.cpp b/sources/plot.cpp
new file mode 100644
index 0000000..34d8d1b
--- /dev/null
+++ b/sources/plot.cpp
@@ -0,0 +1,172 @@
+//-*- mode: c++; indent-tabs-mode: t; coding: utf-8; show-trailing-whitespace: t -*-
+
+// file plot.cpp
+
+#include "plot.hpp"
+
+namespace plot {
+
+ // subroutine sysplt.
+ void sysplt(void *pLUnit4)
+ {
+ // To do.
+ }
+
+ // subroutine rtmplt.
+ void rtmplt(void)
+ {
+ // To do.
+ }
+
+ // subroutine tpplot.
+ void tpplot(void)
+ {
+ // To do.
+ }
+
+ // subroutine pltvar.
+ void pltvar(void)
+ {
+ // To do.
+ }
+
+ // subroutine chrplt.
+ void chrplt(void)
+ {
+ // To do.
+ }
+
+ // subroutine tekplt.
+ void tekplt(void)
+ {
+ // To do.
+ }
+
+ // subroutine tgrid.
+ void tgrid(int nIX, int nIY, int nNX, int nIDelX, int nNY, int nIDelY, int nLDash)
+ {
+ // To do.
+ }
+
+ // subroutine pltfil.
+ void pltfil(const long int &k)
+ {
+ // Installation-dependent module which is called for
+ // output-vector dumping by "subts3" and "over20" if
+ // "m4plot" of /blank/ is nonzero. This
+ // is alternative to conventional in-line dumping on disk.
+ // Module should be universal for computers using fortran 77
+ // compilers and real*4 variables which give single precision.
+ int j;
+ int ll10;
+ int n7, n13, n17 = 0;
+ //
+ if(blkcom::nM4Plot == 1)
+ goto a7286;
+ if(k <= 450)
+ goto a7273;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " ^^^^^^^^^^^^^^^ Error stop in \"pltfil\" ^^^^^^^^^^^^^^\n";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " ^^^^^^ too many output variables (\n";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw (3) << k;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " ) for use real*4 plot file. limit = 450." << std::endl << std::flush;
+ emtp::stoptp();
+
+ a7273:
+ for (j = 1; j <= k; j++) {
+ spycom::pForByt[ j - 1 ] = labcom::sVoltI[ j - 1 ];
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 3 ])) << spycom::pForByt[ j - 1 ];
+ }
+ goto a9000;
+
+ a7286:
+ if (blkcom::nIprsUp >= 3) {
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Top of \"pltfil\". indub, mflush, k, limbuf, newvec, numcrd = ";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw (10) << spycom::nIndBuf << spycom::nMFlush << k << spycom::nLimBuf << spycom::nNewVec << spycom::nNumCRD;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "\n ";
+ for (std::vector<double>::iterator nI = labcom::sVoltI.begin (); nI != labcom::sVoltI.end (); nI++)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw (13) << std::setprecision (4) << *nI;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::endl << std::flush;
+ }
+ n7 = 0;
+ if(spycom::nIndBuf > 0)
+ goto a7308;
+ spycom::nMFlush = 0;
+ spycom::nIndBeg = blkcom::pSStat -> m_nTLabl + 51;
+ spycom::nIndBuf = spycom::nIndBeg;
+ spycom::nNewVec = spycom::nIndBuf + 1;
+
+ a7308:
+ if((spycom::nIndBuf + k) <= spycom::nLimBuf)
+ goto a7374;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " % % % % % % Suspended simulation; plot data space exhausted; use spy. indbuf, limbuf =";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw (8) << spycom::nIndBuf << spycom::nLimBuf << std::endl << std::flush;
+ (*reinterpret_cast<std::ostream *>(spycom::pMFiles[ 5 ])) << " % % % % % % Suspended simulation; plot data space exhausted; use spy. indbuf, limbuf =";
+ (*reinterpret_cast<std::ostream *>(spycom::pMFiles[ 5 ])) << std::setw (8) << spycom::nIndBuf << spycom::nLimBuf << std::endl << std::flush;
+ utilities::window(*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " % % Time-sharing disabled. Send user-keyed interrupt to silence alarm." << std::endl << std::flush;
+ utilities::window(*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ ll10 = 10;
+ utilities::honker(ll10);
+ n13 = spycom::nKBreak;
+ spycom::nLockBR = 1;
+ blkcom::nLastOV = 9911;
+ over20::emtspy();
+ goto a7308;
+
+ a7374:
+ for(j = 1; j <= k; j++) {
+ ++spycom::nIndBuf;
+ spycom::pPltBuf[ spycom::nIndBuf - 1 ] = labcom::sVoltI[ j - 1 ];
+ }
+ ++n17;
+ if(n17 < spycom::nKSlowR)
+ goto a9000;
+ n17 = 0;
+ if(spycom::nMonitR == 0)
+ goto a7396;
+ plot::tekplt();
+ if(spycom::nMonitR != 8765)
+ goto a7396;
+ over20::timval();
+ spycom::nMonitR = 1;
+
+ a7396:
+ if (spycom::nMonitS != 0)
+ plot::chrplt();
+
+ a9000:
+ if (blkcom::nIprsUp >= 4)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Exit \"pltfil\"." << std::endl << std::flush;
+ }
+
+ // subroutine pltlu2.
+ void pltlu2(double *d2, std::vector<double> *pVoltI)
+ {
+ // called by "tacs2" only, if and only if m4plot .ne. 0
+ // this module is universal for fortran 77 compilers and
+ // computers for which real*4 corresponds to single precision.
+ int j;
+ int n12;
+ //
+ std::vector<double> sForByt(150, 0.0);
+ //
+ if(blkcom::nIofgnd > 149)
+ emtp::stoptp();
+ n12 = blkcom::nIofgnd + 1;
+ for(std::vector<double>::iterator nI = sForByt.begin(); nI != sForByt.begin() + n12; nI++)
+ (*reinterpret_cast<std::fstream *>(blkcom::pLFiles[ 1 ])) >> *nI;
+ *d2 = sForByt[ 0 ];
+ for(j = 1; j <= blkcom::nIofgnd; j++)
+ (*pVoltI)[ j - 1 ] = sForByt[ j ];
+ if(blkcom::nIprsUp >= 1) {
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Exit \"pltlu2\". d2, volti(1, iofgnd) =";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(14) << std::setprecision(5) << *d2 << (*pVoltI)[ 0 ] << (*pVoltI)[ blkcom::nIofgnd - 1 ] << std::endl << std::flush;
+ }
+ }
+
+
+}
+
+// end of file plot.cpp
diff --git a/sources/random.cpp b/sources/random.cpp
new file mode 100644
index 0000000..749a5fe
--- /dev/null
+++ b/sources/random.cpp
@@ -0,0 +1,236 @@
+//-*- mode: c++; indent-tabs-mode-nil; coding: utf-8; show-trailing-whitespace: t -*-
+
+// file random.cpp
+
+#include "random.hpp"
+
+namespace randomize {
+ // Variables.
+
+ // Functions.
+ double seedy(std::string *atim)
+ {
+ //
+ // This function is designed to take the time of day (wall-clock
+ // time) in bcd form as input, and return the number of seconds
+ // since midnight as output. The time of day is assumed to be
+ // coded in words atim(1) and atim(2) , as found by a call to
+ // subroutine 'time44' . The storage here is in format 2a4 ,
+ // with the first four characters of 'hh.mm.ss' assumed to be
+ // in atim(1) , and the last four in atim(2) .
+ //
+ //
+ int amin;
+ int hour;
+ int ihr, imin, imin10, imin1, isec;
+ int sec;
+ double nReturnValue;
+ //
+ if (atim) {
+ if (0 < sscanf(atim[ 0 ].c_str(), "%2d %1d", &ihr, &imin10)) {
+ if (0 < sscanf(atim[ 1 ].c_str(), "%1d %2d", &imin1, &isec)) {
+ imin = imin10 * 10 + imin1;
+ hour = ihr * 3600;
+ amin = imin * 60;
+ sec = isec;
+ nReturnValue = sec + amin + hour + 1.0;
+ }
+ }
+ }
+ return nReturnValue;
+ }
+
+ double randnm(const double &x)
+ {
+ //
+ // This is a random number generating function, whose purpose is to
+ // return with a value for a random variable which is uniformly-
+ // distributed over the interval from zero to unity.
+ // A typical call is y = randnm(x) , where 'x' is a
+ // floating-point variable which is present only because 'random'
+ // number-generating algorithms are never truly random, and generally
+ // require some sort of 'random' initialization to even get started.
+ // Since such number-generating algorithms are actually cyclic if a
+ // large enough sampling is taken, it is also desirable to
+ // re-initialize the algorithm periodically, by means of a 'random'
+ // external input. Variable 'x' is this 'random' input, whose
+ // purpose is to randomly re-initialize the algorithm, as follows ...
+ // 1. If 'x' is identically zero, there is no initialization.
+ // the next random number is simply returned through the
+ // function name.
+ // 2. If 'x' is positive, the random number generating
+ // algorithm is to be initialized. EMTP usage has 'x'
+ // as the wall-clock time in seconds since midnight, an
+ // integer (though stored in floating-point mode, note).
+ // In this case, no random number need be returned with the
+ // function name, since the emtp will not use it.
+ // If a non-cdc user has access to a random number generating
+ // function which does not require initialization, he may simply
+ // ignore 'x' , and return the random number through the function
+ // name every time this module is called.
+ //
+ // A minus sign appended to variable 'xmaxmx' of /blank/ is a
+ // flag that the user wants to employ the standard table of random
+ // numbers which is built into module 'sandnm' .
+ //
+ // Installation-dependent emtp module written for the dec
+ // VAX-11/780. 'ran' is a DEC system subroutine which
+ // returns a random number uniformly distributed over (0, 1) .
+ long int *pKnt;
+ long int n14;
+ double nReturnValue = 0.0;
+ //
+ pKnt = &blkcom::sMonCar.m_nKnt;
+ if (blkcom::nXMaxMX >= 0.0) {
+ if (x != 0.0) {
+ if (*pKnt > 1)
+ return nReturnValue;
+ n14 = (int) x;
+ if (n14 / 2 * 2 == n14)
+ ++n14;
+ }
+ nReturnValue = rand() % n14;
+ return nReturnValue;
+ }
+ nReturnValue = sandnm(x);
+ return nReturnValue;
+ }
+
+ double sandnm(const double &x)
+ {
+ // This version of 'randnm' is used for testing of the
+ // statistical overvoltage capability of the EMTP only. It uses
+ // built-in random numbers, so as to produce identical results
+ // on all computer systems, thereby permitting comparative
+ // verification of results exactly as for conventional test cases.
+ // In order to avoid re-use of random numbers, the number of
+ // energizations 'nenerg' times the number of switches 'kswtch'
+ // must not exceed the dimension of array 'a' .
+ // If 'statistics' miscellaneous data parameter 'xmaxmx'
+ // is input by the user with negative value, the EMTP takes
+ // this to mean that "sandnm" is to be used for random
+ // numbers rather than "randnm" .
+ long int *pKnt;
+ long int l = 0;
+ long int n1;
+ double a[ 100 ] = {
+ .1445312506618,
+ .8477795260409,
+ .8267723125831,
+ .6660710406131,
+ .7152322826372,
+ .3239128029543,
+ .5051959208554,
+ .3805491872180,
+ .5609474043286,
+ .5996361115942,
+ .4159594349328,
+ .6756609755246,
+ .0995378032610,
+ .6033780421273,
+ .4515533431030,
+ .0020932062778,
+ .9161858062074,
+ .3434229008090,
+ .7876940045781,
+ .2760908032985,
+ .3665660303205,
+ .8204300122029,
+ .2413831265551,
+ .1246653115746,
+ .2802441882439,
+ .0466535013838,
+ .4742772736449,
+ .9477027545777,
+ .2260144770748,
+ .2987460629005,
+ .5203589181526,
+ .8981967037721,
+ .3873885562436,
+ .5780913804991,
+ .1280852320759,
+ .3327754064471,
+ .4043867414456,
+ .9490362532099,
+ .6261391859471,
+ .3291406705415,
+ .3366864607083,
+ .9438413593777,
+ .9369008057740,
+ .0713971670442,
+ .6500854844946,
+ .9737952005663,
+ .6485758973471,
+ .7724301318424,
+ .9676692044394,
+ .5163953619955,
+ .5788464270596,
+ .7758933795560,
+ .0910635448877,
+ .0439510552688,
+ .0707223001462,
+ .9379043319315,
+ .0052391978463,
+ .9420572226295,
+ .5932597508799,
+ .6466146627873,
+ .4395400252824,
+ .1972895298303,
+ .5017482047726,
+ .1503404202877,
+ .9624699228977,
+ .0098276069324,
+ .6571365402082,
+ .4233003554891,
+ .1203194365765,
+ .7436871629477,
+ .8136524161969,
+ .7311319136405,
+ .0594772166524,
+ .2374863512189,
+ .2450459940689,
+ .4326371816340,
+ .3562832359564,
+ .3723442477773,
+ .1694432139356,
+ .3735622812899,
+ .0610718353086,
+ .2782657746530,
+ .5137050416289,
+ .4340395038268,
+ .5766543446808,
+ .4413641042052,
+ .9812390285872,
+ .2625281459037,
+ .9554345097074,
+ .4741647690234,
+ .9906793757886,
+ .7820837820369,
+ .2206664815389,
+ .0901816247992,
+ .7625227133400,
+ .4434728419824,
+ .7905859532294,
+ .9796097207935,
+ .7599602497147,
+ .1154361048406
+ };
+ double nReturnValue;
+ //
+ pKnt = &blkcom::sMonCar.m_nKnt;
+ if (x != 0.0)
+ l = (*pKnt - 1) * blkcom::nKSwtch + 1;
+ else
+ ++l;
+ n1 = (l - 1) / 100;
+ if (blkcom::nIprsUp >= 1)
+ (*reinterpret_cast<std::ostream *> (blkcom::pLFiles[ 5 ])) << std::endl << " Variables in 'sandnm', the random number generator with 100 built-in numbers. l knt kswtch n1 , x" << std::endl << std::string(82, ' ') << l << *pKnt << blkcom::nKSwtch << n1 << x << std::endl;
+ if (n1 > 0)
+ l -= 100 * n1;
+ nReturnValue = a[ l - 1 ];
+ return nReturnValue;
+ }
+
+}
+
+// end of file random.cpp
diff --git a/sources/strcom.cpp b/sources/strcom.cpp
new file mode 100644
index 0000000..f885d77
--- /dev/null
+++ b/sources/strcom.cpp
@@ -0,0 +1,33 @@
+//-*- mode: c++; indent-tabs-mode: t; coding: utf-8; show-trailing-whitespace: t -*-
+
+// file strcom.cpp
+
+#include "strcom.hpp"
+
+namespace strcom {
+
+ std::string toLower (const std::string &s)
+ {
+ std::string sTemp = s;
+ //
+ std::for_each (sTemp.begin (), sTemp.end (), [](char &c)
+ {
+ c = std::tolower (c);
+ });
+ return sTemp;
+ }
+
+ std::string toUpper (const std::string &s)
+ {
+ std::string sTemp = s;
+ //
+ std::for_each (sTemp.begin (), sTemp.end (), [](char &c)
+ {
+ c = std::toupper (c);
+ });
+ return sTemp;
+ }
+
+}
+
+// end of file strcom.cpp
diff --git a/sources/tacsar.cpp b/sources/tacsar.cpp
new file mode 100644
index 0000000..65a6bb4
--- /dev/null
+++ b/sources/tacsar.cpp
@@ -0,0 +1,52 @@
+//-*- mode: c++; indent-tabs-mode: t; coding: utf-8; show-trailing-whitespace: t -*-
+
+// file tacsar.cpp
+
+#include "tacsar.hpp"
+
+namespace tacsar {
+
+ int nIColCS;
+ int nIlnTab;
+ int nInSup;
+ int nIsBlk;
+ int nIuty;
+ int nIVarB;
+ int nJOut;
+ int nKaliu;
+ int nKalksu;
+ int nKatcs;
+ int nkawkcs;
+ int nKColCS;
+ int nKInSup;
+ int nKIsBlk;
+ int nKiuty;
+ int nKIVarB;
+ int nKJOut;
+ int nKksus;
+ int nKlnTab;
+ int nKofsce;
+ int nKoncur;
+ int nKonsce;
+ int nKOnSup;
+ int nKOnTot;
+ int nKPRSup;
+ int nKRSBlk;
+ int nKSPVar;
+ int nKsus;
+ int nKud1;
+ int nKxar;
+ int nKxtcs;
+ //
+ double nAtcs;
+ double nAwks;
+ double nParsup;
+ double nRsblk;
+ double nSptacs;
+ double nUd1;
+ double nXar;
+ double nXtcs;
+
+}
+
+// end of file tacsar.cpp
diff --git a/sources/time.cpp b/sources/time.cpp
new file mode 100644
index 0000000..d8622ea
--- /dev/null
+++ b/sources/time.cpp
@@ -0,0 +1,153 @@
+//-*- mode: c++; indent-tabs-mode: t; coding: utf-8; show-trailing-whitespace: t -*-
+
+// file time.cpp
+
+#include "time.hpp"
+
+extern long int spycom::nKWTSpy;
+
+namespace date_time {
+
+ std::clock_t nCPUTime;
+
+ bool date44(std::string *a)
+ {
+ // The purpose of subroutine DATE44 is to interrogate the
+ // installation calendar, and return the current date through the
+ // argument of the subroutine. Eight BCD characters are allowed,
+ // with the first (left) four characters to be placed in a(1) ,
+ // and the final (right) four placed in a(2) . A statement like
+ // write (lunit6, 4041) a
+ // 4041 format ( 1x, 2a4 )
+ // Thus outputs the current date as first the month, then the day,
+ // and finally the year, separated by slashes (MM/DD/YY) .
+ // subroutine DATE44 is of course installation dependent.
+ // European (or generally non-United-States, perhaps) users of this
+ // program may want to reverse the order of appearance of the month
+ // and the day, in conformity with established european usage.
+ // Installation-dependent EMTP module written for the DEC
+ // VAX-11/780. 'IDATE' is a DEC system subroutine which
+ // returns the month, day, and year (of century) as three integer*2
+ // numerical values.
+ bool bReturnValue = false;
+ int year, decade;
+ std::stringstream ss;
+ std::time_t sCurrentTime;
+ std::tm *pLocalTime;
+
+ if(a) {
+ sCurrentTime = std::time(NULL);
+ pLocalTime = std::localtime(&sCurrentTime);
+ if(pLocalTime) {
+ ss << std::setfill('0') << std::setw(2) << (1 + pLocalTime -> tm_mon);
+ ss << ".";
+ ss << std::setfill('0') << std::setw(2) << pLocalTime -> tm_mday;
+ ss << ".";
+ year = pLocalTime -> tm_year + 1900;
+ decade = 100 * (((float) year) / 100.0 - (float) floor (year / 100.0));
+ ss << std::setfill('0') << std::setw(2) << decade;
+ a[ 0 ] = ss.str().substr(0, 4);
+ a[ 1 ] = ss.str().substr(4, 8);
+ bReturnValue = true;
+ }
+ }
+ return bReturnValue;
+ }
+
+ bool time44(std::string *a)
+ {
+ // The purpose of subroutine TIME44 is to interrogate the
+ // installation clock, and return the wall-clock time through the
+ // argument of the subroutine. Eight BCD characters are allowed,
+ // with the first (left) four characters to be placed in a(1) ,
+ // and the final (right) four placed in a(2) . A statement like
+ // write (lunit6, 4041) a
+ // 4041 format ( 1x, 2a4 )
+ // Thus outputs the wall-clock time as first hours, then minutes,
+ // and finally seconds, separated by periods (HH.MM.SS) .
+ // subroutine TIME44 is of course installation dependent.
+ // Installation-dependent EMTP module written for the DEC
+ // VAX-11/780. 'TIME' is a DEC system subroutine which
+ // returns the wall-clock time as an 8-byte character string.
+ // This is just what the EMTP needs, except that we want periods
+ // rather than colons, and of course we require 2a4 format.
+ bool bReturnValue = false;
+ std::stringstream ss;
+ std::time_t sCurrentTime;
+ std::tm *pLocalTime;
+
+ if(a) {
+ sCurrentTime = std::time(NULL);
+ pLocalTime = std::localtime(&sCurrentTime);
+ if(pLocalTime) {
+ ss << std::setfill('0') << std::setw(2) << pLocalTime -> tm_hour;
+ ss << ".";
+ ss << std::setfill('0') << std::setw(2) << pLocalTime -> tm_min;
+ ss << ".";
+ ss << std::setfill('0') << std::setw(2) << pLocalTime -> tm_sec;
+ a[ 0 ] = ss.str().substr(0, 4);
+ a[ 1 ] = ss.str().substr(4, 8);
+ bReturnValue = true;
+ }
+ }
+ return bReturnValue;
+ }
+
+ void settym(void)
+ {
+ // VAX-11 Installation-dependent EMTP module.
+ // Called only by VAX "RUNTYM"; destroy for other computers.
+ // Include '[SCOTT]COMMUK.FOR' --- share with "RUNTYM" in-line:
+ date_time::nCPUTime = std::clock ();
+ }
+
+ void runtym(double &d1, double &d2)
+ {
+ // This subroutine returns with the current job-execution time, as
+ // broken down into two categories ....
+ // d1 = central processor job time, in seconds
+ // d2 = peripheral processor (or input/output) job time,
+ // in seconds.
+ // If two such figures are not available ont the user's computre,
+ // 'd2' should be set to zero so that case-summary statistics
+ // will not print out garbage values. Such is the only use of
+ // the values gotten by calling this subroutine ---- for the case-
+ // summary printout. Hence if one wants to convert time into
+ // dollars, or some other measure of job effort, it is easily done.
+ // Include '[SCOTT]COMMUK.FOR' --- share with "SETTYM" in-line:
+ std::clock_t nNowCPUTime;
+ //
+ nNowCPUTime = std::clock ();
+ d1 = std::difftime (date_time::nCPUTime, nNowCPUTime) / CLOCKS_PER_SEC;
+ d2 = 0.0;
+ }
+
+ // subroutine tdelay.
+
+ void tdelay(int &d8)
+ {
+ // Module of interactive EMTP only, which services "emtspy".
+ // If no interactive use, this module can be deleted.
+ // VAX-11 module designed to stall for d8 seconds.
+ // Present use of disk writes is temporary only, and should
+ // later be replaced by a less-wasteful, true hibernation.
+ clock_t sNow = clock();
+ //
+ int nDelay; // integer number of seconds for hibernation
+ //
+ nDelay = d8 * CLOCKS_PER_SEC;
+ while((clock() - sNow) < nDelay) { // loop once for each second of delay
+ utilities::quiter(); // check for user-keyed interrupt signal
+ if (spycom::nKWTSpy == 0) { // no user abort of alarm
+ ;
+ } else {
+ spycom::nKWTSpy = 0; // reset interrupt indicator as we begin service
+ d8 = -7654; // argument flag remembering abort (for honker)
+ break; // jump out of time-delay loop, to return
+ }
+ }
+ }
+
+}
+
+// end of file time.cpp
diff --git a/sources/umdeck.cpp b/sources/umdeck.cpp
new file mode 100644
index 0000000..90f0a83
--- /dev/null
+++ b/sources/umdeck.cpp
@@ -0,0 +1,32 @@
+//-*- mode: c++; indent-tabs-mode: t; coding: utf-8; show-trailing-whitespace: t -*-
+
+// file umdeck.cpp
+
+#include "umdeck.hpp"
+
+namespace umcom {
+
+ int nSRoot2;
+ int nSRoot3;
+ int nOmegRF;
+ int nInpu;
+ int nNumBus;
+ int nNCLTot;
+ int nInitUM;
+ //
+ int pPTheta[ 3 ][ 3 ];
+ int pZTheVR[ 3 ][ 3 ];
+ int pVInp[ 40 ];
+ int pZTheVs[ 40 ];
+ int pUmCur[ 40 ];
+ int pCon[ 10 ];
+ int pDumVec[ 40 ];
+ int pDumMat[ 3 ][ 3 ];
+ int pDate[ 2 ];
+ int pClock[ 2 ];
+ int pNDum[ 40 ];
+ //
+ std::string pBUSUM[ 50 ];
+}
+
+// end of file umdeck.cpp
diff --git a/sources/utilities.cpp b/sources/utilities.cpp
new file mode 100644
index 0000000..82544a5
--- /dev/null
+++ b/sources/utilities.cpp
@@ -0,0 +1,356 @@
+//-*- mode: c++; indent-tabs-mode: t; coding: utf-8; show-trailing-whitespace: t -*-
+
+// file utilities.cpp
+
+#include "utilities.hpp"
+
+//
+
+namespace kwtcom {
+
+ long int nKWTVAX;
+
+}
+
+namespace utilities
+{
+
+#ifdef USE_POSIX
+
+ bool exists(const char *p)
+ {
+ struct stat sb;
+ //
+ return p && (0 == stat (p, &sb));
+ }
+
+#else
+
+ bool exists(const char *p)
+ {
+ bool bReturnValue = false;
+ std::fstream sFile;
+ //
+ if(p) {
+ sFile.open(p, std::ios_base::in);
+ bReturnValue = sFile.is_open();
+ if(bReturnValue)
+ sFile.close();
+ }
+ return bReturnValue;
+ }
+
+#endif
+
+ std::string format(const std::string &format, ...)
+ {
+ va_list args;
+ va_start(args, format);
+ size_t nLength = std::vsnprintf(NULL, 0, format.c_str(), args);
+ va_end (args);
+ std::vector<char> sVector (nLength + 1);
+ va_start (args, format);
+ std::vsnprintf (&sVector[ 0 ], nLength + 1, format.c_str(), args);
+ va_end (args);
+ return &sVector[ 0 ];
+ }
+
+ void quiter(void)
+ {
+ ;
+ }
+
+ // subroutine window.
+ void window(std::ostream &os, std::stringstream &ss)
+ {
+ // Module of interactive emtp usage only, which services "emtspy".
+ // For non-interactive emtp, this module can be destroyed.
+ // For character*132 spy display channel munit6, this serves
+ // to actually output the line to the spy display device.
+ // VAX-11 installation-dependent EMTP module.
+ size_t j;
+ size_t k;
+ std::string sData;
+ //
+ sData = ss.str();
+ if(abs(spycom::nKVerfy) != 34543) {
+ for(j = 1; j <= 132; j++) {
+ k = 133 - j;
+ if(sData[ k - 1 ] != ' ')
+ break;
+ }
+ os << sData.substr(0, k) << std::endl;
+ os.flush();
+ }
+ }
+
+ // subroutine honker.
+ void honker(const long int &nKLevel)
+ {
+ // Module of interactive EMTP only, which services "emtspy".
+ // If no interactive use, this module can be deleted.
+ // VAX-11 installation-dependent emtp module which issues
+ // an audible alarm (via a terminal speaker) of intensity
+ // controlled by argument klevel. This is on a scale of
+ // one to ten, with zero meaning no noise at all, and ten
+ // corresponding to a disaster alert (e.g., air raid sirens).
+ // This VAX-11 module is designed for DEC VT100 terminal. The
+ // idea is by Albert H. Schmidt, BPA route EOGA. At the keyboard,
+ // ctrl-g will ring the bell, and the ascii character 7 is
+ // equivalent within a program. Shortage of 1 bell is due to
+ // carriage control, maybe (see n8 = j + 1, rather than j, below).
+ int nd13;
+ double d13;
+ std::string pSpyTim[ 2 ], pSpDate[ 2 ];
+ //
+ d13 = 2.0;
+ date_time::time44(pSpyTim);
+ date_time::date44(pSpDate);
+ spyf77::sBuff77 = std::string (10, '\7');
+ FOREVER {
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Audible alarm began at ";
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::setw(4) << pSpyTim[ 0 ] << pSpyTim[ 1 ];
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " ";
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::setw(4) << pSpDate[ 0 ] << pSpDate[ 1 ];
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::string(5, ' ');
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << std::setw(3) << spycom::nKLevel;
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " bells.";
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << spyf77::sBuff77 << std::endl << std::flush;
+ window(*reinterpret_cast<std::ostream*>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ if(spycom::nKLevel < 10)
+ break;
+ nd13 = (int) d13;
+ date_time::tdelay(nd13);
+ if(d13 == -7654)
+ break;
+ flager();
+ if(spycom::nKWTSpy != 0) {
+ spycom::nKWTSpy = 0;
+ break;
+ } else
+ d13 = 1.5 * d13;
+ }
+ }
+
+ // subroutine flager.
+ void flager(void)
+ {
+ // Module of interactive EMTP only, which services "emtspy".
+ // if no interactive use, convert to dummy module ("return").
+ // VAX-11 installation-dependent emtp module which serves
+ // to read spy command from munit5 if: 1) ctrl-c interrupt
+ // has occurred, or 2) if lockbr = 1 upon entry.
+ long int pIDum[ 3 ];
+ //
+ if(spycom::nIprSpy >= 10) {
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Top flager. istep, kwtspy, itype, lastov =" << blkcom::nIStep << blkcom::nKWTSpy << blkcom::nIType << blkcom::nLastOV << std::endl;
+ window(*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ }
+ if(blkcom::nLastOV == 9911) {
+ spyf77::sBuff77 = "space";
+ blkcom::nKWTSpy = 1;
+ spycom::nKFile5 = 2;
+ goto a3651;
+ }
+ if(kwtcom::nKWTVAX != 0) {
+ spyf77::sProm80 = " spy:";
+ prompt(*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ]), \
+ spyf77::sProm80);
+ //
+ if (spycom::nIprSpy < 1)
+ (*reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ])) << " Enable VAX ctrl-c interception in \"flager\"." << std::endl;
+ window(*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+
+ a3491:
+ goto a3643;
+ }
+ if((spycom::nLockBR != 1) || (spycom::nKFile5 == 1))
+ goto a3651;
+
+ a3643:
+ reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 4 ]) -> read(&spyf77::sBuff77[ 0 ], 80);
+ blkcom::nKWTSpy = 1;
+ spycom::nKFile5 = 2;
+ if(spycom::nKSPSav == 0)
+ goto a3650;
+ if(strcom::toLower(spyf77::sBuff77.substr(0, 7)) == "cancel ")
+ goto a3648;
+ ++spycom::nKSPSav;
+ goto a3643;
+
+ a3648:
+ --spycom::nKSPSav;
+ if (spycom::nKSPSav > spycom::nNumCRD)
+ goto a3649;
+ std::cout << " Error stop; overflow in \"flager\"." << std::endl;
+ emtp::stoptp();
+
+ a3649:
+ spyf77::sFile6[ spycom::nKSPSav - 1 ] = spyf77::sBuff77;
+
+ a3650:
+ goto a3651;
+
+ a3651:
+ if (spycom::nIprSpy >= 9) {
+ *((std::stringstream *) spycom::pMFiles[ 5 ]) << " Exit \"flager\". kwtspy =" << blkcom::nKWTSpy << " buff77 = " << spyf77::sBuff77.substr(0, 80) << std::endl;
+ window(*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ]), \
+ *reinterpret_cast<std::stringstream *>(spycom::pMFiles[ 5 ]));
+ }
+ }
+
+ // subroutine prompt.
+ void prompt(std::ostream &os, const std::string &sPrompt)
+ {
+ // VAX-11 installation-dependent emtp module used only
+ // for interactive EMTP ("emtspy"). Input is program
+ // prompt in character*80 variable prom80 of deck "dekspy".
+ // The prompt must end with colon (":"). Then line feed
+ // will be suppressed, so subsequent read is to right of ":".
+ // For non-interactive EMTP, this module can be destroyed.
+ long int j;
+ long int n2;
+ //
+ n2 = 80;
+ for(j = 1; j <= 80; j++) {
+ if(sPrompt[ n2 - 1 ] == ' ')
+ break;
+ --n2;
+ }
+ os << sPrompt.substr(0, n2);
+ }
+
+ // subroutine openfile.
+ bool openFile(std::fstream *pFile, \
+ std::string &sFileName, \
+ const std::ios::openmode &mode)
+ {
+ bool bReturnValue = false;
+ //
+ if(pFile) {
+ pFile -> open(sFileName.c_str(), mode);
+ bReturnValue = pFile -> good();
+ }
+ return bReturnValue;
+ }
+
+ // subroutine closefile.
+ bool closeFile(std::fstream *pFile)
+ {
+ bool bReturnValue = false;
+ //
+ if(pFile) {
+ pFile -> close();
+ bReturnValue = true;
+ }
+ return bReturnValue;
+ }
+
+ // subroutine copyfile.
+ bool copyFile(std::fstream *pInFile, \
+ std::fstream *pOutFile, \
+ const std::string &sFileName)
+ {
+ bool bReturnValue = false;
+ //
+ if(pInFile && pOutFile) {
+ pOutFile -> close();
+ pOutFile -> open(sFileName.c_str(), std::ios::out | std::ios::trunc);
+ pInFile -> seekg(0, std::ios::beg);
+ char pTempData[ 80 ];
+ while(!pInFile -> eof()) {
+ pInFile -> read(pTempData, 80);
+ pOutFile -> write(pTempData, 80);
+ }
+ pOutFile -> close();
+ pInFile -> seekg(0, std::ios::beg);
+ bReturnValue = true;
+ }
+ return bReturnValue;
+ }
+
+ // subroutine deletefile.
+ bool deleteFile(const std::string &sFileName)
+ {
+ ;
+ }
+
+ struct winsize getTerminalSize(void)
+ {
+ struct winsize sReturnValue;
+ //
+ ioctl(STDOUT_FILENO, TIOCGWINSZ, &sReturnValue);
+ if(blkcom::nNOutPR > 0) {
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Terminal lines = ";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(8) << std::dec << sReturnValue.ws_row;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << ", columns = ";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(8) << std::dec << sReturnValue.ws_col << std::endl;
+ }
+ return sReturnValue;
+ }
+
+ void expchk(long int &n1, \
+ long int &n2, \
+ long int &n5)
+ {
+ const char cText1 = 'e', cTextN = '-', cTextP = '+';
+ const char pTexNum[ 11 ] = { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '.' };
+ char pX[ 80 ];
+ //
+ long int i;
+ long int j;
+ long int k;
+ long int l;
+ long int n3, n4;
+ long int nKey;
+ //
+ blkcom::sABuff.read(pX, 80);
+ for(i = n1; i <= n2; i += n5) {
+ nKey = 0;
+ for(j = 1; j <= n5; j++) {
+ n3 = i + j - 1;
+ if(pX[ 2 ] == cText1)
+ goto a2622;
+ if(nKey > 0)
+ goto a2620;
+ for(k = 1; k <= 11; k++) {
+
+ a2619:
+ if(pX[ n3 - 1 ] == pTexNum[ k - 1 ])
+ nKey = k;
+ goto a2621;
+
+ a2620:
+ if((pX[ n3 - 1 ] == cTextP) || (pX[ n3 - 1 ] == cTextN))
+ goto a2622;
+
+ a2621:
+ ;
+ }
+ goto a2625;
+
+ a2622:
+ n4 = i + n5 - 1;
+ for(l = 1; l<= 10; l++) {
+ if(pX[ n4 - 1 ] == pTexNum[ l - 1 ])
+ goto a2625;
+ }
+
+ a2624:
+ blkcom::nKill = 97;
+ blkcom::pSStat -> m_nWT = i;
+ blkcom::pSStat -> m_nTails = n4;
+ blkcom::pSStat -> m_nTACST = 2624;
+ return;
+
+ a2625:
+ ;
+ }
+ }
+ }
+
+}
+// end of file utilities.cpp
diff --git a/sources/vardim.cpp b/sources/vardim.cpp
new file mode 100644
index 0000000..24c485f
--- /dev/null
+++ b/sources/vardim.cpp
@@ -0,0 +1,219 @@
+//-*- mode: c++; indent-tabs-mode: t; coding: utf-8; show-trailing-whitespace: t -*-
+// file vardim.cpp
+
+#include "vardim.hpp"
+
+namespace vardim {
+
+ int pLstDef[] = {
+ 250, 300, 500, 100,
+ 2500, 40, 550, 1750,
+ 75, 160, 50, 50,
+ 5, 460, 50, 40,
+ 4, 5, 1600, 650,
+ 100, 150, 4000, 3,
+ 400, 50, 50, 1080
+ };
+
+ tVariables pVariables[] = {
+ { "x", 3, "c0b001", 0 },
+ { "ykm", 5, "c0b002", 0 },
+ };
+
+ // Functions.
+ bool vardim(int *pLstNew)
+ {
+ bool bReturnValue = false;
+ long int j;
+ long int n1, n4, n9, n37;
+ long int nMTot;
+ long int nNumLst = 28;
+ long int nNumKEx;
+ long int pKExtra[ 29 ];
+ long int pNCBarr[ 300 ];
+ long int pCBlock[ 300 ];
+ long int pJBLTyp[ 300 ];
+ long int pMulVar[ 4 ];
+ std::string sBus1, sBus2;
+ //
+ try {
+ if(pLstNew) {
+ for(int i = 1; i <= nNumLst; i++)
+ (*reinterpret_cast<std::istream *>(blkcom::pLFiles[ 4 ])) >> std::setw(8) >> pLstNew[ i - 1 ];
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "\n Pseudo-listing of data cards";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " which have been read by the variable-";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "dimensioning program 'vardim' . Only\n";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " if all data fields are punched with";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " 'clean' I8 integer information will";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " this be a true listing. Data cards\n";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Are in fact read in and then printed out";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " using integer variables and 10I8";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " format." << std::endl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " " << std::string(111, '-') << std::endl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::string(31, ' ') << "0";
+ for(int i = 1; i <= 8; i++)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::string(9, ' ') << std::setw(1) << i;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::endl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::string(31, ' ') << "0";
+ for(int i = 1; i <= 8; i++)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::string(9, ' ') << "0";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::endl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::string(31, ' ') << std::string(80, '-') << std::endl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " 1st card (lists 1-10)." << std::string(7, ' ') << "1";
+ for(int i = 1; i <= 10; i++)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(8) << pLstNew[ i - 1 ];
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::endl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " 2nd card (lists 11-20)." << std::string(7, ' ') << "1";
+ for(int i = 11; i <= 20; i++)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(8) << pLstNew[ i - 1 ];
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::endl;
+
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " 3rd card (lists 21-30)." << std::string(7, ' ') << "1";
+ for(int i = 21; i <= nNumLst; i++)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(8) << pLstNew[ i - 1 ];
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::endl;
+ if(pLstNew[ 0 ] / 10000000 != 9)
+ goto a5294;
+ for(size_t i = 1; i <= nNumKEx; i++)
+ (*reinterpret_cast<std::istream *>(blkcom::pLFiles[ 4 ])) >> std::setw(8) >> pKExtra[ i - 1 ];
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Supplemental offsets." << std::string(9, ' ') << "1";
+ for(size_t i = 1; i <= nNumKEx; i++)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(8) << pKExtra[ i - 1 ];
+ pLstNew[ 0 ] -= 90000000;
+
+ a5294:
+ if(pLstNew[ 10 ] / 10000000 != 9)
+ goto a5297;
+ n4 = pLstNew[ 10 ] - 90000000;
+ for(size_t j = 1; j <= nNumLst; j++)
+ pLstNew[ j - 1 ] = pLstDef[ j - 1 ] * n4;
+
+ a5297:
+ if(pLstNew[ 0 ] > 0)
+ pLstNew[ 0 ] += 2;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " " << std::string(111, '-') << std::endl;
+ for(size_t i = 1; i < nNumLst; i++) {
+ n1 = i;
+ if(pLstNew[ i - 1 ] >= 1000000)
+ goto a9000;
+ if(pLstNew[ i - 1 ] <= 0)
+ pLstNew[ i - 1 ] = pLstDef[ i - 1 ];
+ }
+ if(pLstNew[ 18 ] <= 23)
+ pLstNew[ 18 ] = 23;
+ if(pLstNew[ 25 ] <= 10)
+ pLstNew[ 25 ] = 10;
+ n1 = pLstNew[ 15 ] / 2;
+ if((2 * n1) != pLstNew[ 15 ])
+ ++pLstNew[ 15 ];
+ n1 = pLstNew[ 26 ] / 2;
+ if(2 * n1 != pLstNew[ 26 ])
+ ++pLstNew[ 26 ];
+ pLstNew[ 50 ] = 6 * pLstNew[ 12 ];
+ pLstNew[ 51 ] = pLstNew[ 50 ] + 1;
+ pLstNew[ 52 ] = pLstNew[ 8 ] + 3 * pLstNew[ 16 ];
+ pLstNew[ 53 ] = 6 * pLstNew[ 1 ];
+ pLstNew[ 54 ] = pLstNew[ 8 ] + pLstNew[ 16 ];
+ pLstNew[ 55 ] = pLstNew[ 1 ] + pLstNew[ 26 ] / 2;
+ pLstNew[ 56 ] = pLstNew[ 0 ] * pLstNew[ 23 ];
+ pLstNew[ 57 ] = 4 * pLstNew[ 11 ];
+ pLstNew[ 58 ] = 2 * pLstNew[ 25 ];
+ pLstNew[ 59 ] = 3 * pLstNew[ 5 ];
+ pLstNew[ 60 ] = 1;
+ pLstNew[ 61 ] = 2 * pLstNew[ 17 ];
+ pLstNew[ 62 ] = 3 * pLstNew[ 5 ];
+ pLstNew[ 63 ] = 4 * pLstNew[ 5 ];
+ pLstNew[ 64 ] = 101 * pLstNew[ 16 ];
+ pLstNew[ 65 ] = 24 * pLstNew[ 16 ];
+ pLstNew[ 66 ] = 12 * pLstNew[ 15 ];
+ pLstNew[ 67 ] = 6 * pLstNew[ 15 ];
+ pLstNew[ 68 ] = 30 * pLstNew[ 16 ];
+ pLstNew[ 69 ] = 5 * pLstNew[ 10 ] + 2;
+ pLstNew[ 70 ] = 2 * pLstNew[ 20 ];
+ pLstNew[ 71 ] = pLstNew[ 7 ] + pLstNew[ 27 ];
+ pLstNew[ 72 ] = pLstNew[ 21 ] + pLstNew[ 20 ];
+ nMTot = 0;
+ for(size_t i = 1; i <= 126; i++) {
+ n9 = pVariables[ i - 1 ].m_nNCB;
+ if((n9 == 0) || (n9 == 98))
+ goto a4301;
+ n37 = 3;
+ sBus1[ 0 ] = pCBlock[ i - 1 ];
+ sBus2 = sBus1[ 0 ];
+ for(j = 1; j <= 6; j++)
+ if(sBus2[ 0 ] == (char) (j - 1))
+ n37 = 4;
+ if(pJBLTyp[ i - 1 ] != 0)
+ n37 = pVariables[ i - 1 ].m_nJBLType;
+ nMTot += pMulVar[ n37 - 1 ] * pLstNew[ n9 - 1 ];
+
+ a4301:
+ ;
+ }
+ bReturnValue = true;
+
+ a9000:
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::endl << std::endl << " ";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " " << std::string(131, '-') << std::endl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " ";
+ for(int i = 1; i <= 22; i++)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ]));
+ for(int i = 1; i << 22; i++)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::string(" Error");
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::endl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " " << std::string(131, '-') << std::endl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::endl << " " << "The user is in trouble,";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " unless he has made a data-punching error.";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Variable-dimensioning of the EMTP has\n";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " " << "broken down within the separate variable";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "-dimensioning program 'vardim' . In";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " particular, one or more of the\n";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " " << "user-inputted list sizes must be";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " rejected as being illegally large. User-";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "supplied limits (or default limits,";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " " << "for any non-positive data";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " fields) are as follows ....\n ";
+ for(size_t i = 1; i < nNumLst; i++)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(10) << pLstNew[ i - 1 ];
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::endl;
+ if(blkcom::pLStat -> m_nTLabl > 0)
+ goto a9061;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " " << "Specifically, the user-";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "supplied value which was read for list";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " number " << n1 << " exceeds 999999 ,\n";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " " << "which is unreal. A value of " << pLstNew[ n1 - 1 ];
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " was read from the user's data card";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " for this list.\n";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " " << std::string(131, '-') << std::endl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " ";
+ for(int i = 1; i <= 22; i++)
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::string(" Error");
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::endl;
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " " << std::string(131, '-') << std::endl;
+ goto a9900;
+
+ a9061:
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " " << "Specifically the user-supplied";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " dimensions have collectively produced a";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " total labeled-common allocation\n";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " " << "of " << blkcom::pLStat -> m_nTLabl << " words, which is unreal.";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " A limit of 9999999 has arbitrarily";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " been imposed by the better judgment";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " " << "of the program. A machine this";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " big (with this much real central memory)";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " is not known to be in existence anywhere\n";
+ (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " in the world.\n";
+
+ a9900:
+ bReturnValue = true;
+ }
+ }
+ catch(std::exception &e) {
+ std::cerr << e.what() << std::endl;
+ }
+ return bReturnValue;
+ }
+
+}
+
+// end of file vardim.cpp
diff --git a/sources/volt45.cpp b/sources/volt45.cpp
new file mode 100644
index 0000000..c4cebf0
--- /dev/null
+++ b/sources/volt45.cpp
@@ -0,0 +1,15 @@
+//-*- mode: c++; indent-tabs-mode: t; coding: utf-8; show-trailing-whitespace: t -*-
+
+// file volt45.cpp
+
+#include "volt45.hpp"
+
+namespace volpri {
+
+ double pVoltI[ 50 ];
+ double pVoltK[ 50 ];
+ double pVIM[ 50 ];
+
+}
+
+// end of file volt45.cpp