Commit c2ede186 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Merge pull request #31 from lattuada/master

C Backend
parents 2b77c93e 5c8a87a0
......@@ -13,6 +13,11 @@ test-ada: myfunction.ali dataview-uniq.o | test_ada.o
$(GNATLINK) -o test_ada test_ada.o myfunction.ali -lgnat
./test_ada | diff expected -
test-c: myfunction.c test_c.o dataview-uniq.o
$(CC) myfunction.c -c -o myfunction.o
$(CC) test_c.o myfunction.c -lm -o test_c
./test_c | diff expected_c -
test-llvm: myfunction.o dataview-uniq.o | test_llvm.o
$(CC) myfunction.o dataview-uniq.o test_llvm.o -o test_llvm -lm
./test_llvm | diff expected -
......@@ -20,4 +25,4 @@ test-llvm: myfunction.o dataview-uniq.o | test_llvm.o
coverage:
coverage run -p $(OPENGEODE) myfunction.pr system_structure.pr --toAda
.PHONY: all edit test-parse test-ada test-llvm coverage
\ No newline at end of file
.PHONY: all edit test-parse test-ada test-llvm coverage
[C Code] Running test
0
1
2
3
0
1
2
3
-3
FALSE
abc
abc
Hello!
Hello!!!!
Hello!
0
-2 is FALSE
2 2 1
FALSE TRUE
13 14
OK
[C] result_data: 6
Hello Toto 5
[C] SET MyTimer: 1000
1.500000 ** 2 == 2.250000 (should be 2.25 )
timer expired
......@@ -37,7 +37,7 @@ dcl VeryTrue t_boolean := not false;
/* CIF PROCEDURE (1172, 490), (104, 35) */
PROCEDURE factorial;
/* CIF TEXT (29, 42), (269, 53) */
fpar in N MyInteger,
fpar in n MyInteger,
in/out result MyInteger;
/* CIF ENDTEXT */
/* CIF START (298, 33), (70, 35) */
......@@ -197,4 +197,4 @@ be evaluated.';
/* CIF NEXTSTATE (494, 2065), (70, 33) */
NEXTSTATE wait;
ENDSTATE;
ENDPROCESS myfunction;
\ No newline at end of file
ENDPROCESS myfunction;
#include <signal.h>
#include "dataview-uniq.h"
void result_data(long long *val)
{
printf("[C] result_data: %lld\n", *val);
}
volatile sig_atomic_t keep_going = 1;
void timer_expired()
{
mytimer();
keep_going = 0;
}
void SET_mytimer(asn1SccT_Int32 *val)
{
printf("[C] SET MyTimer: %d\n", *val);
alarm(((int)*val) / 1000);
}
int main()
{
asn1SccT_Int32 test = 5;
signal(SIGALRM, timer_expired);
printf("[C Code] Running test\n");
CInit();
runTransition(0);
start_something(&test);
while (keep_going);
return 0;
}
......@@ -10,9 +10,12 @@ test-parse:
test-ada: orchestrator.ali
test-c: orchestrator.c
$(CC) -c orchestrator.c
test-llvm: orchestrator.o
coverage:
coverage run -p $(OPENGEODE) orchestrator.pr system_structure.pr --toAda
.PHONY: all edit test-parse test-ada test-llvm coverage
\ No newline at end of file
.PHONY: all edit test-parse test-ada test-llvm coverage
......@@ -13,6 +13,11 @@ test-ada: orchestrator.ali dataview-uniq.o | test_ada.o
$(GNATLINK) -o test_ada test_ada.o orchestrator.ali -lgnat
./test_ada | diff expected -
test-c: orchestrator.c test_c.o dataview-uniq.o
$(CC) orchestrator.c -c -o orchestrator.o
$(CC) test_c.o orchestrator.c dataview-uniq.o -lm -o test_c
./test_c | diff expected_c -
test-llvm: orchestrator.o dataview-uniq.o | test_llvm.o
$(CC) orchestrator.o dataview-uniq.o test_llvm.o -o test_llvm -lm
./test_llvm | diff expected -
......@@ -20,4 +25,4 @@ test-llvm: orchestrator.o dataview-uniq.o | test_llvm.o
coverage:
coverage run -p $(OPENGEODE) orchestrator.pr system_structure.pr --toAda
.PHONY: all edit test-parse test-ada test-llvm coverage
\ No newline at end of file
.PHONY: all edit test-parse test-ada test-llvm coverage
[C Code] Running test
[SDL] Startup
Hello 2.000000
1 2.000000
1.000000
[C Code] Received T_GNC_LV_SIM_INPUTS
2.000000
[C Code] Received T_GNC_LV_SIM_INPUTS
3.000000
[C Code] Received T_GNC_LV_SIM_INPUTS
4.000000
[C Code] Received T_GNC_LV_SIM_INPUTS
1.000000
2.000000
3.000000
4.000000
2.000000
3.000000
#include <math.h>
#include <stdio.h>
#include "dataview-uniq.h"
void vesat_one_step(asn1SccT_GNC_LV_SIM_INPUTS *inp)
{
printf("[C Code] Received T_GNC_LV_SIM_INPUTS\n");
}
int main()
{
printf("[C Code] Running test\n");
CInit();
runTransition(0);
return 0;
}
......@@ -10,9 +10,12 @@ test-parse:
test-ada: challenge.ali
test-c: challenge.c
$(CC) -c challenge.c
test-llvm: challenge.o
coverage:
coverage run -p $(OPENGEODE) challenge.pr system_structure.pr --toAda
.PHONY: all edit test-parse test-ada test-llvm coverage
\ No newline at end of file
.PHONY: all edit test-parse test-ada test-llvm coverage
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment