global? check

Notices and updates
Locked
Dmi
Posts: 408
Joined: Sat Jun 04, 2005 4:16 pm
Location: Russia
Contact:

global? check

Post 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)))
WBR, Dmi

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post 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

Dmi
Posts: 408
Joined: Sat Jun 04, 2005 4:16 pm
Location: Russia
Contact:

Post by Dmi »

Thanks!!!!
WBR, Dmi

Fanda
Posts: 253
Joined: Tue Aug 02, 2005 6:40 am
Contact:

Post by Fanda »

Maybe, we could add 'global?' to the newLISP core.

Fanda

Locked