feat(tp2-obj1)
This commit is contained in:
parent
cdbd983b03
commit
453e7aea56
18
tp2-obj1-meens/Makefile
Normal file
18
tp2-obj1-meens/Makefile
Normal file
@ -0,0 +1,18 @@
|
||||
LIB_PATH=$(shell heptc -where)
|
||||
OBJ=rcounter_c/rcounter.c rcounter_c/rcounter_types.c
|
||||
|
||||
all: main
|
||||
|
||||
$(OBJ): rcounter.ept
|
||||
heptc -target c $<
|
||||
|
||||
main: $(OBJ)
|
||||
gcc -I $(LIB_PATH)/c -I . main.c $<
|
||||
|
||||
clean:
|
||||
$(RM) *.log
|
||||
$(RM) *.epci
|
||||
$(RM) *.mls
|
||||
$(RM) *.o *.obj *.obc
|
||||
$(RM) -r *_c
|
||||
$(RM) *.out
|
17
tp2-obj1-meens/main.c
Normal file
17
tp2-obj1-meens/main.c
Normal file
@ -0,0 +1,17 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "rcounter_c/rcounter.h"
|
||||
#include "rcounter_c/rcounter_types.h"
|
||||
|
||||
|
||||
void main() {
|
||||
int o;
|
||||
Rcounter__rcounter_mem s;
|
||||
Rcounter__rcounter_out out;
|
||||
for(;;) { /* Boucle infinie */
|
||||
printf("Input: ");
|
||||
scanf("%d", &o);
|
||||
Rcounter__rcounter_step(o, &out, &s) ; /* Calculs */
|
||||
printf("%i\n", out);
|
||||
}
|
||||
}
|
4
tp2-obj1-meens/rcounter.ept
Normal file
4
tp2-obj1-meens/rcounter.ept
Normal file
@ -0,0 +1,4 @@
|
||||
node rcounter(rst:bool) returns (cnt:int)
|
||||
let
|
||||
cnt = if rst then 0 else (0 fby (cnt+1))
|
||||
tel
|
Loading…
Reference in New Issue
Block a user