/*
$Id: Unicode.xs,v 1.9 2003/12/29 02:47:16 dankogai Exp dankogai $
*/
#define PERL_NO_GET_CONTEXT
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#define FBCHAR 0xFFFd
#define BOM_BE 0xFeFF
#define BOM16LE 0xFFFe
#define BOM32LE 0xFFFe0000
static UV
{
UV v = 0;
if (s+size > e) {
}
switch(endian) {
case 'N':
v = *s++;
v = (v << 8) | *s++;
case 'n':
v = (v << 8) | *s++;
v = (v << 8) | *s++;
break;
case 'V':
case 'v':
v |= *s++;
v |= (*s++ << 8);
if (endian == 'v')
break;
v |= (*s++ << 16);
v |= (*s++ << 24);
break;
default:
break;
}
*sp = s;
return v;
}
void
{
switch(endian) {
case 'v':
case 'V':
while (size--) {
value >>= 8;
}
break;
case 'n':
case 'N':
while (size--) {
value >>= 8;
}
break;
default:
break;
}
}
void
CODE:
{
endian = 'v';
}
endian = 'V';
}
else {
bom);
}
}
#if 1
/* Update endian for next sequence */
if (clone) {
}
#endif
}
while (s < e && s+size <= e) {
U8 *d;
if (ucs2) {
if (check) {
ord);
}
if (s+size <= e) {
/* skip the next one as well */
}
}
else {
if (!isHiSurrogate(ord)) {
ord);
}
if (s+size > e) {
/* Partial character */
s -= size; /* back up to 1st half */
break; /* And exit loop */
}
if (!isLoSurrogate(lo)){
ord);
}
}
}
}
if (s < e) {
/* unlikely to happen because it's fixed-length -- dankogai */
if (check & ENCODE_WARN_ON_ERR){
}
}
if (s < e) {
}
else {
}
}
XSRETURN(1);
}
void
CODE:
{
if (!endian) {
#if 1
/* Update endian for next sequence */
if (clone){
}
#endif
}
while (s < e && s+UTF8SKIP(s) <= e) {
s += len;
if (!issurrogate(ord)){
if (ucs2) {
if (check) {
}
}else{
}
}
else {
/* not supposed to happen */
}
}
else {
}
}
if (s < e) {
/* UTF-8 partial char happens often on PerlIO.
Since this is okay and normal, we do not warn.
But this is critical when you choose to LEAVE_SRC
in which case we die */
"when CHECK = 0x%" UVuf,
}
}
if (s < e) {
}
else {
}
}
XSRETURN(1);
}