home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / progmisc / nfsrc21.zip / DBTHANDL.ASM < prev    next >
Assembly Source File  |  1992-10-16  |  3KB  |  93 lines

  1. ; File......: DBTHANDL.ASM
  2. ; Author....: Ted Means
  3. ; Date......: $Date:   15 Oct 1992 23:55:54  $
  4. ; Revision..: $Revision:   1.0  $
  5. ; Log file..: $Logfile:   C:/nanfor/src/dbthandl.asv  $
  6. ; This is an original work by Ted Means and is placed in the
  7. ; public domain.
  8. ;
  9. ; Modification history:
  10. ; ---------------------
  11. ;
  12. ; $Log:   C:/nanfor/src/dbthandl.asv  $
  13. ;  
  14. ;     Rev 1.0   15 Oct 1992 23:55:54   GLENN
  15. ;  Initial revision.
  16. ;  
  17.  
  18. ; $DOC$
  19. ; $FUNCNAME$
  20. ;     FT_DBTHand()
  21. ; $CATEGORY$
  22. ;     Database
  23. ; $ONELINER$
  24. ;     Obtain the handle associated with an open .DBT file.
  25. ; $SYNTAX$
  26. ;     FT_DBTHand() -> nHandle
  27. ; $ARGUMENTS$
  28. ;     None
  29. ; $RETURNS$
  30. ;    The file handle, or zero if no .DBT is open in the specified
  31. ;    work area.
  32. ; $DESCRIPTION$
  33. ;    For your own twisted reasons you may need make direct use of the
  34. ;    file handle associated with a memo field file.  This function gives you
  35. ;    that capability, but use it with care and don't blame me if you
  36. ;    botch something up.
  37. ;
  38. ;    By default this function works on the current work area, but can be
  39. ;    made to work on any work area through the use of the standard Clipper
  40. ;    alias operator.
  41. ;
  42. ;    Be aware that this function makes use of Clipper's internal work
  43. ;    area information which is subject to change in future versions of
  44. ;    Clipper.  If this makes you uncomfortable then don't use this function,
  45. ;    you spineless jellyfish.
  46. ;
  47. ;    This function is written to adhere to Turbo Assembler's IDEAL mode.
  48. ;    To use another assembler, rearrange the SEGMENT and PROC directives
  49. ;    and make any other necessary changes to the source code.
  50. ;
  51. ; $EXAMPLES$
  52. ;      QOut( FT_DBTHand() )
  53. ;
  54. ;      // Try a non-current work area
  55. ;
  56. ;      nHandle := THISFILE->( FT_DBTHand() )
  57. ;
  58. ;      // This will return zero if no database is open in work area 133
  59. ;
  60. ;      select 133
  61. ;      QOut( FT_DBTHand() )
  62. ;
  63. ; $END$
  64.  
  65. IDEAL                                        ; Invoke TASM IDEAL mode
  66.  
  67. Public   FT_DBTHand
  68.  
  69. Extrn    __WorkAreas:DWord                   ; INTERNAL!!!
  70. Extrn    __RetNI:Far
  71.  
  72. Segment  _NanFor   Word      Public    "CODE"
  73.          Assume    CS:_NanFor
  74.  
  75. Proc     FT_DBTHand          Far
  76.  
  77.          LES       BX,[__WorkAreas]          ; Load pointer to work areas
  78.          Mov       AX,[Word Ptr ES:BX]       ; Check to see if work area
  79.          Or        AX,[Word Ptr ES:BX + 2]   ; is in use
  80.          JZ        @@Done                    ; If not, return zero
  81.          LES       BX,[DWord Ptr ES:BX]      ; Load work area pointer
  82.          Mov       AX,[Word Ptr ES:BX + 6Eh] ; Load handle
  83.  
  84. @@Done:  Push      AX                        ; Put return value on stack
  85.          Call      __RetNI                   ; Return it
  86.          Add       SP,2                      ; Realign stack
  87.          Ret
  88. Endp     FT_DBTHand
  89. Ends     _NanFor
  90. End
  91.  
  92.