add functionality to uscan and ugen so we can add CNS11643 p3-7 into euc-tw

This commit is contained in:
ftang%netscape.com 1999-06-10 12:56:33 +00:00
Родитель 39a4bcb7e0
Коммит 4da807248e
5 изменённых файлов: 635 добавлений и 0 удалений

Просмотреть файл

@ -43,6 +43,11 @@ typedef enum {
u2BytesSwapCharset,
u4BytesCharset,
u4BytesSwapCharset,
u2BytesGRPrefix8EA3Charset,
u2BytesGRPrefix8EA4Charset,
u2BytesGRPrefix8EA5Charset,
u2BytesGRPrefix8EA6Charset,
u2BytesGRPrefix8EA7Charset,
uNumOfCharsetType
} uScanClassID;

Просмотреть файл

@ -119,6 +119,51 @@ PRIVATE PRBool uCheckAndGenAlways4ByteSwap(
PRUint32 outbuflen,
PRUint32* outlen
);
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA3(
uShiftTable *shift,
PRInt32* state,
PRUint16 in,
unsigned char* out,
PRUint32 outbuflen,
PRUint32* outlen
);
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA4(
uShiftTable *shift,
PRInt32* state,
PRUint16 in,
unsigned char* out,
PRUint32 outbuflen,
PRUint32* outlen
);
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA5(
uShiftTable *shift,
PRInt32* state,
PRUint16 in,
unsigned char* out,
PRUint32 outbuflen,
PRUint32* outlen
);
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA6(
uShiftTable *shift,
PRInt32* state,
PRUint16 in,
unsigned char* out,
PRUint32 outbuflen,
PRUint32* outlen
);
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA7(
uShiftTable *shift,
PRInt32* state,
PRUint16 in,
unsigned char* out,
PRUint32 outbuflen,
PRUint32* outlen
);
PRIVATE PRBool uGenAlways2Byte(
PRUint16 in,
unsigned char* out
@ -157,6 +202,11 @@ PRIVATE uGeneratorFunc m_generator[uNumOfCharsetType] =
uCheckAndGenAlways2ByteSwap,
uCheckAndGenAlways4Byte,
uCheckAndGenAlways4ByteSwap,
uCheckAndGen2ByteGRPrefix8EA3,
uCheckAndGen2ByteGRPrefix8EA4,
uCheckAndGen2ByteGRPrefix8EA5,
uCheckAndGen2ByteGRPrefix8EA6,
uCheckAndGen2ByteGRPrefix8EA7,
};
/*=================================================================================
@ -480,3 +530,118 @@ PRIVATE PRBool uCheckAndGenAlways4ByteSwap(
return PR_TRUE;
}
}
/*=================================================================================
=================================================================================*/
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA3( uShiftTable *shift,
PRInt32* state,
PRUint16 in,
unsigned char* out,
PRUint32 outbuflen,
PRUint32* outlen
)
{
if(outbuflen < 4)
return PR_FALSE;
else
{
*outlen = 4;
out[0] = 0x8E;
out[1] = 0xA3;
out[2] = ((in >> 8 ) & 0xff) | 0x80;
out[3] = (in & 0xff) | 0x80;
return PR_TRUE;
}
}
/*=================================================================================
=================================================================================*/
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA4( uShiftTable *shift,
PRInt32* state,
PRUint16 in,
unsigned char* out,
PRUint32 outbuflen,
PRUint32* outlen
)
{
if(outbuflen < 4)
return PR_FALSE;
else
{
*outlen = 4;
out[0] = 0x8E;
out[1] = 0xA4;
out[2] = ((in >> 8 ) & 0xff) | 0x80;
out[3] = (in & 0xff) | 0x80;
return PR_TRUE;
}
}
/*=================================================================================
=================================================================================*/
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA5( uShiftTable *shift,
PRInt32* state,
PRUint16 in,
unsigned char* out,
PRUint32 outbuflen,
PRUint32* outlen
)
{
if(outbuflen < 4)
return PR_FALSE;
else
{
*outlen = 4;
out[0] = 0x8E;
out[1] = 0xA5;
out[2] = ((in >> 8 ) & 0xff) | 0x80;
out[3] = (in & 0xff) | 0x80;
return PR_TRUE;
}
}
/*=================================================================================
=================================================================================*/
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA6( uShiftTable *shift,
PRInt32* state,
PRUint16 in,
unsigned char* out,
PRUint32 outbuflen,
PRUint32* outlen
)
{
if(outbuflen < 4)
return PR_FALSE;
else
{
*outlen = 4;
out[0] = 0x8E;
out[1] = 0xA6;
out[2] = ((in >> 8 ) & 0xff) | 0x80;
out[3] = (in & 0xff) | 0x80;
return PR_TRUE;
}
}
/*=================================================================================
=================================================================================*/
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA7( uShiftTable *shift,
PRInt32* state,
PRUint16 in,
unsigned char* out,
PRUint32 outbuflen,
PRUint32* outlen
)
{
if(outbuflen < 4)
return PR_FALSE;
else
{
*outlen = 4;
out[0] = 0x8E;
out[1] = 0xA7;
out[2] = ((in >> 8 ) & 0xff) | 0x80;
out[3] = (in & 0xff) | 0x80;
return PR_TRUE;
}
}

Просмотреть файл

@ -117,6 +117,46 @@ PRIVATE PRBool uCheckAndScanAlways4ByteSwap(
PRUint32 inbuflen,
PRUint32* inscanlen
);
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA3(
uShiftTable *shift,
PRInt32* state,
unsigned char *in,
PRUint16 *out,
PRUint32 inbuflen,
PRUint32* inscanlen
);
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA4(
uShiftTable *shift,
PRInt32* state,
unsigned char *in,
PRUint16 *out,
PRUint32 inbuflen,
PRUint32* inscanlen
);
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA5(
uShiftTable *shift,
PRInt32* state,
unsigned char *in,
PRUint16 *out,
PRUint32 inbuflen,
PRUint32* inscanlen
);
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA6(
uShiftTable *shift,
PRInt32* state,
unsigned char *in,
PRUint16 *out,
PRUint32 inbuflen,
PRUint32* inscanlen
);
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA7(
uShiftTable *shift,
PRInt32* state,
unsigned char *in,
PRUint16 *out,
PRUint32 inbuflen,
PRUint32* inscanlen
);
PRIVATE PRBool uScanAlways2Byte(
unsigned char* in,
@ -156,6 +196,11 @@ PRIVATE uScannerFunc m_scanner[uNumOfCharsetType] =
uCheckAndScanAlways2ByteSwap,
uCheckAndScanAlways4Byte,
uCheckAndScanAlways4ByteSwap,
uCheckAndScan2ByteGRPrefix8EA3,
uCheckAndScan2ByteGRPrefix8EA4,
uCheckAndScan2ByteGRPrefix8EA5,
uCheckAndScan2ByteGRPrefix8EA6,
uCheckAndScan2ByteGRPrefix8EA7,
};
/*=================================================================================
@ -460,3 +505,108 @@ PRIVATE PRBool uCheckAndScanAlways4ByteSwap(
return PR_TRUE;
}
}
/*=================================================================================
=================================================================================*/
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA3(
uShiftTable *shift,
PRInt32* state,
unsigned char *in,
PRUint16 *out,
PRUint32 inbuflen,
PRUint32* inscanlen
)
{
if((inbuflen < 4) || (in[0] != 0x8E) || (in[1] != 0xA3))
return PR_FALSE;
else
{
*inscanlen = 4;
*out = (((in[2] << 8) | ( in[3])) & 0x7F7F);
return PR_TRUE;
}
}
/*=================================================================================
=================================================================================*/
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA4(
uShiftTable *shift,
PRInt32* state,
unsigned char *in,
PRUint16 *out,
PRUint32 inbuflen,
PRUint32* inscanlen
)
{
if((inbuflen < 4) || (in[0] != 0x8E) || (in[1] != 0xA4))
return PR_FALSE;
else
{
*inscanlen = 4;
*out = (((in[2] << 8) | ( in[3])) & 0x7F7F);
return PR_TRUE;
}
}
/*=================================================================================
=================================================================================*/
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA5(
uShiftTable *shift,
PRInt32* state,
unsigned char *in,
PRUint16 *out,
PRUint32 inbuflen,
PRUint32* inscanlen
)
{
if((inbuflen < 4) || (in[0] != 0x8E) || (in[1] != 0xA5))
return PR_FALSE;
else
{
*inscanlen = 4;
*out = (((in[2] << 8) | ( in[3])) & 0x7F7F);
return PR_TRUE;
}
}
/*=================================================================================
=================================================================================*/
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA6(
uShiftTable *shift,
PRInt32* state,
unsigned char *in,
PRUint16 *out,
PRUint32 inbuflen,
PRUint32* inscanlen
)
{
if((inbuflen < 4) || (in[0] != 0x8E) || (in[1] != 0xA6))
return PR_FALSE;
else
{
*inscanlen = 4;
*out = (((in[2] << 8) | ( in[3])) & 0x7F7F);
return PR_TRUE;
}
}
/*=================================================================================
=================================================================================*/
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA7(
uShiftTable *shift,
PRInt32* state,
unsigned char *in,
PRUint16 *out,
PRUint32 inbuflen,
PRUint32* inscanlen
)
{
if((inbuflen < 4) || (in[0] != 0x8E) || (in[1] != 0xA7))
return PR_FALSE;
else
{
*inscanlen = 4;
*out = (((in[2] << 8) | ( in[3])) & 0x7F7F);
return PR_TRUE;
}
}

Просмотреть файл

@ -119,6 +119,51 @@ PRIVATE PRBool uCheckAndGenAlways4ByteSwap(
PRUint32 outbuflen,
PRUint32* outlen
);
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA3(
uShiftTable *shift,
PRInt32* state,
PRUint16 in,
unsigned char* out,
PRUint32 outbuflen,
PRUint32* outlen
);
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA4(
uShiftTable *shift,
PRInt32* state,
PRUint16 in,
unsigned char* out,
PRUint32 outbuflen,
PRUint32* outlen
);
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA5(
uShiftTable *shift,
PRInt32* state,
PRUint16 in,
unsigned char* out,
PRUint32 outbuflen,
PRUint32* outlen
);
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA6(
uShiftTable *shift,
PRInt32* state,
PRUint16 in,
unsigned char* out,
PRUint32 outbuflen,
PRUint32* outlen
);
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA7(
uShiftTable *shift,
PRInt32* state,
PRUint16 in,
unsigned char* out,
PRUint32 outbuflen,
PRUint32* outlen
);
PRIVATE PRBool uGenAlways2Byte(
PRUint16 in,
unsigned char* out
@ -157,6 +202,11 @@ PRIVATE uGeneratorFunc m_generator[uNumOfCharsetType] =
uCheckAndGenAlways2ByteSwap,
uCheckAndGenAlways4Byte,
uCheckAndGenAlways4ByteSwap,
uCheckAndGen2ByteGRPrefix8EA3,
uCheckAndGen2ByteGRPrefix8EA4,
uCheckAndGen2ByteGRPrefix8EA5,
uCheckAndGen2ByteGRPrefix8EA6,
uCheckAndGen2ByteGRPrefix8EA7,
};
/*=================================================================================
@ -480,3 +530,118 @@ PRIVATE PRBool uCheckAndGenAlways4ByteSwap(
return PR_TRUE;
}
}
/*=================================================================================
=================================================================================*/
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA3( uShiftTable *shift,
PRInt32* state,
PRUint16 in,
unsigned char* out,
PRUint32 outbuflen,
PRUint32* outlen
)
{
if(outbuflen < 4)
return PR_FALSE;
else
{
*outlen = 4;
out[0] = 0x8E;
out[1] = 0xA3;
out[2] = ((in >> 8 ) & 0xff) | 0x80;
out[3] = (in & 0xff) | 0x80;
return PR_TRUE;
}
}
/*=================================================================================
=================================================================================*/
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA4( uShiftTable *shift,
PRInt32* state,
PRUint16 in,
unsigned char* out,
PRUint32 outbuflen,
PRUint32* outlen
)
{
if(outbuflen < 4)
return PR_FALSE;
else
{
*outlen = 4;
out[0] = 0x8E;
out[1] = 0xA4;
out[2] = ((in >> 8 ) & 0xff) | 0x80;
out[3] = (in & 0xff) | 0x80;
return PR_TRUE;
}
}
/*=================================================================================
=================================================================================*/
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA5( uShiftTable *shift,
PRInt32* state,
PRUint16 in,
unsigned char* out,
PRUint32 outbuflen,
PRUint32* outlen
)
{
if(outbuflen < 4)
return PR_FALSE;
else
{
*outlen = 4;
out[0] = 0x8E;
out[1] = 0xA5;
out[2] = ((in >> 8 ) & 0xff) | 0x80;
out[3] = (in & 0xff) | 0x80;
return PR_TRUE;
}
}
/*=================================================================================
=================================================================================*/
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA6( uShiftTable *shift,
PRInt32* state,
PRUint16 in,
unsigned char* out,
PRUint32 outbuflen,
PRUint32* outlen
)
{
if(outbuflen < 4)
return PR_FALSE;
else
{
*outlen = 4;
out[0] = 0x8E;
out[1] = 0xA6;
out[2] = ((in >> 8 ) & 0xff) | 0x80;
out[3] = (in & 0xff) | 0x80;
return PR_TRUE;
}
}
/*=================================================================================
=================================================================================*/
PRIVATE PRBool uCheckAndGen2ByteGRPrefix8EA7( uShiftTable *shift,
PRInt32* state,
PRUint16 in,
unsigned char* out,
PRUint32 outbuflen,
PRUint32* outlen
)
{
if(outbuflen < 4)
return PR_FALSE;
else
{
*outlen = 4;
out[0] = 0x8E;
out[1] = 0xA7;
out[2] = ((in >> 8 ) & 0xff) | 0x80;
out[3] = (in & 0xff) | 0x80;
return PR_TRUE;
}
}

Просмотреть файл

@ -117,6 +117,46 @@ PRIVATE PRBool uCheckAndScanAlways4ByteSwap(
PRUint32 inbuflen,
PRUint32* inscanlen
);
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA3(
uShiftTable *shift,
PRInt32* state,
unsigned char *in,
PRUint16 *out,
PRUint32 inbuflen,
PRUint32* inscanlen
);
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA4(
uShiftTable *shift,
PRInt32* state,
unsigned char *in,
PRUint16 *out,
PRUint32 inbuflen,
PRUint32* inscanlen
);
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA5(
uShiftTable *shift,
PRInt32* state,
unsigned char *in,
PRUint16 *out,
PRUint32 inbuflen,
PRUint32* inscanlen
);
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA6(
uShiftTable *shift,
PRInt32* state,
unsigned char *in,
PRUint16 *out,
PRUint32 inbuflen,
PRUint32* inscanlen
);
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA7(
uShiftTable *shift,
PRInt32* state,
unsigned char *in,
PRUint16 *out,
PRUint32 inbuflen,
PRUint32* inscanlen
);
PRIVATE PRBool uScanAlways2Byte(
unsigned char* in,
@ -156,6 +196,11 @@ PRIVATE uScannerFunc m_scanner[uNumOfCharsetType] =
uCheckAndScanAlways2ByteSwap,
uCheckAndScanAlways4Byte,
uCheckAndScanAlways4ByteSwap,
uCheckAndScan2ByteGRPrefix8EA3,
uCheckAndScan2ByteGRPrefix8EA4,
uCheckAndScan2ByteGRPrefix8EA5,
uCheckAndScan2ByteGRPrefix8EA6,
uCheckAndScan2ByteGRPrefix8EA7,
};
/*=================================================================================
@ -460,3 +505,108 @@ PRIVATE PRBool uCheckAndScanAlways4ByteSwap(
return PR_TRUE;
}
}
/*=================================================================================
=================================================================================*/
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA3(
uShiftTable *shift,
PRInt32* state,
unsigned char *in,
PRUint16 *out,
PRUint32 inbuflen,
PRUint32* inscanlen
)
{
if((inbuflen < 4) || (in[0] != 0x8E) || (in[1] != 0xA3))
return PR_FALSE;
else
{
*inscanlen = 4;
*out = (((in[2] << 8) | ( in[3])) & 0x7F7F);
return PR_TRUE;
}
}
/*=================================================================================
=================================================================================*/
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA4(
uShiftTable *shift,
PRInt32* state,
unsigned char *in,
PRUint16 *out,
PRUint32 inbuflen,
PRUint32* inscanlen
)
{
if((inbuflen < 4) || (in[0] != 0x8E) || (in[1] != 0xA4))
return PR_FALSE;
else
{
*inscanlen = 4;
*out = (((in[2] << 8) | ( in[3])) & 0x7F7F);
return PR_TRUE;
}
}
/*=================================================================================
=================================================================================*/
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA5(
uShiftTable *shift,
PRInt32* state,
unsigned char *in,
PRUint16 *out,
PRUint32 inbuflen,
PRUint32* inscanlen
)
{
if((inbuflen < 4) || (in[0] != 0x8E) || (in[1] != 0xA5))
return PR_FALSE;
else
{
*inscanlen = 4;
*out = (((in[2] << 8) | ( in[3])) & 0x7F7F);
return PR_TRUE;
}
}
/*=================================================================================
=================================================================================*/
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA6(
uShiftTable *shift,
PRInt32* state,
unsigned char *in,
PRUint16 *out,
PRUint32 inbuflen,
PRUint32* inscanlen
)
{
if((inbuflen < 4) || (in[0] != 0x8E) || (in[1] != 0xA6))
return PR_FALSE;
else
{
*inscanlen = 4;
*out = (((in[2] << 8) | ( in[3])) & 0x7F7F);
return PR_TRUE;
}
}
/*=================================================================================
=================================================================================*/
PRIVATE PRBool uCheckAndScan2ByteGRPrefix8EA7(
uShiftTable *shift,
PRInt32* state,
unsigned char *in,
PRUint16 *out,
PRUint32 inbuflen,
PRUint32* inscanlen
)
{
if((inbuflen < 4) || (in[0] != 0x8E) || (in[1] != 0xA7))
return PR_FALSE;
else
{
*inscanlen = 4;
*out = (((in[2] << 8) | ( in[3])) & 0x7F7F);
return PR_TRUE;
}
}