Hi,

I've asked "script-fu" yahoo group where no-one seems to know the trouble.
Can someone here tell me, please, why this script works perfectly well with
Windows:MIT/GNU-Scheme and fails on Windows:Gimp2.4.4/TinyScheme ?


It should create a file (whose name is given as an argument) which
looks like this :


____________ beginning of the file having 4096 lines______

0 0
0 0.8
0 1.6
0 2.4
0 3.2
0 4
0 4.8
0 5.6
0 6.4
.
.
.
0 44.8
0 45.6
0 46.4
0 47.2
0 48
0 48.8
0 49.6
0 50.4
0.8 0
0.8 0.8
0.8 1.6
0.8 2.4
0.8 3.2
0.8 4
.
.
.
...
.
.
.
50.4 42.4
50.4 43.2
50.4 44.
50.4 44.8
50.4 45.6
50.4 46.4
50.4 47.2
50.4 48.
50.4 48.8
50.4 49.6
50.4 50.4
______________end of the file_________


for the argument inPas given equal to 8.


Instead, with Gimp2.4.4, there always is an error and my file ends too
soon :


_______beginning of the file having far less than 4096 lines______
0 0
0 0.8
0 1.6
0 2.4
0 3.2
0 4
0 4.8
0 5.6
0 6.4
.
.
.
11.2 32.8
11.2 33.6
11.2 34.4
11.2 35.2
11.2 36
11.2 36.8
11.2 37.6
11.2 Error: set-output-port: needs 1 argument(s)
______________end of the file_________


My script uses 4 procedures (the same ones on
Gimp as on MIT) : 1 main and 3 auxiliary procedures :


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; the construct-list procedure which increments the first number :
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(define (construct-list row height width pas port)
    (cond
        ((< row height)
            (construct-list (+ row pas) height width pas (construct-list-col (/ 
row 10.0) 0 width pas port)))
        (else port)))



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; the construct-list-col procedure which increments the second number :
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(define (construct-list-col x col width pas port)
    (cond
        ((< col width)
            (element->port x port)
            (element->port (/ col 10.0) port)
            (newline port)
            (construct-list-col x (+ col pas) width pas port))
        (else port)))




;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;the element->port procedure which actually writes to the file
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(define (element->port x port)
    (if (number? x)
        (begin
            (write x port)
            (write-char #\space port))))


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; the main procedure
;;;;;;;;;;;;;;;;;;;;;;;;;;;;



(define (script-fu-exp-medit inFileName inPas)
    (define (subscript tour p)
        (cond
            ((= tour 0)
                (subscript
                    1
                    (construct-list
                        0 ; row
                        512 ;heigt
                        512 ;width
                        inPas
                        p)))
        (else (close-output-port p))))
    (subscript 0 (open-output-file inFileName)))



- On windows:Gimp2.4.4, those 4 procedures together with the call

(script-fu-exp-medit "the-name-of-a-file" 8)

produce, on the Console Script-fu TiinyScheme, the wrong file (and the 
set-output-port error message written inside the file) without any message 
neither from the console nor from Gimp.



- On Gimp2.4.4, the use of this registration :


(script-fu-register
"script-fu-exp-medit" ;func name
"Export Medit" ;menu label
"Exports the current image layer as a Medit file.";description
"My Name" ;author
"copyright 2008, My Name" ;copyright notice
"Mars 6, 2008" ;date created
"RGB*" ;image type that the script works on
SF-FILENAME "Fichier en sortie "
"C:\\gimp-2.4\\production\\remplir_Ici" ;a string variable
SF-ADJUSTMENT "taille du pas" '(8 1 256 1 10 0 1)
)

(script-fu-menu-register "script-fu-exp-medit"
"Somewhere"
)



produces the wrong file (and the set-output-port error message written inside 
the file) with an error message from Gimp :

"Message Export Medit

Erreur à l'exécution de
(script-fu-exp-medit "the-name-of-a-file" 8)
"


- On MIT/GNU Scheme, I call :

(script-fu-exp-medit "the-name-of-a-file" 8)

and everything works fine.

Any ideas?


Thank you for reading and sorry for the long post.
_________________________________________________________________
Créez gratuitement votre disque dur virtuel Windows Live SkyDrive !
http://skydrive.live.com
_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Reply via email to