Пример #1
0
/*--------------------------------------------------------------------------------------------------
  Create a new property.
--------------------------------------------------------------------------------------------------*/
dvProperty dvPropertyCreate(
    dvClass owningClass,
    dvUnion owningUnion,
    dvPropertyType type,
    utSym sym)
{
    dvProperty property = dvClassFindProperty(owningClass, sym);

    if(property != dvPropertyNull) {
        utWarning("Property %s already exists on class %s", utSymGetName(sym),
                  dvClassGetName(owningClass));
        if(dvPropertyGetClass(property) != owningClass ||
                dvPropertyGetUnion(property) != owningUnion ||
                dvPropertyGetType(property) != type) {
            utError("Property %s defined differently the second time", utSymGetName(sym));
        }
        return property;
    }
    property = dvPropertyAlloc();
    dvPropertySetType(property, type);
    dvPropertySetSym(property, sym);
    dvClassAppendProperty(owningClass, property);
    if(owningUnion != dvUnionNull) {
        dvUnionAppendProperty(owningUnion, property);
    }
    return property;
}
Пример #2
0
// Print out an error message and exit.
void paExprError(
    paExpr expr,
    char *message,
    ...)
{
    char *buff;
    va_list ap;

    va_start(ap, message);
    buff = utVsprintf((char *)message, ap);
    va_end(ap);
    utError("Line %d: %s", paExprGetLineNum(expr), buff);
}