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

script-fu: illegal function?

This discussion is connected to the gimp-user-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.

5 of 5 messages available
Toggle history

Please log in to manage your subscriptions.

script-fu: illegal function? Gary Aitken 17 Sep 18:28
  script-fu: illegal function? Kevin Cozens 17 Sep 22:47
   script-fu: illegal function? Richard Gitschlag 18 Sep 03:44
    script-fu: illegal function? Gary Aitken 18 Sep 22:07
     script-fu: illegal function? Kevin Cozens 18 Sep 22:17
Gary Aitken
2012-09-17 18:28:50 UTC (over 12 years ago)

script-fu: illegal function?

When I try the following in the script-fu console:

((define (find-dot txt txtLen offset) (print "foo")) (find-dot "abcd.ef" 7 1)) "foo"
Error: illegal function

The find-dot macro obviously exists and is being executed. So what is the illegal function it is complaining about?

Thanks

Kevin Cozens
2012-09-17 22:47:38 UTC (over 12 years ago)

script-fu: illegal function?

On 12-09-17 02:28 PM, Gary Aitken wrote:

((define (find-dot txt txtLen offset) (print "foo")) (find-dot "abcd.ef" 7 1))

First, you wrapped the whole thing in ( ). Drop the leading and trailing parentheses.

Second, that is a line of Scheme code and Scheme does not contain a "print" function. You probably meant to use "display". Also keep in mind that the "display" function only takes a string so you may first need to convert what you pass it to a string.

Richard Gitschlag
2012-09-18 03:44:41 UTC (over 12 years ago)

script-fu: illegal function?

That's right - parentheses are not "free" in Scheme scripting, every opening parenthesis must be immediately followed by a function call. When you just want parentheses to group a few statements together with, call the (begin ... ) function:

(begin (function a) (function b) (etc ) ... )

-- Stratadrake strata_ranger@hotmail.com
--------------------
Numbers may not lie, but neither do they tell the whole truth.

Date: Mon, 17 Sep 2012 18:47:38 -0400 From: kevin@ve3syb.ca
To: gimp-user-list@gnome.org
Subject: Re: [Gimp-user] script-fu: illegal function?

On 12-09-17 02:28 PM, Gary Aitken wrote:

((define (find-dot txt txtLen offset) (print "foo")) (find-dot "abcd.ef" 7 1))

First, you wrapped the whole thing in ( ). Drop the leading and trailing parentheses.

Second, that is a line of Scheme code and Scheme does not contain a "print" function. You probably meant to use "display". Also keep in mind that the "display" function only takes a string so you may first need to convert what you pass it to a string.

--
Cheers!

Kevin.

http://www.ve3syb.ca/ |"Nerds make the shiny things that distract Owner of Elecraft K2 #2172 | the mouth-breathers, and that's why we're | powerful!" #include | --Chris Hardwick _______________________________________________ gimp-user-list mailing list
gimp-user-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gimp-user-list

Gary Aitken
2012-09-18 22:07:37 UTC (over 12 years ago)

script-fu: illegal function?

On 09/17/12 21:44, Richard Gitschlag wrote:

That's right - parentheses are not "free" in Scheme scripting, every opening parenthesis must be immediately followed by a function call. When you just want parentheses to group a few statements together with, call the (begin ... ) function:

(begin (function a) (function b) (etc ) ... )

Thanks, both of you for clarifications. Not sure where I saw the "print" but it seems to work:

(define (find-dot txt txtLen offset) (print "foo") "xyz" "pqr") (find-dot "abcd.ef" 7 1)

find-dot"foo"
"pqr"

(define (find-dot txt txtLen offset) (display "foo") "xyz" "pqr") (find-dot "abcd.ef" 7 1)

find-dotfoo"pqr"

The function itself seems to be accepted. It appears the difference between using "display" and using "print" is that "print" outputs enclosing double quotes plus trailing newline; "display" outputs the unadorned string and no trailing newline.

-- Stratadrake
strata_ranger@hotmail.com
--------------------
Numbers may not lie, but neither do they tell the whole truth.

> Date: Mon, 17 Sep 2012 18:47:38 -0400 > From: kevin@ve3syb.ca
> To: gimp-user-list@gnome.org
> Subject: Re: [Gimp-user] script-fu: illegal function? >
> On 12-09-17 02:28 PM, Gary Aitken wrote: > > ((define (find-dot txt txtLen offset) (print "foo")) (find-dot "abcd.ef" 7 1)) >
> First, you wrapped the whole thing in ( ). Drop the leading and trailing > parentheses.
>
> Second, that is a line of Scheme code and Scheme does not contain a "print" > function. You probably meant to use "display". Also keep in mind that the > "display" function only takes a string so you may first need to convert what > you pass it to a string.
>
> --
> Cheers!
>
> Kevin.
>
> http://www.ve3syb.ca/ |"Nerds make the shiny things that distract > Owner of Elecraft K2 #2172 | the mouth-breathers, and that's why we're > | powerful!"
> #include | --Chris Hardwick
> _______________________________________________ > gimp-user-list mailing list
> gimp-user-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gimp-user-list

_______________________________________________ gimp-user-list mailing list
gimp-user-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gimp-user-list

Kevin Cozens
2012-09-18 22:17:44 UTC (over 12 years ago)

script-fu: illegal function?

On 12-09-18 06:07 PM, Gary Aitken wrote:

On 09/17/12 21:44, Richard Gitschlag wrote:

That's right - parentheses are not "free" in Scheme scripting, every opening parenthesis must be immediately followed by a function call. When you just want parentheses to group a few statements together with, call the (begin ... ) function:

(begin (function a) (function b) (etc ) ... )

Thanks, both of you for clarifications. Not sure where I saw the "print" but it seems to work:

I just remembered that "print" is one of the deprecated functions that were part of the old SIOD days of Script-Fu. While "print" will work, it is not standard Scheme and should not be used in new scripts.