Skip to main content

属性'naming'

属性は、によって使用されるコード行を識別します 命名規則の分析 除外されます。コード分析が中断されるコードの最初の行の前に、プラグマ属性がオンになっています off、最後の行の後 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変数の識別子には、「intVar1」などの「int」プレフィックスを付ける必要があります。 (2)プログラム名は「prog」で始まる必要があります。

以下に示すコードの場合、静的分析は次の変数についてのみレポートします。 cccVaraVariablebVariable

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