anchor.diff:  (define (getpid) (sys-info 7))
   
   (define (assert)
  -	(setq ret  "") (doargs (i) (extend ret (string i))) 
  +	
  +	(setq ret  "") 
  +	;(doargs (i) (extend ret (string i))) 
  +	
  +	(dolist (x (args))
  +		(extend ret (string x))
  +	)
   	(write 1 ret ) ;; ǿʾstdout
   )
   
  
positive.code: 		(while (not (net-select connection "r" 1000)))
  		
  				(while (net-select connection "w" 1000)
  					(if (setq rvlen (net-receive connection buff ReadMax "\r\n"))
  						(begin
  							(share talk 1)
  							(sleep 200)
  							;(assert buff)
  							(setq atret (parse_atcmd (chop buff 2)))
  							(assert atret "\n")
  							(cond 
  								((list? atret)
  									(dolist (x atret)
  										(semaphore sid 2)
  										(write_string_to_serial x)
  										(sleep 100);;; sleep 100ms to serial  
  									)
  									(semaphore sid 1)
  								)
  								((string? atret)
  										(semaphore sid 2)
  										(write_string_to_serial atret)
  										(semaphore sid 1)
  								)
  							)
  							
  							(if (starts-with buff "AT+")
  								(begin
  									(dotimes (z 50 (= (share talk) 999)) (assert "sleep10\n") (sleep 30) );; sleep Լ500msͽ,ͦģڵķӦ
  									(share talk 0);;  ־read processз	
  									(assert (share content) "\n")
  									
  									(net-send connection (share content))
  								)
  							)
  							
  							(if (starts-with buff "help")
  								(net-send connection help_string (length help_string))
  							)
  							(if (starts-with buff "close")
  								(net-close connection)
  								(net-send connection ">" 1)
  							)
  							;; here deal with data
  						)
  
negative.code: 
  			)
  		)
  		(and (not (nil? cmd)) (nil? str)) ;; ʾֻûв
  		(begin
  			(assert "only cmd \n")
  			(cond 
  				((= (trim cmd ) "AT+PING") ;; ûвͱʾǷڵģǷĳ豸
  						(setq cmd_line (string "70 69 6e 67"))
  				)
  				((= (trim cmd) "AT&ROUTER")
  					(setq cmd_line (string "e0"))
  				)
  				((= cmd "AT&COORDI")
  					(assert "set to coordi\n")
  					(setq cmd_line (string "c0"))
  					(assert cmd_line)
  				)
  			)
  		)
  	)
  )
  
  (define (parse_atcmd str)
  	(setq ret nil)
  	
  	(cond 
  		((starts-with str "AT+")
  			(begin
  				(setq tmplst (parse str "="))
  				(setq cmd (tmplst 0) )
  				(setq content nil)
  				(if (> (length  tmplst) 1)
  					(begin
  						(setq content (tmplst 1))
  					)
  				)
  				(setq ret (make_serial_cmd cmd content) )
  			)
  		)
  		( (starts-with str "AT&")
  			(begin
  				(setq tmplst (parse str "="))
  				(setq cmd (tmplst 0))
  				
  				(setq content_lst nil)
  				(if (> (length tmplst)  1)
  					(begin
  						(setq content_lst (parse ( tmplst 1 ) ","))
  					)
  				)
  				(make_serial_cmd (nth 0 tmplst) content_lst)
  				(setq ret (copy cmd_line))
  			)
  		)
  	)
  	
  