/* occ : C CODE OF AUTOMATON Example1 */

/* AUXILIARY DECLARATIONS */

#ifndef STRLEN 
#define STRLEN 81 
#endif 
#define _COND(A,B,C) ((A)?(B):(C)) 
#ifdef TRACE_ACTION 
#include <stdio.h> 
#endif 
#ifndef NULL 
#define NULL ((char*)0) 
#endif 

#ifndef __EXEC_STATUS_H_LOADED 
#define __EXEC_STATUS_H_LOADED 

typedef struct {
unsigned int start:1;
unsigned int kill:1;
unsigned int active:1;
unsigned int suspended:1;
unsigned int prev_active:1;
unsigned int prev_suspended:1;
unsigned int exec_index;
unsigned int task_exec_index;
void (*pStart)();
void (*pRet)();
} __ExecStatus;

#endif 
#define __ResetExecStatus(status) {\ 
   status.prev_active = status.active; \
   status.prev_suspended = status.suspended; \
   status.start = status.kill = status.active = status.suspended = 0; }
#define __DSZ(V) (--(V)<=0) 
static int __Example1_engine();
#define __BASIC_ACT(i) (*__Example1_PActionArray[i])() 
#ifdef TRACE_ACTION 
#define __ACT(i) fprintf(stderr, "__Example1_A%d\n", i);__BASIC_ACT(i) 
#else 
#define __ACT(i) __BASIC_ACT(i) 
#endif 
#define BASIC_TYPES_DEFINED 
typedef int boolean;
typedef int integer;
typedef char* string;
#define _true 1 
#define _false 0 
#define __Example1_GENERIC_TEST(TEST) {if (TEST) __Example1_cp++; else __Example1_cp += *__Example1_cp;} 
typedef unsigned char  __Example1_indextype;
typedef void (*__Example1_APF)();
static __Example1_APF *__Example1_PActionArray;

#include "example1.h" 

/* EXTERN DECLARATIONS */

#ifndef _NO_EXTERN_DEFINITIONS 
#endif 

/* INITIALIZED CONSTANTS */

/* MEMORY ALLOCATION */

static boolean __Example1_V0;
static boolean __Example1_V1;


/* INPUT FUNCTIONS */

void Example1_I_SW1_ASSERTED () {
__Example1_V0 = _true;
}
void Example1_I_SW2_ASSERTED () {
__Example1_V1 = _true;
}

/* FUNCTIONS RETURNING NUMBER OF EXEC */

int Example1_number_of_execs () {
return (0);
}


/* AUTOMATON (STATE ACTION-TREES) */

static __Example1_indextype __Example1_sct0 [] = {
0,0
};
static __Example1_indextype __Example1_sct1 [] = {
0,2
};
static __Example1_indextype __Example1_sct2 [] = {
4,3,0,3,0,2
};
static __Example1_indextype __Example1_sct3 [] = {
5,4,6,0,0,0,3
};
static __Example1_indextype* __Example1_dct [] = {
(__Example1_indextype*)0 /* no-sub-dags */
};
static __Example1_indextype* __Example1_sct [] = {
__Example1_sct0,
 __Example1_sct1,
 __Example1_sct2,
 __Example1_sct3
};

static __Example1_indextype* __Example1_cp = __Example1_sct1;

/* ACTIONS */

/* PREDEFINED ACTIONS */

static void __Example1_A1 () {
extern __Example1_indextype* __Example1_dct[];
__Example1_indextype* old_cp = __Example1_cp + 1;
__Example1_cp = __Example1_dct[*__Example1_cp];
__Example1_engine();
__Example1_cp = old_cp;
}
static void __Example1_A2 () {
extern __Example1_indextype* __Example1_dct[];
__Example1_cp = __Example1_dct[*__Example1_cp];
}
static void __Example1_A3 () {
__Example1_GENERIC_TEST(_false);
}

/* PRESENT SIGNAL TESTS */

static void __Example1_A4 () {
__Example1_GENERIC_TEST(__Example1_V0);
}
static void __Example1_A5 () {
__Example1_GENERIC_TEST(__Example1_V1);
}

/* OUTPUT ACTIONS */

static void __Example1_A6 () {
Example1_O_LED1_ASSERT();
}

/* ASSIGNMENTS */

static void __Example1_A7 () {
__Example1_V0 = _false;
}
static void __Example1_A8 () {
__Example1_V1 = _false;
}

/* PROCEDURE CALLS */

/* CONDITIONS */

/* DECREMENTS */

/* START ACTIONS */

/* KILL ACTIONS */

/* SUSPEND ACTIONS */

/* ACTIVATE ACTIONS */

/* WRITE ARGS ACTIONS */

/* RESET ACTIONS */

/* ACTION SEQUENCES */

/* THE ACTION ARRAY */

static __Example1_APF __Example1_ActionArray[] = {
0,
(__Example1_APF)__Example1_A1,
(__Example1_APF)__Example1_A2,
(__Example1_APF)__Example1_A3,
(__Example1_APF)__Example1_A4,
(__Example1_APF)__Example1_A5,
(__Example1_APF)__Example1_A6,
(__Example1_APF)__Example1_A7,
(__Example1_APF)__Example1_A8
};
static __Example1_APF *__Example1_PActionArray  = __Example1_ActionArray;


static void __Example1__reset_input () {
__Example1_V0 = _false;
__Example1_V1 = _false;
}

/* AUTOMATON ENGINE */

static int __Example1_engine () {
register __Example1_indextype x;
while (x = *(__Example1_cp++)) {
__ACT(x);
}
return *__Example1_cp;
}

int Example1 () {
int x;
x = __Example1_engine();
__Example1_cp = __Example1_sct[x];
__Example1__reset_input();
return x!=0;
}

/* AUTOMATON RESET */

int Example1_reset () {
__Example1_cp = __Example1_sct1;
__Example1__reset_input();
return 0;
}