aboutsummaryrefslogtreecommitdiffstats
path: root/test/monniaux/lustrev6-convertible/convertible_main_loop.c
blob: 46e94cd18527363113898a5554cd4cc9a11dcaff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/* This file was generated by lus2lic version master.668 (35901e970a0c377cc36d6437dcbc61beb8001b54). */
/*  lus2lic -2c convertible.lus -n main */
/* on ovaz the 27/10/2016 at 11:39:07 */

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <stdint.h>
#include "convertible_main.h" 
#include "../clock.h"
#include "../dm_random.c"

/* MACROS DEFINITIONS ****************/
#ifndef TT
#define TT "1"
#endif
#ifndef FF
#define FF "0"
#endif
#ifndef BB
#define BB "bottom"
#endif
#ifdef CKCHECK
/* set this macro for testing output clocks */
#endif

/* Standard Input procedures **************/
_boolean _get_bool(char* n){
  return dm_random_uint32() & 1;
}
/*
_integer _get_int(char* n){
  return (_integer) (dm_random_uint32() % 21) - 10;
}
*/
_real _get_real(char* n){
  return ((_integer) (dm_random_uint32() % 2000001) - 1000000)*1E-6;  
}
/* Output procedures **********************/
void convertible_main_O_n(void* cdata, _integer _V) {
}
/* Main procedure *************************/
int main(){
  int _s = 0;
  _boolean Start;
  _boolean Parked;
  _boolean Rot;
  _boolean Tic;
  _boolean OnOff;
  _boolean Done;
  _real Distance;
  _boolean Danger;
  _boolean Locked;
  _real Speed;
  _real Hood_Speed;
    convertible_main_ctx_type* ctx = convertible_main_ctx_new_ctx(NULL);

#if 0
  printf("#inputs \"Start\":bool \"Parked\":bool \"Rot\":bool \"Tic\":bool \"OnOff\":bool \"Done\":bool \"Distance\":real\n");
  printf("#outputs \"Danger\":bool \"Locked\":bool \"Speed\":real \"Hood_Speed\":real\n");
#endif
  
  /* Main loop */
  clock_prepare();
  clock_start();
  
  for(int count=0; count<1000; count++){
    ++_s;
    Start = _get_bool("Start");
    Parked = _get_bool("Parked");
    Rot = _get_bool("Rot");
    Tic = _get_bool("Tic");
    OnOff = _get_bool("OnOff");
    Done = _get_bool("Done");
    Distance = _get_real("Distance");
    convertible_main_step(Start,Parked,Rot,Tic,OnOff,Done,Distance,&Danger,&Locked,&Speed,&Hood_Speed,ctx);
    // printf("%d %d %d %d %d %d %f #outs %d %d %f %f\n",Start,Parked,Rot,Tic,OnOff,Done,Distance,Danger,Locked,Speed,Hood_Speed);
    // printf("%d %d %f %f\n",Danger,Locked,Speed,Hood_Speed);
  }

  clock_stop();
  print_total_clock();
  
  return 0;
   
}