bitvectors.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #ifndef SCM_BITVECTORS_H
  2. #define SCM_BITVECTORS_H
  3. /* Copyright 1995-1997,1999-2001,2004,2006,2008-2009,2014,2018
  4. Free Software Foundation, Inc.
  5. This file is part of Guile.
  6. Guile is free software: you can redistribute it and/or modify it
  7. under the terms of the GNU Lesser General Public License as published
  8. by the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Guile is distributed in the hope that it will be useful, but WITHOUT
  11. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
  13. License for more details.
  14. You should have received a copy of the GNU Lesser General Public
  15. License along with Guile. If not, see
  16. <https://www.gnu.org/licenses/>. */
  17. #include "libguile/array-handle.h"
  18. /* Bitvectors. Exciting stuff, maybe!
  19. */
  20. /** Bit vectors */
  21. SCM_API SCM scm_bitvector_p (SCM vec);
  22. SCM_API SCM scm_bitvector (SCM bits);
  23. SCM_API SCM scm_make_bitvector (SCM len, SCM fill);
  24. SCM_API SCM scm_bitvector_length (SCM vec);
  25. SCM_API SCM scm_bitvector_ref (SCM vec, SCM idx);
  26. SCM_API SCM scm_bitvector_set_x (SCM vec, SCM idx, SCM val);
  27. SCM_API SCM scm_list_to_bitvector (SCM list);
  28. SCM_API SCM scm_bitvector_to_list (SCM vec);
  29. SCM_API SCM scm_bitvector_fill_x (SCM vec, SCM val);
  30. SCM_API SCM scm_bit_count (SCM item, SCM seq);
  31. SCM_API SCM scm_bit_position (SCM item, SCM v, SCM k);
  32. SCM_API SCM scm_bit_set_star_x (SCM v, SCM kv, SCM obj);
  33. SCM_API SCM scm_bit_count_star (SCM v, SCM kv, SCM obj);
  34. SCM_API SCM scm_bit_invert_x (SCM v);
  35. SCM_API SCM scm_istr2bve (SCM str);
  36. SCM_API int scm_is_bitvector (SCM obj);
  37. SCM_API SCM scm_c_make_bitvector (size_t len, SCM fill);
  38. SCM_API size_t scm_c_bitvector_length (SCM vec);
  39. SCM_API SCM scm_c_bitvector_ref (SCM vec, size_t idx);
  40. SCM_API void scm_c_bitvector_set_x (SCM vec, size_t idx, SCM val);
  41. SCM_API const uint32_t *scm_array_handle_bit_elements (scm_t_array_handle *h);
  42. SCM_API uint32_t *scm_array_handle_bit_writable_elements (scm_t_array_handle *h);
  43. SCM_API size_t scm_array_handle_bit_elements_offset (scm_t_array_handle *h);
  44. SCM_API const uint32_t *scm_bitvector_elements (SCM vec,
  45. scm_t_array_handle *h,
  46. size_t *offp,
  47. size_t *lenp,
  48. ssize_t *incp);
  49. SCM_API uint32_t *scm_bitvector_writable_elements (SCM vec,
  50. scm_t_array_handle *h,
  51. size_t *offp,
  52. size_t *lenp,
  53. ssize_t *incp);
  54. SCM_INTERNAL uint32_t *scm_i_bitvector_bits (SCM vec);
  55. SCM_INTERNAL int scm_i_is_mutable_bitvector (SCM vec);
  56. SCM_INTERNAL int scm_i_print_bitvector (SCM vec, SCM port, scm_print_state *pstate);
  57. SCM_INTERNAL SCM scm_i_bitvector_equal_p (SCM vec1, SCM vec2);
  58. SCM_INTERNAL void scm_init_bitvectors (void);
  59. #endif /* SCM_BITVECTORS_H */