code128.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*------------------------------------------------------------------------
  2. * Copyright 2007-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
  3. *
  4. * This file is part of the ZBar Bar Code Reader.
  5. *
  6. * The ZBar Bar Code Reader is free software; you can redistribute it
  7. * and/or modify it under the terms of the GNU Lesser Public License as
  8. * published by the Free Software Foundation; either version 2.1 of
  9. * the License, or (at your option) any later version.
  10. *
  11. * The ZBar Bar Code Reader is distributed in the hope that it will be
  12. * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  13. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU Lesser Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser Public License
  17. * along with the ZBar Bar Code Reader; if not, write to the Free
  18. * Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  19. * Boston, MA 02110-1301 USA
  20. *
  21. * http://sourceforge.net/projects/zbar
  22. *------------------------------------------------------------------------*/
  23. #ifndef _CODE128_H_
  24. #define _CODE128_H_
  25. /* Code 128 specific decode state */
  26. typedef struct code128_decoder_s {
  27. unsigned direction : 1; /* scan direction: 0=fwd/space, 1=rev/bar */
  28. unsigned element : 3; /* element offset 0-5 */
  29. int character : 12; /* character position in symbol */
  30. unsigned s6; /* character width */
  31. unsigned config;
  32. int configs[NUM_CFGS]; /* int valued configurations */
  33. } code128_decoder_t;
  34. /* reset Code 128 specific state */
  35. static inline void code128_reset (code128_decoder_t *dcode128)
  36. {
  37. dcode128->direction = 0;
  38. dcode128->element = 0;
  39. dcode128->character = -1;
  40. dcode128->s6 = 0;
  41. }
  42. /* decode Code 128 symbols */
  43. zbar_symbol_type_t _zbar_decode_code128(zbar_decoder_t *dcode);
  44. #endif