Program Structure:

The TaxSolve programs are divided into two parts:
  1. taxsolve_routines.c - Common library routines for all tax programs. These re-usable library routines make designing individual tax programs easy and intuitive. For example, it contains functions for getting and printing lines, filtering comments, and adding multiple entries together. It handles many types of data formats common with tax data, such as dollar signs ($), numbers with commas (3,340.00), and displaying dollars and cents in various ways.
  2. taxsolve_<formname>.c - Program for specific tax form. (ex. taxsolve_usa_fed1040.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_20xx.c - Configured for US federal 1040 for the 20xx tax-year.
  3. tax_form_files / fed1040_20xx_template.txt - Blank starting template for your tax data. A text file to place your earnings/interest/... numbers.
  4. tax_form_files / fed1040_20xx_example.txt - Example of a properly filled-out input file that works with the programs, used in testing and teaching.
Several common tax-forms are presently implemented. The programs generally handle multiple types of filing status including: single, married filing jointly, married filing separately, head of household, widow(er), with either standard deduction or itemized. Cases that go beyond what a given program handles, should be noted by stubs with warning messages saying "not presently handled". The package covers many of the most common situations. But due to the complexity of tax laws, it cannot handle all situations. Where it does not, the program can be extended by the individual user, if so inclined.

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

The included makefile compiles all the programs provided in a given package.

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] );
 ShowLine(9);
 L[12] = L[7] + L[9];		/* Perform a calculation. */
 showline(12);
 GetLine( "L15", &L[15] );
 if (L[15] > L[12])
  L[16] = L[15] - L[12];
 else
  L[16] = 0.0;
 ShowLine(16);
 

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

.