diff options
author | Angelo Rossi <angelo.rossi.homelab@gmail.com> | 2023-06-21 12:04:16 +0000 |
---|---|---|
committer | Angelo Rossi <angelo.rossi.homelab@gmail.com> | 2023-06-21 12:04:16 +0000 |
commit | b18347ffc9db9641e215995edea1c04c363b2bdf (patch) | |
tree | f3908dc911399f1a21e17d950355ee56dc0919ee /sources/datain.cpp |
Initial commit.
Diffstat (limited to 'sources/datain.cpp')
-rw-r--r-- | sources/datain.cpp | 1397 |
1 files changed, 1397 insertions, 0 deletions
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 |