bool Value:: IsBooleanValueEquiv(bool &b) const { if ( !_useOldClassAdSemantics ) { return IsBooleanValue( b ); } switch (valueType) { case BOOLEAN_VALUE: b = booleanValue; return true; case INTEGER_VALUE: b = ( integerValue ) ? true : false; return true; case REAL_VALUE: b = ( realValue ) ? true : false; return true; default: return false; } return false; }
UBOOL AfoGuard (LPPLLOCALVARS lpplLocalVars, // Ptr to LocalVars LPTOKEN lptkRhtArg) // Ptr to right argument token { APLSTYPE aplTypeRht; // Right arg storage type APLNELM aplNELMRht; // Right arg NELM APLRANK aplRankRht; // Right arg rank UBOOL bRet; // TRUE iff the result is valid APLLONGEST aplLongestRht; // Right arg value if immediate // Get the right arg (Type, NELM, Rank) AttrsOfToken (lptkRhtArg, &aplTypeRht, &aplNELMRht, &aplRankRht, NULL); // Check for RIGHT RANK ERROR if (IsMultiRank (aplRankRht)) goto RANK_EXIT; // Check for LENGTH ERROR if (!IsSingleton (aplNELMRht)) goto LENGTH_EXIT; // Check for DOMAIN ERROR if (!IsNumeric (aplTypeRht)) goto DOMAIN_EXIT; // Get and validate the first item in a token aplLongestRht = ValidateFirstItemToken (aplTypeRht, lptkRhtArg, &bRet); // Check for DOMAIN ERROR if (!bRet || !IsBooleanValue (aplLongestRht)) goto DOMAIN_EXIT; // If the guard is FALSE, ... if (aplLongestRht EQ 0) { // If we're at the EOL, ... if (lpplLocalVars->lptkNext[-1].tkFlags.TknType EQ TKT_EOL) goto SYNTAX_EXIT; Assert (lpplLocalVars->lptkNext[-1].tkFlags.TknType EQ TKT_EOS); // Skip over the current stmt to the last token of the next stmt // When pl_yylex gets the next token it decrements this ptr first // so that the next token it processes is an EOS/EOL which causes // it to skip the next stmt. lpplLocalVars->lptkNext += lpplLocalVars->lptkNext[-1].tkData.tkIndex; // Save a ptr to the EOS/EOL token lpplLocalVars->lptkEOS = lpplLocalVars->lptkNext - 1; } // End IF goto NORMAL_EXIT; RANK_EXIT: ErrorMessageIndirectToken (ERRMSG_RANK_ERROR APPEND_NAME, lptkRhtArg); goto ERROR_EXIT; LENGTH_EXIT: ErrorMessageIndirectToken (ERRMSG_LENGTH_ERROR APPEND_NAME, lptkRhtArg); goto ERROR_EXIT; DOMAIN_EXIT: ErrorMessageIndirectToken (ERRMSG_DOMAIN_ERROR APPEND_NAME, lptkRhtArg); goto ERROR_EXIT; SYNTAX_EXIT: ErrorMessageIndirectToken (ERRMSG_SYNTAX_ERROR APPEND_NAME, lptkRhtArg); goto ERROR_EXIT; ERROR_EXIT: // Mark as unsuccessful bRet = FALSE; NORMAL_EXIT: return bRet; } // End AfoGuard