On 13/07/2011 14:10, Martyn Hill wrote:
Hi everyone
As part of an on-going SB Editor project in QPC/SMSQ-E, I am
reseraching ways to queue SB commands in to a daughter SB job.
Extensions such as SG's QUEUE% or Turbo's TYPE_IN don't quite work
for this purpose as I need to queue the commands from another SB
(eventualy Turbo'd) job rather than into the current keyboard queue
(as pointed to by SYS_CKYQ - QUEUE% - or into the the #0 of the
current job - TYPE_IN).
So far, I've found no explicit documentation on where to find the
type-ahead buffer in SMSQ/E CON channels (only the SCR defintion
block's are described in detail), but my own digging around shows
that the (serial queue) buffer appears to sit at offset 152dec.
($98) from the start of a CON defintion block (after all the
SCR-like variables).
So, my question, what is the offical/safest/most portable way to
queue text in to a given CON (#0 for daughter SB) channel belonging
to another job?
Thanks for any ideas/alternatives.
Martyn,
London.
You might be able to do something with the method demonstrated below
instead:
100 REMarkGet an SBASIC job to work as
110 REMarka slave of another SBASIC.
120 REMarkFull programmable interpreter
130 REMarkvia PRINT statements!
140 REMarkBy pjwitte January 23rd 2001
150 :
160 REMarkInit
170 ch =1:cu =0:CLS#ch:CLS#cu
180 pip$ = 'pipe_p'& HEX$(DATE,32)
190 :
200 JOB_NAME 'Master'
210 :
220 REMarkPlumb in SBAS slave
230 co =FOPEN(pip$ & 'o_2048')
240 ERT co
250 REMarklrun our command stream
260 cm$ = 'lrun "'& pip$ & 'o_1024"'
270 REMarkStart SBAS with command
280 EXEP 'SBASIC'; cm$
290 REMarkWe control command channel
300 PRINT#co; 'ch = fopen(#0;"'& pip$ & 'i_64")'
310 PRINT#co; 'JOB_NAME "Slave"'
320 REMarkMessages come out here
330 ci =FOP_IN(pip$ & 'i'): IFci < 0:CLOSE
340 ERT ci
350 :
360 REMarkGive slave some tools
370 LIST#co; 1000 TO
380 :
390 REMarkTest
400 PRINT#co; 'echo "Hello": beep 2000, 2'
410 IFAnswer < 0:CLOSE:STOP
420 :
430 REMarkTorment!
440 CLS#cu:PRINT#cu; 'Type in your commands'
450 REPeatsb
460 INPUT#cu; '>'! cm$
470 IFcm$ = '' ORcm$ == 'quit': EXITsb
480 PRINT#co; cm$
490 IFAnswer < 0: EXITsb
500 END REPeatsb
510 PRINT#co; 'beep 2000, 2: quit'
520 CLOSE
530 :
540 DEFine FuNction Answer
550 ans% =0
560 REPeatil
570 k$ =INKEY$(#ci; 20)
580 IFLEN(k$) =0: EXITil
590 INPUT#ci; l$:echo k$ & l$
600 ans% =1
610 END REPeatil
620 IFEOF(#ci):ans% = -10
630 IFans% =0:echo 'no answer'
640 IFans% < 0:echo 'Slave died'
650 RETurnans%
660 END DEFine
670 :
1000 DEFine PROCedure echo(t$)
1010 PRINT#ch; t$
1020 END DEFine
1030 :
Per
_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm