cohtml::ScriptCompiler
#include <Library.h>
Public Types
Section titled “Public Types”| Name | |
|---|---|
| enum | ScriptType { ST_Classic, ST_Module} The enumeration tells the ScriptCompiler how to compile the provided source. |
Public Functions
Section titled “Public Functions”| Name | |
|---|---|
| virtual DataBuffer * | Compile(DataBuffer * utf8Source, ScriptType scriptType) =0 Compiles a script file synchronously. |
| virtual void | Destroy() =0 Destroys the ScriptCompiler and frees memory. |
| virtual DataBuffer * | CompileScript(DataBuffer * utf8Source) =0 Compiles a classic script file synchronously. |
| virtual DataBuffer * | CompileModule(DataBuffer * utf8Source, const char * URL) =0 Compiles a module script file synchronously. |
Protected Functions
Section titled “Protected Functions”| Name | |
|---|---|
| virtual | ~ScriptCompiler() |
Public Types Documentation
Section titled “Public Types Documentation”enum ScriptType
Section titled “enum ScriptType”| Enumerator | Value | Description |
|---|---|---|
| ST_Classic | Try to compile the provided source as a classic script. | |
| ST_Module | Try to compile the provided source as a module. |
The enumeration tells the ScriptCompiler how to compile the provided source.
Public Functions Documentation
Section titled “Public Functions Documentation”function Compile
Section titled “function Compile”virtual DataBuffer * Compile( DataBuffer * utf8Source, ScriptType scriptType) =0Compiles a script file synchronously.
Parameters:
- utf8Source a data buffer, containing an utf8 encoded script source
- scriptType specify if the provided source is classic script or module
Deprecated:
Legacy compatibility API. Use CompileScript or CompileModule instead.
Return: A data buffer, containing the compiled data.
function Destroy
Section titled “function Destroy”virtual void Destroy() =0Destroys the ScriptCompiler and frees memory.
function CompileScript
Section titled “function CompileScript”virtual DataBuffer * CompileScript( DataBuffer * utf8Source) =0Compiles a classic script file synchronously.
Parameters:
- utf8Source a data buffer, containing an utf8 encoded classic script source
Return: A data buffer, containing the compiled data.
function CompileModule
Section titled “function CompileModule”virtual DataBuffer * CompileModule( DataBuffer * utf8Source, const char * URL) =0Compiles a module script file synchronously.
Parameters:
- utf8Source a data buffer, containing an utf8 encoded module script source
- URL the URL/origin of the module script
Return: A data buffer, containing the compiled data.
Protected Functions Documentation
Section titled “Protected Functions Documentation”function ~ScriptCompiler
Section titled “function ~ScriptCompiler”virtual ~ScriptCompiler()© 2026 Coherent Labs. All rights reserved.