* @param errorP
   * @return BooleanWrapper
   */
  public static BooleanWrapper coerceValueToBoolean(Stella_Object value, boolean errorP) {
    if ((value == Stella.SYM_STELLA_TRUE) ||
        (value == Stella.KWD_TRUE)) {
      return (Stella.TRUE_WRAPPER);
    }
    else if ((value == Stella.SYM_STELLA_FALSE) ||
        (value == Stella.KWD_FALSE)) {
      return (Stella.FALSE_WRAPPER);
    }
    { Surrogate testValue000 = Stella_Object.safePrimaryType(value);

      if (Surrogate.subtypeOfSymbolP(testValue000)) {
        { Symbol value000 = ((Symbol)(value));

          if (Stella.stringEqualP(value000.symbolName, "TRUE")) {
            return (Stella.TRUE_WRAPPER);
          }
          else if (Stella.stringEqualP(value000.symbolName, "FALSE")) {
            return (Stella.FALSE_WRAPPER);
          }
        }
      }
      else if (Surrogate.subtypeOfKeywordP(testValue000)) {
        { Keyword value000 = ((Keyword)(value));

          if (Stella.stringEqualP(value000.symbolName, "TRUE")) {
            return (Stella.TRUE_WRAPPER);
          }
          else if (Stella.stringEqualP(value000.symbolName, "FALSE")) {
            return (Stella.FALSE_WRAPPER);
          }
        }
      }
      else if (Surrogate.subtypeOfBooleanP(testValue000)) {
        { BooleanWrapper value000 = ((BooleanWrapper)(value));

          return (value000);
        }
      }
      else {
      }
    }
    if (errorP) {
      { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

        stream000.nativeStream.print("coerce-value-to-boolean: can't coerce `" + value + "' of type `" + (((value != null) ? value.primaryType() : Stella.SGT_STELLA_UNKNOWN)) + "'");
        throw ((StellaException)(StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
      }
    }
    else {
      return (null);
    }
  }