属性:'naming'
该属性标记了被排除在外的代码行 命名约定分析.一个 off
在停用代码分析的第一个代码行之前分配给 pragma 属性。一个 on
在最后一行之后分配。当一个 omit
被分配,只有下一个代码行被忽略。
插入位置:停用:在 POU 和 DUT 的声明部分中,受影响的行上方。激活:在受影响的线下方。
句法:
{attribute 'naming' := '<switch state>'} <switch state> : on | off | omit on : naming is switched on off : naming is switched off omit : only next codeline is switched off
例子
定义的命名约定: 1) INT 变量名称必须以“int”作为标识符前缀,例如“intVar1”。 (2) 程序名称必须以“prog”开头。
对于下面显示的代码,静态分析仅针对以下变量发出消息: cccVar
, aVariable
, 和 bVariable
.
VAR {attribute 'naming' := 'off'} iVarA : INT; iVarB : INT; {attribute 'naming' := 'on'} iVarC : INT; END_VAR
VAR ... {attribute 'naming' := 'omit'} iVarC : INT; ... END_VAR
{attribute 'naming' := 'omit'} PROGRAM PLC_PRG VAR ... END_VAR
{attribute 'naming' := 'off'} PROGRAM DoSomethingA VAR {attribute 'naming' := 'on'} iVarA : INT; iVarB : INT; … VAR_END