feeley/gambit — pull request #9 by eraserhd (2013-04-08 13:56:30+00:00)
Title: Make gambit.h work for more cases

I made several work-arounds for various aspects of gambit.h when writing gambit-objc. This pull request would remove those work-arounds. Specifically:

`___VERSION`
-------------------

Compiling and linking against stand-alone C files which need gambit types (and therefore need to include `gambit.h`) required defining `___VERSION` to the exact version of the installed gambit. The C file might be pretty simple and have no version-specific dependencies in gambit. As a result, in my `Makefile` I made the `.o` files which are generated from stand-alone `.c` files depend on an arbitrary `.c` file generated by `gsc`, from which I can extract the correct `___VERSION` constant.

With the attached pull request, `___VERSION` is defaulted to the current version unless it has already been provided. In the case it has already been provided, it is checked for a match.

`___GAMBIT_H`
---------------------

This include guard did not protect duplicate inclusion of the whole file. The following would have:

```c
#define ___DEFINES_ONLY 1
#include
```

...since everything which wasn't protected by `___GAMBIT_H` was wrapped in ndef `___DEFINES_ONLY`.

I felt it was cleaner to make `___GAMBIT_H` protect the whole file, and remove `___DEFINES_ONLY` which wasn't used anywhere within gambit.h.

FYI, the duplicate inclusion was in this case:
* Having C functions in a separate file which took `___SCMOBJ`
* Creating a header with prototypes for the functions for use in multiple places.
* Including the header in both a stand-alone C file and in a C-DECLARE block.

`gambit-not*.h`
-------------------

Finally, the `gambit-not40607.h` header seemed extraneous since the version number didn't seem to be computed when it was included. The recursive include of gambit.h seemed like an unnecessary indirection. Therefore, I inlined the header and removed the #else guard protecting the rest of the file from the first inclusion.