SED navigation bar go to SED home page go to Dataplot home page go to NIST home page SED Home Page SED Staff SED Projects SED Products and Publications Search SED Pages
Dataplot Vol 1 Vol 2

MACRO SUBSTITUTION CHARACTER

Name:
    MACRO SUBSTITUTION CHARACTER
Type:
    Support Command
Purpose:
    Specify the character to use in macros to signify an argument to the macro.
Description:
    You can now pass arguments to macros. Recall that Dataplot macros are simply ASCII files containing Dataplot commands (i.e., there is no compilation of macros).

    To pass arguments to a macro, do something like

      CALL SAMPLE.DP arg1 arg2 arg3

    Up tp 10 arguments may be passed (although limits on command line lengths still apply). Arguments containing spaces or hyphens should be enclosed in quotes. The character limit for a single argument is 40 characters.

    In the SAMPLE.DP macro, if a $1 is encountered, it will be replaced with "arg1", if a $2 is encountered, it will be replaced with "arg2" and so on. A $0 will substitute the number of arguments given on the CALL command.

    This substitution will only occur if a command line is contained within a macro (i.e., if no macro is active, the "$" will not signal any substitution and it will remain in the command line as given).

    Dataplot currently only supports one level of argument substitition for macros. That is, the values of the macro arguments (i.e., the $1, $2, etc.) will contain the values given by the most recent CALL command that specified at least one argument. If you need to nest CALL commands with macro arguments, the recommended work around is to have the higher level macro extract any macro arguments passed to it into temporary variables or strings before calling any other macros. For example, supposse SAMPLE.DP needs to call SAMPLE2.DP with arguments. You could do something like the following in SAMPLE.DP:

      . Start of SAMPLE.DP macro
      let string zzzzs1 = $1
      let string zzzzs2 = $2
      let string zzzzs3 = $3
      ...
      call sample2.dp newarg1 newarg2

    The default character for argument substitution is the "$". To use a different character, enter the command

    The MACRO SUBSTITUTION CHARACTER command allows you to specify a character other than "$" to signify argument substitution.

Syntax:
    MACRO SUBSTITUTION CHARACTER <char>
    where <char> is the character to use as the macro substitution character.
Examples:
    MACRO SUBSTITUTION CHARACTER @
    MACRO SUBSTITUTION CHARACTER $
Note:
    Substitutions for the value of a parameter or a string (signified by a "^") are performed before the substitutions for a macro argument. Both of these substitutions are performed before the command line is interpreted.
Default:
    The default macro substitution character is $ .
Synonyms:
    None
Related Commands:
    CALL = Execute the commands stored in a file.
    SUBSTITUTE CHARACTER = Define the character that specifies the substitution of the value of a parameter or a string in a command line.
    TERMINATOR CHARACTER = Define the character that terminates a command.
    CONTINUE CHARACTER = Define the character that specifies that a command is continued onto the next line.
Applications:
    Macros
Implementation Date:
    2005/11
Program:
     
    MACRO SUBSTITUTION CHARACTER @
    LET Y = NORMAL RAND NUMBERS FOR I = 1 1 100
    CALL HIST.DP  "Title for Sample Plot" Y
        
    where HIST.DP contains the lines
     
    TITLE @1
    HISTOGRAM @2
        

Privacy Policy/Security Notice
Disclaimer | FOIA

NIST is an agency of the U.S. Commerce Department.

Date created: 12/05/2005
Last updated: 11/03/2015

Please email comments on this WWW page to alan.heckert@nist.gov.