Program Structure:

The TaxSolve programs are divided into two parts:
  1. taxsolve_routines.c - Common routines for all tax forms.
  2. taxsolve_<formname>.c - Program for specific tax form. (ex. taxsolve_usa_fed1040_2012.c)
There are many variants of the second program for specific tax-years, states, countries, and auxiliary forms.

For example, supplied in the OTS package are:

  1. src / taxsolve_routines.c
  2. src / taxsolve_fed1040_2012.c - Configured for US federal 1040 for 2012.
  3. examples_and_templates / fed1040_2012_template.txt - Starting template for your tax data. A text file to place your earnings/interest/... numbers.
  4. examples_and_templates / fed1040_2012_example.txt - Example of a properly filled out input file that works with the source files above, for testing.
The most popular 1040 forms are presently available with this version. Cases handled include, single, married filing jointly, married filing separately, head of household, widow(er), with either standard deduction or itemized. Includes calculations for Schedules A, B, C, and D to calculate interest, dividends, capital gains/losses, and business taxes. Cases that go beyond are noted by stubs with warning messages saying "not presently handled". The package covers many people with common situations. Where it does not, it may require some slight and hopefully obvious/easy extension.

As currently configured the form-specific part (ex. taxsolve_.c) includes taxsolve_routines.c (with #include) and contains the main routine. You need only compile the one program.

Program Design for Tax Rules:

OTS programs read values from your input file into its L[..] tax-form-line variables, then adds or subtracts the items according to the tax-rules, and prints the results. To do this efficiently, several convenience functions have been provided, such as GetLine and ShowLine. GetLine checks for the named line number, and adds up any contributing entries, while parsing and ignoring any comments. ShowLine prints the resulting line value in a convenient format after the line number or name. The are several variants of the convenience routines. GetLineF is a combination of GetLine and ShowLine. It gets the line data, and prints it to the output file.

Example OTS Program Code:

 GetLine( "L7", &L[7] );	/* Expect label "L7", read value(s) into variable L[7]. */
 ShowLine(7);			/* Print the value of L[7] to output. */
 GetLine( "L9", &L[9] );
 L[12] = L[7] + L[9];		/* Perform a calculation. */
 GetLine( "L15", &L[15] );
 if (L[15] > L[12])
  L[16] = L[15] - L[12];
  L[16] = 0.0;

Capital Gains/Losses are Recorded as:

	buy_cost	date
	sale_value	date
Buy cost is negative; it is a cost; an outlay. Date is xx-yy-zz, where xx is the two-digit month, yy is the day, and zz is the last two digits of the year. (Yes, this is Y2K proof.)

Example Data File Entries:

        -3658.22        12-15-99        { 100 Shares XOM }
         4209.95         1-25-02
The dates are required to apply the proper short-term or long-term capital gains rates on Federal taxes, but are not required for State tax forms.

Return to OpenTaxSolver Home