Error writing file

62 views
Skip to first unread message

JS

unread,
Oct 8, 2012, 5:37:18 PM10/8/12
to qil...@googlegroups.com
Using cd with absolute path results in error for me:


Shen 2010, copyright (C) 2010 Mark Tarver
www.shenlanguage.org, version 6.1
running under Common Lisp, implementation: CLisp
port 1.2 ported by Mark Tarver


(0-) (cd "C:/dev/workspace/ShenJ/src/main/shen/")
"C:/dev/workspace/ShenJ/src/main/shen//"

(1-) (write-to-file "test.txt" "out")
PARSE-NAMESTRING: syntax error in filename "C:/dev/workspace/ShenJ/src/main/shen
//C:/dev/workspace/ShenJ/src/main/shen//test.txt" at position 39

(2-)

Mark Tarver

unread,
Oct 9, 2012, 8:22:23 AM10/9/12
to Qilang
Try missing out the final / in the cd string. Shen puts this in
automatically; you have // in the pathname which is wrong.

Mark

On Oct 8, 10:37 pm, JS <j...@mentics.com> wrote:
> Using cd with absolute path results in error for me:
>
> Shen 2010, copyright (C) 2010 Mark Tarverwww.shenlanguage.org, version 6.1

JS

unread,
Oct 9, 2012, 10:52:46 AM10/9/12
to qil...@googlegroups.com
On Tue, Oct 9, 2012 at 5:22 AM, Mark Tarver <dr.mt...@gmail.com> wrote:
> Try missing out the final / in the cd string. Shen puts this in
> automatically; you have // in the pathname which is wrong.

That doesn't make a difference:

(0-) (cd "C:/dev/workspace/ShenJ/src/main/shen")
"C:/dev/workspace/ShenJ/src/main/shen/"

(1-) (write-to-file "test.txt" "out")
PARSE-NAMESTRING: syntax error in filename "C:/dev/workspace/ShenJ/src/main/shen
/C:/dev/workspace/ShenJ/src/main/shen/test.txt" at position 38


Look at the error closely. It's duplicating the whole path:
C:/dev/workspace/ShenJ/src/main/shen/C:/dev/workspace/ShenJ/src/main/shen/test.txt

Notice the 2 C:'s?

Mark Tarver

unread,
Oct 10, 2012, 7:56:26 AM10/10/12
to Qilang
I ran this with a Lisp TRACE.

(25-) (write-to-file "test.txt" "out")

1. Trace: (intmake-string '"~A" '#(shen-tuple write-to-file NIL))
1. Trace: intmake-string ==> "write-to-file"
1. Trace:
(intmake-string '"~A~A"
'#(shen-tuple "C:/dev/workspace/ShenJ/src/main/shen/"
#(shen-tuple "test.txt" NIL)))
1. Trace: intmake-string ==> "C:/dev/workspace/ShenJ/src/main/shen/
test.txt"
PARSE-NAMESTRING: syntax error in filename "C:/dev/workspace/ShenJ/src/
main/shen/C:/dev/workspace/ShenJ/src/main/shen/test.txt" at position
38

As far as I can make out Shen parses your pathname correctly and CLisp
prints out this error. Very odd.

Mark

Mark Tarver

unread,
Nov 19, 2012, 11:14:41 AM11/19/12
to Qilang
None here. look at your cd command.

Shen 2010, copyright (C) 2010 Mark Tarver
www.shenlanguage.org, version 7.1
running under Common Lisp, implementation: CLisp
port 1.2 ported by Mark Tarver


(0-) (cd "C:")
"C:/"

(1-) (load "ffi.shen")
ffi
push
macro
call-ffi-macro
process-ffi-call
quote
[[tcl/tk (@p shen->tcl send-tcl) (@p tcl->shen receive-tcl)]]
shen->tcl
send-tcl
flush-tcl-tk
tcl-stream
create-tcl-stream
open-process-stream
receive-tcl
receive-tcl-help
tcl->shen
macro
make!-macro
make
set-all!
set!
get!
br-string
chname
macro
pack!-macro
pack
list->string

run time: 0.35880230367183685 secs
loaded

(2-)

On Nov 16, 6:22 pm, taotree <jshell...@gmail.com> wrote:
> I'm still seeing the error with absolute path names in shen-clisp 7.
>
> Shen 2010, copyright (C) 2010 Mark Tarverwww.shenlanguage.org, version 7
> running under Common Lisp, implementation: CLisp
> port 1.2 ported by Mark Tarver
>
> (0-) (cd "C:/")
> "C://"
>
> (1-) (write-to-file "test.txt" "test out")
> PARSE-NAMESTRING: syntax error in filename "C://C://test.txt" at position 5
>
> (2-)

jo...@mentics.com

unread,
Nov 19, 2012, 3:31:31 PM11/19/12
to qil...@googlegroups.com
The problem is with write-to-file. load works fine for me, too.

You were able to reproduce this problem before, I think.

https://groups.google.com/forum/?fromgroups=#!searchin/Qilang/clisp$20parses/qilang/eCO03FKJCnM/coFnpPvleiwJ




On Mon, Nov 19, 2012 at 8:14 AM, Mark Tarver <dr.mt...@gmail.com> wrote:
> None here. look at your cd command.
>
> Shen 2010, copyright (C) 2010 Mark Tarver
> www.shenlanguage.org, version 7.1
> running under Common Lisp, implementation: CLisp
> port 1.2 ported by Mark Tarver
>
>
> (0-) (cd "C:")
> "C:/"
>
> (1-) (load "ffi.shen")
> ffi
> push
...

Mark Tarver

unread,
Nov 20, 2012, 12:05:30 PM11/20/12
to Qilang
Got it.

write-file in load.shen should read

(define write-to-file
File Text -> (let Stream (open file File out)
String (if (string? Text)
(make-string "~A~%~%" Text)
(make-string "~S~%~%" Text))
Write (pr String Stream)
Close (close Stream)
Text))

in KLambda

(defun write-to-file (V1679 V1680)
(let Stream (open file V1679 out)
(let String (if (string? V1680)
(intmake-string "~A~%~%" (@p V1680 ()))
(intmake-string "~S~%~%" (@p V1680 ())))
(let Write (pr String Stream) (let Close (close Stream) V1680)))))

Mark

Mark
On Nov 19, 8:31 pm, j...@mentics.com wrote:
> The problem is with write-to-file. load works fine for me, too.
>
> You were able to reproduce this problem before, I think.
>
> https://groups.google.com/forum/?fromgroups=#!searchin/Qilang/clisp$2...
Reply all
Reply to author
Forward
0 new messages