feat(tp1)
This commit is contained in:
18
tp1-obj1-meens/Makefile
Normal file
18
tp1-obj1-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
|
||||
7
tp1-obj1-meens/first.ept
Normal file
7
tp1-obj1-meens/first.ept
Normal file
@@ -0,0 +1,7 @@
|
||||
fun myfun (x:int;y:int) returns (z:int;t:int)
|
||||
var x2 : int;
|
||||
let
|
||||
x2 = x*x ;
|
||||
t = x2 + 3*x ;
|
||||
z= t + y ;
|
||||
tel
|
||||
15
tp1-obj1-meens/main.c
Normal file
15
tp1-obj1-meens/main.c
Normal file
@@ -0,0 +1,15 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "first_c/first.h"
|
||||
#include "first_c/first_types.h"
|
||||
|
||||
|
||||
void main() {
|
||||
int x,y ; /* Allocation des entrées */
|
||||
First__myfun_out o ; /* Allocation des sorties */
|
||||
for(;;) { /* Boucle infinie */
|
||||
printf("Inputs:"); scanf("%d%d",&x,&y) ; /* Lecture des entrées */
|
||||
First__myfun_step(x,y,&o) ; /* Calculs */
|
||||
printf("Result: z=%d t=%d\n",o.z,o.t) ; /* Ecriture des sorties */
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user