feat(tp1)
This commit is contained in:
19
tp1-obj3-meens/Makefile
Normal file
19
tp1-obj3-meens/Makefile
Normal file
@@ -0,0 +1,19 @@
|
||||
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-obj3-meens/first.ept
Normal file
4
tp1-obj3-meens/first.ept
Normal file
@@ -0,0 +1,4 @@
|
||||
node counter () returns (cnt:int)
|
||||
let
|
||||
cnt = 0 fby (cnt+1) ;
|
||||
tel
|
||||
16
tp1-obj3-meens/main.c
Normal file
16
tp1-obj3-meens/main.c
Normal file
@@ -0,0 +1,16 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "first_c/first.h"
|
||||
#include "first_c/first_types.h"
|
||||
|
||||
void main() {
|
||||
First__counter_out o ; /* Allocation des sorties */
|
||||
First__counter_mem s ; /* Allocation d l'état */
|
||||
First__counter_reset(&s) ; /* Initialisation de l'état */
|
||||
for(;;) { /* Boucle infinie */
|
||||
usleep(10) ; /* A vous d'en choisir un (timer, input, etc.) */
|
||||
First__counter_step(&o,&s) ;
|
||||
printf(" Result: cnt=%d\n",o.cnt) ;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user