[wasm] Add hb-wasm-api.cc
This commit is contained in:
parent
980706441b
commit
42d121ae79
|
@ -27,7 +27,6 @@
|
|||
|
||||
#include "hb-wasm-api.hh"
|
||||
|
||||
#include "hb-wasm-font.hh"
|
||||
|
||||
#ifdef HB_DEBUG_WASM
|
||||
namespace hb { namespace wasm {
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright © 2023 Behdad Esfahbod
|
||||
*
|
||||
* This is part of HarfBuzz, a text shaping library.
|
||||
*
|
||||
* Permission is hereby granted, without written agreement and without
|
||||
* license or royalty fees, to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose, provided that the
|
||||
* above copyright notice and the following two paragraphs appear in
|
||||
* all copies of this software.
|
||||
*
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
* DAMAGE.
|
||||
*
|
||||
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
*/
|
||||
|
||||
#include "hb-wasm-api.hh"
|
||||
|
||||
|
||||
#define nullref 0
|
||||
#define module_inst wasm_runtime_get_module_inst (exec_env)
|
||||
#define HB_REF2OBJ(obj) \
|
||||
hb_##obj##_t *obj = nullptr; \
|
||||
(void) wasm_externref_ref2obj (obj##ref, (void **) &obj)
|
||||
#define HB_OBJ2REF(obj) \
|
||||
uint32_t obj##ref = nullref; \
|
||||
(void) wasm_externref_obj2ref (module_inst, obj, &obj##ref)
|
||||
|
||||
|
||||
#include "hb-wasm-font.hh"
|
||||
|
||||
|
||||
#undef nullref
|
||||
#undef module_inst
|
||||
#undef HB_WASM_EXEC_ENV
|
||||
#undef HB_REF2OBJ
|
||||
#undef HB_OBJ2REF
|
|
@ -42,24 +42,4 @@
|
|||
#undef HB_WASM_END_DECLS
|
||||
|
||||
|
||||
#define nullref 0
|
||||
#define module_inst wasm_runtime_get_module_inst (exec_env)
|
||||
#define HB_REF2OBJ(obj) \
|
||||
hb_##obj##_t *obj = nullptr; \
|
||||
(void) wasm_externref_ref2obj (obj##ref, (void **) &obj)
|
||||
#define HB_OBJ2REF(obj) \
|
||||
uint32_t obj##ref = nullref; \
|
||||
(void) wasm_externref_obj2ref (module_inst, obj, &obj##ref)
|
||||
|
||||
|
||||
#include "hb-wasm-api-list.hh"
|
||||
|
||||
|
||||
#undef nullref
|
||||
#undef module_inst
|
||||
#undef HB_WASM_EXEC_ENV
|
||||
#undef HB_REF2OBJ
|
||||
#undef HB_OBJ2REF
|
||||
|
||||
|
||||
#endif /* HB_WASM_API_HH */
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#ifdef HAVE_WASM
|
||||
|
||||
#include "hb-wasm-api.hh"
|
||||
#include "hb-wasm-api-list.hh"
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -324,7 +324,7 @@ hb_glib_headers = files('hb-glib.h')
|
|||
hb_graphite2_sources = files('hb-graphite2.cc')
|
||||
hb_graphite2_headers = files('hb-graphite2.h')
|
||||
|
||||
hb_wasm_sources = files('hb-wasm-shape.cc')
|
||||
hb_wasm_sources = files('hb-wasm-shape.cc', 'hb-wasm-api.cc')
|
||||
hb_wasm_headers = files()
|
||||
|
||||
# System-dependent sources and headers
|
||||
|
|
Loading…
Reference in New Issue