[haiku-commits] haiku: hrev47126 - src/add-ons/kernel/debugger/qrencode

  • From: korli@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 18 Apr 2014 18:14:09 +0200 (CEST)

hrev47126 adds 1 changeset to branch 'master'
old head: 3860a014873479ba49454cc058ea4c07526d7704
new head: 607a620b1cfcf98b1056991faab5afbcd4a1944d
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=607a620+%5E3860a01

----------------------------------------------------------------------------

607a620: qrencode: use outsourced package
  
  * qrspec.h isn't yet part of the package for some reason.
  * removed qrencode from the bootstrap package.
  * only include qrencode when the qrencode package is found.
  * didn't check qrencode itself, tests welcome.

                                   [ Jérôme Duval <jerome.duval@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev47126
Commit:      607a620b1cfcf98b1056991faab5afbcd4a1944d
URL:         http://cgit.haiku-os.org/haiku/commit/?id=607a620
Author:      Jérôme Duval <jerome.duval@xxxxxxxxx>
Date:        Fri Apr 18 16:10:57 2014 UTC

----------------------------------------------------------------------------

23 files changed, 24 insertions(+), 6029 deletions(-)
build/jam/BuildFeatures                          |   18 +
build/jam/packages/Haiku                         |    2 +-
build/jam/packages/HaikuBootstrap                |    2 +-
src/add-ons/kernel/debugger/qrencode/Jamfile     |   18 +-
src/add-ons/kernel/debugger/qrencode/bitstream.c |  238 ---
src/add-ons/kernel/debugger/qrencode/bitstream.h |   38 -
src/add-ons/kernel/debugger/qrencode/config.h    |    5 -
src/add-ons/kernel/debugger/qrencode/mask.c      |  330 ----
src/add-ons/kernel/debugger/qrencode/mask.h      |   37 -
src/add-ons/kernel/debugger/qrencode/mmask.c     |  177 --
src/add-ons/kernel/debugger/qrencode/mmask.h     |   34 -
src/add-ons/kernel/debugger/qrencode/mqrspec.c   |  280 ---
src/add-ons/kernel/debugger/qrencode/mqrspec.h   |  157 --
src/add-ons/kernel/debugger/qrencode/qrencode.c  |  929 ----------
src/add-ons/kernel/debugger/qrencode/qrencode.h  |  565 ------
.../kernel/debugger/qrencode/qrencode_inner.h    |   88 -
src/add-ons/kernel/debugger/qrencode/qrinput.c   | 1724 ------------------
src/add-ons/kernel/debugger/qrencode/qrinput.h   |  123 --
src/add-ons/kernel/debugger/qrencode/qrspec.c    |  562 ------
src/add-ons/kernel/debugger/qrencode/rscode.c    |  327 ----
src/add-ons/kernel/debugger/qrencode/rscode.h    |   41 -
src/add-ons/kernel/debugger/qrencode/split.c     |  311 ----
src/add-ons/kernel/debugger/qrencode/split.h     |   47 -

----------------------------------------------------------------------------

diff --git a/build/jam/BuildFeatures b/build/jam/BuildFeatures
index fa79ccf..d73109c 100644
--- a/build/jam/BuildFeatures
+++ b/build/jam/BuildFeatures
@@ -351,6 +351,24 @@ if [ IsPackageAvailable libsolv_devel ] {
 }
 
 
+# qrencode
+if [ IsPackageAvailable qrencode_devel ] {
+       ExtractBuildFeatureArchives libqrencode :
+               file: base qrencode
+                       runtime: lib
+               file: devel qrencode_devel
+                       depends: base
+                       library: $(developLibDir)/libqrencode.a
+                       headers: $(developHeadersDir)
+               ;
+
+       EnableBuildFeatures libqrencode ;
+} else {
+       Echo "qrencode support not available on $(TARGET_PACKAGING_ARCH)" ;
+}
+
+
+
 # GPL add-ons
 if $(HAIKU_INCLUDE_GPL_ADDONS) = 1 {
        EnableBuildFeatures gpl ;
diff --git a/build/jam/packages/Haiku b/build/jam/packages/Haiku
index 4920449..d2f8b35 100644
--- a/build/jam/packages/Haiku
+++ b/build/jam/packages/Haiku
@@ -43,7 +43,7 @@ AddFilesToPackage add-ons kernel busses virtio : virtio_pci ;
 AddFilesToPackage add-ons kernel console : vga_text ;
 AddFilesToPackage add-ons kernel debugger
        : <kdebug>demangle <kdebug>disasm@x86 <kdebug>hangman
-         <kdebug>invalidate_on_exit <kdebug>usb_keyboard <kdebug>qrencode
+         <kdebug>invalidate_on_exit <kdebug>usb_keyboard 
<kdebug>qrencode@libqrencode
          <kdebug>run_on_exit ;
 AddFilesToPackage add-ons kernel file_systems : $(SYSTEM_ADD_ONS_FILE_SYSTEMS) 
;
 AddFilesToPackage add-ons kernel generic
diff --git a/build/jam/packages/HaikuBootstrap 
b/build/jam/packages/HaikuBootstrap
index a017b35..afe4f8c 100644
--- a/build/jam/packages/HaikuBootstrap
+++ b/build/jam/packages/HaikuBootstrap
@@ -42,7 +42,7 @@ AddFilesToPackage add-ons kernel busses virtio : virtio_pci ;
 AddFilesToPackage add-ons kernel console : vga_text ;
 AddFilesToPackage add-ons kernel debugger
        : <kdebug>demangle <kdebug>disasm@x86 <kdebug>hangman
-         <kdebug>invalidate_on_exit <kdebug>usb_keyboard <kdebug>qrencode
+         <kdebug>invalidate_on_exit <kdebug>usb_keyboard
          <kdebug>run_on_exit ;
 AddFilesToPackage add-ons kernel file_systems : $(SYSTEM_ADD_ONS_FILE_SYSTEMS) 
;
 AddFilesToPackage add-ons kernel generic
diff --git a/src/add-ons/kernel/debugger/qrencode/Jamfile 
b/src/add-ons/kernel/debugger/qrencode/Jamfile
index c196777..0ed225d 100644
--- a/src/add-ons/kernel/debugger/qrencode/Jamfile
+++ b/src/add-ons/kernel/debugger/qrencode/Jamfile
@@ -2,21 +2,11 @@ SubDir HAIKU_TOP src add-ons kernel debugger qrencode ;
 
 UsePrivateHeaders kernel ;
 
-DEFINES += HAVE_CONFIG_H ;
-DEFINES += malloc=debug_malloc ;
-DEFINES += calloc=debug_calloc ;
-DEFINES += free=debug_free ;
+UseBuildFeatureHeaders libqrencode ;
+Includes [ FGristFiles module.cpp ]
+       : [ BuildFeatureAttribute libqrencode : headers ] ;
 
 KernelAddon <kdebug>qrencode :
-       bitstream.c
-       mask.c
-       mmask.c
-       mqrspec.c
-       qrencode.c
-       qrinput.c
-       qrspec.c
-       rscode.c
-       split.c
-
        module.cpp
+       : [ BuildFeatureAttribute libqrencode : library ]
        ;
diff --git a/src/add-ons/kernel/debugger/qrencode/bitstream.c 
b/src/add-ons/kernel/debugger/qrencode/bitstream.c
deleted file mode 100644
index a0b9283..0000000
--- a/src/add-ons/kernel/debugger/qrencode/bitstream.c
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * qrencode - QR Code encoder
- *
- * Binary sequence class.
- * Copyright (C) 2006-2011 Kentaro Fukuchi <kentaro@xxxxxxxxxxx>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "bitstream.h"
-
-BitStream *BitStream_new(void)
-{
-       BitStream *bstream;
-
-       bstream = (BitStream *)malloc(sizeof(BitStream));
-       if(bstream == NULL) return NULL;
-
-       bstream->length = 0;
-       bstream->data = NULL;
-
-       return bstream;
-}
-
-static int BitStream_allocate(BitStream *bstream, int length)
-{
-       unsigned char *data;
-
-       if(bstream == NULL) {
-               return -1;
-       }
-
-       data = (unsigned char *)malloc(length);
-       if(data == NULL) {
-               return -1;
-       }
-
-       if(bstream->data) {
-               free(bstream->data);
-       }
-       bstream->length = length;
-       bstream->data = data;
-
-       return 0;
-}
-
-static BitStream *BitStream_newFromNum(int bits, unsigned int num)
-{
-       unsigned int mask;
-       int i;
-       unsigned char *p;
-       BitStream *bstream;
-
-       bstream = BitStream_new();
-       if(bstream == NULL) return NULL;
-
-       if(BitStream_allocate(bstream, bits)) {
-               BitStream_free(bstream);
-               return NULL;
-       }
-
-       p = bstream->data;
-       mask = 1 << (bits - 1);
-       for(i=0; i<bits; i++) {
-               if(num & mask) {
-                       *p = 1;
-               } else {
-                       *p = 0;
-               }
-               p++;
-               mask = mask >> 1;
-       }
-
-       return bstream;
-}
-
-static BitStream *BitStream_newFromBytes(int size, unsigned char *data)
-{
-       unsigned char mask;
-       int i, j;
-       unsigned char *p;
-       BitStream *bstream;
-
-       bstream = BitStream_new();
-       if(bstream == NULL) return NULL;
-
-       if(BitStream_allocate(bstream, size * 8)) {
-               BitStream_free(bstream);
-               return NULL;
-       }
-
-       p = bstream->data;
-       for(i=0; i<size; i++) {
-               mask = 0x80;
-               for(j=0; j<8; j++) {
-                       if(data[i] & mask) {
-                               *p = 1;
-                       } else {
-                               *p = 0;
-                       }
-                       p++;
-                       mask = mask >> 1;
-               }
-       }
-
-       return bstream;
-}
-
-int BitStream_append(BitStream *bstream, BitStream *arg)
-{
-       unsigned char *data;
-
-       if(arg == NULL) {
-               return -1;
-       }
-       if(arg->length == 0) {
-               return 0;
-       }
-       if(bstream->length == 0) {
-               if(BitStream_allocate(bstream, arg->length)) {
-                       return -1;
-               }
-               memcpy(bstream->data, arg->data, arg->length);
-               return 0;
-       }
-
-       data = (unsigned char *)malloc(bstream->length + arg->length);
-       if(data == NULL) {
-               return -1;
-       }
-       memcpy(data, bstream->data, bstream->length);
-       memcpy(data + bstream->length, arg->data, arg->length);
-
-       free(bstream->data);
-       bstream->length += arg->length;
-       bstream->data = data;
-
-       return 0;
-}
-
-int BitStream_appendNum(BitStream *bstream, int bits, unsigned int num)
-{
-       BitStream *b;
-       int ret;
-
-       if(bits == 0) return 0;
-
-       b = BitStream_newFromNum(bits, num);
-       if(b == NULL) return -1;
-
-       ret = BitStream_append(bstream, b);
-       BitStream_free(b);
-
-       return ret;
-}
-
-int BitStream_appendBytes(BitStream *bstream, int size, unsigned char *data)
-{
-       BitStream *b;
-       int ret;
-
-       if(size == 0) return 0;
-
-       b = BitStream_newFromBytes(size, data);
-       if(b == NULL) return -1;
-
-       ret = BitStream_append(bstream, b);
-       BitStream_free(b);
-
-       return ret;
-}
-
-unsigned char *BitStream_toByte(BitStream *bstream)
-{
-       int i, j, size, bytes;
-       unsigned char *data, v;
-       unsigned char *p;
-
-       size = BitStream_size(bstream);
-       if(size == 0) {
-               return NULL;
-       }
-       data = (unsigned char *)malloc((size + 7) / 8);
-       if(data == NULL) {
-               return NULL;
-       }
-
-       bytes = size  / 8;
-
-       p = bstream->data;
-       for(i=0; i<bytes; i++) {
-               v = 0;
-               for(j=0; j<8; j++) {
-                       v = v << 1;
-                       v |= *p;
-                       p++;
-               }
-               data[i] = v;
-       }
-       if(size & 7) {
-               v = 0;
-               for(j=0; j<(size & 7); j++) {
-                       v = v << 1;
-                       v |= *p;
-                       p++;
-               }
-               data[bytes] = v;
-       }
-
-       return data;
-}
-
-void BitStream_free(BitStream *bstream)
-{
-       if(bstream != NULL) {
-               free(bstream->data);
-               free(bstream);
-       }
-}
diff --git a/src/add-ons/kernel/debugger/qrencode/bitstream.h 
b/src/add-ons/kernel/debugger/qrencode/bitstream.h
deleted file mode 100644
index ffe743c..0000000
--- a/src/add-ons/kernel/debugger/qrencode/bitstream.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * qrencode - QR Code encoder
- *
- * Binary sequence class.
- * Copyright (C) 2006-2011 Kentaro Fukuchi <kentaro@xxxxxxxxxxx>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __BITSTREAM_H__
-#define __BITSTREAM_H__
-
-typedef struct {
-       int length;
-       unsigned char *data;
-} BitStream;
-
-extern BitStream *BitStream_new(void);
-extern int BitStream_append(BitStream *bstream, BitStream *arg);
-extern int BitStream_appendNum(BitStream *bstream, int bits, unsigned int num);
-extern int BitStream_appendBytes(BitStream *bstream, int size, unsigned char 
*data);
-#define BitStream_size(__bstream__) (__bstream__->length)
-extern unsigned char *BitStream_toByte(BitStream *bstream);
-extern void BitStream_free(BitStream *bstream);
-
-#endif /* __BITSTREAM_H__ */
diff --git a/src/add-ons/kernel/debugger/qrencode/config.h 
b/src/add-ons/kernel/debugger/qrencode/config.h
deleted file mode 100644
index 20515db..0000000
--- a/src/add-ons/kernel/debugger/qrencode/config.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#define MAJOR_VERSION 3
-#define MINOR_VERSION 3
-#define MICRO_VERSION 0
-#define VERSION "3.3.0"
-#define __STATIC static
diff --git a/src/add-ons/kernel/debugger/qrencode/mask.c 
b/src/add-ons/kernel/debugger/qrencode/mask.c
deleted file mode 100644
index 47c658c..0000000
--- a/src/add-ons/kernel/debugger/qrencode/mask.c
+++ /dev/null
@@ -1,330 +0,0 @@
-/*
- * qrencode - QR Code encoder
- *
- * Masking.
- * Copyright (C) 2006-2011 Kentaro Fukuchi <kentaro@xxxxxxxxxxx>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <errno.h>
-
-#include "qrencode.h"
-#include "qrspec.h"
-#include "mask.h"
-
-__STATIC int Mask_writeFormatInformation(int width, unsigned char *frame, int 
mask, QRecLevel level)
-{
-       unsigned int format;
-       unsigned char v;
-       int i;
-       int blacks = 0;
-
-       format = QRspec_getFormatInfo(mask, level);
-
-       for(i=0; i<8; i++) {
-               if(format & 1) {
-                       blacks += 2;
-                       v = 0x85;
-               } else {
-                       v = 0x84;
-               }
-               frame[width * 8 + width - 1 - i] = v;
-               if(i < 6) {
-                       frame[width * i + 8] = v;
-               } else {
-                       frame[width * (i + 1) + 8] = v;
-               }
-               format= format >> 1;
-       }
-       for(i=0; i<7; i++) {
-               if(format & 1) {
-                       blacks += 2;
-                       v = 0x85;
-               } else {
-                       v = 0x84;
-               }
-               frame[width * (width - 7 + i) + 8] = v;
-               if(i == 0) {
-                       frame[width * 8 + 7] = v;
-               } else {
-                       frame[width * 8 + 6 - i] = v;
-               }
-               format= format >> 1;
-       }
-
-       return blacks;
-}
-
-/**
- * Demerit coefficients.
- * See Section 8.8.2, pp.45, JIS X0510:2004.
- */
-#define N1 (3)
-#define N2 (3)
-#define N3 (40)
-#define N4 (10)
-
-#define MASKMAKER(__exp__) \
-       int x, y;\
-       int b = 0;\
-\
-       for(y=0; y<width; y++) {\
-               for(x=0; x<width; x++) {\
-                       if(*s & 0x80) {\
-                               *d = *s;\
-                       } else {\
-                               *d = *s ^ ((__exp__) == 0);\
-                       }\
-                       b += (int)(*d & 1);\
-                       s++; d++;\
-               }\
-       }\
-       return b;
-
-static int Mask_mask0(int width, const unsigned char *s, unsigned char *d)
-{
-       MASKMAKER((x+y)&1)
-}
-
-static int Mask_mask1(int width, const unsigned char *s, unsigned char *d)
-{
-       MASKMAKER(y&1)
-}
-
-static int Mask_mask2(int width, const unsigned char *s, unsigned char *d)
-{
-       MASKMAKER(x%3)
-}
-
-static int Mask_mask3(int width, const unsigned char *s, unsigned char *d)
-{
-       MASKMAKER((x+y)%3)
-}
-
-static int Mask_mask4(int width, const unsigned char *s, unsigned char *d)
-{
-       MASKMAKER(((y/2)+(x/3))&1)
-}
-
-static int Mask_mask5(int width, const unsigned char *s, unsigned char *d)
-{
-       MASKMAKER(((x*y)&1)+(x*y)%3)
-}
-
-static int Mask_mask6(int width, const unsigned char *s, unsigned char *d)
-{
-       MASKMAKER((((x*y)&1)+(x*y)%3)&1)
-}
-
-static int Mask_mask7(int width, const unsigned char *s, unsigned char *d)
-{
-       MASKMAKER((((x*y)%3)+((x+y)&1))&1)
-}
-
-#define maskNum (8)
-typedef int MaskMaker(int, const unsigned char *, unsigned char *);
-static MaskMaker *maskMakers[maskNum] = {
-       Mask_mask0, Mask_mask1, Mask_mask2, Mask_mask3,
-       Mask_mask4, Mask_mask5, Mask_mask6, Mask_mask7
-};
-
-#ifdef WITH_TESTS
-unsigned char *Mask_makeMaskedFrame(int width, unsigned char *frame, int mask)
-{
-       unsigned char *masked;
-
-       masked = (unsigned char *)malloc(width * width);
-       if(masked == NULL) return NULL;
-
-       maskMakers[mask](width, frame, masked);
-
-       return masked;
-}
-#endif
-
-unsigned char *Mask_makeMask(int width, unsigned char *frame, int mask, 
QRecLevel level)
-{
-       unsigned char *masked;
-
-       if(mask < 0 || mask >= maskNum) {
-               errno = EINVAL;
-               return NULL;
-       }
-
-       masked = (unsigned char *)malloc(width * width);
-       if(masked == NULL) return NULL;
-
-       maskMakers[mask](width, frame, masked);
-       Mask_writeFormatInformation(width, masked, mask, level);
-
-       return masked;
-}
-
-
-//static int n1;
-//static int n2;
-//static int n3;
-//static int n4;
-
-__STATIC int Mask_calcN1N3(int length, int *runLength)
-{
-       int i;
-       int demerit = 0;
-       int fact;
-
-       for(i=0; i<length; i++) {
-               if(runLength[i] >= 5) {
-                       demerit += N1 + (runLength[i] - 5);
-                       //n1 += N1 + (runLength[i] - 5);
-               }
-               if((i & 1)) {
-                       if(i >= 3 && i < length-2 && (runLength[i] % 3) == 0) {
-                               fact = runLength[i] / 3;
-                               if(runLength[i-2] == fact &&
-                                  runLength[i-1] == fact &&
-                                  runLength[i+1] == fact &&
-                                  runLength[i+2] == fact) {
-                                       if(i == 3 || runLength[i-3] >= 4 * 
fact) {
-                                               demerit += N3;
-                                               //n3 += N3;
-                                       } else if(i+4 >= length || 
runLength[i+3] >= 4 * fact) {
-                                               demerit += N3;
-                                               //n3 += N3;
-                                       }
-                               }
-                       }
-               }
-       }
-
-       return demerit;
-}
-
-__STATIC int Mask_calcN2(int width, unsigned char *frame)
-{
-       int x, y;
-       unsigned char *p;
-       unsigned char b22, w22;
-       int demerit = 0;
-
-       p = frame + width + 1;
-       for(y=1; y<width; y++) {
-               for(x=1; x<width; x++) {
-                       b22 = p[0] & p[-1] & p[-width] & p [-width-1];
-                       w22 = p[0] | p[-1] | p[-width] | p [-width-1];
-                       if((b22 | (w22 ^ 1))&1) {
-                               demerit += N2;
-                       }
-                       p++;
-               }
-               p++;
-       }
-
-       return demerit;
-}
-
-__STATIC int Mask_calcRunLength(int width, unsigned char *frame, int dir, int 
*runLength)
-{
-       int head;
-       int i;
-       unsigned char *p;
-       int pitch;
-
-       pitch = (dir==0)?1:width;
-       if(frame[0] & 1) {
-               runLength[0] = -1;
-               head = 1;
-       } else {
-               head = 0;
-       }
-       runLength[head] = 1;
-       p = frame + pitch;
-
-       for(i=1; i<width; i++) {
-               if((p[0] ^ p[-pitch]) & 1) {
-                       head++;
-                       runLength[head] = 1;
-               } else {
-                       runLength[head]++;
-               }
-               p += pitch;
-       }
-
-       return head + 1;
-}
-
-__STATIC int Mask_evaluateSymbol(int width, unsigned char *frame)
-{
-       int x, y;
-       int demerit = 0;
-       int runLength[QRSPEC_WIDTH_MAX + 1];
-       int length;
-
-       demerit += Mask_calcN2(width, frame);
-
-       for(y=0; y<width; y++) {
-               length = Mask_calcRunLength(width, frame + y * width, 0, 
runLength);
-               demerit += Mask_calcN1N3(length, runLength);
-       }
-
-       for(x=0; x<width; x++) {
-               length = Mask_calcRunLength(width, frame + x, 1, runLength);
-               demerit += Mask_calcN1N3(length, runLength);
-       }
-
-       return demerit;
-}
-
-unsigned char *Mask_mask(int width, unsigned char *frame, QRecLevel level)
-{
-       int i;
-       unsigned char *mask, *bestMask;
-       int minDemerit = INT_MAX;
-       int blacks;
-       int bratio;
-       int demerit;
-       int w2 = width * width;
-
-       mask = (unsigned char *)malloc(w2);
-       if(mask == NULL) return NULL;
-       bestMask = NULL;
-
-       for(i=0; i<maskNum; i++) {
-//             n1 = n2 = n3 = n4 = 0;
-               demerit = 0;
-               blacks = maskMakers[i](width, frame, mask);
-               blacks += Mask_writeFormatInformation(width, mask, i, level);
-               bratio = (200 * blacks + w2) / w2 / 2; /* 
(int)(100*blacks/w2+0.5) */
-               demerit = (abs(bratio - 50) / 5) * N4;
-//             n4 = demerit;
-               demerit += Mask_evaluateSymbol(width, mask);
-//             printf("(%d,%d,%d,%d)=%d\n", n1, n2, n3 ,n4, demerit);
-               if(demerit < minDemerit) {
-                       minDemerit = demerit;
-                       free(bestMask);
-                       bestMask = mask;
-                       mask = (unsigned char *)malloc(w2);
-                       if(mask == NULL) break;
-               }
-       }
-       free(mask);
-       return bestMask;
-}
diff --git a/src/add-ons/kernel/debugger/qrencode/mask.h 
b/src/add-ons/kernel/debugger/qrencode/mask.h
deleted file mode 100644
index d9e1e5d..0000000
--- a/src/add-ons/kernel/debugger/qrencode/mask.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * qrencode - QR Code encoder
- *
- * Masking.
- * Copyright (C) 2006-2011 Kentaro Fukuchi <kentaro@xxxxxxxxxxx>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __MASK_H__
-#define __MASK_H__
-
-extern unsigned char *Mask_makeMask(int width, unsigned char *frame, int mask, 
QRecLevel level);
-extern unsigned char *Mask_mask(int width, unsigned char *frame, QRecLevel 
level);
-
-#ifdef WITH_TESTS
-extern int Mask_calcN2(int width, unsigned char *frame);
-extern int Mask_calcN1N3(int length, int *runLength);
-extern int Mask_calcRunLength(int width, unsigned char *frame, int dir, int 
*runLength);
-extern int Mask_evaluateSymbol(int width, unsigned char *frame);
-extern int Mask_writeFormatInformation(int width, unsigned char *frame, int 
mask, QRecLevel level);
-extern unsigned char *Mask_makeMaskedFrame(int width, unsigned char *frame, 
int mask);
-#endif
-
-#endif /* __MASK_H__ */
diff --git a/src/add-ons/kernel/debugger/qrencode/mmask.c 
b/src/add-ons/kernel/debugger/qrencode/mmask.c
deleted file mode 100644
index 99470f2..0000000
--- a/src/add-ons/kernel/debugger/qrencode/mmask.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * qrencode - QR Code encoder
- *
- * Masking for Micro QR Code.
- * Copyright (C) 2006-2011 Kentaro Fukuchi <kentaro@xxxxxxxxxxx>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <errno.h>
-
-#include "qrencode.h"
-#include "mqrspec.h"
-#include "mmask.h"
-
-__STATIC void MMask_writeFormatInformation(int version, int width, unsigned 
char *frame, int mask, QRecLevel level)
-{
-       unsigned int format;
-       unsigned char v;
-       int i;
-
-       format = MQRspec_getFormatInfo(mask, version, level);
-
-       for(i=0; i<8; i++) {
-               v = 0x84 | (format & 1);
-               frame[width * (i + 1) + 8] = v;
-               format = format >> 1;
-       }
-       for(i=0; i<7; i++) {
-               v = 0x84 | (format & 1);
-               frame[width * 8 + 7 - i] = v;
-               format = format >> 1;
-       }
-}
-
-#define MASKMAKER(__exp__) \
-       int x, y;\
-\
-       for(y=0; y<width; y++) {\
-               for(x=0; x<width; x++) {\
-                       if(*s & 0x80) {\
-                               *d = *s;\
-                       } else {\
-                               *d = *s ^ ((__exp__) == 0);\
-                       }\
-                       s++; d++;\
-               }\
-       }
-
-static void Mask_mask0(int width, const unsigned char *s, unsigned char *d)
-{
-       MASKMAKER(y&1)
-}
-
-static void Mask_mask1(int width, const unsigned char *s, unsigned char *d)
-{
-       MASKMAKER(((y/2)+(x/3))&1)
-}
-
-static void Mask_mask2(int width, const unsigned char *s, unsigned char *d)
-{
-       MASKMAKER((((x*y)&1)+(x*y)%3)&1)
-}
-
-static void Mask_mask3(int width, const unsigned char *s, unsigned char *d)
-{
-       MASKMAKER((((x+y)&1)+((x*y)%3))&1)
-}
-
-#define maskNum (4)
-typedef void MaskMaker(int, const unsigned char *, unsigned char *);
-static MaskMaker *maskMakers[maskNum] = {
-       Mask_mask0, Mask_mask1, Mask_mask2, Mask_mask3
-};
-
-#ifdef WITH_TESTS
-unsigned char *MMask_makeMaskedFrame(int width, unsigned char *frame, int mask)
-{
-       unsigned char *masked;
-
-       masked = (unsigned char *)malloc(width * width);
-       if(masked == NULL) return NULL;
-
-       maskMakers[mask](width, frame, masked);
-
-       return masked;
-}
-#endif
-
-unsigned char *MMask_makeMask(int version, unsigned char *frame, int mask, 
QRecLevel level)
-{
-       unsigned char *masked;
-       int width;
-
-       if(mask < 0 || mask >= maskNum) {
-               errno = EINVAL;
-               return NULL;
-       }
-
-       width = MQRspec_getWidth(version);
-       masked = (unsigned char *)malloc(width * width);
-       if(masked == NULL) return NULL;
-
-       maskMakers[mask](width, frame, masked);
-       MMask_writeFormatInformation(version, width, masked, mask, level);
-
-       return masked;
-}
-
-__STATIC int MMask_evaluateSymbol(int width, unsigned char *frame)
-{
-       int x, y;
-       unsigned char *p;
-       int sum1 = 0, sum2 = 0;
-
-       p = frame + width * (width - 1);
-       for(x=1; x<width; x++) {
-               sum1 += (p[x] & 1);
-       }
-
-       p = frame + width * 2 - 1;
-       for(y=1; y<width; y++) {
-               sum2 += (*p & 1);
-               p += width;
-       }
-
-       return (sum1 <= sum2)?(sum1 * 16 + sum2):(sum2 * 16 + sum1);
-}
-
-unsigned char *MMask_mask(int version, unsigned char *frame, QRecLevel level)
-{
-       int i;
-       unsigned char *mask, *bestMask;
-       int maxScore = 0;
-       int score;
-       int width;
-
-       width = MQRspec_getWidth(version);
-
-       mask = (unsigned char *)malloc(width * width);
-       if(mask == NULL) return NULL;
-       bestMask = NULL;
-
-       for(i=0; i<maskNum; i++) {
-               score = 0;
-               maskMakers[i](width, frame, mask);
-               MMask_writeFormatInformation(version, width, mask, i, level);
-               score = MMask_evaluateSymbol(width, mask);
-               if(score > maxScore) {
-                       maxScore = score;
-                       free(bestMask);
-                       bestMask = mask;
-                       mask = (unsigned char *)malloc(width * width);
-                       if(mask == NULL) break;
-               }
-       }
-       free(mask);
-       return bestMask;
-}
diff --git a/src/add-ons/kernel/debugger/qrencode/mmask.h 
b/src/add-ons/kernel/debugger/qrencode/mmask.h
deleted file mode 100644
index f6556e8..0000000
--- a/src/add-ons/kernel/debugger/qrencode/mmask.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * qrencode - QR Code encoder
- *
- * Masking for Micro QR Code.
- * Copyright (C) 2006-2011 Kentaro Fukuchi <kentaro@xxxxxxxxxxx>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __MMASK_H__
-#define __MMASK_H__
-
-extern unsigned char *MMask_makeMask(int version, unsigned char *frame, int 
mask, QRecLevel level);
-extern unsigned char *MMask_mask(int version, unsigned char *frame, QRecLevel 
level);
-
-#ifdef WITH_TESTS
-extern int MMask_evaluateSymbol(int width, unsigned char *frame);
-extern void MMask_writeFormatInformation(int version, int width, unsigned char 
*frame, int mask, QRecLevel level);
-extern unsigned char *MMask_makeMaskedFrame(int width, unsigned char *frame, 
int mask);
-#endif
-
-#endif /* __MMASK_H__ */
diff --git a/src/add-ons/kernel/debugger/qrencode/mqrspec.c 
b/src/add-ons/kernel/debugger/qrencode/mqrspec.c
deleted file mode 100644
index 76d2d26..0000000
--- a/src/add-ons/kernel/debugger/qrencode/mqrspec.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- * qrencode - QR Code encoder
- *
- * Micor QR Code specification in convenient format. 
- * Copyright (C) 2006-2011 Kentaro Fukuchi <kentaro@xxxxxxxxxxx>
- *
- * The following data / specifications are taken from
- * "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004)
- *  or
- * "Automatic identification and data capture techniques -- 
- *  QR Code 2005 bar code symbology specification" (ISO/IEC 18004:2006)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#ifdef HAVE_LIBPTHREAD
-#include <pthread.h>
-#endif
-
-#include "mqrspec.h"
-
-/******************************************************************************
- * Version and capacity
- *****************************************************************************/
-
-typedef struct {
-       int width; //< Edge length of the symbol
-       int ec[4];  //< Number of ECC code (bytes)
-} MQRspec_Capacity;
-
-/**
- * Table of the capacity of symbols
- * See Table 1 (pp.106) and Table 8 (pp.113) of Appendix 1, JIS X0510:2004.
- */
-static const MQRspec_Capacity mqrspecCapacity[MQRSPEC_VERSION_MAX + 1] = {
-       {  0, {0,  0,  0, 0}},
-       { 11, {2,  0,  0, 0}},
-       { 13, {5,  6,  0, 0}},
-       { 15, {6,  8,  0, 0}},
-       { 17, {8, 10, 14, 0}}
-};
-
-int MQRspec_getDataLengthBit(int version, QRecLevel level)
-{
-       int w;
-       int ecc;
-
-       w = mqrspecCapacity[version].width - 1;
-       ecc = mqrspecCapacity[version].ec[level];
-       if(ecc == 0) return 0;
-       return w * w - 64 - ecc * 8;
-}
-
-int MQRspec_getDataLength(int version, QRecLevel level)
-{
-       return (MQRspec_getDataLengthBit(version, level) + 4) / 8;
-}
-
-int MQRspec_getECCLength(int version, QRecLevel level)
-{
-       return mqrspecCapacity[version].ec[level];
-}
-
-int MQRspec_getWidth(int version)
-{
-       return mqrspecCapacity[version].width;
-}
-
-/******************************************************************************
- * Length indicator
- *****************************************************************************/
-
-/**
- * See Table 3 (pp.107) of Appendix 1, JIS X0510:2004.
- */
-static const int lengthTableBits[4][4] = {
-       { 3, 4, 5, 6},
-       { 0, 3, 4, 5},
-       { 0, 0, 4, 5},
-       { 0, 0, 3, 4}
-};
-
-int MQRspec_lengthIndicator(QRencodeMode mode, int version)
-{
-       return lengthTableBits[mode][version - 1];
-}
-
-int MQRspec_maximumWords(QRencodeMode mode, int version)
-{
-       int bits;
-       int words;
-
-       bits = lengthTableBits[mode][version - 1];
-       words = (1 << bits) - 1;
-       if(mode == QR_MODE_KANJI) {
-               words *= 2; // the number of bytes is required
-       }
-
-       return words;
-}
-
-/******************************************************************************
- * Format information
- *****************************************************************************/
-
-/* See calcFormatInfo in tests/test_mqrspec.c */
-static const unsigned int formatInfo[4][8] = {
-       {0x4445, 0x55ae, 0x6793, 0x7678, 0x06de, 0x1735, 0x2508, 0x34e3},
-       {0x4172, 0x5099, 0x62a4, 0x734f, 0x03e9, 0x1202, 0x203f, 0x31d4},
-       {0x4e2b, 0x5fc0, 0x6dfd, 0x7c16, 0x0cb0, 0x1d5b, 0x2f66, 0x3e8d},
-       {0x4b1c, 0x5af7, 0x68ca, 0x7921, 0x0987, 0x186c, 0x2a51, 0x3bba}
-};
-
-/* See Table 10 of Appendix 1. (pp.115) */
-static const int typeTable[MQRSPEC_VERSION_MAX + 1][3] = {
-       {-1, -1, -1},
-       { 0, -1, -1},
-       { 1,  2, -1},
-       { 3,  4, -1},
-       { 5,  6,  7}
-};
-
-unsigned int MQRspec_getFormatInfo(int mask, int version, QRecLevel level)
-{
-       int type;
-
-       if(mask < 0 || mask > 3) return 0;
-       if(version <= 0 || version > MQRSPEC_VERSION_MAX) return 0;
-       if(level == QR_ECLEVEL_H) return 0;
-       type = typeTable[version][level];
-       if(type < 0) return 0;
-
-       return formatInfo[mask][type];
-}
-
-/******************************************************************************
- * Frame
- *****************************************************************************/
-
-/**
- * Cache of initial frames.
- */
-/* C99 says that static storage shall be initialized to a null pointer
- * by compiler. */
-static unsigned char *frames[MQRSPEC_VERSION_MAX + 1];
-#ifdef HAVE_LIBPTHREAD
-static pthread_mutex_t frames_mutex = PTHREAD_MUTEX_INITIALIZER;
-#endif
-
-/**
- * Put a finder pattern.
- * @param frame
- * @param width
- * @param ox,oy upper-left coordinate of the pattern
- */
-static void putFinderPattern(unsigned char *frame, int width, int ox, int oy)
-{
-       static const unsigned char finder[] = {
-               0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1,
-               0xc1, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc1,
-               0xc1, 0xc0, 0xc1, 0xc1, 0xc1, 0xc0, 0xc1,
-               0xc1, 0xc0, 0xc1, 0xc1, 0xc1, 0xc0, 0xc1,
-               0xc1, 0xc0, 0xc1, 0xc1, 0xc1, 0xc0, 0xc1,
-               0xc1, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc1,
-               0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1,
-       };
-       int x, y;
-       const unsigned char *s;
-
-       frame += oy * width + ox;
-       s = finder;
-       for(y=0; y<7; y++) {
-               for(x=0; x<7; x++) {
-                       frame[x] = s[x];
-               }
-               frame += width;
-               s += 7;
-       }
-}
-
-static unsigned char *MQRspec_createFrame(int version)
-{
-       unsigned char *frame, *p, *q;
-       int width;
-       int x, y;
-
-       width = mqrspecCapacity[version].width;
-       frame = (unsigned char *)malloc(width * width);
-       if(frame == NULL) return NULL;
-
-       memset(frame, 0, width * width);
-       /* Finder pattern */
-       putFinderPattern(frame, width, 0, 0);
-       /* Separator */
-       p = frame;
-       for(y=0; y<7; y++) {
-               p[7] = 0xc0;
-               p += width;
-       }
-       memset(frame + width * 7, 0xc0, 8);
-       /* Mask format information area */
-       memset(frame + width * 8 + 1, 0x84, 8);
-       p = frame + width + 8;
-       for(y=0; y<7; y++) {
-               *p = 0x84;
-               p += width;
-       }
-       /* Timing pattern */
-       p = frame + 8;
-       q = frame + width * 8;
-       for(x=1; x<width-7; x++) {
-               *p =  0x90 | (x & 1);
-               *q =  0x90 | (x & 1);
-               p++;
-               q += width;
-       }
-
-       return frame;
-}
-
-unsigned char *MQRspec_newFrame(int version)
-{
-       unsigned char *frame;
-       int width;
-
-       if(version < 1 || version > MQRSPEC_VERSION_MAX) return NULL;
-
-#ifdef HAVE_LIBPTHREAD
-       pthread_mutex_lock(&frames_mutex);
-#endif
-       if(frames[version] == NULL) {
-               frames[version] = MQRspec_createFrame(version);
-       }
-#ifdef HAVE_LIBPTHREAD
-       pthread_mutex_unlock(&frames_mutex);
-#endif
-       if(frames[version] == NULL) return NULL;
-
-       width = mqrspecCapacity[version].width;
-       frame = (unsigned char *)malloc(width * width);
-       if(frame == NULL) return NULL;
-       memcpy(frame, frames[version], width * width);
-
-       return frame;
-}
-
-void MQRspec_clearCache(void)
-{
-       int i;
-
-#ifdef HAVE_LIBPTHREAD
-       pthread_mutex_lock(&frames_mutex);
-#endif
-       for(i=1; i<=MQRSPEC_VERSION_MAX; i++) {
-               free(frames[i]);
-               frames[i] = NULL;
-       }
-#ifdef HAVE_LIBPTHREAD
-       pthread_mutex_unlock(&frames_mutex);
-#endif
-}
diff --git a/src/add-ons/kernel/debugger/qrencode/mqrspec.h 
b/src/add-ons/kernel/debugger/qrencode/mqrspec.h
deleted file mode 100644
index 2d4b90d..0000000
--- a/src/add-ons/kernel/debugger/qrencode/mqrspec.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * qrencode - QR Code encoder
- *
- * Micro QR Code specification in convenient format. 
- * Copyright (C) 2006-2011 Kentaro Fukuchi <kentaro@xxxxxxxxxxx>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __MQRSPEC_H__
-#define __MQRSPEC_H__
-
-#include "qrencode.h"
-
-/******************************************************************************
- * Version and capacity
- *****************************************************************************/
-
-/**
- * Maximum width of a symbol
- */
-#define MQRSPEC_WIDTH_MAX 17
-
-/**
- * Return maximum data code length (bits) for the version.
- * @param version
- * @param level
- * @return maximum size (bits)
- */
-extern int MQRspec_getDataLengthBit(int version, QRecLevel level);
-
-/**
- * Return maximum data code length (bytes) for the version.
- * @param version
- * @param level
- * @return maximum size (bytes)
- */
-extern int MQRspec_getDataLength(int version, QRecLevel level);
-
-/**
- * Return maximum error correction code length (bytes) for the version.
- * @param version
- * @param level
- * @return ECC size (bytes)
- */
-extern int MQRspec_getECCLength(int version, QRecLevel level);
-
-/**
- * Return a version number that satisfies the input code length.
- * @param size input code length (byte)
- * @param level
- * @return version number
- */
-extern int MQRspec_getMinimumVersion(int size, QRecLevel level);
-
-/**
- * Return the width of the symbol for the version.
- * @param version
- * @return width
- */
-extern int MQRspec_getWidth(int version);
-
-/**
- * Return the numer of remainder bits.
- * @param version
- * @return number of remainder bits
- */
-extern int MQRspec_getRemainder(int version);
-
-/******************************************************************************
- * Length indicator
- *****************************************************************************/
-
-/**
- * Return the size of lenght indicator for the mode and version.
- * @param mode
- * @param version
- * @return the size of the appropriate length indicator (bits).
- */
-extern int MQRspec_lengthIndicator(QRencodeMode mode, int version);
-
-/**
- * Return the maximum length for the mode and version.
- * @param mode
- * @param version
- * @return the maximum length (bytes)
- */
-extern int MQRspec_maximumWords(QRencodeMode mode, int version);
-
-/******************************************************************************
- * Version information pattern
- *****************************************************************************/
-
-/**
- * Return BCH encoded version information pattern that is used for the symbol
- * of version 7 or greater. Use lower 18 bits.
- * @param version
- * @return BCH encoded version information pattern
- */
-extern unsigned int MQRspec_getVersionPattern(int version);
-
-/******************************************************************************
- * Format information
- *****************************************************************************/
-
-/**
- * Return BCH encoded format information pattern.
- * @param mask
- * @param version
- * @param level
- * @return BCH encoded format information pattern
- */
-extern unsigned int MQRspec_getFormatInfo(int mask, int version, QRecLevel 
level);
-
-/******************************************************************************
- * Frame
- *****************************************************************************/
-
-/**
- * Return a copy of initialized frame.
- * When the same version is requested twice or more, a copy of cached frame
- * is returned.
- * @param version
- * @return Array of unsigned char. You can free it by free().
- */
-extern unsigned char *MQRspec_newFrame(int version);
-
-/**
- * Clear the frame cache. Typically for debug.
- */
-extern void MQRspec_clearCache(void);
-
-/******************************************************************************
- * Mode indicator
- *****************************************************************************/
-
-/**
- * Mode indicator. See Table 2 in Appendix 1 of JIS X0510:2004, pp.107.
- */
-#define MQRSPEC_MODEID_NUM       0
-#define MQRSPEC_MODEID_AN        1
-#define MQRSPEC_MODEID_8         2
-#define MQRSPEC_MODEID_KANJI     3
-
-#endif /* __MQRSPEC_H__ */
diff --git a/src/add-ons/kernel/debugger/qrencode/qrencode.c 
b/src/add-ons/kernel/debugger/qrencode/qrencode.c
deleted file mode 100644
index d166a24..0000000
--- a/src/add-ons/kernel/debugger/qrencode/qrencode.c
+++ /dev/null
@@ -1,929 +0,0 @@
-/*
- * qrencode - QR Code encoder
- *
- * Copyright (C) 2006-2012 Kentaro Fukuchi <kentaro@xxxxxxxxxxx>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-#include "qrencode.h"
-#include "qrspec.h"
-#include "mqrspec.h"
-#include "bitstream.h"
-#include "qrinput.h"
-#include "rscode.h"
-#include "split.h"
-#include "mask.h"
-#include "mmask.h"
-
-/******************************************************************************
- * Raw code
- *****************************************************************************/
-
-typedef struct {
-       int dataLength;
-       unsigned char *data;
-       int eccLength;
-       unsigned char *ecc;
-} RSblock;
-
-typedef struct {
-       int version;
-       int dataLength;
-       int eccLength;
-       unsigned char *datacode;
-       unsigned char *ecccode;
-       int b1;
-       int blocks;
-       RSblock *rsblock;
-       int count;
-} QRRawCode;
-
-static void RSblock_initBlock(RSblock *block, int dl, unsigned char *data, int 
el, unsigned char *ecc, RS *rs)
-{
-       block->dataLength = dl;
-       block->data = data;
-       block->eccLength = el;
-       block->ecc = ecc;
-
-       encode_rs_char(rs, data, ecc);
-}
-
-static int RSblock_init(RSblock *blocks, int spec[5], unsigned char *data, 
unsigned char *ecc)
-{
-       int i;
-       RSblock *block;
-       unsigned char *dp, *ep;
-       RS *rs;
-       int el, dl;
-
-       dl = QRspec_rsDataCodes1(spec);
-       el = QRspec_rsEccCodes1(spec);
-       rs = init_rs(8, 0x11d, 0, 1, el, 255 - dl - el);
-       if(rs == NULL) return -1;
-
-       block = blocks;
-       dp = data;
-       ep = ecc;
-       for(i=0; i<QRspec_rsBlockNum1(spec); i++) {
-               RSblock_initBlock(block, dl, dp, el, ep, rs);
-               dp += dl;
-               ep += el;
-               block++;
-       }
-
-       if(QRspec_rsBlockNum2(spec) == 0) return 0;
-
-       dl = QRspec_rsDataCodes2(spec);
-       el = QRspec_rsEccCodes2(spec);
-       rs = init_rs(8, 0x11d, 0, 1, el, 255 - dl - el);
-       if(rs == NULL) return -1;
-       for(i=0; i<QRspec_rsBlockNum2(spec); i++) {
-               RSblock_initBlock(block, dl, dp, el, ep, rs);
-               dp += dl;
-               ep += el;
-               block++;
-       }
-
-       return 0;
-}
-
-__STATIC void QRraw_free(QRRawCode *raw);
-__STATIC QRRawCode *QRraw_new(QRinput *input)
-{
-       QRRawCode *raw;
-       int spec[5], ret;
-
-       raw = (QRRawCode *)malloc(sizeof(QRRawCode));
-       if(raw == NULL) return NULL;
-
-       raw->datacode = QRinput_getByteStream(input);
-       if(raw->datacode == NULL) {
-               free(raw);
-               return NULL;
-       }
-
-       QRspec_getEccSpec(input->version, input->level, spec);
-
-       raw->version = input->version;
-       raw->b1 = QRspec_rsBlockNum1(spec);
-       raw->dataLength = QRspec_rsDataLength(spec);
-       raw->eccLength = QRspec_rsEccLength(spec);
-       raw->ecccode = (unsigned char *)malloc(raw->eccLength);
-       if(raw->ecccode == NULL) {
-               free(raw->datacode);
-               free(raw);
-               return NULL;
-       }
-
-       raw->blocks = QRspec_rsBlockNum(spec);
-       raw->rsblock = (RSblock *)calloc(sizeof(RSblock), raw->blocks);
-       if(raw->rsblock == NULL) {
-               QRraw_free(raw);
-               return NULL;
-       }
-       ret = RSblock_init(raw->rsblock, spec, raw->datacode, raw->ecccode);
-       if(ret < 0) {
-               QRraw_free(raw);
-               return NULL;
-       }
-
-       raw->count = 0;
-
-       return raw;
-}
-
-/**
- * Return a code (byte).
- * This function can be called iteratively.
- * @param raw raw code.
- * @return code
- */
-__STATIC unsigned char QRraw_getCode(QRRawCode *raw)
-{
-       int col, row;
-       unsigned char ret;
-
-       if(raw->count < raw->dataLength) {
-               row = raw->count % raw->blocks;
-               col = raw->count / raw->blocks;
-               if(col >= raw->rsblock[0].dataLength) {
-                       row += raw->b1;
-               }
-               ret = raw->rsblock[row].data[col];
-       } else if(raw->count < raw->dataLength + raw->eccLength) {
-               row = (raw->count - raw->dataLength) % raw->blocks;
-               col = (raw->count - raw->dataLength) / raw->blocks;
-               ret = raw->rsblock[row].ecc[col];
-       } else {
-               return 0;
-       }
-       raw->count++;
-       return ret;
-}
-
-__STATIC void QRraw_free(QRRawCode *raw)
-{
-       if(raw != NULL) {
-               free(raw->datacode);
-               free(raw->ecccode);
-               free(raw->rsblock);
-               free(raw);
-       }
-}
-
-/******************************************************************************
- * Raw code for Micro QR Code
- *****************************************************************************/
-
-typedef struct {
-       int version;
-       int dataLength;
-       int eccLength;
-       unsigned char *datacode;
-       unsigned char *ecccode;
-       RSblock *rsblock;
-       int oddbits;
-       int count;
-} MQRRawCode;
-
-__STATIC void MQRraw_free(MQRRawCode *raw);
-__STATIC MQRRawCode *MQRraw_new(QRinput *input)
-{
-       MQRRawCode *raw;
-       RS *rs;
-
-       raw = (MQRRawCode *)malloc(sizeof(MQRRawCode));
-       if(raw == NULL) return NULL;
-
-       raw->version = input->version;
-       raw->dataLength = MQRspec_getDataLength(input->version, input->level);
-       raw->eccLength = MQRspec_getECCLength(input->version, input->level);
-       raw->oddbits = raw->dataLength * 8 - 
MQRspec_getDataLengthBit(input->version, input->level);
-       raw->datacode = QRinput_getByteStream(input);
-       if(raw->datacode == NULL) {
-               free(raw);
-               return NULL;
-       }
-       raw->ecccode = (unsigned char *)malloc(raw->eccLength);
-       if(raw->ecccode == NULL) {
-               free(raw->datacode);
-               free(raw);
-               return NULL;
-       }
-
-       raw->rsblock = (RSblock *)calloc(sizeof(RSblock), 1);
-       if(raw->rsblock == NULL) {
-               MQRraw_free(raw);
-               return NULL;
-       }
-
-       rs = init_rs(8, 0x11d, 0, 1, raw->eccLength, 255 - raw->dataLength - 
raw->eccLength);
-       if(rs == NULL) {
-               MQRraw_free(raw);
-               return NULL;
-       }
-
-       RSblock_initBlock(raw->rsblock, raw->dataLength, raw->datacode, 
raw->eccLength, raw->ecccode, rs);
-
-       raw->count = 0;
-
-       return raw;
-}
-
-/**
- * Return a code (byte).
- * This function can be called iteratively.
- * @param raw raw code.
- * @return code
- */
-__STATIC unsigned char MQRraw_getCode(MQRRawCode *raw)
-{
-       unsigned char ret;
-
-       if(raw->count < raw->dataLength) {
-               ret = raw->datacode[raw->count];
-       } else if(raw->count < raw->dataLength + raw->eccLength) {
-               ret = raw->ecccode[raw->count - raw->dataLength];
-       } else {
-               return 0;
-       }
-       raw->count++;
-       return ret;
-}
-
-__STATIC void MQRraw_free(MQRRawCode *raw)
-{
-       if(raw != NULL) {
-               free(raw->datacode);
-               free(raw->ecccode);
-               free(raw->rsblock);
-               free(raw);
-       }
-}
-
-
-/******************************************************************************
- * Frame filling
- *****************************************************************************/
-
-typedef struct {
-       int width;
-       unsigned char *frame;
-       int x, y;
-       int dir;
-       int bit;
-       int mqr;
-} FrameFiller;
-
-static FrameFiller *FrameFiller_new(int width, unsigned char *frame, int mqr)
-{
-       FrameFiller *filler;
-
-       filler = (FrameFiller *)malloc(sizeof(FrameFiller));
-       if(filler == NULL) return NULL;
-       filler->width = width;
-       filler->frame = frame;
-       filler->x = width - 1;
-       filler->y = width - 1;
-       filler->dir = -1;
-       filler->bit = -1;
-       filler->mqr = mqr;
-
-       return filler;
-}
-
-static unsigned char *FrameFiller_next(FrameFiller *filler)
-{
-       unsigned char *p;
-       int x, y, w;
-
-       if(filler->bit == -1) {
-               filler->bit = 0;
-               return filler->frame + filler->y * filler->width + filler->x;
-       }
-
-       x = filler->x;
-       y = filler->y;
-       p = filler->frame;
-       w = filler->width;
-
-       if(filler->bit == 0) {
-               x--;
-               filler->bit++;
-       } else {
-               x++;
-               y += filler->dir;
-               filler->bit--;
-       }
-
-       if(filler->dir < 0) {
-               if(y < 0) {
-                       y = 0;
-                       x -= 2;
-                       filler->dir = 1;
-                       if(!filler->mqr && x == 6) {
-                               x--;
-                               y = 9;
-                       }
-               }
-       } else {
-               if(y == w) {
-                       y = w - 1;
-                       x -= 2;
-                       filler->dir = -1;
-                       if(!filler->mqr && x == 6) {
-                               x--;
-                               y -= 8;
-                       }
-               }
-       }
-       if(x < 0 || y < 0) return NULL;
-
-       filler->x = x;
-       filler->y = y;
-
-       if(p[y * w + x] & 0x80) {
-               // This tail recursion could be optimized.
-               return FrameFiller_next(filler);
-       }
-       return &p[y * w + x];
-}
-
-#ifdef WITH_TESTS
-extern unsigned char *FrameFiller_test(int version)
-{
-       int width;
-       unsigned char *frame, *p;
-       FrameFiller *filler;
-       int i, length;
-
-       width = QRspec_getWidth(version);
-       frame = QRspec_newFrame(version);
-       if(frame == NULL) return NULL;
-       filler = FrameFiller_new(width, frame, 0);
-       if(filler == NULL) {
-               free(frame);
-               return NULL;
-       }
-       length = QRspec_getDataLength(version, QR_ECLEVEL_L) * 8
-              + QRspec_getECCLength(version, QR_ECLEVEL_L) * 8
-                  + QRspec_getRemainder(version);
-       for(i=0; i<length; i++) {
-               p = FrameFiller_next(filler);
-               if(p == NULL) {
-                       free(filler);
-                       free(frame);
-                       return NULL;
-               }
-               *p = (unsigned char)(i & 0x7f) | 0x80;
-       }
-       free(filler);
-       return frame;
-}
-
-extern unsigned char *FrameFiller_testMQR(int version)
-{
-       int width;
-       unsigned char *frame, *p;
-       FrameFiller *filler;
-       int i, length;
-
-       width = MQRspec_getWidth(version);
-       frame = MQRspec_newFrame(version);
-       if(frame == NULL) return NULL;
-       filler = FrameFiller_new(width, frame, 1);
-       if(filler == NULL) {
-               free(frame);
-               return NULL;
-       }
-       length = MQRspec_getDataLengthBit(version, QR_ECLEVEL_L)
-              + MQRspec_getECCLength(version, QR_ECLEVEL_L) * 8;
-       for(i=0; i<length; i++) {
-               p = FrameFiller_next(filler);
-               if(p == NULL) {
-                       fprintf(stderr, "Frame filler run over the frame!\n");
-                       free(filler);
-                       return frame;
-               }
-               *p = (unsigned char)(i & 0x7f) | 0x80;
-       }
-       free(filler);
-       return frame;
-}
-#endif
-
-
-/******************************************************************************
- * QR-code encoding
- *****************************************************************************/
-
-__STATIC QRcode *QRcode_new(int version, int width, unsigned char *data)
-{
-       QRcode *qrcode;
-
-       qrcode = (QRcode *)malloc(sizeof(QRcode));
-       if(qrcode == NULL) return NULL;
-
-       qrcode->version = version;
-       qrcode->width = width;
-       qrcode->data = data;
-
-       return qrcode;
-}
-
-void QRcode_free(QRcode *qrcode)
-{
-       if(qrcode != NULL) {
-               free(qrcode->data);
-               free(qrcode);
-       }
-}
-
-__STATIC QRcode *QRcode_encodeMask(QRinput *input, int mask)
-{
-       int width, version;
-       QRRawCode *raw;
-       unsigned char *frame, *masked, *p, code, bit;
-       FrameFiller *filler;
-       int i, j;
-       QRcode *qrcode = NULL;
-
-       if(input->mqr) {
-               errno = EINVAL;
-               return NULL;
-       }
-       if(input->version < 0 || input->version > QRSPEC_VERSION_MAX) {
-               errno = EINVAL;
-               return NULL;
-       }
-       if(input->level > QR_ECLEVEL_H) {
-               errno = EINVAL;
-               return NULL;
-       }
-
-       raw = QRraw_new(input);
-       if(raw == NULL) return NULL;
-
-       version = raw->version;
-       width = QRspec_getWidth(version);
-       frame = QRspec_newFrame(version);
-       if(frame == NULL) {
-               QRraw_free(raw);
-               return NULL;
-       }
-       filler = FrameFiller_new(width, frame, 0);
-       if(filler == NULL) {
-               QRraw_free(raw);
-               free(frame);
-               return NULL;
-       }
-
-       /* inteleaved data and ecc codes */
-       for(i=0; i<raw->dataLength + raw->eccLength; i++) {
-               code = QRraw_getCode(raw);
-               bit = 0x80;
-               for(j=0; j<8; j++) {
-                       p = FrameFiller_next(filler);
-                       if(p == NULL)  goto EXIT;
-                       *p = 0x02 | ((bit & code) != 0);
-                       bit = bit >> 1;
-               }
-       }
-       QRraw_free(raw);
-       raw = NULL;
-       /* remainder bits */
-       j = QRspec_getRemainder(version);
-       for(i=0; i<j; i++) {
-               p = FrameFiller_next(filler);
-               if(p == NULL)  goto EXIT;
-               *p = 0x02;
-       }
-
-       /* masking */
-       if(mask == -2) { // just for debug purpose
-               masked = (unsigned char *)malloc(width * width);
-               memcpy(masked, frame, width * width);
-       } else if(mask < 0) {
-               masked = Mask_mask(width, frame, input->level);
-       } else {
-               masked = Mask_makeMask(width, frame, mask, input->level);
-       }
-       if(masked == NULL) {
-               goto EXIT;
-       }
-       qrcode = QRcode_new(version, width, masked);
-
-EXIT:
-       QRraw_free(raw);
-       free(filler);
-       free(frame);
-       return qrcode;
-}
-
-__STATIC QRcode *QRcode_encodeMaskMQR(QRinput *input, int mask)
-{
-       int width, version;
-       MQRRawCode *raw;
-       unsigned char *frame, *masked, *p, code, bit;
-       FrameFiller *filler;
-       int i, j;
-       QRcode *qrcode = NULL;
-
-       if(!input->mqr) {
-               errno = EINVAL;
-               return NULL;
-       }
-       if(input->version <= 0 || input->version > MQRSPEC_VERSION_MAX) {
-               errno = EINVAL;
-               return NULL;
-       }
-       if(input->level > QR_ECLEVEL_Q) {
-               errno = EINVAL;
-               return NULL;
-       }
-
-       raw = MQRraw_new(input);
-       if(raw == NULL) return NULL;
-
-       version = raw->version;
-       width = MQRspec_getWidth(version);
-       frame = MQRspec_newFrame(version);
-       if(frame == NULL) {
-               MQRraw_free(raw);
-               return NULL;
-       }
-       filler = FrameFiller_new(width, frame, 1);
-       if(filler == NULL) {
-               MQRraw_free(raw);
-               free(frame);
-               return NULL;
-       }
-
-       /* inteleaved data and ecc codes */
-       for(i=0; i<raw->dataLength + raw->eccLength; i++) {
-               code = MQRraw_getCode(raw);
-               if(raw->oddbits && i == raw->dataLength - 1) {
-                       bit = 1 << raw->oddbits;
-                       for(j=0; j<raw->oddbits; j++) {
-                               p = FrameFiller_next(filler);
-                               if(p == NULL) goto EXIT;
-                               *p = 0x02 | ((bit & code) != 0);
-                               bit = bit >> 1;
-                       }
-               } else {
-                       bit = 0x80;
-                       for(j=0; j<8; j++) {
-                               p = FrameFiller_next(filler);
-                               if(p == NULL) goto EXIT;
-                               *p = 0x02 | ((bit & code) != 0);
-                               bit = bit >> 1;
-                       }
-               }
-       }
-       MQRraw_free(raw);
-       raw = NULL;
-
-       /* masking */
-       if(mask < 0) {
-               masked = MMask_mask(version, frame, input->level);
-       } else {
-               masked = MMask_makeMask(version, frame, mask, input->level);
-       }
-       if(masked == NULL) {
-               goto EXIT;
-       }
-
-       qrcode = QRcode_new(version, width, masked);
-
-EXIT:
-       MQRraw_free(raw);
-       free(filler);
-       free(frame);
-       return qrcode;
-}
-
-QRcode *QRcode_encodeInput(QRinput *input)
-{
-       if(input->mqr) {
-               return QRcode_encodeMaskMQR(input, -1);
-       } else {
-               return QRcode_encodeMask(input, -1);
-       }
-}
-
-static QRcode *QRcode_encodeStringReal(const char *string, int version, 
QRecLevel level, int mqr, QRencodeMode hint, int casesensitive)
-{
-       QRinput *input;
-       QRcode *code;
-       int ret;
-
-       if(string == NULL) {
-               errno = EINVAL;
-               return NULL;
-       }
-       if(hint != QR_MODE_8 && hint != QR_MODE_KANJI) {
-               errno = EINVAL;
-               return NULL;
-       }
-
-       if(mqr) {
-               input = QRinput_newMQR(version, level);
-       } else {
-               input = QRinput_new2(version, level);
-       }
-       if(input == NULL) return NULL;
-
-       ret = Split_splitStringToQRinput(string, input, hint, casesensitive);
-       if(ret < 0) {
-               QRinput_free(input);
-               return NULL;
-       }
-       code = QRcode_encodeInput(input);
-       QRinput_free(input);
-
-       return code;
-}
-
-QRcode *QRcode_encodeString(const char *string, int version, QRecLevel level, 
QRencodeMode hint, int casesensitive)
-{
-       return QRcode_encodeStringReal(string, version, level, 0, hint, 
casesensitive);
-}
-
-QRcode *QRcode_encodeStringMQR(const char *string, int version, QRecLevel 
level, QRencodeMode hint, int casesensitive)
-{
-       return QRcode_encodeStringReal(string, version, level, 1, hint, 
casesensitive);
-}
-
-static QRcode *QRcode_encodeDataReal(const unsigned char *data, int length, 
int version, QRecLevel level, int mqr)
-{
-       QRinput *input;
-       QRcode *code;
-       int ret;
-
-       if(data == NULL || length == 0) {
-               errno = EINVAL;
-               return NULL;
-       }
-
-       if(mqr) {
-               input = QRinput_newMQR(version, level);
-       } else {
-               input = QRinput_new2(version, level);
-       }
-       if(input == NULL) return NULL;
-
-       ret = QRinput_append(input, QR_MODE_8, length, data);
-       if(ret < 0) {
-               QRinput_free(input);
-               return NULL;
-       }
-       code = QRcode_encodeInput(input);
-       QRinput_free(input);
-
-       return code;
-}
-
-QRcode *QRcode_encodeData(int size, const unsigned char *data, int version, 
QRecLevel level)
-{
-       return QRcode_encodeDataReal(data, size, version, level, 0);
-}
-
-QRcode *QRcode_encodeString8bit(const char *string, int version, QRecLevel 
level)
-{
-       if(string == NULL) {
-               errno = EINVAL;
-               return NULL;
-       }
-       return QRcode_encodeDataReal((unsigned char *)string, strlen(string), 
version, level, 0);
-}
-
-QRcode *QRcode_encodeDataMQR(int size, const unsigned char *data, int version, 
QRecLevel level)
-{
-       return QRcode_encodeDataReal(data, size, version, level, 1);
-}
-
-QRcode *QRcode_encodeString8bitMQR(const char *string, int version, QRecLevel 
level)
-{
-       if(string == NULL) {
-               errno = EINVAL;
-               return NULL;
-       }
-       return QRcode_encodeDataReal((unsigned char *)string, strlen(string), 
version, level, 1);
-}
-
-
-/******************************************************************************
- * Structured QR-code encoding
- *****************************************************************************/
-
-static QRcode_List *QRcode_List_newEntry(void)
-{
-       QRcode_List *entry;
-
-       entry = (QRcode_List *)malloc(sizeof(QRcode_List));
-       if(entry == NULL) return NULL;
-
-       entry->next = NULL;
-       entry->code = NULL;
-
-       return entry;
-}
-
-static void QRcode_List_freeEntry(QRcode_List *entry)
-{
-       if(entry != NULL) {
-               QRcode_free(entry->code);
-               free(entry);
-       }
-}
-
-void QRcode_List_free(QRcode_List *qrlist)
-{
-       QRcode_List *list = qrlist, *next;
-
-       while(list != NULL) {
-               next = list->next;
-               QRcode_List_freeEntry(list);
-               list = next;
-       }
-}
-
-int QRcode_List_size(QRcode_List *qrlist)
-{
-       QRcode_List *list = qrlist;
-       int size = 0;
-
-       while(list != NULL) {
-               size++;
-               list = list->next;
-       }
-
-       return size;
-}
-
-#if 0
-static unsigned char QRcode_parity(const char *str, int size)
-{
-       unsigned char parity = 0;
-       int i;
-
-       for(i=0; i<size; i++) {
-               parity ^= str[i];
-       }
-
-       return parity;
-}
-#endif
-
-QRcode_List *QRcode_encodeInputStructured(QRinput_Struct *s)
-{
-       QRcode_List *head = NULL;
-       QRcode_List *tail = NULL;
-       QRcode_List *entry;
-       QRinput_InputList *list = s->head;
-
-       while(list != NULL) {
-               if(head == NULL) {
-                       entry = QRcode_List_newEntry();
-                       if(entry == NULL) goto ABORT;
-                       head = entry;
-                       tail = head;
-               } else {
-                       entry = QRcode_List_newEntry();
-                       if(entry == NULL) goto ABORT;
-                       tail->next = entry;
-                       tail = tail->next;
-               }
-               tail->code = QRcode_encodeInput(list->input);
-               if(tail->code == NULL) {
-                       goto ABORT;
-               }
-               list = list->next;
-       }
-
-       return head;
-ABORT:
-       QRcode_List_free(head);
-       return NULL;
-}
-
-static QRcode_List *QRcode_encodeInputToStructured(QRinput *input)
-{
-       QRinput_Struct *s;
-       QRcode_List *codes;
-
-       s = QRinput_splitQRinputToStruct(input);
-       if(s == NULL) return NULL;
-
-       codes = QRcode_encodeInputStructured(s);
-       QRinput_Struct_free(s);
-
-       return codes;
-}
-
-static QRcode_List *QRcode_encodeDataStructuredReal(
-       int size, const unsigned char *data,
-       int version, QRecLevel level,
-       int eightbit, QRencodeMode hint, int casesensitive)
-{
-       QRinput *input;
-       QRcode_List *codes;
-       int ret;
-
-       if(version <= 0) {
-               errno = EINVAL;
-               return NULL;
-       }
-       if(!eightbit && (hint != QR_MODE_8 && hint != QR_MODE_KANJI)) {
-               errno = EINVAL;
-               return NULL;
-       }
-
-       input = QRinput_new2(version, level);
-       if(input == NULL) return NULL;
-
-       if(eightbit) {
-               ret = QRinput_append(input, QR_MODE_8, size, data);
-       } else {
-               ret = Split_splitStringToQRinput((char *)data, input, hint, 
casesensitive);
-       }
-       if(ret < 0) {
-               QRinput_free(input);
-               return NULL;
-       }
-       codes = QRcode_encodeInputToStructured(input);
-       QRinput_free(input);
-
-       return codes;
-}
-
-QRcode_List *QRcode_encodeDataStructured(int size, const unsigned char *data, 
int version, QRecLevel level) {
-       return QRcode_encodeDataStructuredReal(size, data, version, level, 1, 
QR_MODE_NUL, 0);
-}
-
-QRcode_List *QRcode_encodeString8bitStructured(const char *string, int 
version, QRecLevel level) {
-       if(string == NULL) {
-               errno = EINVAL;
-               return NULL;
-       }
-       return QRcode_encodeDataStructured(strlen(string), (unsigned char 
*)string, version, level);
-}
-
-QRcode_List *QRcode_encodeStringStructured(const char *string, int version, 
QRecLevel level, QRencodeMode hint, int casesensitive)
-{
-       if(string == NULL) {
-               errno = EINVAL;
-               return NULL;
-       }
-       return QRcode_encodeDataStructuredReal(strlen(string), (unsigned char 
*)string, version, level, 0, hint, casesensitive);
-}
-
-/******************************************************************************
- * System utilities
- *****************************************************************************/
-
-void QRcode_APIVersion(int *major_version, int *minor_version, int 
*micro_version)
-{
-       if(major_version != NULL) {
-               *major_version = MAJOR_VERSION;
-       }
-       if(minor_version != NULL) {
-               *minor_version = MINOR_VERSION;
-       }
-       if(micro_version != NULL) {
-               *micro_version = MICRO_VERSION;
-       }
-}
-
-char *QRcode_APIVersionString(void)
-{
-       return VERSION;
-}
-
-void QRcode_clearCache(void)
-{
-       QRspec_clearCache();
-       MQRspec_clearCache();
-       free_rs_cache();
-}
diff --git a/src/add-ons/kernel/debugger/qrencode/qrencode.h 
b/src/add-ons/kernel/debugger/qrencode/qrencode.h
deleted file mode 100644
index fa53e36..0000000
--- a/src/add-ons/kernel/debugger/qrencode/qrencode.h
+++ /dev/null
@@ -1,565 +0,0 @@
-/**
- * qrencode - QR Code encoder
- *
- * Copyright (C) 2006-2011 Kentaro Fukuchi <kentaro@xxxxxxxxxxx>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/** \mainpage
- * Libqrencode is a library for encoding data in a QR Code symbol, a kind of 2D
- * symbology.
- *
- * \section encoding Encoding
- * 
- * There are two ways to encode data: <b>encoding a string</b> or 
- * <b>encoding a structured data</b>.
- *
- * \subsection encoding-string Encoding a string
- * You can encode a string by calling QRcode_encodeString().
- * The given string is parsed automatically and encoded. If you want to encode
- * data that can be represented as a C string style (NUL terminated), you can
- * simply use this way.
- *
- * If the input data contains Kanji (Shift-JIS) characters and you want to
- * encode them as Kanji in QR Code, you should give QR_MODE_KANJI as a hint.
- * Otherwise, all of non-alphanumeric characters are encoded as 8 bit data.
- * If you want to encode a whole string in 8 bit mode, use
- * QRcode_encodeString8bit() instead.
- *
- * Please note that a C string can not contain NUL character. If your data
- * contains NUL, you should chose the second way.
- *
- * \subsection encoding-input Encoding a structured data
- * You can construct a structured input data manually. If the structure of the
- * input data is known, you can use this way.
- * At first, create a ::QRinput object by QRinput_new(). Then add input data
- * to the QRinput object by QRinput_append(). Finally call QRcode_encodeInput()
- * to encode the QRinput data.
- * You can reuse the QRinput data again to encode it in other symbols with
- * different parameters.
- *
- * \section result Result
- * The encoded symbol is resulted as a ::QRcode object. It will contain
- * its version number, width of the symbol and an array represents the symbol.
- * See ::QRcode for the details. You can free the object by QRcode_free().
- *
- * Please note that the version of the result may be larger than specified.
- * In such cases, the input data would be too large to be encoded in a
- * symbol of the specified version.
- *
- * \section structured Structured append
- * Libqrencode can generate "Structured-appended" symbols that enables to split
- * a large data set into mulitple QR codes. A QR code reader concatenates
- * multiple QR code symbols into a string.
- * Just like QRcode_encodeString(), you can use QRcode_encodeStringStructured()
- * to generate structured-appended symbols. This functions returns an instance
- * of ::QRcode_List. The returned list is a singly-linked list of QRcode: you
- * can retrieve each QR code in this way:
- *  
- * \code
- * QRcode_List *qrcodes;
- * QRcode_List *entry;
- * QRcode *qrcode;
- *
- * qrcodes = QRcode_encodeStringStructured(...);
- * entry = qrcodes;
- * while(entry != NULL) {
- *     qrcode = entry->code;
- *     // do something
- *     entry = entry->next;
- * }
- * QRcode_List_free(entry);
- * \endcode
- *
- * Instead of using auto-parsing functions, you can construct your own
- * structured input. At first, instantiate an object of ::QRinput_Struct
- * by calling QRinput_Struct_new(). This object can hold multiple ::QRinput,
- * and one QR code is generated for a ::QRinput.
- * QRinput_Struct_appendInput() appends a ::QRinput to a ::QRinput_Struct
- * object. In order to generate structured-appended symbols, it is required to
- * embed headers to each symbol. You can use
- * QRinput_Struct_insertStructuredAppendHeaders() to insert appropriate
- * headers to each symbol. You should call this function just once before
- * encoding symbols.
- */
-
-#ifndef __QRENCODE_H__
-#define __QRENCODE_H__
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-/**
- * Encoding mode.
- */
-typedef enum {
-       QR_MODE_NUL = -1,  ///< Terminator (NUL character). Internal use only
-       QR_MODE_NUM = 0,   ///< Numeric mode
-       QR_MODE_AN,        ///< Alphabet-numeric mode
-       QR_MODE_8,         ///< 8-bit data mode
-       QR_MODE_KANJI,     ///< Kanji (shift-jis) mode
-       QR_MODE_STRUCTURE, ///< Internal use only
-       QR_MODE_ECI,       ///< ECI mode
-       QR_MODE_FNC1FIRST,  ///< FNC1, first position
-       QR_MODE_FNC1SECOND, ///< FNC1, second position
-} QRencodeMode;
-
-/**
- * Level of error correction.
- */
-typedef enum {

[ *** diff truncated: 3712 lines dropped *** ]



Other related posts:

  • » [haiku-commits] haiku: hrev47126 - src/add-ons/kernel/debugger/qrencode - korli