Logo Search packages:      
Sourcecode: zebra version File versions  Download package

zebra_symbol_type_t zebra_decode_width ( zebra_decoder_t decoder,
unsigned  width 
)

process next bar/space width from input stream. the width is in arbitrary relative units. first value of a scan is ZEBRA_SPACE width, alternating from there.

Returns:
appropriate symbol type if width completes decode of a symbol (data is available for retrieval)

ZEBRA_PARTIAL as a hint if part of a symbol was decoded

ZEBRA_NONE (0) if no new symbol data is available

Definition at line 151 of file decoder.c.

References ZEBRA_CFG_ENABLE, zebra_decode_width(), ZEBRA_NONE, and ZEBRA_PARTIAL.

Referenced by zebra::Decoder::decode_width(), zebra::Decoder::operator<<(), and zebra_decode_width().

{
    dcode->w[dcode->idx & (DECODE_WINDOW - 1)] = w;
    dprintf(1, "    decode[%x]: w=%d (%g)\n", dcode->idx, w, (w / 32.));

    /* each decoder processes width stream in parallel */
    zebra_symbol_type_t sym = dcode->type = ZEBRA_NONE;

#ifdef ENABLE_EAN
    if((dcode->ean.enable) &&
       (sym = _zebra_decode_ean(dcode)))
        dcode->type = sym;
#endif
#ifdef ENABLE_CODE39
    if(TEST_CFG(dcode->code39.config, ZEBRA_CFG_ENABLE) &&
       (sym = _zebra_decode_code39(dcode)) > ZEBRA_PARTIAL)
        dcode->type = sym;
#endif
#ifdef ENABLE_CODE128
    if(TEST_CFG(dcode->code128.config, ZEBRA_CFG_ENABLE) &&
       (sym = _zebra_decode_code128(dcode)) > ZEBRA_PARTIAL)
        dcode->type = sym;
#endif
#ifdef ENABLE_I25
    if(TEST_CFG(dcode->i25.config, ZEBRA_CFG_ENABLE) &&
       (sym = _zebra_decode_i25(dcode)) > ZEBRA_PARTIAL)
        dcode->type = sym;
#endif

    dcode->idx++;
    if(dcode->type) {
        if(dcode->handler)
            dcode->handler(dcode);
        if(dcode->lock && dcode->type > ZEBRA_PARTIAL)
            dcode->lock = 0;
    }
    return(dcode->type);
}


Generated by  Doxygen 1.6.0   Back to index