📄 scripts.gml
字号:
.keyword |
(bitwise OR)
:LI.:cont.
.keyword &
(bitwise AND)
:LI.:cont.
.keyword >.>.
(bit shift down)
:LI.:cont.
.keyword <.<.
(bit shift up)
:eUL.
.np
Special keyword tokens are:
.*
:DL break.
.*
:DT.ERR_???
:DD.These are symbolic representations of all possible errors while
executing in &edvi.. These values are found in
:fname.error.dat:efname.
:period.
These values are described in the appendix
:HDREF refid=errcode.
:period.
:DT.lastrc
:DD.This keyword evaluates to the return code issued by the last command run
in the script. Possible values to compare against are found in
:fname.error.dat:efname.
:period.
These values may are described in the appendix
:HDREF refid=errcode.
:period.
:DT.rdonly
:DD.This keyword evaluates to 1 if the current file is read only, and
0 if it is not read only.
:DT.config
:DD.This keyword evalutes to a number representing the current mode
the screen is configured to. Possible values are:
:DL break.
:DT.100
:DD.Screen is in color mode.
:DT.10
:DD.Screen is in black and white mode.
:DT.1
:DD.Screen is in monochrome mode.
:eDL.
.np
This may be used to have different configurations built into
your
.keyword configuration script
:fname.ed.cfg:efname.
:period.
:DT.black
:DD.This keyword evalutes to the integer representing the color black (0).
:DT.blue
:DD.This keyword evalutes to the integer representing the color blue (1).
:DT.green
:DD.This keyword evalutes to the integer representing the color green (2).
:DT.cyan
:DD.This keyword evalutes to the integer representing the color cyan (3).
:DT.red
:DD.This keyword evalutes to the integer representing the color red (4).
:DT.magenta
:DD.This keyword evalutes to the integer representing the color magenta (5).
:DT.brown
:DD.This keyword evalutes to the integer representing the color brown (6).
:DT.white
:DD.This keyword evalutes to the integer representing the color white (7).
:DT.dark_gray
:DD.This keyword evalutes to the integer representing the color dark_gray (8).
:DT.light_blue
:DD.This keyword evalutes to the integer representing the color light_blue (9).
:DT.light_green
:DD.This keyword evalutes to the integer representing the color light_green (10).
:DT.light_cyan
:DD.This keyword evalutes to the integer representing the color light_cyan (11).
:DT.light_red
:DD.This keyword evalutes to the integer representing the color light_red (12).
:DT.light_magenta
:DD.This keyword evalutes to the integer representing the color light_magenta (13).
:DT.yellow
:DD.This keyword evalutes to the integer representing the color yellow (14).
:DT.bright_white
:DD.This keyword evalutes to the integer representing the color bright_white (15).
:eDL.
.*
.beglevel
.*
.* ******************************************************************
.section 'Script Expression BNF'
.* ******************************************************************
.*
.np
This section describes a BNF for the construction of constant expressions.
.*
:DL break.
.*
:DT.expression
:DD.: conditional-exp
:DT. conditional-exp
:DD.: log-or-exp
.br
| log-or-exp ? expression : conditional-exp
:DT.log-or-exp
:DD.: log-and-exp
.br
| log-or-exp || log-and-exp
:DT.log-and-exp
:DD.: bit-or-exp
.br
| log-and-exp && bit-or-exp
:DT.bit-or-exp
:DD.: bit-xor-exp
.br
| bit-or-exp | bit-xor-exp
:DT.bit-xor-exp
:DD.: bit-and-exp
.br
| bit-xor-exp &caret. bit-and-exp
:DT.bit-and-exp
:DD.: equality-exp
.br
| bit-and-exp & equality-exp
:DT.equality-exp
:DD.: relational-exp
.br
| equality-exp == relational-exp
| equality-exp != relational-exp
:DT.relational-exp
:DD.: shift-exp
.br
| relational-exp >. shift-exp
.br
| relational-exp <. shift-exp
.br
| relational-exp >.= shift-exp
.br
| relational-exp <.= shift-exp
:DT.shift-exp
:DD.: additive-exp
.br
| shift-exp <.<. additive-exp
.br
| shift-exp >.>. additive-exp
:DT.additive-exp
:DD.: multiplicative-exp
.br
| additive-exp + multiplicative-exp
.br
| additive-exp - multiplicative-exp
:DT.multiplicative-exp
:DD.: exponent-exp
.br
| multiplicative-exp * exponent-exp
.br
| multiplicative-exp / exponent-exp
.br
| multiplicative-exp % exponent-exp
:DT.exponent-exp
:DD.: unary-exp
.br
| exponent-exp ** unary-exp
:DT.unary-exp
:DD.: primary-exp
.br
| - unary-exp
.br
| &tilde. unary-exp
.br
| ! unary-exp
:DT.primary-exp
:DD.: token
.br
| ( expression )
:DT.token
:DD.: INTEGER
.br
| STRING
.br
| KEYWORD
.*
:eDL.
.*
.endlevel
.*
.* ******************************************************************
.section 'Control Flow Commands'
.* ******************************************************************
.*
.np
This section gives a brief overview of the control flow commands of the
&edvi script language. For a full description of all
script commands, see the next section
:HDREF refid='scrcmds'.
:period.
.*
.beglevel
.*
.* ******************************************************************
.section *refid=loop 'The LOOP Block'
.* ******************************************************************
.*
.np
The
.keyword loop
block is similar to the
.keyword do-while
construct in C. The flow of the loop may be modified using the
.keyref break
:cont.,
.keyref continue
:cont.
or
.keyref quif
script commands.
.np
The loop may be set to run until a termination condition is met by using the
.keyword loop
-
.keyref until
commands.
.np
The loop may be set to run without any termination condition by using the
.keyword loop
-
.keyref endloop
commands.
.np
An overview of a
.keyword loop
block is:
.millust begin
loop
break
continue
quif <.expr>.
until <.expr>.
loop
break
continue
quif <.expr>.
endloop
.millust end
.*
.* ******************************************************************
.section *refid=while 'The WHILE Block'
.* ******************************************************************
.*
.np
The
.keyword while
block is similar to the
.keyword while
loop construct in C. The flow of the while loop may be modified using the
.keyref break
:cont.,
.keyref continue
:cont.
or
.keyref quif
script commands.
.np
The while loop is set up using the
.keyword while
-
.keyref endwhile
commands.
.np
An overview of the
.keyword while
block is:
.millust begin
while <.expr>.
break
continue
quif <.expr>.
endwhile
.millust end
.*
.* ******************************************************************
.section *refid=if 'The IF Block'
.* ******************************************************************
.*
.np
The
.keyword if
block is similar to the
.keyword if-else
construct in C.
.np
An overview of the
.keyword if
block is:
.millust begin
if <.expr>.
elseif <.expr>.
elseif <.expr>.
else
endif
.millust end
.*
.endlevel
.*
.* ******************************************************************
.section *refid=scrcmds 'Script Commands'
.* ******************************************************************
.*
.np
:INCLUDE file='cmdintro'.
For example, in its syntax model,
the ASSIGN command is specified as "ASSIGN", indicating that all the
letters are required (there are no abbreviations, only "assign" is
accepted as the command).
.np
The term
.param <.expr>.
is used to indicate an expression in the following commands.
Expressions are discussed in full detail in the section
:HDREF refid='screxpr'.
of this chapter.
.np
Script variables are used by some of the following commands. Variables
are discussed in full detail in the section
:HDREF refid='scrvars'.
.if &e'&dohelp eq 0 .do begin
of this chapter.
.do end
.np
When a script command terminates,
.var lastrc
is sometimes set to a value. This value may be tested in an expression.
Script commands that set this have a
.keyword Returns
section.
.* ******************************************************************
.fnlist begin '&edvi. Script Commands'
.* ******************************************************************
.begfunc ATOMIC
.syntx * ATOMIC
.begdescr
This command causes all editing actions done by the script
to all be part of one undo record. This way, the action of the entire
script can be eliminated with a single
.keyref 'undo (command)'
:cont.; i.e., it is an atomic action.
.enddescr
.endfunc
.begfunc ASSIGN
.syntx * ASSIGN <.v1>. "=" /<.val>./"r$@xl"
.begdescr
This command is used to assign the value
.param <.val>.
to the variable &parm1.
:period.
.np
The forward slashes ('/') around
.param <.val>.
are only need if there are spaces in
.param <.val>.
:cont.,
or if one of the special flags
.param r
:cont.,
.param x
:cont.,
.param l
:cont.,
.param $
or
.param @
is required at the end.
.np
The special flags have the following meaning:
.*
:DL break.
.*
:DT.r
:DD.When this flag is used,
.param <.val>.
may contain regular expression replacement
strings (using the last regular expression searched for).
For more information on regular expressions, see the chapter
:HDREF refid='rxchap'.
:period.
:DT.l
:DD.When this flag is used,
.param <.val>.
is assumed to be an expression that indicates a line number. The expression
is evaluated, and the data on the corresponding line number is assigned
to &parm1
:period.
:DT.x
:DD.When this flag is used,
.param <.val>.
is assumed to be an expression, and is evaluated. The result is
assigned to &parm1.
:period.
For another way of assigning expression results to a variable, see the
.keyref expr
script command.
:DT.$ (dollar sign)
:DD.When this flag is used,
.param <.val>.
is assumed to be the name of an operating system environment variable,
and the contents of that environment variable is what is assigned to &parm1.
:period.
:DT.@
:DD.When this flag is used,
.param <.val>.
may be the name of one of the
.keyref set
command parameters. &parm1 will be given the current value of that
parameter.
.*
:eDL.
.*
.np
.param <.val>.
may be coded as a special operator. If
.param <.val>.
is coded this way, the forward slashes ('/') must NOT be used.
The special operators are:
.*
:DL break.
.*
:DT.strlen <.v>.
:DD.Computes the length of the variable
.param <.v>.
:period.
This value is assigned to &parm1.
:period.
:DT.strchr <.v>. <.c>.
:DD.Computes the offset of the character
.param <.c>.
in the variable
.param <.v>.
:period.
The offset is assigned to &parm1.
:period.
Note that the character
.param <.c>.
may be a variable, the value of which will be expanded before offset
is computed.
:period.
:DT.substr <.v>. <.n1>. <.n2>.
:DD.Computes a substring of the string contained in the variable
.param <.v>.
:period.
The substring is composed of characters from offset
.param <.n1>.
to offset
.param <.n2>.
:period.
The substring is assigned to &parm1.
:period.
Note that the parameters
.param <.n1>.
and
.param <.n2>.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -