pcp (Parcel Calculator Portable)
I was gathering information for a “Portability and Cross-Compilation under Mac OS X” tutorial when I came to the conclusion to create a portable version of my Objective-C / Cocoa project Parcel Calculator. Nothing bloated, just a command line utility providing Parcel Calculator’s most common features to users of other platforms than Mac OS X. I decided to use C syntax for this purpose. C is still one of the most popular programming languages and there are very few computer architectures without a C compiler. A standards-compliant and portably written C program can be compiled for a very wide variety of platforms and operating systems with little or no change to it’s source code. So the idea behind was to implement as much portable C programming knowledge as possible to the project’s codebase while keeping it simple and understandable. I decided to use the current standard C99, even not supported by all compilers. I will explain in my upcoming tutorial how I worked around that and achieved compilation with compilers not C99 compliant. It is common to keep the name of a command line tool short and simple, so I named it “pcp” (Parcel Calculator Portable). A word and a blow, pcp is done and already published on GitHub. Click here to access the pcp GitHub repository, I added references and links to the Parcel Calculator section on this page. In the wake of pcp development I created a brandnew version of ptarget.h, a portable header for compiler and OS detection, able now to detect 22 compilers and 30 operating systems. Here is a screenshot taken from the Mac OS X binary of pcp with ptarget.h being used for the version output.
Right now I am busy finalizing my “Portability / Cross-Compilation” tutorial. All of those wonderful features and practices I added to pcp will be covered in detail. We will even go one step further and compile binaries for other operating systems under Mac OS X. Of course I have virtual machines covering different platforms, but compiling with the system of your choice saves valuable time and is efficient in some other ways I will return to later. For now I hope you enjoy pcp, feel free to fork it if you want to contribute and be sure to return here soon. Before I’ll forget it: there is a new version of Parcel Calculator for Mac OS X on the way. I just created a dev branch on GitHub to reflect more recent changes to the code while keeping availability of the stable codebase. The new version will continue with extensive usage of Objective-C 2.0 (I commited strict dot syntax implementation for the upcoming release) and there will be an option to save parcel IDs for later reference.
