cbind - Translator for "thin" Ada bindings to C -- see also DOCS -- REVISION 4: Includes new features added by Mitch Gart to support Ada 95 and the gnat compiler. This tool is designed to AID in the creation of Ada bindings to C. The code is provided "as is" without any warranty whatsoever. The code is NOT copyrighted but is instead published to the public domain as free software. Any attempt to copyright the tool will be refutable in a court of law. I am NOT intending to imply that the bindings generated by this translator will be complete. This tool MAY/MAY NOT be useful as an AID to generating bindings. Hopefully it can do a lot of the grunt work for you. ------------------------------------------------------------------------- NOTE: if the source file you're translating is copyrighted then the translation of the source is also copyrighted! ------------------------------------------------------------------------- This tool should compile easily as distributed for hosts which have already been ported to. If it has not yet been ported to your host see the section PORTING below. Ported to: Sun4m SunOS 4.1.2 Sun4d SunOS 5.3 (solaris) SGI IRIX 4.0.5 IBM RS6000 250 AIX 3.2.5 To simplify distribution of this tool I am making the source base line of this tool available in 1 tar file which shouldn't update very often. To quickly add features and fix bugs I will make patches available on the rational ftp server. If you have fixes/features to add please mail them to me as context diffs so I can incorporate them into the tool. I'll then post them to the rational ftp server. If I don't receive them by email then the next release of the tool may not have them added. You may wish to download the patches to this tool and apply them to the code before you continue. Note the number that is on your tar file. This is the version identifier that you'll need to get the patches for. For example, if your cbind distribution file is cbind1.tar.gz then your version identifier is 1 and you should mget cbind1.patch*. If your distribution file name is cbind2.tar.gz then the version is 2 and you should mget cbind2.patch*. If you've never used patch don't worry, it's simple. Get the source for it off the internet, compile it, and read the man page. An example of patching cbind would be: % gunzip cbind2.patch2 % patch < cbind2.patch2 % make touch % make ------------------------------------------------------------------------- NOTE: You should "make touch" after applying the patches if you do not have yacc and gperf. ------------------------------------------------------------------------- When fully built you will have 3 executables that you'll need to copy somewhere in your path. cbind - a cc like driver cbfe - the bindings generator cbpp - a C preprocessor The make will also produce 2 other semi-useful executables: cdep - A makefile dependency generator htype - A program to figure sizeof and alignof info PORTING: The code is designed to isolate all machine specific information in an auto generated header file called "hostinfo.h". This will never be perfect so expect to have to modify the source if it doesn't compile immediately. I'd like to isolate other host specific information in host.h instead of having them propagate throughout the source. If your maching and C compiler support very large integer and floating point types you may wish to change the definitions of host_int_t and host_float_t in host.h. This will require a little extra work but may increase the number of files cbind is able to translate correctly. Check the file macro.c to make sure it contains all the builtin defines that your host C compiler uses. You can also see them by executing % cbind -builtin Add any defines you're missing. You should always use the -cs switch during this porting period. It causes the output to be annotated with comments as to the sizeof and alignof of all decls it processes. If these are not correct then you cannot trust the binding will accurately represent the C source. If the sizeof/alignof info is out of wack the most likely cause is that the definitions in hostinfo.h are not correct. You can configure some of the type naming by modifying the config.h header file. After your port is complete and the tool is behaving well please mail me context diffs of your changes (see: diff -c). Also let me know what host machine and OS version it pertains to (see: uname -a). Mark Schimmel mjs@netcom.com