aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-05-08 21:49:28 +0200
committerDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-05-08 21:49:28 +0200
commit40792aaf58a5b30ce044803806563ff93169580a (patch)
tree3dff8afa966c16f4a3259aaae557efd1485a9fe0
parenta6fe46753f691329ace81391e2fa9406dd4ee726 (diff)
downloadcompcert-kvx-40792aaf58a5b30ce044803806563ff93169580a.tar.gz
compcert-kvx-40792aaf58a5b30ce044803806563ff93169580a.zip
removed print statements
-rw-r--r--test/monniaux/lustre-convertible/convertible_main_loop.c99
1 files changed, 18 insertions, 81 deletions
diff --git a/test/monniaux/lustre-convertible/convertible_main_loop.c b/test/monniaux/lustre-convertible/convertible_main_loop.c
index d64a4677..f2c1f25a 100644
--- a/test/monniaux/lustre-convertible/convertible_main_loop.c
+++ b/test/monniaux/lustre-convertible/convertible_main_loop.c
@@ -5,9 +5,9 @@
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
+#include <stdint.h>
#include "convertible_main.h"
-/* Print a promt ? ************************/
-static int ISATTY;
+
/* MACROS DEFINITIONS ****************/
#ifndef TT
#define TT "1"
@@ -22,87 +22,26 @@ static int ISATTY;
/* set this macro for testing output clocks */
#endif
+static uint32_t dm_random_uint32(void) {
+ static uint32_t current=UINT32_C(0xDEADBEEF);
+ current = ((uint64_t) current << 6) % UINT32_C(4294967291);
+ return current;
+}
+
/* Standard Input procedures **************/
_boolean _get_bool(char* n){
- char b[512];
- _boolean r = 0;
- int s = 1;
- char c;
- do {
- if(ISATTY) {
- if((s != 1)||(r == -1)) printf("\a");
- // printf("%s (1,t,T/0,f,F) ? ", n);
- }
- if(scanf("%s", b)==EOF) exit(0);
- if (*b == 'q') exit(0);
- s = sscanf(b, "%c", &c);
- r = -1;
- if((c == '0') || (c == 'f') || (c == 'F')) r = 0;
- if((c == '1') || (c == 't') || (c == 'T')) r = 1;
- } while((s != 1) || (r == -1));
- return r;
+ return dm_random_uint32() & 1;
}
+/*
_integer _get_int(char* n){
- char b[512];
- _integer r;
- int s = 1;
- do {
- if(ISATTY) {
- if(s != 1) printf("\a");
- //printf("%s (integer) ? ", n);
- }
- if(scanf("%s", b)==EOF) exit(0);
- if (*b == 'q') exit(0);
- s = sscanf(b, "%d", &r);
- } while(s != 1);
- return r;
+ return (_integer) (dm_random_uint32() % 21) - 10;
}
-#define REALFORMAT ((sizeof(_real)==8)?"%lf":"%f")
+*/
_real _get_real(char* n){
- char b[512];
- _real r;
- int s = 1;
- do {
- if(ISATTY) {
- if(s != 1) printf("\a");
- //printf("%s (real) ? ", n);
- }
- if(scanf("%s", b)==EOF) exit(0);
- if (*b == 'q') exit(0);
- s = sscanf(b, REALFORMAT, &r);
- } while(s != 1);
- return r;
-}
-/* Standard Output procedures **************/
-void _put_bottom(char* n){
- if(ISATTY) printf("%s = ", n);
- printf("%s ", BB);
- if(ISATTY) printf("\n");
-}
-void _put_bool(char* n, _boolean _V){
- if(ISATTY) printf("%s = ", n);
- printf("%s ", (_V)? TT : FF);
- if(ISATTY) printf("\n");
-}
-void _put_int(char* n, _integer _V){
- if(ISATTY) printf("%s = ", n);
- printf("%d ", _V);
- if(ISATTY) printf("\n");
-}
-void _put_real(char* n, _real _V){
- if(ISATTY) printf("%s = ", n);
- printf("%f ", _V);
- if(ISATTY) printf("\n");
+ return ((_integer) (dm_random_uint32() % 2000001) - 1000000)*1E-6;
}
/* Output procedures **********************/
-#ifdef CKCHECK
-void %s_BOT_n(void* cdata){
- _put_bottom("n");
-}
-#endif
-/* Output procedures **********************/
void convertible_main_O_n(void* cdata, _integer _V) {
- _put_int("n", _V);
}
/* Main procedure *************************/
int main(){
@@ -120,15 +59,13 @@ int main(){
_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 */
- ISATTY = isatty(0);
- while(1){
- if (ISATTY) printf("#step %d \n", _s+1);
- else if(_s) printf("\n");
- fflush(stdout);
+ for(int count=0; count<1000; count++){
++_s;
Start = _get_bool("Start");
Parked = _get_bool("Parked");
@@ -139,7 +76,7 @@ int main(){
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);
+ // printf("%d %d %f %f\n",Danger,Locked,Speed,Hood_Speed);
}
return 1;