Added a simple main for the example

This commit is contained in:
Cédric Pasteur 2011-09-06 15:01:33 +02:00
parent eec957cc6a
commit 880303b1cf
2 changed files with 58 additions and 2 deletions

View file

@ -32,8 +32,10 @@ for f in ${sources[@]}; do
$HEPTC $HEPTC_OPTIONS -target c $f
done
#$HEPTC $HEPTC_OPTIONS -target c -s dv_fighterdebug debug.ept
source_dirs=(debug_c dv_c digital_c math_c mc_c trackslib_c verif_c typeBase_c typeTracks_c typeArray_c cstArrayInit_c cstBaseInit_c cstPhysics_c cstTracksInit_c mc_TypeInputs_c mc_TypeLists_c mc_TypeSensors_c)
other_files=(mathext.c mathext.h mc_ext.c mc_ext.h)
other_files=(mathext.c mathext.h mc_ext.c mc_ext.h main.c)
if [ -d _build ]; then
rm -r _build
fi
@ -47,6 +49,8 @@ for f in ${other_files[@]}; do
cp ../$f .
done
$GCC $GCC_OPTIONS *.c
$GCC $GCC_OPTIONS *.c -o mission_control
cp mission_control ..
cd ..

View file

@ -0,0 +1,52 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "debug.h"
void print_mission_track(TypeArray__tmissiontracksarray mt) {
for(int i = 0; i < TypeArray__ksizemissiontracksarray; i++) {
printf("track nb %d\n", i);
printf("pos: x=%f -- y=%f \n", mt[i].m_pos.x, mt[i].m_pos.y);
printf("speed: sx=%f -- sy=%f\n", mt[i].m_speed.sx, mt[i].m_speed.sy);
}
}
int main(int argc, char** argv) {
int step_c;
int step_max;
Debug__fighterdebug_mem _mem;
Debug__fighterdebug_out _res;
int res;
int rdronoffclicked;
int iffonoffclicked;
step_c = 0;
step_max = 0;
if ((argc==2)) {
step_max = atoi(argv[1]);
};
Debug__fighterdebug_reset(&_mem);
while ((!(step_max)||(step_c<step_max))) {
step_c = (step_c+1);
printf("res ? ");
scanf("%d", &res);;
printf("rdronoffclicked ? ");
scanf("%d", &rdronoffclicked);;
printf("iffonoffclicked ? ");
scanf("%d", &iffonoffclicked);;
Debug__fighterdebug_step(res, rdronoffclicked, iffonoffclicked, &_res,
&_mem);
printf("=> \n");
print_mission_track(_res.missiontracks);
puts("");
fflush(stdout);
};
return 0;
}