home *** CD-ROM | disk | FTP | other *** search
/ Netrunner 2004 October / NETRUNNER0410.ISO / regular / ActivePerl-5.8.4.810-MSWin32-x86.msi / _12ff3364609b1abaef2322b32ebd5433 < prev    next >
Text File  |  2004-06-01  |  10KB  |  281 lines

  1. //
  2. //  PerlEz.h
  3. //
  4. //  Copyright (c) 1998-2003 ActiveState Corp.  All rights reserved. 
  5. //
  6.  
  7.  
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11.  
  12. DECLARE_HANDLE(PERLEZHANDLE);
  13.  
  14. enum
  15. {
  16.     plezNoError = 0,        // success
  17.     plezMoreSpace,        // more space need to return result
  18.     plezError,            // returned error string in buffer
  19.     plezErrorMoreSpace,        // more space need to return error message
  20.     plezErrorBadFormat,        // format string is invalid
  21.     plezException,        // function call caused an exception
  22.     plezInvalidHandle,        // hHandle was invalid
  23.     plezCallbackAlreadySet,    // second call to PerlEzSetMagicFunction fails
  24.     plezInvalidParams,        // invalid parameter was passed to a routine
  25.     plezOutOfMemory,        // cannot allocate more memory
  26. };
  27.  
  28.  
  29. PERLEZHANDLE APIENTRY PerlEzCreate(LPCSTR lpFileName, LPCSTR lpOptions);
  30. // Description:
  31. //    Creates a Perl interpreter. The return value is required parameter
  32. //    for all subsequent æPerlEzÆ calls.  Multiple interpreters can be created,
  33. //    but only one will be executing at a time.
  34. //    Call PerlEzDelete to release this handle.
  35. //
  36. // Parameters:
  37. //    lpFileName a pointer to a ASCIIZ string that is the name of a file; can be NULL 
  38. //    lpOptions a pointer to a ASCIIZ string that are the command line options that
  39. //        will be provided before the script; can be NULL.
  40. //        This parameter is used for setting @INC or debugging. 
  41. //
  42. // Returns:
  43. //    A non zero handle to a Perl interpreter if successful; zero otherwise.
  44.  
  45.  
  46. PERLEZHANDLE APIENTRY PerlEzCreateOpt(LPCSTR lpFileName, LPCSTR lpOptions, LPCSTR lpScriptOpts);
  47. // Description:
  48. //    Creates a Perl interpreter. The return value is required parameter
  49. //    for all subsequent æPerlEzÆ calls.  Multiple interpreters can be created,
  50. //    but only one will be executing at a time.
  51. //    Call PerlEzDelete to release this handle.
  52. //
  53. // Parameters:
  54. //    lpFileName a pointer to a ASCIIZ string that is the name of a file; can not be NULL 
  55. //    lpOptions a pointer to a ASCIIZ string that are the command line options that
  56. //        will be provided before the script; can be NULL.
  57. //        This parameter is used for setting @INC or debugging. 
  58. //    lpScriptOpts a pointer to a ASCIIZ string that are the command line options to be
  59. //        passed to the script.
  60. //
  61. // Returns:
  62. //    A non zero handle to a Perl interpreter if successful; zero otherwise.
  63.  
  64.  
  65. BOOL APIENTRY PerlEzDelete(PERLEZHANDLE hHandle);
  66. // Description:
  67. //    Deletes a previously created Perl interpreter.
  68. //    Releases all resources allocated by PerlEzCreate.
  69. //
  70. // Parameters:
  71. //    hHandle    a handle returned by the call to PerlEzCreate
  72. //
  73. // Returns:
  74. //    True if no error false otherwise.
  75.  
  76.  
  77. int APIENTRY PerlEzEvalString(PERLEZHANDLE hHandle, LPCSTR lpString, LPSTR lpBuffer, DWORD dwBufSize);
  78. // Description:
  79. //    Evaluates the string a returns the result in lpBuffer.
  80. //    If there is an error $! is returned in lpBuffer.
  81. //
  82. // Parameters:
  83. //    hHandle    a handle returned by the call to PerlEzCreate
  84. //    lpString a pointer to the ASCIIZ string to evaluate
  85. //    lpBuffer a pointer to the buffer where the result will be placed
  86. //    dwBufSize the size in bytes of the space where lpBuffer points
  87. //
  88. // Returns:
  89. //    A zero if no error; otherwise error code.
  90. //
  91. // Possible Error returns
  92. //    plezException
  93. //    plezInvalidHandle
  94. //    plezErrorMoreSpace
  95.  
  96.  
  97. int APIENTRY PerlEzCall1(PERLEZHANDLE hHandle, LPCSTR lpFunction, LPSTR lpBuffer, DWORD dwBufSize, LPCSTR lpFormat, LPVOID lpVoid);
  98. // Description:
  99. //    Calls the function lpFunction and returns the result in the buffer lpBuffer.
  100. //
  101. // Parameters:
  102. //    hHandle    a handle returned by the call to PerlEzCreate
  103. //    lpFunction a pointer name of the function to call
  104. //    lpBuffer a pointer to the buffer where the result will be placed
  105. //    dwBufSize the size in bytes of the space where lpBuffer points
  106. //    lpFormat a pointer to the parameter specifier; can be NULL.
  107. //    lpVoid a pointer to a parameter will be interpreted based on lpFormat
  108. //
  109. // Returns:
  110. //    A zero if no error; otherwise error code.
  111. //
  112. // Possible Error returns
  113. //    plezException
  114. //    plezInvalidHandle
  115. //    plezErrorMoreSpace
  116. //    plezErrorBadFormat
  117.  
  118.  
  119. int APIENTRY PerlEzCall2(PERLEZHANDLE hHandle, LPCSTR lpFunction, LPSTR lpBuffer, DWORD dwBufSize,
  120.                     LPCSTR lpFormat, LPVOID lpVoid1, LPVOID lpVoid2);
  121. // Description:
  122. //    Calls the function lpFunction and returns the result in the buffer lpBuffer.
  123. //
  124. // Parameters:
  125. //    hHandle    a handle returned by the call to PerlEzCreate
  126. //    lpFunction a pointer name of the function to call
  127. //    lpBuffer a pointer to the buffer where the result will be placed
  128. //    dwBufSize the size in bytes of the space where lpBuffer points
  129. //    lpFormat a pointer to the parameter specifier; can be NULL.
  130. //    lpVoid1...2 pointers to parameters that will be interpreted based on lpFormat
  131. //
  132. // Returns:
  133. //    A zero if no error; otherwise error code.
  134. //
  135. // Possible Error returns
  136. //    plezException
  137. //    plezInvalidHandle
  138. //    plezErrorMoreSpace
  139. //    plezErrorBadFormat
  140.  
  141.  
  142. int APIENTRY PerlEzCall4(PERLEZHANDLE hHandle, LPCSTR lpFunction, LPSTR lpBuffer, DWORD dwBufSize,
  143.                 LPCSTR lpFormat, LPVOID lpVoid1, LPVOID lpVoid2, LPVOID lpVoid3, LPVOID lpVoid4);
  144. // Description:
  145. //    Calls the function lpFunction and returns the result in the buffer lpBuffer.
  146. //
  147. // Parameters:
  148. //    hHandle    a handle returned by the call to PerlEzCreate
  149. //    lpFunction a pointer name of the function to call
  150. //    lpBuffer a pointer to the buffer where the result will be placed
  151. //    dwBufSize the size in bytes of the space where lpBuffer points
  152. //    lpFormat a pointer to the parameter specifier; can be NULL.
  153. //    lpVoid1...4 pointers to parameters that will be interpreted based on lpFormat
  154. //
  155. // Returns:
  156. //    A zero if no error; otherwise error code.
  157. //
  158. // Possible Error returns
  159. //    plezException
  160. //    plezInvalidHandle
  161. //    plezErrorMoreSpace
  162. //    plezErrorBadFormat
  163.  
  164.  
  165. int APIENTRY PerlEzCall8(PERLEZHANDLE hHandle, LPCSTR lpFunction, LPSTR lpBuffer, DWORD dwBufSize,
  166.                 LPCSTR lpFormat, LPVOID lpVoid1, LPVOID lpVoid2, LPVOID lpVoid3, LPVOID lpVoid4,
  167.                 LPVOID lpVoid5, LPVOID lpVoid6, LPVOID lpVoid7, LPVOID lpVoid8);
  168. // Description:
  169. //    Calls the function lpFunction and returns the result in the buffer lpBuffer.
  170. //
  171. // Parameters:
  172. //    hHandle    a handle returned by the call to PerlEzCreate
  173. //    lpFunction a pointer name of the function to call
  174. //    lpBuffer a pointer to the buffer where the result will be placed
  175. //    dwBufSize the size in bytes of the space where lpBuffer points
  176. //    lpFormat a pointer to the parameter specifier; can be NULL.
  177. //    lpVoid1...8 pointers to parameters that will be interpreted based on lpFormat
  178. //
  179. // Returns:
  180. //    A zero if no error; otherwise error code.
  181. //
  182. // Possible Error returns
  183. //    plezException
  184. //    plezInvalidHandle
  185. //    plezErrorMoreSpace
  186. //    plezErrorBadFormat
  187.  
  188.  
  189. int APIENTRY PerlEzCall(PERLEZHANDLE hHandle, LPCSTR lpFunction, LPSTR lpBuffer, DWORD dwBufSize, LPCSTR lpFormat, ...);
  190. // Description:
  191. //    Calls the function lpFunction and returns the result in the buffer lpBuffer.
  192. //
  193. // Parameters:
  194. //    hHandle a handle returned by the call to PerlEzCreate
  195. //    lpFunction a pointer name of the function to call
  196. //    lpBuffer a pointer to the buffer where the result will be placed
  197. //    dwBufSize the size in bytes of the space where lpBuffer points
  198. //    lpFormat a pointer to the parameter specifier; can be NULL.
  199. //    ... parameters to be interpreted based on lpFormat
  200. //
  201. // Returns:
  202. //    A zero if no error; otherwise error code.
  203. //
  204. // Possible Error returns
  205. //    plezException
  206. //    plezInvalidHandle
  207. //    plezErrorMoreSpace
  208. //    plezErrorBadFormat
  209.  
  210.  
  211. int APIENTRY PerlEzCallContext(PERLEZHANDLE hHandle, LPCSTR lpFunction, LPVOID lpContextInfo,
  212.                         LPSTR lpBuffer, DWORD dwBufSize, LPCSTR lpFormat, ...);
  213. // Description:
  214. //    Calls the function lpFunction and returns the result in the buffer lpBuffer.
  215. //
  216. // Parameters:
  217. //    hHandle a handle returned by the call to PerlEzCreate
  218. //    lpFunction a pointer name of the function to call
  219. //    lpContextInfo context info for magic fetch and store functions
  220. //    lpBuffer a pointer to the buffer where the result will be placed
  221. //    dwBufSize the size in bytes of the space where lpBuffer points
  222. //    lpFormat a pointer to the parameter specifier; can be NULL.
  223. //    ... parameters to be interpreted based on lpFormat
  224. //
  225. // Returns:
  226. //    A zero if no error; otherwise error code.
  227. //
  228. // Possible Error returns
  229. //    plezException
  230. //    plezInvalidHandle
  231. //    plezErrorMoreSpace
  232. //    plezErrorBadFormat
  233.  
  234.  
  235. typedef LPCSTR (*LPFETCHVALUEFUNCTION)(LPVOID, LPCSTR);
  236. typedef LPCSTR (*LPSTOREVALUEFUNCTION)(LPVOID, LPCSTR,LPCSTR);
  237.  
  238. int APIENTRY PerlEzSetMagicScalarFunctions(PERLEZHANDLE hHandle, LPFETCHVALUEFUNCTION lpfFetch, LPSTOREVALUEFUNCTION lpfStore);
  239. // Description:
  240. //    Sets the call back function pointers for magic scalar variables.
  241. //
  242. // Parameters:
  243. //    hHandle a handle returned by the call to PerlEzCreate
  244. //    lpfFetch a pointer to the call back function for fetching a string
  245. //        if lpfFetch is NULL, then the scalar is write only
  246. //    lpfStore a pointer to the call back function for storinging a string
  247. //        if lpfStore is NULL, then the scalar is read only
  248. //
  249. //    if lpfFetch and lpfStore are both NULL, then it is an error
  250. //
  251. // Returns:
  252. //    A zero if no error; otherwise error code.
  253. //
  254. // Possible Error returns
  255. //    plezException
  256. //    plezInvalidHandle
  257. //    plezCallbackAlreadySet
  258. //    plezInvalidParams
  259.  
  260.  
  261. int APIENTRY PerlEzSetMagicScalarName(PERLEZHANDLE hHandle, LPCSTR pVariableName);
  262. // Description:
  263. //    Creates the variable if it does not exists and sets it to be tied to
  264. //        the call back function pointer for magic variables.
  265. //
  266. // Parameters:
  267. //    hHandle a handle returned by the call to PerlEzCreate
  268. //    pVariableName a pointer to the name of the variable
  269. //
  270. // Returns:
  271. //    A zero if no error; otherwise error code.
  272. //
  273. // Possible Error returns
  274. //    plezException
  275. //    plezInvalidHandle
  276. //    plezErrorMoreSpace
  277.  
  278. #ifdef __cplusplus
  279. }
  280. #endif
  281.