%%{
machine decode_object;
write data;
alphtype unsigned char;
}%%
bool decode_object(unsigned char *decode_data, int len)
{
int content_type = 0;
unsigned char *p = str, *pe = decode_data + len, *eof = pe;
unsigned char* p_code_beg = decode_data;
int cs;
%%{
action lc{p_code_beg = p;}
action lv_atomic_code{}
action lv_object_open{}
action lv_object_close{}
action lv_escape_254{}
action lv_field_begin{}
action lv_escape_255{}
atomic_code = (0..253) %lv_atomic_code %lc;
object_index = (0..254 0..255)
|(255 0..253);
object_open = (254 object_index) %lv_object_open %lc;
object_close = (254 255 254) %lv_object_close %lc;
escape_254 = (254 255 255) %lv_escape_254 %lc;
field_index = 0..254;
field_begin = (255 field_index) %lv_field_begin %lc;
escape_255 = (255 255) %lv_escape_255 %lc;
main := (atomic_code | object_open | object_close | escape_254 | field_begin | escape_255)+;
# Initialize and execute.
write init;
write exec;
}%%
if(cs < decode_object_first_final)
return false;
return true;
}