Restoring JerryScript a bit cleaner
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "error/error.h"
|
||||
|
||||
typedef struct {
|
||||
bool_t initialized;
|
||||
} script_t;
|
||||
|
||||
extern script_t SCRIPT;
|
||||
|
||||
/**
|
||||
* Initializes the script system, starting up JerryScript and registering all
|
||||
* built-in modules.
|
||||
*
|
||||
* @return Any error that occurred.
|
||||
*/
|
||||
errorret_t scriptInit(void);
|
||||
|
||||
/**
|
||||
* Evaluates a JS source string in the global scope.
|
||||
*
|
||||
* @param source Null-terminated JS source to evaluate.
|
||||
* @return Any error that occurred.
|
||||
*/
|
||||
errorret_t scriptExecString(const char_t *source);
|
||||
|
||||
/**
|
||||
* Loads and evaluates a script asset from the archive. The result is cached
|
||||
* by the asset system; repeated calls with the same path do not re-execute.
|
||||
*
|
||||
* @param path Path of the script inside the asset archive.
|
||||
* @return Any error that occurred.
|
||||
*/
|
||||
errorret_t scriptExecFile(const char_t *path);
|
||||
|
||||
/**
|
||||
* Disposes of the script system and shuts down JerryScript.
|
||||
*
|
||||
* @return Any error that occurred.
|
||||
*/
|
||||
errorret_t scriptDispose(void);
|
||||
Reference in New Issue
Block a user