diff --git a/src/dusk/script/core/array/scriptarraycopy.h b/src/dusk/script/core/array/scriptarraycopy.h index 30e11c2d..045b95f6 100644 --- a/src/dusk/script/core/array/scriptarraycopy.h +++ b/src/dusk/script/core/array/scriptarraycopy.h @@ -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 diff --git a/src/dusk/script/core/array/scriptarraydeep.h b/src/dusk/script/core/array/scriptarraydeep.h index afbd4611..220c23e2 100644 --- a/src/dusk/script/core/array/scriptarraydeep.h +++ b/src/dusk/script/core/array/scriptarraydeep.h @@ -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 diff --git a/src/dusk/script/core/array/scriptarraymodify.h b/src/dusk/script/core/array/scriptarraymodify.h index 7b1317f5..037f87fd 100644 --- a/src/dusk/script/core/array/scriptarraymodify.h +++ b/src/dusk/script/core/array/scriptarraymodify.h @@ -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 diff --git a/src/dusk/script/core/array/scriptarraynew.h b/src/dusk/script/core/array/scriptarraynew.h index 745e43fc..b02a388e 100644 --- a/src/dusk/script/core/array/scriptarraynew.h +++ b/src/dusk/script/core/array/scriptarraynew.h @@ -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 diff --git a/src/dusk/script/core/array/scriptarraysort.h b/src/dusk/script/core/array/scriptarraysort.h index 4df056b1..43321e88 100644 --- a/src/dusk/script/core/array/scriptarraysort.h +++ b/src/dusk/script/core/array/scriptarraysort.h @@ -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 diff --git a/src/dusk/script/core/builtin/array/scriptbarraybasic.h b/src/dusk/script/core/builtin/array/scriptbarraybasic.h index 5e5ab07e..497f5415 100644 --- a/src/dusk/script/core/builtin/array/scriptbarraybasic.h +++ b/src/dusk/script/core/builtin/array/scriptbarraybasic.h @@ -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 diff --git a/src/dusk/script/core/builtin/array/scriptbarrayfunc.h b/src/dusk/script/core/builtin/array/scriptbarrayfunc.h index aa65357c..469fcf92 100644 --- a/src/dusk/script/core/builtin/array/scriptbarrayfunc.h +++ b/src/dusk/script/core/builtin/array/scriptbarrayfunc.h @@ -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 diff --git a/src/dusk/script/core/builtin/array/scriptbarraymodify.h b/src/dusk/script/core/builtin/array/scriptbarraymodify.h index 1cda8b19..bdedc172 100644 --- a/src/dusk/script/core/builtin/array/scriptbarraymodify.h +++ b/src/dusk/script/core/builtin/array/scriptbarraymodify.h @@ -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 diff --git a/src/dusk/script/core/builtin/array/scriptbarrayorder.h b/src/dusk/script/core/builtin/array/scriptbarrayorder.h index 5aa9f4d5..79624f61 100644 --- a/src/dusk/script/core/builtin/array/scriptbarrayorder.h +++ b/src/dusk/script/core/builtin/array/scriptbarrayorder.h @@ -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 diff --git a/src/dusk/script/core/builtin/array/scriptbarraysearch.h b/src/dusk/script/core/builtin/array/scriptbarraysearch.h index a2b4f587..8143f05b 100644 --- a/src/dusk/script/core/builtin/array/scriptbarraysearch.h +++ b/src/dusk/script/core/builtin/array/scriptbarraysearch.h @@ -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 diff --git a/src/dusk/script/core/builtin/array/scriptbarrayslice.h b/src/dusk/script/core/builtin/array/scriptbarrayslice.h index 06a3a914..87fb9d06 100644 --- a/src/dusk/script/core/builtin/array/scriptbarrayslice.h +++ b/src/dusk/script/core/builtin/array/scriptbarrayslice.h @@ -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 diff --git a/src/dusk/script/core/builtin/core/scriptbconvert.h b/src/dusk/script/core/builtin/core/scriptbconvert.h index 0b3a9ee0..7d6d260f 100644 --- a/src/dusk/script/core/builtin/core/scriptbconvert.h +++ b/src/dusk/script/core/builtin/core/scriptbconvert.h @@ -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 diff --git a/src/dusk/script/core/builtin/core/scriptbinclude.h b/src/dusk/script/core/builtin/core/scriptbinclude.h index abed76ca..6b09ac74 100644 --- a/src/dusk/script/core/builtin/core/scriptbinclude.h +++ b/src/dusk/script/core/builtin/core/scriptbinclude.h @@ -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 diff --git a/src/dusk/script/core/builtin/core/scriptbprint.h b/src/dusk/script/core/builtin/core/scriptbprint.h index b5aa876a..f20c586b 100644 --- a/src/dusk/script/core/builtin/core/scriptbprint.h +++ b/src/dusk/script/core/builtin/core/scriptbprint.h @@ -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 diff --git a/src/dusk/script/core/builtin/core/scriptbpromise.h b/src/dusk/script/core/builtin/core/scriptbpromise.h index 55625259..409cbe7b 100644 --- a/src/dusk/script/core/builtin/core/scriptbpromise.h +++ b/src/dusk/script/core/builtin/core/scriptbpromise.h @@ -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 diff --git a/src/dusk/script/core/builtin/core/scriptbtype.h b/src/dusk/script/core/builtin/core/scriptbtype.h index a8caedc6..121be983 100644 --- a/src/dusk/script/core/builtin/core/scriptbtype.h +++ b/src/dusk/script/core/builtin/core/scriptbtype.h @@ -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 diff --git a/src/dusk/script/core/builtin/math/scriptbmathbasic.h b/src/dusk/script/core/builtin/math/scriptbmathbasic.h index 25fa48ae..c53ab2de 100644 --- a/src/dusk/script/core/builtin/math/scriptbmathbasic.h +++ b/src/dusk/script/core/builtin/math/scriptbmathbasic.h @@ -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 diff --git a/src/dusk/script/core/builtin/math/scriptbmathrandom.h b/src/dusk/script/core/builtin/math/scriptbmathrandom.h index 5dcd1b6c..994a35b4 100644 --- a/src/dusk/script/core/builtin/math/scriptbmathrandom.h +++ b/src/dusk/script/core/builtin/math/scriptbmathrandom.h @@ -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 diff --git a/src/dusk/script/core/builtin/math/scriptbmathround.h b/src/dusk/script/core/builtin/math/scriptbmathround.h index 1954d01d..70164fa3 100644 --- a/src/dusk/script/core/builtin/math/scriptbmathround.h +++ b/src/dusk/script/core/builtin/math/scriptbmathround.h @@ -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 diff --git a/src/dusk/script/core/builtin/math/scriptbmathtrig.h b/src/dusk/script/core/builtin/math/scriptbmathtrig.h index 3bd2f15d..340f5f9e 100644 --- a/src/dusk/script/core/builtin/math/scriptbmathtrig.h +++ b/src/dusk/script/core/builtin/math/scriptbmathtrig.h @@ -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 diff --git a/src/dusk/script/core/builtin/scriptarg.h b/src/dusk/script/core/builtin/scriptarg.h index a1b49852..a1062b6d 100644 --- a/src/dusk/script/core/builtin/scriptarg.h +++ b/src/dusk/script/core/builtin/scriptarg.h @@ -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 diff --git a/src/dusk/script/core/builtin/scriptbuiltin.h b/src/dusk/script/core/builtin/scriptbuiltin.h index 48009af9..62ba3168 100644 --- a/src/dusk/script/core/builtin/scriptbuiltin.h +++ b/src/dusk/script/core/builtin/scriptbuiltin.h @@ -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 diff --git a/src/dusk/script/core/builtin/scriptbuiltinregister.h b/src/dusk/script/core/builtin/scriptbuiltinregister.h index 6bd7bc78..923fe066 100644 --- a/src/dusk/script/core/builtin/scriptbuiltinregister.h +++ b/src/dusk/script/core/builtin/scriptbuiltinregister.h @@ -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 diff --git a/src/dusk/script/core/builtin/scriptnativesig.h b/src/dusk/script/core/builtin/scriptnativesig.h index 935887e4..bffa6172 100644 --- a/src/dusk/script/core/builtin/scriptnativesig.h +++ b/src/dusk/script/core/builtin/scriptnativesig.h @@ -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 diff --git a/src/dusk/script/core/builtin/string/scriptbstringcase.h b/src/dusk/script/core/builtin/string/scriptbstringcase.h index f64814a5..c4275969 100644 --- a/src/dusk/script/core/builtin/string/scriptbstringcase.h +++ b/src/dusk/script/core/builtin/string/scriptbstringcase.h @@ -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 diff --git a/src/dusk/script/core/builtin/string/scriptbstringsearch.h b/src/dusk/script/core/builtin/string/scriptbstringsearch.h index 026f7728..ef2b5b24 100644 --- a/src/dusk/script/core/builtin/string/scriptbstringsearch.h +++ b/src/dusk/script/core/builtin/string/scriptbstringsearch.h @@ -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 diff --git a/src/dusk/script/core/builtin/string/scriptbstringsplit.h b/src/dusk/script/core/builtin/string/scriptbstringsplit.h index aeb1815e..38a719e5 100644 --- a/src/dusk/script/core/builtin/string/scriptbstringsplit.h +++ b/src/dusk/script/core/builtin/string/scriptbstringsplit.h @@ -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 diff --git a/src/dusk/script/core/builtin/string/scriptbstringtrim.h b/src/dusk/script/core/builtin/string/scriptbstringtrim.h index 9a32a7d6..f801c6b4 100644 --- a/src/dusk/script/core/builtin/string/scriptbstringtrim.h +++ b/src/dusk/script/core/builtin/string/scriptbstringtrim.h @@ -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 diff --git a/src/dusk/script/core/bytecode/scriptbytecode.h b/src/dusk/script/core/bytecode/scriptbytecode.h index 3aab6d7a..bd4ca1fb 100644 --- a/src/dusk/script/core/bytecode/scriptbytecode.h +++ b/src/dusk/script/core/bytecode/scriptbytecode.h @@ -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 diff --git a/src/dusk/script/core/bytecode/scriptbytecodesize.h b/src/dusk/script/core/bytecode/scriptbytecodesize.h index 38e15f1a..49d5017b 100644 --- a/src/dusk/script/core/bytecode/scriptbytecodesize.h +++ b/src/dusk/script/core/bytecode/scriptbytecodesize.h @@ -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 diff --git a/src/dusk/script/core/bytecode/scriptvarint.h b/src/dusk/script/core/bytecode/scriptvarint.h index 3fc3040e..30a742d0 100644 --- a/src/dusk/script/core/bytecode/scriptvarint.h +++ b/src/dusk/script/core/bytecode/scriptvarint.h @@ -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 diff --git a/src/dusk/script/core/call/scriptcall.h b/src/dusk/script/core/call/scriptcall.h index a4706116..89cc169e 100644 --- a/src/dusk/script/core/call/scriptcall.h +++ b/src/dusk/script/core/call/scriptcall.h @@ -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 diff --git a/src/dusk/script/core/core/scriptcore.h b/src/dusk/script/core/core/scriptcore.h index 01743eda..f5a63c9f 100644 --- a/src/dusk/script/core/core/scriptcore.h +++ b/src/dusk/script/core/core/scriptcore.h @@ -5,8 +5,7 @@ * https://opensource.org/licenses/MIT */ -#ifndef SCRIPT_CORE_SCRIPTCORE_H -#define SCRIPT_CORE_SCRIPTCORE_H +#pragma once #include #include @@ -53,5 +52,3 @@ typedef struct { uint8_t frameCount; scriptframeinfo_t frames[SCRIPT_ERROR_FRAMES_MAX]; } scripterror_t; - -#endif diff --git a/src/dusk/script/core/core/scriptplatform.h b/src/dusk/script/core/core/scriptplatform.h index a880c868..00f43321 100644 --- a/src/dusk/script/core/core/scriptplatform.h +++ b/src/dusk/script/core/core/scriptplatform.h @@ -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 diff --git a/src/dusk/script/core/core/scriptsource.h b/src/dusk/script/core/core/scriptsource.h index 3dcc3fec..f87a41ab 100644 --- a/src/dusk/script/core/core/scriptsource.h +++ b/src/dusk/script/core/core/scriptsource.h @@ -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 diff --git a/src/dusk/script/core/coroutine/scriptcoroutine.h b/src/dusk/script/core/coroutine/scriptcoroutine.h index eb900f2a..c9d8908e 100644 --- a/src/dusk/script/core/coroutine/scriptcoroutine.h +++ b/src/dusk/script/core/coroutine/scriptcoroutine.h @@ -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; diff --git a/src/dusk/script/core/coroutine/scriptcoroutineready.h b/src/dusk/script/core/coroutine/scriptcoroutineready.h index 86635a4d..d35e373e 100644 --- a/src/dusk/script/core/coroutine/scriptcoroutineready.h +++ b/src/dusk/script/core/coroutine/scriptcoroutineready.h @@ -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 diff --git a/src/dusk/script/core/coroutine/scriptcoroutinespawn.h b/src/dusk/script/core/coroutine/scriptcoroutinespawn.h index ce64d27b..24efc4b1 100644 --- a/src/dusk/script/core/coroutine/scriptcoroutinespawn.h +++ b/src/dusk/script/core/coroutine/scriptcoroutinespawn.h @@ -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 diff --git a/src/dusk/script/core/coroutine/scriptframe.h b/src/dusk/script/core/coroutine/scriptframe.h index 7bfba3de..dc62285c 100644 --- a/src/dusk/script/core/coroutine/scriptframe.h +++ b/src/dusk/script/core/coroutine/scriptframe.h @@ -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 diff --git a/src/dusk/script/core/coroutine/scriptscheduler.h b/src/dusk/script/core/coroutine/scriptscheduler.h index aa5c8b5e..e8cf731e 100644 --- a/src/dusk/script/core/coroutine/scriptscheduler.h +++ b/src/dusk/script/core/coroutine/scriptscheduler.h @@ -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 diff --git a/src/dusk/script/core/coroutine/scriptsetposition.h b/src/dusk/script/core/coroutine/scriptsetposition.h index ca895acc..3f3fe4c1 100644 --- a/src/dusk/script/core/coroutine/scriptsetposition.h +++ b/src/dusk/script/core/coroutine/scriptsetposition.h @@ -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 diff --git a/src/dusk/script/core/coroutine/scriptstackcheck.h b/src/dusk/script/core/coroutine/scriptstackcheck.h index a58ea734..0240599f 100644 --- a/src/dusk/script/core/coroutine/scriptstackcheck.h +++ b/src/dusk/script/core/coroutine/scriptstackcheck.h @@ -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 diff --git a/src/dusk/script/core/duskscript.h b/src/dusk/script/core/duskscript.h index ac95b426..e1641843 100644 --- a/src/dusk/script/core/duskscript.h +++ b/src/dusk/script/core/duskscript.h @@ -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 diff --git a/src/dusk/script/core/duskscriptnative.h b/src/dusk/script/core/duskscriptnative.h index 130cd48b..917d5fb2 100644 --- a/src/dusk/script/core/duskscriptnative.h +++ b/src/dusk/script/core/duskscriptnative.h @@ -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 diff --git a/src/dusk/script/core/error/scriptraise.h b/src/dusk/script/core/error/scriptraise.h index 4c61399f..4e1d5274 100644 --- a/src/dusk/script/core/error/scriptraise.h +++ b/src/dusk/script/core/error/scriptraise.h @@ -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 diff --git a/src/dusk/script/core/error/scripttrace.h b/src/dusk/script/core/error/scripttrace.h index 9cf9a28e..dd1be017 100644 --- a/src/dusk/script/core/error/scripttrace.h +++ b/src/dusk/script/core/error/scripttrace.h @@ -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 diff --git a/src/dusk/script/core/executor/scriptexecutor.h b/src/dusk/script/core/executor/scriptexecutor.h index 7e809bad..557ca544 100644 --- a/src/dusk/script/core/executor/scriptexecutor.h +++ b/src/dusk/script/core/executor/scriptexecutor.h @@ -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 diff --git a/src/dusk/script/core/gc/scriptgc.h b/src/dusk/script/core/gc/scriptgc.h index 46ec5d21..5f3801c6 100644 --- a/src/dusk/script/core/gc/scriptgc.h +++ b/src/dusk/script/core/gc/scriptgc.h @@ -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 diff --git a/src/dusk/script/core/gc/scriptgccollect.h b/src/dusk/script/core/gc/scriptgccollect.h index 5120faa5..345208f6 100644 --- a/src/dusk/script/core/gc/scriptgccollect.h +++ b/src/dusk/script/core/gc/scriptgccollect.h @@ -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 diff --git a/src/dusk/script/core/gc/scriptgcmark.h b/src/dusk/script/core/gc/scriptgcmark.h index 1b8ba8eb..d21121fb 100644 --- a/src/dusk/script/core/gc/scriptgcmark.h +++ b/src/dusk/script/core/gc/scriptgcmark.h @@ -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 diff --git a/src/dusk/script/core/gc/scriptgcscan.h b/src/dusk/script/core/gc/scriptgcscan.h index 7d14340d..7ce71ff8 100644 --- a/src/dusk/script/core/gc/scriptgcscan.h +++ b/src/dusk/script/core/gc/scriptgcscan.h @@ -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 diff --git a/src/dusk/script/core/heap/scriptheap.h b/src/dusk/script/core/heap/scriptheap.h index a2b8f705..1f54d4e3 100644 --- a/src/dusk/script/core/heap/scriptheap.h +++ b/src/dusk/script/core/heap/scriptheap.h @@ -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 diff --git a/src/dusk/script/core/heap/scriptheapalloc.h b/src/dusk/script/core/heap/scriptheapalloc.h index e411ad9e..6150610e 100644 --- a/src/dusk/script/core/heap/scriptheapalloc.h +++ b/src/dusk/script/core/heap/scriptheapalloc.h @@ -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 diff --git a/src/dusk/script/core/heap/scriptheapblock.h b/src/dusk/script/core/heap/scriptheapblock.h index a4f04662..89cc8bf7 100644 --- a/src/dusk/script/core/heap/scriptheapblock.h +++ b/src/dusk/script/core/heap/scriptheapblock.h @@ -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 diff --git a/src/dusk/script/core/heap/scriptheapfree.h b/src/dusk/script/core/heap/scriptheapfree.h index a9702d38..ff887ae2 100644 --- a/src/dusk/script/core/heap/scriptheapfree.h +++ b/src/dusk/script/core/heap/scriptheapfree.h @@ -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 diff --git a/src/dusk/script/core/heap/scriptheapinit.h b/src/dusk/script/core/heap/scriptheapinit.h index f4e6e31a..ff99a889 100644 --- a/src/dusk/script/core/heap/scriptheapinit.h +++ b/src/dusk/script/core/heap/scriptheapinit.h @@ -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 diff --git a/src/dusk/script/core/heap/scriptheapsweep.h b/src/dusk/script/core/heap/scriptheapsweep.h index ffcdbbaf..68021898 100644 --- a/src/dusk/script/core/heap/scriptheapsweep.h +++ b/src/dusk/script/core/heap/scriptheapsweep.h @@ -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 diff --git a/src/dusk/script/core/number/scriptnumber.h b/src/dusk/script/core/number/scriptnumber.h index 711f7cdf..88423339 100644 --- a/src/dusk/script/core/number/scriptnumber.h +++ b/src/dusk/script/core/number/scriptnumber.h @@ -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 diff --git a/src/dusk/script/core/number/scriptnumberbinary.h b/src/dusk/script/core/number/scriptnumberbinary.h index ab5ede24..fc924cbe 100644 --- a/src/dusk/script/core/number/scriptnumberbinary.h +++ b/src/dusk/script/core/number/scriptnumberbinary.h @@ -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 diff --git a/src/dusk/script/core/number/scriptnumberformat.h b/src/dusk/script/core/number/scriptnumberformat.h index 76cf38f5..881ae379 100644 --- a/src/dusk/script/core/number/scriptnumberformat.h +++ b/src/dusk/script/core/number/scriptnumberformat.h @@ -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 diff --git a/src/dusk/script/core/number/scriptnumberparse.h b/src/dusk/script/core/number/scriptnumberparse.h index 7d7215d2..42bc89db 100644 --- a/src/dusk/script/core/number/scriptnumberparse.h +++ b/src/dusk/script/core/number/scriptnumberparse.h @@ -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 diff --git a/src/dusk/script/core/number/scriptnumberunary.h b/src/dusk/script/core/number/scriptnumberunary.h index e9e5153a..fb7384fc 100644 --- a/src/dusk/script/core/number/scriptnumberunary.h +++ b/src/dusk/script/core/number/scriptnumberunary.h @@ -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 diff --git a/src/dusk/script/core/ops/scriptbinaryop.h b/src/dusk/script/core/ops/scriptbinaryop.h index 8b85c224..519cb1fa 100644 --- a/src/dusk/script/core/ops/scriptbinaryop.h +++ b/src/dusk/script/core/ops/scriptbinaryop.h @@ -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 diff --git a/src/dusk/script/core/ops/scriptindex.h b/src/dusk/script/core/ops/scriptindex.h index ad889482..f9a01f2e 100644 --- a/src/dusk/script/core/ops/scriptindex.h +++ b/src/dusk/script/core/ops/scriptindex.h @@ -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 diff --git a/src/dusk/script/core/ops/scriptref.h b/src/dusk/script/core/ops/scriptref.h index 9eff13b6..90f9887e 100644 --- a/src/dusk/script/core/ops/scriptref.h +++ b/src/dusk/script/core/ops/scriptref.h @@ -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 diff --git a/src/dusk/script/core/promise/scriptpromise.h b/src/dusk/script/core/promise/scriptpromise.h index 345dbc91..a354e769 100644 --- a/src/dusk/script/core/promise/scriptpromise.h +++ b/src/dusk/script/core/promise/scriptpromise.h @@ -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 diff --git a/src/dusk/script/core/promise/scriptpromiseawait.h b/src/dusk/script/core/promise/scriptpromiseawait.h index 883fc3ef..c6c7745e 100644 --- a/src/dusk/script/core/promise/scriptpromiseawait.h +++ b/src/dusk/script/core/promise/scriptpromiseawait.h @@ -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 diff --git a/src/dusk/script/core/promise/scriptpromisecombine.h b/src/dusk/script/core/promise/scriptpromisecombine.h index 14ac1be3..01361161 100644 --- a/src/dusk/script/core/promise/scriptpromisecombine.h +++ b/src/dusk/script/core/promise/scriptpromisecombine.h @@ -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 diff --git a/src/dusk/script/core/promise/scriptpromisenew.h b/src/dusk/script/core/promise/scriptpromisenew.h index 65059bd4..5a27e57f 100644 --- a/src/dusk/script/core/promise/scriptpromisenew.h +++ b/src/dusk/script/core/promise/scriptpromisenew.h @@ -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 diff --git a/src/dusk/script/core/promise/scriptpromisesettle.h b/src/dusk/script/core/promise/scriptpromisesettle.h index 7dcaf8f0..ca0015fc 100644 --- a/src/dusk/script/core/promise/scriptpromisesettle.h +++ b/src/dusk/script/core/promise/scriptpromisesettle.h @@ -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 diff --git a/src/dusk/script/core/promise/scripttimer.h b/src/dusk/script/core/promise/scripttimer.h index 5016d10b..7f25a788 100644 --- a/src/dusk/script/core/promise/scripttimer.h +++ b/src/dusk/script/core/promise/scripttimer.h @@ -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 diff --git a/src/dusk/script/core/runtime/scriptruntime.h b/src/dusk/script/core/runtime/scriptruntime.h index 6c6099d1..97b2389d 100644 --- a/src/dusk/script/core/runtime/scriptruntime.h +++ b/src/dusk/script/core/runtime/scriptruntime.h @@ -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 diff --git a/src/dusk/script/core/runtime/scriptruntimeconfig.h b/src/dusk/script/core/runtime/scriptruntimeconfig.h index f0eeb487..d40f0f7e 100644 --- a/src/dusk/script/core/runtime/scriptruntimeconfig.h +++ b/src/dusk/script/core/runtime/scriptruntimeconfig.h @@ -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 diff --git a/src/dusk/script/core/runtime/scriptruntimecreate.h b/src/dusk/script/core/runtime/scriptruntimecreate.h index bff4c27a..d97acb22 100644 --- a/src/dusk/script/core/runtime/scriptruntimecreate.h +++ b/src/dusk/script/core/runtime/scriptruntimecreate.h @@ -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 diff --git a/src/dusk/script/core/runtime/scriptruntimeexecute.h b/src/dusk/script/core/runtime/scriptruntimeexecute.h index dcd39653..2d4098c3 100644 --- a/src/dusk/script/core/runtime/scriptruntimeexecute.h +++ b/src/dusk/script/core/runtime/scriptruntimeexecute.h @@ -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 diff --git a/src/dusk/script/core/runtime/scriptruntimeload.h b/src/dusk/script/core/runtime/scriptruntimeload.h index a25575fe..7ebb00a6 100644 --- a/src/dusk/script/core/runtime/scriptruntimeload.h +++ b/src/dusk/script/core/runtime/scriptruntimeload.h @@ -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 diff --git a/src/dusk/script/core/runtime/scriptruntimerun.h b/src/dusk/script/core/runtime/scriptruntimerun.h index f8cadc6f..86efb3b2 100644 --- a/src/dusk/script/core/runtime/scriptruntimerun.h +++ b/src/dusk/script/core/runtime/scriptruntimerun.h @@ -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 diff --git a/src/dusk/script/core/runtime/scriptruntimestate.h b/src/dusk/script/core/runtime/scriptruntimestate.h index 2d841405..5e824c4e 100644 --- a/src/dusk/script/core/runtime/scriptruntimestate.h +++ b/src/dusk/script/core/runtime/scriptruntimestate.h @@ -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 #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 diff --git a/src/dusk/script/core/scope/scriptscope.h b/src/dusk/script/core/scope/scriptscope.h index 67f9c581..1ebfff70 100644 --- a/src/dusk/script/core/scope/scriptscope.h +++ b/src/dusk/script/core/scope/scriptscope.h @@ -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 diff --git a/src/dusk/script/core/scope/scriptscopefind.h b/src/dusk/script/core/scope/scriptscopefind.h index 858267bf..15f3782b 100644 --- a/src/dusk/script/core/scope/scriptscopefind.h +++ b/src/dusk/script/core/scope/scriptscopefind.h @@ -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 diff --git a/src/dusk/script/core/scope/scriptscopenew.h b/src/dusk/script/core/scope/scriptscopenew.h index 31f74887..18e09c6b 100644 --- a/src/dusk/script/core/scope/scriptscopenew.h +++ b/src/dusk/script/core/scope/scriptscopenew.h @@ -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 diff --git a/src/dusk/script/core/scope/scriptscopeset.h b/src/dusk/script/core/scope/scriptscopeset.h index ca2626b1..8e7845eb 100644 --- a/src/dusk/script/core/scope/scriptscopeset.h +++ b/src/dusk/script/core/scope/scriptscopeset.h @@ -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 diff --git a/src/dusk/script/core/scripttypes.h b/src/dusk/script/core/scripttypes.h index db6fbc9b..a229be38 100644 --- a/src/dusk/script/core/scripttypes.h +++ b/src/dusk/script/core/scripttypes.h @@ -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 diff --git a/src/dusk/script/core/string/scriptbuf.h b/src/dusk/script/core/string/scriptbuf.h index 6c98352d..0247de01 100644 --- a/src/dusk/script/core/string/scriptbuf.h +++ b/src/dusk/script/core/string/scriptbuf.h @@ -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 diff --git a/src/dusk/script/core/string/scriptstringchar.h b/src/dusk/script/core/string/scriptstringchar.h index 397ddbde..d2d8107e 100644 --- a/src/dusk/script/core/string/scriptstringchar.h +++ b/src/dusk/script/core/string/scriptstringchar.h @@ -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 diff --git a/src/dusk/script/core/string/scriptstringconcat.h b/src/dusk/script/core/string/scriptstringconcat.h index 557d7a51..b4fec2b1 100644 --- a/src/dusk/script/core/string/scriptstringconcat.h +++ b/src/dusk/script/core/string/scriptstringconcat.h @@ -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 diff --git a/src/dusk/script/core/string/scriptstringnew.h b/src/dusk/script/core/string/scriptstringnew.h index 1b9c8488..4878fe43 100644 --- a/src/dusk/script/core/string/scriptstringnew.h +++ b/src/dusk/script/core/string/scriptstringnew.h @@ -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 diff --git a/src/dusk/script/core/string/scriptstringreject.h b/src/dusk/script/core/string/scriptstringreject.h index 299f2c99..50016136 100644 --- a/src/dusk/script/core/string/scriptstringreject.h +++ b/src/dusk/script/core/string/scriptstringreject.h @@ -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 diff --git a/src/dusk/script/core/string/scriptstringsearch.h b/src/dusk/script/core/string/scriptstringsearch.h index 500a2dcc..42634770 100644 --- a/src/dusk/script/core/string/scriptstringsearch.h +++ b/src/dusk/script/core/string/scriptstringsearch.h @@ -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 diff --git a/src/dusk/script/core/struct/scriptstruct.h b/src/dusk/script/core/struct/scriptstruct.h index 95e3e0f5..c1397cd9 100644 --- a/src/dusk/script/core/struct/scriptstruct.h +++ b/src/dusk/script/core/struct/scriptstruct.h @@ -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 diff --git a/src/dusk/script/core/text/scripttext.h b/src/dusk/script/core/text/scripttext.h index fe7e0d12..8ee14185 100644 --- a/src/dusk/script/core/text/scripttext.h +++ b/src/dusk/script/core/text/scripttext.h @@ -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 @@ -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 diff --git a/src/dusk/script/core/token/scripttoken.h b/src/dusk/script/core/token/scripttoken.h index 27367105..61124296 100644 --- a/src/dusk/script/core/token/scripttoken.h +++ b/src/dusk/script/core/token/scripttoken.h @@ -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 diff --git a/src/dusk/script/core/value/scriptalloc.h b/src/dusk/script/core/value/scriptalloc.h index 7a694d1f..97d13cae 100644 --- a/src/dusk/script/core/value/scriptalloc.h +++ b/src/dusk/script/core/value/scriptalloc.h @@ -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 diff --git a/src/dusk/script/core/value/scriptarray.h b/src/dusk/script/core/value/scriptarray.h index 58d55b71..a40ec51e 100644 --- a/src/dusk/script/core/value/scriptarray.h +++ b/src/dusk/script/core/value/scriptarray.h @@ -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 diff --git a/src/dusk/script/core/value/scriptfunction.h b/src/dusk/script/core/value/scriptfunction.h index c6ba50f6..dadeac64 100644 --- a/src/dusk/script/core/value/scriptfunction.h +++ b/src/dusk/script/core/value/scriptfunction.h @@ -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 diff --git a/src/dusk/script/core/value/scriptstring.h b/src/dusk/script/core/value/scriptstring.h index 99b1fcad..4442f24e 100644 --- a/src/dusk/script/core/value/scriptstring.h +++ b/src/dusk/script/core/value/scriptstring.h @@ -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 diff --git a/src/dusk/script/core/value/scriptstruct.h b/src/dusk/script/core/value/scriptstruct.h index 58e424f8..6371ae4f 100644 --- a/src/dusk/script/core/value/scriptstruct.h +++ b/src/dusk/script/core/value/scriptstruct.h @@ -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 diff --git a/src/dusk/script/core/value/scriptvalue.h b/src/dusk/script/core/value/scriptvalue.h index 74c471fb..69fbc606 100644 --- a/src/dusk/script/core/value/scriptvalue.h +++ b/src/dusk/script/core/value/scriptvalue.h @@ -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 diff --git a/src/dusk/script/core/value/scriptvaluecompare.h b/src/dusk/script/core/value/scriptvaluecompare.h index 821f3cdc..14027fbf 100644 --- a/src/dusk/script/core/value/scriptvaluecompare.h +++ b/src/dusk/script/core/value/scriptvaluecompare.h @@ -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 diff --git a/src/dusk/script/core/value/scriptvalueformat.h b/src/dusk/script/core/value/scriptvalueformat.h index 9dac4cf0..d5641e8c 100644 --- a/src/dusk/script/core/value/scriptvalueformat.h +++ b/src/dusk/script/core/value/scriptvalueformat.h @@ -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 diff --git a/src/dusk/script/core/value/scriptvalueprimitive.h b/src/dusk/script/core/value/scriptvalueprimitive.h index 4c743c45..af3ce01d 100644 --- a/src/dusk/script/core/value/scriptvalueprimitive.h +++ b/src/dusk/script/core/value/scriptvalueprimitive.h @@ -5,8 +5,7 @@ * https://opensource.org/licenses/MIT */ -#ifndef SCRIPT_VALUE_SCRIPTVALUEPRIMITIVE_H -#define SCRIPT_VALUE_SCRIPTVALUEPRIMITIVE_H +#pragma once #include "core/scriptcore.h" #include "value/scriptvalue.h" @@ -48,5 +47,3 @@ scriptvalue_t scriptNumber(const float number); * @returns True for a number. */ bool scriptIsNumber(const scriptvalue_t value); - -#endif diff --git a/src/dusk/script/vm/duskscriptvm.h b/src/dusk/script/vm/duskscriptvm.h index 4cef1139..5105cac1 100644 --- a/src/dusk/script/vm/duskscriptvm.h +++ b/src/dusk/script/vm/duskscriptvm.h @@ -5,13 +5,10 @@ * https://opensource.org/licenses/MIT */ -#ifndef SCRIPT_DUSKSCRIPTVM_H -#define SCRIPT_DUSKSCRIPTVM_H +#pragma once // The bytecode virtual machine, it runs compiled scripts. #include "duskscript.h" #include "image/scriptvmattach.h" #include "image/scriptvmrun.h" - -#endif diff --git a/src/dusk/script/vm/execute/scriptvmcode.h b/src/dusk/script/vm/execute/scriptvmcode.h index c4dd14a4..667e2a0f 100644 --- a/src/dusk/script/vm/execute/scriptvmcode.h +++ b/src/dusk/script/vm/execute/scriptvmcode.h @@ -5,8 +5,7 @@ * https://opensource.org/licenses/MIT */ -#ifndef SCRIPT_EXECUTE_SCRIPTVMCODE_H -#define SCRIPT_EXECUTE_SCRIPTVMCODE_H +#pragma once #include "scriptvmtypes.h" @@ -56,5 +55,3 @@ scriptvalue_t *scriptVmOverflow(scriptvmframe_t *frame); * @returns Nothing, it is a fatal error. */ scriptvalue_t *scriptVmUnderflow(scriptvmframe_t *frame); - -#endif diff --git a/src/dusk/script/vm/execute/scriptvmfunction.c b/src/dusk/script/vm/execute/scriptvmfunction.c index 2659e616..886bee4d 100644 --- a/src/dusk/script/vm/execute/scriptvmfunction.c +++ b/src/dusk/script/vm/execute/scriptvmfunction.c @@ -17,10 +17,7 @@ #include "execute/scriptvmloop.h" #include "execute/scriptvmlocate.h" #include "execute/scriptvmcode.h" -#include "execute/scriptvmcode.h" -#include "execute/scriptvmcode.h" #include -#include "execute/scriptvmcode.h" #include "value/scriptfunction.h" const scriptexecutor_t scriptVmExecutor = { .run = scriptVmRun, .locate = scriptVmLocate }; @@ -37,8 +34,7 @@ scriptvalue_t scriptFunctionFromCode(scriptruntime_t *runtime, const scriptvmima function->code = code; function->source = image->source; function->executor = &scriptVmExecutor; - function->isAsync = code->isAsync; - function->plain = !code->isAsync; + function->isAsync = (code->flags & SCRIPT_VM_FUNCTION_FLAG_ASYNC) != 0; value.as.function = function; return value; } diff --git a/src/dusk/script/vm/execute/scriptvmfunction.h b/src/dusk/script/vm/execute/scriptvmfunction.h index 600f891f..28aa48a3 100644 --- a/src/dusk/script/vm/execute/scriptvmfunction.h +++ b/src/dusk/script/vm/execute/scriptvmfunction.h @@ -5,8 +5,7 @@ * https://opensource.org/licenses/MIT */ -#ifndef SCRIPT_EXECUTE_SCRIPTVMFUNCTION_H -#define SCRIPT_EXECUTE_SCRIPTVMFUNCTION_H +#pragma once #include "scriptvmtypes.h" @@ -51,5 +50,3 @@ void scriptVmRun(scriptruntime_t *runtime, scriptfunction_t *function, const scr * @param index The parameter that is missing. */ void scriptVmRunRaise(scriptruntime_t *runtime, scriptvmframe_t *frame, const uint16_t reason, const uint16_t index); - -#endif diff --git a/src/dusk/script/vm/execute/scriptvmtable.h b/src/dusk/script/vm/execute/scriptvmtable.h index d99d0937..7cf67005 100644 --- a/src/dusk/script/vm/execute/scriptvmtable.h +++ b/src/dusk/script/vm/execute/scriptvmtable.h @@ -5,8 +5,7 @@ * https://opensource.org/licenses/MIT */ -#ifndef SCRIPT_EXECUTE_SCRIPTVMTABLE_H -#define SCRIPT_EXECUTE_SCRIPTVMTABLE_H +#pragma once #include "scriptvmtypes.h" @@ -14,5 +13,3 @@ * What runs each instruction, indexed by the instruction. */ extern const scriptvmhandler_t scriptVmHandlers[SCRIPT_BC_COUNT]; - -#endif diff --git a/src/dusk/script/vm/image/scriptvmattach.h b/src/dusk/script/vm/image/scriptvmattach.h index c0b5b3d9..7d1ce091 100644 --- a/src/dusk/script/vm/image/scriptvmattach.h +++ b/src/dusk/script/vm/image/scriptvmattach.h @@ -5,8 +5,7 @@ * https://opensource.org/licenses/MIT */ -#ifndef SCRIPT_IMAGE_SCRIPTVMATTACH_H -#define SCRIPT_IMAGE_SCRIPTVMATTACH_H +#pragma once #include "scriptvmtypes.h" @@ -16,5 +15,3 @@ * @param runtime The runtime. */ void scriptVmAttach(scriptruntime_t *runtime); - -#endif diff --git a/src/dusk/script/vm/image/scriptvmlink.h b/src/dusk/script/vm/image/scriptvmlink.h index 90d30da9..8a22d0e9 100644 --- a/src/dusk/script/vm/image/scriptvmlink.h +++ b/src/dusk/script/vm/image/scriptvmlink.h @@ -5,8 +5,7 @@ * https://opensource.org/licenses/MIT */ -#ifndef SCRIPT_IMAGE_SCRIPTVMLINK_H -#define SCRIPT_IMAGE_SCRIPTVMLINK_H +#pragma once #include "scriptvmtypes.h" @@ -23,5 +22,3 @@ * @param isRoot True for the main script, false for an include. */ void scriptVmLink(scriptruntime_t *runtime, scriptvmimage_t *image, const bool isRoot); - -#endif diff --git a/src/dusk/script/vm/image/scriptvmload.c b/src/dusk/script/vm/image/scriptvmload.c index 25ca2bf8..6fe7e9a5 100644 --- a/src/dusk/script/vm/image/scriptvmload.c +++ b/src/dusk/script/vm/image/scriptvmload.c @@ -55,10 +55,10 @@ scriptvalue_t scriptVmLoadBinary(scriptruntime_t *runtime, const scriptsource_t image->functions = scriptAlloc(runtime, sizeof(scriptvmfunction_t) * image->functionCount); for(i = 0; i < image->functionCount; i++) { scriptvmfunction_t *function = &image->functions[i]; - uint8_t flags = scriptVmReaderU8(&reader); + uint8_t diskFlags = scriptVmReaderU8(&reader); scriptCopyText(function->name, sizeof(function->name), ""); function->image = image; - function->isAsync = (flags & SCRIPT_BINARY_FLAG_ASYNC) != 0; + function->flags = (diskFlags & SCRIPT_BINARY_FLAG_ASYNC) ? SCRIPT_VM_FUNCTION_FLAG_ASYNC : 0; function->paramCount = scriptVmReaderU8(&reader); function->localCount = scriptVmReaderU8(&reader); function->stackMax = scriptVmReaderU8(&reader); @@ -81,9 +81,9 @@ scriptvalue_t scriptVmLoadBinary(scriptruntime_t *runtime, const scriptsource_t scriptVmMapLoad(runtime, image, source->path); // Whether it is the main script or an include, and whether it is async, is up to whoever runs it - image->functions[0].isScript = true; -image->functions[0].isRoot = isRoot; - image->functions[0].isAsync = rootAsync; + image->functions[0].flags = SCRIPT_VM_FUNCTION_FLAG_SCRIPT + | (isRoot ? SCRIPT_VM_FUNCTION_FLAG_ROOT : 0) + | (rootAsync ? SCRIPT_VM_FUNCTION_FLAG_ASYNC : 0); scriptCopyText(image->functions[0].name, sizeof(image->functions[0].name), isRoot ? "