Dave Gillespie

Welcome to my Home Page!

Who am I? I'm a programmer, and I have put this page together as a way to distribute some of the programs I've written over the years. Sorry, no baby pictures or links to my favorite soap stars just yet...

These programs are distributed in source-code form covered by the GNU General Public License. The GPL basically says you are allowed to use and distribute the program freely, but only freely---for example, you aren't allowed to incorporate the program in your own proprietary product. Click here to learn more about the GPL.

These programs are encoded with tar and gzip. Utilities to unpack these files are available from the GNU project, or from the GNU FTP server, prep.ai.mit.edu.

Feel free to contact me at daveg@synaptics.com.

p2c -- a Pascal to C translator

P2c started out as a tool to help us translate the Chipmunk Tools, a set of CAD tools developed at Caltech. These tools were written in HP Pascal, a powerful dialect of the Pascal programming language which unfortunately only works on HP computers. When it came time for the tools to outgrow their original HP "Chipmunk" workstations, they had to be translated to a more portable language like C. I was able to save several months of dull grunt work by writing an automatic translator to do the job. True, it did take a year and a half to write the translator, but the grunt work was almost entirely eliminated.

P2c is written in C. It was designed for Unix, but it compiles pretty easily on any system with a 32-bit C compiler. P2c is distributed as source code only---you will have to compile it yourself. P2c itself is covered by the GNU General Public License, but programs translated by p2c, and the runtime code supplied with p2c, are explicitly not covered by the GPL. You can do whatever you want with those.

P2c understands all of ISO Standard Pascal, and most of the extensions of HP Pascal, Turbo Pascal, VAX Pascal, and a variety of other dialects. P2c can be targeted to generate ANSI C, older-style C, or C++. However, p2c does not know how to target to specific computers or operating systems, so if your program uses built-in Pascal functions for graphics, device-level I/O, and so on, then you will have to supply your own C functions to do those jobs.

P2c's main goals are readability and correctness of the output code. Translators usually fall in one of two categories: Either they work on the text of the program directly without really "understanding" the program, or they are really more like a Pascal compiler that outputs C instead of machine language. The first kind of translators can preserve most of the formatting of the original program, producing translations that are easy to read and to maintain, but that usually require a lot of manual touch-up work before they are correct and ready to compile. The other kind of translators can guarantee the correctness of the translation, but often the output is barely readable by humans. P2c tries for a middle ground, using compiler-like techniques to get a high-quality translation, but also paying close attention to issues like comments, naming, and formatting that true compilers generally ignore.

For example, the names Foo and FOO are equivalent in Pascal but distinct in C. If your program declares a variable as Foo but later refers to it as foo or FOO, p2c will change all the references to read "Foo" in order to match C's rules. A purely text-style translator might leave the names alone, requiring you to fix them up by hand afterward. A compiler-style translator might convert all names to upper-case to save itself the trouble, producing a translation that was perfectly correct but not very pleasing to the human eye.

P2c is designed to translate large, complex programs. A number of people have used p2c to translate 100K- to million-line Pascal programs into C.

The most recent official release of p2c was version 1.20, released in 1991. You can still FTP it from cs.caltech.edu,. You can also download 1.20.1, with one minor bug fix in the realint function, from this Web page:

Click here to download p2c 1.20.1 (.tar.gz, 390K)

In late 1993 I made available some early "alpha test" copies of p2c 1.21, but I never had time to formally release it. However, the alpha release has proven pretty solid over time. It includes a variety of bug fixes, plus support for translating object-oriented Pascal (Mac Object Pascal or Turbo Pascal 6.0) into C++.

Click here to download p2c 1.21 "alpha 2" (.tar.gz, 422K)

Calc -- the GNU Emacs calculator

GNU Emacs is an extensible text editor widely used in the Unix community. Just how extensible? To find out, I set out to write a full-featured calculator extension in the Emacs Lisp extension language. Before I knew it, I had a powerful interactive package for numerical and symbolic math. Emacs Calc can do arbitrary precision arithmetic, operations on matrices, complex numbers, calendar dates and various other types, plus symbolic algebra and calculus, graphics, and lots more. Calc also comes with an extensive manual which you can print or read on-line. (The GNU project sells a bound copy of the Calc manual as well.)

You can get Emacs Calc, and GNU Emacs itself, from the GNU project FTP server prep.ai.mit.edu. You can also download Calc from this Web page:

Click here to download Calc 2.02f (.tar.gz, 837K, 15 Dec 96)

Previous versions of Calc:

Click here to download Calc 2.02e (.tar.gz, 824K, 22 Sep 96)

Chipmunk Tools

The Chipmunk CAD Tools were developed at Caltech in the 1980's for use in professor Carver Mead's research lab. My own contributions include LOG, an interactive digital logic simulator which was later expanded to an analog simulator by John Lazzaro, and View, a tool for graphing and manipulating data. The Chipmunk tools have been ported to a variety of platforms, and are available as free software.

Click here to go to the Chipmunk Tools home page.

National Cancer Institute    National Institutes of Health    Health and Human Services    USA Gov - Official Web Portal    Viewing Files    Accessibility