// This file is part of Jiffy released under the MIT license. // See the LICENSE file for more information. #ifndef JIFFY_H #define JIFFY_H #include "erl_nif.h" typedef struct { ERL_NIF_TERM atom_ok; ERL_NIF_TERM atom_error; ERL_NIF_TERM atom_null; ERL_NIF_TERM atom_true; ERL_NIF_TERM atom_false; ERL_NIF_TERM atom_bignum; ERL_NIF_TERM atom_bignum_e; ERL_NIF_TERM atom_bigdbl; ERL_NIF_TERM atom_partial; ERL_NIF_TERM ref_object; ERL_NIF_TERM ref_array; } jiffy_st; ERL_NIF_TERM make_atom(ErlNifEnv* env, const char* name); ERL_NIF_TERM make_ok(jiffy_st* st, ErlNifEnv* env, ERL_NIF_TERM data); ERL_NIF_TERM make_error(jiffy_st* st, ErlNifEnv* env, const char* error); ERL_NIF_TERM decode(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); ERL_NIF_TERM encode(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); int int_from_hex(const unsigned char* p); int int_to_hex(int val, char* p); int utf8_len(int c); int utf8_from_pair(int hi, int lo); int utf8_to_binary(int c, unsigned char* buf); #endif // Included JIFFY_H