mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
Remove idnkit-1.0 copy from BIND sources
This commit is contained in:
parent
90f9d86261
commit
c34d76ed36
195 changed files with 0 additions and 80893 deletions
|
|
@ -1,96 +0,0 @@
|
|||
|
||||
BIND 9 IDN support
|
||||
|
||||
Japan Network Information Center (JPNIC)
|
||||
|
||||
|
||||
* Compilation & installation
|
||||
|
||||
0. Prerequisite
|
||||
|
||||
You have to build and install idnkit before building bind9.
|
||||
|
||||
1. Running configure script
|
||||
|
||||
Run `configure' in the top directory. See `README' for the
|
||||
configuration options.
|
||||
|
||||
The following four options to `configure' are relevant to IDN. You
|
||||
should at least specify `--with-idn' option to enable IDN support.
|
||||
|
||||
--with-idn[=IDN_PREFIX]
|
||||
To enable IDN support, you have to specify `--with-idn' option.
|
||||
The argument IDN_PREFIX is the install prefix of idnkit. If
|
||||
IDN_PREFIX is omitted, PREFIX (derived from `--prefix=PREFIX')
|
||||
is assumed.
|
||||
|
||||
--with-libiconv[=LIBICONV_PREFIX]
|
||||
Specify this option if idnkit you have installed links GNU
|
||||
libiconv. The argument LIBICONV_PREFIX is install prefix of
|
||||
GNU libiconv. If the argument is omitted, PREFIX (derived
|
||||
from `--prefix=PREFIX') is assumed.
|
||||
|
||||
`--with-libiconv' is shorthand option for GNU libiconv.
|
||||
|
||||
--with-libiconv=/usr/local
|
||||
|
||||
This is equivalent to:
|
||||
|
||||
--with-iconv='-L/usr/local/lib -R/usr/local/lib -liconv'
|
||||
|
||||
`--with-libiconv' assumes that your C compiler has `-R'
|
||||
option, and that the option adds the specified run-time path
|
||||
to an executable binary. If `-R' option of your compiler has
|
||||
different meaning, or your compiler lacks the option, you
|
||||
should use `--with-iconv' option instead. Binary command
|
||||
without run-time path information might be unexecutable.
|
||||
In that case, you would see an error message like:
|
||||
|
||||
error in loading shared libraries: libiconv.so.2: cannot
|
||||
open shared object file
|
||||
|
||||
If both `--with-libiconv' and `--with-iconv' options are
|
||||
specified, `--with-iconv' is prior to `--with-libiconv'.
|
||||
|
||||
--with-iconv=ICONV_LIBSPEC
|
||||
If your libc doesn't provide iconv(), you need to specify the
|
||||
library containing iconv() with this option. `ICONV_LIBSPEC'
|
||||
is the argument(s) to `cc' or `ld' to link the library, for
|
||||
example, `--with-iconv="-L/usr/local/lib -liconv"'.
|
||||
You don't need to specify the header file directory for "iconv.h"
|
||||
to the compiler, as it isn't included directly by bind9.
|
||||
|
||||
--with-idnlib=IDN_LIBSPEC
|
||||
With this option, you can explicitly specify the argument(s)
|
||||
to `cc' or `ld' to link the idnkit's library, `libidnkit'. If
|
||||
this option is not specified, `-L${PREFIX}/lib -lidnkit' is
|
||||
assumed, where ${PREFIX} is the installation prefix specified
|
||||
with `--with-idn' option above. You may need to use this
|
||||
option to specify extra arguments, for example,
|
||||
`--with-idnlib="-L/usr/local/lib -R/usr/local/lib -lidnkit"'.
|
||||
|
||||
Please consult `README' for other configuration options.
|
||||
|
||||
Note that if you want to specify some extra header file directories,
|
||||
you should use the environment variable STD_CINCLUDES instead of
|
||||
CFLAGS, as described in README.
|
||||
|
||||
2. Compilation and installation
|
||||
|
||||
After running "configure", just do
|
||||
|
||||
make
|
||||
make install
|
||||
|
||||
for compiling and installing.
|
||||
|
||||
|
||||
* Contact information
|
||||
|
||||
Please see http://www.nic.ad.jp/en/idn/ for the latest news
|
||||
about idnkit.
|
||||
|
||||
Bug reports and comments on this kit should be sent to
|
||||
mdnkit-bugs@nic.ad.jp and idn-cmt@nic.ad.jp, respectively.
|
||||
|
||||
; $Id: README.idnkit,v 1.1 2009/12/04 20:14:28 each Exp $
|
||||
10
contrib/idn/idnkit-1.0-src/.gitignore
vendored
10
contrib/idn/idnkit-1.0-src/.gitignore
vendored
|
|
@ -1,10 +0,0 @@
|
|||
idn.conf.sample
|
||||
idnalias.conf.sample
|
||||
idn.conf.5
|
||||
idnalias.conf.5
|
||||
idnrc.5
|
||||
libidnkit.3
|
||||
libidnkitlite.3
|
||||
/idnconv
|
||||
/idnslookup
|
||||
/runidn
|
||||
|
|
@ -1,856 +0,0 @@
|
|||
2003-03-16
|
||||
* idnkit 1.0 release.
|
||||
|
||||
* DISTFILES, README, README.ja, INSTALL, INSTALL.ja: delete BIND8,
|
||||
Squid and libiconv patches.
|
||||
|
||||
2003-03-13
|
||||
* wsock/config/idnconf.tcl: change the version number to '1.0'.
|
||||
|
||||
2003-03-12
|
||||
* Makefile.in, lib/Makefile.in: Add 'make install-config' to
|
||||
Makefile target.
|
||||
|
||||
2003-03-11
|
||||
* patch/bind9/bind-9.2.2-patch: created.
|
||||
|
||||
2003-03-06
|
||||
* lib/punycode.c: idn__punycode_encode() outputs an error message
|
||||
if the input string is over PUNYCODE_MAXINPUT (the value is 3800).
|
||||
|
||||
2003-03-05
|
||||
* include/idn/api.h, include/idn/checker.h,
|
||||
include/idn/nameprep.h, include/idn/res.h, include/idn/version.h,
|
||||
lib/Makefile.in, lib/checker.c, lib/idn.conf.sample.in,
|
||||
lib/mapper.c, lib/nameprep.c, lib/nameprepdata.c,
|
||||
lib/normalizer.c, lib/tests/checker.tsy, lib/tests/mapper.tsy,
|
||||
lib/tests/nameprep.tsy, lib/tests/normalizer.tsy,
|
||||
man/idn.conf.5.in, tools/idnconv/idnconv.1, wsock/bin/idn.conf:
|
||||
Add NAMEPREP version 'RFC3491', and remove 'nameprep-11'.
|
||||
|
||||
2003-02-18
|
||||
* lib/tests/api-init1.tsy, lib/tests/api-init2.tsy,
|
||||
lib/tests/api-init3.tsy, lib/tests/api-init4-1.tsy,
|
||||
lib/tests/api-init4-2.tsy, lib/tests/api-init4-3.tsy,
|
||||
lib/tests/api-init5-1.tsy, lib/tests/api-init5-2.tsy,
|
||||
lib/tests/api-init5-3.tsy, lib/tests/api.tsy, lib/tests/converter.tsy,
|
||||
lib/tests/res.tsy, lib/tests/punycode.c: Change ACE prefix of Punycode
|
||||
from `zq--' to `xn--'.
|
||||
|
||||
2003-02-13
|
||||
* lib/make.wnt: remove dependencies on obsolete files.
|
||||
|
||||
* INSTALL, INSTALL.ja, configure.in, aclocal.m4: Delete configure's
|
||||
--with-punycode-prefix option.
|
||||
|
||||
2003-02-05
|
||||
* lib/res.c: improve performance when encoding/decoding
|
||||
loooooooong domain names.
|
||||
|
||||
2003-01-22
|
||||
* lib/res.c: idn_res_encodename() and idn_res_decodename() in
|
||||
libidnkit returns `idn_invalid_name' if local converter is not
|
||||
available.
|
||||
|
||||
2003-01-20
|
||||
* lib/normalize.c, lib/unormalize.c, include/idn/unormalize.h,
|
||||
lib/tests/normalizer.tsy: unicode-form-c or unicode-form-c/3.2.0 is
|
||||
no longer supported.
|
||||
|
||||
* lib/mapselector.c, lib/tests/mapselector.tsy:
|
||||
idn_mapselector_add() outputs an error message if invalid scheme
|
||||
name or TLD is given.
|
||||
|
||||
* lib/checker.c, lib/normalizer.c, lib/mapselector.c, lib/res.c:
|
||||
modify error messages.
|
||||
|
||||
* lib/result.c: modify an error message for `idn_invalid_length'.
|
||||
|
||||
2003-01-16
|
||||
* lib/checker.c, lib/idn.conf.sample.in, lib/mapper.c, lib/nameprep.c,
|
||||
lib/normalizer.c, lib/unicode.c, lib/tests/checker.tsy,
|
||||
lib/tests/mapper.tsy, lib/tests/nameprep.tsy, lib/tests/normalizer.tsy,
|
||||
man/idn.conf.5.in, tools/idnconv/idnconv.1:
|
||||
delete support for nameprep-03 and nameprep-09.
|
||||
|
||||
* lib/unicodedata_301.c, lib/unicodedata_310.c, DISTFILES:
|
||||
unicodedata_301.c and unicodedata_310.c are removed.
|
||||
|
||||
2003-01-14
|
||||
* tools/idnconv/idnconv.c, tools/idnconv/util.c, tools/idnconv/util.h:
|
||||
remove the restriction on the length of input lines. idnconv can
|
||||
now handle very long lines.
|
||||
|
||||
2003-01-10
|
||||
* lib/converter.c: fix a bug in extending intermediate buffer
|
||||
in converter_iconv_convtoucs4(), which causes incorrect
|
||||
codeset conversion when the input string is very long.
|
||||
|
||||
2002-12-06
|
||||
* idnkit 1.0pr2 release (preview release).
|
||||
|
||||
2002-12-03
|
||||
* lib/mapper.c, lib/normalize.c: Don't check whether an input string
|
||||
is STD3 ASCII label.
|
||||
lib/res.c: Skip localmap if the string is STD3 ASCII label.
|
||||
|
||||
2002-12-02
|
||||
* lib/tests/iconvchk.c, lib/tests/Makefile.in: enable to check
|
||||
whether codeset names "eucJP" and "SJIS" are available in iconv.
|
||||
|
||||
2002-12-01
|
||||
* tools/runidn/stub.c: use RTLD_NEXT for dlsym() if it is available.
|
||||
|
||||
2002-11-29
|
||||
* almost all files: change the license terms.
|
||||
|
||||
2002-11-25
|
||||
* lib/tests/codeset.h: define character encoding names here.
|
||||
* lib/tests/api-init1.tsy, lib/tests/api-init2.tsy,
|
||||
lib/tests/api-init3.tsy, lib/tests/api-init4-3.tsy,
|
||||
lib/tests/api-init5-3.tsy, lib/tests/converter.tsy,
|
||||
lib/tests/mapselector.tsy, lib/tests/resconf.tsy: include `codeset.h'.
|
||||
lib/tests/api-init4-1.tsy, lib/tests/api-init4-2.tsy,
|
||||
lib/tests/api-init5-1.tsy, lib/tests/api-init5-2.tsy,
|
||||
lib/tests/mapselector.tsy, lib/tests/resconf.tsy:
|
||||
Delete the unused cpp macro EUCJP_ENCODING_NAME.
|
||||
* INSTALL, INSTALL.ja: describe `lib/tests/codeset.h'.
|
||||
|
||||
* lib/converter.c: Fix bugs in converter_uescape_convfromucs4()
|
||||
and converter_uescape_convtoucs4() that libidnkit might crash
|
||||
when `from' is very long.
|
||||
|
||||
2002-11-15
|
||||
* Makefile.in: `make distclean' also removes `libtool'.
|
||||
|
||||
2002-10-25
|
||||
* lib/resconf.c: enable the IDN_CONVERTER_RTCHECK flag when it
|
||||
calls idn_converter_create().
|
||||
* tools/idnconv/util.c: enable the IDN_CONVERTER_RTCHECK flag
|
||||
when it calls idn_converter_setlocalconvertername() or
|
||||
idn_converter_setidnconvertername().
|
||||
|
||||
2002-09-20
|
||||
* wsock/README.txt, wsock/README_j.txt: add description on
|
||||
"Force local DLL reference" button.
|
||||
|
||||
2002-09-19
|
||||
* idnkit 1.0pr1 release (preview release).
|
||||
|
||||
2002-09-13
|
||||
* README, README.ja: update URIs.
|
||||
|
||||
* lib/Makefile.in, lib/tests/Makefile.in: generate libidntest and
|
||||
libidntestlite for test programs.
|
||||
|
||||
2002-09-09
|
||||
* wsock/wsock11/dlldef.h, wsock/wsock11/dllfunc.c,
|
||||
wsock/wsock11/dllload.c, wsock/wsock11/dllmain.c,
|
||||
wsock/wsock20/dlldef.h, wsock/wsock20/dllfunc.c,
|
||||
wsock/wsock20/dllload.c, wsock/wsock20/dllmain.c: take out
|
||||
DLL load/unload from DllMain(). load/unload is delayed until
|
||||
it is really necessary.
|
||||
* wsock/common/checkdll.c, wsock/common/wrapcommon.h: move DLL
|
||||
load/unload functions from wsock/{ws11,ws20}/dllmain.c.
|
||||
* wsock/printf.c: make logging more effective.
|
||||
|
||||
* DISTFILES: remove wsock/common/dllmain.c, which is no longer used.
|
||||
|
||||
2002-09-05
|
||||
* lib/mapper.c: fix a bug that idn_mapper_add(ctx, "filemap") aborts.
|
||||
|
||||
2002-09-04
|
||||
* lib/nameprep.c: GCC says that a variable declared in
|
||||
idn_nameprep_isvalidbidi() might be used uninitialized. Fixed.
|
||||
|
||||
* wsock/common/convert.c, wsock/common/printf.c,
|
||||
wsock/common/wrapcommon.h: always reset log output callback procedure
|
||||
before calling idnkit library functions.
|
||||
* wsock/wsock11/dllmain.c, wsock/wsock20/dllmain.c: reset
|
||||
log output callback before unloading.
|
||||
|
||||
2002-09-03
|
||||
* lib/tests/testygen, lib/tests/testsuite.c, lib/tests/testsuite.h:
|
||||
add verbose and partial exec modes.
|
||||
|
||||
2002-08-29
|
||||
* idnkit 020829 snapshot release.
|
||||
|
||||
2002-08-28
|
||||
* lib/tests/testygen: fix generation of main(). It didn't destroy
|
||||
a testsuite context.
|
||||
* lib/tests/testsuite.c: fix a double free bug in
|
||||
idn_testsuite_destroy().
|
||||
|
||||
* lib/filemapper.c: fix one memory leak in read_file().
|
||||
* lib/filemapper.c: fix buffer expansion bug in ucsbuf_grow().
|
||||
* lib/res.c: plug up memory leak in idn_res_decodename().
|
||||
|
||||
* lib/tests/setenv.c: fix memory leak bug.
|
||||
|
||||
* lib/filemapper.c, lib/ucsmap.c, lib/ucsset.c: fix misuse of
|
||||
realloc().
|
||||
|
||||
* lib/converter.c: plug up memory leak in
|
||||
converter_iconv_openfromucs4() and converter_iconv_opentoucs4().
|
||||
|
||||
2002-08-27
|
||||
* lib/tests/Makefile.in: support the case where the build directory
|
||||
is different from the source directory.
|
||||
|
||||
* lib/tests/Makefile.in: perform tests for lite library only if
|
||||
`--enable-liteonly' has been specified at configuration.
|
||||
|
||||
* lib/tests/setenv.c, lib/tests/setenv.h, lib/tests/Makefile.in,
|
||||
configure.in: support systems which lack setenv() and/or unsetenv().
|
||||
|
||||
* configure.in, lib/Makefile.in, lib/idn.conf.sample, INSTALL,
|
||||
INSTALL.ja: delete `--with-preference'.
|
||||
|
||||
2002-08-26
|
||||
* lib/tests/testygen: new option `-L', which suppresses `#line'
|
||||
cpp lines on output.
|
||||
|
||||
* DISTFILES: Add files for tests.
|
||||
* INSTALL, INSTALL.ja: add the `Test' section.
|
||||
|
||||
* lib/resconf.c: fix trace message of idn_resconf_create().
|
||||
|
||||
* win/README.WIN: update the contents.
|
||||
|
||||
* wsock/config/idnconf.tcl: do not display `force local DLL
|
||||
reference' button on Windows 95 and NT, since it is meaningless
|
||||
for these old OSes.
|
||||
|
||||
2002-08-22
|
||||
* lib/mapper.c, lib/normalizer.c: add the procedure for the case
|
||||
that ctx->nschems is 0 to idn_mapper_map() and
|
||||
idn_normalizer_normalize().
|
||||
|
||||
* lib/delimitermap.c: idn_delimitermap_add() and
|
||||
idn_delimitermap_addall() reject a request to add an invalid
|
||||
codepoint.
|
||||
|
||||
2002-08-21
|
||||
* lib/api.c: fix a bug that api_nameinit() didn't call
|
||||
idn_resconf_initialize().
|
||||
* lib/api.c: don't set the `ininitialized' flag if idn_nameinit()
|
||||
returns with an error.
|
||||
* lib/api.c, include/idn/api.h: add idn__setconffile().
|
||||
|
||||
* lib/mapselector.c: idn_mapselector_map() and idn_mapselector_map2()
|
||||
now accept `tld' beginning with a dot.
|
||||
|
||||
2002-08-20
|
||||
* wsock/common/checkdll.c: back out 0812 change because the check
|
||||
method doesn't seem to work correctly on WinMe.
|
||||
* wsock/wsock11/dllload.c, wsock/wsock20/dllload.c: add some trace
|
||||
statements.
|
||||
* wsock/config/idnconf.tcl: do not install winsock2 wrapper on
|
||||
Win98/Me.
|
||||
|
||||
* lib/tests/testsuite.c, lib/tests/testsuite.h, lib/tests/testygen:
|
||||
exit the testcase if ASSERT fails.
|
||||
|
||||
* lib/tests/testsuite.c, lib/tests/testsuite.h:
|
||||
replace ASSERT_PTRNOTNULL with ASSERT_PTR_NE.
|
||||
|
||||
* lib/tests/testutil.c, lib/testuil.h: new file.
|
||||
It provides create_conf_file().
|
||||
|
||||
2002-08-19
|
||||
* lib/resconf.c: if application calls idn_resconf_create() before
|
||||
idn_resconf_initialize(), idnkit returns `idn_failure'.
|
||||
|
||||
2002-08-15
|
||||
* lib/tests/testsuite.c, lib/tests/testsuite.h, lib/tests/testygen:
|
||||
add two assertion macros: ASSERT_PTR and ASSERT_PTRNOTNULL.
|
||||
|
||||
* lib/converter.c: fix some warning messages.
|
||||
|
||||
2002-08-14
|
||||
* lib/resconf.c: fix a but that idnkit aborts if a line in config
|
||||
file lacks an argument.
|
||||
|
||||
* wsock/common/hook.c, wsock/wsock11/dllfunc.c, wsock/wsock20/dllfunc.c
|
||||
: make name resolver APIs return the domain name verbatim (instead
|
||||
of returning error) when name decoding fails.
|
||||
|
||||
2002-08-13
|
||||
* lib/Makefile.in, lib/checker.c, lib/converter.c, lib/delimitermap.c,
|
||||
lib/filechecker.c, lib/filemapper.c, lib/mapper.c, lib/mapselector.c,
|
||||
lib/nameprep.c, lib/normalizer.c, lib/punycode.c, lib/race.c,
|
||||
lib/resconf.c, lib/unormalize.c: delete main routines for test.
|
||||
|
||||
* lib/tests/: new directory.
|
||||
* configure.in: Check for path of perl command.
|
||||
|
||||
* wsock/config/idnconf.tcl: correct OS version check routine.
|
||||
|
||||
2002-08-12
|
||||
* lib/make.wnt: change amcacez.* to punycode.*.
|
||||
* wsock/common/encoding.c, wsock/common/dump.c, wsock/common/convert.c,
|
||||
wsock/commn/hook.c, wsock/common/printf.c, wsock/common/wrapcommon.h,
|
||||
wsock/wsock11/dllfunc.c, wsock/wsock11/dllload.c,
|
||||
wsock/wsock20/dllfunc.c, wsock/wsock20/dllload.c: add extra argument
|
||||
(specifying buffer length) to some interface functions, in order to
|
||||
prevent possible buffer overflow.
|
||||
* wsock/common/printf.c: increase message buffer size.
|
||||
* wsock/wsock11/dllmain.c, wsock/wsock20/dllmain.c: call initialize
|
||||
routine before first log output.
|
||||
* wsock/common/checkdll.c: use light-weight DLL checking using
|
||||
LoadLibraryEx.
|
||||
|
||||
* lib/res.c: fix bugs in idn_res_encodename(), idn_res_decodename()
|
||||
and idn_res_decodename2(). They fell into infinite loops when
|
||||
given `tolen' is 0.
|
||||
|
||||
2002-08-08
|
||||
* lib/resconf.c, lib/res.c: remove unused functions and variables.
|
||||
|
||||
* lib/Makefile.in tools/idnconv/Makefile.in,
|
||||
tools/runidn/Makefile.in: add @CPPFLAGS@ to $(CFLAGS).
|
||||
|
||||
* lib/res.c: idn_res_decodename2() copies `from' to `to' and
|
||||
returns immediately when the `actions' argument is 0.
|
||||
|
||||
2002-08-07
|
||||
* lib/resconf.c: fix a bug in parse_conf() that if `nameprep' or
|
||||
`idn-encoding' directive is defined twice, default value is set
|
||||
to the directive.
|
||||
* lib/resconf.c: cosmetic changes.
|
||||
delete parse_map(), parse_normalize(), parse_prohibit(),
|
||||
parse_unassigned() and parse_bidi().
|
||||
|
||||
* lib/amcacez.c, include/idn/amcacez.h: renamed to lib/punycode.c
|
||||
and include/idn/punycode.h.
|
||||
|
||||
* include/idn/converter.h, lib/converter.h: define
|
||||
idn_converter_getrealname() externally instead of statically
|
||||
defined get_realname().
|
||||
|
||||
2002-08-06
|
||||
* lib/resconf.c: arrange processes of obsolete commands in
|
||||
idn_res_loadfile().
|
||||
|
||||
* INSTALL, INSTALL.ja, man/idn.conf.5.in, tools/idnconv/idnconv.1:
|
||||
remove description of RACE and AMC-ACE-Z.
|
||||
|
||||
* lib/resconf.c: fix a bug in handling of local-converter.
|
||||
|
||||
* lib/converter.c: add initialization check in
|
||||
idn_converter_aliasfile() and idn_converter_resetalias().
|
||||
|
||||
* lib/converter.c: free context memory at some right places in
|
||||
idn_converter_create().
|
||||
|
||||
2002-08-05
|
||||
* configure.in, lib/Makefile.in, lib/aliaslist.sh: also add the
|
||||
"UTF-8" entry if --with-utf8=NAME option of configure is specified,
|
||||
and NAME is not "UTF-8".
|
||||
|
||||
* tools/idnconv/idnconv.c: call idn_converter_destroy() after
|
||||
idn_resconf_getidnconverter() and idn_resconf_getlocalconverter()
|
||||
in main().
|
||||
|
||||
* lib/res.c: fix a bug in idn_res_decodename2().
|
||||
When the function called idn_res_decodename(), assertion check in
|
||||
idn_res_decodename() may have failed.
|
||||
|
||||
* lib/res.c: call idn_delimitermap_destroy() after
|
||||
idn_resconf_getdelimitermap() in idn_res_encodename() and
|
||||
idn_res_decodename().
|
||||
|
||||
2002-08-02
|
||||
* lib/res.c: fix mismatched pointer type in idn_res_decodename2().
|
||||
* lib/res.c: fix a bug in handling of `auxencoding', in
|
||||
idn_res_decodename2().
|
||||
|
||||
2002-08-01
|
||||
* lib/resconf.c: fix two memory leaks in parse_conf().
|
||||
|
||||
* lib/aliaslist.c: fix an error of size measurement in
|
||||
create_item().
|
||||
|
||||
2002-07-31
|
||||
* lib/converter.c: AMC-ACE-Z and RACE are now extra ACE.
|
||||
|
||||
2002-07-30
|
||||
* idnkit 020730 snapshot release.
|
||||
|
||||
* lib/resconf.c: fix a bug in idn_resconf_create() that it
|
||||
misses initializing `ctx->bidi_checker'.
|
||||
|
||||
2002-07-29
|
||||
* tools/idnconv/idnconv.1: describe bidi character check.
|
||||
|
||||
2002-07-24
|
||||
* lib/resconf.c: force to add bidi checker at parsing nameprep
|
||||
entry in config file.
|
||||
|
||||
2002-07-19
|
||||
* include/idn/checker.h, include/idn/nameprep.h,
|
||||
include/idn/res.h, include/idn/resconf.h, man/idn.conf.5.in,
|
||||
man/libidnkit.3.in, lib/checker.c, lib/nameprep.c, lib/res.c,
|
||||
lib/resconf.c, tools/idnconv/idnconv.c: add bidirectional label
|
||||
check routine.
|
||||
|
||||
* include/idn/api.h, include/idn/res.h, lib/api.c, lib/res.c,
|
||||
tools/idnconv/idnconv.c, tools/idnconv/util.c,
|
||||
tools/idnconv/util.h: change the type of action flag at conversion
|
||||
functions and define it as ``idn_action_t''.
|
||||
|
||||
2002-07-18
|
||||
* wsock/config/idnconf.tcl: implement .exe.local file
|
||||
creation/deletion feature.
|
||||
* lib/make.wnt: update list of files according to the recent
|
||||
changes of the library.
|
||||
|
||||
2002-07-12
|
||||
* include/idn/nameprpe.h: define idn_biditype_t.
|
||||
* lib/nameprep_template.c, lib/nameprep.c: support for bidi type
|
||||
check is added.
|
||||
|
||||
2002-07-11
|
||||
* idnkit 020711 snapshot release.
|
||||
|
||||
2002-07-09
|
||||
* man/Makefile.in, man/idn.conf.5.in: force to make and install
|
||||
manpage of idnalias.conf (merely a copy of idn.conf's manpage).
|
||||
|
||||
2002-07-08
|
||||
* DISTFILES: `lib/dude.c' and `include/idn/dude.h' are removed.
|
||||
* DISTFILES: `util/Makefile' is added.
|
||||
|
||||
* tools/idnconv/idnconv.c: fix typo in decode_file().
|
||||
|
||||
* tools/idnconv/idnconv.c: Support "-reverse -out ACE".
|
||||
|
||||
* lib/res.c: fix bugs in label_idndecode() and label_idnencode_ace().
|
||||
If UCS4 to UTF-8 conversion is failed with idn_buffer_overflow,
|
||||
we must extends the size of local buffer and try the conversion
|
||||
again.
|
||||
|
||||
2002-07-05
|
||||
* tools/idnconv/idnconv.c: treat input as the string of the local
|
||||
encoding specified by "-out" option at reverse conversion.
|
||||
|
||||
* include/idn/api.h, lib/api.c: add idn_decodename2() function.
|
||||
|
||||
* include/idn/res.h, lib/res.c: add idn_res_decodename2()
|
||||
function.
|
||||
|
||||
* include/idn/res.h, lib/res.c: restore IDN_DELIMMAP flag.
|
||||
|
||||
2002-07-02
|
||||
* lib/unicodedata_320.c, lib/checker.c, lib/idn.conf.sample.in,
|
||||
lib/mapper.c, lib/nameprep.c, lib/nameprepdata.c, lib/normalizer.c,
|
||||
lib/unicode.c, unicodedata_320.c, include/idn/nameprep.c, DISTFILES,
|
||||
man/idn.conf.5.in: Support NAMEPREP-11 which adopts Unicode-3.2.
|
||||
Support for NAMEPREP-06, -08, -09 are removed.
|
||||
|
||||
2002-07-01
|
||||
* tools/idnconv/idnconv.1: added `-A' option.
|
||||
|
||||
* include/idn/res.h, lib/res.c: redefine IDN_ENCODE_QUERY,
|
||||
IDN_DECODE_QUERY, IDN_ENCODE_STORED, IDN_DECODE_STORED, IDN_ENCODE_APP
|
||||
and IDN_DECODE_APP.
|
||||
|
||||
2002-06-26
|
||||
* lib/resconf.c, include/idn/resconf.h: define
|
||||
idn_resconf_getauxidnconverter(), idn_resconf_setauxidnconverter()
|
||||
and idn_resconf_setauxidnconvertername().
|
||||
|
||||
2002-06-20
|
||||
* lib/res.c: use action flags at round trip check.
|
||||
|
||||
2002-06-19
|
||||
* include/idn/res.h, lib/res.c: remove IDN_UNASCHECK flag from
|
||||
IDN_NAMEPREP.
|
||||
|
||||
* include/idn/res.h, lib/res.c: add IDN_ENCODE_QUERY,
|
||||
IDN_DECODE_QUERY, IDN_ENCODE_STORED, and IDN_DECODE_STORED flags.
|
||||
|
||||
* include/idn/res.h, lib/res.c: IDN_ENCODE_APP and IDN_DECODE_APP
|
||||
have same value as flags for conversion of the query string
|
||||
(IDN_ENCODE_QUERY and IDN_DECODE_QUERY) now.
|
||||
|
||||
2002-06-17
|
||||
* include/idn/Makefile.in, lib/Makefile.in, lib/converter.c,
|
||||
tools/runidn/Makefile.in, configure, INSTALL, INSTALL.ja:
|
||||
delete DUDE support.
|
||||
* include/idn/dude.h, lib/dude.c: deleted.
|
||||
|
||||
* README, README.ja: update URL of mdnkit FAQ.
|
||||
|
||||
* include/idn/res.h, lib/res.c, lib/idn.conf.sample.in,
|
||||
lib/delimitermap.c, man/libidnkit.3.in: add default delimiters
|
||||
defined in IDNA specification and always forced to do delimiter
|
||||
mapping.
|
||||
|
||||
* lib/resconf.c, man/idn.conf.5.in: remove "delimiter-map" entry
|
||||
support of configuration file.
|
||||
|
||||
* tools/idnconv/idnconv.c, tools/idnconv/idnconv.1: remove
|
||||
"-delimiter-map" and "-d" options.
|
||||
|
||||
2002-06-13
|
||||
* wsock/common/encoding.c: fix registry key setting so that
|
||||
it matches what documents say.
|
||||
|
||||
2002-06-11
|
||||
* include/idn/delimitermap.h: remove idn_delimitermap_fix()
|
||||
declaration.
|
||||
|
||||
2002-06-10
|
||||
* wsock/wsock2/dllfunc.c: fix a bug which makes wrapping of
|
||||
getaddrinfo()/getnameinfo() always fail.
|
||||
|
||||
2002-06-05
|
||||
* wsock/wsock2/dllfunc.c, wsock/wsock2/dllstub.c,
|
||||
wsock/wsock2/ws2_32.def: add new APIs introduced by WinXP.
|
||||
|
||||
2002-05-22
|
||||
* tools/idnconv/util.c: reset alias information before loading
|
||||
alias information file.
|
||||
|
||||
2002-05-20
|
||||
* idnkit 1.0rc1 release.
|
||||
|
||||
* include/idn/res.h: fix typo in a comment.
|
||||
|
||||
2002-05-17
|
||||
* include/idn/version.h: set IDNKIT_VERSION to "1.0rc1".
|
||||
|
||||
2002-05-13
|
||||
* tools/rpm/mdnkit.spec: renamed to idnkit.spec, and revised
|
||||
for idnkit-1.0.
|
||||
|
||||
2002-05-09
|
||||
* tools/idnconv/idnconv.c: now `idnconv -r' can convert a file
|
||||
from ACE to ACE.
|
||||
|
||||
2002-05-08
|
||||
* lib/idn.conf.sample.in: delete "encoding-alias-file" entry
|
||||
because idnkit does not support it any longer.
|
||||
|
||||
* lib/nameprepdata.c lib/nameprep.c, lib/mapper.c, lib/normalizer.c,
|
||||
lib/checker.c, lib/idn.conf.sample.in, man/idn.conf.5.in,
|
||||
tools/idnconv/idnconv.1: support NAMEPREP-09.
|
||||
|
||||
* lib/mapper.c, lib/normalizer.c, lib/checker.c, lib/mapselector.c,
|
||||
* lib/res.c, lib/race.c: spmplify local buffer managements.
|
||||
|
||||
* tools/idnconv/idnconv.c, tools/idnconv/util.c, tools/idnconv/util.h:
|
||||
fix a bug that wrong local encoding is set to a resconf context.
|
||||
|
||||
2002-05-07
|
||||
* tools/idnconv/util.c: delete set_reverse_context().
|
||||
* tools/idnconv/idnconv.c: fix a serious bug in -reverse conversion.
|
||||
|
||||
2002-05-04
|
||||
* include/idn/util.h, lib/converter.c, lib/resconf.c, lib/util.c:
|
||||
simplify Windows registry retrieval function interface.
|
||||
* wsock/common/convert.c, wsock/common/dump.c,
|
||||
wsock/common/encoding.c, wsock/common/wrapcommon.h: fix type
|
||||
conflicts.
|
||||
* wsock/wsock11/dlldef.h, wsock/wsock11/dllmain.c,
|
||||
wsock/wsock20/dlldef.h, wsock/wsock20/dllmain.c: fix typo.
|
||||
* wsock/common/jpnicmdn.def, wsock/common/jpnicmdn.h,
|
||||
wsock/config/mdnconf.tcl: removed.
|
||||
* DISTFILES: add new files, remove obsolete files.
|
||||
|
||||
2002-05-02
|
||||
* tools/idnconv/util.c: create a new function set_reverse_context().
|
||||
* tools/idnconv/idnconv.c: fix a bug in handing of reference count
|
||||
of idn_resconf_t contexts.
|
||||
|
||||
* lib/amcacez.c, lib/race.c, lib/dude.c, lib/delimitermap.c,
|
||||
lib/checker.c, lib/mapper.c, lib/mapselector.c, lib/converter.c,
|
||||
lib/normalizer.c, lib/res.c, lib/ucs4.c, lib/debug.c,
|
||||
include/idn/debug.h: output valuable trace logs for developpers.
|
||||
|
||||
* lib/res.c: fix double free bugs.
|
||||
|
||||
* lib/checker.c, include/idn/checker.h: for symbols of the checker
|
||||
module, use `idn_' prefix instead of `idn__' by default.
|
||||
|
||||
* wsock/common/checkdll.c, wsock/common/convert.c,
|
||||
wsock/common/dump.c, wsock/common/encoding.c, wsock/common/hook.c,
|
||||
wsock/common/printf.c, wsock/common/make.wnt,
|
||||
wsock/wsock11/dlldef.h, wsock/wsock11/dllfunc.c,
|
||||
wsock/wsock11/dllload.c , wsock/wsock11/dllmain.c,
|
||||
wsock/wsock11/dllstub.c, wsock/wsock11/make.wnt,
|
||||
wsock/wsock20/dlldef.h, wsock/wsock20/dllfunc.c,
|
||||
wsock/wsock20/dllload.c , wsock/wsock20/dllmain.c,
|
||||
wsock/wsock20/dllstub.c, wsock/wsock20/make.wnt: adapt idnkit
|
||||
interface, change name from `mDN Wrapper' to `idn wrapper'.
|
||||
* wsock/common/wrapcommon.h: created.
|
||||
* wsock/config/idnconf.tcl: created.
|
||||
|
||||
2002-05-01
|
||||
* include/idn/util.h, lib/converter.c, lib/resonf.c, lib/util.c:
|
||||
Move alias information initialization scheme from the resconf
|
||||
context initialization to the converter module initialization.
|
||||
|
||||
* tools/idnconv/idnconv.c: fix a bug in main().
|
||||
Wrong localconverer/idnconverter may be set to resconf2.
|
||||
|
||||
2002-04-30
|
||||
* lib/res.c, tools/idnconv/idnconv.c: accept non-ace encoding as
|
||||
idn-encoding and ace encoding as local-encoding at normal conversion.
|
||||
|
||||
2002-04-23
|
||||
* man/idn.conf.5.in: use the term "unassigned codepoint", not
|
||||
"unassigned character".
|
||||
|
||||
2002-04-19
|
||||
* include/idn/api.h, include/idn/res.h:
|
||||
delete cpp macros for backward compatibility, since they are defined
|
||||
in include/mdn/api.h and include/mdn/res.h.
|
||||
|
||||
* include/idn/checker.h, include/idn/converter.h,
|
||||
include/idn/delimitermap.h, include/idn/filechecker.h,
|
||||
include/idn/filemapper.h, include/idn/mapper.h,
|
||||
include/idn/mapselector.h, include/idn/nameprep.h,
|
||||
include/idn/normalizer.h, include/idn/unormalize.h:
|
||||
fix obsolete descriptions.
|
||||
|
||||
2002-04-17
|
||||
* idnkit 1.0beta2 release.
|
||||
|
||||
2002-04-16
|
||||
* configure.in: check AC_FIND_SYSTEM_SHOBJ(libnsl),
|
||||
AC_CHECK_LIB(socket, socket) and AC_CHECK_LIB(nsl, inet_addr)
|
||||
in case of --enable-runidn.
|
||||
|
||||
2002-04-15
|
||||
* tools/idnconv/idnconv.1: fix the "REVERSE CONVERSION MECHANISM"
|
||||
section.
|
||||
|
||||
2002-04-12
|
||||
* lib/res.c, include/idn/res.h: rename `idn_res_actionstostring()'
|
||||
to `idn__res_actionstostring()'.
|
||||
* lib/mapper.c, lib/checker.c, lib/converter.c: output trace log
|
||||
which shows scheme a name the module is going to perform.
|
||||
|
||||
2002-04-10
|
||||
* man/idn.conf.5.in: delete the "SETFILE SECTION".
|
||||
|
||||
2002-04-09
|
||||
* tools/runidn/resolver.c: call idn_nameinit() and then call
|
||||
idn_encodename() or idn_decodename().
|
||||
|
||||
2002-04-08
|
||||
* include/idn/export.h: created.
|
||||
* include/idn/Makefile.h, DISTFILES: add export.h.
|
||||
* include/idn/api.h, include/idn/converter.h, include/idn/debug.h,
|
||||
include/idn/delimitermap.h, include/idn/localencoding.h,
|
||||
include/idn/log.h, include/idn/mapper.h, include/idn/mapselector.h,
|
||||
include/idn/nameprep.h, include/idn/normalizer.h, include/idn/res.h,
|
||||
include/idn/resconf.h, include/idn/result.h, include/idn/ucs4.h,
|
||||
include/idn/ucsmap.h, include/idn/ucsset.h, include/idn/unormalize.h,
|
||||
include/idn/utf8.h, include/idn/version.h: include export.h. mark
|
||||
exportable functions with IDN_EXPORT macro.
|
||||
* lib/make.wnt: modify to create DLLs.
|
||||
* configure.in: add existance check for pwd.h.
|
||||
* configure, include/config.h.in: rebuilt.
|
||||
* lib/resconf.c, lib/localencoding.c: port to Win32.
|
||||
* include/mdn/version.h: include <idn/version.h> for the declaration
|
||||
of idn_version_getstring().
|
||||
* tools/make.wnt, tools/idnconv/make.wnt: created.
|
||||
* make.wnt: add tools subdirectory.
|
||||
* DISTFILES: add tools/make.wnt and tools/idnconv/make.wnt.
|
||||
|
||||
* include/idn/mapselector.h, lib/mapselector.c:
|
||||
add idn_mapselector_getnotld() and idn_mapselector_getdefaulttld().
|
||||
Instead delete idn_mapselector_no_tld and idn_mapselector_default.
|
||||
|
||||
* lib/api.c, include/mdn/api.h: define mdn_nameinit(),
|
||||
mdn_encodename() and mdn_decodename().
|
||||
|
||||
* DISTFILES: delete `patch/bind8/bind-8.2.3-patch' and
|
||||
`tools/rpm/mdnsproxy.init'.
|
||||
|
||||
* include/idn/aliaslist.h, include/idn/converter.h,
|
||||
lib/aliaslist.c, lib/converter.c: enable to add an alias
|
||||
information item to either top or bottom of the alias information
|
||||
list.
|
||||
|
||||
2002-04-05
|
||||
* include/idn/resconf.h, lib/resconf.c: add
|
||||
idn_resconf_setdefaults().
|
||||
* lib/resconf.c: call idn_converter_aliasfile() at parsing the
|
||||
default alias information file automatically.
|
||||
* include/idn/api.h, lib/api.c: modify api_nameinit() to enable to
|
||||
choose initialization scheme.
|
||||
|
||||
* tools/idnconv/idnconv.c, tools/idnconv/idnconv.1: delete `-map',
|
||||
`-normalize', `-prohibit' and `-unassigned' options.
|
||||
* tools/idnconv/idnconv.c: use default configuration if `-noconf'
|
||||
is specified.
|
||||
|
||||
2002-04-04
|
||||
* tools/idnconv/idnconv.1: fix obsolete description.
|
||||
* tools/runidn/runidn.1: likewise.
|
||||
|
||||
2002-04-02
|
||||
* configure.in: add --enable-mdnkit-compat option.
|
||||
* include/mdn/Makefile.in, include/mdn/api.h,
|
||||
include/mdn/localencoding.h, include/mdn/log.h, include/mdn/res.h,
|
||||
include/mdn/resconf.h, include/mdn/result.h, include/mdn/utf8.h,
|
||||
include/mdn/version.h: re-added.
|
||||
* include/Makefile.in: add `idn' to SUBDIRS.
|
||||
* lib/Makefile.in, tools/idnconv/Makefile.in, tools/runidn/Makefile.in,
|
||||
man/Makefile.in: support --enable-mdnkit-compat.
|
||||
* lib/localencoding.c, lib/resconf.c: ditto.
|
||||
* INSTALL: ditto.
|
||||
|
||||
* Makefile.in, include/Makefile.in, include/idn/Makefile.in,
|
||||
include/mdn/Makefile, lib/Makefile.in, tools/Makefile.in,
|
||||
tools/idnconv/Makefile.in, tools/runidn/Makefile.in,
|
||||
man/Makefile.in, map/Makefile.in: support DESTDIR and distclean.
|
||||
|
||||
2002-03-28
|
||||
* include/idn/api.h: enclose the contents with `extern "C" {...}'
|
||||
if C++ compiler is used.
|
||||
|
||||
2002-03-27
|
||||
* man/Makefile.in: generate and install idnrc.5.
|
||||
* man/idn.conf.5.in: describe the user configuration file ~/.idnrc.
|
||||
|
||||
* tools/idnconv/idnconv.1: add missing description of -nolengthcheck,
|
||||
-noasciicheck and -noroundtrip options.
|
||||
|
||||
* lib/checker.c, lib/mapper.c, lib/normalizer.c,
|
||||
lib/idn.conf.sample.in, tools/idnconv/idnconv.1, man/idn.conf.5.in:
|
||||
Add nameprep-08 support, and delete -05 and -07 instead.
|
||||
|
||||
2002-03-26
|
||||
* idnkit 1.0beta1 release.
|
||||
|
||||
* NEWS: add description about Major changes in mDNkit 2.3, 2.3.1,
|
||||
2.4.
|
||||
* NEWS: add description about Major changes in idnkit
|
||||
version1.0beta1.
|
||||
|
||||
2002-03-25
|
||||
* DISTFILES: add bind-8.3.1-patch and bind-9.2.0-patch.
|
||||
delete bind-9.1.3-patch.
|
||||
|
||||
2002-03-22
|
||||
* lib/mapselector.c: fix a bug in handling of the special TLD `-'.
|
||||
|
||||
2002-03-20
|
||||
* lib/converter.c: fix a bug in idn_converter_convtoucs4().
|
||||
|
||||
* lib/res.c: fix a bug that IDN_LENCHECK overlook an empty label
|
||||
generated by nameprep-map or localmap (e.g. "XXX.\u{200b}").
|
||||
* lib/res.c: fix a bug that libidnkit aborts when it decodes "."
|
||||
|
||||
* lib/Makefile.in, tools/runidn/Makefile.in: change library
|
||||
version.
|
||||
* include/idn/version.h: set version `1.0beta1'.
|
||||
|
||||
* configure, configure.in: modify some error messages.
|
||||
|
||||
2002-03-19
|
||||
* man/idn.conf.5.in, lib/idn.conf.sample.in, tools/idnconv/idnconv.1:
|
||||
delete DUDE from a list of supported encodings.
|
||||
|
||||
* lib/aliaslist.c, lib/debug.c, lib/strhash.c, lib/ucs4.c: they are
|
||||
private modules.
|
||||
|
||||
* include/idn/resolver.h: moved to tools/runidn/resolver.h.
|
||||
|
||||
* tools/runidn/Makefile.in, tools/idnconv/Makefile.in:
|
||||
insert `-I$(srcdir)' into INCS.
|
||||
|
||||
2002-03-18
|
||||
* aclocal.m4, configure, configure.in, include/config.h.in,
|
||||
Makefile.in, map/Makefile.in, src/lib/idn.conf.sample.in,
|
||||
tools/idnconv/selectiveencode.h: replace `MDN' with `IDN'.
|
||||
|
||||
* lib/aliaslist.c: change WARNING message into INFO message when
|
||||
idn_aliaslist_aliasfile() finds an error in alias information
|
||||
file.
|
||||
* lib/resconf.c: change user configuration file name.
|
||||
* lib/resconf.c: add procedure to check the existence of default
|
||||
alias information file before letting converter parse the file.
|
||||
* lib/resconf.c: call idn_converter_aliasfile() even when basic
|
||||
configuration files are not found at all.
|
||||
|
||||
* tools/idnconv/idnconv.c: use hexadecimal numbers for values
|
||||
associated with FLAGS_ macros.
|
||||
|
||||
* include/idn/result.h, lib/result.c: rename `idn_too_long' to
|
||||
`idn_invalid_length'.
|
||||
* lib/res.c: In IDN_LENCHECK, return `idn_invalid_length' for an
|
||||
empty label, but return `idn_success'' for the "." domain name.
|
||||
|
||||
* lib/converter.c: DUDE is now extra ACE.
|
||||
|
||||
* lib/mapselector.c, include/idn/mapselector.h: change types of
|
||||
`idn_mapselector_no_tld' and `idn_mapselector_default' from
|
||||
(const unsigned long []) to (const unsigned long *).
|
||||
|
||||
* DISTFILES: syncronize current source structure.
|
||||
|
||||
2002-03-14
|
||||
* configure, configure.in, include/config.h.in: add
|
||||
`--enable-runidn' option to configure script. Unless the value
|
||||
for this option is set to `yes', runidn command will not be
|
||||
complied and installed.
|
||||
|
||||
2002-03-13
|
||||
* man/libidnkit.3.in: describe new idnkit API.
|
||||
* man/idn.conf.5.in: use the term `internationalized' rather than
|
||||
`multilingual'.
|
||||
* lib/Makefile.in: create idnalias.conf.sample correctly even if
|
||||
the object directory is different from the source directory.
|
||||
|
||||
2002-03-12
|
||||
* configure, configure.in, lib/Makefile.in: add
|
||||
`--enable-liteonly' option to configure script and change
|
||||
description of lib/Makefile.in for designating compilation and
|
||||
installation of libidnkitlite alone.
|
||||
|
||||
2002-03-08
|
||||
* mDNkit is now renamed to idnkit. Also files, directories,
|
||||
commands and function names are renamed (e.g. mdnconv -> idnconv).
|
||||
|
||||
2002-03-07
|
||||
* include/mdn/nameprep.h, lib/nameprep.c, lib/resconf.c: enable
|
||||
libmdn(lite) to run without configuration file and alias file, and
|
||||
also enable to support user configuration file.
|
||||
|
||||
2002-03-05
|
||||
* include/mdn/aliaslist.h, lib/aliaslist.c: change year
|
||||
description to `2002' in copyright notice.
|
||||
* lib/aliaslist.c: fix the initialization scheme of structure's
|
||||
members at creation of both list item and list itself.
|
||||
* lib/aliaslist.c: fix the order of function free() call when
|
||||
an error occurs at list item creation.
|
||||
* make.wnt: remove descriptions related to mdnsproxy.
|
||||
|
||||
2002-03-04
|
||||
* include/mdn/aliaslist.h, include/mdn/amcacez.h, include/mdn/assert.h,
|
||||
include/mdn/checker.h, include/mdn/converter.h, include/mdn/debug.h,
|
||||
include/mdn/delimitermap.h, include/mdn/dude.h,
|
||||
include/mdn/filechecker.h, include/mdn/filemapper.h,
|
||||
include/mdn/localencoding.h, include/mdn/log.h, include/mdn/logmacro.h,
|
||||
include/mdn/mapper.h, include/mdn/mapselector.h,
|
||||
include/mdn/nameprep.h, include/mdn/normalizer.h, include/mdn/race.h,
|
||||
include/mdn/res.h, include/mdn/resconf.h, include/mdn/resolver.h,
|
||||
include/mdn/result.h, include/mdn/strhash.h, include/mdn/ucs4.h,
|
||||
include/mdn/ucsmap.h, include/mdn/ucsset.h, include/mdn/unicode.h,
|
||||
include/mdn/unormalize.h, include/mdn/utf8.h, include/mdn/util.h,
|
||||
include/mdn/version.h: enclose the contents with `extern "C" {...}'
|
||||
if C++ compiler is used.
|
||||
* DISTFILES, Makefile.in, configure, configure.in:
|
||||
remove descriptions related to mdnsproxy.
|
||||
|
||||
2002-03-01
|
||||
* include/mdn/result.h, lib/result.h: define new error code
|
||||
`mdn_too_long'.
|
||||
* lib/res.c: return `mdn_too_long' if MDN_LENCHECK is failed.
|
||||
|
|
@ -1,191 +0,0 @@
|
|||
# $Id: DISTFILES,v 1.1 2003/06/04 00:25:02 marka Exp $
|
||||
README
|
||||
README.ja
|
||||
INSTALL
|
||||
INSTALL.ja
|
||||
ChangeLog
|
||||
DISTFILES
|
||||
LICENSE.txt
|
||||
Makefile.in
|
||||
NEWS
|
||||
make.wnt
|
||||
acconfig.h
|
||||
aclocal.m4
|
||||
config.guess
|
||||
config.sub
|
||||
ltconfig
|
||||
ltmain.sh
|
||||
configure.in
|
||||
configure
|
||||
install-sh
|
||||
mkinstalldirs
|
||||
include/Makefile.in
|
||||
include/config.h.in
|
||||
include/config.h.win
|
||||
include/idn/Makefile.in
|
||||
include/idn/aliaslist.h
|
||||
include/idn/api.h
|
||||
include/idn/assert.h
|
||||
include/idn/checker.h
|
||||
include/idn/converter.h
|
||||
include/idn/debug.h
|
||||
include/idn/delimitermap.h
|
||||
include/idn/export.h
|
||||
include/idn/filechecker.h
|
||||
include/idn/filemapper.h
|
||||
include/idn/localencoding.h
|
||||
include/idn/log.h
|
||||
include/idn/logmacro.h
|
||||
include/idn/mapper.h
|
||||
include/idn/mapselector.h
|
||||
include/idn/nameprep.h
|
||||
include/idn/normalizer.h
|
||||
include/idn/punycode.h
|
||||
include/idn/race.h
|
||||
include/idn/res.h
|
||||
include/idn/resconf.h
|
||||
include/idn/result.h
|
||||
include/idn/strhash.h
|
||||
include/idn/ucs4.h
|
||||
include/idn/ucsmap.h
|
||||
include/idn/ucsset.h
|
||||
include/idn/unicode.h
|
||||
include/idn/unormalize.h
|
||||
include/idn/utf8.h
|
||||
include/idn/util.h
|
||||
include/idn/version.h
|
||||
include/mdn/Makefile.in
|
||||
include/mdn/api.h
|
||||
include/mdn/localencoding.h
|
||||
include/mdn/log.h
|
||||
include/mdn/res.h
|
||||
include/mdn/resconf.h
|
||||
include/mdn/result.h
|
||||
include/mdn/utf8.h
|
||||
include/mdn/version.h
|
||||
lib/Makefile.in
|
||||
lib/aliaslist.c
|
||||
lib/api.c
|
||||
lib/checker.c
|
||||
lib/converter.c
|
||||
lib/debug.c
|
||||
lib/delimitermap.c
|
||||
lib/filechecker.c
|
||||
lib/filemapper.c
|
||||
lib/localencoding.c
|
||||
lib/log.c
|
||||
lib/make.wnt
|
||||
lib/mapper.c
|
||||
lib/mapselector.c
|
||||
lib/nameprep.c
|
||||
lib/nameprep_template.c
|
||||
lib/nameprepdata.c
|
||||
lib/normalizer.c
|
||||
lib/punycode.c
|
||||
lib/race.c
|
||||
lib/res.c
|
||||
lib/resconf.c
|
||||
lib/result.c
|
||||
lib/strhash.c
|
||||
lib/ucs4.c
|
||||
lib/ucsmap.c
|
||||
lib/ucsset.c
|
||||
lib/unicode.c
|
||||
lib/unicode_template.c
|
||||
lib/unicodedata_320.c
|
||||
lib/unormalize.c
|
||||
lib/utf8.c
|
||||
lib/util.c
|
||||
lib/version.c
|
||||
lib/idn.conf.sample.in
|
||||
lib/aliaslist.sh
|
||||
lib/tests/Makefile.in
|
||||
lib/tests/api-init1.tsy
|
||||
lib/tests/api-init2.tsy
|
||||
lib/tests/api-init3.tsy
|
||||
lib/tests/api-init4-1.tsy
|
||||
lib/tests/api-init4-2.tsy
|
||||
lib/tests/api-init4-3.tsy
|
||||
lib/tests/api-init5-1.tsy
|
||||
lib/tests/api-init5-2.tsy
|
||||
lib/tests/api-init5-3.tsy
|
||||
lib/tests/api.tsy
|
||||
lib/tests/checker.tsy
|
||||
lib/tests/codeset.h
|
||||
lib/tests/converter.tsy
|
||||
lib/tests/delimitermap.tsy
|
||||
lib/tests/iconvchk.c
|
||||
lib/tests/mapper.tsy
|
||||
lib/tests/mapselector.tsy
|
||||
lib/tests/nameprep.tsy
|
||||
lib/tests/normalizer.tsy
|
||||
lib/tests/res.tsy
|
||||
lib/tests/resconf.tsy
|
||||
lib/tests/setenv.c
|
||||
lib/tests/setenv.h
|
||||
lib/tests/testsuite.c
|
||||
lib/tests/testsuite.h
|
||||
lib/tests/testutil.c
|
||||
lib/tests/testutil.h
|
||||
lib/tests/testygen
|
||||
lib/tests/ucs4.tsy
|
||||
lib/tests/utffilter
|
||||
tools/Makefile.in
|
||||
tools/idnconv/Makefile.in
|
||||
tools/idnconv/make.wnt
|
||||
tools/idnconv/idnconv.c
|
||||
tools/idnconv/selectiveencode.c
|
||||
tools/idnconv/selectiveencode.h
|
||||
tools/idnconv/util.c
|
||||
tools/idnconv/util.h
|
||||
tools/idnconv/idnconv.1
|
||||
tools/idnconv/idnslookup.in
|
||||
tools/make.wnt
|
||||
tools/rpm/idnkit.spec
|
||||
tools/runidn/Makefile.in
|
||||
tools/runidn/resolver.c
|
||||
tools/runidn/resolver.h
|
||||
tools/runidn/stub.c
|
||||
tools/runidn/stub.h
|
||||
tools/runidn/runidn.1
|
||||
tools/runidn/runidn.in
|
||||
man/Makefile.in
|
||||
man/libidnkit.3.in
|
||||
man/idn.conf.5.in
|
||||
patch/bind9/bind-9.2.1-patch
|
||||
patch/bind9/bind-9.2.2-patch
|
||||
win/README.WIN
|
||||
wsock/README.txt
|
||||
wsock/README_j.txt
|
||||
wsock/make.wnt
|
||||
wsock/common/checkdll.c
|
||||
wsock/common/convert.c
|
||||
wsock/common/dump.c
|
||||
wsock/common/encoding.c
|
||||
wsock/common/hook.c
|
||||
wsock/common/make.wnt
|
||||
wsock/common/printf.c
|
||||
wsock/common/wrapcommon.h
|
||||
wsock/config/make.wnt
|
||||
wsock/config/idnconf.tcl
|
||||
wsock/wsock11/dlldef.h
|
||||
wsock/wsock11/dllfunc.c
|
||||
wsock/wsock11/dllload.c
|
||||
wsock/wsock11/dllmain.c
|
||||
wsock/wsock11/dllstub.c
|
||||
wsock/wsock11/make.wnt
|
||||
wsock/wsock11/wsock32.def
|
||||
wsock/wsock20/dlldef.h
|
||||
wsock/wsock20/dllfunc.c
|
||||
wsock/wsock20/dllload.c
|
||||
wsock/wsock20/dllmain.c
|
||||
wsock/wsock20/dllstub.c
|
||||
wsock/wsock20/make.wnt
|
||||
wsock/wsock20/ws2_32.def
|
||||
util/Makefile
|
||||
util/SparseMap.pm
|
||||
util/UCD.pm
|
||||
util/generate_nameprep_data.pl
|
||||
util/generate_normalize_data.pl
|
||||
map/Makefile.in
|
||||
map/jp.map
|
||||
|
|
@ -1,309 +0,0 @@
|
|||
|
||||
idnkit
|
||||
Compilation and Installation
|
||||
Japan Network Information Center (JPNIC)
|
||||
|
||||
|
||||
This file explains how to compile and install the source package.
|
||||
These procedures take the following steps:
|
||||
|
||||
+ Prerequisite: making iconv() available
|
||||
+ System Configuration: running `configure' script
|
||||
+ Compilation: running `make'
|
||||
+ Test: running `make test' (optional)
|
||||
+ Installation: running `make install'
|
||||
+ Site Configuration: tailoring `idn.conf'
|
||||
+ Configuration Check (optional)
|
||||
+ Clean up (optional)
|
||||
|
||||
See also the following section if you'd like to apply patch and install
|
||||
BIND9.
|
||||
|
||||
+ Applying patches
|
||||
|
||||
0. Prerequisite
|
||||
|
||||
If you want to install generic idnkit library with code conversion
|
||||
support, and also if your system's library does not have iconv()
|
||||
function, which is a general codeset conversion utility, install iconv
|
||||
as an external library. You also need external library if the
|
||||
system's implementation cannot handle UTF-8 encoding, or it doesn't
|
||||
support some encodings which your client applications uses.
|
||||
|
||||
You can get a free version of iconv() implementation (under LGPL
|
||||
license, aka GNU libiconv) from:
|
||||
|
||||
ftp://ftp.gnu.org/gnu/libiconv/
|
||||
and mirrors of that site.
|
||||
|
||||
But if you don't want code conversion support and you want to install
|
||||
idnkitlite library without iconv support alone, you have not install
|
||||
external library. Instead, set `--enable-liteonly' value to "yes" at
|
||||
configure script execution.
|
||||
|
||||
|
||||
1. Running configure script
|
||||
|
||||
Run `configure' script in the top directory. This checks various
|
||||
characteristics of your system and it will create Makefiles and
|
||||
config.h appropriate for your system.
|
||||
|
||||
% ./configure
|
||||
|
||||
`configure' accepts many options. Here is a list of some important
|
||||
options.
|
||||
|
||||
--prefix=PREFIX
|
||||
Specifies the prefix of install directories of idnkit. The
|
||||
default is /usr/local.
|
||||
|
||||
--enable-runidn
|
||||
Build `runidn' command. The default is "no".
|
||||
|
||||
You cannot set this option "yes" when `--enable-liteonly' is
|
||||
also set "yes".
|
||||
|
||||
--with-libiconv=LIBICONV_PREFIX
|
||||
If you have installed GNU libiconv and would like to link it
|
||||
to idnkit, specify this option. The argument LIBICONV_PREFIX
|
||||
is install prefix of GNU libiconv. If the argument is omitted,
|
||||
PREFIX (derived from --prefix=PREFIX option) is assumed.
|
||||
|
||||
--with-libiconv is shorthand option for GNU libiconv.
|
||||
|
||||
--with-libiconv=/usr/local
|
||||
|
||||
This is equivalent to:
|
||||
|
||||
--with-iconv-include='-I/usr/local/include'
|
||||
--with-iconv='-L/usr/local/lib -R/usr/local/lib -liconv'
|
||||
|
||||
If both the shorthand option (--with-libiconv) and longhand
|
||||
options (--with-iconv-include and/or --with-iconv) are specified,
|
||||
the longhand options have priority.
|
||||
|
||||
You cannot set this option when --enable-liteonly is set
|
||||
"yes", because libidnkitlite library doesn't need iconv
|
||||
support.
|
||||
|
||||
--with-iconv-include=ICONV_INCDIR
|
||||
If the header file "iconv.h" resides in a directory where your
|
||||
C compiler doesn't search by default, specify the directory as
|
||||
DIR like this:
|
||||
|
||||
--with-iconv-include=/usr/local/include
|
||||
|
||||
You cannot set this option when `--enable-liteonly' is set
|
||||
"yes", because libidnkitlite library doesn't need iconv
|
||||
support.
|
||||
|
||||
--with-iconv=ICONV_LIB
|
||||
If your libc doesn't contain iconv(), specify the library
|
||||
that contains iconv(). For example, if iconv() is libiconv
|
||||
in /usr/local/lib, you should specify:
|
||||
|
||||
--with-iconv="-L/usr/local/lib -liconv"
|
||||
|
||||
Note that if the library is a shared one, you might also want
|
||||
to specify -R option, like:
|
||||
|
||||
--with-iconv="-L/usr/local/lib -R/usr/local/lib -liconv"
|
||||
|
||||
You cannot set this option when `--enable-liteonly' is set
|
||||
"yes", because libidnkitlite library doesn't need iconv
|
||||
support.
|
||||
|
||||
--with-iconv-sofile=SOFILE_PATH
|
||||
The runidn command in this kit needs to know the pathname of
|
||||
shared library file that contains iconv(), if iconv() is not
|
||||
part of libc. idnkit tries to find out the pathname from the
|
||||
informaiton provided by `--with-iconv' option described above.
|
||||
But when it fails, you have to specify it with this option,
|
||||
like:
|
||||
|
||||
--with-iconv-sofile=/usr/local/lib/libiconv.so.2.0
|
||||
|
||||
You cannot set this option when `--enable-liteonly' is set
|
||||
"yes", because libidnkitlite library doesn't need iconv
|
||||
support.
|
||||
|
||||
--with-utf8=UTF8_NAME
|
||||
If your iconv() (precisely, iconv_open()) does not accept
|
||||
"UTF-8" as the name of UTF-8 encoding, specify the name for
|
||||
it. For example if your iconv() uses "utf8" instead, you
|
||||
should specify:
|
||||
|
||||
--with-utf8=utf8
|
||||
|
||||
|
||||
2. Other configure options
|
||||
|
||||
The configure script has many other options though they are not widely
|
||||
used:
|
||||
|
||||
--exec-prefix=EXEC_PREFIX
|
||||
Specifies the prefix of install directories for machine-specific
|
||||
files. The default is PREFIX (derived from `--prefix=PREFIX'
|
||||
and its default is /usr/local).
|
||||
|
||||
--bindir=BINDIR
|
||||
Specifies the install directory for idnconv and runidn.
|
||||
The default is EXEC_PREFIX/bin.
|
||||
|
||||
--libdir=LIBDIR
|
||||
Specifies the install directory for the libraries (libidnkit
|
||||
and libidnkitlite). The default is EXEC_PREFIX/lib.
|
||||
|
||||
--includedir=INCDIR
|
||||
Specifies the install directory for the header files of the
|
||||
libraries. The default is PREFIX/include.
|
||||
|
||||
--sysconfdir=SYSCONFDIR
|
||||
Specifies the install directory for sample configuration files
|
||||
of the libraries. The default is PREFIX/etc.
|
||||
|
||||
--mandir=MANDIR
|
||||
Specifies the base install directory for online manuals.
|
||||
The default is PREFIX/man.
|
||||
|
||||
--datadir=DATADIR
|
||||
Specifies the base install directory for machine independent
|
||||
data files. The default is PREFIX/share. Some data files for
|
||||
idnkit will be put under the DATADIR/idnkit directory.
|
||||
|
||||
--enable-debug
|
||||
Enable debugging codes. The fault is "no".
|
||||
|
||||
--enable-shared
|
||||
Build shared library. The fault is "yes".
|
||||
|
||||
--enable-static
|
||||
Build static library. The fault is "yes".
|
||||
|
||||
--enable-liteonly
|
||||
Build the `libidnlkitite' library only. Do not build the
|
||||
`libidnkit' library, idnconv and runidn. The fault is "no".
|
||||
|
||||
If you want to set "yes" to this option, you cannot specify it
|
||||
together with `--enable-runidn', `--with-libiconv',
|
||||
`--with-iconv-include', `--with-iconv' or `--with-iconv-sofile'.
|
||||
|
||||
To see the list of available options, you should run it with --help
|
||||
option.
|
||||
|
||||
% ./configure --help
|
||||
|
||||
|
||||
3. Compiling
|
||||
|
||||
Run `make' for compilation.
|
||||
|
||||
% make
|
||||
|
||||
|
||||
4. Test
|
||||
|
||||
Optionally, type `make test' to compile and run test programs.
|
||||
Note that Perl 5 is required for comipilation of the test programs.
|
||||
|
||||
% make test
|
||||
|
||||
The test programs assume that iconv() on the system recognizes the
|
||||
encoding name "EUC-JP" as Japanese EUC, and "SJIS" as Japanese Shift
|
||||
JIS. If iconv() on the system doesn't support the encoding name,
|
||||
please edit `lib/tests/codeset.h' before `make test'.
|
||||
|
||||
*Note*
|
||||
If you use standard iconv which is attached as default on Solaris,
|
||||
converter's test "idn_converter_convfromucs4()" may fail. But it's
|
||||
not the problem because the result is derived from the difference of
|
||||
specification of iconv. So please ignore it if you run the test on
|
||||
Solaris.
|
||||
|
||||
|
||||
5. Installation
|
||||
|
||||
Run `make install' to install binaries and manuals. Don't forget to
|
||||
become a super-user before the installation.
|
||||
|
||||
% su
|
||||
# make install
|
||||
|
||||
*Note*
|
||||
If you have installed pre-release versions of idnkit (such as 1.0pr1),
|
||||
idnkit-1.0 may not work correctly because of the old configuration
|
||||
file 'idn.conf'. If this is the case, you should overwrite existing
|
||||
configuration files with the new ones by executing the following command
|
||||
after 'make install'.
|
||||
|
||||
# make install-config
|
||||
|
||||
|
||||
6. Configuration and usage
|
||||
|
||||
Edit the `idn.conf' configuation file if you'd like to cosutomize
|
||||
conversion/normalization rules of idnkit. Please refer the manual
|
||||
for `idn.conf' for details. A sample configuration (`idn.conf.sample')
|
||||
is also provided for your convenience.
|
||||
|
||||
The sample configuration file has also been installed as `idn.conf'
|
||||
if it has not exist on your system.
|
||||
|
||||
Also online manuals for `idnconv' and `runidn' commands are available.
|
||||
Please refer them for the usage and configuration of these commands.
|
||||
|
||||
% man idn.conf
|
||||
% man idnconv
|
||||
% man runidn
|
||||
|
||||
|
||||
7. Check your configuration
|
||||
|
||||
A simple shell script `idnslookup' is available in the directory
|
||||
`tools/idnconv', with which you can make queries for internationalized
|
||||
domain names. It may help you check your configuration.
|
||||
|
||||
The usage of `idnslookup' is:
|
||||
|
||||
% tools/idnconv/idnslookup <domain-name> <dns-server>
|
||||
|
||||
Suppose that <domain-name> is an internationalized domain name written
|
||||
in the local codeset (see ``LOCAL CODESET'' in the `idn.conf' man page
|
||||
for details), and <dns-server> is a hostname or IP address of DNS
|
||||
server.
|
||||
|
||||
`idnslookup' inquires <idn-domain-name> from <dns-server>, using
|
||||
`idnconv' and `nslookup' commands. If something is wrong, you will
|
||||
see an error message output by `idnconv', `nslookup' or `idnslookup'
|
||||
itself.
|
||||
|
||||
|
||||
8. Clean up
|
||||
|
||||
Run `make clean' to delete files generated by `make' and `make test'
|
||||
from the idnkit source directory. (Files installed by `make install'
|
||||
are not removed.)
|
||||
|
||||
% make clean
|
||||
|
||||
Run `make distclean' instead to also delete files generated by
|
||||
`configure'.
|
||||
|
||||
% make distclean
|
||||
|
||||
After `make distclean', you can run `configure' and compile idnkit for
|
||||
another system using the source directory.
|
||||
|
||||
|
||||
Appendix A. Applying patches
|
||||
|
||||
This distribution also contains patches for BIND9.
|
||||
The top of these patch files describe how to apply the patch and
|
||||
(re)install.
|
||||
|
||||
Note that on Solaris, "patch" command that comes with the system
|
||||
sometimes doesn't work correctly. You may want to install the GNU
|
||||
version of the command (http://www.gnu.org/software/patch/) and use
|
||||
it.
|
||||
|
||||
; $Id: INSTALL,v 1.1 2003/06/04 00:24:59 marka Exp $
|
||||
|
|
@ -1,310 +0,0 @@
|
|||
|
||||
idnkit
|
||||
$B%3%s%Q%$%k$H%$%s%9%H!<%k$NJ}K!(B
|
||||
($B<R(B) $BF|K\%M%C%H%o!<%/%$%s%U%)%a!<%7%g%s%;%s%?!<(B (JPNIC)
|
||||
|
||||
|
||||
$BK\%Q%C%1!<%8$N%3%s%Q%$%k$*$h$S%$%s%9%H!<%k$O!"<!$N$h$&$J%9%F%C%W$G9T(B
|
||||
$B$$$^$9!#(B
|
||||
|
||||
+ $BA0=`Hw(B: iconv() $B$,MxMQ$G$-$k$h$&$K$9$k(B
|
||||
+ $B%7%9%F%`@_Dj(B: `configure' $B%9%/%j%W%H$N<B9T(B
|
||||
+ $B%3%s%Q%$%k(B: `make' $B$N<B9T(B
|
||||
+ $B%F%9%H(B: `make test' $B$N<B9T(B ($B>JN,2D(B)
|
||||
+ $B%$%s%9%H!<%k(B: `make install' $B$N<B9T(B
|
||||
+ $B%5%$%HKh$N@_Dj(B: `idn.conf' $B$K$h$k@_Dj(B
|
||||
+ $B@_Dj$N3NG'(B ($B>JN,2D(B)
|
||||
+ $B8eJRIU$1(B ($B>JN,2D(B)
|
||||
|
||||
BIND9 $B$K%Q%C%A$rEv$F$F%$%s%9%H!<%k$7$?$$>l9g$O!"<!$N9`$b;2>H$7$F2<$5$$!#(B
|
||||
|
||||
+ $B%Q%C%A$NEv$FJ}(B
|
||||
|
||||
0. $BA0=`Hw(B
|
||||
|
||||
$B$b$7$"$J$?$,%3!<%IJQ495!G=$r%5%]!<%H$7$?DL>o$N(B idnkit $B%i%$%V%i%j$r%$%s%9(B
|
||||
$B%H!<%k$9$k$D$b$j$G$"$j!"$^$?$"$J$?$,;HMQ$7$F$$$k%7%9%F%`$N%i%$%V%i%j$K(B
|
||||
iconv() $B$,$J$$>l9g!"$"$k$$$O$"$C$F$b(B UTF-8 $B$r07$&$3$H$,$G$-$J$$>l9g$K$O(B
|
||||
$B$"$i$+$8$a(B iconv() $B$r%$%s%9%H!<%k$7$F$*$$$F$/$@$5$$!#(Biconv() $B$O!"Nc$($P(B
|
||||
GNU libiconv $B$H8F$P$l$k%U%j!<(B (LGPL) $B$N<BAu$,(B
|
||||
|
||||
ftp://ftp.gnu.org/gnu/libiconv/
|
||||
$B$^$?$O$=$N%_%i!<%5%$%H(B
|
||||
|
||||
$B$+$iF~<j2DG=$G$9!#(B
|
||||
|
||||
$B$?$@$7!"%3!<%IJQ49$rI,MW$H$;$:!"(Blite $B%P!<%8%g%s$N%i%$%V%i%j$N$_$r%$%s%9(B
|
||||
$B%H!<%k$9$k$N$G$"$l$P!"(Biconv() $B$r4^$`%i%$%V%i%j$OI,MW$"$j$^$;$s!#$=$N>l9g!"(B
|
||||
configure $B%9%/%j%W%H$N<B9T;~$K(B `--enable-liteonly' $B%*%W%7%g%s$NCM$r(B
|
||||
"yes" $B$K%;%C%H$7$F$/$@$5$$!#(B
|
||||
|
||||
|
||||
1. configure $B%9%/%j%W%H$N<B9T(B
|
||||
|
||||
$B%H%C%W%G%#%l%/%H%j$K$"$k(B configure $B%9%/%j%W%H$r<B9T$7$F$/$@$5$$!#(B
|
||||
|
||||
% ./configure
|
||||
|
||||
configure $B%9%/%j%W%H$K$O!"?tB?$/$N%*%W%7%g%s$,MQ0U$5$l$F$$$^$9!#$=$N$&(B
|
||||
$B$A=EMW$H;W$o$l$k$b$N$O<!$NDL$j$G$9!#(B
|
||||
|
||||
--prefix=PREFIX
|
||||
idnkit $B$r%$%s%9%H!<%k$9$k%G%#%l%/%H%j$N%Q%9$r;XDj$7$^$9!#%G%U%)(B
|
||||
$B%k%H$O(B /usr/local $B$G$9!#(B
|
||||
|
||||
--enable-runidn
|
||||
runidn $B%3%^%s%I$r:n@.$7$F!"%$%s%9%H!<%k$7$^$9!#%G%U%)%k%H$O(B "no"
|
||||
($B:n@.$7$J$$(B) $B$G$9!#(B
|
||||
|
||||
--with-libiconv=LIBICONV_PREFIX
|
||||
$B%$%s%9%H!<%k:Q$_$N(B GNU libiconv $B$r(B idnkit $B$K%j%s%/$5$;$k>l9g$O!"(B
|
||||
$B$3$N%*%W%7%g%s$r;XDj$7$F2<$5$$!#0z?t(B LIBICONV_PREFIX $B$K$O!"(BGNU
|
||||
libiconv $B$,%$%s%9%H!<%k$5$l$F$$$k0LCV$r;XDj$7$^$9!#0z?t$r>JN,(B
|
||||
$B$9$k$H!"(BPREFIX (PREFIX $B$NCM$O(B --prefix=PREFIX $B$+$iF3=P$5$l$^$9(B)
|
||||
$B$r;XDj$7$?$b$N$H8+$J$5$l$^$9!#(B
|
||||
|
||||
--with-libiconv $B$O(B GNU libiconv $BMQ$NC;=L7A$N%*%W%7%g%s$G(B
|
||||
|
||||
--with-libiconv=/usr/local
|
||||
|
||||
$B$3$l$O<!$HEy2A$K$J$j$^$9!#(B
|
||||
|
||||
--with-iconv-include='-I/usr/local/include'
|
||||
--with-iconv='-L/usr/local/lib -R/usr/local/lib -liconv'
|
||||
|
||||
$BC;=L7A$N%*%W%7%g%s(B (--with-libiconv) $B$HDL>oMQ$N%*%W%7%g%s(B
|
||||
(--with-iconv-include, --with-iconv) $B$rN>J}$H$b;XDj$7$?>l9g$O!"(B
|
||||
$BDL>oMQ$N%*%W%7%g%s$[$&$,M%@h$5$l$^$9!#(B
|
||||
|
||||
$B$3$N%*%W%7%g%s$O(B --enable-liteonly $B$r(B "yes" $B$K$7$?>l9g$O;XDj$9$k(B
|
||||
$B$3$H$O$G$-$^$;$s!#$3$l$O!"(Blibidnkitlite $B%i%$%V%i%j$,(B iconv $B%5%]!<(B
|
||||
$B%H$rI,MW$H$7$J$$$?$a$G$9!#(B
|
||||
|
||||
--with-iconv-include=ICONV_INCDIR
|
||||
C $B%3%s%Q%$%i$,DL>o$G$O8!:w$7$J$$%G%#%l%/%H%j$K(B "iconv.h" $B$,CV(B
|
||||
$B$+$l$F$$$k>l9g!"<!$N$h$&$K$7$F$=$N%G%#%l%/%H%j$r;XDj$7$^$9!#(B
|
||||
|
||||
--with-iconv-include=/usr/local/include
|
||||
|
||||
$B$3$N%*%W%7%g%s$O(B --enable-liteonly $B$r(B "yes" $B$K$7$?>l9g$O;XDj$9$k(B
|
||||
$B$3$H$O$G$-$^$;$s!#$3$l$O!"(Blibidnkitlite $B%i%$%V%i%j$,(B iconv $B%5%]!<(B
|
||||
$B%H$rI,MW$H$7$J$$$?$a$G$9!#(B
|
||||
|
||||
--with-iconv=ICONV_LIB
|
||||
libc $B$K(B iconv $B$,F~$C$F$$$J$$>l9g(B ($B>e5-$N%Q%C%1!<%8$rF~$l$?(B
|
||||
$B>l9g$J$I(B) $B$K!"(Biconv $B$N%i%$%V%i%j$r;XDj$7$^$9!#Nc$($P(B
|
||||
|
||||
--with-iconv="-L/usr/local/lib -liconv"
|
||||
|
||||
$B$N$h$&$K;XDj$7$^$9!#$b$7(B iconv $B$,6&M-%i%$%V%i%j$K$J$C$F$$$k(B
|
||||
$B>l9g$K$O!"(B-R $B%*%W%7%g%s$b;XDj$7$F(B
|
||||
|
||||
--with-iconv="-L/usr/local/lib -R/usr/local/lib -liconv"
|
||||
|
||||
$B$H$9$kI,MW$,$"$k$+$b$7$l$^$;$s!#(B
|
||||
|
||||
$B$3$N%*%W%7%g%s$O(B --enable-liteonly $B$r(B "yes" $B$K$7$?>l9g$O;XDj$9$k(B
|
||||
$B$3$H$O$G$-$^$;$s!#$3$l$O!"(Blibidnkitlite $B%i%$%V%i%j$,(B iconv $B%5%]!<(B
|
||||
$B%H$rI,MW$H$7$J$$$?$a$G$9!#(B
|
||||
|
||||
--with-iconv-sofile=SOFILE_PATH
|
||||
idnkit $B$K4^$^$l$F$$$k(B runidn $B%3%^%s%I$O!"(Biconv() $B$,(B libc $B$N0l(B
|
||||
$BIt$H$7$FDs6!$5$l$J$$$H$-$K!"(Biconv() $B$r4^$`6&M-%i%$%V%i%j$X$N%Q(B
|
||||
$B%9L>$rCN$kI,MW$,$"$j$^$9!#(Bidnkit $B$O!"(B--with-iconv $B%*%W%7%g%s$N(B
|
||||
$B5-=R$r4p$K%Q%9L>$r8!:w$7$^$9$,!"$3$l$K<:GT$7$?$H$-$K!"0J2<$N$h(B
|
||||
$B$&$K6&M-%i%$%V%i%j$r;XDj$9$k$3$H$,$G$-$^$9!#(B
|
||||
|
||||
--with-iconv-sofile=/usr/local/lib/libiconv.so.2.0
|
||||
|
||||
$B$3$N%*%W%7%g%s$O(B --enable-liteonly $B$r(B "yes" $B$K$7$?>l9g$O;XDj$9$k(B
|
||||
$B$3$H$O$G$-$^$;$s!#$3$l$O!"(Blibidnkitlite $B%i%$%V%i%j$,(B iconv $B%5%]!<(B
|
||||
$B%H$rI,MW$H$7$J$$$?$a$G$9!#(B
|
||||
|
||||
--with-utf8=UTF8_NAME
|
||||
iconv $B$K(B utf-8 $B%(%s%3!<%G%#%s%0$r;XDj$9$k>l9g!"K\%i%$%V%i%j$O(B
|
||||
$B%G%U%)%k%H$G$O(B "UTF-8" $B$H$$$&L>A0$r;XDj$7$^$9!#$b$7$"$J$?$N(B
|
||||
$B%7%9%F%`$N(B iconv $B$,(B "UTF-8" $B$H$$$&L>A0$r<u$1IU$1$J$$>l9g$K$O!"(B
|
||||
$BBe$j$NL>A0$r;XDj$7$^$9!#Nc$($P(B "UTF-8" $B$G$O$J$/(B "utf8" $B$N(B
|
||||
$B>l9g$K$O<!$N$h$&$K;XDj$7$^$9!#(B
|
||||
|
||||
--with-utf8=utf8
|
||||
|
||||
|
||||
2. $B$=$NB>$N(B configure $B$N%*%W%7%g%s(B
|
||||
|
||||
$B$=$l$[$I$h$/;H$&$o$1$G$O$"$j$^$;$s$,!"(Bconfigure $B$K$OA09`$N$b$N0J30$K(B
|
||||
$B$bMM!9$J%*%W%7%g%s$,MQ0U$5$l$F$$$^$9!#(B
|
||||
|
||||
--exec-prefix=EXEC_PREFIX
|
||||
$B%^%7%s8GM-$N%U%!%$%k$r%$%s%9%H!<%k$9$k%G%#%l%/%H%j$N%Q%9$r;XDj(B
|
||||
$B$7$^$9!#%G%U%)%k%H$O(B PREFIX (``--prefix=PREFIX'' $B$K$h$C$F;XDj(B
|
||||
$B2DG=!"(BPREFIX $B$N%G%U%)%k%H$O(B /usr/local) $B$K$J$j$^$9!#(B
|
||||
|
||||
--bindir=BINDIR
|
||||
idnconv $B$H(B runidn $B$r%$%s%9%H!<%k$9$k%G%#%l%/%H%j$r;XDj$7$^$9!#(B
|
||||
$B%G%U%)%k%H$G$O(B EXEC_PREFIX/bin $B$G$9!#(B
|
||||
|
||||
--libdir=LIBDIR
|
||||
$B%i%$%V%i%j(B (libidnkit $B$*$h$S(B libidnkitlite) $B$r%$%s%9%H!<%k$9$k(B
|
||||
$B%G%#%l%/%H%j$r;XDj$7$^$9!#%G%U%)%k%H$G$O(B EXEC_PREFIX/lib $B$G$9!#(B
|
||||
|
||||
--includedir=INCDIR
|
||||
$B%i%$%V%i%j$N%X%C%@%U%!%$%k$r%$%s%9%H!<%k$9$k%G%#%l%/%H%j$r;XDj(B
|
||||
$B$7$^$9!#%G%U%)%k%H$G$O(B PREFIX/include $B$G$9!#(B
|
||||
|
||||
--sysconfdir=SYSCONFDIR
|
||||
$B%i%$%V%i%j$N@_Dj%U%!%$%k$N%5%s%W%k$r%$%s%9%H!<%k$9$k%G%#%l%/%H(B
|
||||
$B%j$r;XDj$7$^$9!#%G%U%)%k%H$G$O(B PREFIX/etc $B$G$9!#(B
|
||||
|
||||
--mandir=MANDIR
|
||||
$B%*%s%i%$%s%^%K%e%"%k$N%$%s%9%H!<%k%G%#%l%/%H%j$r;XDj$7$^$9!#(B
|
||||
$B%G%U%)%k%H$G$O(B PREFIX/man $B$G$9!#(B
|
||||
|
||||
--datadir=DATADIR
|
||||
$B0[$J$k%^%7%s$G6&M-2DG=$J%U%!%$%k$r%$%s%9%H!<%k$9$k%G%#%l%/%H%j(B
|
||||
$B$r;XDj$7$^$9!#%G%U%)%k%H$O(B PREFIX/share $B$G$9!#(BDATADIR/idnkit
|
||||
$B$N2<$K!"(Bidnkit $B$G;HMQ$9$k4v$D$+$N%G!<%?%U%!%$%k$,%$%s%9%H!<%k(B
|
||||
$B$5$l$^$9!#(B
|
||||
|
||||
--enable-debug
|
||||
$B%G%P%C%0MQ$N%3!<%I$rM-8z$K$7$^$9!#%G%U%)%k%H$O(B "no" ($BL58z(B) $B$G$9!#(B
|
||||
|
||||
--enable-shared
|
||||
$B6&M-%i%$%V%i%j$r:n@.$7$^$9!#%G%U%)%k%H$O(B "yes" ($B:n@.$9$k(B) $B$G$9!#(B
|
||||
|
||||
--enable-static
|
||||
$B@EE*%i%$%V%i%j$r:n@.$7$^$9!#%G%U%)%k%H$O(B "yes" ($B:n@.$9$k(B) $B$G$9!#(B
|
||||
|
||||
--enable-liteonly
|
||||
libidnkitlite $B%i%$%V%i%j$N$_$r:n@.$7$^$9!#(Blibidnkit $B%i%$%V%i%j!"(B
|
||||
idnconv, runidn $B$O:n@.$7$^$;$s!#%G%U%)%k%H$O(B "no" ($B$=$l0J30$N(B
|
||||
$B$b$N$b:n@.$9$k(B) $B$G$9!#(B
|
||||
|
||||
$B$3$N%*%W%7%g%s$NCM$r(B "yes" $B$K$9$k>l9g!"(B `--enable-runidn'
|
||||
`--with-libiconv' `--with-iconv-include' `--with-iconv'
|
||||
`--with-iconv-sofile' $B$OF1;~$K;XDj$9$k$3$H$O$G$-$^$;$s!#(B
|
||||
|
||||
configure $B$K$OB>$K$bB?$/$N%*%W%7%g%s$,$"$j$^$9$,!";D$j$O0lHLE*$J%*%W%7%g(B
|
||||
$B%s$J$N$G@bL@$O>J$-$^$9!#(B
|
||||
|
||||
% ./configure --help
|
||||
|
||||
$B$r<B9T$9$k$H%*%W%7%g%s$N0lMw$,I=<($5$l$^$9!#(B
|
||||
|
||||
|
||||
3. $B%3%s%Q%$%k(B
|
||||
|
||||
configure $B$r<B9T$9$k$H(B Makefile $B$J$I$,@8@.$5$l$^$9$N$G!"B3$1$F(B make$B$r(B
|
||||
$B<B9T$7$F%3%s%Q%$%k$7$^$9!#(B
|
||||
|
||||
% make
|
||||
|
||||
|
||||
4. $B%F%9%H(B
|
||||
|
||||
$B%F%9%H%W%m%0%i%`$r%3%s%Q%$%k$7!"<B9T$9$k$K$O(B `make test' $B$r<B9T$7$^$9(B
|
||||
($B>JN,$7$F$b9=$$$^$;$s(B)$B!#%F%9%H%W%m%0%i%`$N%3%s%Q%$%k$K$O!"(BPerl 5 $B$,I,(B
|
||||
$BMW$G$9!#(B
|
||||
|
||||
% make test
|
||||
|
||||
$B$J$*!"(Biconv() $B$,(B "EUC-JP" $B$rF|K\8l(B EUC $B$N%(%s%3!<%G%#%s%0L>>N$H$7$FG'(B
|
||||
$B<1$7!"(B"SJIS" $B$rF|K\8l%7%U%H(B JIS $B$N%(%s%3!<%G%#%s%0L>>N$H$7$FG'<1$9$k$3(B
|
||||
$B$H$r!"%F%9%H%W%m%0%i%`$G$OA0Ds$H$7$F$$$^$9!#$b$7!"G'<1$7$J$$$h$&$G$"$l(B
|
||||
$B$P!"(B`make test' $B<B9TA0$K(B `lib/tests/codeset.h' $B$rJT=8$7$F2<$5$$!#(B
|
||||
|
||||
*$BCm0U(B*
|
||||
Solaris $B$K$*$$$F(B OS $BI8=`$N(B iconv $B$r;HMQ$7$F$$$k>l9g!"(Bconverter $B$N(B
|
||||
idn_converter_convfromucs4() $B$N%F%9%H$,<:GT$9$k$3$H$,$"$j$^$9!#$3$l(B
|
||||
$B$O(B iconv $B$N;EMM$N0c$$$K$h$k$b$N$J$N$G!">e5-4D6-$K$*$$$F%$%s%9%H!<%k(B
|
||||
$B$r9T$C$F$$$k>l9g$OL5;k$7$F$/$@$5$$!#(B
|
||||
|
||||
|
||||
5. $B%$%s%9%H!<%k(B
|
||||
|
||||
$B%9!<%Q%f!<%6$K$J$C$F%$%s%9%H!<%k$7$^$9!#(B
|
||||
|
||||
% su
|
||||
# make install
|
||||
|
||||
*$BCm0U(B*
|
||||
idnkit $B$N(B 1.0 $B0JA0$N%P!<%8%g%s(B (1.0pr1 $B$J$I(B) $B$,$9$G$K%$%s%9%H!<%k$5(B
|
||||
$B$l$F$$$k>l9g!"%$%s%9%H!<%k$5$l$?@_Dj%U%!%$%k(B 'idn.conf' $B$NFbMF$,8E$$(B
|
||||
$B$?$a!"(Bidnkit-1.0$B$,@5$7$/F0:n$7$^$;$s!#$3$N$?$a!"(Bidnkit-1.0 $BMQ$N@_Dj(B
|
||||
$B%U%!%$%k$r>e=q$-%$%s%9%H!<%k$9$kI,MW$,$"$j$^$9!#(Bmake install $B<B9T8e!"(B
|
||||
$B0J2<$N%3%^%s%I$r<B9T$7$F$/$@$5$$!#(B
|
||||
|
||||
# make install-config
|
||||
|
||||
|
||||
6. $B@_Dj$H;HMQJ}K!(B
|
||||
|
||||
idnkit $B$N@55,2=$*$h$SJQ495,B'$r%+%9%?%^%$%:$7$9$k$J$i!"@_Dj%U%!%$%k(B
|
||||
`idn.conf' $B$rJT=8$7$^$9!#$3$N@_Dj%U%!%$%k$N>\:Y$K$D$$$F$O(B idn.conf $B$N(B
|
||||
$B%*%s%i%$%s%^%K%e%"%k$r$4Mw$/$@$5$$!#$^$?@_DjNc$,=q$+$l$?%5%s%W%k%U%!%$(B
|
||||
$B%k(B (idn.conf.sample) $B$b%$%s%9%H!<%k$5$l$^$9$N$G$4MxMQ$/$@$5$$!#(B
|
||||
|
||||
$B%7%9%F%`$K@_Dj%U%!%$%k$,B8:_$7$J$+$C$?>l9g!"$3$N%5%s%W%k$N@_Dj%U%!%$%k(B
|
||||
$B$O(B `idn.conf' $B$H$7$F$b%$%s%9%H!<%k$5$l$^$9!#(B
|
||||
|
||||
$B$^$?!"(Bidnconv$B!"(Brunidn $B$H$$$C$?%D!<%k$N%*%s%i%$%s%^%K%e%"%k$bDs6!$5$l$F(B
|
||||
$B$$$^$9!#$3$l$i$N%3%^%s%I$N;H$$J}!"@_DjJ}K!$K4X$7$F$O$=$A$i$r;2>H$7$F$/(B
|
||||
$B$@$5$$!#(B
|
||||
|
||||
% man idn.conf
|
||||
% man idnconv
|
||||
% man runidn
|
||||
|
||||
|
||||
7. $B@_Dj$N3NG'(B
|
||||
|
||||
`idnslookup' $B$H$$$&4JC1$J%7%'%k%9%/%j%W%H$,(B tools/idnconv $B%G%#%l%/%H%j(B
|
||||
$B$KMQ0U$5$l$F$$$^$9!#$3$N%9%/%j%W%H$r;H$&$H(B DNS $B%5!<%P$KBP$7$F9q:]2=%I(B
|
||||
$B%a%$%sL>$rLd$$9g$o$;$k$3$H$,$G$-$^$9!#@_Dj%U%!%$%k$N3NG'$KLrN)$D$+$bCN(B
|
||||
$B$l$^$;$s!#(B
|
||||
|
||||
`idnslookup' $B$N;HMQJ}K!$O!"<!$NDL$j$G$9!#(B
|
||||
|
||||
% tools/idnconv/idnslookup <domain-name> <dns-server>
|
||||
|
||||
$B$3$3$G(B <domain-name> $B$O%m!<%+%k%3!<%I%;%C%H(B ($B>\$7$/$O(B idn.conf $B$N%^%K%e(B
|
||||
$B%"%k$N(B ``LOCAL CODESET'' $B$r;2>H$N$3$H(B) $B$G=q$+$l$?9q:]2=%I%a%$%sL>$G!"(B
|
||||
<dns-server> $B$O(B DNS $B%5!<%P$N%[%9%HL>$b$7$/$O(B IP $B%"%I%l%9$G$9!#(B
|
||||
|
||||
`idnslookup' $B$O(B `idnconv' $B$*$h$S(B `nslookup' $B%3%^%s%I$rMQ$$$F!"(B
|
||||
<dns-server> $B$KBP$7$F(B <domain-name> $B$r0z$-$K9T$-$^$9!#@_Dj$K2?$+4V0c$$(B
|
||||
$B$,$"$l$P!"(B`idnconv', `nslookup', $B$"$k$$$O(B `idnslookup' $B<+?H$K$h$k%(%i!<(B
|
||||
$B%a%C%;!<%8$,=PNO$5$l$^$9!#(B
|
||||
|
||||
|
||||
8. $B8eJRIU$1(B
|
||||
|
||||
`make' $B$*$h$S(B `make test' $B$K$h$C$F@8@.$5$l$?%U%!%$%k$r(B idnkit $B$N%=!<(B
|
||||
$B%9%G%#%l%/%H%j$+$i:o=|$9$k$K$O!"(B`make clean' $B$r<B9T$7$F2<$5$$!#(B
|
||||
(`make install' $B$N:]$K%$%s%9%H!<%k$5$l$?%U%!%$%k$O!":o=|$5$l$^$;$s!#(B)
|
||||
|
||||
% make clean
|
||||
|
||||
`configure' $B$G@8@.$5$l$?%U%!%$%k$b0l=o$K:o=|$9$k$J$i!"Be$o$j$K(B `make
|
||||
distclean' $B$r<B9T$7$^$9!#(B
|
||||
|
||||
% make distclean
|
||||
|
||||
`make distclean' $B$r9T$($P!"$3$N%=!<%9%G%#%l%/%H%j$r;H$C$F!"A02s$H$OJL(B
|
||||
$B$N%7%9%F%`8~$1$K(B `configure' $B$*$h$S(B idnkit $B$N%3%s%Q%$%k$r9T$&$3$H$,$G(B
|
||||
$B$-$k$h$&$K$J$j$^$9!#(B
|
||||
|
||||
|
||||
$BIUO?(B A. $B%Q%C%A$NEv$FJ}(B
|
||||
|
||||
$B$3$NG[I[%-%C%H$K$O!"(BBIND9 $B$KBP$9$k%Q%C%A$,4^$^$l$F$$$^$9!#(B
|
||||
$B%Q%C%A$NEv$FJ}$O!"%Q%C%A%U%!%$%k$N@hF,$K=q$+$l$F$$$^$9$N$G$=$A$i$r;2>H(B
|
||||
$B$7$F$/$@$5$$!#(B
|
||||
|
||||
Solaris $B$G$O!"%7%9%F%`IUB0$N(B patch $B%3%^%s%I$,@5>o$KF0:n$7$J$$$3$H$,$"(B
|
||||
$B$j$^$9!#$=$N$h$&$J>l9g$K$O!"(BGNU $B%P!<%8%g%s$N(B patch
|
||||
(http://www.gnu.org/software/patch/) $B$r%$%s%9%H!<%k$7$F!"$3$l$r;HMQ$7(B
|
||||
$B$F$/$@$5$$!#(B
|
||||
|
||||
|
||||
; $Id: INSTALL.ja,v 1.1 2003/06/04 00:25:00 marka Exp $
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved.
|
||||
|
||||
By using this file, you agree to the terms and conditions set forth bellow.
|
||||
|
||||
LICENSE TERMS AND CONDITIONS
|
||||
|
||||
The following License Terms and Conditions apply, unless a different
|
||||
license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
|
||||
1. Use, Modification and Redistribution (including distribution of any
|
||||
modified or derived work) in source and/or binary forms is permitted
|
||||
under this License Terms and Conditions.
|
||||
|
||||
2. Redistribution of source code must retain the copyright notices as they
|
||||
appear in each source code file, this License Terms and Conditions.
|
||||
|
||||
3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
this License Terms and Conditions, in the documentation and/or other
|
||||
materials provided with the distribution. For the purposes of binary
|
||||
distribution the "Copyright Notice" refers to the following language:
|
||||
"Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
|
||||
4. The name of JPNIC may not be used to endorse or promote products
|
||||
derived from this Software without specific prior written approval of
|
||||
JPNIC.
|
||||
|
||||
5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
# $Id: Makefile.in,v 1.1 2003/06/04 00:25:03 marka Exp $
|
||||
# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
|
||||
#
|
||||
# By using this file, you agree to the terms and conditions set forth bellow.
|
||||
#
|
||||
# LICENSE TERMS AND CONDITIONS
|
||||
#
|
||||
# The following License Terms and Conditions apply, unless a different
|
||||
# license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
# Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
#
|
||||
# 1. Use, Modification and Redistribution (including distribution of any
|
||||
# modified or derived work) in source and/or binary forms is permitted
|
||||
# under this License Terms and Conditions.
|
||||
#
|
||||
# 2. Redistribution of source code must retain the copyright notices as they
|
||||
# appear in each source code file, this License Terms and Conditions.
|
||||
#
|
||||
# 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
# this License Terms and Conditions, in the documentation and/or other
|
||||
# materials provided with the distribution. For the purposes of binary
|
||||
# distribution the "Copyright Notice" refers to the following language:
|
||||
# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
#
|
||||
# 4. The name of JPNIC may not be used to endorse or promote products
|
||||
# derived from this Software without specific prior written approval of
|
||||
# JPNIC.
|
||||
#
|
||||
# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
PERL = perl
|
||||
MKTARPKG = ../util/mktarpkg
|
||||
SHELL = @SHELL@
|
||||
|
||||
SUBDIRS = include lib man tools map
|
||||
|
||||
all: force all-subdirs
|
||||
test check: force test-subdirs
|
||||
install: force install-subdirs
|
||||
clean: force clean-subdirs
|
||||
distclean: force distclean-localdir distclean-subdirs
|
||||
|
||||
distclean-localdir:
|
||||
rm -f config.status config.cache config.log libtool Makefile
|
||||
|
||||
all-subdirs install-subdirs clean-subdirs distclean-subdirs test-subdirs:
|
||||
@target=`echo $@ | sed 's/-subdirs$$//'`; \
|
||||
for d in $(SUBDIRS); do \
|
||||
(cd $$d; $(MAKE) DESTDIR=$(DESTDIR) $$target); \
|
||||
done
|
||||
|
||||
install-config:
|
||||
(cd lib; $(MAKE) install-config);
|
||||
|
||||
dist: force
|
||||
@v=`sed -ne '/^# *define *IDNKIT_VERSION/s/^.*"\([^"]*\)".*$$/\1/p' \
|
||||
$(srcdir)/include/idn/version.h`; \
|
||||
echo generate idnkit-$$v-src.tar.gz; \
|
||||
cd $(srcdir); \
|
||||
$(PERL) $(MKTARPKG) --gzip=9 idnkit-$$v-src
|
||||
|
||||
force:
|
||||
|
|
@ -1,186 +0,0 @@
|
|||
; $Id: NEWS,v 1.1 2003/06/04 00:25:03 marka Exp $
|
||||
|
||||
Major changes in idnkit version 1.0:
|
||||
|
||||
* Change ACE prefix of Punycode from 'zq--' to 'xn--'. And delete
|
||||
configure's --with-punycode-prefix option.
|
||||
|
||||
* Add NAMEPREP version RFC3491. Other versions of NAMEPREP are
|
||||
removed.
|
||||
|
||||
* Enable idnconv to handle a input line as long as memory permitted
|
||||
when encoding/decoding.
|
||||
|
||||
* unicode-form-c and unicode-form-c/3.2.0 are not supported.
|
||||
|
||||
* Unicode 3.0.1 and Unicode 3.1.0 are not supported.
|
||||
|
||||
* Delete BIND8, Squid and GNU libiconv patches.
|
||||
|
||||
Major changes in idnkit version 1.0-pr2:
|
||||
|
||||
* The license of idnkit is changed to a less restrictive one. See
|
||||
LICENSE.txt for the new license.
|
||||
|
||||
* The local codeset name used in the test suite, which is hard-coded
|
||||
in the previous version, can be specified by a separate header file.
|
||||
|
||||
* IDN encoding and decoding now always check the validity of the
|
||||
result by performing roundtrip conversion check.
|
||||
|
||||
Major changes in idnkit version 1.0-pr1:
|
||||
|
||||
* Some test cases are added to the testsuite.
|
||||
|
||||
* The testsuite can run on OpenBSD.
|
||||
|
||||
Major changes in idnkit version 020829:
|
||||
|
||||
* Testsuit is added for the library behavior check.
|
||||
Testsuit and testcases are in lib/tests. Read INSTALL (INSTALL.ja)
|
||||
for details. Tests aim at api, checker, converter, delimitermap,
|
||||
mapper, mapselecter, normalizer, res, resconf, and ucs4 at the
|
||||
moment.
|
||||
|
||||
* "amcacez" module is renamed to "punycode".
|
||||
|
||||
* AMC-ACE-Z and RACE are now treated as extra ACE.
|
||||
|
||||
* Add "--with-utf8=NAME" option to configure script.
|
||||
|
||||
Major changes in idnkit version 020730:
|
||||
|
||||
* Complete bidi check support for NAMEPREP draft -11.
|
||||
|
||||
* Type definitions of action flags for conversion APIs are changed
|
||||
from int to idn_action_t.
|
||||
|
||||
* Add -nobidicheck option to idnconv command.
|
||||
|
||||
Major changes in idnkit version 020711:
|
||||
|
||||
* Default delimiters are added according to IDNA-10.
|
||||
|
||||
* ``delimiter-map'' entry in config file is removed.
|
||||
|
||||
* Add Unicode version 3.2 support.
|
||||
|
||||
* Add preliminary support of NAMEPREP draft -11.
|
||||
This version supports NAMEPREP draft -11 without bidirectional label
|
||||
check.
|
||||
|
||||
* Supported NAMEPREP versions are changed.
|
||||
idnkit supports NAMEPREP draft version -03, -10, and -11. Others
|
||||
are removed.
|
||||
|
||||
* IDN encoding DUDE is removed.
|
||||
|
||||
* New action flags are available for conversion APIs.
|
||||
IDN_ENCODE_QUERY, IDN_DECODE_QUERY, IDN_ENCODE_STORED, and
|
||||
IDN_DECODE_STORED are newly created according to IDNA specification.
|
||||
See include/idn/res.h for precise description.
|
||||
|
||||
* Action flags IDN_ENCODE_APP, IDN_DECODE_APP and IDN_NAMEPREP change
|
||||
those behavior.
|
||||
See include/idn/res.h for precise description.
|
||||
|
||||
* New decode APIs are created.
|
||||
idn_decodename2() and idn_res_decodename2() are defined to add
|
||||
conversion process from "IDN string encoded in local encoding" to
|
||||
UTF-8 before actual decode process of IDN.
|
||||
|
||||
* idnconv with -reverse option treats input as IDN string(s) encoded
|
||||
in local encoding specified by -out option.
|
||||
|
||||
* idnconv recognizes `-A' option which is synonym for `-noasciicheck'.
|
||||
|
||||
* (Windows) idn Wrapper can run on Windows XP.
|
||||
|
||||
* BIND-8 patch for BIND-8.3.3 is available and other patches of BIND-8
|
||||
are removed.
|
||||
|
||||
Major changes in idnkit version 1.0-rc1:
|
||||
|
||||
* NAMEPREP draft -09 is supported.
|
||||
|
||||
* idnconv now accepts any encodings specified as argument for `-in'
|
||||
or `-out' option. `-out' accepts non-ACE, and `-in' accepts ACE.
|
||||
|
||||
* In configuration file, `encoding-alias-file' entry is not supported
|
||||
any longer. It is simply ignored.
|
||||
|
||||
Major changes in idnkit version 1.0-beta2:
|
||||
|
||||
* Supported nameprep version is changed.
|
||||
Now idnkit supports nameprep-03, nameprep-06, and nameprep-08.
|
||||
Nameprep-05 and nameprep-07 are not supported any more.
|
||||
|
||||
* Compatibility with mDNkit is added.
|
||||
This feature provides applications formerly written using mDNkit
|
||||
library with some source level compatibilities. If you want to use
|
||||
this feature, set `--enable-mdnkit-compat' option at execution time
|
||||
of configure script.
|
||||
|
||||
* Now idnkit can set up easily without configuration file.
|
||||
As this feature is added, initialization function and some behavior
|
||||
of top level API are changed.
|
||||
|
||||
* BIND-8 patch supports IDN conversion in itself.
|
||||
|
||||
* (Windows) idnkit library looks for configuration files with registry
|
||||
information.
|
||||
|
||||
* (Windows) idnkit library returns "CP<code page number>" as local
|
||||
encoding name when the environment variable "IDN_LOCAL_CODESET" is
|
||||
not set.
|
||||
|
||||
* (Windows) libidnkit/libidnkitlite are now installed as DLL.
|
||||
|
||||
* (Windows) idnconv can be executed as a console application.
|
||||
|
||||
Major changes in idnkit version 1.0-beta1:
|
||||
|
||||
* mDNkit has been renamed idnkit.
|
||||
This means all symbols with "mdn" are renamed with "idn". For
|
||||
example, a function `mdn_encodename()' is now `idn_encodename()', an
|
||||
environment variable "MDN_DISABLE" is "IDN_DISABLE", system
|
||||
configuretion file is "idn.conf", `runmdn' command is `runidn', and
|
||||
so forth.
|
||||
|
||||
* Also, library name has been changed to "libidnkit(lite)".
|
||||
|
||||
* `mdnsproxy' command has been removed.
|
||||
|
||||
* `runidn' (formerly known as `runmdn') command is not installed by
|
||||
default.
|
||||
If you want to install it, set "yes" to `--enable-runidn' option
|
||||
when you run configure script.
|
||||
|
||||
* idnkitlite library only instalation is supported.
|
||||
Set "yes" to `--enable-liteonly' option at execution of configure
|
||||
script to use this feature.
|
||||
|
||||
* BIND-9.1.3 patch has been removed.
|
||||
|
||||
* User configuration file is supported.
|
||||
idnkit now uses ".idnrc" in user's home directory for configuration
|
||||
of whole scheme. If there is no user configuration file, then it
|
||||
tries to load the system configuration file "idn.conf".
|
||||
|
||||
* idnkit is now able to run without configuration file.
|
||||
If there are no configuration files (both of user's and system's),
|
||||
it sets normal configurations (the latest nameprep scheme it
|
||||
supports and the IDN encoding "Punycode") automatically at runtime.
|
||||
|
||||
* Encoding alias information file is supported. (by generic libidnkit)
|
||||
Its name is "idnalias.conf" by default and it should be located in
|
||||
same directory where the system configuration file is. Example
|
||||
alias information file "idnalias.conf.sample" is installed
|
||||
automatically.
|
||||
|
||||
* APIs are renewed. See manpage.
|
||||
|
||||
* Now idnkit has full support of IDNA-07.
|
||||
|
||||
* Internal representation of domain name is changed to UCS4 in place
|
||||
of UTF-8.
|
||||
|
|
@ -1,159 +0,0 @@
|
|||
|
||||
idnkit
|
||||
-- internationalized domain name toolkit --
|
||||
version 1.0
|
||||
Japan Network Information Center (JPNIC)
|
||||
|
||||
|
||||
Table of contents of this file:
|
||||
|
||||
1. Overview
|
||||
2. Directory structure of this distribution
|
||||
3. Supported systems
|
||||
4. Contact information
|
||||
|
||||
See the file INSTALL for compilation and installation instructions.
|
||||
See the file NEWS for a list of major changes in the current release.
|
||||
|
||||
|
||||
1. Overview
|
||||
|
||||
idnkit, which was originally known as mDNkit, is a toolkit for handling
|
||||
internationalized domain names. To handle such names, the following
|
||||
features are required:
|
||||
|
||||
+ Encoding conversion
|
||||
Multilingualized domain names have to be converted from
|
||||
the encoding application uses (local encoding) to
|
||||
the encoding used for name resolution (IDN encoding), and
|
||||
vice versa. Since domain names in IDN encoding just look
|
||||
like good old ASCII domain names, the encoding is also known
|
||||
as ASCII-compatible encoding (ACE).
|
||||
|
||||
+ NAMEPREP
|
||||
Name preparation of domain names before converting to
|
||||
IDN encoding. Basically this is a normalization process
|
||||
of the domain names.
|
||||
|
||||
These conversion/nameprep processes to domain names have to be
|
||||
performed before they are sent to DNS servers. And since the
|
||||
processed domain names (in IDN encoding) consist of only legal ASCII
|
||||
characters, no changes are required to DNS servers.
|
||||
|
||||
idnkit provides several ways for adding these features.
|
||||
|
||||
This kit consists of following components.
|
||||
|
||||
+ library for handling internationalized domain names
|
||||
(libidnkit, libidnkitlite)
|
||||
Those libraries implement encoding conversion and nameprep.
|
||||
They provide easy-to-use APIs for handling internationalized
|
||||
domain name in your applications.
|
||||
|
||||
Both libraries provide almost the same API. The difference
|
||||
between them is that libidnkit internally uses iconv() function
|
||||
to provide encoding conversion from UTF-8 to the local encoding
|
||||
(such as iso-8859-1, usually determined by the current locale),
|
||||
and vise versa. The idnconv and runidn commands in this toolkit
|
||||
use libidnkit.
|
||||
|
||||
libidnkitlite is lightweight version of libidnkit. It assumes
|
||||
local encoding is UTF-8 so that it never uses iconv().
|
||||
|
||||
+ codeset conversion utility (idnconv)
|
||||
This command can convert internationalized domain name written
|
||||
in local encoding (e.g. EUC-JP) to ACE or the opposite direction.
|
||||
It can also convert named.conf and zone master files for BIND.
|
||||
|
||||
+ command which adds IDN feature dynamically to unix applications
|
||||
(runidn)
|
||||
This command enables normal applications to handle
|
||||
internationalized domain names by dynamically attaching special
|
||||
library to them. See ``2. using runidn'' below.
|
||||
|
||||
Note that this command is not installed unless you specify the
|
||||
`--enable-runidn' option to `configure'. See the file `INSTALL'
|
||||
for more information about installation.
|
||||
|
||||
+ patch for BIND9 that adds IDN capability
|
||||
This patch adds IDN capability to BIND9. It adds encoding
|
||||
conversion and nameprep features to `dig', `host' and
|
||||
`nslookup'. With the patch, those commands become capable of
|
||||
internationalized domain names.
|
||||
|
||||
+ IDN wrapper for Windows applications
|
||||
On windows, name resolving request is passed to WINSOCK DLL. So,
|
||||
replacing WINSOCK DLL with multi-lingual domain name version
|
||||
makes legacy windows applications compatible with IDN. This is
|
||||
wrapper DLL for WINSOCK's name resolving functions. See
|
||||
``3. using IDN wrapper'' below.
|
||||
|
||||
|
||||
2. Directory structure of this distribution
|
||||
|
||||
Below is a directory structure of this distribution with some
|
||||
important files and their brief description.
|
||||
|
||||
+README this file
|
||||
+README.ja .. in Japanese
|
||||
+INSTALL compilation and installation instructions.
|
||||
+INSTALL.ja .. in Japanese
|
||||
+DISTFILES list of files in this distribution
|
||||
+NEWS what's new in this version
|
||||
+ChangeLog list of changes
|
||||
+Makefile.in toplevel makefile template
|
||||
+configure a `configure' script
|
||||
+include/
|
||||
| +config.h.in template header file for configuration
|
||||
| +idn/ header files for libidnkit and libindkitlite
|
||||
| +mdn/ header files for backward compatibility
|
||||
+lib/ source for libidnkit and libidnkitlite
|
||||
+patch/
|
||||
| +bind9/ BIND9 patch
|
||||
+tools/
|
||||
| +idnconv/ source for idnconv command
|
||||
| +runidn/ source for runidn command
|
||||
+util/ utilities
|
||||
+wsock/ source for IDN wrapper
|
||||
|
||||
|
||||
3. Supported systems
|
||||
|
||||
We've had successful builds on the following systems:
|
||||
|
||||
-------------------------------------------------------------------
|
||||
OS iconv library configure options
|
||||
===================================================================
|
||||
FreeBSD 4.7-RELEASE GNU libiconv --with-libiconv
|
||||
for Intel 1.8
|
||||
-------------------------------------------------------------------
|
||||
Red Hat Linux 7.3 standard library none
|
||||
for Intel (glibc)
|
||||
-------------------------------------------------------------------
|
||||
Solaris 9 standard library none
|
||||
for Sparc (libc)
|
||||
-------------------------------------------------------------------
|
||||
|
||||
The latest information about supported/unsupported systems will be
|
||||
found at the mdnkit FAQ page linked from:
|
||||
|
||||
http://www.nic.ad.jp/en/idn/
|
||||
|
||||
|
||||
4. Contact information
|
||||
|
||||
Please see
|
||||
|
||||
http://www.nic.ad.jp/en/idn/
|
||||
|
||||
for the latest news about this kit.
|
||||
Bug reports and comments on this kit should be sent to
|
||||
|
||||
mdnkit-bugs@nic.ad.jp
|
||||
and
|
||||
idn-cmt@nic.ad.jp
|
||||
|
||||
respectively.
|
||||
|
||||
|
||||
; $Id: README,v 1.1 2003/06/04 00:24:58 marka Exp $
|
||||
|
|
@ -1,151 +0,0 @@
|
|||
|
||||
idnkit
|
||||
-- $B9q:]2=%I%a%$%sL>%D!<%k%-%C%H(B --
|
||||
$B%P!<%8%g%s(B 1.0
|
||||
($B<R(B) $BF|K\%M%C%H%o!<%/%$%s%U%)%a!<%7%g%s%;%s%?!<(B (JPNIC)
|
||||
|
||||
|
||||
$B$3$N%U%!%$%k$NL\<!(B:
|
||||
|
||||
1. $B35MW(B
|
||||
2. $B%G%#%l%/%H%j9=@.(B
|
||||
3. $BK\%-%C%H$,BP1~$7$F$$$k%7%9%F%`(B
|
||||
4. $BK\%-%C%H$K4X$9$k:G?7>pJs!"Ld$$9g$o$;$K$D$$$F(B
|
||||
|
||||
$B%3%s%Q%$%k$*$h$S%$%s%9%H!<%kJ}K!$K$D$$$F$O!"(BINSTALL.ja $B$H$$$&%U%!%$%k$r(B
|
||||
$B$4Mw2<$5$$!#$3$N%P!<%8%g%s$G$N<g$JJQ99E@$KIU$$$F$O!"(B($B1QJ8$G$9$,(B) NEWS
|
||||
$B$H$$$&%U%!%$%k$r$4Mw2<$5$$!#(B
|
||||
|
||||
|
||||
1. $B35MW(B
|
||||
|
||||
idnkit ($B5l>N(B mDNkit) $B$H$O9q:]2=%I%a%$%sL>$r07$&$?$a$N%D!<%k%-%C%H$G$9!#(B
|
||||
$B9q:]2=%I%a%$%sL>$r07$&$?$a$K$O!"<!$N$h$&$J5!G=$,MW5a$5$l$^$9!#(B
|
||||
|
||||
$B!&%(%s%3!<%G%#%s%0JQ49(B
|
||||
$B9q:]2=%I%a%$%sL>$KBP$7$F!"$=$N%(%s%3!<%G%#%s%0$r%"%W%j%1!<%7%g%s$,;H(B
|
||||
$BMQ$7$F$$$k$b$N(B ($B%m!<%+%k%(%s%3!<%G%#%s%0(B) $B$+$iL>A02r7h$KMQ$$$i$l$k$b(B
|
||||
$B$N(B (IDN $B%(%s%3!<%G%#%s%0(B) $B$X$NJQ49!"$^$?$=$N5UJ}8~$NJQ49$r9T$$$^$9!#(B
|
||||
$B%I%a%$%sL>$r(B IDN $B%(%s%3!<%G%#%s%0$K$7$?7k2L$O!"=>Mh$N%I%a%$%sL>$HF1(B
|
||||
$B$8$/(B ASCII $BJ8;z$N$_$G9=@.$5$l$k$N$G!"(BIDN $B%(%s%3!<%G%#%s%0$O(BASCII $B8_(B
|
||||
$B49%(%s%3!<%G%#%s%0(B (ACE) $B$H$b8F$P$l$^$9!#(B
|
||||
|
||||
$B!&(BNAMEPREP
|
||||
$B%I%a%$%sL>$r(B IDN $B%(%s%3!<%G%#%s%0$KJQ49$9$kA0$K!"L>A0$N@55,2=$r9T$$(B
|
||||
$B$^$9!#$3$l$r(B NAMEPREP $B$H8F$S$^$9!#(B
|
||||
|
||||
$B>e5-$N=hM}$O%I%a%$%sL>$r(B DNS $B%5!<%P$KAw$kA0$K<B9T$9$kI,MW$,$"$j$^$9!#(B
|
||||
$B=hM}:Q$N%I%a%$%sL>$O(B ASCII $BJ8;z$+$i9=@.$5$l!"=>Mh$N(B ASCII $B%I%a%$%sL>$H(B
|
||||
$B$7$F$b@5$7$$7A<0$K$J$C$F$$$k$N$G!"(BDNS $B%5!<%PB&$K$O$J$s$NJQ99$bI,MW$"$j(B
|
||||
$B$^$;$s!#(B
|
||||
|
||||
$B$3$NG[I[%-%C%H$K$O<!$N$h$&$J$b$N$,4^$^$l$^$9!#(B
|
||||
|
||||
$B!&9q:]2=%I%a%$%sL>$r=hM}$9$k$?$a$N%i%$%V%i%j(B (libidnkit, libidnkitlite)
|
||||
$B$3$l$i$N%i%$%V%i%j$G$O!"%(%s%3!<%G%#%s%0JQ49$d(B NAMEPREP $B$N5!G=$r<B(B
|
||||
$BAu$7$F$*$j!"%"%W%j%1!<%7%g%s$,9q:]2=%I%a%$%sL>$r4JC1$K07$($k$h$&$K(B
|
||||
$B$9$k$?$a$N(B API $B$rHw$($F$$$^$9!#(B
|
||||
|
||||
$B$I$A$i$N%i%$%V%i%j$b$[$H$s$IF1$8(B API $B$rDs6!$7$^$9!#N><T$NAj0cE@$G$9(B
|
||||
$B$,!"(Blibidnkit $B$N$[$&$O(B iconv() $B4X?t$r;H$C$F(B UTF-8 $B$H%m!<%+%k%(%s%3!<(B
|
||||
$B%G%#%s%0(B (iso-8859-1 $B$J$I!"DL>o$O(B locale $B$+$i7hDj$5$l$^$9(B) $B$H$N4V$N(B
|
||||
$BJQ495!G=$rDs6!$7$F$$$^$9!#K\%D!<%k%-%C%HIUB0$N(B idnconv $B$*$h$S(B runidn
|
||||
$B$O(B libidnkit $B$r;HMQ$7$F$$$^$9!#(B
|
||||
|
||||
libidnkitlite $B$O(B libidnkit $B$N7ZNLHG$G$9!#%m!<%+%k%(%s%3!<%G%#%s%0$O(B
|
||||
$B>o$K(B UTF-8 $B$@$H2>Dj$7$F$*$j!"(Biconv() $B$O;HMQ$7$^$;$s!#(B
|
||||
|
||||
$B!&%3!<%I%;%C%H%3%s%P!<%?(B (idnconv)
|
||||
$B%m!<%+%k%(%s%3!<%G%#%s%0(B ($B$?$H$($P(B EUC-JP) $B$G=q$+$l$?9q:]2=%I%a%$%s(B
|
||||
$BL>$+$i(B ACE $B$X$NJQ49$d!"$=$N5UJQ49$r9T$($k%3%^%s%I$G$9!#(BBIND $BMQ$N(B
|
||||
named.conf $B$d%>!<%s%^%9%?%U%!%$%k$rJQ49$9$k$3$H$b2DG=$G$9!#(B
|
||||
|
||||
$B!&(BUNIX $B%"%W%j%1!<%7%g%s$K(B IDN $B5!G=$rF0E*$KDI2C$9$k%3%^%s%I(B (runidn)
|
||||
UNIX $B$NDL>o$N%"%W%j%1!<%7%g%s$G9q:]2=%I%a%$%sL>$r<h$j07$&$?$a$K!"FC(B
|
||||
$BJL$J%i%$%V%i%j$rF0E*$K%j%s%/$9$k$?$a$N%3%^%s%I$G$9!#>\$7$/$O!"8e=R$N(B
|
||||
$B!V(B2. runidn $B$r;H$&!W$r8fMw$/$@$5$$!#(B
|
||||
|
||||
$B$J$*!"(Bconfigure $B<B9T;~$K(B `--enable-runidn' $B$r;XDj$7$J$$$H!"(Brunidn $B$O(B
|
||||
$B%$%s%9%H!<%k$5$l$^$;$s!#%$%s%9%H!<%k$K4X$7$F!">\$7$/$O(B INSTALL.ja $B$H(B
|
||||
$B$$$&%U%!%$%k$r$4Mw$/$@$5$$!#(B
|
||||
|
||||
$B!&(BBIND9 $B$K(B IDN $B5!G=$rDI2C$9$k%Q%C%A(B
|
||||
BIND $B$K(B IDN $B$N5!G=$rDI2C$9$k%Q%C%A$G$9!#(B`dig'$B!"(B`host'$B!"(B`nslookup' $B$K(B
|
||||
$B%(%s%3!<%G%#%s%0JQ49$H(B NAMEPREP $B$N5!G=$rDI2C$7!"9q:]2=%I%a%$%sL>$,07(B
|
||||
$B$($k$h$&$K$7$^$9!#(B
|
||||
|
||||
$B!&(BWindows $B%"%W%j%1!<%7%g%sMQ$N(B IDN $B%i%C%Q!<(B
|
||||
WINSOCK $B$NL>A02r7h5!G=$KBP$9$k%i%C%Q!<(B DLL $B$G$9!#(BWindows $B>e$G$O!"L>(B
|
||||
$BA02r7h$NMW5a$O!"(BWINSOCK DLL $B$rDL$7$F9T$o$l$^$9!#$=$3$G!"$3$l$r9q:]2=(B
|
||||
$B%I%a%$%sMQ$N(B WINSOCK DLL $B$KCV$-49$($k$3$H$G!"=>Mh$N(B Windows $B%"%W%j%1!<(B
|
||||
$B%7%g%s$G$b(B IDN $B5!G=$r;HMQ$G$-$k$h$&$K$7$^$9!#>\$7$/$O!"8e=R$N(B
|
||||
$B!V(B3. IDN $B%i%C%Q!<$r;H$&!W$r8fMw$/$@$5$$!#(B
|
||||
|
||||
|
||||
2. $B%G%#%l%/%H%j9=@.(B
|
||||
|
||||
$BG[I[%-%C%H$N%G%#%l%/%H%j9=@.$H!"<gMW$J%U%!%$%k$r<($7$^$9!#(B
|
||||
|
||||
+README $B1Q8lHG$N(B README
|
||||
+README.ja $B$3$N%U%!%$%k(B
|
||||
+INSTALL $B1Q8lHG$N(B INSTALL
|
||||
+INSTALL.ja $B%3%s%Q%$%k$H%$%s%9%H!<%kJ}K!(B
|
||||
+DISTFILES $BG[I[$5$l$k%U%!%$%k0lMw(B
|
||||
+NEWS $B<g$JJQ99(B
|
||||
+ChangeLog $BJQ99>\:Y(B
|
||||
+configure configure $B%9%/%j%W%H(B
|
||||
+Makefile.in $B%H%C%W%l%Y%k$N(B Makefile $B$N%F%s%W%l!<%H(B
|
||||
+include/
|
||||
| +config.h.in config.h $B$N%F%s%W%l!<%H(B
|
||||
| +idn/ libidnkit, libidnkitlite $B$N%X%C%@%U%!%$%k(B
|
||||
| +mdn/ $B5l%P!<%8%g%s$H$N8_49MQ%X%C%@%U%!%$%k(B
|
||||
+lib/ libidnkit, libidnkitlite $B$N%=!<%9(B
|
||||
+patch/
|
||||
| +bind9/ BIND9 $BMQ%Q%C%A(B
|
||||
+tools/
|
||||
| +idnconv/ idnconv $B%3%^%s%I$N%=!<%9(B
|
||||
| +runidn/ runidn $B%3%^%s%I$N%=!<%9(B
|
||||
+util/ $B%f!<%F%#%j%F%#(B
|
||||
+wsock/ IDN $B%i%C%Q!<$N%=!<%9(B
|
||||
|
||||
|
||||
3. $BK\%-%C%H$,BP1~$7$F$$$k%7%9%F%`(B
|
||||
|
||||
$B@5>o$K%$%s%9%H!<%k$G$-$k$3$H$,3NG'$G$-$F$$$k$N$O!"<!$N%7%9%F%`$G$9!#(B
|
||||
|
||||
------------------------------------------------------------------
|
||||
OS iconv configure $B$N%*%W%7%g%s(B
|
||||
==================================================================
|
||||
FreeBSD 4.7-RELEASE GNU libiconv --with-libiconv
|
||||
Intel 1.8
|
||||
-------------------------------------------------------------------
|
||||
Red Hat Linux 7.3 $BI8=`%i%$%V%i%j(B $B$J$7(B
|
||||
Intel (glibc)
|
||||
------------------------------------------------------------------
|
||||
Solaris 9 $BI8=`%i%$%V%i%j(B $B$J$7(B
|
||||
Sparc (libc)
|
||||
-------------------------------------------------------------------
|
||||
|
||||
$BK\%-%C%H$,BP1~$7$F$$$k(B/$B$7$F$$$J$$%7%9%F%`$K4X$9$k:G?7$N>pJs$O!"<!$N$H(B
|
||||
$B$3$m$+$iC)$l$k(B mdnkit FAQ $B$N%Z!<%8$K5-$5$l$F$$$^$9!#(B
|
||||
|
||||
http://www.nic.ad.jp/ja/idn/
|
||||
|
||||
|
||||
4. $BK\%-%C%H$K4X$9$k:G?7>pJs!"Ld$$9g$o$;$K$D$$$F(B
|
||||
|
||||
$BK\%-%C%H$K4X$9$k:G?7>pJs$K$D$$$F$O!"(B
|
||||
|
||||
http://www.nic.ad.jp/ja/idn/
|
||||
|
||||
$B$r;2>H$7$F$/$@$5$$(B
|
||||
$BK\%-%C%H$K4X$9$k%P%0%l%]!<%H$*$h$S%3%a%s%H$O!"$=$l$>$l(B
|
||||
|
||||
mdnkit-bugs@nic.ad.jp
|
||||
$B$*$h$S(B
|
||||
idn-cmt@nic.ad.jp
|
||||
|
||||
$B$X$*4j$$$7$^$9!#(B
|
||||
|
||||
|
||||
; $Id: README.ja,v 1.1 2003/06/04 00:24:59 marka Exp $
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
/* $Id: acconfig.h,v 1.1 2003/06/04 00:25:03 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2000 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
@TOP@
|
||||
|
||||
/* Define as an appropriate type (ex. int) if your system doesn't have. */
|
||||
#undef BOOL
|
||||
|
||||
@BOTTOM@
|
||||
/* Define as the pathname of the shared libc object if your system has one. */
|
||||
#undef SOPATH_LIBC
|
||||
|
||||
/* Define as the pathname of the shared libnsl object if your system has one. */
|
||||
#undef SOPATH_LIBNSL
|
||||
472
contrib/idn/idnkit-1.0-src/aclocal.m4
vendored
472
contrib/idn/idnkit-1.0-src/aclocal.m4
vendored
|
|
@ -1,472 +0,0 @@
|
|||
##
|
||||
## $Id: aclocal.m4,v 1.1 2003/06/04 00:25:05 marka Exp $
|
||||
##
|
||||
AC_DEFUN(AC_FIND_SYSTEM_SHOBJ,[
|
||||
AC_MSG_CHECKING(for $1 shared object)
|
||||
shobj_name=$1
|
||||
shobj_path=
|
||||
case "$host" in
|
||||
*-hpux*)
|
||||
SOEXT=sl
|
||||
;;
|
||||
*)
|
||||
SOEXT=so
|
||||
;;
|
||||
esac
|
||||
for shobj_libdir in /lib /usr/lib; do
|
||||
if test -f $shobj_libdir/$shobj_name.$SOEXT; then
|
||||
shobj_path=$shobj_libdir/$shobj_name.$SOEXT
|
||||
else
|
||||
shobj_path=`ls -r $shobj_libdir/$shobj_name.$SOEXT* 2>/dev/null | head -1`
|
||||
if test "$shobj_path" != "" -a -f "$shobj_path"; then
|
||||
:
|
||||
else
|
||||
shobj_path=
|
||||
fi
|
||||
fi
|
||||
if test "$shobj_path" != ""; then
|
||||
AC_MSG_RESULT($shobj_path)
|
||||
shobj_pathsymbol=SOPATH_`echo $shobj_name | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
|
||||
AC_DEFINE_UNQUOTED($shobj_pathsymbol, "$shobj_path")
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test "$shobj_path" = ""; then
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
])dnl
|
||||
|
||||
## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
|
||||
## Copyright (C) 1996-1999, 2000 Free Software Foundation, Inc.
|
||||
## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
||||
##
|
||||
## 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 of the License, 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, write to the Free Software
|
||||
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## 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.
|
||||
|
||||
# serial 40 AC_PROG_LIBTOOL
|
||||
AC_DEFUN(AC_PROG_LIBTOOL,
|
||||
[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
|
||||
|
||||
# Save cache, so that ltconfig can load it
|
||||
AC_CACHE_SAVE
|
||||
|
||||
# Actually configure libtool. ac_aux_dir is where install-sh is found.
|
||||
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
|
||||
LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
|
||||
LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
|
||||
DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
|
||||
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
|
||||
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
|
||||
|| AC_MSG_ERROR([libtool configure failed])
|
||||
|
||||
# Reload cache, that may have been modified by ltconfig
|
||||
AC_CACHE_LOAD
|
||||
|
||||
# This can be used to rebuild libtool when needed
|
||||
LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
|
||||
|
||||
# Always use our own libtool.
|
||||
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
|
||||
AC_SUBST(LIBTOOL)dnl
|
||||
|
||||
# Redirect the config.log output again, so that the ltconfig log is not
|
||||
# clobbered by the next message.
|
||||
exec 5>>./config.log
|
||||
])
|
||||
|
||||
AC_DEFUN(AC_LIBTOOL_SETUP,
|
||||
[AC_PREREQ(2.13)dnl
|
||||
AC_REQUIRE([AC_ENABLE_SHARED])dnl
|
||||
AC_REQUIRE([AC_ENABLE_STATIC])dnl
|
||||
AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
|
||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_PROG_LD])dnl
|
||||
AC_REQUIRE([AC_PROG_NM])dnl
|
||||
AC_REQUIRE([AC_PROG_LN_S])dnl
|
||||
dnl
|
||||
|
||||
case "$target" in
|
||||
NONE) lt_target="$host" ;;
|
||||
*) lt_target="$target" ;;
|
||||
esac
|
||||
|
||||
# Check for any special flags to pass to ltconfig.
|
||||
libtool_flags="--cache-file=$cache_file"
|
||||
test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
|
||||
test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
|
||||
test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
|
||||
test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
|
||||
test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
|
||||
ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
|
||||
[libtool_flags="$libtool_flags --enable-dlopen"])
|
||||
ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
|
||||
[libtool_flags="$libtool_flags --enable-win32-dll"])
|
||||
AC_ARG_ENABLE(libtool-lock,
|
||||
[ --disable-libtool-lock avoid locking (might break parallel builds)])
|
||||
test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
|
||||
test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
|
||||
|
||||
# Some flags need to be propagated to the compiler or linker for good
|
||||
# libtool support.
|
||||
case "$lt_target" in
|
||||
*-*-irix6*)
|
||||
# Find out which ABI we are using.
|
||||
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
|
||||
if AC_TRY_EVAL(ac_compile); then
|
||||
case "`/usr/bin/file conftest.o`" in
|
||||
*32-bit*)
|
||||
LD="${LD-ld} -32"
|
||||
;;
|
||||
*N32*)
|
||||
LD="${LD-ld} -n32"
|
||||
;;
|
||||
*64-bit*)
|
||||
LD="${LD-ld} -64"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
rm -rf conftest*
|
||||
;;
|
||||
|
||||
*-*-sco3.2v5*)
|
||||
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
|
||||
SAVE_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -belf"
|
||||
AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
|
||||
[AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
|
||||
if test x"$lt_cv_cc_needs_belf" != x"yes"; then
|
||||
# this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
|
||||
CFLAGS="$SAVE_CFLAGS"
|
||||
fi
|
||||
;;
|
||||
|
||||
ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
|
||||
[*-*-cygwin* | *-*-mingw*)
|
||||
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
|
||||
AC_CHECK_TOOL(AS, as, false)
|
||||
AC_CHECK_TOOL(OBJDUMP, objdump, false)
|
||||
;;
|
||||
])
|
||||
esac
|
||||
])
|
||||
|
||||
# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
|
||||
AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
|
||||
|
||||
# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
|
||||
AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
|
||||
|
||||
# AC_ENABLE_SHARED - implement the --enable-shared flag
|
||||
# Usage: AC_ENABLE_SHARED[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AC_ENABLE_SHARED, [dnl
|
||||
define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(shared,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_shared=yes ;;
|
||||
no) enable_shared=no ;;
|
||||
*)
|
||||
enable_shared=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_shared=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
|
||||
AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_ENABLE_SHARED(no)])
|
||||
|
||||
# AC_ENABLE_STATIC - implement the --enable-static flag
|
||||
# Usage: AC_ENABLE_STATIC[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AC_ENABLE_STATIC, [dnl
|
||||
define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(static,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_static=yes ;;
|
||||
no) enable_static=no ;;
|
||||
*)
|
||||
enable_static=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_static=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AC_DISABLE_STATIC - set the default static flag to --disable-static
|
||||
AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_ENABLE_STATIC(no)])
|
||||
|
||||
|
||||
# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
|
||||
# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
|
||||
define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(fast-install,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_fast_install=yes ;;
|
||||
no) enable_fast_install=no ;;
|
||||
*)
|
||||
enable_fast_install=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_fast_install=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
|
||||
AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_ENABLE_FAST_INSTALL(no)])
|
||||
|
||||
# AC_PROG_LD - find the path to the GNU or non-GNU linker
|
||||
AC_DEFUN(AC_PROG_LD,
|
||||
[AC_ARG_WITH(gnu-ld,
|
||||
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
|
||||
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
|
||||
ac_prog=ld
|
||||
if test "$ac_cv_prog_gcc" = yes; then
|
||||
# Check if gcc -print-prog-name=ld gives a path.
|
||||
AC_MSG_CHECKING([for ld used by GCC])
|
||||
ac_prog=`($CC -print-prog-name=ld) 2>&5`
|
||||
case "$ac_prog" in
|
||||
# Accept absolute paths.
|
||||
changequote(,)dnl
|
||||
[\\/]* | [A-Za-z]:[\\/]*)
|
||||
re_direlt='/[^/][^/]*/\.\./'
|
||||
changequote([,])dnl
|
||||
# Canonicalize the path of ld
|
||||
ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
|
||||
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
|
||||
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
|
||||
done
|
||||
test -z "$LD" && LD="$ac_prog"
|
||||
;;
|
||||
"")
|
||||
# If it fails, then pretend we aren't using GCC.
|
||||
ac_prog=ld
|
||||
;;
|
||||
*)
|
||||
# If it is relative, then search for the first ld in PATH.
|
||||
with_gnu_ld=unknown
|
||||
;;
|
||||
esac
|
||||
elif test "$with_gnu_ld" = yes; then
|
||||
AC_MSG_CHECKING([for GNU ld])
|
||||
else
|
||||
AC_MSG_CHECKING([for non-GNU ld])
|
||||
fi
|
||||
AC_CACHE_VAL(ac_cv_path_LD,
|
||||
[if test -z "$LD"; then
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
|
||||
for ac_dir in $PATH; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
|
||||
ac_cv_path_LD="$ac_dir/$ac_prog"
|
||||
# Check to see if the program is GNU ld. I'd rather use --version,
|
||||
# but apparently some GNU ld's only accept -v.
|
||||
# Break only if it was the GNU/non-GNU ld that we prefer.
|
||||
if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
|
||||
test "$with_gnu_ld" != no && break
|
||||
else
|
||||
test "$with_gnu_ld" != yes && break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
else
|
||||
ac_cv_path_LD="$LD" # Let the user override the test with a path.
|
||||
fi])
|
||||
LD="$ac_cv_path_LD"
|
||||
if test -n "$LD"; then
|
||||
AC_MSG_RESULT($LD)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
|
||||
AC_PROG_LD_GNU
|
||||
])
|
||||
|
||||
AC_DEFUN(AC_PROG_LD_GNU,
|
||||
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
|
||||
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
|
||||
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
|
||||
ac_cv_prog_gnu_ld=yes
|
||||
else
|
||||
ac_cv_prog_gnu_ld=no
|
||||
fi])
|
||||
])
|
||||
|
||||
# AC_PROG_NM - find the path to a BSD-compatible name lister
|
||||
AC_DEFUN(AC_PROG_NM,
|
||||
[AC_MSG_CHECKING([for BSD-compatible nm])
|
||||
AC_CACHE_VAL(ac_cv_path_NM,
|
||||
[if test -n "$NM"; then
|
||||
# Let the user override the test.
|
||||
ac_cv_path_NM="$NM"
|
||||
else
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
|
||||
for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
|
||||
# Check to see if the nm accepts a BSD-compat flag.
|
||||
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
|
||||
# nm: unknown option "B" ignored
|
||||
if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
||||
ac_cv_path_NM="$ac_dir/nm -B"
|
||||
break
|
||||
elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
||||
ac_cv_path_NM="$ac_dir/nm -p"
|
||||
break
|
||||
else
|
||||
ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
|
||||
continue # so that we can try to find one that supports BSD flags
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
|
||||
fi])
|
||||
NM="$ac_cv_path_NM"
|
||||
AC_MSG_RESULT([$NM])
|
||||
])
|
||||
|
||||
# AC_CHECK_LIBM - check for math library
|
||||
AC_DEFUN(AC_CHECK_LIBM,
|
||||
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
LIBM=
|
||||
case "$lt_target" in
|
||||
*-*-beos* | *-*-cygwin*)
|
||||
# These system don't have libm
|
||||
;;
|
||||
*-ncr-sysv4.3*)
|
||||
AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
|
||||
AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
|
||||
;;
|
||||
*)
|
||||
AC_CHECK_LIB(m, main, LIBM="-lm")
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
|
||||
# the libltdl convenience library and INCLTDL to the include flags for
|
||||
# the libltdl header and adds --enable-ltdl-convenience to the
|
||||
# configure arguments. Note that LIBLTDL and INCLTDL are not
|
||||
# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not
|
||||
# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed
|
||||
# with '${top_builddir}/' and INCLTDL will be prefixed with
|
||||
# '${top_srcdir}/' (note the single quotes!). If your package is not
|
||||
# flat and you're not using automake, define top_builddir and
|
||||
# top_srcdir appropriately in the Makefiles.
|
||||
AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
case "$enable_ltdl_convenience" in
|
||||
no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
|
||||
"") enable_ltdl_convenience=yes
|
||||
ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
|
||||
esac
|
||||
LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
|
||||
INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
|
||||
])
|
||||
|
||||
# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
|
||||
# the libltdl installable library and INCLTDL to the include flags for
|
||||
# the libltdl header and adds --enable-ltdl-install to the configure
|
||||
# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is
|
||||
# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed
|
||||
# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will
|
||||
# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed
|
||||
# with '${top_srcdir}/' (note the single quotes!). If your package is
|
||||
# not flat and you're not using automake, define top_builddir and
|
||||
# top_srcdir appropriately in the Makefiles.
|
||||
# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
|
||||
AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_CHECK_LIB(ltdl, main,
|
||||
[test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
|
||||
[if test x"$enable_ltdl_install" = xno; then
|
||||
AC_MSG_WARN([libltdl not installed, but installation disabled])
|
||||
else
|
||||
enable_ltdl_install=yes
|
||||
fi
|
||||
])
|
||||
if test x"$enable_ltdl_install" = x"yes"; then
|
||||
ac_configure_args="$ac_configure_args --enable-ltdl-install"
|
||||
LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
|
||||
INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
|
||||
else
|
||||
ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
|
||||
LIBLTDL="-lltdl"
|
||||
INCLTDL=
|
||||
fi
|
||||
])
|
||||
|
||||
dnl old names
|
||||
AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
|
||||
AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
|
||||
AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
|
||||
AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
|
||||
AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
|
||||
AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
|
||||
AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
|
||||
|
||||
dnl This is just to silence aclocal about the macro not being used
|
||||
ifelse([AC_DISABLE_FAST_INSTALL])dnl
|
||||
1317
contrib/idn/idnkit-1.0-src/config.guess
vendored
1317
contrib/idn/idnkit-1.0-src/config.guess
vendored
File diff suppressed because it is too large
Load diff
1411
contrib/idn/idnkit-1.0-src/config.sub
vendored
1411
contrib/idn/idnkit-1.0-src/config.sub
vendored
File diff suppressed because it is too large
Load diff
3517
contrib/idn/idnkit-1.0-src/configure
vendored
3517
contrib/idn/idnkit-1.0-src/configure
vendored
File diff suppressed because it is too large
Load diff
|
|
@ -1,711 +0,0 @@
|
|||
dnl $Id: configure.in,v 1.1 2003/06/04 00:25:25 marka Exp $
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl
|
||||
dnl Copyright (c) 2000 Japan Network Information Center. All rights reserved.
|
||||
dnl
|
||||
dnl By using this file, you agree to the terms and conditions set forth bellow.
|
||||
dnl
|
||||
dnl LICENSE TERMS AND CONDITIONS
|
||||
dnl
|
||||
dnl The following License Terms and Conditions apply, unless a different
|
||||
dnl license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
dnl a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
dnl Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
dnl
|
||||
dnl 1. Use, Modification and Redistribution (including distribution of any
|
||||
dnl modified or derived work) in source and/or binary forms is permitted
|
||||
dnl under this License Terms and Conditions.
|
||||
dnl
|
||||
dnl 2. Redistribution of source code must retain the copyright notices as they
|
||||
dnl appear in each source code file, this License Terms and Conditions.
|
||||
dnl
|
||||
dnl 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
dnl this License Terms and Conditions, in the documentation and/or other
|
||||
dnl materials provided with the distribution. For the purposes of binary
|
||||
dnl distribution the "Copyright Notice" refers to the following language:
|
||||
dnl "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
dnl
|
||||
dnl 4. The name of JPNIC may not be used to endorse or promote products
|
||||
dnl derived from this Software without specific prior written approval of
|
||||
dnl JPNIC.
|
||||
dnl
|
||||
dnl 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
dnl "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
dnl LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
dnl PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
dnl FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
dnl CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
dnl SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
dnl BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
dnl WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
dnl OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
dnl ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
AC_INIT(include/idn/converter.h)
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
debug=no
|
||||
AC_ARG_ENABLE(debug,
|
||||
[ --enable-debug enable debug codes [default=no]],
|
||||
debug=$enableval)
|
||||
case "$debug" in
|
||||
yes)
|
||||
CFLAGS="$CFLAGS -DDEBUG"
|
||||
;;
|
||||
esac
|
||||
|
||||
mdnkit_compat=no
|
||||
COMPAT_TRUE="#"
|
||||
COMPAT_FALSE=
|
||||
AC_ARG_ENABLE(mdnkit-compat,
|
||||
[ --enable-mdnkit-compat enable mDNkit compatibility mode [default=no]],
|
||||
mdnkit_compat=$enableval)
|
||||
case "$mdnkit_compat" in
|
||||
yes)
|
||||
COMPAT_TRUE=
|
||||
COMPAT_FALSE="#"
|
||||
AC_DEFINE(ENABLE_MDNKIT_COMPAT, 1,
|
||||
[Define if --enable-mdnkit-compat is specified])
|
||||
;;
|
||||
no)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([You must specify yes or no to --enable-runidn option.])
|
||||
;;
|
||||
esac
|
||||
AC_SUBST(COMPAT_TRUE)
|
||||
AC_SUBST(COMPAT_FALSE)
|
||||
|
||||
extraace=no
|
||||
AC_ARG_ENABLE(extra-ace,
|
||||
[ --enable-extra-ace enable additional ACE converters. [default=no]],
|
||||
extraace=$enableval)
|
||||
case "$extraace" in
|
||||
no)
|
||||
;;
|
||||
yes)
|
||||
AC_DEFINE(IDN_EXTRA_ACE, 1,
|
||||
[Define if you want additional ACE converters compiled in.])
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([You must specify yes or no to --enable-extra-ace option.])
|
||||
;;
|
||||
esac
|
||||
|
||||
UTF8_NAME=no
|
||||
AC_ARG_WITH(utf8,
|
||||
[ --with-utf8=NAME codeset name for UTF-8 encoding [UTF-8]],
|
||||
UTF8_NAME=$withval)
|
||||
case "$UTF8_NAME" in
|
||||
no)
|
||||
UTF8_NAME=UTF-8
|
||||
;;
|
||||
yes)
|
||||
AC_MSG_ERROR([You must specify NAME to --with-utf8 option.])
|
||||
;;
|
||||
*)
|
||||
AC_DEFINE_UNQUOTED(IDN_UTF8_ENCODING_NAME, "$UTF8_NAME",
|
||||
[Define if your iconv() does not accept "UTF-8" as the codeset name for utf-8.])
|
||||
;;
|
||||
esac
|
||||
AC_SUBST(UTF8_NAME)
|
||||
|
||||
liteonly=no
|
||||
LITEONLY_TRUE="#"
|
||||
LITEONLY_FALSE=
|
||||
AC_ARG_ENABLE(liteonly,
|
||||
[ --enable-liteonly compile and install lite library only [default=no]],
|
||||
liteonly=$enableval)
|
||||
case "$liteonly" in
|
||||
no)
|
||||
;;
|
||||
yes)
|
||||
if test "$install_runidn" = yes ; then
|
||||
AC_MSG_ERROR([you can't set value \"yes\" to --enable-runidn and --enable-liteonly simultaneously, because runidn requires iconv support of generic libidnkit.])
|
||||
fi
|
||||
LITEONLY_TRUE=
|
||||
LITEONLY_FALSE="#"
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([You must specify yes or no to --enable-liteonly option.])
|
||||
;;
|
||||
esac
|
||||
AC_SUBST(LITEONLY_TRUE)
|
||||
AC_SUBST(LITEONLY_FALSE)
|
||||
|
||||
install_runidn=no
|
||||
RUNIDN_TRUE="#"
|
||||
RUNIDN_FALSE=
|
||||
AC_ARG_ENABLE(runidn,
|
||||
[ --enable-runidn compile and install runidn [default=no]],
|
||||
install_runidn=$enableval)
|
||||
case "$install_runidn" in
|
||||
no)
|
||||
;;
|
||||
yes)
|
||||
if test "$liteonly" = yes ; then
|
||||
AC_MSG_ERROR([you can't set value \"yes\" to --enable-runidn and --enable-liteonly simultaneously, because runidn requires iconv support of generic libidnkit.])
|
||||
fi
|
||||
RUNIDN_TRUE=
|
||||
RUNIDN_FALSE="#"
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([You must specify yes or no to --enable-runidn option.])
|
||||
;;
|
||||
esac
|
||||
AC_SUBST(RUNIDN_TRUE)
|
||||
AC_SUBST(RUNIDN_FALSE)
|
||||
|
||||
ICONVINC=
|
||||
ICONVLIB=
|
||||
|
||||
libiconv=unspec
|
||||
AC_ARG_WITH(libiconv,
|
||||
[ --with-libiconv=IPREFIX GNU libiconv are installed in IPREFIX [PREFIX]],
|
||||
libiconv=$withval)
|
||||
case "$libiconv" in
|
||||
unspec)
|
||||
;;
|
||||
no)
|
||||
ICONVINC=
|
||||
ICONVLIB=
|
||||
;;
|
||||
yes)
|
||||
if test "$liteonly" = yes ; then
|
||||
AC_MSG_ERROR([you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support.])
|
||||
fi
|
||||
if test X$prefix = XNONE ; then
|
||||
libiconv=$ac_default_prefix
|
||||
else
|
||||
libiconv=$prefix
|
||||
fi
|
||||
ICONVINC="-I$libiconv/include"
|
||||
ICONVLIB="-L$libiconv/lib -R$libiconv/lib -liconv"
|
||||
;;
|
||||
*)
|
||||
if test "$liteonly" = yes ; then
|
||||
AC_MSG_ERROR([you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support.])
|
||||
fi
|
||||
ICONVINC="-I$libiconv/include"
|
||||
ICONVLIB="-L$libiconv/lib -R$libiconv/lib -liconv"
|
||||
;;
|
||||
esac
|
||||
|
||||
iconv_include=unspec
|
||||
AC_ARG_WITH(iconv-include,
|
||||
[ --with-iconv-include=DIR iconv include files are in DIR []],
|
||||
iconv_include=$withval)
|
||||
case "$iconv_include" in
|
||||
unspec)
|
||||
;;
|
||||
no)
|
||||
ICONVINC=
|
||||
;;
|
||||
yes)
|
||||
if test "$liteonly" = yes ; then
|
||||
AC_MSG_ERROR([you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support.])
|
||||
fi
|
||||
AC_MSG_WARN([You must supply DIR to --with-iconv-include option.
|
||||
Ignored.])
|
||||
ICONVINC=
|
||||
;;
|
||||
*)
|
||||
if test "$liteonly" = yes ; then
|
||||
AC_MSG_ERROR([you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support.])
|
||||
fi
|
||||
ICONVINC="-I$iconv_include"
|
||||
;;
|
||||
esac
|
||||
|
||||
if test "X$ICONVINC" != X ; then
|
||||
iconv_include="`echo X$ICONVINC | sed -e 's/^X-I//'`"
|
||||
if test ! -f "$iconv_include/iconv.h" ; then
|
||||
AC_MSG_ERROR([iconv.h doesn't exist in $iconv_include])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(ICONVINC)
|
||||
|
||||
iconv=unspec
|
||||
AC_ARG_WITH(iconv,
|
||||
[ --with-iconv=LIB special library for iconv []],
|
||||
iconv=$withval)
|
||||
case "$iconv" in
|
||||
unspec)
|
||||
;;
|
||||
no)
|
||||
ICONVLIB=
|
||||
;;
|
||||
yes)
|
||||
if test "$liteonly" = yes ; then
|
||||
AC_MSG_ERROR([you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support.])
|
||||
fi
|
||||
AC_MSG_WARN([You must supply LIB to --with-iconv option.
|
||||
-liconv is assumed.])
|
||||
ICONVLIB=-liconv
|
||||
;;
|
||||
*)
|
||||
if test "$liteonly" = yes ; then
|
||||
AC_MSG_ERROR([you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support.])
|
||||
fi
|
||||
ICONVLIB=$iconv
|
||||
;;
|
||||
esac
|
||||
AC_SUBST(ICONVLIB)
|
||||
|
||||
AC_ARG_WITH(iconv-sofile,
|
||||
[ --with-iconv-sofile=PATH shared library file for libiconv []],
|
||||
iconv_file=$withval, iconv_file=guess)
|
||||
ICONVSOFILE=
|
||||
case "$iconv_file" in
|
||||
no)
|
||||
ICONVSOFILE=none
|
||||
;;
|
||||
yes)
|
||||
if test "$liteonly" = yes ; then
|
||||
AC_MSG_ERROR([you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support.])
|
||||
fi
|
||||
AC_MSG_ERROR([You must supply PATH to --with-iconv-sofile option.])
|
||||
;;
|
||||
guess)
|
||||
if test "$liteonly" != yes ; then
|
||||
if test "$ICONVLIB" = ""; then
|
||||
ICONVSOFILE=none
|
||||
else
|
||||
AC_MSG_CHECKING(pathname of iconv shared library)
|
||||
ic_libdir=
|
||||
ic_libname=
|
||||
case "$host" in
|
||||
*-hpux*)
|
||||
SO=sl
|
||||
;;
|
||||
*)
|
||||
SO=so
|
||||
;;
|
||||
esac
|
||||
for arg in $ICONVLIB; do
|
||||
case "$arg" in
|
||||
-L*) ic_libdir="$ic_libdir `echo $arg | sed s/-L//`" ;;
|
||||
-l*) ic_libname=`echo $arg | sed s/-l//` ;;
|
||||
/*.$SO*) ICONVSOFILE=$arg ;;
|
||||
esac
|
||||
done
|
||||
if test "$ICONVSOFILE" = ""; then
|
||||
if test "$ic_libname" = ""; then
|
||||
AC_MSG_RESULT(unknown)
|
||||
AC_MSG_WARN([use --with-iconv-sofile for specifying iconv shared library file])
|
||||
ICONVSOFILE=none
|
||||
else
|
||||
if test "$ic_libdir" = ""; then
|
||||
# Standard (and semi-standard) library directories
|
||||
ic_libdir="/lib /usr/lib /usr/local/lib"
|
||||
fi
|
||||
for dir in $ic_libdir; do
|
||||
ICONVSOFILE=`ls -r $dir/lib$ic_libname.$SO* 2>/dev/null | head -1`
|
||||
if test "$ICONVSOFILE" != ""; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test "$ICONVSOFILE" != ""; then
|
||||
AC_MSG_RESULT($ICONVSOFILE)
|
||||
else
|
||||
AC_MSG_RESULT(unknown)
|
||||
AC_MSG_WARN([use --with-iconv-sofile for specifying iconv shared library file])
|
||||
ICONVSOFILE=none
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
else
|
||||
ICONVSOFILE=none
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if test "$liteonly" = yes ; then
|
||||
AC_MSG_ERROR([you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support.])
|
||||
fi
|
||||
ICONVSOFILE=$iconv_file
|
||||
;;
|
||||
esac
|
||||
AC_SUBST(ICONVSOFILE)
|
||||
|
||||
dnl Figure out preload stuff.
|
||||
PRELOAD_VAR="LD_PRELOAD"
|
||||
PRELOAD_SEP=":"
|
||||
PRELOAD_LAST=""
|
||||
case "$host" in
|
||||
*-solaris*)
|
||||
PRELOAD_SEP=" "
|
||||
;;
|
||||
*-linux*)
|
||||
PRELOAD_SEP=" "
|
||||
;;
|
||||
*-osf*)
|
||||
PRELOAD_VAR="_RLD_LIST"
|
||||
PRELOAD_LAST=":DEFAULT"
|
||||
;;
|
||||
*-netbsd*)
|
||||
if test -x /usr/bin/file -a -x /usr/bin/grep ; then
|
||||
case "`/usr/bin/file /usr/bin/grep`" in
|
||||
*ELF*)
|
||||
PRELOAD_SEP=" "
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST(PRELOAD_VAR)
|
||||
AC_SUBST(PRELOAD_SEP)
|
||||
AC_SUBST(PRELOAD_LAST)
|
||||
|
||||
dnl Checks for standard tools.
|
||||
AC_PROG_CC
|
||||
AC_PROG_INSTALL
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
AC_PATH_PROGS(PERL, perl, perl)
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_CHECK_HEADERS(unistd.h locale.h langinfo.h pwd.h)
|
||||
if test "$install_runidn" = yes ; then
|
||||
AC_CHECK_HEADERS(dlfcn.h)
|
||||
fi
|
||||
|
||||
saved_CPPFLAGS=$CPPFLAGS
|
||||
CPPFLAGS="$CPPFLAGS $ICONVINC"
|
||||
if test "$liteonly" != yes ; then
|
||||
AC_CHECK_HEADER(iconv.h, , [AC_MSG_ERROR([iconv.h doesn't exist])])
|
||||
fi
|
||||
CPPFLAGS=$saved_CPPFLAGS
|
||||
|
||||
dnl Checks for data types.
|
||||
AC_TYPE_UID_T
|
||||
dnl for dnsproxy.
|
||||
AC_CHECK_TYPE(BOOL, int)
|
||||
|
||||
dnl Checks for libraries.
|
||||
if test "$install_runidn" = yes ; then
|
||||
AC_CHECK_LIB(socket, socket)
|
||||
AC_CHECK_LIB(nsl, inet_addr)
|
||||
AC_CHECK_LIB(dl, dlopen, [
|
||||
LIBS="-ldl $LIBS"
|
||||
LIBDL="-ldl"
|
||||
AC_DEFINE(HAVE_LIBDL, 1, [Define if you have the dl library (-ldl).])
|
||||
AC_SUBST(LIBDL)
|
||||
])
|
||||
fi
|
||||
|
||||
dnl Checks for library functions.
|
||||
AC_CHECK_FUNCS(vsnprintf setvbuf setlocale nl_langinfo memmove bcopy setenv \
|
||||
unsetenv)
|
||||
if test "$install_runidn" = yes ; then
|
||||
AC_CHECK_FUNCS(gethostbyname gethostbyname2 gethostbyaddr)
|
||||
AC_CHECK_FUNCS(gethostbyname_r gethostbyname2_r gethostbyaddr_r, find_gethost_r=yes)
|
||||
AC_CHECK_FUNCS(getipnodebyname getipnodebyaddr freehostent)
|
||||
AC_CHECK_FUNCS(getaddrinfo freeaddrinfo getnameinfo)
|
||||
AC_CHECK_FUNCS(dlopen dlsym)
|
||||
fi
|
||||
|
||||
if test "$install_runidn" = yes ; then
|
||||
dnl Checks the flavor of gethostbyaddr* functions.
|
||||
AC_CACHE_CHECK(flavor of gethostbyaddr, ac_cv_flavor_gethostbyaddr,
|
||||
[ac_cv_flavor_gethostbyaddr=unknown
|
||||
AC_TRY_RUN(
|
||||
[
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type) {
|
||||
return NULL;
|
||||
}
|
||||
int main() {
|
||||
(void)gethostbyaddr(NULL, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
], ac_cv_flavor_gethostbyaddr=glibc2_2,,
|
||||
ac_cv_flavor_gethostbyaddr=unknown)
|
||||
AC_TRY_RUN(
|
||||
[
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
struct hostent *gethostbyaddr(const char *addr, size_t len, int type) {
|
||||
return NULL;
|
||||
}
|
||||
int main() {
|
||||
(void)gethostbyaddr(NULL, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
], ac_cv_flavor_gethostbyaddr=glibc,,
|
||||
ac_cv_flavor_gethostbyaddr=unknown)
|
||||
AC_TRY_RUN(
|
||||
[
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
struct hostent *gethostbyaddr(const char *addr, int len, int type) {
|
||||
return NULL;
|
||||
}
|
||||
int main() {
|
||||
(void)gethostbyaddr(NULL, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
], ac_cv_flavor_gethostbyaddr=traditional,,
|
||||
ac_cv_flavor_gethostbyaddr=unknown)
|
||||
if test "$ac_cv_func_gethostbyaddr" = no ; then
|
||||
ac_cv_flavor_gethostbyaddr=none
|
||||
fi])
|
||||
|
||||
case "$ac_cv_flavor_gethostbyaddr" in
|
||||
glibc2_2)
|
||||
ac_cv_type_ghba_addr_t='const void *'
|
||||
ac_cv_type_ghba_addrlen_t='socklen_t'
|
||||
;;
|
||||
glibc)
|
||||
ac_cv_type_ghba_addr_t='const char *'
|
||||
ac_cv_type_ghba_addrlen_t='size_t'
|
||||
;;
|
||||
traditional | none)
|
||||
ac_cv_type_ghba_addr_t='const char *'
|
||||
ac_cv_type_ghba_addrlen_t='int'
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([can't build runidn, since parameter type list of gethostbyaddr() is unknown to configure.])
|
||||
;;
|
||||
esac
|
||||
AC_DEFINE_UNQUOTED(GHBA_ADDR_T, $ac_cv_type_ghba_addr_t,
|
||||
[Define as the type of the 1st argument of gethostbyaddr.])
|
||||
AC_DEFINE_UNQUOTED(GHBA_ADDRLEN_T, $ac_cv_type_ghba_addrlen_t,
|
||||
[Define as the type of the 2nd argument of gethostbyaddr.])
|
||||
|
||||
dnl Checks the flavor of getnameinfo functions.
|
||||
AC_CACHE_CHECK(flavor of getnameinfo, ac_cv_flavor_getnameinfo,
|
||||
[ac_cv_flavor_getnameinfo=unknown
|
||||
AC_TRY_RUN(
|
||||
[
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host,
|
||||
socklen_t hostlen, char *serv, socklen_t servlen,
|
||||
unsigned int flags) {
|
||||
return NULL;
|
||||
}
|
||||
int main() {
|
||||
(void)getnameinfo(NULL, 0, NULL, 0, NULL, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
], ac_cv_flavor_getnameinfo=glibc2_2_2,,
|
||||
ac_cv_flavor_getnameinfo=unknown)
|
||||
AC_TRY_RUN(
|
||||
[
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host,
|
||||
socklen_t hostlen, char *serv, socklen_t servlen,
|
||||
int flags) {
|
||||
return NULL;
|
||||
}
|
||||
int main() {
|
||||
(void)getnameinfo(NULL, 0, NULL, 0, NULL, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
], ac_cv_flavor_getnameinfo=rfc2553bis_03,,
|
||||
ac_cv_flavor_getnameinfo=unknown)
|
||||
AC_TRY_RUN(
|
||||
[
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host,
|
||||
size_t hostlen, char *serv, size_t servlen, int flags) {
|
||||
return NULL;
|
||||
}
|
||||
int main() {
|
||||
(void)getnameinfo(NULL, 0, NULL, 0, NULL, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
], ac_cv_flavor_getnameinfo=rfc2553,,
|
||||
ac_cv_flavor_getnameinfo=unknown)
|
||||
AC_TRY_RUN(
|
||||
[
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
int getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
|
||||
size_t hostlen, char *serv, size_t servlen, int flags) {
|
||||
return NULL;
|
||||
}
|
||||
int main() {
|
||||
(void)getnameinfo(NULL, 0, NULL, 0, NULL, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
], ac_cv_flavor_getnameinfo=rfc2133,,
|
||||
ac_cv_flavor_getnameinfo=unknown)
|
||||
if test "$ac_cv_func_getnameinfo" = no ; then
|
||||
ac_cv_flavor_getnameinfo=none
|
||||
fi])
|
||||
|
||||
case "$ac_cv_flavor_getnameinfo" in
|
||||
glibc2_2_2)
|
||||
ac_cv_type_gni_salen_t='socklen_t'
|
||||
ac_cv_type_gni_hostlen_t='socklen_t'
|
||||
ac_cv_type_gni_servlen_t='socklen_t'
|
||||
ac_cv_type_gni_flags_t='unsigned int'
|
||||
;;
|
||||
rfc2553bis_03)
|
||||
ac_cv_type_gni_salen_t='socklen_t'
|
||||
ac_cv_type_gni_hostlen_t='socklen_t'
|
||||
ac_cv_type_gni_servlen_t='socklen_t'
|
||||
ac_cv_type_gni_flags_t='int'
|
||||
;;
|
||||
rfc2553)
|
||||
ac_cv_type_gni_salen_t='socklen_t'
|
||||
ac_cv_type_gni_hostlen_t='size_t'
|
||||
ac_cv_type_gni_servlen_t='size_t'
|
||||
ac_cv_type_gni_flags_t='int'
|
||||
;;
|
||||
rfc2133 | none)
|
||||
ac_cv_type_gni_salen_t='size_t'
|
||||
ac_cv_type_gni_hostlen_t='size_t'
|
||||
ac_cv_type_gni_servlen_t='size_t'
|
||||
ac_cv_type_gni_flags_t='int'
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([can't build runidn, since parameter type list of getnameinfo() is unknown to configure.])
|
||||
esac
|
||||
AC_DEFINE_UNQUOTED(GNI_SALEN_T, $ac_cv_type_gni_salen_t,
|
||||
[Define as the type of the 2nd argument of getnameinfo.])
|
||||
AC_DEFINE_UNQUOTED(GNI_HOSTLEN_T, $ac_cv_type_gni_hostlen_t,
|
||||
[Define as the type of the 4th argument of getnameinfo.])
|
||||
AC_DEFINE_UNQUOTED(GNI_SERVLEN_T, $ac_cv_type_gni_servlen_t,
|
||||
[Define as the type of the 6th argument of getnameinfo.])
|
||||
AC_DEFINE_UNQUOTED(GNI_FLAGS_T, $ac_cv_type_gni_flags_t,
|
||||
[Define as the type of the 7th argument of getnameinfo.])
|
||||
fi
|
||||
|
||||
dnl resume here.
|
||||
dnl Checks the flavor of gethost*_r functions.
|
||||
if test "$find_gethost_r" = yes; then
|
||||
AC_CACHE_CHECK(flavor of gethostbyname_r, ac_cv_flavor_gethost_r,
|
||||
[AC_TRY_RUN(
|
||||
changequote(<<, >>)dnl
|
||||
<<
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
#include <stdio.h>
|
||||
int main()
|
||||
{
|
||||
int err = 0;
|
||||
struct hostent hebuf, *hp;
|
||||
char buf[10];
|
||||
/* Try resolving a invalid name using glibc flavor. */
|
||||
(void)gethostbyname_r("@#!", &hebuf, buf, sizeof(buf), &hp, &err);
|
||||
if (err != 0)
|
||||
return 0; /* glibc flavor */
|
||||
else
|
||||
return 1; /* Sun flavor */
|
||||
}
|
||||
>>,
|
||||
changequote([, ])dnl
|
||||
ac_cv_flavor_gethost_r=glibc,
|
||||
ac_cv_flavor_gethost_r=sun,
|
||||
ac_cv_flavor_gethost_r=sun)])
|
||||
if test "$ac_cv_flavor_gethost_r" = "glibc"; then
|
||||
AC_DEFINE(GETHOST_R_GLIBC_FLAVOR, 1,
|
||||
[Define if the prototype of gethost*_r is glibc flavor.])
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Find system shared object paths.
|
||||
AC_FIND_SYSTEM_SHOBJ(libc)
|
||||
if test "$install_runidn" = yes ; then
|
||||
AC_FIND_SYSTEM_SHOBJ(libnsl)
|
||||
fi
|
||||
|
||||
dnl Checks for iconv library.
|
||||
if test "$liteonly" != yes ; then
|
||||
AC_MSG_CHECKING(for iconv)
|
||||
saved_CPPFLAGS=$CPPFLAGS
|
||||
saved_LIBS=$LIBS
|
||||
CPPFLAGS="$CPPFLAGS $ICONVINC"
|
||||
LIBS="$LIBS $ICONVLIB"
|
||||
AC_TRY_LINK([
|
||||
#include <iconv.h>
|
||||
], [
|
||||
iconv_t i;
|
||||
i = iconv_open("ISO-8859-1", "UTF-8");
|
||||
], [iconv_try_link=yes], [iconv_try_link=no])
|
||||
LIBS=$saved_LIBS
|
||||
CPPFLAGS=$saved_CPPFLAGS
|
||||
AC_MSG_RESULT($iconv_try_link)
|
||||
if test "$iconv_try_link" = no ; then
|
||||
AC_MSG_ERROR(iconv function not available)
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Check for codeset name for UTF-8.
|
||||
if test "$liteonly" != yes ; then
|
||||
AC_MSG_CHECKING([for codeset name $UTF8_NAME])
|
||||
saved_CPPFLAGS=$CPPFLAGS
|
||||
saved_LIBS=$LIBS
|
||||
CPPFLAGS="$CPPFLAGS $ICONVINC"
|
||||
LIBS="$LIBS $ICONVLIB"
|
||||
AC_TRY_RUN([
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <iconv.h>
|
||||
#define UTF8_NAME "$UTF8_NAME"
|
||||
#define ICONV_FAIL ((iconv_t)(-1))
|
||||
/* Check if the codeset name UTF8_NAME is valid by performing iconv_open(). */
|
||||
int main() {
|
||||
int i;
|
||||
/* list of codeset names likely to exist */
|
||||
static char *codeset[] = {
|
||||
"ASCII", "ISO-8859-1", "ISO8859-1", "iso8859_1", "8859-1",
|
||||
"Shift_JIS", "SJIS", "sjis", NULL,
|
||||
};
|
||||
|
||||
/* First try null conversion. */
|
||||
if (iconv_open(UTF8_NAME, UTF8_NAME) != ICONV_FAIL) return 0;
|
||||
|
||||
/* Unfortunately, above check fails on certain systems, such as Solaris. */
|
||||
for (i = 0; codeset[i] != NULL; i++) {
|
||||
if (iconv_open(UTF8_NAME, codeset[i]) != ICONV_FAIL) return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
], utf8_name_valid=yes, utf8_name_valid=no, utf8_name_valid=unknown)
|
||||
LIBS=$saved_LIBS
|
||||
CPPFLAGS=$saved_CPPFLAGS
|
||||
AC_MSG_RESULT($utf8_name_valid)
|
||||
fi
|
||||
|
||||
dnl Output.
|
||||
AC_CONFIG_HEADER(include/config.h)
|
||||
AC_OUTPUT(
|
||||
Makefile
|
||||
include/Makefile
|
||||
include/idn/Makefile
|
||||
include/mdn/Makefile
|
||||
lib/Makefile
|
||||
man/Makefile
|
||||
tools/Makefile
|
||||
tools/idnconv/Makefile
|
||||
tools/runidn/Makefile
|
||||
tools/runidn/runidn
|
||||
map/Makefile
|
||||
lib/tests/Makefile
|
||||
)
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
# $Id: Makefile.in,v 1.1 2003/06/04 00:25:33 marka Exp $
|
||||
# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
|
||||
#
|
||||
# By using this file, you agree to the terms and conditions set forth bellow.
|
||||
#
|
||||
# LICENSE TERMS AND CONDITIONS
|
||||
#
|
||||
# The following License Terms and Conditions apply, unless a different
|
||||
# license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
# Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
#
|
||||
# 1. Use, Modification and Redistribution (including distribution of any
|
||||
# modified or derived work) in source and/or binary forms is permitted
|
||||
# under this License Terms and Conditions.
|
||||
#
|
||||
# 2. Redistribution of source code must retain the copyright notices as they
|
||||
# appear in each source code file, this License Terms and Conditions.
|
||||
#
|
||||
# 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
# this License Terms and Conditions, in the documentation and/or other
|
||||
# materials provided with the distribution. For the purposes of binary
|
||||
# distribution the "Copyright Notice" refers to the following language:
|
||||
# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
#
|
||||
# 4. The name of JPNIC may not be used to endorse or promote products
|
||||
# derived from this Software without specific prior written approval of
|
||||
# JPNIC.
|
||||
#
|
||||
# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
SUBDIRS = idn mdn
|
||||
|
||||
all: all-subdirs
|
||||
install: install-subdirs
|
||||
clean: clean-subdirs
|
||||
distclean: distclean-localdir distclean-subdirs
|
||||
check test: test-subdirs
|
||||
|
||||
all-subdirs install-subdirs clean-subdirs distclean-subdirs test-subdirs:
|
||||
@target=`echo $@ | sed 's/-subdirs$$//'`; \
|
||||
for d in $(SUBDIRS); do \
|
||||
(cd $$d; $(MAKE) DESTDIR=$(DESTDIR) $$target); \
|
||||
done
|
||||
|
||||
distclean-localdir:
|
||||
rm -f config.h Makefile
|
||||
|
|
@ -1,181 +0,0 @@
|
|||
/* include/config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
/* $Id: config.h.in,v 1.1 2003/06/04 00:25:34 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2000 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#undef gid_t
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#undef uid_t
|
||||
|
||||
/* Define as an appropriate type (ex. int) if your system doesn't have. */
|
||||
#undef BOOL
|
||||
|
||||
/* Define if you have the bcopy function. */
|
||||
#undef HAVE_BCOPY
|
||||
|
||||
/* Define if you have the dlopen function. */
|
||||
#undef HAVE_DLOPEN
|
||||
|
||||
/* Define if you have the dlsym function. */
|
||||
#undef HAVE_DLSYM
|
||||
|
||||
/* Define if you have the freeaddrinfo function. */
|
||||
#undef HAVE_FREEADDRINFO
|
||||
|
||||
/* Define if you have the freehostent function. */
|
||||
#undef HAVE_FREEHOSTENT
|
||||
|
||||
/* Define if you have the getaddrinfo function. */
|
||||
#undef HAVE_GETADDRINFO
|
||||
|
||||
/* Define if you have the gethostbyaddr function. */
|
||||
#undef HAVE_GETHOSTBYADDR
|
||||
|
||||
/* Define if you have the gethostbyaddr_r function. */
|
||||
#undef HAVE_GETHOSTBYADDR_R
|
||||
|
||||
/* Define if you have the gethostbyname function. */
|
||||
#undef HAVE_GETHOSTBYNAME
|
||||
|
||||
/* Define if you have the gethostbyname2 function. */
|
||||
#undef HAVE_GETHOSTBYNAME2
|
||||
|
||||
/* Define if you have the gethostbyname2_r function. */
|
||||
#undef HAVE_GETHOSTBYNAME2_R
|
||||
|
||||
/* Define if you have the gethostbyname_r function. */
|
||||
#undef HAVE_GETHOSTBYNAME_R
|
||||
|
||||
/* Define if you have the getipnodebyaddr function. */
|
||||
#undef HAVE_GETIPNODEBYADDR
|
||||
|
||||
/* Define if you have the getipnodebyname function. */
|
||||
#undef HAVE_GETIPNODEBYNAME
|
||||
|
||||
/* Define if you have the getnameinfo function. */
|
||||
#undef HAVE_GETNAMEINFO
|
||||
|
||||
/* Define if you have the memmove function. */
|
||||
#undef HAVE_MEMMOVE
|
||||
|
||||
/* Define if you have the nl_langinfo function. */
|
||||
#undef HAVE_NL_LANGINFO
|
||||
|
||||
/* Define if you have the setenv function. */
|
||||
#undef HAVE_SETENV
|
||||
|
||||
/* Define if you have the setlocale function. */
|
||||
#undef HAVE_SETLOCALE
|
||||
|
||||
/* Define if you have the setvbuf function. */
|
||||
#undef HAVE_SETVBUF
|
||||
|
||||
/* Define if you have the unsetenv function. */
|
||||
#undef HAVE_UNSETENV
|
||||
|
||||
/* Define if you have the vsnprintf function. */
|
||||
#undef HAVE_VSNPRINTF
|
||||
|
||||
/* Define if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define if you have the <langinfo.h> header file. */
|
||||
#undef HAVE_LANGINFO_H
|
||||
|
||||
/* Define if you have the <locale.h> header file. */
|
||||
#undef HAVE_LOCALE_H
|
||||
|
||||
/* Define if you have the <pwd.h> header file. */
|
||||
#undef HAVE_PWD_H
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define if you have the nsl library (-lnsl). */
|
||||
#undef HAVE_LIBNSL
|
||||
|
||||
/* Define if you have the socket library (-lsocket). */
|
||||
#undef HAVE_LIBSOCKET
|
||||
|
||||
/* Define if --enable-mdnkit-compat is specified */
|
||||
#undef ENABLE_MDNKIT_COMPAT
|
||||
|
||||
/* Define if you want additional ACE converters compiled in. */
|
||||
#undef IDN_EXTRA_ACE
|
||||
|
||||
/* Define if your iconv() does not accept UTF-8 as the codeset name for utf-8. */
|
||||
#undef IDN_UTF8_ENCODING_NAME
|
||||
|
||||
/* Define if you have the dl library (-ldl). */
|
||||
#undef HAVE_LIBDL
|
||||
|
||||
/* Define as the type of the 1st argument of gethostbyaddr. */
|
||||
#undef GHBA_ADDR_T
|
||||
|
||||
/* Define as the type of the 2nd argument of gethostbyaddr. */
|
||||
#undef GHBA_ADDRLEN_T
|
||||
|
||||
/* Define as the type of the 2nd argument of getnameinfo. */
|
||||
#undef GNI_SALEN_T
|
||||
|
||||
/* Define as the type of the 4th argument of getnameinfo. */
|
||||
#undef GNI_HOSTLEN_T
|
||||
|
||||
/* Define as the type of the 6th argument of getnameinfo. */
|
||||
#undef GNI_SERVLEN_T
|
||||
|
||||
/* Define as the type of the 7th argument of getnameinfo. */
|
||||
#undef GNI_FLAGS_T
|
||||
|
||||
/* Define if the prototype of gethost*_r is glibc flavor. */
|
||||
#undef GETHOST_R_GLIBC_FLAVOR
|
||||
|
||||
/* Define as the pathname of the shared libc object if your system has one. */
|
||||
#undef SOPATH_LIBC
|
||||
|
||||
/* Define as the pathname of the shared libnsl object if your system has one. */
|
||||
#undef SOPATH_LIBNSL
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
/* $Id: config.h.win,v 1.1 2003/06/04 00:25:34 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2000 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
/* for enabling RACE */
|
||||
#define IDN_EXTRA_ACE
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
# $Id: Makefile.in,v 1.1 2003/06/04 00:25:34 marka Exp $
|
||||
# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
|
||||
#
|
||||
# By using this file, you agree to the terms and conditions set forth bellow.
|
||||
#
|
||||
# LICENSE TERMS AND CONDITIONS
|
||||
#
|
||||
# The following License Terms and Conditions apply, unless a different
|
||||
# license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
# Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
#
|
||||
# 1. Use, Modification and Redistribution (including distribution of any
|
||||
# modified or derived work) in source and/or binary forms is permitted
|
||||
# under this License Terms and Conditions.
|
||||
#
|
||||
# 2. Redistribution of source code must retain the copyright notices as they
|
||||
# appear in each source code file, this License Terms and Conditions.
|
||||
#
|
||||
# 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
# this License Terms and Conditions, in the documentation and/or other
|
||||
# materials provided with the distribution. For the purposes of binary
|
||||
# distribution the "Copyright Notice" refers to the following language:
|
||||
# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
#
|
||||
# 4. The name of JPNIC may not be used to endorse or promote products
|
||||
# derived from this Software without specific prior written approval of
|
||||
# JPNIC.
|
||||
#
|
||||
# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
includedir = @includedir@
|
||||
idnincludedir = $(includedir)/idn
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
MKINSTALLDIRS = @top_srcdir@/mkinstalldirs
|
||||
SHELL = @SHELL@
|
||||
|
||||
HDRS = \
|
||||
api.h \
|
||||
assert.h \
|
||||
checker.h \
|
||||
converter.h \
|
||||
debug.h \
|
||||
delimitermap.h \
|
||||
export.h \
|
||||
filechecker.h \
|
||||
filemapper.h \
|
||||
localencoding.h \
|
||||
log.h \
|
||||
logmacro.h \
|
||||
mapper.h \
|
||||
mapselector.h \
|
||||
nameprep.h \
|
||||
normalizer.h \
|
||||
punycode.h \
|
||||
race.h \
|
||||
res.h \
|
||||
resconf.h \
|
||||
result.h \
|
||||
strhash.h \
|
||||
ucsmap.h \
|
||||
ucsset.h \
|
||||
unicode.h \
|
||||
unormalize.h \
|
||||
ucs4.h \
|
||||
utf8.h \
|
||||
util.h \
|
||||
version.h
|
||||
|
||||
all:
|
||||
|
||||
install:
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(idnincludedir)
|
||||
for hdr in $(HDRS); do \
|
||||
$(INSTALL_DATA) $(srcdir)/$$hdr $(DESTDIR)$(idnincludedir)/$$hdr; \
|
||||
done
|
||||
|
||||
clean:
|
||||
rm -f *~
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile
|
||||
|
||||
test check:
|
||||
|
|
@ -1,114 +0,0 @@
|
|||
/* $Id: aliaslist.h,v 1.1 2003/06/04 00:25:34 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2002 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_ALIASLIST_H
|
||||
#define IDN_ALIASLIST_H 1
|
||||
|
||||
#include <idn/result.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct idn__aliaslist *idn__aliaslist_t;
|
||||
|
||||
/*
|
||||
* Create a list.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
extern idn_result_t
|
||||
idn__aliaslist_create(idn__aliaslist_t *listp);
|
||||
|
||||
/*
|
||||
* Delete a list created by 'idn__aliaslist_create'.
|
||||
*/
|
||||
extern void
|
||||
idn__aliaslist_destroy(idn__aliaslist_t list);
|
||||
|
||||
/*
|
||||
* Parse alias information file and set items to the list.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nofile -- no such file.
|
||||
* idn_invalid_syntax -- file is malformed.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
extern idn_result_t
|
||||
idn__aliaslist_aliasfile(idn__aliaslist_t list, const char *path);
|
||||
|
||||
/*
|
||||
* Add an item to the list.
|
||||
*
|
||||
* If top is 0, item is placed as the last item of the alias list.
|
||||
* Otherwise, it is done as the first item.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
extern idn_result_t
|
||||
idn__aliaslist_additem(idn__aliaslist_t list,
|
||||
const char *pattern, const char *encoding,
|
||||
int first_item);
|
||||
|
||||
/*
|
||||
* Find the encoding name with the specified pattern by wildcard
|
||||
* match.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok. found.
|
||||
* idn_noentry -- not found.
|
||||
*/
|
||||
extern idn_result_t
|
||||
idn__aliaslist_find(idn__aliaslist_t list,
|
||||
const char *pattern, char **encodingp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IDN_ALIASLIST_H */
|
||||
|
|
@ -1,298 +0,0 @@
|
|||
/* $Id: api.h,v 1.1 2003/06/04 00:25:35 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2001,2002 Japan Network Information Center.
|
||||
* All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_API_H
|
||||
#define IDN_API_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <idn/export.h>
|
||||
#include <idn/result.h>
|
||||
#include <idn/res.h>
|
||||
|
||||
/*
|
||||
* Application Programming Interface for Internationalized Domain Name
|
||||
* Handling. This module provides high-level APIs for ordinary applications.
|
||||
* Low-level APIs are also available. See "res.h" for details.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Enable or disable IDN conversion scheme.
|
||||
*
|
||||
* If on_off is 0, IDN conversion scheme is disabled. Otherwise, IDN
|
||||
* conversion is enabled even when IDN_DISABLE is defined.
|
||||
*/
|
||||
IDN_EXPORT void
|
||||
idn_enable(int on_off);
|
||||
|
||||
/*
|
||||
* Set configuration file name.
|
||||
* This function is for private use only.
|
||||
*
|
||||
* When idn_nameinit(1) is called, this module loads `file'.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomemory -- malloc failed.
|
||||
* idn_failure -- idn_nameinit() has already been
|
||||
* called.
|
||||
*/
|
||||
extern idn_result_t
|
||||
idn__setconffile(const char *file);
|
||||
|
||||
/*
|
||||
* Initialize this module, and load configuration from the default
|
||||
* configuration file (idn.conf).
|
||||
*
|
||||
* The initialization will be done only once when this function is
|
||||
* called first, while either loading of the configuration file or
|
||||
* setting the defaults behavior without the configuration file will
|
||||
* be done every time it is called.
|
||||
*
|
||||
* If load_file is 0, this will set the defaults behavior without the
|
||||
* configuration file. Otherwise, loading of the configuration file
|
||||
* occurs.
|
||||
*
|
||||
* If 'idn_encodename' or 'idn_decodename' is called without calling
|
||||
* this function, implicit initialization without the configuration
|
||||
* file will be done prior to encoding/decoding process.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nofile -- cannot open the configuration file.
|
||||
* idn_invalid_syntax -- syntax error found in the file.
|
||||
* idn_invalid_name -- there are invalid names (encoding,
|
||||
* normalization etc.).
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_nameinit(int load_file);
|
||||
|
||||
/*
|
||||
* Encode internationalized domain name.
|
||||
*
|
||||
* The encoding process consists of the following 7 steps.
|
||||
*
|
||||
* 1. Local encoding to UTF-8 conversion
|
||||
* Converts a domain name written with local encoding (e.g. ISO-
|
||||
* 8859-1) to UTF-8.
|
||||
* 2. Delimiter mapping,
|
||||
* Maps certain characters to period (U+002E, FULL STOP).
|
||||
* 3. Local mapping
|
||||
* Apply character mappings according with the TLD of the domain
|
||||
* name.
|
||||
* 4. NAMEPREP
|
||||
* Perform NAME preparation described in RFC3491.
|
||||
* This step consists of the following 4 steps:
|
||||
* 4.1. Mapping
|
||||
* 4.2. Normalization
|
||||
* 4.3. Prohibited character check
|
||||
* 4.4. Unassigned check
|
||||
* 5. ASCII range character check
|
||||
* Checks if the domain name contains non-LDH ASCII character (not
|
||||
* alpha-numeric or hypen), or it begins or end with hypen.
|
||||
* 6. UTF-8 to IDN encoding conversion.
|
||||
* Converts the domain name from UTF-8 to ACE (e.g. Punycode).
|
||||
* 7. Length check
|
||||
* Checks the length of each label.
|
||||
*
|
||||
* 'actions' specifies actions and options of the encoding procedure.
|
||||
* Its value is a bitwise-or of the following flags:
|
||||
*
|
||||
* IDN_LOCALCONV -- perform local encoding to UTF-8 conversion (step 1)
|
||||
* IDN_DELIMMAP -- perform delimiter mapping (step 2)
|
||||
* IDN_LOCALMAP -- perform local mapping (step 3)
|
||||
* IDN_MAP -- perform mapping (step 4.1)
|
||||
* IDN_NORMALIZE -- perform normalization (step 4.2)
|
||||
* IDN_PROHCHECK -- perform prohibited character check (step 4.3)
|
||||
* IDN_UNASCHECK -- perform unassigned codepoint check (step 4.4)
|
||||
* IDN_ASCCHECK -- perform ASCII range character check (step 5)
|
||||
* IDN_IDNCONV -- perform UTF-8 to IDN encoding conversion (step 6)
|
||||
* IDN_LENCHECK -- perform length check (step 7)
|
||||
*
|
||||
* Also the following flags are provided for convinience:
|
||||
*
|
||||
* IDN_ENCODE_QUERY -- On libidnkit, perform step 1..7, except for step
|
||||
* 4.4 and 5.
|
||||
* On libidnkitlite, perform step 2..7, except for
|
||||
* step 4.4 and 5.
|
||||
* IDN_ENCODE_STORED -- On libidnkit, perform step 1..7, except for step
|
||||
* 5.
|
||||
* On libidnkitlite, perform step 2..7, except for
|
||||
* step 5.
|
||||
* IDN_ENCODE_APP -- Same as IDN_ENCODE_QUERY.
|
||||
* IDN_NAMEPREP -- perform NAMEPREP (step 4) without unassigned
|
||||
* codepoint check (step 4.4).
|
||||
*
|
||||
* The following flag does not corresponding to a particular action,
|
||||
* but an option of conversion process:
|
||||
*
|
||||
* IDN_UNDOIFERR -- If any step fails, the original input name is
|
||||
* returned.
|
||||
*
|
||||
* Note that if no flags are specified, 'idn_encodename' does nothing
|
||||
* fancy, just copies the given name verbatim.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_invalid_action -- invalid action flag specified.
|
||||
* idn_invalid_encoding -- the given string has invalid/illegal
|
||||
* byte sequence.
|
||||
* idn_invalid_length -- invalid length of a label.
|
||||
* idn_prohibited -- prohibited/unassigned code point found.
|
||||
* idn_buffer_overflow -- 'tolen' is too small.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*
|
||||
* Also, if this function is called without calling 'idn_nameinit',
|
||||
* the following error codes might be returned.
|
||||
* idn_nofile -- cannot open the configuration file.
|
||||
* idn_invalid_syntax -- syntax error found in the file.
|
||||
* idn_invalid_name -- there are invalid names (encoding,
|
||||
* normalization etc.).
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_encodename(idn_action_t actions, const char *from, char *to, size_t tolen);
|
||||
|
||||
/*
|
||||
* Decode internationalized domain name.
|
||||
*
|
||||
* The decoding process consists of the following 5 steps.
|
||||
*
|
||||
* 1. delimiter mapping
|
||||
* Maps certain characters to period (U+002E, FULL STOP).
|
||||
* 2. NAMEPREP
|
||||
* Perform NAME preparation described in RFC3491.
|
||||
* This step consists of the following 4 steps:
|
||||
* 2.1. Mapping
|
||||
* 2.2. Normalization
|
||||
* 2.3. Prohibited character check
|
||||
* 2.4. Unassigned check
|
||||
* 3. IDN encoding to UTF-8 conversion.
|
||||
* Converts the domain name from ACE (e.g. Punycode) to UCS4.
|
||||
* 4. Perform round-trip check.
|
||||
* Encode the result of step 3, and then compare it with the result
|
||||
* of the step 2. If they are different, the check is failed.
|
||||
* 5. Convert UTF-8 to local encoding.
|
||||
* If a character in the domain name cannot be converted to local
|
||||
* encoding, the conversion is failed.
|
||||
*
|
||||
* 'actions' specifies actions of the decoding procedure.
|
||||
* Its value is a bitwise-or of the following flags:
|
||||
*
|
||||
* IDN_DELIMMAP -- perform delimiter mapping (step 1)
|
||||
* IDN_MAP -- perform mapping (step 2.1)
|
||||
* IDN_NORMALIZE -- perform normalization (step 2.2)
|
||||
* IDN_PROHCHECK -- perform prohibited character check (step 2.3)
|
||||
* IDN_UNASCHECK -- perform unassigned codepoint check (step 2.4)
|
||||
* IDN_IDNCONV -- perform IDN encoding to UTF-8 conversion (step 3)
|
||||
* IDN_RTCHECK -- perform round-trip check (step 4)
|
||||
* IDN_ASCCHECK -- perform ASCII range character check while
|
||||
* round-trip check (step 4.1)
|
||||
* IDN_LOCALCONV -- perform UTF-8 to local encoding conversion (step 5)
|
||||
*
|
||||
* Also the following flags are provided for the convenience:
|
||||
*
|
||||
* IDN_DECODE_QUERY -- On libidnkit, perform step 1..5, except for step
|
||||
* 2.4 and 4.1.
|
||||
* On libidnkitlite, perform step 1..3, except for
|
||||
* step 2.4 and 4.1.
|
||||
* IDN_DECODE_STORED -- On libidnkit, perform step 1..5, except for step
|
||||
* 4.1.
|
||||
* On libidnkitlite, perform step 1..3, except for
|
||||
* step 4.1.
|
||||
* IDN_DECODE_APP -- Same as IDN_DECODE_QUERY.
|
||||
* IDN_NAMEPREP -- perform NAMEPREP (step 2) without unassigned
|
||||
* codepoint check (step 2.4).
|
||||
*
|
||||
* If any step fails, the original input name is returned.
|
||||
* 'actions' specifies what actions to take when decoding, and is
|
||||
* a bitwise-or of the following flags:
|
||||
*
|
||||
* Note that if no flags are specified, 'idn_decodename' does nothing
|
||||
* but copying the given name verbatim.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_invalid_action -- invalid action flag specified.
|
||||
* idn_invalid_encoding -- the given string has invalid/illegal
|
||||
* byte sequence.
|
||||
* idn_buffer_overflow -- 'tolen' is too small.
|
||||
* idn_invalid_length -- length of a label is not 1..63 characters.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*
|
||||
* Also, if this function is called without calling 'idn_nameinit',
|
||||
* the following error codes might be returned.
|
||||
* idn_nofile -- cannot open the configuration file.
|
||||
* idn_invalid_syntax -- syntax error found in the file.
|
||||
* idn_invalid_name -- there are invalid names (encoding,
|
||||
* normalization etc.).
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_decodename(idn_action_t actions, const char *from, char *to, size_t tolen);
|
||||
|
||||
/*
|
||||
* Decode internationalized domain name with auxiliary encoding
|
||||
* support.
|
||||
*
|
||||
* This is another API for IDN string decode. The difference between
|
||||
* two is whether the encoding conversion from auxiliary encoding to
|
||||
* UTF-8 occurs prior to the actual decode process (read description
|
||||
* of idn_res_decodename() above) or not.
|
||||
*
|
||||
* If auxencoding is NULL, from is treated as UTF-8 encoded string.
|
||||
*
|
||||
* Other arguments serve exactly same role as those of
|
||||
* idn_res_decodename().
|
||||
*/
|
||||
idn_result_t
|
||||
idn_decodename2(idn_action_t actions, const char *from, char *to, size_t tolen,
|
||||
const char *auxencoding);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IDN_API_H */
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
/* $Id: assert.h,v 1.1 2003/06/04 00:25:35 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2000 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_ASSERT_H
|
||||
#define IDN_ASSERT_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#ifndef DEBUG
|
||||
#define NDEBUG
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
# endif /* IDN_ASSERT_H */
|
||||
|
|
@ -1,171 +0,0 @@
|
|||
/* $Id: checker.h,v 1.1 2003/06/04 00:25:36 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2001 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_CHECKER_H
|
||||
#define IDN_CHECKER_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Character Checker.
|
||||
*
|
||||
* Perfom checking characters in the specified domain name.
|
||||
*/
|
||||
|
||||
#include <idn/result.h>
|
||||
#include <idn/filechecker.h>
|
||||
#include <idn/nameprep.h>
|
||||
|
||||
/*
|
||||
* Schems name prefixes for the standard nameprep prohibit/unassigned
|
||||
* checks.
|
||||
*
|
||||
* If you'd like to add the unassigned check scheme of "RFC3491"
|
||||
* to a checker context, IDN_CHECKER_UNASSIGNED_PREFIX + "RFC3491"
|
||||
* (i.e. "unassigned#RFC3491") is the scheme name passed to
|
||||
* idn_checker_add().
|
||||
*/
|
||||
#define IDN_CHECKER_PROHIBIT_PREFIX "prohibit#"
|
||||
#define IDN_CHECKER_UNASSIGNED_PREFIX "unassigned#"
|
||||
#define IDN_CHECKER_BIDI_PREFIX "bidi#"
|
||||
|
||||
/*
|
||||
* Checker object type.
|
||||
*/
|
||||
typedef struct idn_checker *idn_checker_t;
|
||||
|
||||
/*
|
||||
* Initialize module. Must be called before any other calls of
|
||||
* the functions of this module.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
extern idn_result_t
|
||||
idn_checker_initialize(void);
|
||||
|
||||
/*
|
||||
* Create a checker context.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
extern idn_result_t
|
||||
idn_checker_create(idn_checker_t *ctxp);
|
||||
|
||||
/*
|
||||
* Decrement reference count of the checker `ctx' created by
|
||||
* 'idn_checker_create', if it is still refered by another object.
|
||||
* Otherwise, release all the memory allocated to the checker.
|
||||
*/
|
||||
extern void
|
||||
idn_checker_destroy(idn_checker_t ctx);
|
||||
|
||||
/*
|
||||
* Increment reference count of the checker `ctx' created by
|
||||
* 'idn_checker_create'.
|
||||
*/
|
||||
extern void
|
||||
idn_checker_incrref(idn_checker_t ctx);
|
||||
|
||||
/*
|
||||
* Add checking scheme `name' to the checker to `ctx'.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_invalid_name -- the given name is not valid.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
extern idn_result_t
|
||||
idn_checker_add(idn_checker_t ctx, const char *name);
|
||||
|
||||
extern idn_result_t
|
||||
idn_checker_addall(idn_checker_t ctx, const char **names, int nnames);
|
||||
|
||||
/*
|
||||
* Check a domain name. All checking schemes regsitered in `ctx' are
|
||||
* applied in the regisration order.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomemory -- malloc failed.
|
||||
* idn_buffer_overflow -- output buffer is too small.
|
||||
*/
|
||||
extern idn_result_t
|
||||
idn_checker_lookup(idn_checker_t ctx, const unsigned long *ucs4,
|
||||
const unsigned long **found);
|
||||
|
||||
/*
|
||||
* Checking procedure type.
|
||||
*/
|
||||
typedef idn_result_t (*idn_checker_createproc_t)(const char *parameter,
|
||||
void **ctxp);
|
||||
typedef void (*idn_checker_destroyproc_t)(void *ctx);
|
||||
typedef idn_result_t (*idn_checker_lookupproc_t)(void *ctx,
|
||||
const unsigned long *ucs4,
|
||||
const unsigned long **found);
|
||||
|
||||
/*
|
||||
* Register a new checking scheme.
|
||||
*
|
||||
* You can override the default normalization schemes, if you want.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
extern idn_result_t
|
||||
idn_checker_register(const char *prefix,
|
||||
idn_checker_createproc_t create,
|
||||
idn_checker_destroyproc_t destroy,
|
||||
idn_checker_lookupproc_t lookup);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IDN_CHECKER_H */
|
||||
|
|
@ -1,258 +0,0 @@
|
|||
/* $Id: converter.h,v 1.1 2003/06/04 00:25:36 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2000 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_CONVERTER_H
|
||||
#define IDN_CONVERTER_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Codeset converter.
|
||||
*
|
||||
* This module provides conversions from some local codeset to UCS4
|
||||
* and vice versa.
|
||||
*/
|
||||
|
||||
#include <idn/export.h>
|
||||
#include <idn/result.h>
|
||||
|
||||
/*
|
||||
* Converter context type (opaque).
|
||||
*/
|
||||
typedef struct idn_converter *idn_converter_t;
|
||||
|
||||
/*
|
||||
* Conversion flags.
|
||||
*/
|
||||
#define IDN_CONVERTER_DELAYEDOPEN 1
|
||||
#define IDN_CONVERTER_RTCHECK 2
|
||||
|
||||
/*
|
||||
* Encoding types.
|
||||
*/
|
||||
#define IDN_NONACE 0
|
||||
#define IDN_ACE_STRICTCASE 1
|
||||
#define IDN_ACE_LOOSECASE 2
|
||||
|
||||
/*
|
||||
* Initialize module. Must be called before any other calls of
|
||||
* the functions of this module.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_converter_initialize(void);
|
||||
|
||||
/*
|
||||
* Create a conversion context.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_invalid_name -- specified codeset is not supported.
|
||||
* idn_nomemory -- malloc failed.
|
||||
* idn_failure -- other failure (unknown cause).
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_converter_create(const char *name, idn_converter_t *ctxp,
|
||||
int flags);
|
||||
|
||||
/*
|
||||
* Decrement reference count of the converter `ctx' created by
|
||||
* 'idn_converter_create', if it is still refered by another object.
|
||||
* Otherwise, release all the memory allocated to the converter.
|
||||
*/
|
||||
IDN_EXPORT void
|
||||
idn_converter_destroy(idn_converter_t ctx);
|
||||
|
||||
/*
|
||||
* Increment reference count of the converter `ctx' created by
|
||||
* 'idn_converter_create'.
|
||||
*/
|
||||
IDN_EXPORT void
|
||||
idn_converter_incrref(idn_converter_t ctx);
|
||||
|
||||
/*
|
||||
* Convert between local codeset and UCS4. Note that each conversion
|
||||
* is started with initial state.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_buffer_overflow -- output buffer is too small.
|
||||
* idn_invalid_encoding -- the input string has invalid/illegal
|
||||
* byte sequence.
|
||||
* idn_invalid_name -- codeset is not supported (this error
|
||||
* should happen only if 'delayedopen'
|
||||
* flag was set when idn_converter_create
|
||||
* was called)
|
||||
* idn_failure -- other failure.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_converter_convfromucs4(idn_converter_t ctx,
|
||||
const unsigned long *from, char *to, size_t tolen);
|
||||
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_converter_convtoucs4(idn_converter_t ctx,
|
||||
const char *from, unsigned long *to, size_t tolen);
|
||||
|
||||
/*
|
||||
* Get the name of local codeset. The returned name may be different from
|
||||
* the one specified to idn_converter_create, if the specified one was an
|
||||
* alias.
|
||||
*
|
||||
* Returns:
|
||||
* the local codeset name.
|
||||
*/
|
||||
IDN_EXPORT char *
|
||||
idn_converter_localencoding(idn_converter_t ctx);
|
||||
|
||||
/*
|
||||
* Return the encoding type of this local encoding.
|
||||
*
|
||||
* Returns:
|
||||
* IDN_NONACE -- encoding is not ACE.
|
||||
* IDN_ACE_STRICTCASE -- encoding is ACE.
|
||||
* decoder of this ACE preserve letter case.
|
||||
* IDN_ACE_LOOSECASE -- encoding type is ACE.
|
||||
* decoder cannot preserve letter case.
|
||||
*/
|
||||
IDN_EXPORT int
|
||||
idn_converter_encodingtype(idn_converter_t ctx);
|
||||
|
||||
/*
|
||||
* Return if this local encoding is ACE (Ascii Compatible Encoding).
|
||||
*
|
||||
* Returns:
|
||||
* 1 -- yes, it is ACE.
|
||||
* 0 -- no.
|
||||
*/
|
||||
IDN_EXPORT int
|
||||
idn_converter_isasciicompatible(idn_converter_t ctx);
|
||||
|
||||
/*
|
||||
* Register an alias for a codeset name.
|
||||
*
|
||||
* If first_item is 0, alias pattern is placed as the last item of the
|
||||
* alias list. Otherwise, it is done as the first item.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_converter_addalias(const char *alias_name, const char *real_name,
|
||||
int first_item);
|
||||
|
||||
/*
|
||||
* Register aliases defined by the specified file.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nofile -- no such file.
|
||||
* idn_invalid_syntax -- file is malformed.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_converter_aliasfile(const char *path);
|
||||
|
||||
/*
|
||||
* Unregister all the aliases.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_converter_resetalias(void);
|
||||
|
||||
/*
|
||||
* resolve real encoding name from alias information.
|
||||
*/
|
||||
IDN_EXPORT const char *
|
||||
idn_converter_getrealname(const char *name);
|
||||
|
||||
|
||||
/*
|
||||
* New converter registration.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Conversion operation functions.
|
||||
*/
|
||||
typedef idn_result_t (*idn_converter_openproc_t)(idn_converter_t ctx,
|
||||
void **privdata);
|
||||
typedef idn_result_t (*idn_converter_closeproc_t)(idn_converter_t ctx,
|
||||
void *privdata);
|
||||
typedef idn_result_t
|
||||
(*idn_converter_convfromucs4proc_t)(idn_converter_t ctx,
|
||||
void *privdata,
|
||||
const unsigned long *from,
|
||||
char *to, size_t tolen);
|
||||
typedef idn_result_t
|
||||
(*idn_converter_convtoucs4proc_t)(idn_converter_t ctx,
|
||||
void *privdata,
|
||||
const char *from,
|
||||
unsigned long *to,
|
||||
size_t tolen);
|
||||
|
||||
/*
|
||||
* Register a new converter.
|
||||
* 'encoding_type' is a value which idn_converter_encodingtype() returns.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_converter_register(const char *name,
|
||||
idn_converter_openproc_t openfromucs4,
|
||||
idn_converter_openproc_t opentoucs4,
|
||||
idn_converter_convfromucs4proc_t convfromucs4,
|
||||
idn_converter_convtoucs4proc_t convtoucs4,
|
||||
idn_converter_closeproc_t close,
|
||||
int encoding_type);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IDN_CONVERTER_H */
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
/* $Id: debug.h,v 1.1 2003/06/04 00:25:36 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2000 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_DEBUG_H
|
||||
#define IDN_DEBUG_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Debug utility
|
||||
*/
|
||||
|
||||
#include <idn/export.h>
|
||||
|
||||
IDN_EXPORT char *idn__debug_hexstring(const char *s, int maxbytes);
|
||||
IDN_EXPORT char *idn__debug_xstring(const char *s, int maxbytes);
|
||||
IDN_EXPORT char *idn__debug_ucs4xstring(const unsigned long *s, int maxbytes);
|
||||
IDN_EXPORT char *idn__debug_utf16xstring(const unsigned short *s,
|
||||
int maxbytes);
|
||||
IDN_EXPORT char *idn__debug_hexdata(const char *s, int length, int maxbytes);
|
||||
IDN_EXPORT void idn__debug_hexdump(const char *s, int maxbytes);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IDN_DEBUG_H */
|
||||
|
|
@ -1,123 +0,0 @@
|
|||
/* $Id: delimitermap.h,v 1.1 2003/06/04 00:25:37 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2001 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_DELIMITERMAP_H
|
||||
#define IDN_DELIMITERMAP_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Mapper.
|
||||
*
|
||||
* Perfom mapping local delimiters to `.'.
|
||||
*/
|
||||
|
||||
#include <idn/export.h>
|
||||
#include <idn/result.h>
|
||||
|
||||
/*
|
||||
* Map object type.
|
||||
*/
|
||||
typedef struct idn_delimitermap *idn_delimitermap_t;
|
||||
|
||||
/*
|
||||
* Create a delimitermap context.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_delimitermap_create(idn_delimitermap_t *ctxp);
|
||||
|
||||
/*
|
||||
* Decrement reference count of the delimitermap `ctx' created by
|
||||
* 'idn_delimitermap_create', if it is still refered by another object.
|
||||
* Otherwise, release all the memory allocated to the delimitermap.
|
||||
*/
|
||||
IDN_EXPORT void
|
||||
idn_delimitermap_destroy(idn_delimitermap_t ctx);
|
||||
|
||||
/*
|
||||
* Increment reference count of the delimitermap `ctx' created by
|
||||
* 'idn_delimitermap_create'.
|
||||
*/
|
||||
IDN_EXPORT void
|
||||
idn_delimitermap_incrref(idn_delimitermap_t ctx);
|
||||
|
||||
/*
|
||||
* Add a local delimiter.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomemory -- malloc failed.
|
||||
* idn_invalid_codepoint -- delimiter is not valid UCS4 character.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_delimitermap_add(idn_delimitermap_t ctx, unsigned long delimiter);
|
||||
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_delimitermap_addall(idn_delimitermap_t ctx, unsigned long *delimiters,
|
||||
int ndelimiters);
|
||||
|
||||
/*
|
||||
* Map local delimiters in `from' to `.'.
|
||||
*
|
||||
* Note that if no delimiter is added to the context, the function copies
|
||||
* the string.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_buffer_overflow -- output buffer is too small.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_delimitermap_map(idn_delimitermap_t ctx, const unsigned long *from,
|
||||
unsigned long *to, size_t tolen);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IDN_DELIMITERMAP_H */
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
/* $Id: export.h,v 1.1 2003/06/04 00:25:37 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2002 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_EXPORT_H
|
||||
#define IDN_EXPORT_H 1
|
||||
|
||||
/*
|
||||
* Macro for exporting functions.
|
||||
*
|
||||
* When creating a Windows DLL, define IDN_EXPORT something as
|
||||
* "extern __declspec(dllexport)".
|
||||
*/
|
||||
|
||||
#ifndef IDN_EXPORT
|
||||
#define IDN_EXPORT extern
|
||||
#endif
|
||||
|
||||
# endif /* IDN_EXPORT_H */
|
||||
|
|
@ -1,136 +0,0 @@
|
|||
/* $Id: filechecker.h,v 1.1 2003/06/04 00:25:37 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2001 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_FILECHECKER_H
|
||||
#define IDN_FILECHECKER_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Character checker -- check if there are any characters specified
|
||||
* by a file in the given string.
|
||||
*/
|
||||
|
||||
#include <idn/result.h>
|
||||
|
||||
/*
|
||||
* Check object type.
|
||||
*/
|
||||
typedef struct idn__filechecker *idn__filechecker_t;
|
||||
|
||||
/*
|
||||
* Read the contents of the given file and create a context for
|
||||
* checking.
|
||||
*
|
||||
* 'file' is the pathname of the file, which specifies the set of
|
||||
* characters to be checked. The file is a simple text file, and
|
||||
* each line must be of the form either
|
||||
* <code_point>
|
||||
* or
|
||||
* <code_point>-<code_point>
|
||||
* (or comment, see below) where <code_point> is a UCS code point
|
||||
* represented as hexadecimal string with optional prefix `U+'
|
||||
* (ex. `0041' or `U+FEDC').
|
||||
*
|
||||
* The former specifies just one character (a code point, to be precise),
|
||||
* while the latter specified a range of characters. In the case of
|
||||
* a character range, the first code point (before hyphen) must not be
|
||||
* greater than the second code point (after hyphen).
|
||||
*
|
||||
* Lines starting with `#' are comments.
|
||||
*
|
||||
* If file is read with no errors, the created context is stored in
|
||||
* '*ctxp', and 'idn_success' is returned. Otherwise, the contents
|
||||
* of '*ctxp' is undefined.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nofile -- cannot open the specified file.
|
||||
* idn_nomemory -- malloc failed.
|
||||
* idn_invalid_syntax -- file format is not valid.
|
||||
*/
|
||||
extern idn_result_t
|
||||
idn__filechecker_create(const char *file, idn__filechecker_t *ctxp);
|
||||
|
||||
/*
|
||||
* Release memory for the specified context.
|
||||
*/
|
||||
extern void
|
||||
idn__filechecker_destroy(idn__filechecker_t ctx);
|
||||
|
||||
/*
|
||||
* See if the given string contains any specified characters.
|
||||
*
|
||||
* Check if there is any characters pecified by the context 'ctx' in
|
||||
* the UCS4 string 'str'. If there are none, NULL is stored in '*found'.
|
||||
* Otherwise, the pointer to the first occurence of such character is
|
||||
* stored in '*found'.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
*/
|
||||
extern idn_result_t
|
||||
idn__filechecker_lookup(idn__filechecker_t ctx, const unsigned long *str,
|
||||
const unsigned long **found);
|
||||
|
||||
/*
|
||||
* The following functions are for internal use.
|
||||
* They are used for this module to be add to the checker module.
|
||||
*/
|
||||
extern idn_result_t
|
||||
idn__filechecker_createproc(const char *parameter, void **ctxp);
|
||||
|
||||
extern void
|
||||
idn__filechecker_destroyproc(void *ctxp);
|
||||
|
||||
extern idn_result_t
|
||||
idn__filechecker_lookupproc(void *ctx, const unsigned long *str,
|
||||
const unsigned long **found);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IDN_FILECHECKER_H */
|
||||
|
|
@ -1,137 +0,0 @@
|
|||
/* $Id: filemapper.h,v 1.1 2003/06/04 00:25:38 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2001 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_FILEMAPPER_H
|
||||
#define IDN_FILEMAPPER_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Perform character mapping (substitution) according to a
|
||||
* map file.
|
||||
*/
|
||||
|
||||
#include <idn/result.h>
|
||||
|
||||
/*
|
||||
* Mapping object type.
|
||||
*/
|
||||
typedef struct idn__filemapper *idn__filemapper_t;
|
||||
|
||||
/*
|
||||
* Read the contents of the given map file and create a context for mapping.
|
||||
*
|
||||
* 'file' is the pathname of the file, which specifies the character
|
||||
* mapping. The file is a simple text file, and each line specifies
|
||||
* a mapping of a single character. The format of each line is
|
||||
*
|
||||
* <code_point>; [<code_point>..][;]
|
||||
*
|
||||
* where <code_point> is a UCS code point represented as a hexadecimal
|
||||
* string with optional prefix `U+' (ex. `0041' or `U+FEDC').
|
||||
* The code point before the first semicolon will be mapped to the
|
||||
* sequence of code points separated by space characters after the
|
||||
* first semicolon. The sequence may be empty, denoting wiping out
|
||||
* the character.
|
||||
*
|
||||
* For example,
|
||||
* U+0041; U+0061 -- maps 'A' to 'a'
|
||||
* 20;; -- wipes out ' '
|
||||
*
|
||||
* Anything after the second semicolon is ignored. Also lines beginning
|
||||
* with '#' are treated as comments.
|
||||
*
|
||||
* If there is no error, the created context is stored in '*ctxp'.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nofile -- cannot open the specified file.
|
||||
* idn_nomemory -- malloc failed.
|
||||
* idn_invalid_syntax -- file format is not valid.
|
||||
*/
|
||||
extern idn_result_t
|
||||
idn__filemapper_create(const char *file, idn__filemapper_t *ctxp);
|
||||
|
||||
/*
|
||||
* Release memory for the given context.
|
||||
*/
|
||||
extern void
|
||||
idn__filemapper_destroy(idn__filemapper_t ctx);
|
||||
|
||||
/*
|
||||
* Perform character substitution.
|
||||
*
|
||||
* Each character in the string 'from' is examined and if it
|
||||
* has a mapping, it is substituted to the corresponding
|
||||
* character sequence. The substituted string is stored in 'to',
|
||||
* whose length is specified by 'tolen'.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_buffer_overflow -- result buffer is too small.
|
||||
*/
|
||||
extern idn_result_t
|
||||
idn__filemapper_map(idn__filemapper_t ctx, const unsigned long *from,
|
||||
unsigned long *to, size_t tolen);
|
||||
|
||||
/*
|
||||
* The following functions are for internal use.
|
||||
* They are used for this module to be add to the mapper module.
|
||||
*/
|
||||
extern idn_result_t
|
||||
idn__filemapper_createproc(const char *parameter, void **ctxp);
|
||||
|
||||
extern void
|
||||
idn__filemapper_destroyproc(void *ctxp);
|
||||
|
||||
extern idn_result_t
|
||||
idn__filemapper_mapproc(void *ctx, const unsigned long *from,
|
||||
unsigned long *to, size_t tolen);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IDN_FILEMAPPER_H */
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
/* $Id: localencoding.h,v 1.1 2003/06/04 00:25:38 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2000 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_LOCALENCODING_H
|
||||
#define IDN_LOCALENCODING_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Local codeset detection.
|
||||
*
|
||||
* Determine the local codeset (the codeset used by the current application),
|
||||
* based on the locale information.
|
||||
*/
|
||||
|
||||
#include <idn/export.h>
|
||||
|
||||
#define IDN_LOCALCS_ENV "IDN_LOCAL_CODESET"
|
||||
|
||||
/*
|
||||
* Get the codeset name corresponding to the current locale,
|
||||
* suitable for passing to 'idn_converter_create'.
|
||||
*
|
||||
* If the codeset cannot be determined, the locale name itself
|
||||
* will be returned in the hope that codeset alias file translates it
|
||||
* to the right name.
|
||||
*
|
||||
* If it cannot retrieve the current locale name, NULL will be
|
||||
* returned.
|
||||
*/
|
||||
IDN_EXPORT const char *idn_localencoding_name(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IDN_LOCALENCODING_H */
|
||||
|
|
@ -1,107 +0,0 @@
|
|||
/* $Id: log.h,v 1.1 2003/06/04 00:25:38 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2000 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_LOG_H
|
||||
#define IDN_LOG_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* libidnkit logging facility.
|
||||
*/
|
||||
|
||||
#include <idn/export.h>
|
||||
|
||||
/*
|
||||
* Log level definition.
|
||||
*/
|
||||
enum {
|
||||
idn_log_level_fatal = 0,
|
||||
idn_log_level_error = 1,
|
||||
idn_log_level_warning = 2,
|
||||
idn_log_level_info = 3,
|
||||
idn_log_level_trace = 4,
|
||||
idn_log_level_dump = 5
|
||||
};
|
||||
|
||||
/*
|
||||
* Log handler type.
|
||||
*/
|
||||
typedef void (*idn_log_proc_t)(int level, const char *msg);
|
||||
|
||||
/*
|
||||
* Log routines.
|
||||
*/
|
||||
IDN_EXPORT void idn_log_fatal(const char *fmt, ...);
|
||||
IDN_EXPORT void idn_log_error(const char *fmt, ...);
|
||||
IDN_EXPORT void idn_log_warning(const char *fmt, ...);
|
||||
IDN_EXPORT void idn_log_info(const char *fmt, ...);
|
||||
IDN_EXPORT void idn_log_trace(const char *fmt, ...);
|
||||
IDN_EXPORT void idn_log_dump(const char *fmt, ...);
|
||||
|
||||
/*
|
||||
* Set/get log level.
|
||||
*
|
||||
* If log level has not been explicitly defined by 'idn_log_setlevel',
|
||||
* the default level is determined by the value of enrironment
|
||||
* variable 'IDN_LOG_LEVEL'.
|
||||
*/
|
||||
IDN_EXPORT void idn_log_setlevel(int level);
|
||||
IDN_EXPORT int idn_log_getlevel(void);
|
||||
|
||||
/*
|
||||
* Set log handler.
|
||||
*
|
||||
* If no log handler is set, log goes to stderr by default.
|
||||
* You can reset the handler to the default one by specifying
|
||||
* NULL.
|
||||
*/
|
||||
IDN_EXPORT void idn_log_setproc(idn_log_proc_t proc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IDN_LOG_H */
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
/* $Id: logmacro.h,v 1.1 2003/06/04 00:25:38 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2000 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_LOGMACRO_H
|
||||
#define IDN_LOGMACRO_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <idn/log.h>
|
||||
|
||||
#define FATAL(x) idn_log_fatal x
|
||||
#define ERROR(x) idn_log_error x
|
||||
#define WARNING(x) idn_log_warning x
|
||||
#define INFO(x) LOG_AT_LEVEL(idn_log_level_info, idn_log_info, x)
|
||||
#define TRACE(x) LOG_AT_LEVEL(idn_log_level_trace, idn_log_trace, x)
|
||||
|
||||
#ifdef DEBUG
|
||||
#define DUMP(x) LOG_AT_LEVEL(idn_log_level_dump, idn_log_dump, x)
|
||||
#else
|
||||
#define DUMP(x)
|
||||
#endif /* DEBUG */
|
||||
|
||||
#define LOG_AT_LEVEL(lv, fun, x) do {if (LOGLEVEL >= (lv)) fun x; } while (0)
|
||||
#define LOGLEVEL idn_log_getlevel()
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IDN_LOGMACRO_H */
|
||||
|
|
@ -1,159 +0,0 @@
|
|||
/* $Id: mapper.h,v 1.1 2003/06/04 00:25:38 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2001 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_MAPPER_H
|
||||
#define IDN_MAPPER_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Mapper.
|
||||
*
|
||||
* Perfom mapping the specified domain name.
|
||||
*/
|
||||
|
||||
#include <idn/export.h>
|
||||
#include <idn/result.h>
|
||||
#include <idn/filemapper.h>
|
||||
#include <idn/nameprep.h>
|
||||
|
||||
/*
|
||||
* Map object type.
|
||||
*/
|
||||
typedef struct idn_mapper *idn_mapper_t;
|
||||
|
||||
/*
|
||||
* Initialize module. Must be called before any other calls of
|
||||
* the functions of this module.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_mapper_initialize(void);
|
||||
|
||||
/*
|
||||
* Create a mapper context.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_mapper_create(idn_mapper_t *ctxp);
|
||||
|
||||
/*
|
||||
* Decrement reference count of the mapper `ctx' created by
|
||||
* 'idn_mapper_create', if it is still refered by another object.
|
||||
* Otherwise, release all the memory allocated to the mapper.
|
||||
*/
|
||||
IDN_EXPORT void
|
||||
idn_mapper_destroy(idn_mapper_t ctx);
|
||||
|
||||
/*
|
||||
* Increment reference count of the mapper `ctx' created by
|
||||
* 'idn_mapper_create'.
|
||||
*/
|
||||
IDN_EXPORT void
|
||||
idn_mapper_incrref(idn_mapper_t ctx);
|
||||
|
||||
/*
|
||||
* Add mapping scheme `name' to the mapper to `ctx'.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_invalid_name -- the given name is not valid.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_mapper_add(idn_mapper_t ctx, const char *name);
|
||||
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_mapper_addall(idn_mapper_t ctx, const char **names, int nnames);
|
||||
|
||||
/*
|
||||
* Map an UCS4 string. All mapping schemes regsitered in `ctx'
|
||||
* are applied in the regisration order.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomemory -- malloc failed.
|
||||
* idn_buffer_overflow -- output buffer is too small.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_mapper_map(idn_mapper_t ctx, const unsigned long *from,
|
||||
unsigned long *to, size_t tolen);
|
||||
|
||||
/*
|
||||
* Mapping procedure type.
|
||||
*/
|
||||
typedef idn_result_t (*idn_mapper_createproc_t)(const char *parameter,
|
||||
void **ctxp);
|
||||
typedef void (*idn_mapper_destroyproc_t)(void *ctxp);
|
||||
typedef idn_result_t (*idn_mapper_mapproc_t)(void *ctx,
|
||||
const unsigned long *from,
|
||||
unsigned long *, size_t);
|
||||
|
||||
/*
|
||||
* Register a new mapping scheme.
|
||||
*
|
||||
* You can override the default normalization schemes, if you want.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_mapper_register(const char *prefix,
|
||||
idn_mapper_createproc_t create,
|
||||
idn_mapper_destroyproc_t destroy,
|
||||
idn_mapper_mapproc_t map);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IDN_MAPPER_H */
|
||||
|
|
@ -1,165 +0,0 @@
|
|||
/* $Id: mapselector.h,v 1.1 2003/06/04 00:25:39 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2001 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_MAPSELECTOR_H
|
||||
#define IDN_MAPSELECTOR_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Map selector.
|
||||
*
|
||||
* Perfom mapping the specified domain name according with the TLD
|
||||
* of the donmain name.
|
||||
*/
|
||||
|
||||
#include <idn/export.h>
|
||||
#include <idn/result.h>
|
||||
#include <idn/mapper.h>
|
||||
|
||||
/*
|
||||
* Special TLDs for map selection.
|
||||
*/
|
||||
#define IDN_MAPSELECTOR_NOTLD "-"
|
||||
#define IDN_MAPSELECTOR_DEFAULTTLD "."
|
||||
|
||||
IDN_EXPORT const unsigned long *
|
||||
idn_mapselector_getnotld(void);
|
||||
|
||||
IDN_EXPORT const unsigned long *
|
||||
idn_mapselector_getdefaulttld(void);
|
||||
|
||||
/*
|
||||
* Mapselector object type.
|
||||
*/
|
||||
typedef struct idn_mapselector *idn_mapselector_t;
|
||||
|
||||
/*
|
||||
* Initialize module. Must be called before any other calls of
|
||||
* the functions of this module.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_mapselector_initialize(void);
|
||||
|
||||
/*
|
||||
* Create a mapselector context.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_mapselector_create(idn_mapselector_t *ctxp);
|
||||
|
||||
/*
|
||||
* Decrement reference count of the mapselector `ctx' created by
|
||||
* 'idn_mapselector_create', if it is still refered by another object.
|
||||
* Otherwise, release all the memory allocated to the mapselector.
|
||||
*/
|
||||
IDN_EXPORT void
|
||||
idn_mapselector_destroy(idn_mapselector_t ctx);
|
||||
|
||||
/*
|
||||
* Increment reference count of the mapselector `ctx' created by
|
||||
* 'idn_mapselector_create'.
|
||||
*/
|
||||
IDN_EXPORT void
|
||||
idn_mapselector_incrref(idn_mapselector_t ctx);
|
||||
|
||||
/*
|
||||
* Return the mapper for `tld' registered in `ctx', or return NULL if
|
||||
* mapper for `tld' is not registered.
|
||||
*/
|
||||
IDN_EXPORT idn_mapper_t
|
||||
idn_mapselector_mapper(idn_mapselector_t ctx, const char *tld);
|
||||
|
||||
/*
|
||||
* Add mapping scheme `name' to the mapper for `tld' to the mapselector
|
||||
* context `ctx'. If no mapper for `TLD' has not been registered, the
|
||||
* function creates a new mapper for `tld', and then adds the given mapping
|
||||
* scheme to the mapper. Otherwise, it adds the scheme to the mapper for
|
||||
* TLD registered in `ctx'.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_invalid_name -- the given tld or name is not valid.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_mapselector_add(idn_mapselector_t ctx, const char *tld, const char *name);
|
||||
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_mapselector_addall(idn_mapselector_t ctx, const char *tld,
|
||||
const char **names, int nnames);
|
||||
|
||||
/*
|
||||
* Map an UCS4 string with the mapper for TLD of the domain name.
|
||||
* If there is no mapper suitable for the domain name, the function
|
||||
* simply copies the doman name.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomemory -- malloc failed.
|
||||
* idn_buffer_overflow -- output buffer is too small.
|
||||
* idn_invalid_name -- the given tld is not valid.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_mapselector_map(idn_mapselector_t ctx, const unsigned long *from,
|
||||
const char *tld, unsigned long *to, size_t tolen);
|
||||
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_mapselector_map2(idn_mapselector_t ctx, const unsigned long *from,
|
||||
const unsigned long *tld, unsigned long *to,
|
||||
size_t tolen);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IDN_MAPSELECTOR_H */
|
||||
|
|
@ -1,185 +0,0 @@
|
|||
/* $Id: nameprep.h,v 1.1 2003/06/04 00:25:39 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2001 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_NAMEPREP_H
|
||||
#define IDN_NAMEPREP_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Perform NAMEPREP (mapping, prohibited/unassigned checking).
|
||||
*/
|
||||
|
||||
#include <idn/export.h>
|
||||
#include <idn/result.h>
|
||||
|
||||
/*
|
||||
* BIDI type codes.
|
||||
*/
|
||||
typedef enum {
|
||||
idn_biditype_r_al,
|
||||
idn_biditype_l,
|
||||
idn_biditype_others
|
||||
} idn_biditype_t;
|
||||
|
||||
/*
|
||||
* A Handle for nameprep operations.
|
||||
*/
|
||||
typedef struct idn_nameprep *idn_nameprep_t;
|
||||
|
||||
|
||||
/*
|
||||
* The latest version of nameprep.
|
||||
*/
|
||||
#define IDN_NAMEPREP_CURRENT "RFC3491"
|
||||
|
||||
/*
|
||||
* Create a handle for nameprep operations.
|
||||
* The handle is stored in '*handlep', which is used other functions
|
||||
* in this module.
|
||||
* The version of the NAMEPREP specification can be specified with
|
||||
* 'version' parameter. If 'version' is NULL, the latest version
|
||||
* is used.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_notfound -- specified version not found.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_nameprep_create(const char *version, idn_nameprep_t *handlep);
|
||||
|
||||
/*
|
||||
* Close a handle, which was created by 'idn_nameprep_create'.
|
||||
*/
|
||||
IDN_EXPORT void
|
||||
idn_nameprep_destroy(idn_nameprep_t handle);
|
||||
|
||||
/*
|
||||
* Perform character mapping on an UCS4 string specified by 'from', and
|
||||
* store the result into 'to', whose length is specified by 'tolen'.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_buffer_overflow -- result buffer is too small.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_nameprep_map(idn_nameprep_t handle, const unsigned long *from,
|
||||
unsigned long *to, size_t tolen);
|
||||
|
||||
/*
|
||||
* Check if an UCS4 string 'str' contains any prohibited characters specified
|
||||
* by the draft. If found, the pointer to the first such character is stored
|
||||
* into '*found'. Otherwise '*found' will be NULL.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- check has been done properly. (But this
|
||||
* does not mean that no prohibited character
|
||||
* was found. Check '*found' to see the
|
||||
* result.)
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_nameprep_isprohibited(idn_nameprep_t handle, const unsigned long *str,
|
||||
const unsigned long **found);
|
||||
|
||||
/*
|
||||
* Check if an UCS4 string 'str' contains any unassigned characters specified
|
||||
* by the draft. If found, the pointer to the first such character is stored
|
||||
* into '*found'. Otherwise '*found' will be NULL.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- check has been done properly. (But this
|
||||
* does not mean that no unassinged character
|
||||
* was found. Check '*found' to see the
|
||||
* result.)
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_nameprep_isunassigned(idn_nameprep_t handle, const unsigned long *str,
|
||||
const unsigned long **found);
|
||||
|
||||
/*
|
||||
* Check if an UCS4 string 'str' is valid string specified by ``bidi check''
|
||||
* of the draft. If it is not valid, the pointer to the first invalid
|
||||
* character is stored into '*found'. Otherwise '*found' will be NULL.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- check has been done properly. (But this
|
||||
* does not mean that the string was valid.
|
||||
* Check '*found' to see the result.)
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_nameprep_isvalidbidi(idn_nameprep_t handle, const unsigned long *str,
|
||||
const unsigned long **found);
|
||||
|
||||
/*
|
||||
* The following functions are for internal use.
|
||||
* They are used for this module to be add to the checker and mapper modules.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_nameprep_createproc(const char *parameter, void **handlep);
|
||||
|
||||
IDN_EXPORT void
|
||||
idn_nameprep_destroyproc(void *handle);
|
||||
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_nameprep_mapproc(void *handle, const unsigned long *from,
|
||||
unsigned long *to, size_t tolen);
|
||||
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_nameprep_prohibitproc(void *handle, const unsigned long *str,
|
||||
const unsigned long **found);
|
||||
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_nameprep_unassignedproc(void *handle, const unsigned long *str,
|
||||
const unsigned long **found);
|
||||
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_nameprep_bidiproc(void *handle, const unsigned long *str,
|
||||
const unsigned long **found);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IDN_NAMEPREP_H */
|
||||
|
|
@ -1,155 +0,0 @@
|
|||
/* $Id: normalizer.h,v 1.1 2003/06/04 00:25:40 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2000 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_NORMALIZER_H
|
||||
#define IDN_NORMALIZER_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Domain name normalizer.
|
||||
*
|
||||
* Perform normalization on the specified strings. String must be
|
||||
* in UCS4 encoding.
|
||||
*/
|
||||
|
||||
#include <idn/export.h>
|
||||
#include <idn/result.h>
|
||||
|
||||
/*
|
||||
* Normalizer type (opaque).
|
||||
*/
|
||||
typedef struct idn_normalizer *idn_normalizer_t;
|
||||
|
||||
/*
|
||||
* Normalizer procedure type.
|
||||
*/
|
||||
typedef idn_result_t (*idn_normalizer_proc_t)(const unsigned long *from,
|
||||
unsigned long *to, size_t tolen);
|
||||
|
||||
/*
|
||||
* Initialize this module.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_normalizer_initialize(void);
|
||||
|
||||
/*
|
||||
* Create a empty normalizer.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_normalizer_create(idn_normalizer_t *ctxp);
|
||||
|
||||
/*
|
||||
* Decrement reference count of the normalizer `ctx' created by
|
||||
* 'idn_normalizer_create', if it is still refered by another object.
|
||||
* Otherwise, release all the memory allocated to the normalizer.
|
||||
*/
|
||||
IDN_EXPORT void
|
||||
idn_normalizer_destroy(idn_normalizer_t ctx);
|
||||
|
||||
/*
|
||||
* Increment reference count of the normalizer `ctx' created by
|
||||
* 'idn_normalizer_create'.
|
||||
*/
|
||||
IDN_EXPORT void
|
||||
idn_normalizer_incrref(idn_normalizer_t ctx);
|
||||
|
||||
/*
|
||||
* Add a normalization scheme to a normalizer.
|
||||
*
|
||||
* Multiple shemes can be added to a normalizer, and they will be
|
||||
* applied in order.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_invalid_name -- unknown scheme was specified.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_normalizer_add(idn_normalizer_t ctx, const char *scheme_name);
|
||||
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_normalizer_addall(idn_normalizer_t ctx, const char **scheme_names,
|
||||
int nschemes);
|
||||
|
||||
/*
|
||||
* Perform normalization(s) defined by a normalizer to the specified string,
|
||||
* If the normalizer has two or more normalization schemes, they are
|
||||
* applied in order.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_buffer_overflow -- output buffer is too small.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_normalizer_normalize(idn_normalizer_t ctx, const unsigned long *from,
|
||||
unsigned long *to, size_t tolen);
|
||||
|
||||
/*
|
||||
* Register a new normalization scheme.
|
||||
*
|
||||
* You can override the default normalization schemes, if you want.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_normalizer_register(const char *scheme_name, idn_normalizer_proc_t proc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IDN_NORMALIZER_H */
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
/* $Id: punycode.h,v 1.1 2003/06/04 00:25:40 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2001 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_PUNYCODE_H
|
||||
#define IDN_PUNYCODE_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Punycode Converter.
|
||||
*/
|
||||
|
||||
#include <idn/result.h>
|
||||
#include <idn/converter.h>
|
||||
|
||||
extern idn_result_t
|
||||
idn__punycode_decode(idn_converter_t ctx, void *privdata,
|
||||
const char *from, unsigned long *to, size_t tolen);
|
||||
|
||||
extern idn_result_t
|
||||
idn__punycode_encode(idn_converter_t ctx, void *privdata,
|
||||
const unsigned long *from, char *to, size_t tolen);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IDN_PUNYCODE_H */
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
/* $Id: race.h,v 1.1 2003/06/04 00:25:40 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2000 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_RACE_H
|
||||
#define IDN_RACE_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* RACE Converter.
|
||||
*
|
||||
* See Internet Draft draft-ietf-idn-race-03.txt for details.
|
||||
*/
|
||||
|
||||
#include <idn/result.h>
|
||||
#include <idn/converter.h>
|
||||
|
||||
extern idn_result_t
|
||||
idn__race_encode(idn_converter_t ctx, void *privdata,
|
||||
const unsigned long *from, char *to, size_t tolen);
|
||||
|
||||
extern idn_result_t
|
||||
idn__race_decode(idn_converter_t ctx, void *privdata,
|
||||
const char *from, unsigned long *to, size_t tolen);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IDN_RACE_H */
|
||||
|
|
@ -1,309 +0,0 @@
|
|||
/* $Id: res.h,v 1.1 2003/06/04 00:25:41 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2001,2002 Japan Network Information Center.
|
||||
* All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_RES_H
|
||||
#define IDN_RES_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Resolver library support.
|
||||
*
|
||||
* All the functions provided by this module requires IDN resolver
|
||||
* configuration context of type 'idn_resconf_t' as an argument.
|
||||
* This context holds information described in the configuration file
|
||||
* (idn.conf). See idn_resconf module for details.
|
||||
*
|
||||
* All functions also accept NULL as the context, but since
|
||||
* no conversion/normalization will be done in this case, it is
|
||||
* pretty useless.
|
||||
*/
|
||||
|
||||
#include <idn/export.h>
|
||||
#include <idn/resconf.h>
|
||||
#include <idn/result.h>
|
||||
|
||||
typedef unsigned long idn_action_t;
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
#define IDN_LOCALCONV 0x00000001 /* Local encoding <-> UTF-8 conversion */
|
||||
#define IDN_DELIMMAP 0x00000002 /* Delimiter mapping */
|
||||
#define IDN_LOCALMAP 0x00000004 /* Local mapping */
|
||||
#define IDN_MAP 0x00000008 /* NAMEPREP map */
|
||||
#define IDN_NORMALIZE 0x00000010 /* NAMEPREP normalize */
|
||||
#define IDN_PROHCHECK 0x00000020 /* NAMEPREP prohibited character check */
|
||||
#define IDN_UNASCHECK 0x00000040 /* Unassigned code point check */
|
||||
#define IDN_BIDICHECK 0x00000080 /* bidirectional string check */
|
||||
#define IDN_ASCCHECK 0x00000100 /* Non-LDH ASCII check */
|
||||
#define IDN_IDNCONV 0x00000200 /* UTF-8 <-> IDN encoding conversion */
|
||||
#define IDN_LENCHECK 0x00000400 /* Label length check */
|
||||
#define IDN_RTCHECK 0x00000800 /* Round trip check */
|
||||
#define IDN_UNDOIFERR 0x00001000 /* Option: undo if error occurs */
|
||||
|
||||
#define IDN_ENCODE_QUERY 0x00002000 /* Encode query string */
|
||||
#define IDN_DECODE_QUERY 0x00004000 /* Decode query string */
|
||||
|
||||
#define IDN_ENCODE_APP \
|
||||
(IDN_ENCODE_QUERY | IDN_ASCCHECK) /* Standard encode */
|
||||
#define IDN_DECODE_APP \
|
||||
(IDN_DECODE_QUERY | IDN_ASCCHECK) /* Standard decode */
|
||||
|
||||
#define IDN_ENCODE_STORED \
|
||||
(IDN_ENCODE_QUERY | IDN_ASCCHECK | IDN_UNASCHECK) /* Encode query string */
|
||||
#define IDN_DECODE_STORED \
|
||||
(IDN_DECODE_QUERY | IDN_ASCCHECK | IDN_UNASCHECK) /* Decode query string */
|
||||
|
||||
|
||||
#define IDN_NAMEPREP \
|
||||
(IDN_MAP | IDN_NORMALIZE | IDN_PROHCHECK | IDN_BIDICHECK)
|
||||
|
||||
/*
|
||||
* Enable or disable IDN conversion scheme.
|
||||
*
|
||||
* If on_off is 0, IDN conversion scheme is disabled. Otherwise, IDN
|
||||
* conversion is enabled even when IDN_DISABLE is defined.
|
||||
*/
|
||||
IDN_EXPORT void
|
||||
idn_res_enable(int on_off);
|
||||
|
||||
/*
|
||||
* Encode internationalized domain name.
|
||||
*
|
||||
* The encoding process consists of the following 7 steps.
|
||||
*
|
||||
* 1. Local encoding to UTF-8 conversion
|
||||
* Converts a domain name written with local encoding (e.g. ISO-
|
||||
* 8859-1) to UTF-8.
|
||||
* 2. Delimiter mapping,
|
||||
* Maps certain characters to period (U+002E, FULL STOP).
|
||||
* 3. Local mapping
|
||||
* Apply character mappings according with the TLD of the domain
|
||||
* name.
|
||||
* 4. NAMEPREP
|
||||
* Perform NAME preparation described in RFC3491.
|
||||
* This step consists of the following 4 steps:
|
||||
* 4.1. Mapping
|
||||
* 4.2. Normalization
|
||||
* 4.3. Prohibited character check
|
||||
* 4.4. Unassigned check
|
||||
* 5. ASCII range character check
|
||||
* Checks if the domain name contains non-LDH ASCII character (not
|
||||
* alpha-numeric or hypen), or it begins or end with hypen.
|
||||
* 6. UTF-8 to IDN encoding conversion.
|
||||
* Converts the domain name from UTF-8 to ACE (e.g. Punycode).
|
||||
* 7. Length check
|
||||
* Checks the length of each label.
|
||||
*
|
||||
* 'actions' specifies actions and options of the encoding procedure.
|
||||
* Its value is a bitwise-or of the following flags:
|
||||
*
|
||||
* IDN_LOCALCONV -- perform local encoding to UTF-8 conversion (step 1)
|
||||
* IDN_DELIMMAP -- perform delimiter mapping (step 2)
|
||||
* IDN_LOCALMAP -- perform local mapping (step 3)
|
||||
* IDN_MAP -- perform mapping (step 4.1)
|
||||
* IDN_NORMALIZE -- perform normalization (step 4.2)
|
||||
* IDN_PROHCHECK -- perform prohibited character check (step 4.3)
|
||||
* IDN_UNASCHECK -- perform unassigned codepoint check (step 4.4)
|
||||
* IDN_ASCCHECK -- perform ASCII range character check (step 5)
|
||||
* IDN_IDNCONV -- perform UTF-8 to IDN encoding conversion (step 6)
|
||||
* IDN_LENCHECK -- perform length check (step 7)
|
||||
*
|
||||
* Also the following flags are provided for convinience:
|
||||
*
|
||||
* IDN_ENCODE_QUERY -- On libidnkit, perform step 1..7, except for step
|
||||
* 4.4 and 5.
|
||||
* On libidnkitlite, perform step 2..7, except for
|
||||
* step 4.4 and 5.
|
||||
* IDN_ENCODE_STORED -- On libidnkit, perform step 1..7, except for step
|
||||
* 5.
|
||||
* On libidnkitlite, perform step 2..7, except for
|
||||
* step 5.
|
||||
* IDN_ENCODE_APP -- Same as IDN_ENCODE_QUERY.
|
||||
* IDN_NAMEPREP -- perform NAMEPREP (step 4) without unassigned
|
||||
* codepoint check (step 4.4).
|
||||
*
|
||||
* The following flag does not corresponding to a particular action,
|
||||
* but an option of conversion process:
|
||||
*
|
||||
* IDN_UNDOIFERR -- If any step fails, the original input name is
|
||||
* returned.
|
||||
*
|
||||
* Note that if no flags are specified, 'idn_encodename' does nothing
|
||||
* fancy, just copies the given name verbatim.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_invalid_action -- invalid action flag specified.
|
||||
* idn_invalid_encoding -- the given string has invalid/illegal
|
||||
* byte sequence.
|
||||
* idn_invalid_length -- invalid length of a label.
|
||||
* idn_prohibited -- prohibited/unassigned code point found.
|
||||
* idn_buffer_overflow -- 'tolen' is too small.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*
|
||||
* Also, if this function is called without calling 'idn_nameinit',
|
||||
* the following error codes might be returned.
|
||||
* idn_nofile -- cannot open the configuration file.
|
||||
* idn_invalid_syntax -- syntax error found in the file.
|
||||
* idn_invalid_name -- there are invalid names (encoding,
|
||||
* normalization etc.).
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_res_encodename(idn_resconf_t ctx, idn_action_t actions, const char *from,
|
||||
char *to, size_t tolen);
|
||||
|
||||
/*
|
||||
* Decode internationalized domain name.
|
||||
*
|
||||
* The decoding process consists of the following 5 steps.
|
||||
*
|
||||
* 1. delimiter mapping
|
||||
* Maps certain characters to period (U+002E, FULL STOP).
|
||||
* 2. NAMEPREP
|
||||
* Perform NAME preparation described in RFC3491.
|
||||
* This step consists of the following 4 steps:
|
||||
* 2.1. Mapping
|
||||
* 2.2. Normalization
|
||||
* 2.3. Prohibited character check
|
||||
* 2.4. Unassigned check
|
||||
* 3. IDN encoding to UTF-8 conversion.
|
||||
* Converts the domain name from ACE (e.g. Punycode) to UCS4.
|
||||
* 4. Perform round-trip check.
|
||||
* Encode the result of step 3, and then compare it with the result
|
||||
* of the step 2. If they are different, the check is failed.
|
||||
* 5. Convert UTF-8 to local encoding.
|
||||
* If a character in the domain name cannot be converted to local
|
||||
* encoding, the conversion is failed.
|
||||
*
|
||||
* 'actions' specifies actions of the decoding procedure.
|
||||
* Its value is a bitwise-or of the following flags:
|
||||
*
|
||||
* IDN_DELIMMAP -- perform delimiter mapping (step 1)
|
||||
* IDN_MAP -- perform mapping (step 2.1)
|
||||
* IDN_NORMALIZE -- perform normalization (step 2.2)
|
||||
* IDN_PROHCHECK -- perform prohibited character check (step 2.3)
|
||||
* IDN_UNASCHECK -- perform unassigned codepoint check (step 2.4)
|
||||
* IDN_IDNCONV -- perform IDN encoding to UTF-8 conversion (step 3)
|
||||
* IDN_RTCHECK -- perform round-trip check (step 4)
|
||||
* IDN_ASCCHECK -- perform ASCII range character check while
|
||||
* round-trip check (step 4.1)
|
||||
* IDN_LOCALCONV -- perform UTF-8 to local encoding conversion (step 5)
|
||||
*
|
||||
* Also the following flags are provided for the convenience:
|
||||
*
|
||||
* IDN_DECODE_QUERY -- On libidnkit, perform step 1..5, except for step
|
||||
* 2.4 and 4.1.
|
||||
* On libidnkitlite, perform step 1..3, except for
|
||||
* step 2.4 and 4.1.
|
||||
* IDN_DECODE_STORED -- On libidnkit, perform step 1..5, except for step
|
||||
* 4.1.
|
||||
* On libidnkitlite, perform step 1..3, except for
|
||||
* step 4.1.
|
||||
* IDN_DECODE_APP -- Same as IDN_DECODE_QUERY.
|
||||
* IDN_NAMEPREP -- perform NAMEPREP (step 2) without unassigned
|
||||
* codepoint check (step 2.4).
|
||||
*
|
||||
* If any step fails, the original input name is returned.
|
||||
* 'actions' specifies what actions to take when decoding, and is
|
||||
* a bitwise-or of the following flags:
|
||||
*
|
||||
* Note that if no flags are specified, 'idn_decodename' does nothing
|
||||
* but copying the given name verbatim.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_invalid_action -- invalid action flag specified.
|
||||
* idn_invalid_encoding -- the given string has invalid/illegal
|
||||
* byte sequence.
|
||||
* idn_buffer_overflow -- 'tolen' is too small.
|
||||
* idn_invalid_action -- length of a label is not 1..63 characters.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*
|
||||
* Also, if this function is called without calling 'idn_nameinit',
|
||||
* the following error codes might be returned.
|
||||
* idn_nofile -- cannot open the configuration file.
|
||||
* idn_invalid_syntax -- syntax error found in the file.
|
||||
* idn_invalid_name -- there are invalid names (encoding,
|
||||
* normalization etc.).
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_res_decodename(idn_resconf_t ctx, idn_action_t actions, const char *from,
|
||||
char *to, size_t tolen);
|
||||
|
||||
/*
|
||||
* Decode internationalized domain name with auxiliary encoding
|
||||
* support.
|
||||
*
|
||||
* This is another API for IDN string decode. The difference between
|
||||
* two is whether the encoding conversion from auxiliary encoding to
|
||||
* UTF-8 occurs prior to the actual decode process (read description
|
||||
* of idn_res_decodename() above) or not.
|
||||
*
|
||||
* If auxencoding is NULL, from is treated as UTF-8 encoded string.
|
||||
*
|
||||
* Other arguments serve exactly same role as those of
|
||||
* idn_res_decodename().
|
||||
*/
|
||||
idn_result_t
|
||||
idn_res_decodename2(idn_resconf_t ctx, idn_action_t actions, const char *from,
|
||||
char *to, size_t tolen, const char *auxencoding);
|
||||
|
||||
/*
|
||||
* Convert `actions' to a string, and then return the string.
|
||||
* This function is for internal use only.
|
||||
*
|
||||
* Note that this function returns a pointer to static buffer.
|
||||
*/
|
||||
extern const char *
|
||||
idn__res_actionstostring(idn_action_t actions);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IDN_RES_H */
|
||||
|
|
@ -1,323 +0,0 @@
|
|||
/* $Id: resconf.h,v 1.1 2003/06/04 00:25:41 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2000 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_RESCONF_H
|
||||
#define IDN_RESCONF_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* IDN resolver configuration.
|
||||
*/
|
||||
|
||||
#include <idn/export.h>
|
||||
#include <idn/result.h>
|
||||
#include <idn/converter.h>
|
||||
#include <idn/normalizer.h>
|
||||
#include <idn/checker.h>
|
||||
#include <idn/mapper.h>
|
||||
#include <idn/mapselector.h>
|
||||
#include <idn/delimitermap.h>
|
||||
|
||||
/*
|
||||
* Configuration type (opaque).
|
||||
*/
|
||||
typedef struct idn_resconf *idn_resconf_t;
|
||||
|
||||
/*
|
||||
* Initialize.
|
||||
*
|
||||
* Initialize this module and underlying ones. Must be called before
|
||||
* any other functions of this module.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_resconf_initialize(void);
|
||||
|
||||
/*
|
||||
* Create a configuration context.
|
||||
*
|
||||
* Create an empty context and store it in '*ctxp'.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_resconf_create(idn_resconf_t *ctxp);
|
||||
|
||||
/*
|
||||
* Destroy the configuration context.
|
||||
*
|
||||
* Destroy the configuration context created by 'idn_resconf_create',
|
||||
* and release memory for it.
|
||||
*/
|
||||
IDN_EXPORT void
|
||||
idn_resconf_destroy(idn_resconf_t ctx);
|
||||
|
||||
/*
|
||||
* Increment reference count of the context created by 'idn_resconf_create'.
|
||||
*/
|
||||
IDN_EXPORT void
|
||||
idn_resconf_incrref(idn_resconf_t ctx);
|
||||
|
||||
/*
|
||||
* Set default configurations to resconf context.
|
||||
*
|
||||
* "default configurations" means current nameprep and IDN encoding
|
||||
* which IDN standard document suggests.
|
||||
*
|
||||
* Warning: configurations set previously are removed.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_invalid_syntax -- syntax error found.
|
||||
* idn_invalid_name -- invalid encoding/nomalization name is
|
||||
* specified.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_resconf_setdefaults(idn_resconf_t ctx);
|
||||
|
||||
/*
|
||||
* Load configuration file.
|
||||
*
|
||||
* Parse a configuration file whose name is specified by 'file',
|
||||
* store the result in 'ctx'. If 'file' is NULL, the default file is
|
||||
* loaded.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nofile -- couldn't open specified file.
|
||||
* idn_invalid_syntax -- syntax error found.
|
||||
* idn_invalid_name -- invalid encoding/nomalization name is
|
||||
* specified.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_resconf_loadfile(idn_resconf_t ctx, const char *file);
|
||||
|
||||
/*
|
||||
* Get the pathname of the default configuration file.
|
||||
*
|
||||
* Returns:
|
||||
* the pathname of the default configuration file.
|
||||
*/
|
||||
IDN_EXPORT char *
|
||||
idn_resconf_defaultfile(void);
|
||||
|
||||
/*
|
||||
* Get an object of lower module that `ctx' holds.
|
||||
*/
|
||||
IDN_EXPORT idn_delimitermap_t
|
||||
idn_resconf_getdelimitermap(idn_resconf_t ctx);
|
||||
|
||||
IDN_EXPORT idn_converter_t
|
||||
idn_resconf_getidnconverter(idn_resconf_t ctx);
|
||||
|
||||
IDN_EXPORT idn_converter_t
|
||||
idn_resconf_getauxidnconverter(idn_resconf_t ctx);
|
||||
|
||||
IDN_EXPORT idn_converter_t
|
||||
idn_resconf_getlocalconverter(idn_resconf_t ctx);
|
||||
|
||||
IDN_EXPORT idn_mapselector_t
|
||||
idn_resconf_getlocalmapselector(idn_resconf_t ctx);
|
||||
|
||||
IDN_EXPORT idn_mapper_t
|
||||
idn_resconf_getmapper(idn_resconf_t ctx);
|
||||
|
||||
IDN_EXPORT idn_normalizer_t
|
||||
idn_resconf_getnormalizer(idn_resconf_t ctx);
|
||||
|
||||
IDN_EXPORT idn_checker_t
|
||||
idn_resconf_getprohibitchecker(idn_resconf_t ctx);
|
||||
|
||||
IDN_EXPORT idn_checker_t
|
||||
idn_resconf_getunassignedchecker(idn_resconf_t ctx);
|
||||
|
||||
IDN_EXPORT idn_checker_t
|
||||
idn_resconf_getbidichecker(idn_resconf_t ctx);
|
||||
|
||||
/*
|
||||
* Set an object of lower module to `ctx'.
|
||||
*/
|
||||
IDN_EXPORT void
|
||||
idn_resconf_setdelimitermap(idn_resconf_t ctx,
|
||||
idn_delimitermap_t delimiter_mapper);
|
||||
|
||||
IDN_EXPORT void
|
||||
idn_resconf_setidnconverter(idn_resconf_t ctx,
|
||||
idn_converter_t idn_coverter);
|
||||
|
||||
IDN_EXPORT void
|
||||
idn_resconf_setauxidnconverter(idn_resconf_t ctx,
|
||||
idn_converter_t aux_idn_coverter);
|
||||
|
||||
IDN_EXPORT void
|
||||
idn_resconf_setlocalconverter(idn_resconf_t ctx,
|
||||
idn_converter_t local_converter);
|
||||
|
||||
IDN_EXPORT void
|
||||
idn_resconf_setlocalmapselector(idn_resconf_t ctx,
|
||||
idn_mapselector_t map_selector);
|
||||
|
||||
IDN_EXPORT void
|
||||
idn_resconf_setmapper(idn_resconf_t ctx, idn_mapper_t mapper);
|
||||
|
||||
IDN_EXPORT void
|
||||
idn_resconf_setnormalizer(idn_resconf_t ctx, idn_normalizer_t normalizer);
|
||||
|
||||
IDN_EXPORT void
|
||||
idn_resconf_setprohibitchecker(idn_resconf_t ctx,
|
||||
idn_checker_t prohibit_checker);
|
||||
|
||||
IDN_EXPORT void
|
||||
idn_resconf_setunassignedchecker(idn_resconf_t ctx,
|
||||
idn_checker_t unassigned_checker);
|
||||
|
||||
IDN_EXPORT void
|
||||
idn_resconf_setbidichecker(idn_resconf_t ctx,
|
||||
idn_checker_t bidi_checker);
|
||||
|
||||
/*
|
||||
* Set name or add names to an object of lower module that `ctx' holds.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_resconf_setidnconvertername(idn_resconf_t ctx, const char *name,
|
||||
int flags);
|
||||
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_resconf_setauxidnconvertername(idn_resconf_t ctx, const char *name,
|
||||
int flags);
|
||||
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_resconf_addalldelimitermapucs(idn_resconf_t ctx, unsigned long *v, int nv);
|
||||
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_resconf_setlocalconvertername(idn_resconf_t ctx, const char *name,
|
||||
int flags);
|
||||
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_resconf_addalllocalmapselectornames(idn_resconf_t ctx, const char *tld,
|
||||
const char **names, int nnames);
|
||||
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_resconf_addallmappernames(idn_resconf_t ctx, const char **names,
|
||||
int nnames);
|
||||
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_resconf_addallnormalizernames(idn_resconf_t ctx, const char **names,
|
||||
int nnames);
|
||||
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_resconf_addallprohibitcheckernames(idn_resconf_t ctx, const char **names,
|
||||
int nnames);
|
||||
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_resconf_addallunassignedcheckernames(idn_resconf_t ctx, const char **names,
|
||||
int nnames);
|
||||
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_resconf_addallbidicheckernames(idn_resconf_t ctx, const char **names,
|
||||
int nnames);
|
||||
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_resconf_setnameprepversion(idn_resconf_t ctx, const char *version);
|
||||
|
||||
/*
|
||||
* These macros are provided for backward compatibility to mDNkit 2.1
|
||||
* and older.
|
||||
*/
|
||||
IDN_EXPORT void
|
||||
idn_resconf_setalternateconverter(idn_resconf_t ctx,
|
||||
idn_converter_t alternate_converter);
|
||||
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_resconf_setalternateconvertername(idn_resconf_t ctx, const char *name,
|
||||
int flags);
|
||||
|
||||
IDN_EXPORT idn_converter_t
|
||||
idn_resconf_getalternateconverter(idn_resconf_t ctx);
|
||||
|
||||
|
||||
/*
|
||||
* These macros are provided for backward compatibility to idnkit 1.x.
|
||||
*/
|
||||
#define idn_resconf_localconverter(ctx) \
|
||||
idn_resconf_getlocalconverter(ctx)
|
||||
|
||||
#define idn_resconf_idnconverter(ctx) \
|
||||
idn_resconf_getidnconverter(ctx)
|
||||
|
||||
#define idn_resconf_alternateconverter(ctx) \
|
||||
idn_resconf_getalternateconverter(ctx)
|
||||
|
||||
#define idn_resconf_normalizer(ctx) \
|
||||
idn_resconf_getnormalizer(ctx)
|
||||
|
||||
#define idn_resconf_mapper(ctx) \
|
||||
idn_resconf_getmapper(ctx)
|
||||
|
||||
#define idn_resconf_delimitermap(ctx) \
|
||||
idn_resconf_getdelimitermap(ctx)
|
||||
|
||||
#define idn_resconf_localmapselector(ctx) \
|
||||
idn_resconf_getlocalmapselector(ctx)
|
||||
|
||||
#define idn_resconf_prohibitchecker(ctx) \
|
||||
idn_resconf_getprohibitchecker(ctx)
|
||||
|
||||
#define idn_resconf_unassignedchecker(ctx) \
|
||||
idn_resconf_getunassignedchecker(ctx)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IDN_RESCONF_H */
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
/* $Id: result.h,v 1.1 2003/06/04 00:25:42 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2000 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_RESULT_H
|
||||
#define IDN_RESULT_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <idn/export.h>
|
||||
|
||||
/*
|
||||
* libidnkit result code.
|
||||
*/
|
||||
typedef enum {
|
||||
idn_success,
|
||||
idn_notfound,
|
||||
idn_invalid_encoding,
|
||||
idn_invalid_syntax,
|
||||
idn_invalid_name,
|
||||
idn_invalid_message,
|
||||
idn_invalid_action,
|
||||
idn_invalid_codepoint,
|
||||
idn_invalid_length,
|
||||
idn_buffer_overflow,
|
||||
idn_noentry,
|
||||
idn_nomemory,
|
||||
idn_nofile,
|
||||
idn_nomapping,
|
||||
idn_context_required,
|
||||
idn_prohibited,
|
||||
idn_failure /* !!This must be the last one!! */
|
||||
} idn_result_t;
|
||||
|
||||
/*
|
||||
* Get the string description of a result code.
|
||||
*/
|
||||
IDN_EXPORT char *
|
||||
idn_result_tostring(idn_result_t result);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IDN_RESULT_H */
|
||||
|
|
@ -1,123 +0,0 @@
|
|||
/* $Id: strhash.h,v 1.1 2003/06/04 00:25:42 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2000 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_STRHASH_H
|
||||
#define IDN_STRHASH_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* String-keyed hash table
|
||||
*
|
||||
* Just a hash table. Nothing special. Number of hash buckets
|
||||
* grows automatically.
|
||||
*/
|
||||
|
||||
#include <idn/result.h>
|
||||
|
||||
/*
|
||||
* Hash table type, which is opaque.
|
||||
*/
|
||||
typedef struct idn__strhash *idn__strhash_t;
|
||||
|
||||
/*
|
||||
* Hash value free proc.
|
||||
*/
|
||||
typedef void (*idn__strhash_freeproc_t)(void *value);
|
||||
|
||||
/*
|
||||
* Create a hash table.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
extern idn_result_t
|
||||
idn__strhash_create(idn__strhash_t *hashp);
|
||||
|
||||
/*
|
||||
* Delete a hash table created by 'idn__strhash_create'.
|
||||
* If 'proc' is not NULL, it is called for each value in the
|
||||
* hash to release memory for them.
|
||||
*/
|
||||
extern void
|
||||
idn__strhash_destroy(idn__strhash_t hash, idn__strhash_freeproc_t proc);
|
||||
|
||||
/*
|
||||
* Register an item to the hash table. This function makes a
|
||||
* private copy of the key string.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
extern idn_result_t
|
||||
idn__strhash_put(idn__strhash_t hash, const char *key, void *value);
|
||||
|
||||
/*
|
||||
* Find an item with the specified key.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok. found.
|
||||
* idn_noentry -- not found.
|
||||
*/
|
||||
extern idn_result_t
|
||||
idn__strhash_get(idn__strhash_t hash, const char *key, void **valuep);
|
||||
|
||||
/*
|
||||
* Check if an item with the specified key exists.
|
||||
*
|
||||
* Returns:
|
||||
* 1 -- yes.
|
||||
* 0 -- no.
|
||||
*/
|
||||
extern int
|
||||
idn__strhash_exists(idn__strhash_t hash, const char *key);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IDN_STRHASH_H */
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
/* $Id: ucs4.h,v 1.1 2003/06/04 00:25:42 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2002 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_UCS4_H
|
||||
#define IDN_UCS4_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* UCS4 encoded string facility.
|
||||
*/
|
||||
|
||||
#include <idn/export.h>
|
||||
#include <idn/result.h>
|
||||
|
||||
/*
|
||||
* UCS4 to UTF-16 conversion and vice versa.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_ucs4_ucs4toutf16(const unsigned long *ucs4, unsigned short *utf16,
|
||||
size_t tolen);
|
||||
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_ucs4_utf16toucs4(const unsigned short *utf16, unsigned long *ucs4,
|
||||
size_t tolen);
|
||||
|
||||
/*
|
||||
* UCS4 to UTF-8 conversion and vice versa.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_ucs4_utf8toucs4(const char *utf8, unsigned long *ucs4, size_t tolen);
|
||||
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_ucs4_ucs4toutf8(const unsigned long *ucs4, char *utf8, size_t tolen);
|
||||
|
||||
/*
|
||||
* UCS4 version of string operation functions.
|
||||
*/
|
||||
IDN_EXPORT size_t
|
||||
idn_ucs4_strlen(const unsigned long *ucs4);
|
||||
|
||||
IDN_EXPORT unsigned long *
|
||||
idn_ucs4_strcpy(unsigned long *to, const unsigned long *from);
|
||||
|
||||
IDN_EXPORT unsigned long *
|
||||
idn_ucs4_strcat(unsigned long *to, const unsigned long *from);
|
||||
|
||||
IDN_EXPORT int
|
||||
idn_ucs4_strcmp(const unsigned long *str1, const unsigned long *str2);
|
||||
|
||||
IDN_EXPORT int
|
||||
idn_ucs4_strcasecmp(const unsigned long *str1, const unsigned long *str2);
|
||||
|
||||
IDN_EXPORT unsigned long *
|
||||
idn_ucs4_strdup(const unsigned long *str);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IDN_UCS4_H */
|
||||
|
|
@ -1,131 +0,0 @@
|
|||
/* $Id: ucsmap.h,v 1.1 2003/06/04 00:25:42 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2001 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_UCSMAP_H
|
||||
#define IDN_UCSMAP_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Perform UCS character mapping.
|
||||
* This module support one-to-N mapping (N may be zero, one or more).
|
||||
*/
|
||||
|
||||
#include <idn/export.h>
|
||||
#include <idn/result.h>
|
||||
|
||||
/*
|
||||
* Mapper type (opaque).
|
||||
*/
|
||||
typedef struct idn_ucsmap *idn_ucsmap_t;
|
||||
|
||||
/*
|
||||
* Create an empty mapping. The reference count is set to 1.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_ucsmap_create(idn_ucsmap_t *ctxp);
|
||||
|
||||
/*
|
||||
* Decrement the reference count of the given set, and if it reaches zero,
|
||||
* release all the memory allocated for it.
|
||||
*/
|
||||
IDN_EXPORT void
|
||||
idn_ucsmap_destroy(idn_ucsmap_t ctx);
|
||||
|
||||
/*
|
||||
* Increment the reference count of the given set by one, so that
|
||||
* the map can be shared.
|
||||
*/
|
||||
IDN_EXPORT void
|
||||
idn_ucsmap_incrref(idn_ucsmap_t ctx);
|
||||
|
||||
/*
|
||||
* Add a mapping.
|
||||
* 'ucs' is the character to be mapped, 'map' points an array of mapped
|
||||
* characters of length 'maplen'. 'map' may be NULL if 'maplen' is zero,
|
||||
* meaning one-to-none mapping.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomemory -- malloc failed.
|
||||
* idn_failure -- already fixed by 'idn_ucsmap_fix',
|
||||
* or too large maplen.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_ucsmap_add(idn_ucsmap_t ctx, unsigned long ucs, unsigned long *map,
|
||||
size_t maplen);
|
||||
|
||||
/*
|
||||
* Perform internal arrangement of the map for lookup.
|
||||
* Once it is fixed, 'idn_ucsmap_add' cannot be permitted to the map.
|
||||
*/
|
||||
IDN_EXPORT void
|
||||
idn_ucsmap_fix(idn_ucsmap_t ctx);
|
||||
|
||||
/*
|
||||
* Find the mapping for the given character.
|
||||
* 'idn_ucsmap_fix' must be performed before calling this function.
|
||||
* Find the mapping for 'v' and store the result to 'to'. The length
|
||||
* of the mapped sequence is stored in '*maplenp'. 'tolen' specifies
|
||||
* the length allocated for 'to'.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomapping -- specified character has no mapping.
|
||||
* idn_failure -- not fixed by 'idn_ucsmap_fix' yet.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_ucsmap_map(idn_ucsmap_t ctx, unsigned long v, unsigned long *to,
|
||||
size_t tolen, size_t *maplenp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IDN_UCSMAP_H */
|
||||
|
|
@ -1,145 +0,0 @@
|
|||
/* $Id: ucsset.h,v 1.1 2003/06/04 00:25:43 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2001 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_UCSSET_H
|
||||
#define IDN_UCSSET_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* A 'set' of UCS codepoints.
|
||||
*/
|
||||
|
||||
#include <idn/export.h>
|
||||
#include <idn/result.h>
|
||||
|
||||
/*
|
||||
* Type representing a set (opaque).
|
||||
*/
|
||||
typedef struct idn_ucsset *idn_ucsset_t;
|
||||
|
||||
|
||||
/*
|
||||
* Create an empty set. The reference count is set to 1.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomemory -- malloc failed.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_ucsset_create(idn_ucsset_t *ctxp);
|
||||
|
||||
/*
|
||||
* Decrement the reference count of the given set, and if it reaches zero,
|
||||
* release all the memory allocated for it.
|
||||
*/
|
||||
IDN_EXPORT void
|
||||
idn_ucsset_destroy(idn_ucsset_t ctx);
|
||||
|
||||
/*
|
||||
* Increments the reference count by one.
|
||||
*/
|
||||
IDN_EXPORT void
|
||||
idn_ucsset_incrref(idn_ucsset_t ctx);
|
||||
|
||||
/*
|
||||
* Add a UCS code point to the set.
|
||||
* The set must be in the building phase -- that is, before 'idn_ucsset_fix'
|
||||
* is called for the set.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_invalid_code -- code point out of range.
|
||||
* idn_nomemory -- malloc failed.
|
||||
* idn_failure -- already fixed by 'idn_ucsset_fix'.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_ucsset_add(idn_ucsset_t ctx, unsigned long v);
|
||||
|
||||
/*
|
||||
* Add a range of code points (from 'from' to 'to', inclusive) to the set.
|
||||
* 'from' must not be greater than 'to'.
|
||||
* This function is similar to 'idn_ucsset_add' except that it accepts
|
||||
* range of code points.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_invalid_code -- code point out of range, or the range
|
||||
* specification is invalid.
|
||||
* idn_nomemory -- malloc failed.
|
||||
* idn_failure -- already fixed by 'idn_ucsset_fix'.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_ucsset_addrange(idn_ucsset_t ctx, unsigned long from, unsigned long to);
|
||||
|
||||
/*
|
||||
* Perform internal arrangement of the set for lookup.
|
||||
* Before calling this function, a set is in 'building' phase, and code
|
||||
* points can be added freely by 'idn_ucsset_add' or 'idn_ucsset_addrange'.
|
||||
* But once it is fixed by this function, the set becomes immutable, and
|
||||
* it shifts into 'lookup' phase.
|
||||
*/
|
||||
IDN_EXPORT void
|
||||
idn_ucsset_fix(idn_ucsset_t ctx);
|
||||
|
||||
/*
|
||||
* Find if the given code point is in the set.
|
||||
* The set must be in the lookup phase -- in other words, 'idn_ucsset_fix'
|
||||
* must be called for the set before calling this function.
|
||||
* '*found' is set to 1 if the specified code point is in the set, 0 otherwise.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_invalid_code -- specified code point is out of range.
|
||||
* idn_failure -- not fixed by 'idn_ucsset_fix' yet.
|
||||
*/
|
||||
IDN_EXPORT idn_result_t
|
||||
idn_ucsset_lookup(idn_ucsset_t ctx, unsigned long v, int *found);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IDN_UCSSET_H */
|
||||
|
|
@ -1,164 +0,0 @@
|
|||
/* $Id: unicode.h,v 1.1 2003/06/04 00:25:43 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2000,2001 Japan Network Information Center.
|
||||
* All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_UNICODE_H
|
||||
#define IDN_UNICODE_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Unicode attributes retriever.
|
||||
*
|
||||
* All the information this module provides is based on UnicodeData.txt,
|
||||
* CompositionExclusions-1.txt and SpecialCasing.txt, all of which can be
|
||||
* obtained from unicode.org.
|
||||
*
|
||||
* Unicode characters are represented as 'unsigned long'.
|
||||
*/
|
||||
|
||||
#include <idn/result.h>
|
||||
|
||||
/*
|
||||
* A Handle for Unicode versions.
|
||||
*/
|
||||
typedef struct idn__unicode_ops *idn__unicode_version_t;
|
||||
|
||||
/*
|
||||
* Context information for case conversion.
|
||||
*/
|
||||
typedef enum {
|
||||
idn__unicode_context_unknown,
|
||||
idn__unicode_context_final,
|
||||
idn__unicode_context_nonfinal
|
||||
} idn__unicode_context_t;
|
||||
|
||||
/*
|
||||
* Create a handle for a specific Unicode version.
|
||||
* The version number (such as "3.0.1") is specified by 'version' parameter.
|
||||
* If it is NULL, the latest version is used.
|
||||
* The handle is stored in '*versionp', which is used various functions
|
||||
* in this and unormalize modules.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_notfound -- specified version not found.
|
||||
*/
|
||||
extern idn_result_t
|
||||
idn__unicode_create(const char *version, idn__unicode_version_t *versionp);
|
||||
|
||||
/*
|
||||
* Close a handle which was created by 'idn__unicode_create'.
|
||||
*/
|
||||
extern void
|
||||
idn__unicode_destroy(idn__unicode_version_t version);
|
||||
|
||||
/*
|
||||
* Get canonical class.
|
||||
*
|
||||
* For characters out of unicode range (i.e. above 0xffff), 0 will
|
||||
* be returned.
|
||||
*/
|
||||
extern int
|
||||
idn__unicode_canonicalclass(idn__unicode_version_t version, unsigned long c);
|
||||
|
||||
/*
|
||||
* Decompose a character.
|
||||
*
|
||||
* Decompose character given by 'c', and put the result into 'v',
|
||||
* which can hold 'vlen' characters. The number of decomposed characters
|
||||
* will be stored in '*decomp_lenp'.
|
||||
*
|
||||
* If 'compat' is true, compatibility decomposition is performed.
|
||||
* Otherwise canonical decomposition is done.
|
||||
*
|
||||
* Since decomposition is done recursively, no further decomposition
|
||||
* will be needed.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok, decomposed.
|
||||
* idn_notfound -- no decomposition possible.
|
||||
* idn_buffer_overflow -- 'vlen' is too small.
|
||||
*/
|
||||
extern idn_result_t
|
||||
idn__unicode_decompose(idn__unicode_version_t version,
|
||||
int compat, unsigned long *v, size_t vlen,
|
||||
unsigned long c, int *decomp_lenp);
|
||||
|
||||
/*
|
||||
* Perform canonical composition.
|
||||
*
|
||||
* Do canonical composition to the character sequence 'c1' and 'c2', put the
|
||||
* result into '*compp'.
|
||||
*
|
||||
* Since Unicode Nomalization Froms requires only canonical composition,
|
||||
* compatibility composition is not supported.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok, composed.
|
||||
* idn_notfound -- no composition possible.
|
||||
*/
|
||||
extern idn_result_t
|
||||
idn__unicode_compose(idn__unicode_version_t version,
|
||||
unsigned long c1, unsigned long c2, unsigned long *compp);
|
||||
|
||||
/*
|
||||
* Returns if there may be a canonical composition sequence which starts
|
||||
* with the given character.
|
||||
*
|
||||
* Returns:
|
||||
* 1 -- there may be a composition sequence
|
||||
* (maybe not).
|
||||
* 0 -- no, there is definitely no such sequences.
|
||||
*/
|
||||
extern int
|
||||
idn__unicode_iscompositecandidate(idn__unicode_version_t version,
|
||||
unsigned long c);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IDN_UNICODE_H */
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
/* $Id: unormalize.h,v 1.1 2003/06/04 00:25:44 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2000,2001 Japan Network Information Center.
|
||||
* All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_UNORMALIZE_H
|
||||
#define IDN_UNORMALIZE_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Unicode Normalizations.
|
||||
*
|
||||
* Perform 4 normalizations defined by 'Unicode Normalization Forms'
|
||||
* (http://www.unicode.org/unicode/reports/tr15)
|
||||
*
|
||||
* All of the functions use UCS4 encoding for input/output.
|
||||
*/
|
||||
|
||||
#include <idn/result.h>
|
||||
#include <idn/unicode.h>
|
||||
|
||||
/*
|
||||
* Perform Unicode Normalication Form C and KC.
|
||||
*
|
||||
* They take NUL-terminated UCS4 encoded string 'from', perform
|
||||
* the normalization specified by 'version', put the result
|
||||
* (also a NUL-terminated UCS4 encoded string) to 'to', which must be
|
||||
* able to hold at least 'tolen' bytes.
|
||||
*
|
||||
* Returns:
|
||||
* idn_success -- ok.
|
||||
* idn_nomemory -- malloc failed.
|
||||
* idn_buffer_overflow -- 'tolen' is too small.
|
||||
*/
|
||||
extern idn_result_t
|
||||
idn__unormalize_formkc(idn__unicode_version_t version,
|
||||
const unsigned long *from, unsigned long *to,
|
||||
size_t tolen);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IDN_UNORMALIZE_H */
|
||||
|
|
@ -1,137 +0,0 @@
|
|||
/* $Id: utf8.h,v 1.1 2003/06/04 00:25:44 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2000 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_UTF8_H
|
||||
#define IDN_UTF8_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* UTF-8 encoded string facility.
|
||||
*/
|
||||
|
||||
#include <idn/export.h>
|
||||
|
||||
/*
|
||||
* Get the length of a character.
|
||||
*
|
||||
* Get the length (in bytes) of a character whose first byte is pointed
|
||||
* by 's'. Since this function only looks one first byte to determine the
|
||||
* length, it is possible some of the following bytes are invalid.
|
||||
*/
|
||||
IDN_EXPORT int
|
||||
idn_utf8_mblen(const char *s);
|
||||
|
||||
/*
|
||||
* Get one character.
|
||||
*
|
||||
* Get the first character of the string pointed by 's', and copy it
|
||||
* to 'buf', whose length is 'len'. Returns the number of bytes copied,
|
||||
* or zero if the encoding is invalid or len is too small.
|
||||
*
|
||||
* The area pointed by 'buf' must be large enough to store any UTF-8 encoded
|
||||
* character.
|
||||
*
|
||||
* Note that the copied string is not NUL-terminated.
|
||||
*/
|
||||
IDN_EXPORT int
|
||||
idn_utf8_getmb(const char *s, size_t len, char *buf);
|
||||
|
||||
/*
|
||||
* Get one character in UCS-4.
|
||||
*
|
||||
* Similar to 'idn_utf8_getmb', except that the result is not in UTF-8
|
||||
* encoding, but in UCS-4 format (plain 32bit integer value).
|
||||
*/
|
||||
IDN_EXPORT int
|
||||
idn_utf8_getwc(const char *s, size_t len, unsigned long *vp);
|
||||
|
||||
/*
|
||||
* Put one character.
|
||||
*
|
||||
* This function is an opposite of 'idn_utf8_getwc'. It takes a UCS-4
|
||||
* value 'v', convert it to UTF-8 encoded sequence, and store it to 's',
|
||||
* whose length is 'len'. It returns the number of bytes written, or
|
||||
* zero 'v' is out of range or 'len' is too small.
|
||||
*/
|
||||
IDN_EXPORT int
|
||||
idn_utf8_putwc(char *s, size_t len, unsigned long v);
|
||||
|
||||
/*
|
||||
* Check the validity of UTF-8 encoded character.
|
||||
*
|
||||
* Check if the character pointed by 's' is a valid UTF-8 encoded
|
||||
* character. Return the length of the character (in bytes) if it is valid,
|
||||
* 0 otherwise.
|
||||
*/
|
||||
IDN_EXPORT int
|
||||
idn_utf8_isvalidchar(const char *s);
|
||||
|
||||
/*
|
||||
* Check the validity of UTF-8 encoded string.
|
||||
*
|
||||
* Check if the NUL-terminated string 's' is valid as a UTF-8 encoded
|
||||
* string. Return 1 if it is valid, 0 otherwise.
|
||||
*/
|
||||
IDN_EXPORT int
|
||||
idn_utf8_isvalidstring(const char *s);
|
||||
|
||||
/*
|
||||
* Find first byte of a character.
|
||||
*
|
||||
* Find the first byte of a character 's' points to. 's' may point
|
||||
* the 2nd or later byte of a character. 'known_top' is a pointer to
|
||||
* a string which contains 's', and is known to be the first byte of
|
||||
* a character. If it couldn't find the first byte between 'known_top'
|
||||
* and 's', NULL will be returned.
|
||||
*/
|
||||
IDN_EXPORT char *
|
||||
idn_utf8_findfirstbyte(const char *s, const char *known_top);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IDN_UTF8_H */
|
||||
|
|
@ -1,98 +0,0 @@
|
|||
/* $Id: util.h,v 1.1 2003/06/04 00:25:44 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2000,2002 Japan Network Information Center.
|
||||
* All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_UTIL_H
|
||||
#define IDN_UTIL_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Utility functions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Check ACE prefix.
|
||||
*
|
||||
* These functions examine whether `str' begins with `prefix'.
|
||||
* They disregard the case difference of ASCII letters ([A-Za-z]).
|
||||
* They return 1 if `str' has the ACE prefix, 0 otherwise.
|
||||
*/
|
||||
extern int
|
||||
idn__util_asciihaveaceprefix(const char *str, const char *prefix);
|
||||
extern int
|
||||
idn__util_ucs4haveaceprefix(const unsigned long *str, const char *prefix);
|
||||
|
||||
/*
|
||||
* Check if all codepoints in the UCS4 string `str' are in the ASCII
|
||||
* range (i.e. U+0000...U+007F).
|
||||
*
|
||||
* The function return 1 if it is, 0 otherwise.
|
||||
*/
|
||||
extern int
|
||||
idn__util_ucs4isasciirange(const unsigned long *str);
|
||||
|
||||
/*
|
||||
* Get registry information from the system. (Windows only)
|
||||
*/
|
||||
#ifdef WIN32
|
||||
/*
|
||||
* registry top type.
|
||||
*/
|
||||
typedef enum {
|
||||
idn__util_hkey_currentuser,
|
||||
idn__util_hkey_localmachine
|
||||
} idn__util_hkey_t;
|
||||
|
||||
extern int
|
||||
idn__util_getregistrystring(idn__util_hkey_t topkey, const char *name,
|
||||
char *str, size_t length);
|
||||
#endif /* WIN32 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IDN_UTIL_H */
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
/* $Id: version.h,v 1.1 2003/06/04 00:25:44 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2001 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef IDN_VERSION_H
|
||||
#define IDN_VERSION_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <idn/export.h>
|
||||
|
||||
/*
|
||||
* Version number of this package.
|
||||
*/
|
||||
#define IDNKIT_VERSION "1.0"
|
||||
#define IDNKIT_MAJOR_VERSION 1
|
||||
#define IDNKIT_MINOR_VERSION 0
|
||||
|
||||
/*
|
||||
* Get the version of the library (libidnkit).
|
||||
*/
|
||||
IDN_EXPORT const char *
|
||||
idn_version_getstring(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IDN_VERSION_H */
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
# $Id: Makefile.in,v 1.1 2003/06/04 00:25:45 marka Exp $
|
||||
# Copyright (c) 2000 Japan Network Information Center. All rights reserved.
|
||||
#
|
||||
# By using this file, you agree to the terms and conditions set forth bellow.
|
||||
#
|
||||
# LICENSE TERMS AND CONDITIONS
|
||||
#
|
||||
# The following License Terms and Conditions apply, unless a different
|
||||
# license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
# Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
#
|
||||
# 1. Use, Modification and Redistribution (including distribution of any
|
||||
# modified or derived work) in source and/or binary forms is permitted
|
||||
# under this License Terms and Conditions.
|
||||
#
|
||||
# 2. Redistribution of source code must retain the copyright notices as they
|
||||
# appear in each source code file, this License Terms and Conditions.
|
||||
#
|
||||
# 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
# this License Terms and Conditions, in the documentation and/or other
|
||||
# materials provided with the distribution. For the purposes of binary
|
||||
# distribution the "Copyright Notice" refers to the following language:
|
||||
# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
#
|
||||
# 4. The name of JPNIC may not be used to endorse or promote products
|
||||
# derived from this Software without specific prior written approval of
|
||||
# JPNIC.
|
||||
#
|
||||
# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
includedir = @includedir@
|
||||
mdnincludedir = $(includedir)/mdn
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
MKINSTALLDIRS = @top_srcdir@/mkinstalldirs
|
||||
SHELL = @SHELL@
|
||||
|
||||
HDRS = \
|
||||
api.h \
|
||||
log.h \
|
||||
res.h \
|
||||
resconf.h \
|
||||
result.h \
|
||||
utf8.h \
|
||||
version.h
|
||||
|
||||
all:
|
||||
|
||||
@COMPAT_TRUE@install: all install-compat
|
||||
@COMPAT_FALSE@install:
|
||||
|
||||
install-compat:
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(mdnincludedir)
|
||||
for hdr in $(HDRS); do \
|
||||
$(INSTALL_DATA) $(srcdir)/$$hdr $(DESTDIR)$(mdnincludedir)/$$hdr; \
|
||||
done
|
||||
|
||||
clean:
|
||||
rm -f *~
|
||||
|
||||
distclean:
|
||||
rm -f Makefile
|
||||
|
||||
test check:
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
/* $Id: api.h,v 1.1 2003/06/04 00:25:45 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2001,2002 Japan Network Information Center.
|
||||
* All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef MDN_API_H
|
||||
#define MDN_API_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mdn/result.h>
|
||||
#include <mdn/res.h>
|
||||
#include <idn/api.h>
|
||||
|
||||
#define mdn_enable idn_enable
|
||||
|
||||
extern idn_result_t
|
||||
mdn_nameinit(void);
|
||||
|
||||
extern idn_result_t
|
||||
mdn_encodename(int actions, const char *from, char *to, size_t tolen);
|
||||
|
||||
extern idn_result_t
|
||||
mdn_decodename(int actions, const char *from, char *to, size_t tolen);
|
||||
|
||||
#define mdn_localtoutf8(from, to, tolen) \
|
||||
mdn_encodename(IDN_LOCALCONV, from, to, len)
|
||||
#define mdn_delimitermap(from, to, tolen) \
|
||||
mdn_encodename(IDN_DELIMMAP, from, to, len)
|
||||
#define mdn_localmap(from, to, tolen) \
|
||||
mdn_encodename(IDN_LOCALMAP, from, to, len)
|
||||
#define mdn_nameprep(from, to, tolen) \
|
||||
mdn_encodename(IDN_NAMEPREP, from, to, len)
|
||||
#define mdn_utf8toidn(from, to, tolen) \
|
||||
mdn_encodename(IDN_IDNCONV, from, to, len)
|
||||
#define mdn_idntoutf8(from, to, tolen) \
|
||||
mdn_decodename(IDN_IDNCONV, from, to, tolen)
|
||||
#define mdn_utf8tolocal(from, to, tolen) \
|
||||
mdn_decodename(IDN_LOCALCONV, from, to, tolen)
|
||||
|
||||
#define mdn_localtoidn(from, to, tolen) \
|
||||
mdn_encodename(IDN_ENCODE_APP, from, to, tolen)
|
||||
#define mdn_idntolocal(from, to, tolen) \
|
||||
mdn_decodename(IDN_DECODE_APP, from, to, tolen)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* MDN_API_H */
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
/* $Id: localencoding.h,v 1.1 2003/06/04 00:25:45 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2000 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef MDN_LOCALENCODING_H
|
||||
#define MDN_LOCALENCODING_H 1
|
||||
|
||||
#define MDN_LOCALCS_ENV "MDN_LOCAL_CODESET"
|
||||
|
||||
#endif /* MDN_LOCALENCODING_H */
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
/* $Id: log.h,v 1.1 2003/06/04 00:25:45 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2000 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef MDN_LOG_H
|
||||
#define MDN_LOG_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <idn/log.h>
|
||||
|
||||
#define mdn_log_proc_t \
|
||||
idn_log_proc_t
|
||||
|
||||
#define mdn_log_level_fatal \
|
||||
idn_log_level_fatal
|
||||
#define mdn_log_level_error \
|
||||
idn_log_level_error
|
||||
#define mdn_log_level_warning \
|
||||
idn_log_level_warning
|
||||
#define mdn_log_level_info \
|
||||
idn_log_level_info
|
||||
#define mdn_log_level_trace \
|
||||
idn_log_level_trace
|
||||
#define mdn_log_level_dump \
|
||||
idn_log_level_dump
|
||||
|
||||
#define mdn_log_fatal \
|
||||
idn_log_fatal
|
||||
#define mdn_log_error \
|
||||
idn_log_error
|
||||
#define mdn_log_warning \
|
||||
idn_log_warning
|
||||
#define mdn_log_info \
|
||||
idn_log_info
|
||||
#define mdn_log_trace \
|
||||
idn_log_trace
|
||||
#define mdn_log_dump \
|
||||
idn_log_dump
|
||||
#define mdn_log_setlevel \
|
||||
idn_log_setlevel
|
||||
#define mdn_log_getlevel \
|
||||
idn_log_getlevel
|
||||
#define mdn_log_setproc \
|
||||
idn_log_setproc
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* MDN_LOG_H */
|
||||
|
|
@ -1,121 +0,0 @@
|
|||
/* $Id: res.h,v 1.1 2003/06/04 00:25:45 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2001,2002 Japan Network Information Center.
|
||||
* All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef MDN_RES_H
|
||||
#define MDN_RES_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mdn/resconf.h>
|
||||
#include <mdn/result.h>
|
||||
#include <idn/res.h>
|
||||
|
||||
#define MDN_LOCALCONV \
|
||||
IDN_LOCALCONV
|
||||
#define MDN_DELIMMAP \
|
||||
IDN_DELIMMAP
|
||||
#define MDN_LOCALMAP \
|
||||
IDN_LOCALMAP
|
||||
#define MDN_MAP \
|
||||
IDN_MAP
|
||||
#define MDN_NORMALIZE \
|
||||
IDN_NORMALIZE
|
||||
#define MDN_PROHCHECK \
|
||||
IDN_PROHCHECK
|
||||
#define MDN_UNASCHECK \
|
||||
IDN_UNASCHECK
|
||||
#define MDN_ASCCHECK \
|
||||
IDN_ASCCHECK
|
||||
#define MDN_IDNCONV \
|
||||
IDN_IDNCONV
|
||||
#define MDN_LENCHECK \
|
||||
IDN_LENCHECK
|
||||
#define MDN_RTCHECK \
|
||||
IDN_RTCHECK
|
||||
#define MDN_UNDOIFERR \
|
||||
IDN_UNDOIFERR
|
||||
#define MDN_ENCODE_APP \
|
||||
IDN_ENCODE_APP
|
||||
#define MDN_DECODE_APP \
|
||||
IDN_DECODE_APP
|
||||
#define MDN_NAMEPREP \
|
||||
IDN_NAMEPREP
|
||||
|
||||
#define mdn_res_enable \
|
||||
idn_res_enable
|
||||
#define mdn_res_encodename \
|
||||
idn_res_encodename
|
||||
#define mdn_res_decodename \
|
||||
idn_res_decodename
|
||||
#define mdn_res_actiontostring \
|
||||
idn_res_actiontostring
|
||||
|
||||
#define mdn_res_localtoutf8 \
|
||||
idn_res_localtoutf8
|
||||
#define mdn_res_delimitermap \
|
||||
idn_res_delimitermap
|
||||
#define mdn_res_localmap \
|
||||
idn_res_localmap
|
||||
#define mdn_res_nameprep \
|
||||
idn_res_nameprep
|
||||
#define mdn_res_utf8toidn \
|
||||
idn_res_utf8toidn
|
||||
#define mdn_res_idntoutf8 \
|
||||
idn_res_idntoutf8
|
||||
#define mdn_res_utf8tolocal \
|
||||
idn_res_utf8tolocal
|
||||
#define mdn_res_nameprepcheck \
|
||||
idn_res_nameprepcheck
|
||||
#define mdn_res_localtoidn \
|
||||
idn_res_localtoidn
|
||||
#define mdn_res_idntolocal \
|
||||
idn_res_idntolocal
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* MDN_RES_H */
|
||||
|
|
@ -1,150 +0,0 @@
|
|||
/* $Id: resconf.h,v 1.1 2003/06/04 00:25:46 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2000 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef MDN_RESCONF_H
|
||||
#define MDN_RESCONF_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mdn/result.h>
|
||||
#include <idn/resconf.h>
|
||||
|
||||
#define mdn_resconf_t \
|
||||
idn_resconf_t
|
||||
|
||||
#define mdn_resconf_initialize \
|
||||
idn_resconf_initialize
|
||||
#define mdn_resconf_create \
|
||||
idn_resconf_create
|
||||
#define mdn_resconf_destroy \
|
||||
idn_resconf_destroy
|
||||
|
||||
#define mdn_resconf_incrref \
|
||||
idn_resconf_incrref
|
||||
#define mdn_resconf_loadfile \
|
||||
idn_resconf_loadfile
|
||||
#define mdn_resconf_defaultfile \
|
||||
idn_resconf_defaultfile
|
||||
#define mdn_resconf_getdelimitermap \
|
||||
idn_resconf_getdelimitermap
|
||||
#define mdn_resconf_getidnconverter \
|
||||
idn_resconf_getidnconverter
|
||||
#define mdn_resconf_getlocalconverter \
|
||||
idn_resconf_getlocalconverter
|
||||
#define mdn_resconf_getlocalmapselector \
|
||||
idn_resconf_getlocalmapselector
|
||||
#define mdn_resconf_getmapper \
|
||||
idn_resconf_getmapper
|
||||
#define mdn_resconf_getnormalizer \
|
||||
idn_resconf_getnormalizer
|
||||
#define mdn_resconf_getprohibitchecker \
|
||||
idn_resconf_getprohibitchecker
|
||||
#define mdn_resconf_getunassignedchecker \
|
||||
idn_resconf_getunassignedchecker
|
||||
#define mdn_resconf_setdelimitermap \
|
||||
idn_resconf_setdelimitermap
|
||||
#define mdn_resconf_setidnconverter \
|
||||
idn_resconf_setidnconverter
|
||||
#define mdn_resconf_setlocalconverter \
|
||||
idn_resconf_setlocalconverter
|
||||
#define mdn_resconf_setlocalmapselector \
|
||||
idn_resconf_setlocalmapselector
|
||||
#define mdn_resconf_setmapper \
|
||||
idn_resconf_setmapper
|
||||
#define mdn_resconf_setnormalizer \
|
||||
idn_resconf_setnormalizer
|
||||
#define mdn_resconf_setprohibitchecker \
|
||||
idn_resconf_setprohibitchecker
|
||||
#define mdn_resconf_setunassignedchecker \
|
||||
idn_resconf_setunassignedchecker
|
||||
#define mdn_resconf_setidnconvertername \
|
||||
idn_resconf_setidnconvertername
|
||||
#define mdn_resconf_addalldelimitermapucs \
|
||||
idn_resconf_addalldelimitermapucs
|
||||
#define mdn_resconf_setlocalconvertername \
|
||||
idn_resconf_setlocalconvertername
|
||||
#define mdn_resconf_addalllocalmapselectornames \
|
||||
idn_resconf_addalllocalmapselectornames
|
||||
#define mdn_resconf_addallmappernames \
|
||||
idn_resconf_addallmappernames
|
||||
#define mdn_resconf_addallnormalizernames \
|
||||
idn_resconf_addallnormalizernames
|
||||
#define mdn_resconf_addallprohibitcheckernames \
|
||||
idn_resconf_addallprohibitcheckernames
|
||||
#define mdn_resconf_addallunassignedcheckernames \
|
||||
idn_resconf_addallunassignedcheckernames
|
||||
#define mdn_resconf_setnameprepversion \
|
||||
idn_resconf_setnameprepversion
|
||||
#define mdn_resconf_setalternateconverter \
|
||||
idn_resconf_setalternateconverter
|
||||
#define mdn_resconf_setalternateconvertername \
|
||||
idn_resconf_setalternateconvertername
|
||||
#define mdn_resconf_getalternateconverter \
|
||||
idn_resconf_getalternateconverter
|
||||
|
||||
#define mdn_resconf_localconverter \
|
||||
idn_resconf_localconverter
|
||||
#define mdn_resconf_idnconverter \
|
||||
idn_resconf_idnconverter
|
||||
#define mdn_resconf_alternateconverter \
|
||||
idn_resconf_alternateconverter
|
||||
#define mdn_resconf_normalizer \
|
||||
idn_resconf_normalizer
|
||||
#define mdn_resconf_mapper \
|
||||
idn_resconf_mapper
|
||||
#define mdn_resconf_delimitermap \
|
||||
idn_resconf_delimitermap
|
||||
#define mdn_resconf_localmapselector \
|
||||
idn_resconf_localmapselector
|
||||
#define mdn_resconf_prohibitchecker \
|
||||
idn_resconf_prohibitchecker
|
||||
#define mdn_resconf_unassignedchecker \
|
||||
idn_resconf_unassignedchecker
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* MDN_RESCONF_H */
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
/* $Id: result.h,v 1.1 2003/06/04 00:25:46 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2000 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef MDN_RESULT_H
|
||||
#define MDN_RESULT_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <idn/result.h>
|
||||
|
||||
#define mdn_result_t \
|
||||
idn_result_t
|
||||
|
||||
#define mdn_success \
|
||||
idn_success
|
||||
#define mdn_notfound \
|
||||
idn_notfound
|
||||
#define mdn_invalid_encoding \
|
||||
idn_invalid_encoding
|
||||
#define mdn_invalid_syntax \
|
||||
idn_invalid_syntax
|
||||
#define mdn_invalid_name \
|
||||
idn_invalid_name
|
||||
#define mdn_invalid_message \
|
||||
idn_invalid_message
|
||||
#define mdn_invalid_action \
|
||||
idn_invalid_action
|
||||
#define mdn_invalid_codepoint \
|
||||
idn_invalid_codepoint
|
||||
#define mdn_invalid_length \
|
||||
idn_invalid_length
|
||||
#define mdn_buffer_overflow \
|
||||
idn_buffer_overflow
|
||||
#define mdn_noentry \
|
||||
idn_noentry
|
||||
#define mdn_nomemory \
|
||||
idn_nomemory
|
||||
#define mdn_nofile \
|
||||
idn_nofile
|
||||
#define mdn_nomapping \
|
||||
idn_nomapping
|
||||
#define mdn_context_required \
|
||||
idn_context_required
|
||||
#define mdn_prohibited \
|
||||
idn_prohibited
|
||||
#define mdn_failure \
|
||||
idn_failure
|
||||
#define mdn_result_tostring \
|
||||
idn_result_tostring
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* MDN_RESULT_H */
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
/* $Id: utf8.h,v 1.1 2003/06/04 00:25:46 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2000 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef MDN_UTF8_H
|
||||
#define MDN_UTF8_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define mdn_utf8_mblen \
|
||||
idn_utf8_mblen
|
||||
#define mdn_utf8_getmb \
|
||||
idn_utf8_getmb
|
||||
#define mdn_utf8_getwc \
|
||||
idn_utf8_getwc
|
||||
#define mdn_utf8_putwc \
|
||||
idn_utf8_putwc
|
||||
#define mdn_utf8_isvalidchar \
|
||||
idn_utf8_isvalidchar
|
||||
#define mdn_utf8_isvalidstring \
|
||||
idn_utf8_isvalidstring
|
||||
#define mdn_utf8_findfirstbyte \
|
||||
idn_utf8_findfirstbyte
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* MDN_UTF8_H */
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
/* $Id: version.h,v 1.1 2003/06/04 00:25:46 marka Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2001 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#ifndef MDN_VERSION_H
|
||||
#define MDN_VERSION_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <idn/version.h>
|
||||
|
||||
/*
|
||||
* Version number of this package.
|
||||
*/
|
||||
#define MDNKIT_VERSION "idnkit " IDNKIT_VERSION
|
||||
#define MDNKIT_MAJOR_VERSION (IDNKIT_MAJOR_VERSION + 4)
|
||||
#define MDNKIT_MINOR_VERSION IDNKIT_MINOR_VERSION
|
||||
|
||||
#define mdn_version_getstring idn_version_getstring
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* MDN_VERSION_H */
|
||||
|
|
@ -1,250 +0,0 @@
|
|||
#! /bin/sh
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||
#
|
||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||
# documentation for any purpose is hereby granted without fee, provided that
|
||||
# the above copyright notice appear in all copies and that both that
|
||||
# copyright notice and this permission notice appear in supporting
|
||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||
# publicity pertaining to distribution of the software without specific,
|
||||
# written prior permission. M.I.T. makes no representations about the
|
||||
# suitability of this software for any purpose. It is provided "as is"
|
||||
# without express or implied warranty.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch. It can only install one file at a time, a restriction
|
||||
# shared with many OS's install programs.
|
||||
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
transformbasename=""
|
||||
transform_arg=""
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
# this colon is to work around a 386BSD /bin/sh bug
|
||||
:
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d $dst ]; then
|
||||
instcmd=:
|
||||
else
|
||||
instcmd=mkdir
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f $src -o -d $src ]
|
||||
then
|
||||
true
|
||||
else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d $dst ]
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
else
|
||||
true
|
||||
fi
|
||||
fi
|
||||
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
|
||||
oIFS="${IFS}"
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS="${oIFS}"
|
||||
|
||||
pathcomp=''
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp="${pathcomp}${1}"
|
||||
shift
|
||||
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
then
|
||||
$mkdirprog "${pathcomp}"
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||
else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd $src $dsttmp &&
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
|
||||
fi &&
|
||||
|
||||
|
||||
exit 0
|
||||
|
|
@ -1,309 +0,0 @@
|
|||
# $Id: Makefile.in,v 1.2 2004/07/20 07:13:39 marka Exp $
|
||||
# Copyright (c) 2000, 2002 Japan Network Information Center.
|
||||
# All rights reserved.
|
||||
#
|
||||
# By using this file, you agree to the terms and conditions set forth bellow.
|
||||
#
|
||||
# LICENSE TERMS AND CONDITIONS
|
||||
#
|
||||
# The following License Terms and Conditions apply, unless a different
|
||||
# license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
# Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
#
|
||||
# 1. Use, Modification and Redistribution (including distribution of any
|
||||
# modified or derived work) in source and/or binary forms is permitted
|
||||
# under this License Terms and Conditions.
|
||||
#
|
||||
# 2. Redistribution of source code must retain the copyright notices as they
|
||||
# appear in each source code file, this License Terms and Conditions.
|
||||
#
|
||||
# 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
# this License Terms and Conditions, in the documentation and/or other
|
||||
# materials provided with the distribution. For the purposes of binary
|
||||
# distribution the "Copyright Notice" refers to the following language:
|
||||
# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
#
|
||||
# 4. The name of JPNIC may not be used to endorse or promote products
|
||||
# derived from this Software without specific prior written approval of
|
||||
# JPNIC.
|
||||
#
|
||||
# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
build = @build@
|
||||
|
||||
LIB_CURRENT = 1
|
||||
LIB_REVISION = 2
|
||||
LIB_AGE = 0
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .to
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
libdir = @libdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
datadir = @datadir@
|
||||
mapdir = $(datadir)/idnkit
|
||||
utf8_name = @UTF8_NAME@
|
||||
|
||||
SUBDIRS = tests
|
||||
|
||||
SHELL = @SHELL@
|
||||
CC = @CC@
|
||||
RANLIB = @RANLIB@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
MKINSTALLDIRS = @top_srcdir@/mkinstalldirs
|
||||
LIBTOOL = @LIBTOOL@
|
||||
|
||||
ICONVINC = @ICONVINC@
|
||||
ICONVLIB = @ICONVLIB@
|
||||
|
||||
INCS = -I$(srcdir)/../include -I../include $(ICONVINC)
|
||||
DEFS = -DIDN_RESCONF_DIR="\"$(sysconfdir)\""
|
||||
|
||||
CFLAGS = $(OPTS) $(INCS) $(DEFS) @CPPFLAGS@ @CFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
|
||||
SRCS = \
|
||||
aliaslist.c \
|
||||
api.c \
|
||||
checker.c \
|
||||
converter.c \
|
||||
debug.c \
|
||||
delimitermap.c \
|
||||
filechecker.c \
|
||||
filemapper.c \
|
||||
localencoding.c \
|
||||
log.c \
|
||||
mapper.c \
|
||||
mapselector.c \
|
||||
nameprep.c \
|
||||
nameprep_template.c \
|
||||
nameprepdata.c \
|
||||
normalizer.c \
|
||||
punycode.c \
|
||||
race.c \
|
||||
res.c \
|
||||
resconf.c \
|
||||
result.c \
|
||||
strhash.c \
|
||||
ucs4.c \
|
||||
ucsmap.c \
|
||||
ucsset.c \
|
||||
unicode.c \
|
||||
unicode_template.c \
|
||||
unicodedata_320.c \
|
||||
unormalize.c \
|
||||
util.c \
|
||||
utf8.c \
|
||||
version.c
|
||||
|
||||
OBJS = \
|
||||
aliaslist.lo \
|
||||
api.lo \
|
||||
checker.lo \
|
||||
converter.lo \
|
||||
debug.lo \
|
||||
delimitermap.lo \
|
||||
filechecker.lo \
|
||||
filemapper.lo \
|
||||
localencoding.lo \
|
||||
log.lo \
|
||||
mapper.lo \
|
||||
mapselector.lo \
|
||||
nameprep.lo \
|
||||
normalizer.lo \
|
||||
punycode.lo \
|
||||
race.lo \
|
||||
res.lo \
|
||||
resconf.lo \
|
||||
result.lo \
|
||||
strhash.lo \
|
||||
ucs4.lo \
|
||||
ucsmap.lo \
|
||||
ucsset.lo \
|
||||
unicode.lo \
|
||||
unormalize.lo \
|
||||
utf8.lo \
|
||||
util.lo \
|
||||
version.lo
|
||||
|
||||
LIB = libidnkit
|
||||
TESTLIB = libidntest
|
||||
|
||||
LITELIBCFLAGS = $(CFLAGS) -DWITHOUT_ICONV
|
||||
LITELIB_OBJS = \
|
||||
apilite.lo \
|
||||
converterlite.lo \
|
||||
reslite.lo \
|
||||
resconflite.lo \
|
||||
aliaslist.lo \
|
||||
checker.lo \
|
||||
debug.lo \
|
||||
delimitermap.lo \
|
||||
filechecker.lo \
|
||||
filemapper.lo \
|
||||
log.lo \
|
||||
mapper.lo \
|
||||
mapselector.lo \
|
||||
nameprep.lo \
|
||||
normalizer.lo \
|
||||
punycode.lo \
|
||||
race.lo \
|
||||
result.lo \
|
||||
strhash.lo \
|
||||
ucsmap.lo \
|
||||
ucsset.lo \
|
||||
unicode.lo \
|
||||
unormalize.lo \
|
||||
ucs4.lo \
|
||||
utf8.lo \
|
||||
util.lo \
|
||||
version.lo
|
||||
|
||||
LITELIB = libidnkitlite
|
||||
TESTLITELIB = libidntestlite
|
||||
|
||||
SAMPLES = idn.conf.sample idnalias.conf.sample
|
||||
|
||||
.c.lo:
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c $<
|
||||
|
||||
.c.to:
|
||||
$(CC) -o $@ -DTEST $(CFLAGS) $(LDFLAGS) -c $<
|
||||
|
||||
all: all-localdir all-subdirs
|
||||
@LITEONLY_TRUE@all-localdir: $(LITELIB).la $(SAMPLES)
|
||||
@LITEONLY_FALSE@all-localdir: $(LIB).la $(LITELIB).la $(SAMPLES)
|
||||
|
||||
$(LIB).la: $(OBJS)
|
||||
$(LIBTOOL) --mode=link $(LD) $(LDFLAGS) -o $@ \
|
||||
-version-info $(LIB_CURRENT):$(LIB_REVISION):$(LIB_AGE) \
|
||||
-rpath $(libdir) $(OBJS)
|
||||
|
||||
$(TESTLIB).la: $(OBJS)
|
||||
$(LIBTOOL) --mode=link $(LD) $(LDFLAGS) -o $@ \
|
||||
-version-info $(LIB_CURRENT):$(LIB_REVISION):$(LIB_AGE) \
|
||||
-rpath $(libdir) $(OBJS)
|
||||
|
||||
apilite.lo: api.c
|
||||
$(LIBTOOL) --mode=compile $(CC) $(LITELIBCFLAGS) -o $@ \
|
||||
-c $(srcdir)/api.c
|
||||
converterlite.lo: converter.c
|
||||
$(LIBTOOL) --mode=compile $(CC) $(LITELIBCFLAGS) -o $@ \
|
||||
-c $(srcdir)/converter.c
|
||||
reslite.lo: res.c
|
||||
$(LIBTOOL) --mode=compile $(CC) $(LITELIBCFLAGS) -o $@ \
|
||||
-c $(srcdir)/res.c
|
||||
resconflite.lo: resconf.c
|
||||
$(LIBTOOL) --mode=compile $(CC) $(LITELIBCFLAGS) -o $@ \
|
||||
-c $(srcdir)/resconf.c
|
||||
|
||||
$(LITELIB).la: $(LITELIB_OBJS)
|
||||
$(LIBTOOL) --mode=link $(LD) $(LDFLAGS) -o $@ \
|
||||
-version-info $(LIB_CURRENT):$(LIB_REVISION):$(LIB_AGE) \
|
||||
-rpath $(libdir) $(LITELIB_OBJS)
|
||||
|
||||
$(TESTLITELIB).la: $(LITELIB_OBJS)
|
||||
$(LIBTOOL) --mode=link $(LD) $(LDFLAGS) -o $@ \
|
||||
-version-info $(LIB_CURRENT):$(LIB_REVISION):$(LIB_AGE) \
|
||||
-rpath $(libdir) $(LITELIB_OBJS)
|
||||
|
||||
idn.conf.sample: idn.conf.sample.in
|
||||
sed -e 's%[@]mapdir[@]%$(mapdir)%' \
|
||||
< $(srcdir)/idn.conf.sample.in > $@
|
||||
|
||||
idnalias.conf.sample: Makefile
|
||||
$(SHELL) $(srcdir)/aliaslist.sh $(build) $(utf8_name) > $@
|
||||
|
||||
install: install-localdir install-subdirs
|
||||
@LITEONLY_TRUE@install-localdir: all install-common
|
||||
@LITEONLY_FALSE@install-localdir: all install-common install-nolite
|
||||
|
||||
install-common:
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(libdir)
|
||||
$(LIBTOOL) $(INSTALL_DATA) $(LITELIB).la \
|
||||
$(DESTDIR)$(libdir)/$(LITELIB).la
|
||||
-[ -f $(DESTDIR)$(libdir)/$(LITELIB).a ] \
|
||||
&& $(RANLIB) $(DESTDIR)$(libdir)/$(LITELIB).a
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(sysconfdir)
|
||||
$(INSTALL_DATA) idn.conf.sample \
|
||||
$(DESTDIR)$(sysconfdir)/idn.conf.sample
|
||||
$(INSTALL_DATA) idnalias.conf.sample \
|
||||
$(DESTDIR)$(sysconfdir)/idnalias.conf.sample
|
||||
@if [ ! -f $(DESTDIR)$(sysconfdir)/idn.conf ]; then \
|
||||
echo "** installing default idn.conf"; \
|
||||
$(INSTALL_DATA) idn.conf.sample $(DESTDIR)$(sysconfdir)/idn.conf; \
|
||||
fi
|
||||
@if [ ! -f $(DESTDIR)$(sysconfdir)/idnalias.conf ]; then \
|
||||
echo "** installing default idnalias.conf"; \
|
||||
$(INSTALL_DATA) idnalias.conf.sample \
|
||||
$(DESTDIR)$(sysconfdir)/idnalias.conf; \
|
||||
fi
|
||||
|
||||
install-nolite:
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(libdir)
|
||||
$(LIBTOOL) $(INSTALL_DATA) $(LIB).la \
|
||||
$(DESTDIR)$(libdir)/$(LIB).la
|
||||
-[ -f $(DESTDIR)$(libdir)/$(LIB).a ] \
|
||||
&& $(RANLIB) $(DESTDIR)$(libdir)/$(LIB).a
|
||||
|
||||
install-config:
|
||||
@if [ -f $(DESTDIR)$(sysconfdir)/idn.conf ]; then \
|
||||
echo "** backing up old idn.conf as idn.conf.old"; \
|
||||
mv -f $(DESTDIR)$(sysconfdir)/idn.conf \
|
||||
$(DESTDIR)$(sysconfdir)/idn.conf.old; \
|
||||
fi
|
||||
@echo "** installing default idn.conf forcibly"
|
||||
$(INSTALL_DATA) idn.conf.sample $(DESTDIR)$(sysconfdir)/idn.conf
|
||||
@if [ -f $(DESTDIR)$(sysconfdir)/idnalias.conf ]; then \
|
||||
echo "** backing up old idnalias.conf as idnalias.conf.old"; \
|
||||
mv -f $(DESTDIR)$(sysconfdir)/idnalias.conf \
|
||||
$(DESTDIR)$(sysconfdir)/idnalias.conf.old; \
|
||||
fi
|
||||
@echo "** installing default idnalias.conf forcibly"
|
||||
$(INSTALL_DATA) idnalias.conf.sample \
|
||||
$(DESTDIR)$(sysconfdir)/idnalias.conf
|
||||
|
||||
clean: clean-localdir clean-subdirs
|
||||
clean-localdir: force
|
||||
rm -f *.o *.lo *.la *.a core *.core *~
|
||||
rm -f *.to *_test.c *_test
|
||||
rm -f idn.conf.sample idnalias.conf.sample
|
||||
rm -fr .libs/
|
||||
|
||||
distclean: distclean-localdir distclean-subdirs
|
||||
distclean-localdir: force clean-localdir
|
||||
rm -f Makefile
|
||||
|
||||
test check: test-localdir test-subdirs
|
||||
|
||||
@LITEONLY_TRUE@test-localdir: $(TESTLITELIB).la $(SAMPLES)
|
||||
@LITEONLY_FALSE@test-localdir: $(TESTLIB).la $(TESTLITELIB).la $(SAMPLES)
|
||||
|
||||
all-subdirs install-subdirs clean-subdirs distclean-subdirs test-subdirs:
|
||||
@target=`echo $@ | sed 's/-subdirs$$//'`; \
|
||||
for d in $(SUBDIRS) ; do \
|
||||
(cd $$d; $(MAKE) DESTDIR=$(DESTDIR) $$target); \
|
||||
done
|
||||
|
||||
force:
|
||||
|
|
@ -1,355 +0,0 @@
|
|||
#ifndef lint
|
||||
static char *rcsid = "$Id: aliaslist.c,v 1.1 2003/06/04 00:25:47 marka Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <idn/aliaslist.h>
|
||||
#include <idn/assert.h>
|
||||
#include <idn/logmacro.h>
|
||||
#include <idn/result.h>
|
||||
|
||||
struct aliasitem {
|
||||
char *pattern; /* name pattern */
|
||||
char *encoding; /* MIME-preferred charset name */
|
||||
struct aliasitem *next;
|
||||
};
|
||||
typedef struct aliasitem *aliasitem_t;
|
||||
|
||||
struct idn__aliaslist {
|
||||
aliasitem_t first_item; /* first item of the list */
|
||||
};
|
||||
|
||||
static idn_result_t
|
||||
additem_to_top(idn__aliaslist_t list,
|
||||
const char *pattern, const char *encoding);
|
||||
|
||||
static idn_result_t
|
||||
additem_to_bottom(idn__aliaslist_t list,
|
||||
const char *pattern, const char *encoding);
|
||||
|
||||
static int match(const char *pattern, const char *str);
|
||||
|
||||
static idn_result_t create_item(const char *pattern, const char *encoding,
|
||||
aliasitem_t *itemp);
|
||||
|
||||
#ifdef DEBUG
|
||||
static void dump_list(idn__aliaslist_t list);
|
||||
#endif
|
||||
|
||||
idn_result_t
|
||||
idn__aliaslist_create(idn__aliaslist_t *listp) {
|
||||
static int size = sizeof(struct idn__aliaslist);
|
||||
|
||||
TRACE(("idn__aliaslist_create()\n"));
|
||||
|
||||
assert(listp != NULL);
|
||||
|
||||
if ((*listp = malloc(size)) == NULL) {
|
||||
return (idn_nomemory);
|
||||
}
|
||||
(*listp)->first_item = NULL;
|
||||
|
||||
return (idn_success);
|
||||
}
|
||||
|
||||
void
|
||||
idn__aliaslist_destroy(idn__aliaslist_t list) {
|
||||
aliasitem_t current;
|
||||
aliasitem_t next;
|
||||
|
||||
TRACE(("idn__aliaslist_destroy()\n"));
|
||||
|
||||
assert(list != NULL);
|
||||
|
||||
current = list->first_item;
|
||||
while (current != NULL) {
|
||||
if (current->pattern != NULL) {
|
||||
free(current->pattern);
|
||||
}
|
||||
if (current->encoding != NULL) {
|
||||
free(current->encoding);
|
||||
}
|
||||
next = current->next;
|
||||
free(current);
|
||||
current = next;
|
||||
}
|
||||
free(list);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn__aliaslist_aliasfile(idn__aliaslist_t list, const char *path) {
|
||||
FILE *fp;
|
||||
int line_no;
|
||||
idn_result_t r = idn_success;
|
||||
char line[200], alias[200], real[200];
|
||||
|
||||
assert(path != NULL);
|
||||
|
||||
TRACE(("idn__aliaslist_aliasfile(path=%s)\n", path));
|
||||
|
||||
if ((fp = fopen(path, "r")) == NULL) {
|
||||
return (idn_nofile);
|
||||
}
|
||||
for (line_no = 1; fgets(line, sizeof(line), fp) != NULL; line_no++) {
|
||||
unsigned char *p = (unsigned char *)line;
|
||||
|
||||
while (isascii(*p) && isspace(*p))
|
||||
p++;
|
||||
if (*p == '#' || *p == '\n')
|
||||
continue;
|
||||
if (sscanf((char *)p, "%s %s", alias, real) == 2) {
|
||||
r = additem_to_bottom(list, alias, real);
|
||||
if (r != idn_success)
|
||||
break;
|
||||
} else {
|
||||
INFO(("idn__aliaslist_aliasfile: file %s has "
|
||||
"invalid contents at line %d\n",
|
||||
path, line_no));
|
||||
r = idn_invalid_syntax;
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
#ifdef DEBUG
|
||||
dump_list(list);
|
||||
#endif
|
||||
|
||||
return (r);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn__aliaslist_additem(idn__aliaslist_t list,
|
||||
const char *pattern, const char *encoding,
|
||||
int first_item) {
|
||||
if (first_item) {
|
||||
return additem_to_top(list, pattern, encoding);
|
||||
} else {
|
||||
return additem_to_bottom(list, pattern, encoding);
|
||||
}
|
||||
}
|
||||
|
||||
static idn_result_t
|
||||
additem_to_top(idn__aliaslist_t list,
|
||||
const char *pattern, const char *encoding) {
|
||||
aliasitem_t new_item;
|
||||
idn_result_t r;
|
||||
|
||||
TRACE(("additem_to_top()\n"));
|
||||
|
||||
assert(list != NULL);
|
||||
assert(pattern != NULL);
|
||||
assert(encoding != NULL);
|
||||
|
||||
if ((r = create_item(pattern, encoding, &new_item))
|
||||
!= idn_success) {
|
||||
WARNING(("additem_to_top: malloc failed\n"));
|
||||
return (r);
|
||||
}
|
||||
|
||||
new_item->next = list->first_item;
|
||||
list->first_item = new_item;
|
||||
|
||||
#ifdef DEBUG
|
||||
dump_list(list);
|
||||
#endif
|
||||
|
||||
return (idn_success);
|
||||
}
|
||||
|
||||
static idn_result_t
|
||||
additem_to_bottom(idn__aliaslist_t list,
|
||||
const char *pattern, const char *encoding) {
|
||||
aliasitem_t new_item;
|
||||
idn_result_t r;
|
||||
|
||||
TRACE(("additem_to_bottom()\n"));
|
||||
|
||||
assert(list != NULL);
|
||||
assert(pattern != NULL);
|
||||
assert(encoding != NULL);
|
||||
|
||||
r = create_item(pattern, encoding, &new_item);
|
||||
if (r != idn_success) {
|
||||
WARNING(("additem_to_bottom: malloc failed\n"));
|
||||
return r;
|
||||
}
|
||||
|
||||
if (list->first_item == NULL) {
|
||||
list->first_item = new_item;
|
||||
} else {
|
||||
aliasitem_t cur_item = list->first_item;
|
||||
for (;;) {
|
||||
if (cur_item->next == NULL) {
|
||||
break;
|
||||
}
|
||||
cur_item = cur_item->next;
|
||||
}
|
||||
cur_item->next = new_item;
|
||||
}
|
||||
|
||||
return (idn_success);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn__aliaslist_find(idn__aliaslist_t list,
|
||||
const char *pattern, char **encodingp) {
|
||||
aliasitem_t current;
|
||||
|
||||
TRACE(("idn__aliaslist_find()\n"));
|
||||
|
||||
assert(list != NULL);
|
||||
assert(pattern != NULL);
|
||||
|
||||
#ifdef DEBUG
|
||||
DUMP(("target pattern: %s\n", pattern));
|
||||
#endif
|
||||
current = list->first_item;
|
||||
while (current != NULL) {
|
||||
#ifdef DEBUG
|
||||
DUMP(("current pattern: %s, encoding: %s\n",
|
||||
current->pattern, current->encoding));
|
||||
#endif
|
||||
if (match(current->pattern, pattern)) {
|
||||
*encodingp = current->encoding;
|
||||
return (idn_success);
|
||||
}
|
||||
current = current->next;
|
||||
}
|
||||
|
||||
TRACE(("idn__aliaslist_find(): not found\n"));
|
||||
*encodingp = (char *)pattern;
|
||||
return (idn_notfound);
|
||||
}
|
||||
|
||||
/*
|
||||
* Wild card matching function that supports only '*'.
|
||||
*/
|
||||
static int
|
||||
match(const char *pattern, const char *str) {
|
||||
for (;;) {
|
||||
int c;
|
||||
|
||||
switch (c = *pattern++) {
|
||||
case '\0':
|
||||
return (*str == '\0');
|
||||
case '*':
|
||||
while (!match(pattern, str)) {
|
||||
if (*str == '\0')
|
||||
return (0);
|
||||
str++;
|
||||
}
|
||||
return (1);
|
||||
break;
|
||||
default:
|
||||
if (*str++ != c)
|
||||
return (0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* List item creation.
|
||||
* pattern and encoding must not be NULL.
|
||||
*/
|
||||
static idn_result_t
|
||||
create_item(const char *pattern, const char *encoding,
|
||||
aliasitem_t *itemp) {
|
||||
static size_t size = sizeof(struct aliasitem);
|
||||
|
||||
assert(pattern != NULL);
|
||||
assert(encoding != NULL);
|
||||
|
||||
if ((*itemp = malloc(size)) == NULL)
|
||||
return (idn_nomemory);
|
||||
|
||||
if (((*itemp)->pattern = malloc(strlen(pattern) + 1)) == NULL) {
|
||||
free(*itemp);
|
||||
*itemp = NULL;
|
||||
return (idn_nomemory);
|
||||
}
|
||||
|
||||
if (((*itemp)->encoding = malloc(strlen(encoding) + 1)) == NULL) {
|
||||
free((*itemp)->pattern);
|
||||
free(*itemp);
|
||||
*itemp = NULL;
|
||||
return (idn_nomemory);
|
||||
}
|
||||
|
||||
(void)strcpy((*itemp)->pattern, pattern);
|
||||
(void)strcpy((*itemp)->encoding, encoding);
|
||||
(*itemp)->next = NULL;
|
||||
|
||||
return (idn_success);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
static void
|
||||
dump_list(idn__aliaslist_t list) {
|
||||
aliasitem_t item;
|
||||
int i;
|
||||
|
||||
TRACE(("dump_list()\n"));
|
||||
if (list == NULL) {
|
||||
TRACE(("list is NULL\n"));
|
||||
return;
|
||||
}
|
||||
item = list->first_item;
|
||||
i = 0;
|
||||
while (item != NULL) {
|
||||
DUMP(("%d: %s\t%s\n", i, item->pattern, item->encoding));
|
||||
item = item->next;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# aliaslist.sh -- Generate `idnalias.conf.sample' file.
|
||||
#
|
||||
|
||||
cpu_company_system="$1"
|
||||
utf8_name="$2"
|
||||
|
||||
cat <<EOF
|
||||
*.ISO_8859-1 ISO-8859-1
|
||||
*.ISO_8859-2 ISO-8859-1
|
||||
*.SJIS Shift_JIS
|
||||
*.Shift_JIS Shift_JIS
|
||||
ja_JP.EUC EUC-JP
|
||||
ko_KR.EUC EUC-KR
|
||||
*.big5 Big5
|
||||
*.Big5 Big5
|
||||
*.KOI8-R KOI8-R
|
||||
*.GB2312 GB2312
|
||||
ja EUC-JP
|
||||
EOF
|
||||
|
||||
case "$cpu_company_system" in
|
||||
*-*-hpux*)
|
||||
echo "japanese Shift_JIS"
|
||||
;;
|
||||
*)
|
||||
echo "japanese EUC-JP"
|
||||
esac
|
||||
|
||||
if [ "x$utf8_name" != xUTF-8 ] ; then
|
||||
echo "UTF-8 $utf8_name"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
|
@ -1,257 +0,0 @@
|
|||
#ifndef lint
|
||||
static char *rcsid = "$Id: api.c,v 1.1 2003/06/04 00:25:48 marka Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001,2002 Japan Network Information Center.
|
||||
* All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <idn/result.h>
|
||||
#include <idn/assert.h>
|
||||
#include <idn/log.h>
|
||||
#include <idn/logmacro.h>
|
||||
#include <idn/resconf.h>
|
||||
#include <idn/api.h>
|
||||
#include <idn/debug.h>
|
||||
#include <idn/res.h>
|
||||
|
||||
static int initialized;
|
||||
static idn_resconf_t default_conf;
|
||||
|
||||
static char *conf_file;
|
||||
|
||||
void
|
||||
idn_enable(int on_off) {
|
||||
idn_res_enable(on_off);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn__setconffile(const char *file) {
|
||||
idn_result_t r;
|
||||
char *s;
|
||||
|
||||
TRACE(("idn__setconffile(%s)\n", (file == NULL) ? "<null>" : file));
|
||||
|
||||
if (initialized) {
|
||||
r = idn_failure;
|
||||
goto ret;
|
||||
}
|
||||
|
||||
if (file == NULL)
|
||||
s = NULL;
|
||||
else {
|
||||
s = (char *)malloc(strlen(file) + 1);
|
||||
if (s == NULL) {
|
||||
r = idn_nomemory;
|
||||
goto ret;
|
||||
}
|
||||
strcpy(s, file);
|
||||
}
|
||||
free(conf_file);
|
||||
conf_file = s;
|
||||
|
||||
r = idn_success;
|
||||
ret:
|
||||
TRACE(("idn__setconffile(): %s\n", idn_result_tostring(r)));
|
||||
return (r);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_nameinit(int load_file) {
|
||||
idn_result_t r;
|
||||
|
||||
TRACE(("idn_nameinit()\n"));
|
||||
|
||||
if (initialized) {
|
||||
r = idn_success;
|
||||
goto ret;
|
||||
}
|
||||
|
||||
idn_resconf_initialize();
|
||||
|
||||
r = idn_resconf_create(&default_conf);
|
||||
if (r != idn_success)
|
||||
goto ret;
|
||||
|
||||
if (load_file)
|
||||
r = idn_resconf_loadfile(default_conf, conf_file);
|
||||
else
|
||||
r = idn_resconf_setdefaults(default_conf);
|
||||
if (r != idn_success)
|
||||
goto ret;
|
||||
|
||||
initialized = 1;
|
||||
|
||||
ret:
|
||||
if (r != idn_success && default_conf != NULL) {
|
||||
idn_resconf_destroy(default_conf);
|
||||
default_conf = NULL;
|
||||
}
|
||||
TRACE(("idn_nameinit(): %s\n", idn_result_tostring(r)));
|
||||
return (r);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_encodename(idn_action_t actions, const char *from, char *to, size_t tolen) {
|
||||
idn_result_t r;
|
||||
|
||||
assert(from != NULL && to != NULL);
|
||||
|
||||
TRACE(("idn_encodename(actions=%s, from=\"%s\")\n",
|
||||
idn__res_actionstostring(actions),
|
||||
idn__debug_xstring(from, 50)));
|
||||
|
||||
if (!initialized && ((r = idn_nameinit(0)) != idn_success))
|
||||
goto ret;
|
||||
|
||||
r = idn_res_encodename(default_conf, actions, from, to, tolen);
|
||||
|
||||
ret:
|
||||
if (r == idn_success) {
|
||||
TRACE(("idn_encodename(): success (to=\"%s\")\n",
|
||||
idn__debug_xstring(to, 50)));
|
||||
} else {
|
||||
TRACE(("idn_encodename(): %s\n", idn_result_tostring(r)));
|
||||
}
|
||||
return (r);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_decodename(idn_action_t actions, const char *from, char *to, size_t tolen) {
|
||||
idn_result_t r;
|
||||
|
||||
assert(from != NULL && to != NULL);
|
||||
|
||||
TRACE(("idn_decodename(actions=%s, from=\"%s\", tolen=%d)\n",
|
||||
idn__res_actionstostring(actions),
|
||||
idn__debug_xstring(from, 50), (int)tolen));
|
||||
|
||||
if (!initialized && ((r = idn_nameinit(0)) != idn_success))
|
||||
goto ret;
|
||||
|
||||
r = idn_res_decodename(default_conf, actions, from, to, tolen);
|
||||
|
||||
ret:
|
||||
if (r == idn_success) {
|
||||
TRACE(("idn_decodename(): success (to=\"%s\")\n",
|
||||
idn__debug_xstring(to, 50)));
|
||||
} else {
|
||||
TRACE(("idn_decodename(): %s\n", idn_result_tostring(r)));
|
||||
}
|
||||
return (r);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_decodename2(idn_action_t actions, const char *from, char *to, size_t tolen,
|
||||
const char *auxencoding) {
|
||||
idn_result_t r;
|
||||
|
||||
assert(from != NULL && to != NULL);
|
||||
|
||||
TRACE(("idn_decodename2(actions=%s, from=\"%s\", tolen=%d)\n",
|
||||
idn__res_actionstostring(actions),
|
||||
idn__debug_xstring(from, 50), (int)tolen));
|
||||
|
||||
if (!initialized && ((r = idn_nameinit(0)) != idn_success))
|
||||
goto ret;
|
||||
|
||||
r = idn_res_decodename2(default_conf, actions, from, to, tolen,
|
||||
auxencoding);
|
||||
|
||||
ret:
|
||||
if (r == idn_success) {
|
||||
TRACE(("idn_decodename2(): success (to=\"%s\")\n",
|
||||
idn__debug_xstring(to, 50)));
|
||||
} else {
|
||||
TRACE(("idn_decodename2(): %s\n", idn_result_tostring(r)));
|
||||
}
|
||||
return (r);
|
||||
}
|
||||
|
||||
/*
|
||||
* These functions are for backward compatibility.
|
||||
*/
|
||||
#ifdef ENABLE_MDNKIT_COMPAT
|
||||
|
||||
idn_result_t
|
||||
mdn_nameinit(void) {
|
||||
return idn_nameinit(1);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
mdn_encodename(int actions, const char *from, char *to, size_t tolen) {
|
||||
idn_result_t r;
|
||||
|
||||
assert(from != NULL && to != NULL);
|
||||
|
||||
TRACE(("mdn_encodename(actions=%s, from=\"%s\")\n",
|
||||
idn__res_actionstostring(actions),
|
||||
idn__debug_xstring(from, 50)));
|
||||
|
||||
if (!initialized && ((r = idn_nameinit(1)) != idn_success))
|
||||
return (r);
|
||||
|
||||
return (idn_res_encodename(default_conf, actions, from, to, tolen));
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
mdn_decodename(int actions, const char *from, char *to, size_t tolen) {
|
||||
idn_result_t r;
|
||||
|
||||
assert(from != NULL && to != NULL);
|
||||
|
||||
TRACE(("idn_decodename(actions=%s, from=\"%s\", tolen=%d)\n",
|
||||
idn__res_actionstostring(actions),
|
||||
idn__debug_xstring(from, 50), (int)tolen));
|
||||
|
||||
if (!initialized && ((r = idn_nameinit(1)) != idn_success))
|
||||
return (r);
|
||||
|
||||
return (idn_res_decodename(default_conf, actions, from, to, tolen));
|
||||
}
|
||||
|
||||
#endif /* ENABLE_MDNKIT_COMPAT */
|
||||
|
|
@ -1,446 +0,0 @@
|
|||
#ifndef lint
|
||||
static char *rcsid = "$Id: checker.c,v 1.1 2003/06/04 00:25:49 marka Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001,2002 Japan Network Information Center.
|
||||
* All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <idn/result.h>
|
||||
#include <idn/assert.h>
|
||||
#include <idn/logmacro.h>
|
||||
#include <idn/checker.h>
|
||||
#include <idn/strhash.h>
|
||||
#include <idn/debug.h>
|
||||
|
||||
/*
|
||||
* Type for checking scheme.
|
||||
*/
|
||||
typedef struct {
|
||||
char *prefix;
|
||||
char *parameter;
|
||||
idn_checker_createproc_t create;
|
||||
idn_checker_destroyproc_t destroy;
|
||||
idn_checker_lookupproc_t lookup;
|
||||
void *context;
|
||||
} check_scheme_t;
|
||||
|
||||
/*
|
||||
* Standard checking schemes.
|
||||
*/
|
||||
static const check_scheme_t rfc3491_prohibit_scheme = {
|
||||
"prohibit#RFC3491",
|
||||
"RFC3491",
|
||||
idn_nameprep_createproc,
|
||||
idn_nameprep_destroyproc,
|
||||
idn_nameprep_prohibitproc,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static const check_scheme_t rfc3491_unasigned_scheme = {
|
||||
"unassigned#RFC3491",
|
||||
"RFC3491",
|
||||
idn_nameprep_createproc,
|
||||
idn_nameprep_destroyproc,
|
||||
idn_nameprep_unassignedproc,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static const check_scheme_t rfc3491_bidi_scheme = {
|
||||
"bidi#RFC3491",
|
||||
"RFC3491",
|
||||
idn_nameprep_createproc,
|
||||
idn_nameprep_destroyproc,
|
||||
idn_nameprep_bidiproc,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static const check_scheme_t filecheck_prohibit_scheme = {
|
||||
"prohibit#fileset",
|
||||
NULL,
|
||||
idn__filechecker_createproc,
|
||||
idn__filechecker_destroyproc,
|
||||
idn__filechecker_lookupproc,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static const check_scheme_t filecheck_unassigned_scheme = {
|
||||
"unassigned#fileset",
|
||||
NULL,
|
||||
idn__filechecker_createproc,
|
||||
idn__filechecker_destroyproc,
|
||||
idn__filechecker_lookupproc,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static const check_scheme_t *standard_check_schemes[] = {
|
||||
&rfc3491_unasigned_scheme,
|
||||
&rfc3491_prohibit_scheme,
|
||||
&rfc3491_bidi_scheme,
|
||||
&filecheck_prohibit_scheme,
|
||||
&filecheck_unassigned_scheme,
|
||||
NULL,
|
||||
};
|
||||
|
||||
/*
|
||||
* Hash table for checking schemes.
|
||||
*/
|
||||
static idn__strhash_t scheme_hash = NULL;
|
||||
|
||||
/*
|
||||
* Mapper object type.
|
||||
*/
|
||||
struct idn_checker {
|
||||
int nschemes;
|
||||
int scheme_size;
|
||||
check_scheme_t *schemes;
|
||||
int reference_count;
|
||||
};
|
||||
|
||||
#define MAPPER_INITIAL_SCHEME_SIZE 1
|
||||
|
||||
idn_result_t
|
||||
idn_checker_initialize(void) {
|
||||
idn_result_t r;
|
||||
check_scheme_t **scheme;
|
||||
|
||||
TRACE(("idn_checker_initialize()\n"));
|
||||
|
||||
if (scheme_hash != NULL) {
|
||||
r = idn_success; /* already initialized */
|
||||
goto ret;
|
||||
}
|
||||
|
||||
r = idn__strhash_create(&scheme_hash);
|
||||
if (r != idn_success) {
|
||||
goto ret;
|
||||
}
|
||||
|
||||
for (scheme = (check_scheme_t **)standard_check_schemes;
|
||||
*scheme != NULL; scheme++) {
|
||||
r = idn__strhash_put(scheme_hash, (*scheme)->prefix, *scheme);
|
||||
if (r != idn_success)
|
||||
goto ret;
|
||||
}
|
||||
|
||||
r = idn_success;
|
||||
ret:
|
||||
if (r != idn_success) {
|
||||
if (scheme_hash != NULL) {
|
||||
idn__strhash_destroy(scheme_hash, NULL);
|
||||
scheme_hash = NULL;
|
||||
}
|
||||
}
|
||||
TRACE(("idn_checker_initialize(): %s\n", idn_result_tostring(r)));
|
||||
return (r);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_checker_create(idn_checker_t *ctxp) {
|
||||
idn_checker_t ctx = NULL;
|
||||
idn_result_t r;
|
||||
|
||||
assert(scheme_hash != NULL);
|
||||
assert(ctxp != NULL);
|
||||
|
||||
TRACE(("idn_checker_create()\n"));
|
||||
|
||||
ctx = (idn_checker_t) malloc(sizeof(struct idn_checker));
|
||||
if (ctx == NULL) {
|
||||
r = idn_nomemory;
|
||||
goto ret;
|
||||
}
|
||||
|
||||
ctx->schemes = (check_scheme_t *) malloc(sizeof(check_scheme_t)
|
||||
* MAPPER_INITIAL_SCHEME_SIZE);
|
||||
if (ctx->schemes == NULL) {
|
||||
r = idn_nomemory;
|
||||
goto ret;
|
||||
}
|
||||
|
||||
ctx->nschemes = 0;
|
||||
ctx->scheme_size = MAPPER_INITIAL_SCHEME_SIZE;
|
||||
ctx->reference_count = 1;
|
||||
*ctxp = ctx;
|
||||
r = idn_success;
|
||||
ret:
|
||||
if (r != idn_success) {
|
||||
if (ctx != NULL)
|
||||
free(ctx->schemes);
|
||||
free(ctx);
|
||||
}
|
||||
TRACE(("idn_checker_create(): %s\n", idn_result_tostring(r)));
|
||||
return (r);
|
||||
}
|
||||
|
||||
void
|
||||
idn_checker_destroy(idn_checker_t ctx) {
|
||||
int i;
|
||||
|
||||
assert(scheme_hash != NULL);
|
||||
assert(ctx != NULL);
|
||||
|
||||
TRACE(("idn_checker_destroy()\n"));
|
||||
|
||||
ctx->reference_count--;
|
||||
if (ctx->reference_count <= 0) {
|
||||
TRACE(("idn_checker_destroy(): the object is destroyed\n"));
|
||||
for (i = 0; i < ctx->nschemes; i++)
|
||||
ctx->schemes[i].destroy(ctx->schemes[i].context);
|
||||
free(ctx->schemes);
|
||||
free(ctx);
|
||||
} else {
|
||||
TRACE(("idn_checker_destroy(): "
|
||||
"update reference count (%d->%d)\n",
|
||||
ctx->reference_count + 1, ctx->reference_count));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
idn_checker_incrref(idn_checker_t ctx) {
|
||||
assert(ctx != NULL && scheme_hash != NULL);
|
||||
|
||||
TRACE(("idn_checker_incrref()\n"));
|
||||
TRACE(("idn_checker_incrref: update reference count (%d->%d)\n",
|
||||
ctx->reference_count, ctx->reference_count + 1));
|
||||
|
||||
ctx->reference_count++;
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_checker_add(idn_checker_t ctx, const char *scheme_name) {
|
||||
idn_result_t r;
|
||||
check_scheme_t *scheme;
|
||||
const char *scheme_prefix;
|
||||
const char *scheme_parameter;
|
||||
void *scheme_context = NULL;
|
||||
char *buffer = NULL;
|
||||
|
||||
assert(scheme_hash != NULL);
|
||||
assert(ctx != NULL);
|
||||
|
||||
TRACE(("idn_checker_add(scheme_name=%s)\n",
|
||||
idn__debug_xstring(scheme_name, 50)));
|
||||
|
||||
/*
|
||||
* Split `scheme_name' into `scheme_prefix' and `scheme_parameter'.
|
||||
*/
|
||||
scheme_parameter = strchr(scheme_name, ':');
|
||||
if (scheme_parameter == NULL) {
|
||||
scheme_prefix = scheme_name;
|
||||
scheme_parameter = NULL;
|
||||
} else {
|
||||
ptrdiff_t scheme_prefixlen;
|
||||
|
||||
scheme_prefixlen = scheme_parameter - scheme_name;
|
||||
buffer = (char *) malloc(scheme_prefixlen + 1);
|
||||
if (buffer == NULL) {
|
||||
r = idn_nomemory;
|
||||
goto ret;
|
||||
}
|
||||
memcpy(buffer, scheme_name, scheme_prefixlen);
|
||||
*(buffer + scheme_prefixlen) = '\0';
|
||||
scheme_prefix = buffer;
|
||||
scheme_parameter++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find a scheme.
|
||||
*/
|
||||
if (idn__strhash_get(scheme_hash, scheme_prefix, (void **)&scheme)
|
||||
!= idn_success) {
|
||||
ERROR(("idn_checker_add(): invalid scheme \"%-.30s\"\n",
|
||||
scheme_name));
|
||||
r = idn_invalid_name;
|
||||
goto ret;
|
||||
}
|
||||
if (scheme_parameter == NULL && scheme->parameter != NULL)
|
||||
scheme_parameter = scheme->parameter;
|
||||
|
||||
/*
|
||||
* Add the scheme.
|
||||
*/
|
||||
assert(ctx->nschemes <= ctx->scheme_size);
|
||||
|
||||
if (ctx->nschemes == ctx->scheme_size) {
|
||||
check_scheme_t *new_schemes;
|
||||
|
||||
new_schemes = (check_scheme_t *) realloc(ctx->schemes,
|
||||
sizeof(check_scheme_t) * ctx->scheme_size * 2);
|
||||
if (new_schemes == NULL) {
|
||||
r = idn_nomemory;
|
||||
goto ret;
|
||||
}
|
||||
ctx->schemes = new_schemes;
|
||||
ctx->scheme_size *= 2;
|
||||
}
|
||||
|
||||
r = scheme->create(scheme_parameter, &scheme_context);
|
||||
if (r != idn_success)
|
||||
goto ret;
|
||||
|
||||
memcpy(ctx->schemes + ctx->nschemes, scheme, sizeof(check_scheme_t));
|
||||
ctx->schemes[ctx->nschemes].context = scheme_context;
|
||||
ctx->nschemes++;
|
||||
r = idn_success;
|
||||
|
||||
ret:
|
||||
free(buffer);
|
||||
if (r != idn_success)
|
||||
free(scheme_context);
|
||||
TRACE(("idn_checker_add(): %s\n", idn_result_tostring(r)));
|
||||
return (r);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_checker_addall(idn_checker_t ctx, const char **scheme_names,
|
||||
int nschemes) {
|
||||
idn_result_t r;
|
||||
int i;
|
||||
|
||||
assert(scheme_hash != NULL);
|
||||
assert(ctx != NULL && scheme_names != NULL);
|
||||
|
||||
TRACE(("idn_checker_addall(nschemes=%d)\n", nschemes));
|
||||
|
||||
for (i = 0; i < nschemes; i++) {
|
||||
r = idn_checker_add(ctx, (const char *)*scheme_names);
|
||||
if (r != idn_success)
|
||||
goto ret;
|
||||
scheme_names++;
|
||||
}
|
||||
|
||||
r = idn_success;
|
||||
ret:
|
||||
TRACE(("idn_checker_addall(): %s\n", idn_result_tostring(r)));
|
||||
return (r);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_checker_lookup(idn_checker_t ctx, const unsigned long *ucs4,
|
||||
const unsigned long **found) {
|
||||
idn_result_t r;
|
||||
int i;
|
||||
|
||||
assert(scheme_hash != NULL);
|
||||
assert(ctx != NULL && ucs4 != NULL && found != NULL);
|
||||
|
||||
TRACE(("idn_checker_lookup(ucs4=\"%s\")\n",
|
||||
idn__debug_ucs4xstring(ucs4, 50)));
|
||||
|
||||
/*
|
||||
* Lookup.
|
||||
*/
|
||||
*found = NULL;
|
||||
|
||||
for (i = 0; i < ctx->nschemes; i++) {
|
||||
TRACE(("idn_checker_lookup(): lookup %s\n",
|
||||
ctx->schemes[i].prefix));
|
||||
|
||||
r = (ctx->schemes[i].lookup)(ctx->schemes[i].context, ucs4,
|
||||
found);
|
||||
if (r != idn_success)
|
||||
goto ret;
|
||||
if (*found != NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
r = idn_success;
|
||||
ret:
|
||||
if (*found == NULL) {
|
||||
TRACE(("idn_checker_lookup(): %s (not found)\n",
|
||||
idn_result_tostring(r)));
|
||||
} else {
|
||||
TRACE(("idn_checker_lookup(): %s (found \\x%04lx)\n",
|
||||
idn_result_tostring(r), **found));
|
||||
}
|
||||
return (r);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_checker_register(const char *prefix,
|
||||
idn_checker_createproc_t create,
|
||||
idn_checker_destroyproc_t destroy,
|
||||
idn_checker_lookupproc_t lookup) {
|
||||
idn_result_t r;
|
||||
check_scheme_t *scheme = NULL;
|
||||
|
||||
assert(scheme_hash != NULL);
|
||||
assert(prefix != NULL && create != NULL && destroy != NULL &&
|
||||
lookup != NULL);
|
||||
|
||||
TRACE(("idn_checker_register(prefix=%s)\n", prefix));
|
||||
|
||||
scheme = (check_scheme_t *) malloc(sizeof(check_scheme_t));
|
||||
if (scheme == NULL) {
|
||||
r = idn_nomemory;
|
||||
goto ret;
|
||||
}
|
||||
|
||||
scheme->prefix = (char *) malloc(strlen(prefix) + 1);
|
||||
if (scheme->prefix == NULL) {
|
||||
r = idn_nomemory;
|
||||
goto ret;
|
||||
}
|
||||
|
||||
strcpy(scheme->prefix, prefix);
|
||||
scheme->parameter = NULL;
|
||||
scheme->create = create;
|
||||
scheme->destroy = destroy;
|
||||
scheme->lookup = lookup;
|
||||
|
||||
r = idn__strhash_put(scheme_hash, prefix, scheme);
|
||||
ret:
|
||||
if (r != idn_success) {
|
||||
if (scheme != NULL)
|
||||
free(scheme->prefix);
|
||||
free(scheme);
|
||||
}
|
||||
TRACE(("idn_checker_register(): %s\n", idn_result_tostring(r)));
|
||||
return (r);
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,267 +0,0 @@
|
|||
#ifndef lint
|
||||
static char *rcsid = "$Id: debug.c,v 1.1 2003/06/04 00:25:51 marka Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000,2002 Japan Network Information Center.
|
||||
* All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <idn/debug.h>
|
||||
|
||||
static char *hex = "0123456789abcdef";
|
||||
|
||||
#define STRING_MAXBYTES 200
|
||||
#define STRING_NBUFS 4
|
||||
static char bufs[STRING_NBUFS][STRING_MAXBYTES + 16]; /* +16 for margin */
|
||||
static int bufno = 0;
|
||||
|
||||
char *
|
||||
idn__debug_hexstring(const char *s, int maxbytes) {
|
||||
char *buf = bufs[bufno];
|
||||
char *p;
|
||||
int i;
|
||||
|
||||
if (maxbytes > STRING_MAXBYTES)
|
||||
maxbytes = STRING_MAXBYTES;
|
||||
|
||||
for (i = 0, p = buf; i < maxbytes; i += 3, s++) {
|
||||
int c = *(unsigned char *)s;
|
||||
|
||||
if (c == '\0')
|
||||
break;
|
||||
*p++ = hex[c >> 4];
|
||||
*p++ = hex[c & 15];
|
||||
*p++ = ' ';
|
||||
}
|
||||
|
||||
if (i >= maxbytes)
|
||||
strcpy(p, "...");
|
||||
else
|
||||
*p = '\0';
|
||||
|
||||
bufno = (bufno + 1) % STRING_NBUFS;
|
||||
return (buf);
|
||||
}
|
||||
|
||||
char *
|
||||
idn__debug_xstring(const char *s, int maxbytes) {
|
||||
char *buf = bufs[bufno];
|
||||
char *p;
|
||||
int i;
|
||||
|
||||
if (maxbytes > STRING_MAXBYTES)
|
||||
maxbytes = STRING_MAXBYTES;
|
||||
|
||||
i = 0;
|
||||
p = buf;
|
||||
while (i < maxbytes) {
|
||||
int c = *(unsigned char *)s;
|
||||
|
||||
if (c == '\0') {
|
||||
break;
|
||||
} else if (0x20 <= c && c <= 0x7e) {
|
||||
*p++ = c;
|
||||
i++;
|
||||
} else {
|
||||
*p++ = '\\';
|
||||
*p++ = 'x';
|
||||
*p++ = hex[c >> 4];
|
||||
*p++ = hex[c & 15];
|
||||
i += 4;
|
||||
}
|
||||
s++;
|
||||
}
|
||||
|
||||
if (i >= maxbytes)
|
||||
strcpy(p, "...");
|
||||
else
|
||||
*p = '\0';
|
||||
|
||||
bufno = (bufno + 1) % STRING_NBUFS;
|
||||
return (buf);
|
||||
}
|
||||
|
||||
char *
|
||||
idn__debug_ucs4xstring(const unsigned long *s, int maxbytes) {
|
||||
char *buf = bufs[bufno];
|
||||
char *p;
|
||||
int i;
|
||||
|
||||
if (maxbytes > STRING_MAXBYTES)
|
||||
maxbytes = STRING_MAXBYTES;
|
||||
|
||||
i = 0;
|
||||
p = buf;
|
||||
while (i < maxbytes) {
|
||||
if (*s == '\0') {
|
||||
break;
|
||||
} else if (0x20 <= *s && *s <= 0x7e) {
|
||||
*p++ = *s;
|
||||
i++;
|
||||
} else {
|
||||
*p++ = '\\';
|
||||
*p++ = 'x';
|
||||
i += 2;
|
||||
if (*s >= 0x1000000UL) {
|
||||
*p++ = hex[(*s >> 28) & 0x0f];
|
||||
*p++ = hex[(*s >> 24) & 0x0f];
|
||||
i += 2;
|
||||
}
|
||||
if (*s >= 0x10000UL) {
|
||||
*p++ = hex[(*s >> 20) & 0x0f];
|
||||
*p++ = hex[(*s >> 16) & 0x0f];
|
||||
i += 2;
|
||||
}
|
||||
if (*s >= 0x100UL) {
|
||||
*p++ = hex[(*s >> 12) & 0x0f];
|
||||
*p++ = hex[(*s >> 8) & 0x0f];
|
||||
i += 2;
|
||||
}
|
||||
*p++ = hex[(*s >> 4) & 0x0f];
|
||||
*p++ = hex[ *s & 0x0f];
|
||||
i += 2;
|
||||
}
|
||||
s++;
|
||||
}
|
||||
|
||||
if (i >= maxbytes)
|
||||
strcpy(p, "...");
|
||||
else
|
||||
*p = '\0';
|
||||
|
||||
bufno = (bufno + 1) % STRING_NBUFS;
|
||||
return (buf);
|
||||
}
|
||||
|
||||
char *
|
||||
idn__debug_utf16xstring(const unsigned short *s, int maxbytes) {
|
||||
char *buf = bufs[bufno];
|
||||
char *p;
|
||||
int i;
|
||||
|
||||
if (maxbytes > STRING_MAXBYTES)
|
||||
maxbytes = STRING_MAXBYTES;
|
||||
|
||||
i = 0;
|
||||
p = buf;
|
||||
while (i < maxbytes) {
|
||||
if (*s == '\0') {
|
||||
break;
|
||||
} else if (0x20 <= *s && *s <= 0x7e) {
|
||||
*p++ = *s;
|
||||
i++;
|
||||
} else {
|
||||
*p++ = '\\';
|
||||
*p++ = 'x';
|
||||
*p++ = hex[(*s >> 12) & 0x0f];
|
||||
*p++ = hex[(*s >> 8) & 0x0f];
|
||||
*p++ = hex[(*s >> 4) & 0x0f];
|
||||
*p++ = hex[ *s & 0x0f];
|
||||
i += 6;
|
||||
}
|
||||
s++;
|
||||
}
|
||||
|
||||
if (i >= maxbytes)
|
||||
strcpy(p, "...");
|
||||
else
|
||||
*p = '\0';
|
||||
|
||||
bufno = (bufno + 1) % STRING_NBUFS;
|
||||
return (buf);
|
||||
}
|
||||
|
||||
char *
|
||||
idn__debug_hexdata(const char *s, int length, int maxbytes) {
|
||||
char *buf = bufs[bufno];
|
||||
char *p;
|
||||
int i;
|
||||
|
||||
if (maxbytes > STRING_MAXBYTES)
|
||||
maxbytes = STRING_MAXBYTES;
|
||||
|
||||
i = 0;
|
||||
p = buf;
|
||||
while (length > 0 && i < maxbytes) {
|
||||
int c = *(const unsigned char *)s;
|
||||
|
||||
*p++ = hex[c >> 4];
|
||||
*p++ = hex[c & 15];
|
||||
*p++ = ' ';
|
||||
i += 3;
|
||||
length--;
|
||||
s++;
|
||||
}
|
||||
|
||||
if (i >= maxbytes)
|
||||
strcpy(p, "...");
|
||||
else
|
||||
*p = '\0';
|
||||
|
||||
bufno = (bufno + 1) % STRING_NBUFS;
|
||||
return (buf);
|
||||
}
|
||||
|
||||
void
|
||||
idn__debug_hexdump(const char *s, int length) {
|
||||
int i;
|
||||
const unsigned char *p = (const unsigned char *)s;
|
||||
|
||||
i = 0;
|
||||
while (length-- > 0) {
|
||||
if (i % 16 == 0) {
|
||||
if (i > 0)
|
||||
fprintf(stderr, "\n");
|
||||
fprintf(stderr, "%4x:", i);
|
||||
}
|
||||
fprintf(stderr, " %02x", p[i]);
|
||||
i++;
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
|
@ -1,268 +0,0 @@
|
|||
#ifndef lint
|
||||
static char *rcsid = "$Id: delimitermap.c,v 1.1 2003/06/04 00:25:52 marka Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001,2002 Japan Network Information Center.
|
||||
* All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <idn/result.h>
|
||||
#include <idn/assert.h>
|
||||
#include <idn/logmacro.h>
|
||||
#include <idn/delimitermap.h>
|
||||
#include <idn/util.h>
|
||||
#include <idn/debug.h>
|
||||
#include <idn/ucs4.h>
|
||||
|
||||
/*
|
||||
* Mapper object type.
|
||||
*/
|
||||
struct idn_delimitermap {
|
||||
int ndelimiters;
|
||||
int delimiter_size;
|
||||
unsigned long *delimiters;
|
||||
int reference_count;
|
||||
};
|
||||
|
||||
#define DELIMITERMAP_INITIAL_DELIMITER_SIZE 4
|
||||
#define UNICODE_MAX 0x10ffff
|
||||
#define IS_SURROGATE_HIGH(v) (0xd800 <= (v) && (v) <= 0xdbff)
|
||||
#define IS_SURROGATE_LOW(v) (0xdc00 <= (v) && (v) <= 0xdfff)
|
||||
|
||||
idn_result_t
|
||||
idn_delimitermap_create(idn_delimitermap_t *ctxp) {
|
||||
idn_delimitermap_t ctx = NULL;
|
||||
idn_result_t r;
|
||||
|
||||
assert(ctxp != NULL);
|
||||
TRACE(("idn_delimitermap_create()\n"));
|
||||
|
||||
ctx = (idn_delimitermap_t) malloc(sizeof(struct idn_delimitermap));
|
||||
if (ctx == NULL) {
|
||||
WARNING(("idn_mapper_create: malloc failed\n"));
|
||||
r = idn_nomemory;
|
||||
goto ret;
|
||||
}
|
||||
|
||||
ctx->delimiters = (unsigned long *) malloc(sizeof(unsigned long)
|
||||
* DELIMITERMAP_INITIAL_DELIMITER_SIZE);
|
||||
if (ctx->delimiters == NULL) {
|
||||
r = idn_nomemory;
|
||||
goto ret;
|
||||
}
|
||||
ctx->ndelimiters = 0;
|
||||
ctx->delimiter_size = DELIMITERMAP_INITIAL_DELIMITER_SIZE;
|
||||
ctx->reference_count = 1;
|
||||
*ctxp = ctx;
|
||||
r = idn_success;
|
||||
|
||||
ret:
|
||||
if (r != idn_success)
|
||||
free(ctx);
|
||||
TRACE(("idn_delimitermap_create(): %s\n", idn_result_tostring(r)));
|
||||
return (r);
|
||||
}
|
||||
|
||||
void
|
||||
idn_delimitermap_destroy(idn_delimitermap_t ctx) {
|
||||
assert(ctx != NULL);
|
||||
|
||||
TRACE(("idn_delimitermap_destroy()\n"));
|
||||
|
||||
ctx->reference_count--;
|
||||
if (ctx->reference_count <= 0) {
|
||||
TRACE(("idn_mapper_destroy(): the object is destroyed\n"));
|
||||
free(ctx->delimiters);
|
||||
free(ctx);
|
||||
} else {
|
||||
TRACE(("idn_delimitermap_destroy(): "
|
||||
"update reference count (%d->%d)\n",
|
||||
ctx->reference_count + 1, ctx->reference_count));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
idn_delimitermap_incrref(idn_delimitermap_t ctx) {
|
||||
assert(ctx != NULL);
|
||||
|
||||
TRACE(("idn_delimitermap_incrref()\n"));
|
||||
TRACE(("idn_delimitermap_incrref: update reference count (%d->%d)\n",
|
||||
ctx->reference_count, ctx->reference_count + 1));
|
||||
|
||||
ctx->reference_count++;
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_delimitermap_add(idn_delimitermap_t ctx, unsigned long delimiter) {
|
||||
idn_result_t r;
|
||||
|
||||
assert(ctx != NULL && ctx->ndelimiters <= ctx->delimiter_size);
|
||||
TRACE(("idn_delimitermap_add(delimiter=\\x%04lx)\n", delimiter));
|
||||
|
||||
if (delimiter == 0 || delimiter > UNICODE_MAX ||
|
||||
IS_SURROGATE_HIGH(delimiter) || IS_SURROGATE_LOW(delimiter)) {
|
||||
r = idn_invalid_codepoint;
|
||||
goto ret;
|
||||
}
|
||||
|
||||
if (ctx->ndelimiters == ctx->delimiter_size) {
|
||||
unsigned long *new_delimiters;
|
||||
|
||||
new_delimiters = (unsigned long *) realloc(ctx->delimiters,
|
||||
sizeof(unsigned long) * ctx->delimiter_size * 2);
|
||||
if (new_delimiters == NULL) {
|
||||
r = idn_nomemory;
|
||||
goto ret;
|
||||
}
|
||||
ctx->delimiters = new_delimiters;
|
||||
ctx->delimiter_size *= 2;
|
||||
}
|
||||
|
||||
ctx->delimiters[ctx->ndelimiters] = delimiter;
|
||||
ctx->ndelimiters++;
|
||||
r = idn_success;
|
||||
|
||||
ret:
|
||||
TRACE(("idn_delimitermap_add(): %s\n", idn_result_tostring(r)));
|
||||
return (r);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_delimitermap_addall(idn_delimitermap_t ctx, unsigned long *delimiters,
|
||||
int ndelimiters) {
|
||||
idn_result_t r;
|
||||
int i;
|
||||
|
||||
assert(ctx != NULL && delimiters != NULL);
|
||||
|
||||
TRACE(("idn_delimitermap_addall(ndelimiters=%d)\n", ndelimiters));
|
||||
|
||||
for (i = 0; i < ndelimiters; i++) {
|
||||
r = idn_delimitermap_add(ctx, *delimiters);
|
||||
if (r != idn_success)
|
||||
goto ret;
|
||||
delimiters++;
|
||||
}
|
||||
|
||||
r = idn_success;
|
||||
ret:
|
||||
TRACE(("idn_delimitermap_addall(): %s\n", idn_result_tostring(r)));
|
||||
return (r);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_delimitermap_map(idn_delimitermap_t ctx, const unsigned long *from,
|
||||
unsigned long *to, size_t tolen) {
|
||||
|
||||
/* default delimiters (label separators) from IDNA specification */
|
||||
static const unsigned long default_delimiters[] =
|
||||
{ 0x002e, /* full stop */
|
||||
0x3002, /* ideographic full stop */
|
||||
0xff0e, /* fullwidth full stop */
|
||||
0xff61, /* halfwidth ideographic full stop */
|
||||
0x0000 };
|
||||
|
||||
unsigned long *to_org = to;
|
||||
idn_result_t r;
|
||||
int i, j;
|
||||
int found;
|
||||
|
||||
assert(ctx != NULL && from != NULL && to != NULL);
|
||||
|
||||
TRACE(("idn_delimitermap_map(from=\"%s\", tolen=%d)\n",
|
||||
idn__debug_ucs4xstring(from, 50), (int)tolen));
|
||||
|
||||
/*
|
||||
* Map.
|
||||
*/
|
||||
while (*from != '\0') {
|
||||
found = 0;
|
||||
if (tolen < 1) {
|
||||
r = idn_buffer_overflow;
|
||||
goto ret;
|
||||
}
|
||||
for (j = 0; default_delimiters[j] != 0x0000; j++) {
|
||||
if (default_delimiters[j] == *from) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
for (i = 0; i < ctx->ndelimiters; i++) {
|
||||
if (ctx->delimiters[i] == *from) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
*to = '.';
|
||||
else
|
||||
*to = *from;
|
||||
from++;
|
||||
to++;
|
||||
tolen--;
|
||||
}
|
||||
|
||||
if (tolen < 1) {
|
||||
r = idn_buffer_overflow;
|
||||
goto ret;
|
||||
}
|
||||
*to = '\0';
|
||||
r = idn_success;
|
||||
|
||||
ret:
|
||||
if (r == idn_success) {
|
||||
TRACE(("idn_delimitermap_map(): success (to=\"%s\")\n",
|
||||
idn__debug_ucs4xstring(to_org, 50)));
|
||||
} else {
|
||||
TRACE(("idn_delimitermap_map(): %s\n",
|
||||
idn_result_tostring(r)));
|
||||
}
|
||||
return (r);
|
||||
}
|
||||
|
|
@ -1,261 +0,0 @@
|
|||
#ifndef lint
|
||||
static char *rcsid = "$Id: filechecker.c,v 1.1 2003/06/04 00:25:52 marka Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001,2002 Japan Network Information Center.
|
||||
* All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <idn/result.h>
|
||||
#include <idn/assert.h>
|
||||
#include <idn/log.h>
|
||||
#include <idn/logmacro.h>
|
||||
#include <idn/ucsset.h>
|
||||
#include <idn/filechecker.h>
|
||||
#include <idn/debug.h>
|
||||
|
||||
#define SUPPORT_VERSIONING
|
||||
|
||||
struct idn__filechecker {
|
||||
idn_ucsset_t set;
|
||||
};
|
||||
|
||||
static idn_result_t read_file(const char *file, FILE *fp,
|
||||
idn_ucsset_t set);
|
||||
static int get_range(char *s, unsigned long *ucs1,
|
||||
unsigned long *ucs2);
|
||||
static char *get_ucs(char *p, unsigned long *vp);
|
||||
|
||||
|
||||
idn_result_t
|
||||
idn__filechecker_create(const char *file, idn__filechecker_t *ctxp) {
|
||||
FILE *fp;
|
||||
idn__filechecker_t ctx;
|
||||
idn_result_t r;
|
||||
|
||||
assert(file != NULL && ctxp != NULL);
|
||||
|
||||
TRACE(("idn__filechecker_create(file=\"%-.100s\")\n", file));
|
||||
|
||||
if ((fp = fopen(file, "r")) == NULL) {
|
||||
WARNING(("idn__filechecker_create: cannot open %-.100s\n",
|
||||
file));
|
||||
return (idn_nofile);
|
||||
}
|
||||
|
||||
if ((ctx = malloc(sizeof(struct idn__filechecker))) == NULL)
|
||||
return (idn_nomemory);
|
||||
|
||||
if ((r = idn_ucsset_create(&ctx->set)) != idn_success) {
|
||||
free(ctx);
|
||||
return (r);
|
||||
}
|
||||
|
||||
r = read_file(file, fp, ctx->set);
|
||||
fclose(fp);
|
||||
|
||||
if (r == idn_success) {
|
||||
idn_ucsset_fix(ctx->set);
|
||||
*ctxp = ctx;
|
||||
} else {
|
||||
idn_ucsset_destroy(ctx->set);
|
||||
free(ctx);
|
||||
}
|
||||
return (r);
|
||||
}
|
||||
|
||||
void
|
||||
idn__filechecker_destroy(idn__filechecker_t ctx) {
|
||||
assert(ctx != NULL);
|
||||
|
||||
TRACE(("idn__filechecker_destroy()\n"));
|
||||
|
||||
idn_ucsset_destroy(ctx->set);
|
||||
free(ctx);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn__filechecker_lookup(idn__filechecker_t ctx, const unsigned long *str,
|
||||
const unsigned long **found) {
|
||||
idn_result_t r = idn_success;
|
||||
|
||||
assert(ctx != NULL && str != NULL);
|
||||
|
||||
TRACE(("idn__filechecker_lookup(str=\"%s\")\n",
|
||||
idn__debug_ucs4xstring(str, 50)));
|
||||
|
||||
while (*str != '\0') {
|
||||
int exists;
|
||||
|
||||
r = idn_ucsset_lookup(ctx->set, *str, &exists);
|
||||
|
||||
if (r != idn_success) {
|
||||
return (r);
|
||||
} else if (exists) {
|
||||
/* Found. */
|
||||
*found = str;
|
||||
return (idn_success);
|
||||
}
|
||||
str++;
|
||||
}
|
||||
*found = NULL;
|
||||
return (idn_success);
|
||||
}
|
||||
|
||||
static idn_result_t
|
||||
read_file(const char *file, FILE *fp, idn_ucsset_t set) {
|
||||
char line[256];
|
||||
idn_result_t r;
|
||||
int lineno = 0;
|
||||
|
||||
while (fgets(line, sizeof(line), fp) != NULL) {
|
||||
char *p = line;
|
||||
unsigned long ucs1, ucs2;
|
||||
|
||||
lineno++;
|
||||
while (isspace((unsigned char)*p))
|
||||
p++;
|
||||
if (*p == '\0' || *p == '#')
|
||||
continue;
|
||||
|
||||
#ifdef SUPPORT_VERSIONING
|
||||
/* Skip version tag. */
|
||||
if (lineno == 1 && strncmp("version=", line, 8) == 0)
|
||||
continue;
|
||||
#endif
|
||||
if (!get_range(p, &ucs1, &ucs2)) {
|
||||
WARNING(("syntax error in file \"%-.100s\" line %d: "
|
||||
"%-.100s", file, lineno, line));
|
||||
return (idn_invalid_syntax);
|
||||
}
|
||||
if ((r = idn_ucsset_addrange(set, ucs1, ucs2)) != idn_success)
|
||||
return (r);
|
||||
}
|
||||
return (idn_success);
|
||||
}
|
||||
|
||||
static int
|
||||
get_range(char *s, unsigned long *ucs1, unsigned long *ucs2) {
|
||||
if ((s = get_ucs(s, ucs1)) == NULL)
|
||||
return (0);
|
||||
*ucs2 = *ucs1;
|
||||
|
||||
switch (s[0]) {
|
||||
case '\0':
|
||||
case '\n':
|
||||
case '#':
|
||||
case ';':
|
||||
return (1);
|
||||
case '-':
|
||||
break;
|
||||
default:
|
||||
return (0);
|
||||
}
|
||||
|
||||
if ((s = get_ucs(s + 1, ucs2)) == NULL)
|
||||
return (0);
|
||||
|
||||
if (*ucs1 > *ucs2) {
|
||||
INFO(("idn__filechecker_create: invalid range spec "
|
||||
"U+%X-U+%X\n", *ucs1, *ucs2));
|
||||
return (0);
|
||||
}
|
||||
|
||||
switch (s[0]) {
|
||||
case '\0':
|
||||
case '\n':
|
||||
case '#':
|
||||
case ';':
|
||||
return (1);
|
||||
default:
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static char *
|
||||
get_ucs(char *p, unsigned long *vp) {
|
||||
char *end;
|
||||
|
||||
/* Skip leading space */
|
||||
while (isspace((unsigned char)*p))
|
||||
p++;
|
||||
|
||||
/* Skip optional 'U+' */
|
||||
if (strncmp(p, "U+", 2) == 0)
|
||||
p += 2;
|
||||
|
||||
*vp = strtoul(p, &end, 16);
|
||||
if (end == p) {
|
||||
INFO(("idn__filechecker_create: UCS code point expected\n"));
|
||||
return (NULL);
|
||||
}
|
||||
p = end;
|
||||
|
||||
/* Skip trailing space */
|
||||
while (isspace((unsigned char)*p))
|
||||
p++;
|
||||
return p;
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn__filechecker_createproc(const char *parameter, void **ctxp) {
|
||||
return idn__filechecker_create(parameter, (idn__filechecker_t *)ctxp);
|
||||
}
|
||||
|
||||
void
|
||||
idn__filechecker_destroyproc(void *ctxp) {
|
||||
idn__filechecker_destroy((idn__filechecker_t)ctxp);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn__filechecker_lookupproc(void *ctx, const unsigned long *str,
|
||||
const unsigned long **found) {
|
||||
return idn__filechecker_lookup((idn__filechecker_t)ctx, str, found);
|
||||
}
|
||||
|
|
@ -1,347 +0,0 @@
|
|||
#ifndef lint
|
||||
static char *rcsid = "$Id: filemapper.c,v 1.1 2003/06/04 00:25:53 marka Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001,2002 Japan Network Information Center.
|
||||
* All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <idn/result.h>
|
||||
#include <idn/assert.h>
|
||||
#include <idn/log.h>
|
||||
#include <idn/logmacro.h>
|
||||
#include <idn/debug.h>
|
||||
#include <idn/ucs4.h>
|
||||
#include <idn/ucsmap.h>
|
||||
#include <idn/filemapper.h>
|
||||
|
||||
#define SUPPORT_VERSIONING
|
||||
|
||||
#define UCSBUF_LOCAL_SIZE 20
|
||||
|
||||
typedef struct ucsbuf {
|
||||
unsigned long *ucs;
|
||||
size_t size;
|
||||
size_t len;
|
||||
unsigned long local[UCSBUF_LOCAL_SIZE];
|
||||
} ucsbuf_t;
|
||||
|
||||
struct idn__filemapper {
|
||||
idn_ucsmap_t map;
|
||||
};
|
||||
|
||||
static void ucsbuf_init(ucsbuf_t *b);
|
||||
static idn_result_t ucsbuf_grow(ucsbuf_t *b);
|
||||
static idn_result_t ucsbuf_append(ucsbuf_t *b, unsigned long v);
|
||||
static void ucsbuf_free(ucsbuf_t *b);
|
||||
static idn_result_t read_file(const char *file, FILE *fp,
|
||||
idn_ucsmap_t map);
|
||||
static idn_result_t get_map(char *p, ucsbuf_t *b);
|
||||
static char *get_ucs(char *p, unsigned long *vp);
|
||||
|
||||
|
||||
idn_result_t
|
||||
idn__filemapper_create(const char *file, idn__filemapper_t *ctxp) {
|
||||
FILE *fp;
|
||||
idn__filemapper_t ctx;
|
||||
idn_result_t r;
|
||||
|
||||
assert(file != NULL && ctxp != NULL);
|
||||
|
||||
TRACE(("idn__filemapper_create(file=\"%-.100s\")\n", file));
|
||||
|
||||
if ((fp = fopen(file, "r")) == NULL) {
|
||||
WARNING(("idn__filemapper_create: cannot open %-.100s\n",
|
||||
file));
|
||||
return (idn_nofile);
|
||||
}
|
||||
if ((ctx = malloc(sizeof(struct idn__filemapper))) == NULL)
|
||||
return (idn_nomemory);
|
||||
|
||||
if ((r = idn_ucsmap_create(&ctx->map)) != idn_success) {
|
||||
free(ctx);
|
||||
return (r);
|
||||
}
|
||||
|
||||
r = read_file(file, fp, ctx->map);
|
||||
fclose(fp);
|
||||
|
||||
if (r == idn_success) {
|
||||
idn_ucsmap_fix(ctx->map);
|
||||
*ctxp = ctx;
|
||||
} else {
|
||||
idn_ucsmap_destroy(ctx->map);
|
||||
free(ctx);
|
||||
}
|
||||
return (r);
|
||||
}
|
||||
|
||||
void
|
||||
idn__filemapper_destroy(idn__filemapper_t ctx) {
|
||||
|
||||
assert(ctx != NULL);
|
||||
|
||||
TRACE(("idn__filemapper_destroy()\n"));
|
||||
|
||||
idn_ucsmap_destroy(ctx->map);
|
||||
free(ctx);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn__filemapper_map(idn__filemapper_t ctx, const unsigned long *from,
|
||||
unsigned long *to, size_t tolen)
|
||||
{
|
||||
idn_result_t r = idn_success;
|
||||
ucsbuf_t ub;
|
||||
|
||||
assert(ctx != NULL && from != NULL && to != NULL);
|
||||
|
||||
TRACE(("idn__filemapper_map(from=\"%s\")\n",
|
||||
idn__debug_ucs4xstring(from, 50)));
|
||||
|
||||
/* Initialize temporary buffer. */
|
||||
ucsbuf_init(&ub);
|
||||
|
||||
while (*from != '\0') {
|
||||
/* Try mapping. */
|
||||
r = idn_ucsmap_map(ctx->map, *from, ub.ucs, ub.size, &ub.len);
|
||||
switch (r) {
|
||||
case idn_buffer_overflow:
|
||||
/* Temporary buffer too small. Enlarge and retry. */
|
||||
if ((r = ucsbuf_grow(&ub)) != idn_success)
|
||||
break;
|
||||
continue;
|
||||
case idn_nomapping:
|
||||
/* There is no mapping. */
|
||||
r = idn_success;
|
||||
/* fallthrough */
|
||||
case idn_success:
|
||||
if (tolen < ub.len) {
|
||||
r = idn_buffer_overflow;
|
||||
goto ret;
|
||||
}
|
||||
memcpy(to, ub.ucs, sizeof(*to) * ub.len);
|
||||
to += ub.len;
|
||||
tolen -= ub.len;
|
||||
break;
|
||||
default:
|
||||
goto ret;
|
||||
}
|
||||
from++;
|
||||
}
|
||||
|
||||
ret:
|
||||
ucsbuf_free(&ub);
|
||||
|
||||
if (r == idn_success) {
|
||||
/* Terminate with NUL. */
|
||||
if (tolen == 0)
|
||||
return (idn_buffer_overflow);
|
||||
*to = '\0';
|
||||
}
|
||||
|
||||
return (r);
|
||||
}
|
||||
|
||||
static void
|
||||
ucsbuf_init(ucsbuf_t *b) {
|
||||
b->ucs = b->local;
|
||||
b->size = UCSBUF_LOCAL_SIZE;
|
||||
b->len = 0;
|
||||
}
|
||||
|
||||
static idn_result_t
|
||||
ucsbuf_grow(ucsbuf_t *b) {
|
||||
unsigned long *newbuf;
|
||||
|
||||
b->size *= 2;
|
||||
if (b->ucs == b->local) {
|
||||
b->ucs = malloc(sizeof(unsigned long) * b->size);
|
||||
if (b->ucs == NULL)
|
||||
return (idn_nomemory);
|
||||
memcpy(b->ucs, b->local, sizeof(b->local));
|
||||
} else {
|
||||
newbuf = realloc(b->ucs, sizeof(unsigned long) * b->size);
|
||||
if (newbuf == NULL)
|
||||
return (idn_nomemory);
|
||||
b->ucs = newbuf;
|
||||
}
|
||||
return (idn_success);
|
||||
}
|
||||
|
||||
static idn_result_t
|
||||
ucsbuf_append(ucsbuf_t *b, unsigned long v) {
|
||||
idn_result_t r;
|
||||
|
||||
if (b->len + 1 > b->size) {
|
||||
r = ucsbuf_grow(b);
|
||||
if (r != idn_success)
|
||||
return (r);
|
||||
}
|
||||
b->ucs[b->len++] = v;
|
||||
return (idn_success);
|
||||
}
|
||||
|
||||
static void
|
||||
ucsbuf_free(ucsbuf_t *b) {
|
||||
if (b->ucs != b->local && b->ucs != NULL)
|
||||
free(b->ucs);
|
||||
}
|
||||
|
||||
static idn_result_t
|
||||
read_file(const char *file, FILE *fp, idn_ucsmap_t map) {
|
||||
char line[1024];
|
||||
ucsbuf_t ub;
|
||||
idn_result_t r = idn_success;
|
||||
int lineno = 0;
|
||||
|
||||
ucsbuf_init(&ub);
|
||||
|
||||
while (fgets(line, sizeof(line), fp) != NULL) {
|
||||
char *p = line;
|
||||
|
||||
lineno++;
|
||||
while (isspace((unsigned char)*p))
|
||||
p++;
|
||||
if (*p == '\0' || *p == '#')
|
||||
continue;
|
||||
#ifdef SUPPORT_VERSIONING
|
||||
/* Skip version tag. */
|
||||
if (lineno == 1 && strncmp("version=", line, 8) == 0)
|
||||
continue;
|
||||
#endif
|
||||
again:
|
||||
ub.len = 0;
|
||||
r = get_map(p, &ub);
|
||||
switch (r) {
|
||||
case idn_success:
|
||||
r = idn_ucsmap_add(map, ub.ucs[0],
|
||||
&ub.ucs[1], ub.len - 1);
|
||||
break;
|
||||
case idn_buffer_overflow:
|
||||
if ((r = ucsbuf_grow(&ub)) != idn_success)
|
||||
break;
|
||||
goto again;
|
||||
case idn_invalid_syntax:
|
||||
WARNING(("syntax error in file \"%-.100s\" line %d: "
|
||||
"%-.100s", file, lineno, line));
|
||||
/* fall through */
|
||||
default:
|
||||
ucsbuf_free(&ub);
|
||||
return (r);
|
||||
}
|
||||
}
|
||||
ucsbuf_free(&ub);
|
||||
return (r);
|
||||
}
|
||||
|
||||
static idn_result_t
|
||||
get_map(char *p, ucsbuf_t *b) {
|
||||
unsigned long v;
|
||||
idn_result_t r = idn_success;
|
||||
|
||||
for (;;) {
|
||||
if ((p = get_ucs(p, &v)) == NULL)
|
||||
return (idn_invalid_syntax);
|
||||
if ((r = ucsbuf_append(b, v)) != idn_success)
|
||||
return (r);
|
||||
if (b->len == 1) {
|
||||
if (*p != ';')
|
||||
return (idn_invalid_syntax);
|
||||
p++;
|
||||
while (isspace((unsigned char)*p))
|
||||
p++;
|
||||
}
|
||||
|
||||
if (*p == ';' || *p == '#' || *p == '\0')
|
||||
return (r);
|
||||
}
|
||||
return (r);
|
||||
}
|
||||
|
||||
static char *
|
||||
get_ucs(char *p, unsigned long *vp) {
|
||||
char *end;
|
||||
|
||||
/* Skip leading space */
|
||||
while (isspace((unsigned char)*p))
|
||||
p++;
|
||||
|
||||
/* Skip optional 'U+' */
|
||||
if (strncmp(p, "U+", 2) == 0)
|
||||
p += 2;
|
||||
|
||||
*vp = strtoul(p, &end, 16);
|
||||
if (end == p) {
|
||||
INFO(("idn__filemapper_create: UCS code point expected\n"));
|
||||
return (NULL);
|
||||
}
|
||||
p = end;
|
||||
|
||||
/* Skip trailing space */
|
||||
while (isspace((unsigned char)*p))
|
||||
p++;
|
||||
return p;
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn__filemapper_createproc(const char *parameter, void **ctxp) {
|
||||
return idn__filemapper_create(parameter, (idn__filemapper_t *)ctxp);
|
||||
}
|
||||
|
||||
void
|
||||
idn__filemapper_destroyproc(void *ctxp) {
|
||||
idn__filemapper_destroy((idn__filemapper_t)ctxp);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn__filemapper_mapproc(void *ctx, const unsigned long *from,
|
||||
unsigned long *to, size_t tolen) {
|
||||
return idn__filemapper_map((idn__filemapper_t)ctx, from, to, tolen);
|
||||
}
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
# $Id: idn.conf.sample.in,v 1.1 2003/06/04 00:26:45 marka Exp $
|
||||
#
|
||||
# Sample file for idnkit configuration file (idn.conf).
|
||||
#
|
||||
|
||||
#
|
||||
# `idn-encoding' entry specifies the encoding name used as the encoding
|
||||
# of multilingualized names by resolvers and DNS servers. Currently, the
|
||||
# following encodings are available:
|
||||
#
|
||||
# Punycode
|
||||
# UTF-8
|
||||
# <codeset names your iconv_open() accepts>
|
||||
#
|
||||
# If you enabled extra ace feature, following IDN encoding can be used.
|
||||
#
|
||||
# AMC-ACE-Z (old name of Punycode)
|
||||
# RACE
|
||||
#
|
||||
# syntax)
|
||||
# idn-encoding <encoding>
|
||||
#
|
||||
idn-encoding Punycode
|
||||
|
||||
#
|
||||
# `nameprep' entry specifies the version of NAMEPREP.
|
||||
# idnkit currently supports the following version:
|
||||
#
|
||||
# RFC3491 -- name preparation scheme described in the
|
||||
# RFC3491
|
||||
#
|
||||
# syntax)
|
||||
# nameprep <nameprep version>
|
||||
#
|
||||
nameprep RFC3491
|
||||
|
||||
#
|
||||
# `local-map' entry specifies TLD (top level domain) based local mapping
|
||||
# schemes, which is performed before NAMEPREP. Available schemes are:
|
||||
#
|
||||
# <nameprep version> -- nameprep version
|
||||
# filemap:<pathname> -- read mapping rules from a file
|
||||
#
|
||||
# syntax)
|
||||
# local-map <tld> <scheme> ...
|
||||
#
|
||||
# If the TLD of the domain name matches <tld>, local mapping specified
|
||||
# by <scheme> is performed on the name. Otherwise no mapping are
|
||||
# performed. Multiple schemes can be specified; they are applied in
|
||||
# turn.
|
||||
#
|
||||
# There are two special <tld>s for specifying a default mapping rule
|
||||
# and a mapping rule for local names (domain names containing no
|
||||
# dots). If <tld> is `.', its schemes are applied to domain names
|
||||
# whose TLD does not match any TLDs specified in local-map entries.
|
||||
# If <tld> is `-', its schemes are applied to domain names which
|
||||
# contain no dots.
|
||||
#
|
||||
#local-map - filemap:/some/where/local.map
|
||||
#local-map . filemap:/some/where/default.map
|
||||
local-map .jp filemap:@mapdir@/jp.map
|
||||
|
|
@ -1,123 +0,0 @@
|
|||
#ifndef lint
|
||||
static char *rcsid = "$Id: localencoding.c,v 1.1 2003/06/04 00:25:53 marka Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_LOCALE_H
|
||||
#include <locale.h>
|
||||
#endif
|
||||
#ifdef HAVE_LANGINFO_H
|
||||
#include <langinfo.h>
|
||||
#endif
|
||||
|
||||
#include <idn/logmacro.h>
|
||||
#include <idn/localencoding.h>
|
||||
#include <idn/debug.h>
|
||||
|
||||
#ifdef ENABLE_MDNKIT_COMPAT
|
||||
#include <mdn/localencoding.h>
|
||||
#endif
|
||||
|
||||
const char *
|
||||
idn_localencoding_name(void) {
|
||||
char *name;
|
||||
|
||||
TRACE(("idn_localencoding_name()\n"));
|
||||
|
||||
if ((name = getenv(IDN_LOCALCS_ENV)) != NULL) {
|
||||
TRACE(("local encoding=\"%-.30s\"\n",
|
||||
name == NULL ? "<null>" : name));
|
||||
return (name);
|
||||
}
|
||||
#ifdef ENABLE_MDNKIT_COMPAT
|
||||
if ((name = getenv(MDN_LOCALCS_ENV)) != NULL) {
|
||||
TRACE(("local encoding=\"%-.30s\"\n",
|
||||
name == NULL ? "<null>" : name));
|
||||
return (name);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
{
|
||||
static char cp_str[40]; /* enough */
|
||||
(void)sprintf(cp_str, "CP%u", GetACP());
|
||||
TRACE(("local encoding(codepage)=\"%-.30s\"\n", cp_str));
|
||||
return (cp_str);
|
||||
}
|
||||
#else /* WIN32 */
|
||||
#ifdef HAVE_LIBCHARSET
|
||||
name = locale_charset();
|
||||
TRACE(("local encoding=\"%-.30s\"\n",
|
||||
name == NULL ? "<null>" : name));
|
||||
return (name);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_NL_LANGINFO) && defined(CODESET)
|
||||
if ((name = nl_langinfo(CODESET)) != NULL) {
|
||||
TRACE(("local encoding=\"%-.30s\"\n",
|
||||
name == NULL ? "<null>" : name));
|
||||
return (name);
|
||||
}
|
||||
#endif
|
||||
(void)(
|
||||
#ifdef HAVE_SETLOCALE
|
||||
(name = setlocale(LC_CTYPE, NULL)) ||
|
||||
#endif
|
||||
(name = getenv("LC_ALL")) ||
|
||||
(name = getenv("LC_CTYPE")) ||
|
||||
(name = getenv("LANG")));
|
||||
TRACE(("local encoding=\"%-.30s\"\n", name == NULL ? "<null>" : name));
|
||||
return (name);
|
||||
#endif /* WIN32 */
|
||||
}
|
||||
|
|
@ -1,215 +0,0 @@
|
|||
#ifndef lint
|
||||
static char *rcsid = "$Id: log.c,v 1.1 2003/06/04 00:25:53 marka Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <idn/log.h>
|
||||
|
||||
#define LOGLEVEL_ENV "IDN_LOG_LEVEL"
|
||||
|
||||
#ifdef DEBUG
|
||||
#define DEFAULT_LOG_LEVEL idn_log_level_info
|
||||
#else
|
||||
#define DEFAULT_LOG_LEVEL idn_log_level_error
|
||||
#endif
|
||||
|
||||
static int log_level = -1;
|
||||
static idn_log_proc_t log_proc;
|
||||
|
||||
static void initialize(void);
|
||||
static void log(int level, const char *fmt, va_list args);
|
||||
static void log_to_stderr(int level, const char *buf);
|
||||
|
||||
void
|
||||
idn_log_fatal(const char *fmt, ...) {
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
log(idn_log_level_fatal, fmt, args);
|
||||
va_end(args);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void
|
||||
idn_log_error(const char *fmt, ...) {
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
log(idn_log_level_error, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void
|
||||
idn_log_warning(const char *fmt, ...) {
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
log(idn_log_level_warning, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void
|
||||
idn_log_info(const char *fmt, ...) {
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
log(idn_log_level_info, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void
|
||||
idn_log_trace(const char *fmt, ...) {
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
log(idn_log_level_trace, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void
|
||||
idn_log_dump(const char *fmt, ...) {
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
log(idn_log_level_dump, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void
|
||||
idn_log_setlevel(int level) {
|
||||
if (level >= 0)
|
||||
log_level = level;
|
||||
}
|
||||
|
||||
int
|
||||
idn_log_getlevel(void) {
|
||||
if (log_level < 0)
|
||||
initialize();
|
||||
return log_level;
|
||||
}
|
||||
|
||||
void
|
||||
idn_log_setproc(idn_log_proc_t proc) {
|
||||
if (proc == NULL)
|
||||
log_proc = log_to_stderr;
|
||||
else
|
||||
log_proc = proc;
|
||||
}
|
||||
|
||||
static void
|
||||
initialize(void) {
|
||||
char *s;
|
||||
|
||||
if (log_level < 0) {
|
||||
if ((s = getenv(LOGLEVEL_ENV)) != NULL) {
|
||||
int level = atoi(s);
|
||||
if (level >= 0)
|
||||
log_level = level;
|
||||
}
|
||||
if (log_level < 0)
|
||||
log_level = DEFAULT_LOG_LEVEL;
|
||||
}
|
||||
|
||||
if (log_proc == NULL)
|
||||
log_proc = log_to_stderr;
|
||||
}
|
||||
|
||||
static void
|
||||
log(int level, const char *fmt, va_list args) {
|
||||
char buf[1024];
|
||||
|
||||
initialize();
|
||||
|
||||
if (log_level < level)
|
||||
return;
|
||||
|
||||
#if HAVE_VSNPRINTF
|
||||
(void)vsnprintf(buf, sizeof(buf), fmt, args);
|
||||
#else
|
||||
/* Let's hope 1024 is enough.. */
|
||||
(void)vsprintf(buf, fmt, args);
|
||||
#endif
|
||||
(*log_proc)(level, buf);
|
||||
}
|
||||
|
||||
static void
|
||||
log_to_stderr(int level, const char *buf) {
|
||||
char *title;
|
||||
char tmp[20];
|
||||
|
||||
switch (level) {
|
||||
case idn_log_level_fatal:
|
||||
title = "FATAL";
|
||||
break;
|
||||
case idn_log_level_error:
|
||||
title = "ERROR";
|
||||
break;
|
||||
case idn_log_level_warning:
|
||||
title = "WARNING";
|
||||
break;
|
||||
case idn_log_level_info:
|
||||
title = "INFO";
|
||||
break;
|
||||
case idn_log_level_trace:
|
||||
title = "TRACE";
|
||||
break;
|
||||
case idn_log_level_dump:
|
||||
title = "DUMP";
|
||||
break;
|
||||
default:
|
||||
(void)sprintf(tmp, "LEVEL%d", level);
|
||||
title = tmp;
|
||||
break;
|
||||
}
|
||||
fprintf(stderr, "%u: [%s] %s", (unsigned int)getpid(), title, buf);
|
||||
}
|
||||
|
|
@ -1,279 +0,0 @@
|
|||
# $Id: make.wnt,v 1.1 2003/06/04 00:25:54 marka Exp $
|
||||
# Makefile for MDN library, manually configured for WIN-NT (VC5.0)
|
||||
#
|
||||
# Copyright (c) 2000,2002 Japan Network Information Center. All rights reserved.
|
||||
#
|
||||
# By using this file, you agree to the terms and conditions set forth bellow.
|
||||
#
|
||||
# LICENSE TERMS AND CONDITIONS
|
||||
#
|
||||
# The following License Terms and Conditions apply, unless a different
|
||||
# license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
# Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
#
|
||||
# 1. Use, Modification and Redistribution (including distribution of any
|
||||
# modified or derived work) in source and/or binary forms is permitted
|
||||
# under this License Terms and Conditions.
|
||||
#
|
||||
# 2. Redistribution of source code must retain the copyright notices as they
|
||||
# appear in each source code file, this License Terms and Conditions.
|
||||
#
|
||||
# 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
# this License Terms and Conditions, in the documentation and/or other
|
||||
# materials provided with the distribution. For the purposes of binary
|
||||
# distribution the "Copyright Notice" refers to the following language:
|
||||
# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
#
|
||||
# 4. The name of JPNIC may not be used to endorse or promote products
|
||||
# derived from this Software without specific prior written approval of
|
||||
# JPNIC.
|
||||
#
|
||||
# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
!include <ntwin32.mak>
|
||||
|
||||
INCDIR = ..\include
|
||||
ICONVDIR = ..\win
|
||||
LIBS = $(ICONVDIR)\iconv.lib
|
||||
LIBS_LITE =
|
||||
SYSLIBS = $(conlibsdll)
|
||||
|
||||
#
|
||||
# Files to build MDN library
|
||||
#
|
||||
|
||||
HDRS_LITE = \
|
||||
$(INCDIR)\config.h \
|
||||
$(INCDIR)\idn\aliaslist.h \
|
||||
$(INCDIR)\idn\api.h \
|
||||
$(INCDIR)\idn\assert.h \
|
||||
$(INCDIR)\idn\checker.h \
|
||||
$(INCDIR)\idn\converter.h \
|
||||
$(INCDIR)\idn\debug.h \
|
||||
$(INCDIR)\idn\delimitermap.h \
|
||||
$(INCDIR)\idn\export.h \
|
||||
$(INCDIR)\idn\filechecker.h \
|
||||
$(INCDIR)\idn\filemapper.h \
|
||||
$(INCDIR)\idn\localencoding.h \
|
||||
$(INCDIR)\idn\log.h \
|
||||
$(INCDIR)\idn\logmacro.h \
|
||||
$(INCDIR)\idn\mapper.h \
|
||||
$(INCDIR)\idn\mapselector.h \
|
||||
$(INCDIR)\idn\nameprep.h \
|
||||
$(INCDIR)\idn\normalizer.h \
|
||||
$(INCDIR)\idn\punycode.h \
|
||||
$(INCDIR)\idn\race.h \
|
||||
$(INCDIR)\idn\res.h \
|
||||
$(INCDIR)\idn\resconf.h \
|
||||
$(INCDIR)\idn\result.h \
|
||||
$(INCDIR)\idn\strhash.h \
|
||||
$(INCDIR)\idn\ucs4.h \
|
||||
$(INCDIR)\idn\ucsmap.h \
|
||||
$(INCDIR)\idn\ucsset.h \
|
||||
$(INCDIR)\idn\unicode.h \
|
||||
$(INCDIR)\idn\unormalize.h \
|
||||
$(INCDIR)\idn\utf8.h \
|
||||
$(INCDIR)\idn\util.h \
|
||||
$(INCDIR)\idn\version.h
|
||||
|
||||
HDRS = $(ICONVDIR)\iconv.h \
|
||||
$(HDRS_LITE)
|
||||
|
||||
SRCS = aliaslist.c api.c checker.c \
|
||||
converter.c debug.c delimitermap.c \
|
||||
filechecker.c filemapper.c \
|
||||
localencoding.c log.c mapper.c \
|
||||
mapselector.c nameprep.c nameprep_template.c \
|
||||
nameprepdata.c normalizer.c punycode.c race.c \
|
||||
res.c resconf.c result.c \
|
||||
strhash.c ucs4.c ucsmap.c \
|
||||
ucsset.c unicode.c unicode_template.c \
|
||||
unicodedata_320.c unormalize.c \
|
||||
utf8.c util.c version.c
|
||||
|
||||
OBJS = aliaslist.obj api.obj checker.obj \
|
||||
converter.obj debug.obj delimitermap.obj \
|
||||
filechecker.obj filemapper.obj \
|
||||
localencoding.obj log.obj mapper.obj \
|
||||
mapselector.obj nameprep.obj \
|
||||
normalizer.obj punycode.obj race.obj \
|
||||
res.obj resconf.obj result.obj \
|
||||
strhash.obj ucs4.obj ucsmap.obj \
|
||||
ucsset.obj unicode.obj \
|
||||
unormalize.obj \
|
||||
utf8.obj util.obj version.obj
|
||||
|
||||
OBJS_LITE = \
|
||||
aliaslist_l.obj api_l.obj checker_l.obj \
|
||||
converter_l.obj debug_l.obj delimitermap_l.obj \
|
||||
filechecker_l.obj filemapper_l.obj \
|
||||
localencoding_l.obj log_l.obj mapper_l.obj \
|
||||
mapselector_l.obj nameprep_l.obj \
|
||||
normalizer_l.obj punycode_l.obj race_l.obj \
|
||||
res_l.obj resconf_l.obj result_l.obj \
|
||||
strhash_l.obj ucs4_l.obj ucsmap_l.obj \
|
||||
ucsset_l.obj unicode_l.obj \
|
||||
unormalize_l.obj \
|
||||
utf8_l.obj util_l.obj version_l.obj
|
||||
|
||||
|
||||
#DBG = -DDEBUG
|
||||
|
||||
#
|
||||
# Target to build
|
||||
#
|
||||
|
||||
TARGETS = idnkit.dll idnkitlite.dll
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
idnkit.dll: $(OBJS)
|
||||
-del idnkit.dll
|
||||
$(link) /out:"idnkit.dll" /implib:"idnkit.lib" $(dlllflags) $(OBJS) $(LIBS) $(SYSLIBS)
|
||||
|
||||
idnkitlite.dll: $(OBJS_LITE)
|
||||
-del idnkitlite.dll
|
||||
$(link) /out:"idnkitlite.dll" /implib:"idnkitlite.lib" $(dlllflags) $(OBJS_LITE) $(LIBS_LITE) $(SYSLIBS)
|
||||
|
||||
install:
|
||||
|
||||
clean:
|
||||
-del *.obj
|
||||
-del *.lib
|
||||
-del *.dll
|
||||
-del *.exp
|
||||
|
||||
#
|
||||
# Dependencies
|
||||
#
|
||||
|
||||
EXP = -DIDN_EXPORT="extern __declspec(dllexport)"
|
||||
CCARGS = $(cflags) $(cvarsdll) -I$(INCDIR) -I$(ICONVDIR) $(EXP) $(DBG)
|
||||
CCARGS_LITE = $(cflags) $(cvarsdll) -I$(INCDIR) -DWITHOUT_ICONV $(EXP) $(DBG)
|
||||
|
||||
aliaslist.obj: aliaslist.c $(HDRS)
|
||||
$(cc) $(CCARGS) /Foaliaslist.obj aliaslist.c
|
||||
api.obj: api.c $(HDRS)
|
||||
$(cc) $(CCARGS) /Foapi.obj api.c
|
||||
checker.obj: checker.c $(HDRS)
|
||||
$(cc) $(CCARGS) /Fochecker.obj checker.c
|
||||
converter.obj: converter.c $(HDRS)
|
||||
$(cc) $(CCARGS) /Foconverter.obj converter.c
|
||||
debug.obj: debug.c $(HDRS)
|
||||
$(cc) $(CCARGS) /Fodebug.obj debug.c
|
||||
delimitermap.obj: delimitermap.c $(HDRS)
|
||||
$(cc) $(CCARGS) /Fodelimitermap.obj delimitermap.c
|
||||
filechecker.obj: filechecker.c $(HDRS)
|
||||
$(cc) $(CCARGS) /Fofilechecker.obj filechecker.c
|
||||
filemapper.obj: filemapper.c $(HDRS)
|
||||
$(cc) $(CCARGS) /Fofilemapper.obj filemapper.c
|
||||
localencoding.obj: localencoding.c $(HDRS)
|
||||
$(cc) $(CCARGS) /Folocalencoding.obj localencoding.c
|
||||
log.obj: log.c $(HDRS)
|
||||
$(cc) $(CCARGS) /Folog.obj log.c
|
||||
mapper.obj: mapper.c $(HDRS)
|
||||
$(cc) $(CCARGS) /Fomapper.obj mapper.c
|
||||
mapselector.obj: mapselector.c $(HDRS)
|
||||
$(cc) $(CCARGS) /Fomapselector.obj mapselector.c
|
||||
nameprep.obj: nameprep.c nameprepdata.c nameprep_template.c $(HDRS)
|
||||
$(cc) $(CCARGS) /Fonameprep.obj nameprep.c
|
||||
normalizer.obj: normalizer.c $(HDRS)
|
||||
$(cc) $(CCARGS) /Fonormalizer.obj normalizer.c
|
||||
punycode.obj: punycode.c $(HDRS)
|
||||
$(cc) $(CCARGS) /Fopunycode.obj punycode.c
|
||||
race.obj: race.c $(HDRS)
|
||||
$(cc) $(CCARGS) /Forace.obj race.c
|
||||
res.obj: res.c $(HDRS)
|
||||
$(cc) $(CCARGS) /Fores.obj res.c
|
||||
resconf.obj: resconf.c $(HDRS)
|
||||
$(cc) $(CCARGS) /Foresconf.obj resconf.c
|
||||
result.obj: result.c $(HDRS)
|
||||
$(cc) $(CCARGS) /Foresult.obj result.c
|
||||
strhash.obj: strhash.c $(HDRS)
|
||||
$(cc) $(CCARGS) /Fostrhash.obj strhash.c
|
||||
ucs4.obj: ucs4.c $(HDRS)
|
||||
$(cc) $(CCARGS) /Foucs4.obj ucs4.c
|
||||
ucsmap.obj: ucsmap.c $(HDRS)
|
||||
$(cc) $(CCARGS) /Foucsmap.obj ucsmap.c
|
||||
ucsset.obj: ucsset.c $(HDRS)
|
||||
$(cc) $(CCARGS) /Foucsset.obj ucsset.c
|
||||
unicode.obj: unicode.c unicodedata_320.c unicode_template.c $(HDRS)
|
||||
$(cc) $(CCARGS) /Founicode.obj unicode.c
|
||||
unormalize.obj: unormalize.c $(HDRS)
|
||||
$(cc) $(CCARGS) /Founormalize.obj unormalize.c
|
||||
utf8.obj: utf8.c $(HDRS)
|
||||
$(cc) $(CCARGS) /Foutf8.obj utf8.c
|
||||
util.obj: util.c $(HDRS)
|
||||
$(cc) $(CCARGS) /Foutil.obj util.c
|
||||
version.obj: version.c $(HDRS)
|
||||
$(cc) $(CCARGS) /Foversion.obj version.c
|
||||
|
||||
aliaslist_l.obj: aliaslist.c $(HDRS_LITE)
|
||||
$(cc) $(CCARGS_LITE) /Foaliaslist_l.obj aliaslist.c
|
||||
api_l.obj: api.c $(HDRS_LITE)
|
||||
$(cc) $(CCARGS_LITE) /Foapi_l.obj api.c
|
||||
checker_l.obj: checker.c $(HDRS_LITE)
|
||||
$(cc) $(CCARGS_LITE) /Fochecker_l.obj checker.c
|
||||
converter_l.obj: converter.c $(HDRS_LITE)
|
||||
$(cc) $(CCARGS_LITE) /Foconverter_l.obj converter.c
|
||||
debug_l.obj: debug.c $(HDRS_LITE)
|
||||
$(cc) $(CCARGS_LITE) /Fodebug_l.obj debug.c
|
||||
delimitermap_l.obj: delimitermap.c $(HDRS_LITE)
|
||||
$(cc) $(CCARGS_LITE) /Fodelimitermap_l.obj delimitermap.c
|
||||
dude_l.obj: dude.c $(HDRS_LITE)
|
||||
$(cc) $(CCARGS_LITE) /Fodude_l.obj dude.c
|
||||
filechecker_l.obj: filechecker.c $(HDRS_LITE)
|
||||
$(cc) $(CCARGS_LITE) /Fofilechecker_l.obj filechecker.c
|
||||
filemapper_l.obj: filemapper.c $(HDRS_LITE)
|
||||
$(cc) $(CCARGS_LITE) /Fofilemapper_l.obj filemapper.c
|
||||
localencoding_l.obj: localencoding.c $(HDRS_LITE)
|
||||
$(cc) $(CCARGS_LITE) /Folocalencoding_l.obj localencoding.c
|
||||
log_l.obj: log.c $(HDRS_LITE)
|
||||
$(cc) $(CCARGS_LITE) /Folog_l.obj log.c
|
||||
mapper_l.obj: mapper.c $(HDRS_LITE)
|
||||
$(cc) $(CCARGS_LITE) /Fomapper_l.obj mapper.c
|
||||
mapselector_l.obj: mapselector.c $(HDRS_LITE)
|
||||
$(cc) $(CCARGS_LITE) /Fomapselector_l.obj mapselector.c
|
||||
nameprep_l.obj: nameprep.c nameprepdata.c nameprep_template.c $(HDRS_LITE)
|
||||
$(cc) $(CCARGS_LITE) /Fonameprep_l.obj nameprep.c
|
||||
normalizer_l.obj: normalizer.c $(HDRS_LITE)
|
||||
$(cc) $(CCARGS_LITE) /Fonormalizer_l.obj normalizer.c
|
||||
punycode_l.obj: punycode.c $(HDRS_LITE)
|
||||
$(cc) $(CCARGS_LITE) /Fopunycode_l.obj punycode.c
|
||||
race_l.obj: race.c $(HDRS_LITE)
|
||||
$(cc) $(CCARGS_LITE) /Forace_l.obj race.c
|
||||
res_l.obj: res.c $(HDRS_LITE)
|
||||
$(cc) $(CCARGS_LITE) /Fores_l.obj res.c
|
||||
resconf_l.obj: resconf.c $(HDRS_LITE)
|
||||
$(cc) $(CCARGS_LITE) /Foresconf_l.obj resconf.c
|
||||
result_l.obj: result.c $(HDRS_LITE)
|
||||
$(cc) $(CCARGS_LITE) /Foresult_l.obj result.c
|
||||
strhash_l.obj: strhash.c $(HDRS_LITE)
|
||||
$(cc) $(CCARGS_LITE) /Fostrhash_l.obj strhash.c
|
||||
ucs4_l.obj: ucs4.c $(HDRS_LITE)
|
||||
$(cc) $(CCARGS_LITE) /Foucs4_l.obj ucs4.c
|
||||
ucsmap_l.obj: ucsmap.c $(HDRS_LITE)
|
||||
$(cc) $(CCARGS_LITE) /Foucsmap_l.obj ucsmap.c
|
||||
ucsset_l.obj: ucsset.c $(HDRS_LITE)
|
||||
$(cc) $(CCARGS_LITE) /Foucsset_l.obj ucsset.c
|
||||
unicode_l.obj: unicode.c unicodedata_320.c unicode_template.c $(HDRS_LITE)
|
||||
$(cc) $(CCARGS_LITE) /Founicode_l.obj unicode.c
|
||||
unormalize_l.obj: unormalize.c $(HDRS_LITE)
|
||||
$(cc) $(CCARGS_LITE) /Founormalize_l.obj unormalize.c
|
||||
utf8_l.obj: utf8.c $(HDRS_LITE)
|
||||
$(cc) $(CCARGS_LITE) /Foutf8_l.obj utf8.c
|
||||
util_l.obj: util.c $(HDRS_LITE)
|
||||
$(cc) $(CCARGS_LITE) /Foutil_l.obj util.c
|
||||
version_l.obj: version.c $(HDRS_LITE)
|
||||
$(cc) $(CCARGS_LITE) /Foversion_l.obj version.c
|
||||
|
|
@ -1,482 +0,0 @@
|
|||
#ifndef lint
|
||||
static char *rcsid = "$Id: mapper.c,v 1.1 2003/06/04 00:25:55 marka Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001,2002 Japan Network Information Center.
|
||||
* All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <idn/result.h>
|
||||
#include <idn/assert.h>
|
||||
#include <idn/logmacro.h>
|
||||
#include <idn/mapper.h>
|
||||
#include <idn/strhash.h>
|
||||
#include <idn/debug.h>
|
||||
#include <idn/util.h>
|
||||
#include <idn/ucs4.h>
|
||||
|
||||
/*
|
||||
* Type for mapping scheme.
|
||||
*/
|
||||
typedef struct {
|
||||
char *prefix;
|
||||
char *parameter;
|
||||
idn_mapper_createproc_t create;
|
||||
idn_mapper_destroyproc_t destroy;
|
||||
idn_mapper_mapproc_t map;
|
||||
void *context;
|
||||
} map_scheme_t;
|
||||
|
||||
/*
|
||||
* Standard mapping schemes.
|
||||
*/
|
||||
static const map_scheme_t nameprep_scheme = {
|
||||
"RFC3491",
|
||||
NULL,
|
||||
idn_nameprep_createproc,
|
||||
idn_nameprep_destroyproc,
|
||||
idn_nameprep_mapproc,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static const map_scheme_t filemap_scheme = {
|
||||
"filemap",
|
||||
"",
|
||||
idn__filemapper_createproc,
|
||||
idn__filemapper_destroyproc,
|
||||
idn__filemapper_mapproc,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static const map_scheme_t *standard_map_schemes[] = {
|
||||
&nameprep_scheme,
|
||||
&filemap_scheme,
|
||||
NULL,
|
||||
};
|
||||
|
||||
/*
|
||||
* Hash table for mapping schemes.
|
||||
*/
|
||||
static idn__strhash_t scheme_hash = NULL;
|
||||
|
||||
/*
|
||||
* Mapper object type.
|
||||
*/
|
||||
struct idn_mapper {
|
||||
int nschemes;
|
||||
int scheme_size;
|
||||
map_scheme_t *schemes;
|
||||
int reference_count;
|
||||
};
|
||||
|
||||
#define MAPPER_INITIAL_SCHEME_SIZE 1
|
||||
|
||||
idn_result_t
|
||||
idn_mapper_initialize(void) {
|
||||
idn_result_t r;
|
||||
map_scheme_t **scheme;
|
||||
|
||||
TRACE(("idn_mapper_initialize()\n"));
|
||||
|
||||
if (scheme_hash != NULL) {
|
||||
r = idn_success; /* already initialized */
|
||||
goto ret;
|
||||
}
|
||||
|
||||
r = idn__strhash_create(&scheme_hash);
|
||||
if (r != idn_success)
|
||||
goto ret;
|
||||
|
||||
for (scheme = (map_scheme_t **)standard_map_schemes;
|
||||
*scheme != NULL; scheme++) {
|
||||
r = idn__strhash_put(scheme_hash, (*scheme)->prefix, *scheme);
|
||||
if (r != idn_success)
|
||||
goto ret;
|
||||
}
|
||||
|
||||
r = idn_success;
|
||||
ret:
|
||||
if (r != idn_success && scheme_hash != NULL) {
|
||||
idn__strhash_destroy(scheme_hash, NULL);
|
||||
scheme_hash = NULL;
|
||||
}
|
||||
TRACE(("idn_mapper_initialize(): %s\n", idn_result_tostring(r)));
|
||||
return (r);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_mapper_create(idn_mapper_t *ctxp) {
|
||||
idn_mapper_t ctx = NULL;
|
||||
idn_result_t r;
|
||||
|
||||
assert(scheme_hash != NULL);
|
||||
assert(ctxp != NULL);
|
||||
|
||||
TRACE(("idn_mapper_create()\n"));
|
||||
|
||||
ctx = (idn_mapper_t) malloc(sizeof(struct idn_mapper));
|
||||
if (ctx == NULL) {
|
||||
r = idn_nomemory;
|
||||
goto ret;
|
||||
}
|
||||
|
||||
ctx->schemes = (map_scheme_t *) malloc(sizeof(map_scheme_t)
|
||||
* MAPPER_INITIAL_SCHEME_SIZE);
|
||||
if (ctx->schemes == NULL) {
|
||||
r = idn_nomemory;
|
||||
goto ret;
|
||||
}
|
||||
|
||||
ctx->nschemes = 0;
|
||||
ctx->scheme_size = MAPPER_INITIAL_SCHEME_SIZE;
|
||||
ctx->reference_count = 1;
|
||||
*ctxp = ctx;
|
||||
r = idn_success;
|
||||
|
||||
ret:
|
||||
if (r != idn_success) {
|
||||
if (ctx != NULL)
|
||||
free(ctx->schemes);
|
||||
free(ctx);
|
||||
}
|
||||
TRACE(("idn_mapper_create(): %s\n", idn_result_tostring(r)));
|
||||
return (r);
|
||||
}
|
||||
|
||||
void
|
||||
idn_mapper_destroy(idn_mapper_t ctx) {
|
||||
int i;
|
||||
|
||||
assert(scheme_hash != NULL);
|
||||
assert(ctx != NULL);
|
||||
|
||||
TRACE(("idn_mapper_destroy()\n"));
|
||||
|
||||
ctx->reference_count--;
|
||||
if (ctx->reference_count <= 0) {
|
||||
TRACE(("idn_mapper_destroy(): the object is destroyed\n"));
|
||||
for (i = 0; i < ctx->nschemes; i++)
|
||||
ctx->schemes[i].destroy(ctx->schemes[i].context);
|
||||
free(ctx->schemes);
|
||||
free(ctx);
|
||||
} else {
|
||||
TRACE(("idn_mapper_destroy(): "
|
||||
"update reference count (%d->%d)\n",
|
||||
ctx->reference_count + 1, ctx->reference_count));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
idn_mapper_incrref(idn_mapper_t ctx) {
|
||||
assert(ctx != NULL && scheme_hash != NULL);
|
||||
|
||||
TRACE(("idn_mapper_incrref()\n"));
|
||||
TRACE(("idn_mapper_incrref: update reference count (%d->%d)\n",
|
||||
ctx->reference_count, ctx->reference_count + 1));
|
||||
|
||||
ctx->reference_count++;
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_mapper_add(idn_mapper_t ctx, const char *scheme_name) {
|
||||
idn_result_t r;
|
||||
map_scheme_t *scheme;
|
||||
const char *scheme_prefix;
|
||||
const char *scheme_parameter;
|
||||
void *scheme_context = NULL;
|
||||
char static_buffer[128]; /* large enough */
|
||||
char *buffer = static_buffer;
|
||||
|
||||
assert(scheme_hash != NULL);
|
||||
assert(ctx != NULL);
|
||||
|
||||
TRACE(("idn_mapper_add(scheme_name=%s)\n",
|
||||
idn__debug_xstring(scheme_name, 50)));
|
||||
|
||||
/*
|
||||
* Split `scheme_name' into `scheme_prefix' and `scheme_parameter'.
|
||||
*/
|
||||
scheme_parameter = strchr(scheme_name, ':');
|
||||
if (scheme_parameter == NULL) {
|
||||
scheme_prefix = scheme_name;
|
||||
} else {
|
||||
ptrdiff_t scheme_prefixlen;
|
||||
|
||||
scheme_prefixlen = scheme_parameter - scheme_name;
|
||||
if (scheme_prefixlen + 1 > sizeof(static_buffer)) {
|
||||
buffer = (char *) malloc(scheme_prefixlen + 1);
|
||||
if (buffer == NULL) {
|
||||
r = idn_nomemory;
|
||||
goto ret;
|
||||
}
|
||||
}
|
||||
memcpy(buffer, scheme_name, scheme_prefixlen);
|
||||
*(buffer + scheme_prefixlen) = '\0';
|
||||
scheme_prefix = buffer;
|
||||
scheme_parameter++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find a scheme.
|
||||
*/
|
||||
if (idn__strhash_get(scheme_hash, scheme_prefix, (void **)&scheme)
|
||||
!= idn_success) {
|
||||
ERROR(("idn_mapper_add(): invalid scheme name \"%-.30s\"\n",
|
||||
scheme_prefix));
|
||||
r = idn_invalid_name;
|
||||
goto ret;
|
||||
}
|
||||
if (scheme_parameter == NULL) {
|
||||
if (scheme->parameter != NULL)
|
||||
scheme_parameter = scheme->parameter;
|
||||
else
|
||||
scheme_parameter = scheme->prefix;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add the scheme.
|
||||
*/
|
||||
assert(ctx->nschemes <= ctx->scheme_size);
|
||||
|
||||
if (ctx->nschemes == ctx->scheme_size) {
|
||||
map_scheme_t *new_schemes;
|
||||
|
||||
new_schemes = (map_scheme_t *) realloc(ctx->schemes,
|
||||
sizeof(map_scheme_t) * ctx->scheme_size * 2);
|
||||
if (new_schemes == NULL) {
|
||||
r = idn_nomemory;
|
||||
goto ret;
|
||||
}
|
||||
ctx->schemes = new_schemes;
|
||||
ctx->scheme_size *= 2;
|
||||
}
|
||||
|
||||
r = scheme->create(scheme_parameter, &scheme_context);
|
||||
if (r != idn_success)
|
||||
goto ret;
|
||||
|
||||
memcpy(ctx->schemes + ctx->nschemes, scheme, sizeof(map_scheme_t));
|
||||
ctx->schemes[ctx->nschemes].context = scheme_context;
|
||||
ctx->nschemes++;
|
||||
r = idn_success;
|
||||
ret:
|
||||
if (r != idn_success)
|
||||
free(scheme_context);
|
||||
if (buffer != static_buffer)
|
||||
free(buffer);
|
||||
TRACE(("idn_mapper_add(): %s\n", idn_result_tostring(r)));
|
||||
return (r);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_mapper_addall(idn_mapper_t ctx, const char **scheme_names, int nschemes) {
|
||||
idn_result_t r;
|
||||
int i;
|
||||
|
||||
assert(scheme_hash != NULL);
|
||||
assert(ctx != NULL && scheme_names != NULL);
|
||||
|
||||
TRACE(("idn_mapper_addall(nschemes=%d)\n", nschemes));
|
||||
|
||||
for (i = 0; i < nschemes; i++) {
|
||||
r = idn_mapper_add(ctx, (const char *)*scheme_names);
|
||||
if (r != idn_success)
|
||||
goto ret;
|
||||
scheme_names++;
|
||||
}
|
||||
|
||||
r = idn_success;
|
||||
ret:
|
||||
TRACE(("idn_mapper_addall(): %s\n", idn_result_tostring(r)));
|
||||
return (r);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_mapper_map(idn_mapper_t ctx, const unsigned long *from,
|
||||
unsigned long *to, size_t tolen) {
|
||||
idn_result_t r;
|
||||
unsigned long *src, *dst;
|
||||
unsigned long *buffers[2] = {NULL, NULL};
|
||||
size_t buflen[2] = {0, 0};
|
||||
size_t dstlen;
|
||||
int idx;
|
||||
int i;
|
||||
|
||||
assert(scheme_hash != NULL);
|
||||
assert(ctx != NULL && from != NULL && to != NULL);
|
||||
|
||||
TRACE(("idn_mapper_map(from=\"%s\", tolen=%d)\n",
|
||||
idn__debug_ucs4xstring(from, 50), (int)tolen));
|
||||
|
||||
if (ctx->nschemes <= 0) {
|
||||
if (tolen < idn_ucs4_strlen(from) + 1) {
|
||||
r = idn_buffer_overflow;
|
||||
goto ret;
|
||||
}
|
||||
idn_ucs4_strcpy(to, from);
|
||||
r = idn_success;
|
||||
goto ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Map.
|
||||
*/
|
||||
src = (void *)from;
|
||||
dstlen = idn_ucs4_strlen(from) + 1;
|
||||
|
||||
i = 0;
|
||||
while (i < ctx->nschemes) {
|
||||
TRACE(("idn_mapper_map(): map %s\n", ctx->schemes[i].prefix));
|
||||
|
||||
/*
|
||||
* Choose destination area to restore the result of a mapping.
|
||||
*/
|
||||
if (i + 1 == ctx->nschemes) {
|
||||
dst = to;
|
||||
dstlen = tolen;
|
||||
|
||||
} else {
|
||||
if (src == buffers[0])
|
||||
idx = 1;
|
||||
else
|
||||
idx = 0;
|
||||
|
||||
if (buflen[idx] < dstlen) {
|
||||
void *newbuf;
|
||||
|
||||
newbuf = realloc(buffers[idx],
|
||||
sizeof(long) * dstlen);
|
||||
if (newbuf == NULL) {
|
||||
r = idn_nomemory;
|
||||
goto ret;
|
||||
}
|
||||
buffers[idx] = (unsigned long *)newbuf;
|
||||
buflen[idx] = dstlen;
|
||||
}
|
||||
|
||||
dst = buffers[idx];
|
||||
dstlen = buflen[idx];
|
||||
}
|
||||
|
||||
/*
|
||||
* Perform i-th map scheme.
|
||||
* If buffer size is not enough, we double it and try again.
|
||||
*/
|
||||
r = (ctx->schemes[i].map)(ctx->schemes[i].context, src, dst,
|
||||
dstlen);
|
||||
if (r == idn_buffer_overflow && dst != to) {
|
||||
dstlen *= 2;
|
||||
continue;
|
||||
}
|
||||
if (r != idn_success)
|
||||
goto ret;
|
||||
|
||||
src = dst;
|
||||
i++;
|
||||
}
|
||||
|
||||
r = idn_success;
|
||||
ret:
|
||||
free(buffers[0]);
|
||||
free(buffers[1]);
|
||||
if (r == idn_success) {
|
||||
TRACE(("idn_mapper_map(): success (to=\"%s\")\n",
|
||||
idn__debug_ucs4xstring(to, 50)));
|
||||
} else {
|
||||
TRACE(("idn_mapper_map(): %s\n", idn_result_tostring(r)));
|
||||
}
|
||||
return (r);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_mapper_register(const char *prefix,
|
||||
idn_mapper_createproc_t create,
|
||||
idn_mapper_destroyproc_t destroy,
|
||||
idn_mapper_mapproc_t map) {
|
||||
idn_result_t r;
|
||||
map_scheme_t *scheme = NULL;
|
||||
|
||||
assert(scheme_hash != NULL);
|
||||
assert(prefix != NULL && create != NULL && destroy != NULL &&
|
||||
map != NULL);
|
||||
|
||||
TRACE(("idn_mapper_register(prefix=%s)\n", prefix));
|
||||
|
||||
scheme = (map_scheme_t *) malloc(sizeof(map_scheme_t));
|
||||
if (scheme == NULL) {
|
||||
r = idn_nomemory;
|
||||
goto ret;
|
||||
}
|
||||
|
||||
scheme->prefix = (char *) malloc(strlen(prefix) + 1);
|
||||
if (scheme->prefix == NULL) {
|
||||
r = idn_nomemory;
|
||||
goto ret;
|
||||
}
|
||||
|
||||
strcpy(scheme->prefix, prefix);
|
||||
scheme->parameter = NULL;
|
||||
scheme->create = create;
|
||||
scheme->destroy = destroy;
|
||||
scheme->map = map;
|
||||
|
||||
r = idn__strhash_put(scheme_hash, prefix, scheme);
|
||||
if (r != idn_success)
|
||||
goto ret;
|
||||
|
||||
r = idn_success;
|
||||
ret:
|
||||
if (r != idn_success) {
|
||||
if (scheme != NULL)
|
||||
free(scheme->prefix);
|
||||
free(scheme);
|
||||
}
|
||||
|
||||
TRACE(("idn_mapper_register(): %s\n", idn_result_tostring(r)));
|
||||
return (r);
|
||||
}
|
||||
|
|
@ -1,375 +0,0 @@
|
|||
#ifndef lint
|
||||
static char *rcsid = "$Id: mapselector.c,v 1.1 2003/06/04 00:25:56 marka Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001,2002 Japan Network Information Center.
|
||||
* All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <idn/assert.h>
|
||||
#include <idn/logmacro.h>
|
||||
#include <idn/result.h>
|
||||
#include <idn/mapselector.h>
|
||||
#include <idn/strhash.h>
|
||||
#include <idn/debug.h>
|
||||
#include <idn/util.h>
|
||||
#include <idn/ucs4.h>
|
||||
|
||||
struct idn_mapselector {
|
||||
idn__strhash_t maphash;
|
||||
int reference_count;
|
||||
};
|
||||
|
||||
/*
|
||||
* Maximum length of a top level domain name. (e.g. `com', `jp', ...)
|
||||
*/
|
||||
#define MAPSELECTOR_MAX_TLD_LENGTH 63
|
||||
|
||||
static void string_ascii_tolower(char *string);
|
||||
|
||||
|
||||
const unsigned long *
|
||||
idn_mapselector_getnotld(void) {
|
||||
static const unsigned long notld[] = {0x002d, 0x0000}; /* "-" */
|
||||
return (notld);
|
||||
}
|
||||
|
||||
const unsigned long *
|
||||
idn_mapselector_getdefaulttld(void) {
|
||||
const static unsigned long defaulttld[] = {0x002e, 0x0000}; /* "." */
|
||||
return (defaulttld);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_mapselector_initialize(void) {
|
||||
idn_result_t r;
|
||||
|
||||
TRACE(("idn_mapselector_initialize()\n"));
|
||||
|
||||
r = idn_mapper_initialize();
|
||||
|
||||
TRACE(("idn_mapselector_initialize(): %s\n", idn_result_tostring(r)));
|
||||
return (r);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_mapselector_create(idn_mapselector_t *ctxp) {
|
||||
idn_mapselector_t ctx = NULL;
|
||||
idn_result_t r;
|
||||
|
||||
assert(ctxp != NULL);
|
||||
TRACE(("idn_mapselector_create()\n"));
|
||||
|
||||
ctx = (idn_mapselector_t)malloc(sizeof(struct idn_mapselector));
|
||||
if (ctx == NULL) {
|
||||
r = idn_nomemory;
|
||||
goto ret;
|
||||
}
|
||||
|
||||
ctx->maphash = NULL;
|
||||
ctx->reference_count = 1;
|
||||
|
||||
r = idn__strhash_create(&(ctx->maphash));
|
||||
if (r != idn_success)
|
||||
goto ret;
|
||||
|
||||
*ctxp = ctx;
|
||||
r = idn_success;
|
||||
|
||||
ret:
|
||||
if (r != idn_success) {
|
||||
if (ctx != NULL)
|
||||
free(ctx->maphash);
|
||||
free(ctx);
|
||||
}
|
||||
TRACE(("idn_mapselector_create(): %s\n", idn_result_tostring(r)));
|
||||
return (r);
|
||||
}
|
||||
|
||||
void
|
||||
idn_mapselector_destroy(idn_mapselector_t ctx) {
|
||||
assert(ctx != NULL);
|
||||
|
||||
TRACE(("idn_mapselector_destroy()\n"));
|
||||
|
||||
ctx->reference_count--;
|
||||
if (ctx->reference_count <= 0) {
|
||||
TRACE(("idn_mapselector_destroy(): "
|
||||
"the object is destroyed\n"));
|
||||
idn__strhash_destroy(ctx->maphash,
|
||||
(idn__strhash_freeproc_t)&idn_mapper_destroy);
|
||||
free(ctx);
|
||||
} else {
|
||||
TRACE(("idn_mapselector_destroy(): "
|
||||
"update reference count (%d->%d)\n",
|
||||
ctx->reference_count + 1, ctx->reference_count));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
idn_mapselector_incrref(idn_mapselector_t ctx) {
|
||||
assert(ctx != NULL);
|
||||
|
||||
TRACE(("idn_mapselector_incrref()\n"));
|
||||
TRACE(("idn_mapselector_incrref: update reference count (%d->%d)\n",
|
||||
ctx->reference_count, ctx->reference_count + 1));
|
||||
|
||||
ctx->reference_count++;
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_mapselector_add(idn_mapselector_t ctx, const char *tld, const char *name) {
|
||||
idn_result_t r;
|
||||
idn_mapper_t mapper;
|
||||
char hash_key[MAPSELECTOR_MAX_TLD_LENGTH + 1];
|
||||
|
||||
assert(ctx != NULL && tld != NULL);
|
||||
|
||||
TRACE(("idn_mapselector_add(tld=%s, name=%s)\n", tld, name));
|
||||
|
||||
if (!(tld[0] == '.' && tld[1] == '\0')) {
|
||||
if (tld[0] == '.')
|
||||
tld++;
|
||||
if (strchr(tld, '.') != NULL) {
|
||||
ERROR(("idn_mapselector_add: "
|
||||
"invalid TLD \"%-.100s\"\n", tld));
|
||||
r = idn_invalid_name;
|
||||
goto ret;
|
||||
}
|
||||
}
|
||||
if (strlen(tld) > MAPSELECTOR_MAX_TLD_LENGTH) {
|
||||
ERROR(("idn_mapselector_add: "
|
||||
"too long TLD \"%-.100s\"\n", tld));
|
||||
r = idn_invalid_name;
|
||||
goto ret;
|
||||
}
|
||||
strcpy(hash_key, tld);
|
||||
string_ascii_tolower(hash_key);
|
||||
|
||||
if (idn__strhash_get(ctx->maphash, hash_key, (void **)&mapper)
|
||||
!= idn_success) {
|
||||
r = idn_mapper_create(&mapper);
|
||||
if (r != idn_success)
|
||||
goto ret;
|
||||
|
||||
r = idn__strhash_put(ctx->maphash, hash_key, mapper);
|
||||
if (r != idn_success)
|
||||
goto ret;
|
||||
}
|
||||
|
||||
r = idn_mapper_add(mapper, name);
|
||||
ret:
|
||||
TRACE(("idn_mapselector_add(): %s\n", idn_result_tostring(r)));
|
||||
return (r);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_mapselector_addall(idn_mapselector_t ctx, const char *tld,
|
||||
const char **scheme_names, int nschemes) {
|
||||
idn_result_t r;
|
||||
int i;
|
||||
|
||||
assert(ctx != NULL && tld != NULL && scheme_names != NULL);
|
||||
|
||||
TRACE(("idn_mapselector_addall(tld=%s, nschemes=%d)\n",
|
||||
tld, nschemes));
|
||||
|
||||
for (i = 0; i < nschemes; i++) {
|
||||
r = idn_mapselector_add(ctx, tld, (const char *)*scheme_names);
|
||||
if (r != idn_success)
|
||||
goto ret;
|
||||
scheme_names++;
|
||||
}
|
||||
|
||||
r = idn_success;
|
||||
ret:
|
||||
TRACE(("idn_mapselector_addall(): %s\n", idn_result_tostring(r)));
|
||||
return (r);
|
||||
}
|
||||
|
||||
idn_mapper_t
|
||||
idn_mapselector_mapper(idn_mapselector_t ctx, const char *tld) {
|
||||
idn_result_t r;
|
||||
idn_mapper_t mapper;
|
||||
char hash_key[MAPSELECTOR_MAX_TLD_LENGTH + 1];
|
||||
|
||||
assert(ctx != NULL && tld != NULL);
|
||||
|
||||
TRACE(("idn_mapselector_mapper(tld=%s)\n", tld));
|
||||
|
||||
if (!(tld[0] == '.' && tld[1] == '\0')) {
|
||||
if (tld[0] == '.')
|
||||
tld++;
|
||||
if (strchr(tld, '.') != NULL)
|
||||
return (NULL);
|
||||
}
|
||||
if (strlen(tld) > MAPSELECTOR_MAX_TLD_LENGTH)
|
||||
return (NULL);
|
||||
strcpy(hash_key, tld);
|
||||
string_ascii_tolower(hash_key);
|
||||
|
||||
mapper = NULL;
|
||||
r = idn__strhash_get(ctx->maphash, hash_key, (void **)&mapper);
|
||||
if (r != idn_success)
|
||||
return (NULL);
|
||||
|
||||
idn_mapper_incrref(mapper);
|
||||
|
||||
return (mapper);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_mapselector_map(idn_mapselector_t ctx, const unsigned long *from,
|
||||
const char *tld, unsigned long *to, size_t tolen) {
|
||||
idn_result_t r;
|
||||
idn_mapper_t mapper = NULL;
|
||||
char hash_key[MAPSELECTOR_MAX_TLD_LENGTH + 1];
|
||||
size_t fromlen;
|
||||
|
||||
assert(ctx != NULL && from != NULL && to != NULL);
|
||||
|
||||
TRACE(("idn_mapselector_map(from=\"%s\", tld=\"%s\", tolen=%d)\n",
|
||||
idn__debug_ucs4xstring(from, 50), idn__debug_xstring(tld, 50),
|
||||
(int)tolen));
|
||||
|
||||
if (!(tld[0] == '.' && tld[1] == '\0')) {
|
||||
if (tld[0] == '.')
|
||||
tld++;
|
||||
if (strchr(tld, '.') != NULL) {
|
||||
r = idn_invalid_name;
|
||||
goto ret;
|
||||
}
|
||||
}
|
||||
if (strlen(tld) > MAPSELECTOR_MAX_TLD_LENGTH) {
|
||||
r = idn_invalid_name;
|
||||
goto ret;
|
||||
}
|
||||
strcpy(hash_key, tld);
|
||||
string_ascii_tolower(hash_key);
|
||||
|
||||
fromlen = idn_ucs4_strlen(from);
|
||||
|
||||
/*
|
||||
* Get mapper for the TLD.
|
||||
*/
|
||||
if (idn__strhash_get(ctx->maphash, hash_key, (void **)&mapper)
|
||||
!= idn_success) {
|
||||
strcpy(hash_key, IDN_MAPSELECTOR_DEFAULTTLD);
|
||||
idn__strhash_get(ctx->maphash, hash_key, (void **)&mapper);
|
||||
}
|
||||
|
||||
/*
|
||||
* Map.
|
||||
* If default mapper has not been registered, copy the string.
|
||||
*/
|
||||
if (mapper == NULL) {
|
||||
TRACE(("idn_mapselector_map(): no mapper\n"));
|
||||
if (fromlen + 1 > tolen) {
|
||||
r = idn_buffer_overflow;
|
||||
goto ret;
|
||||
}
|
||||
memcpy(to, from, (fromlen + 1) * sizeof(*from));
|
||||
} else {
|
||||
TRACE(("idn_mapselector_map(): tld=%s\n", tld));
|
||||
r = idn_mapper_map(mapper, from, to, tolen);
|
||||
if (r != idn_success)
|
||||
goto ret;
|
||||
}
|
||||
|
||||
r = idn_success;
|
||||
ret:
|
||||
if (r == idn_success) {
|
||||
TRACE(("idn_mapselector_map(): succcess (to=\"%s\")\n",
|
||||
idn__debug_ucs4xstring(to, 50)));
|
||||
} else {
|
||||
TRACE(("idn_mapselector_map(): %s\n", idn_result_tostring(r)));
|
||||
}
|
||||
return (r);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_mapselector_map2(idn_mapselector_t ctx, const unsigned long *from,
|
||||
const unsigned long *tld, unsigned long *to,
|
||||
size_t tolen) {
|
||||
char tld_utf8[MAPSELECTOR_MAX_TLD_LENGTH + 1];
|
||||
idn_result_t r;
|
||||
|
||||
assert(ctx != NULL && from != NULL && to != NULL);
|
||||
|
||||
TRACE(("idn_mapselector_map2(from=\"%s\", tld=\"%s\")\n",
|
||||
idn__debug_ucs4xstring(from, 50),
|
||||
idn__debug_ucs4xstring(tld, 50)));
|
||||
|
||||
r = idn_ucs4_ucs4toutf8(tld, tld_utf8, sizeof(tld_utf8));
|
||||
if (r == idn_buffer_overflow) {
|
||||
r = idn_invalid_name;
|
||||
goto ret;
|
||||
} else if (r != idn_success) {
|
||||
goto ret;
|
||||
}
|
||||
|
||||
r = idn_mapselector_map(ctx, from, tld_utf8, to, tolen);
|
||||
ret:
|
||||
if (r == idn_success) {
|
||||
TRACE(("idn_mapselector_map2(): success (to=\"%s\")\n",
|
||||
idn__debug_ucs4xstring(to, 50)));
|
||||
} else {
|
||||
TRACE(("idn_mapselector_map2(): %s\n", idn_result_tostring(r)));
|
||||
}
|
||||
return (r);
|
||||
}
|
||||
|
||||
static void
|
||||
string_ascii_tolower(char *string) {
|
||||
unsigned char *p;
|
||||
|
||||
for (p = (unsigned char *) string; *p != '\0'; p++) {
|
||||
if ('A' <= *p && *p <= 'Z')
|
||||
*p = *p - 'A' + 'a';
|
||||
}
|
||||
}
|
||||
|
|
@ -1,357 +0,0 @@
|
|||
#ifndef lint
|
||||
static char *rcsid = "$Id: nameprep.c,v 1.1 2003/06/04 00:25:56 marka Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001,2002 Japan Network Information Center.
|
||||
* All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <idn/result.h>
|
||||
#include <idn/assert.h>
|
||||
#include <idn/log.h>
|
||||
#include <idn/logmacro.h>
|
||||
#include <idn/debug.h>
|
||||
#include <idn/nameprep.h>
|
||||
|
||||
#define UCS_MAX 0x7fffffff
|
||||
#define UNICODE_MAX 0x10ffff
|
||||
|
||||
|
||||
/*
|
||||
* Load NAMEPREP compiled tables.
|
||||
*/
|
||||
#include "nameprepdata.c"
|
||||
|
||||
/*
|
||||
* Define mapping/checking functions for each version of the draft.
|
||||
*/
|
||||
|
||||
#define VERSION rfc3491
|
||||
#include "nameprep_template.c"
|
||||
#undef VERSION
|
||||
|
||||
typedef const char *(*nameprep_mapproc)(unsigned long v);
|
||||
typedef int (*nameprep_checkproc)(unsigned long v);
|
||||
typedef idn_biditype_t (*nameprep_biditypeproc)(unsigned long v);
|
||||
|
||||
static struct idn_nameprep {
|
||||
char *version;
|
||||
nameprep_mapproc map_proc;
|
||||
nameprep_checkproc prohibited_proc;
|
||||
nameprep_checkproc unassigned_proc;
|
||||
nameprep_biditypeproc biditype_proc;
|
||||
} nameprep_versions[] = {
|
||||
#define MAKE_NAMEPREP_HANDLE(version, id) \
|
||||
{ version, \
|
||||
compose_sym2(nameprep_map_, id), \
|
||||
compose_sym2(nameprep_prohibited_, id), \
|
||||
compose_sym2(nameprep_unassigned_, id), \
|
||||
compose_sym2(nameprep_biditype_, id), }
|
||||
MAKE_NAMEPREP_HANDLE("RFC3491", rfc3491),
|
||||
{ NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
static idn_result_t idn_nameprep_check(nameprep_checkproc proc,
|
||||
const unsigned long *str,
|
||||
const unsigned long **found);
|
||||
|
||||
idn_result_t
|
||||
idn_nameprep_create(const char *version, idn_nameprep_t *handlep) {
|
||||
idn_nameprep_t handle;
|
||||
|
||||
assert(handlep != NULL);
|
||||
|
||||
TRACE(("idn_nameprep_create(version=%-.50s)\n",
|
||||
version == NULL ? "<NULL>" : version));
|
||||
|
||||
if (version == NULL)
|
||||
version = IDN_NAMEPREP_CURRENT;
|
||||
|
||||
/*
|
||||
* Lookup table for the specified version. Since the number of
|
||||
* versions won't be large (I don't want see draft-23 or such :-),
|
||||
* simple linear search is OK.
|
||||
*/
|
||||
for (handle = nameprep_versions; handle->version != NULL; handle++) {
|
||||
if (strcmp(handle->version, version) == 0) {
|
||||
*handlep = handle;
|
||||
return (idn_success);
|
||||
}
|
||||
}
|
||||
return (idn_notfound);
|
||||
}
|
||||
|
||||
void
|
||||
idn_nameprep_destroy(idn_nameprep_t handle) {
|
||||
assert(handle != NULL);
|
||||
|
||||
TRACE(("idn_nameprep_destroy()\n"));
|
||||
|
||||
/* Nothing to do. */
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_nameprep_map(idn_nameprep_t handle, const unsigned long *from,
|
||||
unsigned long *to, size_t tolen) {
|
||||
assert(handle != NULL && from != NULL && to != NULL);
|
||||
|
||||
TRACE(("idn_nameprep_map(ctx=%s, from=\"%s\")\n",
|
||||
handle->version, idn__debug_ucs4xstring(from, 50)));
|
||||
|
||||
while (*from != '\0') {
|
||||
unsigned long v = *from;
|
||||
const char *mapped;
|
||||
|
||||
if (v > UCS_MAX) {
|
||||
/* This cannot happen, but just in case.. */
|
||||
return (idn_invalid_codepoint);
|
||||
} else if (v > UNICODE_MAX) {
|
||||
/* No mapping is possible. */
|
||||
mapped = NULL;
|
||||
} else {
|
||||
/* Try mapping. */
|
||||
mapped = (*handle->map_proc)(v);
|
||||
}
|
||||
|
||||
if (mapped == NULL) {
|
||||
/* No mapping. Just copy verbatim. */
|
||||
if (tolen < 1)
|
||||
return (idn_buffer_overflow);
|
||||
*to++ = v;
|
||||
tolen--;
|
||||
} else {
|
||||
const unsigned char *mappeddata;
|
||||
size_t mappedlen;
|
||||
|
||||
mappeddata = (const unsigned char *)mapped + 1;
|
||||
mappedlen = *mapped;
|
||||
|
||||
if (tolen < (mappedlen + 3) / 4)
|
||||
return (idn_buffer_overflow);
|
||||
tolen -= (mappedlen + 3) / 4;
|
||||
while (mappedlen >= 4) {
|
||||
*to = *mappeddata++;
|
||||
*to |= *mappeddata++ << 8;
|
||||
*to |= *mappeddata++ << 16;
|
||||
*to |= *mappeddata++ << 24;
|
||||
mappedlen -= 4;
|
||||
to++;
|
||||
}
|
||||
if (mappedlen > 0) {
|
||||
*to = *mappeddata++;
|
||||
*to |= (mappedlen >= 2) ?
|
||||
*mappeddata++ << 8: 0;
|
||||
*to |= (mappedlen >= 3) ?
|
||||
*mappeddata++ << 16: 0;
|
||||
to++;
|
||||
}
|
||||
}
|
||||
from++;
|
||||
}
|
||||
if (tolen == 0)
|
||||
return (idn_buffer_overflow);
|
||||
*to = '\0';
|
||||
return (idn_success);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_nameprep_isprohibited(idn_nameprep_t handle, const unsigned long *str,
|
||||
const unsigned long **found) {
|
||||
assert(handle != NULL && str != NULL && found != NULL);
|
||||
|
||||
TRACE(("idn_nameprep_isprohibited(ctx=%s, str=\"%s\")\n",
|
||||
handle->version, idn__debug_ucs4xstring(str, 50)));
|
||||
|
||||
return (idn_nameprep_check(handle->prohibited_proc, str, found));
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_nameprep_isunassigned(idn_nameprep_t handle, const unsigned long *str,
|
||||
const unsigned long **found) {
|
||||
assert(handle != NULL && str != NULL && found != NULL);
|
||||
|
||||
TRACE(("idn_nameprep_isunassigned(handle->version, str=\"%s\")\n",
|
||||
handle->version, idn__debug_ucs4xstring(str, 50)));
|
||||
|
||||
return (idn_nameprep_check(handle->unassigned_proc, str, found));
|
||||
}
|
||||
|
||||
static idn_result_t
|
||||
idn_nameprep_check(nameprep_checkproc proc, const unsigned long *str,
|
||||
const unsigned long **found) {
|
||||
unsigned long v;
|
||||
|
||||
while (*str != '\0') {
|
||||
v = *str;
|
||||
|
||||
if (v > UCS_MAX) {
|
||||
/* This cannot happen, but just in case.. */
|
||||
return (idn_invalid_codepoint);
|
||||
} else if (v > UNICODE_MAX) {
|
||||
/* It is invalid.. */
|
||||
*found = str;
|
||||
return (idn_success);
|
||||
} else if ((*proc)(v)) {
|
||||
*found = str;
|
||||
return (idn_success);
|
||||
}
|
||||
str++;
|
||||
}
|
||||
*found = NULL;
|
||||
return (idn_success);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_nameprep_isvalidbidi(idn_nameprep_t handle, const unsigned long *str,
|
||||
const unsigned long **found) {
|
||||
unsigned long v;
|
||||
idn_biditype_t first_char;
|
||||
idn_biditype_t last_char;
|
||||
int found_r_al;
|
||||
|
||||
assert(handle != NULL && str != NULL && found != NULL);
|
||||
|
||||
TRACE(("idn_nameprep_isvalidbidi(ctx=%s, str=\"%s\")\n",
|
||||
handle->version, idn__debug_ucs4xstring(str, 50)));
|
||||
|
||||
if (*str == '\0') {
|
||||
*found = NULL;
|
||||
return (idn_success);
|
||||
}
|
||||
|
||||
/*
|
||||
* check first character's type and initialize variables.
|
||||
*/
|
||||
found_r_al = 0;
|
||||
if (*str > UCS_MAX) {
|
||||
/* This cannot happen, but just in case.. */
|
||||
return (idn_invalid_codepoint);
|
||||
} else if (*str > UNICODE_MAX) {
|
||||
/* It is invalid.. */
|
||||
*found = str;
|
||||
return (idn_success);
|
||||
}
|
||||
first_char = last_char = (*(handle->biditype_proc))(*str);
|
||||
if (first_char == idn_biditype_r_al) {
|
||||
found_r_al = 1;
|
||||
}
|
||||
str++;
|
||||
|
||||
/*
|
||||
* see whether string is valid or not.
|
||||
*/
|
||||
while (*str != '\0') {
|
||||
v = *str;
|
||||
|
||||
if (v > UCS_MAX) {
|
||||
/* This cannot happen, but just in case.. */
|
||||
return (idn_invalid_codepoint);
|
||||
} else if (v > UNICODE_MAX) {
|
||||
/* It is invalid.. */
|
||||
*found = str;
|
||||
return (idn_success);
|
||||
} else {
|
||||
last_char = (*(handle->biditype_proc))(v);
|
||||
if (found_r_al && last_char == idn_biditype_l) {
|
||||
*found = str;
|
||||
return (idn_success);
|
||||
}
|
||||
if (first_char != idn_biditype_r_al && last_char == idn_biditype_r_al) {
|
||||
*found = str;
|
||||
return (idn_success);
|
||||
}
|
||||
if (last_char == idn_biditype_r_al) {
|
||||
found_r_al = 1;
|
||||
}
|
||||
}
|
||||
str++;
|
||||
}
|
||||
|
||||
if (found_r_al) {
|
||||
if (last_char != idn_biditype_r_al) {
|
||||
*found = str - 1;
|
||||
return (idn_success);
|
||||
}
|
||||
}
|
||||
|
||||
*found = NULL;
|
||||
return (idn_success);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_nameprep_createproc(const char *parameter, void **handlep) {
|
||||
return idn_nameprep_create(parameter, (idn_nameprep_t *)handlep);
|
||||
}
|
||||
|
||||
void
|
||||
idn_nameprep_destroyproc(void *handle) {
|
||||
idn_nameprep_destroy((idn_nameprep_t)handle);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_nameprep_mapproc(void *handle, const unsigned long *from,
|
||||
unsigned long *to, size_t tolen) {
|
||||
return idn_nameprep_map((idn_nameprep_t)handle, from, to, tolen);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_nameprep_prohibitproc(void *handle, const unsigned long *str,
|
||||
const unsigned long **found) {
|
||||
return idn_nameprep_isprohibited((idn_nameprep_t)handle, str, found);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_nameprep_unassignedproc(void *handle, const unsigned long *str,
|
||||
const unsigned long **found) {
|
||||
return idn_nameprep_isunassigned((idn_nameprep_t)handle, str, found);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_nameprep_bidiproc(void *handle, const unsigned long *str,
|
||||
const unsigned long **found) {
|
||||
return idn_nameprep_isvalidbidi((idn_nameprep_t)handle, str, found);
|
||||
}
|
||||
|
|
@ -1,137 +0,0 @@
|
|||
/* $Id: nameprep_template.c,v 1.1 2003/06/04 00:25:57 marka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include this file once for each version of NAMEPREP.
|
||||
* VERSION should be defined to appropriate value before inclusion.
|
||||
*/
|
||||
|
||||
#ifndef NAMEPREP_TEMPLATE_INIT
|
||||
#define NAMEPREP_TEMPLATE_INIT
|
||||
|
||||
/* Symbol composition. */
|
||||
#define compose_sym2(a, b) compose_sym2X(a, b)
|
||||
#define compose_sym2X(a, b) a ## b
|
||||
#define compose_sym3(a, b, c) compose_sym3X(a, b, c)
|
||||
#define compose_sym3X(a, b, c) a ## b ## c
|
||||
|
||||
/* Index calculation for multi-level index tables. */
|
||||
#define IDX0(type, v) IDX_0(v, BITS1(type), BITS2(type))
|
||||
#define IDX1(type, v) IDX_1(v, BITS1(type), BITS2(type))
|
||||
#define IDX2(type, v) IDX_2(v, BITS1(type), BITS2(type))
|
||||
|
||||
#define IDX_0(v, bits1, bits2) ((v) >> ((bits1) + (bits2)))
|
||||
#define IDX_1(v, bits1, bits2) (((v) >> (bits2)) & ((1 << (bits1)) - 1))
|
||||
#define IDX_2(v, bits1, bits2) ((v) & ((1 << (bits2)) - 1))
|
||||
|
||||
#define BITS1(type) type ## _BITS_1
|
||||
#define BITS2(type) type ## _BITS_2
|
||||
|
||||
#endif /* NAMEPREP_TEMPLATE_INIT */
|
||||
|
||||
static const char *
|
||||
compose_sym2(nameprep_map_, VERSION) (unsigned long v) {
|
||||
int idx0 = IDX0(MAP, v);
|
||||
int idx1 = IDX1(MAP, v);
|
||||
int idx2 = IDX2(MAP, v);
|
||||
int offset;
|
||||
|
||||
#define IMAP compose_sym3(nameprep_, VERSION, _map_imap)
|
||||
#define TABLE compose_sym3(nameprep_, VERSION, _map_table)
|
||||
#define DATA compose_sym3(nameprep_, VERSION, _map_data)
|
||||
offset = TABLE[IMAP[IMAP[idx0] + idx1]].tbl[idx2];
|
||||
if (offset == 0)
|
||||
return (NULL); /* no mapping */
|
||||
return (const char *)(DATA + offset);
|
||||
#undef IMAP
|
||||
#undef TABLE
|
||||
#undef DATA
|
||||
}
|
||||
|
||||
static int
|
||||
compose_sym2(nameprep_prohibited_, VERSION) (unsigned long v) {
|
||||
int idx0 = IDX0(PROH, v);
|
||||
int idx1 = IDX1(PROH, v);
|
||||
int idx2 = IDX2(PROH, v);
|
||||
const unsigned char *bm;
|
||||
|
||||
#define IMAP compose_sym3(nameprep_, VERSION, _prohibited_imap)
|
||||
#define BITMAP compose_sym3(nameprep_, VERSION, _prohibited_bitmap)
|
||||
bm = BITMAP[IMAP[IMAP[idx0] + idx1]].bm;
|
||||
return (bm[idx2 / 8] & (1 << (idx2 % 8)));
|
||||
#undef IMAP
|
||||
#undef BITMAP
|
||||
}
|
||||
|
||||
static int
|
||||
compose_sym2(nameprep_unassigned_, VERSION) (unsigned long v) {
|
||||
int idx0 = IDX0(UNAS, v);
|
||||
int idx1 = IDX1(UNAS, v);
|
||||
int idx2 = IDX2(UNAS, v);
|
||||
const unsigned char *bm;
|
||||
|
||||
#define IMAP compose_sym3(nameprep_, VERSION, _unassigned_imap)
|
||||
#define BITMAP compose_sym3(nameprep_, VERSION, _unassigned_bitmap)
|
||||
bm = BITMAP[IMAP[IMAP[idx0] + idx1]].bm;
|
||||
return (bm[idx2 / 8] & (1 << (idx2 % 8)));
|
||||
#undef IMAP
|
||||
#undef BITMAP
|
||||
}
|
||||
|
||||
static idn_biditype_t
|
||||
compose_sym2(nameprep_biditype_, VERSION) (unsigned long v) {
|
||||
int idx0 = IDX0(BIDI, v);
|
||||
int idx1 = IDX1(BIDI, v);
|
||||
int idx2 = IDX2(BIDI, v);
|
||||
int offset;
|
||||
|
||||
#define IMAP compose_sym3(nameprep_, VERSION, _bidi_imap)
|
||||
#define TABLE compose_sym3(nameprep_, VERSION, _bidi_table)
|
||||
#define DATA compose_sym3(nameprep_, VERSION, _bidi_data)
|
||||
offset = TABLE[IMAP[IMAP[idx0] + idx1]].tbl[idx2];
|
||||
return DATA[offset];
|
||||
#undef IMAP
|
||||
#undef TABLE
|
||||
#undef DATA
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,439 +0,0 @@
|
|||
#ifndef lint
|
||||
static char *rcsid = "$Id: normalizer.c,v 1.1 2003/06/04 00:26:05 marka Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000,2002 Japan Network Information Center.
|
||||
* All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <idn/assert.h>
|
||||
#include <idn/logmacro.h>
|
||||
#include <idn/result.h>
|
||||
#include <idn/normalizer.h>
|
||||
#include <idn/strhash.h>
|
||||
#include <idn/unormalize.h>
|
||||
#include <idn/unicode.h>
|
||||
#include <idn/ucs4.h>
|
||||
#include <idn/debug.h>
|
||||
#include <idn/util.h>
|
||||
|
||||
#define MAX_LOCAL_SCHEME 3
|
||||
|
||||
#define INITIALIZED (scheme_hash != NULL)
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
idn_normalizer_proc_t proc;
|
||||
} normalize_scheme_t;
|
||||
|
||||
struct idn_normalizer {
|
||||
int nschemes;
|
||||
int scheme_size;
|
||||
normalize_scheme_t **schemes;
|
||||
normalize_scheme_t *local_buf[MAX_LOCAL_SCHEME];
|
||||
int reference_count;
|
||||
};
|
||||
|
||||
static idn__strhash_t scheme_hash;
|
||||
|
||||
static idn__unicode_version_t vcur = NULL;
|
||||
static idn__unicode_version_t v320 = NULL;
|
||||
#define INIT_VERSION(version, var) \
|
||||
if (var == NULL) { \
|
||||
idn_result_t r = idn__unicode_create(version, &var); \
|
||||
if (r != idn_success) \
|
||||
return (r); \
|
||||
}
|
||||
|
||||
static idn_result_t expand_schemes(idn_normalizer_t ctx);
|
||||
static idn_result_t register_standard_normalizers(void);
|
||||
static idn_result_t normalizer_formkc(const unsigned long *from,
|
||||
unsigned long *to, size_t tolen);
|
||||
static idn_result_t normalizer_formkc_v320(const unsigned long *from,
|
||||
unsigned long *to,
|
||||
size_t tolen);
|
||||
|
||||
static struct standard_normalizer {
|
||||
char *name;
|
||||
idn_normalizer_proc_t proc;
|
||||
} standard_normalizer[] = {
|
||||
{ "unicode-form-kc", normalizer_formkc },
|
||||
{ "unicode-form-kc/3.2.0", normalizer_formkc_v320 },
|
||||
{ "RFC3491", normalizer_formkc_v320 },
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
||||
idn_result_t
|
||||
idn_normalizer_initialize(void) {
|
||||
idn__strhash_t hash;
|
||||
idn_result_t r;
|
||||
|
||||
TRACE(("idn_normalizer_initialize()\n"));
|
||||
|
||||
if (scheme_hash != NULL) {
|
||||
r = idn_success; /* already initialized */
|
||||
goto ret;
|
||||
}
|
||||
|
||||
if ((r = idn__strhash_create(&hash)) != idn_success)
|
||||
goto ret;
|
||||
scheme_hash = hash;
|
||||
|
||||
/* Register standard normalizers */
|
||||
r = register_standard_normalizers();
|
||||
ret:
|
||||
TRACE(("idn_normalizer_initialize(): %s\n", idn_result_tostring(r)));
|
||||
return (r);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_normalizer_create(idn_normalizer_t *ctxp) {
|
||||
idn_normalizer_t ctx;
|
||||
idn_result_t r;
|
||||
|
||||
assert(ctxp != NULL);
|
||||
TRACE(("idn_normalizer_create()\n"));
|
||||
|
||||
if ((ctx = malloc(sizeof(struct idn_normalizer))) == NULL) {
|
||||
r = idn_nomemory;
|
||||
goto ret;
|
||||
}
|
||||
|
||||
ctx->nschemes = 0;
|
||||
ctx->scheme_size = MAX_LOCAL_SCHEME;
|
||||
ctx->schemes = ctx->local_buf;
|
||||
ctx->reference_count = 1;
|
||||
*ctxp = ctx;
|
||||
|
||||
r = idn_success;
|
||||
ret:
|
||||
TRACE(("idn_normalizer_create(): %s\n", idn_result_tostring(r)));
|
||||
return (r);
|
||||
}
|
||||
|
||||
void
|
||||
idn_normalizer_destroy(idn_normalizer_t ctx) {
|
||||
assert(ctx != NULL);
|
||||
|
||||
TRACE(("idn_normalizer_destroy()\n"));
|
||||
|
||||
ctx->reference_count--;
|
||||
if (ctx->reference_count <= 0) {
|
||||
TRACE(("idn_normalizer_destroy(): the object is destroyed\n"));
|
||||
if (ctx->schemes != ctx->local_buf)
|
||||
free(ctx->schemes);
|
||||
free(ctx);
|
||||
} else {
|
||||
TRACE(("idn_normalizer_destroy(): "
|
||||
"update reference count (%d->%d)\n",
|
||||
ctx->reference_count + 1, ctx->reference_count));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
idn_normalizer_incrref(idn_normalizer_t ctx) {
|
||||
assert(ctx != NULL);
|
||||
|
||||
TRACE(("idn_normalizer_incrref()\n"));
|
||||
TRACE(("idn_normalizer_incrref: update reference count (%d->%d)\n",
|
||||
ctx->reference_count, ctx->reference_count + 1));
|
||||
|
||||
ctx->reference_count++;
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_normalizer_add(idn_normalizer_t ctx, const char *scheme_name) {
|
||||
idn_result_t r;
|
||||
void *v;
|
||||
normalize_scheme_t *scheme;
|
||||
|
||||
assert(ctx != NULL && scheme_name != NULL);
|
||||
|
||||
TRACE(("idn_normalizer_add(scheme_name=%s)\n", scheme_name));
|
||||
|
||||
assert(INITIALIZED);
|
||||
|
||||
if (idn__strhash_get(scheme_hash, scheme_name, &v) != idn_success) {
|
||||
ERROR(("idn_normalizer_add(): invalid scheme \"%-.30s\"\n",
|
||||
scheme_name));
|
||||
r = idn_invalid_name;
|
||||
goto ret;
|
||||
}
|
||||
|
||||
scheme = v;
|
||||
|
||||
assert(ctx->nschemes <= ctx->scheme_size);
|
||||
|
||||
if (ctx->nschemes == ctx->scheme_size &&
|
||||
(r = expand_schemes(ctx)) != idn_success) {
|
||||
goto ret;
|
||||
}
|
||||
|
||||
ctx->schemes[ctx->nschemes++] = scheme;
|
||||
r = idn_success;
|
||||
ret:
|
||||
TRACE(("idn_normalizer_add(): %s\n", idn_result_tostring(r)));
|
||||
return (r);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_normalizer_addall(idn_normalizer_t ctx, const char **scheme_names,
|
||||
int nschemes) {
|
||||
idn_result_t r;
|
||||
int i;
|
||||
|
||||
assert(ctx != NULL && scheme_names != NULL);
|
||||
|
||||
TRACE(("idn_normalizer_addall(nschemes=%d)\n", nschemes));
|
||||
|
||||
for (i = 0; i < nschemes; i++) {
|
||||
r = idn_normalizer_add(ctx, (const char *)*scheme_names);
|
||||
if (r != idn_success)
|
||||
goto ret;
|
||||
scheme_names++;
|
||||
}
|
||||
|
||||
r = idn_success;
|
||||
ret:
|
||||
TRACE(("idn_normalizer_addall(): %s\n", idn_result_tostring(r)));
|
||||
return (r);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_normalizer_normalize(idn_normalizer_t ctx, const unsigned long *from,
|
||||
unsigned long *to, size_t tolen) {
|
||||
idn_result_t r;
|
||||
unsigned long *src, *dst;
|
||||
unsigned long *buffers[2] = {NULL, NULL};
|
||||
size_t buflen[2] = {0, 0};
|
||||
size_t dstlen;
|
||||
int idx;
|
||||
int i;
|
||||
|
||||
assert(scheme_hash != NULL);
|
||||
assert(ctx != NULL && from != NULL && to != NULL);
|
||||
|
||||
TRACE(("idn_normalizer_normalize(from=\"%s\", tolen=%d)\n",
|
||||
idn__debug_ucs4xstring(from, 50), (int)tolen));
|
||||
|
||||
if (ctx->nschemes <= 0) {
|
||||
if (tolen < idn_ucs4_strlen(from) + 1) {
|
||||
r = idn_buffer_overflow;
|
||||
goto ret;
|
||||
}
|
||||
idn_ucs4_strcpy(to, from);
|
||||
r = idn_success;
|
||||
goto ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Normalize.
|
||||
*/
|
||||
src = (void *)from;
|
||||
dstlen = idn_ucs4_strlen(from) + 1;
|
||||
|
||||
i = 0;
|
||||
while (i < ctx->nschemes) {
|
||||
TRACE(("idn_normalizer_normalize(): normalize %s\n",
|
||||
ctx->schemes[i]->name));
|
||||
|
||||
/*
|
||||
* Choose destination area to restore the result of a mapping.
|
||||
*/
|
||||
if (i + 1 == ctx->nschemes) {
|
||||
dst = to;
|
||||
dstlen = tolen;
|
||||
} else {
|
||||
if (src == buffers[0])
|
||||
idx = 1;
|
||||
else
|
||||
idx = 0;
|
||||
|
||||
if (buflen[idx] < dstlen) {
|
||||
void *newbuf;
|
||||
|
||||
newbuf = realloc(buffers[idx],
|
||||
sizeof(long) * dstlen);
|
||||
if (newbuf == NULL) {
|
||||
r = idn_nomemory;
|
||||
goto ret;
|
||||
}
|
||||
buffers[idx] = (unsigned long *)newbuf;
|
||||
buflen[idx] = dstlen;
|
||||
}
|
||||
|
||||
dst = buffers[idx];
|
||||
dstlen = buflen[idx];
|
||||
}
|
||||
|
||||
/*
|
||||
* Perform i-th normalization scheme.
|
||||
* If buffer size is not enough, we double it and try again.
|
||||
*/
|
||||
r = (ctx->schemes[i]->proc)(src, dst, dstlen);
|
||||
if (r == idn_buffer_overflow && dst != to) {
|
||||
dstlen *= 2;
|
||||
continue;
|
||||
}
|
||||
if (r != idn_success)
|
||||
goto ret;
|
||||
|
||||
src = dst;
|
||||
i++;
|
||||
}
|
||||
|
||||
r = idn_success;
|
||||
ret:
|
||||
free(buffers[0]);
|
||||
free(buffers[1]);
|
||||
if (r == idn_success) {
|
||||
TRACE(("idn_normalizer_normalize(): success (to=\"%s\")\n",
|
||||
idn__debug_ucs4xstring(to, 50)));
|
||||
} else {
|
||||
TRACE(("idn_normalizer_normalize(): %s\n",
|
||||
idn_result_tostring(r)));
|
||||
}
|
||||
return (r);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn_normalizer_register(const char *scheme_name, idn_normalizer_proc_t proc) {
|
||||
idn_result_t r;
|
||||
normalize_scheme_t *scheme;
|
||||
|
||||
assert(scheme_name != NULL && proc != NULL);
|
||||
|
||||
TRACE(("idn_normalizer_register(scheme_name=%s)\n", scheme_name));
|
||||
|
||||
assert(INITIALIZED);
|
||||
|
||||
scheme = malloc(sizeof(*scheme) + strlen(scheme_name) + 1);
|
||||
if (scheme == NULL) {
|
||||
r = idn_nomemory;
|
||||
goto ret;
|
||||
}
|
||||
scheme->name = (char *)(scheme + 1);
|
||||
(void)strcpy(scheme->name, scheme_name);
|
||||
scheme->proc = proc;
|
||||
|
||||
r = idn__strhash_put(scheme_hash, scheme_name, scheme);
|
||||
if (r != idn_success)
|
||||
goto ret;
|
||||
|
||||
r = idn_success;
|
||||
ret:
|
||||
TRACE(("idn_normalizer_register(): %s\n", idn_result_tostring(r)));
|
||||
return (r);
|
||||
}
|
||||
|
||||
static idn_result_t
|
||||
expand_schemes(idn_normalizer_t ctx) {
|
||||
normalize_scheme_t **new_schemes;
|
||||
int new_size = ctx->scheme_size * 2;
|
||||
|
||||
if (ctx->schemes == ctx->local_buf) {
|
||||
new_schemes = malloc(sizeof(normalize_scheme_t) * new_size);
|
||||
} else {
|
||||
new_schemes = realloc(ctx->schemes,
|
||||
sizeof(normalize_scheme_t) * new_size);
|
||||
}
|
||||
if (new_schemes == NULL)
|
||||
return (idn_nomemory);
|
||||
|
||||
if (ctx->schemes == ctx->local_buf)
|
||||
memcpy(new_schemes, ctx->local_buf, sizeof(ctx->local_buf));
|
||||
|
||||
ctx->schemes = new_schemes;
|
||||
ctx->scheme_size = new_size;
|
||||
|
||||
return (idn_success);
|
||||
}
|
||||
|
||||
static idn_result_t
|
||||
register_standard_normalizers(void) {
|
||||
int i;
|
||||
int failed = 0;
|
||||
|
||||
for (i = 0; standard_normalizer[i].name != NULL; i++) {
|
||||
idn_result_t r;
|
||||
r = idn_normalizer_register(standard_normalizer[i].name,
|
||||
standard_normalizer[i].proc);
|
||||
if (r != idn_success) {
|
||||
WARNING(("idn_normalizer_initialize(): "
|
||||
"failed to register \"%-.100s\"\n",
|
||||
standard_normalizer[i].name));
|
||||
failed++;
|
||||
}
|
||||
}
|
||||
if (failed > 0)
|
||||
return (idn_failure);
|
||||
else
|
||||
return (idn_success);
|
||||
}
|
||||
|
||||
/*
|
||||
* Unicode Normalization Forms -- latest version
|
||||
*/
|
||||
|
||||
static idn_result_t
|
||||
normalizer_formkc(const unsigned long *from, unsigned long *to, size_t tolen) {
|
||||
INIT_VERSION(NULL, vcur);
|
||||
return (idn__unormalize_formkc(vcur, from, to, tolen));
|
||||
}
|
||||
|
||||
/*
|
||||
* Unicode Normalization Forms -- version 3.2.0
|
||||
*/
|
||||
|
||||
static idn_result_t
|
||||
normalizer_formkc_v320(const unsigned long *from, unsigned long *to,
|
||||
size_t tolen) {
|
||||
INIT_VERSION("3.2.0", v320);
|
||||
return (idn__unormalize_formkc(v320, from, to, tolen));
|
||||
}
|
||||
|
|
@ -1,434 +0,0 @@
|
|||
#ifndef lint
|
||||
static char *rcsid = "$Id: punycode.c,v 1.1 2003/06/04 00:26:06 marka Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001,2002 Japan Network Information Center.
|
||||
* All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <idn/result.h>
|
||||
#include <idn/assert.h>
|
||||
#include <idn/logmacro.h>
|
||||
#include <idn/converter.h>
|
||||
#include <idn/ucs4.h>
|
||||
#include <idn/debug.h>
|
||||
#include <idn/punycode.h>
|
||||
#include <idn/util.h>
|
||||
|
||||
/*
|
||||
* Although draft-ietf-idn-punycode-00.txt doesn't specify the ACE
|
||||
* signature, we have to choose one. In order to prevent the converted
|
||||
* name from beginning with a hyphen, we should choose a prefix rather
|
||||
* than a suffix.
|
||||
*/
|
||||
#ifndef IDN_PUNYCODE_PREFIX
|
||||
#define IDN_PUNYCODE_PREFIX "xn--"
|
||||
#endif
|
||||
|
||||
#define INVALID_UCS 0x80000000
|
||||
#define MAX_UCS 0x10FFFF
|
||||
|
||||
/*
|
||||
* As the draft states, it is possible that `delta' may overflow during
|
||||
* the encoding. The upper bound of 'delta' is:
|
||||
* <# of chars. of input string> + <max. difference in code point> *
|
||||
* <# of chars. of input string + 1>
|
||||
* For this value not to be greater than 0xffffffff (since the calculation
|
||||
* is done using unsigned long, which is at least 32bit long), the maxmum
|
||||
* input string size is about 3850 characters, which is long enough for
|
||||
* a domain label...
|
||||
*/
|
||||
#define PUNYCODE_MAXINPUT 3800
|
||||
|
||||
/*
|
||||
* Parameters.
|
||||
*/
|
||||
#define PUNYCODE_BASE 36
|
||||
#define PUNYCODE_TMIN 1
|
||||
#define PUNYCODE_TMAX 26
|
||||
#define PUNYCODE_SKEW 38
|
||||
#define PUNYCODE_DAMP 700
|
||||
#define PUNYCODE_INITIAL_BIAS 72
|
||||
#define PUNYCODE_INITIAL_N 0x80
|
||||
|
||||
static int punycode_getwc(const char *s, size_t len,
|
||||
int bias, unsigned long *vp);
|
||||
static int punycode_putwc(char *s, size_t len,
|
||||
unsigned long delta, int bias);
|
||||
static int punycode_update_bias(unsigned long delta,
|
||||
size_t npoints, int first);
|
||||
|
||||
idn_result_t
|
||||
idn__punycode_decode(idn_converter_t ctx, void *privdata,
|
||||
const char *from, unsigned long *to, size_t tolen) {
|
||||
unsigned long *to_org = to;
|
||||
unsigned long c, idx;
|
||||
size_t prefixlen = strlen(IDN_PUNYCODE_PREFIX);
|
||||
size_t fromlen;
|
||||
size_t uidx, fidx, ucslen;
|
||||
int first, bias;
|
||||
idn_result_t r;
|
||||
|
||||
assert(ctx != NULL);
|
||||
|
||||
TRACE(("idn__punycode_decode(from=\"%s\", tolen=%d)\n",
|
||||
idn__debug_xstring(from, 50), (int)tolen));
|
||||
|
||||
if (!idn__util_asciihaveaceprefix(from, IDN_PUNYCODE_PREFIX)) {
|
||||
if (*from == '\0') {
|
||||
r = idn_ucs4_utf8toucs4(from, to, tolen);
|
||||
goto ret;
|
||||
}
|
||||
r = idn_invalid_encoding;
|
||||
goto ret;
|
||||
}
|
||||
from += prefixlen;
|
||||
fromlen = strlen(from);
|
||||
|
||||
/*
|
||||
* Find the last delimiter, and copy the characters
|
||||
* before it verbatim.
|
||||
*/
|
||||
ucslen = 0;
|
||||
for (fidx = fromlen; fidx > 0; fidx--) {
|
||||
if (from[fidx - 1] == '-') {
|
||||
if (tolen < fidx) {
|
||||
r = idn_buffer_overflow;
|
||||
goto ret;
|
||||
}
|
||||
for (uidx = 0; uidx < fidx - 1; uidx++) {
|
||||
to[uidx] = from[uidx];
|
||||
}
|
||||
ucslen = uidx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
first = 1;
|
||||
bias = PUNYCODE_INITIAL_BIAS;
|
||||
c = PUNYCODE_INITIAL_N;
|
||||
idx = 0;
|
||||
while (fidx < fromlen) {
|
||||
int len;
|
||||
unsigned long delta;
|
||||
int i;
|
||||
|
||||
len = punycode_getwc(from + fidx, fromlen - fidx, bias, &delta);
|
||||
if (len == 0) {
|
||||
r = idn_invalid_encoding;
|
||||
goto ret;
|
||||
}
|
||||
fidx += len;
|
||||
|
||||
bias = punycode_update_bias(delta, ucslen + 1, first);
|
||||
first = 0;
|
||||
idx += delta;
|
||||
c += idx / (ucslen + 1);
|
||||
uidx = idx % (ucslen + 1);
|
||||
|
||||
/* Insert 'c' at uidx. */
|
||||
if (tolen-- <= 0) {
|
||||
r = idn_buffer_overflow;
|
||||
goto ret;
|
||||
}
|
||||
for (i = ucslen; i > uidx; i--)
|
||||
to[i] = to[i - 1];
|
||||
to[uidx] = c;
|
||||
|
||||
ucslen++;
|
||||
idx = uidx + 1;
|
||||
}
|
||||
|
||||
/* Terminate with NUL. */
|
||||
if (tolen <= 0) {
|
||||
r = idn_buffer_overflow;
|
||||
goto ret;
|
||||
}
|
||||
to[ucslen] = '\0';
|
||||
r = idn_success;
|
||||
|
||||
ret:
|
||||
if (r == idn_success) {
|
||||
TRACE(("idn__punycode_decode(): succcess (to=\"%s\")\n",
|
||||
idn__debug_ucs4xstring(to_org, 50)));
|
||||
} else {
|
||||
TRACE(("idn__punycode_decode(): %s\n", idn_result_tostring(r)));
|
||||
}
|
||||
return (r);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn__punycode_encode(idn_converter_t ctx, void *privdata,
|
||||
const unsigned long *from, char *to, size_t tolen) {
|
||||
char *to_org = to;
|
||||
unsigned long cur_code, next_code, delta;
|
||||
size_t prefixlen = strlen(IDN_PUNYCODE_PREFIX);
|
||||
size_t fromlen;
|
||||
size_t ucsdone;
|
||||
size_t toidx;
|
||||
int uidx, bias, first;
|
||||
idn_result_t r;
|
||||
|
||||
assert(ctx != NULL);
|
||||
|
||||
TRACE(("idn__punycode_encode(from=\"%s\", tolen=%d)\n",
|
||||
idn__debug_ucs4xstring(from, 50), (int)tolen));
|
||||
|
||||
if (*from == '\0') {
|
||||
r = idn_ucs4_ucs4toutf8(from, to, tolen);
|
||||
goto ret;
|
||||
} else if (idn__util_ucs4haveaceprefix(from, IDN_PUNYCODE_PREFIX)) {
|
||||
r = idn_prohibited;
|
||||
goto ret;
|
||||
}
|
||||
|
||||
if (tolen < prefixlen) {
|
||||
r = idn_buffer_overflow;
|
||||
goto ret;
|
||||
}
|
||||
memcpy(to, IDN_PUNYCODE_PREFIX, prefixlen);
|
||||
to += prefixlen;
|
||||
tolen -= prefixlen;
|
||||
|
||||
fromlen = idn_ucs4_strlen(from);
|
||||
|
||||
/*
|
||||
* If the input string is too long (actually too long to be sane),
|
||||
* return failure in order to prevent possible overflow.
|
||||
*/
|
||||
if (fromlen > PUNYCODE_MAXINPUT) {
|
||||
ERROR(("idn__punycode_encode(): "
|
||||
"the input string is too long to convert Punycode\n",
|
||||
idn__debug_ucs4xstring(from, 50)));
|
||||
r = idn_failure;
|
||||
goto ret;
|
||||
}
|
||||
|
||||
ucsdone = 0; /* number of characters processed */
|
||||
toidx = 0;
|
||||
|
||||
/*
|
||||
* First, pick up basic code points and copy them to 'to'.
|
||||
*/
|
||||
for (uidx = 0; uidx < fromlen; uidx++) {
|
||||
if (from[uidx] < 0x80) {
|
||||
if (toidx >= tolen) {
|
||||
r = idn_buffer_overflow;
|
||||
goto ret;
|
||||
}
|
||||
to[toidx++] = from[uidx];
|
||||
ucsdone++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If there are any basic code points, output a delimiter
|
||||
* (hyphen-minus).
|
||||
*/
|
||||
if (toidx > 0) {
|
||||
if (toidx >= tolen) {
|
||||
r = idn_buffer_overflow;
|
||||
goto ret;
|
||||
}
|
||||
to[toidx++] = '-';
|
||||
to += toidx;
|
||||
tolen -= toidx;
|
||||
}
|
||||
|
||||
/*
|
||||
* Then encode non-basic characters.
|
||||
*/
|
||||
first = 1;
|
||||
cur_code = PUNYCODE_INITIAL_N;
|
||||
bias = PUNYCODE_INITIAL_BIAS;
|
||||
delta = 0;
|
||||
while (ucsdone < fromlen) {
|
||||
int limit = -1, rest;
|
||||
|
||||
/*
|
||||
* Find the smallest code point equal to or greater
|
||||
* than 'cur_code'. Also remember the index of the
|
||||
* last occurence of the code point.
|
||||
*/
|
||||
for (next_code = MAX_UCS, uidx = fromlen - 1;
|
||||
uidx >= 0; uidx--) {
|
||||
if (from[uidx] >= cur_code && from[uidx] < next_code) {
|
||||
next_code = from[uidx];
|
||||
limit = uidx;
|
||||
}
|
||||
}
|
||||
/* There must be such code point. */
|
||||
assert(limit >= 0);
|
||||
|
||||
delta += (next_code - cur_code) * (ucsdone + 1);
|
||||
cur_code = next_code;
|
||||
|
||||
/*
|
||||
* Scan the input string again, and encode characters
|
||||
* whose code point is 'cur_code'. Use 'limit' to avoid
|
||||
* unnecessary scan.
|
||||
*/
|
||||
for (uidx = 0, rest = ucsdone; uidx <= limit; uidx++) {
|
||||
if (from[uidx] < cur_code) {
|
||||
delta++;
|
||||
rest--;
|
||||
} else if (from[uidx] == cur_code) {
|
||||
int sz = punycode_putwc(to, tolen, delta, bias);
|
||||
if (sz == 0) {
|
||||
r = idn_buffer_overflow;
|
||||
goto ret;
|
||||
}
|
||||
to += sz;
|
||||
tolen -= sz;
|
||||
ucsdone++;
|
||||
bias = punycode_update_bias(delta, ucsdone,
|
||||
first);
|
||||
delta = 0;
|
||||
first = 0;
|
||||
}
|
||||
}
|
||||
delta += rest + 1;
|
||||
cur_code++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Terminate with NUL.
|
||||
*/
|
||||
if (tolen <= 0) {
|
||||
r = idn_buffer_overflow;
|
||||
goto ret;
|
||||
}
|
||||
*to = '\0';
|
||||
r = idn_success;
|
||||
|
||||
ret:
|
||||
if (r == idn_success) {
|
||||
TRACE(("idn__punycode_encode(): succcess (to=\"%s\")\n",
|
||||
idn__debug_xstring(to_org, 50)));
|
||||
} else {
|
||||
TRACE(("idn__punycode_encode(): %s\n", idn_result_tostring(r)));
|
||||
}
|
||||
return (r);
|
||||
}
|
||||
|
||||
static int
|
||||
punycode_getwc(const char *s, size_t len, int bias, unsigned long *vp) {
|
||||
size_t orglen = len;
|
||||
unsigned long v = 0, w = 1;
|
||||
int k;
|
||||
|
||||
for (k = PUNYCODE_BASE - bias; len > 0; k += PUNYCODE_BASE) {
|
||||
int c = *s++;
|
||||
int t = (k < PUNYCODE_TMIN) ? PUNYCODE_TMIN :
|
||||
(k > PUNYCODE_TMAX) ? PUNYCODE_TMAX : k;
|
||||
|
||||
len--;
|
||||
if ('a' <= c && c <= 'z')
|
||||
c = c - 'a';
|
||||
else if ('A' <= c && c <= 'Z')
|
||||
c = c - 'A';
|
||||
else if ('0' <= c && c <= '9')
|
||||
c = c - '0' + 26;
|
||||
else
|
||||
c = -1;
|
||||
|
||||
if (c < 0)
|
||||
return (0); /* invalid character */
|
||||
|
||||
v += c * w;
|
||||
|
||||
if (c < t) {
|
||||
*vp = v;
|
||||
return (orglen - len);
|
||||
}
|
||||
|
||||
w *= (PUNYCODE_BASE - t);
|
||||
}
|
||||
|
||||
return (0); /* final character missing */
|
||||
}
|
||||
|
||||
static int
|
||||
punycode_putwc(char *s, size_t len, unsigned long delta, int bias) {
|
||||
const char *punycode_base36 = "abcdefghijklmnopqrstuvwxyz0123456789";
|
||||
int k;
|
||||
char *sorg = s;
|
||||
|
||||
for (k = PUNYCODE_BASE - bias; 1; k += PUNYCODE_BASE) {
|
||||
int t = (k < PUNYCODE_TMIN) ? PUNYCODE_TMIN :
|
||||
(k > PUNYCODE_TMAX) ? PUNYCODE_TMAX : k;
|
||||
|
||||
if (delta < t)
|
||||
break;
|
||||
if (len < 1)
|
||||
return (0);
|
||||
*s++ = punycode_base36[t + ((delta - t) % (PUNYCODE_BASE - t))];
|
||||
len--;
|
||||
delta = (delta - t) / (PUNYCODE_BASE - t);
|
||||
}
|
||||
if (len < 1)
|
||||
return (0);
|
||||
*s++ = punycode_base36[delta];
|
||||
return (s - sorg);
|
||||
}
|
||||
|
||||
static int
|
||||
punycode_update_bias(unsigned long delta, size_t npoints, int first) {
|
||||
int k = 0;
|
||||
|
||||
delta /= first ? PUNYCODE_DAMP : 2;
|
||||
delta += delta / npoints;
|
||||
|
||||
while (delta > ((PUNYCODE_BASE - PUNYCODE_TMIN) * PUNYCODE_TMAX) / 2) {
|
||||
delta /= PUNYCODE_BASE - PUNYCODE_TMIN;
|
||||
k++;
|
||||
}
|
||||
return (PUNYCODE_BASE * k +
|
||||
(((PUNYCODE_BASE - PUNYCODE_TMIN + 1) * delta) /
|
||||
(delta + PUNYCODE_SKEW)));
|
||||
}
|
||||
|
|
@ -1,427 +0,0 @@
|
|||
#ifndef lint
|
||||
static char *rcsid = "$Id: race.c,v 1.1 2003/06/04 00:26:07 marka Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000,2001,2002 Japan Network Information Center.
|
||||
* All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <idn/result.h>
|
||||
#include <idn/assert.h>
|
||||
#include <idn/logmacro.h>
|
||||
#include <idn/converter.h>
|
||||
#include <idn/ucs4.h>
|
||||
#include <idn/debug.h>
|
||||
#include <idn/race.h>
|
||||
#include <idn/util.h>
|
||||
|
||||
#ifndef IDN_RACE_PREFIX
|
||||
#define IDN_RACE_PREFIX "bq--"
|
||||
#endif
|
||||
#define RACE_2OCTET_MODE 0xd8
|
||||
#define RACE_ESCAPE 0xff
|
||||
#define RACE_ESCAPE_2ND 0x99
|
||||
|
||||
#define RACE_BUF_SIZE 128 /* more than enough */
|
||||
|
||||
/*
|
||||
* Unicode surrogate pair.
|
||||
*/
|
||||
#define IS_SURROGATE_HIGH(v) (0xd800 <= (v) && (v) <= 0xdbff)
|
||||
#define IS_SURROGATE_LOW(v) (0xdc00 <= (v) && (v) <= 0xdfff)
|
||||
#define SURROGATE_HIGH(v) (SURROGATE_H_OFF + (((v) - 0x10000) >> 10))
|
||||
#define SURROGATE_LOW(v) (SURROGATE_L_OFF + ((v) & 0x3ff))
|
||||
#define SURROGATE_BASE 0x10000
|
||||
#define SURROGATE_H_OFF 0xd800
|
||||
#define SURROGATE_L_OFF 0xdc00
|
||||
#define COMBINE_SURROGATE(h, l) \
|
||||
(SURROGATE_BASE + (((h)-SURROGATE_H_OFF)<<10) + ((l)-SURROGATE_L_OFF))
|
||||
|
||||
/*
|
||||
* Compression type.
|
||||
*/
|
||||
enum {
|
||||
compress_one, /* all characters are in a single row */
|
||||
compress_two, /* row 0 and another row */
|
||||
compress_none /* nope */
|
||||
};
|
||||
|
||||
static idn_result_t race_decode_decompress(const char *from,
|
||||
unsigned short *buf,
|
||||
size_t buflen);
|
||||
static idn_result_t race_compress_encode(const unsigned short *p,
|
||||
int compress_mode,
|
||||
char *to, size_t tolen);
|
||||
static int get_compress_mode(unsigned short *p);
|
||||
|
||||
idn_result_t
|
||||
idn__race_decode(idn_converter_t ctx, void *privdata,
|
||||
const char *from, unsigned long *to, size_t tolen) {
|
||||
unsigned short *buf = NULL;
|
||||
size_t prefixlen = strlen(IDN_RACE_PREFIX);
|
||||
size_t fromlen;
|
||||
size_t buflen;
|
||||
idn_result_t r;
|
||||
|
||||
assert(ctx != NULL);
|
||||
|
||||
TRACE(("idn__race_decode(from=\"%s\", tolen=%d)\n",
|
||||
idn__debug_xstring(from, 50), (int)tolen));
|
||||
|
||||
if (!idn__util_asciihaveaceprefix(from, IDN_RACE_PREFIX)) {
|
||||
if (*from == '\0') {
|
||||
r = idn_ucs4_utf8toucs4(from, to, tolen);
|
||||
goto ret;
|
||||
}
|
||||
r = idn_invalid_encoding;
|
||||
goto ret;
|
||||
}
|
||||
from += prefixlen;
|
||||
fromlen = strlen(from);
|
||||
|
||||
/*
|
||||
* Allocate sufficient buffer.
|
||||
*/
|
||||
buflen = fromlen + 1;
|
||||
buf = malloc(sizeof(*buf) * buflen);
|
||||
if (buf == NULL) {
|
||||
r = idn_nomemory;
|
||||
goto ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Decode base32 and decompress.
|
||||
*/
|
||||
r = race_decode_decompress(from, buf, buflen);
|
||||
if (r != idn_success)
|
||||
goto ret;
|
||||
|
||||
/*
|
||||
* Now 'buf' points the decompressed string, which must contain
|
||||
* UTF-16 characters.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Convert to UCS4.
|
||||
*/
|
||||
r = idn_ucs4_utf16toucs4(buf, to, tolen);
|
||||
if (r != idn_success)
|
||||
goto ret;
|
||||
|
||||
ret:
|
||||
free(buf);
|
||||
if (r == idn_success) {
|
||||
TRACE(("idn__race_decode(): succcess (to=\"%s\")\n",
|
||||
idn__debug_ucs4xstring(to, 50)));
|
||||
} else {
|
||||
TRACE(("idn__race_decode(): %s\n", idn_result_tostring(r)));
|
||||
}
|
||||
return (r);
|
||||
}
|
||||
|
||||
static idn_result_t
|
||||
race_decode_decompress(const char *from, unsigned short *buf, size_t buflen)
|
||||
{
|
||||
unsigned short *p = buf;
|
||||
unsigned int bitbuf = 0;
|
||||
int bitlen = 0;
|
||||
int i, j;
|
||||
size_t len;
|
||||
|
||||
while (*from != '\0') {
|
||||
int c = *from++;
|
||||
int x;
|
||||
|
||||
if ('a' <= c && c <= 'z')
|
||||
x = c - 'a';
|
||||
else if ('A' <= c && c <= 'Z')
|
||||
x = c - 'A';
|
||||
else if ('2' <= c && c <= '7')
|
||||
x = c - '2' + 26;
|
||||
else
|
||||
return (idn_invalid_encoding);
|
||||
|
||||
bitbuf = (bitbuf << 5) + x;
|
||||
bitlen += 5;
|
||||
if (bitlen >= 8) {
|
||||
*p++ = (bitbuf >> (bitlen - 8)) & 0xff;
|
||||
bitlen -= 8;
|
||||
}
|
||||
}
|
||||
len = p - buf;
|
||||
|
||||
/*
|
||||
* Now 'buf' holds the decoded string.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Decompress.
|
||||
*/
|
||||
if (buf[0] == RACE_2OCTET_MODE) {
|
||||
if ((len - 1) % 2 != 0)
|
||||
return (idn_invalid_encoding);
|
||||
for (i = 1, j = 0; i < len; i += 2, j++)
|
||||
buf[j] = (buf[i] << 8) + buf[i + 1];
|
||||
len = j;
|
||||
} else {
|
||||
unsigned short c = buf[0] << 8; /* higher octet */
|
||||
|
||||
for (i = 1, j = 0; i < len; j++) {
|
||||
if (buf[i] == RACE_ESCAPE) {
|
||||
if (i + 1 >= len)
|
||||
return (idn_invalid_encoding);
|
||||
else if (buf[i + 1] == RACE_ESCAPE_2ND)
|
||||
buf[j] = c | 0xff;
|
||||
else
|
||||
buf[j] = buf[i + 1];
|
||||
i += 2;
|
||||
|
||||
} else if (buf[i] == 0x99 && c == 0x00) {
|
||||
/*
|
||||
* The RACE specification says this is error.
|
||||
*/
|
||||
return (idn_invalid_encoding);
|
||||
|
||||
} else {
|
||||
buf[j] = c | buf[i++];
|
||||
}
|
||||
}
|
||||
len = j;
|
||||
}
|
||||
buf[len] = '\0';
|
||||
|
||||
return (idn_success);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn__race_encode(idn_converter_t ctx, void *privdata,
|
||||
const unsigned long *from, char *to, size_t tolen) {
|
||||
char *to_org = to;
|
||||
unsigned short *p, *buf = NULL;
|
||||
size_t prefixlen = strlen(IDN_RACE_PREFIX);
|
||||
size_t buflen;
|
||||
size_t fromlen;
|
||||
idn_result_t r;
|
||||
int compress_mode;
|
||||
|
||||
assert(ctx != NULL);
|
||||
|
||||
TRACE(("idn__race_encode(from=\"%s\", tolen=%d)\n",
|
||||
idn__debug_ucs4xstring(from, 50), (int)tolen));
|
||||
|
||||
if (*from == '\0') {
|
||||
r = idn_ucs4_ucs4toutf8(from, to, tolen);
|
||||
goto ret;
|
||||
} else if (idn__util_ucs4haveaceprefix(from, IDN_RACE_PREFIX)) {
|
||||
r = idn_prohibited;
|
||||
goto ret;
|
||||
}
|
||||
|
||||
if (tolen < prefixlen) {
|
||||
r = idn_buffer_overflow;
|
||||
goto ret;
|
||||
}
|
||||
memcpy(to, IDN_RACE_PREFIX, prefixlen);
|
||||
to += prefixlen;
|
||||
tolen -= prefixlen;
|
||||
|
||||
fromlen = idn_ucs4_strlen(from);
|
||||
buflen = fromlen * 2 + 2;
|
||||
|
||||
/*
|
||||
* Convert to UTF-16.
|
||||
* Preserve space for a character at the top of the buffer.
|
||||
*/
|
||||
for (;;) {
|
||||
unsigned short *new_buf;
|
||||
|
||||
new_buf = realloc(buf, sizeof(*buf) * buflen);
|
||||
if (new_buf == NULL) {
|
||||
r = idn_nomemory;
|
||||
goto ret;
|
||||
}
|
||||
buf = new_buf;
|
||||
|
||||
r = idn_ucs4_ucs4toutf16(from, buf + 1, buflen - 1);
|
||||
if (r == idn_success)
|
||||
break;
|
||||
else if (r != idn_buffer_overflow)
|
||||
goto ret;
|
||||
|
||||
buflen = fromlen * 2 + 2;
|
||||
}
|
||||
p = buf + 1;
|
||||
|
||||
/*
|
||||
* Now 'p' contains UTF-16 encoded string.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Check U+0099.
|
||||
* RACE doesn't permit U+0099 in an input string.
|
||||
*/
|
||||
for (p = buf + 1; *p != '\0'; p++) {
|
||||
if (*p == 0x0099) {
|
||||
r = idn_invalid_encoding;
|
||||
goto ret;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Compress, encode in base-32 and output.
|
||||
*/
|
||||
compress_mode = get_compress_mode(buf + 1);
|
||||
r = race_compress_encode(buf, compress_mode, to, tolen);
|
||||
|
||||
ret:
|
||||
free(buf);
|
||||
if (r == idn_success) {
|
||||
TRACE(("idn__race_encode(): succcess (to=\"%s\")\n",
|
||||
idn__debug_xstring(to_org, 50)));
|
||||
} else {
|
||||
TRACE(("idn__race_encode(): %s\n", idn_result_tostring(r)));
|
||||
}
|
||||
return (r);
|
||||
}
|
||||
|
||||
static idn_result_t
|
||||
race_compress_encode(const unsigned short *p, int compress_mode,
|
||||
char *to, size_t tolen)
|
||||
{
|
||||
unsigned long bitbuf = *p++; /* bit stream buffer */
|
||||
int bitlen = 8; /* # of bits in 'bitbuf' */
|
||||
|
||||
while (*p != '\0' || bitlen > 0) {
|
||||
unsigned int c = *p;
|
||||
|
||||
if (c == '\0') {
|
||||
/* End of data. Flush. */
|
||||
bitbuf <<= (5 - bitlen);
|
||||
bitlen = 5;
|
||||
} else if (compress_mode == compress_none) {
|
||||
/* Push 16 bit data. */
|
||||
bitbuf = (bitbuf << 16) | c;
|
||||
bitlen += 16;
|
||||
p++;
|
||||
} else {/* compress_mode == compress_one/compress_two */
|
||||
/* Push 8 or 16 bit data. */
|
||||
if (compress_mode == compress_two &&
|
||||
(c & 0xff00) == 0) {
|
||||
/* Upper octet is zero (and not U1). */
|
||||
bitbuf = (bitbuf << 16) | 0xff00 | c;
|
||||
bitlen += 16;
|
||||
} else if ((c & 0xff) == 0xff) {
|
||||
/* Lower octet is 0xff. */
|
||||
bitbuf = (bitbuf << 16) |
|
||||
(RACE_ESCAPE << 8) | RACE_ESCAPE_2ND;
|
||||
bitlen += 16;
|
||||
} else {
|
||||
/* Just output lower octet. */
|
||||
bitbuf = (bitbuf << 8) | (c & 0xff);
|
||||
bitlen += 8;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Output bits in 'bitbuf' in 5-bit unit.
|
||||
*/
|
||||
while (bitlen >= 5) {
|
||||
int x;
|
||||
|
||||
/* Get top 5 bits. */
|
||||
x = (bitbuf >> (bitlen - 5)) & 0x1f;
|
||||
bitlen -= 5;
|
||||
|
||||
/* Encode. */
|
||||
if (x < 26)
|
||||
x += 'a';
|
||||
else
|
||||
x = (x - 26) + '2';
|
||||
|
||||
if (tolen < 1)
|
||||
return (idn_buffer_overflow);
|
||||
|
||||
*to++ = x;
|
||||
tolen--;
|
||||
}
|
||||
}
|
||||
|
||||
if (tolen <= 0)
|
||||
return (idn_buffer_overflow);
|
||||
|
||||
*to = '\0';
|
||||
return (idn_success);
|
||||
}
|
||||
|
||||
static int
|
||||
get_compress_mode(unsigned short *p) {
|
||||
int zero = 0;
|
||||
unsigned int upper = 0;
|
||||
unsigned short *modepos = p - 1;
|
||||
|
||||
while (*p != '\0') {
|
||||
unsigned int hi = *p++ & 0xff00;
|
||||
|
||||
if (hi == 0) {
|
||||
zero++;
|
||||
} else if (hi == upper) {
|
||||
;
|
||||
} else if (upper == 0) {
|
||||
upper = hi;
|
||||
} else {
|
||||
*modepos = RACE_2OCTET_MODE;
|
||||
return (compress_none);
|
||||
}
|
||||
}
|
||||
*modepos = upper >> 8;
|
||||
if (upper > 0 && zero > 0)
|
||||
return (compress_two);
|
||||
else
|
||||
return (compress_one);
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,76 +0,0 @@
|
|||
#ifndef lint
|
||||
static char *rcsid = "$Id: result.c,v 1.1 2003/06/04 00:26:12 marka Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <idn/result.h>
|
||||
|
||||
static char *result_string[] = {
|
||||
"success",
|
||||
"not found",
|
||||
"invalid encoding found",
|
||||
"syntax error",
|
||||
"invalid name",
|
||||
"invalid message",
|
||||
"invalid action",
|
||||
"invalid code point",
|
||||
"label length reduced to 0 or exceeded 63 bytes",
|
||||
"buffer overflow",
|
||||
"no such entry",
|
||||
"out of memory",
|
||||
"no such file",
|
||||
"no mapping to output codeset",
|
||||
"context information required",
|
||||
"prohibited character found",
|
||||
"generic failure",
|
||||
};
|
||||
|
||||
char *
|
||||
idn_result_tostring(idn_result_t result) {
|
||||
if (result < 0 || result > idn_failure)
|
||||
return ("unknown result code");
|
||||
|
||||
return (result_string[result]);
|
||||
}
|
||||
|
|
@ -1,283 +0,0 @@
|
|||
#ifndef lint
|
||||
static char *rcsid = "$Id: strhash.c,v 1.1 2003/06/04 00:26:13 marka Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000 Japan Network Information Center. All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <idn/assert.h>
|
||||
#include <idn/logmacro.h>
|
||||
#include <idn/result.h>
|
||||
#include <idn/strhash.h>
|
||||
|
||||
/*
|
||||
* Initially, the number of hash buckets is INITIAL_HASH_SIZE.
|
||||
* As the more elements are put in the hash, the number of elements
|
||||
* per bucket will exceed THRESHOLD eventually. When it happens,
|
||||
* the number of buckets will be multiplied by FACTOR.
|
||||
*/
|
||||
#define INITIAL_HASH_SIZE 67
|
||||
#define FACTOR 7
|
||||
#define THRESHOLD 5
|
||||
|
||||
#define HASH_MULT 31
|
||||
|
||||
typedef struct strhash_entry {
|
||||
struct strhash_entry *next;
|
||||
unsigned long hash_value;
|
||||
char *key;
|
||||
void *value;
|
||||
} strhash_entry_t;
|
||||
|
||||
struct idn__strhash {
|
||||
int nbins;
|
||||
int nelements;
|
||||
strhash_entry_t **bins;
|
||||
};
|
||||
|
||||
static unsigned long hash_value(const char *key);
|
||||
static strhash_entry_t *find_entry(strhash_entry_t *entry, const char *key,
|
||||
unsigned long hash);
|
||||
static strhash_entry_t *new_entry(const char *key, void *value);
|
||||
static idn_result_t expand_bins(idn__strhash_t hash, int new_size);
|
||||
|
||||
idn_result_t
|
||||
idn__strhash_create(idn__strhash_t *hashp) {
|
||||
idn__strhash_t hash;
|
||||
idn_result_t r;
|
||||
|
||||
TRACE(("idn__strhash_create()\n"));
|
||||
|
||||
assert(hashp != NULL);
|
||||
|
||||
*hashp = NULL;
|
||||
|
||||
if ((hash = malloc(sizeof(struct idn__strhash))) == NULL) {
|
||||
WARNING(("idn__strhash_create: malloc failed (hash)\n"));
|
||||
return (idn_nomemory);
|
||||
}
|
||||
hash->nbins = 0;
|
||||
hash->nelements = 0;
|
||||
hash->bins = NULL;
|
||||
if ((r = expand_bins(hash, INITIAL_HASH_SIZE)) != idn_success) {
|
||||
WARNING(("idn__strhash_create: malloc failed (bins)\n"));
|
||||
free(hash);
|
||||
return (r);
|
||||
}
|
||||
|
||||
*hashp = hash;
|
||||
|
||||
return (idn_success);
|
||||
}
|
||||
|
||||
void
|
||||
idn__strhash_destroy(idn__strhash_t hash, idn__strhash_freeproc_t proc) {
|
||||
int i;
|
||||
|
||||
assert(hash != NULL && hash->bins != NULL);
|
||||
|
||||
for (i = 0; i < hash->nbins; i++) {
|
||||
strhash_entry_t *bin = hash->bins[i];
|
||||
strhash_entry_t *next;
|
||||
|
||||
while (bin != NULL) {
|
||||
next = bin->next;
|
||||
if (proc != NULL)
|
||||
(*proc)(bin->value);
|
||||
free(bin);
|
||||
bin = next;
|
||||
}
|
||||
}
|
||||
free(hash->bins);
|
||||
free(hash);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn__strhash_put(idn__strhash_t hash, const char *key, void *value) {
|
||||
unsigned long h, h_index;
|
||||
strhash_entry_t *entry;
|
||||
|
||||
assert(hash != NULL && key != NULL);
|
||||
|
||||
h = hash_value(key);
|
||||
h_index = h % hash->nbins;
|
||||
|
||||
if ((entry = find_entry(hash->bins[h_index], key, h)) != NULL) {
|
||||
/* Entry exists. Replace the value. */
|
||||
entry->value = value;
|
||||
} else {
|
||||
/* Create new entry. */
|
||||
if ((entry = new_entry(key, value)) == NULL) {
|
||||
return (idn_nomemory);
|
||||
}
|
||||
/* Insert it to the list. */
|
||||
entry->next = hash->bins[h_index];
|
||||
hash->bins[h_index] = entry;
|
||||
hash->nelements++;
|
||||
|
||||
if (hash->nelements > hash->nbins * THRESHOLD) {
|
||||
idn_result_t r;
|
||||
r = expand_bins(hash, hash->nbins * FACTOR);
|
||||
if (r != idn_success) {
|
||||
TRACE(("idn__strhash_put: hash table "
|
||||
"expansion failed\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (idn_success);
|
||||
}
|
||||
|
||||
idn_result_t
|
||||
idn__strhash_get(idn__strhash_t hash, const char *key, void **valuep) {
|
||||
unsigned long h;
|
||||
strhash_entry_t *entry;
|
||||
|
||||
assert(hash != NULL && key != NULL && valuep != NULL);
|
||||
|
||||
h = hash_value(key);
|
||||
entry = find_entry(hash->bins[h % hash->nbins], key, h);
|
||||
if (entry == NULL)
|
||||
return (idn_noentry);
|
||||
|
||||
*valuep = entry->value;
|
||||
return (idn_success);
|
||||
}
|
||||
|
||||
int
|
||||
idn__strhash_exists(idn__strhash_t hash, const char *key) {
|
||||
unsigned long h;
|
||||
|
||||
assert(hash != NULL && key != NULL);
|
||||
|
||||
h = hash_value(key);
|
||||
return (find_entry(hash->bins[h % hash->nbins], key, h) != NULL);
|
||||
}
|
||||
|
||||
static unsigned long
|
||||
hash_value(const char *key) {
|
||||
unsigned long h = 0;
|
||||
unsigned char *p = (unsigned char *)key;
|
||||
int c;
|
||||
|
||||
while ((c = *p++) != '\0') {
|
||||
h = h * HASH_MULT + c;
|
||||
}
|
||||
return (h);
|
||||
}
|
||||
|
||||
static strhash_entry_t *
|
||||
find_entry(strhash_entry_t *entry, const char *key, unsigned long hash) {
|
||||
assert(key != NULL);
|
||||
|
||||
while (entry != NULL) {
|
||||
if (entry->hash_value == hash && strcmp(key, entry->key) == 0)
|
||||
return (entry);
|
||||
entry = entry->next;
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
static strhash_entry_t *
|
||||
new_entry(const char *key, void *value) {
|
||||
strhash_entry_t *entry;
|
||||
int len;
|
||||
|
||||
assert(key != NULL);
|
||||
|
||||
len = strlen(key) + 1;
|
||||
if ((entry = malloc(sizeof(strhash_entry_t) + len)) == NULL) {
|
||||
return (NULL);
|
||||
}
|
||||
entry->next = NULL;
|
||||
entry->hash_value = hash_value(key);
|
||||
entry->key = (char *)(entry + 1);
|
||||
(void)strcpy(entry->key, key);
|
||||
entry->value = value;
|
||||
|
||||
return (entry);
|
||||
}
|
||||
|
||||
static idn_result_t
|
||||
expand_bins(idn__strhash_t hash, int new_size) {
|
||||
strhash_entry_t **old_bins, **new_bins;
|
||||
int old_size;
|
||||
int old_index, new_index;
|
||||
|
||||
new_bins = malloc(sizeof(strhash_entry_t *) * new_size);
|
||||
if (new_bins == NULL)
|
||||
return (idn_nomemory);
|
||||
|
||||
memset(new_bins, 0, sizeof(strhash_entry_t *) * new_size);
|
||||
|
||||
old_bins = hash->bins;
|
||||
old_size = hash->nbins;
|
||||
for (old_index = 0; old_index < old_size; old_index++) {
|
||||
strhash_entry_t *entries = old_bins[old_index];
|
||||
|
||||
while (entries != NULL) {
|
||||
strhash_entry_t *e = entries;
|
||||
|
||||
/* Remove the top element from the linked list. */
|
||||
entries = entries->next;
|
||||
|
||||
/* ..and move to the new hash. */
|
||||
new_index = e->hash_value % new_size;
|
||||
e->next = new_bins[new_index];
|
||||
new_bins[new_index] = e;
|
||||
}
|
||||
}
|
||||
|
||||
hash->nbins = new_size;
|
||||
hash->bins = new_bins;
|
||||
|
||||
if (old_bins != NULL)
|
||||
free(old_bins);
|
||||
|
||||
return (idn_success);
|
||||
}
|
||||
|
|
@ -1,304 +0,0 @@
|
|||
# $Id: Makefile.in,v 1.2 2004/07/20 07:13:39 marka Exp $
|
||||
# Copyright (c) 2000, 2002 Japan Network Information Center.
|
||||
# All rights reserved.
|
||||
#
|
||||
# By using this file, you agree to the terms and conditions set forth bellow.
|
||||
#
|
||||
# LICENSE TERMS AND CONDITIONS
|
||||
#
|
||||
# The following License Terms and Conditions apply, unless a different
|
||||
# license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
# Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
#
|
||||
# 1. Use, Modification and Redistribution (including distribution of any
|
||||
# modified or derived work) in source and/or binary forms is permitted
|
||||
# under this License Terms and Conditions.
|
||||
#
|
||||
# 2. Redistribution of source code must retain the copyright notices as they
|
||||
# appear in each source code file, this License Terms and Conditions.
|
||||
#
|
||||
# 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
# this License Terms and Conditions, in the documentation and/or other
|
||||
# materials provided with the distribution. For the purposes of binary
|
||||
# distribution the "Copyright Notice" refers to the following language:
|
||||
# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
#
|
||||
# 4. The name of JPNIC may not be used to endorse or promote products
|
||||
# derived from this Software without specific prior written approval of
|
||||
# JPNIC.
|
||||
#
|
||||
# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .tsy .c
|
||||
|
||||
top_builddir = ../..
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
CC = @CC@
|
||||
SHELL = @SHELL@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
|
||||
ICONVINC = @ICONVINC@
|
||||
ICONVLIB = @ICONVLIB@
|
||||
IDNLIB = ../libidntest.la
|
||||
IDNLITELIB = ../libidntestlite.la
|
||||
|
||||
INCS = -I. -I$(srcdir) -I$(srcdir)/../../include -I../../include $(ICONVINC)
|
||||
DEFS =
|
||||
|
||||
CFLAGS = $(INCS) $(DEFS) @CPPFLAGS@ @CFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
TSYFLAGS =
|
||||
|
||||
PERL = @PERL@
|
||||
|
||||
COMMONSRCS = testsuite.c testutil.c setenv.c
|
||||
COMMONOBJS = testsuite.lo testutil.lo setenv.lo
|
||||
BUILTSRCS = api.c api-init1.c api-init2.c api-init3.c \
|
||||
api-init4-1.c api-init4-2.c api-init4-3.c \
|
||||
api-init5-1.c api-init5-2.c api-init5-3.c \
|
||||
res.c resconf.c mapselector.c checker.c converter.c mapper.c \
|
||||
normalizer.c delimitermap.c ucs4.c nameprep.c \
|
||||
testconfig.h
|
||||
|
||||
TESTS = api-test \
|
||||
api-init1-test \
|
||||
api-init2-test \
|
||||
api-init3-test \
|
||||
api-init4-1-test \
|
||||
api-init4-2-test \
|
||||
api-init4-3-test \
|
||||
api-init5-1-test \
|
||||
api-init5-2-test \
|
||||
api-init5-3-test \
|
||||
res-test \
|
||||
resconf-test \
|
||||
mapselector-test \
|
||||
converter-test \
|
||||
checker-test \
|
||||
mapper-test \
|
||||
normalizer-test \
|
||||
delimitermap-test \
|
||||
ucs4-test \
|
||||
nameprep-test
|
||||
|
||||
LITETESTS = apilite-test \
|
||||
reslite-test \
|
||||
resconflite-test \
|
||||
converterlite-test
|
||||
|
||||
.tsy.c:
|
||||
rm -f $@ $@.tmp
|
||||
$(PERL) $(srcdir)/testygen -o $@ $(TSYFLAGS) $<
|
||||
$(PERL) $(srcdir)/utffilter $@ > $@.tmp
|
||||
mv -f $@.tmp $@
|
||||
|
||||
all:
|
||||
|
||||
install:
|
||||
|
||||
clean:
|
||||
rm -f *.o *.lo *.tmp core *.core *~
|
||||
rm -f $(TESTS) $(LITETESTS) $(BUILTSRCS)
|
||||
rm -f test.conf testalias.conf test.map
|
||||
rm -f iconvchk
|
||||
rm -fr .libs/
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile
|
||||
|
||||
@LITEONLY_TRUE@test check: test-lite
|
||||
@LITEONLY_FALSE@test check: test-nolite
|
||||
|
||||
test-lite: $(LITETESTS)
|
||||
@for i in $(LITETESTS); do \
|
||||
echo "Run test program: $$i"; \
|
||||
./$$i; \
|
||||
echo; \
|
||||
done
|
||||
|
||||
test-nolite: $(TESTS) $(LITETESTS) iconvchk
|
||||
@./iconvchk
|
||||
@for i in $(TESTS) $(LITETESTS); do \
|
||||
echo "Run test program: $$i"; \
|
||||
./$$i; \
|
||||
echo; \
|
||||
done
|
||||
|
||||
api-test: api.lo $(IDNLIB) $(COMMONOBJS)
|
||||
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
|
||||
api.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
|
||||
api.lo: api.c testconfig.h
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c api.c
|
||||
|
||||
apilite-test: apilite.lo $(IDNLITELIB) $(COMMONOBJS)
|
||||
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
|
||||
apilite.lo $(COMMONOBJS) $(IDNLITELIB)
|
||||
apilite.lo: api.c testconfig.h
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -DWITHOUT_ICONV -o $@ \
|
||||
-c api.c
|
||||
|
||||
api-init1-test: api-init1.lo $(IDNLIB) $(COMMONOBJS)
|
||||
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
|
||||
api-init1.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
|
||||
api-init1.lo: api-init1.c testconfig.h
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c api-init1.c
|
||||
|
||||
api-init2-test: api-init2.lo $(IDNLIB) $(COMMONOBJS)
|
||||
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
|
||||
api-init2.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
|
||||
api-init2.lo: api-init2.c testconfig.h
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c api-init2.c
|
||||
|
||||
api-init3-test: api-init3.lo $(IDNLIB) $(COMMONOBJS)
|
||||
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
|
||||
api-init3.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
|
||||
api-init3.lo: api-init3.c testconfig.h
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c api-init3.c
|
||||
|
||||
api-init4-1-test: api-init4-1.lo $(IDNLIB) $(COMMONOBJS)
|
||||
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
|
||||
api-init4-1.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
|
||||
api-init4-1.lo: api-init4-1.c testconfig.h
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c api-init4-1.c
|
||||
|
||||
api-init4-2-test: api-init4-2.lo $(IDNLIB) $(COMMONOBJS)
|
||||
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
|
||||
api-init4-2.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
|
||||
api-init4-2.lo: api-init4-2.c testconfig.h
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c api-init4-2.c
|
||||
|
||||
api-init4-3-test: api-init4-3.lo $(IDNLIB) $(COMMONOBJS)
|
||||
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
|
||||
api-init4-3.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
|
||||
api-init4-3.lo: api-init4-3.c testconfig.h
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c api-init4-3.c
|
||||
|
||||
api-init5-1-test: api-init5-1.lo $(IDNLIB) $(COMMONOBJS)
|
||||
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
|
||||
api-init5-1.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
|
||||
api-init5-1.lo: api-init5-1.c testconfig.h
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c api-init5-1.c
|
||||
|
||||
api-init5-2-test: api-init5-2.lo $(IDNLIB) $(COMMONOBJS)
|
||||
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
|
||||
api-init5-2.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
|
||||
api-init5-2.lo: api-init5-2.c testconfig.h
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c api-init5-2.c
|
||||
|
||||
api-init5-3-test: api-init5-3.lo $(IDNLIB) $(COMMONOBJS)
|
||||
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
|
||||
api-init5-3.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
|
||||
api-init5-3.lo: api-init5-3.c testconfig.h
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c api-init5-3.c
|
||||
|
||||
res-test: res.lo $(IDNLIB) $(COMMONOBJS)
|
||||
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
|
||||
res.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
|
||||
res.lo: res.c testconfig.h
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c res.c
|
||||
|
||||
reslite-test: reslite.lo $(IDNLITELIB) $(COMMONOBJS)
|
||||
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
|
||||
reslite.lo $(COMMONOBJS) $(IDNLITELIB)
|
||||
reslite.lo: res.c testconfig.h
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -DWITHOUT_ICONV -o $@ \
|
||||
-c res.c
|
||||
|
||||
resconf-test: resconf.lo $(IDNLIB) $(COMMONOBJS)
|
||||
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
|
||||
resconf.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
|
||||
resconf.lo: resconf.c testconfig.h
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c resconf.c
|
||||
|
||||
resconflite-test: resconflite.lo $(IDNLITELIB) $(COMMONOBJS)
|
||||
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
|
||||
resconflite.lo $(COMMONOBJS) $(IDNLITELIB)
|
||||
resconflite.lo: resconf.c testconfig.h
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -DWITHOUT_ICONV -o $@ \
|
||||
-c resconf.c
|
||||
|
||||
mapselector-test: mapselector.lo $(IDNLIB) $(COMMONOBJS)
|
||||
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
|
||||
mapselector.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
|
||||
mapselector.lo: mapselector.c
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c mapselector.c
|
||||
|
||||
converter-test: converter.lo $(IDNLIB) $(COMMONOBJS)
|
||||
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
|
||||
converter.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
|
||||
converter.lo: converter.c
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c converter.c
|
||||
|
||||
converterlite-test: converterlite.lo $(IDNLITELIB) $(COMMONOBJS)
|
||||
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
|
||||
converterlite.lo $(COMMONOBJS) $(IDNLITELIB)
|
||||
converterlite.lo: converter.c
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -DWITHOUT_ICONV -o $@ \
|
||||
-c converter.c
|
||||
|
||||
checker-test: checker.lo $(IDNLIB) $(COMMONOBJS)
|
||||
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
|
||||
checker.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
|
||||
checker.lo: checker.c
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c checker.c
|
||||
|
||||
mapper-test: mapper.lo $(IDNLIB) $(COMMONOBJS)
|
||||
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
|
||||
mapper.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
|
||||
mapper.lo: mapper.c
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c mapper.c
|
||||
|
||||
normalizer-test: normalizer.lo $(IDNLIB) $(COMMONOBJS)
|
||||
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
|
||||
normalizer.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
|
||||
normalizer.lo: normalizer.c
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c normalizer.c
|
||||
|
||||
delimitermap-test: delimitermap.lo $(IDNLIB) $(COMMONOBJS)
|
||||
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
|
||||
delimitermap.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
|
||||
delimitermap.lo: delimitermap.c
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c delimitermap.c
|
||||
|
||||
ucs4-test: ucs4.lo $(IDNLIB) $(COMMONOBJS)
|
||||
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
|
||||
ucs4.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
|
||||
ucs4.lo: ucs4.c
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c ucs4.c
|
||||
|
||||
nameprep-test: nameprep.lo $(IDNLIB) $(COMMONOBJS)
|
||||
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
|
||||
nameprep.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
|
||||
nameprep.lo: nameprep.c
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c nameprep.c
|
||||
|
||||
testsuite.lo: testsuite.c testsuite.h
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -o $@ -c $(srcdir)/testsuite.c
|
||||
testutil.lo: testutil.c testutil.h
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -o $@ -c $(srcdir)/testutil.c
|
||||
setenv.lo: setenv.c
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -o $@ -c $(srcdir)/setenv.c
|
||||
|
||||
testconfig.h: ../../include/config.h
|
||||
rm -f testconfig.h
|
||||
sed -n -e '/HAVE_SETENV/p' -e '/HAVE_UNSETENV/p' \
|
||||
../../include/config.h > testconfig.h
|
||||
|
||||
iconvchk: iconvchk.c codeset.h
|
||||
$(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ \
|
||||
$(srcdir)/iconvchk.c $(IDNLIB) $(ICONVLIB)
|
||||
|
|
@ -1,113 +0,0 @@
|
|||
#ifndef lint
|
||||
static char *rcsid = "$Id: api-init1.tsy,v 1.1 2003/06/04 00:26:46 marka Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Japan Network Information Center.
|
||||
* All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <idn/api.h>
|
||||
#include <idn/log.h>
|
||||
|
||||
#include "codeset.h"
|
||||
#include "setenv.h"
|
||||
#include "testutil.h"
|
||||
|
||||
#ifndef EUCJP_ENCODING_NAME
|
||||
#define EUCJP_ENCODING_NAME "eucJP"
|
||||
#endif
|
||||
|
||||
#define CONF_FILENAME "test.conf"
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Setups and Teardowns.
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
//# SETUP
|
||||
// group: init
|
||||
{
|
||||
char to[256];
|
||||
idn_result_t r;
|
||||
|
||||
setenv("IDN_LOCAL_CODESET", "UTF-8", 1);
|
||||
unsetenv("IDN_DISABLE");
|
||||
create_conf_file(CONF_FILENAME, 0,
|
||||
"idn-encoding UTF-8",
|
||||
NULL);
|
||||
}
|
||||
|
||||
//# TEARDOWN
|
||||
// group: init
|
||||
{
|
||||
remove(CONF_FILENAME);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Testcases.
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
//# TESTCASE
|
||||
// title: nameinit(0)
|
||||
// group: init
|
||||
{
|
||||
r = idn__setconffile(CONF_FILENAME);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
|
||||
r = idn_nameinit(0);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
|
||||
r = idn_encodename(IDN_ENCODE_APP, "<U+3042>", to, sizeof(to));
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_STRING(to, "xn--l8j");
|
||||
|
||||
r = idn_decodename(IDN_DECODE_APP, "xn--l8j", to, sizeof(to));
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_STRING(to, "<U+3042>");
|
||||
|
||||
r = idn_decodename2(IDN_DECODE_APP, "xn--l8j", to, sizeof(to),
|
||||
EUCJP_ENCODING_NAME);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_STRING(to, "<U+3042>");
|
||||
}
|
||||
|
|
@ -1,113 +0,0 @@
|
|||
#ifndef lint
|
||||
static char *rcsid = "$Id: api-init2.tsy,v 1.1 2003/06/04 00:26:47 marka Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Japan Network Information Center.
|
||||
* All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <idn/api.h>
|
||||
#include <idn/log.h>
|
||||
|
||||
#include "codeset.h"
|
||||
#include "setenv.h"
|
||||
#include "testutil.h"
|
||||
|
||||
#ifndef EUCJP_ENCODING_NAME
|
||||
#define EUCJP_ENCODING_NAME "eucJP"
|
||||
#endif
|
||||
|
||||
#define CONF_FILENAME "test.conf"
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Setups and Teardowns.
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
//# SETUP
|
||||
// group: init
|
||||
{
|
||||
char to[256];
|
||||
idn_result_t r;
|
||||
|
||||
setenv("IDN_LOCAL_CODESET", "UTF-8", 1);
|
||||
unsetenv("IDN_DISABLE");
|
||||
create_conf_file(CONF_FILENAME, 0,
|
||||
"idn-encoding UTF-8",
|
||||
NULL);
|
||||
}
|
||||
|
||||
//# TEARDOWN
|
||||
// group: init
|
||||
{
|
||||
remove(CONF_FILENAME);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Testcases.
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
//# TESTCASE
|
||||
// title: nameinit(1)
|
||||
// group: init
|
||||
{
|
||||
r = idn__setconffile(CONF_FILENAME);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
|
||||
r = idn_nameinit(1);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
|
||||
r = idn_encodename(IDN_ENCODE_APP, "<U+3042>", to, sizeof(to));
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_STRING(to, "<U+3042>");
|
||||
|
||||
r = idn_decodename(IDN_DECODE_APP, "xn--l8j", to, sizeof(to));
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_STRING(to, "xn--l8j");
|
||||
|
||||
r = idn_decodename2(IDN_DECODE_APP, "xn--l8j", to, sizeof(to),
|
||||
EUCJP_ENCODING_NAME);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_STRING(to, "xn--l8j");
|
||||
}
|
||||
|
|
@ -1,117 +0,0 @@
|
|||
#ifndef lint
|
||||
static char *rcsid = "$Id: api-init3.tsy,v 1.1 2003/06/04 00:26:47 marka Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Japan Network Information Center.
|
||||
* All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <idn/api.h>
|
||||
#include <idn/log.h>
|
||||
|
||||
#include "codeset.h"
|
||||
#include "setenv.h"
|
||||
#include "testutil.h"
|
||||
|
||||
#ifndef EUCJP_ENCODING_NAME
|
||||
#define EUCJP_ENCODING_NAME "eucJP"
|
||||
#endif
|
||||
|
||||
#define CONF_FILENAME "test.conf"
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Setups and Teardowns.
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
//# SETUP
|
||||
// group: init
|
||||
{
|
||||
char to[256];
|
||||
idn_result_t r;
|
||||
|
||||
setenv("IDN_LOCAL_CODESET", "UTF-8", 1);
|
||||
unsetenv("IDN_DISABLE");
|
||||
create_conf_file(CONF_FILENAME, 0,
|
||||
"idn-encoding UTF-8",
|
||||
NULL);
|
||||
}
|
||||
|
||||
//# TEARDOWN
|
||||
// group: init
|
||||
{
|
||||
remove(CONF_FILENAME);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Testcases.
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
//# TESTCASE
|
||||
// title: call nameinit() twice
|
||||
// group: init
|
||||
{
|
||||
r = idn__setconffile(CONF_FILENAME);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
|
||||
r = idn_nameinit(1);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
r = idn_nameinit(0);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
|
||||
r = idn_encodename(IDN_ENCODE_APP, "<U+3042>", to, sizeof(to));
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_STRING(to, "<U+3042>");
|
||||
|
||||
r = idn_decodename(IDN_DECODE_APP, "xn--l8j", to, sizeof(to));
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_STRING(to, "xn--l8j");
|
||||
|
||||
r = idn_decodename2(IDN_DECODE_APP, "xn--l8j", to, sizeof(to),
|
||||
EUCJP_ENCODING_NAME);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_STRING(to, "xn--l8j");
|
||||
|
||||
remove(CONF_FILENAME);
|
||||
}
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
#ifndef lint
|
||||
static char *rcsid = "$Id: api-init4-1.tsy,v 1.1 2003/06/04 00:26:47 marka Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Japan Network Information Center.
|
||||
* All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <idn/api.h>
|
||||
#include <idn/log.h>
|
||||
|
||||
#include "setenv.h"
|
||||
#include "testutil.h"
|
||||
|
||||
#define CONF_FILENAME "test.conf"
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Setups and Teardowns.
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
//# SETUP
|
||||
// group: init
|
||||
{
|
||||
char to[256];
|
||||
idn_result_t r;
|
||||
|
||||
setenv("IDN_LOCAL_CODESET", "UTF-8", 1);
|
||||
unsetenv("IDN_DISABLE");
|
||||
create_conf_file(CONF_FILENAME, 0,
|
||||
"idn-encoding UTF-8",
|
||||
NULL);
|
||||
}
|
||||
|
||||
//# TEARDOWN
|
||||
// group: init
|
||||
{
|
||||
remove(CONF_FILENAME);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Testcases.
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
//# TESTCASE
|
||||
// title: call encodename() without initialization
|
||||
// group: init
|
||||
{
|
||||
r = idn__setconffile(CONF_FILENAME);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
|
||||
r = idn_encodename(IDN_ENCODE_APP, "<U+3042>", to, sizeof(to));
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_STRING(to, "xn--l8j");
|
||||
}
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
#ifndef lint
|
||||
static char *rcsid = "$Id: api-init4-2.tsy,v 1.1 2003/06/04 00:26:47 marka Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Japan Network Information Center.
|
||||
* All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <idn/api.h>
|
||||
#include <idn/log.h>
|
||||
|
||||
#include "setenv.h"
|
||||
#include "testutil.h"
|
||||
|
||||
#define CONF_FILENAME "test.conf"
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Setups and Teardowns.
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
//# SETUP
|
||||
// group: init
|
||||
{
|
||||
char to[256];
|
||||
idn_result_t r;
|
||||
|
||||
setenv("IDN_LOCAL_CODESET", "UTF-8", 1);
|
||||
unsetenv("IDN_DISABLE");
|
||||
create_conf_file(CONF_FILENAME, 0,
|
||||
"idn-encoding UTF-8",
|
||||
NULL);
|
||||
}
|
||||
|
||||
//# TEARDOWN
|
||||
// group: init
|
||||
{
|
||||
remove(CONF_FILENAME);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Testcases.
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
//# TESTCASE
|
||||
// title: call decodename() without initialization
|
||||
// group: init
|
||||
{
|
||||
r = idn__setconffile(CONF_FILENAME);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
|
||||
r = idn_decodename(IDN_DECODE_APP, "xn--l8j", to, sizeof(to));
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_STRING(to, "<U+3042>");
|
||||
}
|
||||
|
|
@ -1,102 +0,0 @@
|
|||
#ifndef lint
|
||||
static char *rcsid = "$Id: api-init4-3.tsy,v 1.1 2003/06/04 00:26:47 marka Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Japan Network Information Center.
|
||||
* All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <idn/api.h>
|
||||
#include <idn/log.h>
|
||||
|
||||
#include "codeset.h"
|
||||
#include "setenv.h"
|
||||
#include "testutil.h"
|
||||
|
||||
#ifndef EUCJP_ENCODING_NAME
|
||||
#define EUCJP_ENCODING_NAME "eucJP"
|
||||
#endif
|
||||
|
||||
#define CONF_FILENAME "test.conf"
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Setups and Teardowns.
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
//# SETUP
|
||||
// group: init
|
||||
{
|
||||
char to[256];
|
||||
idn_result_t r;
|
||||
|
||||
setenv("IDN_LOCAL_CODESET", "UTF-8", 1);
|
||||
unsetenv("IDN_DISABLE");
|
||||
create_conf_file(CONF_FILENAME, 0,
|
||||
"idn-encoding UTF-8",
|
||||
NULL);
|
||||
}
|
||||
|
||||
//# TEARDOWN
|
||||
// group: init
|
||||
{
|
||||
remove(CONF_FILENAME);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Testcases.
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
//# TESTCASE
|
||||
// title: call decodename2() without initialization
|
||||
// group: init
|
||||
{
|
||||
r = idn__setconffile(CONF_FILENAME);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
|
||||
r = idn_decodename2(IDN_DECODE_APP, "xn--l8j", to, sizeof(to),
|
||||
EUCJP_ENCODING_NAME);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_STRING(to, "<U+3042>");
|
||||
}
|
||||
|
|
@ -1,102 +0,0 @@
|
|||
#ifndef lint
|
||||
static char *rcsid = "$Id: api-init5-1.tsy,v 1.1 2003/06/04 00:26:48 marka Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Japan Network Information Center.
|
||||
* All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <idn/api.h>
|
||||
#include <idn/log.h>
|
||||
|
||||
#include "setenv.h"
|
||||
#include "testutil.h"
|
||||
|
||||
#define CONF_FILENAME "test.conf"
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Setups and Teardowns.
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
//# SETUP
|
||||
// group: init
|
||||
{
|
||||
char to[256];
|
||||
idn_result_t r;
|
||||
|
||||
setenv("IDN_LOCAL_CODESET", "UTF-8", 1);
|
||||
unsetenv("IDN_DISABLE");
|
||||
create_conf_file(CONF_FILENAME, 0,
|
||||
"idn-encoding UTF-8",
|
||||
NULL);
|
||||
}
|
||||
|
||||
//# TEARDOWN
|
||||
// group: init
|
||||
{
|
||||
remove(CONF_FILENAME);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Testcases.
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
//# TESTCASE
|
||||
// title: call encodename() and nameinit()
|
||||
// group: init
|
||||
{
|
||||
r = idn__setconffile(CONF_FILENAME);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
|
||||
r = idn_encodename(IDN_ENCODE_APP, "aaa", to, sizeof(to));
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
|
||||
r = idn_nameinit(1);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
|
||||
r = idn_encodename(IDN_ENCODE_APP, "<U+3042>", to, sizeof(to));
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_STRING(to, "xn--l8j");
|
||||
}
|
||||
|
|
@ -1,102 +0,0 @@
|
|||
#ifndef lint
|
||||
static char *rcsid = "$Id: api-init5-2.tsy,v 1.1 2003/06/04 00:26:48 marka Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Japan Network Information Center.
|
||||
* All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <idn/api.h>
|
||||
#include <idn/log.h>
|
||||
|
||||
#include "setenv.h"
|
||||
#include "testutil.h"
|
||||
|
||||
#define CONF_FILENAME "test.conf"
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Setups and Teardowns.
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
//# SETUP
|
||||
// group: init
|
||||
{
|
||||
char to[256];
|
||||
idn_result_t r;
|
||||
|
||||
setenv("IDN_LOCAL_CODESET", "UTF-8", 1);
|
||||
unsetenv("IDN_DISABLE");
|
||||
create_conf_file(CONF_FILENAME, 0,
|
||||
"idn-encoding UTF-8",
|
||||
NULL);
|
||||
}
|
||||
|
||||
//# TEARDOWN
|
||||
// group: init
|
||||
{
|
||||
remove(CONF_FILENAME);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Testcases.
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
//# TESTCASE
|
||||
// title: call decodename() and nameinit()
|
||||
// group: init
|
||||
{
|
||||
r = idn__setconffile(CONF_FILENAME);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
|
||||
r = idn_decodename(IDN_DECODE_APP, "aaa", to, sizeof(to));
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
|
||||
r = idn_nameinit(1);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
|
||||
r = idn_decodename(IDN_DECODE_APP, "xn--l8j", to, sizeof(to));
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_STRING(to, "<U+3042>");
|
||||
}
|
||||
|
|
@ -1,109 +0,0 @@
|
|||
#ifndef lint
|
||||
static char *rcsid = "$Id: api-init5-3.tsy,v 1.1 2003/06/04 00:26:48 marka Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Japan Network Information Center.
|
||||
* All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <idn/api.h>
|
||||
#include <idn/log.h>
|
||||
|
||||
#include "codeset.h"
|
||||
#include "setenv.h"
|
||||
#include "testutil.h"
|
||||
|
||||
#ifndef EUCJP_ENCODING_NAME
|
||||
#define EUCJP_ENCODING_NAME "eucJP"
|
||||
#endif
|
||||
|
||||
#define CONF_FILENAME "test.conf"
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Setups and Teardowns.
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
//# SETUP
|
||||
// group: init
|
||||
{
|
||||
char to[256];
|
||||
idn_result_t r;
|
||||
|
||||
setenv("IDN_LOCAL_CODESET", "UTF-8", 1);
|
||||
unsetenv("IDN_DISABLE");
|
||||
create_conf_file(CONF_FILENAME, 0,
|
||||
"idn-encoding UTF-8",
|
||||
NULL);
|
||||
}
|
||||
|
||||
//# TEARDOWN
|
||||
// group: init
|
||||
{
|
||||
remove(CONF_FILENAME);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Testcases.
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
//# TESTCASE
|
||||
// title: call decodename2() and nameinit()
|
||||
// group: init
|
||||
{
|
||||
r = idn__setconffile(CONF_FILENAME);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
|
||||
r = idn_decodename2(IDN_DECODE_APP, "aaa", to, sizeof(to),
|
||||
EUCJP_ENCODING_NAME);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
|
||||
r = idn_nameinit(1);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
|
||||
r = idn_decodename2(IDN_DECODE_APP, "xn--l8j", to, sizeof(to),
|
||||
EUCJP_ENCODING_NAME);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_STRING(to, "<U+3042>");
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,610 +0,0 @@
|
|||
#ifndef lint
|
||||
static char *rcsid = "$Id: checker.tsy,v 1.1 2003/06/04 00:26:51 marka Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Japan Network Information Center.
|
||||
* All rights reserved.
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set forth bellow.
|
||||
*
|
||||
* LICENSE TERMS AND CONDITIONS
|
||||
*
|
||||
* The following License Terms and Conditions apply, unless a different
|
||||
* license is obtained from Japan Network Information Center ("JPNIC"),
|
||||
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
|
||||
* Chiyoda-ku, Tokyo 101-0047, Japan.
|
||||
*
|
||||
* 1. Use, Modification and Redistribution (including distribution of any
|
||||
* modified or derived work) in source and/or binary forms is permitted
|
||||
* under this License Terms and Conditions.
|
||||
*
|
||||
* 2. Redistribution of source code must retain the copyright notices as they
|
||||
* appear in each source code file, this License Terms and Conditions.
|
||||
*
|
||||
* 3. Redistribution in binary form must reproduce the Copyright Notice,
|
||||
* this License Terms and Conditions, in the documentation and/or other
|
||||
* materials provided with the distribution. For the purposes of binary
|
||||
* distribution the "Copyright Notice" refers to the following language:
|
||||
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
|
||||
*
|
||||
* 4. The name of JPNIC may not be used to endorse or promote products
|
||||
* derived from this Software without specific prior written approval of
|
||||
* JPNIC.
|
||||
*
|
||||
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <idn/checker.h>
|
||||
#include <idn/log.h>
|
||||
#include <idn/ucs4.h>
|
||||
#include "testutil.h"
|
||||
|
||||
#define SIZEOFUCS4(x) (sizeof(x) / sizeof(unsigned long))
|
||||
|
||||
#define UCS4_NAME_STR "U+304C" /* hiragana letter ga */
|
||||
#define UCS4_NAME 0x304C
|
||||
|
||||
#define BUF_SIZE 128
|
||||
#define ARRAY_SIZE 9
|
||||
|
||||
#define CONF_FILENAME "test.map"
|
||||
|
||||
#define LINEBUF_SIZE 2001
|
||||
|
||||
/*
|
||||
* Sample strings for `from' argument of normalize(),
|
||||
* and its expected outputs.
|
||||
*/
|
||||
const unsigned long from[4] = {
|
||||
UCS4_NAME,
|
||||
0x00A0, /* no-break space: prohibited character */
|
||||
0x0221, /* unassigned character */
|
||||
0x0000
|
||||
};
|
||||
|
||||
|
||||
#define FROM_UCS4NAME_OFFSET 0
|
||||
#define FROM_PROH_OFFSET 1
|
||||
#define FROM_UNAS_OFFSET 2
|
||||
|
||||
const unsigned long from2[4] = {
|
||||
UCS4_NAME,
|
||||
0x0221, /* unassigned character */
|
||||
0x00A0, /* no-break space: prohibited character */
|
||||
0x0000
|
||||
};
|
||||
|
||||
#define FROM2_UCS4NAME_OFFSET 0
|
||||
#define FROM2_PROH_OFFSET 2
|
||||
#define FROM2_UNAS_OFFSET 1
|
||||
|
||||
static const unsigned long bidi_from[4] = {
|
||||
0x05BE, /* hebrew punctuation maqaf */
|
||||
0x0041, /* latin capital letter a */
|
||||
0xFEFC, /* arabic ligature lam with alef final form */
|
||||
0x0000
|
||||
};
|
||||
#define BIDIFROM_OFFSET 1
|
||||
|
||||
idn_result_t
|
||||
test_createproc(const char *parameter, void **ctxp)
|
||||
{
|
||||
return (idn_success);
|
||||
}
|
||||
|
||||
void
|
||||
test_destroyproc(void *ctx)
|
||||
{
|
||||
}
|
||||
|
||||
#define FOUNDPTR_OFFSET 2
|
||||
idn_result_t
|
||||
test_lookupproc(void *ctx, const unsigned long *ucs4,
|
||||
const unsigned long **found)
|
||||
{
|
||||
*found = ucs4 + FOUNDPTR_OFFSET;
|
||||
return (idn_success);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Setups and Teardowns.
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
//# SETUP
|
||||
// group: generic
|
||||
//--
|
||||
// Initialize the module and create context.
|
||||
{
|
||||
idn_result_t r;
|
||||
idn_checker_t ctx = NULL;
|
||||
char name[BUF_SIZE];
|
||||
|
||||
r = idn_checker_initialize();
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
r = idn_checker_create(&ctx);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
}
|
||||
|
||||
//# TEARDOWN
|
||||
// group: generic
|
||||
//--
|
||||
// Destroy context.
|
||||
{
|
||||
if (ctx != NULL)
|
||||
idn_checker_destroy(ctx);
|
||||
}
|
||||
|
||||
//# SETUP
|
||||
// group: lookup
|
||||
//--
|
||||
// Initialize the module and create context.
|
||||
{
|
||||
idn_result_t r;
|
||||
idn_checker_t ctx = NULL;
|
||||
char name[BUF_SIZE];
|
||||
const unsigned long *ptr;
|
||||
|
||||
r = idn_checker_initialize();
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
r = idn_checker_create(&ctx);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
}
|
||||
|
||||
//# TEARDOWN
|
||||
// group: lookup
|
||||
//--
|
||||
// Destroy context.
|
||||
{
|
||||
if (ctx != NULL)
|
||||
idn_checker_destroy(ctx);
|
||||
}
|
||||
|
||||
//# SETUP
|
||||
// group: addall
|
||||
//--
|
||||
// Initialize the module and create context.
|
||||
{
|
||||
idn_result_t r;
|
||||
idn_checker_t ctx = NULL;
|
||||
char *names[ARRAY_SIZE];
|
||||
int i;
|
||||
const unsigned long *ptr;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE; i++) {
|
||||
names[i] = malloc(BUF_SIZE);
|
||||
if (names[i] == NULL) {
|
||||
ASSERT("malloc failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
r = idn_checker_initialize();
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
r = idn_checker_create(&ctx);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
}
|
||||
|
||||
//# TEARDOWN
|
||||
// group: addall
|
||||
//--
|
||||
// Destroy context and free some blocks.
|
||||
{
|
||||
if (ctx != NULL)
|
||||
idn_checker_destroy(ctx);
|
||||
for (i = 0; i < ARRAY_SIZE; i++) {
|
||||
free(names[i]);
|
||||
}
|
||||
}
|
||||
|
||||
//# SETUP
|
||||
// group: quiet
|
||||
//--
|
||||
// Set log level to `fatal' to supress log messages.
|
||||
{
|
||||
int saved_log_level;
|
||||
|
||||
saved_log_level = idn_log_getlevel();
|
||||
idn_log_setlevel(idn_log_level_fatal);
|
||||
}
|
||||
|
||||
//# TEARDOWN
|
||||
// group: quiet
|
||||
//--
|
||||
// Restore log level.
|
||||
{
|
||||
idn_log_setlevel(saved_log_level);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Testcases.
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
//# TESTCASE
|
||||
// title: idn_checker_add() - boundary condition
|
||||
// group: generic quiet
|
||||
{
|
||||
r = idn_checker_add(ctx, "");
|
||||
ASSERT_RESULT(r, idn_invalid_name);
|
||||
}
|
||||
|
||||
//# TESTCASE
|
||||
// title: idn_checker_add() - builtin schemes, prohibit
|
||||
// group: generic quiet
|
||||
{
|
||||
sprintf(name, "%s%s", IDN_CHECKER_PROHIBIT_PREFIX, "RFC3491");
|
||||
r = idn_checker_add(ctx, name);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
|
||||
sprintf(name, "%s%s", IDN_CHECKER_PROHIBIT_PREFIX, "nameprep-01");
|
||||
r = idn_checker_add(ctx, name);
|
||||
ASSERT_RESULT(r, idn_invalid_name);
|
||||
}
|
||||
|
||||
//# TESTCASE
|
||||
// title: idn_checker_add() - builtin schemes, unassigned
|
||||
// group: generic quiet
|
||||
{
|
||||
sprintf(name, "%s%s", IDN_CHECKER_UNASSIGNED_PREFIX, "RFC3491");
|
||||
r = idn_checker_add(ctx, name);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
|
||||
sprintf(name, "%s%s", IDN_CHECKER_UNASSIGNED_PREFIX, "nameprep-01");
|
||||
r = idn_checker_add(ctx, name);
|
||||
ASSERT_RESULT(r, idn_invalid_name);
|
||||
}
|
||||
|
||||
//# TESTCASE
|
||||
// title: idn_checker_add() - builtin schemes, bidi
|
||||
// group: generic quiet
|
||||
{
|
||||
sprintf(name, "%s%s", IDN_CHECKER_BIDI_PREFIX, "RFC3491");
|
||||
r = idn_checker_add(ctx, name);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
|
||||
sprintf(name, "%s%s", IDN_CHECKER_BIDI_PREFIX, "nameprep-01");
|
||||
r = idn_checker_add(ctx, name);
|
||||
ASSERT_RESULT(r, idn_invalid_name);
|
||||
}
|
||||
|
||||
//# TESTCASE
|
||||
// title: idn_checker_add() - file - boundary condition
|
||||
// group: generic quiet
|
||||
{
|
||||
sprintf(name, "%sfileset:%s", IDN_CHECKER_UNASSIGNED_PREFIX, "");
|
||||
r = idn_checker_add(ctx, name);
|
||||
ASSERT_RESULT(r, idn_nofile);
|
||||
sprintf(name, "%sfileset:%s", IDN_CHECKER_PROHIBIT_PREFIX, "");
|
||||
r = idn_checker_add(ctx, name);
|
||||
ASSERT_RESULT(r, idn_nofile);
|
||||
sprintf(name, "%sfileset:%s", IDN_CHECKER_BIDI_PREFIX, "");
|
||||
r = idn_checker_add(ctx, name);
|
||||
ASSERT_RESULT(r, idn_invalid_name);
|
||||
}
|
||||
|
||||
//# TESTCASE
|
||||
// title: idn_checker_add() - file - long line
|
||||
// group: generic quiet
|
||||
{
|
||||
char line[LINEBUF_SIZE];
|
||||
const char *first_entry = "304C;";
|
||||
const char *other_entry = " 304D";
|
||||
int i;
|
||||
int len;
|
||||
|
||||
memcpy(line, first_entry, strlen(first_entry));
|
||||
len = strlen(other_entry);
|
||||
for (i = len; i < LINEBUF_SIZE - len; i += len) {
|
||||
memcpy(line + i, other_entry, len);
|
||||
}
|
||||
*(line + i) = '\0';
|
||||
|
||||
create_conf_file(CONF_FILENAME, 0, line, NULL);
|
||||
sprintf(name, "%sfileset:%s", IDN_CHECKER_UNASSIGNED_PREFIX,
|
||||
CONF_FILENAME);
|
||||
r = idn_checker_add(ctx, name);
|
||||
ASSERT_RESULT(r, idn_invalid_syntax);
|
||||
sprintf(name, "%sfileset:%s", IDN_CHECKER_PROHIBIT_PREFIX,
|
||||
CONF_FILENAME);
|
||||
r = idn_checker_add(ctx, name);
|
||||
ASSERT_RESULT(r, idn_invalid_syntax);
|
||||
}
|
||||
|
||||
//# TESTCASE
|
||||
// title: idn_checker_add() - file, prohibit
|
||||
// group: lookup
|
||||
{
|
||||
create_conf_file(CONF_FILENAME, 0,
|
||||
UCS4_NAME_STR,
|
||||
NULL);
|
||||
sprintf(name, "%sfileset:%s", IDN_CHECKER_PROHIBIT_PREFIX,
|
||||
CONF_FILENAME);
|
||||
r = idn_checker_add(ctx, name);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
r = idn_checker_lookup(ctx, from, &ptr);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_PTR(ptr, from + FROM_UCS4NAME_OFFSET);
|
||||
r = idn_checker_lookup(ctx, from2, &ptr);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_PTR(ptr, from2 + FROM2_UCS4NAME_OFFSET);
|
||||
}
|
||||
|
||||
//# TESTCASE
|
||||
// title: idn_checker_add() - file, unassigned
|
||||
// group: lookup
|
||||
{
|
||||
create_conf_file(CONF_FILENAME, 0,
|
||||
UCS4_NAME_STR,
|
||||
NULL);
|
||||
sprintf(name, "%sfileset:%s", IDN_CHECKER_UNASSIGNED_PREFIX,
|
||||
CONF_FILENAME);
|
||||
r = idn_checker_add(ctx, name);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
r = idn_checker_lookup(ctx, from, &ptr);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_PTR(ptr, from + FROM_UCS4NAME_OFFSET);
|
||||
r = idn_checker_lookup(ctx, from2, &ptr);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_PTR(ptr, from2 + FROM2_UCS4NAME_OFFSET);
|
||||
}
|
||||
|
||||
//# TESTCASE
|
||||
// title: idn_checker_add() - file, bidi
|
||||
// group: lookup quiet
|
||||
{
|
||||
create_conf_file(CONF_FILENAME, 0,
|
||||
UCS4_NAME_STR,
|
||||
NULL);
|
||||
sprintf(name, "%sfileset:%s", IDN_CHECKER_BIDI_PREFIX,
|
||||
CONF_FILENAME);
|
||||
r = idn_checker_add(ctx, name);
|
||||
ASSERT_RESULT(r, idn_invalid_name);
|
||||
}
|
||||
|
||||
//# TESTCASE
|
||||
// title: idn_checker_addall() - boundary condition - scheme name
|
||||
// group: addall quiet
|
||||
{
|
||||
sprintf(names[0], "%s%s", IDN_CHECKER_PROHIBIT_PREFIX, "RFC3491");
|
||||
sprintf(names[1], "%s%s", IDN_CHECKER_UNASSIGNED_PREFIX, "RFC3491");
|
||||
sprintf(names[2], "%s%s", IDN_CHECKER_BIDI_PREFIX, "RFC3491");
|
||||
sprintf(names[3], "%s%s", IDN_CHECKER_BIDI_PREFIX, "");
|
||||
r = idn_checker_addall(ctx, (const char **)names, 4);
|
||||
ASSERT_RESULT(r, idn_invalid_name);
|
||||
}
|
||||
|
||||
//# TESTCASE
|
||||
// title: idn_checker_addall() - boundary condition - nschemes = 0
|
||||
// group: addall quiet
|
||||
{
|
||||
sprintf(names[0], "%s%s", IDN_CHECKER_PROHIBIT_PREFIX, "nameprep-01");
|
||||
sprintf(names[1], "%s%s", IDN_CHECKER_UNASSIGNED_PREFIX, "nameprep-01");
|
||||
sprintf(names[2], "%s%s", IDN_CHECKER_BIDI_PREFIX, "");
|
||||
sprintf(names[3], "%s%s", IDN_CHECKER_BIDI_PREFIX, "nameprep-01");
|
||||
r = idn_checker_addall(ctx, (const char **)names, 0);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
r = idn_checker_lookup(ctx, from, &ptr);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_PTR(ptr, NULL);
|
||||
}
|
||||
|
||||
//# TESTCASE
|
||||
// title: idn_checker_addall() - add a lot of schemes #1
|
||||
// group: addall
|
||||
{
|
||||
sprintf(names[0], "%s%s", IDN_CHECKER_PROHIBIT_PREFIX, "RFC3491");
|
||||
sprintf(names[1], "%s%s", IDN_CHECKER_UNASSIGNED_PREFIX, "RFC3491");
|
||||
sprintf(names[2], "%s%s", IDN_CHECKER_BIDI_PREFIX, "RFC3491");
|
||||
sprintf(names[3], "%s%s", IDN_CHECKER_PROHIBIT_PREFIX, "RFC3491");
|
||||
sprintf(names[4], "%s%s", IDN_CHECKER_UNASSIGNED_PREFIX, "RFC3491");
|
||||
sprintf(names[5], "%s%s", IDN_CHECKER_BIDI_PREFIX, "RFC3491");
|
||||
sprintf(names[6], "%s%s", IDN_CHECKER_PROHIBIT_PREFIX, "RFC3491");
|
||||
sprintf(names[7], "%s%s", IDN_CHECKER_UNASSIGNED_PREFIX, "RFC3491");
|
||||
sprintf(names[8], "%s%s", IDN_CHECKER_BIDI_PREFIX, "RFC3491");
|
||||
|
||||
r = idn_checker_addall(ctx, (const char **)names, 9);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
|
||||
r = idn_checker_lookup(ctx, from, &ptr);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_PTR(ptr, from + FROM_PROH_OFFSET);
|
||||
|
||||
r = idn_checker_lookup(ctx, from2, &ptr);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_PTR(ptr, from2 + FROM2_PROH_OFFSET);
|
||||
|
||||
r = idn_checker_lookup(ctx, bidi_from, &ptr);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_PTR(ptr, bidi_from + BIDIFROM_OFFSET);
|
||||
}
|
||||
|
||||
//# TESTCASE
|
||||
// title: idn_checker_addall() - add a lot of schemes #2
|
||||
// group: addall
|
||||
{
|
||||
sprintf(names[0], "%s%s", IDN_CHECKER_BIDI_PREFIX, "RFC3491");
|
||||
sprintf(names[1], "%s%s", IDN_CHECKER_UNASSIGNED_PREFIX, "RFC3491");
|
||||
sprintf(names[2], "%s%s", IDN_CHECKER_PROHIBIT_PREFIX, "RFC3491");
|
||||
sprintf(names[3], "%s%s", IDN_CHECKER_BIDI_PREFIX, "RFC3491");
|
||||
sprintf(names[4], "%s%s", IDN_CHECKER_UNASSIGNED_PREFIX, "RFC3491");
|
||||
sprintf(names[5], "%s%s", IDN_CHECKER_PROHIBIT_PREFIX, "RFC3491");
|
||||
sprintf(names[6], "%s%s", IDN_CHECKER_BIDI_PREFIX, "RFC3491");
|
||||
sprintf(names[7], "%s%s", IDN_CHECKER_UNASSIGNED_PREFIX, "RFC3491");
|
||||
sprintf(names[8], "%s%s", IDN_CHECKER_PROHIBIT_PREFIX, "RFC3491");
|
||||
|
||||
r = idn_checker_addall(ctx, (const char **)names, 9);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
|
||||
r = idn_checker_lookup(ctx, from, &ptr);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_PTR(ptr, from + FROM_UNAS_OFFSET);
|
||||
|
||||
r = idn_checker_lookup(ctx, from2, &ptr);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_PTR(ptr, from2 + FROM2_UNAS_OFFSET);
|
||||
|
||||
r = idn_checker_lookup(ctx, bidi_from, &ptr);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_PTR(ptr, bidi_from + BIDIFROM_OFFSET);
|
||||
}
|
||||
|
||||
//# TESTCASE
|
||||
// title: idn_checker_addall() - add same scheme repetedly
|
||||
// group: addall
|
||||
{
|
||||
int i;
|
||||
|
||||
sprintf(names[0], "%s%s", IDN_CHECKER_PROHIBIT_PREFIX, "RFC3491");
|
||||
for (i = 1; i < ARRAY_SIZE; i++) {
|
||||
strcpy(names[i], names[0]);
|
||||
}
|
||||
r = idn_checker_addall(ctx, (const char **)names, ARRAY_SIZE);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
|
||||
r = idn_checker_lookup(ctx, from, &ptr);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_PTR(ptr, from + FROM_PROH_OFFSET);
|
||||
|
||||
r = idn_checker_lookup(ctx, from2, &ptr);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_PTR(ptr, from2 + FROM2_PROH_OFFSET);
|
||||
}
|
||||
|
||||
//# TESTCASE
|
||||
// title: idn_checker_lookup() - builtin schemes - RFC3491 prohibit
|
||||
// group: lookup
|
||||
{
|
||||
sprintf(name, "%s%s", IDN_CHECKER_PROHIBIT_PREFIX, "RFC3491");
|
||||
|
||||
r = idn_checker_add(ctx, name);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
|
||||
r = idn_checker_lookup(ctx, from, &ptr);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_PTR(ptr, from + FROM_PROH_OFFSET);
|
||||
|
||||
r = idn_checker_lookup(ctx, from2, &ptr);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_PTR(ptr, from2 + FROM2_PROH_OFFSET);
|
||||
}
|
||||
|
||||
//# TESTCASE
|
||||
// title: idn_checker_lookup() - builtin schemes - RFC3491 unassigned
|
||||
// group: lookup
|
||||
{
|
||||
sprintf(name, "%s%s", IDN_CHECKER_UNASSIGNED_PREFIX, "RFC3491");
|
||||
|
||||
r = idn_checker_add(ctx, name);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
|
||||
r = idn_checker_lookup(ctx, from, &ptr);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_PTR(ptr, from + FROM_UNAS_OFFSET);
|
||||
|
||||
r = idn_checker_lookup(ctx, from2, &ptr);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_PTR(ptr, from2 + FROM2_UNAS_OFFSET);
|
||||
}
|
||||
|
||||
//# TESTCASE
|
||||
// title: idn_checker_lookup() - builtin schemes - RFC3491 bidi
|
||||
// group: lookup
|
||||
{
|
||||
sprintf(name, "%s%s", IDN_CHECKER_BIDI_PREFIX, "RFC3491");
|
||||
|
||||
r = idn_checker_add(ctx, name);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
|
||||
r = idn_checker_lookup(ctx, bidi_from, &ptr);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_PTR(ptr, bidi_from + BIDIFROM_OFFSET);
|
||||
|
||||
r = idn_checker_lookup(ctx, from, &ptr);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_PTR(ptr, NULL);
|
||||
|
||||
r = idn_checker_lookup(ctx, from2, &ptr);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_PTR(ptr, NULL);
|
||||
}
|
||||
|
||||
//# TESTCASE
|
||||
// title: idn_checker_lookup() - context without procedure
|
||||
// group: lookup
|
||||
{
|
||||
r = idn_checker_lookup(ctx, from, &ptr);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_PTR(ptr, NULL);
|
||||
}
|
||||
|
||||
//# TESTCASE
|
||||
// title: idn_checker_lookup() - string in ascii
|
||||
// group: lookup
|
||||
{
|
||||
char *ascii_str = "test";
|
||||
unsigned long ucs4_str[5];
|
||||
|
||||
r = idn_ucs4_utf8toucs4(ascii_str, ucs4_str, SIZEOFUCS4(ucs4_str));
|
||||
|
||||
sprintf(name, "%s%s", IDN_CHECKER_PROHIBIT_PREFIX, "RFC3491");
|
||||
r = idn_checker_add(ctx, name);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
sprintf(name, "%s%s", IDN_CHECKER_UNASSIGNED_PREFIX, "RFC3491");
|
||||
r = idn_checker_add(ctx, name);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
sprintf(name, "%s%s", IDN_CHECKER_BIDI_PREFIX, "RFC3491");
|
||||
r = idn_checker_add(ctx, name);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
r = idn_checker_lookup(ctx, ucs4_str, &ptr);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_PTR(ptr, NULL);
|
||||
}
|
||||
|
||||
//# TESTCASE
|
||||
// title: idn_checker_destroy(), idn_checker_incrref()
|
||||
// group:
|
||||
{
|
||||
idn_result_t r;
|
||||
idn_checker_t ctx = NULL;
|
||||
|
||||
r = idn_checker_initialize();
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
r = idn_checker_create(&ctx);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
idn_checker_incrref(ctx);
|
||||
idn_checker_destroy(ctx);
|
||||
idn_checker_destroy(ctx);
|
||||
}
|
||||
|
||||
//# TESTCASE
|
||||
// title: idn_checker_register()
|
||||
// group: generic
|
||||
{
|
||||
const unsigned long *ptr = NULL;
|
||||
|
||||
r = idn_checker_register("test",
|
||||
test_createproc,
|
||||
test_destroyproc,
|
||||
test_lookupproc);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
|
||||
r = idn_checker_add(ctx, "test");
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
|
||||
r = idn_checker_lookup(ctx, from, &ptr);
|
||||
ASSERT_RESULT(r, idn_success);
|
||||
ASSERT_PTR(ptr, from + FOUNDPTR_OFFSET);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue