home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / CLIPPER / NFORX11 / POKE.C < prev   
C/C++ Source or Header  |  1993-08-17  |  2KB  |  64 lines

  1. /*
  2.  * File......: POKE.C
  3.  * Author....: Ted Means
  4.  * Date......: $Date:   17 Aug 1993 19:42:24  $
  5.  * Revision..: $Revision:   1.1  $
  6.  * Log file..: $Logfile:   C:/nanfor/src/exo/poke.c_v  $
  7.  * 
  8.  * This is an original work by Ted Means and is placed in the
  9.  * public domain.
  10.  *
  11.  * Modification history:
  12.  * ---------------------
  13.  *
  14.  * $Log:   C:/nanfor/src/exo/poke.c_v  $
  15.  * 
  16.  *    Rev 1.1   17 Aug 1993 19:42:24   GLENN
  17.  * Dieter Smode [CIS ID: 100034,243] noticed that the function creates a
  18.  * protected mode pointer but does not release the selector from the
  19.  * descriptor table.  Due to successive calls to FT_POKE(), the descriptor
  20.  * table would overflow.  Fixed.
  21.  * 
  22.  * 
  23.  *    Rev 1.0   15 Jul 1993 22:46:50   GLENN
  24.  * Initial revision.
  25.  *
  26.  */
  27.  
  28. /* Librarian's note:
  29.  *
  30.  * This source code is for a special version of ft_poke(), compatible
  31.  * with the ExoSpace (tm) DOS Extender from SofDesign, International.
  32.  * It is ExoSpace-specific and is maintained separately from the real
  33.  * mode version.
  34.  *
  35.  * The documentation can be found in the real-mode POKE.C as
  36.  * distributed with the regular Nanforum Toolkit.
  37.  *
  38.  */ 
  39.  
  40.  
  41. #include "extend.h"
  42.  
  43. void *      ExoProtectedPtr(void *rmptr, unsigned int sizebytes);
  44. int         ExoFreeSelector(unsigned int);
  45.  
  46. CLIPPER FT_POKE(void)
  47. {
  48.    auto unsigned char * byteptr;
  49.    auto unsigned char * pmptr;
  50.  
  51.    if ( (PCOUNT >= 3) && (ISNUM(1)) && (ISNUM(2)) && (ISNUM(3)) )
  52.    {
  53.       * ((unsigned int *) &byteptr)     = _parni(2);
  54.       * ((unsigned int *) &byteptr + 1) = _parni(1);
  55.       pmptr = ExoProtectedPtr(byteptr, 8);
  56.       *pmptr = ((unsigned char) _parni(3));
  57.     _retl( TRUE );
  58.     ExoFreeSelector(* ((unsigned int *) &pmptr + 1));
  59.    }
  60.    else
  61.       _retl( FALSE );
  62.    return;
  63. }
  64.