|
|
|
[writing to files] Error: set-output-port: needs 1 argument(s) | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
Hi,
Can someone tell me why this script works perfectly well with
Windows:MIT/GNU-Scheme and fails on Windows:Gimp2.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, 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 : 1 main and 3 auxiliary procedures (on
Gimp as on MIT):
;; 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 MIT/GNU Scheme, I call :
(script-fu-exp-medit "the-name-of-a-file" 8)
on Gimp2.4/TinyScheme, I use :
(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"
)
Any ideas?
Thank you for reading and sorry for the long post.
[Gimp Developers] [Gimp Users] [Photos] [Yosemite News] [Yosemite Photos] [Epson Inkjet] [Scanner] [Gimp's Home] [Steve's Art]
![]() |
![]() |