0
点赞
收藏
分享

微信扫一扫

DMIS 5.2高级编程之无条件跳转(JUMPTO跳转)

程序运行从一个区域跨到另一个区域称为跳转。在DMIS里JUMPTO和标签同时使用就可以实现无条件跳转功能。无条件跳转指令和其他DMIS控制程序流程的语句稍微有些不同,因为即使程序没有条件语句跳转还是会执行。

JUMPTO语句

JUMPTO语句用来引导程序运行到新的一行,这一行用标签识别,格式如下:

JUMPTO/(标签)

标签:程序即将运行到的行

例子

(startline)

$$DMIS语句

$$DMIS语句

JUMPTO/(startline)

DMIS5.2标准:

Function:
Used to transfer the control of the program to a labelled statement anywhere in the program.

Input Formats:


can be:
JUMPTO/(jumptarget)

Output Formats:


can be:
None

Where:


(jumptarget)
is the label identifying a program line that contains only a label name enclosed in parentheses, with no label type, to which the program execution control will be transferred.

The JUMPTO statement breaks the sequential flow of execution and transfers control to the statement immediately following the jumptarget. The jumptarget may be before or after the JUMPTO statement, as long as it is in the same

一般来说程序是按行来运行的,第一行开始最后一行结束,而应用DMIS的一些高级语句就可以直接跳转到某一行,或跳过一些行;可以重复运行几行程序固定次数或可变次数;

Example 1

DECL/GLOBAL,CHAR,l,AnsrYN

DECL/GLOBAL,REAL,AnsR,A,B

DECL/GLOBAL,BOOL,DME

DME=ASSIGN/.TRUE.

IF/(DME)

JUMPTO/(outif)

ENDIF

executable statements

IF/((AnsrYN .EQ. 'N').AND.(AnsR .GT. 0.1))

executable statements

ENDIF

executable statements

(outif)

F(label)=FEAT/POINT,CART,25.31,41.45,1.76,0.00,0.00,-1.00

executable statements

IF/(A .LE. B)

executable statements

ELSE

IF/(A .LT. 3.0)

executable statements

ELSE

JUMPTO/(endblk)

ENDIF

ENDIF

(endblk)

Example 2

DECL/GLOBAL,BOOL,bad

executable statements

JUMPTO/(new_probe)

(restart)

by-passed executable statements

(new_probe)

SNSLCT/S(next_probe)

(cylndr7)

F(CYL7)=FEAT/CYLNDR,INNER,CART,-1.00,1.00,0.0,0.00,0.00,1.00,0.375

MEAS/CYLNDR,F(CYL7),8

PTMEAS/CART,-1.188,1.00,-0.250,1.00,0.00,0.00

PTMEAS/CART,-0.813,1.00,-0.250,-1.00,0.00,0.00

PTMEAS/CART,-1.00,1.188,-0.250,0.00,1.00,0.00

PTMEAS/CART,-1.00,0.813,-0.250,0.00,-1.00,0.00

PTMEAS/CART,-1.188,1.00,-5.250,1.00,0.00,0.00

PTMEAS/CART,-0.813,1.00,-5.250,-1.00,0.00,0.00

PTMEAS/CART,-1.00,1.188,-5.250,0.00,1.00,0.00

PTMEAS/CART,-1.00,0.813,-5.250,0.00,-1.00,0.00

ENDMES

executable statements

IF/(bad)

JUMPTO/(cylndr7)

ENDIF

DMIS 5.2高级编程之无条件跳转(JUMPTO跳转)_条件语句


举报

相关推荐

0 条评论