From 04012a9cb62d388c7ef2eec51c71e173a646cb26 Mon Sep 17 00:00:00 2001 From: Stephanie Gawroriski Date: Fri, 8 Dec 2023 19:53:55 +0000 Subject: [PATCH] Move the whole bunch of nvm functions into their own header. --- nanocoat/CMakeLists.txt | 5 + nanocoat/include/sjme/nvm.h | 264 ------------------------- nanocoat/include/sjme/nvmFunc.h | 307 ++++++++++++++++++++++++++++++ nanocoat/include/sjme/vmConfig.h | 20 +- nanocoat/tests/src/tac.c | 3 +- nanocoat/tests/testNvmLocalPopDouble.c | 4 +- nanocoat/tests/testNvmLocalPopFloat.c | 4 +- nanocoat/tests/testNvmLocalPopInteger.c | 4 +- nanocoat/tests/testNvmLocalPopLong.c | 4 +- nanocoat/tests/testNvmLocalPopReference.c | 5 +- 10 files changed, 337 insertions(+), 283 deletions(-) create mode 100644 nanocoat/include/sjme/nvmFunc.h diff --git a/nanocoat/CMakeLists.txt b/nanocoat/CMakeLists.txt index f589cd2462..4b6603b620 100644 --- a/nanocoat/CMakeLists.txt +++ b/nanocoat/CMakeLists.txt @@ -54,6 +54,11 @@ set(CMAKE_C_STANDARD_REQUIRED True) # Assets and otherwise, such as icons, etc. squirreljme_include("assets.cmake") +# Turn some warnings into errors +if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) + add_compile_options("-Werror=implicit-function-declaration") +endif() + # Declare Version add_compile_definitions( SQUIRRELJME_VERSION_TRIM=${SQUIRRELJME_VERSION}) diff --git a/nanocoat/include/sjme/nvm.h b/nanocoat/include/sjme/nvm.h index a512c2ebdf..e40e5394ca 100644 --- a/nanocoat/include/sjme/nvm.h +++ b/nanocoat/include/sjme/nvm.h @@ -1155,270 +1155,6 @@ typedef enum sjme_errorCode SJME_NUM_ERROR_CODES = -22 } sjme_errorCode; -sjme_jboolean sjme_nvm_arrayLength( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInNullable sjme_jobject arrayInstance, - sjme_attrOutNotNull sjme_jint* outLen) - sjme_attrCheckReturn; - -sjme_tempIndex sjme_nvm_arrayLoadIntoTemp( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInValue sjme_basicTypeId primitiveType, - sjme_attrInNullable sjme_jobject arrayInstance, - sjme_attrInValue sjme_attrInPositive sjme_jint index) - sjme_attrOutNegativeOnePositive sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_arrayStore( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInValue sjme_basicTypeId primitiveType, - sjme_attrInNullable sjme_jobject arrayInstance, - sjme_attrInValue sjme_attrInPositive sjme_jint index, - sjme_attrInNotNull sjme_any* value) - sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_checkCast( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInNullable sjme_jobject instance, - sjme_attrInNotNull sjme_dynamic_linkage_data_classObject* type) - sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_countReferenceDown( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInNullable sjme_jobject instance) - sjme_attrCheckReturn; - -sjme_tempIndex sjme_nvm_fieldGetToTemp( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInNullable sjme_jobject instance, - sjme_attrInNotNull sjme_dynamic_linkage_data_fieldAccess* field) - sjme_attrOutNegativeOnePositive sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_fieldPut( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInNullable sjme_jobject instance, - sjme_attrInNotNull sjme_dynamic_linkage_data_fieldAccess* field, - sjme_attrInNotNull sjme_any* value) - sjme_attrCheckReturn; - -/** - * Garbage collects an object. - * - * @param frame The frame this is collecting in. - * @param instance The instance to be garbage collected. - * @return Returns @c SJME_JNI_TRUE on success. - * @since 2023/11/17 - */ -sjme_jboolean sjme_nvm_gcObject( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInNullable sjme_jobject instance) - sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_invoke( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInNotNull sjme_dynamic_linkage_data_invokeNormal* method) - sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_localPopDouble( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInValue sjme_attrInPositive sjme_jint localIndex) - sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_localPopFloat( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInValue sjme_attrInPositive sjme_jint localIndex) - sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_localPopInteger( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInValue sjme_attrInPositive sjme_jint localIndex) - sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_localPopLong( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInValue sjme_attrInPositive sjme_jint localIndex) - sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_localPopReference( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInValue sjme_attrInPositive sjme_jint localIndex) - sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_localPushDouble( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInValue sjme_attrInPositive sjme_jint index) - sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_localPushFloat( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInValue sjme_attrInPositive sjme_jint index) - sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_localPushInteger( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInValue sjme_attrInPositive sjme_jint index) - sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_localPushLong( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInValue sjme_attrInPositive sjme_jint index) - sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_localPushReference( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInValue sjme_attrInPositive sjme_jint index) - sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_localReadInteger( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInValue sjme_attrInPositive sjme_jint index, - sjme_attrOutNotNull sjme_jint* outValue) - sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_localWriteInteger( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInValue sjme_attrInPositive sjme_jint index, - sjme_attrInValue sjme_jint value) - sjme_attrCheckReturn; - -sjme_tempIndex sjme_nvm_lookupClassObjectIntoTemp( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInNotNull sjme_dynamic_linkage_data_classObject* classLinkage) - sjme_attrOutNegativeOnePositive sjme_attrCheckReturn; - -sjme_tempIndex sjme_nvm_lookupStringIntoTemp( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInNotNull sjme_dynamic_linkage_data_stringObject* stringLinkage) - sjme_attrOutNegativeOnePositive sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_monitor( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInNullable sjme_jobject instance, - sjme_attrInValue sjme_jboolean isEnter) - sjme_attrCheckReturn; - -sjme_tempIndex sjme_nvm_newArrayIntoTemp( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInNotNull sjme_dynamic_linkage_data_classObject* componentType, - sjme_attrInValue sjme_attrInPositive sjme_jint length) - sjme_attrOutNegativeOnePositive sjme_attrCheckReturn; - -sjme_tempIndex sjme_nvm_newInstanceIntoTemp( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInNotNull sjme_dynamic_linkage_data_classObject* linkage) - sjme_attrOutNegativeOnePositive sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_returnFromMethod( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInNotNull sjme_any* value) - sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_stackPopAny( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrOutNotNull sjme_any* output) - sjme_attrCheckReturn; - -sjme_tempIndex sjme_nvm_stackPopAnyToTemp( - sjme_attrInNotNull sjme_nvm_frame* frame) - sjme_attrOutNegativeOnePositive sjme_attrCheckReturn; - -sjme_jint sjme_nvm_stackPopInteger( - sjme_attrInNotNull sjme_nvm_frame* frame) - sjme_attrOutNegativeOnePositive; - -sjme_jobject sjme_nvm_stackPopReference( - sjme_attrInNotNull sjme_nvm_frame* frame) - sjme_attrOutNullable; - -sjme_jboolean sjme_nvm_stackPopReferenceThenThrow( - sjme_attrInNotNull sjme_nvm_frame* frame) - sjme_attrCheckReturn; - -sjme_tempIndex sjme_nvm_stackPopReferenceToTemp( - sjme_attrInNotNull sjme_nvm_frame* frame) - sjme_attrOutNegativeOnePositive sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_stackPushAny( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInNotNull sjme_any* input) - sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_stackPushAnyFromTemp( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInPositive sjme_tempIndex input) - sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_stackPushDoubleParts( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInValue sjme_jint hi, - sjme_attrInValue sjme_jint lo) - sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_stackPushFloatRaw( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInValue sjme_jint rawValue) - sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_stackPushInteger( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInValue sjme_jint value) - sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_stackPushIntegerIsInstanceOf( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInNullable sjme_jobject instance, - sjme_attrInNotNull sjme_dynamic_linkage_data_classObject* type) - sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_stackPushLongParts( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInValue sjme_jint hi, - sjme_attrInValue sjme_jint lo) - sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_stackPushReference( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInNullable sjme_jobject instance) - sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_stackPushReferenceFromTemp( - sjme_attrInNotNull sjme_nvm_frame* frame, - sjme_attrInPositive sjme_tempIndex tempIndex) - sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_tempDiscard( - sjme_attrInNotNull sjme_nvm_frame* frame) - sjme_attrCheckReturn; - -sjme_jboolean sjme_nvm_throwExecute( - sjme_attrInNotNull sjme_nvm_frame* frame) - sjme_attrCheckReturn; - -/** - * Returns the top-most frame in the thread. - * - * @param inThread The thread to get the top frame from. - * @param outFrame The top most frame. - * @return Returns @c SJME_JNI_TRUE on success where the thread is valid and it - * has at least one frame. - * @since 2023/11/11 - */ -sjme_jboolean sjme_nvm_topFrame( - sjme_attrInNotNull sjme_nvm_thread* inThread, - sjme_attrOutNotNull sjme_nvm_frame* outFrame) - sjme_attrCheckReturn; - -/** - * Ticks the virtual machine. - * - * @param state The state to tick, @c -1 means to tick forever. - * @param maxTics The number of ticks to execute before returning. - * @return Returns @c SJME_JNI_TRUE if the machine is still running. - * @since 2023/07/27 - */ -sjme_jboolean sjme_nvm_tick(sjme_attrInNotNull sjme_nvm_state* state, - sjme_attrInValue sjme_attrInPositive sjme_jint maxTics) - sjme_attrCheckReturn; - /*--------------------------------------------------------------------------*/ /* Anti-C++. */ diff --git a/nanocoat/include/sjme/nvmFunc.h b/nanocoat/include/sjme/nvmFunc.h new file mode 100644 index 0000000000..dc422c2fe1 --- /dev/null +++ b/nanocoat/include/sjme/nvmFunc.h @@ -0,0 +1,307 @@ +/* -*- Mode: C; indent-tabs-mode: t; tab-width: 4 -*- +// --------------------------------------------------------------------------- +// SquirrelJME +// Copyright (C) Stephanie Gawroriski +// --------------------------------------------------------------------------- +// SquirrelJME is under the Mozilla Public License Version 2.0. +// See license.mkd for licensing and copyright information. +// -------------------------------------------------------------------------*/ + +/** + * NanoCoat Virtual Machine functions. + * + * @since 2023/12/08 + */ + +#ifndef SQUIRRELJME_NVMFUNC_H +#define SQUIRRELJME_NVMFUNC_H + +#include "sjme/nvm.h" + +/* Anti-C++. */ +#ifdef __cplusplus + #ifndef SJME_CXX_IS_EXTERNED + #define SJME_CXX_IS_EXTERNED + #define SJME_CXX_SQUIRRELJME_NVMFUNC_H +extern "C" { + #endif /* #ifdef SJME_CXX_IS_EXTERNED */ +#endif /* #ifdef __cplusplus */ + +/*--------------------------------------------------------------------------*/ + +sjme_jboolean sjme_nvm_arrayLength( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInNullable sjme_jobject arrayInstance, + sjme_attrOutNotNull sjme_jint* outLen) + sjme_attrCheckReturn; + +sjme_tempIndex sjme_nvm_arrayLoadIntoTemp( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInValue sjme_basicTypeId primitiveType, + sjme_attrInNullable sjme_jobject arrayInstance, + sjme_attrInValue sjme_attrInPositive sjme_jint index) + sjme_attrOutNegativeOnePositive sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_arrayStore( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInValue sjme_basicTypeId primitiveType, + sjme_attrInNullable sjme_jobject arrayInstance, + sjme_attrInValue sjme_attrInPositive sjme_jint index, + sjme_attrInNotNull sjme_any* value) + sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_checkCast( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInNullable sjme_jobject instance, + sjme_attrInNotNull sjme_dynamic_linkage_data_classObject* type) + sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_countReferenceDown( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInNullable sjme_jobject instance) + sjme_attrCheckReturn; + +sjme_tempIndex sjme_nvm_fieldGetToTemp( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInNullable sjme_jobject instance, + sjme_attrInNotNull sjme_dynamic_linkage_data_fieldAccess* field) + sjme_attrOutNegativeOnePositive sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_fieldPut( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInNullable sjme_jobject instance, + sjme_attrInNotNull sjme_dynamic_linkage_data_fieldAccess* field, + sjme_attrInNotNull sjme_any* value) + sjme_attrCheckReturn; + +/** + * Garbage collects an object. + * + * @param frame The frame this is collecting in. + * @param instance The instance to be garbage collected. + * @return Returns @c SJME_JNI_TRUE on success. + * @since 2023/11/17 + */ +sjme_jboolean sjme_nvm_gcObject( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInNullable sjme_jobject instance) + sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_invoke( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInNotNull sjme_dynamic_linkage_data_invokeNormal* method) + sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_localPopDouble( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInValue sjme_attrInPositive sjme_jint localIndex) + sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_localPopFloat( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInValue sjme_attrInPositive sjme_jint localIndex) + sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_localPopInteger( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInValue sjme_attrInPositive sjme_jint localIndex) + sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_localPopLong( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInValue sjme_attrInPositive sjme_jint localIndex) + sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_localPopReference( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInValue sjme_attrInPositive sjme_jint localIndex) + sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_localPushDouble( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInValue sjme_attrInPositive sjme_jint index) + sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_localPushFloat( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInValue sjme_attrInPositive sjme_jint index) + sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_localPushInteger( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInValue sjme_attrInPositive sjme_jint index) + sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_localPushLong( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInValue sjme_attrInPositive sjme_jint index) + sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_localPushReference( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInValue sjme_attrInPositive sjme_jint index) + sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_localReadInteger( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInValue sjme_attrInPositive sjme_jint index, + sjme_attrOutNotNull sjme_jint* outValue) + sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_localWriteInteger( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInValue sjme_attrInPositive sjme_jint index, + sjme_attrInValue sjme_jint value) + sjme_attrCheckReturn; + +sjme_tempIndex sjme_nvm_lookupClassObjectIntoTemp( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInNotNull sjme_dynamic_linkage_data_classObject* classLinkage) + sjme_attrOutNegativeOnePositive sjme_attrCheckReturn; + +sjme_tempIndex sjme_nvm_lookupStringIntoTemp( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInNotNull sjme_dynamic_linkage_data_stringObject* stringLinkage) + sjme_attrOutNegativeOnePositive sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_monitor( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInNullable sjme_jobject instance, + sjme_attrInValue sjme_jboolean isEnter) + sjme_attrCheckReturn; + +sjme_tempIndex sjme_nvm_newArrayIntoTemp( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInNotNull sjme_dynamic_linkage_data_classObject* componentType, + sjme_attrInValue sjme_attrInPositive sjme_jint length) + sjme_attrOutNegativeOnePositive sjme_attrCheckReturn; + +sjme_tempIndex sjme_nvm_newInstanceIntoTemp( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInNotNull sjme_dynamic_linkage_data_classObject* linkage) + sjme_attrOutNegativeOnePositive sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_returnFromMethod( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInNotNull sjme_any* value) + sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_stackPopAny( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrOutNotNull sjme_any* output) + sjme_attrCheckReturn; + +sjme_tempIndex sjme_nvm_stackPopAnyToTemp( + sjme_attrInNotNull sjme_nvm_frame* frame) + sjme_attrOutNegativeOnePositive sjme_attrCheckReturn; + +sjme_jint sjme_nvm_stackPopInteger( + sjme_attrInNotNull sjme_nvm_frame* frame) + sjme_attrOutNegativeOnePositive; + +sjme_jobject sjme_nvm_stackPopReference( + sjme_attrInNotNull sjme_nvm_frame* frame) + sjme_attrOutNullable; + +sjme_jboolean sjme_nvm_stackPopReferenceThenThrow( + sjme_attrInNotNull sjme_nvm_frame* frame) + sjme_attrCheckReturn; + +sjme_tempIndex sjme_nvm_stackPopReferenceToTemp( + sjme_attrInNotNull sjme_nvm_frame* frame) + sjme_attrOutNegativeOnePositive sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_stackPushAny( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInNotNull sjme_any* input) + sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_stackPushAnyFromTemp( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInPositive sjme_tempIndex input) + sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_stackPushDoubleParts( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInValue sjme_jint hi, + sjme_attrInValue sjme_jint lo) + sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_stackPushFloatRaw( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInValue sjme_jint rawValue) + sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_stackPushInteger( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInValue sjme_jint value) + sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_stackPushIntegerIsInstanceOf( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInNullable sjme_jobject instance, + sjme_attrInNotNull sjme_dynamic_linkage_data_classObject* type) + sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_stackPushLongParts( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInValue sjme_jint hi, + sjme_attrInValue sjme_jint lo) + sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_stackPushReference( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInNullable sjme_jobject instance) + sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_stackPushReferenceFromTemp( + sjme_attrInNotNull sjme_nvm_frame* frame, + sjme_attrInPositive sjme_tempIndex tempIndex) + sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_tempDiscard( + sjme_attrInNotNull sjme_nvm_frame* frame) + sjme_attrCheckReturn; + +sjme_jboolean sjme_nvm_throwExecute( + sjme_attrInNotNull sjme_nvm_frame* frame) + sjme_attrCheckReturn; + +/** + * Returns the top-most frame in the thread. + * + * @param inThread The thread to get the top frame from. + * @param outFrame The top most frame. + * @return Returns @c SJME_JNI_TRUE on success where the thread is valid and it + * has at least one frame. + * @since 2023/11/11 + */ +sjme_jboolean sjme_nvm_topFrame( + sjme_attrInNotNull sjme_nvm_thread* inThread, + sjme_attrOutNotNull sjme_nvm_frame* outFrame) + sjme_attrCheckReturn; + +/** + * Ticks the virtual machine. + * + * @param state The state to tick, @c -1 means to tick forever. + * @param maxTics The number of ticks to execute before returning. + * @return Returns @c SJME_JNI_TRUE if the machine is still running. + * @since 2023/07/27 + */ +sjme_jboolean sjme_nvm_tick(sjme_attrInNotNull sjme_nvm_state* state, + sjme_attrInValue sjme_attrInPositive sjme_jint maxTics) + sjme_attrCheckReturn; + +/*--------------------------------------------------------------------------*/ + +/* Anti-C++. */ +#ifdef __cplusplus + #ifdef SJME_CXX_SQUIRRELJME_NVMFUNC_H +} + #undef SJME_CXX_SQUIRRELJME_NVMFUNC_H + #undef SJME_CXX_IS_EXTERNED + #endif /* #ifdef SJME_CXX_SQUIRRELJME_NVMFUNC_H */ +#endif /* #ifdef __cplusplus */ + +#endif /* SQUIRRELJME_NVMFUNC_H */ diff --git a/nanocoat/include/sjme/vmConfig.h b/nanocoat/include/sjme/vmConfig.h index def73a00a3..f392db5e13 100644 --- a/nanocoat/include/sjme/vmConfig.h +++ b/nanocoat/include/sjme/vmConfig.h @@ -101,17 +101,21 @@ typedef struct sjme_vmConfig_setting /** Flags for the configuration setting. */ sjme_vmConfig_flag flags; - /** The default value, if any. */ - const sjme_vmConfig_value defaultValue; + /** Contains the various values within. */ + struct + { + /** The default value, if any. */ + const sjme_vmConfig_value initial; - /** The minimum value, if applicable. */ - const sjme_vmConfig_value minValue; + /** The minimum value, if applicable. */ + const sjme_vmConfig_value min; - /** The maximum value, if applicable. */ - const sjme_vmConfig_value maxValue; + /** The maximum value, if applicable. */ + const sjme_vmConfig_value max; - /** The option tick values that are possible, if applicable. */ - const sjme_vmConfig_value ticks[sjme_flexibleArrayCount]; + /** The option tick values that are possible, if applicable. */ + const sjme_vmConfig_value ticks[sjme_flexibleArrayCount]; + } value; } sjme_vmConfig_setting; /*--------------------------------------------------------------------------*/ diff --git a/nanocoat/tests/src/tac.c b/nanocoat/tests/src/tac.c index 5600258d03..0c167ed19a 100644 --- a/nanocoat/tests/src/tac.c +++ b/nanocoat/tests/src/tac.c @@ -9,8 +9,9 @@ #include -#include "sjme/nvm.h" #include "sjme/boot.h" +#include "sjme/nvm.h" +#include "sjme/nvmFunc.h" #include "sjme/payload.h" #include "test.h" diff --git a/nanocoat/tests/testNvmLocalPopDouble.c b/nanocoat/tests/testNvmLocalPopDouble.c index c5c13cb058..5268a7379f 100755 --- a/nanocoat/tests/testNvmLocalPopDouble.c +++ b/nanocoat/tests/testNvmLocalPopDouble.c @@ -9,10 +9,10 @@ #include -#include "test.h" -#include "proto.h" #include "elevator.h" #include "proto.h" +#include "sjme/nvmFunc.h" +#include "test.h" #include "unit.h" sjme_jboolean configNvmLocalPopDouble( diff --git a/nanocoat/tests/testNvmLocalPopFloat.c b/nanocoat/tests/testNvmLocalPopFloat.c index cacd800d5d..283a6e0fa3 100755 --- a/nanocoat/tests/testNvmLocalPopFloat.c +++ b/nanocoat/tests/testNvmLocalPopFloat.c @@ -9,10 +9,10 @@ #include -#include "test.h" -#include "proto.h" #include "elevator.h" #include "proto.h" +#include "sjme/nvmFunc.h" +#include "test.h" #include "unit.h" sjme_jboolean configNvmLocalPopFloat( diff --git a/nanocoat/tests/testNvmLocalPopInteger.c b/nanocoat/tests/testNvmLocalPopInteger.c index 677fcd4738..5f2bf7b703 100755 --- a/nanocoat/tests/testNvmLocalPopInteger.c +++ b/nanocoat/tests/testNvmLocalPopInteger.c @@ -9,10 +9,10 @@ #include -#include "test.h" -#include "proto.h" #include "elevator.h" #include "proto.h" +#include "sjme/nvmFunc.h" +#include "test.h" #include "unit.h" sjme_jboolean configNvmLocalPopInteger( diff --git a/nanocoat/tests/testNvmLocalPopLong.c b/nanocoat/tests/testNvmLocalPopLong.c index 892f23a053..f809d859e3 100755 --- a/nanocoat/tests/testNvmLocalPopLong.c +++ b/nanocoat/tests/testNvmLocalPopLong.c @@ -9,10 +9,10 @@ #include -#include "test.h" -#include "proto.h" #include "elevator.h" #include "proto.h" +#include "sjme/nvmFunc.h" +#include "test.h" #include "unit.h" sjme_jboolean configNvmLocalPopLong( diff --git a/nanocoat/tests/testNvmLocalPopReference.c b/nanocoat/tests/testNvmLocalPopReference.c index 02e28c5434..263e4b07ce 100755 --- a/nanocoat/tests/testNvmLocalPopReference.c +++ b/nanocoat/tests/testNvmLocalPopReference.c @@ -9,11 +9,12 @@ #include -#include "proto.h" #include "elevator.h" +#include "proto.h" #include "sjme/debug.h" -#include "unit.h" +#include "sjme/nvmFunc.h" #include "test.h" +#include "unit.h" #define TEST_NUM_OBJECT_IDS 3 -- 2.11.4.GIT