├── EXPERIMENTAL ├── CREDITS ├── qrencode ├── acinclude.m4 ├── tests │ ├── .deps │ │ ├── decoder.Po │ │ ├── test_rs.Po │ │ ├── test_mask.Po │ │ ├── test_mmask.Po │ │ ├── test_monkey.Po │ │ ├── test_mqrspec.Po │ │ ├── test_qrinput.Po │ │ ├── test_qrspec.Po │ │ ├── test_split.Po │ │ ├── prof_qrencode.Po │ │ ├── pthread_qrencode.Po │ │ ├── test_bitstream.Po │ │ ├── test_estimatebit.Po │ │ ├── test_qrencode.Po │ │ ├── view_qrcode-view_qrcode.Po │ │ ├── create_frame_pattern-create_frame_pattern.Po │ │ └── create_mqr_frame_pattern-create_mqr_frame_pattern.Po │ ├── frame │ ├── test_all.sh │ ├── test_rs.c │ ├── decoder.h │ ├── prof_qrencode.c │ ├── Makefile.am │ ├── pthread_qrencode.c │ ├── test_mmask.c │ ├── test_estimatebit.c │ ├── create_frame_pattern.c │ ├── create_mqr_frame_pattern.c │ ├── common.h │ ├── test_mqrspec.c │ └── test_bitstream.c ├── stamp-h1 ├── TODO ├── libqrencode.pc.in ├── libqrencode.pc ├── autogen.sh ├── Makefile.am ├── mmask.h ├── bitstream.h ├── rscode.h ├── mask.h ├── split.h ├── qrencode.spec ├── qrencode.spec.in ├── config.h.in ├── config.h ├── qrencode_inner.h ├── qrencode.1.in ├── qrinput.h ├── configure.ac ├── mmask.c ├── mqrspec.h ├── README ├── bitstream.c ├── .deps │ ├── split.Plo │ ├── bitstream.Plo │ ├── qrinput.Plo │ ├── qrencode.Plo │ ├── mask.Plo │ ├── mmask.Plo │ ├── rscode.Plo │ ├── mqrspec.Plo │ ├── qrspec.Plo │ └── qrencode-qrenc.Po ├── qrspec.h ├── use │ └── missing ├── mqrspec.c └── mask.c ├── .svnignore ├── r.sh ├── config.w32 ├── .gitignore ├── dcode.php ├── tests ├── 002.phpt └── 001.phpt ├── LICENSE ├── dcode.h ├── config.m4 ├── php_dcode.h └── README.md /EXPERIMENTAL: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /CREDITS: -------------------------------------------------------------------------------- 1 | dcode 2 | -------------------------------------------------------------------------------- /qrencode/acinclude.m4: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.svnignore: -------------------------------------------------------------------------------- 1 | .deps 2 | *.lo 3 | *.la 4 | -------------------------------------------------------------------------------- /qrencode/tests/.deps/decoder.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /qrencode/tests/.deps/test_rs.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /qrencode/stamp-h1: -------------------------------------------------------------------------------- 1 | timestamp for config.h 2 | -------------------------------------------------------------------------------- /qrencode/tests/.deps/test_mask.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /qrencode/tests/.deps/test_mmask.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /qrencode/tests/.deps/test_monkey.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /qrencode/tests/.deps/test_mqrspec.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /qrencode/tests/.deps/test_qrinput.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /qrencode/tests/.deps/test_qrspec.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /qrencode/tests/.deps/test_split.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /qrencode/tests/.deps/prof_qrencode.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /qrencode/tests/.deps/pthread_qrencode.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /qrencode/tests/.deps/test_bitstream.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /qrencode/tests/.deps/test_estimatebit.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /qrencode/tests/.deps/test_qrencode.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /qrencode/tests/.deps/view_qrcode-view_qrcode.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /qrencode/tests/.deps/create_frame_pattern-create_frame_pattern.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /qrencode/tests/.deps/create_mqr_frame_pattern-create_mqr_frame_pattern.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /qrencode/tests/frame: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/outman/dcode/HEAD/qrencode/tests/frame -------------------------------------------------------------------------------- /r.sh: -------------------------------------------------------------------------------- 1 | /Users/outman/Workspace/opt/bin/phpize 2 | ./configure --with-php-config=//Users/outman/Workspace/opt/bin/php-config 3 | make 4 | make test 5 | -------------------------------------------------------------------------------- /qrencode/tests/test_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | ./test_bitstream 3 | ./test_estimatebit 4 | ./test_qrencode 5 | ./test_qrinput 6 | ./test_qrspec 7 | ./test_rs 8 | ./test_split 9 | ./test_mask 10 | ./test_mqrspec 11 | ./test_mmask 12 | ./test_monkey 13 | -------------------------------------------------------------------------------- /qrencode/TODO: -------------------------------------------------------------------------------- 1 | Micro QR code encoding is not tested well. 2 | 3 | Documents (not only the README, but also the manual of the library) needs 4 | revision of grammer, spell or to resolve ambiguity or incomplete descriptions. 5 | Feel really free to send us your revision. 6 | -------------------------------------------------------------------------------- /qrencode/libqrencode.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libqrencode 7 | Description: A QR Code encoding library 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -lqrencode 10 | Libs.private: @LIBPTHREAD@ 11 | Cflags: -I${includedir} 12 | -------------------------------------------------------------------------------- /qrencode/libqrencode.pc: -------------------------------------------------------------------------------- 1 | prefix=/usr/local 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: libqrencode 7 | Description: A QR Code encoding library 8 | Version: 3.4.4 9 | Libs: -L${libdir} -lqrencode 10 | Libs.private: -lpthread 11 | Cflags: -I${includedir} 12 | -------------------------------------------------------------------------------- /config.w32: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | // vim:ft=javascript 3 | 4 | // If your extension references something external, use ARG_WITH 5 | // ARG_WITH("dcode", "for dcode support", "no"); 6 | 7 | // Otherwise, use ARG_ENABLE 8 | // ARG_ENABLE("dcode", "enable dcode support", "no"); 9 | 10 | if (PHP_DCODE != "no") { 11 | EXTENSION("dcode", "dcode.c"); 12 | } 13 | 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | # Object files 4 | *.o 5 | *.ko 6 | *.obj 7 | *.elf 8 | 9 | # Precompiled Headers 10 | *.gch 11 | *.pch 12 | 13 | # Libraries 14 | *.lib 15 | *.a 16 | *.la 17 | *.lo 18 | 19 | # Shared objects (inc. Windows DLLs) 20 | *.dll 21 | *.so 22 | *.so.* 23 | *.dylib 24 | 25 | # Executables 26 | *.exe 27 | *.out 28 | *.app 29 | *.i*86 30 | *.x86_64 31 | *.hex 32 | 33 | # Debug files 34 | *.dSYM/ 35 | -------------------------------------------------------------------------------- /dcode.php: -------------------------------------------------------------------------------- 1 | "; 3 | 4 | if(!extension_loaded('dcode')) { 5 | dl('dcode.' . PHP_SHLIB_SUFFIX); 6 | } 7 | $module = 'dcode'; 8 | $functions = get_extension_funcs($module); 9 | echo "Functions available in the test extension:$br\n"; 10 | foreach($functions as $func) { 11 | echo $func."$br\n"; 12 | } 13 | echo "$br\n"; 14 | $function = 'confirm_' . $module . '_compiled'; 15 | if (extension_loaded($module)) { 16 | $str = $function($module); 17 | } else { 18 | $str = "Module $module is not compiled into PHP"; 19 | } 20 | echo "$str\n"; 21 | ?> 22 | -------------------------------------------------------------------------------- /tests/002.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for dcode's qrcode functions 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 20 | --EXPECT-- 21 | 238 22 | 238 23 | 239 24 | 239 25 | 241 26 | 241 27 | -------------------------------------------------------------------------------- /qrencode/autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | if [ `uname -s` = Darwin ]; then 6 | LIBTOOLIZE=glibtoolize 7 | else 8 | LIBTOOLIZE=libtoolize 9 | fi 10 | 11 | ACLOCAL_OPT="" 12 | if [ -d /usr/local/share/aclocal ]; then 13 | ACLOCAL_OPT="-I /usr/local/share/aclocal" 14 | elif [ -d /opt/local/share/aclocal ]; then 15 | ACLOCAL_OPT="-I /opt/local/share/aclocal" 16 | elif [ -d /usr/share/aclocal ]; then 17 | ACLOCAL_OPT="-I /usr/share/aclocal" 18 | fi 19 | 20 | if [ ! -d use ]; then 21 | mkdir use 22 | fi 23 | 24 | autoheader 25 | 26 | aclocal $ACLOCAL_OPT 27 | 28 | $LIBTOOLIZE --automake --copy 29 | automake --add-missing --copy 30 | 31 | autoconf 32 | -------------------------------------------------------------------------------- /tests/001.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for dcode's en/decrypt functions 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 28 | --EXPECT-- 29 | 100000 30 | HELLO WORLD 31 | HELLO WORLD 32 | -------------------------------------------------------------------------------- /qrencode/tests/test_rs.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "common.h" 4 | #include "../qrencode_inner.h" 5 | #include "../qrinput.h" 6 | #include "../rscode.h" 7 | 8 | /* See pp. 73 of JIS X0510:2004 */ 9 | void test_rscode1(void) 10 | { 11 | QRinput *stream; 12 | QRRawCode *code; 13 | static const char str[9] = "01234567"; 14 | static unsigned char correct[26] = { 15 | 0x10, 0x20, 0x0c, 0x56, 0x61, 0x80, 0xec, 0x11, 0xec, 0x11, 0xec, 0x11, 16 | 0xec, 0x11, 0xec, 0x11, 0xa5, 0x24, 0xd4, 0xc1, 0xed, 0x36, 0xc7, 0x87, 17 | 0x2c, 0x55}; 18 | 19 | testStart("RS ecc test"); 20 | stream = QRinput_new(); 21 | QRinput_append(stream, QR_MODE_NUM, 8, (unsigned char *)str); 22 | QRinput_setErrorCorrectionLevel(stream, QR_ECLEVEL_M); 23 | code = QRraw_new(stream); 24 | 25 | testEnd(memcmp(correct + 16, code->rsblock[0].ecc, 10)); 26 | QRinput_free(stream); 27 | QRraw_free(code); 28 | } 29 | 30 | int main(void) 31 | { 32 | test_rscode1(); 33 | 34 | free_rs_cache(); 35 | report(); 36 | 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /qrencode/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = foreign 2 | ACLOCAL_AMFLAGS=-I m4 3 | 4 | SUBDIRS = . 5 | 6 | if BUILD_TESTS 7 | SUBDIRS += tests 8 | endif 9 | 10 | lib_LTLIBRARIES = libqrencode.la 11 | 12 | libqrencode_la_SOURCES = qrencode.c qrencode_inner.h \ 13 | qrinput.c qrinput.h \ 14 | bitstream.c bitstream.h \ 15 | qrspec.c qrspec.h \ 16 | rscode.c rscode.h \ 17 | split.c split.h \ 18 | mask.c mask.h \ 19 | mqrspec.c mqrspec.h \ 20 | mmask.c mmask.h 21 | 22 | libqrencode_la_LDFLAGS = -version-number $(MAJOR_VERSION):$(MINOR_VERSION):$(MICRO_VERSION) 23 | 24 | include_HEADERS = qrencode.h 25 | 26 | pkgconfigdir = $(libdir)/pkgconfig 27 | pkgconfig_DATA = libqrencode.pc 28 | 29 | EXTRA_DIST = libqrencode.pc.in autogen.sh configure.ac acinclude.m4 \ 30 | Makefile.am tests/Makefile.am qrencode.spec.in qrencode.spec \ 31 | qrencode.1.in Doxyfile tests/test_all.sh 32 | 33 | if BUILD_TOOLS 34 | bin_PROGRAMS = qrencode 35 | qrencode_SOURCES = qrenc.c 36 | qrencode_CFLAGS = $(png_CFLAGS) 37 | qrencode_LDADD = libqrencode.la $(png_LIBS) 38 | man1_MANS = qrencode.1 39 | endif 40 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 OutMan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /qrencode/tests/decoder.h: -------------------------------------------------------------------------------- 1 | #ifndef __DECODER_H__ 2 | #define __DECODER_H__ 3 | 4 | #include "../qrencode.h" 5 | 6 | typedef struct _DataChunk { 7 | QRencodeMode mode; 8 | int size; 9 | int bits; 10 | unsigned char *data; 11 | struct _DataChunk *next; 12 | } DataChunk; 13 | 14 | typedef struct { 15 | int size; 16 | unsigned char *data; 17 | int mqr; 18 | int version; 19 | QRecLevel level; 20 | DataChunk *chunks, *last; 21 | } QRdata; 22 | 23 | struct FormatInfo { 24 | int version; 25 | QRecLevel level; 26 | }; 27 | 28 | extern struct FormatInfo MQRformat[]; 29 | 30 | QRdata *QRdata_new(void); 31 | QRdata *QRdata_newMQR(void); 32 | int QRdata_decodeBitStream(QRdata *qrdata, BitStream *bstream); 33 | void QRdata_dump(QRdata *data); 34 | void QRdata_free(QRdata *data); 35 | 36 | unsigned int QRcode_decodeVersion(QRcode *code); 37 | int QRcode_decodeFormat(QRcode *code, QRecLevel *level, int *mask); 38 | unsigned char *QRcode_unmask(QRcode *code); 39 | unsigned char *QRcode_extractBits(QRcode *code, int *length); 40 | QRdata *QRcode_decodeBits(QRcode *code); 41 | QRdata *QRcode_decode(QRcode *code); 42 | 43 | int QRcode_decodeFormatMQR(QRcode *code, int *vesion, QRecLevel *level, int *mask); 44 | unsigned char *QRcode_unmaskMQR(QRcode *code); 45 | unsigned char *QRcode_extractBitsMQR(QRcode *code, int *length); 46 | QRdata *QRcode_decodeBitsMQR(QRcode *code); 47 | QRdata *QRcode_decodeMQR(QRcode *code); 48 | 49 | #endif /* __DECODER_H__ */ 50 | -------------------------------------------------------------------------------- /qrencode/mmask.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qrencode - QR Code encoder 3 | * 4 | * Masking for Micro QR Code. 5 | * Copyright (C) 2006-2011 Kentaro Fukuchi 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef __MMASK_H__ 23 | #define __MMASK_H__ 24 | 25 | extern unsigned char *MMask_makeMask(int version, unsigned char *frame, int mask, QRecLevel level); 26 | extern unsigned char *MMask_mask(int version, unsigned char *frame, QRecLevel level); 27 | 28 | #ifdef WITH_TESTS 29 | extern int MMask_evaluateSymbol(int width, unsigned char *frame); 30 | extern void MMask_writeFormatInformation(int version, int width, unsigned char *frame, int mask, QRecLevel level); 31 | extern unsigned char *MMask_makeMaskedFrame(int width, unsigned char *frame, int mask); 32 | #endif 33 | 34 | #endif /* __MMASK_H__ */ 35 | -------------------------------------------------------------------------------- /qrencode/bitstream.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qrencode - QR Code encoder 3 | * 4 | * Binary sequence class. 5 | * Copyright (C) 2006-2011 Kentaro Fukuchi 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef __BITSTREAM_H__ 23 | #define __BITSTREAM_H__ 24 | 25 | typedef struct { 26 | int length; 27 | unsigned char *data; 28 | } BitStream; 29 | 30 | extern BitStream *BitStream_new(void); 31 | extern int BitStream_append(BitStream *bstream, BitStream *arg); 32 | extern int BitStream_appendNum(BitStream *bstream, int bits, unsigned int num); 33 | extern int BitStream_appendBytes(BitStream *bstream, int size, unsigned char *data); 34 | #define BitStream_size(__bstream__) (__bstream__->length) 35 | extern unsigned char *BitStream_toByte(BitStream *bstream); 36 | extern void BitStream_free(BitStream *bstream); 37 | 38 | #endif /* __BITSTREAM_H__ */ 39 | -------------------------------------------------------------------------------- /qrencode/rscode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qrencode - QR Code encoder 3 | * 4 | * Reed solomon encoder. This code is taken from Phil Karn's libfec then 5 | * editted and packed into a pair of .c and .h files. 6 | * 7 | * Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q 8 | * (libfec is released under the GNU Lesser General Public License.) 9 | * 10 | * Copyright (C) 2006-2011 Kentaro Fukuchi 11 | * 12 | * This library is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU Lesser General Public 14 | * License as published by the Free Software Foundation; either 15 | * version 2.1 of the License, or any later version. 16 | * 17 | * This library is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | * Lesser General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with this library; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | #ifndef __RSCODE_H__ 28 | #define __RSCODE_H__ 29 | 30 | /* 31 | * General purpose RS codec, 8-bit symbols. 32 | */ 33 | 34 | typedef struct _RS RS; 35 | 36 | extern RS *init_rs(int symsize, int gfpoly, int fcr, int prim, int nroots, int pad); 37 | extern void encode_rs_char(RS *rs, const unsigned char *data, unsigned char *parity); 38 | extern void free_rs_char(RS *rs); 39 | extern void free_rs_cache(void); 40 | 41 | #endif /* __RSCODE_H__ */ 42 | -------------------------------------------------------------------------------- /qrencode/tests/prof_qrencode.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "../qrencode.h" 7 | 8 | struct timeval tv; 9 | void timerStart(const char *str) 10 | { 11 | printf("%s: START\n", str); 12 | gettimeofday(&tv, NULL); 13 | } 14 | 15 | void timerStop(void) 16 | { 17 | struct timeval tc; 18 | 19 | gettimeofday(&tc, NULL); 20 | printf("STOP: %ld msec\n", (tc.tv_sec - tv.tv_sec) * 1000 21 | + (tc.tv_usec - tv.tv_usec) / 1000); 22 | } 23 | 24 | void prof_ver1to10(void) 25 | { 26 | QRcode *code; 27 | int i; 28 | int version; 29 | static const char *data = "This is test."; 30 | 31 | timerStart("Version 1 - 10 (500 symbols for each)"); 32 | for(i=0; i<500; i++) { 33 | for(version = 0; version < 11; version++) { 34 | code = QRcode_encodeString(data, version, QR_ECLEVEL_L, QR_MODE_8, 0); 35 | if(code == NULL) { 36 | perror("Failed to encode:"); 37 | } else { 38 | QRcode_free(code); 39 | } 40 | } 41 | } 42 | timerStop(); 43 | } 44 | 45 | void prof_ver31to40(void) 46 | { 47 | QRcode *code; 48 | int i; 49 | int version; 50 | static const char *data = "This is test."; 51 | 52 | timerStart("Version 31 - 40 (50 symbols for each)"); 53 | for(i=0; i<50; i++) { 54 | for(version = 31; version < 41; version++) { 55 | code = QRcode_encodeString(data, version, QR_ECLEVEL_L, QR_MODE_8, 0); 56 | if(code == NULL) { 57 | perror("Failed to encode:"); 58 | } else { 59 | QRcode_free(code); 60 | } 61 | } 62 | } 63 | timerStop(); 64 | } 65 | 66 | int main(void) 67 | { 68 | prof_ver1to10(); 69 | prof_ver31to40(); 70 | 71 | QRcode_clearCache(); 72 | 73 | return 0; 74 | } 75 | -------------------------------------------------------------------------------- /qrencode/mask.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qrencode - QR Code encoder 3 | * 4 | * Masking. 5 | * Copyright (C) 2006-2011 Kentaro Fukuchi 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef __MASK_H__ 23 | #define __MASK_H__ 24 | 25 | extern unsigned char *Mask_makeMask(int width, unsigned char *frame, int mask, QRecLevel level); 26 | extern unsigned char *Mask_mask(int width, unsigned char *frame, QRecLevel level); 27 | 28 | #ifdef WITH_TESTS 29 | extern int Mask_calcN2(int width, unsigned char *frame); 30 | extern int Mask_calcN1N3(int length, int *runLength); 31 | extern int Mask_calcRunLength(int width, unsigned char *frame, int dir, int *runLength); 32 | extern int Mask_evaluateSymbol(int width, unsigned char *frame); 33 | extern int Mask_writeFormatInformation(int width, unsigned char *frame, int mask, QRecLevel level); 34 | extern unsigned char *Mask_makeMaskedFrame(int width, unsigned char *frame, int mask); 35 | #endif 36 | 37 | #endif /* __MASK_H__ */ 38 | -------------------------------------------------------------------------------- /dcode.h: -------------------------------------------------------------------------------- 1 | /* 2 | +----------------------------------------------------------------------+ 3 | | DCode tools extendsion | 4 | +----------------------------------------------------------------------+ 5 | | Copyright (c) 1997-2014 The PHP Group | 6 | +----------------------------------------------------------------------+ 7 | | This source file is subject to version 3.01 of the PHP license, | 8 | | that is bundled with this package in the file LICENSE, and is | 9 | | available through the world-wide-web at the following url: | 10 | | http://www.php.net/license/3_01.txt | 11 | | If you did not receive a copy of the PHP license and are unable to | 12 | | obtain it through the world-wide-web, please send a note to | 13 | | license@php.net so we can mail you a copy immediately. | 14 | +----------------------------------------------------------------------+ 15 | | Author: pochonlee@gmail.com | 16 | +----------------------------------------------------------------------+ 17 | */ 18 | 19 | /* $Id$ */ 20 | #ifndef DCODE_H 21 | #define DCODE_H 22 | 23 | #define DCODE_KEY "THIS IS SHIT" 24 | #define DCODE_CN "DCode" 25 | #define DCODE_MD5_SIZE 32 26 | #define DCODE_MD5_SIZE_H 16 27 | #define DCODE_MICROTIME_SIZE 100 28 | #define DCODE_MICRO_IN_SEC 1000000.00 29 | 30 | typedef struct _png_mem_encode { 31 | char *buffer; 32 | size_t size; 33 | } png_mem_encode ; 34 | 35 | static char* dcode_md5(char *, uint, char *); 36 | static char* dcode_microtime(char *); 37 | static long dcode_time(); 38 | static void dcode_png_writer(png_structp, png_bytep, png_size_t); 39 | static char* dcode_write_to_png(QRcode *, int, int, int *); 40 | static int dcode_qrcode_error(QRcode * TSRMLS_DC); 41 | #endif 42 | /* 43 | * Local variables: 44 | * tab-width: 4 45 | * c-basic-offset: 4 46 | * End: 47 | * vim600: noet sw=4 ts=4 fdm=marker 48 | * vim<600: noet sw=4 ts=4 49 | */ 50 | -------------------------------------------------------------------------------- /qrencode/split.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qrencode - QR Code encoder 3 | * 4 | * Input data splitter. 5 | * Copyright (C) 2006-2011 Kentaro Fukuchi 6 | * 7 | * The following data / specifications are taken from 8 | * "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004) 9 | * or 10 | * "Automatic identification and data capture techniques -- 11 | * QR Code 2005 bar code symbology specification" (ISO/IEC 18004:2006) 12 | * 13 | * This library is free software; you can redistribute it and/or 14 | * modify it under the terms of the GNU Lesser General Public 15 | * License as published by the Free Software Foundation; either 16 | * version 2.1 of the License, or any later version. 17 | * 18 | * This library is distributed in the hope that it will be useful, 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | * Lesser General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU Lesser General Public 24 | * License along with this library; if not, write to the Free Software 25 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 26 | */ 27 | 28 | #ifndef __SPLIT_H__ 29 | #define __SPLIT_H__ 30 | 31 | #include "qrencode.h" 32 | 33 | /** 34 | * Split the input string (null terminated) into QRinput. 35 | * @param string input string 36 | * @param hint give QR_MODE_KANJI if the input string contains Kanji character encoded in Shift-JIS. If not, give QR_MODE_8. 37 | * @param casesensitive 0 for case-insensitive encoding (all alphabet characters are replaced to UPPER-CASE CHARACTERS. 38 | * @retval 0 success. 39 | * @retval -1 an error occurred. errno is set to indicate the error. See 40 | * Exceptions for the details. 41 | * @throw EINVAL invalid input object. 42 | * @throw ENOMEM unable to allocate memory for input objects. 43 | */ 44 | extern int Split_splitStringToQRinput(const char *string, QRinput *input, 45 | QRencodeMode hint, int casesensitive); 46 | 47 | #endif /* __SPLIT_H__ */ 48 | -------------------------------------------------------------------------------- /config.m4: -------------------------------------------------------------------------------- 1 | dnl $Id$ 2 | dnl config.m4 for extension dcode 3 | 4 | dnl Comments in this file start with the string 'dnl'. 5 | dnl Remove where necessary. This file will not work 6 | dnl without editing. 7 | 8 | dnl If your extension references something external, use with: 9 | 10 | PHP_ARG_WITH(dcode, for dcode support, 11 | Make sure that the comment is aligned: 12 | [ --with-dcode Include dcode support]) 13 | 14 | dnl Otherwise use enable: 15 | 16 | dnl PHP_ARG_ENABLE(dcode, whether to enable dcode support, 17 | dnl Make sure that the comment is aligned: 18 | dnl [ --enable-dcode Enable dcode support]) 19 | 20 | if test "$PHP_DCODE" != "no"; then 21 | dnl Write more examples of tests here... 22 | 23 | dnl # --with-dcode -> check with-path 24 | dnl SEARCH_PATH="/usr/local /usr" # you might want to change this 25 | dnl SEARCH_FOR="/include/dcode.h" # you most likely want to change this 26 | dnl if test -r $PHP_DCODE/$SEARCH_FOR; then # path given as parameter 27 | dnl DCODE_DIR=$PHP_DCODE 28 | dnl else # search default path list 29 | dnl AC_MSG_CHECKING([for dcode files in default path]) 30 | dnl for i in $SEARCH_PATH ; do 31 | dnl if test -r $i/$SEARCH_FOR; then 32 | dnl DCODE_DIR=$i 33 | dnl AC_MSG_RESULT(found in $i) 34 | dnl fi 35 | dnl done 36 | dnl fi 37 | dnl 38 | dnl if test -z "$DCODE_DIR"; then 39 | dnl AC_MSG_RESULT([not found]) 40 | dnl AC_MSG_ERROR([Please reinstall the dcode distribution]) 41 | dnl fi 42 | 43 | dnl # --with-dcode -> add include path 44 | dnl PHP_ADD_INCLUDE($DCODE_DIR/include) 45 | 46 | dnl # --with-dcode -> check for lib and symbol presence 47 | dnl LIBNAME=dcode # you may want to change this 48 | dnl LIBSYMBOL=dcode # you most likely want to change this 49 | 50 | dnl PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL, 51 | dnl [ 52 | dnl PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $DCODE_DIR/lib, DCODE_SHARED_LIBADD) 53 | dnl AC_DEFINE(HAVE_DCODELIB,1,[ ]) 54 | dnl ],[ 55 | dnl AC_MSG_ERROR([wrong dcode lib version or lib not found]) 56 | dnl ],[ 57 | dnl -L$DCODE_DIR/lib -lm 58 | dnl ]) 59 | dnl 60 | dnl PHP_SUBST(DCODE_SHARED_LIBADD) 61 | 62 | PHP_NEW_EXTENSION(dcode, dcode.c qrencode/bitstream.c qrencode/mask.c qrencode/mmask.c qrencode/mqrspec.c qrencode/qrenc.c qrencode/qrencode.c qrencode/qrinput.c qrencode/qrspec.c qrencode/rscode.c qrencode/split.c, $ext_shared) 63 | fi 64 | -------------------------------------------------------------------------------- /qrencode/tests/Makefile.am: -------------------------------------------------------------------------------- 1 | if HAVE_SDL 2 | sdlPROGRAMS = view_qrcode 3 | endif 4 | 5 | noinst_PROGRAMS = test_qrinput test_bitstream test_estimatebit \ 6 | test_qrspec test_rs test_qrencode prof_qrencode \ 7 | test_mqrspec test_split test_monkey test_mask test_mmask \ 8 | create_frame_pattern create_mqr_frame_pattern \ 9 | $(sdlPROGRAMS) 10 | noinst_LIBRARIES = libdecoder.a 11 | DECODER_LIBS = libdecoder.a $(LIBICONV) 12 | noinst_HEADERS = common.h 13 | if HAVE_LIBPTHREAD 14 | noinst_PROGRAMS += pthread_qrencode 15 | endif 16 | 17 | EXTRA_DIST = frame 18 | 19 | libdecoder_a_SOURCES = decoder.c decoder.h 20 | 21 | test_qrinput_SOURCES = test_qrinput.c 22 | test_qrinput_LDADD = ../libqrencode.la $(DECODER_LIBS) 23 | 24 | test_bitstream_SOURCES = test_bitstream.c 25 | test_bitstream_LDADD = ../libqrencode.la 26 | 27 | test_estimatebit_SOURCES = test_estimatebit.c 28 | test_estimatebit_LDADD = ../libqrencode.la 29 | 30 | test_qrspec_SOURCES = test_qrspec.c 31 | test_qrspec_LDADD = ../libqrencode.la $(DECODER_LIBS) 32 | 33 | test_mqrspec_SOURCES = test_mqrspec.c 34 | test_mqrspec_LDADD = ../libqrencode.la $(DECODER_LIBS) 35 | 36 | test_rs_SOURCES = test_rs.c 37 | test_rs_LDADD = ../libqrencode.la 38 | 39 | test_qrencode_SOURCES = test_qrencode.c 40 | test_qrencode_LDADD = ../libqrencode.la $(DECODER_LIBS) 41 | 42 | test_split_SOURCES = test_split.c 43 | test_split_LDADD = ../libqrencode.la 44 | 45 | test_monkey_SOURCES = test_monkey.c 46 | test_monkey_LDADD = ../libqrencode.la $(DECODER_LIBS) 47 | 48 | test_mask_SOURCES = test_mask.c 49 | test_mask_LDADD = ../libqrencode.la $(DECODER_LIBS) 50 | 51 | test_mmask_SOURCES = test_mmask.c 52 | test_mmask_LDADD = ../libqrencode.la $(DECODER_LIBS) 53 | 54 | prof_qrencode_SOURCES = prof_qrencode.c 55 | prof_qrencode_LDADD = ../libqrencode.la 56 | 57 | pthread_qrencode_SOURCES = pthread_qrencode.c 58 | pthread_qrencode_LDADD = ../libqrencode.la $(LIBPTHREAD) 59 | 60 | create_frame_pattern_SOURCES = create_frame_pattern.c 61 | create_frame_pattern_CFLAGS = $(png_CFLAGS) 62 | create_frame_pattern_LDADD = ../libqrencode.la $(png_LIBS) 63 | 64 | create_mqr_frame_pattern_SOURCES = create_mqr_frame_pattern.c 65 | create_mqr_frame_pattern_CFLAGS = $(png_CFLAGS) 66 | create_mqr_frame_pattern_LDADD = ../libqrencode.la $(png_LIBS) 67 | 68 | if HAVE_SDL 69 | view_qrcode_SOURCES = view_qrcode.c 70 | view_qrcode_CFLAGS= $(SDL_CFLAGS) 71 | view_qrcode_LDADD = ../libqrencode.la $(SDL_LIBS) 72 | endif 73 | -------------------------------------------------------------------------------- /qrencode/tests/pthread_qrencode.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include "../qrencode.h" 8 | 9 | #define THREADS (10) 10 | 11 | static pthread_t threads[THREADS]; 12 | 13 | struct timeval tv; 14 | void timerStart(const char *str) 15 | { 16 | printf("%s: START\n", str); 17 | gettimeofday(&tv, NULL); 18 | } 19 | 20 | void timerStop(void) 21 | { 22 | struct timeval tc; 23 | 24 | gettimeofday(&tc, NULL); 25 | printf("STOP: %ld msec\n", (tc.tv_sec - tv.tv_sec) * 1000 26 | + (tc.tv_usec - tv.tv_usec) / 1000); 27 | } 28 | 29 | void *encode_ver1to10(void *arg) 30 | { 31 | QRcode *code; 32 | int i; 33 | int version; 34 | static const char *data = "This is test."; 35 | 36 | for(i=0; i<500; i++) { 37 | for(version = 0; version < 11; version++) { 38 | code = QRcode_encodeString(data, version, QR_ECLEVEL_L, QR_MODE_8, 0); 39 | if(code == NULL) { 40 | perror("Failed to encode:"); 41 | } else { 42 | QRcode_free(code); 43 | } 44 | } 45 | } 46 | 47 | return NULL; 48 | } 49 | 50 | void prof_ver1to10(void) 51 | { 52 | int i; 53 | 54 | timerStart("Version 1 - 10 (500 symbols for each)"); 55 | for(i=0; i 3.9.0-1 66 | - URL and Source0 have been updated. 67 | * Fri May 01 2008 Kentaro Fukuchi 3.0.1-1 68 | - The man page has been packaged correctly. 69 | * Tue May 15 2007 Kentaro Fukuchi 1.0.2-2 70 | - Summary has been synchronized to README. 71 | * Thu May 09 2007 Katsumi Saito 1.0.2-1 72 | - Initial RPM release 73 | -------------------------------------------------------------------------------- /qrencode/qrencode.spec.in: -------------------------------------------------------------------------------- 1 | %define ver @VERSION@ 2 | %define rel 1 3 | 4 | Name: qrencode 5 | Version: %{ver} 6 | Release: %{rel}%{?dist} 7 | Summary: Libqrencode is a library for encoding data in a QR Code symbol, a kind of 2D symbology that can be scanned by handy terminals such as a mobile phone with CCD. The capacity of QR Code is up to 7000 digits or 4000 characters, and has high robustness. 8 | 9 | Group: System Environment/Libraries 10 | License: LGPLv2+ 11 | URL: http://fukuchi.org/works/qrencode/ 12 | Source0: http://fukuchi.org/works/qrencode/%{name}-%{version}.tar.gz 13 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 14 | 15 | %description 16 | Libqrencode supports QR Code model 2, described in JIS (Japanese Industrial Standards) X0510:2004 or ISO/IEC 18004. Currently the following features are not supported: ECI and FNC1 mode, Micro QR Code, QR Code model 1. 17 | 18 | %package devel 19 | Summary: Development files for libqrencode 20 | Group: Development/Libraries 21 | Requires: %{name} = %{version}-%{release} 22 | 23 | %description devel 24 | Libqrencode supports QR Code model 2, described in JIS (Japanese Industrial Standards) X0510:2004 or ISO/IEC 18004. Currently the following features are not supported: ECI and FNC1 mode, Micro QR Code, QR Code model 1. 25 | 26 | This package contains development files for libqrencode. 27 | 28 | %prep 29 | %setup -q 30 | 31 | 32 | %build 33 | %configure --without-tests 34 | make %{?_smp_mflags} 35 | 36 | 37 | %install 38 | rm -rf $RPM_BUILD_ROOT 39 | make install DESTDIR=$RPM_BUILD_ROOT 40 | rm -f $RPM_BUILD_ROOT%{_libdir}/*.la 41 | 42 | 43 | %post -p /sbin/ldconfig 44 | 45 | %postun -p /sbin/ldconfig 46 | 47 | 48 | %clean 49 | rm -rf $RPM_BUILD_ROOT 50 | 51 | %files 52 | %defattr(-,root,root,-) 53 | %doc COPYING TODO ChangeLog NEWS README 54 | %{_libdir}/libqrencode.so.* 55 | %{_bindir}/qrencode 56 | %{_mandir}/man1/qrencode.1.gz 57 | 58 | %files devel 59 | %defattr(-,root,root,-) 60 | %{_includedir}/qrencode.h 61 | %{_libdir}/libqrencode.so 62 | %{_libdir}/pkgconfig/libqrencode.pc 63 | 64 | %changelog 65 | * Sat Oct 09 2010 Kentaro Fukuchi 3.9.0-1 66 | - URL and Source0 have been updated. 67 | * Fri May 01 2008 Kentaro Fukuchi 3.0.1-1 68 | - The man page has been packaged correctly. 69 | * Tue May 15 2007 Kentaro Fukuchi 1.0.2-2 70 | - Summary has been synchronized to README. 71 | * Thu May 09 2007 Katsumi Saito 1.0.2-1 72 | - Initial RPM release 73 | -------------------------------------------------------------------------------- /qrencode/config.h.in: -------------------------------------------------------------------------------- 1 | /* config.h.in. Generated from configure.ac by autoheader. */ 2 | 3 | /* Define to 1 if you have the header file. */ 4 | #undef HAVE_DLFCN_H 5 | 6 | /* Define if you have the iconv() function and it works. */ 7 | #undef HAVE_ICONV 8 | 9 | /* Define to 1 if you have the header file. */ 10 | #undef HAVE_INTTYPES_H 11 | 12 | /* Define to 1 if using pthread is enabled. */ 13 | #undef HAVE_LIBPTHREAD 14 | 15 | /* Define to 1 if you have the header file. */ 16 | #undef HAVE_MEMORY_H 17 | 18 | /* Define to 1 if you have the header file. */ 19 | #undef HAVE_STDINT_H 20 | 21 | /* Define to 1 if you have the header file. */ 22 | #undef HAVE_STDLIB_H 23 | 24 | /* Define to 1 if you have the `strdup' function. */ 25 | #undef HAVE_STRDUP 26 | 27 | /* Define to 1 if you have the header file. */ 28 | #undef HAVE_STRINGS_H 29 | 30 | /* Define to 1 if you have the header file. */ 31 | #undef HAVE_STRING_H 32 | 33 | /* Define to 1 if you have the header file. */ 34 | #undef HAVE_SYS_STAT_H 35 | 36 | /* Define to 1 if you have the header file. */ 37 | #undef HAVE_SYS_TYPES_H 38 | 39 | /* Define to 1 if you have the header file. */ 40 | #undef HAVE_UNISTD_H 41 | 42 | /* Define to the sub-directory in which libtool stores uninstalled libraries. 43 | */ 44 | #undef LT_OBJDIR 45 | 46 | /* Major version number */ 47 | #undef MAJOR_VERSION 48 | 49 | /* Micro version number */ 50 | #undef MICRO_VERSION 51 | 52 | /* Minor version number */ 53 | #undef MINOR_VERSION 54 | 55 | /* Name of package */ 56 | #undef PACKAGE 57 | 58 | /* Define to the address where bug reports for this package should be sent. */ 59 | #undef PACKAGE_BUGREPORT 60 | 61 | /* Define to the full name of this package. */ 62 | #undef PACKAGE_NAME 63 | 64 | /* Define to the full name and version of this package. */ 65 | #undef PACKAGE_STRING 66 | 67 | /* Define to the one symbol short name of this package. */ 68 | #undef PACKAGE_TARNAME 69 | 70 | /* Define to the home page for this package. */ 71 | #undef PACKAGE_URL 72 | 73 | /* Define to the version of this package. */ 74 | #undef PACKAGE_VERSION 75 | 76 | /* Define to 1 if you have the ANSI C header files. */ 77 | #undef STDC_HEADERS 78 | 79 | /* Version number of package */ 80 | #undef VERSION 81 | 82 | /* Define to empty if `const' does not conform to ANSI C. */ 83 | #undef const 84 | 85 | /* Define to `__inline__' or `__inline' if that's what the C compiler 86 | calls it, or to nothing if 'inline' is not supported under any name. */ 87 | #ifndef __cplusplus 88 | #undef inline 89 | #endif 90 | 91 | /* Define to 'static' if no test programs will be compiled. */ 92 | #define __STATIC static 93 | #undef WITH_TESTS 94 | 95 | -------------------------------------------------------------------------------- /qrencode/config.h: -------------------------------------------------------------------------------- 1 | /* config.h. Generated from config.h.in by configure. */ 2 | /* config.h.in. Generated from configure.ac by autoheader. */ 3 | 4 | /* Define to 1 if you have the header file. */ 5 | #define HAVE_DLFCN_H 1 6 | 7 | /* Define if you have the iconv() function and it works. */ 8 | /* #undef HAVE_ICONV */ 9 | 10 | /* Define to 1 if you have the header file. */ 11 | #define HAVE_INTTYPES_H 1 12 | 13 | /* Define to 1 if using pthread is enabled. */ 14 | #define HAVE_LIBPTHREAD 1 15 | 16 | /* Define to 1 if you have the header file. */ 17 | #define HAVE_MEMORY_H 1 18 | 19 | /* Define to 1 if you have the header file. */ 20 | #define HAVE_STDINT_H 1 21 | 22 | /* Define to 1 if you have the header file. */ 23 | #define HAVE_STDLIB_H 1 24 | 25 | /* Define to 1 if you have the `strdup' function. */ 26 | #define HAVE_STRDUP 1 27 | 28 | /* Define to 1 if you have the header file. */ 29 | #define HAVE_STRINGS_H 1 30 | 31 | /* Define to 1 if you have the header file. */ 32 | #define HAVE_STRING_H 1 33 | 34 | /* Define to 1 if you have the header file. */ 35 | #define HAVE_SYS_STAT_H 1 36 | 37 | /* Define to 1 if you have the header file. */ 38 | #define HAVE_SYS_TYPES_H 1 39 | 40 | /* Define to 1 if you have the header file. */ 41 | #define HAVE_UNISTD_H 1 42 | 43 | /* Define to the sub-directory in which libtool stores uninstalled libraries. 44 | */ 45 | #define LT_OBJDIR ".libs/" 46 | 47 | /* Major version number */ 48 | #define MAJOR_VERSION 3 49 | 50 | /* Micro version number */ 51 | #define MICRO_VERSION 4 52 | 53 | /* Minor version number */ 54 | #define MINOR_VERSION 4 55 | 56 | /* Name of package */ 57 | #define PACKAGE "qrencode" 58 | 59 | /* Define to the address where bug reports for this package should be sent. */ 60 | #define PACKAGE_BUGREPORT "" 61 | 62 | /* Define to the full name of this package. */ 63 | #define PACKAGE_NAME "QRencode" 64 | 65 | /* Define to the full name and version of this package. */ 66 | #define PACKAGE_STRING "QRencode 3.4.4" 67 | 68 | /* Define to the one symbol short name of this package. */ 69 | #define PACKAGE_TARNAME "qrencode" 70 | 71 | /* Define to the home page for this package. */ 72 | #define PACKAGE_URL "" 73 | 74 | /* Define to the version of this package. */ 75 | #define PACKAGE_VERSION "3.4.4" 76 | 77 | /* Define to 1 if you have the ANSI C header files. */ 78 | #define STDC_HEADERS 1 79 | 80 | /* Version number of package */ 81 | #define VERSION "3.4.4" 82 | 83 | /* Define to empty if `const' does not conform to ANSI C. */ 84 | /* #undef const */ 85 | 86 | /* Define to `__inline__' or `__inline' if that's what the C compiler 87 | calls it, or to nothing if 'inline' is not supported under any name. */ 88 | #ifndef __cplusplus 89 | /* #undef inline */ 90 | #endif 91 | 92 | /* Define to 'static' if no test programs will be compiled. */ 93 | #define __STATIC static 94 | /* #undef WITH_TESTS */ 95 | 96 | -------------------------------------------------------------------------------- /qrencode/qrencode_inner.h: -------------------------------------------------------------------------------- 1 | /** 2 | * qrencode - QR Code encoder 3 | * 4 | * Header for test use 5 | * Copyright (C) 2006-2011 Kentaro Fukuchi 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef __QRENCODE_INNER_H__ 23 | #define __QRENCODE_INNER_H__ 24 | 25 | /** 26 | * This header file includes definitions for test use. 27 | */ 28 | 29 | /****************************************************************************** 30 | * Raw code 31 | *****************************************************************************/ 32 | 33 | typedef struct { 34 | int dataLength; 35 | unsigned char *data; 36 | int eccLength; 37 | unsigned char *ecc; 38 | } RSblock; 39 | 40 | typedef struct { 41 | int version; 42 | int dataLength; 43 | int eccLength; 44 | unsigned char *datacode; 45 | unsigned char *ecccode; 46 | int b1; 47 | int blocks; 48 | RSblock *rsblock; 49 | int count; 50 | } QRRawCode; 51 | 52 | extern QRRawCode *QRraw_new(QRinput *input); 53 | extern unsigned char QRraw_getCode(QRRawCode *raw); 54 | extern void QRraw_free(QRRawCode *raw); 55 | 56 | /****************************************************************************** 57 | * Raw code for Micro QR Code 58 | *****************************************************************************/ 59 | 60 | typedef struct { 61 | int version; 62 | int dataLength; 63 | int eccLength; 64 | unsigned char *datacode; 65 | unsigned char *ecccode; 66 | RSblock *rsblock; 67 | int oddbits; 68 | int count; 69 | } MQRRawCode; 70 | 71 | extern MQRRawCode *MQRraw_new(QRinput *input); 72 | extern unsigned char MQRraw_getCode(MQRRawCode *raw); 73 | extern void MQRraw_free(MQRRawCode *raw); 74 | 75 | /****************************************************************************** 76 | * Frame filling 77 | *****************************************************************************/ 78 | extern unsigned char *FrameFiller_test(int version); 79 | extern unsigned char *FrameFiller_testMQR(int version); 80 | 81 | /****************************************************************************** 82 | * QR-code encoding 83 | *****************************************************************************/ 84 | extern QRcode *QRcode_encodeMask(QRinput *input, int mask); 85 | extern QRcode *QRcode_encodeMaskMQR(QRinput *input, int mask); 86 | extern QRcode *QRcode_new(int version, int width, unsigned char *data); 87 | 88 | #endif /* __QRENCODE_INNER_H__ */ 89 | -------------------------------------------------------------------------------- /php_dcode.h: -------------------------------------------------------------------------------- 1 | /* 2 | +----------------------------------------------------------------------+ 3 | | PHP Version 5 | 4 | +----------------------------------------------------------------------+ 5 | | Copyright (c) 1997-2014 The PHP Group | 6 | +----------------------------------------------------------------------+ 7 | | This source file is subject to version 3.01 of the PHP license, | 8 | | that is bundled with this package in the file LICENSE, and is | 9 | | available through the world-wide-web at the following url: | 10 | | http://www.php.net/license/3_01.txt | 11 | | If you did not receive a copy of the PHP license and are unable to | 12 | | obtain it through the world-wide-web, please send a note to | 13 | | license@php.net so we can mail you a copy immediately. | 14 | +----------------------------------------------------------------------+ 15 | | Author: | 16 | +----------------------------------------------------------------------+ 17 | */ 18 | 19 | /* $Id$ */ 20 | 21 | #ifndef PHP_DCODE_H 22 | #define PHP_DCODE_H 23 | 24 | extern zend_module_entry dcode_module_entry; 25 | #define phpext_dcode_ptr &dcode_module_entry 26 | 27 | #define PHP_DCODE_VERSION "0.1.0" /* Replace with version number for your extension */ 28 | 29 | #ifdef PHP_WIN32 30 | # define PHP_DCODE_API __declspec(dllexport) 31 | #elif defined(__GNUC__) && __GNUC__ >= 4 32 | # define PHP_DCODE_API __attribute__ ((visibility("default"))) 33 | #else 34 | # define PHP_DCODE_API 35 | #endif 36 | 37 | #ifdef ZTS 38 | #include "TSRM.h" 39 | #endif 40 | 41 | PHP_MINIT_FUNCTION(dcode); 42 | PHP_MSHUTDOWN_FUNCTION(dcode); 43 | PHP_RINIT_FUNCTION(dcode); 44 | PHP_RSHUTDOWN_FUNCTION(dcode); 45 | PHP_MINFO_FUNCTION(dcode); 46 | 47 | PHP_FUNCTION(dcode_encrypt); 48 | PHP_FUNCTION(dcode_decrypt); 49 | PHP_FUNCTION(dcode_qrcode); 50 | PHP_FUNCTION(dcode_qrcode8bit); 51 | PHP_FUNCTION(dcode_qrcodedata); 52 | 53 | PHP_METHOD(dcode, encrypt); 54 | PHP_METHOD(dcode, decrypt); 55 | PHP_METHOD(dcode, qrcode); 56 | PHP_METHOD(dcode, qrcode8bit); 57 | PHP_METHOD(dcode, qrcodedata); 58 | 59 | /* 60 | Declare any global variables you may need between the BEGIN 61 | and END macros here: 62 | 63 | ZEND_BEGIN_MODULE_GLOBALS(dcode) 64 | long global_value; 65 | char *global_string; 66 | ZEND_END_MODULE_GLOBALS(dcode) 67 | */ 68 | 69 | /* In every utility function you add that needs to use variables 70 | in php_dcode_globals, call TSRMLS_FETCH(); after declaring other 71 | variables used by that function, or better yet, pass in TSRMLS_CC 72 | after the last function argument and declare your utility function 73 | with TSRMLS_DC after the last declared argument. Always refer to 74 | the globals in your function as DCODE_G(variable). You are 75 | encouraged to rename these macros something shorter, see 76 | examples in any other php module directory. 77 | */ 78 | 79 | #ifdef ZTS 80 | #define DCODE_G(v) TSRMG(dcode_globals_id, zend_dcode_globals *, v) 81 | #else 82 | #define DCODE_G(v) (dcode_globals.v) 83 | #endif 84 | 85 | #endif /* PHP_DCODE_H */ 86 | 87 | 88 | /* 89 | * Local variables: 90 | * tab-width: 4 91 | * c-basic-offset: 4 92 | * End: 93 | * vim600: noet sw=4 ts=4 fdm=marker 94 | * vim<600: noet sw=4 ts=4 95 | */ 96 | -------------------------------------------------------------------------------- /qrencode/tests/test_mmask.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "common.h" 4 | #include "../mmask.h" 5 | #include "../mqrspec.h" 6 | 7 | char dot[2] = {'_', '#'}; 8 | static char *maskPatterns[4] = { 9 | /* i mod 2 = 0 */ 10 | "######" 11 | "______" 12 | "######" 13 | "______" 14 | "######" 15 | "______", 16 | /* ((i div 2) + (j div 3)) mod 2 = 0 */ 17 | "###___" 18 | "###___" 19 | "___###" 20 | "___###" 21 | "###___" 22 | "###___", 23 | /* ((ij) mod 2 + (ij) mod 3) mod 2 = 0 */ 24 | "######" 25 | "###___" 26 | "##_##_" 27 | "#_#_#_" 28 | "#_##_#" 29 | "#___##", 30 | /* ((ij) mod 3 + (i+j) mod 2) mod 2 = 0 */ 31 | "#_#_#_" 32 | "___###" 33 | "#___##" 34 | "_#_#_#" 35 | "###___" 36 | "_###__" 37 | }; 38 | 39 | void print_mask(int mask) 40 | { 41 | const int w = 6; 42 | unsigned char frame[w * w], *masked, *p; 43 | int x, y; 44 | 45 | memset(frame, 0, w * w); 46 | masked = MMask_makeMaskedFrame(w, frame, mask); 47 | p = masked; 48 | for(y=0; y 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef __QRINPUT_H__ 23 | #define __QRINPUT_H__ 24 | 25 | #include "qrencode.h" 26 | #include "bitstream.h" 27 | 28 | int QRinput_isSplittableMode(QRencodeMode mode); 29 | 30 | /****************************************************************************** 31 | * Entry of input data 32 | *****************************************************************************/ 33 | typedef struct _QRinput_List QRinput_List; 34 | 35 | struct _QRinput_List { 36 | QRencodeMode mode; 37 | int size; ///< Size of data chunk (byte). 38 | unsigned char *data; ///< Data chunk. 39 | BitStream *bstream; 40 | QRinput_List *next; 41 | }; 42 | 43 | /****************************************************************************** 44 | * Input Data 45 | *****************************************************************************/ 46 | struct _QRinput { 47 | int version; 48 | QRecLevel level; 49 | QRinput_List *head; 50 | QRinput_List *tail; 51 | int mqr; 52 | int fnc1; 53 | unsigned char appid; 54 | }; 55 | 56 | /****************************************************************************** 57 | * Structured append input data 58 | *****************************************************************************/ 59 | typedef struct _QRinput_InputList QRinput_InputList; 60 | 61 | struct _QRinput_InputList { 62 | QRinput *input; 63 | QRinput_InputList *next; 64 | }; 65 | 66 | struct _QRinput_Struct { 67 | int size; ///< number of structured symbols 68 | int parity; 69 | QRinput_InputList *head; 70 | QRinput_InputList *tail; 71 | }; 72 | 73 | /** 74 | * Pack all bit streams padding bits into a byte array. 75 | * @param input input data. 76 | * @return padded merged byte stream 77 | */ 78 | extern unsigned char *QRinput_getByteStream(QRinput *input); 79 | 80 | 81 | extern int QRinput_estimateBitsModeNum(int size); 82 | extern int QRinput_estimateBitsModeAn(int size); 83 | extern int QRinput_estimateBitsMode8(int size); 84 | extern int QRinput_estimateBitsModeKanji(int size); 85 | 86 | extern QRinput *QRinput_dup(QRinput *input); 87 | 88 | extern const signed char QRinput_anTable[128]; 89 | 90 | /** 91 | * Look up the alphabet-numeric convesion table (see JIS X0510:2004, pp.19). 92 | * @param __c__ character 93 | * @return value 94 | */ 95 | #define QRinput_lookAnTable(__c__) \ 96 | ((__c__ & 0x80)?-1:QRinput_anTable[(int)__c__]) 97 | 98 | /** 99 | * Length of a standard mode indicator in bits. 100 | */ 101 | 102 | #define MODE_INDICATOR_SIZE 4 103 | 104 | /** 105 | * Length of a segment of structured-append header. 106 | */ 107 | #define STRUCTURE_HEADER_SIZE 20 108 | 109 | /** 110 | * Maximum number of symbols in a set of structured-appended symbols. 111 | */ 112 | #define MAX_STRUCTURED_SYMBOLS 16 113 | 114 | #ifdef WITH_TESTS 115 | extern BitStream *QRinput_mergeBitStream(QRinput *input); 116 | extern BitStream *QRinput_getBitStream(QRinput *input); 117 | extern int QRinput_estimateBitStreamSize(QRinput *input, int version); 118 | extern int QRinput_splitEntry(QRinput_List *entry, int bytes); 119 | extern int QRinput_lengthOfCode(QRencodeMode mode, int version, int bits); 120 | extern int QRinput_insertStructuredAppendHeader(QRinput *input, int size, int index, unsigned char parity); 121 | #endif 122 | 123 | #endif /* __QRINPUT_H__ */ 124 | -------------------------------------------------------------------------------- /qrencode/tests/test_estimatebit.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "common.h" 5 | #include "../qrinput.h" 6 | 7 | QRinput *gstream; 8 | 9 | void test_numbit(void) 10 | { 11 | QRinput *stream; 12 | char num[9]="01234567"; 13 | int bits; 14 | 15 | testStart("Estimation of Numeric stream (8 digits)"); 16 | stream = QRinput_new(); 17 | QRinput_append(stream, QR_MODE_NUM, 8, (unsigned char *)num); 18 | bits = QRinput_estimateBitStreamSize(stream, 0); 19 | testEndExp(bits == 41); 20 | 21 | QRinput_append(gstream, QR_MODE_NUM, 8, (unsigned char *)num); 22 | QRinput_free(stream); 23 | } 24 | 25 | void test_numbit2(void) 26 | { 27 | QRinput *stream; 28 | char num[17]="0123456789012345"; 29 | int bits; 30 | 31 | testStart("Estimation of Numeric stream (16 digits)"); 32 | stream = QRinput_new(); 33 | QRinput_append(stream, QR_MODE_NUM, 16, (unsigned char *)num); 34 | bits = QRinput_estimateBitStreamSize(stream, 0); 35 | testEndExp(bits == 68); 36 | 37 | QRinput_append(gstream, QR_MODE_NUM, 16, (unsigned char *)num); 38 | QRinput_free(stream); 39 | } 40 | 41 | void test_numbit3(void) 42 | { 43 | QRinput *stream; 44 | char *num; 45 | int bits; 46 | 47 | testStart("Estimation of Numeric stream (400 digits)"); 48 | stream = QRinput_new(); 49 | num = (char *)malloc(401); 50 | memset(num, '1', 400); 51 | num[400] = '\0'; 52 | QRinput_append(stream, QR_MODE_NUM, 400, (unsigned char *)num); 53 | bits = QRinput_estimateBitStreamSize(stream, 0); 54 | /* 4 + 10 + 133*10 + 4 = 1348 */ 55 | testEndExp(bits == 1348); 56 | 57 | QRinput_append(gstream, QR_MODE_NUM, 400, (unsigned char *)num); 58 | QRinput_free(stream); 59 | free(num); 60 | } 61 | 62 | void test_an(void) 63 | { 64 | QRinput *stream; 65 | char str[6]="AC-42"; 66 | int bits; 67 | 68 | testStart("Estimation of Alphabet-Numeric stream (5 chars)"); 69 | stream = QRinput_new(); 70 | QRinput_append(stream, QR_MODE_AN, 5, (unsigned char *)str); 71 | bits = QRinput_estimateBitStreamSize(stream, 0); 72 | testEndExp(bits == 41); 73 | 74 | QRinput_append(gstream, QR_MODE_AN, 5, (unsigned char *)str); 75 | QRinput_free(stream); 76 | } 77 | 78 | void test_8(void) 79 | { 80 | QRinput *stream; 81 | char str[9]="12345678"; 82 | int bits; 83 | 84 | testStart("Estimation of 8 bit data stream (8 bytes)"); 85 | stream = QRinput_new(); 86 | QRinput_append(stream, QR_MODE_8, 8, (unsigned char *)str); 87 | bits = QRinput_estimateBitStreamSize(stream, 0); 88 | testEndExp(bits == 76); 89 | 90 | QRinput_append(gstream, QR_MODE_8, 8, (unsigned char *)str); 91 | QRinput_free(stream); 92 | } 93 | 94 | void test_structure(void) 95 | { 96 | QRinput *stream; 97 | int bits; 98 | 99 | testStart("Estimation of a structure-append header"); 100 | stream = QRinput_new(); 101 | QRinput_insertStructuredAppendHeader(stream, 10, 1, 0); 102 | bits = QRinput_estimateBitStreamSize(stream, 1); 103 | testEndExp(bits == 20); 104 | 105 | QRinput_insertStructuredAppendHeader(gstream, 10, 1, 0); 106 | QRinput_free(stream); 107 | } 108 | 109 | void test_kanji(void) 110 | { 111 | int res; 112 | 113 | QRinput *stream; 114 | unsigned char str[4]= {0x93, 0x5f,0xe4, 0xaa}; 115 | int bits; 116 | 117 | testStart("Estimation of Kanji stream (2 chars)"); 118 | stream = QRinput_new(); 119 | res = QRinput_append(stream, QR_MODE_KANJI, 4, (unsigned char *)str); 120 | if(res < 0) { 121 | printf("Failed to add.\n"); 122 | testEnd(1); 123 | } else { 124 | bits = QRinput_estimateBitStreamSize(stream, 0); 125 | testEndExp(bits == 38); 126 | QRinput_append(gstream, QR_MODE_KANJI, 4, (unsigned char *)str); 127 | } 128 | 129 | QRinput_free(stream); 130 | } 131 | 132 | void test_mix(void) 133 | { 134 | int bits; 135 | 136 | testStart("Estimation of Mixed stream"); 137 | bits = QRinput_estimateBitStreamSize(gstream, 0); 138 | testEndExp(bits == (41 + 68 + 1348 + 41 + 76 + 38 + 20)); 139 | QRinput_free(gstream); 140 | } 141 | 142 | int main(void) 143 | { 144 | gstream = QRinput_new(); 145 | 146 | test_numbit(); 147 | test_numbit2(); 148 | test_numbit3(); 149 | test_an(); 150 | test_8(); 151 | test_kanji(); 152 | test_structure(); 153 | test_mix(); 154 | 155 | report(); 156 | 157 | return 0; 158 | } 159 | -------------------------------------------------------------------------------- /qrencode/tests/create_frame_pattern.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This tool creates a frame pattern data for debug purpose used by 3 | * test_qrspec. test_qrspec and create_frame_pattern uses the same function 4 | * of libqrencode. This means the test is meaningless if test_qrspec is run 5 | * with a pattern data created by create_frame_pattern of the same version. 6 | * In order to test it correctly, create a pattern data by the tool of the 7 | * previous version, or use the frame data attached to the package. 8 | */ 9 | 10 | #include 11 | #include 12 | #include 13 | #include "common.h" 14 | #include "../qrspec.h" 15 | 16 | void append_pattern(int version, FILE *fp) 17 | { 18 | int width; 19 | unsigned char *frame; 20 | 21 | frame = QRspec_newFrame(version); 22 | width = QRspec_getWidth(version); 23 | fwrite(frame, 1, width * width, fp); 24 | free(frame); 25 | } 26 | 27 | static int writePNG(unsigned char *frame, int width, const char *outfile) 28 | { 29 | static FILE *fp; 30 | png_structp png_ptr; 31 | png_infop info_ptr; 32 | unsigned char *row, *p, *q; 33 | int x, y, xx, yy, bit; 34 | int realwidth; 35 | const int margin = 0; 36 | const int size = 1; 37 | 38 | realwidth = (width + margin * 2) * size; 39 | row = (unsigned char *)malloc((realwidth + 7) / 8); 40 | if(row == NULL) { 41 | fprintf(stderr, "Failed to allocate memory.\n"); 42 | exit(EXIT_FAILURE); 43 | } 44 | 45 | if(outfile[0] == '-' && outfile[1] == '\0') { 46 | fp = stdout; 47 | } else { 48 | fp = fopen(outfile, "wb"); 49 | if(fp == NULL) { 50 | fprintf(stderr, "Failed to create file: %s\n", outfile); 51 | perror(NULL); 52 | exit(EXIT_FAILURE); 53 | } 54 | } 55 | 56 | png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); 57 | if(png_ptr == NULL) { 58 | fclose(fp); 59 | fprintf(stderr, "Failed to initialize PNG writer.\n"); 60 | exit(EXIT_FAILURE); 61 | } 62 | 63 | info_ptr = png_create_info_struct(png_ptr); 64 | if(info_ptr == NULL) { 65 | fclose(fp); 66 | fprintf(stderr, "Failed to initialize PNG write.\n"); 67 | exit(EXIT_FAILURE); 68 | } 69 | 70 | if(setjmp(png_jmpbuf(png_ptr))) { 71 | png_destroy_write_struct(&png_ptr, &info_ptr); 72 | fclose(fp); 73 | fprintf(stderr, "Failed to write PNG image.\n"); 74 | exit(EXIT_FAILURE); 75 | } 76 | 77 | png_init_io(png_ptr, fp); 78 | png_set_IHDR(png_ptr, info_ptr, 79 | realwidth, realwidth, 80 | 1, 81 | PNG_COLOR_TYPE_GRAY, 82 | PNG_INTERLACE_NONE, 83 | PNG_COMPRESSION_TYPE_DEFAULT, 84 | PNG_FILTER_TYPE_DEFAULT); 85 | png_write_info(png_ptr, info_ptr); 86 | 87 | /* top margin */ 88 | memset(row, 0xff, (realwidth + 7) / 8); 89 | for(y=0; y 11 | #include 12 | #include 13 | #include "common.h" 14 | #include "../mqrspec.h" 15 | 16 | void append_pattern(int version, FILE *fp) 17 | { 18 | int width; 19 | unsigned char *frame; 20 | 21 | frame = MQRspec_newFrame(version); 22 | width = MQRspec_getWidth(version); 23 | fwrite(frame, 1, width * width, fp); 24 | free(frame); 25 | } 26 | 27 | static int writePNG(unsigned char *frame, int width, const char *outfile) 28 | { 29 | static FILE *fp; 30 | png_structp png_ptr; 31 | png_infop info_ptr; 32 | unsigned char *row, *p, *q; 33 | int x, y, xx, yy, bit; 34 | int realwidth; 35 | const int margin = 0; 36 | const int size = 1; 37 | 38 | realwidth = (width + margin * 2) * size; 39 | row = (unsigned char *)malloc((realwidth + 7) / 8); 40 | if(row == NULL) { 41 | fprintf(stderr, "Failed to allocate memory.\n"); 42 | exit(EXIT_FAILURE); 43 | } 44 | 45 | if(outfile[0] == '-' && outfile[1] == '\0') { 46 | fp = stdout; 47 | } else { 48 | fp = fopen(outfile, "wb"); 49 | if(fp == NULL) { 50 | fprintf(stderr, "Failed to create file: %s\n", outfile); 51 | perror(NULL); 52 | exit(EXIT_FAILURE); 53 | } 54 | } 55 | 56 | png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); 57 | if(png_ptr == NULL) { 58 | fclose(fp); 59 | fprintf(stderr, "Failed to initialize PNG writer.\n"); 60 | exit(EXIT_FAILURE); 61 | } 62 | 63 | info_ptr = png_create_info_struct(png_ptr); 64 | if(info_ptr == NULL) { 65 | fclose(fp); 66 | fprintf(stderr, "Failed to initialize PNG write.\n"); 67 | exit(EXIT_FAILURE); 68 | } 69 | 70 | if(setjmp(png_jmpbuf(png_ptr))) { 71 | png_destroy_write_struct(&png_ptr, &info_ptr); 72 | fclose(fp); 73 | fprintf(stderr, "Failed to write PNG image.\n"); 74 | exit(EXIT_FAILURE); 75 | } 76 | 77 | png_init_io(png_ptr, fp); 78 | png_set_IHDR(png_ptr, info_ptr, 79 | realwidth, realwidth, 80 | 1, 81 | PNG_COLOR_TYPE_GRAY, 82 | PNG_INTERLACE_NONE, 83 | PNG_COMPRESSION_TYPE_DEFAULT, 84 | PNG_FILTER_TYPE_DEFAULT); 85 | png_write_info(png_ptr, info_ptr); 86 | 87 | /* top margin */ 88 | memset(row, 0xff, (realwidth + 7) / 8); 89 | for(y=0; y>confdefs.h 77 | echo "#define WITH_TESTS 1" >>confdefs.h 78 | else 79 | echo "#define __STATIC static" >>confdefs.h 80 | echo "/* #undef WITH_TESTS */" >>confdefs.h 81 | fi 82 | 83 | if test x$build_tests = xyes ; then 84 | SDL_REQUIRED_VERSION=1.2.0 85 | AM_PATH_SDL($SDL_REQUIRED_VERSION,,AC_MSG_WARN([*** SDL $SDL_REQUIRED_VERSION or better is required.])) 86 | AC_MSG_NOTICE([SDL check done.]) 87 | AM_ICONV_LINK 88 | fi 89 | AM_CONDITIONAL(HAVE_SDL, [test "x$SDL_CFLAGS" != "x" ]) 90 | 91 | 92 | dnl --enable-gprof 93 | AC_ARG_ENABLE([gprof], [AS_HELP_STRING([--enable-gprof], [generate extra code to write profile information suitable for gprof [default=no]])], 94 | [], [enable_gprof=no]) 95 | 96 | if test x$enable_gprof = xyes; then 97 | CFLAGS="$CFLAGS -g -pg" 98 | fi 99 | 100 | 101 | dnl --enable-gcov 102 | AC_ARG_ENABLE([gcov], [AS_HELP_STRING([--enable-gcov], [generate extra code to write coverage information suitable for gcov [default=no]])], 103 | [], [enable_gcov=no]) 104 | 105 | if test x$enable_gcov = xyes; then 106 | CFLAGS="$CFLAGS --coverage" 107 | fi 108 | 109 | 110 | dnl --enable-mudflap 111 | AC_ARG_ENABLE([mudflap], [AS_HELP_STRING([--enable-mudflap], [generate extra code to check memory leaks [default=no]])], 112 | [], [enable_mudflap=no]) 113 | 114 | if test x$enable_mudflap = xyes; then 115 | if test x$enable_thread_safety = xyes; then 116 | CFLAGS="$CFLAGS -fmudflapth" 117 | LDFLAGS="$LDFLAGS -lmudflapth" 118 | else 119 | CFLAGS="$CFLAGS -fmudflap" 120 | LDFLAGS="$LDFLAGS -lmudflap" 121 | fi 122 | fi 123 | 124 | 125 | dnl set CFLAGS 126 | CFLAGS="-Wall $CFLAGS" 127 | 128 | 129 | AC_OUTPUT 130 | 131 | echo "" 132 | echo "Options used to compile and link:" 133 | echo " CC = $CC" 134 | echo " CFLAGS = $CFLAGS" 135 | echo " CPPFLAGS = $CPPFLAGS" 136 | echo " CXX = $CXX" 137 | echo " CXXFLAGS = $CXXFLAGS" 138 | echo " LDFLAGS = $LDFLAGS" 139 | echo "" 140 | -------------------------------------------------------------------------------- /qrencode/mmask.c: -------------------------------------------------------------------------------- 1 | /* 2 | * qrencode - QR Code encoder 3 | * 4 | * Masking for Micro QR Code. 5 | * Copyright (C) 2006-2011 Kentaro Fukuchi 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #if HAVE_CONFIG_H 23 | # include "config.h" 24 | #endif 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "qrencode.h" 31 | #include "mqrspec.h" 32 | #include "mmask.h" 33 | 34 | __STATIC void MMask_writeFormatInformation(int version, int width, unsigned char *frame, int mask, QRecLevel level) 35 | { 36 | unsigned int format; 37 | unsigned char v; 38 | int i; 39 | 40 | format = MQRspec_getFormatInfo(mask, version, level); 41 | 42 | for(i=0; i<8; i++) { 43 | v = 0x84 | (format & 1); 44 | frame[width * (i + 1) + 8] = v; 45 | format = format >> 1; 46 | } 47 | for(i=0; i<7; i++) { 48 | v = 0x84 | (format & 1); 49 | frame[width * 8 + 7 - i] = v; 50 | format = format >> 1; 51 | } 52 | } 53 | 54 | #define MASKMAKER(__exp__) \ 55 | int x, y;\ 56 | \ 57 | for(y=0; y= maskNum) { 114 | errno = EINVAL; 115 | return NULL; 116 | } 117 | 118 | width = MQRspec_getWidth(version); 119 | masked = (unsigned char *)malloc(width * width); 120 | if(masked == NULL) return NULL; 121 | 122 | maskMakers[mask](width, frame, masked); 123 | MMask_writeFormatInformation(version, width, masked, mask, level); 124 | 125 | return masked; 126 | } 127 | 128 | __STATIC int MMask_evaluateSymbol(int width, unsigned char *frame) 129 | { 130 | int x, y; 131 | unsigned char *p; 132 | int sum1 = 0, sum2 = 0; 133 | 134 | p = frame + width * (width - 1); 135 | for(x=1; x maxScore) { 168 | maxScore = score; 169 | free(bestMask); 170 | bestMask = mask; 171 | mask = (unsigned char *)malloc(width * width); 172 | if(mask == NULL) break; 173 | } 174 | } 175 | free(mask); 176 | return bestMask; 177 | } 178 | -------------------------------------------------------------------------------- /qrencode/tests/common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * common part of test units. 3 | */ 4 | 5 | #ifndef __COMMON_H__ 6 | #define __COMMON_H__ 7 | 8 | #include 9 | #include "../config.h" 10 | #include "../qrencode.h" 11 | #include "../qrinput.h" 12 | #include "../bitstream.h" 13 | #include "../qrencode_inner.h" 14 | 15 | #define testStart(__arg__) (testStartReal(__func__, __arg__)) 16 | #define testEndExp(__arg__) (testEnd(!(__arg__))) 17 | 18 | static int tests = 0; 19 | static int failed = 0; 20 | static int assertionFailed = 0; 21 | static int assertionNum = 0; 22 | static const char *testName = NULL; 23 | static const char *testFunc = NULL; 24 | char levelChar[4] = {'L', 'M', 'Q', 'H'}; 25 | const char *modeStr[5] = {"nm", "an", "8", "kj", "st"}; 26 | 27 | void printQRinput(QRinput *input) 28 | { 29 | QRinput_List *list; 30 | int i; 31 | 32 | list = input->head; 33 | while(list != NULL) { 34 | for(i=0; isize; i++) { 35 | printf("0x%02x,", list->data[i]); 36 | } 37 | list = list->next; 38 | } 39 | printf("\n"); 40 | } 41 | 42 | void printQRinputInfo(QRinput *input) 43 | { 44 | QRinput_List *list; 45 | BitStream *b; 46 | int i; 47 | 48 | printf("QRinput info:\n"); 49 | printf(" version: %d\n", input->version); 50 | printf(" level : %c\n", levelChar[input->level]); 51 | list = input->head; 52 | i = 0; 53 | while(list != NULL) { 54 | i++; 55 | list = list->next; 56 | } 57 | printf(" chunks: %d\n", i); 58 | b = QRinput_mergeBitStream(input); 59 | if(b != NULL) { 60 | printf(" bitstream-size: %d\n", BitStream_size(b)); 61 | BitStream_free(b); 62 | } 63 | 64 | list = input->head; 65 | i = 0; 66 | while(list != NULL) { 67 | printf("\t#%d: mode = %s, size = %d\n", i, modeStr[list->mode], list->size); 68 | i++; 69 | list = list->next; 70 | } 71 | } 72 | 73 | void printQRinputStruct(QRinput_Struct *s) 74 | { 75 | QRinput_InputList *list; 76 | int i = 1; 77 | 78 | printf("Struct size: %d\n", s->size); 79 | printf("Struct parity: %08x\n", s->parity); 80 | for(list = s->head; list != NULL; list = list->next) { 81 | printf("Symbol %d - ", i); 82 | printQRinputInfo(list->input); 83 | i++; 84 | } 85 | } 86 | 87 | void printFrame(int width, unsigned char *frame) 88 | { 89 | int x, y; 90 | 91 | for(y=0; ywidth, code->data); 102 | } 103 | 104 | void testStartReal(const char *func, const char *name) 105 | { 106 | tests++; 107 | testName = name; 108 | testFunc = func; 109 | assertionFailed = 0; 110 | assertionNum = 0; 111 | printf("_____%d: %s: %s...\n", tests, func, name); 112 | } 113 | 114 | void testEnd(int result) 115 | { 116 | printf(".....%d: %s: %s, ", tests, testFunc, testName); 117 | if(result) { 118 | puts("FAILED."); 119 | failed++; 120 | } else { 121 | puts("PASSED."); 122 | } 123 | } 124 | 125 | #define assert_exp(__exp__, ...) \ 126 | {assertionNum++;if(!(__exp__)) {assertionFailed++; printf(__VA_ARGS__);}} 127 | 128 | #define assert_zero(__exp__, ...) assert_exp((__exp__) == 0, __VA_ARGS__) 129 | #define assert_nonzero(__exp__, ...) assert_exp((__exp__) != 0, __VA_ARGS__) 130 | #define assert_null(__ptr__, ...) assert_exp((__ptr__) == NULL, __VA_ARGS__) 131 | #define assert_nonnull(__ptr__, ...) assert_exp((__ptr__) != NULL, __VA_ARGS__) 132 | #define assert_equal(__e1__, __e2__, ...) assert_exp((__e1__) == (__e2__), __VA_ARGS__) 133 | #define assert_notequal(__e1__, __e2__, ...) assert_exp((__e1__) != (__e2__), __VA_ARGS__) 134 | #define assert_nothing(__exp__, ...) {printf(__VA_ARGS__); __exp__;} 135 | 136 | void testFinish(void) 137 | { 138 | printf(".....%d: %s: %s, ", tests, testFunc, testName); 139 | if(assertionFailed) { 140 | printf("FAILED. (%d assertions failed.)\n", assertionFailed); 141 | failed++; 142 | } else { 143 | printf("PASSED. (%d assertions passed.)\n", assertionNum); 144 | } 145 | } 146 | 147 | void report() 148 | { 149 | printf("Total %d tests, %d fails.\n", tests, failed); 150 | if(failed) exit(-1); 151 | } 152 | 153 | int ncmpBin(char *correct, BitStream *bstream, int len) 154 | { 155 | int i, bit; 156 | char *p; 157 | 158 | if(len != BitStream_size(bstream)) { 159 | printf("Length is not match: %d, %d expected.\n", BitStream_size(bstream), len); 160 | return -1; 161 | } 162 | 163 | p = correct; 164 | i = 0; 165 | while(*p != '\0') { 166 | while(*p == ' ') { 167 | p++; 168 | } 169 | bit = (*p == '1')?1:0; 170 | if(bstream->data[i] != bit) return -1; 171 | i++; 172 | p++; 173 | if(i == len) break; 174 | } 175 | 176 | return 0; 177 | } 178 | 179 | int cmpBin(char *correct, BitStream *bstream) 180 | { 181 | int len = 0; 182 | char *p; 183 | 184 | 185 | for(p = correct; *p != '\0'; p++) { 186 | if(*p != ' ') len++; 187 | } 188 | return ncmpBin(correct, bstream, len); 189 | } 190 | 191 | void printBstream(BitStream *bstream) 192 | { 193 | int i, size; 194 | 195 | size = BitStream_size(bstream); 196 | for(i=0; idata[i]?"1":"0"); 198 | } 199 | printf("\n"); 200 | } 201 | #endif /* __COMMON_H__ */ 202 | -------------------------------------------------------------------------------- /qrencode/tests/test_mqrspec.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "common.h" 4 | #include "../mqrspec.h" 5 | 6 | unsigned char v4frame[] = { 7 | 0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc0,0x91,0x90,0x91,0x90,0x91,0x90,0x91,0x90,0x91, 8 | 0xc1,0xc0,0xc0,0xc0,0xc0,0xc0,0xc1,0xc0,0x84,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9 | 0xc1,0xc0,0xc1,0xc1,0xc1,0xc0,0xc1,0xc0,0x84,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 10 | 0xc1,0xc0,0xc1,0xc1,0xc1,0xc0,0xc1,0xc0,0x84,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11 | 0xc1,0xc0,0xc1,0xc1,0xc1,0xc0,0xc1,0xc0,0x84,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 12 | 0xc1,0xc0,0xc0,0xc0,0xc0,0xc0,0xc1,0xc0,0x84,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 13 | 0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc0,0x84,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 14 | 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x84,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 15 | 0x91,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 16 | 0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 17 | 0x91,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 18 | 0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 19 | 0x91,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 20 | 0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 21 | 0x91,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 22 | 0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 23 | 0x91,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 24 | }; 25 | 26 | void test_newFrame(void) 27 | { 28 | int width, i, y; 29 | unsigned char *frame; 30 | 31 | testStart("Test empty frames"); 32 | for(i=1; i> 1; 67 | } 68 | c = 4 - i; 69 | code = 0x537 << c ; //10100110111 70 | b = 1 << (10 + c); 71 | for(i=0; i<=c; i++) { 72 | if(b & ecc) { 73 | ecc ^= code; 74 | } 75 | code = code >> 1; 76 | b = b >> 1; 77 | } 78 | 79 | return (data | ecc) ^ 0x4445; 80 | } 81 | 82 | /* See Table 10 of Appendix 1. (pp.115) */ 83 | static const int typeTable[4][3] = { 84 | { 0, -1, -1}, 85 | { 1, 2, -1}, 86 | { 3, 4, -1}, 87 | { 5, 6, 7} 88 | }; 89 | 90 | void test_format(void) 91 | { 92 | unsigned int format; 93 | int version, l, mask; 94 | int type; 95 | int err = 0; 96 | 97 | testStart("Format info test"); 98 | for(version=1; version<=4; version++) { 99 | for(l=0; l<3; l++) { 100 | for(mask=0; mask<4; mask++) { 101 | format = MQRspec_getFormatInfo(mask, version, (QRecLevel)l); 102 | type = typeTable[version - 1][l]; 103 | if(type == -1) { 104 | if(format != 0) { 105 | printf("Error in version %d, level %d, mask %d\n", 106 | version, l, mask); 107 | err++; 108 | } 109 | } else { 110 | if(format != calcFormatInfo(type, mask)) { 111 | printf("Error in version %d, level %d, mask %d\n", 112 | version, l, mask); 113 | err++; 114 | } 115 | } 116 | } 117 | } 118 | } 119 | testEnd(err); 120 | } 121 | 122 | void print_format(void) 123 | { 124 | unsigned int format; 125 | int i, j; 126 | 127 | for(i=0; i<4; i++) { 128 | for(j=0; j<8; j++) { 129 | format = calcFormatInfo(j, i); 130 | printf("0x%04x, ", format); 131 | } 132 | printf("\n"); 133 | } 134 | } 135 | 136 | /** 137 | * See Table 7 of Appendix 1. 138 | */ 139 | int datalen[4][3] = { 140 | { 20, 0, 0}, 141 | { 40, 32, 0}, 142 | { 84, 68, 0}, 143 | {128, 112, 80}, 144 | }; 145 | 146 | void test_dataLength(void) 147 | { 148 | int v, l; 149 | int bits; 150 | int err = 0; 151 | 152 | testStart("Test dataLength"); 153 | for(v=0; v<4; v++) { 154 | for(l=0; l<3; l++) { 155 | bits = MQRspec_getDataLengthBit(v+1, (QRecLevel)l); 156 | if(bits != datalen[v][l]) { 157 | printf("Error in version %d, level %d.\n", v, l); 158 | err++; 159 | } 160 | } 161 | } 162 | testEnd(err); 163 | } 164 | 165 | int main(void) 166 | { 167 | test_newFrame(); 168 | test_newframe_invalid(); 169 | //print_format(); 170 | test_format(); 171 | test_dataLength(); 172 | 173 | MQRspec_clearCache(); 174 | 175 | report(); 176 | 177 | return 0; 178 | } 179 | -------------------------------------------------------------------------------- /qrencode/mqrspec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qrencode - QR Code encoder 3 | * 4 | * Micro QR Code specification in convenient format. 5 | * Copyright (C) 2006-2011 Kentaro Fukuchi 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef __MQRSPEC_H__ 23 | #define __MQRSPEC_H__ 24 | 25 | #include "qrencode.h" 26 | 27 | /****************************************************************************** 28 | * Version and capacity 29 | *****************************************************************************/ 30 | 31 | /** 32 | * Maximum width of a symbol 33 | */ 34 | #define MQRSPEC_WIDTH_MAX 17 35 | 36 | /** 37 | * Return maximum data code length (bits) for the version. 38 | * @param version 39 | * @param level 40 | * @return maximum size (bits) 41 | */ 42 | extern int MQRspec_getDataLengthBit(int version, QRecLevel level); 43 | 44 | /** 45 | * Return maximum data code length (bytes) for the version. 46 | * @param version 47 | * @param level 48 | * @return maximum size (bytes) 49 | */ 50 | extern int MQRspec_getDataLength(int version, QRecLevel level); 51 | 52 | /** 53 | * Return maximum error correction code length (bytes) for the version. 54 | * @param version 55 | * @param level 56 | * @return ECC size (bytes) 57 | */ 58 | extern int MQRspec_getECCLength(int version, QRecLevel level); 59 | 60 | /** 61 | * Return a version number that satisfies the input code length. 62 | * @param size input code length (byte) 63 | * @param level 64 | * @return version number 65 | */ 66 | extern int MQRspec_getMinimumVersion(int size, QRecLevel level); 67 | 68 | /** 69 | * Return the width of the symbol for the version. 70 | * @param version 71 | * @return width 72 | */ 73 | extern int MQRspec_getWidth(int version); 74 | 75 | /** 76 | * Return the numer of remainder bits. 77 | * @param version 78 | * @return number of remainder bits 79 | */ 80 | extern int MQRspec_getRemainder(int version); 81 | 82 | /****************************************************************************** 83 | * Length indicator 84 | *****************************************************************************/ 85 | 86 | /** 87 | * Return the size of lenght indicator for the mode and version. 88 | * @param mode 89 | * @param version 90 | * @return the size of the appropriate length indicator (bits). 91 | */ 92 | extern int MQRspec_lengthIndicator(QRencodeMode mode, int version); 93 | 94 | /** 95 | * Return the maximum length for the mode and version. 96 | * @param mode 97 | * @param version 98 | * @return the maximum length (bytes) 99 | */ 100 | extern int MQRspec_maximumWords(QRencodeMode mode, int version); 101 | 102 | /****************************************************************************** 103 | * Version information pattern 104 | *****************************************************************************/ 105 | 106 | /** 107 | * Return BCH encoded version information pattern that is used for the symbol 108 | * of version 7 or greater. Use lower 18 bits. 109 | * @param version 110 | * @return BCH encoded version information pattern 111 | */ 112 | extern unsigned int MQRspec_getVersionPattern(int version); 113 | 114 | /****************************************************************************** 115 | * Format information 116 | *****************************************************************************/ 117 | 118 | /** 119 | * Return BCH encoded format information pattern. 120 | * @param mask 121 | * @param version 122 | * @param level 123 | * @return BCH encoded format information pattern 124 | */ 125 | extern unsigned int MQRspec_getFormatInfo(int mask, int version, QRecLevel level); 126 | 127 | /****************************************************************************** 128 | * Frame 129 | *****************************************************************************/ 130 | 131 | /** 132 | * Return a copy of initialized frame. 133 | * When the same version is requested twice or more, a copy of cached frame 134 | * is returned. 135 | * @param version 136 | * @return Array of unsigned char. You can free it by free(). 137 | */ 138 | extern unsigned char *MQRspec_newFrame(int version); 139 | 140 | /** 141 | * Clear the frame cache. Typically for debug. 142 | */ 143 | extern void MQRspec_clearCache(void); 144 | 145 | /****************************************************************************** 146 | * Mode indicator 147 | *****************************************************************************/ 148 | 149 | /** 150 | * Mode indicator. See Table 2 in Appendix 1 of JIS X0510:2004, pp.107. 151 | */ 152 | #define MQRSPEC_MODEID_NUM 0 153 | #define MQRSPEC_MODEID_AN 1 154 | #define MQRSPEC_MODEID_8 2 155 | #define MQRSPEC_MODEID_KANJI 3 156 | 157 | #endif /* __MQRSPEC_H__ */ 158 | -------------------------------------------------------------------------------- /qrencode/README: -------------------------------------------------------------------------------- 1 | libqrencode 3.4.4 - QR Code encoding library 2 | 3 | GENERAL INFORMATION 4 | =================== 5 | Libqrencode is a library for encoding data in a QR Code symbol, a 2D symbology 6 | that can be scanned by handy terminals such as a mobile phone with CCD. The 7 | capacity of QR Code is up to 7000 digits or 4000 characters and has high 8 | robustness. 9 | 10 | Libqrencode accepts a string or a list of data chunks then encodes in a QR Code 11 | symbol as a bitmap array. While other QR Code applications generate an image 12 | file, using libqrencode allows applications to render QR Code symbols from raw 13 | bitmap data directly. This library also contains a command-line utility outputs 14 | a QR Code symbol as a PNG image. 15 | 16 | 17 | SPECIFICATION 18 | ============= 19 | Libqrencode supports QR Code model 2, described in JIS (Japanese Industrial 20 | Standards) X0510:2004 or ISO/IEC 18004. Most of features in the specification 21 | are implemented such as: 22 | - Numeric, alphabet, Japanese kanji (Shift-JIS) or any 8 bit code can be 23 | embedded 24 | - Optimized encoding of a string 25 | - Structured-append of symbols 26 | - Micro QR Code (experimental) 27 | 28 | Currently the following features are not supported: 29 | - ECI and FNC1 mode 30 | - QR Code model 1 (deprecated) 31 | 32 | 33 | INSTALL 34 | ======= 35 | 36 | Requirements 37 | ------------ 38 | Some test programs or utility tools uses SDL or PNG, but the library itself 39 | has no dependencies. You can skip compiling those tools if you want not to 40 | install programs using SDL or PNG. 41 | 42 | Compile & install 43 | ----------------- 44 | Just try 45 | 46 | ./configure 47 | make 48 | make install 49 | 50 | This compiles and installs the library and header file to the appropriate 51 | directories. By default, /usr/local/lib and /usr/local/include. You can change 52 | the destination directory by passing some options to the configure script. 53 | Run "./configure --help" to see the list of options. 54 | 55 | It also installs a binary "qrencode" to /usr/local/bin. If you want not to 56 | install it, give "--without-tools" option to the configure script. 57 | 58 | When you downloaded a development tree from github, it is required to run 59 | "autogen.sh" at first to generate configure script. 60 | 61 | 62 | USAGE 63 | ===== 64 | Basic usages of this library are written in the header file (qrencode.h). 65 | You can generate a manual of the library by using Doxygen. 66 | 67 | 68 | WARNINGS 69 | ======== 70 | The library is distributed WITHOUT ANY WRRANTY. 71 | 72 | Micro QR Code support is EXPERIMENTAL. 73 | 74 | Be careful to use the command line tool (qrencode) if it is used by a web 75 | application (e.g. CGI script). For example, giving "-s" option with a large 76 | number to qrencode may cause DoS. The parameters should be checked by the 77 | application. 78 | 79 | 80 | LICENSING INFORMATION 81 | ===================== 82 | Copyright (C) 2006-2012 Kentaro Fukuchi 83 | 84 | This library is free software; you can redistribute it and/or modify it under 85 | the terms of the GNU Lesser General Public License as published by the Free 86 | Software Foundation; either version 2.1 of the License, or any later version. 87 | 88 | This library is distributed in the hope that it will be useful, but WITHOUT ANY 89 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 90 | PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 91 | 92 | You should have received a copy of the GNU Lesser General Public License along 93 | with this library; if not, write to the Free Software Foundation, Inc., 51 94 | Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 95 | 96 | 97 | CONTACT 98 | ======= 99 | Visit the homepage at: 100 | 101 | http://fukuchi.org/works/qrencode/ 102 | 103 | for new releases. The git repository is available at: 104 | 105 | https://github.com/fukuchi/libqrencode 106 | 107 | Please mail any bug reports, suggestions, comments, and questions to: 108 | 109 | Kentaro Fukuchi 110 | 111 | or submit issues to: 112 | 113 | https://github.com/fukuchi/libqrencode/issues 114 | 115 | Questions of license compliance are also welcome. 116 | 117 | 118 | ACKNOWLEDGMENTS 119 | =============== 120 | QR Code is registered trademarks of DENSO WAVE INCORPORATED in JAPAN and other 121 | countries. 122 | 123 | Reed-Solomon encoder is written by Phil Karn, KA9Q. 124 | Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q 125 | 126 | NANKI Haruo - improved lower-case characteres encoding 127 | Philippe Delcroix - improved mask evaluation 128 | Yusuke Mihara - structured-append support 129 | David Dahl - DPI and SVG support patch 130 | Adam Shepherd - bug fix patch of the mask evaluation 131 | Josef Eisl (zapster) - EPS support patch 132 | Colin (moshen) - ANSI support patch 133 | Ralf Ertzinger - ASCII support patch 134 | Yutaka Niibe (gniibe) - various bug fix patches 135 | Dan Storm (Repox) - SVG support patch 136 | Lennart Poettering (mezcalero) 137 | - improved text art patch 138 | Yann Droneaud - improved input validation patch 139 | Viona - bug fix patch for string splitting 140 | Daniel Dörrhöfer - RLE option 141 | Shigeyuki Hirai, Paul Janssens, wangsai, Gavan Fantom, Matthew Baker, Rob Ryan, 142 | Fred Steinhaeuser, Terry Burton, chisj, vlad417, Petr, Hassan Hajji, 143 | Emmanuel Blot, ßlúèÇhîp, win32asm, Antenore, Yoshimichi Inoue 144 | - bug report / suggestion 145 | -------------------------------------------------------------------------------- /qrencode/bitstream.c: -------------------------------------------------------------------------------- 1 | /* 2 | * qrencode - QR Code encoder 3 | * 4 | * Binary sequence class. 5 | * Copyright (C) 2006-2011 Kentaro Fukuchi 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #if HAVE_CONFIG_H 23 | # include "config.h" 24 | #endif 25 | #include 26 | #include 27 | #include 28 | 29 | #include "bitstream.h" 30 | 31 | BitStream *BitStream_new(void) 32 | { 33 | BitStream *bstream; 34 | 35 | bstream = (BitStream *)malloc(sizeof(BitStream)); 36 | if(bstream == NULL) return NULL; 37 | 38 | bstream->length = 0; 39 | bstream->data = NULL; 40 | 41 | return bstream; 42 | } 43 | 44 | static int BitStream_allocate(BitStream *bstream, int length) 45 | { 46 | unsigned char *data; 47 | 48 | if(bstream == NULL) { 49 | return -1; 50 | } 51 | 52 | data = (unsigned char *)malloc(length); 53 | if(data == NULL) { 54 | return -1; 55 | } 56 | 57 | if(bstream->data) { 58 | free(bstream->data); 59 | } 60 | bstream->length = length; 61 | bstream->data = data; 62 | 63 | return 0; 64 | } 65 | 66 | static BitStream *BitStream_newFromNum(int bits, unsigned int num) 67 | { 68 | unsigned int mask; 69 | int i; 70 | unsigned char *p; 71 | BitStream *bstream; 72 | 73 | bstream = BitStream_new(); 74 | if(bstream == NULL) return NULL; 75 | 76 | if(BitStream_allocate(bstream, bits)) { 77 | BitStream_free(bstream); 78 | return NULL; 79 | } 80 | 81 | p = bstream->data; 82 | mask = 1 << (bits - 1); 83 | for(i=0; i> 1; 91 | } 92 | 93 | return bstream; 94 | } 95 | 96 | static BitStream *BitStream_newFromBytes(int size, unsigned char *data) 97 | { 98 | unsigned char mask; 99 | int i, j; 100 | unsigned char *p; 101 | BitStream *bstream; 102 | 103 | bstream = BitStream_new(); 104 | if(bstream == NULL) return NULL; 105 | 106 | if(BitStream_allocate(bstream, size * 8)) { 107 | BitStream_free(bstream); 108 | return NULL; 109 | } 110 | 111 | p = bstream->data; 112 | for(i=0; i> 1; 122 | } 123 | } 124 | 125 | return bstream; 126 | } 127 | 128 | int BitStream_append(BitStream *bstream, BitStream *arg) 129 | { 130 | unsigned char *data; 131 | 132 | if(arg == NULL) { 133 | return -1; 134 | } 135 | if(arg->length == 0) { 136 | return 0; 137 | } 138 | if(bstream->length == 0) { 139 | if(BitStream_allocate(bstream, arg->length)) { 140 | return -1; 141 | } 142 | memcpy(bstream->data, arg->data, arg->length); 143 | return 0; 144 | } 145 | 146 | data = (unsigned char *)malloc(bstream->length + arg->length); 147 | if(data == NULL) { 148 | return -1; 149 | } 150 | memcpy(data, bstream->data, bstream->length); 151 | memcpy(data + bstream->length, arg->data, arg->length); 152 | 153 | free(bstream->data); 154 | bstream->length += arg->length; 155 | bstream->data = data; 156 | 157 | return 0; 158 | } 159 | 160 | int BitStream_appendNum(BitStream *bstream, int bits, unsigned int num) 161 | { 162 | BitStream *b; 163 | int ret; 164 | 165 | if(bits == 0) return 0; 166 | 167 | b = BitStream_newFromNum(bits, num); 168 | if(b == NULL) return -1; 169 | 170 | ret = BitStream_append(bstream, b); 171 | BitStream_free(b); 172 | 173 | return ret; 174 | } 175 | 176 | int BitStream_appendBytes(BitStream *bstream, int size, unsigned char *data) 177 | { 178 | BitStream *b; 179 | int ret; 180 | 181 | if(size == 0) return 0; 182 | 183 | b = BitStream_newFromBytes(size, data); 184 | if(b == NULL) return -1; 185 | 186 | ret = BitStream_append(bstream, b); 187 | BitStream_free(b); 188 | 189 | return ret; 190 | } 191 | 192 | unsigned char *BitStream_toByte(BitStream *bstream) 193 | { 194 | int i, j, size, bytes; 195 | unsigned char *data, v; 196 | unsigned char *p; 197 | 198 | size = BitStream_size(bstream); 199 | if(size == 0) { 200 | return NULL; 201 | } 202 | data = (unsigned char *)malloc((size + 7) / 8); 203 | if(data == NULL) { 204 | return NULL; 205 | } 206 | 207 | bytes = size / 8; 208 | 209 | p = bstream->data; 210 | for(i=0; idata); 236 | free(bstream); 237 | } 238 | } 239 | -------------------------------------------------------------------------------- /qrencode/.deps/split.Plo: -------------------------------------------------------------------------------- 1 | split.lo: split.c config.h /usr/include/stdlib.h \ 2 | /usr/include/Availability.h /usr/include/AvailabilityInternal.h \ 3 | /usr/include/_types.h /usr/include/sys/_types.h \ 4 | /usr/include/sys/cdefs.h /usr/include/sys/_symbol_aliasing.h \ 5 | /usr/include/sys/_posix_availability.h /usr/include/machine/_types.h \ 6 | /usr/include/i386/_types.h /usr/include/sys/wait.h \ 7 | /usr/include/sys/_types/_pid_t.h /usr/include/sys/_types/_id_t.h \ 8 | /usr/include/sys/signal.h /usr/include/sys/appleapiopts.h \ 9 | /usr/include/machine/signal.h /usr/include/i386/signal.h \ 10 | /usr/include/machine/_mcontext.h /usr/include/i386/_mcontext.h \ 11 | /usr/include/mach/i386/_structs.h \ 12 | /usr/include/sys/_types/_sigaltstack.h \ 13 | /usr/include/sys/_types/_ucontext.h \ 14 | /usr/include/sys/_types/_pthread_attr_t.h \ 15 | /usr/include/sys/_types/_sigset_t.h /usr/include/sys/_types/_size_t.h \ 16 | /usr/include/sys/_types/_uid_t.h /usr/include/sys/resource.h \ 17 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include/stdint.h \ 18 | /usr/include/stdint.h /usr/include/sys/_types/_int8_t.h \ 19 | /usr/include/sys/_types/_int16_t.h /usr/include/sys/_types/_int32_t.h \ 20 | /usr/include/sys/_types/_int64_t.h /usr/include/_types/_uint8_t.h \ 21 | /usr/include/_types/_uint16_t.h /usr/include/_types/_uint32_t.h \ 22 | /usr/include/_types/_uint64_t.h /usr/include/sys/_types/_intptr_t.h \ 23 | /usr/include/sys/_types/_uintptr_t.h /usr/include/_types/_intmax_t.h \ 24 | /usr/include/_types/_uintmax_t.h /usr/include/sys/_types/_timeval.h \ 25 | /usr/include/machine/endian.h /usr/include/i386/endian.h \ 26 | /usr/include/sys/_endian.h /usr/include/libkern/_OSByteOrder.h \ 27 | /usr/include/libkern/i386/_OSByteOrder.h /usr/include/alloca.h \ 28 | /usr/include/sys/_types/_ct_rune_t.h /usr/include/sys/_types/_rune_t.h \ 29 | /usr/include/sys/_types/_wchar_t.h /usr/include/sys/_types/_null.h \ 30 | /usr/include/machine/types.h /usr/include/i386/types.h \ 31 | /usr/include/sys/_types/___offsetof.h /usr/include/sys/_types/_dev_t.h \ 32 | /usr/include/sys/_types/_mode_t.h /usr/include/string.h \ 33 | /usr/include/sys/_types/_rsize_t.h /usr/include/sys/_types/_errno_t.h \ 34 | /usr/include/sys/_types/_ssize_t.h /usr/include/strings.h \ 35 | /usr/include/secure/_string.h /usr/include/secure/_common.h \ 36 | /usr/include/errno.h /usr/include/sys/errno.h qrencode.h qrinput.h \ 37 | bitstream.h qrspec.h split.h 38 | 39 | config.h: 40 | 41 | /usr/include/stdlib.h: 42 | 43 | /usr/include/Availability.h: 44 | 45 | /usr/include/AvailabilityInternal.h: 46 | 47 | /usr/include/_types.h: 48 | 49 | /usr/include/sys/_types.h: 50 | 51 | /usr/include/sys/cdefs.h: 52 | 53 | /usr/include/sys/_symbol_aliasing.h: 54 | 55 | /usr/include/sys/_posix_availability.h: 56 | 57 | /usr/include/machine/_types.h: 58 | 59 | /usr/include/i386/_types.h: 60 | 61 | /usr/include/sys/wait.h: 62 | 63 | /usr/include/sys/_types/_pid_t.h: 64 | 65 | /usr/include/sys/_types/_id_t.h: 66 | 67 | /usr/include/sys/signal.h: 68 | 69 | /usr/include/sys/appleapiopts.h: 70 | 71 | /usr/include/machine/signal.h: 72 | 73 | /usr/include/i386/signal.h: 74 | 75 | /usr/include/machine/_mcontext.h: 76 | 77 | /usr/include/i386/_mcontext.h: 78 | 79 | /usr/include/mach/i386/_structs.h: 80 | 81 | /usr/include/sys/_types/_sigaltstack.h: 82 | 83 | /usr/include/sys/_types/_ucontext.h: 84 | 85 | /usr/include/sys/_types/_pthread_attr_t.h: 86 | 87 | /usr/include/sys/_types/_sigset_t.h: 88 | 89 | /usr/include/sys/_types/_size_t.h: 90 | 91 | /usr/include/sys/_types/_uid_t.h: 92 | 93 | /usr/include/sys/resource.h: 94 | 95 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include/stdint.h: 96 | 97 | /usr/include/stdint.h: 98 | 99 | /usr/include/sys/_types/_int8_t.h: 100 | 101 | /usr/include/sys/_types/_int16_t.h: 102 | 103 | /usr/include/sys/_types/_int32_t.h: 104 | 105 | /usr/include/sys/_types/_int64_t.h: 106 | 107 | /usr/include/_types/_uint8_t.h: 108 | 109 | /usr/include/_types/_uint16_t.h: 110 | 111 | /usr/include/_types/_uint32_t.h: 112 | 113 | /usr/include/_types/_uint64_t.h: 114 | 115 | /usr/include/sys/_types/_intptr_t.h: 116 | 117 | /usr/include/sys/_types/_uintptr_t.h: 118 | 119 | /usr/include/_types/_intmax_t.h: 120 | 121 | /usr/include/_types/_uintmax_t.h: 122 | 123 | /usr/include/sys/_types/_timeval.h: 124 | 125 | /usr/include/machine/endian.h: 126 | 127 | /usr/include/i386/endian.h: 128 | 129 | /usr/include/sys/_endian.h: 130 | 131 | /usr/include/libkern/_OSByteOrder.h: 132 | 133 | /usr/include/libkern/i386/_OSByteOrder.h: 134 | 135 | /usr/include/alloca.h: 136 | 137 | /usr/include/sys/_types/_ct_rune_t.h: 138 | 139 | /usr/include/sys/_types/_rune_t.h: 140 | 141 | /usr/include/sys/_types/_wchar_t.h: 142 | 143 | /usr/include/sys/_types/_null.h: 144 | 145 | /usr/include/machine/types.h: 146 | 147 | /usr/include/i386/types.h: 148 | 149 | /usr/include/sys/_types/___offsetof.h: 150 | 151 | /usr/include/sys/_types/_dev_t.h: 152 | 153 | /usr/include/sys/_types/_mode_t.h: 154 | 155 | /usr/include/string.h: 156 | 157 | /usr/include/sys/_types/_rsize_t.h: 158 | 159 | /usr/include/sys/_types/_errno_t.h: 160 | 161 | /usr/include/sys/_types/_ssize_t.h: 162 | 163 | /usr/include/strings.h: 164 | 165 | /usr/include/secure/_string.h: 166 | 167 | /usr/include/secure/_common.h: 168 | 169 | /usr/include/errno.h: 170 | 171 | /usr/include/sys/errno.h: 172 | 173 | qrencode.h: 174 | 175 | qrinput.h: 176 | 177 | bitstream.h: 178 | 179 | qrspec.h: 180 | 181 | split.h: 182 | -------------------------------------------------------------------------------- /qrencode/.deps/bitstream.Plo: -------------------------------------------------------------------------------- 1 | bitstream.lo: bitstream.c config.h /usr/include/stdio.h \ 2 | /usr/include/sys/cdefs.h /usr/include/sys/_symbol_aliasing.h \ 3 | /usr/include/sys/_posix_availability.h /usr/include/Availability.h \ 4 | /usr/include/AvailabilityInternal.h /usr/include/_types.h \ 5 | /usr/include/sys/_types.h /usr/include/machine/_types.h \ 6 | /usr/include/i386/_types.h /usr/include/sys/_types/_va_list.h \ 7 | /usr/include/sys/_types/_size_t.h /usr/include/sys/_types/_null.h \ 8 | /usr/include/sys/_types/_off_t.h /usr/include/sys/_types/_ssize_t.h \ 9 | /usr/include/secure/_stdio.h /usr/include/secure/_common.h \ 10 | /usr/include/stdlib.h /usr/include/sys/wait.h \ 11 | /usr/include/sys/_types/_pid_t.h /usr/include/sys/_types/_id_t.h \ 12 | /usr/include/sys/signal.h /usr/include/sys/appleapiopts.h \ 13 | /usr/include/machine/signal.h /usr/include/i386/signal.h \ 14 | /usr/include/machine/_mcontext.h /usr/include/i386/_mcontext.h \ 15 | /usr/include/mach/i386/_structs.h \ 16 | /usr/include/sys/_types/_sigaltstack.h \ 17 | /usr/include/sys/_types/_ucontext.h \ 18 | /usr/include/sys/_types/_pthread_attr_t.h \ 19 | /usr/include/sys/_types/_sigset_t.h /usr/include/sys/_types/_uid_t.h \ 20 | /usr/include/sys/resource.h \ 21 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include/stdint.h \ 22 | /usr/include/stdint.h /usr/include/sys/_types/_int8_t.h \ 23 | /usr/include/sys/_types/_int16_t.h /usr/include/sys/_types/_int32_t.h \ 24 | /usr/include/sys/_types/_int64_t.h /usr/include/_types/_uint8_t.h \ 25 | /usr/include/_types/_uint16_t.h /usr/include/_types/_uint32_t.h \ 26 | /usr/include/_types/_uint64_t.h /usr/include/sys/_types/_intptr_t.h \ 27 | /usr/include/sys/_types/_uintptr_t.h /usr/include/_types/_intmax_t.h \ 28 | /usr/include/_types/_uintmax_t.h /usr/include/sys/_types/_timeval.h \ 29 | /usr/include/machine/endian.h /usr/include/i386/endian.h \ 30 | /usr/include/sys/_endian.h /usr/include/libkern/_OSByteOrder.h \ 31 | /usr/include/libkern/i386/_OSByteOrder.h /usr/include/alloca.h \ 32 | /usr/include/sys/_types/_ct_rune_t.h /usr/include/sys/_types/_rune_t.h \ 33 | /usr/include/sys/_types/_wchar_t.h /usr/include/machine/types.h \ 34 | /usr/include/i386/types.h /usr/include/sys/_types/___offsetof.h \ 35 | /usr/include/sys/_types/_dev_t.h /usr/include/sys/_types/_mode_t.h \ 36 | /usr/include/string.h /usr/include/sys/_types/_rsize_t.h \ 37 | /usr/include/sys/_types/_errno_t.h /usr/include/strings.h \ 38 | /usr/include/secure/_string.h bitstream.h 39 | 40 | config.h: 41 | 42 | /usr/include/stdio.h: 43 | 44 | /usr/include/sys/cdefs.h: 45 | 46 | /usr/include/sys/_symbol_aliasing.h: 47 | 48 | /usr/include/sys/_posix_availability.h: 49 | 50 | /usr/include/Availability.h: 51 | 52 | /usr/include/AvailabilityInternal.h: 53 | 54 | /usr/include/_types.h: 55 | 56 | /usr/include/sys/_types.h: 57 | 58 | /usr/include/machine/_types.h: 59 | 60 | /usr/include/i386/_types.h: 61 | 62 | /usr/include/sys/_types/_va_list.h: 63 | 64 | /usr/include/sys/_types/_size_t.h: 65 | 66 | /usr/include/sys/_types/_null.h: 67 | 68 | /usr/include/sys/_types/_off_t.h: 69 | 70 | /usr/include/sys/_types/_ssize_t.h: 71 | 72 | /usr/include/secure/_stdio.h: 73 | 74 | /usr/include/secure/_common.h: 75 | 76 | /usr/include/stdlib.h: 77 | 78 | /usr/include/sys/wait.h: 79 | 80 | /usr/include/sys/_types/_pid_t.h: 81 | 82 | /usr/include/sys/_types/_id_t.h: 83 | 84 | /usr/include/sys/signal.h: 85 | 86 | /usr/include/sys/appleapiopts.h: 87 | 88 | /usr/include/machine/signal.h: 89 | 90 | /usr/include/i386/signal.h: 91 | 92 | /usr/include/machine/_mcontext.h: 93 | 94 | /usr/include/i386/_mcontext.h: 95 | 96 | /usr/include/mach/i386/_structs.h: 97 | 98 | /usr/include/sys/_types/_sigaltstack.h: 99 | 100 | /usr/include/sys/_types/_ucontext.h: 101 | 102 | /usr/include/sys/_types/_pthread_attr_t.h: 103 | 104 | /usr/include/sys/_types/_sigset_t.h: 105 | 106 | /usr/include/sys/_types/_uid_t.h: 107 | 108 | /usr/include/sys/resource.h: 109 | 110 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include/stdint.h: 111 | 112 | /usr/include/stdint.h: 113 | 114 | /usr/include/sys/_types/_int8_t.h: 115 | 116 | /usr/include/sys/_types/_int16_t.h: 117 | 118 | /usr/include/sys/_types/_int32_t.h: 119 | 120 | /usr/include/sys/_types/_int64_t.h: 121 | 122 | /usr/include/_types/_uint8_t.h: 123 | 124 | /usr/include/_types/_uint16_t.h: 125 | 126 | /usr/include/_types/_uint32_t.h: 127 | 128 | /usr/include/_types/_uint64_t.h: 129 | 130 | /usr/include/sys/_types/_intptr_t.h: 131 | 132 | /usr/include/sys/_types/_uintptr_t.h: 133 | 134 | /usr/include/_types/_intmax_t.h: 135 | 136 | /usr/include/_types/_uintmax_t.h: 137 | 138 | /usr/include/sys/_types/_timeval.h: 139 | 140 | /usr/include/machine/endian.h: 141 | 142 | /usr/include/i386/endian.h: 143 | 144 | /usr/include/sys/_endian.h: 145 | 146 | /usr/include/libkern/_OSByteOrder.h: 147 | 148 | /usr/include/libkern/i386/_OSByteOrder.h: 149 | 150 | /usr/include/alloca.h: 151 | 152 | /usr/include/sys/_types/_ct_rune_t.h: 153 | 154 | /usr/include/sys/_types/_rune_t.h: 155 | 156 | /usr/include/sys/_types/_wchar_t.h: 157 | 158 | /usr/include/machine/types.h: 159 | 160 | /usr/include/i386/types.h: 161 | 162 | /usr/include/sys/_types/___offsetof.h: 163 | 164 | /usr/include/sys/_types/_dev_t.h: 165 | 166 | /usr/include/sys/_types/_mode_t.h: 167 | 168 | /usr/include/string.h: 169 | 170 | /usr/include/sys/_types/_rsize_t.h: 171 | 172 | /usr/include/sys/_types/_errno_t.h: 173 | 174 | /usr/include/strings.h: 175 | 176 | /usr/include/secure/_string.h: 177 | 178 | bitstream.h: 179 | -------------------------------------------------------------------------------- /qrencode/.deps/qrinput.Plo: -------------------------------------------------------------------------------- 1 | qrinput.lo: qrinput.c config.h /usr/include/stdio.h \ 2 | /usr/include/sys/cdefs.h /usr/include/sys/_symbol_aliasing.h \ 3 | /usr/include/sys/_posix_availability.h /usr/include/Availability.h \ 4 | /usr/include/AvailabilityInternal.h /usr/include/_types.h \ 5 | /usr/include/sys/_types.h /usr/include/machine/_types.h \ 6 | /usr/include/i386/_types.h /usr/include/sys/_types/_va_list.h \ 7 | /usr/include/sys/_types/_size_t.h /usr/include/sys/_types/_null.h \ 8 | /usr/include/sys/_types/_off_t.h /usr/include/sys/_types/_ssize_t.h \ 9 | /usr/include/secure/_stdio.h /usr/include/secure/_common.h \ 10 | /usr/include/stdlib.h /usr/include/sys/wait.h \ 11 | /usr/include/sys/_types/_pid_t.h /usr/include/sys/_types/_id_t.h \ 12 | /usr/include/sys/signal.h /usr/include/sys/appleapiopts.h \ 13 | /usr/include/machine/signal.h /usr/include/i386/signal.h \ 14 | /usr/include/machine/_mcontext.h /usr/include/i386/_mcontext.h \ 15 | /usr/include/mach/i386/_structs.h \ 16 | /usr/include/sys/_types/_sigaltstack.h \ 17 | /usr/include/sys/_types/_ucontext.h \ 18 | /usr/include/sys/_types/_pthread_attr_t.h \ 19 | /usr/include/sys/_types/_sigset_t.h /usr/include/sys/_types/_uid_t.h \ 20 | /usr/include/sys/resource.h \ 21 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include/stdint.h \ 22 | /usr/include/stdint.h /usr/include/sys/_types/_int8_t.h \ 23 | /usr/include/sys/_types/_int16_t.h /usr/include/sys/_types/_int32_t.h \ 24 | /usr/include/sys/_types/_int64_t.h /usr/include/_types/_uint8_t.h \ 25 | /usr/include/_types/_uint16_t.h /usr/include/_types/_uint32_t.h \ 26 | /usr/include/_types/_uint64_t.h /usr/include/sys/_types/_intptr_t.h \ 27 | /usr/include/sys/_types/_uintptr_t.h /usr/include/_types/_intmax_t.h \ 28 | /usr/include/_types/_uintmax_t.h /usr/include/sys/_types/_timeval.h \ 29 | /usr/include/machine/endian.h /usr/include/i386/endian.h \ 30 | /usr/include/sys/_endian.h /usr/include/libkern/_OSByteOrder.h \ 31 | /usr/include/libkern/i386/_OSByteOrder.h /usr/include/alloca.h \ 32 | /usr/include/sys/_types/_ct_rune_t.h /usr/include/sys/_types/_rune_t.h \ 33 | /usr/include/sys/_types/_wchar_t.h /usr/include/machine/types.h \ 34 | /usr/include/i386/types.h /usr/include/sys/_types/___offsetof.h \ 35 | /usr/include/sys/_types/_dev_t.h /usr/include/sys/_types/_mode_t.h \ 36 | /usr/include/string.h /usr/include/sys/_types/_rsize_t.h \ 37 | /usr/include/sys/_types/_errno_t.h /usr/include/strings.h \ 38 | /usr/include/secure/_string.h /usr/include/errno.h \ 39 | /usr/include/sys/errno.h qrencode.h qrspec.h mqrspec.h bitstream.h \ 40 | qrinput.h 41 | 42 | config.h: 43 | 44 | /usr/include/stdio.h: 45 | 46 | /usr/include/sys/cdefs.h: 47 | 48 | /usr/include/sys/_symbol_aliasing.h: 49 | 50 | /usr/include/sys/_posix_availability.h: 51 | 52 | /usr/include/Availability.h: 53 | 54 | /usr/include/AvailabilityInternal.h: 55 | 56 | /usr/include/_types.h: 57 | 58 | /usr/include/sys/_types.h: 59 | 60 | /usr/include/machine/_types.h: 61 | 62 | /usr/include/i386/_types.h: 63 | 64 | /usr/include/sys/_types/_va_list.h: 65 | 66 | /usr/include/sys/_types/_size_t.h: 67 | 68 | /usr/include/sys/_types/_null.h: 69 | 70 | /usr/include/sys/_types/_off_t.h: 71 | 72 | /usr/include/sys/_types/_ssize_t.h: 73 | 74 | /usr/include/secure/_stdio.h: 75 | 76 | /usr/include/secure/_common.h: 77 | 78 | /usr/include/stdlib.h: 79 | 80 | /usr/include/sys/wait.h: 81 | 82 | /usr/include/sys/_types/_pid_t.h: 83 | 84 | /usr/include/sys/_types/_id_t.h: 85 | 86 | /usr/include/sys/signal.h: 87 | 88 | /usr/include/sys/appleapiopts.h: 89 | 90 | /usr/include/machine/signal.h: 91 | 92 | /usr/include/i386/signal.h: 93 | 94 | /usr/include/machine/_mcontext.h: 95 | 96 | /usr/include/i386/_mcontext.h: 97 | 98 | /usr/include/mach/i386/_structs.h: 99 | 100 | /usr/include/sys/_types/_sigaltstack.h: 101 | 102 | /usr/include/sys/_types/_ucontext.h: 103 | 104 | /usr/include/sys/_types/_pthread_attr_t.h: 105 | 106 | /usr/include/sys/_types/_sigset_t.h: 107 | 108 | /usr/include/sys/_types/_uid_t.h: 109 | 110 | /usr/include/sys/resource.h: 111 | 112 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include/stdint.h: 113 | 114 | /usr/include/stdint.h: 115 | 116 | /usr/include/sys/_types/_int8_t.h: 117 | 118 | /usr/include/sys/_types/_int16_t.h: 119 | 120 | /usr/include/sys/_types/_int32_t.h: 121 | 122 | /usr/include/sys/_types/_int64_t.h: 123 | 124 | /usr/include/_types/_uint8_t.h: 125 | 126 | /usr/include/_types/_uint16_t.h: 127 | 128 | /usr/include/_types/_uint32_t.h: 129 | 130 | /usr/include/_types/_uint64_t.h: 131 | 132 | /usr/include/sys/_types/_intptr_t.h: 133 | 134 | /usr/include/sys/_types/_uintptr_t.h: 135 | 136 | /usr/include/_types/_intmax_t.h: 137 | 138 | /usr/include/_types/_uintmax_t.h: 139 | 140 | /usr/include/sys/_types/_timeval.h: 141 | 142 | /usr/include/machine/endian.h: 143 | 144 | /usr/include/i386/endian.h: 145 | 146 | /usr/include/sys/_endian.h: 147 | 148 | /usr/include/libkern/_OSByteOrder.h: 149 | 150 | /usr/include/libkern/i386/_OSByteOrder.h: 151 | 152 | /usr/include/alloca.h: 153 | 154 | /usr/include/sys/_types/_ct_rune_t.h: 155 | 156 | /usr/include/sys/_types/_rune_t.h: 157 | 158 | /usr/include/sys/_types/_wchar_t.h: 159 | 160 | /usr/include/machine/types.h: 161 | 162 | /usr/include/i386/types.h: 163 | 164 | /usr/include/sys/_types/___offsetof.h: 165 | 166 | /usr/include/sys/_types/_dev_t.h: 167 | 168 | /usr/include/sys/_types/_mode_t.h: 169 | 170 | /usr/include/string.h: 171 | 172 | /usr/include/sys/_types/_rsize_t.h: 173 | 174 | /usr/include/sys/_types/_errno_t.h: 175 | 176 | /usr/include/strings.h: 177 | 178 | /usr/include/secure/_string.h: 179 | 180 | /usr/include/errno.h: 181 | 182 | /usr/include/sys/errno.h: 183 | 184 | qrencode.h: 185 | 186 | qrspec.h: 187 | 188 | mqrspec.h: 189 | 190 | bitstream.h: 191 | 192 | qrinput.h: 193 | -------------------------------------------------------------------------------- /qrencode/.deps/qrencode.Plo: -------------------------------------------------------------------------------- 1 | qrencode.lo: qrencode.c config.h /usr/include/stdio.h \ 2 | /usr/include/sys/cdefs.h /usr/include/sys/_symbol_aliasing.h \ 3 | /usr/include/sys/_posix_availability.h /usr/include/Availability.h \ 4 | /usr/include/AvailabilityInternal.h /usr/include/_types.h \ 5 | /usr/include/sys/_types.h /usr/include/machine/_types.h \ 6 | /usr/include/i386/_types.h /usr/include/sys/_types/_va_list.h \ 7 | /usr/include/sys/_types/_size_t.h /usr/include/sys/_types/_null.h \ 8 | /usr/include/sys/_types/_off_t.h /usr/include/sys/_types/_ssize_t.h \ 9 | /usr/include/secure/_stdio.h /usr/include/secure/_common.h \ 10 | /usr/include/stdlib.h /usr/include/sys/wait.h \ 11 | /usr/include/sys/_types/_pid_t.h /usr/include/sys/_types/_id_t.h \ 12 | /usr/include/sys/signal.h /usr/include/sys/appleapiopts.h \ 13 | /usr/include/machine/signal.h /usr/include/i386/signal.h \ 14 | /usr/include/machine/_mcontext.h /usr/include/i386/_mcontext.h \ 15 | /usr/include/mach/i386/_structs.h \ 16 | /usr/include/sys/_types/_sigaltstack.h \ 17 | /usr/include/sys/_types/_ucontext.h \ 18 | /usr/include/sys/_types/_pthread_attr_t.h \ 19 | /usr/include/sys/_types/_sigset_t.h /usr/include/sys/_types/_uid_t.h \ 20 | /usr/include/sys/resource.h \ 21 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include/stdint.h \ 22 | /usr/include/stdint.h /usr/include/sys/_types/_int8_t.h \ 23 | /usr/include/sys/_types/_int16_t.h /usr/include/sys/_types/_int32_t.h \ 24 | /usr/include/sys/_types/_int64_t.h /usr/include/_types/_uint8_t.h \ 25 | /usr/include/_types/_uint16_t.h /usr/include/_types/_uint32_t.h \ 26 | /usr/include/_types/_uint64_t.h /usr/include/sys/_types/_intptr_t.h \ 27 | /usr/include/sys/_types/_uintptr_t.h /usr/include/_types/_intmax_t.h \ 28 | /usr/include/_types/_uintmax_t.h /usr/include/sys/_types/_timeval.h \ 29 | /usr/include/machine/endian.h /usr/include/i386/endian.h \ 30 | /usr/include/sys/_endian.h /usr/include/libkern/_OSByteOrder.h \ 31 | /usr/include/libkern/i386/_OSByteOrder.h /usr/include/alloca.h \ 32 | /usr/include/sys/_types/_ct_rune_t.h /usr/include/sys/_types/_rune_t.h \ 33 | /usr/include/sys/_types/_wchar_t.h /usr/include/machine/types.h \ 34 | /usr/include/i386/types.h /usr/include/sys/_types/___offsetof.h \ 35 | /usr/include/sys/_types/_dev_t.h /usr/include/sys/_types/_mode_t.h \ 36 | /usr/include/string.h /usr/include/sys/_types/_rsize_t.h \ 37 | /usr/include/sys/_types/_errno_t.h /usr/include/strings.h \ 38 | /usr/include/secure/_string.h /usr/include/errno.h \ 39 | /usr/include/sys/errno.h qrencode.h qrspec.h mqrspec.h bitstream.h \ 40 | qrinput.h rscode.h split.h mask.h mmask.h 41 | 42 | config.h: 43 | 44 | /usr/include/stdio.h: 45 | 46 | /usr/include/sys/cdefs.h: 47 | 48 | /usr/include/sys/_symbol_aliasing.h: 49 | 50 | /usr/include/sys/_posix_availability.h: 51 | 52 | /usr/include/Availability.h: 53 | 54 | /usr/include/AvailabilityInternal.h: 55 | 56 | /usr/include/_types.h: 57 | 58 | /usr/include/sys/_types.h: 59 | 60 | /usr/include/machine/_types.h: 61 | 62 | /usr/include/i386/_types.h: 63 | 64 | /usr/include/sys/_types/_va_list.h: 65 | 66 | /usr/include/sys/_types/_size_t.h: 67 | 68 | /usr/include/sys/_types/_null.h: 69 | 70 | /usr/include/sys/_types/_off_t.h: 71 | 72 | /usr/include/sys/_types/_ssize_t.h: 73 | 74 | /usr/include/secure/_stdio.h: 75 | 76 | /usr/include/secure/_common.h: 77 | 78 | /usr/include/stdlib.h: 79 | 80 | /usr/include/sys/wait.h: 81 | 82 | /usr/include/sys/_types/_pid_t.h: 83 | 84 | /usr/include/sys/_types/_id_t.h: 85 | 86 | /usr/include/sys/signal.h: 87 | 88 | /usr/include/sys/appleapiopts.h: 89 | 90 | /usr/include/machine/signal.h: 91 | 92 | /usr/include/i386/signal.h: 93 | 94 | /usr/include/machine/_mcontext.h: 95 | 96 | /usr/include/i386/_mcontext.h: 97 | 98 | /usr/include/mach/i386/_structs.h: 99 | 100 | /usr/include/sys/_types/_sigaltstack.h: 101 | 102 | /usr/include/sys/_types/_ucontext.h: 103 | 104 | /usr/include/sys/_types/_pthread_attr_t.h: 105 | 106 | /usr/include/sys/_types/_sigset_t.h: 107 | 108 | /usr/include/sys/_types/_uid_t.h: 109 | 110 | /usr/include/sys/resource.h: 111 | 112 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include/stdint.h: 113 | 114 | /usr/include/stdint.h: 115 | 116 | /usr/include/sys/_types/_int8_t.h: 117 | 118 | /usr/include/sys/_types/_int16_t.h: 119 | 120 | /usr/include/sys/_types/_int32_t.h: 121 | 122 | /usr/include/sys/_types/_int64_t.h: 123 | 124 | /usr/include/_types/_uint8_t.h: 125 | 126 | /usr/include/_types/_uint16_t.h: 127 | 128 | /usr/include/_types/_uint32_t.h: 129 | 130 | /usr/include/_types/_uint64_t.h: 131 | 132 | /usr/include/sys/_types/_intptr_t.h: 133 | 134 | /usr/include/sys/_types/_uintptr_t.h: 135 | 136 | /usr/include/_types/_intmax_t.h: 137 | 138 | /usr/include/_types/_uintmax_t.h: 139 | 140 | /usr/include/sys/_types/_timeval.h: 141 | 142 | /usr/include/machine/endian.h: 143 | 144 | /usr/include/i386/endian.h: 145 | 146 | /usr/include/sys/_endian.h: 147 | 148 | /usr/include/libkern/_OSByteOrder.h: 149 | 150 | /usr/include/libkern/i386/_OSByteOrder.h: 151 | 152 | /usr/include/alloca.h: 153 | 154 | /usr/include/sys/_types/_ct_rune_t.h: 155 | 156 | /usr/include/sys/_types/_rune_t.h: 157 | 158 | /usr/include/sys/_types/_wchar_t.h: 159 | 160 | /usr/include/machine/types.h: 161 | 162 | /usr/include/i386/types.h: 163 | 164 | /usr/include/sys/_types/___offsetof.h: 165 | 166 | /usr/include/sys/_types/_dev_t.h: 167 | 168 | /usr/include/sys/_types/_mode_t.h: 169 | 170 | /usr/include/string.h: 171 | 172 | /usr/include/sys/_types/_rsize_t.h: 173 | 174 | /usr/include/sys/_types/_errno_t.h: 175 | 176 | /usr/include/strings.h: 177 | 178 | /usr/include/secure/_string.h: 179 | 180 | /usr/include/errno.h: 181 | 182 | /usr/include/sys/errno.h: 183 | 184 | qrencode.h: 185 | 186 | qrspec.h: 187 | 188 | mqrspec.h: 189 | 190 | bitstream.h: 191 | 192 | qrinput.h: 193 | 194 | rscode.h: 195 | 196 | split.h: 197 | 198 | mask.h: 199 | 200 | mmask.h: 201 | -------------------------------------------------------------------------------- /qrencode/.deps/mask.Plo: -------------------------------------------------------------------------------- 1 | mask.lo: mask.c config.h /usr/include/stdlib.h \ 2 | /usr/include/Availability.h /usr/include/AvailabilityInternal.h \ 3 | /usr/include/_types.h /usr/include/sys/_types.h \ 4 | /usr/include/sys/cdefs.h /usr/include/sys/_symbol_aliasing.h \ 5 | /usr/include/sys/_posix_availability.h /usr/include/machine/_types.h \ 6 | /usr/include/i386/_types.h /usr/include/sys/wait.h \ 7 | /usr/include/sys/_types/_pid_t.h /usr/include/sys/_types/_id_t.h \ 8 | /usr/include/sys/signal.h /usr/include/sys/appleapiopts.h \ 9 | /usr/include/machine/signal.h /usr/include/i386/signal.h \ 10 | /usr/include/machine/_mcontext.h /usr/include/i386/_mcontext.h \ 11 | /usr/include/mach/i386/_structs.h \ 12 | /usr/include/sys/_types/_sigaltstack.h \ 13 | /usr/include/sys/_types/_ucontext.h \ 14 | /usr/include/sys/_types/_pthread_attr_t.h \ 15 | /usr/include/sys/_types/_sigset_t.h /usr/include/sys/_types/_size_t.h \ 16 | /usr/include/sys/_types/_uid_t.h /usr/include/sys/resource.h \ 17 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include/stdint.h \ 18 | /usr/include/stdint.h /usr/include/sys/_types/_int8_t.h \ 19 | /usr/include/sys/_types/_int16_t.h /usr/include/sys/_types/_int32_t.h \ 20 | /usr/include/sys/_types/_int64_t.h /usr/include/_types/_uint8_t.h \ 21 | /usr/include/_types/_uint16_t.h /usr/include/_types/_uint32_t.h \ 22 | /usr/include/_types/_uint64_t.h /usr/include/sys/_types/_intptr_t.h \ 23 | /usr/include/sys/_types/_uintptr_t.h /usr/include/_types/_intmax_t.h \ 24 | /usr/include/_types/_uintmax_t.h /usr/include/sys/_types/_timeval.h \ 25 | /usr/include/machine/endian.h /usr/include/i386/endian.h \ 26 | /usr/include/sys/_endian.h /usr/include/libkern/_OSByteOrder.h \ 27 | /usr/include/libkern/i386/_OSByteOrder.h /usr/include/alloca.h \ 28 | /usr/include/sys/_types/_ct_rune_t.h /usr/include/sys/_types/_rune_t.h \ 29 | /usr/include/sys/_types/_wchar_t.h /usr/include/sys/_types/_null.h \ 30 | /usr/include/machine/types.h /usr/include/i386/types.h \ 31 | /usr/include/sys/_types/___offsetof.h /usr/include/sys/_types/_dev_t.h \ 32 | /usr/include/sys/_types/_mode_t.h /usr/include/string.h \ 33 | /usr/include/sys/_types/_rsize_t.h /usr/include/sys/_types/_errno_t.h \ 34 | /usr/include/sys/_types/_ssize_t.h /usr/include/strings.h \ 35 | /usr/include/secure/_string.h /usr/include/secure/_common.h \ 36 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include/limits.h \ 37 | /usr/include/limits.h /usr/include/machine/limits.h \ 38 | /usr/include/i386/limits.h /usr/include/i386/_limits.h \ 39 | /usr/include/sys/syslimits.h /usr/include/errno.h \ 40 | /usr/include/sys/errno.h qrencode.h qrspec.h mask.h 41 | 42 | config.h: 43 | 44 | /usr/include/stdlib.h: 45 | 46 | /usr/include/Availability.h: 47 | 48 | /usr/include/AvailabilityInternal.h: 49 | 50 | /usr/include/_types.h: 51 | 52 | /usr/include/sys/_types.h: 53 | 54 | /usr/include/sys/cdefs.h: 55 | 56 | /usr/include/sys/_symbol_aliasing.h: 57 | 58 | /usr/include/sys/_posix_availability.h: 59 | 60 | /usr/include/machine/_types.h: 61 | 62 | /usr/include/i386/_types.h: 63 | 64 | /usr/include/sys/wait.h: 65 | 66 | /usr/include/sys/_types/_pid_t.h: 67 | 68 | /usr/include/sys/_types/_id_t.h: 69 | 70 | /usr/include/sys/signal.h: 71 | 72 | /usr/include/sys/appleapiopts.h: 73 | 74 | /usr/include/machine/signal.h: 75 | 76 | /usr/include/i386/signal.h: 77 | 78 | /usr/include/machine/_mcontext.h: 79 | 80 | /usr/include/i386/_mcontext.h: 81 | 82 | /usr/include/mach/i386/_structs.h: 83 | 84 | /usr/include/sys/_types/_sigaltstack.h: 85 | 86 | /usr/include/sys/_types/_ucontext.h: 87 | 88 | /usr/include/sys/_types/_pthread_attr_t.h: 89 | 90 | /usr/include/sys/_types/_sigset_t.h: 91 | 92 | /usr/include/sys/_types/_size_t.h: 93 | 94 | /usr/include/sys/_types/_uid_t.h: 95 | 96 | /usr/include/sys/resource.h: 97 | 98 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include/stdint.h: 99 | 100 | /usr/include/stdint.h: 101 | 102 | /usr/include/sys/_types/_int8_t.h: 103 | 104 | /usr/include/sys/_types/_int16_t.h: 105 | 106 | /usr/include/sys/_types/_int32_t.h: 107 | 108 | /usr/include/sys/_types/_int64_t.h: 109 | 110 | /usr/include/_types/_uint8_t.h: 111 | 112 | /usr/include/_types/_uint16_t.h: 113 | 114 | /usr/include/_types/_uint32_t.h: 115 | 116 | /usr/include/_types/_uint64_t.h: 117 | 118 | /usr/include/sys/_types/_intptr_t.h: 119 | 120 | /usr/include/sys/_types/_uintptr_t.h: 121 | 122 | /usr/include/_types/_intmax_t.h: 123 | 124 | /usr/include/_types/_uintmax_t.h: 125 | 126 | /usr/include/sys/_types/_timeval.h: 127 | 128 | /usr/include/machine/endian.h: 129 | 130 | /usr/include/i386/endian.h: 131 | 132 | /usr/include/sys/_endian.h: 133 | 134 | /usr/include/libkern/_OSByteOrder.h: 135 | 136 | /usr/include/libkern/i386/_OSByteOrder.h: 137 | 138 | /usr/include/alloca.h: 139 | 140 | /usr/include/sys/_types/_ct_rune_t.h: 141 | 142 | /usr/include/sys/_types/_rune_t.h: 143 | 144 | /usr/include/sys/_types/_wchar_t.h: 145 | 146 | /usr/include/sys/_types/_null.h: 147 | 148 | /usr/include/machine/types.h: 149 | 150 | /usr/include/i386/types.h: 151 | 152 | /usr/include/sys/_types/___offsetof.h: 153 | 154 | /usr/include/sys/_types/_dev_t.h: 155 | 156 | /usr/include/sys/_types/_mode_t.h: 157 | 158 | /usr/include/string.h: 159 | 160 | /usr/include/sys/_types/_rsize_t.h: 161 | 162 | /usr/include/sys/_types/_errno_t.h: 163 | 164 | /usr/include/sys/_types/_ssize_t.h: 165 | 166 | /usr/include/strings.h: 167 | 168 | /usr/include/secure/_string.h: 169 | 170 | /usr/include/secure/_common.h: 171 | 172 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include/limits.h: 173 | 174 | /usr/include/limits.h: 175 | 176 | /usr/include/machine/limits.h: 177 | 178 | /usr/include/i386/limits.h: 179 | 180 | /usr/include/i386/_limits.h: 181 | 182 | /usr/include/sys/syslimits.h: 183 | 184 | /usr/include/errno.h: 185 | 186 | /usr/include/sys/errno.h: 187 | 188 | qrencode.h: 189 | 190 | qrspec.h: 191 | 192 | mask.h: 193 | -------------------------------------------------------------------------------- /qrencode/.deps/mmask.Plo: -------------------------------------------------------------------------------- 1 | mmask.lo: mmask.c config.h /usr/include/stdlib.h \ 2 | /usr/include/Availability.h /usr/include/AvailabilityInternal.h \ 3 | /usr/include/_types.h /usr/include/sys/_types.h \ 4 | /usr/include/sys/cdefs.h /usr/include/sys/_symbol_aliasing.h \ 5 | /usr/include/sys/_posix_availability.h /usr/include/machine/_types.h \ 6 | /usr/include/i386/_types.h /usr/include/sys/wait.h \ 7 | /usr/include/sys/_types/_pid_t.h /usr/include/sys/_types/_id_t.h \ 8 | /usr/include/sys/signal.h /usr/include/sys/appleapiopts.h \ 9 | /usr/include/machine/signal.h /usr/include/i386/signal.h \ 10 | /usr/include/machine/_mcontext.h /usr/include/i386/_mcontext.h \ 11 | /usr/include/mach/i386/_structs.h \ 12 | /usr/include/sys/_types/_sigaltstack.h \ 13 | /usr/include/sys/_types/_ucontext.h \ 14 | /usr/include/sys/_types/_pthread_attr_t.h \ 15 | /usr/include/sys/_types/_sigset_t.h /usr/include/sys/_types/_size_t.h \ 16 | /usr/include/sys/_types/_uid_t.h /usr/include/sys/resource.h \ 17 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include/stdint.h \ 18 | /usr/include/stdint.h /usr/include/sys/_types/_int8_t.h \ 19 | /usr/include/sys/_types/_int16_t.h /usr/include/sys/_types/_int32_t.h \ 20 | /usr/include/sys/_types/_int64_t.h /usr/include/_types/_uint8_t.h \ 21 | /usr/include/_types/_uint16_t.h /usr/include/_types/_uint32_t.h \ 22 | /usr/include/_types/_uint64_t.h /usr/include/sys/_types/_intptr_t.h \ 23 | /usr/include/sys/_types/_uintptr_t.h /usr/include/_types/_intmax_t.h \ 24 | /usr/include/_types/_uintmax_t.h /usr/include/sys/_types/_timeval.h \ 25 | /usr/include/machine/endian.h /usr/include/i386/endian.h \ 26 | /usr/include/sys/_endian.h /usr/include/libkern/_OSByteOrder.h \ 27 | /usr/include/libkern/i386/_OSByteOrder.h /usr/include/alloca.h \ 28 | /usr/include/sys/_types/_ct_rune_t.h /usr/include/sys/_types/_rune_t.h \ 29 | /usr/include/sys/_types/_wchar_t.h /usr/include/sys/_types/_null.h \ 30 | /usr/include/machine/types.h /usr/include/i386/types.h \ 31 | /usr/include/sys/_types/___offsetof.h /usr/include/sys/_types/_dev_t.h \ 32 | /usr/include/sys/_types/_mode_t.h /usr/include/string.h \ 33 | /usr/include/sys/_types/_rsize_t.h /usr/include/sys/_types/_errno_t.h \ 34 | /usr/include/sys/_types/_ssize_t.h /usr/include/strings.h \ 35 | /usr/include/secure/_string.h /usr/include/secure/_common.h \ 36 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include/limits.h \ 37 | /usr/include/limits.h /usr/include/machine/limits.h \ 38 | /usr/include/i386/limits.h /usr/include/i386/_limits.h \ 39 | /usr/include/sys/syslimits.h /usr/include/errno.h \ 40 | /usr/include/sys/errno.h qrencode.h mqrspec.h mmask.h 41 | 42 | config.h: 43 | 44 | /usr/include/stdlib.h: 45 | 46 | /usr/include/Availability.h: 47 | 48 | /usr/include/AvailabilityInternal.h: 49 | 50 | /usr/include/_types.h: 51 | 52 | /usr/include/sys/_types.h: 53 | 54 | /usr/include/sys/cdefs.h: 55 | 56 | /usr/include/sys/_symbol_aliasing.h: 57 | 58 | /usr/include/sys/_posix_availability.h: 59 | 60 | /usr/include/machine/_types.h: 61 | 62 | /usr/include/i386/_types.h: 63 | 64 | /usr/include/sys/wait.h: 65 | 66 | /usr/include/sys/_types/_pid_t.h: 67 | 68 | /usr/include/sys/_types/_id_t.h: 69 | 70 | /usr/include/sys/signal.h: 71 | 72 | /usr/include/sys/appleapiopts.h: 73 | 74 | /usr/include/machine/signal.h: 75 | 76 | /usr/include/i386/signal.h: 77 | 78 | /usr/include/machine/_mcontext.h: 79 | 80 | /usr/include/i386/_mcontext.h: 81 | 82 | /usr/include/mach/i386/_structs.h: 83 | 84 | /usr/include/sys/_types/_sigaltstack.h: 85 | 86 | /usr/include/sys/_types/_ucontext.h: 87 | 88 | /usr/include/sys/_types/_pthread_attr_t.h: 89 | 90 | /usr/include/sys/_types/_sigset_t.h: 91 | 92 | /usr/include/sys/_types/_size_t.h: 93 | 94 | /usr/include/sys/_types/_uid_t.h: 95 | 96 | /usr/include/sys/resource.h: 97 | 98 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include/stdint.h: 99 | 100 | /usr/include/stdint.h: 101 | 102 | /usr/include/sys/_types/_int8_t.h: 103 | 104 | /usr/include/sys/_types/_int16_t.h: 105 | 106 | /usr/include/sys/_types/_int32_t.h: 107 | 108 | /usr/include/sys/_types/_int64_t.h: 109 | 110 | /usr/include/_types/_uint8_t.h: 111 | 112 | /usr/include/_types/_uint16_t.h: 113 | 114 | /usr/include/_types/_uint32_t.h: 115 | 116 | /usr/include/_types/_uint64_t.h: 117 | 118 | /usr/include/sys/_types/_intptr_t.h: 119 | 120 | /usr/include/sys/_types/_uintptr_t.h: 121 | 122 | /usr/include/_types/_intmax_t.h: 123 | 124 | /usr/include/_types/_uintmax_t.h: 125 | 126 | /usr/include/sys/_types/_timeval.h: 127 | 128 | /usr/include/machine/endian.h: 129 | 130 | /usr/include/i386/endian.h: 131 | 132 | /usr/include/sys/_endian.h: 133 | 134 | /usr/include/libkern/_OSByteOrder.h: 135 | 136 | /usr/include/libkern/i386/_OSByteOrder.h: 137 | 138 | /usr/include/alloca.h: 139 | 140 | /usr/include/sys/_types/_ct_rune_t.h: 141 | 142 | /usr/include/sys/_types/_rune_t.h: 143 | 144 | /usr/include/sys/_types/_wchar_t.h: 145 | 146 | /usr/include/sys/_types/_null.h: 147 | 148 | /usr/include/machine/types.h: 149 | 150 | /usr/include/i386/types.h: 151 | 152 | /usr/include/sys/_types/___offsetof.h: 153 | 154 | /usr/include/sys/_types/_dev_t.h: 155 | 156 | /usr/include/sys/_types/_mode_t.h: 157 | 158 | /usr/include/string.h: 159 | 160 | /usr/include/sys/_types/_rsize_t.h: 161 | 162 | /usr/include/sys/_types/_errno_t.h: 163 | 164 | /usr/include/sys/_types/_ssize_t.h: 165 | 166 | /usr/include/strings.h: 167 | 168 | /usr/include/secure/_string.h: 169 | 170 | /usr/include/secure/_common.h: 171 | 172 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include/limits.h: 173 | 174 | /usr/include/limits.h: 175 | 176 | /usr/include/machine/limits.h: 177 | 178 | /usr/include/i386/limits.h: 179 | 180 | /usr/include/i386/_limits.h: 181 | 182 | /usr/include/sys/syslimits.h: 183 | 184 | /usr/include/errno.h: 185 | 186 | /usr/include/sys/errno.h: 187 | 188 | qrencode.h: 189 | 190 | mqrspec.h: 191 | 192 | mmask.h: 193 | -------------------------------------------------------------------------------- /qrencode/tests/test_bitstream.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "common.h" 4 | #include "../bitstream.h" 5 | 6 | void test_null(void) 7 | { 8 | BitStream *bstream; 9 | 10 | testStart("Empty stream"); 11 | bstream = BitStream_new(); 12 | assert_zero(BitStream_size(bstream), "Size of empty BitStream is not 0.\n"); 13 | assert_null(BitStream_toByte(bstream), "BitStream_toByte returned non-NULL.\n"); 14 | assert_nothing(BitStream_free(NULL), "Checking BitStream_free(NULL).\n"); 15 | testFinish(); 16 | 17 | BitStream_free(bstream); 18 | } 19 | 20 | void test_num(void) 21 | { 22 | BitStream *bstream; 23 | unsigned int data = 0x13579bdf; 24 | char correct[] = "0010011010101111001101111011111"; 25 | 26 | testStart("New from num"); 27 | bstream = BitStream_new(); 28 | BitStream_appendNum(bstream, 31, data); 29 | testEnd(cmpBin(correct, bstream)); 30 | 31 | BitStream_free(bstream); 32 | } 33 | 34 | void test_bytes(void) 35 | { 36 | BitStream *bstream; 37 | unsigned char data[1] = {0x3a}; 38 | char correct[] = "00111010"; 39 | 40 | testStart("New from bytes"); 41 | bstream = BitStream_new(); 42 | BitStream_appendBytes(bstream, 1, data); 43 | testEnd(cmpBin(correct, bstream)); 44 | BitStream_free(bstream); 45 | } 46 | 47 | void test_appendNum(void) 48 | { 49 | BitStream *bstream; 50 | char correct[] = "10001010 11111111 11111111 00010010001101000101011001111000"; 51 | 52 | testStart("Append Num"); 53 | bstream = BitStream_new(); 54 | 55 | BitStream_appendNum(bstream, 8, 0x0000008a); 56 | assert_zero(ncmpBin(correct, bstream, 8), "Internal data is incorrect.\n"); 57 | 58 | BitStream_appendNum(bstream, 16, 0x0000ffff); 59 | assert_zero(ncmpBin(correct, bstream, 24), "Internal data is incorrect.\n"); 60 | 61 | BitStream_appendNum(bstream, 32, 0x12345678); 62 | 63 | assert_zero(cmpBin(correct, bstream), "Internal data is incorrect.\n"); 64 | testFinish(); 65 | 66 | BitStream_free(bstream); 67 | } 68 | 69 | void test_appendBytes(void) 70 | { 71 | BitStream *bstream; 72 | unsigned char data[8]; 73 | char correct[] = "10001010111111111111111100010010001101000101011001111000"; 74 | 75 | testStart("Append Bytes"); 76 | bstream = BitStream_new(); 77 | 78 | data[0] = 0x8a; 79 | BitStream_appendBytes(bstream, 1, data); 80 | assert_zero(ncmpBin(correct, bstream, 8), "Internal data is incorrect."); 81 | 82 | data[0] = 0xff; 83 | data[1] = 0xff; 84 | BitStream_appendBytes(bstream, 2, data); 85 | assert_zero(ncmpBin(correct, bstream, 24), "Internal data is incorrect.\n"); 86 | 87 | data[0] = 0x12; 88 | data[1] = 0x34; 89 | data[2] = 0x56; 90 | data[3] = 0x78; 91 | BitStream_appendBytes(bstream, 4, data); 92 | 93 | assert_zero(cmpBin(correct, bstream), "Internal data is incorrect.\n"); 94 | testFinish(); 95 | 96 | BitStream_free(bstream); 97 | } 98 | 99 | void test_toByte(void) 100 | { 101 | BitStream *bstream; 102 | unsigned char correct[] = { 103 | 0x8a, 0xff, 0xff, 0x12, 0x34, 0x56, 0x78 104 | }; 105 | unsigned char *result; 106 | 107 | testStart("Convert to a byte array"); 108 | bstream = BitStream_new(); 109 | 110 | BitStream_appendBytes(bstream, 1, &correct[0]); 111 | BitStream_appendBytes(bstream, 2, &correct[1]); 112 | BitStream_appendBytes(bstream, 4, &correct[3]); 113 | 114 | result = BitStream_toByte(bstream); 115 | testEnd(memcmp(correct, result, 7)); 116 | 117 | BitStream_free(bstream); 118 | free(result); 119 | } 120 | 121 | void test_toByte_4bitpadding(void) 122 | { 123 | BitStream *bstream; 124 | unsigned char *result; 125 | 126 | testStart("Convert to a byte array"); 127 | 128 | bstream = BitStream_new(); 129 | BitStream_appendNum(bstream, 4, 0xb); 130 | result = BitStream_toByte(bstream); 131 | assert_equal(result[0], 0xb, "incorrect paddings\n"); 132 | BitStream_free(bstream); 133 | free(result); 134 | 135 | bstream = BitStream_new(); 136 | BitStream_appendNum(bstream, 12, 0x335); 137 | result = BitStream_toByte(bstream); 138 | assert_equal(result[0], 0x33, "incorrect paddings\n"); 139 | assert_equal(result[1], 0x05, "incorrect paddings\n"); 140 | BitStream_free(bstream); 141 | free(result); 142 | 143 | testFinish(); 144 | 145 | } 146 | 147 | void test_size(void) 148 | { 149 | BitStream *bstream; 150 | 151 | testStart("size check"); 152 | bstream = BitStream_new(); 153 | assert_equal(BitStream_size(bstream), 0, "Initialized BitStream is not 0 length"); 154 | BitStream_appendNum(bstream, 1, 0); 155 | assert_equal(BitStream_size(bstream), 1, "Size incorrect. (first append)"); 156 | BitStream_appendNum(bstream, 2, 0); 157 | assert_equal(BitStream_size(bstream), 3, "Size incorrect. (second append)"); 158 | testFinish(); 159 | 160 | BitStream_free(bstream); 161 | } 162 | 163 | void test_append(void) 164 | { 165 | BitStream *bs1, *bs2; 166 | char c1[] = "00"; 167 | char c2[] = "0011"; 168 | char c3[] = "01111111111111111"; 169 | char c4[] = "001101111111111111111"; 170 | char c5[] = "0011011111111111111111111111111111"; 171 | int ret; 172 | 173 | testStart("Append two BitStreams"); 174 | 175 | bs1 = BitStream_new(); 176 | bs2 = BitStream_new(); 177 | ret = BitStream_appendNum(bs1, 1, 0); 178 | ret = BitStream_appendNum(bs2, 1, 0); 179 | 180 | ret = BitStream_append(bs1, bs2); 181 | assert_zero(ret, "Failed to append."); 182 | assert_zero(cmpBin(c1, bs1), "Internal data is incorrect."); 183 | 184 | ret = BitStream_appendNum(bs1, 2, 3); 185 | assert_zero(ret, "Failed to append."); 186 | assert_zero(cmpBin(c2, bs1), "Internal data is incorrect."); 187 | 188 | ret = BitStream_appendNum(bs2, 16, 65535); 189 | assert_zero(ret, "Failed to append."); 190 | assert_zero(cmpBin(c3, bs2), "Internal data is incorrect."); 191 | 192 | ret = BitStream_append(bs1, bs2); 193 | assert_zero(ret, "Failed to append."); 194 | assert_zero(cmpBin(c4, bs1), "Internal data is incorrect."); 195 | 196 | ret = BitStream_appendNum(bs1, 13, 16383); 197 | assert_zero(ret, "Failed to append."); 198 | assert_zero(cmpBin(c5, bs1), "Internal data is incorrect."); 199 | 200 | testFinish(); 201 | 202 | BitStream_free(bs1); 203 | BitStream_free(bs2); 204 | } 205 | 206 | int main(void) 207 | { 208 | test_null(); 209 | test_num(); 210 | test_bytes(); 211 | test_appendNum(); 212 | test_appendBytes(); 213 | test_toByte(); 214 | test_toByte_4bitpadding(); 215 | test_size(); 216 | test_append(); 217 | 218 | report(); 219 | 220 | return 0; 221 | } 222 | -------------------------------------------------------------------------------- /qrencode/qrspec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qrencode - QR Code encoder 3 | * 4 | * QR Code specification in convenient format. 5 | * Copyright (C) 2006-2011 Kentaro Fukuchi 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef __QRSPEC_H__ 23 | #define __QRSPEC_H__ 24 | 25 | #include "qrencode.h" 26 | 27 | /****************************************************************************** 28 | * Version and capacity 29 | *****************************************************************************/ 30 | 31 | /** 32 | * Maximum width of a symbol 33 | */ 34 | #define QRSPEC_WIDTH_MAX 177 35 | 36 | /** 37 | * Return maximum data code length (bytes) for the version. 38 | * @param version 39 | * @param level 40 | * @return maximum size (bytes) 41 | */ 42 | extern int QRspec_getDataLength(int version, QRecLevel level); 43 | 44 | /** 45 | * Return maximum error correction code length (bytes) for the version. 46 | * @param version 47 | * @param level 48 | * @return ECC size (bytes) 49 | */ 50 | extern int QRspec_getECCLength(int version, QRecLevel level); 51 | 52 | /** 53 | * Return a version number that satisfies the input code length. 54 | * @param size input code length (byte) 55 | * @param level 56 | * @return version number 57 | */ 58 | extern int QRspec_getMinimumVersion(int size, QRecLevel level); 59 | 60 | /** 61 | * Return the width of the symbol for the version. 62 | * @param version 63 | * @return width 64 | */ 65 | extern int QRspec_getWidth(int version); 66 | 67 | /** 68 | * Return the numer of remainder bits. 69 | * @param version 70 | * @return number of remainder bits 71 | */ 72 | extern int QRspec_getRemainder(int version); 73 | 74 | /****************************************************************************** 75 | * Length indicator 76 | *****************************************************************************/ 77 | 78 | /** 79 | * Return the size of lenght indicator for the mode and version. 80 | * @param mode 81 | * @param version 82 | * @return the size of the appropriate length indicator (bits). 83 | */ 84 | extern int QRspec_lengthIndicator(QRencodeMode mode, int version); 85 | 86 | /** 87 | * Return the maximum length for the mode and version. 88 | * @param mode 89 | * @param version 90 | * @return the maximum length (bytes) 91 | */ 92 | extern int QRspec_maximumWords(QRencodeMode mode, int version); 93 | 94 | /****************************************************************************** 95 | * Error correction code 96 | *****************************************************************************/ 97 | 98 | /** 99 | * Return an array of ECC specification. 100 | * @param version 101 | * @param level 102 | * @param spec an array of ECC specification contains as following: 103 | * {# of type1 blocks, # of data code, # of ecc code, 104 | * # of type2 blocks, # of data code} 105 | */ 106 | void QRspec_getEccSpec(int version, QRecLevel level, int spec[5]); 107 | 108 | #define QRspec_rsBlockNum(__spec__) (__spec__[0] + __spec__[3]) 109 | #define QRspec_rsBlockNum1(__spec__) (__spec__[0]) 110 | #define QRspec_rsDataCodes1(__spec__) (__spec__[1]) 111 | #define QRspec_rsEccCodes1(__spec__) (__spec__[2]) 112 | #define QRspec_rsBlockNum2(__spec__) (__spec__[3]) 113 | #define QRspec_rsDataCodes2(__spec__) (__spec__[4]) 114 | #define QRspec_rsEccCodes2(__spec__) (__spec__[2]) 115 | 116 | #define QRspec_rsDataLength(__spec__) \ 117 | ((QRspec_rsBlockNum1(__spec__) * QRspec_rsDataCodes1(__spec__)) + \ 118 | (QRspec_rsBlockNum2(__spec__) * QRspec_rsDataCodes2(__spec__))) 119 | #define QRspec_rsEccLength(__spec__) \ 120 | (QRspec_rsBlockNum(__spec__) * QRspec_rsEccCodes1(__spec__)) 121 | 122 | /****************************************************************************** 123 | * Version information pattern 124 | *****************************************************************************/ 125 | 126 | /** 127 | * Return BCH encoded version information pattern that is used for the symbol 128 | * of version 7 or greater. Use lower 18 bits. 129 | * @param version 130 | * @return BCH encoded version information pattern 131 | */ 132 | extern unsigned int QRspec_getVersionPattern(int version); 133 | 134 | /****************************************************************************** 135 | * Format information 136 | *****************************************************************************/ 137 | 138 | /** 139 | * Return BCH encoded format information pattern. 140 | * @param mask 141 | * @param level 142 | * @return BCH encoded format information pattern 143 | */ 144 | extern unsigned int QRspec_getFormatInfo(int mask, QRecLevel level); 145 | 146 | /****************************************************************************** 147 | * Frame 148 | *****************************************************************************/ 149 | 150 | /** 151 | * Return a copy of initialized frame. 152 | * When the same version is requested twice or more, a copy of cached frame 153 | * is returned. 154 | * @param version 155 | * @return Array of unsigned char. You can free it by free(). 156 | */ 157 | extern unsigned char *QRspec_newFrame(int version); 158 | 159 | /** 160 | * Clear the frame cache. Typically for debug. 161 | */ 162 | extern void QRspec_clearCache(void); 163 | 164 | /****************************************************************************** 165 | * Mode indicator 166 | *****************************************************************************/ 167 | 168 | /** 169 | * Mode indicator. See Table 2 of JIS X0510:2004, pp.16. 170 | */ 171 | #define QRSPEC_MODEID_ECI 7 172 | #define QRSPEC_MODEID_NUM 1 173 | #define QRSPEC_MODEID_AN 2 174 | #define QRSPEC_MODEID_8 4 175 | #define QRSPEC_MODEID_KANJI 8 176 | #define QRSPEC_MODEID_FNC1FIRST 5 177 | #define QRSPEC_MODEID_FNC1SECOND 9 178 | #define QRSPEC_MODEID_STRUCTURE 3 179 | #define QRSPEC_MODEID_TERMINATOR 0 180 | 181 | #endif /* __QRSPEC_H__ */ 182 | -------------------------------------------------------------------------------- /qrencode/.deps/rscode.Plo: -------------------------------------------------------------------------------- 1 | rscode.lo: rscode.c config.h /usr/include/stdlib.h \ 2 | /usr/include/Availability.h /usr/include/AvailabilityInternal.h \ 3 | /usr/include/_types.h /usr/include/sys/_types.h \ 4 | /usr/include/sys/cdefs.h /usr/include/sys/_symbol_aliasing.h \ 5 | /usr/include/sys/_posix_availability.h /usr/include/machine/_types.h \ 6 | /usr/include/i386/_types.h /usr/include/sys/wait.h \ 7 | /usr/include/sys/_types/_pid_t.h /usr/include/sys/_types/_id_t.h \ 8 | /usr/include/sys/signal.h /usr/include/sys/appleapiopts.h \ 9 | /usr/include/machine/signal.h /usr/include/i386/signal.h \ 10 | /usr/include/machine/_mcontext.h /usr/include/i386/_mcontext.h \ 11 | /usr/include/mach/i386/_structs.h \ 12 | /usr/include/sys/_types/_sigaltstack.h \ 13 | /usr/include/sys/_types/_ucontext.h \ 14 | /usr/include/sys/_types/_pthread_attr_t.h \ 15 | /usr/include/sys/_types/_sigset_t.h /usr/include/sys/_types/_size_t.h \ 16 | /usr/include/sys/_types/_uid_t.h /usr/include/sys/resource.h \ 17 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include/stdint.h \ 18 | /usr/include/stdint.h /usr/include/sys/_types/_int8_t.h \ 19 | /usr/include/sys/_types/_int16_t.h /usr/include/sys/_types/_int32_t.h \ 20 | /usr/include/sys/_types/_int64_t.h /usr/include/_types/_uint8_t.h \ 21 | /usr/include/_types/_uint16_t.h /usr/include/_types/_uint32_t.h \ 22 | /usr/include/_types/_uint64_t.h /usr/include/sys/_types/_intptr_t.h \ 23 | /usr/include/sys/_types/_uintptr_t.h /usr/include/_types/_intmax_t.h \ 24 | /usr/include/_types/_uintmax_t.h /usr/include/sys/_types/_timeval.h \ 25 | /usr/include/machine/endian.h /usr/include/i386/endian.h \ 26 | /usr/include/sys/_endian.h /usr/include/libkern/_OSByteOrder.h \ 27 | /usr/include/libkern/i386/_OSByteOrder.h /usr/include/alloca.h \ 28 | /usr/include/sys/_types/_ct_rune_t.h /usr/include/sys/_types/_rune_t.h \ 29 | /usr/include/sys/_types/_wchar_t.h /usr/include/sys/_types/_null.h \ 30 | /usr/include/machine/types.h /usr/include/i386/types.h \ 31 | /usr/include/sys/_types/___offsetof.h /usr/include/sys/_types/_dev_t.h \ 32 | /usr/include/sys/_types/_mode_t.h /usr/include/string.h \ 33 | /usr/include/sys/_types/_rsize_t.h /usr/include/sys/_types/_errno_t.h \ 34 | /usr/include/sys/_types/_ssize_t.h /usr/include/strings.h \ 35 | /usr/include/secure/_string.h /usr/include/secure/_common.h \ 36 | /usr/include/pthread.h /usr/include/pthread_impl.h \ 37 | /usr/include/sched.h /usr/include/time.h /usr/include/_structs.h \ 38 | /usr/include/sys/_structs.h /usr/include/sys/_types/_timespec.h \ 39 | /usr/include/sys/_types/_clock_t.h /usr/include/sys/_types/_time_t.h \ 40 | /usr/include/sys/_types/_pthread_cond_t.h \ 41 | /usr/include/sys/_types/_pthread_condattr_t.h \ 42 | /usr/include/sys/_types/_pthread_key_t.h \ 43 | /usr/include/sys/_types/_pthread_mutex_t.h \ 44 | /usr/include/sys/_types/_pthread_mutexattr_t.h \ 45 | /usr/include/sys/_types/_pthread_once_t.h \ 46 | /usr/include/sys/_types/_pthread_rwlock_t.h \ 47 | /usr/include/sys/_types/_pthread_rwlockattr_t.h \ 48 | /usr/include/sys/_types/_pthread_t.h \ 49 | /usr/include/sys/_types/_mach_port_t.h rscode.h 50 | 51 | config.h: 52 | 53 | /usr/include/stdlib.h: 54 | 55 | /usr/include/Availability.h: 56 | 57 | /usr/include/AvailabilityInternal.h: 58 | 59 | /usr/include/_types.h: 60 | 61 | /usr/include/sys/_types.h: 62 | 63 | /usr/include/sys/cdefs.h: 64 | 65 | /usr/include/sys/_symbol_aliasing.h: 66 | 67 | /usr/include/sys/_posix_availability.h: 68 | 69 | /usr/include/machine/_types.h: 70 | 71 | /usr/include/i386/_types.h: 72 | 73 | /usr/include/sys/wait.h: 74 | 75 | /usr/include/sys/_types/_pid_t.h: 76 | 77 | /usr/include/sys/_types/_id_t.h: 78 | 79 | /usr/include/sys/signal.h: 80 | 81 | /usr/include/sys/appleapiopts.h: 82 | 83 | /usr/include/machine/signal.h: 84 | 85 | /usr/include/i386/signal.h: 86 | 87 | /usr/include/machine/_mcontext.h: 88 | 89 | /usr/include/i386/_mcontext.h: 90 | 91 | /usr/include/mach/i386/_structs.h: 92 | 93 | /usr/include/sys/_types/_sigaltstack.h: 94 | 95 | /usr/include/sys/_types/_ucontext.h: 96 | 97 | /usr/include/sys/_types/_pthread_attr_t.h: 98 | 99 | /usr/include/sys/_types/_sigset_t.h: 100 | 101 | /usr/include/sys/_types/_size_t.h: 102 | 103 | /usr/include/sys/_types/_uid_t.h: 104 | 105 | /usr/include/sys/resource.h: 106 | 107 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include/stdint.h: 108 | 109 | /usr/include/stdint.h: 110 | 111 | /usr/include/sys/_types/_int8_t.h: 112 | 113 | /usr/include/sys/_types/_int16_t.h: 114 | 115 | /usr/include/sys/_types/_int32_t.h: 116 | 117 | /usr/include/sys/_types/_int64_t.h: 118 | 119 | /usr/include/_types/_uint8_t.h: 120 | 121 | /usr/include/_types/_uint16_t.h: 122 | 123 | /usr/include/_types/_uint32_t.h: 124 | 125 | /usr/include/_types/_uint64_t.h: 126 | 127 | /usr/include/sys/_types/_intptr_t.h: 128 | 129 | /usr/include/sys/_types/_uintptr_t.h: 130 | 131 | /usr/include/_types/_intmax_t.h: 132 | 133 | /usr/include/_types/_uintmax_t.h: 134 | 135 | /usr/include/sys/_types/_timeval.h: 136 | 137 | /usr/include/machine/endian.h: 138 | 139 | /usr/include/i386/endian.h: 140 | 141 | /usr/include/sys/_endian.h: 142 | 143 | /usr/include/libkern/_OSByteOrder.h: 144 | 145 | /usr/include/libkern/i386/_OSByteOrder.h: 146 | 147 | /usr/include/alloca.h: 148 | 149 | /usr/include/sys/_types/_ct_rune_t.h: 150 | 151 | /usr/include/sys/_types/_rune_t.h: 152 | 153 | /usr/include/sys/_types/_wchar_t.h: 154 | 155 | /usr/include/sys/_types/_null.h: 156 | 157 | /usr/include/machine/types.h: 158 | 159 | /usr/include/i386/types.h: 160 | 161 | /usr/include/sys/_types/___offsetof.h: 162 | 163 | /usr/include/sys/_types/_dev_t.h: 164 | 165 | /usr/include/sys/_types/_mode_t.h: 166 | 167 | /usr/include/string.h: 168 | 169 | /usr/include/sys/_types/_rsize_t.h: 170 | 171 | /usr/include/sys/_types/_errno_t.h: 172 | 173 | /usr/include/sys/_types/_ssize_t.h: 174 | 175 | /usr/include/strings.h: 176 | 177 | /usr/include/secure/_string.h: 178 | 179 | /usr/include/secure/_common.h: 180 | 181 | /usr/include/pthread.h: 182 | 183 | /usr/include/pthread_impl.h: 184 | 185 | /usr/include/sched.h: 186 | 187 | /usr/include/time.h: 188 | 189 | /usr/include/_structs.h: 190 | 191 | /usr/include/sys/_structs.h: 192 | 193 | /usr/include/sys/_types/_timespec.h: 194 | 195 | /usr/include/sys/_types/_clock_t.h: 196 | 197 | /usr/include/sys/_types/_time_t.h: 198 | 199 | /usr/include/sys/_types/_pthread_cond_t.h: 200 | 201 | /usr/include/sys/_types/_pthread_condattr_t.h: 202 | 203 | /usr/include/sys/_types/_pthread_key_t.h: 204 | 205 | /usr/include/sys/_types/_pthread_mutex_t.h: 206 | 207 | /usr/include/sys/_types/_pthread_mutexattr_t.h: 208 | 209 | /usr/include/sys/_types/_pthread_once_t.h: 210 | 211 | /usr/include/sys/_types/_pthread_rwlock_t.h: 212 | 213 | /usr/include/sys/_types/_pthread_rwlockattr_t.h: 214 | 215 | /usr/include/sys/_types/_pthread_t.h: 216 | 217 | /usr/include/sys/_types/_mach_port_t.h: 218 | 219 | rscode.h: 220 | -------------------------------------------------------------------------------- /qrencode/.deps/mqrspec.Plo: -------------------------------------------------------------------------------- 1 | mqrspec.lo: mqrspec.c config.h /usr/include/stdio.h \ 2 | /usr/include/sys/cdefs.h /usr/include/sys/_symbol_aliasing.h \ 3 | /usr/include/sys/_posix_availability.h /usr/include/Availability.h \ 4 | /usr/include/AvailabilityInternal.h /usr/include/_types.h \ 5 | /usr/include/sys/_types.h /usr/include/machine/_types.h \ 6 | /usr/include/i386/_types.h /usr/include/sys/_types/_va_list.h \ 7 | /usr/include/sys/_types/_size_t.h /usr/include/sys/_types/_null.h \ 8 | /usr/include/sys/_types/_off_t.h /usr/include/sys/_types/_ssize_t.h \ 9 | /usr/include/secure/_stdio.h /usr/include/secure/_common.h \ 10 | /usr/include/stdlib.h /usr/include/sys/wait.h \ 11 | /usr/include/sys/_types/_pid_t.h /usr/include/sys/_types/_id_t.h \ 12 | /usr/include/sys/signal.h /usr/include/sys/appleapiopts.h \ 13 | /usr/include/machine/signal.h /usr/include/i386/signal.h \ 14 | /usr/include/machine/_mcontext.h /usr/include/i386/_mcontext.h \ 15 | /usr/include/mach/i386/_structs.h \ 16 | /usr/include/sys/_types/_sigaltstack.h \ 17 | /usr/include/sys/_types/_ucontext.h \ 18 | /usr/include/sys/_types/_pthread_attr_t.h \ 19 | /usr/include/sys/_types/_sigset_t.h /usr/include/sys/_types/_uid_t.h \ 20 | /usr/include/sys/resource.h \ 21 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include/stdint.h \ 22 | /usr/include/stdint.h /usr/include/sys/_types/_int8_t.h \ 23 | /usr/include/sys/_types/_int16_t.h /usr/include/sys/_types/_int32_t.h \ 24 | /usr/include/sys/_types/_int64_t.h /usr/include/_types/_uint8_t.h \ 25 | /usr/include/_types/_uint16_t.h /usr/include/_types/_uint32_t.h \ 26 | /usr/include/_types/_uint64_t.h /usr/include/sys/_types/_intptr_t.h \ 27 | /usr/include/sys/_types/_uintptr_t.h /usr/include/_types/_intmax_t.h \ 28 | /usr/include/_types/_uintmax_t.h /usr/include/sys/_types/_timeval.h \ 29 | /usr/include/machine/endian.h /usr/include/i386/endian.h \ 30 | /usr/include/sys/_endian.h /usr/include/libkern/_OSByteOrder.h \ 31 | /usr/include/libkern/i386/_OSByteOrder.h /usr/include/alloca.h \ 32 | /usr/include/sys/_types/_ct_rune_t.h /usr/include/sys/_types/_rune_t.h \ 33 | /usr/include/sys/_types/_wchar_t.h /usr/include/machine/types.h \ 34 | /usr/include/i386/types.h /usr/include/sys/_types/___offsetof.h \ 35 | /usr/include/sys/_types/_dev_t.h /usr/include/sys/_types/_mode_t.h \ 36 | /usr/include/string.h /usr/include/sys/_types/_rsize_t.h \ 37 | /usr/include/sys/_types/_errno_t.h /usr/include/strings.h \ 38 | /usr/include/secure/_string.h /usr/include/errno.h \ 39 | /usr/include/sys/errno.h /usr/include/pthread.h \ 40 | /usr/include/pthread_impl.h /usr/include/sched.h /usr/include/time.h \ 41 | /usr/include/_structs.h /usr/include/sys/_structs.h \ 42 | /usr/include/sys/_types/_timespec.h /usr/include/sys/_types/_clock_t.h \ 43 | /usr/include/sys/_types/_time_t.h \ 44 | /usr/include/sys/_types/_pthread_cond_t.h \ 45 | /usr/include/sys/_types/_pthread_condattr_t.h \ 46 | /usr/include/sys/_types/_pthread_key_t.h \ 47 | /usr/include/sys/_types/_pthread_mutex_t.h \ 48 | /usr/include/sys/_types/_pthread_mutexattr_t.h \ 49 | /usr/include/sys/_types/_pthread_once_t.h \ 50 | /usr/include/sys/_types/_pthread_rwlock_t.h \ 51 | /usr/include/sys/_types/_pthread_rwlockattr_t.h \ 52 | /usr/include/sys/_types/_pthread_t.h \ 53 | /usr/include/sys/_types/_mach_port_t.h mqrspec.h qrencode.h 54 | 55 | config.h: 56 | 57 | /usr/include/stdio.h: 58 | 59 | /usr/include/sys/cdefs.h: 60 | 61 | /usr/include/sys/_symbol_aliasing.h: 62 | 63 | /usr/include/sys/_posix_availability.h: 64 | 65 | /usr/include/Availability.h: 66 | 67 | /usr/include/AvailabilityInternal.h: 68 | 69 | /usr/include/_types.h: 70 | 71 | /usr/include/sys/_types.h: 72 | 73 | /usr/include/machine/_types.h: 74 | 75 | /usr/include/i386/_types.h: 76 | 77 | /usr/include/sys/_types/_va_list.h: 78 | 79 | /usr/include/sys/_types/_size_t.h: 80 | 81 | /usr/include/sys/_types/_null.h: 82 | 83 | /usr/include/sys/_types/_off_t.h: 84 | 85 | /usr/include/sys/_types/_ssize_t.h: 86 | 87 | /usr/include/secure/_stdio.h: 88 | 89 | /usr/include/secure/_common.h: 90 | 91 | /usr/include/stdlib.h: 92 | 93 | /usr/include/sys/wait.h: 94 | 95 | /usr/include/sys/_types/_pid_t.h: 96 | 97 | /usr/include/sys/_types/_id_t.h: 98 | 99 | /usr/include/sys/signal.h: 100 | 101 | /usr/include/sys/appleapiopts.h: 102 | 103 | /usr/include/machine/signal.h: 104 | 105 | /usr/include/i386/signal.h: 106 | 107 | /usr/include/machine/_mcontext.h: 108 | 109 | /usr/include/i386/_mcontext.h: 110 | 111 | /usr/include/mach/i386/_structs.h: 112 | 113 | /usr/include/sys/_types/_sigaltstack.h: 114 | 115 | /usr/include/sys/_types/_ucontext.h: 116 | 117 | /usr/include/sys/_types/_pthread_attr_t.h: 118 | 119 | /usr/include/sys/_types/_sigset_t.h: 120 | 121 | /usr/include/sys/_types/_uid_t.h: 122 | 123 | /usr/include/sys/resource.h: 124 | 125 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include/stdint.h: 126 | 127 | /usr/include/stdint.h: 128 | 129 | /usr/include/sys/_types/_int8_t.h: 130 | 131 | /usr/include/sys/_types/_int16_t.h: 132 | 133 | /usr/include/sys/_types/_int32_t.h: 134 | 135 | /usr/include/sys/_types/_int64_t.h: 136 | 137 | /usr/include/_types/_uint8_t.h: 138 | 139 | /usr/include/_types/_uint16_t.h: 140 | 141 | /usr/include/_types/_uint32_t.h: 142 | 143 | /usr/include/_types/_uint64_t.h: 144 | 145 | /usr/include/sys/_types/_intptr_t.h: 146 | 147 | /usr/include/sys/_types/_uintptr_t.h: 148 | 149 | /usr/include/_types/_intmax_t.h: 150 | 151 | /usr/include/_types/_uintmax_t.h: 152 | 153 | /usr/include/sys/_types/_timeval.h: 154 | 155 | /usr/include/machine/endian.h: 156 | 157 | /usr/include/i386/endian.h: 158 | 159 | /usr/include/sys/_endian.h: 160 | 161 | /usr/include/libkern/_OSByteOrder.h: 162 | 163 | /usr/include/libkern/i386/_OSByteOrder.h: 164 | 165 | /usr/include/alloca.h: 166 | 167 | /usr/include/sys/_types/_ct_rune_t.h: 168 | 169 | /usr/include/sys/_types/_rune_t.h: 170 | 171 | /usr/include/sys/_types/_wchar_t.h: 172 | 173 | /usr/include/machine/types.h: 174 | 175 | /usr/include/i386/types.h: 176 | 177 | /usr/include/sys/_types/___offsetof.h: 178 | 179 | /usr/include/sys/_types/_dev_t.h: 180 | 181 | /usr/include/sys/_types/_mode_t.h: 182 | 183 | /usr/include/string.h: 184 | 185 | /usr/include/sys/_types/_rsize_t.h: 186 | 187 | /usr/include/sys/_types/_errno_t.h: 188 | 189 | /usr/include/strings.h: 190 | 191 | /usr/include/secure/_string.h: 192 | 193 | /usr/include/errno.h: 194 | 195 | /usr/include/sys/errno.h: 196 | 197 | /usr/include/pthread.h: 198 | 199 | /usr/include/pthread_impl.h: 200 | 201 | /usr/include/sched.h: 202 | 203 | /usr/include/time.h: 204 | 205 | /usr/include/_structs.h: 206 | 207 | /usr/include/sys/_structs.h: 208 | 209 | /usr/include/sys/_types/_timespec.h: 210 | 211 | /usr/include/sys/_types/_clock_t.h: 212 | 213 | /usr/include/sys/_types/_time_t.h: 214 | 215 | /usr/include/sys/_types/_pthread_cond_t.h: 216 | 217 | /usr/include/sys/_types/_pthread_condattr_t.h: 218 | 219 | /usr/include/sys/_types/_pthread_key_t.h: 220 | 221 | /usr/include/sys/_types/_pthread_mutex_t.h: 222 | 223 | /usr/include/sys/_types/_pthread_mutexattr_t.h: 224 | 225 | /usr/include/sys/_types/_pthread_once_t.h: 226 | 227 | /usr/include/sys/_types/_pthread_rwlock_t.h: 228 | 229 | /usr/include/sys/_types/_pthread_rwlockattr_t.h: 230 | 231 | /usr/include/sys/_types/_pthread_t.h: 232 | 233 | /usr/include/sys/_types/_mach_port_t.h: 234 | 235 | mqrspec.h: 236 | 237 | qrencode.h: 238 | -------------------------------------------------------------------------------- /qrencode/.deps/qrspec.Plo: -------------------------------------------------------------------------------- 1 | qrspec.lo: qrspec.c config.h /usr/include/stdio.h \ 2 | /usr/include/sys/cdefs.h /usr/include/sys/_symbol_aliasing.h \ 3 | /usr/include/sys/_posix_availability.h /usr/include/Availability.h \ 4 | /usr/include/AvailabilityInternal.h /usr/include/_types.h \ 5 | /usr/include/sys/_types.h /usr/include/machine/_types.h \ 6 | /usr/include/i386/_types.h /usr/include/sys/_types/_va_list.h \ 7 | /usr/include/sys/_types/_size_t.h /usr/include/sys/_types/_null.h \ 8 | /usr/include/sys/_types/_off_t.h /usr/include/sys/_types/_ssize_t.h \ 9 | /usr/include/secure/_stdio.h /usr/include/secure/_common.h \ 10 | /usr/include/stdlib.h /usr/include/sys/wait.h \ 11 | /usr/include/sys/_types/_pid_t.h /usr/include/sys/_types/_id_t.h \ 12 | /usr/include/sys/signal.h /usr/include/sys/appleapiopts.h \ 13 | /usr/include/machine/signal.h /usr/include/i386/signal.h \ 14 | /usr/include/machine/_mcontext.h /usr/include/i386/_mcontext.h \ 15 | /usr/include/mach/i386/_structs.h \ 16 | /usr/include/sys/_types/_sigaltstack.h \ 17 | /usr/include/sys/_types/_ucontext.h \ 18 | /usr/include/sys/_types/_pthread_attr_t.h \ 19 | /usr/include/sys/_types/_sigset_t.h /usr/include/sys/_types/_uid_t.h \ 20 | /usr/include/sys/resource.h \ 21 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include/stdint.h \ 22 | /usr/include/stdint.h /usr/include/sys/_types/_int8_t.h \ 23 | /usr/include/sys/_types/_int16_t.h /usr/include/sys/_types/_int32_t.h \ 24 | /usr/include/sys/_types/_int64_t.h /usr/include/_types/_uint8_t.h \ 25 | /usr/include/_types/_uint16_t.h /usr/include/_types/_uint32_t.h \ 26 | /usr/include/_types/_uint64_t.h /usr/include/sys/_types/_intptr_t.h \ 27 | /usr/include/sys/_types/_uintptr_t.h /usr/include/_types/_intmax_t.h \ 28 | /usr/include/_types/_uintmax_t.h /usr/include/sys/_types/_timeval.h \ 29 | /usr/include/machine/endian.h /usr/include/i386/endian.h \ 30 | /usr/include/sys/_endian.h /usr/include/libkern/_OSByteOrder.h \ 31 | /usr/include/libkern/i386/_OSByteOrder.h /usr/include/alloca.h \ 32 | /usr/include/sys/_types/_ct_rune_t.h /usr/include/sys/_types/_rune_t.h \ 33 | /usr/include/sys/_types/_wchar_t.h /usr/include/machine/types.h \ 34 | /usr/include/i386/types.h /usr/include/sys/_types/___offsetof.h \ 35 | /usr/include/sys/_types/_dev_t.h /usr/include/sys/_types/_mode_t.h \ 36 | /usr/include/string.h /usr/include/sys/_types/_rsize_t.h \ 37 | /usr/include/sys/_types/_errno_t.h /usr/include/strings.h \ 38 | /usr/include/secure/_string.h /usr/include/errno.h \ 39 | /usr/include/sys/errno.h /usr/include/pthread.h \ 40 | /usr/include/pthread_impl.h /usr/include/sched.h /usr/include/time.h \ 41 | /usr/include/_structs.h /usr/include/sys/_structs.h \ 42 | /usr/include/sys/_types/_timespec.h /usr/include/sys/_types/_clock_t.h \ 43 | /usr/include/sys/_types/_time_t.h \ 44 | /usr/include/sys/_types/_pthread_cond_t.h \ 45 | /usr/include/sys/_types/_pthread_condattr_t.h \ 46 | /usr/include/sys/_types/_pthread_key_t.h \ 47 | /usr/include/sys/_types/_pthread_mutex_t.h \ 48 | /usr/include/sys/_types/_pthread_mutexattr_t.h \ 49 | /usr/include/sys/_types/_pthread_once_t.h \ 50 | /usr/include/sys/_types/_pthread_rwlock_t.h \ 51 | /usr/include/sys/_types/_pthread_rwlockattr_t.h \ 52 | /usr/include/sys/_types/_pthread_t.h \ 53 | /usr/include/sys/_types/_mach_port_t.h qrspec.h qrencode.h qrinput.h \ 54 | bitstream.h 55 | 56 | config.h: 57 | 58 | /usr/include/stdio.h: 59 | 60 | /usr/include/sys/cdefs.h: 61 | 62 | /usr/include/sys/_symbol_aliasing.h: 63 | 64 | /usr/include/sys/_posix_availability.h: 65 | 66 | /usr/include/Availability.h: 67 | 68 | /usr/include/AvailabilityInternal.h: 69 | 70 | /usr/include/_types.h: 71 | 72 | /usr/include/sys/_types.h: 73 | 74 | /usr/include/machine/_types.h: 75 | 76 | /usr/include/i386/_types.h: 77 | 78 | /usr/include/sys/_types/_va_list.h: 79 | 80 | /usr/include/sys/_types/_size_t.h: 81 | 82 | /usr/include/sys/_types/_null.h: 83 | 84 | /usr/include/sys/_types/_off_t.h: 85 | 86 | /usr/include/sys/_types/_ssize_t.h: 87 | 88 | /usr/include/secure/_stdio.h: 89 | 90 | /usr/include/secure/_common.h: 91 | 92 | /usr/include/stdlib.h: 93 | 94 | /usr/include/sys/wait.h: 95 | 96 | /usr/include/sys/_types/_pid_t.h: 97 | 98 | /usr/include/sys/_types/_id_t.h: 99 | 100 | /usr/include/sys/signal.h: 101 | 102 | /usr/include/sys/appleapiopts.h: 103 | 104 | /usr/include/machine/signal.h: 105 | 106 | /usr/include/i386/signal.h: 107 | 108 | /usr/include/machine/_mcontext.h: 109 | 110 | /usr/include/i386/_mcontext.h: 111 | 112 | /usr/include/mach/i386/_structs.h: 113 | 114 | /usr/include/sys/_types/_sigaltstack.h: 115 | 116 | /usr/include/sys/_types/_ucontext.h: 117 | 118 | /usr/include/sys/_types/_pthread_attr_t.h: 119 | 120 | /usr/include/sys/_types/_sigset_t.h: 121 | 122 | /usr/include/sys/_types/_uid_t.h: 123 | 124 | /usr/include/sys/resource.h: 125 | 126 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include/stdint.h: 127 | 128 | /usr/include/stdint.h: 129 | 130 | /usr/include/sys/_types/_int8_t.h: 131 | 132 | /usr/include/sys/_types/_int16_t.h: 133 | 134 | /usr/include/sys/_types/_int32_t.h: 135 | 136 | /usr/include/sys/_types/_int64_t.h: 137 | 138 | /usr/include/_types/_uint8_t.h: 139 | 140 | /usr/include/_types/_uint16_t.h: 141 | 142 | /usr/include/_types/_uint32_t.h: 143 | 144 | /usr/include/_types/_uint64_t.h: 145 | 146 | /usr/include/sys/_types/_intptr_t.h: 147 | 148 | /usr/include/sys/_types/_uintptr_t.h: 149 | 150 | /usr/include/_types/_intmax_t.h: 151 | 152 | /usr/include/_types/_uintmax_t.h: 153 | 154 | /usr/include/sys/_types/_timeval.h: 155 | 156 | /usr/include/machine/endian.h: 157 | 158 | /usr/include/i386/endian.h: 159 | 160 | /usr/include/sys/_endian.h: 161 | 162 | /usr/include/libkern/_OSByteOrder.h: 163 | 164 | /usr/include/libkern/i386/_OSByteOrder.h: 165 | 166 | /usr/include/alloca.h: 167 | 168 | /usr/include/sys/_types/_ct_rune_t.h: 169 | 170 | /usr/include/sys/_types/_rune_t.h: 171 | 172 | /usr/include/sys/_types/_wchar_t.h: 173 | 174 | /usr/include/machine/types.h: 175 | 176 | /usr/include/i386/types.h: 177 | 178 | /usr/include/sys/_types/___offsetof.h: 179 | 180 | /usr/include/sys/_types/_dev_t.h: 181 | 182 | /usr/include/sys/_types/_mode_t.h: 183 | 184 | /usr/include/string.h: 185 | 186 | /usr/include/sys/_types/_rsize_t.h: 187 | 188 | /usr/include/sys/_types/_errno_t.h: 189 | 190 | /usr/include/strings.h: 191 | 192 | /usr/include/secure/_string.h: 193 | 194 | /usr/include/errno.h: 195 | 196 | /usr/include/sys/errno.h: 197 | 198 | /usr/include/pthread.h: 199 | 200 | /usr/include/pthread_impl.h: 201 | 202 | /usr/include/sched.h: 203 | 204 | /usr/include/time.h: 205 | 206 | /usr/include/_structs.h: 207 | 208 | /usr/include/sys/_structs.h: 209 | 210 | /usr/include/sys/_types/_timespec.h: 211 | 212 | /usr/include/sys/_types/_clock_t.h: 213 | 214 | /usr/include/sys/_types/_time_t.h: 215 | 216 | /usr/include/sys/_types/_pthread_cond_t.h: 217 | 218 | /usr/include/sys/_types/_pthread_condattr_t.h: 219 | 220 | /usr/include/sys/_types/_pthread_key_t.h: 221 | 222 | /usr/include/sys/_types/_pthread_mutex_t.h: 223 | 224 | /usr/include/sys/_types/_pthread_mutexattr_t.h: 225 | 226 | /usr/include/sys/_types/_pthread_once_t.h: 227 | 228 | /usr/include/sys/_types/_pthread_rwlock_t.h: 229 | 230 | /usr/include/sys/_types/_pthread_rwlockattr_t.h: 231 | 232 | /usr/include/sys/_types/_pthread_t.h: 233 | 234 | /usr/include/sys/_types/_mach_port_t.h: 235 | 236 | qrspec.h: 237 | 238 | qrencode.h: 239 | 240 | qrinput.h: 241 | 242 | bitstream.h: 243 | -------------------------------------------------------------------------------- /qrencode/use/missing: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Common wrapper for a few potentially missing GNU programs. 3 | 4 | scriptversion=2013-10-28.13; # UTC 5 | 6 | # Copyright (C) 1996-2013 Free Software Foundation, Inc. 7 | # Originally written by Fran,cois Pinard , 1996. 8 | 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2, or (at your option) 12 | # any later version. 13 | 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program. If not, see . 21 | 22 | # As a special exception to the GNU General Public License, if you 23 | # distribute this file as part of a program that contains a 24 | # configuration script generated by Autoconf, you may include it under 25 | # the same distribution terms that you use for the rest of that program. 26 | 27 | if test $# -eq 0; then 28 | echo 1>&2 "Try '$0 --help' for more information" 29 | exit 1 30 | fi 31 | 32 | case $1 in 33 | 34 | --is-lightweight) 35 | # Used by our autoconf macros to check whether the available missing 36 | # script is modern enough. 37 | exit 0 38 | ;; 39 | 40 | --run) 41 | # Back-compat with the calling convention used by older automake. 42 | shift 43 | ;; 44 | 45 | -h|--h|--he|--hel|--help) 46 | echo "\ 47 | $0 [OPTION]... PROGRAM [ARGUMENT]... 48 | 49 | Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 50 | to PROGRAM being missing or too old. 51 | 52 | Options: 53 | -h, --help display this help and exit 54 | -v, --version output version information and exit 55 | 56 | Supported PROGRAM values: 57 | aclocal autoconf autoheader autom4te automake makeinfo 58 | bison yacc flex lex help2man 59 | 60 | Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 61 | 'g' are ignored when checking the name. 62 | 63 | Send bug reports to ." 64 | exit $? 65 | ;; 66 | 67 | -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68 | echo "missing $scriptversion (GNU Automake)" 69 | exit $? 70 | ;; 71 | 72 | -*) 73 | echo 1>&2 "$0: unknown '$1' option" 74 | echo 1>&2 "Try '$0 --help' for more information" 75 | exit 1 76 | ;; 77 | 78 | esac 79 | 80 | # Run the given program, remember its exit status. 81 | "$@"; st=$? 82 | 83 | # If it succeeded, we are done. 84 | test $st -eq 0 && exit 0 85 | 86 | # Also exit now if we it failed (or wasn't found), and '--version' was 87 | # passed; such an option is passed most likely to detect whether the 88 | # program is present and works. 89 | case $2 in --version|--help) exit $st;; esac 90 | 91 | # Exit code 63 means version mismatch. This often happens when the user 92 | # tries to use an ancient version of a tool on a file that requires a 93 | # minimum version. 94 | if test $st -eq 63; then 95 | msg="probably too old" 96 | elif test $st -eq 127; then 97 | # Program was missing. 98 | msg="missing on your system" 99 | else 100 | # Program was found and executed, but failed. Give up. 101 | exit $st 102 | fi 103 | 104 | perl_URL=http://www.perl.org/ 105 | flex_URL=http://flex.sourceforge.net/ 106 | gnu_software_URL=http://www.gnu.org/software 107 | 108 | program_details () 109 | { 110 | case $1 in 111 | aclocal|automake) 112 | echo "The '$1' program is part of the GNU Automake package:" 113 | echo "<$gnu_software_URL/automake>" 114 | echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 115 | echo "<$gnu_software_URL/autoconf>" 116 | echo "<$gnu_software_URL/m4/>" 117 | echo "<$perl_URL>" 118 | ;; 119 | autoconf|autom4te|autoheader) 120 | echo "The '$1' program is part of the GNU Autoconf package:" 121 | echo "<$gnu_software_URL/autoconf/>" 122 | echo "It also requires GNU m4 and Perl in order to run:" 123 | echo "<$gnu_software_URL/m4/>" 124 | echo "<$perl_URL>" 125 | ;; 126 | esac 127 | } 128 | 129 | give_advice () 130 | { 131 | # Normalize program name to check for. 132 | normalized_program=`echo "$1" | sed ' 133 | s/^gnu-//; t 134 | s/^gnu//; t 135 | s/^g//; t'` 136 | 137 | printf '%s\n' "'$1' is $msg." 138 | 139 | configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 140 | case $normalized_program in 141 | autoconf*) 142 | echo "You should only need it if you modified 'configure.ac'," 143 | echo "or m4 files included by it." 144 | program_details 'autoconf' 145 | ;; 146 | autoheader*) 147 | echo "You should only need it if you modified 'acconfig.h' or" 148 | echo "$configure_deps." 149 | program_details 'autoheader' 150 | ;; 151 | automake*) 152 | echo "You should only need it if you modified 'Makefile.am' or" 153 | echo "$configure_deps." 154 | program_details 'automake' 155 | ;; 156 | aclocal*) 157 | echo "You should only need it if you modified 'acinclude.m4' or" 158 | echo "$configure_deps." 159 | program_details 'aclocal' 160 | ;; 161 | autom4te*) 162 | echo "You might have modified some maintainer files that require" 163 | echo "the 'autom4te' program to be rebuilt." 164 | program_details 'autom4te' 165 | ;; 166 | bison*|yacc*) 167 | echo "You should only need it if you modified a '.y' file." 168 | echo "You may want to install the GNU Bison package:" 169 | echo "<$gnu_software_URL/bison/>" 170 | ;; 171 | lex*|flex*) 172 | echo "You should only need it if you modified a '.l' file." 173 | echo "You may want to install the Fast Lexical Analyzer package:" 174 | echo "<$flex_URL>" 175 | ;; 176 | help2man*) 177 | echo "You should only need it if you modified a dependency" \ 178 | "of a man page." 179 | echo "You may want to install the GNU Help2man package:" 180 | echo "<$gnu_software_URL/help2man/>" 181 | ;; 182 | makeinfo*) 183 | echo "You should only need it if you modified a '.texi' file, or" 184 | echo "any other file indirectly affecting the aspect of the manual." 185 | echo "You might want to install the Texinfo package:" 186 | echo "<$gnu_software_URL/texinfo/>" 187 | echo "The spurious makeinfo call might also be the consequence of" 188 | echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 189 | echo "want to install GNU make:" 190 | echo "<$gnu_software_URL/make/>" 191 | ;; 192 | *) 193 | echo "You might have modified some files without having the proper" 194 | echo "tools for further handling them. Check the 'README' file, it" 195 | echo "often tells you about the needed prerequisites for installing" 196 | echo "this package. You may also peek at any GNU archive site, in" 197 | echo "case some other package contains this missing '$1' program." 198 | ;; 199 | esac 200 | } 201 | 202 | give_advice "$1" | sed -e '1s/^/WARNING: /' \ 203 | -e '2,$s/^/ /' >&2 204 | 205 | # Propagate the correct exit status (expected to be 127 for a program 206 | # not found, 63 for a program that failed due to version mismatch). 207 | exit $st 208 | 209 | # Local variables: 210 | # eval: (add-hook 'write-file-hooks 'time-stamp) 211 | # time-stamp-start: "scriptversion=" 212 | # time-stamp-format: "%:y-%02m-%02d.%02H" 213 | # time-stamp-time-zone: "UTC" 214 | # time-stamp-end: "; # UTC" 215 | # End: 216 | -------------------------------------------------------------------------------- /qrencode/mqrspec.c: -------------------------------------------------------------------------------- 1 | /* 2 | * qrencode - QR Code encoder 3 | * 4 | * Micor QR Code specification in convenient format. 5 | * Copyright (C) 2006-2011 Kentaro Fukuchi 6 | * 7 | * The following data / specifications are taken from 8 | * "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004) 9 | * or 10 | * "Automatic identification and data capture techniques -- 11 | * QR Code 2005 bar code symbology specification" (ISO/IEC 18004:2006) 12 | * 13 | * This library is free software; you can redistribute it and/or 14 | * modify it under the terms of the GNU Lesser General Public 15 | * License as published by the Free Software Foundation; either 16 | * version 2.1 of the License, or any later version. 17 | * 18 | * This library is distributed in the hope that it will be useful, 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | * Lesser General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU Lesser General Public 24 | * License along with this library; if not, write to the Free Software 25 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 26 | */ 27 | 28 | #if HAVE_CONFIG_H 29 | # include "config.h" 30 | #endif 31 | #include 32 | #include 33 | #include 34 | #include 35 | #ifdef HAVE_LIBPTHREAD 36 | #include 37 | #endif 38 | 39 | #include "mqrspec.h" 40 | 41 | /****************************************************************************** 42 | * Version and capacity 43 | *****************************************************************************/ 44 | 45 | typedef struct { 46 | int width; //< Edge length of the symbol 47 | int ec[4]; //< Number of ECC code (bytes) 48 | } MQRspec_Capacity; 49 | 50 | /** 51 | * Table of the capacity of symbols 52 | * See Table 1 (pp.106) and Table 8 (pp.113) of Appendix 1, JIS X0510:2004. 53 | */ 54 | static const MQRspec_Capacity mqrspecCapacity[MQRSPEC_VERSION_MAX + 1] = { 55 | { 0, {0, 0, 0, 0}}, 56 | { 11, {2, 0, 0, 0}}, 57 | { 13, {5, 6, 0, 0}}, 58 | { 15, {6, 8, 0, 0}}, 59 | { 17, {8, 10, 14, 0}} 60 | }; 61 | 62 | int MQRspec_getDataLengthBit(int version, QRecLevel level) 63 | { 64 | int w; 65 | int ecc; 66 | 67 | w = mqrspecCapacity[version].width - 1; 68 | ecc = mqrspecCapacity[version].ec[level]; 69 | if(ecc == 0) return 0; 70 | return w * w - 64 - ecc * 8; 71 | } 72 | 73 | int MQRspec_getDataLength(int version, QRecLevel level) 74 | { 75 | return (MQRspec_getDataLengthBit(version, level) + 4) / 8; 76 | } 77 | 78 | int MQRspec_getECCLength(int version, QRecLevel level) 79 | { 80 | return mqrspecCapacity[version].ec[level]; 81 | } 82 | 83 | int MQRspec_getWidth(int version) 84 | { 85 | return mqrspecCapacity[version].width; 86 | } 87 | 88 | /****************************************************************************** 89 | * Length indicator 90 | *****************************************************************************/ 91 | 92 | /** 93 | * See Table 3 (pp.107) of Appendix 1, JIS X0510:2004. 94 | */ 95 | static const int lengthTableBits[4][4] = { 96 | { 3, 4, 5, 6}, 97 | { 0, 3, 4, 5}, 98 | { 0, 0, 4, 5}, 99 | { 0, 0, 3, 4} 100 | }; 101 | 102 | int MQRspec_lengthIndicator(QRencodeMode mode, int version) 103 | { 104 | return lengthTableBits[mode][version - 1]; 105 | } 106 | 107 | int MQRspec_maximumWords(QRencodeMode mode, int version) 108 | { 109 | int bits; 110 | int words; 111 | 112 | bits = lengthTableBits[mode][version - 1]; 113 | words = (1 << bits) - 1; 114 | if(mode == QR_MODE_KANJI) { 115 | words *= 2; // the number of bytes is required 116 | } 117 | 118 | return words; 119 | } 120 | 121 | /****************************************************************************** 122 | * Format information 123 | *****************************************************************************/ 124 | 125 | /* See calcFormatInfo in tests/test_mqrspec.c */ 126 | static const unsigned int formatInfo[4][8] = { 127 | {0x4445, 0x55ae, 0x6793, 0x7678, 0x06de, 0x1735, 0x2508, 0x34e3}, 128 | {0x4172, 0x5099, 0x62a4, 0x734f, 0x03e9, 0x1202, 0x203f, 0x31d4}, 129 | {0x4e2b, 0x5fc0, 0x6dfd, 0x7c16, 0x0cb0, 0x1d5b, 0x2f66, 0x3e8d}, 130 | {0x4b1c, 0x5af7, 0x68ca, 0x7921, 0x0987, 0x186c, 0x2a51, 0x3bba} 131 | }; 132 | 133 | /* See Table 10 of Appendix 1. (pp.115) */ 134 | static const int typeTable[MQRSPEC_VERSION_MAX + 1][3] = { 135 | {-1, -1, -1}, 136 | { 0, -1, -1}, 137 | { 1, 2, -1}, 138 | { 3, 4, -1}, 139 | { 5, 6, 7} 140 | }; 141 | 142 | unsigned int MQRspec_getFormatInfo(int mask, int version, QRecLevel level) 143 | { 144 | int type; 145 | 146 | if(mask < 0 || mask > 3) return 0; 147 | if(version <= 0 || version > MQRSPEC_VERSION_MAX) return 0; 148 | if(level == QR_ECLEVEL_H) return 0; 149 | type = typeTable[version][level]; 150 | if(type < 0) return 0; 151 | 152 | return formatInfo[mask][type]; 153 | } 154 | 155 | /****************************************************************************** 156 | * Frame 157 | *****************************************************************************/ 158 | 159 | /** 160 | * Cache of initial frames. 161 | */ 162 | /* C99 says that static storage shall be initialized to a null pointer 163 | * by compiler. */ 164 | static unsigned char *frames[MQRSPEC_VERSION_MAX + 1]; 165 | #ifdef HAVE_LIBPTHREAD 166 | static pthread_mutex_t frames_mutex = PTHREAD_MUTEX_INITIALIZER; 167 | #endif 168 | 169 | /** 170 | * Put a finder pattern. 171 | * @param frame 172 | * @param width 173 | * @param ox,oy upper-left coordinate of the pattern 174 | */ 175 | static void putFinderPattern(unsigned char *frame, int width, int ox, int oy) 176 | { 177 | static const unsigned char finder[] = { 178 | 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 179 | 0xc1, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc1, 180 | 0xc1, 0xc0, 0xc1, 0xc1, 0xc1, 0xc0, 0xc1, 181 | 0xc1, 0xc0, 0xc1, 0xc1, 0xc1, 0xc0, 0xc1, 182 | 0xc1, 0xc0, 0xc1, 0xc1, 0xc1, 0xc0, 0xc1, 183 | 0xc1, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc1, 184 | 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 185 | }; 186 | int x, y; 187 | const unsigned char *s; 188 | 189 | frame += oy * width + ox; 190 | s = finder; 191 | for(y=0; y<7; y++) { 192 | for(x=0; x<7; x++) { 193 | frame[x] = s[x]; 194 | } 195 | frame += width; 196 | s += 7; 197 | } 198 | } 199 | 200 | static unsigned char *MQRspec_createFrame(int version) 201 | { 202 | unsigned char *frame, *p, *q; 203 | int width; 204 | int x, y; 205 | 206 | width = mqrspecCapacity[version].width; 207 | frame = (unsigned char *)malloc(width * width); 208 | if(frame == NULL) return NULL; 209 | 210 | memset(frame, 0, width * width); 211 | /* Finder pattern */ 212 | putFinderPattern(frame, width, 0, 0); 213 | /* Separator */ 214 | p = frame; 215 | for(y=0; y<7; y++) { 216 | p[7] = 0xc0; 217 | p += width; 218 | } 219 | memset(frame + width * 7, 0xc0, 8); 220 | /* Mask format information area */ 221 | memset(frame + width * 8 + 1, 0x84, 8); 222 | p = frame + width + 8; 223 | for(y=0; y<7; y++) { 224 | *p = 0x84; 225 | p += width; 226 | } 227 | /* Timing pattern */ 228 | p = frame + 8; 229 | q = frame + width * 8; 230 | for(x=1; x MQRSPEC_VERSION_MAX) return NULL; 246 | 247 | #ifdef HAVE_LIBPTHREAD 248 | pthread_mutex_lock(&frames_mutex); 249 | #endif 250 | if(frames[version] == NULL) { 251 | frames[version] = MQRspec_createFrame(version); 252 | } 253 | #ifdef HAVE_LIBPTHREAD 254 | pthread_mutex_unlock(&frames_mutex); 255 | #endif 256 | if(frames[version] == NULL) return NULL; 257 | 258 | width = mqrspecCapacity[version].width; 259 | frame = (unsigned char *)malloc(width * width); 260 | if(frame == NULL) return NULL; 261 | memcpy(frame, frames[version], width * width); 262 | 263 | return frame; 264 | } 265 | 266 | void MQRspec_clearCache(void) 267 | { 268 | int i; 269 | 270 | #ifdef HAVE_LIBPTHREAD 271 | pthread_mutex_lock(&frames_mutex); 272 | #endif 273 | for(i=1; i<=MQRSPEC_VERSION_MAX; i++) { 274 | free(frames[i]); 275 | frames[i] = NULL; 276 | } 277 | #ifdef HAVE_LIBPTHREAD 278 | pthread_mutex_unlock(&frames_mutex); 279 | #endif 280 | } 281 | -------------------------------------------------------------------------------- /qrencode/mask.c: -------------------------------------------------------------------------------- 1 | /* 2 | * qrencode - QR Code encoder 3 | * 4 | * Masking. 5 | * Copyright (C) 2006-2011 Kentaro Fukuchi 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #if HAVE_CONFIG_H 23 | # include "config.h" 24 | #endif 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "qrencode.h" 31 | #include "qrspec.h" 32 | #include "mask.h" 33 | 34 | __STATIC int Mask_writeFormatInformation(int width, unsigned char *frame, int mask, QRecLevel level) 35 | { 36 | unsigned int format; 37 | unsigned char v; 38 | int i; 39 | int blacks = 0; 40 | 41 | format = QRspec_getFormatInfo(mask, level); 42 | 43 | for(i=0; i<8; i++) { 44 | if(format & 1) { 45 | blacks += 2; 46 | v = 0x85; 47 | } else { 48 | v = 0x84; 49 | } 50 | frame[width * 8 + width - 1 - i] = v; 51 | if(i < 6) { 52 | frame[width * i + 8] = v; 53 | } else { 54 | frame[width * (i + 1) + 8] = v; 55 | } 56 | format= format >> 1; 57 | } 58 | for(i=0; i<7; i++) { 59 | if(format & 1) { 60 | blacks += 2; 61 | v = 0x85; 62 | } else { 63 | v = 0x84; 64 | } 65 | frame[width * (width - 7 + i) + 8] = v; 66 | if(i == 0) { 67 | frame[width * 8 + 7] = v; 68 | } else { 69 | frame[width * 8 + 6 - i] = v; 70 | } 71 | format= format >> 1; 72 | } 73 | 74 | return blacks; 75 | } 76 | 77 | /** 78 | * Demerit coefficients. 79 | * See Section 8.8.2, pp.45, JIS X0510:2004. 80 | */ 81 | #define N1 (3) 82 | #define N2 (3) 83 | #define N3 (40) 84 | #define N4 (10) 85 | 86 | #define MASKMAKER(__exp__) \ 87 | int x, y;\ 88 | int b = 0;\ 89 | \ 90 | for(y=0; y= maskNum) { 169 | errno = EINVAL; 170 | return NULL; 171 | } 172 | 173 | masked = (unsigned char *)malloc(width * width); 174 | if(masked == NULL) return NULL; 175 | 176 | maskMakers[mask](width, frame, masked); 177 | Mask_writeFormatInformation(width, masked, mask, level); 178 | 179 | return masked; 180 | } 181 | 182 | 183 | //static int n1; 184 | //static int n2; 185 | //static int n3; 186 | //static int n4; 187 | 188 | __STATIC int Mask_calcN1N3(int length, int *runLength) 189 | { 190 | int i; 191 | int demerit = 0; 192 | int fact; 193 | 194 | for(i=0; i= 5) { 196 | demerit += N1 + (runLength[i] - 5); 197 | //n1 += N1 + (runLength[i] - 5); 198 | } 199 | if((i & 1)) { 200 | if(i >= 3 && i < length-2 && (runLength[i] % 3) == 0) { 201 | fact = runLength[i] / 3; 202 | if(runLength[i-2] == fact && 203 | runLength[i-1] == fact && 204 | runLength[i+1] == fact && 205 | runLength[i+2] == fact) { 206 | if(i == 3 || runLength[i-3] >= 4 * fact) { 207 | demerit += N3; 208 | //n3 += N3; 209 | } else if(i+4 >= length || runLength[i+3] >= 4 * fact) { 210 | demerit += N3; 211 | //n3 += N3; 212 | } 213 | } 214 | } 215 | } 216 | } 217 | 218 | return demerit; 219 | } 220 | 221 | __STATIC int Mask_calcN2(int width, unsigned char *frame) 222 | { 223 | int x, y; 224 | unsigned char *p; 225 | unsigned char b22, w22; 226 | int demerit = 0; 227 | 228 | p = frame + width + 1; 229 | for(y=1; y