Verified Commit e9ae5033 authored by Bernd Paysan's avatar Bernd Paysan
Browse files

serial changes, DOPRESS use dpy context

parent 2bb3b084
Loading
Loading
Loading
Loading
(59.7 KiB)

File changed.

No diff preview for this file type.

+9 −7
Original line number Diff line number Diff line
@@ -64,7 +64,8 @@
    Create t_buf  sizeof DCB allot
    Create tout_buf  sizeof COMMTIMEOUTS allot
    
    : set-baud ( baud fd -- )  >r
    : fileno ( file -- fd )  filehandle @ ;
    : set-baud ( baud file -- )  fileno >r
        r@ t_old GetCommState drop
        1 t_old DCB flags !
        r@ tout_buf GetCommTimeouts drop
@@ -78,8 +79,8 @@
        t_buf DCB BaudRate !
        8 t_buf DCB ByteSize c!
        r> t_buf SetCommState drop ;
    : reset-baud ( fd -- )
        t_old SetCommState drop ;
    : reset-baud ( file -- )
	fileno t_old SetCommState drop ;
[ELSE]
    also DOS also
    legacy on
@@ -197,7 +198,8 @@
    $541B Constant FIONREAD
    [THEN]
    
    : set-baud ( baud fd -- )  >r
    : fileno ( file -- fd )  filehandle @ ;
    : set-baud ( baud fd -- )  fileno >r
        t_old r@ tcgetattr drop
        t_old t_buf sizeof termios move
        \  t_buf sizeof termios erase
@@ -215,10 +217,10 @@
        t_buf 1 r> tcsetattr drop ;
    
    : reset-baud ( fd -- )
        t_old 1 rot tcsetattr drop ;
	fileno t_old 1 rot tcsetattr drop ;

    : check-read ( fd -- n )  >r
        0 sp@ FIONREAD r> filehandle @ ioctl drop ;
    : check-read ( fd -- n )  fileno >r
        0 sp@ FIONREAD r> ioctl drop ;
    
    previous previous
[THEN]
+7 −7
Original line number Diff line number Diff line
@@ -25,13 +25,13 @@ how: : >callback ( cb -- )

\ widget                                               28aug99py

        : DOPRESS  ( dx dy -- dx dy x y )
          BEGIN  BEGIN  dpy click? 0=  WHILE  dpy moved?
                        IF    2dup dpy mouse drop r@ execute
                              dpy sync
                        THEN  dpy invoke dpy do-idle
                 REPEAT dpy click nip 1 and  WHILE
          2drop  REPEAT  dpy moved! ;
        : DOPRESS  ( dx dy -- dx dy x y )  dpy with
          BEGIN  BEGIN  click? 0=  WHILE  moved?
                        IF    2dup mouse endwith drop r@ execute
                              dpy with sync
                        THEN  invoke do-idle
                 REPEAT  click nip 1 and  WHILE
          2drop  REPEAT  moved! endwith ;
[defined] doNotSin [IF] doNotSin [THEN]

\ widget                                               01mar98py