
#lang racket

(provide bytevector-zero
	 bytevector-zero2
	 _b_my-map
	 my-apply
	 count-prim-classes
	 return-invalid-object
	 return-valid-object)

(require (except-in rnrs assert))
(require rnrs/mutable-pairs-6)
(require theme-d-racket/runtime/runtime-theme-d-environment)
(require theme-d-racket/th-scheme-utilities/stdutils)
(require rnrs/bytevectors-6)

(define bytevector-zero (make-bytevector 1 0))

(define bytevector-zero2 (make-bytevector 5 0))

(define (_b_my-map %arglist %result proc . lists)
  (let* ((arglist2 (general-list->list %arglist))
	 (proc2 (lambda args
		  (_i_call-proc proc args arglist2)))
	 (result
	  (apply map* (cons proc2 lists))))
    result))

(define (my-apply %arglist %result proc args)
  (let ((arglist2 (general-list->list %arglist)))
    (_i_call-proc proc args arglist2)))

(define (count-prim-classes)
  (let ((i-count 0))
    (for-each (lambda (lst) (if (eq? (cadr lst) bytevector?)
				(set! i-count (+ i-count 1))
				(void)))
	      gl-custom-prim-classes)
    i-count))

(define (return-invalid-object)
  2/3)

(define (return-valid-object)
  1)

