1

Hi.
What I am trying to do is having my program pick the name of another program in the estack, then call it with the remaining arguments. For instance, typing

MyProg("otherprog", "test", 42)

should be equivalent to typing otherprog("test", 42) from the point of view of otherprog (that is, it should detect 2 arguments, the first one being "test" and the second one 42).

The loading and execution of otherprog is not a problem. My problem is I can't see how I can modify the estack before executing otherprog to achieve this result.

2

What mode? Kernel, _nostub ?
avatarQue cache le pays des Dieux ? - Ximoon's Box - Forum Ghibli - Forum Littéraire

La fin d'un monde souillé est venue. L'oiseau blanc plane dans le ciel annonçant le début d'une longue ère de purification. Détachons-nous à jamais de notre vie dans ce monde de souffrance. Ô toi l'oiseau blanc, l'être vêtu de bleu, guide nous vers ce monde de pureté. - Sutra originel dork.

3

Well, my code currently compiles in both modes, so a solution that also works in both modes would be better.
Alternatively, one solution for each mode would work, though maybe a bit harder to maintain.

4

I'm wondering whether something like this would work : SkipArg(top_estack);

5

Try to see the source code of some shells happy
avatarQue cache le pays des Dieux ? - Ximoon's Box - Forum Ghibli - Forum Littéraire

La fin d'un monde souillé est venue. L'oiseau blanc plane dans le ciel annonçant le début d'une longue ère de purification. Détachons-nous à jamais de notre vie dans ce monde de souffrance. Ô toi l'oiseau blanc, l'être vêtu de bleu, guide nous vers ce monde de pureté. - Sutra originel dork.

6

Good idea, I'll do that smile

7

Or TTStart.
avatar« Quand le dernier arbre sera abattu, la dernière rivière empoisonnée, le dernier poisson capturé, alors vous découvrirez que l'argent ne se mange pas. »

8

Thanks, I found the solution in TTstart sources (I read the code of a few shells and kernels, but none did what I wanted. The ones that pass arguments to the program they run do it by pushing more things to he estack).

next_expression_index(fname);
I found this code in ttstart :fname = top_estack;
/* a few lines checking the type of the first parameter */
top_estack =


After a little check in tigcclib headers, I was able to find this :
#define SkipArg(p) ((void)((p)=_rom_call(ESI,(ESI),10A)(p)))
and
#define next_expression_index _rom_call(ESI,(CESI),10A)

Thus, it seems that doing a SkipArg(top_estack); will do what I want. I keep this topic handy, and I'll tell you if it works when I have tested it (it may take a few days, though).