Suppose i have many different but very similar modules i would like to generate on the fly rather than
coding them manually each. How would i generate module names on the fly?
For example lets say i want to name modules with 3 main parts... sufix, datatype and numbering. How would i do it?
This is somewhat i tried last week and failed (untested pseudocode written from memory):
#def nameGen %1_%2_%3
macro generateModule(suf,dtt,num)
function nameGen(suf,dtt,num)(dtt p1) as dtt
#if typeof(dtt) = string
' string code...
#endif
#if typeof(dtt) = long
' long code...
#endif
end function
end macro
I recall i was getting something like a parameter issue. Maybe the statement thought i was naming my function nameGen and was expecting a datatype for suf.
I also tried:
#def nameGen function %1_%2_%3
macro generateModule(suf,dtt,num)
nameGen(suf,dtt,num)(dtt p1) as dtt
.
.
.
To no avail... is there something else i can try? What i need is to be able to call my macro like this:
generateModule(TCP,string,210)
And have a function like this generated:
function TCP_string_210(string p1) as string
' string code...
end function