diff -Nru libcangjie-1.0/aclocal.m4 libcangjie-1.3/aclocal.m4 --- libcangjie-1.0/aclocal.m4 2013-12-21 15:03:12.000000000 +0000 +++ libcangjie-1.3/aclocal.m4 2014-12-28 11:50:58.000000000 +0000 @@ -1,4 +1,4 @@ -# generated automatically by aclocal 1.13.4 -*- Autoconf -*- +# generated automatically by aclocal 1.14.1 -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. @@ -247,10 +247,10 @@ # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.13' +[am__api_version='1.14' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.13.4], [], +m4_if([$1], [1.14.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -266,7 +266,7 @@ # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.13.4])dnl +[AM_AUTOMAKE_VERSION([1.14.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) @@ -633,6 +633,12 @@ # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. +dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. +m4_define([AC_PROG_CC], +m4_defn([AC_PROG_CC]) +[_AM_PROG_CC_C_O +]) + # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- @@ -741,7 +747,48 @@ AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl -]) + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) + fi +fi]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further @@ -749,7 +796,6 @@ m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) - # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. @@ -931,6 +977,53 @@ AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) +# Copyright (C) 1999-2013 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_PROG_CC_C_O +# --------------- +# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC +# to automatically call this. +AC_DEFUN([_AM_PROG_CC_C_O], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([compile])dnl +AC_LANG_PUSH([C])dnl +AC_CACHE_CHECK( + [whether $CC understands -c and -o together], + [am_cv_prog_cc_c_o], + [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i]) +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +AC_LANG_POP([C])]) + +# For backward compatibility. +AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) + # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation diff -Nru libcangjie-1.0/AUTHORS libcangjie-1.3/AUTHORS --- libcangjie-1.0/AUTHORS 2013-12-21 15:03:36.000000000 +0000 +++ libcangjie-1.3/AUTHORS 2014-12-28 11:51:04.000000000 +0000 @@ -2,10 +2,14 @@ # # libcangjie was written by these people: +Anthony Wong +antonyho +Dridi Boukelmoune +jeremy-fouriaux Koala Yeung Linquize +Mathieu Bridon Mathieu Bridon -jeremy-fouriaux # libcangjie would not have been possible without Wan Leung Wong's work on the # original libcangjie: https://github.com/wanleung/libcangjie diff -Nru libcangjie-1.0/autogen.sh libcangjie-1.3/autogen.sh --- libcangjie-1.0/autogen.sh 2013-08-03 18:15:00.000000000 +0000 +++ libcangjie-1.3/autogen.sh 2014-04-25 04:07:49.000000000 +0000 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh set -e set -x diff -Nru libcangjie-1.0/compile libcangjie-1.3/compile --- libcangjie-1.0/compile 1970-01-01 00:00:00.000000000 +0000 +++ libcangjie-1.3/compile 2014-12-28 11:50:59.000000000 +0000 @@ -0,0 +1,347 @@ +#! /bin/sh +# Wrapper for compilers which do not understand '-c -o'. + +scriptversion=2012-10-14.11; # UTC + +# Copyright (C) 1999-2013 Free Software Foundation, Inc. +# Written by Tom Tromey . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +nl=' +' + +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent tools from complaining about whitespace usage. +IFS=" "" $nl" + +file_conv= + +# func_file_conv build_file lazy +# Convert a $build file to $host form and store it in $file +# Currently only supports Windows hosts. If the determined conversion +# type is listed in (the comma separated) LAZY, no conversion will +# take place. +func_file_conv () +{ + file=$1 + case $file in + / | /[!/]*) # absolute file, and not a UNC file + if test -z "$file_conv"; then + # lazily determine how to convert abs files + case `uname -s` in + MINGW*) + file_conv=mingw + ;; + CYGWIN*) + file_conv=cygwin + ;; + *) + file_conv=wine + ;; + esac + fi + case $file_conv/,$2, in + *,$file_conv,*) + ;; + mingw/*) + file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` + ;; + cygwin/*) + file=`cygpath -m "$file" || echo "$file"` + ;; + wine/*) + file=`winepath -w "$file" || echo "$file"` + ;; + esac + ;; + esac +} + +# func_cl_dashL linkdir +# Make cl look for libraries in LINKDIR +func_cl_dashL () +{ + func_file_conv "$1" + if test -z "$lib_path"; then + lib_path=$file + else + lib_path="$lib_path;$file" + fi + linker_opts="$linker_opts -LIBPATH:$file" +} + +# func_cl_dashl library +# Do a library search-path lookup for cl +func_cl_dashl () +{ + lib=$1 + found=no + save_IFS=$IFS + IFS=';' + for dir in $lib_path $LIB + do + IFS=$save_IFS + if $shared && test -f "$dir/$lib.dll.lib"; then + found=yes + lib=$dir/$lib.dll.lib + break + fi + if test -f "$dir/$lib.lib"; then + found=yes + lib=$dir/$lib.lib + break + fi + if test -f "$dir/lib$lib.a"; then + found=yes + lib=$dir/lib$lib.a + break + fi + done + IFS=$save_IFS + + if test "$found" != yes; then + lib=$lib.lib + fi +} + +# func_cl_wrapper cl arg... +# Adjust compile command to suit cl +func_cl_wrapper () +{ + # Assume a capable shell + lib_path= + shared=: + linker_opts= + for arg + do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + eat=1 + case $2 in + *.o | *.[oO][bB][jJ]) + func_file_conv "$2" + set x "$@" -Fo"$file" + shift + ;; + *) + func_file_conv "$2" + set x "$@" -Fe"$file" + shift + ;; + esac + ;; + -I) + eat=1 + func_file_conv "$2" mingw + set x "$@" -I"$file" + shift + ;; + -I*) + func_file_conv "${1#-I}" mingw + set x "$@" -I"$file" + shift + ;; + -l) + eat=1 + func_cl_dashl "$2" + set x "$@" "$lib" + shift + ;; + -l*) + func_cl_dashl "${1#-l}" + set x "$@" "$lib" + shift + ;; + -L) + eat=1 + func_cl_dashL "$2" + ;; + -L*) + func_cl_dashL "${1#-L}" + ;; + -static) + shared=false + ;; + -Wl,*) + arg=${1#-Wl,} + save_ifs="$IFS"; IFS=',' + for flag in $arg; do + IFS="$save_ifs" + linker_opts="$linker_opts $flag" + done + IFS="$save_ifs" + ;; + -Xlinker) + eat=1 + linker_opts="$linker_opts $2" + ;; + -*) + set x "$@" "$1" + shift + ;; + *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) + func_file_conv "$1" + set x "$@" -Tp"$file" + shift + ;; + *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) + func_file_conv "$1" mingw + set x "$@" "$file" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift + done + if test -n "$linker_opts"; then + linker_opts="-link$linker_opts" + fi + exec "$@" $linker_opts + exit 1 +} + +eat= + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: compile [--help] [--version] PROGRAM [ARGS] + +Wrapper for compilers which do not understand '-c -o'. +Remove '-o dest.o' from ARGS, run PROGRAM with the remaining +arguments, and rename the output as expected. + +If you are trying to build a whole package this is not the +right script to run: please start by reading the file 'INSTALL'. + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "compile $scriptversion" + exit $? + ;; + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) + func_cl_wrapper "$@" # Doesn't return... + ;; +esac + +ofile= +cfile= + +for arg +do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + # So we strip '-o arg' only if arg is an object. + eat=1 + case $2 in + *.o | *.obj) + ofile=$2 + ;; + *) + set x "$@" -o "$2" + shift + ;; + esac + ;; + *.c) + cfile=$1 + set x "$@" "$1" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift +done + +if test -z "$ofile" || test -z "$cfile"; then + # If no '-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # '.c' file was seen then we are probably linking. That is also + # ok. + exec "$@" +fi + +# Name of file we expect compiler to create. +cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` + +# Create the lock directory. +# Note: use '[/\\:.-]' here to ensure that we don't use the same name +# that we are using for the .o file. Also, base the name on the expected +# object file name, since that is what matters with a parallel build. +lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d +while true; do + if mkdir "$lockdir" >/dev/null 2>&1; then + break + fi + sleep 1 +done +# FIXME: race condition here if user kills between mkdir and trap. +trap "rmdir '$lockdir'; exit 1" 1 2 15 + +# Run the compile. +"$@" +ret=$? + +if test -f "$cofile"; then + test "$cofile" = "$ofile" || mv "$cofile" "$ofile" +elif test -f "${cofile}bj"; then + test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" +fi + +rmdir "$lockdir" +exit $ret + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff -Nru libcangjie-1.0/config.guess libcangjie-1.3/config.guess --- libcangjie-1.0/config.guess 2013-12-21 15:03:14.000000000 +0000 +++ libcangjie-1.3/config.guess 2014-12-28 11:50:59.000000000 +0000 @@ -1,10 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011, 2012, 2013 Free Software Foundation, Inc. +# Copyright 1992-2014 Free Software Foundation, Inc. -timestamp='2012-12-29' +timestamp='2014-03-23' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -26,7 +24,7 @@ # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # -# Originally written by Per Bothner. +# Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD @@ -52,9 +50,7 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, -2012, 2013 Free Software Foundation, Inc. +Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -136,6 +132,27 @@ UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "${UNAME_SYSTEM}" in +Linux|GNU|GNU/*) + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu + + eval $set_cc_for_build + cat <<-EOF > $dummy.c + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #else + LIBC=gnu + #endif + EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + ;; +esac + # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -809,7 +826,7 @@ *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; - i*:MSYS*:*) + *:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) @@ -857,21 +874,21 @@ exit ;; *:GNU:*:*) # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -884,59 +901,54 @@ EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo ${UNAME_MACHINE}-unknown-linux-gnueabi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else - echo ${UNAME_MACHINE}-unknown-linux-gnueabihf + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) - LIBC=gnu - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build @@ -955,54 +967,63 @@ #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; - or32:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + openrisc*:Linux:*:*) + echo or1k-unknown-linux-${LIBC} + exit ;; + or32:Linux:*:* | or1k*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) - echo sparc-unknown-linux-gnu + echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; + PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; + *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu + echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu + echo powerpc-unknown-linux-${LIBC} + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-${LIBC} + exit ;; + ppcle:Linux:*:*) + echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux + echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu + echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. @@ -1235,19 +1256,31 @@ exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - i386) - eval $set_cc_for_build - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - UNAME_PROCESSOR="x86_64" - fi - fi ;; - unknown) UNAME_PROCESSOR=powerpc ;; - esac + eval $set_cc_for_build + if test "$UNAME_PROCESSOR" = unknown ; then + UNAME_PROCESSOR=powerpc + fi + if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # Avoid executing cc on OS X 10.9, as it ships with a stub + # that puts up a graphical alert prompting to install + # developer tools. Any system running Mac OS X 10.7 or + # later (Darwin 11 and later) is required to have a 64-bit + # processor. This is not true of the ARM version of Darwin + # that Apple uses in portable devices. + UNAME_PROCESSOR=x86_64 + fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) @@ -1338,154 +1371,6 @@ exit ;; esac -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - cat >&2 <. # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='libcangjie' PACKAGE_TARNAME='libcangjie' -PACKAGE_VERSION='1.0' -PACKAGE_STRING='libcangjie 1.0' +PACKAGE_VERSION='1.3' +PACKAGE_STRING='libcangjie 1.3' PACKAGE_BUGREPORT='https://github.com/Cangjians/libcangjie/issues' PACKAGE_URL='https://github.com/Cangjians/libcangjie' @@ -1325,7 +1325,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libcangjie 1.0 to adapt to many kinds of systems. +\`configure' configures libcangjie 1.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1395,7 +1395,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libcangjie 1.0:";; + short | recursive ) echo "Configuration of libcangjie 1.3:";; esac cat <<\_ACEOF @@ -1511,7 +1511,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libcangjie configure 1.0 +libcangjie configure 1.3 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1789,7 +1789,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libcangjie $as_me 1.0, which was +It was created by libcangjie $as_me 1.3, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2142,7 +2142,7 @@ -am__api_version='1.13' +am__api_version='1.14' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do @@ -2657,7 +2657,7 @@ # Define the identity of the package. PACKAGE='libcangjie' - VERSION='1.0' + VERSION='1.3' cat >>confdefs.h <<_ACEOF @@ -2824,6 +2824,47 @@ +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 + fi +fi # Check whether --enable-silent-rules was given. @@ -3884,6 +3925,65 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } +if ${am_cv_prog_cc_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +$as_echo "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 @@ -6275,10 +6375,10 @@ x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; - powerpcle-*linux*) + powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; - powerpc-*linux*) + powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) @@ -11686,7 +11786,7 @@ # For information on how to properly maintain the library version information, # refer to the libtool manual, section "Updating library version information": # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html -CANGJIE_SO_VERSION=2:0:0 +CANGJIE_SO_VERSION=2:1:0 # OUTPUT files @@ -12227,7 +12327,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libcangjie $as_me 1.0, which was +This file was extended by libcangjie $as_me 1.3, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -12294,7 +12394,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libcangjie config.status 1.0 +libcangjie config.status 1.3 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -Nru libcangjie-1.0/configure.ac libcangjie-1.3/configure.ac --- libcangjie-1.0/configure.ac 2013-12-21 14:48:24.000000000 +0000 +++ libcangjie-1.3/configure.ac 2014-12-28 11:48:56.000000000 +0000 @@ -1,5 +1,5 @@ AC_PREREQ(2.63) -AC_INIT([libcangjie], [1.0], [https://github.com/Cangjians/libcangjie/issues], [libcangjie], [https://github.com/Cangjians/libcangjie]) +AC_INIT([libcangjie], [1.3], [https://github.com/Cangjians/libcangjie/issues], [libcangjie], [https://github.com/Cangjians/libcangjie]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) @@ -37,7 +37,7 @@ # For information on how to properly maintain the library version information, # refer to the libtool manual, section "Updating library version information": # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html -AC_SUBST([CANGJIE_SO_VERSION], [2:0:0]) +AC_SUBST([CANGJIE_SO_VERSION], [2:1:0]) # OUTPUT files AC_CONFIG_FILES([ diff -Nru libcangjie-1.0/data/README.table.rst libcangjie-1.3/data/README.table.rst --- libcangjie-1.0/data/README.table.rst 2013-10-26 04:16:04.000000000 +0000 +++ libcangjie-1.3/data/README.table.rst 2014-12-25 16:03:56.000000000 +0000 @@ -40,8 +40,8 @@ the Japanese Kanji alphabet. * The seventh column is a boolean representing whether the character is part of the Japanese Hiragana alphabet. -* The eigth column is a boolean representing whether the character is part of - the Japanse Katakana alphabet. +* The eighth column is a boolean representing whether the character is part of + the Japanese Katakana alphabet. * The ninth column is a boolean representing whether the character is a punctuation mark. * The tenth column is a boolean representing whether the character is a diff -Nru libcangjie-1.0/data/table.txt libcangjie-1.3/data/table.txt --- libcangjie-1.0/data/table.txt 2013-10-26 02:14:52.000000000 +0000 +++ libcangjie-1.3/data/table.txt 2014-12-28 11:48:56.000000000 +0000 @@ -1,4 +1,4 @@ -# See the README.tables.rst file in this folder for details about this data. +# See the README.table.rst file in this folder for details about this data. ? 0 0 0 0 0 0 0 1 0 zxaf,zxbb NA NA 0 § 0 0 0 0 0 0 0 0 1 yyybs yyybs NA 0 @@ -254,9 +254,9 @@ ☆ 0 0 0 0 0 0 0 0 1 yyybi yyybi,za NA 0 ♀ 0 0 0 0 0 0 0 0 1 yyybr yyybr NA 0 ♂ 0 0 0 0 0 0 0 0 1 yyybq yyybq NA 0 -、 0 0 0 0 0 0 0 1 0 i,xi,zxac i,xi,zxac , 3 -。 0 0 0 0 0 0 0 1 0 xr,yyyco,zxad xr,yyyco,zxad . 2 -〇 0 0 0 0 0 0 0 0 1 NA xxr,xxxxx NA 0 +、 0 0 0 0 0 0 0 1 0 zxac zxac , 3 +。 0 0 0 0 0 0 0 1 0 zxad zxad . 2 +〇 0 0 0 0 0 0 0 0 1 NA xxxxx NA 0 〈 0 0 0 0 0 0 0 1 0 yyyae,zxby yyyae,za,zxby ' 6 〉 0 0 0 0 0 0 0 1 0 yyyaf,zxca yyyaf,za,zxca ' 5 《 0 0 0 0 0 0 0 1 0 yyyag,zxbu yyyag,za,zxbu " 6 @@ -6817,7 +6817,7 @@ 䱺 1 0 0 0 0 0 0 0 0 nfumt nfumt NA 0 䱻 1 0 1 0 0 0 0 0 0 nfbbb nfbbb NA 0 䱼 1 0 0 0 0 0 0 0 0 nfstv nfstv NA 0 -䱽 1 0 1 0 0 0 0 0 0 nfomr nfoir NA 0 +䱽 1 0 1 0 0 0 0 0 0 nfoir nfoir NA 0 䱾 1 0 0 0 0 0 0 0 0 nflwv nfllv NA 0 䱿 1 0 0 0 0 0 0 0 0 nfjjl nfjjl NA 0 䲀 1 0 0 0 0 0 0 0 0 ginwf ginwf NA 0 @@ -7228,7 +7228,7 @@ 也 1 1 0 0 1 0 0 0 0 pd pd NA 23201 习 1 0 0 0 1 0 0 0 0 sim sim NA 0 乡 1 0 0 0 1 0 0 0 0 vvh vvh NA 0 -乢 1 0 0 0 1 0 0 0 0 uu uu,xxxua NA 0 +乢 1 0 0 0 1 0 0 0 0 uu uu,xxxuu NA 0 乣 1 0 0 0 1 0 0 0 0 viu viu NA 0 乤 1 0 0 0 1 0 0 0 0 myn myn NA 0 乥 1 0 0 0 1 0 0 0 0 hcn hcn NA 0 @@ -7467,7 +7467,7 @@ 低 1 1 0 0 1 0 0 0 0 ohpm,ohvi ohpm,ohvi NA 22459 住 1 1 0 0 1 0 0 0 0 oyg oyg NA 22545 佐 1 1 0 0 1 0 0 0 0 okm okm NA 22537 -佑 1 1 0 0 1 0 0 0 0 okr,okrx okr,xokr NA 22536 +佑 1 1 0 0 1 0 0 0 0 okr okr,xokr NA 22536 佒 1 1 0 0 1 0 0 0 0 olbk olbk NA 14173 体 1 1 0 0 1 0 0 0 0 odm odm NA 14177 佔 1 1 0 0 1 0 0 0 0 oyr oyr NA 22531 @@ -8124,7 +8124,7 @@ 凟 1 0 1 0 1 0 0 0 0 imgwc imgwc NA 0 几 1 1 0 0 1 0 0 0 0 hn hn NA 23218 凡 1 1 0 0 1 0 0 0 0 hni hni NA 23204 -凢 1 0 1 0 1 0 0 0 0 hn hhn,xhhn NA 0 +凢 1 0 1 0 1 0 0 0 0 hhn hhn,xhhn NA 0 凣 1 0 0 0 1 0 0 0 0 lhn lhn NA 0 凤 1 0 1 0 1 0 0 0 0 hne hne NA 0 凥 1 0 0 0 1 0 0 0 0 shn shn NA 0 @@ -8584,7 +8584,7 @@ 厫 1 0 1 0 1 0 0 0 0 mgsk mgsk,mqsk NA 0 厬 1 1 0 0 1 0 0 0 0 mahr mahr NA 8313 厭 1 1 0 0 1 0 0 0 0 mabk mabk NA 17729 -厮 1 0 1 0 1 0 0 0 0 itcl mtcl NA 0 +厮 1 0 1 0 1 0 0 0 0 mtcl mtcl NA 0 厯 1 0 0 0 1 0 0 0 0 mduii mddi NA 0 厰 1 0 1 0 1 0 0 0 0 mfbk mfbk,xmfbk NA 0 厱 1 0 0 0 1 0 0 0 0 momo momo NA 0 @@ -8680,7 +8680,7 @@ 吋 1 1 0 0 1 0 0 0 0 rdi rdi NA 22698 同 1 1 0 0 1 0 0 0 0 bmr bmr NA 22702 名 1 1 0 0 1 0 0 0 0 nir nir NA 22695 -后 1 1 0 0 1 0 0 0 0 hmr,hovie hmr NA 22692 +后 1 1 0 0 1 0 0 0 0 hmr hmr NA 22692 吏 1 1 0 0 1 0 0 0 0 jlk jlk NA 22703 吐 1 1 0 0 1 0 0 0 0 rg rg NA 22700 向 1 1 0 0 1 0 0 0 0 hbr hbr NA 22696 @@ -9183,7 +9183,7 @@ 嘂 1 1 0 0 1 0 0 0 0 rrvlr rrvlr NA 8303 嘃 1 0 0 0 1 0 0 0 0 rilb rilb NA 0 嘄 1 1 0 0 1 0 0 0 0 rhad rhad NA 8300 -嘅 1 0 1 0 1 0 0 0 0 rhpu raiu,rhpu NA 0 +嘅 1 0 1 0 1 0 0 0 0 raiu,rhpu raiu,rhpu NA 0 嘆 1 1 0 0 1 0 0 0 0 rtlo rtlo NA 17722 嘇 1 0 0 0 1 0 0 0 0 riih riih NA 0 嘈 1 1 0 0 1 0 0 0 0 rtwa rtwa NA 17715 @@ -11622,7 +11622,7 @@ 徉 1 1 0 0 1 0 0 0 0 hotq hotq NA 21276 徊 1 1 0 0 1 0 0 0 0 howr howr NA 21280 律 1 1 0 0 1 0 0 0 0 holq holq NA 21279 -後 1 1 0 0 1 0 0 0 0 hmr,hovie hovie NA 21277 +後 1 1 0 0 1 0 0 0 0 hovie hovie NA 21277 徍 1 0 0 0 1 0 0 0 0 hogg hogg NA 0 徎 1 0 0 0 1 0 0 0 0 horhg hormg NA 0 徏 1 0 0 0 1 0 0 0 0 hoylh hoylh NA 0 @@ -15633,7 +15633,7 @@ 漮 1 1 0 0 1 0 0 0 0 eile eile NA 8011 漯 1 1 0 0 1 0 0 0 0 ewvf ewvf NA 17492 漰 1 1 0 0 1 0 0 0 0 eubb eubb NA 7960 -漱 1 1 0 0 1 0 0 0 0 edlk,edlo edlo,xedlo NA 17498 +漱 1 1 0 0 1 0 0 0 0 edlo edlo,xedlo NA 17498 漲 1 1 0 0 1 0 0 0 0 ensv ensv NA 17496 漳 1 1 0 0 1 0 0 0 0 eytj eytj NA 17547 漴 1 0 1 0 1 0 0 0 0 eujf eujf NA 0 @@ -16794,7 +16794,7 @@ 玷 1 1 0 0 1 0 0 0 0 mgyr mgyr NA 21055 玸 1 1 0 0 1 0 0 0 0 mgpru mgpru NA 12778 玹 1 1 0 0 1 0 0 0 0 mgyvi mgyvi NA 12788 -玺 1 0 1 0 1 0 0 0 0 mbmgi nfmgi NA 0 +玺 1 0 1 0 1 0 0 0 0 nfmgi nfmgi NA 0 玻 1 1 0 0 1 0 0 0 0 mgdhe mgdhe NA 21053 玼 1 1 0 0 1 0 0 0 0 mgymp mgymp NA 12048 玽 1 0 0 0 1 0 0 0 0 mgpr mgpr NA 0 @@ -17300,7 +17300,7 @@ 疱 1 0 1 0 1 0 0 0 0 depru kpru NA 0 疲 1 1 0 0 1 0 0 0 0 kdhe kdhe NA 20374 疳 1 1 0 0 1 0 0 0 0 ktm ktm NA 20373 -疴 1 0 1 0 1 0 0 0 0 knlr kmnr,xkmnr NA 0 +疴 1 0 1 0 1 0 0 0 0 kmnr kmnr,xkmnr NA 0 疵 1 1 0 0 1 0 0 0 0 kymp kymp NA 19539 疶 1 1 0 0 1 0 0 0 0 kpt kpt NA 12022 疷 1 0 0 0 1 0 0 0 0 khpm khpm,khvi NA 0 @@ -17861,7 +17861,7 @@ 矢 1 1 0 0 1 0 0 0 0 ok ok NA 22820 矣 1 1 0 0 1 0 0 0 0 iok iok NA 22159 矤 1 0 0 0 1 0 0 0 0 nok nok NA 0 -知 1 1 0 0 1 0 0 0 0 okr okr NA 21568 +知 1 1 0 0 1 0 0 0 0 okr,okrx okr NA 21568 矦 1 0 1 0 1 0 0 0 0 nmok nmok NA 0 矧 1 1 0 0 1 0 0 0 0 oknl oknl NA 12759 矨 1 1 0 0 1 0 0 0 0 okhk okhk NA 12758 @@ -18242,7 +18242,7 @@ 祟 1 1 0 0 1 0 0 0 0 uummf uummf NA 20309 祠 1 1 0 0 1 0 0 0 0 ifsmr ifsmr NA 20310 祡 1 1 0 0 1 0 0 0 0 ypmmf ypmmf NA 11005 -祢 1 0 1 0 1 0 0 0 0 ifmfb ifnf NA 0 +祢 1 0 1 0 1 0 0 0 0 ifnf ifnf NA 0 祣 1 1 0 0 1 0 0 0 0 ifohv ifohv NA 11007 祤 1 1 0 0 1 0 0 0 0 ifsmm ifsmm NA 11011 祥 1 1 0 0 1 0 0 0 0 iftq iftq NA 19523 @@ -21073,7 +21073,7 @@ 葮 1 1 0 0 1 0 0 0 0 thje thje NA 8671 葯 1 1 0 0 1 0 0 0 0 tvfi tvfi NA 8684 葰 1 1 0 0 1 0 0 0 0 toie toie NA 8689 -葱 1 0 1 0 1 0 0 0 0 tphp tpkp NA 0 +葱 1 0 1 0 1 0 0 0 0 tpkp tpkp NA 0 葲 1 0 1 0 1 0 0 0 0 thae thae NA 0 葳 1 1 0 0 1 0 0 0 0 tihv tihv NA 8708 葴 1 1 0 0 1 0 0 0 0 tihr tihr NA 8709 @@ -21518,7 +21518,7 @@ 蘫 1 0 0 0 1 0 0 0 0 test test NA 0 蘬 1 1 0 0 1 0 0 0 0 thmb thmb NA 2677 蘭 1 1 0 0 1 0 0 0 0 tanw tanw NA 14857 -蘮 1 1 0 0 1 0 0 0 0 twln twln,xxxta NA 3014 +蘮 1 1 0 0 1 0 0 0 0 twln twln,xxxtw NA 3014 蘯 1 0 1 0 1 0 0 0 0 teht teht NA 0 蘰 1 0 0 0 1 0 0 0 0 tvfe tvfe,xtvfe NA 0 蘱 1 1 0 0 1 0 0 0 0 tfkc tfkc NA 2507 @@ -21580,9 +21580,9 @@ 虩 1 1 0 0 1 0 0 0 0 ffypu ffypn,ffypu NA 4357 虪 1 1 0 0 1 0 0 0 0 yuolf ynolf,yuolf NA 2074 虫 1 1 0 0 1 0 0 0 0 lmi lmi NA 22554 -虬 1 0 1 0 1 0 0 0 0 livl liu NA 0 +虬 1 0 1 0 1 0 0 0 0 liu liu NA 0 虭 1 1 0 0 1 0 0 0 0 lish lish NA 13302 -虮 1 1 0 0 1 0 0 0 0 lihn,livii lihn NA 13301 +虮 1 1 0 0 1 0 0 0 0 lihn lihn NA 13301 虯 1 1 0 0 1 0 0 0 0 livl livl NA 13303 虰 1 1 0 0 1 0 0 0 0 limn limn NA 13304 虱 1 1 0 0 1 0 0 0 0 nhli nhli NA 21523 @@ -22134,7 +22134,7 @@ 袓 1 1 0 0 1 0 0 0 0 lbm lbm NA 10748 袔 1 0 0 0 1 0 0 0 0 lmnr lmnr NA 0 袕 1 1 0 0 1 0 0 0 0 ljc ljc NA 10764 -袖 1 1 0 0 1 0 0 0 0 iflw,llw llw NA 19371 +袖 1 1 0 0 1 0 0 0 0 llw llw NA 19371 袗 1 1 0 0 1 0 0 0 0 lohh lohh NA 10752 袘 1 1 0 0 1 0 0 0 0 lopd lopd NA 10756 袙 1 1 0 0 1 0 0 0 0 lha lha NA 10754 @@ -22375,7 +22375,7 @@ 覄 1 0 0 0 1 0 0 0 0 mwoik mwoik NA 0 覅 1 1 0 0 1 0 0 0 0 mvphh mvphh NA 8645 覆 1 1 0 0 1 0 0 0 0 mwhoe mwhoe NA 15406 -覇 1 0 1 0 1 0 0 0 0 mbtjb mbtjb,mwtjb,xmbtj NA 0 +覇 1 0 1 0 1 0 0 0 0 mwtjb mwtjb,xmbtj NA 0 覈 1 1 0 0 1 0 0 0 0 mwhsk mwhsk NA 3789 覉 1 0 1 0 1 0 0 0 0 mbtjr mbtjr,mwtjr NA 0 覊 1 0 1 0 1 0 0 0 0 mbtjf mbtjf,mwtjf NA 0 @@ -27482,7 +27482,7 @@ 鵷 1 1 0 0 1 0 0 0 0 juhaf juhaf NA 3559 鵸 1 1 0 0 1 0 0 0 0 krhaf krhaf NA 3552 鵹 1 1 0 0 1 0 0 0 0 hhhaf hhhaf NA 3537 -鵺 1 0 0 0 1 0 0 0 0 ykhaf xxxyb,ykhaf NA 0 +鵺 1 0 0 0 1 0 0 0 0 ykhaf xxxyk,ykhaf NA 0 鵻 1 1 0 0 1 0 0 0 0 hfog hfog NA 3540 鵼 1 0 1 0 1 0 0 0 0 jmhaf jmhaf NA 0 鵽 1 1 0 0 1 0 0 0 0 eeeef eeeef NA 3548 @@ -27622,7 +27622,7 @@ 鸃 1 1 0 0 1 0 0 0 0 hftgi hftgi NA 2272 鸄 1 1 0 0 1 0 0 0 0 hkhaf hkhaf,xhkha NA 2264 鸅 1 1 0 0 1 0 0 0 0 wjhaf wjhaf NA 2270 -鸆 1 1 0 0 1 0 0 0 0 ykhaf xxxya,ykhaf NA 2271 +鸆 1 1 0 0 1 0 0 0 0 ykhaf xxxyk,ykhaf NA 2271 鸇 1 1 0 0 1 0 0 0 0 ymhaf ymhaf NA 2273 鸈 1 0 0 0 1 0 0 0 0 tdhaf tdhaf NA 0 鸉 1 1 0 0 1 0 0 0 0 dhhaf dhhaf NA 2267 @@ -60415,7 +60415,7 @@ 𧷅 1 0 0 0 0 0 0 0 0 belmc belmc NA 0 𧷆 1 0 0 0 0 0 0 0 0 bcysd bcysd NA 0 𧷇 1 0 0 0 0 0 0 0 0 lmfbc lmfbc NA 0 -𧷈 1 0 0 0 0 0 0 0 0 xmbuc hmbuc NA 0 +𧷈 1 0 0 0 0 0 0 0 0 hmbuc hmbuc NA 0 𧷉 1 0 0 0 0 0 0 0 0 bcbcc bcbcc NA 0 𧷊 1 0 0 0 0 0 0 0 0 bchju bchju NA 0 𧷋 1 0 0 0 0 0 0 0 0 mwvbc mwvbc NA 0 diff -Nru libcangjie-1.0/debian/changelog libcangjie-1.3/debian/changelog --- libcangjie-1.0/debian/changelog 2014-01-19 16:39:45.000000000 +0000 +++ libcangjie-1.3/debian/changelog 2015-05-26 07:15:48.000000000 +0000 @@ -1,3 +1,33 @@ +libcangjie (1.3-1~trusty1) trusty; urgency=medium + + * Backporting vivid release sync to trusty to fix wrong input results + as per upstream's request (LP: #1452326) + + -- Didier Roche Tue, 26 May 2015 09:14:36 +0200 + +libcangjie (1.3-1) experimental; urgency=low + + * New upstream release. + * debian/watch: update for new upstream release location. + + -- Anthony Wong Mon, 19 Jan 2015 20:31:49 +0800 + +libcangjie (1.2-1) unstable; urgency=low + + * New upstream release. + * Updated Priority and Standards-Version to 3.9.6. + + -- Anthony Wong Sun, 26 Oct 2014 15:27:38 +0800 + +libcangjie (1.1-1) unstable; urgency=low + + * New upstream release. + * debian/control: libcangjie2-dev and libcangjie2-dev-tools conflict + with libcangjie-dev as they they cannot co-exist. (Closes: + #736191, #736193) + + -- Anthony Wong Thu, 13 Feb 2014 01:01:23 +0800 + libcangjie (1.0-1) unstable; urgency=low * New upstream release. diff -Nru libcangjie-1.0/debian/control libcangjie-1.3/debian/control --- libcangjie-1.0/debian/control 2014-01-19 16:39:45.000000000 +0000 +++ libcangjie-1.3/debian/control 2015-01-19 12:31:16.000000000 +0000 @@ -1,8 +1,8 @@ Source: libcangjie Section: utils -Priority: extra +Priority: optional Maintainer: IME Packaging Team -Uploaders: Anthony Wong +Uploaders: Anthony Wong Build-Depends: debhelper (>= 9), autotools-dev, libsqlite3-dev, @@ -10,7 +10,7 @@ automake, dh-autoreconf, pkg-config -Standards-Version: 3.9.5 +Standards-Version: 3.9.6 Homepage: https://github.com/Cangjians/libcangjie Vcs-Git: git://anonscm.debian.org/pkg-ime/libcangjie.git Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-ime/libcangjie.git;a=summary @@ -44,6 +44,7 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, libcangjie2 (= ${binary:Version}), libsqlite3-dev +Conflicts: libcangjie-dev Description: Cangjie input method library (development) This is a library that provides functions related to the Cangjie Chinese input method. @@ -55,6 +56,7 @@ Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, libcangjie2 (= ${binary:Version}) +Conflicts: libcangjie-dev Multi-Arch: foreign Description: Cangjie input method library development tools This is a library that provides functions related to the Cangjie @@ -68,6 +70,7 @@ Multi-Arch: same Depends: ${misc:Depends}, libcangjie2 (= ${binary:Version}) +Priority: extra Description: Cangjie input method library (debug) This is a library that provides functions related to the Cangjie Chinese input method. diff -Nru libcangjie-1.0/debian/libcangjie2.symbols libcangjie-1.3/debian/libcangjie2.symbols --- libcangjie-1.0/debian/libcangjie2.symbols 1970-01-01 00:00:00.000000000 +0000 +++ libcangjie-1.3/debian/libcangjie2.symbols 2015-01-19 12:31:16.000000000 +0000 @@ -0,0 +1,15 @@ +libcangjie.so.2 libcangjie2 #MINVER# + cangjie_char_free@Base 1.2 + cangjie_char_list_append@Base 1.2 + cangjie_char_list_free@Base 1.2 + cangjie_char_list_new_elem@Base 1.2 + cangjie_char_list_prepend@Base 1.2 + cangjie_char_new@Base 1.2 + cangjie_free@Base 1.2 + cangjie_get_characters@Base 1.2 + cangjie_get_characters_by_shortcode@Base 1.2 + cangjie_get_filter_query@Base 1.2 + cangjie_get_radical@Base 1.2 + cangjie_is_input_key@Base 1.2 + cangjie_new@Base 1.2 + cangjie_radicals@Base 1.2 diff -Nru libcangjie-1.0/debian/watch libcangjie-1.3/debian/watch --- libcangjie-1.0/debian/watch 2014-01-19 16:39:45.000000000 +0000 +++ libcangjie-1.3/debian/watch 2015-01-19 12:31:16.000000000 +0000 @@ -1,2 +1,2 @@ version=3 -http://cangjians.github.io/downloads/libcangjie/libcangjie-(.+).tar.xz +https://github.com/Cangjians/libcangjie/releases /Cangjians/libcangjie/releases/download/v(?:.+)/libcangjie-(.+).tar.xz diff -Nru libcangjie-1.0/docs/cangjiecharlist.md libcangjie-1.3/docs/cangjiecharlist.md --- libcangjie-1.0/docs/cangjiecharlist.md 1970-01-01 00:00:00.000000000 +0000 +++ libcangjie-1.3/docs/cangjiecharlist.md 2014-12-25 16:03:56.000000000 +0000 @@ -0,0 +1,58 @@ +## Lists of characters + +This is again something your application will consume, but we document it here +both for reference, and because knowing how things work will provide you a +better understanding of how to use libcangjie. + +A `CangjieCharList` is merely a doubly-linked list of `CangjieChar` instances: + +```c +struct CangjieCharList { + CangjieChar *c; + CangjieCharList *prev; + CangjieCharList *next; +}; +``` + +This is pretty self-explanatory: the `c` member is the `CangjieChar` of the +current item in the list, and the `prev` and `next` members are used to +iterate the list by reaching the previous or next item. + +#### Growing a list: `cangjie_char_list_append()` and `cangjie_char_list_prepend()` + +There are two ways to add elements to a list, you can either append a new +element at the end, or prepend a new element at the beginning. + +Here again, the API is really trivial: + +```c +// We have this list +CangjieCharList *l; + +// Now create a new CangjieChar +CangjieChar *c; +int ret = cangjie_char_new(&c, "木", "d", 1000); + +// And append it at the end of the list +ret = cangjie_char_list_append(&l, c); + +// Or instead prepend it +ret = cangjie_char_list_prepend(&l, c); +``` + +**Note:** `cangjie_char_list_append()` has to traverse the entire list to find +the end, which is inefficient when repeatedly adding multiple items. It is +usually faster to prepend all the elements to the list. + +#### Freeing used memory: `cangjie_char_list_free()` + +You are responsible for freeing all the `CangjieCharList` you create. If `l` +is a pointer to a `CangjieCharList` instance: + +```c +int ret = cangjie_char_list_free(l); +``` + +**Note:** `cangjie_char_list_free()` will traverse the list and free every +`CangjieChar` element in it. You do not need to manually free them with +`cangjie_char_free()`. diff -Nru libcangjie-1.0/docs/cangjiechar.md libcangjie-1.3/docs/cangjiechar.md --- libcangjie-1.0/docs/cangjiechar.md 1970-01-01 00:00:00.000000000 +0000 +++ libcangjie-1.3/docs/cangjiechar.md 2014-12-25 16:03:56.000000000 +0000 @@ -0,0 +1,60 @@ +## The CangjieChar structure + +This is the basic currency unit in libcangjie. `CangjieChar`'s are what the +functions return when you want to find what character corresponds to a certain +Cangjie code. + +The `CangjieChar` structure is defined as follows: + +```c +struct CangjieChar { + char chchar[5]; + char code[6]; + uint32_t frequency; +}; +``` + +The `chchar` member is the character that the user actually wants, and the +`code` member is its Cangjie code. + +For example, in Cangjie, the character (`chchar`) "木" has the `code` "d". + +Finally, the `frequency` member is a useful measure to order the characters +when presenting them to the user. The higher it is, the more frequent that +character is. + +For example, a character with a `frequency` of 1000 should be presented before +a character with a frequency of 500. + +#### Instantiating a CangjieChar: `cangjie_char_new()` + +`CangjieChar`'s are really something that your application will consume, not +something you will create and manage. + +Nevertheless, if you really want to create a new `CangjieChar`, use the +`cangjie_char_new` function: + +* The first argument is the `chchar` member. It is a `char *` and must be + less than 4 `char` in length. + +* The second argument is the Cangjie `code` for this character. It is a + `char *` and must be less that 5 `char` in length. + +* The third argument is the `frequency` for this character. It is a `uint32_t` + integer. + +Here is an example: + +```c +CangjieChar *c; +int ret = cangjie_char_new(&c, "木", "d", 1000); +``` + +#### Freeing used memory: `cangjie_char_free()` + +You are expected to free all `CangjieChar` instances you create. If `c` is a +pointer to a `CangjieChar` instance: + +```c +int ret = cangjie_char_free(c); +``` diff -Nru libcangjie-1.0/docs/cangjie.md libcangjie-1.3/docs/cangjie.md --- libcangjie-1.0/docs/cangjie.md 1970-01-01 00:00:00.000000000 +0000 +++ libcangjie-1.3/docs/cangjie.md 2013-10-26 04:16:04.000000000 +0000 @@ -0,0 +1,142 @@ +## The Cangjie context + +Now this is really the interesting part: it is the actual entry point to the +library. For everything worth doing with libcangjie, you will want to get a +hold on a `Cangjie` context. + +Here is how it is defined: + +```c +struct Cangjie { + uint32_t version; + uint32_t filter_flags; + + sqlite3 *db; + char *cj_query; + char *shortcode_query; +}; +``` + +The public members of the structure deserve some explanations: + +* the `version` is an integer representing the version (see versions.md) of the + Cangjie input method you are interested in. + +* the `filter_flags` is an integer corresponding to how you want to + filter the output (see filters.md) of the `cangjie_get_characters()` query + function. + +The remaining attributes are considered **private API** and should not be +accessed directly. As such, we will not document them here. + +#### First step: get a Cangjie context with `cangjie_new()` + +Because of the aforementioned private attributes, you **must** use the +`cangjie_new()` function as follows: + +```c +Cangjie cj; +int ret = cangjie_new(&cj, 3, CANGJIE_FILTER_BIG5 | CANGJIE_FILTER_HKSCS); +``` + +The second parameter is one of the supported versions (see versions.md), and +the third is a bitwise OR of the available output filters (see filters.md). + +These will have an impact on the `cangjie_get_characters()` query function. + +Note that in the example above, given the output filters that have been used, +the only characters which would be returned are the ones which are part of the +Big 5 encoding and the Hong Kong Supplemental Character Set. + +Output filters thus control the set of characters which will be returned, not +the ones which are filtered out. + +#### Querying for characters + +There are three query functions. + +First, and most importantly, `cangjie_get_characters()` returns a list of +characters corresponding to a given Cangjie code. + +This is really what is intended by a Cangjie input method: the user types an +input code, and expects one or more characters in return. + +Here is an example of usage: + +```c +CangjieCharList *l; + +// cj is an initialized Cangjie context +int ret = cangjie_get_characters(cj, "abcd", &l); +``` + +After execution of the above, `l` will be a list (see cangjiecharlist.md) of +one or more `CangjieChar` instances (see cangjiechar.md) corresponding to the +"abcd" code in the Cangjie version passed to the constructor of the `Cangjie` +context. + +Wildcards ("*") are supported inside a code. For example, the "d*d" code could +be used. + +It is often desired to show the user the radical corresponding to the +characters they input, rather than (or along with) the latin letters they +actually type. + +You can do that with the `cangjie_get_radical()` function, used as follows: + +```c +char *radical; + +// cj is an initialized Cangjie context +int ret = cangjie_get_radical(cj, 'd', &radical); +``` + +After execution, `radical` contains the radical corresponding to the 'd' code. + +Finally, users (especially Quick users) often want a convenient way to input +punctuation and symbols without knowing their Cangjie code. + +As such, we provide the `cangjie_get_characters_by_shortcode()` function, +which is used in exactly the same way as the `cangjie_get_characters()` one: + +```c +CangjieCharList *l; + +int ret = cangjie_get_characters_by_shortcode(cj, ",", &l); +``` + +After execution, `l` would contain a `CangjieChar` instance for each +fullwidth / Chinese comma. + +Note that in the above cases, you are expected to +free the `CangjieCharList` (see cangjiecharlist.md) that result from these +functions. + +#### Validating user input + +In your application, you might want to check whether the user input are valid +keys of Cangjie codes (to pass them to the `cangjie_get_characters()` +function), or not (for example, to pass other characters to the +`cangjie_get_characters_by_shortcode()` function). + +You can do that with the `cangjie_is_input_key()` function: + +```c +// ret would be equal to CANGJIE_OK here +int ret = cangjie_is_input_key(cj, "a"); + +// ret would be equal to CANGJIE_INVALID here +int ret = cangjie_is_input_key(cj, "@"); +``` + +The function only returns either `CANGJIE_OK` (the key is a valid Cangjie +input) or `CANGJIE_INVALID` (the key is not). + +#### Tidying up behind yourself + +When done, you should destroy the `Cangjie` context to free the used memory +and close the connection to the database: + +```c +int ret = cangjie_free(cj); +``` diff -Nru libcangjie-1.0/docs/cli.md libcangjie-1.3/docs/cli.md --- libcangjie-1.0/docs/cli.md 1970-01-01 00:00:00.000000000 +0000 +++ libcangjie-1.3/docs/cli.md 2014-01-30 16:14:54.000000000 +0000 @@ -0,0 +1,81 @@ +## Name + +libcangjie_cli - a CLI interface to the Cangjie database + +## Synopsis + +``` +libcangjie_cli [OPTIONS] CODE +``` + +## Description + +libcangjie_cli may be used to query the Cangjie database from the command +line. + +This is mostly useful for testing and/or debugging purpose, as the primary +interface is through the libcangjie library. + +## Options + +The following options are understood: + +* `-h`, `--help` + + Print a short help text and exit. + +* `-f FILTER`, `--filter=FILTER` + + Specify a comma-separated list of filters to use for the query. + + Acceptable values are one or more of `big5`, `hkscs`, `punctuation`, + `chinese`, `zhuyin`, `kanji`, `katakana`, `symbols`. + + The default is `big5,hkscs`. + +* `-m MODE`, `--mode=MODE` + + Specify the query mode. + + Acceptable values are one of `code`, `shortcode` or `radical`. + + The default value is `code`. + +* `-C VERSION`, `--cj-version=VERSION` + + Specify the Cangjie version to use for the query. + + Acceptable values are one of `3` or `5`. + +## Exit status + +On success, 0 is returned, a non-zero failure code otherwise. + +See the `cangjie/cangjieerrors.h` header for the list of possible exit codes. + +## Environment + +As for libcangjie itself, the `CANGJIE_DB` environment variable can be used to +specify the full path to the Cangjie database. + +## Exemples + +To obtain the characters which have `a` for Cangjie code, with all default +options, run: + +``` +$ libcangjie_cli a +``` + +To obtain **all** the characters which have a Cangjie code starting with `h` +and ending with `i`, use: + +``` +$ libcangjie_cli --filter=big5,hkscs,punctuation,chinese,zhuyin,kanji,katakana,symbols 'd*d' +``` + +To get the Cangjie radical of the letter `x`, run: + +``` +$ libcangjie_cli --mode=radical x +``` diff -Nru libcangjie-1.0/docs/errors.md libcangjie-1.3/docs/errors.md --- libcangjie-1.0/docs/errors.md 1970-01-01 00:00:00.000000000 +0000 +++ libcangjie-1.3/docs/errors.md 2013-10-26 04:16:04.000000000 +0000 @@ -0,0 +1,23 @@ +## Return values + +**All functions in libcangjie return `int`'s**. Which value they return +depends on the success or failure of the execution. + +When everything goes right, the function succeeds and returns `CANGJIE_OK`. + +Functions which are supposed get you a list of characters will return +`CANGJIE_NOCHARS` when no characters correspond to your query. + +If the libcangjie database could not be opened for some reason, then +`CANGJIE_DBOPEN` is returned. + +If an error happens when querying the database, the function returns +`CANGJIE_DBERROR`. + +When memory could not be allocated, the function will return `CANGJIE_NOMEM`. + +Finally, functions will return `CANGJIE_INVALID` when they are passed an +invalid input. + +Of course, you must include the `cangjie.h` header in order to have these +defined. diff -Nru libcangjie-1.0/docs/filters.md libcangjie-1.3/docs/filters.md --- libcangjie-1.0/docs/filters.md 1970-01-01 00:00:00.000000000 +0000 +++ libcangjie-1.3/docs/filters.md 2013-10-26 04:16:04.000000000 +0000 @@ -0,0 +1,34 @@ +## Output filtering + +Often when using libcangjie you will get lists of characters (for example, +which characters correspond to the code "d*d" ?). + +It is possible to filter these lists so you only get the characters you are +interested in. + +Once you include the `cangjie.h` header, you will be able to use the following +filters: + +* Use `CANGJIE_FILTER_BIG5` if you are interested in the characters which are + part of the Big 5 charset. +* Use `CANGJIE_FILTER_HKSCS` if you want the characters which are part of the + Hong Kong Supplemental Character Set. +* Use `CANGJIE_FILTER_PUNCTUATION` to get the punctuation characters. +* Use `CANGJIE_FILTER_CHINESE` if you want all Chinese characters. +* Use `CANGJIE_FILTER_ZHUYIN` in order to get the characters part of Taiwan's + Zhuyin/Bopomofo alphabet. +* Use `CANGJIE_FILTER_KANJI` for the Japanese Kanji characters. +* Use `CANGJIE_FILTER_KATAKANA` and you'll get the Japanese Katakana + characters. +* Use `CANGJIE_FILTER_HIRAGANA` if the Japanese Hiragana matter to you. +* Finally, use `CANGJIE_FILTER_SYMBOLS` to get access to lots of miscellaneous + symbols. + +Note that these are bit flags. If you want more than one, just OR them +together. + +For example, if you want the Big 5 and HKSCS characters, use: + +```c +CANGJIE_FILTER_BIG5 | CANGJIE_FILTER_HKSCS +``` diff -Nru libcangjie-1.0/docs/index.md libcangjie-1.3/docs/index.md --- libcangjie-1.0/docs/index.md 1970-01-01 00:00:00.000000000 +0000 +++ libcangjie-1.3/docs/index.md 2014-01-30 16:14:54.000000000 +0000 @@ -0,0 +1,19 @@ +libcangjie is a very simple library: + +* there is only one header to include: `cangjie.h` +* everything happens by instantiating a `Cangjie` context, and then passing it + to the various functions of the API. + +These pages will document proper use of libcangjie. Although the interesting +part is the last of the list, we recommend you read them in order: + +1. the possible error codes (see errors.md) +2. the supported Cangjie versions (see versions.md) +3. the available output filters (see filters.md) +4. the `CangjieChar` structure (see cangjiechar.md) +5. the `CangjieCharList` character lists (see cangjiecharlist.md) +6. the `Cangjie` context (see cangjie.md) + +libcangjie also comes with a command-line tool, which can be seen as an +example of how to use the API, and is useful for testing/debugging purpose: +`libcangjie_cli`. (see cli.md) diff -Nru libcangjie-1.0/docs/versions.md libcangjie-1.3/docs/versions.md --- libcangjie-1.0/docs/versions.md 1970-01-01 00:00:00.000000000 +0000 +++ libcangjie-1.3/docs/versions.md 2013-10-26 04:16:04.000000000 +0000 @@ -0,0 +1,7 @@ +## The Cangjie versions + +libcangjie supports **2 different versions of the Cangjie input method**: +versions 3 and 5. + +Once you include the `cangjie.h` header, they are defined as +`CANGJIE_VERSION_3` and `CANGJIE_VERSION_5`. diff -Nru libcangjie-1.0/INSTALL.md libcangjie-1.3/INSTALL.md --- libcangjie-1.0/INSTALL.md 2013-10-26 04:16:04.000000000 +0000 +++ libcangjie-1.3/INSTALL.md 2014-12-25 16:03:56.000000000 +0000 @@ -1,7 +1,58 @@ -At the moment, libcangjie is not included in any operating system, so you'll -have to build it from source. +## Arch Linux -We will update these instructions as that changes. +libcangjie has not been included in official repository yet, but only in AUR. +If it works for you and you like it, please don't hesitate to vote it on +[upvote it](https://aur.archlinux.org/packages/libcangjie/). You can install it +with `yaourt`: + +``` +$ yaourt libcangjie +``` + +## Debian Unstable / Sid + +libcangjie is included in the default Debian repositories, so you can just +install it with `apt-get`, as the root user: + +``` +# apt-get install libcangjie2 +``` + +Note that if you need the development headers, then you should also install +the `libcangjie2-dev` package. + +## Fedora + +libcangjie is included in the default Fedora repositories, so you can just +install it with `yum`: + +``` +$ sudo yum install libcangjie +``` + +Note that if you need the development headers, then you should also install +the `libcangjie-devel` package. + +## Ubuntu 14.04 + +libcangjie is included in the default Ubuntu repositories, **starting with the +14.04 release**, so you can install it with `apt-get`: + +``` +$ sudo apt-get install libcangjie2 +``` + +Note that if you need the development headers, then you should also install +the `libcangjie2-dev` package. + +## NixOS + +libcangjie is included in the default NixOS channel, **starting with the +14.02 release**, so you can install it with `nix-env`: + +``` +$ nix-env --install libcangjie +``` ## Build from the sources @@ -14,7 +65,9 @@ ### Install from a release tarball -_**Note:** There are no release tarballs at this point._ +Download a release tarball from +[the download section](http://cangjians.github.io/downloads/libcangjie/) of +our website. From the root folder of the unpacked tarball, do the usual Autotools dance: diff -Nru libcangjie-1.0/m4/libtool.m4 libcangjie-1.3/m4/libtool.m4 --- libcangjie-1.0/m4/libtool.m4 2013-12-21 15:03:07.000000000 +0000 +++ libcangjie-1.3/m4/libtool.m4 2014-12-28 11:50:57.000000000 +0000 @@ -1326,10 +1326,10 @@ x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; - powerpcle-*linux*) + powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; - powerpc-*linux*) + powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) diff -Nru libcangjie-1.0/Makefile.am libcangjie-1.3/Makefile.am --- libcangjie-1.0/Makefile.am 2013-10-26 04:16:04.000000000 +0000 +++ libcangjie-1.3/Makefile.am 2014-12-25 16:03:56.000000000 +0000 @@ -138,6 +138,7 @@ autogen.sh \ data/README.table.rst \ data/table.txt \ + $(wildcard docs/*.md) \ INSTALL.md \ README.md \ $(NULL) diff -Nru libcangjie-1.0/Makefile.in libcangjie-1.3/Makefile.in --- libcangjie-1.0/Makefile.in 2013-12-21 15:03:15.000000000 +0000 +++ libcangjie-1.3/Makefile.in 2014-12-28 11:50:59.000000000 +0000 @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.13.4 from Makefile.am. +# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. @@ -91,7 +91,7 @@ $(top_srcdir)/configure $(am__configure_deps) \ $(srcdir)/config.h.in $(top_srcdir)/data/cangjie.pc.in depcomp \ $(libcangjie_la_include_HEADERS) test-driver AUTHORS COPYING \ - config.guess config.sub install-sh missing ltmain.sh + compile config.guess config.sub install-sh missing ltmain.sh ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ @@ -614,6 +614,7 @@ autogen.sh \ data/README.table.rst \ data/table.txt \ + $(wildcard docs/*.md) \ INSTALL.md \ README.md \ $(NULL) @@ -659,8 +660,8 @@ $(am__aclocal_m4_deps): config.h: stamp-h1 - @if test ! -f $@; then rm -f stamp-h1; else :; fi - @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi + @test -f $@ || rm -f stamp-h1 + @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 @@ -822,14 +823,14 @@ @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -1308,10 +1309,16 @@ $(am__post_remove_distdir) dist-tarZ: distdir + @echo WARNING: "Support for shar distribution archives is" \ + "deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir + @echo WARNING: "Support for distribution archives compressed with" \ + "legacy program 'compress' is deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__post_remove_distdir) @@ -1353,9 +1360,10 @@ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ - && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + && ../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ + --srcdir=.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ diff -Nru libcangjie-1.0/missing libcangjie-1.3/missing --- libcangjie-1.0/missing 2013-12-21 15:03:15.000000000 +0000 +++ libcangjie-1.3/missing 2014-12-28 11:50:59.000000000 +0000 @@ -1,7 +1,7 @@ #! /bin/sh # Common wrapper for a few potentially missing GNU programs. -scriptversion=2012-06-26.16; # UTC +scriptversion=2013-10-28.13; # UTC # Copyright (C) 1996-2013 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. @@ -160,7 +160,7 @@ ;; autom4te*) echo "You might have modified some maintainer files that require" - echo "the 'automa4te' program to be rebuilt." + echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) diff -Nru libcangjie-1.0/README.md libcangjie-1.3/README.md --- libcangjie-1.0/README.md 2013-10-26 04:16:04.000000000 +0000 +++ libcangjie-1.3/README.md 2014-12-25 16:03:56.000000000 +0000 @@ -43,7 +43,9 @@ or the one shipped with this software. Development happens [on github](https://github.com/Cangjians/libcangjie), and -stable release tarballs will be available when we reach that point. +stable release tarballs can be found in +[the download section](http://cangjians.github.io/downloads/libcangjie/) of +our website. ## History diff -Nru libcangjie-1.0/src/bench.c libcangjie-1.3/src/bench.c --- libcangjie-1.0/src/bench.c 2013-10-06 07:24:06.000000000 +0000 +++ libcangjie-1.3/src/bench.c 2014-01-30 16:14:54.000000000 +0000 @@ -1,3 +1,22 @@ +/* Copyright (c) 2013 - The libcangjie authors. + * + * This file is part of libcangjie. + * + * libcangjie 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 3 of the License, or + * (at your option) any later version. + * + * libcangjie 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 libcangjie. If not, see . + */ + + #include #include #include @@ -36,11 +55,15 @@ return ret; } - code = calloc(4, sizeof(char)); - cStartClock = clock(); + code = malloc(4 * sizeof(char)); + printf("Testing all one-letter codes... "); + cStartClock = clock(); for (i = 97; i <= 122; i++) { CangjieCharList *chars = NULL; + + snprintf(code, 2, "%c", i); + ret = cangjie_get_characters(cj, code, &chars); if (ret != CANGJIE_NOCHARS) { @@ -51,11 +74,36 @@ count++; } + printf("Ran %d queries in %4.3f milliseconds\n", count, + 1000 * (clock() - cStartClock) / (double)CLOCKS_PER_SEC); + + count = 0; + + printf("Testing all two-letters codes... "); + cStartClock = clock(); + for (i = 97; i <= 122; i++) { + for (j = 97; j <= 122; j++) { + CangjieCharList *chars = NULL; + snprintf(code, 3, "%c%c", i, j); + + ret = cangjie_get_characters(cj, code, &chars); + + if (ret != CANGJIE_NOCHARS) { + iterate_results(chars); + + cangjie_char_list_free(chars); + } + + count++; + } + } printf("Ran %d queries in %4.3f milliseconds\n", count, 1000 * (clock() - cStartClock) / (double)CLOCKS_PER_SEC); count = 0; + + printf("Testing all 'X*Y' codes... "); cStartClock = clock(); for (i = 97; i <= 122; i++) { for (j = 97; j <= 122; j++) { @@ -74,7 +122,6 @@ count++; } } - printf("Ran %d queries in %4.3f milliseconds\n", count, 1000 * (clock() - cStartClock) / (double)CLOCKS_PER_SEC); diff -Nru libcangjie-1.0/src/cangjie.c libcangjie-1.3/src/cangjie.c --- libcangjie-1.0/src/cangjie.c 2013-10-26 05:34:28.000000000 +0000 +++ libcangjie-1.3/src/cangjie.c 2014-12-25 16:03:56.000000000 +0000 @@ -66,6 +66,14 @@ "\xEF\xBC\xBA", // Z }; +static void strcat_or_operator(uint32_t *first, char *query) { + if (! *first) { + strcat(query, "OR "); + } else { + *first = 0; + } +} + int cangjie_get_filter_query(Cangjie *cj, char **query) { uint32_t first = 1; if (cj->filter_flags == 0) { @@ -91,75 +99,43 @@ } if (cj->filter_flags & CANGJIE_FILTER_HKSCS) { - if (first) { - strcat(*query, "hkscs = 1 "); - first = 0; - } else { - strcat(*query, "OR hkscs = 1 "); - } + strcat_or_operator(&first, *query); + strcat(*query, "hkscs = 1 "); } if (cj->filter_flags & CANGJIE_FILTER_PUNCTUATION) { - if (first) { - strcat(*query, "punct = 1 "); - first = 0; - } else { - strcat(*query, "OR punct = 1 "); - } + strcat_or_operator(&first, *query); + strcat(*query, "punct = 1 "); } if (cj->filter_flags & CANGJIE_FILTER_CHINESE) { - if (first) { - strcat(*query, "zh = 1 "); - first = 0; - } else { - strcat(*query, "OR zh = 1 "); - } + strcat_or_operator(&first, *query); + strcat(*query, "zh = 1 "); } if (cj->filter_flags & CANGJIE_FILTER_ZHUYIN) { - if (first) { - strcat(*query, "zhuyin = 1 "); - first = 0; - } else { - strcat(*query, "OR zhuyin = 1 "); - } + strcat_or_operator(&first, *query); + strcat(*query, "zhuyin = 1 "); } if (cj->filter_flags & CANGJIE_FILTER_KANJI) { - if (first) { - strcat(*query, "kanji = 1 "); - first = 0; - } else { - strcat(*query, "OR kanji = 1 "); - } + strcat_or_operator(&first, *query); + strcat(*query, "kanji = 1 "); } if (cj->filter_flags & CANGJIE_FILTER_KATAKANA) { - if (first) { - strcat(*query, "katakana = 1 "); - first = 0; - } else { - strcat(*query, "OR katakana = 1 "); - } + strcat_or_operator(&first, *query); + strcat(*query, "katakana = 1 "); } if (cj->filter_flags & CANGJIE_FILTER_HIRAGANA) { - if (first) { - strcat(*query, "hiragana = 1 "); - first = 0; - } else { - strcat(*query, "OR hiragana = 1 "); - } + strcat_or_operator(&first, *query); + strcat(*query, "hiragana = 1 "); } if (cj->filter_flags & CANGJIE_FILTER_SYMBOLS) { - if (first) { - strcat(*query, "symbol = 1 "); - first = 0; - } else { - strcat(*query, "OR symbol = 1 "); - } + strcat_or_operator(&first, *query); + strcat(*query, "symbol = 1 "); } strcat(*query, ") "); @@ -185,6 +161,7 @@ tmp->cj_query = calloc(strlen(BASE_QUERY) + MAX_LEN_FILTER_QUERY + 1, sizeof(char)); if (tmp->cj_query == NULL) { + cangjie_free(tmp); return CANGJIE_NOMEM; } @@ -192,6 +169,7 @@ ret = cangjie_get_filter_query(tmp, &filter_query); if (ret != CANGJIE_OK) { + cangjie_free(tmp); return ret; } @@ -202,6 +180,7 @@ tmp->shortcode_query = calloc(strlen(BASE_QUERY) + MAX_LEN_CODE_QUERY + 1, sizeof(char)); if (tmp->shortcode_query == NULL) { + cangjie_free(tmp); return CANGJIE_NOMEM; } @@ -216,8 +195,10 @@ ret = sqlite3_open_v2(CANGJIE_DB, &tmp->db, SQLITE_OPEN_READONLY, NULL); } if (ret == SQLITE_CANTOPEN) { + cangjie_free(tmp); return CANGJIE_DBOPEN; } else if (ret != SQLITE_OK) { + cangjie_free(tmp); // FIXME: Unhandled error codes return ret; } @@ -257,6 +238,7 @@ query_code = calloc(6, sizeof(char)); if (query_code == NULL) { + free(cj_query); return CANGJIE_NOMEM; } strncpy(query_code, input_code, 5); @@ -270,6 +252,10 @@ } query = sqlite3_mprintf(cj_query, cj->version, query_code); + + free(query_code); + free(cj_query); + if (query == NULL) { return CANGJIE_NOMEM; } @@ -280,8 +266,6 @@ return ret; } - free(query_code); - free(cj_query); sqlite3_free(query); while (1) { diff -Nru libcangjie-1.0/src/cli.c libcangjie-1.3/src/cli.c --- libcangjie-1.0/src/cli.c 2013-10-26 05:34:28.000000000 +0000 +++ libcangjie-1.3/src/cli.c 2014-12-25 16:03:56.000000000 +0000 @@ -40,7 +40,8 @@ printf(" default: big5,hkscs\n"); printf(" acceptable values:\n"); printf(" big5, hkscs, punctuation, chinese,\n"); - printf(" zhuyin, kanji, katakana, symbols\n"); + printf(" zhuyin, kanji, katakana, hiragana,\n"); + printf(" symbols\n"); printf("-m, --mode=MODE specify the mode of query\n"); printf(" default: code\n"); printf(" acceptable values:\n"); @@ -114,14 +115,14 @@ if (strstr(optarg, "hkscs") != NULL) { opt_filter = opt_filter | CANGJIE_FILTER_HKSCS; } - if (strstr(optarg, "puntuation") != NULL) { + if (strstr(optarg, "punctuation") != NULL) { opt_filter = opt_filter | CANGJIE_FILTER_PUNCTUATION; } if (strstr(optarg, "chinese") != NULL) { opt_filter = opt_filter | CANGJIE_FILTER_CHINESE; } if (strstr(optarg, "zhuyin") != NULL) { - opt_filter = opt_filter | CANGJIE_FILTER_BIG5; + opt_filter = opt_filter | CANGJIE_FILTER_ZHUYIN; } if (strstr(optarg, "kanji") != NULL) { opt_filter = opt_filter | CANGJIE_FILTER_KANJI; @@ -219,6 +220,16 @@ cangjie_free(cj); return CANGJIE_NOCHARS; + } else if (ret == CANGJIE_INVALID) { + printf("Invalid code '%s'\n", code); + + cangjie_free(cj); + return CANGJIE_INVALID; + } else if (ret != CANGJIE_OK) { + printf("Other error %d with code '%s'\n", ret, code); + + cangjie_free(cj); + return ret; } iter = chars; diff -Nru libcangjie-1.0/src/dbbuilder.c libcangjie-1.3/src/dbbuilder.c --- libcangjie-1.0/src/dbbuilder.c 2013-10-26 04:16:04.000000000 +0000 +++ libcangjie-1.3/src/dbbuilder.c 2014-12-25 16:03:56.000000000 +0000 @@ -205,7 +205,6 @@ if (line[len-1] == '\n') { line[len-1] = '\0'; - len -= 1; } insert_line(db, line, i); diff -Nru libcangjie-1.0/test-driver libcangjie-1.3/test-driver --- libcangjie-1.0/test-driver 2013-12-21 15:03:15.000000000 +0000 +++ libcangjie-1.3/test-driver 2014-12-28 11:50:59.000000000 +0000 @@ -1,7 +1,7 @@ #! /bin/sh # test-driver - basic testsuite driver script. -scriptversion=2012-06-27.10; # UTC +scriptversion=2013-07-13.22; # UTC # Copyright (C) 2011-2013 Free Software Foundation, Inc. # @@ -44,13 +44,12 @@ Usage: test-driver --test-name=NAME --log-file=PATH --trs-file=PATH [--expect-failure={yes|no}] [--color-tests={yes|no}] - [--enable-hard-errors={yes|no}] [--] TEST-SCRIPT + [--enable-hard-errors={yes|no}] [--] + TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS] The '--test-name', '--log-file' and '--trs-file' options are mandatory. END } -# TODO: better error handling in option parsing (in particular, ensure -# TODO: $log_file, $trs_file and $test_name are defined). test_name= # Used for reporting. log_file= # Where to save the output of the test script. trs_file= # Where to save the metadata of the test run. @@ -69,10 +68,23 @@ --enable-hard-errors) enable_hard_errors=$2; shift;; --) shift; break;; -*) usage_error "invalid option: '$1'";; + *) break;; esac shift done +missing_opts= +test x"$test_name" = x && missing_opts="$missing_opts --test-name" +test x"$log_file" = x && missing_opts="$missing_opts --log-file" +test x"$trs_file" = x && missing_opts="$missing_opts --trs-file" +if test x"$missing_opts" != x; then + usage_error "the following mandatory options are missing:$missing_opts" +fi + +if test $# -eq 0; then + usage_error "missing argument" +fi + if test $color_tests = yes; then # Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'. red='' # Red.