Re: [Gimp-user] does number-string have format options?

2012-05-02 Thread Burlen Loring

On 05/02/2012 02:00 AM, paynekj wrote:

There is no official document for TinyScheme. The closest thing to it is the
official R4RS or R5RS Scheme standard.
The R5RS document can be found at:
http://www.schemers.org/Documents/Standards/R5RS/r5rs.pdf
Not all features documented are supported by TinyScheme but its a good
starting point to see the language syntax or some of the features supported.
If other Scheme interpreters have many different definitions for things like
string parsing they may not be following the Scheme standard, may be using
custom sets of Scheme code, or be using some features from R6RS, or
functions from the Scheme SRFI's.

Isn't it about time that an official document was written for Tiny-Fu? at 
least documenting which features are supported and where differences exist between 
Tiny-Fu and R5RS.

I see it is on your To Do list: http://www.ve3syb.ca/software/tiny-fu/index.html


Yes, That would be super! It's insane that tinyscheme does not have 
documentation!


I use it pretty much entirely in batch mode to post processes large time 
series of rendered images from scientific datasets so from my point of 
view the batch mode scripting is essential. Tinyscheme is lacking very 
basic functionality that is pretty standard these days (eg formatted io 
routines). If there is there any chance to replace tinyscheme with some 
other scheme implementation it would be a huge improvement (0.02$). 
perhaps mit scheme or racket or some other implementation that is more 
full featured? Both of these have excellent documentation as well. It's 
crazy ridiculous that I spent a day to re-invent and debug printf! that 
functionality should be there already. debugging scheme code under the 
gimp is fairly difficult. for example tinyscheme io streams are buffered 
and there is no way to set the buffering mode when you open a stream 
(?!), and there is no fflush equivalent. at least I couldn't find these 
features. the other scheme implementations I looked at when looking for 
a source of documentation seem to have these and other basic and 
essential standard features implemented out of the box.


___
gimp-user-list mailing list
gimp-user-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gimp-user-list


Re: [Gimp-user] does number-string have format options?

2012-05-01 Thread Rob Antonishen
 does number-string have format options? What is the equivalent of
 printf in gimp tinyscheme?

 I am scripting adding axes to an image and need to control of format of
 floating point numbers that will be passed to gimps text generation
 functions.


Here is a helper function I had written to deal with this:

(define (number-fixedstring V D)
  (let ((D (trunc D)))
(string-append
  (number-string (if ( D 0) (trunc V) (round V)))
  (if ( D 0) (string-append . (number-string (round (* (- V (trunc
V)) (pow 10 (trunc D)) )
)
  )
)

In use, the first parameter is the value and the second is the number of
decimals to include.  It rounds to the decimal specified and pads where
zeros if needed.

 (number-fixedstring 3.14159 0)
3
 (number-fixedstring 3.14159 1)
3.1
 (number-fixedstring 3.14159 2)
3.14
 (number-fixedstring 3.14159 3)
3.142
 (number-fixedstring 3.14159 4)
3.1416
 (number-fixedstring 3.14159 5)
3.14159
 (number-fixedstring 3.14159 6)
3.141590
 (number-fixedstring 2.7 0)
3


-Rob A
___
gimp-user-list mailing list
gimp-user-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gimp-user-list


Re: [Gimp-user] does number-string have format options?

2012-05-01 Thread Burlen Loring

great thanks!

I am looking for the programmers reference / documentation for the 
scheme interpreter included with gimp. I have so far not found it, and 
other scheme interpreters seem to have many different definitions for eg 
string parsing functions. Do you know where the documentation such as a 
list of all functions can be found?


Burlen

On 05/01/2012 07:41 AM, Rob Antonishen wrote:


does number-string have format options? What is the equivalent of
printf in gimp tinyscheme?

I am scripting adding axes to an image and need to control of
format of floating point numbers that will be passed to gimps text
generation functions.


Here is a helper function I had written to deal with this:

(define (number-fixedstring V D)
  (let ((D (trunc D)))
(string-append
  (number-string (if ( D 0) (trunc V) (round V)))
  (if ( D 0) (string-append . (number-string (round (* (- V 
(trunc V)) (pow 10 (trunc D)) )

)
  )
)

In use, the first parameter is the value and the second is the number 
of decimals to include.  It rounds to the decimal specified and pads 
where zeros if needed.


 (number-fixedstring 3.14159 0)
3
 (number-fixedstring 3.14159 1)
3.1
 (number-fixedstring 3.14159 2)
3.14
 (number-fixedstring 3.14159 3)
3.142
 (number-fixedstring 3.14159 4)
3.1416
 (number-fixedstring 3.14159 5)
3.14159
 (number-fixedstring 3.14159 6)
3.141590
 (number-fixedstring 2.7 0)
3


-Rob A


___
gimp-user-list mailing list
gimp-user-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gimp-user-list