<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8745444058210106238</id><updated>2011-04-21T15:30:38.880-07:00</updated><title type='text'>KoOL DeeZeL</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://kooldeezel.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://kooldeezel.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>KoOL</name><uri>http://www.blogger.com/profile/16392700484307461888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>15</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8745444058210106238.post-4275540809474631194</id><published>2007-11-29T18:05:00.001-08:00</published><updated>2007-11-29T18:05:41.473-08:00</updated><title type='text'>Trouble-shooting</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: trebuchet ms;"&gt; Well, as you've seen, there are &lt;/span&gt;&lt;i style="font-family: trebuchet ms;"&gt;many&lt;/i&gt;&lt;span style="font-family: trebuchet ms;"&gt; factors that come into play porting from Turbo C to gcc/TurboC.  Some of these are describe above, but there are others that haven't even been hinted at.  For the sake of completeness, here's a somewhat-complete list of the difficulties I've personally encountered: &lt;/span&gt;&lt;/span&gt;&lt;center style="font-family: trebuchet ms;"&gt; &lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;Summary or illumination of trouble-shooting items covered earlier&lt;/i&gt;&lt;/span&gt;&lt;/p&gt; &lt;/center&gt; &lt;ul style="font-family: trebuchet ms;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Whenever possible, run the ported program under &lt;b&gt;xterm&lt;/b&gt;, with the command-line switches "+sb -tn linux".&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Functions needed by Turbo C may not have been provided in the TurboC library &lt;a href="http://www.sandroid.org/TurboC/functionlist.html#Entitites"&gt;function list&lt;/a&gt;.  Solution:  Write them and &lt;a href="mailto:info@sandroid.org"&gt;send them to me&lt;/a&gt;.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Integer datatypes may not have been converted properly.  Solution:  Handle as described &lt;a href="http://www.sandroid.org/TurboC/functionlist.html#Integers"&gt;earlier&lt;/a&gt;.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Some functions, such as strupr, strlwr, and fcloseall are not handled by any of the Turbo C header files.  Solution:  #include &lt;turboc.h&gt; .&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; The TurboC library cannot physically resize the console unless the ported program is being run under &lt;b&gt;xterm&lt;/b&gt;.  Solution:  Manually resize the console, rewrite the code to adjust automatically to size changes, or &lt;a href="mailto:info@sandroid.org"&gt;send me a fix&lt;/a&gt;.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; The ported program does not release control of the console on exit.  Solution:  Add a call to textmode(EXITMODE) before exiting the program.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Functions don't behave as expected.  Quite a few functions are common to Turbo C and to &lt;b&gt;gcc&lt;/b&gt;, but act somewhat differently.  An example is printf.   In &lt;b&gt;gcc&lt;/b&gt; this supports the carriage-return character ('\r'), but in true Turbo C does not.  I've chosen &lt;i&gt;not&lt;/i&gt; to correct this.  Other functions, like getch , ungetch, and mkdir, are different enough that I've had to correct for their differences.  Typically this is done by means of macros, so that these functions have their &lt;b&gt;gcc&lt;/b&gt; interpretations above the point in the source file where their associated header files are included, and have their Turbo C interpretations below that point.  Solution:  Learn to recognize it, I guess.  The &lt;b&gt;gcc&lt;/b&gt; functions are always available, even after macro assignment, by means of a new name, such as      getchNcurses.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Not all &lt;a href="http://www.sandroid.org/TurboC/functionlist.html#Keys"&gt;special-function keys&lt;/a&gt; on the keyboard are supported. Solution:  Rewrite the code to eliminate the keys that aren't supported, or &lt;a href="mailto:info@sandroid.org"&gt;send me a fix&lt;/a&gt; .&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Not all &lt;a href="http://www.sandroid.org/TurboC/functionlist.html#Characters"&gt;graphics characters&lt;/a&gt; are supported in console i/o mode (cprintf/putch/etc.), and &lt;i&gt;none&lt;/i&gt; of them are supported in regular text mode (printf/putchar /etc.).  Solution:  Rewrite the code to eliminate those characters, or &lt;a href="mailto:info@sandroid.org"&gt;send me a fix&lt;/a&gt;.&lt;/span&gt;&lt;/li&gt;&lt;li&gt; &lt;span style="font-size:85%;"&gt;char is signed but is supposed to be unsigned (or vice versa).  Solution:  Both Turbo C and &lt;b&gt;gcc&lt;/b&gt; have options/switches for setting whether characters are signed or unsigned by default.  Make sure you set the switch in gcc the same way as the option in Turbo C.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Main function is of the wrong type.  The &lt;b&gt;gcc&lt;/b&gt; compiler expects main to be of type int, whereas in Turbo C these are often (always?) of type void.  Solution:  Change it.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; You may experience some compiler errors if integer datatype conversion is turned on but a compiler optimization level higher than -O0 is used when compiling your code.  Solution:  reduce the optimization level to -O0 and &lt;a href="mailto:info@sandroid.org"&gt;report the problem&lt;/a&gt;.  This applies only to compiling your own code, and not to building the TurboC library.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Allocating the image buffers for the getimage function:  The proper sequence of operations, as defined by Borland's docs, is this:&lt;/span&gt;&lt;/li&gt;&lt;ul&gt;&lt;span style="font-size:85%;"&gt;// Good code, approved by Borland and by the TurboC library.&lt;br /&gt;void MyFunction (void)&lt;br /&gt;  {&lt;br /&gt;    void *bitmap;&lt;br /&gt;    bitmap = farmalloc (imagesize (left, top, right, bottom));&lt;br /&gt;    getimage (left, top, right, bottom, bitmap);&lt;br /&gt;    ... do stuff, such as call the putimage function ...&lt;br /&gt;    farfree (bitmap);&lt;br /&gt;    return;&lt;br /&gt;  }&lt;/span&gt;&lt;/ul&gt;&lt;span style="font-size:85%;"&gt; If instead your program does stuff like the following, it will probably work, but you'll have a memory leak in which the memory allocated for the image buffers won't be &lt;i&gt;fully&lt;/i&gt;&lt;/span&gt; deallocated:   &lt;ul&gt;&lt;span style="font-size:85%;"&gt;// Bad code, by any standards.&lt;br /&gt;void MyFunction (void)&lt;br /&gt;  {&lt;br /&gt;    char bitmap[4 + X_SIZE * Y_SIZE * COLOR_DEPTH];&lt;br /&gt;    getimage (left, top, left + X_SIZE - 1, top + Y_SIZE - 1, bitmap);&lt;br /&gt;    ... do stuff, such as call the putimage function ...&lt;br /&gt;    return;&lt;br /&gt;  }&lt;/span&gt;&lt;/ul&gt;&lt;span style="font-size:85%;"&gt; The problem is that getimage has to transparently allocate memory of which you're not aware -- specifically, X-window system Pixmap structures.  In the olden days, programmers (such as myself) were tempted to write this kind of bad code because they believed that they understood the format of the graphical data in the image buffers -- even though Borland did not specify or even hint at its nature.  This assumption is now revealed as being false. &lt;/span&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Manipulation of the image buffers used by the getimage and putimage functions:   Borland does not specify the format of the data in the image-buffer structures used by the getimage and putimage functions.  (See the item above.)  All that is specified is that this:&lt;/span&gt;&lt;/li&gt;&lt;ul&gt;&lt;span style="font-size:85%;"&gt;struct {&lt;br /&gt;  unsigned short width;&lt;br /&gt;  unsigned short height;&lt;br /&gt;  ... some undocumented stuff representing graphical data ...&lt;br /&gt;};&lt;/span&gt;&lt;/ul&gt;&lt;span style="font-size:85%;"&gt; For practical reasons, it is likely that some (perhaps many) programmers -- such as myself -- hacked the format of the graphical-data area, and chose to manipulate the area directly.  Programs based on this principle will not work, because the format of this area -- at least in the X-window based implementation of graphics.h functions -- is not the same in the TurboC library as it was in Borland's Turbo C.    (&lt;b&gt;Note&lt;/b&gt;:  it is possible to rewrite the code for getimage and putimage so that the old Borland formats are preserved.  The formats were dependent on the graphics controller and the graphics mode.  Anyone who cares to hack all of these and to rewrite the code accordingly is very welcome to do so.  Please send me the fixes.  As of Borland C++ v5.0, the graphics.h file listed 43 graphics controllers and 29 graphics modes by name.  The comments in the next trouble-shooting item below may be of assistance to you, if you try to undertake this task.)  However, it &lt;i&gt;is&lt;/i&gt; possible to manipulate the graphical data in the TurboC library image buffers, because I will tell you the format.  You need to use X-window drawing functions such as XDrawLine, as applied to X-windowPixmap structures.  The format of the image buffer, for the X-window implementation of the TurboC library, is as follows:   &lt;/span&gt;&lt;ul&gt;&lt;span style="font-size:85%;"&gt;struct TcImageBuffer&lt;br /&gt;{&lt;br /&gt;  gushort Width;&lt;br /&gt;  gushort Height;&lt;br /&gt;  Pixmap Handle;&lt;br /&gt;};&lt;/span&gt;&lt;/ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Saving getimage image buffers to disk, or loading putimage image buffers from disk:  If you read the discussion above, it will be obvious to you that this is next-to-useless, since the image buffers themselves no longer contain graphical data.  What needs to be save or loaded is the Pixmap structures themselves, whereas the image buffers contain only the handles of the Pixmap structures.  I believe that it is possible to get around this problem by rewriting the getimage /putimage functions in terms of the X-window functions XGetImage and XPutImage rather than Pixmap structures.  If you want to do this and send me the patches, &lt;a href="mailto:info@sandroid.org"&gt;tell me about it&lt;/a&gt;.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt; &lt;center style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;Trouble-shooting items not covered earlier&lt;/i&gt;&lt;/span&gt;&lt;/center&gt; &lt;ul style="font-family: trebuchet ms;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Various standard C library "functions" may actually be implemented as macros on some target platforms, and as true functions on others.  A common example is strcpy.  When such macros contain casts (such as "(unsigned int)") that are questionable as described above under &lt;a href="http://www.sandroid.org/TurboC/functionlist.html#Datatypes"&gt;handling of integer datatypes&lt;/a&gt;, code containing them will fail to compile. It's difficult for me to catch all of these, since they may be perfectly fine on my test machines.  For clues as to how to work around such problems, look at the implementation of strcpy in TurboC.h.  Sometimes, changing the compiler optimization level to "-O0" fixes the problem.  Or, just don't use the automatic datatype conversion.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Header files are messed up.  The TurboC header files all include TurboC.h, which by default redefines short, int, unsigned , and long.  Solution:  Any standard system headers, must be included &lt;i&gt;before&lt;/i&gt; any TurboC header, or else the reassignments of the integer datatypes will destroy them.  Actually, TurboC.h itself includes a variety of standard system headers -- like stdlib.h, stdio.h, string.h, ctype.h, and so on -- and this problem won't arise for &lt;i&gt;those&lt;/i&gt; headers.   But your typical *nix system has a cadjillion header files, and TurboC.h can't include them all.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Filenames don't work in fopen.   MS-DOS expected filenames like C:\MYDIR\MY.FIL, whereas *nix expects names like /MYDIR/MY.FIL.  Also, *nix is case-sensitive, whereas MS-DOS is not.  So if you have any hardcoded filenames that violate these rules, you'll have to fix them. I suppose I could have fixed fopen to get around some of these problems, but I have not done so.&lt;/span&gt;&lt;/li&gt;&lt;li&gt; &lt;span style="font-size:85%;"&gt;scanf/gets/getchar doesn't work.   In Turbo C, to a certain extent you can get away with mixing and matching getchar &amp;amp; getch or cgets &amp;amp; gets.  This doesn't work with the TurboC library because once the conio text console is active you can't use scanf/gets/getchar until closing the conio console.  Solution:  Rewrite the code to eliminate gets/getchar in favor of cgets/getch (or vice versa).  But note this:  In my experience, a large motivator for using conio was often simply that Turbo C's print/puts&lt;b&gt;gcc&lt;/b&gt; 'sprintf/puts functions do correctly support '\r', so you might not even need conio.&lt;/span&gt; functions did not correctly support '\r'. &lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; The compiler gives weird errors for printf/scanf/(etc.) commands.  The &lt;b&gt;gcc&lt;/b&gt; compiler is intelligent enough to find many discrepancies between format strings and value lists in printf statements.  For example, it can recognize that this is an error:&lt;/span&gt;&lt;/li&gt;&lt;ul&gt;&lt;span style="font-size:85%;"&gt;long n;                // a long&lt;br /&gt;printf ("%d\n", n);    // an int&lt;/span&gt;&lt;/ul&gt;&lt;span style="font-size:85%;"&gt; But it's not smart enough to necessarily recognize that the following &lt;i&gt; isn't&lt;/i&gt; an error:   &lt;/span&gt;&lt;ul&gt;&lt;span style="font-size:85%;"&gt;uint32_t n;            // a long&lt;br /&gt;printf ("%ld\n", n);   // a long&lt;/span&gt;&lt;/ul&gt;&lt;span style="font-size:85%;"&gt; That's okay, though, because &lt;b&gt;gcc&lt;/b&gt; produces only warning message rather than fatal errors for these problems.  Besides, you'll want to check all of your i/o statements carefully anyway, since stuff like the following is correct in Turbo C but not in gcc/TurboC:   &lt;/span&gt;&lt;ul&gt;&lt;span style="font-size:85%;"&gt;int n;                 // 16-bits&lt;br /&gt;printf ("%d\n", n);    // 16-bit in Turbo C but 32-bit in gcc.&lt;/span&gt;&lt;/ul&gt;&lt;li&gt; &lt;span style="font-size:85%;"&gt;printf/scanf/(etc.) don't work, but there's no compiler error.  See the item above.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; File i/o is messed up.  File i/o is &lt;i&gt;not&lt;/i&gt; messed up, but since different datatypes are supported in Turbo C than in gcc/TurboC, the data formats you're reading/writing may be different.  This can happen in numerous ways:&lt;/span&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Integer datatypes are the &lt;a href="http://www.sandroid.org/TurboC/functionlist.html#Integers"&gt;wrong size&lt;/a&gt;.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Integer datatypes are the &lt;a href="http://www.sandroid.org/TurboC/functionlist.html#Endian"&gt;wrong endian type&lt;/a&gt;.&lt;/span&gt;&lt;/li&gt;&lt;li&gt; &lt;span style="font-size:85%;"&gt;printf/scanf/(etc.) may use the wrong format strings (see above).&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Floating-point formats differ.  Sorry, but I've no clue about this.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Structures are packed differently.  For example, a structure like this in Turbo C&lt;/span&gt;&lt;/li&gt;&lt;ul&gt;&lt;span style="font-size:85%;"&gt;struct MyStruct {&lt;br /&gt;  char c;&lt;br /&gt;  short s;&lt;br /&gt;  int i;&lt;br /&gt;  long n;&lt;br /&gt;};&lt;/span&gt;&lt;/ul&gt;&lt;span style="font-size:85%;"&gt; might have to be rewritten as follows in gcc/TurboC if you expect to use it for direct i/o to a file:     &lt;/span&gt;&lt;ul&gt;&lt;span style="font-size:85%;"&gt;struct MyStruct {&lt;br /&gt;  int8_t c __attribute__ ((packed));&lt;br /&gt;  int16_t s __attribute__ ((packed));&lt;br /&gt;  int16_t i __attribute__ ((packed));&lt;br /&gt;  int32_t n __attribute__ ((packed));&lt;br /&gt;};&lt;/span&gt;&lt;/ul&gt;&lt;span style="font-size:85%;"&gt; I can't guarantee that this &lt;i&gt;always&lt;/i&gt; works, but I've ported a reasonably substantial &lt;a href="http://www.sandroid.org/RIP/index.html"&gt;text-indexing system&lt;/a&gt; from MS-DOS (16-bit, little-endian) to LinuxPPC (32-bit, big-endian) that made heavy use of directly inputting/outputting structures to files, and the file formats were preserved.  That seems to me to be a good sign.   &lt;/span&gt;&lt;/ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Interrupt service routines.  Sorry, I don't even want to think about this.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Inline assembler code.  It can be done, but I don't know how, and the syntax will be different.  I personally don't care about this problem, because I'm interested only in completely portable code. Sorry!&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Making DOS or BIOS system calls.  Obviously, you can't.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Turbo C pragmas.  These will get warning messages from the compiler, but will be otherwise ignored.  But they're confusing, so unless you expect to go back to MS-DOS someday, I'd suggest removing them manually. :-)&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8745444058210106238-4275540809474631194?l=kooldeezel.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kooldeezel.blogspot.com/feeds/4275540809474631194/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8745444058210106238&amp;postID=4275540809474631194' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default/4275540809474631194'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default/4275540809474631194'/><link rel='alternate' type='text/html' href='http://kooldeezel.blogspot.com/2007/11/trouble-shooting.html' title='Trouble-shooting'/><author><name>KoOL</name><uri>http://www.blogger.com/profile/16392700484307461888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8745444058210106238.post-3276739761827401381</id><published>2007-11-29T18:04:00.003-08:00</published><updated>2007-11-29T18:04:58.061-08:00</updated><title type='text'>Examples</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;i style="font-family: trebuchet ms;"&gt;Hello, world!&lt;/i&gt;&lt;span style="font-family: trebuchet ms;"&gt;  Consider the following Turbo C program: &lt;/span&gt;&lt;/span&gt;&lt;blockquote style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;#include &lt;conio.h&gt;&lt;br /&gt;#include &lt;time.h&gt;&lt;/span&gt;      &lt;p&gt;&lt;span style="font-size:85%;"&gt;void&lt;br /&gt;main (void)&lt;br /&gt;{&lt;br /&gt;  time_t t, newt;&lt;br /&gt;  int i = 0, x, y;&lt;br /&gt;  time (&amp;amp;t);&lt;br /&gt;  clrscr ();&lt;br /&gt;  cprintf ("Hit any key to continue: ");&lt;br /&gt;  x = wherex ();&lt;br /&gt;  y = wherey ();&lt;br /&gt;  // Wait for a keypress, flashing the message&lt;br /&gt;  // "I'm waiting!" on and off once per second.&lt;br /&gt;  // After any key is hit, display "Hello, world!"&lt;br /&gt;  while (!kbhit ())&lt;br /&gt;    {&lt;br /&gt;      time (&amp;amp;newt);&lt;br /&gt;      if (t != newt)&lt;br /&gt;        {&lt;br /&gt;          t = newt;  &lt;br /&gt;          i++;&lt;br /&gt;          if (0 == (i &amp;amp; 1))&lt;br /&gt;            cprintf ("I\'m waiting!");&lt;br /&gt;          clreol ();  &lt;br /&gt;          gotoxy (x, y);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;  getch ();&lt;br /&gt;  cprintf ("\r\nHello, world!\r\n");&lt;br /&gt;}&lt;/span&gt;                                                                                    &lt;/p&gt; &lt;/blockquote&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: trebuchet ms;"&gt; This program almost compiles with GNU &lt;/span&gt;&lt;b style="font-family: trebuchet ms;"&gt;gcc&lt;/b&gt;&lt;span style="font-family: trebuchet ms;"&gt; (and the TurboC library), and almost works as-is,  except for a couple of points: &lt;/span&gt;&lt;/span&gt;&lt;ul style="font-family: trebuchet ms;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; You will want to add the following statement at the very end of the program:&lt;/span&gt;&lt;/li&gt;&lt;ul&gt;&lt;span style="font-size:85%;"&gt;textmode (EXITMODE);&lt;/span&gt;&lt;/ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; The "Hello, world!" message won't actually be seen, because the you have to end with will instantly restore whatever was on the screen prior to running the program.  So, you might want to add another getch()&lt;/span&gt; textmode(EXITMODE) printing the "Hello, world!" message.&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; GNU &lt;b&gt;gcc&lt;/b&gt; expects main to be of type int rather than void, and of course you can't actually use int because of the automatic conversion of integer datatypes.  So use gint&lt;/span&gt; instead.&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: trebuchet ms;"&gt; Having done these things, you'll find that you can compile the program and run it without any errors: &lt;/span&gt;&lt;/span&gt;&lt;blockquote style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;gcc -o Hello Hello.c -lTurboC -lncurses&lt;br /&gt;xterm +sb -e Hello&lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: trebuchet ms;"&gt; Compiling without warnings is actually a little unusual, because there are quite a few things that can cause non-fatal warning messages.  See the &lt;/span&gt;&lt;a style="font-family: trebuchet ms;" href="http://www.sandroid.org/TurboC/functionlist.html#Trouble"&gt;trouble-shooting&lt;/a&gt;&lt;span style="font-family: trebuchet ms;"&gt; section for more detail.&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8745444058210106238-3276739761827401381?l=kooldeezel.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kooldeezel.blogspot.com/feeds/3276739761827401381/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8745444058210106238&amp;postID=3276739761827401381' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default/3276739761827401381'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default/3276739761827401381'/><link rel='alternate' type='text/html' href='http://kooldeezel.blogspot.com/2007/11/examples.html' title='Examples'/><author><name>KoOL</name><uri>http://www.blogger.com/profile/16392700484307461888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8745444058210106238.post-2592749617912263966</id><published>2007-11-29T18:04:00.001-08:00</published><updated>2007-11-29T18:04:33.142-08:00</updated><title type='text'>Endian conversions</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: trebuchet ms;"&gt; Since all Turbo C functions have been run only on Intel 'x86 processors, it is not uncommon in Turbo C code to find that the programmer has simply &lt;/span&gt;&lt;i style="font-family: trebuchet ms;"&gt;assumed&lt;/i&gt;&lt;span style="font-family: trebuchet ms;"&gt; that the CPU is little-endian -- i.e., that the LSB of multi-byte integers precedes the MSB.  In porting such code to GNU &lt;/span&gt;&lt;b style="font-family: trebuchet ms;"&gt;gcc&lt;/b&gt;&lt;span style="font-family: trebuchet ms;"&gt;, one has to recognize that it &lt;/span&gt;&lt;i style="font-family: trebuchet ms;"&gt;may not&lt;/i&gt;&lt;span style="font-family: trebuchet ms;"&gt; necessarily be run on a little-endian processor.  For example, I do a lot of work on an iMac, which is based on a big-endian PowerPC processor.  This is not important in most cases, but does affect various operations such as the matching of bytes within union objects and, especially, reading/writing files. &lt;/span&gt;&lt;/span&gt;&lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;To make it easier to deal with this problem, I've provided a number of functions not originally present in Turbo C that can be used to convert endian types where required.  Unfortunately, it's still up to you to figure out that there's a problem and to add these function calls to the program. &lt;/span&gt;&lt;/p&gt; &lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;There are two separate groups of functions, those which convert the endian type of an integer value already stored in memory, and those which convert data on-the-fly whilst reading/writing a file.  All of the functions require the TurboC.h header file.&lt;br /&gt;  &lt;/span&gt;&lt;/p&gt;          &lt;table style="font-family: trebuchet ms;" nosave="" border="1" width="95%"&gt;&lt;tbody&gt;&lt;tr nosave=""&gt;       &lt;th nosave=""&gt;&lt;span style="font-size:85%;"&gt;Function prototype&lt;/span&gt;&lt;/th&gt;       &lt;th nosave=""&gt;&lt;span style="font-size:85%;"&gt;Description&lt;/span&gt;&lt;/th&gt;     &lt;/tr&gt;     &lt;tr nosave=""&gt;       &lt;td nosave="" nowrap="nowrap"&gt;&lt;span style="font-size:85%;"&gt;void FixLittle16 (uint16_t *);&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Performs an in-place conversion of a 16-bit integer value stored in memory from little-endian format to the natural CPU endian format, &lt;i&gt;or vice-versa&lt;/i&gt; .  Using this function twice in succession gets back whatever you started with.  There's no harm using this function if the CPU happens to be little-endian, since the value is passed through unchanged in that case.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr nosave=""&gt;       &lt;td nosave="" nowrap="nowrap"&gt;&lt;span style="font-size:85%;"&gt;void FixLittle32 (uint32_t *);&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Same as FixLittle16, but 32-bit instead.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr nosave=""&gt;       &lt;td nosave="" nowrap="nowrap"&gt;&lt;span style="font-size:85%;"&gt;void FixBig16 (uint16_t *);&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Same as FixLittle16, but big-endian instead.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr nosave=""&gt;       &lt;td nosave="" nowrap="nowrap"&gt;&lt;span style="font-size:85%;"&gt;void FixBig32 (uint32_t *);&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Same as FixLittle16, but 32-bit big-endian instead.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr nosave=""&gt;       &lt;td nosave="" nowrap="nowrap"&gt;&lt;span style="font-size:85%;"&gt;int ReadLittle16 (FILE *fp, uint16_t *Value);&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Reads a 16-bit little-endian integer from a file, and delivers it in the natural endian-format of the CPU.  Returns 0 on success, non-zero on failure.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr nosave=""&gt;       &lt;td nosave="" nowrap="nowrap"&gt;&lt;span style="font-size:85%;"&gt;int ReadBig16 (FILE *fp, uint16_t *Value);&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Same as ReadLittle16, but big-endian instead.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr nosave=""&gt;       &lt;td nosave="" nowrap="nowrap"&gt;&lt;span style="font-size:85%;"&gt;int ReadLittle32 (FILE *fp, uint32_t *Value);&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Same as ReadLittle16, but 32-bit instead.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr nosave=""&gt;       &lt;td nosave="" nowrap="nowrap"&gt;&lt;span style="font-size:85%;"&gt;int ReadBig32 (FILE *fp, uint32_t *Value);&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Same as ReadLittle16, but 32-bit big-endian instead.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr nosave=""&gt;       &lt;td nosave="" nowrap="nowrap"&gt;&lt;span style="font-size:85%;"&gt;int WriteLittle16 (FILE *fp, uint16_t Value);&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Takes a 16-bit integer value in the natural endian format of the CPU, and writes it to a file as a 16-bit little-endian integer.  Returns 0 on success and non-zero on failure.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr nosave=""&gt;       &lt;td nosave="" nowrap="nowrap"&gt;&lt;span style="font-size:85%;"&gt;int WriteBig16 (FILE *fp, uint16_t Value);&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Same as WriteLittle16, but big-endian instead.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr nosave=""&gt;       &lt;td nosave="" nowrap="nowrap"&gt;&lt;span style="font-size:85%;"&gt;int WriteLittle32 (FILE *fp, uint32_t Value);&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Same as WriteLittle16, but 32-bit instead.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr nosave=""&gt;       &lt;td nosave="" nowrap="nowrap"&gt;&lt;span style="font-size:85%;"&gt;int WriteBig32 (FILE *fp, uint32_t Value);&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Same as WriteLittle16, but 32-bit big-endian instead.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8745444058210106238-2592749617912263966?l=kooldeezel.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kooldeezel.blogspot.com/feeds/2592749617912263966/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8745444058210106238&amp;postID=2592749617912263966' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default/2592749617912263966'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default/2592749617912263966'/><link rel='alternate' type='text/html' href='http://kooldeezel.blogspot.com/2007/11/endian-conversions.html' title='Endian conversions'/><author><name>KoOL</name><uri>http://www.blogger.com/profile/16392700484307461888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8745444058210106238.post-8019939643747626603</id><published>2007-11-29T18:03:00.002-08:00</published><updated>2007-11-29T18:04:04.196-08:00</updated><title type='text'>Alternative graphics-mode functions</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: trebuchet ms;"&gt; If the graphics-mode discrepancies described above are too awful for you to live with, it is possible in theory to disable the TurboC-provided graphics functions and instead to use alternate functions.  (I've not actually tried any of this myself, so if you make it work I'd appreciate it if you could &lt;/span&gt;&lt;a style="font-family: trebuchet ms;" href="mailto:info@sandroid.org"&gt;send me&lt;/a&gt;&lt;span style="font-family: trebuchet ms;"&gt; detailed instructions.) &lt;/span&gt;&lt;/span&gt;&lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;For example, there is a 2D graphics library called the &lt;a href="http://www.gnu.de/software/GRX/"&gt;GRX library&lt;/a&gt; ( by Csaba Biegl, Michael Goffioul, and Hartmut Schirmer).  The GRX 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.   To find out more, download the library using the link above.  After unpacking the tarball, you'll find the Borland replacement functions in the src/bgi directory, and information about them in the doc/readme.bgi file. &lt;/span&gt;&lt;/p&gt; &lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;Disabling the graphics functions present in the TurboC library involves these steps: &lt;/span&gt;&lt;/p&gt; &lt;ol style="font-family: trebuchet ms;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Edit the TurboC library's Makefile, remove the compiler switch "-DWITH_X", and rebuild the TurboC library.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Eliminate the TurboC version of graphics.h from the system includes (probably /usr/include).&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Install GRX.&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: trebuchet ms;"&gt; Realize that I have not really evaluated the GRX library, and so do not understand its ins and outs.  For example, I don't know how many BGI functions it implements.  I &lt;/span&gt;&lt;i style="font-family: trebuchet ms;"&gt;believe&lt;/i&gt;&lt;span style="font-family: trebuchet ms;"&gt; that the main advantage of GRX relative to TurboC is that in a system without &lt;/span&gt;&lt;b style="font-family: trebuchet ms;"&gt;X&lt;/b&gt;&lt;span style="font-family: trebuchet ms;"&gt; it can directly used the graphics controller. I believe that the main disadvantage of GRX relative to TurboC is that it is not integrated with the other non-graphics Turbo C functions like getch.  Since the TurboC library's version of getch (for example) depends on the TurboC library's implementation of graphics functionality, it will not work properly with GRX.&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8745444058210106238-8019939643747626603?l=kooldeezel.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kooldeezel.blogspot.com/feeds/8019939643747626603/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8745444058210106238&amp;postID=8019939643747626603' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default/8019939643747626603'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default/8019939643747626603'/><link rel='alternate' type='text/html' href='http://kooldeezel.blogspot.com/2007/11/alternative-graphics-mode-functions.html' title='Alternative graphics-mode functions'/><author><name>KoOL</name><uri>http://www.blogger.com/profile/16392700484307461888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8745444058210106238.post-6873760398425897881</id><published>2007-11-29T18:03:00.001-08:00</published><updated>2007-11-29T18:03:33.937-08:00</updated><title type='text'>Graphics mode</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;b style="font-family: trebuchet ms;"&gt;Note&lt;/b&gt;&lt;span style="font-family: trebuchet ms;"&gt;:  The material in this section and the next describes both features that exist and features that are planned for the future.  Consult the &lt;/span&gt;&lt;a style="font-family: trebuchet ms;" href="http://www.sandroid.org/TurboC/changes.html"&gt;change log&lt;/a&gt;&lt;span style="font-family: trebuchet ms;"&gt; for more info about the support provided in specific code versions. &lt;/span&gt;&lt;/span&gt;&lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;In true Turbo C, graphics-mode screens (as opposed to text-mode screens) are handled by something called the Borland Graphics Interface, or BGI for short.  The BGI is an API containing 80+ functions.  Note that the graphics functions provided with the TurboC library are somewhat less portable than the remainder of the library, in that the X-window system is required.  If you need graphics functions that can operate without &lt;b&gt;X&lt;/b&gt;, I'd suggest reading the &lt;a href="http://www.sandroid.org/TurboC/functionlist.html#Alternative"&gt;next section&lt;/a&gt;. &lt;/span&gt;&lt;/p&gt; &lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;Some of the more important points of departure from true Turbo C are these: &lt;/span&gt;&lt;/p&gt; &lt;ul style="font-family: trebuchet ms;"&gt;&lt;li&gt; &lt;span style="font-size:85%;"&gt;&lt;i&gt;External files&lt;/i&gt;.  True Turbo C relies on the existence of certain plug-in files, specifically the BGI "drivers" (such as EGAVGA.BGI, HERC.BGI, etc.) and the fonts (such as TRIP.CHR, SANS.CHR, etc.).  The TurboC library has no such dependence, though it may eventually be possible to load new fonts at runtime.  Functions related to manipulation of these files are provided, so that you don't have to take the effort of writing them out of your code, but often they are empty stubs.&lt;/span&gt;&lt;/li&gt;&lt;li&gt; &lt;span style="font-size:85%;"&gt;&lt;i&gt;Missing functions&lt;/i&gt;.  Implementation of the floodfill function is not presently planned.&lt;/span&gt;&lt;/li&gt;&lt;li&gt; &lt;span style="font-size:85%;"&gt;&lt;i&gt;Screen hiding&lt;/i&gt;.  Since true Turbo C ran under MS-DOS, a non-windowed non-graphical environment, the way it had to operate was to take over the entire display screen, and to place the hardware graphics controller itself either in "text mode" or in "graphics mode".  In other words, if the graphics controller was in text mode then only textual functions (like those in stdio.h or conio.h) could be used, whereas in graphics mode only graphical functions (graphic.h) could be used.  Material written to the screen in text mode disappeared when graphics mode was started, and vice-versa.   With the TurboC library, because a windowed environment is used, both text-mode windows and graphics-mode windows can appear simultaneously.  In other words, when graphics mode is started, a new graphics-mode window is created, but no effort is made to hide the old text-mode window.&lt;/span&gt;&lt;/li&gt;&lt;li&gt; &lt;span style="font-size:85%;"&gt;&lt;i&gt;Palettes&lt;/i&gt;.  Since true Turbo C dealt with actual modes of the hardware graphics controller, palettes were built into the graphics controller itself, and &lt;i&gt;changes&lt;/i&gt; to palettes (for example, reassignment of a palette color, like the background color) were instantly reflected on-screen.  With the TurboC library, changes to the paletted (and specifically, to the background color) are reflected only in future screen-writes, and don't affect anything already written to the screen.&lt;/span&gt;&lt;/li&gt;&lt;li&gt; &lt;span style="font-size:85%;"&gt;&lt;i&gt;Text&lt;/i&gt;.  The bitmapped font is supported.  For various reasons, sadly -- having spent a considerable amount of work on it -- I find that it's not convenient to support Borland's "stroked font" (CHR) format.  (These reasons include the following:  Borland's license does not allow using the Borland-supplied fonts with the TurboC library; nobody has made any free CHR fonts available on the Internet; and, while there are TrueType-to-CHR programs available, they cost more than I'm willing to pay -- i.e., more than zero.)  Therefore, the functionality otherwise normally provided by the stroked fonts will eventually be supplied indirectly by means of *nix system fonts.  Currently, this has not yet been implemented.  Or, you may draw text directly using &lt;b&gt;Xlib&lt;/b&gt;&lt;a href="http://www.sandroid.org/TurboC/functionlist.html#TcUnicode"&gt;TcUnicodeMappings&lt;/a&gt;&lt;b&gt;Xlib&lt;/b&gt;.&lt;/span&gt; functions, as described a few lines below.  You may also find the  array useful when using &lt;/li&gt;&lt;li&gt; &lt;span style="font-size:85%;"&gt;&lt;i&gt;The&lt;/i&gt; getimage &lt;i&gt;and&lt;/i&gt; putimage &lt;i&gt;functions&lt;/i&gt; .  This is described in detail &lt;a href="http://www.sandroid.org/TurboC/functionlist.html#getimage"&gt;above&lt;/a&gt;.  Briefly, these functions are used to fetch a rectangular area of the display into an image buffer, or to write the image back to the screen.  The formats of the image buffers were undocumented by Borland, but actually corresponded to the memory maps used by the specific graphics controllers and graphics modes.  These formats are &lt;i&gt;not&lt;/i&gt; duplicated by the TurboC library.&lt;/span&gt;&lt;/li&gt;&lt;li&gt; &lt;span style="font-size:85%;"&gt;&lt;i&gt;Flexibility&lt;/i&gt;.  You don't need to confine yourself to the BGI functions.  You can also use X-window library functions.  For example, *nix system fonts -- which BGI obviously doesn't support -- can be used in a TurboC-ported program via &lt;b&gt;Xlib&lt;/b&gt; functions like XLoadFont , XDrawString, etc.  All you have to know -- other than basic X operations -- is that the TurboC library exposes the following X objects for your use:&lt;/span&gt;&lt;/li&gt;&lt;ul&gt;&lt;span style="font-size:85%;"&gt;Display *TcDisplay;       // The X-window "display".&lt;br /&gt;Window TcWindow;          // The X-window "window".&lt;br /&gt;gint TcScreen;            // The X-window "screen".&lt;br /&gt;GC TcGc;                  // The X-window "graphics context".&lt;/span&gt;&lt;/ul&gt;&lt;span style="font-size:85%;"&gt; It's necessary to modify the graphics context (TcGc) for any serious drawing.  If you don't restore it to its original settings, the TurboC library will become seriously confused.  Therefore, it's best to &lt;i&gt; copy&lt;/i&gt; followed by  the graphics context (with X-window function XCreateGCXCopyGC), and work only with your copy of the graphics context rather than with the original.  Also, to avoid threading conflicts, always wrap your X operations as follows:   &lt;/span&gt;&lt;ul&gt;&lt;span style="font-size:85%;"&gt;XLockDisplay (TcDisplay);&lt;br /&gt;// ... your X code goes here ...&lt;br /&gt;// For Example, draw a text string at x=10, y=20:&lt;br /&gt;XDrawString (TcDisplay, TcScreen, TcGc,&lt;br /&gt;             10, 20, "I am text", 9);&lt;br /&gt;XSync (TcDisplay);&lt;br /&gt;XUnlockDisplay (TcDisplay);&lt;/span&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8745444058210106238-6873760398425897881?l=kooldeezel.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kooldeezel.blogspot.com/feeds/6873760398425897881/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8745444058210106238&amp;postID=6873760398425897881' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default/6873760398425897881'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default/6873760398425897881'/><link rel='alternate' type='text/html' href='http://kooldeezel.blogspot.com/2007/11/graphics-mode.html' title='Graphics mode'/><author><name>KoOL</name><uri>http://www.blogger.com/profile/16392700484307461888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8745444058210106238.post-6333435756898670732</id><published>2007-11-29T18:02:00.000-08:00</published><updated>2007-11-29T18:03:04.644-08:00</updated><title type='text'>Graphical display characters in text mode</title><content type='html'>&lt;span style="font-family: trebuchet ms;font-size:85%;" &gt; When using functions such as printf, putchar, etc., no attempt is made to translate displayed characters so that they appear identical to those on an IBM PC.  In other words, you're just using the native *nix functions, and you get whatever you get.  Typically, you should expect only the characters in the numerical range 0x20-0x7E to display accurately.  However, when using the various conio.h functions, such as cprintf , putch, etc., we attempt to match the output characters as closely as possible to those in true Turbo C on an IBM PC.&lt;br /&gt;&lt;br /&gt;When I say that we attempt to map the characters as closely as possible, I mean that given a character with a certain numerical code, we attempt to display a character that looks as much as possible like the IBM PC character with that same numerical code.  On the other hand, we have no way to translate string characters appearing in your source code.  What do I mean by this?  Well, consider the character 'é'.  This happens to correspond to character 0x82 in the IBM PC character set.  Suppose you have source code like this:&lt;br /&gt;&lt;/span&gt;  &lt;div style="margin-left: 40px; font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;putch ('é');     /* bad! */&lt;br /&gt;putch (0x82);    /* good! */&lt;br /&gt;&lt;/span&gt;   &lt;/div&gt; &lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;What makes the first of these two lines "bad" is that the numerical code which the compiler creates for 'é' is based on the character sets and languages installed on the computer doing the compiling, and is very likely &lt;span style="font-style: italic;"&gt;not&lt;/span&gt; 0x82.  So the first form is almost guaranteed not to work properly.  Even so, calling the second form "good" is stretching a point, because (as it happens), the TurboC library isn't presently able to display the character 'é' anyway.  True Turbo C is able to display any of the characters in the IBM PC character set -- i.e. the standard printable 7-bit ASCII characters, &lt;i&gt;plus&lt;/i&gt; additional characters in the numerical ranges 0-31 and 128-255.  However, the TurboC library does not fully support this capability in text mode, because the &lt;b&gt;ncurses&lt;/b&gt; library does not.  A subset of the IBM PC character set is supported, including linedraw characters.  (However, all linedraw characters representing double-lines or combinations of double/single lines are represented simply in terms of single lines.)&lt;br /&gt;  &lt;/span&gt;&lt;/p&gt; &lt;center style="font-family: trebuchet ms;"&gt; &lt;table nosave="" border="1"&gt;   &lt;caption&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;Screenshots of displayable Characters&lt;/b&gt;&lt;/span&gt;&lt;/caption&gt; &lt;tbody&gt;     &lt;tr nosave=""&gt;       &lt;td nosave="" align="center"&gt;&lt;span style="font-size:85%;"&gt;&lt;a href="http://www.sandroid.org/TurboC/RealTurboChars.png"&gt;&lt;img src="http://www.sandroid.org/TurboC/sm-RealTurboChars.png" alt="True Turbo C display characters -- click to enlarge." align="middle" height="209" width="381" /&gt; &lt;/a&gt;&lt;br /&gt;&lt;/span&gt;        &lt;span style="font-size:85%;"&gt;True Turbo C&lt;/span&gt;&lt;/td&gt;       &lt;td nosave="" align="center"&gt;&lt;span style="font-size:85%;"&gt;&lt;a href="http://www.sandroid.org/TurboC/FakeTurboChars.png"&gt;&lt;img src="http://www.sandroid.org/TurboC/sm-FakeTurboChars.png" alt="TurboC library display characters -- click to enlarge." align="middle" height="209" width="319" /&gt; &lt;/a&gt;&lt;br /&gt;&lt;/span&gt;        &lt;span style="font-size:85%;"&gt;TurboC library&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt; &lt;/table&gt; &lt;/center&gt; &lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;(&lt;a href="http://www.sandroid.org/TurboC/TurboCChars.c"&gt;Click here&lt;/a&gt; to see the program that generated this output.)  As you may notice, non-supported characters are rendered as dots.  Actually, this can be changed within the ported program to any other character as follows: &lt;/span&gt;&lt;/p&gt; &lt;blockquote style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;/*&lt;br /&gt;  Add this code prior to the FIRST use of any conio function.  &lt;br /&gt;  The default character cannot be changed after initialization.&lt;br /&gt;  The values used are any integer character code recognized by&lt;br /&gt;  ncurses (NOT IBM PC character codes).&lt;br /&gt;*/&lt;br /&gt;extern gint DefaultChar;&lt;br /&gt;DefaultChar = ' ';              /* or whatever */&lt;/span&gt;                     &lt;/blockquote&gt;&lt;span style="font-family: trebuchet ms;font-size:85%;" &gt; If this still isn't good enough for you, you can individually control the mapping of every character.  For example: &lt;/span&gt;&lt;blockquote style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;/*&lt;br /&gt;  Add this code AFTER the first use of textmode.&lt;br /&gt;  It will be overridden if placed BEFORE textmode.&lt;br /&gt;*/&lt;br /&gt;extern gint TranslatedChar[256];&lt;br /&gt;TranslatedChar[0x9d] = 'Y';     /* support YEN as 'Y'. */&lt;/span&gt;               &lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8745444058210106238-6333435756898670732?l=kooldeezel.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kooldeezel.blogspot.com/feeds/6333435756898670732/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8745444058210106238&amp;postID=6333435756898670732' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default/6333435756898670732'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default/6333435756898670732'/><link rel='alternate' type='text/html' href='http://kooldeezel.blogspot.com/2007/11/graphical-display-characters-in-text.html' title='Graphical display characters in text mode'/><author><name>KoOL</name><uri>http://www.blogger.com/profile/16392700484307461888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8745444058210106238.post-6540106531266560975</id><published>2007-11-29T18:01:00.002-08:00</published><updated>2007-11-29T18:02:10.294-08:00</updated><title type='text'>Text Screen resizing</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: trebuchet ms;"&gt; In true Turbo C, the resolution of the text console is completely under the control of the programmer.  The textmode function sets the resolution, in terms of the number of text rows and columns, and sets the graphics modes appropriately.  If a Turbo C program is run under Microsoft Windows, the same situation applies, in essence, because even though Windows renders the text console by means of graphical operations, the number of text rows and columns is fixed, and cannot be changed by the user. &lt;/span&gt;&lt;/span&gt;&lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;The situation is different in ncurses -- at least, if using the X-Window system -- because the size of the text console is entirely under the control of the user.  The user can resize the text console at will, and the program has little effective control over the resizing. &lt;/span&gt;&lt;/p&gt; &lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;This presents a difficulty, because Turbo C programs have naturally been written under the suppositions that the text console size has been set by the program itself, and that the text console is &lt;i&gt;not&lt;/i&gt; going to be unexpectedly resized during program execution.  Yet, these suppositions are both rather dodgy with code that has been ported using the TurboC library. &lt;/span&gt;&lt;/p&gt; &lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;There are several possible approaches to the problem: &lt;/span&gt;&lt;/p&gt; &lt;ol style="font-family: trebuchet ms;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; For TurboC versions 04/18/02 and later, the screen size is now &lt;i&gt;correct&lt;/i&gt; if the ported program is run under &lt;b&gt;xterm&lt;/b&gt;.  TurboC physically resizes the &lt;b&gt;xterm&lt;/b&gt; console correctly upon starting the program.  While it cannot prevent the user from manually resizing the window later, it will correct any manual resizing by automatically restoring the window to its correct size.  (Sadly, it is possible for a persistent user to corrupt the window by trying hard enough to resize it, but the behavior is usually pretty acceptable.)  Or,&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; If for some reason it's impractical to use &lt;b&gt;xterm&lt;/b&gt;, or if the window manager being used resists TurboC's attempts to resize &lt;b&gt;xterm&lt;/b&gt; , then you may need to use some method outside of TurboC (such as instructions to the user) to prevent resizing of the window; or&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Set the BypassResizeXterm variable to 1, and recode those portions of your program that depend on knowledge of the screen size (such as those using gotoxy and windowgotoxy(1,25) , but use gotoxy(1,LINES) instead.&lt;/span&gt; functions) so that they are more flexible.   For example, don't use things like &lt;/li&gt;&lt;/ol&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: trebuchet ms;"&gt; In implementing approach #3, several tools are at your disposal. Firstly, the variables LINES and COLS are available for your use.  These variables always contain the number of text rows and text columns, respectively, in the text console.  Secondly, the TurboC library can detect (in versions 20020331 and later) if the user has resized the console.   When it detects that such resizing has occurred, it calls a function called  ConioResizeCallback.  You can optionally provide this function yourself (though the TurboC library provides a default version of the function which does nothing), and can use this function in a variety of ways to take care of the screen resizing.  Perhaps the most straightforward way to do so is to simply allow ConioResizeCallback&lt;/span&gt; to completely redraw the screen. &lt;/span&gt;&lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;In the latter case, by the way, if the user manually resizes the text console, then your current window (as determined by the windowor textmode function) will automatically be reduced in size (if necessary) to fit the new console size.  However, it will not be correspondingly increased in size of the user later enlarges the text console.  To override this behavior, you'll need to provide an alternative to the ResizeTurboC function.   You'll need to examine the source code for any further explanation. &lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8745444058210106238-6540106531266560975?l=kooldeezel.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kooldeezel.blogspot.com/feeds/6540106531266560975/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8745444058210106238&amp;postID=6540106531266560975' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default/6540106531266560975'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default/6540106531266560975'/><link rel='alternate' type='text/html' href='http://kooldeezel.blogspot.com/2007/11/text-screen-resizing.html' title='Text Screen resizing'/><author><name>KoOL</name><uri>http://www.blogger.com/profile/16392700484307461888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8745444058210106238.post-2780665367729537451</id><published>2007-11-29T18:01:00.001-08:00</published><updated>2007-11-29T18:01:41.878-08:00</updated><title type='text'>Special-function keys</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: trebuchet ms;"&gt; In Turbo C, special keyboard character such as F1 or Ctrl-PgUp are indicated by a two-byte sequence with the getch function:   If the first byte returned is 0, then the next byte indicates which special-function key has been pressed.  The values for this second byte have been summarized in the fnkeys.h file, which also provides symbolic names for all of them. &lt;/span&gt;&lt;/span&gt;&lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;Unfortunately, many function-key sequences available using getch in MS-DOS are not available at all using the ncurses library.  (For example, F1 is available, but Ctrl-PgUp is not.)  Others may or may not be available, depending on various factors.   Consequently, while the TurboC library has mimicked this functionality as best it can -- or rather, as best &lt;i&gt;I&lt;/i&gt; can -- you may still be in the position of having to change some of the special-function keys used by your program. &lt;/span&gt;&lt;/p&gt; &lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;Here's a list of all special keys that I believe are handled by Turbo C's getch function, along with my observations of how they are handled by the TurboC library's getch function.  &lt;i&gt;Your&lt;/i&gt;&lt;br /&gt;  &lt;/span&gt; mileage may vary. &lt;/p&gt; &lt;center style="font-family: trebuchet ms;"&gt; &lt;table nosave="" border="1" cols="5"&gt;   &lt;tbody&gt;     &lt;tr nosave=""&gt;       &lt;th nosave=""&gt;&lt;span style="font-size:85%;"&gt;Special Key&lt;/span&gt;&lt;/th&gt;       &lt;th nosave=""&gt;&lt;span style="font-size:85%;"&gt;Symbol provided in fnkeys.h&lt;/span&gt;&lt;/th&gt;       &lt;th nosave=""&gt;&lt;span style="font-size:85%;"&gt;Under xterm&lt;/span&gt;&lt;/th&gt;       &lt;th nosave=""&gt;&lt;span style="font-size:85%;"&gt;Under KDE Konsole&lt;/span&gt;&lt;/th&gt;       &lt;th nosave=""&gt;&lt;span style="font-size:85%;"&gt;Under a text-mode login&lt;/span&gt;&lt;/th&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Digits on numeric keypad&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;n/a (0-9, of course)&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;No!  Treated as arrows, PgUp/PgDn.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ctrl-A through Ctrl-Z&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;C_A-C_Z&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok, except there is no Ctrl-Z.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Alt-A through Alt-Z&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;A_A-A_Z&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok, except that Alt-O has a slight delay before registering.&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;F1 through F10&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;N_F1-N-F10&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr nosave=""&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Shift-F1 though Shift-F10&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;S_F1-S_F10&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok, except Shift-F5 terminates program&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok, except:  Shift-F5 terminates program, and F9-F10 don't work.&lt;/span&gt;&lt;/td&gt;       &lt;td nosave=""&gt;&lt;span style="font-size:85%;"&gt;Ok, except:  Shift-F5 terminates program, and F9-F10 don't work.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Alt-F1 through Alt-F10&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;A_F1-A_F10&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;No!  (These are KDE hotkeys.)&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;No!  (These are KDE hotkeys.)&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;No!  (Switches between consoles.)&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ctrl-F1 through Ctrl-F10&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;C_F1-C_F10&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;No!  (These are KDE hotkeys.)&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;No!  (These are KDE hotkeys.)&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;No!&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Alt-0 through Alt-9&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;A_0-A9&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Arrows&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;N_UP, N_DOWN, N_LEFT, N_RIGHT&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok on standalone arrow keys, but not on numeric keypad.&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;PgUp, PgDn&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;N_PGUP, N_PGDN&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok on standalone arrow keys, but not on numeric keypad.&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Home, End&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;N_HOME, N_END&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;No!&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok on standalone arrow keys, but not on numeric keypad.&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;No!&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ins, Del&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;N_INS, N_DEL&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok on standalone arrow keys, but not on numeric keypad.&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Pad-minus, Pad-plus&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;N_PADPLUS, N_PADMINUS&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;No, treated as regular +/-.&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;No, treated as regular +/-.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ctrl-right, Ctrl-left&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;C_LEFT, C_RIGHT&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok on standalone arrow keys, but not on numeric keypad.&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;No, treated as regular right/left.&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;No, treated as regular right/left.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ctrl-PgUp, Ctrl-PgDn&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;C_PGUP, C_PGDN&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;No!&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;No, treated as regular PgUp/PgDn.&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;No, treated as regular PgUp/PgDn.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ctrl-Home, Ctrl-End&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;C_HOME, C_END&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok on standalone arrow keys, but not on numeric keypad.&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;No, treated as regular home/end.&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;No!&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Alt-minus, Alt-equals&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;A_MINUS, A_EQUALS&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok on main keyboard, but not on the numeric keypad.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Esc&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;N_ESC&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok, though there is a short delay before the keystroke registers.&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok, though there is a short delay before the keystroke registers.&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Ok, though there is a short delay before the keystroke registers.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt; &lt;/table&gt; &lt;/center&gt; &lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;I'd be happy to &lt;a href="mailto:info@sandroid.org"&gt;hear from&lt;/a&gt; anyone with a clear idea on how make this work more consistently, perhaps by using termcap/terminfo, of which I'm completely ignorant. &lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8745444058210106238-2780665367729537451?l=kooldeezel.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kooldeezel.blogspot.com/feeds/2780665367729537451/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8745444058210106238&amp;postID=2780665367729537451' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default/2780665367729537451'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default/2780665367729537451'/><link rel='alternate' type='text/html' href='http://kooldeezel.blogspot.com/2007/11/special-function-keys.html' title='Special-function keys'/><author><name>KoOL</name><uri>http://www.blogger.com/profile/16392700484307461888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8745444058210106238.post-8048169864101800915</id><published>2007-11-29T18:00:00.000-08:00</published><updated>2007-11-29T18:01:07.412-08:00</updated><title type='text'>Handling of integer datatypes</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: trebuchet ms;"&gt; Since the MS-DOS based Turbo C compiler is 16-bit and GNU &lt;/span&gt;&lt;b style="font-family: trebuchet ms;"&gt;gcc&lt;/b&gt;&lt;span style="font-family: trebuchet ms;"&gt; is inherently 32-bit, there are some unfortunate discrepancies in the sizes of integer datatypes between them.  This &lt;/span&gt;&lt;i style="font-family: trebuchet ms;"&gt;usually&lt;/i&gt;&lt;span style="font-family: trebuchet ms;"&gt; doesn't matter, but sometimes does matter -- for example, in disk i/o or where the programmer has counted on certain types of rollover. &lt;/span&gt;&lt;/span&gt;&lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;The TurboC library allows you to handle this problem in two separate ways, at your option.  The first way, of course, is simply to ignore the problem and to assume that an int is an int is an int.  :-)   In other words, datatypes can be left unchanged, and it's up to you to figure it out later, if your program doesn't work.  By &lt;i&gt; default&lt;/i&gt;, though, TurboC redefines the words short, int , unsigned, and long using macros so that they are replaced by GNU datatypes specifically corresponding to the Turbo C datatypes, namely: &lt;/span&gt;&lt;/p&gt; &lt;blockquote style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;#define short int16_t&lt;br /&gt;#define int int16_t&lt;br /&gt;#define unsigned uint16_t&lt;br /&gt;#define long int32_t&lt;/span&gt;         &lt;/blockquote&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: trebuchet ms;"&gt; (You may wonder why there's a macro for long, since it's a 32-bit datatype on both Turbo C and &lt;/span&gt;&lt;b style="font-family: trebuchet ms;"&gt;gcc&lt;/b&gt;&lt;span style="font-family: trebuchet ms;"&gt;.  If so, you've fallen into the Turbo-thinking trap!  The long datatype is 64-bit for some CPU types supported by &lt;/span&gt;&lt;b style="font-family: trebuchet ms;"&gt;gcc&lt;/b&gt;&lt;span style="font-family: trebuchet ms;"&gt;.) &lt;/span&gt;&lt;/span&gt;&lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;This scheme has the advantage of transparently fixing almost all data declarations in your program.  Those declarations which are not fixed properly, such as unsigned long or the use of unsigned to define bitfields in a struct, are &lt;i&gt;broken&lt;/i&gt;.  This is actually good news, because the compiler gives you an error message and you're allowed to fix the problem, rather than just allowing you to assume everything is swell.  The resources you have to fix the problems with are the various explicit datatypes provided by GNU &lt;b&gt;gcc&lt;/b&gt; (int8_t,uint8_t, int16_t, uint16_t, int32_t, and uint32_t) and some new datatypes defined by the TurboC library corresponding to the original (non-macro-replaced) GNU datatypes: gchar, gschar , guchar, gshort, gushort, gint, guint, glong, and gulong. &lt;/span&gt;&lt;/p&gt; &lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;For example, after automatic macro conversion, things like the following will be correct &lt;/span&gt;&lt;/p&gt; &lt;blockquote style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;int i, j, k;&lt;br /&gt;unsigned u;&lt;br /&gt;char c;&lt;br /&gt;short is;&lt;br /&gt;long n;&lt;/span&gt;            &lt;/blockquote&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: trebuchet ms;"&gt; but things like this will be wrong: &lt;/span&gt;&lt;/span&gt;&lt;blockquote style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;unsigned int i, j, k; // Change to unsigned or to uint16_t.&lt;br /&gt;unsigned char c; // Change to uint8_t.&lt;br /&gt;struct MyStruct&lt;br /&gt;{&lt;br /&gt;  int i; // Okay.&lt;br /&gt;  unsigned x:1; // change to guint.&lt;br /&gt;  unsigned y:2; // change to guint.&lt;br /&gt;};&lt;br /&gt;int main (int argc, char *argv[]) // Change to gint.&lt;br /&gt;{&lt;br /&gt;  ...&lt;br /&gt;}&lt;/span&gt;                                 &lt;/blockquote&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: trebuchet ms;"&gt; The automatic conversions are enabled by default, but can be disabled with the "-DDoNotFixIntegers" compiler switch.  You have to decide for yourself which is more appropriate.  Enabling the automatic conversions means that your program is more likely to work correctly once ported.  But it also means that it may be more difficult to maintain afterward because it will be filled with things that &lt;/span&gt;&lt;i style="font-family: trebuchet ms;"&gt;look&lt;/i&gt;&lt;span style="font-family: trebuchet ms;"&gt; like int but aren't really. &lt;/span&gt;&lt;/span&gt;&lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;Note that if you want to use "-DDoNotFixIntegers" to compile the code you're porting, a different version of the library is used -- libTurboCu.a rather than libTurboC.a.  Both library versions are automatically built, for versions 20020319 or later.  (For earlier versions, I'm afraid you'll have to build libTurboCu.a yourself by manually changing the Makefile to have the &lt;b&gt;gcc&lt;/b&gt; switch -DDoNotFixIntegers). &lt;/span&gt;&lt;/p&gt; &lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;Here is a tabular summary of how the integer datatype declarations are handled if converted automatically by the TurboC library:&lt;br /&gt;  &lt;/span&gt;&lt;/p&gt;          &lt;table style="font-family: trebuchet ms;" nosave="" border="1" width="95%"&gt;&lt;tbody&gt;&lt;tr nosave=""&gt;       &lt;th nosave=""&gt;&lt;span style="font-size:85%;"&gt;&lt;a name="Datatypes"&gt;&lt;/a&gt;Turbo C type&lt;/span&gt;&lt;/th&gt;       &lt;th nosave=""&gt;&lt;span style="font-size:85%;"&gt;Size&lt;/span&gt;&lt;/th&gt;       &lt;th nosave=""&gt;&lt;span style="font-size:85%;"&gt;Equivalent&lt;br /&gt;GNU gcc type&lt;/span&gt;&lt;/th&gt;       &lt;th nosave=""&gt;&lt;span style="font-size:85%;"&gt;Handling by TurboC&lt;/span&gt;&lt;/th&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;char&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;8&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;char&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Correct&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;signed char&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;8&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;signed char&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Correct&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr nosave=""&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;unsigned char&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;8&lt;/span&gt;&lt;/td&gt;       &lt;td nosave="" nowrap="nowrap"&gt;&lt;span style="font-size:85%;"&gt;uint8_t&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Causes compile-time error.  Replace manually with uint8_t .&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;short&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;16&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;int16_t&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Correct&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;unsigned short&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;16&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;uint16_t&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Causes compile-time error.  Replace manually with uint16_t .&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;short int&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;16&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;int16_t&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Causes compile-time error.  Replace manually with short .&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr nosave=""&gt;       &lt;td nosave="" nowrap="nowrap"&gt;&lt;span style="font-size:85%;"&gt;unsigned short int&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;16&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;uint16_t&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Causes compile-time error.  Replace manually with uint16_t .&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;int&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;16&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;int16_t&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Correct&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;int bitfields in structs&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;varies&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;int&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Causes a compile-time error.  Replace manually with gint .&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;unsigned int&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;16&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;uint16_t&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Causes compile-time error.  Replace manually with unsigned .&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;unsigned&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;16&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;uint16_t&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Correct&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;unsigned bitfields in structs&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;varies&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;unsigned&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Causes a compile-time error.  Replace manually with guint .&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;long&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;32&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;int32_t&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Correct&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;unsigned long&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;32&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;uint32_t&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Causes compile-time error.  Replace manually with uint32_t .&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;long int&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;32&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;int32_t&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Causes compile-time error.  Replace manually with long .&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr nosave=""&gt;       &lt;td nosave="" nowrap="nowrap"&gt;&lt;span style="font-size:85%;"&gt;unsigned long int&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;32&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;uint32_t&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Causes compile-time error.  Replace manually with uint32_t .&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8745444058210106238-8048169864101800915?l=kooldeezel.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kooldeezel.blogspot.com/feeds/8048169864101800915/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8745444058210106238&amp;postID=8048169864101800915' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default/8048169864101800915'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default/8048169864101800915'/><link rel='alternate' type='text/html' href='http://kooldeezel.blogspot.com/2007/11/handling-of-integer-datatypes.html' title='Handling of integer datatypes'/><author><name>KoOL</name><uri>http://www.blogger.com/profile/16392700484307461888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8745444058210106238.post-5420140537744605853</id><published>2007-11-29T17:59:00.000-08:00</published><updated>2007-11-29T18:00:09.416-08:00</updated><title type='text'>Supported Turbo C entities</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: trebuchet ms;"&gt; Of course, there are a lot of functions in Turbo C that are not only supported in GNU &lt;/span&gt;&lt;b style="font-family: trebuchet ms;"&gt;gcc&lt;/b&gt;&lt;span style="font-family: trebuchet ms;"&gt;, but that are even supported identically, such as fopen , fclose, fread, printf, time, etc.  On the other hand, a generic function like putchar may operate similarly only over a certain range.  For example, putchar(0xA5) is unlikely to display characters that appear to be identical in Borland Turbo C on an IBM PC and in GNU &lt;/span&gt;&lt;b style="font-family: trebuchet ms;"&gt;gcc&lt;/b&gt;&lt;span style="font-family: trebuchet ms;"&gt; in Linux.  I'm sorry about that, in a theoretical way, but life is too short for me to expend a lot of energy fixing it. &lt;/span&gt;&lt;/span&gt;&lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;Anyway, the table below isn't a complete list of all the Turbo C entities you can use, but simply those that the TurboC library treats specially. Also, I'm sure there are Turbo C functions that need special treatment which I've simply not encountered yet in my porting activities, and so aren't included here.&lt;br /&gt;  &lt;/span&gt;&lt;/p&gt;          &lt;table style="font-family: trebuchet ms;" nosave="" border="1" width="95%"&gt;&lt;tbody&gt;&lt;tr nosave=""&gt;       &lt;th nosave=""&gt;&lt;span style="font-size:85%;"&gt;Turbo C Entity&lt;/span&gt;&lt;/th&gt;       &lt;th nosave=""&gt;&lt;span style="font-size:85%;"&gt;Entity Type&lt;/span&gt;&lt;/th&gt;       &lt;th nosave=""&gt;&lt;span style="font-size:85%;"&gt;Supported&lt;/span&gt;&lt;/th&gt;       &lt;th nosave=""&gt;&lt;span style="font-size:85%;"&gt;Notes&lt;/span&gt;&lt;/th&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;__libTurboC__&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;constant&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;n/a&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Provided by the TurboC library, but not normally present in actual Turbo C.  Can be used with conditionaly compilation to insure that any changes you make to your code in porting to libTurboC are discarded if the program is recompiled later in actual Turbo C.  :-)&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;alloc.h&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;header file&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;This is supported in the sense that a file of this name is provided.  However, not all of the functions are necessarily supported.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;arc&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;bar&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;bar3d&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;bios.h&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;header file&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;This is supported in the sense that a file of this name is provided.  However, not all of the functions are necessarily supported.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;biosprint&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Thanks to Igor Bujna!  At the moment, this one relies on Linux specifically (not FreeBSD or other Unices). &lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;BypassResizeXterm&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;variable&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;n/a&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;This is not present in real Turbo C.  Normally, the TurboC library will attempt to physically resize the text console when you call textmode .  However, this does not work unless you are running &lt;b&gt;xterm&lt;/b&gt;.  If you set BypassResizeXterm to a non-zero value before calling -- say, on the basis of some environment variable setting -- then the attempt to resize the window is bypassed.  However, the window must still be resized by some other mechanism or else the program may segfault.&lt;/span&gt; textmode&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;cgets&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;circle&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;cleardevice&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;clearviewport&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;clock&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;This is already a standard *nix function, but the existing *nix function is not suitable for Turbo C.  Instead the existing function is rename clockUnix and a new clock (clockTurbo) function is created. The CLK_TCK constant may also pre-exist in *nix, but it may (or may not) be assigned a different value than needed for clock .  If TurboC.h or any other header files from the TurboC library are included, CLK_TCK will automatically be reassigned (within that source file) to an appropriate value.  However, it may not be the same value for CLK_TCK used in true Turbo C (variously, 18 or 1000).  For example, in my experiments it is equal to 100, but there's no guarantee that it won't be 1000000 on some system.  This means that the output of clock must always be assigned to a variable of type clock_t , because it may overflow an intunsigned.         clock and CLK_TCK are supposed to be prototyped in time.h -- and &lt;i&gt;are&lt;/i&gt; -- but won't have the behavior expected in TurboC unless a TurboC library header file is included also.  In other words, if time.h is included but no TurboC header file is included, clock will behave incorrectly but there will be no errors or warnings.  Finally, clock is supposed to measure the time since program startup, but in TurboC it actually measures the time since clock itself was first called by the program.&lt;/span&gt; or &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;closegraph&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;clreol&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;clrscr&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;COLS&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;variable&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;n/a&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;This is not present in true Turbo C.  It is an &lt;b&gt;ncurses&lt;/b&gt; variable that tells the current number of text columns in the display console.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;conio.h&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;header file&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Most conio.h functions are supported.  Currently, only cscanf is omitted.  Support is through ncurses.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;ConioResizeCallback&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;n/a&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;This is not present in true Turbo C.  It is a function which the TurboC library calls when it has detected that the user has resized the console.  By default, it does nothing, but you can override this behavior by providing your own version of this function (which will be preferentially chosen at linktime over the version already within the TurboC library).  You can do anything you like with this function, but one possible use is to refresh all of the text data on the screen.  Use the LINES and  COLS&lt;/span&gt; variables to determine the current screen height and width.&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;cprintf&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;cputs&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;cscanf&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;No&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;It may seem naively that this function is a simple combination of  cgets with sscanf.  However, on closer inspection it really isn't&lt;i&gt;.&lt;/i&gt;  I don't presently see how to implement it without messing with the guts of the scanf function family (which I have no desire to do).        &lt;/span&gt;&lt;p&gt;&lt;span style="font-size:85%;"&gt;Workaround:  For the present time, I'd suggest writing  cscanf out of your code in favor of cgets and sscanf .  Actually, I've seen Borland docs that recommend this also.&lt;/span&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;struct date&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;data type&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Thanks to Igor Bujna.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;delay&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;(Igor Bujna provided this function but I haven't used it, because his version relies on &lt;b&gt;ncurses&lt;/b&gt;.  Thanks but sorry, Igor!) The function parameter has arbitrarily been changed from 16-bit to 32-bit.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;delline&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;detectgraph&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;dir.h&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;header file&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;This is supported in the sense that a file of this name is provided.  However, not all of the functions are necessarily supported.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;directvideo&lt;br /&gt;_directvideo&lt;/span&gt;       &lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;variable&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;I provide variables of this name, which you can manipulated as desired, but they don't affect any conio functionality.  (It seems to me that variables of both names have been provided in different versions of Turbo C, but they behave the same.)&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;dos.h&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;header file&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;This is supported in the sense that a file of this name is provided.  However, not all of the functions are necessarily supported.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;dostounix&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Contributed by Igor Bujna.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;drawpoly&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;ellipse&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;far&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;type modifier&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Requires TurboC.h.  There's no need for "far pointers" with a 32-bit compiler, so this is simply an empty macro.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;farcalloc&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;This is the same as calloc.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;farcoreleft&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;This is supposed to determine how much space remains on the heap. There's no way to do this, since the heap size is not limited in any practical sense.  Hence, it is a macro that simply always has the value 512K.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;farfree&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;This is the same as free.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;farmalloc&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;This is the same as malloc.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;fcloseall&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Linux: Yes&lt;br /&gt;FreeBSD: No&lt;br /&gt;Other: TBD&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Requires TurboC.h.  This is not a function for which I provide any code.  It's simply a standard library function.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;struct ffblk&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;data type&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;fillellipse&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;fillpoly&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;findfirst&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;While substantially a functional replacement for the Turbo C function of the same name, it is also subtly different in a number of ways:       &lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Most importantly, please read about the findlast function.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Long filenames (not just 8.3) are supported. &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Regular expressions are used for the filename patterns.  This means that expressions like "*.c" and "foobar.?" will work mostly -- but not &lt;i&gt;entirely&lt;/i&gt; -- as expected.  For example, the pattern "*" in Linux corresponds more closely to the pattern "*.*" in DOS than does "*.*" in Linux.  (In Linux, "*.*" implies that the filename &lt;i&gt;really&lt;/i&gt; contains a dot, and so it wouldn't match a filename like "foobar".)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Since *nix filenames are case-sensitive, patterns like "*.c" and "*.C" are &lt;i&gt;not&lt;/i&gt; interchangeable.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Among the flags, only FA_DIRECFA_DIREC  flag. FA_ARCH and FA_LABEL flags are not supported at all.  I've arbitrarily defined FA_RDONLY to correspond to files for which the user-write-permission bit is not set, and FA_SYSTEM to correspond to files for which the user-read-permission bit is not set. FA_HIDDEN is defined to correspond to files whith names beginning in '.'.  However, this does not work on all systems.  (It works in Linux, but not presently in BSD.)&lt;/span&gt; corresponds directly to the DOS &lt;/li&gt;&lt;/ul&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;findlast&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;n/a&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;This is not a function provided by true Turbo C, but is provided to correct a problem in the libTurboC emulation.  The "normal" use of  findfirst/findnext, as defined by me, is that the entire file list is read, and then terminates when findnext cannot locate any more files.  If the functions are not used in this way -- in other words, if findnext never locates the &lt;i&gt;last&lt;/i&gt; file -- then libTurboC has no way to know that it should free the memory which has been allocated.  With each "abnormal" use of findfirst/findnext this memory will accumulate.  The symptom is that eventuallyfindfirst/findnext will not be able to locate files even though they exist.  This problem can be fixed by explicitly adding a call to findlast after the last use of findnext, but before deallocating its struct ffblk .   The prototype is:&lt;br /&gt;void findlast (struct ffblk *);&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;findnext&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;See the notes for findfirst.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;floodfill&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;TBD&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;I may prove to be too darned lazy for this.  However, there's a &lt;b&gt;GRX&lt;/b&gt; function that does this.  If anyone wants to adapt it ...&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;fnkeys.h&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;header file&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;n/a&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;This is a file I've provided, but there is not any equivalent Turbo C header file.  This header simply provides symbolic names for all of the special-function keys recognized by MS-DOS.  Unfortunately, these are not all supported by ncurses.  See the discussion &lt;a href="http://www.sandroid.org/TurboC/functionlist.html#Keys"&gt;below&lt;/a&gt;.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;getarccoords&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Requires the "-lm" compiler switch.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;getaspectratio&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;There is a function of this name, but at this point it acts as though the pixels are always square.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;getbkcolor&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;getch&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;There is an ncurses function of the same name, but somewhat different functionality.  In any source file using conio.h, the conio version of getch#include "conio.h", while the ncurses version of getchgetchNcurses .       &lt;/span&gt; applies below the  applies above it.  The ncurses functionality continues to be available, however, as a new function &lt;p&gt;&lt;span style="font-size:85%;"&gt;Please note that getch will work in textmode or in graphics mode, but will not presently work otherwise.  Conversely, getchar will work only when &lt;i&gt;not&lt;/i&gt; in textmode .  (getchar will work in graphics mode if textmode has not been previously called, but will not echo to graphics screen).&lt;/span&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;getche&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;getcolor&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;getdate&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Contributed by Igor Bujna.  In some newer system libraries, there actually is a function called getdate, which works differently and conflicts with this function.  That function, if it exists, will be accessible in TurboC programs as getdateSystem.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;getdefaultpalette&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;The true Turbo C function returns a pointer to a struct palettetype , whereas the TurboC library function returns a pointer to const struct palettetype.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;getdrivername&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;This functions returns a const char *, whereas the true Turbo C function returns char *.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;getfillpattern&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;getfillsettings&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;getftime&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;I initially believed that this function did not work, because the linker could not find the fstat function on which it is based.  Later, this problem mysteriously disappeared.   I mention this just FYI.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;getgraphmode&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;getimage&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;a name="getimage"&gt;&lt;/a&gt;Borland's documentation does not specify the format of the buffer into which the image is placed, beyond fact that the first two words contain the width and height, in pixels.  If you use this function with those restrictions in mind, you'll be okay.       &lt;/span&gt;&lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;On the other hand ...&lt;/i&gt; I think it's very likely that programs containing  this function might exploit knowledge of the graphics controller in the PC, and thus may (improperly if cleverly) directly manipulate date within the output graphics buffer.  Realize that &lt;i&gt;no&lt;/i&gt; effort has been made to duplicate these  undocumented buffer formats. &lt;/span&gt;&lt;span style="font-size:85%;color:#ff0000;"&gt;If your program depends on the size or format of the graphical area of the output buffer, I guarantee that it &lt;i&gt;will not&lt;/i&gt; work!&lt;/span&gt;       &lt;/p&gt;       &lt;p&gt;&lt;span style="font-size:85%;color:#000000;"&gt;As a corollary, be sure to allocate image buffers dynamically using imagesize, per Borland's docs, with        malloc or calloc.  I suspect that many existing programs statically allocate the buffers, on the incorrect notion that the buffer format is known.&lt;/span&gt; &lt;/p&gt;       &lt;p&gt;&lt;span style="font-size:85%;color:#000000;"&gt;Finally, you should not expect to be able to save the image buffer as a file and to reload it later.&lt;/span&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;getlinesettings&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;getmaxcolor&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;getmaxmode&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;See the comments for getmoderange.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;getmaxx&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;getmaxy&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;getmodename&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Since the TurboC library does not limit the graphics modes to those of a particular "graphics driver" as Borland Turbo C does, and since there are many more graphics modes, it is not practical to make the name strings identical to those reported in an actual Turbo C program.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;getmoderange&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Since the TurboC library rejects the concept of a "graphics driver", &lt;i&gt;every&lt;/i&gt;&lt;i&gt;every&lt;/i&gt;VGAHI, VGALO, etc.), the symbolic constants don't have the same numeric values as in true Turbo C, and many more modes are available than are assigned symbolic constants.  (To understand this, refer to the graph.h file.)  The upshot of all this is that getmoderange returns a huge range of allowable modes, in comparison to true Turbo C.  At this writing, the range is from 0 to approximately 1439, whereas true Turbo C topped out at about 5; this maximum mode presently provides a 1280x1024 screen with 256 colors and 4 pages.  Whether this presents a problem remains to be seen.&lt;/span&gt; graphics mode is allowed for  driver.  Furthermore, while various graphics modes are available under the same symbolic constant names as in true Turbo C (such as &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;getpass&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;getpixel&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;In true Turbo C, we are guaranteed that the on-screen color corresponds to an actual color in our palette.  In the TurboC library, this isn't true.  The closest-match paletted color is returned.  If there is more than one match, the first one encountered is returned.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;getpalette&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;getpalettesize&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;gettext&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;The format of the text buffer created is the same as in true Turbo C.  The same bytes are produced, and they are stored in the same order.&lt;br /&gt;&lt;br /&gt;11/02/03 and later:  There is a function called gettext in the internationalization library (libintl).  To avoid a conflict, the internationalization library's function will be accessible instead by the name gettextIntl.&lt;br /&gt;&lt;/span&gt;              &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;gettextinfo&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;gettextsettings&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;gettime&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;There are two versions of this, one by me, and one by Igor Bujna (called).   I'm not aware of the pros and cons of the two.&lt;/span&gt; gettime_d&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;getviewsettings&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;getx&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;gety&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;gotoxy&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;graphics.h&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;header file&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;At present, most graphics.h functionality is supported in one form or another except text output, which is next on the to-do list.       &lt;/span&gt;&lt;p&gt;&lt;span style="font-size:85%;"&gt;Use of graphics requires the X-window system.&lt;/span&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;graphdefaults&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;grapherrormsg&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;_graphfreemem&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;This function is not used in any way by the TurboC library -- or hopefully, by the user code -- but has nevertheless been provided.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;_graphgetmem&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;See the comments for _graphfreemem.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;graphresult&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;highvideo&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;huge&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;type modifier&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Requires TurboC.h.  There's no need for "huge pointers" with a 32-bit compiler, so this is simply an empty macro.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;imagesize&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Important:  see the warnings for the getimage function above.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;initgraph&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Causes a separate graphics window to open.  (The parent text-based window remains visible.)  The location of this graphics window (i.e., locally or remotely) is dependent on the value of the DISPLAY environment variable.  Typically (but not always) this variable is set automatically for you by the system, and so you usually don't have to worry about it.  The graphdriver and pathtodriver input-parameters of  initgraph are (almost) completely ignored, though the constants used as names for the various drivers are available for your use (DETECT, CGA, MCGA, EGA, etc.).  As far as the graphmode input-parameter is concerned, every mode applicable to any graphics driver is accepted.  All graphics modes through Borland C++ 5.0 are supported:  CGAC0, CGAC1, CGAC2, CGAC3, CGAHI, MCGAC0, MCGAC1, MCGAC2, MCGAC3, MCGAMED, MCGAHI, EGALO, EGAHI, EGA64LO, EGA64HI, EGAMONOHI, HERCMONOHI, ATT400C0, ATT400C1, ATT400C2, ATT400C3, ATT400MED, ATT400HI, VGALO, VGAMED, VGAHI, PC3270HI, IBM8514HI, IBM8514LO.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;insline&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;installuserdriver&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes (sort of)&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Graphics drivers as such are not used by the TurboC library (which allows every defined graphics mode to be used by every "driver" anyway).  This function, therefore, does nothing.  It always returns a value of  IBM8514.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;installuserfont&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;TBD&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;io.h&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;header file&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;This is supported in the sense that a file of this name is provided.  However, not all of the functions are necessarily supported.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;kbhit&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;line&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;linerel&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;LINES&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;variable&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;n/a&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;This is not present in true Turbo C.  It is an &lt;b&gt;ncurses&lt;/b&gt; variable that tells the current number of text rows in the display console.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;lineto&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;lowvideo&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;mkdir&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;A function of the same name is provided by GNU &lt;b&gt;gcc&lt;/b&gt;, but behaves somewhat differently in the Linux environment.  The version provided by TurboC corrects that behavior.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;moverel&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;movetext&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;moveto&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;normvideo&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;outtext&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;See the comments for outtextxy.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;outtextxy&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;See the comments for settextstyle.        &lt;/span&gt;&lt;p&gt;&lt;span style="font-size:85%;"&gt;Borland seems to perform clipping on text by not displaying any &lt;i&gt;characters&lt;/i&gt; that aren't wholly within the viewport.  The TurboC library performs clipping on text by not displaying any &lt;i&gt;pixels&lt;/i&gt; of the characters that are outside of the viewport.  In other words, the TurboC library may display partial characters in some cases, whereas true Turbo C will not do so.&lt;/span&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;pieslice&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;putch&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;putimage&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Important:  see the warnings for the getimage function above.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;putpixel&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;puttext&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;See the notes for gettext. &lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;random&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Requires TurboC.h.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;randomize&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Requires TurboC.h.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;rectangle&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;registerbgidriver&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes (sort of)&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;This function serves no purpose in the TurboC library, since there is no need to load separate graphics "drivers".  Hence, this function actually does nothing.  It always returns a value of IBM8514, which probably doesn't correspond to what you might have wanted.  Therefore, it is probably best to write this function out of your code.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;registerbgifont&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;TBD&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;restorecrtmode&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Note that Borland's documentation does not specify whether the resulting text-mode screen is cleared or not.  With the TurboC library, it will &lt;i&gt;not&lt;/i&gt; be cleared.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;sector&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Requires the "-lm" compiler switch.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;setactivepage&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;setallpalette&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;setaspectratio&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;There's a function of this name, but it does nothing, on the assumption that the pixels are always square.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;setbkcolor&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;See the comment for setpalette below.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;setcolor&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;_setcursortype&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;This function was not present in Turbo C 2.0, but appeared in some later versions.  The cursor type, as in Turbo C, is one of the following: _NOCURSOR, _NORMALCURSOR, _SOLIDCURSOR.  However, ncurses does not provide these choices as such; it provides only "invisible", "visible", and "very visible", with the differences between these being dependent on the target platform.  For example, on my iMac Linux box, both  _NORMALCURSOR and _SOLIDCURSOR&lt;/span&gt; appear as indistinguishable block cursors.  In other words, your mileage may vary.&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;setfillpattern&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;setfillstyle&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;setftime&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;No&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;The closest *nix function corresponding to this that I can find is  utimes, which unfortunately requires knowing the filename.  On the other hand, setftime&lt;i&gt;handle&lt;/i&gt; of an open file.  There's no clean way I know to determine a filename given a file handle.  I don't see any clean way to implement this without intercepting all  open and fopen calls.       &lt;/span&gt; requires the &lt;p&gt;&lt;span style="font-size:85%;"&gt;Workaround:  Rewrite your code to use utimes rather than setftime. &lt;/span&gt;&lt;/p&gt;       &lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;Note&lt;/b&gt;:  Actually, there is a way of writing such a function without trapping fopen, but it's &lt;i&gt;so&lt;/i&gt; unclean that I'd hesitate to do it.  I'd be happy to &lt;a href="mailto:info@sandroid.org"&gt;receive&lt;/a&gt; someone else's code for it, though.  Given the file handle, the  fstat function can reveal the file's "inode".  There's no way to do a reverse lookup and determine a filename given an inode, but a search of the entire file-system (using the &lt;b&gt;find&lt;/b&gt;&lt;i&gt;relatively&lt;/i&gt; efficient by first searching just the current directory, and then searching the home directory only on failure, and then searching the entire file-system only on failure.  (Unfortunately, the inode numbers are not necessarily unique.  They are only unique within a given file-system, and if multiple file-systems are mounted, they could each have files with the same inode.)  Finally, after &lt;b&gt;find&lt;/b&gt; has determined the filename, the utimes functions could be used.  Ick!&lt;/span&gt; function from the command line, with the appropriate switches) can give a list of the filenames of all files with a given inode.  The search can be made &lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;setgraphbufsize&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes ... and no&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes there is a function of this name.  No, it doesn't do anything, though it does return the correct values.  I don't allow you to alter the size of any memory buffers used internally by the TurboC library.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;setgraphmode&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;setlinestyle&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;setpalette&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;In true Turbo C, changes to the palette may instantly be seen on the graphics display, because true hardware modes within the graphics controller are affected.  With the TurboC library, only future drawing operations are affected, but pixels which have already been drawn are unaffected.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;setrgbpalette&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;See the comment for setpalette above.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;settextjustify&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Borland Turbo C 2.&lt;i&gt;x&lt;/i&gt; seemingly has a bug in which if the text style is HORIZ_DIR, then LEFT_TEXT is treated as RIGHT_TEXT .  This bug has not been duplicated in the TurboC library.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;settextstyle&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes ... and no&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;So far (20020608), only the bitmapped font (DEFAULT_FONT) has been implemented.        &lt;/span&gt;&lt;p&gt;&lt;span style="font-size:85%;"&gt;Eventually, all stroked fonts defined in Borland C++ 5.0 will be supported, supposing that I can find appropriate open-source fonts with which to implement them:    TRIPLEX_FONT, SMALL_FONT , SANS_SERIF_FONT, GOTHIC_FONT, SCRIPT_FONT,       SIMPLEX_FONT, TRIPLEX_SCR_FONT, COMPLEX_FONT,       EUROPEAN_FONT, BOLD_FONT&lt;/span&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;setusercharsize&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;TBD&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;setviewport&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;setvisualpage&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;setwritemode&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Supports not only the modes COPY_PUTXOR_PUT specified by Borland, but also the modes OR_PUT, AND_PUT, and        NOT_PUT (which in true Turbo C were used only for the putimage function).&lt;/span&gt; and &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;sopen&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;This function (implemented as a macro) was contributed by Igor Bujna.  Never having used it myself, I don't know how closely it matches the Turbo C function.  However, O_TEXT is defined identically to  O_BINARY, so it clearly doesn't distinguish between text and binary modes.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;_stklen&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;global variable&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Requires TurboC.h.  In Turbo C, this was used to define the size of the stack.  This is pointless in &lt;b&gt;gcc&lt;/b&gt;, so a variable of this name is provided, but assigning it a value does nothing.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;strcmpi&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Requires TurboC.h.  This is simply a macro that renames the function as strcasecmp.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;stricmp&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Requires TurboC.h.  This is simply a macro that renames the function as strcasecmp.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;strlwr&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Requires TurboC.h.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;strncmpi&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Requires TurboC.h.   This is simply a macro that renames the function as strncasecmp.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;strupr&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Requires TurboC.h.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;const int TcUnicodeMappings[256]&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;global variable&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;n/a&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;a name="TcUnicode"&gt;&lt;/a&gt;This is a resource not available in true Turbo C, but is helpful if you choose to use &lt;b&gt;Xlib&lt;/b&gt; functions rather than graphics.h functions to display text on a graphics-mode screen.  Except for the usual ASCII printable characters (0x20-0x7E), the character set in normal *nix fonts is not the same as the normal character set in MS-DOS.  However, you can fake up this character set if a Unicode font (one with font descriptions ending in 10646-1) is used.   The array simply provides a decent Unicode equivalent for MS-DOS characters.  Every character is represented,  but not every character is necessarily present in every Unicode font.  The so-called GNU Unifont supports every character we reference.  Note that lots of characters were missing from the original Borland-supplied stroked fonts anyhow.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;textattr&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;(See notes for textcolor.)&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;textbackground&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;(See notes for textcolor.)&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;textcolor&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;For color control, Borland's color constants are used, and are assigned the same numerical values as in Turbo C:  BLACK, BLUE, GREEN, CYAN, RED, MAGENTA, BROWN, LIGHTGRAY, DARKGRAY, LIGHTBLUE, LIGHTGREEN, LIGHTCYAN, LIGHTRED, LIGHTMAGENTA, YELLOW, WHITE, BLINK.  Whether or not you &lt;i&gt;actually&lt;/i&gt; get blinking when using BLINK seems to depend on the console being used.  For me, it seems to blink with KDE's &lt;b&gt;konsole       &lt;/b&gt;but not with &lt;b&gt;xterm&lt;/b&gt;.  Anyhow, your mileage may vary.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;textheight&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;struct text_info&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;data type&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;textmode&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;All of the Turbo C 2.0 text modes are supported, and I've included many added later, up to those defined in Borland C++ 5.5.  The same constants, with the same numerical values are used as in Turbo C.  (BW40, C40, BW80, C80, MONO, C4350,&lt;/span&gt; ....)        &lt;p&gt;&lt;span style="font-size:85%;"&gt;If you don't explicitly call textmode textmode(C80). Unfortunately, even though the initial call to textmode is optional, there is a non-optional call to textmode at the &lt;i&gt; end&lt;/i&gt;EXITMODE not found in Turbo C is provided to allow ncurses to gracefully shutdown.  You must call textmode(EXITMODE) prior to exiting your program, or else you risk losing control of the console from within which you're running the program. &lt;/span&gt; before beginning to use the various console-i/o operations, there is an implicit call  of the program, not needed by the original Turbo C program but needed by the TurboC library.  A mode called &lt;/p&gt;       &lt;p&gt;&lt;span style="font-size:85%;"&gt;TurboC does not actually distinguish between B&amp;amp;W and Color modes; all modes are color modes.  &lt;/span&gt;&lt;/p&gt;       &lt;p&gt;&lt;span style="font-size:85%;"&gt;The rationale for sizing of the text console differs somewhat between Turbo C and ncurses, in a way that makes it difficult to reconcile them with perfect accuracy.  You'll want to read the section titled "&lt;a href="http://www.sandroid.org/TurboC/functionlist.html#Resizing"&gt;Screen resizing&lt;/a&gt;" for an explanation.&lt;/span&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;textwidth&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;struct time&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;data type&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;TurboC.h&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;header file&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;n/a&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;There is no Turbo C header file of this name, but this is sort of a catch-all header I've created to cover everything not directly covered in conio.h and the other actual Turbo C header files.  For example, it contains the &lt;a href="http://www.sandroid.org/TurboC/functionlist.html#Integers"&gt;integer datatype conversion macros&lt;/a&gt; and the prototypes for the strupr and strlwr&lt;b&gt;gcc&lt;/b&gt; that way because string.h already exists). This file is automatically included if any of the other header files (conio.h, io.h, dir.h, etc.) are included.&lt;/span&gt; functions (which are handled in Turbo C by the string.h header file, but can't be handled in &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;ungetch&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;There is an ncurses function of the same name, but somewhat different functionality.  In any source file using conio.h, the conio version of ungetch#include "conio.h", while the ncurses version of ungetchungetchNcurses .&lt;/span&gt; applies below the  applies above it.  The ncurses functionality continues to be available, however, as a new function &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;unixtodos&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;functions&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Contributed by Igor Bujna.&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;wherex&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;wherey&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;window&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;function&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;       &lt;/td&gt;     &lt;/tr&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;_wscroll&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;variable&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;Yes&lt;/span&gt;&lt;/td&gt;       &lt;td&gt;&lt;span style="font-size:85%;"&gt;This global variable variable was not present in Turbo C 2.0, but is present in some later versions.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8745444058210106238-5420140537744605853?l=kooldeezel.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kooldeezel.blogspot.com/feeds/5420140537744605853/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8745444058210106238&amp;postID=5420140537744605853' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default/5420140537744605853'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default/5420140537744605853'/><link rel='alternate' type='text/html' href='http://kooldeezel.blogspot.com/2007/11/supported-turbo-c-entities.html' title='Supported Turbo C entities'/><author><name>KoOL</name><uri>http://www.blogger.com/profile/16392700484307461888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8745444058210106238.post-6928688621758527583</id><published>2007-11-29T17:58:00.000-08:00</published><updated>2007-11-29T17:59:13.712-08:00</updated><title type='text'>Running a ported program remotely</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: trebuchet ms;"&gt; Because text-handling capabilities of the TurboC libary are based on standard i/o streams (stdin/stdout) and on &lt;/span&gt;&lt;b style="font-family: trebuchet ms;"&gt;ncurses&lt;/b&gt;&lt;span style="font-family: trebuchet ms;"&gt;, the text-based programs work just fine when run remotely but hosted on another computer: &lt;/span&gt;&lt;/span&gt;&lt;blockquote style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;xterm +sb -tn linux&lt;br /&gt;telnet/rlogin/ssh/etc. &lt;i&gt;(to connect to host)&lt;/i&gt;&lt;br /&gt;&lt;i&gt;PortedProgram PortedProgramOptions ...&lt;/i&gt;&lt;/span&gt;   &lt;/blockquote&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: trebuchet ms;"&gt; Actually, there is some difficulty correctly sizing the screen when &lt;/span&gt;&lt;b style="font-family: trebuchet ms;"&gt;ssh&lt;/b&gt;&lt;span style="font-family: trebuchet ms;"&gt; is used for the remote login, though &lt;/span&gt;&lt;b style="font-family: trebuchet ms;"&gt;telnet&lt;/b&gt;&lt;span style="font-family: trebuchet ms;"&gt; and &lt;/span&gt;&lt;b style="font-family: trebuchet ms;"&gt;rlogin&lt;/b&gt;&lt;span style="font-family: trebuchet ms;"&gt; seem to work properly in the cases I've tried.  What happens with &lt;/span&gt;&lt;b style="font-family: trebuchet ms;"&gt;ssh&lt;/b&gt;&lt;span style="font-family: trebuchet ms;"&gt; is that if the &lt;/span&gt;&lt;b style="font-family: trebuchet ms;"&gt;xterm&lt;/b&gt;&lt;span style="font-family: trebuchet ms;"&gt; window is manually resized, it doesn't automatically resize itself until a key is pressed.  I imagine that the desire to remotely run a ported Turbo C program is rare, so this is unlikely to pose a problem for many people. &lt;/span&gt;&lt;/span&gt;&lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;To a certain extent, graphically-based programs can also be run remotely, because the TurboC library's graphical capabilites are based on the X-window system.  However, exploiting this capability is hardly a user-friendly process.  The following steps are necessary: &lt;/span&gt;&lt;/p&gt; &lt;blockquote style="font-family: trebuchet ms;"&gt;   &lt;ol&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; You must set up the X-server at the user's location to accept input from the remote computer hosting the ported TurboC program.  This is done with the command-line program &lt;b&gt;xhost&lt;/b&gt;, and you need to know the ip address of the remote computer:&lt;/span&gt;&lt;/li&gt;&lt;ul&gt;&lt;span style="font-size:85%;"&gt; xhost &lt;i&gt;RemoteIpAddress&lt;/i&gt;&lt;/span&gt;&lt;/ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; The DISPLAY environment variable must be properly initialized on the remote computer to indicate the user's computer.  Typically this is done automatically when you log in (with &lt;b&gt;telnet&lt;/b&gt;/&lt;b&gt;rlogin&lt;/b&gt;/&lt;b&gt;ssh&lt;/b&gt; ), but not &lt;i&gt;necessarily&lt;/i&gt;.  So after logging in, but before running the ported program, you might need to set up DISPLAY.  In the bash shell, this would look something like this:&lt;/span&gt;&lt;/li&gt;&lt;ol&gt;&lt;span style="font-size:85%;"&gt; export DISPLAY=&lt;i&gt;UserIpAddress&lt;/i&gt;:0.0     &lt;/span&gt;&lt;/ol&gt;&lt;/ol&gt; &lt;/blockquote&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: trebuchet ms;"&gt; Putting it all together, the complete sequence of steps for running the program remotely might become something like this: &lt;/span&gt;&lt;/span&gt;&lt;blockquote style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;xterm +sb -tn linux&lt;br /&gt;xhost &lt;i&gt;RemoteIpAddress&lt;/i&gt;&lt;br /&gt;telnet &lt;i&gt;RemoteIpAddress&lt;/i&gt;&lt;br /&gt;export DISPLAY=&lt;i&gt;UserIpAddress&lt;/i&gt;:0.0&lt;br /&gt;&lt;i&gt;PortedProgram&lt;/i&gt; &lt;i&gt;PortedProgramOptions&lt;/i&gt; ...&lt;/span&gt;   &lt;/blockquote&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: trebuchet ms;"&gt; Unfortunately, firewalls and/or network-address-translation may wreak havoc with this scheme, and you may find that the graphics capabilities of the ported Turbo C programs simply don't work remotely.  Text-only ported programs are fortunately less affected (i.e., &lt;/span&gt;&lt;i style="font-family: trebuchet ms;"&gt;not&lt;/i&gt; affected)  by these problems.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8745444058210106238-6928688621758527583?l=kooldeezel.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kooldeezel.blogspot.com/feeds/6928688621758527583/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8745444058210106238&amp;postID=6928688621758527583' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default/6928688621758527583'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default/6928688621758527583'/><link rel='alternate' type='text/html' href='http://kooldeezel.blogspot.com/2007/11/running-ported-program-remotely.html' title='Running a ported program remotely'/><author><name>KoOL</name><uri>http://www.blogger.com/profile/16392700484307461888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8745444058210106238.post-3295995204915460383</id><published>2007-11-29T17:54:00.000-08:00</published><updated>2007-11-29T17:56:43.203-08:00</updated><title type='text'>Running a Ported Program</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: trebuchet ms;"&gt; The ease with which you can run a program ported to *nix with the TurboC library depends on &lt;/span&gt;&lt;i style="font-family: trebuchet ms;"&gt;which&lt;/i&gt;&lt;span style="font-family: trebuchet ms;"&gt; Turbo C capabilities have been used.  The important points to consider are whether the "console i/o" capabilities (as represented by the header file conio.h) and/or the "graphics" capabilities (as represented by the header file graphics.h) have been used. &lt;/span&gt;&lt;/span&gt;&lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;While text-based programs ported with the TurboC library run to some extent in almost any *nix text terminal, it is highly advisable to run the ported program under the X-window system, explicitly using &lt;b&gt;xterm&lt;/b&gt;.  I'd recommend invoking your program as follows, either from a command line or as a desktop icon: &lt;/span&gt;&lt;/p&gt; &lt;blockquote style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;xterm +sb -tn linux -e &lt;i&gt;PortedProgram&lt;/i&gt; &lt;i&gt;PortedProgramOptions&lt;/i&gt; ...&lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: trebuchet ms;"&gt; (See "man xterm".)  The "+sb" command-line switch removes scrollbars from the &lt;/span&gt;&lt;b style="font-family: trebuchet ms;"&gt;xterm&lt;/b&gt;&lt;b style="font-family: trebuchet ms;"&gt;xterm&lt;/b&gt;&lt;span style="font-family: trebuchet ms;"&gt; color settings, function-key interpretation, etc., match what's used in Linux (where I've been developing the TurboC library).  This is useful, for example, if the ported program is being run in FreeBSD, where &lt;/span&gt;&lt;b style="font-family: trebuchet ms;"&gt;xterm&lt;/b&gt;&lt;span style="font-family: trebuchet ms;"&gt;'s default settings aren't necessarily the same as in Linux. &lt;/span&gt;&lt;/span&gt; console.  The "-tn linux" command-line switch insures that the &lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;The deficiencies which you may encounter if &lt;b&gt;xterm&lt;/b&gt; is &lt;i&gt;not&lt;/i&gt; used are &lt;a href="http://www.sandroid.org/TurboC/bugs.html"&gt;numerous&lt;/a&gt;, but other kinds of text consoles (even a real text console without the X-window system) may prove to be satisfactory for your purposes.  You'll simply have to try it and see, if you're so inclined. &lt;/span&gt;&lt;/p&gt; &lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;Graphical capabilities, on the other hand, are supported only under the X-window system, and require availability of an X server.  In general, this means that the ported program can be run on any *nix box except bare-bone ones (like firewalls) or quirky ones (like Mac OS X) that don't provide &lt;b&gt;X&lt;/b&gt;. &lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8745444058210106238-3295995204915460383?l=kooldeezel.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kooldeezel.blogspot.com/feeds/3295995204915460383/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8745444058210106238&amp;postID=3295995204915460383' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default/3295995204915460383'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default/3295995204915460383'/><link rel='alternate' type='text/html' href='http://kooldeezel.blogspot.com/2007/11/running-ported-program.html' title='Running a Ported Program'/><author><name>KoOL</name><uri>http://www.blogger.com/profile/16392700484307461888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8745444058210106238.post-8766477829087977002</id><published>2007-11-29T17:52:00.002-08:00</published><updated>2007-11-29T17:53:20.422-08:00</updated><title type='text'>Licensing</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: trebuchet ms;"&gt; Since TurboC is provided under the &lt;/span&gt;&lt;a style="font-family: trebuchet ms;" href="http://www.fsf.org/"&gt;LGPL&lt;/a&gt;&lt;span style="font-family: trebuchet ms;"&gt; , you are free to license your own program however you like.  In other words, your program &lt;/span&gt;&lt;i style="font-family: trebuchet ms;"&gt;does not&lt;/i&gt;&lt;span style="font-family: trebuchet ms;"&gt; have to be GPL'd.  Of course, it would be nice to do so, and you might want to consider GPL'ing your code.  You'll still want to read the LGPL to make sure that you conform to its (rather minimal) requirements. &lt;/span&gt;&lt;/span&gt;&lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;If your code is linked to &lt;b&gt;ncurses&lt;/b&gt; or &lt;b&gt;X&lt;/b&gt;, as described in the previous section, you'll also have to conform to &lt;i&gt;their&lt;/i&gt; licenses, namely the MIT license and the X-Consortium license respectively.  These licenses are highly non-restrictive, and require merely that you include their copyright notices.  Both licenses can be viewed at the Free Software Foundation's &lt;a href="http://www.fsf.org/"&gt;website&lt;/a&gt;. &lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8745444058210106238-8766477829087977002?l=kooldeezel.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kooldeezel.blogspot.com/feeds/8766477829087977002/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8745444058210106238&amp;postID=8766477829087977002' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default/8766477829087977002'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default/8766477829087977002'/><link rel='alternate' type='text/html' href='http://kooldeezel.blogspot.com/2007/11/licensing.html' title='Licensing'/><author><name>KoOL</name><uri>http://www.blogger.com/profile/16392700484307461888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8745444058210106238.post-4539969716431832458</id><published>2007-11-29T17:52:00.001-08:00</published><updated>2007-11-29T17:52:46.669-08:00</updated><title type='text'>Using Turbo C</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: trebuchet ms;"&gt; Compile the Turbo C source you're trying to port, using GNU &lt;/span&gt;&lt;b style="font-family: trebuchet ms;"&gt;gcc&lt;/b&gt;&lt;span style="font-family: trebuchet ms;"&gt;. Add command-line switches to link to TurboC, to &lt;/span&gt;&lt;b style="font-family: trebuchet ms;"&gt;ncurses&lt;/b&gt;&lt;span style="font-family: trebuchet ms;"&gt;, to &lt;/span&gt;&lt;b style="font-family: trebuchet ms;"&gt;Xlib&lt;/b&gt;&lt;span style="font-family: trebuchet ms;"&gt; , and to &lt;/span&gt;&lt;b style="font-family: trebuchet ms;"&gt;pthreads&lt;/b&gt;&lt;span style="font-family: trebuchet ms;"&gt;: &lt;/span&gt;&lt;/span&gt;&lt;blockquote style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;gcc [-O0] &lt;i&gt;... your switches ...&lt;/i&gt; -lTurboC -lm -lncurses -L/usr/X11R6/lib -lX11 -lpthread   &lt;/span&gt;&lt;blockquote&gt;&lt;span style="font-size:85%;"&gt;or&lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-size:85%;"&gt; gcc -DDoNotFixIntegers &lt;/span&gt;&lt;span style="font-size:85%;"&gt;... &lt;i&gt;your switches &lt;/i&gt;... -lTurboCu -lm -lncurses -L/usr/X11R6/lib -lX11 -lpthread&lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: trebuchet ms;"&gt; In FreeBSD, you'll have to say "-lc_r" rather than "-lpthread".  Note that the actual directories containing header files and libraries of the X-window system may vary, so you may need to alter the "-L" switch or add a "-I" switch to access the appropriate X files. &lt;/span&gt;&lt;/span&gt;&lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;The command-line switch "-DDoNotFixIntegers" is optionally used to turn off TurboC's &lt;a href="http://www.sandroid.org/TurboC/functionlist.html#Integers"&gt;integer datatype conversion macros&lt;/a&gt; and (as you may notice) uses a slightly different version of the library.  In the past, some GNU "functions" actually implemented as macros have failed to compile with optimization level higher than -O0, when integer datatype conversion is turned on.  That's why one of the examples includes -O0 and the other does not.  However, this precaution is probably no longer necessary, and you needn't use -O0 unless experiencing problems. &lt;/span&gt;&lt;/p&gt; &lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;You can see samples of both types of compilation in the provided Makefile.  If there are complaints from the compiler, refer to the &lt;a href="http://www.sandroid.org/TurboC/functionlist.html#Trouble"&gt;trouble-shooting&lt;/a&gt; section below. &lt;/span&gt;&lt;/p&gt; &lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;The switch "-lm" is required by only a couple of functions, but there's no harm in using it for everything.  The switch "-lncurses" is needed only if you are using the Turbo C functions prototyped in conio.h, while the switches "-L/usr/X11R6/lib -lX11 -lpthread" are needed only if using the functions prototyped in graphics.h.  You'll want to remove these switches if they're not used, to enhance your ability to compile the ported program on more platforms.  For example, neither &lt;b&gt;ncurses&lt;/b&gt; nor &lt;b&gt;Xlib&lt;/b&gt; are typically present in a Mac OS X system (though they can be installed with some effort), and compilation of your ported program will therefore typically fail if these compiler switches are included. &lt;/span&gt;&lt;/p&gt; &lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;Although I'm not entirely sure why you'd want to do it, and though I haven't tried it myself, I think you can probably disable the graphics.h functions in the TurboC library, and replace them with those in the &lt;a href="http://www.gnu.de/software/GRX/grx244um.htm#bgi"&gt;GRX 2D&lt;/a&gt; graphics library.  In the TurboC library Makefile, remove the compiler switch "-DWITH_X" before compiling the TurboC library.  Then install &lt;b&gt;GRX&lt;/b&gt; and follow the instructions in &lt;b&gt;GRX&lt;/b&gt;'s readme.bgi file.  I'd be happy to hear from anyone with &lt;a href="mailto:info@sandroid.org"&gt;feedback&lt;/a&gt;&lt;/span&gt; (pro/con/howto) on this topic, and will post those comments if they seem to be of general interest. &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8745444058210106238-4539969716431832458?l=kooldeezel.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kooldeezel.blogspot.com/feeds/4539969716431832458/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8745444058210106238&amp;postID=4539969716431832458' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default/4539969716431832458'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default/4539969716431832458'/><link rel='alternate' type='text/html' href='http://kooldeezel.blogspot.com/2007/11/using-turbo-c.html' title='Using Turbo C'/><author><name>KoOL</name><uri>http://www.blogger.com/profile/16392700484307461888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8745444058210106238.post-4406961097111307959</id><published>2007-11-29T17:50:00.000-08:00</published><updated>2007-11-29T17:52:08.581-08:00</updated><title type='text'>Turbo C</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: trebuchet ms;"&gt;No explanation of the exact functionality of the various TurboC library elements is offered here, except for noting differences between Borland's version and my version.  As Pablo Vidal points out on his &lt;/span&gt;&lt;b style="font-family: trebuchet ms;"&gt;UConio&lt;/b&gt;&lt;span style="font-family: trebuchet ms;"&gt; web page, if you don't know how to use these functions already, then you won't need the TurboC library, since you shouldn't be using it for new program development anyway.  Consult Borland's &lt;/span&gt;&lt;i style="font-family: trebuchet ms;"&gt;Turbo C Reference Guide&lt;/i&gt;&lt;span style="font-family: trebuchet ms;"&gt; as needed.   &lt;/span&gt;&lt;/span&gt;&lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;But if you are porting or supporting a Turbo C program that somebody else has created, and don't have access to Borland's printed materials yourself, I'd offer the following advice:  Download the &lt;i&gt;free&lt;/i&gt; Turbo C development environment that Borland has kindly provided on their &lt;a href="http://community.borland.com/museum/"&gt;"museum" website&lt;/a&gt;.    (Requires you to register, but registering is free.)  The IDE has context-sensitive help, and you can find out what most functions do by typing the name of the thing (such as clrscr)  into the source-code editor and then hitting ctrl-F1.  Of course, this requires you to have some means of running an MS-DOS program. &lt;/span&gt;&lt;/p&gt;   &lt;p style="font-family: trebuchet ms;"&gt;&lt;span style="font-size:85%;"&gt;Alternately, the online help for Borland's C++Builder program actually provides much fuller documentation of Turbo C library functions (even though it doesn't support a lot of them), and while C++Builder itself is not free, Borland allows you to download the Win32-based helpfile for free from their &lt;a href="ftp://ftp.borland.com/pub/bcppbuilder/techpubs/bcb5/b5rtl.zip"&gt;website&lt;/a&gt; .   After you download it, the particular helpfile you want is the one which Borland calls the &lt;i&gt;DOS Reference&lt;/i&gt;.  Sadly, there's no &lt;i&gt;guarantee&lt;/i&gt; that this documentation corresponds exactly to the functionality provided in Turbo C.&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8745444058210106238-4406961097111307959?l=kooldeezel.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kooldeezel.blogspot.com/feeds/4406961097111307959/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8745444058210106238&amp;postID=4406961097111307959' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default/4406961097111307959'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8745444058210106238/posts/default/4406961097111307959'/><link rel='alternate' type='text/html' href='http://kooldeezel.blogspot.com/2007/11/turbo-c.html' title='Turbo C'/><author><name>KoOL</name><uri>http://www.blogger.com/profile/16392700484307461888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
