common.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* Copyright (C) 2013 Artyom V. Poptsov <poptsov.artyom@gmail.com>
  2. *
  3. * This file is part of Guile-SSH
  4. *
  5. * Guile-SSH is free software: you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation, either version 3 of the
  8. * License, or (at your option) any later version.
  9. *
  10. * Guile-SSH is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with Guile-SSH. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef __COMMON_H__
  19. #define __COMMON_H__
  20. #include <libguile.h>
  21. /* Whether we're using Guile < 2.2. */
  22. #define USING_GUILE_BEFORE_2_2 \
  23. (SCM_MAJOR_VERSION < 2 \
  24. || (SCM_MAJOR_VERSION == 2 && SCM_MINOR_VERSION == 0))
  25. /* Simplified version of 'SCM_DEFINE' macro that defines a procedure with
  26. empty docstring and without optional and "rest" arguments. */
  27. #define SCM_GSSH_DEFINE(c_name, scheme_name, req, arglist) \
  28. SCM_DEFINE (c_name, scheme_name, req, 0, 0, arglist, "")
  29. struct symbol_mapping {
  30. char* symbol;
  31. int value;
  32. };
  33. extern SCM
  34. _ssh_const_to_scm (const struct symbol_mapping *types, int value);
  35. extern const struct symbol_mapping *
  36. _scm_to_ssh_const (const struct symbol_mapping *types, SCM value);
  37. extern SCM
  38. _scm_object_hex_address (SCM obj);
  39. #endif /* ifndef __COMMON_H__ */
  40. /* common.h ends here. */