コード例 #1
0
ファイル: bintex.c プロジェクト: jpnorair/bintex
int sub_parsestream(void* stream, ot_queue* msg) {
    int status;

    switch (sub_parse_header(stream)) {
    case DATA_EOF:
        return -1;
    case DATA_error:
        return -2;
    case DATA_lineterm:
        return -3;
    case DATA_comment:
        return sub_passcomment(stream);
    case DATA_ascii:
        return sub_getascii(stream, msg);
    case DATA_binnum:
        return sub_getbinnum(&status, stream, msg);
    case DATA_hexnum:
        return sub_gethexnum(&status, stream, msg);
    case DATA_hexblock:
        return sub_gethexblock(stream, msg);
    case DATA_decnum:
        return sub_getdecnum(&status, stream, msg);
    case DATA_decblock:
        return sub_getdecblock(stream, msg);
    }

    return -2;
}
コード例 #2
0
ファイル: input_parser.c プロジェクト: KennyRIM/OpenTag
int sub_gethexblock(FILE* stream, Queue* msg) {
    int status = 0;
    int bytes_written = msg->length;

    while (status == 0) {
        sub_gethexnum(&status, stream, msg);
    }

    bytes_written = msg->length - bytes_written;
    return bytes_written;
}
コード例 #3
0
ファイル: input_parser.c プロジェクト: jpnorair/OpenTag
int sub_gethexblock(FILE* stream, ot_queue* msg) {
    int status = 0;
    int bytes_written;
    bytes_written = q_length(msg);

    while (status == 0) {
        sub_gethexnum(&status, stream, msg);
    }

    bytes_written = q_length(msg) - bytes_written;
    return bytes_written;
}