RSS/Atom feed Twitter
Site is read-only, email is disabled

script-fu error.

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

4 of 4 messages available
Toggle history

Please log in to manage your subscriptions.

script-fu error. Giovanni Rizzardi 01 Oct 11:47
  script-fu error. paul taney 01 Oct 16:49
  script-fu error. Kevin Cozens 01 Oct 17:03
   script-fu error. saulgoode@flashingtwelve.brickfilms.com 01 Oct 22:32
Giovanni Rizzardi
2008-10-01 11:47:50 UTC (about 16 years ago)

script-fu error.

I'm trying to update an old script (stegano.scm) that uses the functions bit-or and bit-and. Both these function should be ported from SIOD to TinyScheme but the interpreter raises an exception complaining about an "unbound variable".

I wonder if it is me that I'm doing something wrong or effectively these two function aren't part of the scheme library anymore.

Regards, Giovanni.

paul taney
2008-10-01 16:49:38 UTC (about 16 years ago)

script-fu error.

Hi Giovanni,

I googled "Tinyscheme bitwise-and" and got a hit. Try that.

http://homepage.mac.com/rdadolf/tinyscheme.html

paul

--- On Wed, 10/1/08, Giovanni Rizzardi wrote:

From: Giovanni Rizzardi
Subject: [Gimp-developer] script-fu error. To: gimp-developer@lists.XCF.Berkeley.EDU Date: Wednesday, October 1, 2008, 5:47 AM I'm trying to update an old script (stegano.scm) that uses the functions
bit-or and bit-and. Both these function should be ported from SIOD to TinyScheme but the interpreter raises an exception
complaining about an "unbound variable".

I wonder if it is me that I'm doing something wrong or effectively these two
function aren't part of the scheme library anymore.

Regards, Giovanni.

Kevin Cozens
2008-10-01 17:03:11 UTC (about 16 years ago)

script-fu error.

Giovanni Rizzardi wrote:

I'm trying to update an old script (stegano.scm) that uses the functions bit-or and bit-and. Both these function should be ported from SIOD to TinyScheme but the interpreter raises an exception complaining about an "unbound variable".

Those two functions are unique to SIOD. TinyScheme tends to follow the R4RS and R5RS Scheme standards which do not currently define bit wise operations. The bitwise operation could be written in standard Scheme but they would be rather slow.

Bit operations were proposed in SRFI-33 (http://srfi.schemers.org/srfi-33/) but that is currently in a withdrawn state awaiting revival. You could check to see if they have a reference implementation which you could use.

saulgoode@flashingtwelve.brickfilms.com
2008-10-01 22:32:47 UTC (about 16 years ago)

script-fu error.

Quoting Kevin Cozens :

Giovanni Rizzardi wrote:

I'm trying to update an old script (stegano.scm) that uses the functions bit-or and bit-and. Both these function should be ported from SIOD to TinyScheme but the interpreter raises an exception complaining about an "unbound variable".

Those two functions are unique to SIOD. TinyScheme tends to follow the R4RS and R5RS Scheme standards which do not currently define bit wise operations. The bitwise operation could be written in standard Scheme but they would be rather slow.

Bit operations were proposed in SRFI-33 (http://srfi.schemers.org/srfi-33/) but that is currently in a withdrawn state awaiting revival. You could check to see if they have a reference implementation which you could use.

I don't know if they are reference implementations, but the following two functions should work for reasonably-sized positive integers.

(define (bit-or x y) (cond
((= x y) x)
((zero? x) y)
((zero? y) x)
(else
(+ (* (bit-or (quotient (trunc x) 2) (quotient (trunc y) 2)) 2) (if (and (even? x) (even? y)) 0 1)))))

(define (bit-and x y) (cond
((= x y) x)
((zero? x) 0)
((zero? y) 0)
(else
(+ (* (bit-and (quotient (trunc x) 2) (quotient (trunc y) 2)) 2) (if (or (even? x) (even? y)) 0 1)))))