chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-hackers] Re: [Chicken-users] Hash table mystery


From: Kon Lovett
Subject: [Chicken-hackers] Re: [Chicken-users] Hash table mystery
Date: Thu, 24 Jan 2008 11:59:52 -0800

Hi,

Something like the following should probably be added:

chicken.h:

#define C_i_check_closure(x) C_i_check_closure_2(x, C_SCHEME_FALSE)

C_fctexport C_word C_fcall C_i_check_closure_2(C_word x, C_word loc) C_regparm;

runtime.c:

C_regparm C_word C_fcall C_i_check_closure_2(C_word x, C_word loc)
{
  if((C_header_bits(x) != C_CLOSURE_TYPE)) {
    error_location = loc;
    barf(C_BAD_ARGUMENT_TYPE_NO_CHAR_ERROR, NULL, x);
  }

  return C_SCHEME_UNDEFINED;
}

library.scm:

(define (##sys#check-closure x . y)
  (if (pair? y)
      (##core#inline "C_i_check_closure_2" x (car y))
      (##core#inline "C_i_check_closure" x) ) )

extras.scm:

(define make-hash-table
  (let ([make-vector make-vector])
    (lambda test-and-size
      (let-optionals test-and-size ([test equal?]
                                    [hashf ##sys#hash]
                                    [len hashtab-default-size])
        (##sys#check-closure test 'make-hash-table)
        (##sys#check-closure hashf 'make-hash-table)
        (##sys#check-exact len 'make-hash-table)
(##sys#make-structure 'hash-table (make-vector len '()) 0 test hashf) ) ) ) )

Best Wishes,
Kon






reply via email to

[Prev in Thread] Current Thread [Next in Thread]