aboutsummaryrefslogtreecommitdiffstats
path: root/test/monniaux/lustrev6-carlightV2/carlightV2_carlight_loop.c
blob: a9b4417ac023d91f8093afef70180c153ee7a498 (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
/* This file was generated by lv6 version master.737 (2727a7744111c84f7984634d2bd3ad6f7c6c7ff9). */
/*  lv6 carlightV2.lus -n carlight --to-c */
/* on vanoise the 08/05/2019 at 22:54:09 */

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include "carlightV2_carlight.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;  
}

/* Main procedure *************************/
int main(){
  int _s = 0;
  _integer switch_pos;
  _real intensity;
  _boolean is_on;
    carlightV2_carlight_ctx_type* ctx = carlightV2_carlight_ctx_new_ctx(NULL);

  /* Main loop */
  clock_prepare();
  clock_start();

  for(int count=0; count<1000; count++){
    ++_s;
     switch_pos = _get_int("switch_pos");
     intensity = _get_real("intensity");
    carlightV2_carlight_step(switch_pos,intensity,&is_on,ctx);
    // printf("%d %f #outs %d\n",switch_pos,intensity,is_on);
    // printf("%d\n",is_on);
  }
  
  clock_stop();
  print_total_clock();
  
  return 0;  
}