home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / tcl / tk3.3b1 / porting.notes < prev    next >
Encoding:
Text File  |  1993-06-26  |  5.0 KB  |  154 lines

  1. This file contains a collection of notes that various people have
  2. provided about porting Tk to various machines and operating systems.
  3. I don't have personal access to any of these machines, so I make
  4. no guarantees that the notes are correct, complete, or up-to-date.
  5. I'd be happy to receive corrections or updates.
  6.  
  7. ---------------------------------------------
  8. HP-UX systems:
  9. ---------------------------------------------
  10.  
  11. 1. Configuration:
  12.         HP-UX Release 7.05 on a series 300 (68k) machine.
  13.         The native cc has been used for production.
  14.         X11r4 libraries and include files were taken from
  15.         internet archives, where as the server came with HPUX release 7.05.
  16.     
  17.     Problems:
  18.         Symbol table space for cc had to be increased with: -Wc,-Ns3000
  19.         tkBind.c did not compile under -O:
  20.             C1 internal error in "GetField": Set Error Detected
  21.             *** Error code 1
  22.         tkBind.c did compile without optimization (no -O).
  23.  
  24. ---------------------------------------------
  25. SCO Unix:
  26. ---------------------------------------------
  27.  
  28. Getting Tk to run under SCO Unix:
  29.  
  30. Add a "#undef select" to tkEvent.c, and remove the reference to TK_EXCEPTION
  31. around line 460 of main.c.
  32.  
  33. Tk uses its own scheme for allocating the border colors for its 3D widgets,
  34. which causes problems when running TK on a system with "PseudoColor"
  35. display class, and a 16-cell colormap.
  36.  
  37. If you can't go to eight bitplanes, you can instead start the server with a
  38. "-static" (Xsco) or "-analog" (Xsight) option, making the display class 
  39. become "StaticColor".  This makes the entire colormap read-only, and it will
  40. return the color that most closely maps to the desired color as possible.
  41.  
  42. ---------------------------------------------
  43. Silicon Graphics systems:
  44. ---------------------------------------------
  45.  
  46. 1. Change the CC variable in the Makefile to:
  47.  
  48. CC =        cc -xansi -D__STDC__ -signed
  49.  
  50. 2. Change the LIBS variable in the Makefile to use the X11 shared library
  51. ("-lX11_s" instead of "-lX11"):
  52.  
  53. 3. Under some versions of IRIX (e.g. 4.0.1) you have to turn off
  54.    optimization (e.g.  change "-O" in CFLAGS to "-O0" or remove it
  55.    entirely) because of faulty code generation.  If the Tcl or Tk test
  56.    suites fail, turn off optimization.
  57.  
  58. ---------------------------------------------
  59. AT&T SVR4:
  60. ---------------------------------------------
  61.  
  62. 1. The first major hurdle is that SVR4's select() subtly differs
  63. from BSD select.  This impacts Tk in two ways, some of the Xlib calls
  64. make use of select() and are inherently broken and Tk itself makes
  65. extensive use of select().  The first problem can't be fixed without
  66. rebuilding one's Xlib, but can be avoided.  I intend to submit part
  67. of my work the XFree86 guys so that the next version of XFree86 for
  68. SVR4 will not be broken.  Until then, it is necessary to comment out
  69. this section of code from Tk_DoOneEvent() (which is near line 1227):
  70.  
  71. #if !defined(SVR4)
  72.                     void (*oldHandler)();
  73.  
  74.                     oldHandler = (void (*)()) signal(SIGPIPE, SIG_IGN);
  75.                     XNoOp(display);
  76.                     XFlush(display);
  77.                     (void) signal(SIGPIPE, oldHandler);
  78. #endif /* SVR4 */
  79.  
  80. if you don't comment it out, some scripts cause wish to go into
  81. an infinite loop of sending no-ops to the X server.
  82.  
  83. 2. As for fixing Tk's calls to select(), I've taken the simple
  84. approach of writing a wrapper for select and then using #define to
  85. replace all calls to select with the wrapper.  I chose tkConfig.h
  86. to load the wrapper.  So at the very end of tkConfig.h, it now looks
  87. like:
  88.  
  89. #if defined(SVR4)
  90. #  include "BSDselect.h"
  91. #endif 
  92.  
  93. #endif /* _TKCONFIG */
  94.  
  95. The file BSDselect.h looks like this:
  96.  
  97. #include <sys/types.h>
  98. #include <sys/time.h>
  99. #include <sys/select.h>
  100.  
  101. /*  This is a fix for the difference between BSD's select() and
  102.  *  SVR4's select().  SVR4's select() can never return a value larger
  103.  *  than the total number of file descriptors being checked.  So, if
  104.  *  you select for read and write on one file descriptor, and both
  105.  *  are true, SVR4 select() will only return 1.  BSD select in the
  106.  *  same situation will return 2.
  107.  *
  108.  *    Additionally, BSD select() on timing out, will zero the masks,
  109.  *    while SVR4 does not.  This is fixed here as well.
  110.  *
  111.  *    Set your tabstops to 4 characters to have this code nicely formatted.
  112.  *
  113.  *    Jerry Whelan, guru@bradley.edu, June 12th, 1993
  114.  */
  115.  
  116.  
  117. int
  118. BSDselect(nfds, readfds, writefds, exceptfds, timeout)
  119. int nfds;
  120. fd_set *readfds, *writefds, *exceptfds;
  121. struct timeval *timeout;
  122. {
  123.     int        rval,
  124.             i;
  125.  
  126.     rval = select(nfds, readfds, writefds, exceptfds, timeout);
  127.  
  128.     switch(rval) {
  129.         case -1:    return(rval);
  130.                     break;
  131.  
  132.         case 0:        if(readfds != NULL)
  133.                         FD_ZERO(readfds);
  134.                     if(writefds != NULL)
  135.                         FD_ZERO(writefds);
  136.                     if(exceptfds != NULL)
  137.                         FD_ZERO(exceptfds);
  138.  
  139.                     return(rval);
  140.                     break;
  141.  
  142.         default:    for(i=0, rval=0; i < nfds; i++) {
  143.                         if((readfds != NULL) && FD_ISSET
  144. (i, readfds)) rval++;
  145.                         if((writefds != NULL) && FD_ISSE
  146. T(i, writefds)) rval++;
  147.                         if((writefds != NULL) && FD_ISSE
  148. T(i, exceptfds)) rval++;
  149.                     }
  150.                     return(rval);
  151.         }
  152. /* Should never get here */
  153. }
  154.