Skip to content

Commit

Permalink
Synchronized to 2.0.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
fukuchi committed Jan 23, 2008
1 parent ac1e4d5 commit 13fffb7
Show file tree
Hide file tree
Showing 29 changed files with 351 additions and 114 deletions.
28 changes: 28 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
2008.01.23 Kentaro FUKUCHI <fukuchi@megaui.net>
* qrencode.1.in, Makefile.am, configure.ac:
- Manpage of qrencode has been added.
* qrenc.c, tests/view_qrcode.c:
- Usage message has been updated.

2008.01.18 Kentaro FUKUCHI <fukuchi@megaui.net>
* split.c:
- Bug fixes.
* tests/test_split.c:
- Followed recent API changes.
- Added new test "test_toupper()".
* qrenc.c, tests/view_qrcode.c:
- Source-level compatiblity has been improved.
- view_qrcode now accepts stdin like qrencode.
- Usage message has been updated/fixed.
* Copyright year has been updated.

2008.01.16 Kentaro FUKUCHI <fukuchi@megaui.net>
* qrinput.c, split.c:
- Case-sensitive mode becomes now default mode.
- Alphabet-Numeric mode now encodes only upper-case alphabet and
numeric characters. If "-i" option is given, split.c converts
lower-case characters to upper-case characters at first.
* qrenc.c, tests/view_qrcode.c:
- Case-sensitive mode becomes now default mode.
- Option "-i" has been added.

2007.12.14 Kentaro FUKUCHI <fukuchi@megaui.net>
* tests/test_qrencode.c:
- New test has been added.
Expand Down
4 changes: 3 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ include_HEADERS = qrencode.h
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libqrencode.pc

man1_MANS = qrencode.1

EXTRA_DIST = libqrencode.pc.in autogen.sh configure.ac acinclude.m4 \
Makefile.am tests/Makefile.am qrencode.spec.in
Makefile.am tests/Makefile.am qrencode.spec.in qrencode.1.in

if BUILD_TOOLS
bin_PROGRAMS = qrencode
Expand Down
24 changes: 22 additions & 2 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,36 @@ libqrencode NEWS - Overview of changes

Version 2.0.0 (2007.12.xx)
--------------------------
Summary:
* "-i" option to ignore case distinctions has been added to qrencode and
view_qrcode.
* "-c" option (case-sensitive mode) of qrencode is now enabled by default and
has been improved. See details in Release Note section.
* "-8" option has been added to qrencode to encode whole data in 8-bit mode.
* tests/view_qrcode now accepts various options like qrencode.
* Code cleanup.
* The mask evaluation bug has been fixed. (Philippe Delcroix)
* qrencode's case-sensitive encoding has been improved.
* "-8" option has been added to qrencode to encode whole data in 8-bit mode.

* API changes
- QRcode_encodeString() now receives case-sensitive flag.
- QRcode_encodeStringCase() has been removed.
- QRcode_encodeString8bit() has been added.

Release Note:

Previously libqrencode encodes lower-case alphabet characters in Alphabet-
Numeric mode (upper-case alphabet and numeric) by default. According to the
specification of QR code, however, it is clearly claimed that Alphabet-Numeric
mode provides only upper-case alphabet (+ numeric and some symbol) characters.
Since this version, libqrencode distinguishes lower-case and upper-case of
alphabet characters by default. Because of that, "-c" option of qrencode
is now deprecated, and "-i" option has been added. By giving "-i", qrencode
converts lower-case characters to upper-case if possible, then encode a QR code
symbol. Please read qrencode.h for the details about API changes if you are
going to use this library.

Many thanks to NANKI Haruo for his suggestions.

Version 1.0.2 (2007.03.24)
--------------------------
* A small bug fix. (Thanks to NANKI Haruo)
Expand Down
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ WARNING: This library is thread UNSAFE.

LICENSING INFORMATION
=====================
Copyright (C) 2006,2007 Kentaro Fukuchi
Copyright (C) 2006, 2007, 2008 Kentaro Fukuchi

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
Expand Down
9 changes: 4 additions & 5 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
Thread unsafe.
Only two functions, QRspec_newFrame() and init_rs(), are thread unsafe.

view_qrcode should support various options like qrencode.
Only two functions, QRspec_newFrame() and init_rs(), are thread unsafe, but
all of qrencode functions are thread unsafe because of them.

This package contains

*.c and *.h files (total): 5422 lines, 131476 bytes.
configure script : 22866 lines, 740829 bytes.
*.c and *.h files (total): 5916 lines, 146312 bytes.
configure script : 22510 lines, 724802 bytes.

It's absolutely crazy.
2 changes: 1 addition & 1 deletion bitstream.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* qrencode - QR Code encoder
*
* Binary sequence class.
* Copyright (C) 2006,2007 Kentaro Fukuchi <fukuchi@megaui.net>
* Copyright (C) 2006, 2007, 2008 Kentaro Fukuchi <fukuchi@megaui.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
2 changes: 1 addition & 1 deletion bitstream.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* qrencode - QR Code encoder
*
* Binary sequence class.
* Copyright (C) 2006,2007 Kentaro Fukuchi <fukuchi@megaui.net>
* Copyright (C) 2006, 2007, 2008 Kentaro Fukuchi <fukuchi@megaui.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ AM_CONDITIONAL(HAVE_SDL, [test "x$SDL_CFLAGS" != "x" ])

CFLAGS="-Wall $CFLAGS"

AC_CONFIG_FILES([Makefile libqrencode.pc tests/Makefile qrencode.spec])
AC_CONFIG_FILES([Makefile libqrencode.pc tests/Makefile qrencode.spec qrencode.1])

AC_ARG_WITH([tools], [AC_HELP_STRING([--with-tools], [build utility tools [default=yes]])],
[], [build_tools=yes])
Expand Down
2 changes: 1 addition & 1 deletion mask.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* qrencode - QR Code encoder
*
* Masking.
* Copyright (C) 2006,2007 Kentaro Fukuchi <fukuchi@megaui.net>
* Copyright (C) 2006, 2007, 2008 Kentaro Fukuchi <fukuchi@megaui.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
2 changes: 1 addition & 1 deletion mask.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* qrencode - QR Code encoder
*
* Masking.
* Copyright (C) 2006,2007 Kentaro Fukuchi <fukuchi@megaui.net>
* Copyright (C) 2006, 2007, 2008 Kentaro Fukuchi <fukuchi@megaui.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
2 changes: 1 addition & 1 deletion mqrspec.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* qrencode - QR Code encoder
*
* Micor QR Code specification in convenient format.
* Copyright (C) 2006,2007 Kentaro Fukuchi <fukuchi@megaui.net>
* Copyright (C) 2006, 2007, 2008 Kentaro Fukuchi <fukuchi@megaui.net>
*
* The following data / specifications are taken from
* "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004)
Expand Down
2 changes: 1 addition & 1 deletion mqrspec.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* qrencode - QR Code encoder
*
* Micro QR Code specification in convenient format.
* Copyright (C) 2006,2007 Kentaro Fukuchi <fukuchi@megaui.net>
* Copyright (C) 2006, 2007, 2008 Kentaro Fukuchi <fukuchi@megaui.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
29 changes: 14 additions & 15 deletions qrenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* qrencode - QR Code encoder
*
* QR Code encoding tool
* Copyright (C) 2006,2007 Kentaro Fukuchi <fukuchi@megaui.net>
* Copyright (C) 2006, 2007, 2008 Kentaro Fukuchi <fukuchi@megaui.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand All @@ -26,13 +26,13 @@

#include "qrencode.h"

static int casesensitive = 0;
static int casesensitive = 1;
static int eightbit = 0;
static int kanji = 0;
static int version = 0;
static int size = 3;
static int margin = 4;
static QRecLevel level = QR_ECLEVEL_L;
static QRencodeMode hint = QR_MODE_8;

enum {
O_HELP,
Expand All @@ -43,6 +43,7 @@ enum {
O_MARGIN,
O_KANJI,
O_CASE,
O_IGNORECASE,
O_8BIT,
};

Expand All @@ -55,14 +56,16 @@ static const struct option options[] = {
{"m", required_argument, NULL, O_MARGIN},
{"k", no_argument , NULL, O_KANJI},
{"c", no_argument , NULL, O_CASE},
{"i", no_argument , NULL, O_IGNORECASE},
{"8", no_argument , NULL, O_8BIT},
{NULL, 0, NULL, 0}
};

static void usage(void)
{
fprintf(stderr,
"qrencode version %s\n\n"
"qrencode version %s\n"
"Copyright (C) 2008 Kentaro Fukuchi\n"
"Usage: qrencode [OPTION]... [STRING]\n"
"Encode input data in a QR Code and save as a PNG image.\n\n"
" -h display this message.\n"
Expand All @@ -74,9 +77,9 @@ static void usage(void)
" -v NUMBER specify the version of the symbol. (default=auto)\n"
" -m NUMBER specify the width of margin. (default=4)\n"
" -k assume that the input text contains kanji (shift-jis).\n"
" -c encode alphabet characters in 8-bit mode. If your application\n"
" is case-sensitive, choose this.\n"
" -8 encode entire data in 8-bit mode. -c and -k will be ignored.\n"
" -c encode lower-case alphabet characters in 8-bit mode. (default)\n"
" -i ignore case distinctions and use only upper-case characters.\n"
" -8 encode entire data in 8-bit mode. -k, -c and -i will be ignored.\n"
" [STRING] input data. If it is not specified, data will be taken from\n"
" standard input.\n",
VERSION);
Expand Down Expand Up @@ -106,15 +109,8 @@ static char *readStdin(void)

static QRcode *encode(const char *intext)
{
QRencodeMode hint;
QRcode *code;

if(kanji) {
hint = QR_MODE_KANJI;
} else {
hint = QR_MODE_8;
}

if(eightbit) {
code = QRcode_encodeString8bit(intext, version, level);
} else {
Expand Down Expand Up @@ -289,11 +285,14 @@ int main(int argc, char **argv)
}
break;
case O_KANJI:
kanji = 1;
hint = QR_MODE_KANJI;
break;
case O_CASE:
casesensitive = 1;
break;
case O_IGNORECASE:
casesensitive = 0;
break;
case O_8BIT:
eightbit = 1;
break;
Expand Down
58 changes: 58 additions & 0 deletions qrencode.1.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
.TH QRENCODE 1 "Jan. 23, 2008" "qrencode @VERSION@"
.SH NAME
qrencode \- Encode input data in a QR Code and save as a PNG image.
.SH SYNOPSIS
.B "qrencode"
[OPTION]...
[STRING]

.SH DESCRIPTION
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.

Qrencode is a utility software using libqrencode to encode string data in
a QR Code and save as a PNG image.

.SH OPTIONS
.TP
.B \-h
display help message.
.TP
.B \-o FILENAME
write PNG image to FILENAME. If '-' is specified, the result will be output
to standard output.
.TP
.B \-s NUMBER
specify the size of dot (pixel). (default=3)
.TP
.B \-l {LMQH}
specify error collectin level from L (lowest) to H (highest). (default=L)
.TP
.B \-v NUMBER
specify the version of the symbol. (default=auto)
.TP
.B \-m NUMBER
specify the width of margin. (default=4)
.TP
.B \-k
assume that the input text contains kanji (shift-jis).
.TP
.B \-c
encode lower-case alphabet characters in 8-bit mode. (default)
.TP
.B \-i
ignore case distinctions and use only upper-case characters.
.TP
.B \-8
encode entire data in 8-bit mode. -k, -c and -i will be ignored.
.TP
.B [STRING]
input data. If it is not specified, data will be taken from standard input.

.SH AUTHOR
Written by Kentaro Fukuchi.

.SH COPYRIGHT
Copyright (C) 2006, 2007, 2008 Kentaro Fukuchi.
2 changes: 1 addition & 1 deletion qrencode.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* qrencode - QR Code encoder
*
* Copyright (C) 2006,2007 Kentaro Fukuchi <fukuchi@megaui.net>
* Copyright (C) 2006, 2007, 2008 Kentaro Fukuchi <fukuchi@megaui.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
2 changes: 1 addition & 1 deletion qrencode.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* qrencode - QR Code encoder
*
* Copyright (C) 2006,2007 Kentaro Fukuchi <fukuchi@megaui.net>
* Copyright (C) 2006, 2007, 2008 Kentaro Fukuchi <fukuchi@megaui.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
2 changes: 1 addition & 1 deletion qrencode_inner.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* qrencode - QR Code encoder
*
* Header for internal use
* Copyright (C) 2006,2007 Kentaro Fukuchi <fukuchi@megaui.net>
* Copyright (C) 2006, 2007, 2008 Kentaro Fukuchi <fukuchi@megaui.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
13 changes: 4 additions & 9 deletions qrinput.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* qrencode - QR Code encoder
*
* Input data chunk class
* Copyright (C) 2006,2007 Kentaro Fukuchi <fukuchi@megaui.net>
* Copyright (C) 2006, 2007, 2008 Kentaro Fukuchi <fukuchi@megaui.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down Expand Up @@ -230,8 +230,8 @@ const signed char QRinput_anTable[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1,
-1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1,
-1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
};

/**
Expand Down Expand Up @@ -692,13 +692,8 @@ static BitStream *QRinput_createPaddingBit(QRinput *input)
bstream = BitStream_new();
BitStream_appendNum(bstream, words * 8 - bits + 4, 0);

/* FIXME: It would be able to add padding bits by more efficient way. */
for(i=0; i<maxwords - words; i++) {
if(i & 1) {
BitStream_appendNum(bstream, 8, 0x11);
} else {
BitStream_appendNum(bstream, 8, 0xec);
}
BitStream_appendNum(bstream, 8, (i&1)?0x11:0xec);
}

return bstream;
Expand Down
2 changes: 1 addition & 1 deletion qrinput.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* qrencode - QR Code encoder
*
* Input data chunk class
* Copyright (C) 2006,2007 Kentaro Fukuchi <fukuchi@megaui.net>
* Copyright (C) 2006, 2007, 2008 Kentaro Fukuchi <fukuchi@megaui.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Loading

0 comments on commit 13fffb7

Please sign in to comment.