1
0

ns-eel.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. Nullsoft Expression Evaluator Library (NS-EEL)
  3. Copyright (C) 1999-2003 Nullsoft, Inc.
  4. ns-eel.h: main application interface header
  5. This software is provided 'as-is', without any express or implied
  6. warranty. In no event will the authors be held liable for any damages
  7. arising from the use of this software.
  8. Permission is granted to anyone to use this software for any purpose,
  9. including commercial applications, and to alter it and redistribute it
  10. freely, subject to the following restrictions:
  11. 1. The origin of this software must not be misrepresented; you must not
  12. claim that you wrote the original software. If you use this software
  13. in a product, an acknowledgment in the product documentation would be
  14. appreciated but is not required.
  15. 2. Altered source versions must be plainly marked as such, and must not be
  16. misrepresented as being the original software.
  17. 3. This notice may not be removed or altered from any source distribution.
  18. */
  19. #ifndef __NS_EEL_H__
  20. #define __NS_EEL_H__
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. int NSEEL_init(); // returns 0 on success
  25. #define NSEEL_addfunction(name,nparms,code,len) NSEEL_addfunctionex((name),(nparms),(code),(len),0)
  26. void NSEEL_addfunctionex(char *name, int nparms, int code_startaddr, int code_len, void *pproc);
  27. void NSEEL_quit();
  28. int *NSEEL_getstats(); // returns a pointer to 5 ints... source bytes, static code bytes, call code bytes, data bytes, number of code handles
  29. double *NSEEL_getglobalregs();
  30. typedef void *NSEEL_VMCTX;
  31. typedef void *NSEEL_CODEHANDLE;
  32. NSEEL_VMCTX NSEEL_VM_alloc(); // return a handle
  33. void NSEEL_VM_free(NSEEL_VMCTX ctx); // free when done with a VM and ALL of its code have been freed, as well
  34. void NSEEL_VM_resetvars(NSEEL_VMCTX ctx);
  35. double *NSEEL_VM_regvar(NSEEL_VMCTX ctx, char *name);
  36. NSEEL_CODEHANDLE NSEEL_code_compile(NSEEL_VMCTX ctx, char *code);
  37. char *NSEEL_code_getcodeerror(NSEEL_VMCTX ctx);
  38. void NSEEL_code_execute(NSEEL_CODEHANDLE code);
  39. void NSEEL_code_free(NSEEL_CODEHANDLE code);
  40. int *NSEEL_code_getstats(NSEEL_CODEHANDLE code); // 4 ints...source bytes, static code bytes, call code bytes, data bytes
  41. // configuration:
  42. //#define NSEEL_REENTRANT_EXECUTION
  43. // defining this allows code to run in different threads at the same time
  44. // this can be slower at times.
  45. //#define NSEEL_MAX_VARIABLE_NAMELEN 8
  46. // define this to override the max variable length (default is 8 bytes)
  47. //#define NSEEL_MAX_TEMPSPACE_ENTRIES 2048
  48. // define this to override the maximum working space in 8 byte units.
  49. // 2048 is the default, and is way more than enough for most applications
  50. //#define NSEEL_LOOPFUNC_SUPPORT
  51. //#define NSEEL_LOOPFUNC_SUPPORT_MAXLEN (4096)
  52. // define this for loop() support
  53. // and define maxlen if you wish to override the maximum loop length (default is 4096 times)
  54. #ifdef __cplusplus
  55. }
  56. #endif
  57. #endif//__NS_EEL_H__