Skip to main content

#def1arg

Defines a macro with only one argument, where that argument can include commas.

Description

This macro preprocessor directive defines a macro with only one argument, where that argument can have commas in it. #def1arg is a special version of #define, since #define treats commas within arguments as delimiters between arguments. It has the form:

#def1arg Macro(%Arg) Value

where

  • Macro is the name of the macro being defined, which accepts only one argument. A valid macro name is an alphanumeric string.

  • %Arg is the name of the argument for the macro. The name of the variable specifying the macro’s argument must begin with a percent sign.

  • Value is the macro’s value, which includes the use of value of %Arg specified at runtime

A #def1arg line can include a ##; comment.

For more information on defining macros generally, see the entry for #define.

For example, the following MarxBros macro accepts the comma-separated list of the names of the Marx brothers as its argument:

#def1arg MarxBros(%MBNames) WRITE "%MBNames:",!,"The Marx Brothers!",!
 // some movies have all four of them
 $$$MarxBros(Groucho, Chico, Harpo, and Zeppo)
 WRITE !
 // some movies only have three of them
 $$$MarxBros(Groucho, Chico, and Harpo)

where the MarxBros macro takes an argument, %MBNames argument, which accepts a comma-delimited list of the names of the Marx brothers.

FeedbackOpens in a new tab