Page 1 of 1

global? check

Posted: Wed May 23, 2007 6:40 am
by Dmi
Hi, Lutz!

The function, you suggested eraly isn't working anymore and always returns nil.

Code: Select all

(define (global? s)
  "(global? 'sym) - return 'sym if it is global, otherwise - nil"
  (let (mask (if (= (pack "d" 1) "\000\001") 0x02000000 0x00000200))
    (= (& (get-int (last (dump s))) mask) mask)))

Posted: Wed May 23, 2007 7:57 am
by Lutz
The global bit has moved, this corrected version works:

Code: Select all

 (define (global? s)
     (let (mask (if (= (pack "d" 1) "\000\001") 
                        0x00200000 0x00000020))
          (= (& (get-int (last (dump s))) mask) mask)))


(global? 'x) => nil)

(global 'x)

(global? 'x) => true)
Lutz

Posted: Wed May 23, 2007 7:59 am
by Dmi
Thanks!!!!

Posted: Wed May 23, 2007 5:07 pm
by Fanda
Maybe, we could add 'global?' to the newLISP core.

Fanda