目次

オブジェクト変数生成(AWK)

 オブジェクト指向の開発環境でアプリケーションを
 開発する場合、ラベル、テキスト、ボタン等を区別
 して定義することが必要です。

 オブジェクトを区別できるように、接頭辞をつけています。

 自分がオブジェクト指向の開発環境で利用する変数は
 次のように決めています。

 テキストファイルに対象となる変数名と種別を
 次のように入れておき、スクリプトに渡します。

unit label
push button
unit text

 スクリプトは、以下。

{
  # label
  if ( $2 == "label" )  { printf("lbl%s",$1); }
  # text
  if ( $2 == "text" )   { printf("txt%s",$1); }
  # edit
  if ( $2 == "edit" )   { printf("edt%s",$1); }
  # button
  if ( $2 == "button" ) { printf("btn%s",$1); }
  # combo box
  if ( $2 == "combo" )  { printf("cbx%s",$1); }
  # scroll
  if ( $2 == "scroll" ) { printf("scr%s",$1); }

  printf("\n");
}

 テキストファイルを用意します。



 スクリプトを適用すると、次のようになります。



 結果を残すなら、I/Oリダイレクトとします。




目次

inserted by FC2 system