Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

280 lines
9.8 KiB

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