compiler.rst 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. .. _api_ref_compiler:
  2. ========
  3. Compiler
  4. ========
  5. .. _sq_compile:
  6. .. c:function:: SQRESULT sq_compile(HSQUIRRELVM v, HSQLEXREADFUNC read, SQUserPointer p, const SQChar * sourcename, SQBool raiseerror)
  7. :param HSQUIRRELVM v: the target VM
  8. :param HSQLEXREADFUNC read: a pointer to a read function that will feed the compiler with the program.
  9. :param SQUserPointer p: a user defined pointer that will be passed by the compiler to the read function at each invocation.
  10. :param const SQChar * sourcename: the symbolic name of the program (used only for more meaningful runtime errors)
  11. :param SQBool raiseerror: if this value is true the compiler error handler will be called in case of an error
  12. :returns: a SQRESULT. If the sq_compile fails nothing is pushed in the stack.
  13. :remarks: in case of an error the function will call the function set by sq_setcompilererrorhandler().
  14. compiles a squirrel program; if it succeeds, push the compiled script as function in the stack.
  15. .. _sq_compilebuffer:
  16. .. c:function:: SQRESULT sq_compilebuffer(HSQUIRRELVM v, const SQChar* s, SQInteger size, const SQChar * sourcename, SQBool raiseerror)
  17. :param HSQUIRRELVM v: the target VM
  18. :param const SQChar* s: a pointer to the buffer that has to be compiled.
  19. :param SQInteger size: size in characters of the buffer passed in the parameter 's'.
  20. :param const SQChar * sourcename: the symbolic name of the program (used only for more meaningful runtime errors)
  21. :param SQBool raiseerror: if this value true the compiler error handler will be called in case of an error
  22. :returns: a SQRESULT. If the sq_compilebuffer fails nothing is pushed in the stack.
  23. :remarks: in case of an error the function will call the function set by sq_setcompilererrorhandler().
  24. compiles a squirrel program from a memory buffer; if it succeeds, push the compiled script as function in the stack.
  25. .. _sq_enabledebuginfo:
  26. .. c:function:: void sq_enabledebuginfo(HSQUIRRELVM v, SQBool enable)
  27. :param HSQUIRRELVM v: the target VM
  28. :param SQBool enable: if true enables the debug info generation, if == 0 disables it.
  29. :remarks: The function affects all threads as well.
  30. enable/disable the debug line information generation at compile time.
  31. .. _sq_notifyallexceptions:
  32. .. c:function:: void sq_notifyallexceptions(HSQUIRRELVM v, SQBool enable)
  33. :param HSQUIRRELVM v: the target VM
  34. :param SQBool enable: if true enables the error callback notification of handled exceptions.
  35. :remarks: By default the VM will invoke the error callback only if an exception is not handled (no try/catch traps are present in the call stack). If notifyallexceptions is enabled, the VM will call the error callback for any exception even if between try/catch blocks. This feature is useful for implementing debuggers.
  36. enable/disable the error callback notification of handled exceptions.
  37. .. _sq_setcompilererrorhandler:
  38. .. c:function:: void sq_setcompilererrorhandler(HSQUIRRELVM v, SQCOMPILERERROR f)
  39. :param HSQUIRRELVM v: the target VM
  40. :param SQCOMPILERERROR f: A pointer to the error handler function
  41. :remarks: if the parameter f is NULL no function will be called when a compiler error occurs. The compiler error handler is shared between friend VMs.
  42. sets the compiler error handler function