Esempio n. 1
0
std::string TargetToString(FBTEXTURE::TARGET value)
{
	switch (value)
	{
		_CASE_(NORMAL);
		_CASE_(RECTANGLE);
		_CASE_(CUBEMAP);
	}
	return "UNKNOWN";
}
Esempio n. 2
0
static std::string TargetToString(FrameBufferTexture::Target value)
{
	switch (value)
	{
		_CASE_(NORMAL);
		_CASE_(RECTANGLE);
		_CASE_(CUBEMAP);
	}
	return "UNKNOWN";
}
Esempio n. 3
0
std::string FormatToString(FBTEXTURE::FORMAT value)
{
	switch (value)
	{
		_CASE_(LUM8);
		_CASE_(RGB8);
		_CASE_(RGBA8);
		_CASE_(RGB16);
		_CASE_(RGBA16);
		_CASE_(DEPTH24);
	}
	return "UNKNOWN";
}
Esempio n. 4
0
static std::string FormatToString(FrameBufferTexture::Format value)
{
	switch (value)
	{
		_CASE_(R8);
		_CASE_(RGB8);
		_CASE_(RGBA8);
		_CASE_(RGB16);
		_CASE_(RGBA16);
		_CASE_(DEPTH24);
	}
	return "UNKNOWN";
}
Esempio n. 5
0
c_char *
u_kindImage(
    u_kind kind)
{
    c_char *image = NULL;

#define _CASE_(o) case o: image = #o; break;
    switch (kind) {
        _CASE_(U_UNDEFINED);
        _CASE_(U_ENTITY);
        _CASE_(U_PARTICIPANT);
        _CASE_(U_PUBLISHER);
        _CASE_(U_WRITER);
        _CASE_(U_SERVICE);
        _CASE_(U_SERVICEMANAGER);
        _CASE_(U_SUBSCRIBER);
        _CASE_(U_READER);
        _CASE_(U_NETWORKREADER);
        _CASE_(U_GROUPQUEUE);
        _CASE_(U_QUERY);
        _CASE_(U_DATAVIEW);
        _CASE_(U_PARTITION);
        _CASE_(U_TOPIC);
        _CASE_(U_GROUP);
        _CASE_(U_WAITSET);
        _CASE_(U_DOMAIN);
    default:
        image = "Internal error: no image for illegal result value";
        break;
    }
    return image;
#undef _CASE_
}
Esempio n. 6
0
c_char *
u_resultImage(
    u_result result)
{
    c_char *image = NULL;

#define _CASE_(o) case o: image = #o; break;
    switch (result) {
        _CASE_(U_RESULT_UNDEFINED);
        _CASE_(U_RESULT_OK);
        _CASE_(U_RESULT_INTERRUPTED);
        _CASE_(U_RESULT_NOT_INITIALISED);
        _CASE_(U_RESULT_OUT_OF_MEMORY);
        _CASE_(U_RESULT_INTERNAL_ERROR);
        _CASE_(U_RESULT_ILL_PARAM);
        _CASE_(U_RESULT_CLASS_MISMATCH);
        _CASE_(U_RESULT_DETACHING);
        _CASE_(U_RESULT_TIMEOUT);
        _CASE_(U_RESULT_INCONSISTENT_QOS);
        _CASE_(U_RESULT_IMMUTABLE_POLICY);
        _CASE_(U_RESULT_PRECONDITION_NOT_MET);
        _CASE_(U_RESULT_ALREADY_DELETED);
        _CASE_(U_RESULT_UNSUPPORTED);
    default:
        image = "Internal error: no image for illegal result value";
        break;
    }
    return image;
#undef _CASE_
}
Esempio n. 7
0
const DDS::Char*
DDS::OpenSplice::Utils::returnCodeToString(
    DDS::ReturnCode_t code)
{
    const DDS::Char* image;

#define _CASE_(code) case code: image = #code; break;
    switch (code) {
    _CASE_(DDS::RETCODE_OK);
    _CASE_(DDS::RETCODE_ERROR);
    _CASE_(DDS::RETCODE_UNSUPPORTED);
    _CASE_(DDS::RETCODE_BAD_PARAMETER);
    _CASE_(DDS::RETCODE_PRECONDITION_NOT_MET);
    _CASE_(DDS::RETCODE_OUT_OF_RESOURCES);
    _CASE_(DDS::RETCODE_NOT_ENABLED);
    _CASE_(DDS::RETCODE_IMMUTABLE_POLICY);
    _CASE_(DDS::RETCODE_INCONSISTENT_POLICY);
    _CASE_(DDS::RETCODE_ALREADY_DELETED);
    _CASE_(DDS::RETCODE_TIMEOUT);
    _CASE_(DDS::RETCODE_NO_DATA);
    _CASE_(DDS::RETCODE_ILLEGAL_OPERATION);
    break;
    default:
        image = "Illegal return code value.";
    break;
    }
#undef _CASE_
    return image;
}
Esempio n. 8
0
static const char *
getEntityName (
    gapi_entity entity)
{
    _ObjectKind kind;

#define _CASE_(k,n) case OBJECT_KIND_##k: return #n

    kind = gapi_objectGetKind(entity);
    switch ( kind ) {
        _CASE_(ENTITY,Entity);
        _CASE_(DOMAIN,Domain);
        _CASE_(DOMAINPARTICIPANTFACTORY,DomainParticipantFactory);
        _CASE_(DOMAINPARTICIPANT,DomainParticipant);
        _CASE_(TYPESUPPORT,Typesupport);
        _CASE_(TOPICDESCRIPTION,TopicDescription);
        _CASE_(TOPIC,topic);
        _CASE_(CONTENTFILTEREDTOPIC,ContentFilteredtopic);
        _CASE_(MULTITOPIC,MultiTopic);
        _CASE_(PUBLISHER,Publisher);
        _CASE_(SUBSCRIBER,Subscriber);
        _CASE_(DATAWRITER,Datawriter);
        _CASE_(DATAREADER,Datareader);
        _CASE_(CONDITION,Condition);
        _CASE_(STATUSCONDITION,Statuscondition);
        _CASE_(READCONDITION,Readcondition);
        _CASE_(QUERYCONDITION,Querycondition);
        _CASE_(WAITSET,WAITSET);
    default:
        return "UNKNOWN";
    }

#undef _CASE_
}
Esempio n. 9
0
static void
printPrimitive(
    c_type _this,
    toolActionData actionData)
{
    c_object o;
    c_value v;
    c_char *str;

    #define _CASE_(l,f,t) \
            case P_##l: \
            { \
                v.is.f = *(t *)o; \
                v.kind = V_##l; \
                str = c_valueImage(v); \
                printf("%s",c_valueImage(v)); \
                os_free(str); \
            } \
            break

    o = c_iterObject(actionData->stack, 0);
    switch(c_primitiveKind(_this)) {
    _CASE_(BOOLEAN,Boolean,c_bool);
    _CASE_(SHORT,Short,c_short);
    _CASE_(LONG,Long,c_long);
    _CASE_(LONGLONG,LongLong,c_longlong);
    _CASE_(OCTET,Octet,c_octet);
    _CASE_(USHORT,UShort,c_ushort);
    _CASE_(ULONG,ULong,c_ulong);
    _CASE_(ULONGLONG,ULongLong,c_ulonglong);
    _CASE_(CHAR,Char,c_char);
    _CASE_(WCHAR,WChar,c_wchar);
    _CASE_(FLOAT,Float,c_float);
    _CASE_(DOUBLE,Double,c_double);
    case P_ADDRESS:
        v.is.Address = *(c_address *)o;
        v.kind = V_ADDRESS;
        str = c_valueImage(v);
        printf("<%s>",c_valueImage(v));
        os_free(str);
    break;
    case P_VOIDP:
        v.is.Voidp = *(c_voidp *)o;
        v.kind = V_VOIDP;
        str = c_valueImage(v);
        printf("<%s>",c_valueImage(v));
        os_free(str);
    break;
    case P_MUTEX:
    case P_LOCK:
    case P_COND:
        printf("<******>");
    break;
    default:
        printf("Specified type <0x"PA_ADDRFMT"> is not a valid primitive type\n",
               (os_address)_this);
    break;
    }
    #undef _CASE_
}
Esempio n. 10
0
const c_char *
q_tagImage(
    q_tag tag)
{
#define _IMAGE_(t) #t
#define _CASE_(t) case Q_EXPR_##t: return _IMAGE_(Q_EXPR_##t)
    switch (tag) {
    _CASE_(DONTCARE); _CASE_(ERROR);
    _CASE_(PROGRAM); _CASE_(IMPORT); _CASE_(DEFINE); _CASE_(UNDEFINE);
    _CASE_(BIND); _CASE_(SELECT); _CASE_(SELECTDISTINCT); _CASE_(PARAMS);
    _CASE_(PROJECTION); _CASE_(FROM); _CASE_(WHERE); _CASE_(GROUP);
    _CASE_(HAVING); _CASE_(ORDER); _CASE_(DESC); _CASE_(CAST);
    _CASE_(OR); _CASE_(ORELSE); _CASE_(AND); _CASE_(FORALL);
    _CASE_(EXISTS); _CASE_(ANDTHEN); _CASE_(LIKE); _CASE_(EQ);
    _CASE_(NE); _CASE_(LT); _CASE_(LE); _CASE_(GT);
    _CASE_(GE); _CASE_(SOME); _CASE_(ANY); _CASE_(ALL);
    _CASE_(PLUS); _CASE_(SUB); _CASE_(UNION); _CASE_(EXCEPT);
    _CASE_(CONCAT); _CASE_(MUL); _CASE_(DIV); _CASE_(MOD);
    _CASE_(INTERSECT); _CASE_(IN); _CASE_(ABS); _CASE_(NOT);
    _CASE_(INDEX); _CASE_(PROPERTY); _CASE_(LIST); _CASE_(RANGE_);
    _CASE_(FUNCTION); _CASE_(LISTTOSET); _CASE_(ELEMENT); _CASE_(DISTINCT);
    _CASE_(FLATTEN); _CASE_(FIRST); _CASE_(LAST); _CASE_(UNIQUE);
    _CASE_(SUM); _CASE_(MIN); _CASE_(MAX); _CASE_(AVG);
    _CASE_(COUNT); _CASE_(ISUNDEF); _CASE_(ISDEF); _CASE_(CLASS);
    _CASE_(STRUCT); _CASE_(ARRAY); _CASE_(SET); _CASE_(BAG);
    _CASE_(DATE); _CASE_(TIME); _CASE_(TIMESTAMP); _CASE_(VARIABLE);
    _CASE_(SCOPEDNAME); _CASE_(JOIN); _CASE_(KEY);
    _CASE_(CALLBACK);
    }
#undef _CASE_
#undef _IMAGE_
    return NULL;
}
Esempio n. 11
0
void
q_disjunctify(
    q_expr e)
{
    q_expr leftTerm, rightTerm;
    c_long len,i;
    q_expr newTerm, notTerm;

    if (e == NULL) return;
    if (e->kind == T_FNC) {
        switch (e->info.function->tag) {
        case Q_EXPR_AND:
#if 1
            q_promote(e);
#else
            leftTerm = q_leftPar(e);
            rightTerm = q_rightPar(e);
            q_disjunctify(leftTerm);
            q_disjunctify(rightTerm);
            if (q_isFnc(leftTerm,Q_EXPR_OR)) {
                newTerm = F2(Q_EXPR_AND,q_rightPar(leftTerm),q_exprCopy(rightTerm));
                q_swapRight(leftTerm,q_swapRight(e,newTerm));
                q_setTag(leftTerm,Q_EXPR_AND);
                q_setTag(e,Q_EXPR_OR);
                q_disjunctify(e);
            }
            if (q_isFnc(rightTerm,Q_EXPR_OR)) {
                newTerm = F2(Q_EXPR_AND,q_rightPar(rightTerm),q_exprCopy(leftTerm));
                q_swapRight(rightTerm,q_swapLeft(e,newTerm));
                q_setTag(rightTerm,Q_EXPR_AND);
                q_setTag(e,Q_EXPR_OR);
                q_disjunctify(e);
            }
#endif
        break;
        case Q_EXPR_OR:
            leftTerm = q_leftPar(e);
            rightTerm = q_rightPar(e);
            q_disjunctify(leftTerm);
            q_disjunctify(rightTerm);
        break;
        case Q_EXPR_NOT:
            notTerm = q_getPar(e,0);
            if (notTerm->kind == T_FNC) {
                switch (notTerm->info.function->tag) {
                case Q_EXPR_NOT:
                    q_swapExpr(e,q_takePar(notTerm,0));
                    q_dispose(notTerm);
                    q_disjunctify(e);
                break;
                case Q_EXPR_OR:
                case Q_EXPR_AND:
                    /* e = not (A and/or B) */
                    notTerm = q_takePar(e,0);
                    /* e = not; notTerm = (A and/or B); */
                    newTerm = F1(Q_EXPR_NOT,q_exprCopy(q_getPar(notTerm,0)));
                    /* newTerm = not A */
#if 1
                    q_disjunctify(newTerm);
#endif
                    q_swapPar(notTerm,0,newTerm);
                    /* notTerm = (not A) and/or B */
                    newTerm = F1(Q_EXPR_NOT,q_exprCopy(q_getPar(notTerm,1)));
                    /* newTerm = not B */
#if 1
                    q_disjunctify(newTerm);
#endif
                    q_swapPar(notTerm,1,newTerm);
                    /* notTerm = (not A) and/or (not B) */
                    if (notTerm->info.function->tag == Q_EXPR_OR) {
                        notTerm->info.function->tag = Q_EXPR_AND;
                    } else {
                        notTerm->info.function->tag = Q_EXPR_OR;
                    }
                    /* notTerm = (not A) or/and (not B) */
                    q_swapExpr(e,notTerm);
                    /* e = (not A) or/and (not B) */
                    q_dispose(notTerm);
#if 0
                    q_disjunctify(e);
#endif
                break;
#define _CASE_(l,n) case l: notTerm = q_takePar(e,0); \
                            q_swapExpr(e,notTerm); \
                            e->info.function->tag = n; \
                            q_dispose(notTerm); \
                            q_disjunctify(e); \
                    break
                _CASE_(Q_EXPR_EQ,Q_EXPR_NE);
                _CASE_(Q_EXPR_NE,Q_EXPR_EQ);
                _CASE_(Q_EXPR_LT,Q_EXPR_GE);
                _CASE_(Q_EXPR_LE,Q_EXPR_GT);
                _CASE_(Q_EXPR_GT,Q_EXPR_LE);
                _CASE_(Q_EXPR_GE,Q_EXPR_LT);
#undef _CASE_
                default:
                    /* let it be */
                break;
                }
            }
        break;
        case Q_EXPR_CALLBACK:
            q_disjunctify(q_getPar(e,2));
        break;
        default:
            /* let it be */
            len = q_getLen(e);
            for (i=0;i<len;i++) {
                q_disjunctify(q_getPar(e,i));
            }
        break;
        }
    }
}
Esempio n. 12
0
static c_bool
c__cloneReferences (
    c_type type,
    c_voidp data,
    c_voidp dest)
{
    c_type refType;
    c_class cls;
    c_array references, labels, ar, destar;
    c_sequence seq, destseq;
    c_property property;
    c_member member;
    c_long i,j,length,size;
    c_long nrOfRefs,nrOfLabs;
    c_value v;

    switch (c_baseObject(type)->kind) {
    case M_CLASS:
		cls = c_class(type);
		while (cls) {
			length = c_arraySize(c_interface(cls)->references);
			for (i=0;i<length;i++) {
				property = c_property(c_interface(cls)->references[i]);
				refType = property->type;
				_cloneReference(refType,
						C_DISPLACE(data, property->offset),
						C_DISPLACE(dest, property->offset));
			}
			cls = cls->extends;
		}
    break;
    case M_INTERFACE:
        length = c_arraySize(c_interface(type)->references);
        for (i=0;i<length;i++) {
            property = c_property(c_interface(type)->references[i]);
            refType = property->type;
			_cloneReference(refType,
					C_DISPLACE(data, property->offset),
					C_DISPLACE(dest, property->offset));
        }
    break;
    case M_EXCEPTION:
    case M_STRUCTURE:
        length = c_arraySize(c_structure(type)->references);
        for (i=0;i<length;i++) {
            member = c_member(c_structure(type)->references[i]);
            refType = c_specifier(member)->type;
			_cloneReference(refType,
					C_DISPLACE(data, member->offset),
					C_DISPLACE(dest, member->offset));
        }
    break;
    case M_UNION:
#define _CASE_(k,t) case k: v = t##Value(*((t *)data)); break
        switch (c_metaValueKind(c_metaObject(c_union(type)->switchType))) {
        _CASE_(V_BOOLEAN,   c_bool);
        _CASE_(V_OCTET,     c_octet);
        _CASE_(V_SHORT,     c_short);
        _CASE_(V_LONG,      c_long);
        _CASE_(V_LONGLONG,  c_longlong);
        _CASE_(V_USHORT,    c_ushort);
        _CASE_(V_ULONG,     c_ulong);
        _CASE_(V_ULONGLONG, c_ulonglong);
        _CASE_(V_CHAR,      c_char);
        _CASE_(V_WCHAR,     c_wchar);
        default:
            OS_REPORT(OS_ERROR,
                      "c__cloneReferences",0,
                      "illegal union switch type detected");
            assert(FALSE);
            return FALSE;
        break;
        }
#undef _CASE_
        references = c_union(type)->references;
        if (references != NULL) {
            i=0; refType=NULL;
            nrOfRefs = c_arraySize(references);
            while ((i<nrOfRefs) && (refType == NULL)) {
                labels = c_unionCase(references[i])->labels;
                j=0;
                nrOfLabs = c_arraySize(labels);
                while ((j<nrOfLabs) && (refType == NULL)) {
                    if (c_valueCompare(v,c_literal(labels[j])->value) == C_EQ) {
                        c__cloneReferences(c_type(references[i]),
                                           C_DISPLACE(data, c_type(type)->alignment),
                                           C_DISPLACE(dest, c_type(type)->alignment));
                        refType = c_specifier(references[i])->type;
                    }
                    j++;
                }
                i++;
            }
        }
    break;
    case M_COLLECTION:
        refType = c_typeActualType(c_collectionType(type)->subType);
        switch (c_collectionType(type)->kind) {
        case C_ARRAY:
            ar = c_array(data);
            destar = c_array(dest);
            length = c_collectionType(type)->maxSize;
            if (length == 0) {
                length = c_arraySize(ar);
            }
            if (c_typeIsRef(refType)) {
                for (i=0;i<length;i++) {
                    c_cloneIn(refType, ar[i], &destar[i]);
                }
            } else {
                if (c_typeHasRef(refType)) {
                    size = refType->size;
                    for (i=0;i<length;i++) {
                        _cloneReference(refType, C_DISPLACE(data, (i*size)), C_DISPLACE(dest, (i*size)));
                    }
                }
            }
        break;
        case C_SEQUENCE:
            seq = c_sequence(data);
            destseq = c_sequence(dest);
            length = c_sequenceSize(seq);
            if (c_typeIsRef(refType)) {
                for (i=0;i<length;i++) {
                    c_cloneIn(refType, seq[i], &destseq[i]);
                }
            } else {
                if (c_typeHasRef(refType)) {
                    size = refType->size;
                    for (i=0;i<length;i++) {
                        _cloneReference(refType, C_DISPLACE(seq, (i*size)), C_DISPLACE(dest, (i*size)));
                    }
                }
            }
        break;
        default:
            OS_REPORT(OS_ERROR,
                  "c__cloneReferences",0,
                  "illegal collectionType found");
        break;
        }
    break;
    case M_BASE:
    break;
    case M_TYPEDEF:
        c__cloneReferences(c_type(c_typeDef(type)->alias), data, dest);
    break;
    case M_ATTRIBUTE:
    case M_RELATION:
        refType = c_typeActualType(c_property(type)->type);
        _cloneReference(refType,
        		C_DISPLACE(data, c_property(type)->offset),
        		C_DISPLACE(dest, c_property(type)->offset));
    break;
    case M_MEMBER:
        refType = c_typeActualType(c_specifier(type)->type);
        _cloneReference(refType,
        		C_DISPLACE(data, c_member(type)->offset),
        		C_DISPLACE(dest, c_member(type)->offset));
    break;
    case M_UNIONCASE:
        refType = c_typeActualType(c_specifier(type)->type);
        _cloneReference(refType, data, dest);
    break;
    case M_MODULE:
        /* Do nothing */
    break;
    case M_PRIMITIVE:
        /* Do nothing */
    break;
    case M_EXTENT:
    case M_EXTENTSYNC:
    default:
        OS_REPORT(OS_ERROR,
                  "c__cloneReferences",0,
                  "illegal meta object specified");
        assert(FALSE);
        return FALSE;
    }
    return TRUE;
}
Esempio n. 13
0
const c_char *
v_qosKindImage (
    v_qosKind kind)
{
#define _CASE_(o) case o: return #o

    switch (kind) {
    _CASE_(V_PARTITION_QOS);
    _CASE_(V_PARTICIPANT_QOS);
    _CASE_(V_TOPIC_QOS);
    _CASE_(V_WRITER_QOS);
    _CASE_(V_READER_QOS);
    _CASE_(V_PUBLISHER_QOS);
    _CASE_(V_SUBSCRIBER_QOS);
    _CASE_(V_INDEX_QOS);
    _CASE_(V_WRITERHISTORY_QOS);
    _CASE_(V_GROUPHISTORY_QOS);
    _CASE_(V_VIEW_QOS);
    _CASE_(V_DATAVIEW_QOS);
    _CASE_(V_KERNEL_QOS);
    default:
        return "Unknown Qos specified";
    }
#undef _CASE_
}
Esempio n. 14
0
v_qos
v_qosCreate(
    v_kernel kernel,
    v_qosKind kind)
{
    v_qos qos;
    c_base base;
    c_type type;

    assert(kernel != NULL);
    assert(C_TYPECHECK(kernel,v_kernel));

    base = c_getBase(c_object(kernel));

#define _CASE_(l,t) case l: type = c_resolve(base,t); break

    switch (kind) {
    _CASE_(V_PARTITION_QOS,        "kernelModule::v_partitionQos");
    _CASE_(V_PARTICIPANT_QOS,   "kernelModule::v_participantQos");
    _CASE_(V_TOPIC_QOS,         "kernelModule::v_topicQos");
    _CASE_(V_WRITER_QOS,        "kernelModule::v_writerQos");
    _CASE_(V_READER_QOS,        "kernelModule::v_readerQos");
    _CASE_(V_PUBLISHER_QOS,     "kernelModule::v_publisherQos");
    _CASE_(V_SUBSCRIBER_QOS,    "kernelModule::v_subscriberQos");
    _CASE_(V_INDEX_QOS,         "kernelModule::v_indexQos");
    _CASE_(V_WRITERHISTORY_QOS, "kernelModule::v_writerHistoryQos");
    _CASE_(V_GROUPHISTORY_QOS,  "kernelModule::v_groupHistoryQos");
    _CASE_(V_VIEW_QOS,          "kernelModule::v_viewQos");
    _CASE_(V_DATAVIEW_QOS,      "kernelModule::v_dataViewQos");
    _CASE_(V_KERNEL_QOS,        "kernelModule::v_kernelQos");
    default:
        OS_REPORT_1(OS_ERROR,"v_qos::Create",0,
                    "Illegal Qos kind specified (%s)",
                    v_qosKindImage(kind));
        return NULL;
    }

    qos = v_qos(c_new(type));
    c_free(type);
    if (qos) {
        qos->kind = kind;
    } else {
        OS_REPORT(OS_ERROR,
                  "v_qosCreate",0,
                  "Failed to allocate qos.");
        assert(FALSE);
    }

    return qos;

#undef _CASE_
}