INCLAN: special characters: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
The following characters have a special meaning for | The following characters have a special meaning for INCLAN. To use them literally, they usually must be preceded by a backslash. | ||
literally, they usually must be preceded by a backslash. | |||
;$: '''$'''''variable'' substitutes the value of the variable in the command line. Substitutions proceed from left to right. If the value of the variable or function call starts and ends with single quotes (i.e. if it is a Fortran-77 character string), the delimiting single quotes are removed before inserting the value. | ;$: '''$'''''variable'' substitutes the value of the variable in the command line. Substitutions proceed from left to right. If the value of the variable or function call starts and ends with single quotes (i.e. if it is a Fortran-77 character string), the delimiting single quotes are removed before inserting the value. | ||
Line 8: | Line 7: | ||
;{ }: The curly braces in '''{$'''''variable'''''}''' or '''{%'''''variable'''''}''' separate the variable name variable from immediately following text. '''${'''''expression'''''}''' or '''%{'''''expression'''''}''' substitute the result value of the FORTRAN-77 expression. | ;{ }: The curly braces in '''{$'''''variable'''''}''' or '''{%'''''variable'''''}''' separate the variable name variable from immediately following text. '''${'''''expression'''''}''' or '''%{'''''expression'''''}''' substitute the result value of the FORTRAN-77 expression. | ||
;( ): '''$'''''variable'''''('''''format''''')''' uses the given FORTRAN-77 format to convert the numeric value of a variable into the string that is substituted in the command line. If the value of the variable is a comma-separated list, | ;( ): '''$'''''variable'''''('''''format''''')''' uses the given FORTRAN-77 format to convert the numeric value of a variable into the string that is substituted in the command line. If the value of the variable is a comma-separated list, '''$'''''variable'''''('''''n''''')''', where ''n'' is an integer expression, substitutes with the ''n''-th element of this list. '''$'''''variable'''''('''''n''''':'''''m''''')''', where ''m'' and ''n'' are integer expressions, substitutes with the substring between positions ''m'' and ''n'' of the value of the variable. These three possible uses of parentheses cannot be used simultaneously. | ||
;;: separates commands that stand on the same line. Note, however, that commands that form blocks (e.g. do ... end do, if ... end if) must always appear as the first command on a line. | ;;: separates commands that stand on the same line. Note, however, that commands that form blocks (e.g. do ... end do, if ... end if) must always appear as the first command on a line. | ||
;:: | ;:: ''label''''':''' denotes a label that can be used as the target of a jump. | ||
;\ : | ;\ : '''\'''''c'' treats the character ''c'' literally and allows the use of special characters in normal text, '''\''' at the end of a line indicates that the statement continues on the following line. | ||
;": "text" treats text as a single parameter, even if it contains spaces. Variable substitutions in the text still occur. | ;": "''text''" treats ''text'' as a single parameter, even if it contains spaces. Variable substitutions in the text still occur. | ||
;': 'text' treats text as a single parameter; the single quotes remain part of the text. Single quotes are used to delimit FORTRAN-77 character string constants. Variable substitutions in the text still occur. | ;': '''''''''text''''''''' treats ''text'' as a single parameter; the single quotes remain part of the text. Single quotes are used to delimit FORTRAN-77 character string constants. Variable substitutions in the text still occur. | ||
;#: Text between a comment sign | ;#: Text between a comment sign '''#''' and the end of the line is treated as a comment and skipped by the program. | ||
;@: Commands preceded by | ;@: Commands preceded by '''@''' are only echoed if the variable echo has the value full. '''@''' has its special meaning only if it occurs as the first character of a command. | ||
;!: | ;!: '''!'''''string'' recalls the last interactive command that started with ''string''. '''!''' has its special meaning only if it occurs as the first character of a command. | ||
;^: | ;^: '''^'''''string'''''^'''''replacement'''''^''' executes the last interactive command again after replacing the first occurrence of string by replacement. The third caret is optional unless the replacement string has trailing blanks. '''^''' has its special meaning only if it occurs as the first character of a command. |
Latest revision as of 10:13, 30 January 2009
The following characters have a special meaning for INCLAN. To use them literally, they usually must be preceded by a backslash.
- $
- $variable substitutes the value of the variable in the command line. Substitutions proceed from left to right. If the value of the variable or function call starts and ends with single quotes (i.e. if it is a Fortran-77 character string), the delimiting single quotes are removed before inserting the value.
- %
- %variable substitutes the value of the variable in the command line. Substitutions proceed from left to right. Single quotes that delimit Fortran-77 character strings are retained.
- { }
- The curly braces in {$variable} or {%variable} separate the variable name variable from immediately following text. ${expression} or %{expression} substitute the result value of the FORTRAN-77 expression.
- ( )
- $variable(format) uses the given FORTRAN-77 format to convert the numeric value of a variable into the string that is substituted in the command line. If the value of the variable is a comma-separated list, $variable(n), where n is an integer expression, substitutes with the n-th element of this list. $variable(n:m), where m and n are integer expressions, substitutes with the substring between positions m and n of the value of the variable. These three possible uses of parentheses cannot be used simultaneously.
- ;
- separates commands that stand on the same line. Note, however, that commands that form blocks (e.g. do ... end do, if ... end if) must always appear as the first command on a line.
- :
- label: denotes a label that can be used as the target of a jump.
- \
- \c treats the character c literally and allows the use of special characters in normal text, \ at the end of a line indicates that the statement continues on the following line.
- "
- "text" treats text as a single parameter, even if it contains spaces. Variable substitutions in the text still occur.
- '
- 'text' treats text as a single parameter; the single quotes remain part of the text. Single quotes are used to delimit FORTRAN-77 character string constants. Variable substitutions in the text still occur.
- #
- Text between a comment sign # and the end of the line is treated as a comment and skipped by the program.
- @
- Commands preceded by @ are only echoed if the variable echo has the value full. @ has its special meaning only if it occurs as the first character of a command.
- !
- !string recalls the last interactive command that started with string. ! has its special meaning only if it occurs as the first character of a command.
- ^
- ^string^replacement^ executes the last interactive command again after replacing the first occurrence of string by replacement. The third caret is optional unless the replacement string has trailing blanks. ^ has its special meaning only if it occurs as the first character of a command.