home *** CD-ROM | disk | FTP | other *** search
/ ftp.alaska-software.com / 2014.06.ftp.alaska-software.com.tar / ftp.alaska-software.com / acsn / bapread.me < prev    next >
Text File  |  2001-03-28  |  5KB  |  146 lines

  1. The Binary Access Package for Xbase++ 
  2. =====================================
  3. Version 1.5        03/29/2001
  4.  
  5. Author: Gernot Trautmann
  6.  
  7. Provides functions to make any DllCall or C-API function call which
  8. requires structures possible.
  9.  
  10. Available function groups:
  11.  
  12. 1. To create and extract structures:
  13. ------------------------------------
  14. Theses functions are used to setup structures which can be manipulated
  15. by non-Xbase++ functions. The structures may conatin pointers to
  16. character buffers or even to other structures. It is necessary to
  17. call BaInit(), BaStruct() and BaExtract() even if the return values
  18. are not of any interest.
  19.  
  20.  
  21. aBin := BaInit(nSize)
  22.         =======
  23.     Creates the array aBin and prepares to hold nSize structure
  24.     members. Never touch the array.
  25.     
  26. lRet := BaStruct(aBin, [@]xValue)
  27.         ======
  28.     Adds one value to the structure. Available types:
  29.     BOOL, NUMERIC, CHARACTER; per value or per reference.
  30.     The creation order is the order of the members in the structure.
  31.     Values passed by reference will be locked.
  32.     If lret is .F., a failure with xValue occured. You should
  33.     do sufficient calls to BaExtract() to unlock all locked values.
  34.  
  35. cBin := BaAccess(aBin)    
  36.         =========
  37.     Now use cBin to pass the binary structure to the external function. 
  38.     If you pass it by reference, you may get updated values after 
  39.         extracting and therefore you must pass cBin back to BaExtract 
  40.         as its second parameter before.
  41.  
  42. xVal := BaExtract(aBin [, cBin] )
  43.     ==========
  44.     Extracts one value from the structure. You have to call
  45.     it in the same order as the BaAdd-calls are placed.
  46.     Values passed by reference will be unlocked.
  47.         If you pass cBin, this value is used in all subsequent calls
  48.         to extract from.
  49.         After extracting all members you can free the array (aBin := NIL)
  50.         or reuse it by using BaInit.
  51.  
  52.  
  53. 2. To cast return values:
  54. -------------------------
  55. These functions are used to interprete return values of DllCall()'s, 
  56. since DllCall() returns only numeric values.
  57.  
  58. cVal := StringOf(nVal,[nLength])
  59.     ========
  60.     If an external call returns a pointer to a character and this 
  61.     piece of memory is still available, you may use this function
  62.     to create an Xbase++-character with the value where nVal 
  63.     points to. If no nLength is given, the buffer is copied up to
  64.         the first 0-character.
  65.  
  66. nVal :=    WordOf(nVal)
  67.     ======
  68.     Corrects bits if an external call returns 16bit values to an
  69.     Xbase++ numerical.
  70.  
  71. nVal :=    ByteOf(nVal)
  72.     ======
  73.     Corrects bits if an external call returns 8bit values to an
  74.     Xbase++ numerical.
  75.     
  76.  
  77. lVal := LogicOf(nVal)
  78.     =======
  79.     Converts a numeric to a logic value. The value 0 means .F.,
  80.         others mean .T.
  81.  
  82.  
  83. 3. To extract values from binary (structered) buffers:
  84. ------------------------------------------------------
  85. These functions are used to handle structures returned as a return
  86. value or to extract values out of a structured buffer which was not
  87. created using BaStruct().
  88.  
  89.  
  90. cVal := BaExValue( cStruct, nPlace, nLength)
  91.         =========
  92.         Cut out a piece of the structure buffer. If the buffer
  93.         was returned by a previous DllCall(), you must call
  94.         cStruct := StringOf(nRet) prior to executing this function.
  95.  
  96.  
  97. nAdr := BaExPointer( cStruct, nPlace)
  98.     ===========
  99.     Extract a pointer out of a structure buffer. It does the
  100.         same as BaExValue(), but also converts the value to a
  101.         numeric using Bin2U().
  102.  
  103.  
  104. nAdr := BaDereference( nAddr)
  105.     =============
  106.     Interpretes nAddr as a pointer to a pointer, and returns
  107.         the numeric value of the dereferenced pointer.
  108.         C declaration: char **ptr.
  109.  
  110.  
  111. nCnt := BaEvalPtrArray( cStruct, nPlace, cbEval)
  112.     ==============
  113.     Interpretes cStruct.nPlace as an array of pointers, dereferences
  114.         the pointer and calls Eval( cbEval, nDerefPtr). The termination
  115.         is done by a NULL pointer inside of the array.
  116.     Returns number of Evals().
  117.  
  118.  
  119. 4. To create a callback function
  120. --------------------------------
  121. A callback function is called back while an API is under execution.
  122. Currently, these types of callbacks are supported:
  123.  
  124. BA_CB_LPOFNHOOKPROC    - callback of Win32-API GetOpenFileName
  125. BA_CB_ADDZIP            - callback of AddZip
  126. BA_CB_GENERIC1          - Generic callbacks: The number designates
  127. BA_CB_GENERIC2            the number of passed parameters, all of
  128. BA_CB_GENERIC3            type NUMERIC, return value is NUMERIC.
  129. BA_CB_GENERIC4            To adapt a generic callback, the Xbase++
  130.                           passed to BaCallBack() must interprete the
  131.                           parameters by itself, and may call a specialized
  132.                           function. To interprete a parameter means to
  133.                           cast to other types, like calling StringOf(par2)
  134.                           to interprete the passed NUMERIC as an address
  135.                           to a character.
  136.      
  137. nAdr := BaCallback( <cFuncName>, <nCallbackType>)
  138.         =========
  139.         The <cFuncName> is set as the current callback, which can
  140.         only be one per thread.
  141.         To disable/reset the callback, pass and empty string.
  142.         The <nCallbackType> can be one of the BA_CB_xx - values 
  143.         defined in bap.ch.
  144.         The return value is the address of the callback function
  145.         which can be passed to the API which requires a callback
  146.         function.