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,10 @@ 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_ada.o
$(CC) -o test_c myfunction.c test_c.c
./test_c | diff expected -
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 -
......
[C Code] Running test
0
0
1
2
2
TRUE
TRUE
Hello
12
13
-12
-13
2
2
1
1
TRUE
TRUE
1
1
1
2
1
#include <stdio.h>
#include "dataview-uniq.h"
void myfunction_RI_result_data(long long *val)
{
printf("[C] result_data: %lld\n", *val);
}
int main()
{
asn1SccT_Int32 test = 5;
printf("[C Code] Running test\n");
CInit();
runTransition(0);
start_something(&test);
return 0;
}
......@@ -10,6 +10,8 @@ test-parse:
test-ada: function1.ali
test-c: function1.c
test-llvm: function1.o
coverage:
......
......@@ -14,6 +14,11 @@ test-ada: og.ali dataview-uniq.o | test_ada.o
./test_ada
gcov og.adb
test-c: og.c test_c.o dataview-uniq.o
$(CC) og.c -c -o og.o
$(CC) test_c.o og.c dataview-uniq.o -lm -o test_c
./test_c | diff expected -
test-llvm: og.o dataview-uniq.o | test_llvm.o
$(CC) og.o dataview-uniq.o test_llvm.o -o test_llvm -lm
......
ay
FALSE
1
2
4
3
test= 3
All OK (1)
ALL OK (2)
[C] got something]
#include "dataview-uniq.h"
void rezult (asn1SccMy_OctStr *val)
{
printf("[C] got something]\n");
}
int main() {
asn1SccMy_OctStr toto;
CInit();
runTransition(0);
go(&toto);
return 0;
}
......@@ -13,6 +13,11 @@ test-ada: challenge.ali dataview-uniq.o | test_ada.o
$(GNATLINK) -o test_ada test_ada.o challenge.ali -lgnat -lm
./test_ada | diff expected -
test-c: challenge.c test_c.o dataview-uniq.o
$(CC) -include missing.h challenge.c -c -o challenge.o
$(CC) test_c.o challenge.c dataview-uniq.o -lm -o test_c
./test_c | diff expected -
test-llvm: challenge.o dataview-uniq.o | test_llvm.o
$(CC) challenge.o dataview-uniq.o test_llvm.o -o test_llvm -lm
./test_llvm| diff expected -
......@@ -20,4 +25,4 @@ test-llvm: challenge.o dataview-uniq.o | test_llvm.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
......@@ -216,7 +216,7 @@ ENDSTATE;
/* CIF STATE (851, 72), (65, 35) */
STATE ON;
STATE on;
/* CIF INPUT (1043, 127), (88, 35) */
INPUT any_one;
/* CIF NEXTSTATE (1030, 177), (113, 35) */
......@@ -248,8 +248,8 @@ INPUT run;
/* CIF PROCEDURECALL (-360, 306), (106, 35) */
CALL writeln('2');
/* CIF NEXTSTATE (-374, 357), (132, 35) */
NEXTSTATE ON via via_toto
NEXTSTATE on via via_toto
/* CIF COMMENT (-222, 357), (219, 35) */
COMMENT 'Enter substate via entry point';
ENDSTATE;
ENDPROCESS challenge;
\ No newline at end of file
ENDPROCESS challenge;
#include <math.h>
#include <stdio.h>
/* Provide code called by the Ada state machine as external procedure */
void challenge_RI_pow(long long *a, long long *b, long long *res)
{
*res = (long long)pow((double)*a, (double)*b);
}
int main()
{
CInit();
runTransition(0);
run();
run();
//printf("Internal state: %lld\n", l_result);
any_one();
run();
return 0;
}
......@@ -13,6 +13,11 @@ test-ada: og.ali dataview-uniq.o | test_ada.o
$(GNATLINK) -o test_ada test_ada.o og.ali -lgnat
./test_ada | diff expected -
test-c: og.c test_c.o dataview-uniq.o
$(CC) og.c -c -o og.o
$(CC) test_c.o og.c dataview-uniq.o -lm -o test_c
./test_c | diff expected -
test-llvm: og.o dataview-uniq.o | test_llvm.o
$(CC) og.o dataview-uniq.o test_llvm.o -o test_llvm -lm
./test_llvm | diff expected -
......@@ -20,4 +25,4 @@ test-llvm: og.o dataview-uniq.o | test_llvm.o
coverage:
coverage run -p $(OPENGEODE) og.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
int main() {
CInit();
runTransition(0);
return 0;
}
......@@ -10,6 +10,9 @@ test-parse:
test-ada: trafficlight.ali
test-c: trafficlight.c
$(CC) trafficlight.c -c -o trafficlight.o
test-llvm: trafficlight.o
test-export:
......@@ -19,4 +22,4 @@ test-export:
coverage:
coverage run -p $(OPENGEODE) trafficlight.pr system_structure.pr --toAda
.PHONY: all edit test-parse test-ada test-llvm test-exports coverage
\ No newline at end of file
.PHONY: all edit test-parse test-ada test-llvm test-exports coverage
......@@ -14,6 +14,12 @@ test-ada: orchestrator.ali dataview-uniq.o | test_ada.o
./test_ada
gcov orchestrator.adb
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
test-llvm: orchestrator.o
coverage:
......
#include <math.h>
#include <stdio.h>
#include "dataview-uniq.h"
void orchestrator_RI_telemetry(void *_){}
void orchestrator_RI_S_SET_GNC_LV_SIM_CONTEXT_FOR_NEXT_MAJOR_CYCLE(void *_){}
void orchestrator_RI_Scheduler(void *_){}
void orchestrator_RI_VESAT_Simulation_Step(void *_){}
void plot(void *_) {}
void orchestrator_RI_S_JUMP_TO_NEXT_MAJOR_CYCLE() {}
void orchestrator_RI_S_GET_GNC_LV_SIM_INPUTS_FOR_NEXT_MAJOR_CYCLE(void *_){}
int main()
{
printf("[C Code] Running test\n");
CInit();
runTransition(0);
return 0;
}
......@@ -10,9 +10,12 @@ test-parse:
test-ada: fce.ali
test-c: fce.c
$(CC) -c fce.c
test-llvm: fce.o
coverage:
coverage run -p $(OPENGEODE) fce.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
......@@ -10,9 +10,12 @@ test-parse:
test-ada: orchestrator.ali
test-c: orchestrator.c
$(CC) -include missing.h -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
#include "dataview-uniq.h"
asn1SccMyChoice asn1SccMyChoice_b_set(asn1SccMySeq itm)
{
asn1SccMyChoice temp;
temp.kind = b_PRESENT;
temp.u.b = itm;
return temp;
}
asn1SccMyChoice asn1SccMyChoice_a_set(flag itm)
{
asn1SccMyChoice temp;
temp.kind = MyChoice_a_PRESENT;
temp.u.a = itm;
return temp;
}
asn1SccMyPossiblyEmptySeqOf asn1SccMyPossiblyEmptySeqOf_Init()
{
asn1SccMyPossiblyEmptySeqOf temp;
asn1SccMyPossiblyEmptySeqOf_Initialize(&temp);
return temp;
}
asn1SccMyComplexChoice asn1SccMyComplexChoice_a_set(asn1SccMyComplexChoice_a itm)
{
asn1SccMyComplexChoice temp;
temp.kind = MyComplexChoice_a_PRESENT;
temp.u.a = itm;
return temp;
}
asn1SccDeepSeq_a_b_d asn1SccDeepSeq_a_b_d_e_set(flag itm)
{
asn1SccDeepSeq_a_b_d temp;
temp.kind = e_PRESENT;
temp.u.e = itm;
return temp;
}
......@@ -10,9 +10,12 @@ test-parse:
test-ada: function0.ali
test-c: function0.c
$(CC) -c function0.c
test-llvm: function0.o
coverage:
coverage run -p $(OPENGEODE) function0.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