1 /* -*- Mode: C; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
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 // -------------------------------------------------------------------------*/
11 * Virtual machine booting.
16 #ifndef SQUIRRELJME_BOOT_H
17 #define SQUIRRELJME_BOOT_H
20 #include "sjme/alloc.h"
22 #include "sjme/list.h"
26 #ifndef SJME_CXX_IS_EXTERNED
27 #define SJME_CXX_IS_EXTERNED
28 #define SJME_CXX_SQUIRRELJME_BOOT_H
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. */
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
;
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.
67 sjme_errorCode
sjme_nvm_allocReservedPool(
68 sjme_attrInNotNull sjme_alloc_pool
* mainPool
,
69 sjme_attrOutNotNull sjme_alloc_pool
** outReservedPool
);
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.
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
)
92 * Destroys the virtual machine.
94 * @param state The state to destroy.
95 * @return If destruction was successful.
98 sjme_errorCode
sjme_nvm_destroy(
99 sjme_attrInNotNull sjme_nvm_state
* state
,
100 sjme_attrOutNullable sjme_jint
* exitCode
)
101 sjme_attrCheckReturn
;
103 /*--------------------------------------------------------------------------*/
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 */