ps-package-defs.scm 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. ; Copyright (c) 1993-2008 by Richard Kelsey and Jonathan Rees. See file COPYING.
  2. (define-structures ((vm-utilities vm-utilities-interface))
  3. (open prescheme)
  4. (files (util vm-utilities))
  5. (begin
  6. (define-syntax assert
  7. (lambda (exp rename compare)
  8. 0))
  9. ))
  10. (define-structures ((external external-interface))
  11. (open prescheme)
  12. (begin
  13. (define extended-vm
  14. (external "s48_extended_vm" (=> (integer integer) integer)))
  15. (define external-call
  16. (external "s48_external_call" (=> (integer integer integer address)
  17. integer)))
  18. (define schedule-interrupt
  19. (external "s48_schedule_alarm_interrupt" (=> (integer) integer)))
  20. ;; implemented in C, wrapper around s48-dequeue-external-event/unsafe!
  21. (define dequeue-external-event!
  22. (external "s48_dequeue_external_event" (=> () integer boolean)))
  23. (define cheap-time
  24. (external "CHEAP_TIME" (=> () integer)))
  25. (define real-time
  26. (external "s48_real_time" (=> () integer integer)))
  27. (define run-time
  28. (external "s48_run_time" (=> () integer integer)))
  29. (define get-os-string-encoding
  30. (external "s48_get_os_string_encoding" (=> () (^ char))))
  31. (define host-architecture
  32. (external "S48_HOST_ARCHITECTURE" (^ char)))
  33. (define s48-call-native-procedure
  34. (external "s48_call_native_procedure" (=> (integer integer) integer)))
  35. (define s48-invoke-native-continuation
  36. (external "s48_invoke_native_continuation" (=> (integer integer) integer)))
  37. (define s48-jump-native
  38. (external "s48_jump_to_native_address" (=> (integer integer) integer)))
  39. (define s48-native-return
  40. (external "((long)&s48_native_return)" integer))
  41. (define get-proposal-lock!
  42. (external "GET_PROPOSAL_LOCK" (=> () null)))
  43. (define release-proposal-lock!
  44. (external "RELEASE_PROPOSAL_LOCK" (=> () null)))
  45. (define shared-ref
  46. (external "SHARED_REF" (=> (integer) integer)))
  47. (define real-shared-set!
  48. (external "SHARED_SETB" (=> (integer integer) null)))
  49. (define-syntax shared-set!
  50. (syntax-rules ()
  51. ((shared-set! x v)
  52. (real-shared-set! x v))))
  53. ; for use in C functions usable from external code, defined as
  54. ; PreScheme procedures
  55. (define raise-argument-type-error
  56. ;; value
  57. (external "s48_raise_argument_type_error" (=> (integer) null)))
  58. (define raise-range-error
  59. ;; value, min, max
  60. (external "s48_raise_range_error" (=> (integer integer integer) null)))
  61. ; Lots of bignum stuff. This should be moved to its own interface.
  62. (define export-key
  63. (external "s48_export_key" (=> (integer) integer)))
  64. (define external-bignum-make-cached-constants
  65. (external "s48_bignum_make_cached_constants" (=> () null)))
  66. (define external-bignum-add
  67. (external "(char *)s48_bignum_add" (=> (address address) address)))
  68. (define external-bignum-subtract
  69. (external "(char *)s48_bignum_subtract" (=> (address address) address)))
  70. (define external-bignum-multiply
  71. (external "(char *)s48_bignum_multiply" (=> (address address) address)))
  72. (define external-bignum-quotient
  73. (external "(char *)s48_bignum_quotient" (=> (address address) address)))
  74. (define external-bignum-remainder
  75. (external "(char *)s48_bignum_remainder" (=> (address address) address)))
  76. (define external-bignum-divide
  77. (external "s48_bignum_divide" (=> (address address)
  78. boolean address address)))
  79. (define external-bignum-equal?
  80. (external "s48_bignum_equal_p" (=> (address address) boolean)))
  81. (define external-bignum-compare
  82. (external "s48_bignum_compare" (=> (address address) integer)))
  83. (define external-bignum-test
  84. (external "s48_bignum_test" (=> (address) integer)))
  85. (define external-bignum-negate
  86. (external "(char *) s48_bignum_negate" (=> (address) address)))
  87. (define external-bignum-arithmetic-shift
  88. (external "(char *) s48_bignum_arithmetic_shift"
  89. (=> (address integer) address)))
  90. (define external-bignum-bitwise-not
  91. (external "(char *) s48_bignum_bitwise_not"
  92. (=> (address) address)))
  93. (define external-bignum-bit-count
  94. (external "s48_bignum_bit_count"
  95. (=> (address) integer)))
  96. (define external-bignum-bitwise-and
  97. (external "(char *) s48_bignum_bitwise_and"
  98. (=> (address address) address)))
  99. (define external-bignum-bitwise-ior
  100. (external "(char *) s48_bignum_bitwise_ior"
  101. (=> (address address) address)))
  102. (define external-bignum-bitwise-xor
  103. (external "(char *) s48_bignum_bitwise_xor"
  104. (=> (address address) address)))
  105. (define external-bignum-from-long
  106. (external "(char *) s48_long_to_bignum" (=> (integer) address)))
  107. (define external-bignum-from-unsigned-long
  108. (external "(char *) s48_ulong_to_bignum" (=> (unsigned-integer) address)))
  109. (define external-bignum->long
  110. (external "s48_bignum_to_long" (=> (address) integer)))
  111. (define external-bignum-fits-in-word?
  112. (external "s48_bignum_fits_in_word_p" (=> (address integer boolean)
  113. boolean)))
  114. ))
  115. (define-structures ((channel-io channel-interface)
  116. (events event-interface))
  117. (open prescheme)
  118. (files (data ps-channel)))