From b18347ffc9db9641e215995edea1c04c363b2bdf Mon Sep 17 00:00:00 2001 From: Angelo Rossi Date: Wed, 21 Jun 2023 12:04:16 +0000 Subject: Initial commit. --- sources/over20.cpp | 1909 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1909 insertions(+) create mode 100644 sources/over20.cpp (limited to 'sources/over20.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(blkcom::sMonCar.m_pMTape); + // + if (blkcom::nIprsUp >= 1) + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " Begin module \"over20\"." << std::endl << std::flush; + date_time::runtym (d1, d2); + n10 = 1; + if (blkcom::nIprsUp >= 1) + (*reinterpret_cast (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 (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 (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::iterator nI = labcom::sVoltI.begin (); nI != labcom::sVoltI.begin () + k; nI++) + (*reinterpret_cast (blkcom::pLFiles[ 3 ])) << *nI << " "; + (*reinterpret_cast (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 (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 (blkcom::pLFiles[ 5 ])) << " same as for the regular printed output vs. time." << std::endl << std::flush; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " Variable maxima :" << std::endl << std::flush; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (15, ' '); + for (std::vector::iterator nI = labcom::sXMax.begin (); nI != labcom::sXMax.begin () + k; nI++) + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (13) << std::setprecision (6) << *nI << " "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::endl << std::flush; + ndx1 = blkcom::sSStat.m_nSize12 + 1; + ndx2 = blkcom::sSStat.m_nSize12 + k; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " Times of maxima :" << std::endl << std::flush; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (15, ' '); + for (std::vector::iterator nI = labcom::sXMax.begin () + ndx1; nI != labcom::sXMax.begin () + ndx2; nI++) + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (13) << std::setprecision (6) << *nI << " "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::endl << std::flush; + ndx1 += blkcom::sSStat.m_nSize12; + ndx2 += blkcom::sSStat.m_nSize12; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " Variable minima :" << std::endl << std::flush; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (15, ' '); + for (std::vector::iterator nI = labcom::sXMax.begin () + ndx1; nI != labcom::sXMax.begin () + ndx2; nI++) + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (13) << std::setprecision (6) << *nI << " "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::endl << std::flush; + ndx1 += blkcom::sSStat.m_nSize12; + ndx2 += blkcom::sSStat.m_nSize12; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " Times of minima :" << std::endl << std::flush; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (15, ' '); + for (std::vector::iterator nI = labcom::sXMax.begin () + ndx1; nI != labcom::sXMax.begin () + ndx2; nI++) + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (13) << std::setprecision (6) << *nI << " "; + (*reinterpret_cast (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 (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 (blkcom::pLFiles[ 5 ])) << " " << std::endl << std::flush; + if (blkcom::nIPunch <= 0) + goto a9800; + blkcom::nKCount = 2; + nIOld = 3; + if (n10 != 0) { + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "\n Printout of the saving of terminal conditions for all components, at time"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (15) << std::setprecision (7) << blkcom::nT; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " seconds.\n"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " Begin with all node voltages.\n"; + for (i = 0; i < 3; i++) + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (21, ' ') << "node\n"; + (*reinterpret_cast (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 (blkcom::pLFiles[ 5 ])) << " " << std::setw (6) << labcom::sBus[ k - 1 ]; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (13) << std::setprecision (5) << labcom::sE[ k - 1 ] << " " << zero; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (41, ' '); + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " " << k << std::endl << std::flush; + } + (*reinterpret_cast (blkcom::pLFiles[ 6 ])) << std::setw (2) << blkcom::nKCount; + (*reinterpret_cast (blkcom::pLFiles[ 6 ])) << std::setw (6) << labcom::sBus[ k - 1 ]; + (*reinterpret_cast (blkcom::pLFiles[ 6 ])) << std::fixed << std::setw (15) << std::setprecision (8) << labcom::sE[ k - 1 ] << zero << zero; + (*reinterpret_cast (blkcom::pLFiles[ 6 ])) << std::string (21, ' '); + (*reinterpret_cast (blkcom::pLFiles[ 6 ])) << std::setw (6) << k << std::endl << std::flush; + } + if (n10 != 0) { + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "\n Linear branch table state variables ( 'currents' ) follow.\n"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (7, ' '); + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "row"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (9, ' '); + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "'from' node"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (11, ' '); + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "'to' node"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (9, ' '); + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "linear branch parameters, identified by the Fortran vector storage\n"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (9, ' '); + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "i"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (8, ' '); + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "bus(kbus(i))"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (8, ' '); + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "bus(mbus(i))"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (19, ' '); + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "cik(i)"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (20, ' '); + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "ci(i)"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (20, ' '); + (*reinterpret_cast (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 (blkcom::pLFiles[ 6 ])) << std::setw (2) << nIOld; + (*reinterpret_cast (blkcom::pLFiles[ 6 ])) << std::setw (6) << labcom::sBus[ l - 1 ] << labcom::sBus[ m - 1 ]; + (*reinterpret_cast (blkcom::pLFiles[ 6 ])) << std::fixed << std::setw (15) << std::setprecision (8) << blkcom::nCI1 << blkcom::nCK1 << zero << zero; + (*reinterpret_cast (blkcom::pLFiles[ 6 ])) << std::setw (6) << k << std::endl << std::flush; + if (n10 != 0) { + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::setw (6) << labcom::sBus[ l - 1 ]; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::setw (6) << labcom::sBus[ m - 1 ]; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (13) << std::setprecision (5) << blkcom::nCI1 << blkcom::nCK1 << zero << zero; + (*reinterpret_cast (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 (blkcom::pLFiles[ 5 ])) << " "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::setw (6) << labcom::sBus[ n1 - 1 ]; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::setw (6) << labcom::sBus[ n2 - 1 ]; + (*reinterpret_cast (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 (blkcom::pLFiles[ 5 ])) << std::setw (6) << i << std::endl << std::flush; + } + (*reinterpret_cast (blkcom::pLFiles[ 6 ])) << std::setw (2) << nIOld; + (*reinterpret_cast (blkcom::pLFiles[ 6 ])) << std::setw (12) << labcom::sBus[ n1 - 1 ] << labcom::sBus[ n2 - 1 ]; + (*reinterpret_cast (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 (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 (blkcom::pLFiles[ 5 ])) << " **** Warning. **** No currents will be punched for the distributed line connecting nodes "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "\"" << std::setw (6) << labcom::sBus[ n1 - 1 ]; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "\" and \""; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::setw (6) << labcom::sBus[ n2 - 1 ]; + (*reinterpret_cast (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 (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 (blkcom::pLFiles[ 6 ])) << std::setw (2) << nIOld; + (*reinterpret_cast (blkcom::pLFiles[ 6 ])) << std::setw (6) << labcom::sBus[ n1 - 1 ] << labcom::sBus[ n2 - 1 ]; + (*reinterpret_cast (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 (blkcom::pLFiles[ 6 ])) << std::setw (10) << n9 << n11; + for (std::vector::iterator nI = labcom::sVChar.begin () + n5; nI != labcom::sVChar.begin () + n8; nI++) + (*reinterpret_cast (blkcom::pLFiles[ 6 ])) << std::fixed << std::setw (15) << std::setprecision (8) << *nI; + (*reinterpret_cast (blkcom::pLFiles[ 6 ])) << std::endl << std::flush; + n12 = n5 + 4; + n13 = n5 + 5; + n14 = (int) labcom::sCChar[ n12 - 1 ]; + (*reinterpret_cast (blkcom::pLFiles[ 6 ])) << std::setw (10) << n9 << n11; + (*reinterpret_cast (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 (blkcom::pLFiles[ 5 ])) << " "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::setw (6) << labcom::sBus[ n1 - 1 ]; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::setw (6) << labcom::sBus[ n2 - 1 ]; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (13) << std::setprecision (5) << labcom::sVChar[ n7 - 1 ] << labcom::sCChar[ n8 - 1 ]; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::endl << std::flush; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::setw (10) << n9; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::setw (10) << n11; + for (std::vector::iterator nI = labcom::sVChar.begin () + n5; nI != labcom::sVChar.begin () + n8; nI++) { + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (15) << std::setprecision (8) << *nI; + } + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::endl << std::flush; + + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::setw (10) << n14; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " " << std::fixed << std::setw (15) << std::setprecision (8) << labcom::sVChar[ n13 - 1 ]; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " " << std::fixed << std::setw (15) << std::setprecision (8) << labcom::sVChar[ n13 - 1 ]; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " " << std::fixed << std::setw (15) << std::setprecision (8) << labcom::sGSlope[ n12 - 1 ]; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " " << std::fixed << std::setw (15) << std::setprecision (8) << labcom::sGSlope[ n13 - 1 ]; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::endl << std::flush; + // cycle + goto a7032; + + a7031: + a = labcom::sCurr[ k - 1 ]; + if (a == 0.0) { + ; + } else { + (*reinterpret_cast (blkcom::pLFiles[ 6 ])) << std::setw (2) << nIOld; + (*reinterpret_cast (blkcom::pLFiles[ 6 ])) << std::setw (6) << labcom::sBus[ n1 - 1 ] << labcom::sBus[ n2 - 1 ]; + (*reinterpret_cast (blkcom::pLFiles[ 6 ])) << std::fixed << std::setw (15) << std::setprecision (8) << a; + (*reinterpret_cast (blkcom::pLFiles[ 6 ])) << std::endl << std::flush; + if (n10 != 0) { + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::setw (6) << labcom::sBus[ n1 - 1 ]; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::setw (6) << labcom::sBus[ n2 - 1 ]; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (13) << std::setprecision (5) << a; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::endl << std::flush; + } + } + } + + a7032: + ; + } + } + + a9207: + if (blkcom::nKSwtch == 0) + goto a4020; + if (n10 != 0) { + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "\n"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " Status variables for switches follow.\n"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "bus(l)"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "bus(m)"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "kpos(k)"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " kode(l)"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " kode(m)"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (14, ' '); + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "tclose"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (14, ' '); + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "adelay"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (14, ' '); + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "energy"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (16, ' '); + (*reinterpret_cast (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 (blkcom::pLFiles[ 6 ])) << " 5"; + (*reinterpret_cast (blkcom::pLFiles[ 6 ])) << std::setw (6) << labcom::sBus[ l - 1 ] << labcom::sBus[ m - 1 ]; + (*reinterpret_cast (blkcom::pLFiles[ 6 ])) << std::setw (4) << labcom::sKPos[ k - 1 ] << labcom::sKode[ l - 1 ] << labcom::sKode[ m - 1 ]; + (*reinterpret_cast (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 (blkcom::pLFiles[ 6 ])) << "\n"; + (*reinterpret_cast (blkcom::pLFiles[ 6 ])) << std::string (14, ' '); + (*reinterpret_cast (blkcom::pLFiles[ 6 ])) << std::setw (4) << npl; + (*reinterpret_cast (blkcom::pLFiles[ 6 ])) << std::endl << std::flush; + if (n10 == 0) { + ; + } else { + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::setw (6) << labcom::sBus[ l - 1 ]; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::setw (6) << labcom::sBus[ m - 1 ]; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::setw (10) << labcom::sKPos[ k - 1 ] << labcom::sKode[ l - 1 ] << labcom::sKode[ m - 1 ]; + (*reinterpret_cast (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 (blkcom::pLFiles[ 5 ])) << "\n"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (14, ' '); + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::setw (10) << labcom::sNextSw[ k - 1]; + (*reinterpret_cast (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 (blkcom::pLFiles[ 5 ])) << " isw, nstat, knt, nenerg = "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::setw (10) << *pISW << nStat << *pKnt << blkcom::nEnerg; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " (xmax(i), i=1, nstat) =\n"; + for (std::vector::iterator nI = labcom::sXMax.begin (); nI != labcom::sXMax.begin () + nStat; nI++) + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (5, ' ') << std::setw (15) << std::setprecision (8) << *nI; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::endl << std::flush; + } + ++*pKnt; + for (std::vector::iterator nI = labcom::sXMax.begin (); nI != labcom::sXMax.end () + nStat; nI++) + (*reinterpret_cast (blkcom::pLFiles[ 8 ])) << *nI; + (*reinterpret_cast (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 (blkcom::pLFiles[ 5 ])) << " "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (6) << std::setprecision (2) << blkcom::nAngle; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (6) << std::setprecision (2) << comthl::nAngTpe; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " "; + for (std::vector::iterator nI = labcom::sXMax.begin (); nI != labcom::sXMax.begin () + ll9; nI++) + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (13) << std::setprecision (6) << *nI; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::endl << std::flush; + goto a611; + + a1610: + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (9) << std::setprecision (4) << blkcom::nAngle; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (5, ' '); + for (std::vector::iterator nI = labcom::sXMax.begin (); nI != labcom::sXMax.begin () + ll9; nI++) + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << *nI; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::endl << std::flush; + + a611: + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (15, ' '); + for (std::vector::iterator nI = labcom::sXMax.begin () + ll10; nI != labcom::sXMax.begin () + nStat; nI++) + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (13) << std::setprecision (6) << *nI; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::endl << std::flush; + goto a624; + + a612: + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (15, ' '); + for (std::vector::iterator nI = labcom::sXMax.begin (); nI != labcom::sXMax.begin () + ll9; nI++) + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (13) << std::setprecision (6) << *nI; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::endl << std::flush; + goto a611; + + a609: + if (blkcom::nEnerg < 0) + goto a614; + if (comthl::nSwTpe <= 1) + goto a1620; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (6) << std::setprecision (2) << blkcom::nAngle; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (6) << std::setprecision (2) << comthl::nAngTpe; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " "; + for (std::vector::iterator nI = labcom::sXMax.begin (); nI != labcom::sXMax.begin () + nStat; nI++) + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (13) << std::setprecision (6) << *nI; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::endl << std::flush; + goto a624; + + a1620: + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (9) << std::setprecision (4) << blkcom::nAngle; + for (std::vector::iterator nI = labcom::sXMax.begin (); nI != labcom::sXMax.begin () + nStat; nI++) + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (13) << std::setprecision (6) << *nI; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::endl << std::flush; + goto a624; + + a614: + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (15, ' '); + for (std::vector::iterator nI = labcom::sXMax.begin (); nI != labcom::sXMax.begin () + nStat; nI++) + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::fixed << std::setw (13) << std::setprecision (6) << *nI; + (*reinterpret_cast (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 (blkcom::pLFiles[ 5 ])) << " Times of maxima :\n"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (15, ' '); + for (std::vector::iterator nI = labcom::sXMax.begin () + ndx1; nI != labcom::sXMax.begin () + ndx2; nI++) + (*reinterpret_cast (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 (blkcom::pLFiles[ 5 ])) << " Exit \"over20\"." << std::endl << std::flush; + goto a99999; + + a610: + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "\n\n" << std::endl << std::flush; + blkcom::pLFiles[ 4 ] = pMTape; + if (blkcom::sLStat[ 14 ] != std::numeric_limits::max ()) + blkcom::nNumDCD -= blkcom::pIpnTV[ 10 ]; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " " << std::string (131, '-') << "\n"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " Simulation of all 'nenerg' ="; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::setw (4) << blkcom::nEnerg; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " energizations is now complete, and the EMTP is ready to begin statistical\n"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " processing of the voltage solutions. But before doing so, two cautions about discretization of continuous\n"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " variables are probably appropriate to mention at this point.\n"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (5, ' '); + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "1. The switch closing times which are printed along with peak voltages of each energization are only desired\n"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (9, ' '); + (*reinterpret_cast (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 (blkcom::pLFiles[ 5 ])) << std::string (9, ' '); + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "time is discretized in multiples of time-step-size 'deltat' , actual closure will occur at the first discrete\n"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (9, ' '); + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "step which does not precede the requested time.\n"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (5, ' '); + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "2. In the tabulation of voltage distributions which follow, an arbitrary decision had to be made concerning the\n"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (9, ' '); + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "column which is labeled 'frequency' . The continuous variable voltage has been discretized, divided into\n"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (9, ' '); + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "compartments of size 'aincr' (read from columns 25-32 of the special statistics misc. data card). For an entry"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (9, ' '); + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "which is printed in a row marked as being for voltage 'vrow' , the associated compartment contains all\n"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (9, ' '); + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "voltages 'v' which satisfy vrow .le. v .lt. (vrow + aincr) .\n"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (5, ' '); + (*reinterpret_cast (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 (blkcom::pLFiles[ 5 ])) << std::string (9, ' '); + (*reinterpret_cast (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 (blkcom::pLFiles[ 5 ])) << "\n\n"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " *********************************************************** Look, look ************************************************************\n"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "\n"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " During this run, a total of"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::setw (4) << *pLTDelt; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " random switch closings less than time zero were generated by the random\n"; + (*reinterpret_cast (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 (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 (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 (blkcom::pLFiles[ 5 ])) << " counsel on this subject.\n"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " "; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " *********************************************************** Look, look ************************************************************\n"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "\n\n"; + + a7314: + (*reinterpret_cast (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 (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 (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 (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 (blkcom::pLFiles[ 5 ])) << " Enter \"katalg\". icat memsav lunit2 ltlabl\n"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (18, ' '); + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::setw (10) << blkcom::nICat << blkcom::nMemSav; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "0x" << std::hex << blkcom::pLFiles[ 1 ]; + (*reinterpret_cast (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::infinity (); + if (blkcom::nMemSav == 1016) + goto a2634; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "\n"; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (20, ' '); + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "----- memsav = 1 represents request for table dumping on disk."; + (*reinterpret_cast (blkcom::pLFiles[ 1 ])).close(); + (*reinterpret_cast (blkcom::pLFiles[ 1 ])).open ("tptables.bin", std::ios_base::out | std::ios_base::trunc | std::ios_base::binary); + emtp::tables (); + (*reinterpret_cast (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 (blkcom::pLFiles[ 1 ])).write (&pANSI132[ 0 ], 132); + } while (1); + (*reinterpret_cast (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 (&labcom::pKArray[ 0 * sizeof (int) ]), reinterpret_cast (&spycom::nIndBuf), sizeof (int)); + memcpy (reinterpret_cast (&labcom::pKArray[ 1 * sizeof (int) ]), reinterpret_cast (&spycom::nMFlush), sizeof (int)); + memcpy (reinterpret_cast (&labcom::pKArray[ 2 * sizeof (int) ]), reinterpret_cast (&spycom::nNewVec), sizeof (int)); + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::string (26, ' '); + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << "Successful saving of EMTP tables as file \"tptables.bin\" . ltlabl ="; + (*reinterpret_cast (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 (blkcom::pLFiles[ 5 ])) << " Begin EMTP table restoration. ltlabl ="; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << std::setw (7) << blkcom::sSStat.m_nTLabl; + (*reinterpret_cast (blkcom::pLFiles[ 5 ])) << " . Wait for completion." << std::endl << std::flush; + (*reinterpret_cast (blkcom::pLFiles[ 2 ])).close (); + (*reinterpret_cast (blkcom::pLFiles[ 2 ])).open ("tptables.bin", std::ios_base::out | std::ios_base::in); + emtp::tables (); + (*reinterpret_cast (blkcom::pLFiles[ 2 ])).close (); + (*reinterpret_cast (blkcom::pLFiles[ 2 ])).open ("tptables.bin", std::ios_base::in | std::ios_base::out | std::ios_base::binary); + emtp::tables (); + (*reinterpret_cast (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 (&spycom::nIndBuf), reinterpret_cast (labcom::pKArray[ 0 * sizeof (int) ]), sizeof (int)); + memcpy (reinterpret_cast (&spycom::nMFlush), reinterpret_cast (labcom::pKArray[ 1 * sizeof (int) ]), sizeof (int)); + memcpy (reinterpret_cast (&spycom::nNewVec), reinterpret_cast (labcom::pKArray[ 2 * sizeof (int) ]), sizeof (int)); + (*reinterpret_cast (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(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(blkcom::pLFiles[ 6 ]), \ + *reinterpret_cast(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 (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(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast (spycom::pMFiles[ 5 ])); + if(spycom::nKFile5 == 1) + goto a6258; + + a5617: + spyf77::sProm80 = " spy:"; + utilities::prompt(*reinterpret_cast(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 (spycom::pMFiles[ 4 ])).read(&spyf77::sBuff77[ 0 ], 80); + if((*reinterpret_cast (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(spycom::pMFiles[ 5 ])) << " Exit \"emtspy\". kbreak, nchain, lastov, m4plot =" << spycom::nKBreak << blkcom::nChain << blkcom::nLastOV << blkcom::nM4Plot << std::endl; + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(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(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(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(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(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(spycom::pMFiles[ 5 ])) << " Comment:" << spyf77::sANSW80.substr(0, 80) << std::endl; + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(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 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(spycom::pMFiles[ 5 ])) << " Near top of \"initsp\". limbuf =" << spycom::nLimBuf << std::endl; + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(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(spycom::pMFiles[ 5 ])) << " Next use of \"inquire\". j, ansi32 =" << j << " " << spyf77::sANSI32.str() << std::endl; + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(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(spycom::pMFiles[ 5 ])) << " ???? Trouble. \"@?\" usage only defined" << spycom::nMaxArg << " arguments, while the disk" << std::endl; + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(spycom::pMFiles[ 5 ]));; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << " file has more %-strings. Trouble detected in following:" << std::endl; + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(spycom::pMFiles[ 5 ]));; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << " >>>" << pVByte -> substr(0, 80) << std::endl; + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(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 (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(spycom::pMFiles[ 5 ])) << " ??? Sorry, illegal numeric just read:"; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << std::setw (50) << (*pVByte).substr (0, 50) << std::endl << std::flush; + (*reinterpret_cast(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(spycom::pMFiles[ 5 ])) << " Begin \"getnum\". ibegcl ="; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << std::setw (5) << spycom::nIBegCL; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << " bytbuf(ibegcl) ="; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << std::setw (1) << spycom::pByteBuf[ spycom::nIBegCL - 1 ] << std::endl << std::flush; + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(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(spycom::pMFiles[ 5 ])) << " -- Illegal byte in \"number\"."; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << " "; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << std::setw (4) << i; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << " "; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << std::setw (1) << c4; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << " "; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << "Try again ..." << std::endl << std::flush; + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(spycom::pMFiles[ 5 ])); + nNum = -87654; + goto a4294; + + a4256: + if (j == 10) + j = 0; + nNum = 10 * nNum + j; + if (spycom::nIprSpy < 2) { + ; + } else { + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << " Next digit. j, num ="; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << std::setw (8) << j << nNum; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << std::endl << std::flush; + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(spycom::pMFiles[ 5 ])); + } + + a4219: + ; + } + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << " Stop at 4271 of \"getnum\". num ="; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << std::setw (8) << spycom::nIEndCL << nNum; + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(spycom::pMFiles[ 5 ])); + + a4286: + if(n1 < 0) + nNum = -nNum; + spycom::nIEndCL = i - 1; + if(spycom::nIprSpy < 1) + goto a4294; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << " Exit \"number\". iendcl, num = " << spycom::nIEndCL << ", " << nNum << std::endl; + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(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(spycom::pMFiles[ 5 ])) << std::string (7, ' '); + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << std::setw (7) << sText10[ j - 1 ]; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << std::endl << std::flush; + } + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(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(spycom::pMFiles[ 5 ])) << " Exit \"spyout\". n1, n2, k, n11, n12 ="; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << std::setw(6) << n1 << n2 << k << n11 << n12 << std::endl << std::flush; + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(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(spycom::pMFiles[ 5 ])) << " Top of \"examin\". numex, imin(1), locout(1) ="; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << std::setw(6) << spycom::nNumex << spycom::pIMin[ 0 ] << spycom::pLocOut[ 0 ] << std::endl << std::flush; + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(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(spycom::pMFiles[ 5 ])) << " Next examine. jj, n5, n3, n8, intout(jj)"; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << std::setw (8) << jj << n5 << n3 << n8 << spycom::pIntOut[ jj - 1 ] << std::endl << std::flush; + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(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(spycom::pMFiles[ 5 ])) << " i6 integer encoded for examine. n9,kar1(1 + n9) ="; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << std::setw (8) << n9 << spycom::pKar1[ n9 ]; + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(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(spycom::pMFiles[ 5 ])) << " Exit \"examin\". kolout ="; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << std::setw (5) << spycom::nKOLOut; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << " outlin(1:80) ="; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << spyf77::sOutLin.substr(0, n17); + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(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(spycom::pMFiles[ 5 ])) << " Top of \"deposi\". ind, intype, iascii(ind), d4, ansi8 ="; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << std::setw(8) << ind << intype << spycom::pIASCII[ ind - 1 ]; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << std::setw(15) << std::setprecision(4) << d4; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << " "; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << std::setw(8) << spyf77::sANSI8.str(); + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(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 (spycom::pMFiles[ 5 ])) << " Exit \"deposi\"."; + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(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(spycom::pMFiles[ 5 ])) << " ---- Wrap around, end to beginning ----"; + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(spycom::pMFiles[ 5 ]));; + n1 = 1; + + a2107: + n2 = n1 + n33; + goto a2110; + + a2109: + if(n13 == 2) + goto a2132; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << " ???? Illegal data (not blank or two dec free-format integers. Try again."; + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(spycom::pMFiles[ 5 ]));; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << " Is it possible user's data has no such table (other cause of message)?"; + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(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(spycom::pMFiles[ 5 ])) << " Return from \"intpar\". max, n1, n2, kill ="; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << std::setw(6) << max << n1 << n2 << kill; + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(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(spycom::pMFiles[ 5 ])) << " Top \"sosrange\". bytbuf(a20) ="; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << std::setw(20) << spycom::pByteBuf; + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(spycom::pMFiles[ 5 ])); + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << " numsym, lidnt1, linnow, char1 ="; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << std::setw(5) << spycom::nNumSym << spycom::nLIdnt1 << spycom::nLinNow; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << " "; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << std::setw(1) << spycom::cChar1; + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(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(spycom::pMFiles[ 6 ])) << " Begin next lidnt. ibeg n13 lidnt1 jpoint n1 n24"; + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(spycom::pMFiles[ 5 ]));; + (*reinterpret_cast(spycom::pMFiles[ 6 ])) << std::string(18, ' '); + (*reinterpret_cast(spycom::pMFiles[ 6 ])) << std::setw(8) << spycom::nIBegCL << n13 << spycom::nLIdnt1 << spycom::nLinNow << n1 << n24; + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(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(spycom::pMFiles[ 5 ])) << " Exit \"sosrng\". lidnt1, lidnt2, kill, char2 ="; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << std::setw(6) << spycom::nLIdnt1 << spycom::nLIdnt2 << kill; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << " "; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << std::setw(1) << char2 << std::endl << std::flush; + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(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(spycom::pMFiles[ 5 ])) << " ? ? ? Trouble with input data. Last card number" << std::setw (5) << blkcom::nIStep; + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << " is in error." << std::endl; + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(spycom::pMFiles[ 5 ])); + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << " 12345678901234567890123456789012345678901234567890123456789012345678901234567890" << std::endl; + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(spycom::pMFiles[ 5 ])); + (*reinterpret_cast(spycom::pMFiles[ 5 ])) << spyf77::sFile6[ blkcom::nIStep - 1 ].substr(0, 80) << std::endl; + utilities::window(*reinterpret_cast(blkcom::pLFiles[ 5 ]), \ + *reinterpret_cast(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(blkcom::pLFiles[ 6 ]), \ + spyf77::sProm80); + (*reinterpret_cast(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 -- cgit v1.2.3