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

Merge pull request #31 from lattuada/master

C Backend
parents 2b77c93e 5c8a87a0
[C Code] Running test
TRUE
FALSE
FALSE
(1) -> TRUEFALSE
(2) -> TRUETRUE
Hello word
Hop
Hop!!
Hop!!:-)
Hop
OK
void telemetry(void *_){}
int main()
{
printf("[C Code] Running test\n");
CInit();
runTransition(0);
return 0;
}
......@@ -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
test-c: orchestrator.c test_c.o dataview-uniq.o
$(CC) -include missing.h orchestrator.c -c -o orchestrator.o
$(CC) test_c.o orchestrator.o dataview-uniq.o -lm -o test_c
./test_c | diff expected -
test-llvm: orchestrator.o
test-python:
......
[C Code] Running test
0
0
0
1
0
0
0
1
FALSE
TRUE
TRUE
FALSE
HELLO!!!
HELLOHELLOHELLO
#include "dataview-uniq.h"
asn1SccSeqOpt_c asn1SccSeqOpt_c_Init()
{
asn1SccSeqOpt_c temp;
asn1SccSeqOpt_c_Initialize(&temp);
return temp;
}
asn1SccSeqOpt_d asn1SccSeqOpt_d_Init()
{
asn1SccSeqOpt_d temp;
asn1SccSeqOpt_d_Initialize(&temp);
return temp;
}
int asn1SccMyChoice_Kind(asn1SccMyChoice val)
{
return val.kind;
}
void telemetry(void *_){}
int main()
{
printf("[C Code] Running test\n");
CInit();
runTransition(0);
return 0;
}
......@@ -13,6 +13,11 @@ test-ada: operators.ali dataview-uniq.o | test_ada.o
$(GNATLINK) test_ada.o operators.ali -lgnat -lm -o test_ada
./test_ada | diff expected -
test-c: operators.c test_c.o dataview-uniq.o
$(CC) -include missing.h operators.c -c -o operators.o
$(CC) test_c.o operators.o -lm -o test_c
./test_c | diff expected_c -
test-llvm: operators.o dataview-uniq.o | test_llvm.o
$(CC) operators.o dataview-uniq.o test_llvm.o -o test_llvm -lm
./test_llvm | diff expected -
......@@ -20,4 +25,4 @@ test-llvm: operators.o dataview-uniq.o | test_llvm.o
coverage:
coverage run -p $(OPENGEODE) operators.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
2 2.000000TRUEHELLO
2 2.000000TRUEHELLO
\ No newline at end of file
#include "dataview-uniq.h"
#include <math.h>
asn1SccReal pi = M_PI;
asn1SccChoice asn1SccChoice_i_set(asn1SccInteger itm)
{
asn1SccChoice temp;
temp.kind = i_PRESENT;
temp.u.i = itm;
return temp;
}
#include "dataview-uniq.h"
void operators_RI_assert(asn1SccBoolean *res, asn1SccCharString *msg) {
if (!*res) {
printf("%.*s\n", (int)msg->nCount, msg->arr);
exit(1);
}
}
int main() {
CInit();
runTransition(0);
run();
return 0;
}
......@@ -14,6 +14,11 @@ test-ada:
$(GNATMAKE) -O$(O) -c *.adb
$(GNATBIND) -n og.ali
test-c:
$(OPENGEODE) og.pr --toC
$(ASN1SCC) -c dataview-uniq.asn -typePrefix asn1Scc -equal
$(CC) -O$(O) -c *c
test-llvm:
$(OPENGEODE) og.pr --llvm -O$(O)
......
......@@ -8,9 +8,12 @@ edit:
test-parse:
$(OPENGEODE) og.pr --check
test-ada:
test-ada:
$(OPENGEODE) og.pr --toAda
test-c:
$(OPENGEODE) og.pr --toC
test-llvm:
$(OPENGEODE) og.pr --llvm -O$(O)
......
......@@ -20,6 +20,14 @@ test-ada:
$(GNATLINK) -o test_ada test_ada.o external_proc.o orchestrator.ali -lgnat
./test_ada
test-c:
$(ASN1SCC) -c dataview-uniq.asn -typePrefix asn1Scc -equal
$(CC) -c -g test_c.c
$(OPENGEODE) orchestrator.pr system_structure.pr --shared --toC
$(ASN1SCC) -c dataview-uniq.asn -typePrefix asn1Scc -equal
$(CC) -O$(O) test_c.c external_proc.c orchestrator.c -o test_c
./test_c | diff - expected
test-llvm: orchestrator.o
test-python:
......
[C Code] Running test
Size=24
100000002000000030000000
......@@ -51,7 +51,7 @@ anint := 478;
/* CIF PROCEDURECALL (433, 360), (212, 35) */
CALL writeln('Input param', anint);
/* CIF PROCEDURECALL (442, 410), (193, 35) */
CALL externalProc(anint, anint);
CALL ExternalProc(anint, anint);
/* CIF PROCEDURECALL (427, 460), (224, 35) */
CALL writeln('Output param', anint);
/* CIF PROCEDURECALL (398, 510), (283, 35) */
......@@ -87,4 +87,4 @@ anint := 478;
/* CIF NEXTSTATE (977, 305), (90, 35) */
NEXTSTATE Timeout;
ENDSTATE;
ENDPROCESS orchestrator;
\ No newline at end of file
ENDPROCESS orchestrator;
#include <stdio.h>
extern char *fixed_value();
extern int fixed_size();
int main()
{
char * toto;
int size;
int i;
printf("[C Code] Running test\n");
CInit();
runTransition(0);
toto = fixed_value();
size = fixed_size();
printf("Size=%d\n", size);
for (i = 0; i<size; i++) printf("%d", toto[i]);
printf("\n");
return 0;
}
......@@ -14,6 +14,11 @@ test-ada:
$(GNATMAKE) -O$(O) -c *.adb
$(GNATBIND) -n og.ali
test-c:
$(OPENGEODE) og.pr --toC
$(ASN1SCC) -c dataview-uniq.asn -typePrefix asn1Scc -equal
$(CC) -O$(O) -c *.c
test-llvm:
$(OPENGEODE) og.pr --llvm -O$(O)
......
......@@ -17,6 +17,13 @@ test-ada: dataview-uniq.o | test_ada.o
./test_ada
test-c: dataview-uniq.o | test_ada.o
$(OPENGEODE) og.pr --toC
$(ASN1SCC) -c dataview-uniq.asn -typePrefix asn1Scc -equal
$(CC) -O$(O) test_c.c og.c dataview-uniq.c -o test_c
./test_c | diff - expected
test-llvm: test.o dataview-uniq.o | test_llvm.o
$(OPENGEODE) og.pr --llvm -O$(O)
$(LLC) *.ll
......
foo, bar
, baz
a
b
foo
bar
baz
int main()
{
CInit();
runTransition(0);
return 0;
}
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