feat(tp1)
This commit is contained in:
18
tp1-obj2-meens/Makefile
Normal file
18
tp1-obj2-meens/Makefile
Normal file
@@ -0,0 +1,18 @@
|
||||
LIB_PATH=$(shell heptc -where)
|
||||
OBJ=first_c/first.c
|
||||
|
||||
all: main
|
||||
|
||||
$(OBJ): first.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
|
||||
4
tp1-obj2-meens/first.ept
Normal file
4
tp1-obj2-meens/first.ept
Normal file
@@ -0,0 +1,4 @@
|
||||
node sum2(i:int) returns (o:int)
|
||||
let
|
||||
o = i + (0 fby i) ;
|
||||
tel
|
||||
16
tp1-obj2-meens/main.c
Normal file
16
tp1-obj2-meens/main.c
Normal file
@@ -0,0 +1,16 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "first_c/first.h"
|
||||
#include "first_c/first_types.h"
|
||||
|
||||
void main() {
|
||||
int i ; /* Allocation des entrées */
|
||||
First__sum2_out o ; /* Allocation des sorties */
|
||||
First__sum2_mem s ; /* Allocation d l'état */
|
||||
First__sum2_reset(&s) ; /* Initialisation de l'état */
|
||||
for(;;) { /* Boucle infinie */
|
||||
printf("Inputs:"); scanf("%d",&i) ; /* Lecture des entrées */
|
||||
First__sum2_step(i,&o,&s) ; /* Calculs */
|
||||
printf("Result: o=%d\n",o.o) ; /* Ecriture des sorties */
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user