Social Security Benefit Calculator Source Code

Versions of the program

There are two versions of the Social Security Benefit Calculator: one for Windows and one for the MacOS. The version for Windows is compiled using the Microsoft Visual C/C++ compiler (2022 version). The version for the MacOS is compiled using the Metrowerks CodeWarrior compiler (version 9.0)

Source code for the calculator

The source code that does the actual benefit calculations is stored in subdirectories oactobjs (for the MacOS) and oactobjs32 (for Windows). In addition there are extra files in each subdirectory saved by the compiler to help the compiler build the libraries; those files differ from Windows to MacOS.

The source code for the windowing part of the program is stored in subdirectories anypiamacprojOSX (for the MacOS) and anypia32 (for Windows). There is also a subdirectory anypiab with source code to make a console application; it uses the Windows calculation code. (See Batch Version of the Calculator for more details.)

You can download the MacOS calculation and windowing code (subdirectories oactobjs and anypiamacOSXproj), and/or the Windows calculation and windowing code (subdirectories oactobjs32, anypia32, and anypiab). The code for the MacOS is available as .sitx archives. The Windows code is available as self-extracting zipped files (executable on a Windows machine) or as plain zip files (which can be expanded on any operating system with unzip capabilities).

Downloading Windows source code

To download the Windows code, click one item from each of the following rows:

Source files

Self-extracting zip file

Plain zip file

oactobjs32

oactobjs32.exe (834,048 bytes)

oactobjs32.zip (644,974 bytes)

anypia32 and anypiab

source32.exe (339,456 bytes)

source32.zip (150,147 bytes)

Downloading MacOS source code

To download the MacOS code, click on each of the following items:

Source files

Archive file (.sitx)

oactobjs

oactobjs.sitx (260,631 bytes)

anypiamacproj

anypiamacprojOSX.sitx (159,966 bytes)

The Boost Libraries

In the 2006.2 and later versions of the code, we use the Boost libraries, which are a set of free open-source libraries that perform common functions not included in the C++ Standard Library. In order to use our source code, you will have to download and install the libraries from www.boost.org. That website has instructions on how to install the libraries on your computer. The Windows code uses the 1.81.0 version of the Boost libraries, and the Mac version uses 1.33.1.

In your C++ projects for each of the libraries in our source code and the main program project, you must put an include path to the base of your Boost install directory. Here's where we have boost installed in the ready-made projects we include with our source code: On a Windows machine, the libraries are in a subdirectory of oactobjs32 named "boost_1_81_0". On a Mac, the libraries are in a directory parallel to oactobjs and anypiamacprojOSX named "boost_1_33_1". Once this is done, you can use our projects to build the program.

The oactobjs directory (for MacOS)

oactobjs contains 183 include files (ending in .h) and four subdirectories with library source code. The first subdirectory, miscproj, contains 38 files (ending in .cpp) for classes that are not tied specifically to Social Security benefit calculations. The second subdirectory, piadataproj, contains 149 files (ending in .cpp) for classes involving benefit calculations. The third subdirectory, piaoutproj, contains 38 include files (ending in .h) and 38 files (ending in .cpp) for classes involving printing out the results of a benefit calculation. The fourth subdirectory, mac, contains six header files (ending in .h) and one file (ending in .cpp) for functions which are not available in MacOS, or that differ from similar functions on other operating systems. The code in all four subdirectories has only been tested with the Metrowerks compiler within the MacOS environment.

The oactobjs32 directory (for Windows)

oactobjs32 contains five subdirectories with library source code. The first subdirectory, windows, contains 15 include files (ending in .h), 6 C files (ending in .c) and 4 C++ files (ending in .cpp) for functions that are not available with the Windows operating system, or that differ from similar functions on other operating systems. The second subdirectory, misc, contains 31 files (ending in .cpp) for classes that are not tied specifically to Social Security benefit calculations. The third subdirectory, piadata, contains 152 files (ending in .cpp) for classes involving benefit calculations. The fourth subdirectory, piaout, contains 40 include files (ending in .h) and 40 files (ending in .cpp) for classes involving printing out the results of a benefit calculation. The fifth subdirectory, include, contains 182 header files (ending in .h). In addition, each subdirectory except include contains a solution file (ending in .sln) and a project file (ending in .vcxproj) that work with the Microsoft compiler, 2022 version, to create each library. However, the code in the three subdirectories other than windows has been compiled in the past on the Linux operating system using the Gnu C++ compiler, where the subdirectory linux takes the place of the subdirectory windows.

The anypiamacprojOSX directory

anypiamacprojOSX contains five subdirectories: one with the user interface code for the MacOS version of the benefit calculation program, one with resource files, one with information for prebuilding include files, one for target information, and one for output. The subdirectory named Source contains 33 include files (ending in .h), 31 files with class functions (ending in .cp or .cpp), and 1 file with utility functions (ending in .c). The subdirectory named Resources contains 10 files for icons and visual layout information. The subdirectory named Prefix contains 3 files for prebuilding include files. The directory anypiamacData is empty, but will contain target information after the project has been opened in CodeWarrior. The directory Output will contain the executable file when the program is built.

The anypiab directory

anypiab contains the necessary files to make a console application (command prompt executable) that reads either one file with multiple cases or multiple individual data files and calculates the benefit for each case (see Batch Version of the Calculator). There are 3 include files (ending in .h), 3 files with C++ code (ending in .cpp), a solution file (anypiab.sln) and a project file (anypiab.vcxproj) for compiling with the Microsoft compiler, 2022 version, and two illustrative data files (anypiab.pia and anypiac.dat). The solution references three libraries in the oactobjs32 directory (windows, misc, and piadata), so those libraries need to be made before compiling the files in this subdirectory. There is a macro named DETAILS which can be defined to allow anypiab to produce detailed output. If it is defined, the fourth library (piaout) must also be made before compiling the files in this subdirectory. The anypiab program has been compiled on other operating systems, including Linux using the Gnu C++ compiler with the linux library replacing the windows library.

The anypia32 directory

anypia32 contains the user interface code for the Windows version of the Calculator and one subdirectory with resource files. There are 40 include files (ending in .h), 39 files with class functions (ending in .cpp), a resource file (anypia32.rc), a solution file (anypia32.sln), a project file (anypia32.vcxproj), and a help macro file (resource.hm). The subdirectory res contains 4 files for icons and bitmaps. The solution references the four libraries in the oactobjs32 subdirectory and the Boost libraries, so those libraries need to be made before compiling the files in this subdirectory.

Compilers

The source code, as distributed, may not compile correctly with compilers other than those mentioned above. The author will provide limited assistance to anyone trying to recompile the program with another compiler or in another operating system.

Documentation

We provide descriptions of the functions available in the oactobjs32 libraries in a compiled help file for Windows and a set of HTML files in a sitx archive for Mac OSX. To download the documentation, click the following item:

Source documentation

Compiled HTML file (Windows)

Archive file (Mac)

oactobjs

oactobjsdoc.chm (6,129,262 bytes)

oactobjsdoc.sitx (2,037,626 bytes)

Creating a program with changes from present law

A version of the interactive or console program that can handle some changes from present law can be created by using the LawChangeArray created on line 69 of anypiabdoc.cpp (for the console version) or line 195 of AnypiaDoc.cpp (for the Windows interactive version). Note, however, that only some of the 40 listed changes from present law have actually been implemented. Also note that there is not yet any user interface code to handle the indicators for changes from present law.

Program in Fortran

We also have a Social Security benefit estimate program in Fortran, the operation of which is similar to that of the C++ version. The Fortran source code is structured similarly to the C++ version, but has not been updated for some years. The source code for the program, or the program compiled for MS-DOS, is available in a self-extracting zipped file sourcef.exe (384,000 bytes), or in a plain zipped file, sourcef.zip (358,085 bytes).

The program compiles in Windows 98 or NT, using Compaq Fortran. There are also separate files of subroutines enabling the program to compile on a Unix system or on an IBM mainframe. However, the compiled program does not have some of the screen-handling capabilities of the C++ version; therefore we distribute the C++ version, rather than the Fortran version, as the Calculator.

Questions or comments

If you have questions or comments about the Detailed Calculator, please visit our Contact Social Security page for ways to contact us. Remember to use "Detailed Calculator" as the subject so we know which calculator your question or comment refers to.