Ejemplo n.º 1
0
void CDataType::WriteRecvPar(FILE *f)
{
    if (retByteCount)
    {
        if (IsReturn())
            fprintf(f, "\trpc_par0 = msg.Get_%s();\n", GetTypeName());
        else
            fprintf(f, "\trpc_par%u = msg.Get_%s();\n", id, GetTypeName());
    }
}
Ejemplo n.º 2
0
void Loader::EatReturns(void)
{
	char c;
	do 
	{
		ReadChar(c);	
	} while(IsReturn(c));

	if (!feof(f))
		fseek(f, -1, SEEK_CUR); // Don't have to check for \n because it is not whitespace
}
Ejemplo n.º 3
0
bool CDataType::Read(const char*&s, int parNr)
{
    id = parNr;
    parByteCount = 0;
    retByteCount = 0;
    retValue = false;

    if (*s == 0) return false;
    switch (*s)
    {
    case '0':
        comp = REFERENCE;
        s++;
        break;
    case '1':
        comp = VECTOR;
        s++;
        break;
    case '2':
        comp = VECTORR;
        s++;
        break;
    case '3':
        comp = STRING;
        s++;
        break;
    case '4':
        comp = STRINGR;
        s++;
        break;
    case '5':
        comp = HWVECTORR;
        s++;
        break;
    default:
        comp = SIMPLE;
    }

    switch (*(s++))
    {
    case 'v':
        type = VOID;
        break;
    case 'b':
        type = BOOL;
        break;
    case 'c':
        type = CHAR;
        break;
    case 'C':
        type = UCHAR;
        break;
    case 's':
        type = SHORT;
        break;
    case 'S':
        type = USHORT;
        break;
    case 'i':
        type = INT;
        break;
    case 'I':
        type = UINT;
        break;
    case 'l':
        type = LONG;
        break;
    case 'L':
        type = ULONG;
        break;
    default:
        throw "unknow data type id";
    }

    if (IsReturn())
    {
        if (comp != SIMPLE)  throw "return value should be a simple type";
        retByteCount = typeByteSize[type];
    }
    else
    {
        if (type == VOID)  throw "void in parameter list not allowed";
        if (comp == REFERENCE)                    retByteCount = typeByteSize[type];
        if (comp == REFERENCE || comp == SIMPLE)  parByteCount = typeByteSize[type];
    }

    if (retByteCount || comp == VECTORR || comp == STRINGR) retValue = true;

    switch (comp)
    {
    case SIMPLE:
    case REFERENCE:
        cTypeName = string(typeCNames[type]);
        break;
    case VECTOR:
        cTypeName = string("vector<") + typeCNames[type] + ">";
        break;
    case VECTORR:
        cTypeName = string("vectorR<") + typeCNames[type] + ">";
        break;
    case STRING:
        cTypeName = string("string");
        break;
    case STRINGR:
        cTypeName = string("stringR");
        break;
    case HWVECTORR:
        cTypeName = string("HWvectorR<") + typeCNames[type] + ">";
        break;
    }

    return true;
}