Ejemplo n.º 1
0
void countFiles(std::wstring dir, PKGItem *base, std::map<RPKGEntry *, PKGItem*>& itemMap)
{
    for (int i = 0; i < base->childCount; i++)
    {
        if (base->childs[i].dataType == 3)
            countFiles(dir + fromASCII(base->childs[i].name) + L"/", &base->childs[i], itemMap);
        else
        {
            RPKGEntry *e = new RPKGEntry;
            e->name = dir + fromASCII(base->childs[i].name);
            itemMap[e] = &base->childs[i];
        }
    }
}
uint16_t ClientAJAKumoTCP::hexToDec(char* str, uint8_t len) {
    uint16_t value = 0;
    for(uint8_t i = 0; i < len; i++) {
        value |= fromASCII(str[len-i-1]) << (i*4);
    }
    return value;
}
Ejemplo n.º 3
0
        bool operator()(char ch) {
            switch (state) {
                case IntegerParseState::Start:
                    goto start;
                case IntegerParseState::ParsingInt:
                    goto take_int;
                case IntegerParseState::ParsingFract:
                    goto take_fact;
                case IntegerParseState::Done:
                    goto number_parsed;
                default:
                    goto error;
            }
start:
            if (isspace(ch)) return true;
            if (ch == 0x2D) {
                negative = true;
                state = IntegerParseState::ParsingInt;
                return true;
            }
            state = IntegerParseState::ParsingInt;
take_int:
            if (valid(ch)) {
                integer *= radix;
                integer += fromASCII(ch);
                return true;
            }
            if (isspace(ch)) goto number_parsed;
            if (ch == '.') {
                state = IntegerParseState::ParsingFract;
                return true;
            }
            goto error;
take_fact:
            if (valid(ch)) {
                exp = exp / radix;
                fraction += fromASCII(ch) * exp;
                return true;
            }
            if (isspace(ch)) goto number_parsed;
error:
            state = IntegerParseState::Error;
number_parsed:
            state = IntegerParseState::Done;
            return false;
        }
Ejemplo n.º 4
0
 bool valid(uint8_t ch) {
     uint8_t v = fromASCII(ch);
     return v < radix;
 }