Exemplo n.º 1
0
void ydpDictionary::ReGetDefinition(void) {
	if (ReadDefinition(lastIndex) == 0) {
		ParseRTF();
	} else {
		BAlert *alert = new BAlert(APP_NAME, tr("Data file read error."), tr("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
		alert->Go();
	}
}
Exemplo n.º 2
0
void ydpDictionary::GetDefinition(int index) {
	if (!dictionaryReady) {
		BAlert *alert = new BAlert(APP_NAME, tr("Please setup path to dictionary files."), tr("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
		alert->Go();
		return;
	}
	if (index < 0)
		index = lastIndex;
	if (index == lastIndex)
		return;
	lastIndex = index;
	if (ReadDefinition(index) == 0) {
		ParseRTF();
	} else {
		BAlert *alert = new BAlert(APP_NAME, tr("Data file read error."), tr("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
		alert->Go();
	}
}
Exemplo n.º 3
0
void ImplicitAtt(FILE *Nf)
/*   -----------  */
{
#ifdef CUBIST
    _UNK.cval = UNKNOWN;
#else
    _UNK.dval = UNKNOWN;
#endif
    _NA.dval  = NA;

    /*  Get definition as a string in Buff  */

    ReadDefinition(Nf);

    PreviousError = false;
    BN = 0;

    /*  Allocate initial stack and attribute definition  */

    TStack = Alloc(TStackSize=50, EltRec);
    TSN = 0;

    AttDef[MaxAtt] = Alloc(DefSize = 100, DefElt);
    DN = 0;

    /*  Parse Buff as an expression terminated by a period  */

    Expression();
    if ( ! Find(".") ) DefSyntaxError("'.' ending definition");

    /*  Final check -- defined attribute must not be of type String  */

    if ( ! PreviousError )
    {
        if ( DN == 1 && DefOp(AttDef[MaxAtt][0]) == OP_ATT &&
                strcmp(AttName[MaxAtt], "case weight") )
        {
            Error(SAMEATT, AttName[ (long) DefSVal(AttDef[MaxAtt][0]) ], Nil);
        }

        if ( TStack[0].Type == 'B' )
        {
            /*  Defined attributes should never have a value N/A  */

            MaxAttVal[MaxAtt] = 3;
            AttValName[MaxAtt] = AllocZero(4, String);
            AttValName[MaxAtt][1] = strdup("??");
            AttValName[MaxAtt][2] = strdup("t");
            AttValName[MaxAtt][3] = strdup("f");
        }
        else
        {
            MaxAttVal[MaxAtt] = 0;
        }
    }

    if ( PreviousError )
    {
        DN = 0;
        SpecialStatus[MaxAtt] = EXCLUDE;
    }

    /*  Write a terminating marker  */

    DefOp(AttDef[MaxAtt][DN]) = OP_END;

    Free(Buff);
    Free(TStack);
}