User Tools

Site Tools


jvs:cigal:manual:chapter2:argshift

CIGAL Reference Manual, Chapter 2 (Commands): ARGSHIFT

ARGSHIFT -- Shift command line arguments in a CIGAL macro program

usage: argshift

ARGSHIFT shifts the arguments sent to a macro program one place to the left. Thus, the second argument becomes the first, the third becomes the second, etc. This command allows you to cycle through a list of macro arguments, getting around the limitation that macro arguments must be specified explicitly (eg. $1, $2,…). For example, if you want to make a loop that adds up numeric command arguments you could use:

        default -1 -1 -1 -1 -1 -1 -1 -1
        declare sum
        sum = 0
        while($1 >= 0) {
                sum = sum + $1
                argshift
        }
        type sum

See Also:
DEFAULT(2), MACRO(2), MACROS(1)

CIGAL Home, CIGAL Manual, Commands List, Manual Help

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