net-read-line ??

Started by HPW, November 03, 2008, 12:30:27 AM

Previous topic - Next topic

HPW

I ran into problem with the tk-macro:
(define-macro (tk , _result)
(set '_result (append (apply string (map eval (args))) ";##EOT##"))
(net-send SYS:tk-sock '_result)
;; on Unix's we could just use 'read-line', but doesn't work on sockets in win32
(while (starts-with (net-read-line SYS:tk-sock '_result) "VOID-TK:"))
(if (starts-with _result "ERR-TK:") (reset) _result))


It seems that net-read-line is the problem.
Quote
> setq

setq <408002>

> net-read-line

nil


Seems not to be defined.

But in the list of (symbols) it appears.

Also in the doc it is not documented.

But in the V10 release doc it is not abandoned.



??
Hans-Peter

HPW

#1
Oops, just noticed that net-read-line is not a primitiv, it is defined in newLISP-tk.tcl



I must futher investigate the problem.


Quote> (tk "tk_chooseColor -title {Pick line color}")

"tk_chooseColor -title {Pick line color};##EOT##"

>


The problem in TK-demo mouse lisp is that not the color is given back.
Hans-Peter

HPW

#2
The following fix make the TK-mouse demo work for me:



(define (tk)
        (let (result (append (apply string (args)) ";##EOT##"))
          (net-send SYS:tk-sock result)
          ;; on Unix's we could just use 'read-line', but doesn't work on sockets in win32
          (while (starts-with (setq tkresult(SYS:net-read-line SYS:tk-sock 'result)) "VOID-TK:"))
;         Debug-Dialog
;         (MAIN:MessageBoxA 0 (string "tk result: " (eval tkresult)) "Debug" 1)
          (if (starts-with tkresult "ERR-TK:") (reset) tkresult)))
Hans-Peter