Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

34 řádky
825 B

  1. // This file is part of Jiffy released under the MIT license.
  2. // See the LICENSE file for more information.
  3. #ifndef TERMSTACK_H
  4. #define TERMSTACK_H
  5. #include "erl_nif.h"
  6. #ifdef _WIN32
  7. #define JIFFY_EXPORT __declspec(dllexport)
  8. #else
  9. #define JIFFY_EXPORT
  10. #endif
  11. #define SMALL_TERMSTACK_SIZE 16
  12. typedef struct {
  13. ERL_NIF_TERM* elements;
  14. size_t size;
  15. size_t top;
  16. ERL_NIF_TERM __default_elements[SMALL_TERMSTACK_SIZE];
  17. } TermStack;
  18. ERL_NIF_TERM termstack_save(ErlNifEnv* env, TermStack* stack);
  19. int termstack_restore(ErlNifEnv* env, ERL_NIF_TERM from, TermStack* stack);
  20. void termstack_destroy(TermStack* stack);
  21. JIFFY_EXPORT void termstack_push(TermStack* stack, ERL_NIF_TERM term);
  22. JIFFY_EXPORT ERL_NIF_TERM termstack_pop(TermStack* stack);
  23. JIFFY_EXPORT int termstack_is_empty(TermStack* stack);
  24. #endif