Am 09.10.2013 um 22:53 schrieb Norman Dunbar:

Norman,

> > EX adds 12 bytes for "two pipes (and two counts)". Reading the source
>> the counts seem to refer to two words counting the number of channels
>> and the bytes of the command string (EX test_exe;'command string').
> Yes, I have no problem with these two words. I have problems with the pipes 
> though. The channel ids are not stacked as far as I can see, but then again, 
> maybe they are.

I don't quite get what you mean by the above sentence. If the "channel ID 
count" word on the job's stack is non-zero, they are ;)

> 
> If I open #3,some_file and ex #3 to test_bin, I do get a channel Id on the 
> stack (and a word count of 1) but if I run it again, the channel Id on the 
> stack is different. I would have thought that the [qdosmsq] channel id for 
> SuperBasic channel #3 would remain constant, especially as I never closed the 
> channel between executions.
> 

what is put on the job's stack is actually pipe ends opened specifically for 
the new job.

> 
> Maybe, the pipe IDs are put on the stack and not the actual channel ids 
> themselves? And each pipe is opened specially, so the ID on stack will change?
> 

from one EX to the other, yes. That's exactly the case.

> Of course, when I run the following, I get two pipes:
> 
> open #3, some_file
> ex #3 to test_bin

You're not saying where you "get two pipes" - I must assume not on the job's 
stack but maybe in QPTR2's "channel" window?  In this case you're seeing one 
pipe with two ends, obviously. Actually, one end would belong to SuperBASIC, 
but - from what I can see in the sources - is handed over to the new job in 
order to be in EOF condition in case the job dies.

> 
> Then, if I leave #3 open and open #4, and try again:
> 
> open_new #4,other_file
> ex #3 to test_bin to #4
> 
> I get three pipes.
> 
> However, the stack for the job only shows as many #channels as I have used, 
> one or two in the examples above.

The channel ids on the stack are the ones that the job is entitled to use - the 
other ends would righteously belong to SuperBASIC, but, as said above, are 
handed over to the job in order to be closed when the job dies. Otherwise, you 
could have stray SuperBASIC ends, I guess.

> So, my next question has to be, what are these pipes used for? And why do I 
> get two in initially?
.....
> However, I was pretty sure that there was a document somewhere that I had 
> read that these channels, on a job's stack, were up to a maximum of three - 
> input, output and error. Funnily enough, I cannot find the information at all 
> now. Was I dreaming?

Hmm. One thing is what the OS mechanism supports - And that would be up to 
32767 channels on the Job's stack ;) In the general case, the "what is what" 
and "how many" is a convention between the caller - In this case SuperBASIC - 
and the callee. There is a rather detailed description of this convention for 
EX in the TKII manual. (And a description of what a Job is expected to do with 
that information on the stack)

QDOS, however, does not know about the concept of an "error" channel - I think 
you have mixed that up with the C convention (also fulfilled by C68) that has 
stdin, stdout and stderr as standard file descriptors opened for any program.


> And if I was dreaming, how do I know, inside a job, which channels are input, 
> output and/or IO given what's on the stack?
> 

See above, in my opinion this is not an Operating System convention, but one 
that EX, i.e. SuperBASIC sets up.

Regards,
Tobias
_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm

Reply via email to