Rename unzip tool.
[SquirrelJME.git] / nanocoat / include / sjme / boot.h
blob5e5c40c3071b50a7f150f4f5d247bde53fe2d0fa
1 /* -*- Mode: C; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
3 // SquirrelJME
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the Mozilla Public License Version 2.0.
7 // See license.mkd for licensing and copyright information.
8 // -------------------------------------------------------------------------*/
10 /**
11 * Virtual machine booting.
13 * @since 2023/07/29
16 #ifndef SQUIRRELJME_BOOT_H
17 #define SQUIRRELJME_BOOT_H
19 #include "sjme/nvm.h"
20 #include "sjme/alloc.h"
21 #include "sjme/rom.h"
22 #include "sjme/list.h"
24 /* Anti-C++. */
25 #ifdef __cplusplus
26 #ifndef SJME_CXX_IS_EXTERNED
27 #define SJME_CXX_IS_EXTERNED
28 #define SJME_CXX_SQUIRRELJME_BOOT_H
29 extern "C" {
30 #endif /* #ifdef SJME_CXX_IS_EXTERNED */
31 #endif /* #ifdef __cplusplus */
33 /*--------------------------------------------------------------------------*/
35 struct sjme_nvm_bootParam
37 /** The payload to use for booting the virtual machine. */
38 const sjme_payload_config* payload;
40 /** The suite to use for the library set. */
41 sjme_rom_suite suite;
43 /** The class path for main by library IDs. */
44 const sjme_list_sjme_jint* mainClassPathById;
46 /** The class path for main by names. */
47 const sjme_list_sjme_lpcstr* mainClassPathByName;
49 /** Main class to start in. */
50 sjme_lpcstr mainClass;
52 /** Main arguments. */
53 const sjme_list_sjme_lpcstr* mainArgs;
55 /** System properties. */
56 const sjme_list_sjme_lpcstr* sysProps;
59 /**
60 * Allocates the reserved pool.
62 * @param mainPool The main pool to allocate within.
63 * @param outReservedPool The output reserved pool.
64 * @return If there is an error or not.
65 * @since 2023/12/14
67 sjme_errorCode sjme_nvm_allocReservedPool(
68 sjme_attrInNotNull sjme_alloc_pool* mainPool,
69 sjme_attrOutNotNull sjme_alloc_pool** outReservedPool);
71 /**
72 * Boots the virtual machine.
74 * @param mainPool The main pool to be allocated within.
75 * @param reservedPool An optional reserved pool that can be used, if not
76 * specified then one is initialized.
77 * @param param The configuration to use.
78 * @param outState The output state of the virtual machine.
79 * @param argc The number of arguments passed to the executable.
80 * @param argv The command line arguments passed to the executable.
81 * @return The error code, if any.
82 * @since 2023/07/27
84 sjme_errorCode sjme_nvm_boot(
85 sjme_attrInNotNull sjme_alloc_pool* mainPool,
86 sjme_attrInNotNull sjme_alloc_pool* reservedPool,
87 sjme_attrInNotNull const sjme_nvm_bootParam* param,
88 sjme_attrOutNotNull sjme_nvm_state** outState)
89 sjme_attrCheckReturn;
91 /**
92 * Destroys the virtual machine.
94 * @param state The state to destroy.
95 * @return If destruction was successful.
96 * @since 2023/07/27
98 sjme_errorCode sjme_nvm_destroy(
99 sjme_attrInNotNull sjme_nvm_state* state,
100 sjme_attrOutNullable sjme_jint* exitCode)
101 sjme_attrCheckReturn;
103 /*--------------------------------------------------------------------------*/
105 /* Anti-C++. */
106 #ifdef __cplusplus
107 #ifdef SJME_CXX_SQUIRRELJME_BOOT_H
109 #undef SJME_CXX_SQUIRRELJME_BOOT_H
110 #undef SJME_CXX_IS_EXTERNED
111 #endif /* #ifdef SJME_CXX_SQUIRRELJME_BOOT_H */
112 #endif /* #ifdef __cplusplus */
114 #endif /* SQUIRRELJME_BOOT_H */