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

Lists, Arrays and Vectors [was Re: Re: Tiny-Fu: A new plug-in for GIMP]

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.

23 of 24 messages available
Toggle history

Please log in to manage your subscriptions.

Tiny-Fu: A new plug-in for GIMP Kevin Cozens 06 Jul 18:12
  Tiny-Fu: A new plug-in for GIMP Sven Neumann 06 Jul 19:18
   Tiny-Fu: A new plug-in for GIMP Simon Budig 06 Jul 19:34
   Tiny-Fu: A new plug-in for GIMP Kevin Cozens 06 Jul 20:59
    Tiny-Fu: A new plug-in for GIMP Joao S. O. Bueno 06 Jul 21:27
     Tiny-Fu: A new plug-in for GIMP Kevin Cozens 06 Jul 21:34
Tiny-Fu: A new plug-in for GIMP Markus Triska 06 Jul 20:18
  Tiny-Fu: A new plug-in for GIMP Kevin Cozens 06 Jul 21:12
20040706173836.6CE5810470@l... 07 Oct 20:23
  Tiny-Fu: A new plug-in for GIMP Markus Triska 07 Jul 02:24
   Tiny-Fu: A new plug-in for GIMP Markus Triska 07 Jul 02:58
    Tiny-Fu: A new plug-in for GIMP Sven Neumann 07 Jul 01:45
     Tiny-Fu: A new plug-in for GIMP Kevin Cozens 07 Jul 04:05
      Lists, Arrays and Vectors [was Re: Re: Tiny-Fu: A new plug-in for GIMP] Shlomi Fish 07 Jul 11:17
       Lists, Arrays and Vectors [was Re: Re: Tiny-Fu: A new plug-in for GIMP] Kevin Cozens 07 Jul 16:51
        Lists, Arrays and Vectors [was Re: Re: Tiny-Fu: A new plug-in for GIMP] Markus Triska 08 Jul 02:09
         Lists, Arrays and Vectors [was Re: Re: Tiny-Fu: A new plug-in for GIMP] Kevin Cozens 08 Jul 18:55
          Lists, Arrays and Vectors [was Re: Re: Tiny-Fu: A new plug-in for GIMP] Markus Triska 09 Jul 19:38
           Lists, Arrays and Vectors [was Re: Re: Tiny-Fu: A new plug-in for GIMP] Kevin Cozens 10 Jul 06:02
            Lists, Arrays and Vectors [was Re: Re: Tiny-Fu: A new plug-in for GIMP] Sven Neumann 10 Jul 12:00
             Lists, Arrays and Vectors [was Re: Re: Tiny-Fu: A new plug-in for GIMP] Kevin Cozens 10 Jul 19:46
              Lists, Arrays and Vectors [was Re: Re: Tiny-Fu: A new plug-in for GIMP] Markus Triska 11 Jul 01:19
               Lists, Arrays and Vectors [was Re: Re: Tiny-Fu: A new plug-in for GIMP] Kevin Cozens 10 Jul 22:02
              Lists, Arrays and Vectors [was Re: Re: Tiny-Fu: A new plug-in for GIMP] Sven Neumann 12 Jul 09:23
Kevin Cozens
2004-07-06 18:12:04 UTC (almost 20 years ago)

Tiny-Fu: A new plug-in for GIMP

Greetings, everyone.

For some months now I have been working on a new plug-in for the 2.1 version of GIMP. I have been calling this new plug-in Tiny-Fu. Some of the people on this list who use the #gimp IRC channel have already heard about this plug-in.

Tiny-Fu is a plug-in for the 2.1 (and later) series of the GIMP. It is essentially a modified version of the Script-Fu plug-in but with some major differences. The main difference is in the Scheme interpreter being used.

I have created a web page for Tiny-Fu. The URL for the page is: http://www.interlog.com/~kcozens/software/gimp/tiny-fu.html A tarball of Tiny-Fu is available but at the moment it must be hooked in to the GIMP 2.1 source tree using the supplied patch file. A standalone version will be available later.

The web page contains additional information about the plug-in as well as the status of the work being done on it. Currently it is somewhere between the alpha and beta stage of development. It ran its first script in April of this year (ts-helloworld.sct) and as of July 6, I have updated 57 of the 96 Script-Fu scripts to work with Tiny-Fu.

Cheers!

Kevin. (http://www.interlog.com/~kcozens/)

Owner of Elecraft K2 #2172 |"What are we going to do today, Borg?" E-mail:kcozens at interlog dot com|"Same thing we always do, Pinkutus: Packet:ve3syb@ve3yra.#con.on.ca.na| Try to assimilate the world!" #include | -Pinkutus & the Borg

Sven Neumann
2004-07-06 19:18:37 UTC (almost 20 years ago)

Tiny-Fu: A new plug-in for GIMP

Hi,

Kevin Cozens writes:

I have created a web page for Tiny-Fu. The URL for the page is: http://www.interlog.com/~kcozens/software/gimp/tiny-fu.html A tarball of Tiny-Fu is available but at the moment it must be hooked in to the GIMP 2.1 source tree using the supplied patch file. A standalone version will be available later.

The web page contains additional information about the plug-in as well as the status of the work being done on it. Currently it is somewhere between the alpha and beta stage of development. It ran its first script in April of this year (ts-helloworld.sct) and as of July 6, I have updated 57 of the 96 Script-Fu scripts to work with Tiny-Fu.

We talked about script-fu and tiny-fu at GIMPCon and agreed that we'd like to see Script-Fu removed from the GIMP source tree as soon as Tiny-Fu is available as a separate package that can replace it. This could happen for GIMP 2.2 provided that Tiny-Fu is ready by that time.

I have a couple of questions about Tiny-Fu. Please excuse if they are already answered on your web-page, I didn't look at it yet. Just point me to the FAQ then.

(1) Is Tiny-Fu supposed to run scripts written for Script-Fu? If so, will this be some kind of compatibility layer or perhaps just a script that helps to convert old scripts?

(2) Is Tiny-Fu supposed to run as a permanent extension like the current Script-Fu implementation or will it start a new interpreter when needed and exit when the script is done?

(3) Somewhat related to question (2), will Tiny-Fu allow scripts to be run concurrently? I know that the GIMP core doesn't like this very much at the moment but it would still be nice to have a script engine that allows it. That would put more pressure on making the core reentrant.

Sven

Simon Budig
2004-07-06 19:34:51 UTC (almost 20 years ago)

Tiny-Fu: A new plug-in for GIMP

Sven Neumann (sven@gimp.org) wrote:

(1) Is Tiny-Fu supposed to run scripts written for Script-Fu? If so, will this be some kind of compatibility layer or perhaps just a script that helps to convert old scripts?

There are a few small differences between Tiny-Scheme and SIOD, some of them are listed on the webpage.

Tiny-Fu will not run the same scripts as Script-Fu, since SIOD allows some dirty tricks that are not nice. The most evil thing (that gets fixed by Tiny-Fu) is the use of (set! ) on a not yet defined variable.

Some scripts do that kind of stuff and there even were some bugs in the Scripts because of this. These Scripts need to become sanitized to be able to run under the new Scheme interpreter.

There are some other differences, but I am not exactly sure about their consequences. Some might be hidden by some small helper functions, I am however not sure if this is desireable.

Bye, Simon

Markus Triska
2004-07-06 20:18:12 UTC (almost 20 years ago)

Tiny-Fu: A new plug-in for GIMP

You wrote:

Tiny-Fu is a plug-in for the 2.1 (and later) series of the GIMP. It is essentially a modified version of the Script-Fu plug-in but with some major differences. The main difference is in the Scheme interpreter being used.

TinyScheme does not support arrays at the moment - do you plan to implement this feature (i.e., fork TinyScheme), or is such a feature planned by the TinyScheme developers?

Otherwise, I can convert scripts that are currently using arrays to use lists instead if you have not already done so.

Best regards, Markus.

Kevin Cozens
2004-07-06 20:59:38 UTC (almost 20 years ago)

Tiny-Fu: A new plug-in for GIMP

At 01:18 PM 07/06/2004, Sven Neumann wrote:

We talked about script-fu and tiny-fu at GIMPCon and agreed that we'd like to see Script-Fu removed from the GIMP source tree as soon as Tiny-Fu is available as a separate package that can replace it.

The Tiny-Fu tarball can exist in the GIMP source tree just as Script-Fu does now since its of a comparable size. Having it as a separate package would make it easier for others to try it who aren't building GIMP from source.

This
could happen for GIMP 2.2 provided that Tiny-Fu is ready by that time.

It would be helpful to know of anything that might block this. Other than the lack of support for binary data (ie. it can't work with GIMP parasites) at the moment, and the translation files need to be updated, I think Tiny-Fu is in as good a shape (if not better in some ways) than Script-Fu.

I have a couple of questions about Tiny-Fu.

No, problem. I don't really have an FAQ yet so your questions can help me create one.

(1) Is Tiny-Fu supposed to run scripts written for Script-Fu?

The answer is yes, however...

I wanted to keep Script-Fu on my machine while working on Tiny-Fu. As a result, I had to make them co-exist. The scripts run by Tiny-Fu must end in .sct rather than .scm as they do for Script-Fu. Also, any references to Script-Fu in scripts must be changed to Tiny-Fu (preserving case).

Once those changes have been done, some scripts will work as is. Some scripts need to have variables defined before first use. Some scripts (especially those that work with GIMP parasites, use arrays, or use features of Scheme unique to the SIOD interpreter) will need other changes. The web page contains some information about updating a Script-Fu script for use with Tiny-Fu.

If so,
will this be some kind of compatibility layer or perhaps just a script that helps to convert old scripts?

A script could be created to handle the simpler changes required to make a Script-Fu script work with Tiny-Fu but some scripts will still require changes to be made by hand.

(2) Is Tiny-Fu supposed to run as a permanent extension like the current Script-Fu implementation or will it start a new interpreter when needed and exit when the script is done?

I made a full copy of Script-Fu as the starting point for Tiny-Fu. It currently works just like Script-Fu does but that doesn't meant it can't (or won't) change in the future.

(3) Somewhat related to question (2), will Tiny-Fu allow scripts to be run concurrently?

[snip]

That would put more pressure on making the core reentrant.

This quote from the TinyScheme authors web site might help. "As an embedded interpreter, it [TinyScheme] allows multiple interpreter states to coexist in the same program, without any interference between them."

With the recent changes to GIMP regarding context and the fact I access all features of the TinyScheme interpreter via its interface mechanism, it should be possible to have scripts run concurrently.

Cheers!

Kevin. (http://www.interlog.com/~kcozens/)

Owner of Elecraft K2 #2172 |"What are we going to do today, Borg?" E-mail:kcozens at interlog dot com|"Same thing we always do, Pinkutus: Packet:ve3syb@ve3yra.#con.on.ca.na| Try to assimilate the world!" #include | -Pinkutus & the Borg

Kevin Cozens
2004-07-06 21:12:32 UTC (almost 20 years ago)

Tiny-Fu: A new plug-in for GIMP

At 02:18 PM 07/06/2004, Markus wrote:

TinyScheme does not support arrays at the moment - do you plan to implement this feature (i.e., fork TinyScheme), or is such a feature planned by the TinyScheme developers?

No, I do NOT want to fork TinyScheme. I am trying to keep patches to TinyScheme which would be only be required for use with Tiny-Fu to a minimum. Some TinyScheme patches I currently have will be passed back to the author of TinyScheme so others can benefit from those changes and/or bug-fixes.

Arrays as used with SIOD are not defined in the R5RS (the current document defining the Scheme language). I have chosen to use lists instead.

Otherwise, I can convert scripts that are currently using arrays to use lists instead if you have not already done so.

I have no objections if you would like to update some of the scripts which use arrays. I would suggest you contact me before hand so I can provide a list of the scripts which need to be updated to avoid duplicating work.

Cheers!

Kevin. (http://www.interlog.com/~kcozens/)

Owner of Elecraft K2 #2172 |"What are we going to do today, Borg?" E-mail:kcozens at interlog dot com|"Same thing we always do, Pinkutus: Packet:ve3syb@ve3yra.#con.on.ca.na| Try to assimilate the world!" #include | -Pinkutus & the Borg

Joao S. O. Bueno
2004-07-06 21:27:35 UTC (almost 20 years ago)

Tiny-Fu: A new plug-in for GIMP

On Tuesday 06 July 2004 15:59, Kevin Cozens wrote:

It would be helpful to know of anything that might block this. Other than the lack of support for binary data (ie. it can't work with GIMP parasites) at the moment, and the translation files need to be updated, I think Tiny-Fu is in as good a shape (if not better in some ways) than Script-Fu.

OOPS...

One of the major showstopers for script-fu as of lately is it inability to handle UTF-8 strings. Is tiny scheme able to do so?

Kevin Cozens
2004-07-06 21:34:27 UTC (almost 20 years ago)

Tiny-Fu: A new plug-in for GIMP

At 03:27 PM 07/06/2004, Joao wrote:

One of the major showstopers for script-fu as of lately is it inability to handle UTF-8 strings. Is tiny scheme able to do so?

No, TinyScheme does not handle UTF-8 strings. UTF-8 support is already on the ToDo list since Sven already raised the issue on #gimp.

Cheers!

Kevin. (http://www.interlog.com/~kcozens/)

Owner of Elecraft K2 #2172 |"What are we going to do today, Borg?" E-mail:kcozens at interlog dot com|"Same thing we always do, Pinkutus: Packet:ve3syb@ve3yra.#con.on.ca.na| Try to assimilate the world!" #include | -Pinkutus & the Borg

Sven Neumann
2004-07-07 01:45:16 UTC (almost 20 years ago)

Tiny-Fu: A new plug-in for GIMP

Hi,

Markus Triska writes:

Are any of them already ported? If not, I will change them to not use arrays.

Well, at least the trivial cases (where the arrays are used only inside the script) - there are some PDB functions that use arrays as arguments or as return values, and I don't know what to do with them, for example gimp-cursves-spline and gimp-image-get-layers.

The fact that the PDB uses arrays doesn't necessarily mean that a language binding such as Tiny-Fu needs to represent them as arrays. One of the most annoying bits of Script-Fu is that it forces you to work with arrays even though the natural choice for a scheme dialekt would be lists. If Tiny-Fu cannot provide backward-compatibility, then it should overcome this mistake and map the PDB API to lists.

Sven

Markus Triska
2004-07-07 02:24:04 UTC (almost 20 years ago)

Tiny-Fu: A new plug-in for GIMP

I have no objections if you would like to update some of the scripts which use arrays. I would suggest you contact me before hand so I can provide a list of the scripts which need to be updated to avoid duplicating work.

These scripts (included with 2.0) currently use arrays:

addborder.scm alien-glow-arrow.scm
beveled-pattern-arrow.scm
blend-anim.scm
chrome-it.scm
copy-visible.scm
crystal-logo.scm
grid-system.scm
hsv-graph.scm
line-nova.scm
neon-logo.scm
sota-chrome-logo.scm
spyrogimp.scm

Are any of them already ported? If not, I will change them to not use arrays.

Best regards, Markus.

Markus Triska
2004-07-07 02:58:08 UTC (almost 20 years ago)

Tiny-Fu: A new plug-in for GIMP

Are any of them already ported? If not, I will change them to not use arrays.

Well, at least the trivial cases (where the arrays are used only inside the script) - there are some PDB functions that use arrays as arguments or as return values, and I don't know what to do with them, for example gimp-cursves-spline and gimp-image-get-layers.

There seems to be some correlation between arrays and lists in the PDB, but not too much. Am I right in assuming that a PDB STRINGARRAY is equivalent to a (Scheme) list in Script-Fu? This seems to be handled differently for INTARRAY, which remains a (nonstandard) Scheme-array. So what it comes down to is: How do I convert a PDB's array (of integers) to a Scheme list in a script and vice versa?

Markus.

Kevin Cozens
2004-07-07 04:05:49 UTC (almost 20 years ago)

Tiny-Fu: A new plug-in for GIMP

On Tue, 2004-07-06 at 19:45, Sven Neumann wrote:

The fact that the PDB uses arrays doesn't necessarily mean that a language binding such as Tiny-Fu needs to represent them as arrays. One of the most annoying bits of Script-Fu is that it forces you to work with arrays even though the natural choice for a scheme dialekt would be lists. If Tiny-Fu cannot provide backward-compatibility, then it should overcome this mistake and map the PDB API to lists.

Tiny-Fu makes no attempt to provide backwards compatability with the SIOD Scheme interpreter way of doing things. It expects scripts to follow the current Scheme standard as defined in the R5RS document.

Since the R5RS does not define an array type, any script which uses arrays either internally or when dealing with PDB calls needs to be modified to use a list. The marshalling code of Tiny-Fu converts between PDB *ARRAY and Scheme lists as needed. The alternative would be to use a Scheme vector but instead of a list. Using a list seemed like the simplest approach.

Shlomi Fish
2004-07-07 11:17:01 UTC (almost 20 years ago)

Lists, Arrays and Vectors [was Re: Re: Tiny-Fu: A new plug-in for GIMP]

0

Kevin Cozens
2004-07-07 16:51:43 UTC (almost 20 years ago)

Lists, Arrays and Vectors [was Re: Re: Tiny-Fu: A new plug-in for GIMP]

At 05:17 AM 07/07/2004, Shlomi Fish wrote:

Are you sure using lists instead of vectors is the right thing to do? Lists are linked lists and as such accessing the i'th element is O(i). In vectors it is O(1). This can cause an order of complexity increase in handling them.

No, I'm not sure. For the few scripts I looked at (and for ease of implementation), using a list was the easier route to have something functional during the early development stages. Using vectors instead of a simple list would mean the ability to use functions which would provide rough equivalents to the SIOD interpreters array manipulation functions.

In any case, this may not be an issue, because a programmer can temporarily use a vector, and convert it to a list before calling the PDB entries.

Conversion is simple through the use of vector->list and list->vector.

I will take a closer look at using vectors. It will simplify the work needed to update old Script-Fu scripts for use with Tiny-Fu. I will start by converting between list and vector. If the approach works well, I will bit the bullet and update the marshalling code to use vectors for the *ARRAY types.

Cheers!

Kevin. (http://www.interlog.com/~kcozens/)

Owner of Elecraft K2 #2172 |"What are we going to do today, Borg?" E-mail:kcozens at interlog dot com|"Same thing we always do, Pinkutus: Packet:ve3syb@ve3yra.#con.on.ca.na| Try to assimilate the world!" #include | -Pinkutus & the Borg

Markus Triska
2004-07-08 02:09:45 UTC (almost 20 years ago)

Lists, Arrays and Vectors [was Re: Re: Tiny-Fu: A new plug-in for GIMP]

Are you sure using lists instead of vectors is the right thing to do? Lists are linked lists and as such accessing the i'th element is O(i). In vectors it is O(1). This can cause an order of complexity increase in handling them.

This is true, but not much of a problem, since most scripts only use either the first 1 or 2 elements of arrays or work on typically very short arrays, or want to pass a (short) array to PDB, where there is no difference between list-construction and setting every element of a vector explicitly (the latter possibly being even more inefficient).

No, I'm not sure. For the few scripts I looked at (and for ease of implementation), using a list was the easier route to have something functional during the early development stages. Using vectors instead of a simple list would mean the ability to use functions which would provide rough equivalents to the SIOD interpreters array manipulation functions.

As I understand it, there are even *exact* equivalents to the current "array" type. No wonder, since a Lisp vector is a special case of an array (one-dimensional). In Script-Fu, "arrays" are indeed vectors.

I will take a closer look at using vectors. It will simplify the work needed to update old Script-Fu scripts for use with Tiny-Fu. I will start by converting between list and vector. If the approach works well, I will bit the bullet and update the marshalling code to use vectors for the *ARRAY types.

I also opt for vector because apart from being the natural Scheme equivalent to PDB's one-dimensional arrays, it makes writing plug-ins easier for people that have no to little practice in converting common "for/while" loops using tail-recursion, and current scripts would work practically unmodified, without explicit conversions list->vector that would only cost time (with everybody ending up calling these instead of working on lists most of the time).

Markus.

Kevin Cozens
2004-07-08 18:55:44 UTC (almost 20 years ago)

Lists, Arrays and Vectors [was Re: Re: Tiny-Fu: A new plug-in for GIMP]

At 08:09 PM 07/07/2004, Markus Triska wrote:

I also opt for vector because apart from being the natural Scheme equivalent to PDB's one-dimensional arrays, it makes writing plug-ins easier for people that have no to little practice in converting common "for/while" loops using tail-recursion, and current scripts would work practically unmodified, without explicit conversions list->vector that would only cost time (with everybody ending up calling these instead of working on lists most of the time).

By using vectors I was able to very quickly update the portion of those scripts which used SIOD array functions. I have not changed the Tiny-Fu marshalling code yet but I will do that soon and release a new tarball.

Cheers!

Kevin. (http://www.interlog.com/~kcozens/)

Owner of Elecraft K2 #2172 |"What are we going to do today, Borg?" E-mail:kcozens at interlog dot com|"Same thing we always do, Pinkutus: Packet:ve3syb@ve3yra.#con.on.ca.na| Try to assimilate the world!" #include | -Pinkutus & the Borg

Markus Triska
2004-07-09 19:38:17 UTC (almost 20 years ago)

Lists, Arrays and Vectors [was Re: Re: Tiny-Fu: A new plug-in for GIMP]

By using vectors I was able to very quickly update the portion of those scripts which used SIOD array functions. I have not changed the Tiny-Fu marshalling code yet but I will do that soon and release a new tarball.

Now since there is essentially a one-to-one correspondence between Tiny-Fu's vectors and Script-Fu's "arrays", it might be worth considering adding compatibility definitions to "init.scm" (similar to gimpcompat.h for plug-ins), that would, depending on a certain "compatibility"-switch in a configuration file (or in "init.scm" itself, but I don't know if every user will get a copy or you will install the file in /usr/gimpsomething...), "define ...." the current array operations and map them to corresponding vector functions. You could then (depending on said switch) also re-define set! to use "define" if a variable is not "defined?".

Markus.

Kevin Cozens
2004-07-10 06:02:37 UTC (almost 20 years ago)

Lists, Arrays and Vectors [was Re: Re: Tiny-Fu: A new plug-in for GIMP]

At 01:38 PM 07/09/2004, you wrote:

Now since there is essentially a one-to-one correspondence between Tiny-Fu's vectors and Script-Fu's "arrays", it might be worth considering adding compatibility definitions to "init.scm" (similar to gimpcompat.h for plug-ins), that would, depending on a certain "compatibility"-switch in a configuration file (or in "init.scm" itself, but I don't know if every user will get a copy or you will install the file in /usr/gimpsomething...), "define ...." the current array operations and map them to corresponding vector functions. You could then (depending on said switch) also re-define set! to use "define" if a variable is not "defined?".

I don't really want a "compatibility"-switch. Instead, old Script-Fu scripts should be updated so they do things the way they are supposed to be done in Scheme rather than how the old SIOD interpreter let script writers get away with some things (ie. not defining variables). It forces a review of the code. For example, I noticed that one script defined an internal routine to compute a least common multiple rather. I deleted the routine and used the standard Scheme routine 'lcm'.

I am planning on putting together a Perl script that will take a Script-Fu script and update as much of it as possible for use with Tiny-Fu. I know of quite a few mappings from SIOD to TinyScheme that can be applied. Pre-defining variables and changing while loops to do loops will still have to be done by hand.

Cheers!

Kevin. (http://www.interlog.com/~kcozens/)

Owner of Elecraft K2 #2172 |"What are we going to do today, Borg?" E-mail:kcozens at interlog dot com|"Same thing we always do, Pinkutus: Packet:ve3syb@ve3yra.#con.on.ca.na| Try to assimilate the world!" #include | -Pinkutus & the Borg

Sven Neumann
2004-07-10 12:00:37 UTC (almost 20 years ago)

Lists, Arrays and Vectors [was Re: Re: Tiny-Fu: A new plug-in for GIMP]

Hi,

Kevin Cozens writes:

I don't really want a "compatibility"-switch. Instead, old Script-Fu scripts should be updated so they do things the way they are supposed to be done in Scheme rather than how the old SIOD interpreter let script writers get away with some things (ie. not defining variables). It forces a review of the code. For example, I noticed that one script defined an internal routine to compute a least common multiple rather. I deleted the routine and used the standard Scheme routine 'lcm'.

I understand your reasons but a compatibility mode (if that is feasible at all) would allow us to ditch Script-Fu in favor of Tiny-Fu. If no such mode is available we will have to continue to ship Script-Fu for quite a while. I don't think we can just tell people that all their scripts won't work any longer when they update GIMP the next time.

Sven

Kevin Cozens
2004-07-10 19:46:25 UTC (almost 20 years ago)

Lists, Arrays and Vectors [was Re: Re: Tiny-Fu: A new plug-in for GIMP]

At 06:00 AM 07/10/2004, Sven wrote:

Kevin Cozens writes:

I don't really want a "compatibility"-switch. Instead, old Script-Fu scripts should be updated so they do things the way they are supposed to be done in Scheme rather than how the old SIOD interpreter let script writers get away with some things (ie. not defining variables).

I understand your reasons but a compatibility mode (if that is feasible at all) would allow us to ditch Script-Fu in favor of Tiny-Fu. If no such mode is available we will have to continue to ship Script-Fu for quite a while.

Many (most?) of the needed changes between SIOD and TinyScheme could be handled via a set of additional define statements in a separate file included from the main TinyScheme init file. Handling the while loop should be possible but that requires a non-trivial Scheme define. All of these additional defines should be flagged in documentation as deprecated.

That just leaves the problem of variables used in a set! statement which are not defined before first use. Tiny-Fu displays an error message stating "unbound variable" along with the name of the variable when this situation is encountered. The solution is to add a line to the let block with the name of the variable in parenthesis (no initial value is required). A few of the standard Script-Fu scripts had a define that used set! but no let statement so a let had to be added first. I don't see how this can be handled automatically without a change to TinyScheme itself.

Script-Fu scripts written for GIMP 1.2 won't work under GIMP 2.x without some changes due mainly to differences in the API. In what version of GIMP would it be possible to have the compatibility features of Tiny-Fu removed?

Cheers!

Kevin. (http://www.interlog.com/~kcozens/)

Owner of Elecraft K2 #2172 |"What are we going to do today, Borg?" E-mail:kcozens at interlog dot com|"Same thing we always do, Pinkutus: Packet:ve3syb@ve3yra.#con.on.ca.na| Try to assimilate the world!" #include | -Pinkutus & the Borg

Kevin Cozens
2004-07-10 22:02:33 UTC (almost 20 years ago)

Lists, Arrays and Vectors [was Re: Re: Tiny-Fu: A new plug-in for GIMP]

On Sat, 2004-07-10 at 19:19, Markus Triska wrote:

I have explained this above - re-define "set!" to use the TinyScheme "defined?" command to see if a variable is already defined, and if this is not the case, define it.

Now I understand what you were getting at earlier. That would work only I don't see defined? as being available in the R5RS. However, a check of the interpreter indicates it does have such a function so this should be doable even if it is outside the current standard (perhaps its in of the suggested additions and will be part of R6RS currently being developed).

I think I may be able to use that to deal with the missing symbol-bound? function of SIOD.

Markus Triska
2004-07-11 01:19:54 UTC (almost 20 years ago)

Lists, Arrays and Vectors [was Re: Re: Tiny-Fu: A new plug-in for GIMP]

The solution is to add a line to the let block with the name of the variable in parenthesis (no initial value is required). A few of the standard Script-Fu scripts had a define that used set! but no let statement so a let had to be added first. I don't see how this can be handled automatically without a change to TinyScheme itself.

I have explained this above - re-define "set!" to use the TinyScheme "defined?" command to see if a variable is already defined, and if this is not the case, define it.

Markus.

Sven Neumann
2004-07-12 09:23:38 UTC (almost 20 years ago)

Lists, Arrays and Vectors [was Re: Re: Tiny-Fu: A new plug-in for GIMP]

Hi,

Kevin Cozens writes:

Script-Fu scripts written for GIMP 1.2 won't work under GIMP 2.x without some changes due mainly to differences in the API. In what version of GIMP would it be possible to have the compatibility features of Tiny-Fu removed?

The next time we release a version that doesn't guarantee backward compatibility. This will most probably be called GIMP 3.0 then.

Sven