newLISP Fan Club

Forum => newLISP newS => Topic started by: HPW on November 03, 2008, 12:30:27 AM

Title: net-read-line ??
Post by: HPW on November 03, 2008, 12:30:27 AM
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.



??
Title:
Post by: HPW on November 03, 2008, 02:29:17 AM
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.
Title:
Post by: HPW on November 03, 2008, 04:38:29 AM
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)))