------=_NextPart_000_00C9_01C47A7D.0C4F49C0
Content-Type: text/plain;
        charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

"Ram�n Jim�nez" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> Has anyone here ever tried to map a Cach� device to a stream?
>
> I've been thinking about this for a few months now... Especially after I
> found what seems to be equivalent functionality in the Java binding. The
> idea being that you could "shadow" a device (the current device, for
> example) to a file or global stream, or alternatively being able to use
> the stream API in some cases where currently you're restricted to the
> device API.
>
> It would seem as if this can only be done by changing Cach� itself... Am
>   I right to think this? If so, are there any plans in this direction
> for 5.1?

Hi Ram�n,

Take a look at the small attached routine, Intercept.INT. This shows a
technique you might be able to use. It *is* partially documented by ISC, and
some of the techniques are used in the routine %XDTM2 to implement a DTM
console emulation.

Have fun!

John Murray
George James Software
www.georgejames.com

------=_NextPart_000_00C9_01C47A7D.0C4F49C0
Content-Type: application/octet-stream;
        name="Intercept.RO"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
        filename="Intercept.RO"

Cache for Windows NT^INT^Demonstrate I/O interception^~Format=3DCache.S~
%RO on 04 Aug 2004  11:41 PM
Intercept^INT^1^59751,85235^0
Intercept ; Demonstrate I/O interception - 4 Aug 2004, John Murray, =
www.georgejames.com
 K Intercept
 ;
 ; Tidy up on any error
 N $ET,$ES
 S $ET=3D"I '$ES D $ZU(82,12,0) U $I::"""" W !,""ERROR:"",$ZE"
 ;
 ; Tell the device to use this as the I/O handler
 U $I::"^"_$T(+0)
 I $ZU(82,12,1)
 ;
 ; Exercise the I/O
 W #,"Hello World",!
 W *7
 R !,"Type a line of text and press Enter:",junk
 W !,?10,"Got that!"
 W !,"Type up to 5 characters in 10 seconds:"
 R five#5:10
 I '$T W !,"NOT FAST ENOUGH",!
 W !,"Now press any key:"
 R *char
 ;
 ; Back to normal
 I $ZU(82,12,0)
 U $I::""
 ;
 W !,"Done",!
 ;
 ; Dump the intercepts
 ZW Intercept
 Q
 ; The intercepts
wstr(string) ; WRITE string
 S Intercept($I(Intercept))=3D"wstr:"_string
 I $ZU(82,12,0)
 W string
 I $ZU(82,12,1)
 Q
wchr(ascii) ; WRITE *ascii
 S Intercept($I(Intercept))=3D"wchr:"_ascii
 I $ZU(82,12,0)
 W *ascii
 I $ZU(82,12,1)
 Q
wtab(pos) ; WRITE ?pos
 S Intercept($I(Intercept))=3D"wtab:"_pos
 I $ZU(82,12,0)
 W $J("",pos-$X)
 I $ZU(82,12,1)
 Q
wnl ; WRITE !
 S Intercept($I(Intercept))=3D"wnl"
 I $ZU(82,12,0)
 W !
 I $ZU(82,12,1)
 Q
wff ; WRITE #
 S Intercept($I(Intercept))=3D"wnl"
 I $ZU(82,12,0)
 W #
 I $ZU(82,12,1)
 Q
rstr(length,timeout)    ; READ and QUIT with value
 N result,ok,readarg
 N $ET,$ES S $ET=3D"I '$ES,$ZU(82,12,1)"
 I $ZU(82,12,0)
 s readarg=3D"result"
 I $D(length) s readarg=3Dreadarg_"#"_length
 I $D(timeout) s readarg=3Dreadarg_":"_timeout
 R @readarg
 S ok=3D$T
 i $ZU(82,12,1)
 ; Can't seem to get this to work - docs claim it lets me set/clear the =
$T that tells the
 ; timed READer the outcome
 ;i $ZU(96,4,ok)=20
 S =
Intercept($I(Intercept))=3D"rstr:"_$g(length)_":"_$g(timeout)_":"_$g(ok)_=
":"_$g(result)
 Q result
rchr(timeout)   ; READ * and QUIT with value
 N ascii,ok
 N $ET,$ES S $ET=3D"I '$ES,$ZU(82,12,1)"
 I $ZU(82,12,0)
 I $D(timeout) D
 . R *ascii:timeout
 . S ok=3D$T
 E  D
 . R *ascii
 I $ZU(82,12,1)
 ; Can't seem to get this to work - docs claim it lets me set/clear the =
$T that tells the
 ; timed READer the outcome
 ;I $D(ok) I $ZU(96,4,ok)=20
 S =
Intercept($I(Intercept))=3D"rchr:"_$g(timeout)_":"_$g(ok)_":"_$g(ascii)
 Q ascii




------=_NextPart_000_00C9_01C47A7D.0C4F49C0--


Reply via email to