User Tools

Site Tools


CIGAL Reference Manual, Chapter 2 (Commands): DEFAULT

DEFAULT -- Set default values for arguments to a macro command

usage: default arg1 arg2 …

The DEFAULT command sets the values to be assigned to any macro arguments that are not specified explicitly in the macro command line. For example, consider the simple macro, TEST.IMP:

        default 100 200 brighter 400 cold
        type "Arguments:" $1 $2 $3 $4 $5

If this macro were called as:

        test 1 34 dimmer 888 hot

it would print out:

        Arguments: 1 34 dimmer 888 hot

But if it were called as:

        test 1 - lighter

it would use the default values for the missing arguments and print:

        Arguments: 1 200 lighter 400 cold

In general, it is wise to use the DEFAULT command to provide a default value for every macro argument that is used. For example, if anywhere in your macro you refer to $5, then you should be sure that the default command has a value for the fifth argument. Undefined arguments can produce unpredictable results.

The DEFAULT command should appear near the beginning of the macro, before any DECLARE or DEFINE statements. The DEFAULT command has no effect if called outside of a macro program.

See Also:

CIGAL Home, CIGAL Manual, Commands List, Manual Help

jvs/cigal/manual/chapter2/default.txt · Last modified: 2023/02/23 18:43 (external edit)