Download Turbo C
TurboC is a linkable library and a set of C header files that make it easier to port C code originally written for Borland's MS-DOS based Turbo C compiler to GNU gcc -- and therefore to a wide variety of *nix computer platforms. Generally speaking, it is the following:
* An implementation via ncurses of conio.h from Turbo C.
* An implementation via Xlib of graphics.h from Turbo C.
* A few other functions and time-saving features thrown in for convenience.
* A means of overcoming the integer datatype discrepancies between Turbo C and GNU gcc.
It is not, by any means, a complete solution, but you may find it helpful. The support for graphics.h is in its relatively early stages.
TurboC is available as free software under the GNU Lesser General Public License (LGPL).
Why was TurboC created?
I have written quite a lot of MS-DOS based software using Borland's Turbo C 2.0 compiler. When the inclination finally hit me to make some of this otherwise-deceased code available as free software, my first innocent idea was to release it under the GPL, simply labeling it honestly as MS-DOS code, and then later to port the code to *nix as time and interest permitted. It was obvious that directly porting to *nix up-front would be a time-consuming task.
But I ran into a snag. It's no good to release software if there's no way for anybody to find out about it. My preferred channel for announcing open-source software is freshmeat, but freshmeat doesn't "do" MS-DOS (and therefore politely declined to accept my MS-DOS projects).
Apparently, necessity really is the mother of invention. It occurred to me that if I could provide appropriate Turbo C compatible libraries and header files, then the effort of porting Turbo C code to *nix would be greatly simplified. In other words, it would be relatively easy to provide *nix versions of the old MS-DOS code. Whether it's absolutely easy or not depends a lot on the program you're trying to port.
Alternate Approaches
For conio.h functionality, you might consider Pablo Vidal's UConio library instead. I've not used it, and don't know its advantages and disadvantages. It certainly supports a much smaller subset of conio functionality than TurboC, and requires you to modify your source code much more extensively.
Borland supposedly has (or will soon have) a Linux version of their C++ compiler. At this point, the nature, price, and target platforms of this compiler are mysteries. One presumes that (like Kylix) it will be Wine-based, and therefore will work only on 'x86 systems. Nevertheless, if it contains the various library functions implemented in the TurboC library -- and frankly, that's a very big "if" -- it might provide a simpler means of porting your Turbo C programs to Linux. Speaking for myself, even though I have been a long-time Borland user, I philosophically prefer to compile my program with GNU gcc.
For graphics.h functionality, there is the GRX library of Csaba Biegl, Michael Goffioul, and Hartmut Schirmer. I didn't discover this library until I had only a few graphics.h functions left to write, and I haven't fully evaluated it. Its stated aim is to be a multi-platform 2D graphics library. Its website does not advertise (or even mention) Turbo C compatibility. However, it contains quite a few functions of the same name (and, apparently, the same functionality) as Turbo C library functions.
Of course, if you are only interested running your program on *nix systems -- as opposed to porting the program to *nix systems in general -- you might be able to simply run your existing executable using one of the freely available DOS emulators for Linux. DOS emulation using dosemu with freedos works very well on 'x86 systems, while bochs with freedos works well (if somewhat slowly) on non-'x86 *nix systems.
Features
* TurboC provides most of the console-i/o functionality of Turbo C's conio.h header, mapping it to related ncurses functionality. (Currently, every conio function except cscanf is supported.)
* TurboC provides most of the "BGI" functionality of Turbo C's graphics.h header. At present (20020608), implementation of these features is mostly complete except for the temporary lack of stroked-font support.
* TurboC provides a sprinkling of other missing functionality like the strupr and strlwr functions.
* Check out the complete list of available functions.
Deficiencies
* Refer to the complete list of bugs and issues. So far, the library is only as complete as it needs to be for the kind of programs I typically used to write in Turbo C. As I port more of my old programs to *nix, the TurboC libraray will presumably become more complete. Presently, support for conio.h is essentially complete, and support for graphics.h is essentially complete except for displaying text.
* In the ported program, the text-console window is logically sized properly, but is not physically sized properly unless xterm is used. If other terminals are used (such as KDE Konsole), the window must be resized manually by the user.
* Borland's Turbo C is a 16-bit compiler, whereas the GNU gcc compiler I'm targeting is 32-bit. This results in a discrepancy in the integer datatypes. TurboC handles the (hopefully) most common cases by means of macros; unhandled cases will cause compile-time errors and must be fixed manually. This is covered in detail on the usage page.
* Mixing and matching stream-based functionality (like getchar ,printf, and so on) with "console" based functionality (like getch, cprintf, and so on) probably won't work. Again, look at the usage page.
Wednesday, February 23, 2011
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment