#ifndef lint
#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
* 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,
* 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/logmacro.h>
/*
* Some constants for Hangul decomposition/composition.
*/
/*
* Symbol composition macro.
*/
#define compose_symX(a, b) a ## b
struct composition {
};
#include "unicodedata_320.c"
#include "unicode_template.c"
typedef int (*unicode_canonclassproc)(unsigned long v);
typedef int (*unicode_decomposeproc)(unsigned long c,
const unsigned long **seqp);
typedef int (*unicode_composeproc)(unsigned long c,
const struct composition **compp);
static struct idn__unicode_ops {
char *version;
} unicode_versions[] = {
{ version, \
{ NULL },
};
TRACE(("idn__unicode_create(version=%-.50s)\n",
*versionp = v;
return (idn_success);
}
}
return (idn_notfound);
}
void
TRACE(("idn__unicode_destroy()\n"));
/* Nothing to do */
}
int
if (c > UCS_MAX)
return (0);
return (*version->canonclass_proc)(c);
}
unsigned long c, int *decomp_lenp) {
unsigned long *vorg = v;
int seqidx;
const unsigned long *seq;
if (c > UCS_MAX)
return (idn_notfound);
/*
* First, check for Hangul.
*/
return (idn_buffer_overflow);
if (t_offset > 0)
*decomp_lenp = v - vorg;
return (idn_success);
}
/*
* Look up decomposition table. If no decomposition is defined
* or if it is a compatibility decomosition when canonical
* decomposition requested, return 'idn_notfound'.
*/
return (idn_notfound);
/*
* Copy the decomposed sequence. The end of the sequence are
* marked with END_BIT.
*/
do {
unsigned long c;
int dlen;
idn_result_t r;
/* Decompose recursively. */
if (r == idn_success) {
v += dlen;
} else if (r == idn_notfound) {
if (vlen < 1)
return (idn_buffer_overflow);
*v++ = c;
vlen--;
} else {
return (r);
}
*decomp_lenp = v - vorg;
return (idn_success);
}
int
unsigned long c) {
if (c > UCS_MAX)
return (0);
/* Check for Hangul */
return (1);
/*
* Look up composition table. If there are no composition
* that begins with the given character, it is not a
* composition candidate.
*/
return (0);
else
return (1);
}
int n;
return (idn_notfound);
/*
* Check for Hangul.
*/
/*
* Hangul L and V.
*/
return (idn_success);
/*
* Hangul LV and T.
*/
return (idn_success);
}
/*
* Look up composition table. If the result is 0, no composition
* is defined. Otherwise, upper 16bits of the result contains
* the number of composition that begins with 'c1', and the lower
* 16bits is the offset in 'compose_seq'.
*/
return (idn_notfound);
/*
* The composite sequences are sorted by the 2nd character 'c2'.
* So we can use binary search.
*/
lo = 0;
hi = n - 1;
} else {
return (idn_success);
}
}
return (idn_notfound);
}