int my_showmem(char *str, int size) { char *curr; curr = str; while (*curr) curr = showline(curr, str); return (0); }
int main(int argc, char* argv[]) { initscr(); scrollok(stdscr, TRUE); wprintw(stdscr, "Welcome to Scripted ver. %d.%d for the Brave Quest engine.\nCopyright 2012 Mad Science Inc.\nPlease do not redistrubute.\n",scriptedvernum,scriptedvernum2); stufffilename(); if(loadscript(filename) == 1) { wprintw(stdscr, "File not Found. Would you like to make a new file?\n"); if(bie() == 'y') { cleanfilebuff(); if(savescript(filename) == 1) { wprintw(stdscr, "Your disk sucks.\n"); bi(); return 1; } } else { wprintw(stdscr, "Goodbye.\n"); endwin(); return 1; } } currlinenum = linenum; menu(); wprintw(stdscr, "Press escape to go to the save menu\n"); for(;;) { wprintw(stdscr, "q= give, w= take, e= say, r= flag, t= move, y= battle, u= check flag, i= check item, o= party add, p= party remove, [ = check character\n"); wprintw(stdscr, "a= warp, s= check experience, d= give experience, f= make experience, g= exec script, h= screen effect, j= user input, k= goline, l= make health\n"); wprintw(stdscr, "b= check stat, n= make stat, m= blank, ,= show line, .= change line.\n"); input[0] = bie(); if(input[0] == 27) menu(); if(input[0] == 'q') give(); if(input[0] == 'w') take(); if(input[0] == 'e') say(); if(input[0] == 'r') flag(); if(input[0] == 't') mmove(); if(input[0] == 'y') battle(); if(input[0] == 'u') checkflag(); if(input[0] == 'i') checkitem(); if(input[0] == 'o') partyadd(); if(input[0] == 'p') partyrm(); if(input[0] == '[') checkparty(); if(input[0] == 'a') warp(); if(input[0] == 's') checkexp(); if(input[0] == 'd') giveexp(); if(input[0] == 'f') makeexp(); if(input[0] == 'g') execscript(); if(input[0] == 'h') screeneffect(); if(input[0] == 'j') userinput(); if(input[0] == 'k') goline(); if(input[0] == 'l') makehealth(); if(input[0] == 'z') teachspell(); if(input[0] == 'x') unlearnspell(); if(input[0] == 'b') checkstat(); if(input[0] == 'n') makestat(); if(input[0] == 'm') blank(); if(input[0] == ',') showline(); if(input[0] == '.') changeline(); if(currlinenum > linenum) linenum = currlinenum; } return 0; };
int main( int argc, char *argv[] ) { int i, j, k; char word[1000], outfname[4000], nj1040_outfname[4000], nj1040_sched_a_outfname[4000]; int status=0; time_t now; int L12a=0, L12b=0; double L27a=0.0, L27b=0.0, L29a=0.0, L29b=0.0, L37a=0.0; double Ab[10], A9a=0.0, proptxcredit; double F[10], Fb[10]; /* Schedule F, added by BWB. */ double I[10], Ib[10]; /* Schedule I. */ /* Intercept any command-line arguments. */ printf("NJ 1040 2014 - v%3.1f\n", thisversion); i = 1; k=1; while (i < argc) { if (strcmp(argv[i],"-verbose")==0) verbose = 1; else if (k==1) { infile = fopen(argv[i],"r"); if (infile==0) { printf("ERROR: Parameter file '%s' could not be opened.\n", argv[i]); exit(1); } k = 2; /* Base name of output file on input file. */ strcpy(outfname,argv[i]); strcpy(nj1040_outfname,argv[i]); strcpy(nj1040_sched_a_outfname,argv[i]); j = strlen(outfname)-1; while ((j>=0) && (outfname[j]!='.')) j--; if (j<0) { strcat(outfname,"_out.txt"); strcat(nj1040_outfname,"_nj1040.xfdf"); strcat(nj1040_sched_a_outfname,"nj1040abc.xfdf"); } else { strcpy(&(outfname[j]),"_out.txt"); strcpy(&(nj1040_outfname[j]),"_nj1040.xfdf"); strcpy(&(nj1040_sched_a_outfname[j]),"_nj1040abc.xfdf"); } outfile = fopen(outfname,"w"); if (outfile==0) { printf("ERROR: Output file '%s' could not be opened.\n", outfname); exit(1); } printf("Writing results to file: %s\n", outfname); } else { printf("Unknown command-line parameter '%s'\n", argv[i]); exit(1); } i = i + 1; } if (infile==0) { printf("Error: No input file on command line.\n"); exit(1); } /* Pre-initialize all lines to zeros. */ for (i=0; i<MAX_LINES; i++) { L[i] = 0.0; A[i] = 0.0; S[i] = 0.0; E[i] = 0.0; } /* Accept parameters from input file. */ /* Expect NJ-1040 lines, something like: Title: NJ 1040 1999 Return L14 {Wages} L15a {Interest} L16 {Dividends} L18 {Capital Gains} S1 {Property Tax} L42 {Witheld tax, from W-2} */ /* Accept Form's "Title" line, and put out with date-stamp for records. */ read_line( infile, word ); now = time(0); fprintf(outfile,"\n%s %s\n", word, ctime( &now )); /* get_parameter(infile, kind, x, mesage ) */ get_parameter( infile, 's', word, "Status" ); get_parameter( infile, 'l', word, "Status ?"); if (strncasecmp(word,"Single",4)==0) { status = SINGLE; L["Single"] = 1; } else if (strncasecmp(word,"Married/Joint",13)==0) { status = MARRIED_FILLING_JOINTLY; L["MFJ"] = 1; } else if (strncasecmp(word,"Married/Sep",11)==0) { status = MARRIED_FILLING_SEPARAT; L["MFS"] = 1; } else if (strncasecmp(word,"Head_of_House",4)==0) { status = HEAD_OF_HOUSEHOLD; L["HOH"] = 1; } else if (strncasecmp(word,"Widow",4)==0) { status = WIDOW; L["QW"] = 1; } else { printf("Error: unrecognized status '%s'. Must be: Single, Married/joint, Married/sep, Head_of_house, Widow(er)\nExiting.\n", word); fprintf(outfile,"Error: unrecognized status '%s'. Must be: Single, Married/joint, Married/sep, Head_of_house, Widow(er)\nExiting.\n", word); exit(1); } switch (status) { case SINGLE: fprintf(outfile,"Status = Single (%d)\n", status); break; case MARRIED_FILLING_JOINTLY: fprintf(outfile,"Status = Married/Joint (%d)\n", status); break; case MARRIED_FILLING_SEPARAT: fprintf(outfile,"Status = Married/Sep (%d)\n", status); break; case HEAD_OF_HOUSEHOLD: fprintf(outfile,"Status = Head_of_Household (%d)\n", status); break; case WIDOW: fprintf(outfile,"Status = Widow(er) (%d)\n", status); break; } get_parameter( infile, 's', word, "L6" ); /* Exemptions, self/spouse. */ get_parameter( infile, 'i', &j, "L6"); L[6] = j; shownum(6); get_parameter( infile, 's', word, "L7" ); /* Exemptions, Over 65. */ get_parameter( infile, 'i', &j, "L7"); L[7] = j; shownum(7); get_parameter( infile, 's', word, "L8" ); /* Exemptions, Blind/disabled. */ get_parameter( infile, 'i', &j, "L8"); L[8] = j; shownum(8); get_parameter( infile, 's', word, "L9" ); /* Exemptions, children. */ get_parameter( infile, 'i', &j, "L9"); L[9] = j; shownum(9); get_parameter( infile, 's', word, "L10" ); /* Exemptions, other dependents. */ get_parameter( infile, 'i', &j, "L10"); L[10] = j; shownum(10); get_parameter( infile, 's', word, "L11" ); /* Exemptions, college kids. */ get_parameter( infile, 'i', &j, "L11"); L[11] = j; shownum(11); L12a = L[6] + L[7] + L[8] + L[11]; L["12a"] = L12a; fprintf(outfile,"L12a = %d\n", L12a); L12b = L[9] + L[10]; L["12b"] = L12b; fprintf(outfile,"L12b = %d\n", L12b); GetLineF( "L14", &L[14] ); /* Wages. */ GetLineF( "L15a", &L[15] ); /* Taxable Interest. */ /* Form asks for tax-exempt income, but does not use it. */ GetLineF( "L16", &L[16] ); /* Dividends. */ GetLine( "L17", &L[17] ); /* Business profits, Fed Sched C. */ if (L[17] < 0.0) L[17] = 0.0; showline(17); GetLine( "L18", &L[18] ); /* Capital Gains . */ if (L[18] < 0.0) L[18] = 0.0; showline(18); GetLineF( "L19", &L[19] ); /* Pensions, Annuities, and IRA Withdrawals (pg 20). */ GetLineF( "L20", &L[20] ); /* Partnership income. (See pg 24.) */ GetLineF( "L21", &L[21] ); /* S Corporation income. (See pg 24.) */ GetLineF( "L22", &L[22] ); /* Rent, royalty, patents income. (Sched NJ-BUS-1, Part IV, Line 4.) */ GetLineF( "L23", &L[23] ); /* Net gambling winnings. */ GetLineF( "L24", &L[24] ); /* Alimony and maintenance payments RECEIVED. */ GetLineF( "L25", &L[25] ); /* Other (See pg 24). */ L[26] = L[14] + L[15] + L[16] + L[17] + L[18] + L[19] + L[20] + L[21] + L[22] + L[23] + L[24] + L[25]; showline_wmsg(26,"Total Income"); /* Total Income. */ GetLineF( "L27a", &L27a ); /* Pension Exclusion (See pg 26). */ GetLineF( "L27b", &L27b ); /* Other Retirement Income Exclusion (See worksheet pg 26). */ L["27a"] = L27a; L["27b"] = L27b; L[27] = L27a + L27b; L["27c"] = L[27]; showline(27); L[28] = L[26] - L[27]; showline_wmsg(28,"NJ Gross Income"); if ((status == SINGLE) || (status == MARRIED_FILLING_SEPARAT)) { if (L[28] < 10000.0) fprintf(outfile," --- You do not need to file, (except to get refund). Income < $10,000. ---\n"); } else { if (L[28] < 20000.0) fprintf(outfile," --- You do not need to file, (except to get refund). Income < $20,000. ---\n"); } L29a = L12a * 1000.0; fprintf(outfile," L29a = %6.2f\n", L29a ); L29b = L12b * 1500.0; fprintf(outfile," L29b = %6.2f\n", L29b ); L[29] = L29a + L29b; fprintf(outfile,"L29c = %6.2f Total Exemption Amount\n", L[29] ); fprintf(outfile,"\n"); GetLine( "E1", &E[1] ); /* Medical Expenses (See pg 27). */ showline_wrksht('E',1,E); E[2] = 0.02 * L[28]; showline_wrksht('E',2,E); E[3] = NotLessThanZero( E[1] - E[2] ); showline_wrksht('E',3,E); GetLine( "E4", &E[4] ); /* Qualified Archer MSA contributions from Federal Form 8853 */ showline_wrksht('E',4,E); GetLine( "E5", &E[5] ); /* Amount of self-employed health insurance deduction */ showline_wrksht('E',5,E); E[6] = NotLessThanZero( E[3] + E[4] + E[5] ); showline_wrksht('E',6,E); fprintf(outfile,"\n"); L[30] = E[6]; if (L[30] != 0.0) showline_wmsg(30," Medical Expenses Worksheet E (See pg 27)"); /* end of Worksheet E */ GetLineF( "L31", &L[31] ); /* Alimony and maintenance payments PAYED. */ GetLineF( "L32", &L[32] ); /* Qualified Conservation Contribution. */ GetLineF( "L33", &L[33] ); /* Health Enterprise Zone Deduction. */ GetLineF( "L34", &L[34] ); /* Alternative Business Calc Adj (Sched NJ-BUS-2, Line 11). */ L[35] = L[29] + L[30] + L[31] + L[32] + L[33] + L[34]; showline_wmsg(35,"Total Exemptions and Deductions"); /* Taxable income. */ L[36] = L[28] - L[35]; if (L[36] > 0.0) showline_wmsg(36, "(Taxable Income)"); GetLineF( "L37a", &L37a ); /* Property Tax Paid. */ L[37] = L37a; GetLine( "A1", &A[1] ); /* Income taxed by other jurisdictions, if any. */ GetLine( "A9a", &A9a ); /* Tax paid to other jurisdictions on that income, if any. */ fprintf(outfile,"\n"); /* Tax deduction worksheet F (pg 34). */ F[1] = L37a; showline_wrksht('F',1,F); if (status != MARRIED_FILLING_SEPARAT) F[2] = smallerof( F[1], 10000.0 ); else F[2] = smallerof( F[1], 5000.0 ); showline_wrksht('F',2,F); if (status != MARRIED_FILLING_SEPARAT) proptxcredit = 50.0; else proptxcredit = 25.0; if (A9a == 0.0) { /*Worksheet-F*/ F[3] = L[36]; Fb[3] = L[36]; fprintf(outfile," F3a = %6.2f F3b = %6.2f\n", F[3], Fb[3]); F[4] = F[2]; Fb[4] = 0.0; fprintf(outfile," F4a = %6.2f F4b = %6.2f\n", F[4], Fb[4]); F[5] = F[3] - F[4]; Fb[5] = Fb[3] - Fb[4]; fprintf(outfile," F5a = %6.2f F5b = %6.2f\n", F[5], Fb[5]); F[6] = TaxRateFunction( F[5], status ); Fb[6] = TaxRateFunction( Fb[5], status ); fprintf(outfile," F6a = %6.2f F6b = %6.2f\n", F[6], Fb[6]); F[7] = Fb[6] - F[6]; showline_wrksht('F',7,F); if (F[7] >= proptxcredit) { /*yes*/ fprintf(outfile," F8. Yes. (Take Property Tax Deduction.)\n"); L[38] = F[4]; L[39] = F[5]; L[40] = F[6]; L[49] = 0.0; } /*yes*/ else { /*no*/ fprintf(outfile," F8. No. (Take Property Tax Credit.)\n"); L[38] = 0.0; L[39] = Fb[5]; L[40] = Fb[6]; L[49] = proptxcredit; } /*no*/ } /*Worksheet-F*/ else { /*SchedA+Worksheet-I*/ fprintf(outfile,"\nSchedule A:\n"); fprintf(outfile," %c%d = %6.2f\n", 'A', 1, A[1]); A[2] = L[28]; fprintf(outfile," %c%d = %6.2f\n", 'A', 2, A[2]); A[3] = smallerof( 1.0, (A[1] / A[2]) ); fprintf(outfile," A3 = %6.2f %%\n", 100.0 * A[3] ); A["3p"] = 100.0*A[3]; A[4] = L[36]; A["4a"] = L[36]; A["4b"] = L[36]; fprintf(outfile," A4a = %6.2f A4b = %6.2f\n", A[4], A[4] ); fprintf(outfile," (5a = %6.2f)\n", F[1] ); A["5a"] = F[1]; A[5] = F[2]; A["5aa"] = F[2]; fprintf(outfile," A5a = %6.2f A5b = %6.2f\n", A[5], 0.0); A[6] = A[4] - A[5]; A["6a"] = A[6]; Ab[6] = A[4] - 0.0; A["6b"] = Ab[6]; fprintf(outfile," A6a = %6.2f A6b = %6.2f\n", A[6], Ab[6]); A[7] = TaxRateFunction( A[6], status ); A["7a"] = A[7]; Ab[7] = TaxRateFunction( Ab[6], status ); A["7b"] = Ab[7]; fprintf(outfile," A7a = %6.2f A7b = %6.2f\n", A[7], Ab[7] ); A[8] = A[3] * A[7]; A["8a"] = A[8]; Ab[8] = A[3] * Ab[7]; A["8b"] = Ab[8]; fprintf(outfile," A8a = %6.2f A8b = %6.2f\n", A[8], Ab[8] ); fprintf(outfile," (9a = %6.2f)\n", A9a ); A["9a"] = A9a; A[9] = smallerof( smallerof( A9a, A[8] ), A[7] ); A["9aa"] = A[8]; Ab[9] = smallerof( smallerof( A9a, Ab[8] ), Ab[7] ); A["9ab"] = Ab[9]; fprintf(outfile," A9a = %6.2f A9b = %6.2f\n", A[9], Ab[9] ); fprintf(outfile,"\nWorksheet I:\n"); I[1] = A[7]; Ib[1] = Ab[7]; fprintf(outfile," I1a = %6.2f I1b = %6.2f\n", I[1], Ib[1] ); I[2] = A[9]; Ib[2] = Ab[9]; fprintf(outfile," I2a = %6.2f I2b = %6.2f\n", I[2], Ib[2] ); I[3] = I[1] - I[2]; Ib[3] = Ib[1] - Ib[2]; fprintf(outfile," I3a = %6.2f I3b = %6.2f\n", I[3], Ib[3] ); Ib[4] = Ib[3] - I[3]; showline_wrksht('I', 4, Ib); if (Ib[4] >= proptxcredit) { fprintf(outfile," Sched-I, Yes: Take PropTax Deduction\n\n"); L[38] = A[5]; // fprintf(outfile,"L36c = %6.2f\n", L[36]); L[39] = A[6]; L[40] = A[7]; L[41] = I[2]; L[49] = 0.0; } else { fprintf(outfile," Sched-I, No: Take PropTax Credit\n\n"); L[38] = 0.0; L[39] = Ab[6]; L[40] = Ab[7]; L[41] = Ib[2]; L[49] = proptxcredit; } } /*SchedA+Worksheet-I*/ /* If no property tax was paid, ensure prop.tax credit is set to 0 */ if ( L37a == 0.0 ) L[49] = 0.0; if (L[37] > 0.0) fprintf(outfile, "L37c = %6.2f\n", L[37]); showline(39); fprintf(outfile,"\n"); /* NJ Taxable Income.*/ // L[39] = L[36] - L[38]; /* Handled above in Sched-1. */ if (L[39] > 0.0) showline_wmsg(39, "NJ Taxable Income"); // L[40] = TaxRateFunction( L[39], status ); /* Handled above in Schedules+Worksheets, A, F, H. */ showline_wmsg(40, "TAX"); if (A[1] > 0.0) showline_wmsg(41, "( Credit for Taxes paid to other jurisdictions. )\n"); L[42] = L[40] - L[41]; showline_wmsg(42, "( Balance of Tax )"); GetLineF( "L43", &L[43] ); /* Sheltered Workshop Tax Credit. */ L[44] = L[42] - L[43]; showline(44); GetLineF( "L45", &L[45] ); /* Use Tax Due on Out-of-State Purchases (pg 35). */ GetLineF( "L46", &L[46] ); /* Penalty for underpayment of estimated tax. */ L[47] = L[44] + L[45] + L[46]; showline(47); /* Total Tax + Penalty. */ GetLine( "L48", &L[48] ); showline_wmsg(48, "Total NJ Income Tax Withheld"); showline_wmsg(49, "Property tax Credit"); GetLineF( "L50", &L[50] ); /* NJ Estimated Tax Payments/Credit from last year's return. */ GetLineF( "L51", &L[51] ); /* NJ Earned Income Tax Credit. (See Sched pg 38.) */ GetLineF( "L52", &L[52] ); /* EXCESS NJ UI/HC/WD Withheld, (See pg 38.) */ GetLineF( "L53", &L[53] ); /* EXCESS NJ Disability Insurance Withheld, (See pg 38.) */ GetLineF( "L54", &L[54] ); /* EXCESS NJ Family Leave Insurance Withheld, (See pg 38.) */ L[55] = L[48] + L[49] + L[50] + L[51] + L[52] + L[53] + L[54]; showline_wmsg(55,"Total Payments/Credits"); if (L[55] < L[47]) { L[56] = L[47] - L[55]; fprintf(outfile, "L56 = %6.2f YOU OWE !!!\n", L[56] ); } else { L[57] = L[55] - L[47]; fprintf(outfile, "L57 = %6.2f Overpayment\n", L[57] ); L[65] = 0.0; showline_wmsg(65, "( Total Contributions from overpayment )"); L[66] = L[57] - L[65]; showline_wmsg(66, "Refund !!!"); } fclose(infile); fclose(outfile); outfile = fopen(nj1040_outfname,"w"); output_xfdf_form_data(outfile, nj1040_2014, L); fclose(outfile); outfile = fopen(nj1040_sched_a_outfname,"w"); output_xfdf_form_data(outfile, nj_schedule_a_2014, A); fclose(outfile); Display_File( outfname ); printf("\nResults written to file: %s\n", outfname); return 0; }
int main(int argc, char *argv[]) { unsigned int repeat=0; char **tags; int i; int a; int b; float gdivide_a; float gdivide_b; char are_you_sure[100]; #ifdef NAJI_DEBUG fprintf(stderr, "\n\n"); fprintf(stderr, "NAJI_DEBUG - check if two commands are displayed as one joined string,\n"); fprintf(stderr, " you might have missed a , in najitool_valid_commands[]\n\n"); for (i=0; i<NAJITOOL_MAX_COMMANDS; i++) fprintf(stderr, "%s ", najitool_valid_commands[i]); fgetc(stdin); #endif /* NAJI_DEBUG */ #ifdef NAJI_DEBUG fprintf(stderr, "\n\nNAJI_DEBUG - YOUR PARAMETERS/ARGUMENTS:\n\n"); for (i=0; i<argc; i++) fprintf(stderr, "%s ", argv[i]); fprintf(stderr, "\n\n"); fgetc(stdin); #endif /* NAJI_DEBUG */ if (argc >= 2) { tolowers(argv[1]); najitool_check_command(argv[1]); } if (argc == 1) { printf("\n\n"); /* printf(" __ | \n"); printf(" / \\ | \n"); printf(" / _____| | o \\ \n"); printf(" | \\ o |___| \n"); printf(" \\____\\ \n"); printf(" o o T O O L \n"); */ printf(" __ | ********************************************\n"); printf(" / \\ | najitool 0.8.4 using libnaji 0.6.4 \n"); printf(" / _____| | o \\ both written by NECDET COKYAZICI \n"); printf(" | \\ o |___| and contributors \n"); printf(" \\____\\ ********************************************\n"); printf(" o o T O O L No warranty, to view the license type: \n"); printf(" najitool license \n"); printf(" http://najitool.sf.net/ ********************************************\n"); printf(" To view the credits type: najitool credits \n"); printf(" Public Domain, 2003-2011 ********************************************\n"); printf("\n"); forhelp(); return 0; } if (argc >= 2) { if (!strcmp(argv[1], "mp3taged")) { if ((argc % 2 != 1) | (argc == 3)) { printf("mp3taged: too few arguments '%s'\n", argv[1]); return 1; } /* * we save the tags' options: * tags[i] = <tag name> * tags[i+1] = <user content> * .. */ tags = (char**) malloc (sizeof(char*)*(argc-3)*2); for (i=0; i<(argc-3)*2; i+=2) tags[i] = (char*) malloc(7*sizeof(char)); for (i=1; i<(argc-3)*2; i+=2) tags[i] = argv[i+2]; for (i=0; i<(argc-3)*2; i+=2) memcpy (tags[i], argv[i+2], 7); mp3editag (argv[argc-1], tags, argc-3); for (i=0; i<(argc-3)*2; i+=2) free(tags[i]); free(tags); return 0; } if (!strcmp(argv[1], "credits")) { if (argc > 2) tooparam("credits"); naji_credits(); return 0; } if (!strcmp(argv[1], "asctable")) { if (argc > 2) tooparam("asctable"); asctable(); return 0; } if (!strcmp(argv[1], "engnum")) { if (argc > 2) tooparam("engnum"); engnum(); return 0; } if (!strcmp(argv[1], "turnum")) { if (argc > 2) tooparam("turnum"); turnum(); return 0; } if (!strcmp(argv[1], "najcrypt")) { if (argc > 2) tooparam("najcrypt"); najcrypt(); return 0; } if (!strcmp(argv[1], "database")) { if (argc > 2) tooparam("database"); naji_database(); return 0; } if (!strcmp(argv[1], "html_db")) { if (argc > 2) tooparam("html_db"); naji_html_database(); return 0; } if (!strcmp(argv[1], "calc")) { if (argc > 2) tooparam("calc"); naji_calc(); return 0; } if (!strcmp(argv[1], "length")) { if (argc > 2) tooparam("length"); length(); return 0; } if (!strcmp(argv[1], "mathgame")) { if (argc > 2) tooparam("mathgame"); mathgame(); return 0; } if (!strcmp(argv[1], "license")) { if (argc > 2) tooparam("license"); naji_license(); return 0; } if (!strcmp(argv[1], "ttt")) { if (argc > 2) tooparam("ttt"); ttt(); return 0; } if (!strcmp(argv[1], "naji_bmp")) { if (argc > 2) tooparam("naji_bmp"); naji_bmp(); return 0; } if (!strcmp(argv[1], "unihtml")) { if (argc > 2) tooparam("unihtml"); naji_gen_unicode_html_pages(); return 0; } if (!strcmp(argv[1], "rmunihtm")) { if (argc > 2) tooparam("rmunihtm"); naji_del_gen_unicode_html_pages(); return 0; } if (!strcmp(argv[1], "cat_text")) { if (argc == 2) { naji_stdin_msg(); cat_text_stdin(); return 0; } if (argc == 3) { cat_text(argv[2]); return 0; } if (argc > 3) tooparam("cat_text"); return 0; } if (!strcmp(argv[1], "kitten")) { if (argc == 2) { naji_stdin_msg(); kitten_stdin(); return 0; } if (argc == 3) { kitten(argv[2]); return 0; } if (argc > 3) tooparam("kitten"); return 0; } if (!strcmp(argv[1], "genlic")) { if (argc > 2) tooparam("genlic"); naji_genlic(); return 0; } if (!strcmp(argv[1], "genhelp")) { if (argc > 2) tooparam("genhelp"); najitool_generate_help(); return 0; } if (!strcmp(argv[1], "htmlhelp")) { if (argc > 2) tooparam("htmlhelp"); najitool_generate_help_html(); return 0; } if (!strcmp(argv[1], "systemdt")) { if (argc > 2) tooparam("systemdt"); systemdt(); return 0; } if (!strcmp(argv[1], "datetime")) { if (argc > 2) tooparam("datetime"); datetime(); return 0; } if (!strcmp(argv[1], "telltime")) { if (argc > 2) tooparam("telltime"); printf("\n\n"); telltime(); printf("\n\n"); return 0; } if (!strcmp(argv[1], "today")) { if (argc > 2) tooparam("today"); printf("\n\n"); today(); printf("\n\n"); return 0; } if (!strcmp(argv[1], "dayofmon")) { if (argc > 2) tooparam("dayofmon"); printf("\n\n"); dayofmon(); printf("\n\n"); return 0; } if (!strcmp(argv[1], "month")) { if (argc > 2) tooparam("month"); printf("\n\n"); month(); printf("\n\n"); return 0; } if (!strcmp(argv[1], "year")) { if (argc > 2) tooparam("year"); printf("\n\n"); year(); printf("\n\n"); return 0; } if (!strcmp(argv[1], "saatarih")) { if (argc > 2) tooparam("saatarih"); saatarih(); return 0; } if (!strcmp(argv[1], "saat")) { if (argc > 2) tooparam("saat"); printf("\n\n"); saat(); printf("\n\n"); return 0; } if (!strcmp(argv[1], "bugun")) { if (argc > 2) tooparam("bugun"); printf("\n\n"); bugun(); printf("\n\n"); return 0; } if (!strcmp(argv[1], "ayinkaci")) { if (argc > 2) tooparam("ayinkaci"); printf("\n\n"); ayinkaci(); printf("\n\n"); return 0; } if (!strcmp(argv[1], "ay")) { if (argc > 2) tooparam("ay"); printf("\n\n"); ay(); printf("\n\n"); return 0; } if (!strcmp(argv[1], "yil")) { if (argc > 2) tooparam("yil"); printf("\n\n"); yil(); printf("\n\n"); return 0; } if (!strcmp(argv[1], "allbmp16")) { if (argc > 2) tooparam("allbmp16"); printf("\n\n"); allbmp16(); printf("\n\n"); return 0; } if (!strcmp(argv[1], "help")) { if (argc == 2) { printf("\n\nAvailable help catagories:\n\n"); printf("commands\n"); printf("\n\n"); forhelp(); return 0; } if (argc == 3) { if (!strcmp(argv[2], "commands")) najitool_help_commands(); else najitool_command_help(argv[2]); return 0; } if (argc > 3) tooparam("help"); return 0; } begin_cmd("mergline", 7) mergline(argv[2], argv[3], argv[4], argv[5], argv[6]); end_cmd() begin_cmd("mp3split", 6) mp3split(argv[4], argv[5], atoi(argv[2]), atoi(argv[3])); end_cmd() begin_cmd("rrrchars", 6) rrrchars(argv[2], argv[3], atoi(argv[4]), atoi(argv[5])); end_cmd() begin_cmd("chstr", 6) chstr(argv[2], argv[3], argv[4], argv[5]); end_cmd() begin_cmd("chchars", 6) chchars(argv[2], argv[3], argv[4], argv[5]); end_cmd() begin_cmd("chchar", 6) chchar(argv[2], argv[3], argv[4][0], argv[5][0]); end_cmd() begin_cmd("filechop", 6) filechop( (strtol(argv[2], NULL, 0)), argv[3], argv[4], argv[5]); end_cmd() begin_cmd("putlines", 6) putlines(argv[2], argv[3], argv[4], argv[5]); end_cmd() begin_cmd("copyoffs", 6) copyoffs(argv[2], strtoul(argv[3], NULL, 0), strtoul(argv[4], NULL, 0), argv[5]); end_cmd() begin_cmd("istrael", 6) istrael(argv[2], atoi(argv[3]), argv[4], argv[5]); end_cmd() begin_cmd("addline", 6) addline(argv[2], argv[3], argv[4], strtoul(argv[5], NULL, 0)); end_cmd() begin_cmd("replacel", 6) replacel(argv[2], argv[3], argv[4], strtoul(argv[5], NULL, 0)); end_cmd() begin_cmd("bremline", 5) bremline(argv[2], argv[3], argv[4]); end_cmd() begin_cmd("eremline", 5) eremline(argv[2], argv[3], argv[4]); end_cmd() begin_cmd("remline", 5) remline(argv[2], argv[3], argv[4]); end_cmd() begin_cmd("skipstr", 5) skipstr(argv[2], argv[3], argv[4]); end_cmd() begin_cmd("makarray", 5) makarray(argv[2], argv[3], argv[4]); end_cmd() begin_cmd("streline", 5) streline(argv[2], argv[3], argv[4]); end_cmd() begin_cmd("strbline", 5) strbline(argv[2], argv[3], argv[4]); end_cmd() begin_cmd("swapfeb", 5) swapfeb(argv[2], argv[3], argv[4]); end_cmd() begin_cmd("filbreed", 5) filbreed(argv[2], argv[3], argv[4]); end_cmd() begin_cmd("skipchar", 5) skipchar(argv[2], argv[3], argv[4]); end_cmd() begin_cmd("onlychar", 5) onlychar(argv[2], argv[3], argv[4]); end_cmd() begin_cmd("repchar", 5) repeat = (unsigned int) atoi(argv[4]); repchar(argv[2], argv[3], repeat); end_cmd() begin_cmd("linesnip", 5) repeat = (unsigned int) atoi(argv[2]); linesnip(repeat, argv[3], argv[4]); end_cmd() begin_cmd("charwarp", 5) repeat = (unsigned int) atoi(argv[4]); charwrap(repeat, argv[2], argv[3]); end_cmd() begin_cmd("repcharp", 5) repeat = (unsigned int) atoi(argv[4]); repcharp(argv[2], argv[3], repeat); end_cmd() begin_cmd("coffset", 5) coffset(argv[2], strtoul(argv[3], NULL, 0), strtoul(argv[4], NULL, 0)); end_cmd() begin_cmd("dumpoffs", 5) dumpoffs(argv[2], strtoul(argv[3], NULL, 0), strtoul(argv[4], NULL, 0)); end_cmd() begin_cmd("bin2c", 5) bin2c(argv[2], argv[3], argv[4]); end_cmd() begin_cmd("filejoin", 5) filejoin(argv[2], argv[3], argv[4]); end_cmd() begin_cmd("mkpatch", 5) mkpatch(argv[2], argv[3], argv[4]); end_cmd() begin_cmd("charfile", 5) repeat = (unsigned int) atoi(argv[3]); charfile(argv[2], repeat, argv[4][0]); end_cmd() begin_cmd("strfile", 5) repeat = (unsigned int) atoi(argv[3]); strfile(argv[2], repeat, argv[4]); end_cmd() begin_cmd("tabspace", 5) repeat = atoi(argv[2]); tabspace(repeat, argv[3], argv[4]); end_cmd() begin_cmd("charaftr", 5) charaftr(argv[2], argv[3], argv[4][0]); end_cmd() begin_cmd("charbefr", 5) charbefr(argv[2], argv[3], argv[4][0]); end_cmd() begin_cmd("strachar", 5) strachar(argv[2], argv[3], argv[4]); end_cmd() begin_cmd("strbchar", 5) strbchar(argv[2], argv[3], argv[4]); end_cmd() begin_cmd("rstrach", 5) rstrach(atoi(argv[2]), argv[3], argv[4]); end_cmd() begin_cmd("rstrbch", 5) rstrbch(atoi(argv[2]), argv[3], argv[4]); end_cmd() begin_cmd("cpfroml", 5) cpfroml(atoi(argv[2]), argv[3], argv[4]); end_cmd() begin_cmd("cptiline", 5) cptiline(atoi(argv[2]), argv[3], argv[4]); end_cmd() begin_cmd("n2ch", 5) n2ch(argv[2][0], argv[3], argv[4]); end_cmd() begin_cmd("n2str", 5) n2str(argv[2], argv[3], argv[4]); end_cmd() begin_cmd("weakrypt", 5) weakrypt(argv[2], argv[3], argv[4]); end_cmd() begin_cmd("sp2ce2sp", 5) sp2ce2sp(argv[2][0], argv[3], argv[4]); end_cmd() begin_cmd("istreml", 5) istreml(argv[2], argv[3], argv[4]); end_cmd() begin_cmd("removel", 5) removel(argv[2], argv[3], strtoul(argv[4], NULL, 0)); end_cmd() begin_cmd("printftx", 4) printftx(argv[2], argv[3]); end_cmd() begin_cmd("lensorts", 4) lensorts(argv[2], argv[3]); end_cmd() begin_cmd("lensortl", 4) lensortl(argv[2], argv[3]); end_cmd() begin_cmd("find", 4) find(argv[2], argv[3]); end_cmd() begin_cmd("findi", 4) findi(argv[2], argv[3]); end_cmd() begin_cmd("cfind", 4) cfind(argv[2], argv[3]); end_cmd() begin_cmd("cfindi", 4) cfindi(argv[2], argv[3]); end_cmd() begin_cmd("showline", 4) showline(argv[2], atoi(argv[3])); end_cmd() begin_cmd("cat_tail", 4) cat_tail(argv[2], atoi(argv[3])); end_cmd() begin_cmd("cat_head", 4) cat_head(argv[2], atoi(argv[3])); end_cmd() begin_cmd("getlinks", 4) getlinks(argv[2], argv[3]); end_cmd() begin_cmd("f2upper", 4) f2upper(argv[2], argv[3]); end_cmd() begin_cmd("f2lower", 4) f2lower(argv[2], argv[3]); end_cmd() begin_cmd("fswpcase", 4) fswpcase(argv[2], argv[3]); end_cmd() begin_cmd("downlist", 4) downlist(argv[2], argv[3]); end_cmd() begin_cmd("hilist", 4) hilist(argv[2], argv[3]); end_cmd() begin_cmd("rtcafter", 4) rtcafter(argv[2], argv[3]); end_cmd() begin_cmd("rtcbefor", 4) rtcbefor(argv[2], argv[3]); end_cmd() begin_cmd("rbcafter", 4) rbcafter(argv[2], argv[3]); end_cmd() begin_cmd("rbcbefor", 4) rbcbefor(argv[2], argv[3]); end_cmd() begin_cmd("numlines", 4) numlines(argv[2], argv[3]); end_cmd() begin_cmd("file2dec", 4) file2dec(argv[2], argv[3]); end_cmd() begin_cmd("file2hex", 4) file2hex(argv[2], argv[3]); end_cmd() begin_cmd("file2bin", 4) file2bin(argv[2], argv[3]); end_cmd() begin_cmd("wordline", 4) wordline(argv[2], argv[3]); end_cmd() begin_cmd("8bit256", 4) repeat = (unsigned int) atoi(argv[3]); _8bit256(argv[2], repeat); end_cmd() begin_cmd("eng2arab", 4) eng2arab(argv[2], argv[3]); end_cmd() begin_cmd("arab2eng", 4) arab2eng(argv[2], argv[3]); end_cmd() begin_cmd("e2ahtml", 4) e2ahtml(argv[2], argv[3]); end_cmd() begin_cmd("freverse", 4) freverse(argv[2], argv[3]); end_cmd() begin_cmd("repcat", 4) repeat = (unsigned int) atoi(argv[3]); repcat(argv[2], repeat); end_cmd() begin_cmd("repcatpp", 4) repeat = (unsigned int) atoi(argv[3]); repcatpp(argv[2], repeat); end_cmd() begin_cmd("copyfile", 4) copyfile(argv[2], argv[3]); end_cmd() begin_cmd("qpatch", 4) qpatch(argv[2], argv[3]); end_cmd() begin_cmd("flipcopy", 4) flipcopy(argv[2], argv[3]); end_cmd() begin_cmd("fillfile", 4) fillfile(argv[2], argv[3][0]); end_cmd() begin_cmd("bin2text", 4) bin2text(argv[2], argv[3]); end_cmd() begin_cmd("bin2hexi", 4) bin2hexi(argv[2], argv[3]); end_cmd() begin_cmd("rndbfile", 4) rndbfile(argv[2], strtoul(argv[3], NULL, 0)); end_cmd() begin_cmd("rndtfile", 4) rndtfile(argv[2], strtoul(argv[3], NULL, 0)); end_cmd() begin_cmd("skipcat", 4) skipcat(argv[2], argv[3]); end_cmd() begin_cmd("onlycat", 4) onlycat(argv[2], argv[3]); end_cmd() begin_cmd("bigascif", 4) bigascif(argv[2], argv[3]); end_cmd() begin_cmd("leetfile", 4) leetfile(argv[2], argv[3]); end_cmd() begin_cmd("asc2ebc", 4) asc2ebc(argv[2], argv[3]); end_cmd() begin_cmd("ebc2asc", 4) ebc2asc(argv[2], argv[3]); end_cmd() begin_cmd("unix2dos", 4) unix2dos(argv[2], argv[3]); end_cmd() begin_cmd("dos2unix", 4) dos2unix(argv[2], argv[3]); end_cmd() begin_cmd("uuencode", 4) uuencode(argv[2], argv[3]); end_cmd() begin_cmd("uudecode", 4) uudecode(argv[2], argv[3]); end_cmd() begin_cmd("wordwrap", 4) wordwrap(argv[2], argv[3]); end_cmd() begin_cmd("compare", 4) compare(argv[2], argv[3]); end_cmd() begin_cmd("ccompare", 4) ccompare(argv[2], argv[3]); end_cmd() begin_cmd("hmakerf", 4) hmakerf(argv[2], argv[3]); end_cmd() begin_cmd("qcrypt", 4) qcrypt(argv[2], argv[3]); end_cmd() begin_cmd("revlines", 4) revlines(argv[2], argv[3]); end_cmd() begin_cmd("html2txt", 4) html2txt(argv[2], argv[3]); end_cmd() begin_cmd("txt2html", 4) txt2html(argv[2], argv[3]); end_cmd() begin_cmd("htmlfast", 4) htmlfast(argv[2], argv[3]); end_cmd() begin_cmd("onlalnum", 4) onlalnum(argv[2], argv[3]); end_cmd() begin_cmd("onlalpha", 4) onlalpha(argv[2], argv[3]); end_cmd() begin_cmd("onlcntrl", 4) onlcntrl(argv[2], argv[3]); end_cmd() begin_cmd("onldigit", 4) onldigit(argv[2], argv[3]); end_cmd() begin_cmd("onlgraph", 4) onlgraph(argv[2], argv[3]); end_cmd() begin_cmd("onllower", 4) onllower(argv[2], argv[3]); end_cmd() begin_cmd("onlprint", 4) onlprint(argv[2], argv[3]); end_cmd() begin_cmd("onlpunct", 4) onlpunct(argv[2], argv[3]); end_cmd() begin_cmd("onlspace", 4) onlspace(argv[2], argv[3]); end_cmd() begin_cmd("onlupper", 4) onlupper(argv[2], argv[3]); end_cmd() begin_cmd("onlxdigt", 4) onlxdigt(argv[2], argv[3]); end_cmd() begin_cmd("skpalnum", 4) skpalnum(argv[2], argv[3]); end_cmd() begin_cmd("skpalpha", 4) skpalpha(argv[2], argv[3]); end_cmd() begin_cmd("skpcntrl", 4) skpcntrl(argv[2], argv[3]); end_cmd() begin_cmd("skpdigit", 4) skpdigit(argv[2], argv[3]); end_cmd() begin_cmd("skpgraph", 4) skpgraph(argv[2], argv[3]); end_cmd() begin_cmd("skplower", 4) skplower(argv[2], argv[3]); end_cmd() begin_cmd("skpprint", 4) skpprint(argv[2], argv[3]); end_cmd() begin_cmd("skppunct", 4) skppunct(argv[2], argv[3]); end_cmd() begin_cmd("skpspace", 4) skpspace(argv[2], argv[3]); end_cmd() begin_cmd("skpupper", 4) skpupper(argv[2], argv[3]); end_cmd() begin_cmd("skpxdigt", 4) skpxdigt(argv[2], argv[3]); end_cmd() begin_cmd("ftothe", 4) ftothe(argv[2], argv[3]); end_cmd() begin_cmd("blanka", 4) blanka(argv[2], argv[3]); end_cmd() begin_cmd("unblanka", 4) unblanka(argv[2], argv[3]); end_cmd() begin_cmd("najirle", 4) najirle(argv[2], argv[3]); end_cmd() begin_cmd("unajirle", 4) unajirle(argv[2], argv[3]); end_cmd() begin_cmd("gplus", 4) a = atoi(argv[2]); b = atoi(argv[3]); gplus(a, b); end_cmd() begin_cmd("gminus", 4) a = atoi(argv[2]); b = atoi(argv[3]); gminus(a, b); end_cmd() begin_cmd("gtimes", 4) a = atoi(argv[2]); b = atoi(argv[3]); gtimes(a, b); end_cmd() begin_cmd("gdivide", 4) gdivide_a = atof(argv[2]); gdivide_b = atof(argv[3]); gdivide(gdivide_a, gdivide_b); end_cmd() begin_cmd("bytsplit", 4) bytsplit(argv[2], atol(argv[3])); end_cmd() begin_cmd("kbsplit", 4) kbsplit(argv[2], atol(argv[3])); end_cmd() begin_cmd("mbsplit", 4) mbsplit(argv[2], atol(argv[3])); end_cmd() begin_cmd("gbsplit", 4) gbsplit(argv[2], atol(argv[3])); end_cmd() begin_cmd("mjoin", 4) mjoin(argv[2], argv[3]); end_cmd() begin_cmd("listdigt", 4) listdigt(atoi(argv[2]), argv[3]); end_cmd() begin_cmd("listlowr", 4) listlowr(atoi(argv[2]), argv[3]); end_cmd() begin_cmd("listprnt", 4) listprnt(atoi(argv[2]), argv[3]); end_cmd() begin_cmd("listuppr", 4) listuppr(atoi(argv[2]), argv[3]); end_cmd() begin_cmd("charsort", 4) charsort(argv[2], argv[3]); end_cmd() begin_cmd("sp2re2sp", 4) sp2re2sp(argv[2], argv[3]); end_cmd() begin_cmd("lcvfiles", 3) lcvfiles(argv[2]); end_cmd() begin_cmd("rcvfiles", 3) rcvfiles(argv[2]); end_cmd() begin_cmd("mp3tagnf", 3) mp3info(argv[2]); end_cmd() begin_cmd("catrandl", 3) catrandl(argv[2]); end_cmd() begin_cmd("leetstr", 3) printf("\n\n"); leetstr(argv[2]); printf("\n\n"); end_cmd() begin_cmd("lcharvar", 3) lcharvar(argv[2]); end_cmd() begin_cmd("rcharvar", 3) rcharvar(argv[2]); end_cmd() begin_cmd("hexicat", 3) hexicat(argv[2]); end_cmd() begin_cmd("rndffill", 3) rndffill(argv[2]); end_cmd() begin_cmd("zerokill", 3) zerokill(argv[2]); end_cmd() begin_cmd("randkill", 3) randkill(argv[2]); end_cmd() begin_cmd("najisum", 3) najisum(argv[2]); end_cmd() begin_cmd("rndbsout", 3) rndbsout(strtoul(argv[2], NULL, 0)); end_cmd() begin_cmd("rndtsout", 3) rndtsout(strtoul(argv[2], NULL, 0)); end_cmd() begin_cmd("patch", 3) patch(argv[2]); end_cmd() begin_cmd("revcat", 3) revcat(argv[2]); end_cmd() begin_cmd("copyself", 3) copyfile(argv[0], argv[2]); end_cmd() begin_cmd("bigascii", 3) bigascii(argv[2]); end_cmd() begin_cmd("hmaker", 3) hmaker(argv[2]); end_cmd() begin_cmd("wrdcount", 3) printf("\n\n%i\n\n", wrdcount(argv[2])); end_cmd() begin_cmd("addim", 3) addim(atoi(argv[2])); end_cmd() begin_cmd("allfiles", 3) fprintf(stderr, "\n" "NOTE: On most systems you can stop with Ctrl+C\n" "WARNING: This will make a lot of files.\n" "Are you sure? type YES to continue\n" "or anything else to quit.\n" ); safegets(are_you_sure, 80); if (!strcmp(are_you_sure, "YES")) allfiles(atol(argv[2])); end_cmd(); begin_cmd("tothe", 3) tothe(argv[2]); end_cmd() begin_cmd("vowelwrd", 3) vowelwrd(argv[2]); end_cmd() begin_cmd("gigabyte", 3) gigabyte(strtoul(argv[2], NULL, 0)); end_cmd() begin_cmd("sort", 3) sort(argv[2]); end_cmd() begin_cmd("sortlast", 3) sortlast(argv[2]); end_cmd() begin_cmd("lineback", 3) lineback(argv[2]); end_cmd() begin_cmd("longline", 3) longline(argv[2]); end_cmd() begin_cmd("howline", 3) howline(argv[2]); end_cmd() begin_cmd("rndlines", 3) rndlines(argv[2]); end_cmd() begin_cmd("spyramid", 3) spyramid(argv[2]); end_cmd() } /* if (argc >= 2) */ return 0; }
int main( int argc, char *argv[] ) { int j, k, argk; char word[1000], outfname[1000], it201_xfdf_outfname[1000], it201d_xfdf_outfname[1000]; time_t now; int Dependent, Exemptions, nyc_resident; double itemized_ded, std_ded=0.0, LTC=0, AddAdj=0.0, CollegeDed=0.0; Lmap ded_sched; char prelim_1040_outfilename[5000]; /* Intercept any command-line arguments. */ printf("NY-IT201 - 2011 - v%3.1f\n", thisversion); argk = 1; k=1; while (argk < argc) { if (strcmp(argv[argk],"-verbose")==0) verbose = 1; else if (k==1) { infile = fopen(argv[argk],"r"); if (infile==0) {printf("ERROR: Parameter file '%s' could not be opened.\n", argv[argk]); exit(1);} k = 2; /* Base name of output file on input file. */ strcpy(outfname,argv[argk]); strcpy(it201_xfdf_outfname,argv[argk]); strcpy(it201d_xfdf_outfname,argv[argk]); j = strlen(outfname)-1; while ((j>=0) && (outfname[j]!='.')) j--; if (j<0) { strcat(outfname,"_out.txt"); strcat(it201_xfdf_outfname,"_it201.xfdf"); strcat(it201d_xfdf_outfname,"_it201d.xfdf"); } else { strcpy(&(outfname[j]),"_out.txt"); strcpy(&(it201_xfdf_outfname[j]),"_it201.xfdf"); strcpy(&(it201d_xfdf_outfname[j]),"_it201d.xfdf"); } outfile = fopen(outfname,"w"); if (outfile==0) {printf("ERROR: Output file '%s' could not be opened.\n", outfname); exit(1);} printf("Writing results to file: %s\n", outfname); } else {printf("Unknown command-line parameter '%s'\n", argv[argk]); exit(1);} argk = argk + 1; } if (infile==0) {printf("Error: No input file on command line.\n"); exit(1);} /* Pre-initialize all lines to zeros. */ for (j=0; j<MAX_LINES; j++) { L[j] = 0.0; ded_sched[j] = 0.0; } /* Accept parameters from input file. */ /* Expect NY IT200 form lines, something like: Title: NY IT-200 1999 Return L1 ; {Wages} L2 ; {Interest} L3 ; {Dividends} ... */ /* Accept Form's "Title" line, and put out with date-stamp for records. */ read_line( infile, word ); now = time(0); fprintf(outfile,"\n%s %s\n", word, ctime( &now )); get_parameter( infile, 's', word, "FileName" ); /* Preliminary Return Output File-name. */ get_word(infile, prelim_1040_outfilename ); if (ImportFederalReturnData( prelim_1040_outfilename, &PrelimFedReturn ) == 0) { fclose(infile); fclose(outfile); Display_File( outfname ); exit(1); } /* get_parameter(infile, kind, x, emssg ) */ // get_parameter( infile, 's', word, "Status" ); // get_parameter( infile, 'l', word, "Status?"); // if (strncasecmp(word,"Single",4)==0) status = SINGLE; else // if (strncasecmp(word,"Married/Joint",13)==0) status = MARRIED_FILLING_JOINTLY; else // if (strncasecmp(word,"Married/Sep",11)==0) status = MARRIED_FILLING_SEPARAT; else // if (strncasecmp(word,"Head_of_House",4)==0) status = HEAD_OF_HOUSEHOLD; else // if (strncasecmp(word,"Widow",4)==0) status = WIDOW; // else { printf("Error: unrecognized status '%s'. Exiting.\n", word); exit(1); } if (PrelimFedReturn.Itemized) L["itemized"] = 1; else L["did_not_itemize"] = 1; switch (status) { case SINGLE: L["Single"] = 1; break; case MARRIED_FILLING_SEPARAT: L["MFS"] = 1; break; case HEAD_OF_HOUSEHOLD: L["HOH"] = 1;; break; case MARRIED_FILLING_JOINTLY: L["MFJ"] = 1; break; case WIDOW: L["QW"] = 1; break; } fprintf(outfile,"Status = %s (%d)\n", statusnames[status], status); get_parameter( infile, 's', word, "Dependent" ); get_parameter( infile, 'b', &Dependent, "Dependent?"); if (Dependent==1) { fprintf(outfile," Check box C = Yes\n"); L["dependent"] = 1; } else { fprintf(outfile," Check box C = No\n"); L["not_dependent"] = 1; } // GetLineF( "L1", &L[1] ); /* Wages. */ L[1] = PrelimFedReturn.fedline[7]; showline(1); // GetLineF( "L2", &L[2] ); /* Taxable Interest. */ L[2] = PrelimFedReturn.fedline[8]; showline(2); // GetLineF( "L3", &L[3] ); /* Ordinary Dividends. */ L[3] = PrelimFedReturn.fedline[9]; showline(3); // GetLineF( "L4", &L[4] ); /* Taxable refunds, credits, offsets */ L[4] = PrelimFedReturn.fedline[10]; showline(4); // GetLineF( "L5", &L[5] ); /* Alimony received */ L[5] = PrelimFedReturn.fedline[11]; showline(5); // GetLineF( "L6", &L[6] ); /* Business income/loss (fed sched C) */ L[6] = PrelimFedReturn.fedline[12]; showline(6); // GetLineF( "L7", &L[7] ); /* Capital gains/losses (fed sched D) */ L[7] = PrelimFedReturn.fedline[13]; showline(7); // GetLineF( "L8", &L[8] ); /* Other gains/losses (fed form 4794) */ L[8] = PrelimFedReturn.fedline[14]; showline(8); // GetLineF( "L9", &L[9] ); /* Taxable IRA distributions */ L[9] = PrelimFedReturn.fedline[15]; showline(9); // GetLineF( "L10", &L[10] ); /* Taxable pension/annuity amounts */ L[10] = PrelimFedReturn.fedline[16]; showline(10); // GetLineF( "L11", &L[11] ); /* Rental, royalties, partnership, S corp, (fed sched E) */ L[11] = PrelimFedReturn.fedline[17]; showline(11); // GetLineF( "L13", &L[13] ); /* Farm income (fed sched F) */ L[13] = PrelimFedReturn.fedline[18]; showline(13); // GetLineF( "L14", &L[14] ); /* Unemployment compensation */ L[14] = PrelimFedReturn.fedline[19]; showline(14); // GetLineF( "L15", &L[15] ); /* Taxable Social Sec. benefits */ L[15] = PrelimFedReturn.fedline[20]; showline(15); L[27] = L[15]; // GetLineF( "L16", &L[16] ); /* Other income (pg. 14) */ L[16] = PrelimFedReturn.fedline[21]; showline(16); for (j = 1; j <= 11; j++) L[17] = L[17] + L[j]; for (j=13; j <= 16; j++) L[17] = L[17] + L[j]; showline(17); if (absolutev( L[17] - PrelimFedReturn.fedline[22]) > 0.1) { printf(" Warning: L[17] = %6.2f, while Fed-line[22] = %6.2f\n", L[17], PrelimFedReturn.fedline[22] ); fprintf(outfile," Warning: L[17] = %6.2f, while Fed-line[22] = %6.2f\n", L[17], PrelimFedReturn.fedline[22] ); } // GetLineF( "L18", &L[18] ); /* Total federal adjustments to income (pg 14) */ L[18] = PrelimFedReturn.fedline[36]; showline(18); L[19] = L[17] - L[18]; showline_wmsg( 19, "Federal adjusted gross income" ); if (absolutev(L[19] - PrelimFedReturn.fedline[38]) > 0.1) { printf(" Warning: L[19] = %6.2f, while Fed-line[38] = %6.2f\n", L[19], PrelimFedReturn.fedline[38] ); fprintf(outfile," Warning: L[19] = %6.2f, while Fed-line[38] = %6.2f\n", L[19], PrelimFedReturn.fedline[38] ); } GetLineF( "L20", &L[20] ); /* Interest income from non-NY state or local bonds */ GetLineF( "L21", &L[21] ); /* Public employee retirement contributions (pg 15) */ GetLineF( "L22", &L[22] ); /* College choice tuition saving distributions */ GetLineF( "L23", &L[23] ); /* Other (pg 16) */ for (j = 19; j <= 23; j++) L[24] = L[24] + L[j]; showline(24); L[25] = L[4]; /* Taxable refunds, credits, offsets */ showline(25); GetLineF( "L26", &L[26] ); /* Pensions of NYS and local governments and the federal government (see page 16) */ L[27] = L[14]; /* Taxable amount of social security benefits */ showline(27); GetLineF( "L28", &L[28] ); /* Interest income on U.S. government bonds */ GetLine( "L29", &L[29] ); /* Pension and annuity income exclusion */ if (L[29] > 20000.0) { L[29] = 20000.0; showline_wmsg( 29, "(Limited to 20,000.)" ); } else showline(29); GetLineF( "L30", &L[30] ); /* College choice tuition savings deduction / earnings distributions */ GetLineF( "L31", &L[31] ); /* Other (see page 21) */ for (j=25; j <= 31; j++) L[32] = L[32] + L[j]; showline(32); L[33] = L[24] - L[32]; showline_wmsg(33,"New York adjusted gross income (AGI)"); /* NYS Itemized Deductions Schedule, pg. 38 */ GetLine( "LTcare%", <C ); GetLine( "AddAdj", &AddAdj ); GetLine( "CollegeDed", &CollegeDed ); ded_sched[1] = PrelimFedReturn.schedA[4]; ded_sched[2] = PrelimFedReturn.schedA[9]; ded_sched[3] = PrelimFedReturn.schedA[15]; ded_sched[4] = PrelimFedReturn.schedA[19]; ded_sched[5] = PrelimFedReturn.schedA[20]; ded_sched[6] = PrelimFedReturn.schedA[27]; ded_sched[7] = PrelimFedReturn.schedA[28]; ded_sched[8] = PrelimFedReturn.schedA[29]; ded_sched[9] = PrelimFedReturn.schedA[5] + PrelimFedReturn.schedA[8] + LTC * PrelimFedReturn.schedA[4]; ded_sched[10] = ded_sched[8] - ded_sched[9]; ded_sched[11] = AddAdj; ded_sched[12] = ded_sched[10] + ded_sched[11]; if (L[33] <= 100000.0) ded_sched[13] = 0.0; else { /*L33_morethan_100000*/ double ws[50]; if (L[33] <= 475000.0) { /* Worksheet 3 pg 40 */ ws[1] = L[33]; switch (status) { case SINGLE: case MARRIED_FILLING_SEPARAT: ws[2] = 100000.0; break; case HEAD_OF_HOUSEHOLD: ws[2] = 150000.0; break; case MARRIED_FILLING_JOINTLY: case WIDOW: ws[2] = 200000.0; break; default: ws[2] = 0.0; } ws[3] = ws[1] - ws[2]; if (ws[3] < 0.0) ded_sched[13] = 0.0; else { ws[4] = smallerof( ws[3], 50000.0 ); ws[5] = 0.0001 * Round( 10000.0 * (ws[4] / 50000) ); ws[6] = 0.25 * ded_sched[1]; ws[7] = ws[5] * ws[6]; ded_sched[13] = ws[7]; } } else if (L[33] <= 525000.0) { /* Worksheet 4 pg 40 */ ws[1] = L[33] - 475000.0; ws[2] = 0.0001 * Round( 10000.0 * (ws[1] / 50000) ); ws[3] = 0.25 * ded_sched[1]; ws[4] = ws[2] * ws[3]; ws[5] = ws[3] + ws[4]; ded_sched[13] = ws[5]; } else if (L[33] <= 1000000.0) ded_sched[13] = 0.5 * ded_sched[12]; else if (L[33] <= 10000000.0) { /* Worksheet 5 pg 40 */ ws[1] = L[33]; ws[2] = 0.5 * ded_sched[4]; ws[3] = ws[1] - ws[2]; ded_sched[13] = ws[3]; } else { /* Worksheet 6 pg 40 */ ws[1] = L[33]; ws[2] = 0.25 * ded_sched[4]; ws[3] = ws[1] - ws[2]; ded_sched[13] = ws[3]; } } /*L33_morethan_100000*/ ded_sched[14] = ded_sched[12] - ded_sched[13]; ded_sched[15] = CollegeDed; ded_sched[16] = ded_sched[14] + ded_sched[15]; itemized_ded = ded_sched[16]; // GetLine( "Itemized_Deduction", &itemized_ded ); /* Form IT-201-ATT or 0.0 if std ded. */ switch (status) /* Determine the Std. Deduction. Pg. 18. */ { case SINGLE: if (Dependent) std_ded = 3100.0; else std_ded = 7800.0; break; case MARRIED_FILLING_JOINTLY: std_ded = 15650.0; break; case MARRIED_FILLING_SEPARAT: std_ded = 7800.0; break; case HEAD_OF_HOUSEHOLD: std_ded = 10950.0; break; case WIDOW: std_ded = 15650.0; break; } if (std_ded > itemized_ded) { L[34] = std_ded; L["ny_standard"] = 1; showline_wmsg(34,"(Mark Std-deduction)"); } else { L[34] = itemized_ded; L["ny_itemized"] = 1; showline_wmsg(34,"(Mark Itemized-deduction)"); } L[35] = L[33] - L[34]; if (L[35] < 0.0) L[35] = 0.0; else showline(35); get_parameter( infile, 's', word, "L36" ); /* Number of Dependent Exemptions (Pg 76, line e) */ get_parameters( infile, 'i', &k, "L36" ); L[36] = 1000.0 * (double)k; showline(36); L[37] = L[35] - L[36]; if (L[37] < 0.0) L[37] = 0.0; showline_wmsg(37,"taxable income"); L[38] = L[37]; showline(38); if (L[33] <= 104600.0) L[39] = TaxRateLookup( L[38], status ); else tax_computation_worksheet( status ); showline(39); /* Household credit. */ get_parameter( infile, 's', word, "Exemptions" ); /* NY dependent exemptions, Pg 19. */ get_parameter( infile, 'i', &Exemptions, "Exemptions" ); if (Dependent) L[40] = 0.0; else /* From tables starting on page 25. */ if (status==SINGLE) { if (L[19] < 5000.0) L[40] = 75.0; else if (L[19] < 6000.0) L[40] = 60.0; else if (L[19] < 7000.0) L[40] = 50.0; else if (L[19] < 20000.0) L[40] = 45.0; else if (L[19] < 25000.0) L[40] = 40.0; else if (L[19] < 28000.0) L[40] = 20.0; else L[40] = 0.0; } else /* Status = MARRIED_FILLING_JOINTLY, MARRIED_FILLING_SEPARAT, Head_of_house, Widow */ if (status!=MARRIED_FILLING_SEPARAT) { if (L[19] < 5000.0) L[40] = 90.0 + 15.0 * (Exemptions-1); else if (L[19] < 6000.0) L[40] = 75.0 + 15.0 * (Exemptions-1); else if (L[19] < 7000.0) L[40] = 65.0 + 15.0 * (Exemptions-1); else if (L[19] < 20000.0) L[40] = 60.0 + 15.0 * (Exemptions-1); else if (L[19] < 22000.0) L[40] = 60.0 + 10.0 * (Exemptions-1); else if (L[19] < 25000.0) L[40] = 50.0 + 10.0 * (Exemptions-1); else if (L[19] < 28000.0) L[40] = 40.0 + 5.0 * (Exemptions-1); else if (L[19] < 32000.0) L[40] = 20.0 + 5.0 * (Exemptions-1); else L[40] = 0.0; } else { if (L[19] < 5000.0) L[40] = 45.0 + 8.0 * (Exemptions-1); else if (L[19] < 6000.0) L[40] = 37.5 + 8.0 * (Exemptions-1); else if (L[19] < 7000.0) L[40] = 32.5 + 8.0 * (Exemptions-1); else if (L[19] < 20000.0) L[40] = 30.0 + 8.0 * (Exemptions-1); else if (L[19] < 22000.0) L[40] = 30.0 + 5.0 * (Exemptions-1); else if (L[19] < 25000.0) L[40] = 25.0 + 5.0 * (Exemptions-1); else if (L[19] < 28000.0) L[40] = 20.0 + 3.0 * (Exemptions-1); else if (L[19] < 32000.0) L[40] = 10.0 + 3.0 * (Exemptions-1); else L[40] = 0.0; } showline_wmsg(40,"NY state household credit"); /* NY state household credit, (pg 29). */ GetLineF( "L41", &L[41] ); /* Resident credit, Form IT-112-R or IT-112-C, pg 98 */ GetLineF( "L42", &L[42] ); /* Other New York State nonrefundable credits */ L[43] = L[40] + L[41] + L[42]; showline(43); L[44] = L[39] - L[43]; if (L[44] < 0.0) L[44] = 0.0; else showline(44); GetLineF( "L45", &L[45] ); /* Net Other New York State taxes, Form IT-201-ATT, line 30 */ L[46] = L[44] + L[45]; showline_wmsg(46,"Total New York State taxes"); get_parameter( infile, 's', word, "NYC_Resident" ); get_parameters( infile, 'b', &nyc_resident, "NYC_Resident (yes/no) ?"); GetLine( "L50", &L[50] ); /* Part-year New York City resident tax */ GetLine( "L51", &L[51] ); /* Other New York City taxes */ GetLine( "L53", &L[53] ); /* NY City nonrefundable credits */ if (nyc_resident) { /*NYC*/ L[47] = NYcityTaxRateFunction( L[38], status ); showline(47); /* NYC Household credit. */ if (Dependent) L[48] = 0.0; else if (status==SINGLE) /* From table 4, 5, or 6 on page 30. */ { if (L[19] < 10000.0) L[48] = 15.0; else if (L[19] < 12500.0) L[48] = 10.0; else L[48] = 0.0; } else /* Status = 2, 4, or 5. */ if (status!=MARRIED_FILLING_SEPARAT) { if (L[19] < 15000.0) L[48] = 30.0 * Exemptions; else if (L[19] < 17500.0) L[48] = 25.0 * Exemptions; else if (L[19] < 20000.0) L[48] = 15.0 * Exemptions; else if (L[19] < 22500.0) L[48] = 10.0 * Exemptions; else L[48] = 0.0; } else { if (L[19] < 15000.0) L[48] = 15.0 * Exemptions; else if (L[19] < 17500.0) L[48] = 13.0 * Exemptions; else if (L[19] < 20000.0) L[48] = 8.0 * Exemptions; else if (L[19] < 22500.0) L[48] = 5.0 * Exemptions; else L[48] = 0.0; } showline_wmsg(48,"NY City household credit"); /* NY City household credit, (pg 34). */ L[49] = L[47] - L[48]; if (L[49] > 0.0) showline(49); else L[49] = 0.0; showline(50); showline(51); L[52] = L[49] + L[50] + L[51]; showline(52); showline(53); L[54] = L[52] - L[53]; if (L[54] > 0.0) showline(54); else L[54] = 0.0; /* Yonkers case not added. */ L[58] = L[54] + L[55] + L[56] + L[57]; showline_wmsg(58,"NYC taxes"); } /*NYC*/ GetLineF( "L59", &L[59] ); /* Sales or use tax, see pg 29. */ GetLineF( "L60", &L[60] ); /* Voluntary Gift contibutions (pgs 30). */ L[61] = L[46] + L[58] + L[59] + L[60]; showline(61); L[62] = L[61]; showline(62); GetLineF( "L63", &L[63] ); /* Empire State child credit (attach new Form IT-213) */ GetLineF( "L64", &L[64] ); /* NYS/NYC Child care/dependent credit. Form IT-216. */ GetLineF( "L65", &L[65] ); /* NYS Earned income credit. Form IT-213. */ GetLineF( "L66", &L[66] ); /* NYS State noncustodial parent EIC (attach new Form IT-209) */ GetLineF( "L67", &L[67] ); /* Real property credit. Form IT-214. */ GetLineF( "L68", &L[68] ); /* College tution credit. Form IT-272. */ if (nyc_resident) /* City of NY school taxcredit. (pg 26) */ { /*NYC*/ if (Dependent) L[69] = 0.0; else if (L[37] < 250000) { if ((status==SINGLE) || (status==MARRIED_FILLING_SEPARAT) || (status==HEAD_OF_HOUSEHOLD)) L[69] = 63.0; else if ((status==MARRIED_FILLING_JOINTLY) || (status==WIDOW)) L[69] = 125.0; } else L[69] = 0.0; showline(69); /* L[70] = earned_income_credit; */ /* showline(70); */ } /*NYC*/ GetLineF( "L71", &L[71] ); /* Other refundable credits, IT-201-ATT line 18) */ GetLineF( "L72", &L[72] ); /* Total NY State tax withheld. */ GetLineF( "L73", &L[73] ); /* Total City of NY tax withheld. */ GetLineF( "L74", &L[74] ); /* Yonkers tax withheld. */ GetLineF( "L75", &L[75] ); /* Total estimated tax payments (from IT-370)*/ for (j = 63; j <= 75; j++) L[76] = L[76] + L[j]; showline(76); if (L[76] > L[62]) { L[77] = L[76] - L[62]; fprintf(outfile,"L77 = %6.2f REFUND !!!\n", L[77] ); L[78] = L[77]; showline(78); } else { L[80] = L[62] - L[76]; fprintf(outfile,"L80 = %6.2f YOU OWE !!!\n", L[80] ); } fclose(infile); fclose(outfile); outfile = fopen(it201_xfdf_outfname,"w"); output_xfdf_form_data(outfile, it201_2014, L); fclose(outfile); if (std_ded < itemized_ded) { outfile = fopen(it201d_xfdf_outfname,"w"); output_xfdf_form_data(outfile, it201d_2014, ded_sched); fclose(outfile); } printf("\nListing results from file: %s\n\n", outfname); Display_File( outfname ); return 0; }
int main( int argc, char *argv[] ) { int i, j, k; char word[1000], outfname[1000], it1040_xfdf_outfname[1000]; int status=0, exemptions=0, qualify_jfc=0; time_t now; double factor62, factor67, limit; double L35a=0.0, L35b=0.0, L35c=0.0, L35d=0.0, L35e=0.0, L35f=0.0, L35g=0.0; double L37a=0.0, L37b=0.0, L39a=0.0, L39b=0.0; double L40a=0.0, L40b=0.0, L40c=0.0; double L44a=0.0, L44b=0.0; double L46a=0.0, L46b=0.0, L46c=0.0; double L72a=0.0, L72b=0.0, L72c=0.0, L72d=0.0, L72e=0.0; double jfc, exemption_amnt; /* Intercept any command-line arguments. */ printf("OH IT1040 2014 - v%3.1f\n", thisversion); i = 1; k=1; while (i < argc) { if (strcmp(argv[i],"-verbose")==0) verbose = 1; else if (k==1) { infile = fopen(argv[i],"r"); if (infile==0) {printf("ERROR: Parameter file '%s' could not be opened.\n", argv[i]); exit(1);} k = 2; /* Base name of output file on input file. */ strcpy(outfname,argv[i]); strcpy(it1040_xfdf_outfname,argv[i]); j = strlen(outfname)-1; while ((j>=0) && (outfname[j]!='.')) j--; if (j<0) { strcat(outfname,"_out.txt"); strcat(it1040_xfdf_outfname,"_it1040.xfdf"); } else { strcpy(&(outfname[j]),"_out.txt"); strcpy(&(it1040_xfdf_outfname[j]),"_it1040.xfdf"); } outfile = fopen(outfname,"w"); if (outfile==0) {printf("ERROR: Output file '%s' could not be opened.\n", outfname); exit(1);} printf("Writing results to file: %s\n", outfname); } else {printf("Unknown command-line parameter '%s'\n", argv[i]); exit(1);} i = i + 1; } if (infile==0) {printf("Error: No input file on command line.\n"); exit(1);} /* Pre-initialize all lines to zeros. */ for (i=0; i<MAX_LINES; i++) { L[i] = 0.0; } /* Accept parameters from input file. */ /* Expect OH IT1040 lines, something like: Title: OH IT1040 1999 Return L1 {Wages} */ /* Accept Form's "Title" line, and put out with date-stamp for records. */ read_line( infile, word ); now = time(0); fprintf(outfile,"\n%s %s\n", word, ctime( &now )); /* get_parameter(infile, kind, x, emssg ) */ get_parameter( infile, 's', word, "Status" ); get_parameter( infile, 'l', word, "Status ?"); if (strncasecmp(word,"Single",4)==0) { status = SINGLE; L["Single"] = 1; } else if (strncasecmp(word,"Married/Joint",11)==0) { status = MARRIED_FILLING_JOINTLY; L["MFJ"] = 1; }else if (strncasecmp(word,"Married/Sep",11)==0) { status = MARRIED_FILLING_SEPARAT; L["MFS"] = 1; }else if (strncasecmp(word,"Head_of_House",4)==0) { status = HEAD_OF_HOUSEHOLD; L["HOH"] = 1; } else { printf("Error: unrecognized status '%s'. Must be: Single, Married/joint, Married/sep, Head_of_house.\nExiting.\n", word); fprintf(outfile,"Error: unrecognized status '%s'. Must be: Single, Married/joint, Married/sep, Head_of_house.\nExiting.\n", word); exit(1); } fprintf(outfile,"Status = %s (%d)\n", word, status); GetLine( "L1", &L[1] ); /* Federal Adjusted Gross Income */ get_parameter( infile, 's', word, "Exemptions" ); /* Exemptions, self/depend. */ get_parameters( infile, 'i', &exemptions, "Exemptions"); /* Answer YES only if Married Filing Jointly, and you and your spouse */ /* each have qualifying Ohio adjusted gross income of at least $500. */ get_parameter( infile, 's', word, "JointCredit" ); get_parameter( infile, 'b', &qualify_jfc, "JointCredit ?"); GetLine( "L14", &L[14] ); /* Earned income credit (see the worksheet on page 20). */ GetLine( "L15", &L[15] ); /* Ohio adoption credit ($1,500 per child adopted during the year). */ GetLine( "L16", &L[16] ); /* Manufacturing equipment grant. */ GetLine( "L19", &L[19] ); /* Unpaid Ohio Use Tax */ GetLine( "L21", &L[21] ); /* Ohio Tax Withheld (box 17 on your W-2) */ GetLine( "L22", &L[22] ); /* 1040ES payments, IT 40P extension payments for 2014, 2013 overpayments ... */ /* Additions - add to extent not included in fed adjusted gross income (line 1). */ GetLine( "L33", &L[33] ); /* Non-Ohio state or local gov't interest, dividends. */ GetLine( "L34", &L[34] ); /* Pass-through Entity addback. */ GetLine( "L35a", &L35a ); /* Fed int+div subject to state tax & misc. fed adj. */ L["35a"] = L35a; GetLine( "L35b", &L35b ); /* Reimbursed college tuit. fees deducted prev yrs. */ L["35b"] = L35b; GetLine( "L35c", &L35c ); /* Losses, sale of Ohio Public Obligations. */ L["35c"] = L35c; GetLine( "L35d", &L35d ); /* Nonmedical withdrawals OH Med. Savings Acct. */ L["35d"] = L35d; GetLine( "L35e", &L35e ); /* Reimb. exp. prev. deducted, if reimb. not in FAGI .*/ L["35e"] = L35e; GetLine( "L35f", &L35f ); /* Lump sum distribution add-back + misc. fed income tax adjustments */ L["35f"] = L35f; GetLine( "L35g", &L35g ); /* Adjustment for IRC section 168(k) and 179 depreciation expense */ L["35g"] = L35g; L[35] = L35a + L35b + L35c + L35d + L35e + L35f + L35g; /* Deductions - see limitations in instructions. */ GetLine( "L37a", &L37a ); /* Fed int + div exempt from state taxation. */ L["37a"] = L37a; GetLine( "L37b", &L37b ); /* Adjustment for Internal Revenue Code sections 168(k) + 179 deprec. expense */ L["37b"] = L37b; L[37] = L37a + L37b; GetLine( "L38", &L[38] ); /* Employee compensation earned in OH by non-residents. */ GetLine( "L39a", &L39a ); /* Military pay. */ L["39a"] = L39a; GetLine( "L39b", &L39b ); /* Military Retirement Income. */ L["39b"] = L39b; L[39] = L39a + L39b; GetLine( "L40a", &L40a ); /* State/municipal income tax overpayments. */ L["40a"] = L40a; GetLine( "L40b", &L40b ); /* Refund or reimbursements shown on IRS form 1040, line 21 */ L["40b"] = L40b; GetLine( "L40c", &L40c ); /* Repayment of income reported in a prior year, ... */ L["40c"] = L40c; L[40] = L40a + L40b + L40c; GetLine( "L41", &L[41] ); /* Small business investor income deduction */ GetLine( "L42", &L[42] ); /* Disab. & survivor benef. */ GetLine( "L43", &L[43] ); /* Qualifying soc. sec. + railroad benefits. */ GetLine( "L44a", &L44a ); /* Education: Ohio 529 contributions */ L["44a"] = L40a; GetLine( "L44b", &L44b ); /* Education: Ohio 529 contributions */ L["44b"] = L40b; L[44] = L44a + L44b; GetLine( "L45", &L[45] ); /* Ohio National Guard reimbursements */ GetLine( "L46a", &L46a ); /* Unreimbursed health insurance ... */ L["46a"] = L40a; GetLine( "L46b", &L46b ); /* Funds deposited into, and earnings of, a medical savings account */ L["46b"] = L40b; GetLine( "L46c", &L46c ); /* Qualified organ donor expenses */ L["46c"] = L40c; L[46] = L46a + L46b + L46c; GetLine( "L47", &L[47] ); /* Wage expense not deducted */ GetLine( "L48", &L[48] ); /* Interest income from Ohio Public Obligations ... */ GetLine( "L51", &L[51] ); /* Retirement Income Credit (see instructions for credit table) (Limit $200) */ if (L[51] > 200.0) L[51] = 200.0; GetLine( "L52", &L[52] ); /* Senior Citizen Credit (Limit $50 per return) */ if (L[52] > 50.0) L[52] = 50.0; GetLine( "L53", &L[53] ); /* Lump Sum Distribution Credit (you must be 65 years of age or older to claim this credit) */ GetLine( "L54", &L[54] ); /* Child and Dependent Care Credit (see instructions and worksheet) */ GetLine( "L55", &L[55] ); /* Lump Sum Retirement Credit */ GetLine( "L57", &L[57] ); /* Displaced worker credit (Limit $500 single; $1,000 joint, if both spouses qualify) */ if (status == MARRIED_FILLING_JOINTLY) limit = 2.0 * 500.0; else limit = 500.0; L[57] = smallerof( L[57], limit ); GetLine( "L58", &L[58] ); /* Ohio Political Contributions Credit (Limit $50 single; $100 joint) */ if (status == MARRIED_FILLING_JOINTLY) limit = 2.0 * 50.0; else limit = 50.0; L[58] = smallerof( L[58], limit ); GetLine( "L60", &L[60] ); /* Portion of line 3 subjected to tax by other states. */ GetLine( "L63", &L[63] ); /* 2014 income tax paid to other states ... */ /* For non-residents only. */ GetLine( "L65", &L[65] ); /* Portion Ohio Adj. Gross Income not earned in Oh. */ GetLine( "L68", &L[68] ); /* Nonrefundable Business Credits, Sched-E line 10 */ GetLine( "L72a", &L72a ); /* Refundable Business Jobs Credits, */ L[72] = L72a; GetLine( "L72b", &L72b ); /* Refundable Pass-through Entity Credits, */ L["72b"] = L72b; GetLine( "L72c", &L72c ); /* Refundable Histroic Preservation Credits, */ L["72c"] = L72c; GetLine( "L72d", &L72d ); /* Refundable Motion Picture Credits */ L["72d"] = L72d; GetLine( "L72e", &L72e ); /* Financial Institutions Tax (FIT) credit */ L["72e"] = L72e; L[73] = L72a + L72b + L72c + L72d + L72e; L[23] = L[73]; /* ---- Do Calculations. ---- */ L[36] = L[33] + L[34] + L[35]; for (j = 37; j <= 48; j++) L[49] = L[49] + L[j]; L[50] = L[36] - L[49]; L[2] = L[50]; L[3] = L[1] + L[2]; if (L[3] <= 40000.0) exemption_amnt = 2200.0; else if (L[3] <= 80000.0) exemption_amnt = 1950.0; else exemption_amnt = 1700.0; L[4] = exemption_amnt * exemptions; L[5] = NotLessThanZero( L[3] - L[4] ); L[6] = TaxRateFunction( L[5], status ); if (L[5] <= 10000.0) L[56] = 88.0; for (j = 51; j <= 58; j++) L[59] = L[59] + L[j]; L[7] = L[59]; L[8] = NotLessThanZero( L[6] - L[7] ); if (L[5] < 30000) L[9] = 20.0 * exemptions; L[10] = NotLessThanZero( L[8] - L[9] ); if ((status == MARRIED_FILLING_JOINTLY) && (qualify_jfc)) { /*Joint_Filing_Credit*/ if (L[5] < 25000) jfc = 0.20; else if (L[5] < 50000) jfc = 0.15; else if (L[5] < 75000) jfc = 0.10; else jfc = 0.05; L[11] = smallerof( jfc * L[10], 650.0 ); L["11p"] = jfc*100.0; } /*Joint_Filing_Credit*/ L[12] = L[10] - L[11]; /* L[13] computed below, which depends on L[71] and the following prior lines. */ L[61] = L[3]; factor62 = 0.0001 * (int)(10000.0 * (L[60] / L[61])); /* 4-digits right of decimal-pt. */ L["62p"] = factor62; L[62] = factor62 * L[12]; L[64] = smallerof( L[62], L[63] ); L[69] = L[64]; L[66] = L[3]; factor67 = 0.0001 * (int)(10000.0 * (L[65] / L[66])); /* 4-digits right of decimal-pt. */ L["67p"] = factor67; L[67] = factor67 * L[12]; L[70] = L[67]; L[71] = L[68] + L[69] + L[70]; L[13] = L[71]; /* Resuming now with calculations at line 17. */ L[17] = NotLessThanZero( L[12] - (L[13] + L[14] + L[15] + L[16]) ); L[20] = L[17] + L[18] + L[19]; L[24] = L[21] + L[22] + L[23]; if ((status == SINGLE) && (L[1] <= 12200.0) && (L[50] == 0.0)) fprintf(outfile, "You do not need to file Ohio tax return (Fed AGI < minimum).\n"); if ((status == MARRIED_FILLING_JOINTLY) && (L[1] <= 14400.0) && (L[50] == 0.0)) fprintf(outfile, "You do not need to file Ohio tax return (Fed AGI < minimum).\n"); if ((L[4] >= L[3]) && (L[50] == 0.0)) fprintf(outfile, "You do not need to file Ohio tax return (L[4] >= L[3]).\n"); /* Output the Results. */ showline(1); showline(2); showline(3); fprintf(outfile,"Exemptions = %d\n", exemptions ); for (j = 4; j <= 10; j++) showline(j); fprintf(outfile, "L10a = %6.2f\n", L[10]); for (j = 11; j <= 19; j++) showline(j); showline_wmsg( 20, "Total Ohio Tax" ); showline_wmsg( 21, "Amount Withheld" ); showline(22); showline(23); showline_wmsg( 24, "Total Payments" ); if (L[24] > L[20]) { L[25] = L[24] - L[20]; showline_wmsg( 25, "AMOUNT OVERPAID" ); } else { L[29] = L[20] - L[24]; showline_wmsg( 29, "AMOUNT DUE" ); } showline(33); showline(34); showline_wlabel( "L35a", L35a ); showline_wlabel( "L35b", L35b ); showline_wlabel( "L35c", L35c ); showline_wlabel( "L35d", L35d ); showline_wlabel( "L35e", L35e ); showline_wlabel( "L35f", L35f ); showline_wlabel( "L35g", L35g ); showline_wmsg( 36, "Total additions" ); showline_wlabel( "L37a", L37a ); showline_wlabel( "L37b", L37b ); showline(38); showline_wlabel( "L39a", L39a ); showline_wlabel( "L39b", L39b ); showline_wlabel( "L40a", L40a ); showline_wlabel( "L40b", L40b ); showline_wlabel( "L40c", L40c ); showline(41); showline(42); showline(43); showline_wlabel( "L44a", L44a ); showline_wlabel( "L44b", L44b ); showline(45); showline_wlabel( "L46a", L46a ); showline_wlabel( "L46b", L46b ); showline_wlabel( "L46c", L46c ); showline(47); showline(48); showline_wmsg( 49, "Total Deductions" ); showline_wmsg( 50, "Net adjustments" ); for (j = 51; j <= 58; j++) showline(j); showline_wmsg(59,"Total Schedule B Credits"); showline(60); showline(61); fprintf(outfile," (L62 [%g]) \t", factor62 ); for (j = 62; j <= 66; j++) showline(j); fprintf(outfile," (L67 [%g]) \t", factor67 ); for (j = 67; j <= 73; j++) showline(j); fclose(infile); fclose(outfile); outfile = fopen(it1040_xfdf_outfname,"w"); output_xfdf_form_data(outfile, it1040_2014, L); fclose(outfile); Display_File( outfname ); printf("\nResults written to file: %s\n", outfname); return 0; }