You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 line
1.1 KiB

  1. // This file is part of Jiffy released under the MIT license.
  2. // See the LICENSE file for more information.
  3. #ifndef JIFFY_H
  4. #define JIFFY_H
  5. #include "erl_nif.h"
  6. typedef struct {
  7. ERL_NIF_TERM atom_ok;
  8. ERL_NIF_TERM atom_error;
  9. ERL_NIF_TERM atom_null;
  10. ERL_NIF_TERM atom_true;
  11. ERL_NIF_TERM atom_false;
  12. ERL_NIF_TERM atom_bignum;
  13. ERL_NIF_TERM atom_bignum_e;
  14. ERL_NIF_TERM atom_bigdbl;
  15. ERL_NIF_TERM atom_partial;
  16. ERL_NIF_TERM ref_object;
  17. ERL_NIF_TERM ref_array;
  18. } jiffy_st;
  19. ERL_NIF_TERM make_atom(ErlNifEnv* env, const char* name);
  20. ERL_NIF_TERM make_ok(jiffy_st* st, ErlNifEnv* env, ERL_NIF_TERM data);
  21. ERL_NIF_TERM make_error(jiffy_st* st, ErlNifEnv* env, const char* error);
  22. ERL_NIF_TERM decode(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]);
  23. ERL_NIF_TERM encode(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]);
  24. int int_from_hex(const unsigned char* p);
  25. int int_to_hex(int val, char* p);
  26. int utf8_len(int c);
  27. int utf8_from_pair(int hi, int lo);
  28. int utf8_to_binary(int c, unsigned char* buf);
  29. #endif // Included JIFFY_H