PPWIZARD is a free preprocessor for HTML, REXX, Visual Basic or any text files.
[Bottom][Contents][Search][Prev]: <?TotalOutputLines>[Next]: <?Version>

<?Unique>

This variable will be replaced by a unique number every time it is used.

This is a Standard Definition which always exists (you don't need to #define it). Note that you can create your own variations or completely new ones (see the examples).

Example of Creating Your Own Counter

If you wanted to have a number of counters running so that each is consecutive (no gaps) then this is one possible and self documenting way:

    ;--- Generic Counter ---
    #NextId
    #define      Counter                        \
                 <$Rexx4Counter {$?} $$RXEXEC>
    #DefineRexx  'Rexx4Counter'
       ;--- Inc the value (start with 1) ---
       @@CntVAR    = 'Counter_{$#1}'       ;;Generate Rexx var name unlikely to class with anything!
       @@NumDigits = '{$Digits=^3^}'       ;;By default padded to 3 digits
       if  symbol(@@CntVAR) <> 'VAR' then
           @@Val = 1;                      ;;Start with 1
       else
           @@Val = value(@@CntVAR) + 1;    ;;Incremented existing counter
       call value @@CntVAR, @@Val;         ;;Remember value
    
       ;--- Pad the value (NEVER truncate!). Can "enable" correct sorting ---
       if  length(@@Val) >= @@NumDigits then
           RxExec = @@Val;                          ;;Don't pad!
       else
           RxExec = right(@@Val, @@NumDigits, '0'); ;;Pad to left with zeros
    #DefineRexx
    
    ;--- Use the counter ---
    Counter X is now: <$Counter "X">
    Counter Y is now: <$Counter "Y">
    Counter X is now: <$Counter "X">
    

Note that I very carefully did not use #evaluate etc so that PPWIZARD would never complain about the counters use even if used on PPWIZARD commands (where it might overwise cause an error). Also note that you will still need to be careful about how the macro is used as it does not care about whether the number is generated into the output file, it just cares about macro expansion.


[Top][Contents][Search][Prev]: <?TotalOutputLines>[Next]: <?Version>

PPWIZARD Manual
My whole website and this manual itself was developed using PPWIZARD (free preprocessor written by Dennis Bareis)
Friday June 01 2001 at 5:58pm