/* Generated by re2c */
#line 1 "encodings/unicode_group_Cs_8_encoding_policy_substitute.re"
// re2c $INPUT -o $OUTPUT -8 --encoding-policy substitute
#include <stdio.h>
#include "utf8.h"
#define YYCTYPE unsigned char
bool scan(const YYCTYPE * start, const YYCTYPE * const limit)
{
	__attribute__((unused)) const YYCTYPE * YYMARKER; // silence compiler warnings when YYMARKER is not used
#	define YYCURSOR start
Cs:
	
#line 14 "encodings/unicode_group_Cs_8_encoding_policy_substitute.c"
{
	YYCTYPE yych;
	yych = *YYCURSOR;
	switch (yych) {
		case 0xEF: goto yy3;
		default: goto yy1;
	}
yy1:
	++YYCURSOR;
yy2:
#line 14 "encodings/unicode_group_Cs_8_encoding_policy_substitute.re"
	{ return YYCURSOR == limit; }
#line 27 "encodings/unicode_group_Cs_8_encoding_policy_substitute.c"
yy3:
	yych = *(YYMARKER = ++YYCURSOR);
	switch (yych) {
		case 0xBF: goto yy4;
		default: goto yy2;
	}
yy4:
	yych = *++YYCURSOR;
	switch (yych) {
		case 0xBD: goto yy6;
		default: goto yy5;
	}
yy5:
	YYCURSOR = YYMARKER;
	goto yy2;
yy6:
	++YYCURSOR;
#line 13 "encodings/unicode_group_Cs_8_encoding_policy_substitute.re"
	{ goto Cs; }
#line 47 "encodings/unicode_group_Cs_8_encoding_policy_substitute.c"
}
#line 15 "encodings/unicode_group_Cs_8_encoding_policy_substitute.re"

}
static const unsigned int chars_Cs [] = {0xd800,0xdfff,  0x0,0x0};
static unsigned int encode_utf8 (const unsigned int * ranges, unsigned int ranges_count, unsigned int * s)
{
	unsigned int * const s_start = s;
	for (unsigned int i = 0; i < ranges_count - 2; i += 2)
		for (unsigned int j = ranges[i]; j <= ranges[i + 1]; ++j)
			s += re2c::utf8::rune_to_bytes (s, j);
	re2c::utf8::rune_to_bytes (s, ranges[ranges_count - 1]);
	return s - s_start + 1;
}

int main ()
{
	unsigned int * buffer_Cs = new unsigned int [8196];
	YYCTYPE * s = (YYCTYPE *) buffer_Cs;
	unsigned int buffer_len = encode_utf8 (chars_Cs, sizeof (chars_Cs) / sizeof (unsigned int), buffer_Cs);
	/* convert 32-bit code units to YYCTYPE; reuse the same buffer */
	for (unsigned int i = 0; i < buffer_len; ++i) s[i] = buffer_Cs[i];
	if (!scan (s, s + buffer_len))
		printf("test 'Cs' failed\n");
	delete [] buffer_Cs;
	return 0;
}
