/*
	WARNING: This file was generated by dkct.
	Changes you make here will be lost if dkct is run again!
	You should modify the original source and run dkct on it.
	Original source: test-dkct.ctr
*/

/*
Copyright (C) 2011-2013, Dirk Krause

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice,
  this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above opyright notice,
  this list of conditions and the following disclaimer in the documentation
  and/or other materials provided with the distribution.
* Neither the name of the author nor the names of contributors may be used
  to endorse or promote products derived from this software without specific
  prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

/**	@file test-dkct.c The test-dkct module.
*/

/** @defgroup dkct_state_machine_test The test state machine. */
/**@{*/

#ifndef S_ERROR
/** State: Error occured. */
#line 39 "test-dkct.ctr"
#define S_ERROR 2
#else
#line 39 "test-dkct.ctr"
#error "Redefinition of S_ERROR"
#endif

#ifndef S_FOUND
/** State: Data was found. */
#line 38 "test-dkct.ctr"
#define S_FOUND 1
#else
#line 38 "test-dkct.ctr"
#error "Redefinition of S_FOUND"
#endif

#ifndef S_START
/** State: Start state. */
#line 37 "test-dkct.ctr"
#define S_START 0
#else
#line 37 "test-dkct.ctr"
#error "Redefinition of S_START"
#endif

#ifndef I_ANY
/** State machine input: Anything not mentioned below. */
#line 42 "test-dkct.ctr"
#define I_ANY 0
#else
#line 42 "test-dkct.ctr"
#error "Redefinition of I_ANY"
#endif

#ifndef I_CHARACTER
/** State machine input: Character. */
#line 44 "test-dkct.ctr"
#define I_CHARACTER 1
#else
#line 44 "test-dkct.ctr"
#error "Redefinition of I_CHARACTER"
#endif

#ifndef I_DIGIT
/** State machine input: Digit. */
#line 45 "test-dkct.ctr"
#define I_DIGIT 2
#else
#line 45 "test-dkct.ctr"
#error "Redefinition of I_DIGIT"
#endif

#ifndef I_END
/** State machine input: End of input. */
#line 46 "test-dkct.ctr"
#define I_END 3
#else
#line 46 "test-dkct.ctr"
#error "Redefinition of I_END"
#endif

#ifndef I_UNDERSCORE
/** State machine input: Underscore. */
#line 43 "test-dkct.ctr"
#define I_UNDERSCORE 4
#else
#line 43 "test-dkct.ctr"
#error "Redefinition of I_UNDERSCORE"
#endif

#ifndef O_ERROR
/** State machine output: Error occured. */
#line 50 "test-dkct.ctr"
#define O_ERROR 0
#else
#line 50 "test-dkct.ctr"
#error "Redefinition of O_ERROR"
#endif

#ifndef O_OK
/** State machine output: OK. */
#line 49 "test-dkct.ctr"
#define O_OK 1
#else
#line 49 "test-dkct.ctr"
#error "Redefinition of O_OK"
#endif

/**@}*/

/**	Reset test state machine.
	@param	st	Pointer to state variable.
*/
static
void
test_reset(int *st)
{
  if(st) { *st = S_START; }
}

/**	State machine test step.
	@param	st	Pointer to state variable.
	@param	in	Input.
	@return	Transition output.
*/
static
int
test_step(int *st, int in)
{
  int back = O_ERROR;
  if(st) {
    int os;
    int nf = 1;
    int ns = S_ERROR;
    os = *st;
    switch(os) {
      case S_FOUND: {
        switch(in) {
          case I_CHARACTER: {
            ns = S_FOUND; back = O_OK; nf = 0;
          } break;
          case I_DIGIT: {
            ns = S_FOUND; back = O_OK; nf = 0;
          } break;
          case I_END: {
            ns = S_START; back = O_OK; nf = 0;
          } break;
          case I_UNDERSCORE: {
            ns = S_FOUND; back = O_OK; nf = 0;
          } break;
        }
      } break;
      case S_START: {
        switch(in) {
          case I_CHARACTER: {
            ns = S_FOUND; back = O_OK; nf = 0;
          } break;
          case I_UNDERSCORE: {
            ns = S_FOUND; back = O_OK; nf = 0;
          } break;
        }
      } break;
    }
    if(nf) {
      if(in == I_END) {
      ns = S_START; back = O_ERROR;
      } else {
      }
    }
    *st = ns;
  } else {
  }
  return back;
}


#line 64 "test-dkct.ctr"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#include "dk3all.h"



#line 71 "test-dkct.ctr"


/* ************************************************************************ */
/* *                                                                      * */
/* * Here we have some comments in a box.                                 * */
/* * We      use     tabulators      too.                                 * */
/* *                                                                      * */
/* ************************************************************************ */


#line 77 "test-dkct.ctr"


dkChar const * const mymessages[] = {
/* 0 */
dkT("Hello"),

/* 1 */
dkT("Goodbye"),

NULL


#line 90 "test-dkct.ctr"
};



int
testfct(int a, int b)
{
  int back;
  

#line 99 "test-dkct.ctr"
  back = a + b;	

#line 100 "test-dkct.ctr"
  return back;
}



int main(int argc, char *argv[])
{
  int i, j, k;
  

#line 109 "test-dkct.ctr"
  for(i = 0; i < 5; i++) {
    for(j = 0; j < 5; j++) {
      k = testfct(i, j);
    }
  }
  

#line 115 "test-dkct.ctr"
  exit(0); return 0;
}


