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/over51.cpp |
Initial commit.
Diffstat (limited to 'sources/over51.cpp')
-rw-r--r-- | sources/over51.cpp | 147 |
1 files changed, 147 insertions, 0 deletions
diff --git a/sources/over51.cpp b/sources/over51.cpp new file mode 100644 index 0000000..601a25b --- /dev/null +++ b/sources/over51.cpp @@ -0,0 +1,147 @@ +//-*- mode: c++; indent-tabs-mode: nil; coding: utf-8; show-trailing-whitespace: t -*- + +// file over51.cpp + +#include "over51.hpp" + +namespace over51 { + + // subroutine over51. + + void over51(void) + { + double nVMin; + double nVMax; + // + if (blkcom::nIprsUp >= 1) + (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Begin \"over51\". kill = " << blkcom::nKill << std::endl << std::flush; + date_time::runtym(nVMin, nVMax); + blkcom::sFLStat[ 8 ] = nVMin - blkcom::sFLStat[ 8 ]; + blkcom::sFLStat[ 9 ] = nVMax - blkcom::sFLStat[ 9 ]; + if (blkcom::nKill == 0) + goto a4521; + subr51 (); + goto a4536; + + a4521: + blkcom::nLastOV = blkcom::nChain; + blkcom::nChain = 55; + + a4536: + if (blkcom::nIprsUp >= 1) + (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Exit module \"over51\"." << std::endl << std::flush; + } + + // subroutine subr51. + + void subr51 (void) + { + // + // Note. --- As the structure of the EMTP error overlays change, + // the following assignments may have to be altered ... + // nfrfld ---- total number of error overlays + // kpen(j) ---- storage for the highest kill-code + // number handled by error overlay + // number 50+j , for all but the + // last error overlay. + int i; + int j; + int nKSat; + // + double nD1; + double nVMin; + double nVMax; + // + size_t pKPen[ 5 ] = { 50, 90, 150, 200 }; + // + try { + blkcom::nNFrFld = 5; + if(blkcom::nIprsUp >= 1) + (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Begin \"subr51\". kill = " << blkcom::nKill << std::endl << std::flush; + if ((blkcom::nKill == 99) && blkcom::sLStat[ 18 ] == 11111) + emtp::stoptp (); + pKPen[ blkcom::nNFrFld ] = std::numeric_limits<size_t>::max (); + date_time::runtym (nVMin, nVMax); + blkcom::sFLStat[ 8 ] = nVMin - blkcom::sFLStat[ 8 ]; + if (blkcom::pIpnTV[ 0 ] != -8888) + goto a1643; + if (blkcom::nKill == 38) + blkcom::sFLStat[ 12 ] = 1.0; + if (blkcom::nKill == 41) + blkcom::sLStat[ 10 ] = 1; + if (blkcom::nKill == 43) + blkcom::sFLStat[ 12 ] = 1.0; + if ((blkcom::nKill - 1) != blkcom::pIpnTV[ 2 ]) + goto a1643; + blkcom::pIpnTV[ 2 ] = blkcom::nKill; + goto a1649; + + a1643: + if (blkcom::nLastOV >= blkcom::nChain) + goto a1649; + blkcom::nNOutPR = 0; + emtp::interp (); + (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " " << std::endl << std::flush; + (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::string (132, '-') << std::endl << std::flush; + for (i = 1; i <= 2; i++) { + for (j = 1; j <= 22; j++) + (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "error/"; + (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::endl; + } + (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::flush; + (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::string (132, '-') << std::endl << std::flush; + (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "0You lose, fella. The EMTP logic has detected an error condition, and is going to terminate your run. The following\n"; + (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " printout message summarizes the data difficulty leading to this program decision. By studying this message, the problem\n"; + (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " data, and the rules delineated by the 840-page EMTP rule book, it is hoped that the user can rectify the problem.\n"; + (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " If still in doubt after some study, come see program maintenance for assistance.\n" << std::flush; + blkcom::sTexCol = blkcom::sABuff.str ().substr (0, 80); + (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Where an otherwise-unidentified card is referred to, or is called the 'last' card, this means the most-recently-\n"; + (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " read card of the input data deck. The 80-column card image in question is the last one printed out before this\n"; + (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " termination message. A copy follows.... " << blkcom::sTexCol << std::endl << std::flush; + (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::string (14, ' ') << "kill code number" << std::string (16, ' ') << "overlay number " << std::string (10, ' ') << "nearby statement no.\n" << blkcom::nKill << " " << blkcom::sLStat[ 17 ] << " " << blkcom::sLStat[ 18 ] << std::endl << std::flush; + + a1649: + for(j = 1; j <= blkcom::nNFrFld; j++) { + if(blkcom::nKill > pKPen[ j - 1 ]) + goto a1658; + if(j == 1) + goto a1684; + blkcom::nLastOV = blkcom::nChain; + blkcom::nChain = 50 + j; + if(blkcom::nIprsUp >= 1) + (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Error overlay found. kill, j, kpen(j), nchain = " << blkcom::nKill << " " << j << " " << pKPen[ j - 1 ] << " " << blkcom::nChain << std::endl << std::flush; + goto a9000; + } + + a1658: + ; + + a1684: + ; + + switch (blkcom::nKill) { + case 1: + throw emtp::storage_exceeded_error(); + break; + + case 60: + throw emtp::dummy_function_called_error(); + break; + } + } + catch (const std::runtime_error &e) { + (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 0 ])) << e.what () << std::endl << std::flush; + } + + blkcom::nLastOV = blkcom::nChain; + blkcom::nChain = blkcom::nNFrFld + 50; + if (blkcom::nIprsUp >= 1) + (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Exit \"subr51\". nchain, kill = " << blkcom::nChain << " " << blkcom::nKill << std::endl << std::flush; + + a9000: + return; + } + +} + +// end of file over51.f90 |