On 14 Jan 2005 at 20:08, P Witte wrote:

(...)

> But why? Its enough to know it can be done without knowing how ;)

OK, so this whole discussion makes no sense, I should just have gone ahead...

More seriously, I don't pretend to know it all and if you have a better idea, 
I (generally) don't suffer from the NIH syndrome.


> Actually I can think of one sure method to find a Home Directory [HD]
> string. Taking the structure to look like this:
> 
>     stack    (a7)
>     channel count
>     channels
>     command string
> 
>     magic (.w)                       <- (a6,a5) (as at present)
>     program's name length (.w)
>     HD's length (.w)
>     program's name bytes
>     padding of above to 42 bytes
> 
> Algorithm:
> 
>     get job info
>     find start of allocated memory list
>     scan through list:
>         if memory ID <> my ID: next
>         if length of block < 52 bytes: next
>         if the word at block_length - 48 <> magic: next
>         HD found: exit scan
>     end scan

Yes, that would be one way.
Several remarks here: There is no guarantee that a word wouldn't be occurring 
naturally, it would have to be a long word at least.
Why 52 bytes? Let's cater for longer filenames immediately.
Scanning this list will probably take longer than fnd the thing.
It doesn't take care of the current prog string..


> Another way would be to analyse QLib_rext or trace a running program to
> determin whether QLib retains any memory of its original data area. If it
> does, say in a6, 

No need to check Qlib for that. When it comes to your keyword, it'll emuate 
Sbasic, i.e. point to a basic area in A6. We also know that A3 & A5 point to 
the parameter list....

(...)

> Thus a different structure could be
> used:
(...)

I'm not sure what happens first: relase of the memory, or freeing of the 
thing...
Moreovern this would means that the job continues to use the thing during its 
entire lifetime.
And anyway, if you start implementing a thing, let's go the whole hog.

Moreover, Joachim said on this list that there is a mechanism in the heap 
allocation/release whereby a call would be made to some user specified code 
when the mem is released. I can't find this facility anywhere, thgough. All 
that exists, AFAIK, is an address that will be set when the memory is 
released.
 
(...)
> >
> > > Both. By why not re-use the DUP & DDOWN code as a general utility to
> > > work on any filename string, given the string's location? Suggest the
> new
> > > Sbasic keywords be called UD, DD and CD (CD -> Change dir, ie set a
> > > new start string) ie, something quick and simple (though admittedly a
> > > two char name is potentially dangerous)
> >
> > NOT trivial.
> 
> What is not trivial? The implementation? 
Yes.
But fortunetaly that can be done later.
Incidentally, I don't know the DUP & DDOWN commands. Whilst I have no problem 
understanding the DUP command (after all there is only one parent dir), am I 
correct in assuming the DDOWN command has one obligatory parameter, the name 
of the dir?

(...)

> That was a very discreet one ;)

Always the diplomat, I.

Wolfgang
----------------------------------------
www.scp-paulet-lenerz.com

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

Reply via email to