6 * Test a high character to make sure signedness
11 #include <objc/Object.h>
13 @interface Fsm : Object
19 // Initialize the machine. Invokes any init statement blocks. Returns 0
20 // if the machine begins in a non-accepting state and 1 if the machine
21 // begins in an accepting state.
24 // Execute the machine on a block of data. Returns -1 if after processing
25 // the data, the machine is in the error state and can never accept, 0 if
26 // the machine is in a non-accepting state and 1 if the machine is in an
28 - (void) executeWithData:(const unsigned char *)data len:(int)len;
30 // Indicate that there is no more data. Returns -1 if the machine finishes
31 // in the error state and does not accept, 0 if the machine finishes
32 // in any other non-accepting state and 1 if the machine finishes in an
43 alphtype unsigned char;
45 # Indicate we got the high character.
50 main := 0xe8 @gothigh '\n';
61 - (void) executeWithData:(const unsigned char *)_data len:(int)_len;
63 const unsigned char *p = _data;
64 const unsigned char *pe = _data + _len;
71 if ( cs == Fsm_error )
73 else if ( cs >= Fsm_first_final )
85 unsigned char buf[BUFSIZE];
87 void test( unsigned char *buf, int len )
89 fsm = [[Fsm alloc] init];
91 [fsm executeWithData:buf len:len];
92 if ( [fsm finish] > 0 )
98 unsigned char data1[] = { 0xe8, 10 };
99 unsigned char data2[] = { 0xf8, 10 };
108 #ifdef _____OUTPUT_____