#if !defined(WASMER_WASM_H_PRELUDE)
#define WASMER_WASM_H_PRELUDE
#if defined(MSVC) && defined(_M_AMD64)
# define ARCH_X86_64
#elif (defined(GCC) || defined(__GNUC__) || defined(__clang__)) && defined(__x86_64__)
# define ARCH_X86_64
#endif
#if !defined(__has_attribute)
# define __has_attribute(x) 0
#endif
#if !defined(__has_declspec_attribute)
# define __has_declspec_attribute(x) 0
#endif
#if defined(GCC) || defined(__GNUC__) || __has_attribute(deprecated)
# define DEPRECATED(message) __attribute__((deprecated(message)))
#elif defined(MSVC) || __has_declspec_attribute(deprecated)
# define DEPRECATED(message) __declspec(deprecated(message))
#endif
#define WASMER_JIT_ENABLED
#define WASMER_COMPILER_ENABLED
#define WASMER_WASI_ENABLED
#define WASMER_VERSION "1.0.1"
#define WASMER_VERSION_MAJOR 1
#define WASMER_VERSION_MINOR 0
#define WASMER_VERSION_PATCH 1
#define WASMER_VERSION_PRE ""
#endif
#ifndef WASMER_WASM_H
#define WASMER_WASM_H
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include "wasm.h"
#if defined(WASMER_WASI_ENABLED)
typedef enum {
#if defined(WASMER_WASI_ENABLED)
INVALID_VERSION = -1,
#endif
#if defined(WASMER_WASI_ENABLED)
LATEST = 0,
#endif
#if defined(WASMER_WASI_ENABLED)
SNAPSHOT0 = 1,
#endif
#if defined(WASMER_WASI_ENABLED)
SNAPSHOT1 = 2,
#endif
} wasi_version_t;
#endif
#if defined(WASMER_COMPILER_ENABLED)
typedef enum {
CRANELIFT = 0,
LLVM = 1,
SINGLEPASS = 2,
} wasmer_compiler_t;
#endif
typedef enum {
JIT = 0,
NATIVE = 1,
OBJECT_FILE = 2,
} wasmer_engine_t;
#if defined(WASMER_WASI_ENABLED)
typedef struct wasi_config_t wasi_config_t;
#endif
#if defined(WASMER_WASI_ENABLED)
typedef struct wasi_env_t wasi_env_t;
#endif
typedef struct wasm_cpu_features_t wasm_cpu_features_t;
#if defined(WASMER_WASI_ENABLED)
typedef struct wasm_named_extern_t wasm_named_extern_t;
#endif
typedef struct wasm_target_t wasm_target_t;
typedef struct wasm_triple_t wasm_triple_t;
#if defined(WASMER_WASI_ENABLED)
typedef struct {
uintptr_t size;
wasm_named_extern_t **data;
} wasm_named_extern_vec_t;
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if defined(WASMER_WASI_ENABLED)
void wasi_config_arg(wasi_config_t *config, const char *arg);
#endif
#if defined(WASMER_WASI_ENABLED)
void wasi_config_capture_stderr(wasi_config_t *config);
#endif
#if defined(WASMER_WASI_ENABLED)
void wasi_config_capture_stdout(wasi_config_t *config);
#endif
#if defined(WASMER_WASI_ENABLED)
void wasi_config_env(wasi_config_t *config, const char *key, const char *value);
#endif
#if defined(WASMER_WASI_ENABLED)
void wasi_config_inherit_stderr(wasi_config_t *config);
#endif
#if defined(WASMER_WASI_ENABLED)
void wasi_config_inherit_stdin(wasi_config_t *config);
#endif
#if defined(WASMER_WASI_ENABLED)
void wasi_config_inherit_stdout(wasi_config_t *config);
#endif
#if defined(WASMER_WASI_ENABLED)
bool wasi_config_mapdir(wasi_config_t *config, const char *alias, const char *dir);
#endif
#if defined(WASMER_WASI_ENABLED)
wasi_config_t *wasi_config_new(const char *program_name);
#endif
#if defined(WASMER_WASI_ENABLED)
bool wasi_config_preopen_dir(wasi_config_t *config, const char *dir);
#endif
#if defined(WASMER_WASI_ENABLED)
void wasi_env_delete(wasi_env_t *_state);
#endif
#if defined(WASMER_WASI_ENABLED)
wasi_env_t *wasi_env_new(wasi_config_t *config);
#endif
#if defined(WASMER_WASI_ENABLED)
intptr_t wasi_env_read_stderr(wasi_env_t *env, char *buffer, uintptr_t buffer_len);
#endif
#if defined(WASMER_WASI_ENABLED)
intptr_t wasi_env_read_stdout(wasi_env_t *env, char *buffer, uintptr_t buffer_len);
#endif
#if defined(WASMER_WASI_ENABLED)
DEPRECATED("This function is no longer necessary. You may safely remove all calls to it and everything will continue to work.")
bool wasi_env_set_instance(wasi_env_t *_env,
const wasm_instance_t *_instance);
#endif
#if defined(WASMER_WASI_ENABLED)
DEPRECATED("This function is no longer necessary. You may safely remove all calls to it and everything will continue to work.")
void wasi_env_set_memory(wasi_env_t *_env,
const wasm_memory_t *_memory);
#endif
#if defined(WASMER_WASI_ENABLED)
bool wasi_get_imports(const wasm_store_t *store,
const wasm_module_t *module,
const wasi_env_t *wasi_env,
wasm_extern_vec_t *imports);
#endif
#if defined(WASMER_WASI_ENABLED)
wasm_func_t *wasi_get_start_function(wasm_instance_t *instance);
#endif
#if defined(WASMER_WASI_ENABLED)
bool wasi_get_unordered_imports(const wasm_store_t *store,
const wasm_module_t *module,
const wasi_env_t *wasi_env,
wasm_named_extern_vec_t *imports);
#endif
#if defined(WASMER_WASI_ENABLED)
wasi_version_t wasi_get_wasi_version(const wasm_module_t *module);
#endif
#if defined(WASMER_COMPILER_ENABLED)
void wasm_config_set_compiler(wasm_config_t *config, wasmer_compiler_t compiler);
#endif
void wasm_config_set_engine(wasm_config_t *config, wasmer_engine_t engine);
void wasm_config_set_target(wasm_config_t *config, wasm_target_t *target);
bool wasm_cpu_features_add(wasm_cpu_features_t *cpu_features, const wasm_name_t *feature);
void wasm_cpu_features_delete(wasm_cpu_features_t *_cpu_features);
wasm_cpu_features_t *wasm_cpu_features_new(void);
void wasm_module_name(const wasm_module_t *module, wasm_name_t *out);
bool wasm_module_set_name(wasm_module_t *module, const wasm_name_t *name);
#if defined(WASMER_WASI_ENABLED)
const wasm_name_t *wasm_named_extern_module(const wasm_named_extern_t *named_extern);
#endif
#if defined(WASMER_WASI_ENABLED)
const wasm_name_t *wasm_named_extern_name(const wasm_named_extern_t *named_extern);
#endif
#if defined(WASMER_WASI_ENABLED)
const wasm_extern_t *wasm_named_extern_unwrap(const wasm_named_extern_t *named_extern);
#endif
#if defined(WASMER_WASI_ENABLED)
void wasm_named_extern_vec_copy(wasm_named_extern_vec_t *out_ptr,
const wasm_named_extern_vec_t *in_ptr);
#endif
#if defined(WASMER_WASI_ENABLED)
void wasm_named_extern_vec_delete(wasm_named_extern_vec_t *ptr);
#endif
#if defined(WASMER_WASI_ENABLED)
void wasm_named_extern_vec_new(wasm_named_extern_vec_t *out,
uintptr_t length,
wasm_named_extern_t *const *init);
#endif
#if defined(WASMER_WASI_ENABLED)
void wasm_named_extern_vec_new_empty(wasm_named_extern_vec_t *out);
#endif
#if defined(WASMER_WASI_ENABLED)
void wasm_named_extern_vec_new_uninitialized(wasm_named_extern_vec_t *out, uintptr_t length);
#endif
void wasm_target_delete(wasm_target_t *_target);
wasm_target_t *wasm_target_new(wasm_triple_t *triple, wasm_cpu_features_t *cpu_features);
void wasm_triple_delete(wasm_triple_t *_triple);
wasm_triple_t *wasm_triple_new(const wasm_name_t *triple);
wasm_triple_t *wasm_triple_new_from_host(void);
int wasmer_last_error_length(void);
int wasmer_last_error_message(char *buffer, int length);
const char *wasmer_version(void);
uint8_t wasmer_version_major(void);
uint8_t wasmer_version_minor(void);
uint8_t wasmer_version_patch(void);
const char *wasmer_version_pre(void);
void wat2wasm(const wasm_byte_vec_t *wat, wasm_byte_vec_t *out);
#ifdef __cplusplus
} #endif
#endif