static void Show(void) { switch (wProgram) { case bGET_CNTCURR_10: ShowModemReadCntCurrCan(); break; case bGET_CNTCURR_110: ShowModemReadCntCurrCan(); break; case bGET_IMPCANCURRMNT: ShowInt(mpwImpMntCan[ ibSoftMnt ][ibCan]); break; } sprintf(szLo+14,"%2u",ibCan+1); switch (wProgram) { case bGET_READTIMEDATE1: ShowModemReadTimeCan(true); break; case bGET_READTIMEDATE2: ShowModemReadTimeCan(false); break; } }
int main(int argc, char **argv) { FILE *input = NULL, *output = NULL; //char strOut[17] = "test*_student.txt"; //strOut[4] = argv[1][4]; stack = NULL; char ch; /* if(argc == 3) { */ input = freopen("test10.txt", "r", stdin); //output = freopen(strOut, "w", stdout); if(!input) { fprintf(stderr, "File IO error\n"); return -1; } /* } else { fprintf(stderr, "Don't enter input and output files\n"); return -1; } */ ch = getchar(); while (ch != EOF) { if (ch == '*' || ch == '/' || ch == '+') { if(!stack) { fprintf(stdout, "Not enough arguments\n"); memClear(); return 1; } IntList* a = stack -> integer; stack = Remote(0); if(!stack) { fprintf(stdout, "Not enough arguments\n"); stack = Add(a); memClear(); return 1; } IntList* b = stack -> integer; stack = Remote(0); switch(ch) { case '*': stack = Add(Mult(a, b)); break; case '/': if(b -> length == 1 && !b->value) { fprintf(stdout, "Division by zero\n"); memClear(); return 1; } stack = Add(Div(a, b)); break; case '+': stack = Add(Inc(a, b)); break; } if (!stack) { return 0; } } else if(ch == '-') { ch = getchar(); if (ch == '\n' || ch == EOF) { if(!stack) { fprintf(stdout, "Not enough arguments\n"); memClear(); return 1; } IntList* a = stack -> integer; stack = Remote(0); if(!stack) { fprintf(stdout, "Not enough arguments\n"); stack = Add(a); memClear(); return 1; } IntList* b = stack -> integer; stack = Remote(0); stack = Add(Dec(a, b)); } else if (ch >= 48 && ch < 58) { stack = Add(Read(ch, 1)); } if (!stack) { return 0; } } else if (ch >= 48 && ch < 58) { stack = Add(Read(ch, 0)); if (!stack) { return 0; } } else if(ch == '=') { if(!stack) { fprintf(stdout, "Not enough arguments\n"); memClear(); return 1; } ShowInt(stack -> integer, stack -> integer -> sign, 0); printf("\n"); } else if(ch != 13 && ch != '\n') { fprintf(stdout, "Unknown command\n"); memClear(); return 1; } ch = getchar(); } //ShowInt(stack -> integer, stack -> integer -> sign); if(stack) { printf("["); while(stack) { stack = Remote(1); } printf("]"); } return 0; }