Consistency pass: house struct tags, pragma once guards, pack bools into flags

Struct tags throughout duskscript reused the typedef name itself (struct
foo_t { ... }), unlike the rest of dusk which always tags with foo_s and
typedefs foo_t - renames all 15 tagged structs in src/dusk/script and
src/duskscriptcc to match. Also drops a vestigial duplicate forward
declaration of scriptsource_t left over from the port.

Unifies all 144 #ifndef/#define/#endif include guards in the ported code to
#pragma once, matching the rest of the codebase (which was already a mix of
25 files doing it the house way and 144 not).

Packs scriptvmfunction_t's isAsync/isRoot/isScript and scriptfuncnode_t's
isAsync/isInline/isNoInline/isRoot/isScript into single uint8_t flags
fields with bit constants, mirroring the SCRIPT_BINARY_FLAG_ASYNC pattern
the bytecode format already uses and the flags-byte convention used
elsewhere in dusk (animation, display). While there, zero-initializes both
scriptfuncnode_t allocation sites (scriptAlloc never zeroes memory, so
several of its fields - not just the ones being packed here - were
previously read uninitialized before their first explicit write), and
removes scriptfunction_t's dead `plain` field, which was always the exact
inverse of isAsync and never actually read anywhere.

Converts the couple of struct-level doc comments that used the ported
project's Javadoc-with-@param style to dusk's plain // prose convention,
and adds missing rationale comments to scriptruntime_t and scriptstring_t,
which had none at all.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
YourWishesandClaude Sonnet 5 committed 2026-10-14 13:22:39 -05:00
1 parent 703d89a9ac
commit af2f0617e0
152 files changed
+235 -666

No files matched your search

+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_ARRAY_SCRIPTARRAYCOPY_H
#define SCRIPT_ARRAY_SCRIPTARRAYCOPY_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -19,5 +18,3 @@
* @returns The new array value.
*/
scriptvalue_t scriptArrayCopy(scriptruntime_t *runtime, const scriptarray_t *source);
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_ARRAY_SCRIPTARRAYDEEP_H
#define SCRIPT_ARRAY_SCRIPTARRAYDEEP_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -31,5 +30,3 @@ scriptvalue_t scriptDeepCopy(scriptruntime_t *runtime, const scriptvalue_t value
* @returns True when they match.
*/
bool scriptDeepEqual(const scriptvalue_t a, const scriptvalue_t b, const uint8_t depth);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_ARRAY_SCRIPTARRAYMODIFY_H
#define SCRIPT_ARRAY_SCRIPTARRAYMODIFY_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -75,5 +74,3 @@ void scriptFreeze(scriptruntime_t *runtime, const scriptvalue_t value);
* @param value The value.
*/
void scriptRequireConstant(scriptruntime_t *runtime, const scriptvalue_t value);
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_ARRAY_SCRIPTARRAYNEW_H
#define SCRIPT_ARRAY_SCRIPTARRAYNEW_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -38,5 +37,3 @@ scriptcategory_t scriptCategoryOf(const scriptvalue_t value);
* @param value The value about to be added.
*/
void scriptArrayCheck(scriptruntime_t *runtime, scriptarray_t *array, const scriptvalue_t value);
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_ARRAY_SCRIPTARRAYSORT_H
#define SCRIPT_ARRAY_SCRIPTARRAYSORT_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -39,5 +38,3 @@ void scriptSortValues(
const bool descending,
const scriptvalue_t comparer
);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_BUILTIN_ARRAY_SCRIPTBARRAYBASIC_H
#define SCRIPT_BUILTIN_ARRAY_SCRIPTBARRAYBASIC_H
#pragma once
#include "core/scriptcore.h"
#include "builtin/scriptbuiltin.h"
@@ -29,5 +28,3 @@ SCRIPT_NATIVE(scriptBClone);
SCRIPT_NATIVE(scriptBDeepClone);
SCRIPT_NATIVE(scriptBDeepEqual);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_BUILTIN_ARRAY_SCRIPTBARRAYFUNC_H
#define SCRIPT_BUILTIN_ARRAY_SCRIPTBARRAYFUNC_H
#pragma once
#include "core/scriptcore.h"
#include "builtin/scriptbuiltin.h"
@@ -14,5 +13,3 @@
SCRIPT_NATIVE(scriptBMap);
SCRIPT_NATIVE(scriptBReduce);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_BUILTIN_ARRAY_SCRIPTBARRAYMODIFY_H
#define SCRIPT_BUILTIN_ARRAY_SCRIPTBARRAYMODIFY_H
#pragma once
#include "core/scriptcore.h"
#include "builtin/scriptbuiltin.h"
@@ -20,5 +19,3 @@ SCRIPT_NATIVE(scriptBSplice);
SCRIPT_NATIVE(scriptBInsert);
SCRIPT_NATIVE(scriptBInsertArr);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_BUILTIN_ARRAY_SCRIPTBARRAYORDER_H
#define SCRIPT_BUILTIN_ARRAY_SCRIPTBARRAYORDER_H
#pragma once
#include "core/scriptcore.h"
#include "builtin/scriptbuiltin.h"
@@ -16,5 +15,3 @@ SCRIPT_NATIVE(scriptBSort);
SCRIPT_NATIVE(scriptBReverse);
SCRIPT_NATIVE(scriptBShuffle);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_BUILTIN_ARRAY_SCRIPTBARRAYSEARCH_H
#define SCRIPT_BUILTIN_ARRAY_SCRIPTBARRAYSEARCH_H
#pragma once
#include "core/scriptcore.h"
#include "builtin/scriptbuiltin.h"
@@ -16,5 +15,3 @@ SCRIPT_NATIVE(scriptBIndexOf);
SCRIPT_NATIVE(scriptBLastIndexOf);
SCRIPT_NATIVE(scriptBFilter);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_BUILTIN_ARRAY_SCRIPTBARRAYSLICE_H
#define SCRIPT_BUILTIN_ARRAY_SCRIPTBARRAYSLICE_H
#pragma once
#include "core/scriptcore.h"
#include "builtin/scriptbuiltin.h"
@@ -16,5 +15,3 @@ SCRIPT_NATIVE(scriptBSubarr);
SCRIPT_NATIVE(scriptBFlatten);
SCRIPT_NATIVE(scriptBJoin);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_BUILTIN_CORE_SCRIPTBCONVERT_H
#define SCRIPT_BUILTIN_CORE_SCRIPTBCONVERT_H
#pragma once
#include "core/scriptcore.h"
#include "builtin/scriptbuiltin.h"
@@ -18,5 +17,3 @@ SCRIPT_NATIVE(scriptBToBase);
SCRIPT_NATIVE(scriptBToNum);
SCRIPT_NATIVE(scriptBToBool);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_BUILTIN_CORE_SCRIPTBINCLUDE_H
#define SCRIPT_BUILTIN_CORE_SCRIPTBINCLUDE_H
#pragma once
#include "core/scriptcore.h"
#include "builtin/scriptbuiltin.h"
@@ -14,5 +13,3 @@
SCRIPT_NATIVE(scriptBInclude);
SCRIPT_NATIVE(scriptBAInclude);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_BUILTIN_CORE_SCRIPTBPRINT_H
#define SCRIPT_BUILTIN_CORE_SCRIPTBPRINT_H
#pragma once
#include "core/scriptcore.h"
#include "builtin/scriptbuiltin.h"
@@ -15,5 +14,3 @@
SCRIPT_NATIVE(scriptBPrint);
SCRIPT_NATIVE(scriptBAssert);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_BUILTIN_CORE_SCRIPTBPROMISE_H
#define SCRIPT_BUILTIN_CORE_SCRIPTBPROMISE_H
#pragma once
#include "core/scriptcore.h"
#include "builtin/scriptbuiltin.h"
@@ -24,5 +23,3 @@ SCRIPT_NATIVE(scriptBAny);
SCRIPT_NATIVE(scriptBFirst);
SCRIPT_NATIVE(scriptBWait);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_BUILTIN_CORE_SCRIPTBTYPE_H
#define SCRIPT_BUILTIN_CORE_SCRIPTBTYPE_H
#pragma once
#include "core/scriptcore.h"
#include "builtin/scriptbuiltin.h"
@@ -20,5 +19,3 @@ SCRIPT_NATIVE(scriptBIsNullOrUndefined);
SCRIPT_NATIVE(scriptBIsFunction);
SCRIPT_NATIVE(scriptBIsFunctionAsync);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_BUILTIN_MATH_SCRIPTBMATHBASIC_H
#define SCRIPT_BUILTIN_MATH_SCRIPTBMATHBASIC_H
#pragma once
#include "core/scriptcore.h"
#include "builtin/scriptbuiltin.h"
@@ -25,5 +24,3 @@ SCRIPT_NATIVE(scriptBClamp);
SCRIPT_NATIVE(scriptBPow);
SCRIPT_NATIVE(scriptBSqrt);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_BUILTIN_MATH_SCRIPTBMATHRANDOM_H
#define SCRIPT_BUILTIN_MATH_SCRIPTBMATHRANDOM_H
#pragma once
#include "core/scriptcore.h"
#include "builtin/scriptbuiltin.h"
@@ -24,5 +23,3 @@ SCRIPT_NATIVE(scriptBRand);
SCRIPT_NATIVE(scriptBRandf);
SCRIPT_NATIVE(scriptBRandSeed);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_BUILTIN_MATH_SCRIPTBMATHROUND_H
#define SCRIPT_BUILTIN_MATH_SCRIPTBMATHROUND_H
#pragma once
#include "core/scriptcore.h"
#include "builtin/scriptbuiltin.h"
@@ -16,5 +15,3 @@ SCRIPT_NATIVE(scriptBFloor);
SCRIPT_NATIVE(scriptBCeil);
SCRIPT_NATIVE(scriptBRound);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_BUILTIN_MATH_SCRIPTBMATHTRIG_H
#define SCRIPT_BUILTIN_MATH_SCRIPTBMATHTRIG_H
#pragma once
#include "core/scriptcore.h"
#include "builtin/scriptbuiltin.h"
@@ -18,5 +17,3 @@ SCRIPT_NATIVE(scriptBCos);
SCRIPT_NATIVE(scriptBTan);
SCRIPT_NATIVE(scriptBAtan2);
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_BUILTIN_SCRIPTARG_H
#define SCRIPT_BUILTIN_SCRIPTARG_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -120,5 +119,3 @@ int32_t scriptArgInteger(scriptruntime_t *runtime, const scriptvalue_t *args, co
* @returns The function value.
*/
scriptvalue_t scriptArgFunction(scriptruntime_t *runtime, const scriptvalue_t *args, const uint8_t argc, const uint8_t index);
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_BUILTIN_SCRIPTBUILTIN_H
#define SCRIPT_BUILTIN_SCRIPTBUILTIN_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -18,5 +17,3 @@
const uint8_t argc, \
scriptfunction_t *self \
)
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_BUILTIN_SCRIPTBUILTINREGISTER_H
#define SCRIPT_BUILTIN_SCRIPTBUILTINREGISTER_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptfunction.h"
@@ -36,5 +35,3 @@ void scriptBuiltinAddInt(scriptruntime_t *runtime, const char *name, const int16
* @param runtime The runtime.
*/
void scriptBuiltinsRegister(scriptruntime_t *runtime);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_BUILTIN_SCRIPTNATIVESIG_H
#define SCRIPT_BUILTIN_SCRIPTNATIVESIG_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -57,7 +56,7 @@ typedef struct {
// What the machine finds a native by, for the instruction that calls one by its number. 16
// bytes each on the Super Nintendo, which the assembly counts on.
typedef struct scriptnativeentry_t {
typedef struct scriptnativeentry_s {
scriptnative_t function;
const char *name;
const scriptnativesig_t *signature;
@@ -105,5 +104,3 @@ void scriptNativeCheckArgs(scriptruntime_t *runtime, const scriptnativesig_t *si
#else
#define SCRIPT_NATIVE_INT(runtime, args, argc, index) scriptArgInteger((runtime), (args), (argc), (index))
#endif
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_BUILTIN_STRING_SCRIPTBSTRINGCASE_H
#define SCRIPT_BUILTIN_STRING_SCRIPTBSTRINGCASE_H
#pragma once
#include "core/scriptcore.h"
#include "builtin/scriptbuiltin.h"
@@ -16,5 +15,3 @@ SCRIPT_NATIVE(scriptBChr);
SCRIPT_NATIVE(scriptBDowncase);
SCRIPT_NATIVE(scriptBUpcase);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_BUILTIN_STRING_SCRIPTBSTRINGSEARCH_H
#define SCRIPT_BUILTIN_STRING_SCRIPTBSTRINGSEARCH_H
#pragma once
#include "core/scriptcore.h"
#include "builtin/scriptbuiltin.h"
@@ -23,5 +22,3 @@ SCRIPT_NATIVE(scriptBEndsWith);
SCRIPT_NATIVE(scriptBStringEquals);
SCRIPT_NATIVE(scriptBStringEqualsInsensitive);
#endif
@@ -5,12 +5,9 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_BUILTIN_STRING_SCRIPTBSTRINGSPLIT_H
#define SCRIPT_BUILTIN_STRING_SCRIPTBSTRINGSPLIT_H
#pragma once
#include "core/scriptcore.h"
#include "builtin/scriptbuiltin.h"
SCRIPT_NATIVE(scriptBSplit);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_BUILTIN_STRING_SCRIPTBSTRINGTRIM_H
#define SCRIPT_BUILTIN_STRING_SCRIPTBSTRINGTRIM_H
#pragma once
#include "core/scriptcore.h"
#include "builtin/scriptbuiltin.h"
@@ -16,5 +15,3 @@ SCRIPT_NATIVE(scriptBLtrim);
SCRIPT_NATIVE(scriptBRtrim);
SCRIPT_NATIVE(scriptBTrim);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_BYTECODE_SCRIPTBYTECODE_H
#define SCRIPT_BYTECODE_SCRIPTBYTECODE_H
#pragma once
#include "core/scriptcore.h"
@@ -187,5 +186,3 @@ typedef enum {
// Set in the token or the mode of an assignment or an increment when its value is
// not wanted, which saves putting it on the stack and taking it off again.
#define SCRIPT_BC_DISCARD 0x80
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_BYTECODE_SCRIPTBYTECODESIZE_H
#define SCRIPT_BYTECODE_SCRIPTBYTECODESIZE_H
#pragma once
#include "core/scriptcore.h"
#include "bytecode/scriptbytecode.h"
@@ -16,5 +15,3 @@
* instruction.
*/
extern const uint8_t scriptBytecodeSize[SCRIPT_BC_COUNT];
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_BYTECODE_SCRIPTVARINT_H
#define SCRIPT_BYTECODE_SCRIPTVARINT_H
#pragma once
#include "core/scriptcore.h"
@@ -45,5 +44,3 @@ uint16_t scriptZigzag(const int16_t value);
* @returns The signed number.
*/
int16_t scriptUnzigzag(const uint16_t value);
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_CALL_SCRIPTCALL_H
#define SCRIPT_CALL_SCRIPTCALL_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -66,5 +65,3 @@ scriptvalue_t scriptCallFunction(
const scriptvalue_t *args,
const uint8_t argc
);
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_CORE_SCRIPTCORE_H
#define SCRIPT_CORE_SCRIPTCORE_H
#pragma once
#include <stddef.h>
#include <stdint.h>
@@ -53,5 +52,3 @@ typedef struct {
uint8_t frameCount;
scriptframeinfo_t frames[SCRIPT_ERROR_FRAMES_MAX];
} scripterror_t;
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_CORE_SCRIPTPLATFORM_H
#define SCRIPT_CORE_SCRIPTPLATFORM_H
#pragma once
// What the platform the script engine is built for can do, and the sizes its
// numbers come in. Every one of the feature switches can be set from the
@@ -159,5 +158,3 @@ typedef size_t scriptoffset_t;
// Most values a function has on its stack at once, the compiler checks it.
#define SCRIPT_VM_STACK_MAX 64
#endif
+2 -7
View File
@@ -5,19 +5,14 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_CORE_SCRIPTSOURCE_H
#define SCRIPT_CORE_SCRIPTSOURCE_H
#pragma once
#include "core/scriptcore.h"
// A script's text and the name shown for it in errors.
typedef struct scriptsource_t {
typedef struct scriptsource_s {
char name[SCRIPT_FILE_MAX];
char path[SCRIPT_FILE_MAX];
const char *text;
size_t length;
} scriptsource_t;
struct scriptsource_t;
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_COROUTINE_SCRIPTCOROUTINE_H
#define SCRIPT_COROUTINE_SCRIPTCOROUTINE_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -29,16 +28,16 @@ typedef enum {
// A script that can be paused at an await. Where there is no way to switch stacks
// (SCRIPT_FEATURE_COROUTINES is 0) it runs on the stack of whoever starts it, to
// the end, and an await can only wait for what can be run right then.
typedef struct scriptcoroutine_t {
struct scriptcoroutine_t *nextAll;
struct scriptcoroutine_t *prevAll;
typedef struct scriptcoroutine_s {
struct scriptcoroutine_s *nextAll;
struct scriptcoroutine_s *prevAll;
#if SCRIPT_FEATURE_COROUTINES
ucontext_t context;
void *stack;
#endif
jmp_buf errorJump;
scriptcostate_t state;
struct scriptcoroutine_t *nextReady;
struct scriptcoroutine_s *nextReady;
scriptvalue_t function;
scriptvalue_t args[SCRIPT_PARAMS_MAX];
uint8_t argc;
@@ -54,6 +53,4 @@ typedef struct scriptcoroutine_t {
uint16_t valuesTop;
} scriptcoroutine_t;
struct scriptcoroutine_t;
#endif
struct scriptcoroutine_s;
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_COROUTINE_SCRIPTCOROUTINEREADY_H
#define SCRIPT_COROUTINE_SCRIPTCOROUTINEREADY_H
#pragma once
#include "core/scriptcore.h"
#include "coroutine/scriptcoroutine.h"
@@ -18,5 +17,3 @@
* @param coroutine The coroutine, it is marked ready.
*/
void scriptReadyPush(scriptruntime_t *runtime, scriptcoroutine_t *coroutine);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_COROUTINE_SCRIPTCOROUTINESPAWN_H
#define SCRIPT_COROUTINE_SCRIPTCOROUTINESPAWN_H
#pragma once
#include "core/scriptcore.h"
#include "coroutine/scriptcoroutine.h"
@@ -71,5 +70,3 @@ scriptcoroutine_t *scriptCoroutineSpawn(
* @param coroutine The coroutine to switch to.
*/
void scriptCoroutineResume(scriptruntime_t *runtime, scriptcoroutine_t *coroutine);
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_COROUTINE_SCRIPTFRAME_H
#define SCRIPT_COROUTINE_SCRIPTFRAME_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -28,5 +27,3 @@ typedef struct {
void *locateData;
uint8_t padding[SCRIPT_FRAME_PADDING]; // sizeof is a power of two on the SNES, the frames are indexed with a shift
} scriptframe_t;
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_COROUTINE_SCRIPTSCHEDULER_H
#define SCRIPT_COROUTINE_SCRIPTSCHEDULER_H
#pragma once
#include "core/scriptcore.h"
@@ -39,5 +38,3 @@ void scriptCoroutineReap(scriptruntime_t *runtime, scriptcoroutine_t *co);
*/
bool scriptSchedulerStep(scriptruntime_t *runtime);
#endif
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_COROUTINE_SCRIPTSETPOSITION_H
#define SCRIPT_COROUTINE_SCRIPTSETPOSITION_H
#pragma once
#include "core/scriptcore.h"
@@ -18,5 +17,3 @@
* @param column Column in the script.
*/
void scriptSetPosition(scriptruntime_t *runtime, const uint16_t line, const uint16_t column);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_COROUTINE_SCRIPTSTACKCHECK_H
#define SCRIPT_COROUTINE_SCRIPTSTACKCHECK_H
#pragma once
#include "core/scriptcore.h"
@@ -20,5 +19,3 @@
* @param runtime The runtime.
*/
void scriptStackCheck(scriptruntime_t *runtime);
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_DUSKSCRIPT_H
#define SCRIPT_DUSKSCRIPT_H
#pragma once
// The part of dusk script every runtime shares: values, the heap, the garbage
// collector, the built in functions and running scripts. The interpreter and the
@@ -18,5 +17,3 @@
#include "runtime/scriptruntimeconfig.h"
#include "runtime/scriptruntimerun.h"
#include "error/scripttrace.h"
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_DUSKSCRIPTNATIVE_H
#define SCRIPT_DUSKSCRIPTNATIVE_H
#pragma once
// What a native function needs, the types, the argument helpers and the value
// constructors.
@@ -26,5 +25,3 @@
#include "promise/scriptpromisesettle.h"
#include "promise/scripttimer.h"
#include "runtime/scriptruntimeload.h"
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_ERROR_SCRIPTRAISE_H
#define SCRIPT_ERROR_SCRIPTRAISE_H
#pragma once
#include "core/scriptcore.h"
#include "core/scriptsource.h"
@@ -39,5 +38,3 @@ void scriptRaiseSyntax(
const char *format,
...
);
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_ERROR_SCRIPTTRACE_H
#define SCRIPT_ERROR_SCRIPTTRACE_H
#pragma once
#include "core/scriptcore.h"
@@ -24,5 +23,3 @@
* @param size Size of the buffer in bytes.
*/
void scriptErrorFormat(const scripterror_t *error, char *buffer, const size_t size);
#endif
+5 -10
View File
@@ -5,19 +5,16 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_EXECUTOR_SCRIPTEXECUTOR_H
#define SCRIPT_EXECUTOR_SCRIPTEXECUTOR_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
#include "value/scriptfunction.h"
/**
* Something that can run the body of a script function. The tree walking
* interpreter is one, the bytecode virtual machine is another, and a function
* remembers which one made it, so both kinds can call each other in one runtime.
*/
typedef struct scriptexecutor_t {
// Something that can run the body of a script function. The tree walking
// interpreter is one, the bytecode virtual machine is another, and a function
// remembers which one made it, so both kinds can call each other in one runtime.
typedef struct scriptexecutor_s {
/**
* Runs the body of a script function right now, in the current coroutine.
*
@@ -42,5 +39,3 @@ typedef struct scriptexecutor_t {
*/
void (*locate)(const scriptfunction_t *function, void *data, uint16_t *line, uint16_t *column);
} scriptexecutor_t;
#endif
+1 -4
View File
@@ -5,9 +5,6 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_GC_SCRIPTGC_H
#define SCRIPT_GC_SCRIPTGC_H
#pragma once
#include "core/scriptcore.h"
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_GC_SCRIPTGCCOLLECT_H
#define SCRIPT_GC_SCRIPTGCCOLLECT_H
#pragma once
#include "core/scriptcore.h"
@@ -26,5 +25,3 @@ void scriptGcCollect(scriptruntime_t *runtime);
* @param runtime The runtime.
*/
void scriptGcSetThreshold(scriptruntime_t *runtime);
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_GC_SCRIPTGCMARK_H
#define SCRIPT_GC_SCRIPTGCMARK_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -26,5 +25,3 @@ void scriptGcMarkPointer(scriptruntime_t *runtime, const void *pointer);
* @param value The value.
*/
void scriptGcMarkValue(scriptruntime_t *runtime, const scriptvalue_t value);
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_GC_SCRIPTGCSCAN_H
#define SCRIPT_GC_SCRIPTGCSCAN_H
#pragma once
#include "core/scriptcore.h"
@@ -35,5 +34,3 @@ void scriptGcScanRange(scriptruntime_t *runtime, const void *low, const void *hi
* @param base The top of the stack.
*/
void scriptGcScanStack(scriptruntime_t *runtime, const char *base);
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_HEAP_SCRIPTHEAP_H
#define SCRIPT_HEAP_SCRIPTHEAP_H
#pragma once
#include "core/scriptcore.h"
@@ -34,5 +33,3 @@ typedef struct {
size_t last; // offset of the last block, the big blocks are looked for from there
size_t rover; // offset of the block where the last small allocation ended, where the next one starts looking
} scriptheap_t;
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_HEAP_SCRIPTHEAPALLOC_H
#define SCRIPT_HEAP_SCRIPTHEAPALLOC_H
#pragma once
#include "core/scriptcore.h"
#include "heap/scriptheap.h"
@@ -30,5 +29,3 @@ void *scriptHeapAlloc(scriptheap_t *heap, const size_t size);
* @returns The memory, or NULL if the heap is out of space.
*/
void *scriptHeapAllocKind(scriptheap_t *heap, const size_t size, const scriptheapkind_t kind);
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_HEAP_SCRIPTHEAPBLOCK_H
#define SCRIPT_HEAP_SCRIPTHEAPBLOCK_H
#pragma once
#include "core/scriptcore.h"
#include "heap/scriptheap.h"
@@ -94,5 +93,3 @@ void scriptHeapSetScanned(scriptheap_t *heap, void *pointer);
* @returns The block, or NULL when there are no more.
*/
void *scriptHeapNextPending(const scriptheap_t *heap, void **cursor);
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_HEAP_SCRIPTHEAPFREE_H
#define SCRIPT_HEAP_SCRIPTHEAPFREE_H
#pragma once
#include "core/scriptcore.h"
#include "heap/scriptheap.h"
@@ -18,5 +17,3 @@
* @param pointer Memory returned by scriptHeapAlloc, NULL is ignored.
*/
void scriptHeapFree(scriptheap_t *heap, void *pointer);
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_HEAP_SCRIPTHEAPINIT_H
#define SCRIPT_HEAP_SCRIPTHEAPINIT_H
#pragma once
#include "core/scriptcore.h"
#include "heap/scriptheap.h"
@@ -19,5 +18,3 @@
* @param size Size of the block in bytes.
*/
void scriptHeapInit(scriptheap_t *heap, void *memory, const size_t size);
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_HEAP_SCRIPTHEAPSWEEP_H
#define SCRIPT_HEAP_SCRIPTHEAPSWEEP_H
#pragma once
#include "core/scriptcore.h"
#include "heap/scriptheap.h"
@@ -18,5 +17,3 @@
* @param heap The heap.
*/
void scriptHeapSweep(scriptheap_t *heap);
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_NUMBER_SCRIPTNUMBER_H
#define SCRIPT_NUMBER_SCRIPTNUMBER_H
#pragma once
#include "core/scriptcore.h"
@@ -15,5 +14,3 @@ typedef enum {
SCRIPT_PARSE_INVALID,
SCRIPT_PARSE_TOOBIG
} scriptparse_t;
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_NUMBER_SCRIPTNUMBERBINARY_H
#define SCRIPT_NUMBER_SCRIPTNUMBERBINARY_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -23,5 +22,3 @@
* @returns The result.
*/
scriptvalue_t scriptNumberBinary(scriptruntime_t *runtime, const scriptoperator_t op, const scriptvalue_t a, const scriptvalue_t b);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_NUMBER_SCRIPTNUMBERFORMAT_H
#define SCRIPT_NUMBER_SCRIPTNUMBERFORMAT_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -21,5 +20,3 @@
* @param decimals Number of decimal places, or -1 for as many as are needed, with trailing zeros dropped.
*/
void scriptNumberFormat(scriptruntime_t *runtime, scriptbuf_t *buffer, const scriptvalue_t value, const int decimals);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_NUMBER_SCRIPTNUMBERPARSE_H
#define SCRIPT_NUMBER_SCRIPTNUMBERPARSE_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -33,5 +32,3 @@ scriptparse_t scriptParseDecimal(const char *text, const size_t length, scriptva
* @returns Whether it was valid and fit.
*/
scriptparse_t scriptParseInteger(const char *text, const size_t length, const int base, int32_t *out);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_NUMBER_SCRIPTNUMBERUNARY_H
#define SCRIPT_NUMBER_SCRIPTNUMBERUNARY_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -37,5 +36,3 @@ scriptvalue_t scriptNumberInvert(scriptruntime_t *runtime, const scriptvalue_t v
* @returns -1, 0 or 1.
*/
int scriptNumberCompare(const scriptvalue_t a, const scriptvalue_t b);
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_OPS_SCRIPTBINARYOP_H
#define SCRIPT_OPS_SCRIPTBINARYOP_H
#pragma once
#include "core/scriptcore.h"
#include "token/scripttoken.h"
@@ -22,5 +21,3 @@
* @returns The result.
*/
scriptvalue_t scriptBinaryOp(scriptruntime_t *runtime, const scripttokentype_t op, const scriptvalue_t a, const scriptvalue_t b);
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_OPS_SCRIPTINDEX_H
#define SCRIPT_OPS_SCRIPTINDEX_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -41,5 +40,3 @@ scriptvalue_t scriptIndexGet(scriptruntime_t *runtime, const scriptvalue_t conta
* @returns The value, undefined when the member is not there.
*/
scriptvalue_t scriptMemberGet(scriptruntime_t *runtime, const scriptvalue_t container, const char *name, const size_t length);
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_OPS_SCRIPTREF_H
#define SCRIPT_OPS_SCRIPTREF_H
#pragma once
#include "core/scriptcore.h"
#include "scope/scriptscope.h"
@@ -46,5 +45,3 @@ scriptvalue_t scriptRefGet(scriptruntime_t *runtime, const scriptref_t *ref);
* @param value The new value.
*/
void scriptRefSet(scriptruntime_t *runtime, const scriptref_t *ref, const scriptvalue_t value);
#endif
+5 -8
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_PROMISE_SCRIPTPROMISE_H
#define SCRIPT_PROMISE_SCRIPTPROMISE_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -26,14 +25,14 @@ typedef enum {
// Something waiting for a promise to settle: a coroutine to wake up, or a
// combinator (all, any, first) that is watching one of its members.
typedef struct scriptpromisewaiter_t {
struct scriptcoroutine_t *coroutine;
typedef struct scriptpromisewaiter_s {
struct scriptcoroutine_s *coroutine;
scriptpromise_t *combinator;
uint16_t index;
struct scriptpromisewaiter_t *next;
struct scriptpromisewaiter_s *next;
} scriptpromisewaiter_t;
struct scriptpromise_t {
struct scriptpromise_s {
scriptpromisestate_t state;
scriptvalue_t value;
scriptpromisewaiter_t *waiters;
@@ -54,5 +53,3 @@ struct scriptpromise_t {
bool comboRejected;
scriptvalue_t comboReason;
};
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_PROMISE_SCRIPTPROMISEAWAIT_H
#define SCRIPT_PROMISE_SCRIPTPROMISEAWAIT_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -20,5 +19,3 @@
* @returns The resolved value.
*/
scriptvalue_t scriptAwait(scriptruntime_t *runtime, scriptpromise_t *promise);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_PROMISE_SCRIPTPROMISECOMBINE_H
#define SCRIPT_PROMISE_SCRIPTPROMISECOMBINE_H
#pragma once
#include "core/scriptcore.h"
#include "promise/scriptpromise.h"
@@ -31,5 +30,3 @@ void scriptComboNotify(scriptruntime_t *runtime, scriptpromise_t *combinator, co
* @returns The promise value.
*/
scriptvalue_t scriptPromiseCombine(scriptruntime_t *runtime, const scriptcombinator_t kind, scriptarray_t *promises);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_PROMISE_SCRIPTPROMISENEW_H
#define SCRIPT_PROMISE_SCRIPTPROMISENEW_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -18,5 +17,3 @@
* @returns The promise value.
*/
scriptvalue_t scriptPromiseNew(scriptruntime_t *runtime);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_PROMISE_SCRIPTPROMISESETTLE_H
#define SCRIPT_PROMISE_SCRIPTPROMISESETTLE_H
#pragma once
#include "core/scriptcore.h"
#include "promise/scriptpromise.h"
@@ -67,5 +66,3 @@ void scriptPromiseReject(scriptruntime_t *runtime, scriptpromise_t *promise, con
* @param promise The promise.
*/
void scriptPromiseStart(scriptruntime_t *runtime, scriptpromise_t *promise);
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_PROMISE_SCRIPTTIMER_H
#define SCRIPT_PROMISE_SCRIPTTIMER_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -31,5 +30,3 @@ scriptvalue_t scriptTimerPromise(scriptruntime_t *runtime, const uint32_t ticks)
* @param runtime The runtime.
*/
void scriptTimersAdvance(scriptruntime_t *runtime);
#endif
+3 -8
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_RUNTIME_SCRIPTRUNTIME_H
#define SCRIPT_RUNTIME_SCRIPTRUNTIME_H
#pragma once
#include "core/scriptcore.h"
#include "core/scriptsource.h"
@@ -15,7 +14,7 @@
// A runtime is one script context: its own heap, its own globals, its own
// running scripts. Nothing in it uses malloc, all of its memory comes from the
// block the host gives scriptRuntimeCreate.
typedef struct scriptruntime_t scriptruntime_t;
typedef struct scriptruntime_s scriptruntime_t;
/**
* Called with the text print() produces, newline included.
@@ -87,12 +86,8 @@ typedef scriptvalue_t (*scriptloadbinary_t)(
*/
typedef scriptvalue_t (*scriptrootmaker_t)(scriptruntime_t *runtime, const void *input);
/**
* What scriptRuntimeMakeRoot is given to make the main script's function.
*/
// What scriptRuntimeMakeRoot is given to make the main script's function.
typedef struct {
const scriptsource_t *source;
bool rootAsync;
} scriptrootinput_t;
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_RUNTIME_SCRIPTRUNTIMECONFIG_H
#define SCRIPT_RUNTIME_SCRIPTRUNTIMECONFIG_H
#pragma once
#include "core/scriptcore.h"
#include "runtime/scriptruntime.h"
@@ -77,5 +76,3 @@ uint32_t scriptRuntimeGcRuns(const scriptruntime_t *runtime);
* @returns Bytes.
*/
size_t scriptRuntimeHeapPeak(const scriptruntime_t *runtime);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_RUNTIME_SCRIPTRUNTIMECREATE_H
#define SCRIPT_RUNTIME_SCRIPTRUNTIMECREATE_H
#pragma once
#include "core/scriptcore.h"
@@ -21,5 +20,3 @@
* @returns The runtime, NULL if the block is too small.
*/
scriptruntime_t *scriptRuntimeCreate(void *memory, const size_t size);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_RUNTIME_SCRIPTRUNTIMEEXECUTE_H
#define SCRIPT_RUNTIME_SCRIPTRUNTIMEEXECUTE_H
#pragma once
#include "core/scriptcore.h"
#include "runtime/scriptruntime.h"
@@ -23,5 +22,3 @@
* @returns SCRIPT_OK, or the kind of error.
*/
scriptresult_t scriptRuntimeExecute(scriptruntime_t *runtime, const scriptrootmaker_t make, const void *input, scripterror_t *error);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_RUNTIME_SCRIPTRUNTIMELOAD_H
#define SCRIPT_RUNTIME_SCRIPTRUNTIMELOAD_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -63,5 +62,3 @@ scriptvalue_t scriptLoadFunction(scriptruntime_t *runtime, const scriptsource_t
* @returns The script, a missing file is a fatal error.
*/
scriptsource_t *scriptReadScript(scriptruntime_t *runtime, const char *path, const char *callerPath);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_RUNTIME_SCRIPTRUNTIMERUN_H
#define SCRIPT_RUNTIME_SCRIPTRUNTIMERUN_H
#pragma once
#include "core/scriptcore.h"
#include "core/scriptsource.h"
@@ -71,5 +70,3 @@ bool scriptRuntimeResult(scriptruntime_t *runtime, scriptvalue_t *result);
* @returns SCRIPT_OK, or the kind of error.
*/
scriptresult_t scriptRuntimeCall(scriptruntime_t *runtime, const scriptvalue_t function, scripterror_t *error);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_RUNTIME_SCRIPTRUNTIMESTATE_H
#define SCRIPT_RUNTIME_SCRIPTRUNTIMESTATE_H
#pragma once
#include "core/scriptcore.h"
#include "promise/scripttimer.h"
@@ -20,7 +19,9 @@
#include <ucontext.h>
#endif
struct scriptruntime_t {
// One script context: its own heap, its own globals, its own running scripts.
// The embedding API only ever hands out a pointer to this, see scriptruntime.h.
struct scriptruntime_s {
scriptheap_t heap;
scriptscope_t *builtinScope;
scriptscope_t *globalScope;
@@ -60,7 +61,7 @@ struct scriptruntime_t {
char *mainStackBase;
// The natives that have a signature, which the machine calls by their number
const struct scriptnativeentry_t *nativeEntries;
const struct scriptnativeentry_s *nativeEntries;
uint16_t nativeCount;
// Where the maps of compiled scripts are found, see scriptmaphandler_t. It is last, the machine for the
@@ -72,7 +73,5 @@ struct scriptruntime_t {
// Where the calls of scriptRuntimeCall are run on a platform without coroutines: one that is kept, so a call does not
// make and unmake one
struct scriptcoroutine_t *callCoroutine;
struct scriptcoroutine_s *callCoroutine;
};
#endif
+5 -8
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_SCOPE_SCRIPTSCOPE_H
#define SCRIPT_SCOPE_SCRIPTSCOPE_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -23,14 +22,12 @@ typedef struct {
// A scope holds the variables of one block, it is thrown away when the block
// ends. Lookups walk up through the parents.
typedef struct scriptscope_t {
struct scriptscope_t *nextAll;
struct scriptscope_t *prevAll;
struct scriptscope_t *parent;
typedef struct scriptscope_s {
struct scriptscope_s *nextAll;
struct scriptscope_s *prevAll;
struct scriptscope_s *parent;
scriptvariable_t *variables;
uint16_t count;
uint16_t capacity;
bool fixed; // never grows, so a pointer to a variable of it stays good
} scriptscope_t;
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_SCOPE_SCRIPTSCOPEFIND_H
#define SCRIPT_SCOPE_SCRIPTSCOPEFIND_H
#pragma once
#include "core/scriptcore.h"
#include "scope/scriptscope.h"
@@ -28,5 +27,3 @@ scriptvariable_t *scriptScopeFindLocal(scriptscope_t *scope, const char *name);
* @returns The variable or NULL.
*/
scriptvariable_t *scriptScopeFind(scriptscope_t *scope, const char *name);
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_SCOPE_SCRIPTSCOPENEW_H
#define SCRIPT_SCOPE_SCRIPTSCOPENEW_H
#pragma once
#include "core/scriptcore.h"
#include "scope/scriptscope.h"
@@ -27,5 +26,3 @@ scriptscope_t *scriptScopeNew(scriptruntime_t *runtime, scriptscope_t *parent);
* @param scope The scope.
*/
void scriptScopeFree(scriptruntime_t *runtime, scriptscope_t *scope);
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_SCOPE_SCRIPTSCOPESET_H
#define SCRIPT_SCOPE_SCRIPTSCOPESET_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -64,5 +63,3 @@ void scriptScopeDeclare(scriptruntime_t *runtime, scriptscope_t *scope, const ch
* @param value The value.
*/
void scriptScopeDefine(scriptruntime_t *runtime, scriptscope_t *scope, const char *name, const scriptvalue_t value);
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_SCRIPTTYPES_H
#define SCRIPT_SCRIPTTYPES_H
#pragma once
// Every type and constant of the interpreter, for the files that reach into the
// structures. The functions are declared next to the files that define them.
@@ -36,5 +35,3 @@
#include "value/scriptstring.h"
#include "value/scriptstruct.h"
#include "promise/scriptpromise.h"
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_STRING_SCRIPTBUF_H
#define SCRIPT_STRING_SCRIPTBUF_H
#pragma once
#include "core/scriptcore.h"
@@ -50,5 +49,3 @@ void scriptBufAppendC(scriptruntime_t *runtime, scriptbuf_t *buffer, const char
* @param buffer The buffer.
*/
void scriptBufFree(scriptruntime_t *runtime, scriptbuf_t *buffer);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_STRING_SCRIPTSTRINGCHAR_H
#define SCRIPT_STRING_SCRIPTSTRINGCHAR_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -45,5 +44,3 @@ char scriptCharUpper(const char c);
* @returns The trimmed string value.
*/
scriptvalue_t scriptStringTrim(scriptruntime_t *runtime, const scriptstring_t *text, const bool left, const bool right);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_STRING_SCRIPTSTRINGCONCAT_H
#define SCRIPT_STRING_SCRIPTSTRINGCONCAT_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -21,5 +20,3 @@
* @returns The string value.
*/
scriptvalue_t scriptStringConcat(scriptruntime_t *runtime, const scriptvalue_t a, const scriptvalue_t b);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_STRING_SCRIPTSTRINGNEW_H
#define SCRIPT_STRING_SCRIPTSTRINGNEW_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -29,5 +28,3 @@ scriptvalue_t scriptStringNew(scriptruntime_t *runtime, const char *data, const
* @returns The string value.
*/
scriptvalue_t scriptStringFromC(scriptruntime_t *runtime, const char *text);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_STRING_SCRIPTSTRINGREJECT_H
#define SCRIPT_STRING_SCRIPTSTRINGREJECT_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -19,5 +18,3 @@
* @param value The first argument of the function.
*/
void scriptRejectString(scriptruntime_t *runtime, const scriptvalue_t value);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_STRING_SCRIPTSTRINGSEARCH_H
#define SCRIPT_STRING_SCRIPTSTRINGSEARCH_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -19,5 +18,3 @@
* @returns Where the piece starts, or -1 when it is not there.
*/
int scriptStringSearch(const scriptstring_t *text, const scriptstring_t *piece);
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_STRUCT_SCRIPTSTRUCT_H
#define SCRIPT_STRUCT_SCRIPTSTRUCT_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -67,5 +66,3 @@ void scriptStructSet(
* @param value The value to store.
*/
void scriptStructSetKey(scriptruntime_t *runtime, scriptstruct_t *structure, scriptstring_t *key, const scriptvalue_t value);
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_TEXT_SCRIPTTEXT_H
#define SCRIPT_TEXT_SCRIPTTEXT_H
#pragma once
#include "core/scriptcore.h"
#include <stdarg.h>
@@ -39,5 +38,3 @@ void scriptFormat(char *out, const size_t capacity, const char *format, ...);
* @param text The text, NULL counts as empty.
*/
void scriptCopyText(char *out, const size_t capacity, const char *text);
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_TOKEN_SCRIPTTOKEN_H
#define SCRIPT_TOKEN_SCRIPTTOKEN_H
#pragma once
#include "core/scriptcore.h"
@@ -90,5 +89,3 @@ typedef struct {
uint16_t length;
float number;
} scripttoken_t;
#endif
+1 -4
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_VALUE_SCRIPTALLOC_H
#define SCRIPT_VALUE_SCRIPTALLOC_H
#pragma once
#include "core/scriptcore.h"
#include "heap/scriptheap.h"
@@ -38,5 +37,3 @@ void *scriptAlloc(scriptruntime_t *runtime, const size_t size);
* @param pointer Memory from scriptAlloc, NULL is ignored.
*/
void scriptFree(scriptruntime_t *runtime, void *pointer);
#endif
+2 -5
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_VALUE_SCRIPTARRAY_H
#define SCRIPT_VALUE_SCRIPTARRAY_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -23,12 +22,10 @@ typedef enum {
SCRIPT_CATEGORY_PROMISE
} scriptcategory_t;
struct scriptarray_t {
struct scriptarray_s {
uint16_t length;
uint16_t capacity;
scriptcategory_t category;
scriptvalue_t *items;
bool frozen; // a constant, which nothing changes
};
#endif
+5 -9
View File
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_VALUE_SCRIPTFUNCTION_H
#define SCRIPT_VALUE_SCRIPTFUNCTION_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -18,16 +17,15 @@ typedef scriptvalue_t (*scriptnative_t)(
scriptfunction_t *self
);
struct scriptfunction_t {
struct scriptfunction_s {
const char *name; // not copied, it has to stay where it is as long as the function lives
const struct scriptfuncnode_t *node;
const struct scriptfuncnode_s *node;
const void *code;
const struct scriptexecutor_t *executor;
const struct scriptsource_t *source;
const struct scriptexecutor_s *executor;
const struct scriptsource_s *source;
scriptnative_t native;
void *data;
bool isAsync;
bool plain; // a compiled function that is not async, which the virtual machine calls without asking anything else
};
/**
@@ -40,5 +38,3 @@ struct scriptfunction_t {
* @returns The function value.
*/
scriptvalue_t scriptFunctionNative(scriptruntime_t *runtime, const char *name, scriptnative_t native, void *data);
#endif
+4 -5
View File
@@ -5,14 +5,13 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_VALUE_SCRIPTSTRING_H
#define SCRIPT_VALUE_SCRIPTSTRING_H
#pragma once
#include "core/scriptcore.h"
struct scriptstring_t {
// A string value: immutable, and not null terminated, its bytes follow it in
// the same heap block, which is why nothing holds one by value.
struct scriptstring_s {
uint16_t length;
char data[];
};
#endif
+2 -5
View File
@@ -5,17 +5,14 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_VALUE_SCRIPTSTRUCT_H
#define SCRIPT_VALUE_SCRIPTSTRUCT_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
struct scriptstruct_t {
struct scriptstruct_s {
uint8_t count;
scriptstring_t *keys[SCRIPT_STRUCT_KEYS_MAX];
scriptvalue_t values[SCRIPT_STRUCT_KEYS_MAX];
bool frozen; // a constant, which nothing changes
};
#endif
+8 -11
View File
@@ -5,14 +5,13 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_VALUE_SCRIPTVALUE_H
#define SCRIPT_VALUE_SCRIPTVALUE_H
#pragma once
#include "core/scriptcore.h"
typedef struct scriptruntime_t scriptruntime_t;
typedef struct scriptruntime_s scriptruntime_t;
struct scriptfuncnode_t;
struct scriptfuncnode_s;
typedef enum {
SCRIPT_VALUE_UNDEFINED,
@@ -26,15 +25,15 @@ typedef enum {
SCRIPT_VALUE_PROMISE
} scriptvaluetype_t;
typedef struct scriptstring_t scriptstring_t;
typedef struct scriptstring_s scriptstring_t;
typedef struct scriptarray_t scriptarray_t;
typedef struct scriptarray_s scriptarray_t;
typedef struct scriptstruct_t scriptstruct_t;
typedef struct scriptstruct_s scriptstruct_t;
typedef struct scriptfunction_t scriptfunction_t;
typedef struct scriptfunction_s scriptfunction_t;
typedef struct scriptpromise_t scriptpromise_t;
typedef struct scriptpromise_s scriptpromise_t;
typedef struct {
scriptvaluetype_t type;
@@ -67,5 +66,3 @@ typedef enum {
SCRIPT_OP_SHL,
SCRIPT_OP_SHR
} scriptoperator_t;
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_VALUE_SCRIPTVALUECOMPARE_H
#define SCRIPT_VALUE_SCRIPTVALUECOMPARE_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -37,5 +36,3 @@ bool scriptValuesEqual(const scriptvalue_t a, const scriptvalue_t b);
* @returns A short lowercase name.
*/
const char *scriptTypeName(const scriptvalue_t value);
#endif
@@ -5,8 +5,7 @@
* https://opensource.org/licenses/MIT
*/
#ifndef SCRIPT_VALUE_SCRIPTVALUEFORMAT_H
#define SCRIPT_VALUE_SCRIPTVALUEFORMAT_H
#pragma once
#include "core/scriptcore.h"
#include "value/scriptvalue.h"
@@ -31,5 +30,3 @@ void scriptValueFormat(scriptruntime_t *runtime, scriptbuf_t *buffer, const scri
* @returns A string value.
*/
scriptvalue_t scriptValueToString(scriptruntime_t *runtime, const scriptvalue_t value);
#endif
Loaded 100 of 152 files, more files were not shown because too many files have changed in this diff. Show more