Hi cm, thanks for your post. I picked up on the helper macro and expanded the above example with your suggestion. This example is preprocessor only, compiles and gives me the results I had expected.
%macro smac 1
%defstr temp %
%rep %{1}
%strcat temp ,temp ,'$'
%endrep
%strcat temp ,temp ,'$'
%deftok %$index temp
%endm
%push __MOM__
%define %$contextname __MOM__
%assign %$ctxframe 0
%warning %$contextname %$ctxframe
%push __FIRST__
%define %$contextname __FIRST__
%assign %$ctxframe %$$ctxframe+1
%warning %$contextname %$ctxframe
%push __SECOND__
%define %$contextname __SECOND__
%assign %$ctxframe %$$ctxframe+1
%warning %$contextname %$ctxframe
%push __THIRD__
%define %$contextname __THIRD__
%assign %$ctxframe %$$ctxframe+1
%warning %$contextname %$ctxframe
%push __FORTH__
%define %$contextname __FORTH__
%assign %$ctxframe %$$ctxframe+1
%warning %$contextname %$ctxframe
%push __FIFTH__
%define %$contextname __FIFTH__
%assign %$ctxframe %$$ctxframe+1
%warning %$contextname MOM has %$ctxframe punks
smac %{$ctxframe}
%assign %{$index}newinmom 5
%warning %{$index}newinmom %$$$$$$newinmom %$contextname
%pop
smac %{$ctxframe}
%assign %{$index}newinmom %{$index}newinmom-1
%warning %{$index}newinmom %$$$$$newinmom %$contextname
%pop
smac %{$ctxframe}
%assign %{$index}newinmom %{$index}newinmom-1
%warning %{$index}newinmom %$$$$newinmom %$contextname
%pop
smac %{$ctxframe}
%assign %{$index}newinmom %{$index}newinmom-1
%warning %{$index}newinmom %$$$newinmom %$contextname
%pop
smac %{$ctxframe}
%assign %{$index}newinmom %{$index}newinmom-1
%warning %{$index}newinmom %$$newinmom %$contextname
%pop
smac %{$ctxframe}
%assign %{$index}newinmom %{$index}newinmom-1
%warning %{$index}newinmom %$newinmom %$contextname
%pop
Regards,
Klod