CAPL类型定义布尔

CAPL类型定义布尔,capl,Capl,CAPL是否支持typedef之类的功能?我的目标是创建一个布尔值: typedef char bool; 我能够做到这一点: enum bool { false = 0, true = 1 }; 但这不是我想要的,因为我必须这样做: enum bool isValid() 而不是: bool isValid() 不幸的是,CAPL中没有typedef enum是有关布尔值的最接近值 以下代码显示了

CAPL是否支持typedef之类的功能?我的目标是创建一个布尔值:

    typedef char bool;
我能够做到这一点:

      enum bool {
        false = 0,
        true  = 1
      };
但这不是我想要的,因为我必须这样做:

      enum bool isValid()
而不是:

      bool isValid()

不幸的是,CAPL中没有typedef
enum
是有关布尔值的最接近值

以下代码显示了此类枚举的用法:

variables
{
  enum Bool {
    true = 1,
    false = 0
  };
}



on Start {
  enum Bool state; 


  // setting the value
  state = true;


  // accessing the integer value
  write("state (integer value): %d", state); // prints "1"


  // accessing the value identifier
  write("state (value identifier ): %s", state.name()); // prints "true"


  // usage in if-statement
  if (state == true) {
    write("if-statement: true");
  } else {
    write("if-statement: false");
  }


  // usage in switch-statement  
  switch (state) {
    case true:
      write("switch-statement: true");
      break;
    case false:
      write("switch-statement: false");
      break;
    default: 
      write("switch-statement: undefined");
      break;
  }
}