summaryrefslogtreecommitdiff
path: root/src/stringprep
diff options
context:
space:
mode:
authorAlexey Shchepin <alexey@process-one.net>2003-10-09 18:09:05 +0000
committerAlexey Shchepin <alexey@process-one.net>2003-10-09 18:09:05 +0000
commit7df146166a7229a66e5d7d4fe8476a5a4c646e0b (patch)
tree4160eed36b115426b948f3944476ce41a1cf9fa6 /src/stringprep
parent* src/ejabberd_c2s.erl: Added support for "jid-malformed" error (diff)
* src/ejabberd_c2s.erl: Added authentification logging
* src/ejabberd_listener.erl: Added logging of accepted connections * src/stringprep/stringprep_drv.c: Cleanup * src/jd2ejd.erl: Added support for iq:private importing * src/mod_configure.erl: Fixed user removal * src/mod_private.erl: Added remove_user/1 * doc/guide.tex: Updated * src/mod_disco.erl: Added "extra_domains" option SVN Revision: 146
Diffstat (limited to 'src/stringprep')
-rw-r--r--src/stringprep/stringprep_drv.c53
-rw-r--r--src/stringprep/uni_norm.c21
-rw-r--r--src/stringprep/uni_parse2.tcl21
3 files changed, 23 insertions, 72 deletions
diff --git a/src/stringprep/stringprep_drv.c b/src/stringprep/stringprep_drv.c
index 906ea620..43dd2b87 100644
--- a/src/stringprep/stringprep_drv.c
+++ b/src/stringprep/stringprep_drv.c
@@ -37,7 +37,7 @@ static void stringprep_erl_stop(ErlDrvData handle)
* library
*/
-void canonical_ordering(int *str, int len)
+static void canonical_ordering(int *str, int len)
{
int i, j, t;
int last, next;
@@ -232,13 +232,6 @@ static int stringprep_erl_control(ErlDrvData drv_data,
}
info = GetUniCharInfo(uc);
- //if(info & prohibit) {
- // *rbuf = rstring;
- // driver_free(str32);
- // return 1;
- //}
-
- //printf("Got %x\r\n", uc);
if(!(info & B1Mask))
{
@@ -247,34 +240,10 @@ static int stringprep_erl_control(ErlDrvData drv_data,
{
ruc = uc + GetDelta(info);
ADD_DECOMP(ruc);
-
- //info = GetUniCharDecompInfo(ruc);
- //if(info >= 0) {
- // decomp_len = GetDecompLen(info);
- // decomp_shift = GetDecompShift(info);
- // for(j = 0; j < decomp_len; j++) {
- // ADD_UCHAR32(str32, str32pos, str32len,
- // decompList[decomp_shift + j]);
- // }
- //} else {
- // ADD_UCHAR32(str32, str32pos, str32len, ruc);
- //}
-
- //info = GetUniCharDecompInfo(ruc);
- //if(info >= 0) {
- // printf("Decomposition %x: ", ruc);
- // for(j = 0; j < GetDecompLen(info); j++) {
- // printf("%x ", decompList[GetDecompShift(info) + j]);
- // }
- // printf("\r\n");
- //}
-
- //ADD_UCHAR(ruc);
} else {
mc = GetMC(info);
for(j = 1; j <= mc[0]; j++) {
ruc = mc[j];
- //printf("Char %x cclass %d\r\n", ruc, GetUniCharCClass(ruc));
ADD_DECOMP(ruc);
}
}
@@ -292,19 +261,8 @@ static int stringprep_erl_control(ErlDrvData drv_data,
return 1;
}
- //printf("\r\n");
- //printf("DECOMPOSED:\t");
- //for(i = 0; i < str32pos; i++)
- // printf("%4x ", str32[i]);
- //printf("\r\n");
-
canonical_ordering(str32, str32pos);
- //printf("ORDERED:\t");
- //for(i = 0; i < str32pos; i++)
- // printf("%4x ", str32[i]);
- //printf("\r\n");
-
comp_pos = 1;
comp_starter_pos = 0;
ch1 = str32[0];
@@ -314,7 +272,6 @@ static int stringprep_erl_control(ErlDrvData drv_data,
{
ch2 = str32[i];
cclass2 = GetUniCharCClass(ch2);
- //printf("Compose: %x + %x = %x\r\n", ch1, ch2, compose(ch1, ch2));
if(cclass1 == 0 && cclass2 > cclass_prev && (ruc = compose(ch1, ch2))) {
ch1 = ruc;
} else {
@@ -332,11 +289,6 @@ static int stringprep_erl_control(ErlDrvData drv_data,
str32[comp_starter_pos] = ch1;
str32pos = comp_pos;
- //printf("COMPOSED:\t");
- //for(i = 0; i < str32pos; i++)
- // printf("%4x ", str32[i]);
- //printf("\r\n");
-
for(i = 0; i < str32pos; i++)
{
ruc = str32[i];
@@ -349,9 +301,6 @@ static int stringprep_erl_control(ErlDrvData drv_data,
ADD_UCHAR(ruc);
}
- //printf("Compose: %x\r\n", compose(0x438, 0x301));
- //printf("Pos: %d\r\n", pos);
-
rstring[0] = 1;
*rbuf = rstring;
driver_free(str32);
diff --git a/src/stringprep/uni_norm.c b/src/stringprep/uni_norm.c
index d95ad5ba..fe7281b4 100644
--- a/src/stringprep/uni_norm.c
+++ b/src/stringprep/uni_norm.c
@@ -77,9 +77,8 @@ static unsigned char cclassPageMap[] = {
};
/*
- * The groupMap is indexed by combining the alternate page number with
- * the page offset and returns a group number that identifies a unique
- * set of character attributes.
+ * The cclassGroupMap is indexed by combining the alternate page number with
+ * the page offset and returns a combining class number.
*/
static unsigned char cclassGroupMap[] = {
@@ -297,9 +296,9 @@ static unsigned char decompPageMap[] = {
};
/*
- * The groupMap is indexed by combining the alternate page number with
- * the page offset and returns a group number that identifies a unique
- * set of character attributes.
+ * The decompGroupMap is indexed by combining the alternate page number with
+ * the page offset and returns a group number that identifies a length and
+ * shift of decomposition sequence in decompList
*/
static int decompGroupMap[] = {
@@ -839,7 +838,7 @@ static int decompGroupMap[] = {
};
/*
- * Each group represents a unique set of character attributes. The attributes...
+ * List of decomposition sequences
*/
static int decompList[] = {
@@ -1295,8 +1294,6 @@ static int decompList[] = {
* Unicode character tables.
*/
-//#define GetUniCharInfo(ch) (groups[groupMap[(pageMap[(((int)(ch)) & 0xffff) >> CCLASS_OFFSET_BITS] << CCLASS_OFFSET_BITS) | ((ch) & ((1 << CCLASS_OFFSET_BITS)-1))]])
-
#define GetUniCharDecompInfo(ch) (decompGroupMap[(decompPageMap[(((int)(ch)) & 0xffff) >> DECOMP_OFFSET_BITS] << DECOMP_OFFSET_BITS) | ((ch) & ((1 << DECOMP_OFFSET_BITS)-1))])
#define GetDecompShift(info) ((info) & 0xffff)
@@ -1556,7 +1553,7 @@ static int compGroupMap[] = {
};
/*
- * ...
+ * Lists of compositions for characters that appears only in one composition
*/
static int compFirstList[][2] = {
@@ -1612,6 +1609,10 @@ static int compSecondList[][2] = {
{1575, 1570}, {1575, 1573}
};
+/*
+ * Compositions matrix
+ */
+
static int compBothList[144][37] = {
{
8179, 8060, 974, 0, 8032, 0, 8033, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
diff --git a/src/stringprep/uni_parse2.tcl b/src/stringprep/uni_parse2.tcl
index 2f3ef7ec..968f262b 100644
--- a/src/stringprep/uni_parse2.tcl
+++ b/src/stringprep/uni_parse2.tcl
@@ -423,9 +423,8 @@ static unsigned char cclassPageMap\[\] = {"
puts $f "};
/*
- * The groupMap is indexed by combining the alternate page number with
- * the page offset and returns a group number that identifies a unique
- * set of character attributes.
+ * The cclassGroupMap is indexed by combining the alternate page number with
+ * the page offset and returns a combining class number.
*/
static unsigned char cclassGroupMap\[\] = {"
@@ -476,9 +475,9 @@ static unsigned char decompPageMap\[\] = {"
puts $f "};
/*
- * The groupMap is indexed by combining the alternate page number with
- * the page offset and returns a group number that identifies a unique
- * set of character attributes.
+ * The decompGroupMap is indexed by combining the alternate page number with
+ * the page offset and returns a group number that identifies a length and
+ * shift of decomposition sequence in decompList
*/
static int decompGroupMap\[\] = {"
@@ -502,7 +501,7 @@ static int decompGroupMap\[\] = {"
puts $f "};
/*
- * Each group represents a unique set of character attributes. The attributes...
+ * List of decomposition sequences
*/
static int decompList\[\] = {"
@@ -529,8 +528,6 @@ static int decompList\[\] = {"
* Unicode character tables.
*/
-//#define GetUniCharInfo(ch) (groups\[groupMap\[(pageMap\[(((int)(ch)) & 0xffff) >> CCLASS_OFFSET_BITS\] << CCLASS_OFFSET_BITS) | ((ch) & ((1 << CCLASS_OFFSET_BITS)-1))\]\])
-
#define GetUniCharDecompInfo(ch) (decompGroupMap\[(decompPageMap\[(((int)(ch)) & 0xffff) >> DECOMP_OFFSET_BITS\] << DECOMP_OFFSET_BITS) | ((ch) & ((1 << DECOMP_OFFSET_BITS)-1))\])
#define GetDecompShift(info) ((info) & 0xffff)
@@ -588,7 +585,7 @@ static int compGroupMap\[\] = {"
puts $f "};
/*
- * ...
+ * Lists of compositions for characters that appears only in one composition
*/
static int compFirstList\[\]\[2\] = {"
@@ -627,6 +624,10 @@ static int compSecondList\[\]\[2\] = {"
puts $f $line
puts $f "};
+/*
+ * Compositions matrix
+ */
+
static int compBothList\[[llength $comp_x_list]\]\[[llength $comp_y_list]\] = {"
set lastx [expr {[llength $comp_x_list] - 1}]
set lasty [expr {[llength $comp_y_list] - 1}]