⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scripts.gml

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 GML
📖 第 1 页 / 共 4 页
字号:
may be variables, the values of which will be expanded before the substring
is computed.
.*
:eDL.
.enddescr
.xmplsect begin
.begxmpl assign %a = foobar
The variable
.var %a
gets the string
.param foobar
assigned to it.
.endxmpl

.begxmpl assign %(Path) = /path/$
The global variable
.var %(Path)
gets the data stored in the
.param path
environment variable assigned to it.
.endxmpl

.begxmpl assign %b = strlen %a
Assigns the length of the contents of the local variable
.var %a
to the local variable
.var %b
:period.
Assuming the local variable
.var %a
has the string
.param abcdefg
assigned to it, then
.var %b
gets
.param 7
assigned to it.
.endxmpl

.begxmpl assign %b = strchr %a b
Assigns the offset of the letter
.var b
in the string contained in the local variable
.var %a
to the local variable
.var %b
:period.
Assuming the local variable
.var %a
has the string
.param abcdefg
assigned to it, then
.var %b
gets
.param 2
assigned to it.
.endxmpl

.begxmpl assign %(Substr) = substr %a 2 4
Assigns the characters from offset 2 to offset 4
in the string contained in the local variable
.var %a
to the global variable
.var %(Substr)
:period.
Assuming the local variable
.var %a
has the string
.param abcdefg
assigned to it, then
.var %b
gets
.param bcd
assigned to it.
.endxmpl

.begxmpl assign %(res) = /abc %(str) def/
Assuming
.var %(str)
has been assigned the value
.param xyz
:cont.,
then the string
.param abc xyz def
is assigned to the local variable
.var %(res)
.endxmpl

.begxmpl assign %(Result) = /100*30+(50-17)*10/x
The value
.param 3330
is assigned to the global variable
.var %(Result)
:period.
.endxmpl
.xmplsect end
.alsosee begin
.seethis expr
.alsosee end
.endfunc

.begfunc BREAK
.syntx * BREAK
.begdescr
Unconditionally exits the current looping block. This breaks out
of
.keyref loop
-
.keyref endloop
:cont.,
.keyref loop
-
.keyref until
and
.keyref while
-
.keyref endwhile
blocks.
.enddescr
.alsosee begin
.seethis continue
.seethis endloop
.seethis endwhile
.seethis loop
.seethis quif
.seethis until
.seethis while
.alsosee end
.endfunc

.begfunc CONTINUE
.syntx * CONTINUE
.begdescr
Restarts the current looping block. This causes a jump to the top of
.keyref loop
-
.keyref endloop
:cont.,
.keyref loop
-
.keyref until
and
.keyref while
-
.keyref endwhile
blocks.
.enddescr
.alsosee begin
.seethis break
.seethis endloop
.seethis endwhile
.seethis loop
.seethis quif
.seethis until
.seethis while
.alsosee end
.endfunc

.begfunc ENDIF
.syntx * ENDIF
.begdescr
Terminates an
.keyref if
-
.keyref elseif
-
.keyref else
block.
.enddescr
.alsosee begin
.seethis if
.seethis elseif
.seethis else
.alsosee end
.endfunc

.begfunc ENDLOOP
.syntx * ENDLOOP
.begdescr
Terminates a loop block.  Control goes to the top of the current loop.
.enddescr
.alsosee begin
.seethis break
.seethis continue
.seethis endwhile
.seethis loop
.seethis quif
.seethis until
.seethis while
.alsosee end
.endfunc

.begfunc ENDWHILE
.syntx * ENDWHILE
.begdescr
Terminates a while block.  Control goes to the top of the current
while loop.
.enddescr
.alsosee begin
.seethis break
.seethis continue
.seethis endloop
.seethis loop
.seethis quif
.seethis until
.seethis while
.alsosee end
.endfunc

.begfunc ELSEIF
.syntx * ELSEIF &lt.expr&gt.
.begdescr
An alternate case in an
.keyref if
block.  If the opening
.keyref if
script command
and none of the
.keyword elseif
script commands prior to this one were executed, then this
.keyword elseif
is executed.
.np
Any variables contained in &parm1 are expanded before the expression
is evaluated.
.np
If &parm1 is true, then the code following the
.keyword elseif
is executed.  If &parm1 is false, control goes to the next
.keyword elseif
:cont.,
.keyref else
or
.keyref endif
command.
.enddescr
.alsosee begin
.seethis if
.seethis else
.seethis endif
.alsosee end
.endfunc

.begfunc ELSE
.syntx * ELSE
.begdescr
This is the alternate case in an
.keyref if
block.  If none of the preceding
.keyref if
or
.keyref elseif
statements are true, the code following the
.keyword else
command is executed.
.enddescr
.alsosee begin
.seethis if
.seethis elseif
.seethis endif
.alsosee end
.endfunc

.begfunc EXPR
.syntx * EXPR &lt.v1&gt. "=" &lt.expr&gt.
.begdescr
Assigns the expression &parm3 to the variable &parm1
:period.
.np
Any variables contained in &parm3 are expanded before the expression
is evaluated.
.enddescr
.xmplsect begin
.begxmpl expr %(Num) = 100*30+50
Assigns the value
.param 3050
to the global variable
.var %(Num)
:period.
.endxmpl
.begxmpl expr %a = %(SW)-10
Assuming a screen width of 80, then this assigns the value
.param 70
to the local variable
.var %a
:period.
.endxmpl
.xmplsect end
.alsosee begin
.seethis assign
.seethis eval
.alsosee end
.endfunc

.begfunc FCLOSE
.syntx FCLOSE &lt.n&gt.
.begdescr
Closes file &parm1 previously opened with a
.keyref fopen
script command.
.enddescr
.xmplsect begin
.begxmpl fclose 1
Closes file 1.
.endxmpl
.xmplsect end
.alsosee begin
.seethis fopen
.seethis fread
.seethis fwrite
.alsosee end
.endfunc

.begfunc FOPEN
.syntx * FOPEN &lt.name&gt. &lt.n&gt. &lt.how&gt.
.begdescr
This command opens file &parm1, assigning it file handle &parm2.
:period.
.np
&parm2 may be a value from 1 to 9.  This number is used to identify
the file for future
.keyref fread
:cont.,
.keyref fwrite
or
.keyref fclose
script commands.
.np
&parm3 specifies the method that the file is opened. Methods are:
.*
:DL break.
.*
:DT.a
:DD.Opens file for append.

:DT.r
:DD.Opens file for read.

:DT.w
:DD.Opens file for write.

:DT.x
:DD.Checks if the file exists.  This does not actually open the file,
so no
.keyref fclose
is required.
:eDL.
.enddescr
.returns begin
.retval ERR_NO_ERR.
The setting of
.keyword lastrc
if the open/existence check is a success.
.retval ERR_FILE_NOT_FOUND
The setting of
.keyword lastrc
if the open/existence check is a fails.
.returns end
.xmplsect begin
.begxmpl fopen test.dat 1 r
Opens file test.dat for read, and uses file handle 1.
.endxmpl
.begxmpl fopen test.dat 2 w
Opens file test.dat for write, and uses file handle 2.
.endxmpl
.begxmpl fopen test.dat 1 x
Tests if the file test.dat exists.
.endxmpl
.begxmpl fopen test.dat 9 a
Opens file test.dat for append, and uses file handle 9.
.endxmpl
.xmplsect end
.alsosee begin
.seethis fclose
.seethis fread
.seethis fwrite
.alsosee end
.endfunc

.begfunc FREAD
.syntx * FREAD &lt.n&gt. &lt.v1&gt.
.begdescr
Reads a line from the file identified by handle &parm1.
:period.
The line is stored in the variable &parm2
:period.
.enddescr
.returns begin
.retval ERR_NO_ERR
The setting of
.keyword lastrc
if the read was successful.
.retval END_OF_FILE
The setting of
.keyword lastrc
if end of file was encountered.
.retval ERR_FILE_NOT_OPEN
The setting of
.keyword lastrc
if the file being read was not opened with
.keyref fopen
:period.
.returns end
.xmplsect begin
.begxmpl fread 1 %(line)
Reads the next line from file handle 1 into the variable
.var %(line)
:period.
.endxmpl
.xmplsect end
.alsosee begin
.seethis fclose
.seethis fopen
.seethis fwrite
.alsosee end
.endfunc

.begfunc FWRITE
.syntx * FWRITE &lt.n&gt. &lt.v1&gt.
.begdescr
Writes the contents of the variable &parm2 to the file identified
by handle &parm1.
:period.
.enddescr
.returns begin
.retval ERR_NO_ERR
The setting of
.keyword lastrc
if the write was successful.
.retval ERR_FILE_NOT_OPEN
The setting of
.keyword lastrc
if the file being written was not opened with
.keyref fopen
:period.
.returns end
.xmplsect begin
.begxmpl fwrite 3 %(line)
Writes the contents of the variable 
.var %(line)
to file handle 3
:period.
.endxmpl
.xmplsect end
.alsosee begin
.seethis fclose
.seethis fopen
.seethis fread
.alsosee end
.endfunc

.begfunc GET
.syntx * GET &lt.v1&gt.
.begdescr
Waits for the user to type a single keystroke, and then assigns
the keystroke into variable &parm1
:period.
.enddescr
.xmplsect begin
.begxmpl get %(ch)
Waits for a key to be pressed, and then assigns the key to the local
variable
.var %(ch)
:period.
.endxmpl
.xmplsect end
.alsosee begin
.seethis floatmenu
.seethis input
.alsosee end
.endfunc

.begfunc GOTO
.syntx * GOTO &lt.label&gt.
.begdescr
Transfers control to point in script with label &parm1 defined.
.enddescr
.alsosee begin
.seethis label
.alsosee end
.endfunc

.begfunc IF
.syntx * IF &lt.expr&gt.
.begdescr
Starts an
.keyword if
block.
.np
Any variables contained in &parm1 are expanded before the expression
is evaluated.
.np
If &parm1 is true, then the code following the
.keyword if
is executed.  If &parm1 is false, control goes to the next
.keyref elseif
:cont.,
.keyref else
or
.keyref endif
command.
.enddescr
.alsosee begin

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -