home *** CD-ROM | disk | FTP | other *** search
/ Power CD-ROM!! 7 / POWERCD7.ISO / prgmming / clipper / gt_off.c < prev    next >
C/C++ Source or Header  |  1993-10-14  |  2KB  |  72 lines

  1. /*
  2.  * GT CLIPPER STANDARD HEADER
  3.  *
  4.  * File......: gt_off.c
  5.  * Author....: Brian Dukes
  6.  * BBS.......: THE CELLAR bbs
  7.  * Net/Node..: 013/203
  8.  * User Name.: Brian Dukes
  9.  * Date......: 10/5/93
  10.  * Revision..: 1.0
  11.  *
  12.  * This is an original work by Brian Dukes and is placed in the
  13.  * public domain.
  14.  *
  15.  * Modification history:
  16.  * ---------------------
  17.  *
  18.  * $Log$
  19.  *
  20.  */
  21.  
  22. /*
  23.  *  $DOC$
  24.  *  $FUNCNAME$
  25.  *      GT_OFFSET()
  26.  *  $CATEGORY$
  27.  *      String
  28.  *  $ONELINER$
  29.  *      Returns the offset of the passed character string
  30.  *  $SYNTAX$
  31.  *      GT_Offset(<str>) --> nOffset
  32.  *  $ARGUMENTS$
  33.  *      <str>     - Character String
  34.  *  $RETURNS$
  35.  *      nOffset   - The offset of <str>.
  36.  *  $DESCRIPTION$
  37.  *      This function will become invaluable when calling GT_Int86()
  38.  *      functions, as some of these functions will need to know the address
  39.  *      of strings that are passed in.
  40.  *
  41.  *  $EXAMPLES$
  42.  *      ? GT_Offset(str)
  43.  *
  44.  *  $SEEALSO$
  45.  *      GT_SEGMENT()   SYSTEM.EHO:GT_INT86()
  46.  *  $END$
  47.  */
  48.  
  49. /**** Compiled in MS/C v6.0  as  CL /AL /Gs /Zl -c gt_off.c        ****/
  50.  
  51. #include <extend.h>
  52.  
  53. /* FP_OFF Ripped out of DOS.H - No need to include all the other junk from it */
  54. #define FP_OFF(fp) (*((unsigned _far *)&(fp)))
  55.  
  56.  
  57. CLIPPER gt_offset()
  58. {
  59.    unsigned offset = 0 ;
  60.    char far * ptr ;
  61.  
  62.    if (_parinfo(1) == CHARACTER)
  63.       {
  64.          ptr = _parc(1) ;
  65.          offset = FP_OFF(ptr) ;
  66.       }
  67.  
  68.    _retni(offset) ;
  69. }
  70.  
  71. /**** end of function ****/
  72.