| Thank you John!
The inclusion of macros in version 3.48 is just what the doctor ordered for
my increasingly complex orc files.
I would like to see 1 addition however. In a macro definition, it would be
nice to be able to use a special type of string that gets replaced uniquely
each time the macro is called.
This way, if you call a macro twice in the same instr, they don't share the
same data space for an variable created using the unique-string feature.
This is especially important for k/a-rate variables used in recursion.
This also provides a way to have macros that don't foul the data space of
code outside the macro.
My suggestion is that unique strings be defined as $name$, where name is
like a variable name.
$name$ is replaced by unique# each time a macro is expanded, where # is a
unique index number
This may require variables of the form xunique# to be illegal (reserved) in
normal orchestra syntax.
This is a little more complex than the macroing already implemented, but I
think it shouldn't be too hard to code.
If anyone is interested in this, but is a little confused by what I mean,
e-mail me. It is hard to talk about macros sometimes due to the abstraction
involved. :)
Christopher Neese
An example follows:
;*******************Example orc:
#define EXAMPLE(OUT) #
k$spec$r 0 init 0
k$spec$r 1 init 0
k$spec$r 2 init 0
k$spec$r2 = k$spec$r1
k$spec$r1 = k$spec$r0
k$spec$r0 = int(rnd(1000))
;code using k$spec$r2, k$spec$r1, k$spec$r0 and defining OUT
# ;end of macro
instr 1
k1 init 0
k2 init 0
EXAMPLE(k1)
EXAMPLE(k2)
;etc.
;**********************Parsed orc:
instr 1
k1 init 0
k2 init 0
kunique1r 0 init 0
kunique1r 1 init 0
kunique1r 2 init 0
kunique1r2 = kunique1r1
kunique1r1 = kunique1r0
kunique1r0 = int(rnd(1000))
;code using kunique1r2, kunique1r1, kunique1r0 and defining k1
kunique2r 0 init 0
kunique2r 1 init 0
kunique2r 2 init 0
kunique2r2 = kunique2r1
kunique2r1 = kunique2r0
kunique2r0 = int(rnd(1000))
;code using kunique2r2, kunique2r1, kunique2r0 and defining k2
;etc.
|