code39.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*------------------------------------------------------------------------
  2. * Copyright 2008-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 _CODE39_H_
  24. #define _CODE39_H_
  25. /* Code 39 specific decode state */
  26. typedef struct code39_decoder_s {
  27. unsigned direction : 1; /* scan direction: 0=fwd, 1=rev */
  28. unsigned element : 4; /* element offset 0-8 */
  29. int character : 12; /* character position in symbol */
  30. unsigned s9; /* current character width */
  31. unsigned width; /* last character width */
  32. unsigned config;
  33. int configs[NUM_CFGS]; /* int valued configurations */
  34. } code39_decoder_t;
  35. /* reset Code 39 specific state */
  36. static inline void code39_reset (code39_decoder_t *dcode39)
  37. {
  38. dcode39->direction = 0;
  39. dcode39->element = 0;
  40. dcode39->character = -1;
  41. dcode39->s9 = 0;
  42. }
  43. /* decode Code 39 symbols */
  44. zbar_symbol_type_t _zbar_decode_code39(zbar_decoder_t *dcode);
  45. #endif