feat(tp1)

This commit is contained in:
2025-03-27 12:42:38 +01:00
commit cdbd983b03
9 changed files with 117 additions and 0 deletions

19
tp1-obj3-meens/Makefile Normal file
View 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
View 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
View 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) ;
}
}