ZBar bar code reader . http://zbar.sourceforge.net/ ZBar is licensed under the GNU LGPL 2.1 to enable development of both open source and commercial projects.

Dependents:   GR-PEACH_Camera_in_barcode levkov_ov7670

LICENSE

The ZBar Bar Code Reader is Copyright (C) 2007-2009 Jeff Brown <spadix@users.sourceforge.net> The QR Code reader is Copyright (C) 1999-2009 Timothy B. Terriberry <tterribe@xiph.org>

You can redistribute this library and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

ISAAC is based on the public domain implementation by Robert J. Jenkins Jr., and is itself public domain.

Portions of the bit stream reader are copyright (C) The Xiph.Org Foundation 1994-2008, and are licensed under a BSD-style license.

The Reed-Solomon decoder is derived from an implementation (C) 1991-1995 Henry Minsky (hqm@ua.com, hqm@ai.mit.edu), and is licensed under the LGPL with permission.

Committer:
RyoheiHagimoto
Date:
Tue Apr 19 02:19:39 2016 +0000
Revision:
1:500d42699c34
Parent:
0:56c5742b9e2b
Add copying.txt and license.txt

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RyoheiHagimoto 0:56c5742b9e2b 1 /*------------------------------------------------------------------------
RyoheiHagimoto 0:56c5742b9e2b 2 * Copyright 2007-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
RyoheiHagimoto 0:56c5742b9e2b 3 *
RyoheiHagimoto 0:56c5742b9e2b 4 * This file is part of the ZBar Bar Code Reader.
RyoheiHagimoto 0:56c5742b9e2b 5 *
RyoheiHagimoto 0:56c5742b9e2b 6 * The ZBar Bar Code Reader is free software; you can redistribute it
RyoheiHagimoto 0:56c5742b9e2b 7 * and/or modify it under the terms of the GNU Lesser Public License as
RyoheiHagimoto 0:56c5742b9e2b 8 * published by the Free Software Foundation; either version 2.1 of
RyoheiHagimoto 0:56c5742b9e2b 9 * the License, or (at your option) any later version.
RyoheiHagimoto 0:56c5742b9e2b 10 *
RyoheiHagimoto 0:56c5742b9e2b 11 * The ZBar Bar Code Reader is distributed in the hope that it will be
RyoheiHagimoto 0:56c5742b9e2b 12 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
RyoheiHagimoto 0:56c5742b9e2b 13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
RyoheiHagimoto 0:56c5742b9e2b 14 * GNU Lesser Public License for more details.
RyoheiHagimoto 0:56c5742b9e2b 15 *
RyoheiHagimoto 0:56c5742b9e2b 16 * You should have received a copy of the GNU Lesser Public License
RyoheiHagimoto 0:56c5742b9e2b 17 * along with the ZBar Bar Code Reader; if not, write to the Free
RyoheiHagimoto 0:56c5742b9e2b 18 * Software Foundation, Inc., 51 Franklin St, Fifth Floor,
RyoheiHagimoto 0:56c5742b9e2b 19 * Boston, MA 02110-1301 USA
RyoheiHagimoto 0:56c5742b9e2b 20 *
RyoheiHagimoto 0:56c5742b9e2b 21 * http://sourceforge.net/projects/zbar
RyoheiHagimoto 0:56c5742b9e2b 22 *------------------------------------------------------------------------*/
RyoheiHagimoto 0:56c5742b9e2b 23 #ifndef _ZBAR_MUTEX_H_
RyoheiHagimoto 0:56c5742b9e2b 24 #define _ZBAR_MUTEX_H_
RyoheiHagimoto 0:56c5742b9e2b 25
RyoheiHagimoto 0:56c5742b9e2b 26 #include <config.h>
RyoheiHagimoto 0:56c5742b9e2b 27
RyoheiHagimoto 0:56c5742b9e2b 28 /* simple platform mutex abstraction
RyoheiHagimoto 0:56c5742b9e2b 29 */
RyoheiHagimoto 0:56c5742b9e2b 30
RyoheiHagimoto 0:56c5742b9e2b 31 #if defined(_WIN32)
RyoheiHagimoto 0:56c5742b9e2b 32
RyoheiHagimoto 0:56c5742b9e2b 33 # include <windows.h>
RyoheiHagimoto 0:56c5742b9e2b 34
RyoheiHagimoto 0:56c5742b9e2b 35 # define DEBUG_LOCKS
RyoheiHagimoto 0:56c5742b9e2b 36 # ifdef DEBUG_LOCKS
RyoheiHagimoto 0:56c5742b9e2b 37
RyoheiHagimoto 0:56c5742b9e2b 38 typedef struct zbar_mutex_s {
RyoheiHagimoto 0:56c5742b9e2b 39 int count;
RyoheiHagimoto 0:56c5742b9e2b 40 CRITICAL_SECTION mutex;
RyoheiHagimoto 0:56c5742b9e2b 41 } zbar_mutex_t;
RyoheiHagimoto 0:56c5742b9e2b 42
RyoheiHagimoto 0:56c5742b9e2b 43 static inline int _zbar_mutex_init (zbar_mutex_t *lock)
RyoheiHagimoto 0:56c5742b9e2b 44 {
RyoheiHagimoto 0:56c5742b9e2b 45 lock->count = 1;
RyoheiHagimoto 0:56c5742b9e2b 46 InitializeCriticalSection(&lock->mutex);
RyoheiHagimoto 0:56c5742b9e2b 47 return(0);
RyoheiHagimoto 0:56c5742b9e2b 48 }
RyoheiHagimoto 0:56c5742b9e2b 49
RyoheiHagimoto 0:56c5742b9e2b 50 static inline void _zbar_mutex_destroy (zbar_mutex_t *lock)
RyoheiHagimoto 0:56c5742b9e2b 51 {
RyoheiHagimoto 0:56c5742b9e2b 52 DeleteCriticalSection(&lock->mutex);
RyoheiHagimoto 0:56c5742b9e2b 53 }
RyoheiHagimoto 0:56c5742b9e2b 54
RyoheiHagimoto 0:56c5742b9e2b 55 static inline int _zbar_mutex_lock (zbar_mutex_t *lock)
RyoheiHagimoto 0:56c5742b9e2b 56 {
RyoheiHagimoto 0:56c5742b9e2b 57 EnterCriticalSection(&lock->mutex);
RyoheiHagimoto 0:56c5742b9e2b 58 if(lock->count++ < 1)
RyoheiHagimoto 0:56c5742b9e2b 59 assert(0);
RyoheiHagimoto 0:56c5742b9e2b 60 return(0);
RyoheiHagimoto 0:56c5742b9e2b 61 }
RyoheiHagimoto 0:56c5742b9e2b 62
RyoheiHagimoto 0:56c5742b9e2b 63 static inline int _zbar_mutex_unlock (zbar_mutex_t *lock)
RyoheiHagimoto 0:56c5742b9e2b 64 {
RyoheiHagimoto 0:56c5742b9e2b 65 if(lock->count-- <= 1)
RyoheiHagimoto 0:56c5742b9e2b 66 assert(0);
RyoheiHagimoto 0:56c5742b9e2b 67 LeaveCriticalSection(&lock->mutex);
RyoheiHagimoto 0:56c5742b9e2b 68 return(0);
RyoheiHagimoto 0:56c5742b9e2b 69 }
RyoheiHagimoto 0:56c5742b9e2b 70
RyoheiHagimoto 0:56c5742b9e2b 71 # else
RyoheiHagimoto 0:56c5742b9e2b 72
RyoheiHagimoto 0:56c5742b9e2b 73 typedef CRITICAL_SECTION zbar_mutex_t;
RyoheiHagimoto 0:56c5742b9e2b 74
RyoheiHagimoto 0:56c5742b9e2b 75 static inline int _zbar_mutex_init (zbar_mutex_t *lock)
RyoheiHagimoto 0:56c5742b9e2b 76 {
RyoheiHagimoto 0:56c5742b9e2b 77 InitializeCriticalSection(lock);
RyoheiHagimoto 0:56c5742b9e2b 78 return(0);
RyoheiHagimoto 0:56c5742b9e2b 79 }
RyoheiHagimoto 0:56c5742b9e2b 80
RyoheiHagimoto 0:56c5742b9e2b 81 static inline void _zbar_mutex_destroy (zbar_mutex_t *lock)
RyoheiHagimoto 0:56c5742b9e2b 82 {
RyoheiHagimoto 0:56c5742b9e2b 83 DeleteCriticalSection(lock);
RyoheiHagimoto 0:56c5742b9e2b 84 }
RyoheiHagimoto 0:56c5742b9e2b 85
RyoheiHagimoto 0:56c5742b9e2b 86 static inline int _zbar_mutex_lock (zbar_mutex_t *lock)
RyoheiHagimoto 0:56c5742b9e2b 87 {
RyoheiHagimoto 0:56c5742b9e2b 88 EnterCriticalSection(lock);
RyoheiHagimoto 0:56c5742b9e2b 89 return(0);
RyoheiHagimoto 0:56c5742b9e2b 90 }
RyoheiHagimoto 0:56c5742b9e2b 91
RyoheiHagimoto 0:56c5742b9e2b 92 static inline int _zbar_mutex_unlock (zbar_mutex_t *lock)
RyoheiHagimoto 0:56c5742b9e2b 93 {
RyoheiHagimoto 0:56c5742b9e2b 94 LeaveCriticalSection(lock);
RyoheiHagimoto 0:56c5742b9e2b 95 return(0);
RyoheiHagimoto 0:56c5742b9e2b 96 }
RyoheiHagimoto 0:56c5742b9e2b 97
RyoheiHagimoto 0:56c5742b9e2b 98 # endif
RyoheiHagimoto 0:56c5742b9e2b 99
RyoheiHagimoto 0:56c5742b9e2b 100
RyoheiHagimoto 0:56c5742b9e2b 101 #elif defined(HAVE_LIBPTHREAD)
RyoheiHagimoto 0:56c5742b9e2b 102
RyoheiHagimoto 0:56c5742b9e2b 103 # include <pthread.h>
RyoheiHagimoto 0:56c5742b9e2b 104
RyoheiHagimoto 0:56c5742b9e2b 105 typedef pthread_mutex_t zbar_mutex_t;
RyoheiHagimoto 0:56c5742b9e2b 106
RyoheiHagimoto 0:56c5742b9e2b 107 static inline int _zbar_mutex_init (zbar_mutex_t *lock)
RyoheiHagimoto 0:56c5742b9e2b 108 {
RyoheiHagimoto 0:56c5742b9e2b 109 # ifdef DEBUG_LOCKS
RyoheiHagimoto 0:56c5742b9e2b 110 pthread_mutexattr_t attr;
RyoheiHagimoto 0:56c5742b9e2b 111 pthread_mutexattr_init(&attr);
RyoheiHagimoto 0:56c5742b9e2b 112 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
RyoheiHagimoto 0:56c5742b9e2b 113 int rc = pthread_mutex_init(lock, &attr);
RyoheiHagimoto 0:56c5742b9e2b 114 pthread_mutexattr_destroy(&attr);
RyoheiHagimoto 0:56c5742b9e2b 115 return(rc);
RyoheiHagimoto 0:56c5742b9e2b 116 # else
RyoheiHagimoto 0:56c5742b9e2b 117 return(pthread_mutex_init(lock, NULL));
RyoheiHagimoto 0:56c5742b9e2b 118 # endif
RyoheiHagimoto 0:56c5742b9e2b 119 }
RyoheiHagimoto 0:56c5742b9e2b 120
RyoheiHagimoto 0:56c5742b9e2b 121 static inline void _zbar_mutex_destroy (zbar_mutex_t *lock)
RyoheiHagimoto 0:56c5742b9e2b 122 {
RyoheiHagimoto 0:56c5742b9e2b 123 pthread_mutex_destroy(lock);
RyoheiHagimoto 0:56c5742b9e2b 124 }
RyoheiHagimoto 0:56c5742b9e2b 125
RyoheiHagimoto 0:56c5742b9e2b 126 static inline int _zbar_mutex_lock (zbar_mutex_t *lock)
RyoheiHagimoto 0:56c5742b9e2b 127 {
RyoheiHagimoto 0:56c5742b9e2b 128 int rc = pthread_mutex_lock(lock);
RyoheiHagimoto 0:56c5742b9e2b 129 # ifdef DEBUG_LOCKS
RyoheiHagimoto 0:56c5742b9e2b 130 assert(!rc);
RyoheiHagimoto 0:56c5742b9e2b 131 # endif
RyoheiHagimoto 0:56c5742b9e2b 132 /* FIXME save system code */
RyoheiHagimoto 0:56c5742b9e2b 133 /*rc = err_capture(proc, SEV_ERROR, ZBAR_ERR_LOCKING, __func__,
RyoheiHagimoto 0:56c5742b9e2b 134 "unable to lock processor");*/
RyoheiHagimoto 0:56c5742b9e2b 135 return(rc);
RyoheiHagimoto 0:56c5742b9e2b 136 }
RyoheiHagimoto 0:56c5742b9e2b 137
RyoheiHagimoto 0:56c5742b9e2b 138 static inline int _zbar_mutex_unlock (zbar_mutex_t *lock)
RyoheiHagimoto 0:56c5742b9e2b 139 {
RyoheiHagimoto 0:56c5742b9e2b 140 int rc = pthread_mutex_unlock(lock);
RyoheiHagimoto 0:56c5742b9e2b 141 # ifdef DEBUG_LOCKS
RyoheiHagimoto 0:56c5742b9e2b 142 assert(!rc);
RyoheiHagimoto 0:56c5742b9e2b 143 # endif
RyoheiHagimoto 0:56c5742b9e2b 144 /* FIXME save system code */
RyoheiHagimoto 0:56c5742b9e2b 145 return(rc);
RyoheiHagimoto 0:56c5742b9e2b 146 }
RyoheiHagimoto 0:56c5742b9e2b 147
RyoheiHagimoto 0:56c5742b9e2b 148
RyoheiHagimoto 0:56c5742b9e2b 149 #else
RyoheiHagimoto 0:56c5742b9e2b 150
RyoheiHagimoto 0:56c5742b9e2b 151 typedef int zbar_mutex_t[0];
RyoheiHagimoto 0:56c5742b9e2b 152
RyoheiHagimoto 0:56c5742b9e2b 153 #define _zbar_mutex_init(l) -1
RyoheiHagimoto 0:56c5742b9e2b 154 #define _zbar_mutex_destroy(l)
RyoheiHagimoto 0:56c5742b9e2b 155 #define _zbar_mutex_lock(l) 0
RyoheiHagimoto 0:56c5742b9e2b 156 #define _zbar_mutex_unlock(l) 0
RyoheiHagimoto 0:56c5742b9e2b 157
RyoheiHagimoto 0:56c5742b9e2b 158 #endif
RyoheiHagimoto 0:56c5742b9e2b 159
RyoheiHagimoto 0:56c5742b9e2b 160 #endif
RyoheiHagimoto 0:56c5742b9e2b 161