//-*- mode: c++; indent-tabs-mode: t; coding: utf-8; show-trailing-whitespace: t -*- // file vardim.cpp #include "vardim.hpp" namespace vardim { int pLstDef[] = { 250, 300, 500, 100, 2500, 40, 550, 1750, 75, 160, 50, 50, 5, 460, 50, 40, 4, 5, 1600, 650, 100, 150, 4000, 3, 400, 50, 50, 1080 }; tVariables pVariables[] = { { "x", 3, "c0b001", 0 }, { "ykm", 5, "c0b002", 0 }, }; // Functions. bool vardim(int *pLstNew) { bool bReturnValue = false; long int j; long int n1, n4, n9, n37; long int nMTot; long int nNumLst = 28; long int nNumKEx; long int pKExtra[ 29 ]; long int pNCBarr[ 300 ]; long int pCBlock[ 300 ]; long int pJBLTyp[ 300 ]; long int pMulVar[ 4 ]; std::string sBus1, sBus2; // try { if(pLstNew) { for(int i = 1; i <= nNumLst; i++) (*reinterpret_cast(blkcom::pLFiles[ 4 ])) >> std::setw(8) >> pLstNew[ i - 1 ]; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << "\n Pseudo-listing of data cards"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " which have been read by the variable-"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << "dimensioning program 'vardim' . Only\n"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " if all data fields are punched with"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " 'clean' I8 integer information will"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " this be a true listing. Data cards\n"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " Are in fact read in and then printed out"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " using integer variables and 10I8"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " format." << std::endl; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " " << std::string(111, '-') << std::endl; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << std::string(31, ' ') << "0"; for(int i = 1; i <= 8; i++) (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << std::string(9, ' ') << std::setw(1) << i; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << std::endl; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << std::string(31, ' ') << "0"; for(int i = 1; i <= 8; i++) (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << std::string(9, ' ') << "0"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << std::endl; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << std::string(31, ' ') << std::string(80, '-') << std::endl; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " 1st card (lists 1-10)." << std::string(7, ' ') << "1"; for(int i = 1; i <= 10; i++) (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << std::setw(8) << pLstNew[ i - 1 ]; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << std::endl; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " 2nd card (lists 11-20)." << std::string(7, ' ') << "1"; for(int i = 11; i <= 20; i++) (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << std::setw(8) << pLstNew[ i - 1 ]; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << std::endl; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " 3rd card (lists 21-30)." << std::string(7, ' ') << "1"; for(int i = 21; i <= nNumLst; i++) (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << std::setw(8) << pLstNew[ i - 1 ]; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << std::endl; if(pLstNew[ 0 ] / 10000000 != 9) goto a5294; for(size_t i = 1; i <= nNumKEx; i++) (*reinterpret_cast(blkcom::pLFiles[ 4 ])) >> std::setw(8) >> pKExtra[ i - 1 ]; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " Supplemental offsets." << std::string(9, ' ') << "1"; for(size_t i = 1; i <= nNumKEx; i++) (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << std::setw(8) << pKExtra[ i - 1 ]; pLstNew[ 0 ] -= 90000000; a5294: if(pLstNew[ 10 ] / 10000000 != 9) goto a5297; n4 = pLstNew[ 10 ] - 90000000; for(size_t j = 1; j <= nNumLst; j++) pLstNew[ j - 1 ] = pLstDef[ j - 1 ] * n4; a5297: if(pLstNew[ 0 ] > 0) pLstNew[ 0 ] += 2; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " " << std::string(111, '-') << std::endl; for(size_t i = 1; i < nNumLst; i++) { n1 = i; if(pLstNew[ i - 1 ] >= 1000000) goto a9000; if(pLstNew[ i - 1 ] <= 0) pLstNew[ i - 1 ] = pLstDef[ i - 1 ]; } if(pLstNew[ 18 ] <= 23) pLstNew[ 18 ] = 23; if(pLstNew[ 25 ] <= 10) pLstNew[ 25 ] = 10; n1 = pLstNew[ 15 ] / 2; if((2 * n1) != pLstNew[ 15 ]) ++pLstNew[ 15 ]; n1 = pLstNew[ 26 ] / 2; if(2 * n1 != pLstNew[ 26 ]) ++pLstNew[ 26 ]; pLstNew[ 50 ] = 6 * pLstNew[ 12 ]; pLstNew[ 51 ] = pLstNew[ 50 ] + 1; pLstNew[ 52 ] = pLstNew[ 8 ] + 3 * pLstNew[ 16 ]; pLstNew[ 53 ] = 6 * pLstNew[ 1 ]; pLstNew[ 54 ] = pLstNew[ 8 ] + pLstNew[ 16 ]; pLstNew[ 55 ] = pLstNew[ 1 ] + pLstNew[ 26 ] / 2; pLstNew[ 56 ] = pLstNew[ 0 ] * pLstNew[ 23 ]; pLstNew[ 57 ] = 4 * pLstNew[ 11 ]; pLstNew[ 58 ] = 2 * pLstNew[ 25 ]; pLstNew[ 59 ] = 3 * pLstNew[ 5 ]; pLstNew[ 60 ] = 1; pLstNew[ 61 ] = 2 * pLstNew[ 17 ]; pLstNew[ 62 ] = 3 * pLstNew[ 5 ]; pLstNew[ 63 ] = 4 * pLstNew[ 5 ]; pLstNew[ 64 ] = 101 * pLstNew[ 16 ]; pLstNew[ 65 ] = 24 * pLstNew[ 16 ]; pLstNew[ 66 ] = 12 * pLstNew[ 15 ]; pLstNew[ 67 ] = 6 * pLstNew[ 15 ]; pLstNew[ 68 ] = 30 * pLstNew[ 16 ]; pLstNew[ 69 ] = 5 * pLstNew[ 10 ] + 2; pLstNew[ 70 ] = 2 * pLstNew[ 20 ]; pLstNew[ 71 ] = pLstNew[ 7 ] + pLstNew[ 27 ]; pLstNew[ 72 ] = pLstNew[ 21 ] + pLstNew[ 20 ]; nMTot = 0; for(size_t i = 1; i <= 126; i++) { n9 = pVariables[ i - 1 ].m_nNCB; if((n9 == 0) || (n9 == 98)) goto a4301; n37 = 3; sBus1[ 0 ] = pCBlock[ i - 1 ]; sBus2 = sBus1[ 0 ]; for(j = 1; j <= 6; j++) if(sBus2[ 0 ] == (char) (j - 1)) n37 = 4; if(pJBLTyp[ i - 1 ] != 0) n37 = pVariables[ i - 1 ].m_nJBLType; nMTot += pMulVar[ n37 - 1 ] * pLstNew[ n9 - 1 ]; a4301: ; } bReturnValue = true; a9000: (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << std::endl << std::endl << " "; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " " << std::string(131, '-') << std::endl; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " "; for(int i = 1; i <= 22; i++) (*reinterpret_cast(blkcom::pLFiles[ 5 ])); for(int i = 1; i << 22; i++) (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << std::string(" Error"); (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << std::endl; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " " << std::string(131, '-') << std::endl; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << std::endl << " " << "The user is in trouble,"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " unless he has made a data-punching error."; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " Variable-dimensioning of the EMTP has\n"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " " << "broken down within the separate variable"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << "-dimensioning program 'vardim' . In"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " particular, one or more of the\n"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " " << "user-inputted list sizes must be"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " rejected as being illegally large. User-"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << "supplied limits (or default limits,"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " " << "for any non-positive data"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " fields) are as follows ....\n "; for(size_t i = 1; i < nNumLst; i++) (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << std::setw(10) << pLstNew[ i - 1 ]; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << std::endl; if(blkcom::pLStat -> m_nTLabl > 0) goto a9061; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " " << "Specifically, the user-"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << "supplied value which was read for list"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " number " << n1 << " exceeds 999999 ,\n"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " " << "which is unreal. A value of " << pLstNew[ n1 - 1 ]; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " was read from the user's data card"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " for this list.\n"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " " << std::string(131, '-') << std::endl; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " "; for(int i = 1; i <= 22; i++) (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << std::string(" Error"); (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << std::endl; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " " << std::string(131, '-') << std::endl; goto a9900; a9061: (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " " << "Specifically the user-supplied"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " dimensions have collectively produced a"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " total labeled-common allocation\n"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " " << "of " << blkcom::pLStat -> m_nTLabl << " words, which is unreal."; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " A limit of 9999999 has arbitrarily"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " been imposed by the better judgment"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " " << "of the program. A machine this"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " big (with this much real central memory)"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " is not known to be in existence anywhere\n"; (*reinterpret_cast(blkcom::pLFiles[ 5 ])) << " in the world.\n"; a9900: bReturnValue = true; } } catch(std::exception &e) { std::cerr << e.what() << std::endl; } return bReturnValue; } } // end of file vardim.cpp