chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] [1.89] The symbol .


From: felix winkelmann
Subject: Re: [Chicken-users] [1.89] The symbol .
Date: Tue, 26 Apr 2005 07:32:06 +0200

> On 25 Apr 2005 15:25:26 +0200, Nicolas Pelletier
> 
> >
> > Is there a way to input the dot as a symbol literal ?
> >
> 

Here's a patch (taken against the current darcs head):

cd /home/fwinkel/stuff/chicken/
diff -c /home/fwinkel/stuff/chicken/library.scm\~
/home/fwinkel/stuff/chicken/library.scm
*** /home/fwinkel/stuff/chicken/library.scm~    2005-04-26 07:11:57.405505248 
+0200
--- /home/fwinkel/stuff/chicken/library.scm     2005-04-26 07:16:50.711915896 
+0200
***************
*** 2045,2071 ****
                        [else (loop (fx+ i 1))] ) ) ) )
  
            (define (resolve-symbol tok)
!             (if (string=? tok ".")
!                 (##sys#read-error "invalid use of '.'")
!                 (let ([len (##sys#size tok)])
!                   (cond [(and (fx> len 1)
!                               (or (and (eq? ksp #:prefix)
!                                        (char=? #\: (##core#inline "C_subchar" 
tok 0)) 
!                                        (##sys#substring tok 1 len) )
!                                   (and (eq? ksp #:suffix) 
!                                        (char=? #\: (##core#inline "C_subchar" 
tok (fx- len 1)))
!                                        (##sys#substring tok 0 (fx- len 1)) ) 
) )
!                          => build-keyword] ; ugh
!                         [(not ##sys#current-namespace) (build-symbol tok)]
!                         [else
!                          (let ([i (##core#inline "C_fixnum_modulo" 
(##core#inline
"C_hash_string" tok) namespace-size)])
!                            (let loop ([bucket (##sys#slot 
##sys#current-namespace i)])
!                              (if (null? bucket)
!                                  (build-symbol tok)
!                                  (let ([e (##sys#slot bucket 0)])
!                                    (if (string=? tok (##sys#slot e 0))
!                                        (##sys#slot e 1)
!                                        (loop (##sys#slot bucket 1)) ) ) ) ) ) 
] ) ) ) )
  
            (define (build-symbol tok)
              (##sys#intern-symbol
--- 2045,2069 ----
                        [else (loop (fx+ i 1))] ) ) ) )
  
            (define (resolve-symbol tok)
!             (let ([len (##sys#size tok)])
!               (cond [(and (fx> len 1)
!                           (or (and (eq? ksp #:prefix)
!                                    (char=? #\: (##core#inline "C_subchar" tok 
0)) 
!                                    (##sys#substring tok 1 len) )
!                               (and (eq? ksp #:suffix) 
!                                    (char=? #\: (##core#inline "C_subchar" tok 
(fx- len 1)))
!                                    (##sys#substring tok 0 (fx- len 1)) ) ) )
!                      => build-keyword] ; ugh
!                     [(not ##sys#current-namespace) (build-symbol tok)]
!                     [else
!                      (let ([i (##core#inline "C_fixnum_modulo" (##core#inline
"C_hash_string" tok) namespace-size)])
!                        (let loop ([bucket (##sys#slot ##sys#current-namespace 
i)])
!                          (if (null? bucket)
!                              (build-symbol tok)
!                              (let ([e (##sys#slot bucket 0)])
!                                (if (string=? tok (##sys#slot e 0))
!                                    (##sys#slot e 1)
!                                    (loop (##sys#slot bucket 1)) ) ) ) ) ) ] ) 
) )
  
            (define (build-symbol tok)
              (##sys#intern-symbol


cheers,
felix




reply via email to

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