gpib.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * gpib.h - guile binding for LinuxGpib
  3. *
  4. * Copyright (C) 2003 Stefan Jahn <stefan@lkcc.org>
  5. *
  6. * LinuxGpib is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * LinuxGpib is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with LinuxGpib; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. *
  20. */
  21. #ifndef SCM_GPIB_H
  22. #define SCM_GPIB_H 1
  23. #if defined (SCM_MINOR_VERSION) && (SCM_MINOR_VERSION >= 5) && \
  24. defined (SCM_MAJOR_VERSION) && (SCM_MAJOR_VERSION >= 1)
  25. #define SCM_VERSION_15X 1
  26. #endif
  27. #if defined (SCM_MINOR_VERSION) && (SCM_MINOR_VERSION >= 7) && \
  28. defined (SCM_MAJOR_VERSION) && (SCM_MAJOR_VERSION >= 1)
  29. #define SCM_VERSION_17X 1
  30. #endif
  31. #ifndef SCM_VERSION_17X
  32. #define scm_c_string2str(obj, str, lenp) gh_scm2newstr (obj, lenp)
  33. #endif
  34. #ifndef SCM_VERSION_17X
  35. #define scm_c_symbol2str(obj, str, lenp) gh_symbol2newstr (obj, lenp)
  36. #endif
  37. #define guile_to_string(cell) \
  38. (SCM_NULLP (cell) ? NULL : \
  39. (SCM_STRINGP (cell) ? scm_c_string2str (cell, NULL, NULL) : \
  40. (SCM_SYMBOLP (cell) ? scm_c_symbol2str (cell, NULL, NULL) : NULL)))
  41. #ifndef SCM_EXACTP
  42. #define SCM_EXACTP(obj) SCM_NFALSEP (scm_exact_p (obj))
  43. #endif
  44. #ifndef SCM_NUM2INT
  45. #define SCM_NUM2INT(pos, obj) gh_scm2int (obj)
  46. #endif
  47. #ifndef SCM_BOOLP
  48. #define SCM_BOOLP(obj) SCM_NFALSEP (scm_boolean_p (obj))
  49. #endif
  50. #ifndef SCM_BOOL
  51. #define SCM_BOOL(x) ((x) ? SCM_BOOL_T : SCM_BOOL_F)
  52. #endif
  53. #ifndef SCM_STRING_CHARS
  54. #define SCM_STRING_CHARS(obj) ((char *) SCM_VELTS (obj))
  55. #endif
  56. #ifndef SCM_VERSION_15X
  57. #define scm_c_define_gsubr(name, req, opt, rst, fcn) \
  58. gh_new_procedure (name, fcn, req, opt, rst)
  59. #endif
  60. #ifndef SCM_VERSION_15X
  61. #define scm_int2num(x) scm_long2num ((long) (x))
  62. #endif
  63. #ifndef SCM_VERSION_15X
  64. #define scm_mem2string(str, len) gh_str2scm (str, len)
  65. #endif
  66. #ifndef SCM_VERSION_15X
  67. #define scm_c_define(name, val) gh_define (name, val)
  68. #endif
  69. #endif /* SCM_GPIB_H */