"depot M111"

This commit is contained in:
JunkJumper 2020-05-03 14:10:04 +02:00
parent 0e8d905c4e
commit 78cdd39ea9
54 changed files with 610 additions and 0 deletions

BIN
2018_TP11_V0.pdf Executable file

Binary file not shown.

20
Demo_make/M111_point.c Executable file
View File

@ -0,0 +1,20 @@
// M111 - TP10_PROG-PROC
// Composant M111_point
// Implementation
#include <stdio.h>
#include "M111_point.h"
lePoint lePointCreation (int x, int y, char nom) {
lePoint localPoint;
localPoint.champX = x;
localPoint.champY = y;
localPoint.champN = nom;
return localPoint;
}
void lePointAfficher (lePoint unPoint){
printf ("[ %c (%3d, %3d ) ]\n", unPoint.champN,
unPoint.champX, unPoint.champY);
}

14
Demo_make/M111_point.h Executable file
View File

@ -0,0 +1,14 @@
// M111 - TP10_PROG-PROC
// Composant M111_point
// Header
typedef struct {
int champX;
int champY;
char champN;
}
lePoint;
lePoint lePointCreation (int x, int y, char nom);
void lePointAfficher (lePoint unPoint);

11
Demo_make/Makefile Executable file
View File

@ -0,0 +1,11 @@
CFLAGS = -Wall -std=gnu99 -g
EXECUTABLES = crash \
crash2
all : ${EXECUTABLES}
clean :
@rm -f core *.o *.out *~
@rm -f ${EXECUTABLES}

20
Demo_make/main.c Executable file
View File

@ -0,0 +1,20 @@
// M111 - TP10_PROG-PROC
// Programme de test du composant M111_point
#include <stdio.h>
#include <stdlib.h>
#include "M111_point.h"
int main()
{
printf("Hellu world!\n");
lePoint pointA, pointB;
pointA =lePointCreation(10,20, 'A');
pointB =lePointCreation(100,200, 'B');
lePointAfficher(pointA);
lePointAfficher(pointB);
return 0;
}

15
Projets_A_B_C/appli_A.c Executable file
View File

@ -0,0 +1,15 @@
/// appliA.C
int main()
{
int x, y;
structA1 A1 = structA1Creation (x, y);
structA1Afficher (structA1 A2);
structA1 A2 = structA2Creation (x, y);
structA2Afficher (A2);
structA1 A3 = structA3Creation ( x, y);
structA3Afficher (A3);
return 0;
}

21
Projets_A_B_C/fichier_A1.c Executable file
View File

@ -0,0 +1,21 @@
#include <stdio.h>
#include "header_A1.h"
structA1 structA1Creation (int x, int y)
{ printf ("Execution de structA1Creation"\n}
void structA1Afficher (structA1 x)
{ printf ("Execution de structA1Afficher"\n}
#include <stdio.h>
#include "header_A2.h"
structA1 structA2Creation (int x, int y)
{ printf ("Execution de structA2Creation"\n}
void structA2Afficher (structA1 x)
{ printf ("Execution de structA2Afficher"\n}
#include <stdio.h>
#include "header_A3.h"
structA1 structA3Creation (int x, int y)
{ printf ("Execution de structA3Creation"\n}
void structA3Afficher (structA3 x)
{ printf ("Execution de structA3Afficher"\n}

26
Projets_A_B_C/fichier_A1.h Executable file
View File

@ -0,0 +1,26 @@
/// Header_A1
typedef struct
{
int champX;
int champY;
} structA1;
structA1 structA1Creation (int x, int y);
void structA1Afficher (structA1 x);
/// Header_A2
typedef struct
{
int champX;
int champY;
} structA2;
structA2 structA2Creation (int x, int y);
void structA2Afficher (structA1 x);
/// Header_A3
typedef struct
{
int champX;
int champY;
} structA3;
structA3 structA3Creation (int x, int y);
void structA3Afficher (structA3 x);

Binary file not shown.

View File

@ -0,0 +1,21 @@
#!/bin/bash
# M111 - TP9 - afficheargs.sh
echo $*
for i in $*
do
echo $i
done
for i
do
echo $i
done
while test $# != 0 # ou bien [ ou bien [[
do
echo $1
shift
done

View File

@ -0,0 +1,33 @@
#! /bin/bash
# M111 - TP11 - ajouterposte.sh (version prototype a terminer)
# Ajout a la fin d'un fichier (ou creation du fichier) de lignes composées
# d'un mot, chaque mot terminé par 00 à 99.
# Le fichier de nom FICHIER-DES-SALLES se trouve dans le répertoire indiqué
# par la variable d'environnement REP_SALLES.
# Exemple :
# $ q6 S756P 01 11
# $ cat $REP_SALLES/FICHIER-DES-SALLES
# S756P01
# S756P02
# S756P03
# S756P05
# S756P06
# S756P07
# S756P08
# S756P09
# S756P10
# S756P11
# $
if [[ $# -ne 3 ]] ; then echo "Syntaxe : $0 salle debut fin" ; exit 2 ; fi
if [[ ! -d $REP_SALLES ]] ; then echo '$REP_SALLE absente ou incorrecte' ; exit 2 ; fi
if [[ $3 -gt 99 ]] ; then echo "Nombre entre 0 et 99 !" ; exit 2 ; fi
for NB in $(seq $2 $3)
do
if [[ $NB -le 9 ]]
then echo ${1}0$NB
else echo $1$NB
fi
done >> $REP_SALLES/FICHIER-DES-SALLES

View File

@ -0,0 +1,16 @@
#!/bin/bash
# Version avec 'stat'
somme=0
for i in *
do
if [ -f $i ]
then
taille=$(stat -c%s $i)
let somme=somme+taille
echo "... Mise au point " $i $taille $somme >&2
fi
done
echo $somme

View File

@ -0,0 +1,13 @@
#!/bin/bash
# Version avec 'ls' et 'read'
ls -l | grep '^-' | { somme=0 ; while read m1 m2 m3 m4 taille m6
do
let somme=somme+taille
echo "... Mise au point " $i $taille $somme >&2
done
echo $somme
}

View File

@ -0,0 +1,14 @@
#!/bin/bash
# Version avec 'ls' et 'set'
ls -l | grep '^-' | { somme=0; while read neutre ligne
do
set $ligne
let somme=somme+$4
echo "... Mise au point " $i $taille $somme >&2
done
echo $somme
}

View File

@ -0,0 +1,10 @@
#! /bin/bash
# M111 - TP9 - concatene.sh
rm -rf GROSFICHIER
for FICH in TEST/*
do
cat $FICH >> GROSFICHIER
done

19
SCRIPTS_EXEMPLES/egaltilde.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash - egaltilde.sh
# M111 - TP11 - reconnaitre un mot commencant
# par un caractere particulier
if [[ $# -le 1 ]]
then echo "Syntaxe : $0 caractere mot ..."
exit 5
fi
LECAR=$1
shift
while [[ ! $1 =~ $LECAR && -n $1 ]]
do
LESMOTS="$LESMOTS $1"
echo ' boucle ...'
shift
done
echo ' 'LESMOTS=\'$LESMOTS\'

View File

@ -0,0 +1,7 @@
MOT='<esscai.c>'
echo Valeur de LIGNE = $MOT
echo ${MOT//.c/.o}
basename /usr/bin/fichier.c
basename --suffix=.c fichier.c
basename /home/TP
dirname /usr/bin/gcc

17
SCRIPTS_EXEMPLES/somme_args.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
# M111 - TP9 - sommeargs.sh (prototype)
# solution avec seq possible ...
if [[ $# -ne 2 ]]
then echo "Syntaxe : $0 nbre1 nombre2 # avec nbre1 <= nbre2" ; exit 2 ; fi
NB1=$1
NB2=$2
SOMME=0
while [[ $NB1 -le $NB2 ]]
do
let SOMME=SOMME+NB1
let NB1++
done
echo $SOMME

BIN
SCRIPTS_EXEMPLES/strings.JPG Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

View File

@ -0,0 +1,47 @@
#! /bin/bash
# traite_arguments.sh : exemple de script pour traiter les arguments de la ligne de commande
# - avec passage d'arguments (simples ou couple) dans un ordre quelconque
# - avec initialisation des variables associées aux parametres pour traitement ulterieur
# - Affichage des valeurs des variables concernees
# Arguments possibles :
# -x1 -x2 --var_x2
# -a1 valeur -argument1 valeur -a2 valeur --argument2
# Exemple :
# traite_arguments.sh -a1 val1 --argument1 val11 -x1 -a2 val2 -x2 # nb : redondance
varX1=0 ; varX2=0
variable1=NON ; variable2=NON
echo Nombre d arguments = $#
while [[ $# -gt 0 ]] ; do
case $1 in
"-x1" ) varX1=1
shift ;;
"-x2" | "--var_x2" ) varX2=1
shift
;;
"-d" | "--argument1" )
if [[ -n $2 ]]
then
if [ -d $2 ]
variable1=$2
else
echo "$0: Syntaxe : $1 <valeur>" ; exit 2
fi
shift ; shift ;;
"-a2" | "--argument2" )
if [[ -n $2 ]]
then variable2=$2
else
echo "$0: Syntaxe : $1 <valeur>" ; exit 2
fi
shift ; shift ;;
* ) echo "$0: Syntaxe : $1 = parametre illegal" ; exit 2
esac
done

11
Squelette_Makefile Executable file
View File

@ -0,0 +1,11 @@
CFLAGS = -Wall -std=gnu99 -g
EXECUTABLES = crash \
crash2
all : ${EXECUTABLES}
clean :
@rm -f core *.o *.out *~
@rm -f ${EXECUTABLES}

3
appli_A/Help Executable file
View File

@ -0,0 +1,3 @@
Pour produire l'executable : gcc *.c -o appli_A

0
appli_A/dir/1.c Executable file
View File

0
appli_A/dir/2.c Executable file
View File

0
appli_A/dir/23-36664289109.c Executable file
View File

0
appli_A/dir/3.c Executable file
View File

0
appli_A/dir/546.c Executable file
View File

7
appli_A/fichier_A1.c Executable file
View File

@ -0,0 +1,7 @@
#include <stdio.h>
#include "fichier_A1.h"
structA1 structA1Creation (int x, int y)
{ printf ("Execution de structA1Creation\n");}
void structA1Afficher (structA1 x)
{ printf ("Execution de structA1Afficher\n");}

9
appli_A/fichier_A1.h Executable file
View File

@ -0,0 +1,9 @@
/// Header_A1
typedef struct
{
int champX;
int champY;
} structA1;
structA1 structA1Creation (int x, int y);
void structA1Afficher (structA1 x);

9
appli_A/fichier_A2.c Executable file
View File

@ -0,0 +1,9 @@
#include <stdio.h>
#include "fichier_A2.h"
structA2 structA2Creation (int x, int y)
{ printf ("Execution de structA2Creation\n");}
void structA2Afficher (structA2 x)
{ printf ("Execution de structA2Afficher\n");}

9
appli_A/fichier_A2.h Executable file
View File

@ -0,0 +1,9 @@
/// Header_A2
typedef struct
{
int champX;
int champY;
} structA2;
structA2 structA2Creation (int x, int y);
void structA2Afficher (structA2 x);

7
appli_A/fichier_A3.c Executable file
View File

@ -0,0 +1,7 @@
#include <stdio.h>
#include "fichier_A3.h"
structA3 structA3Creation (int x, int y)
{ printf ("Execution de structA3Creation\n");}
void structA3Afficher (structA3 x)
{ printf ("Execution de structA3Afficher\n");}

9
appli_A/fichier_A3.h Executable file
View File

@ -0,0 +1,9 @@
/// Header_A3
typedef struct
{
int champX;
int champY;
} structA3;
structA3 structA3Creation (int x, int y);
void structA3Afficher (structA3 x);

BIN
appli_A/main Executable file

Binary file not shown.

73
appli_A/mgcc.sh Executable file
View File

@ -0,0 +1,73 @@
#echo "|**********************************************************************|"
#echo "* Projet : TD11 - Script 1"
#echo "*"
#echo "* Programme : mgcc.sh"
#echo "*"
#echo "* Auteur : JunkJumper"
#echo "*"
#echo "* Date created : 12-12-2018"
#echo "*"
#echo "* But : Apprendre pour le makefile"
#echo "*"
#echo "|**********************************************************************|"
varX1=0 ; varX2=0
leVerbose=NON
leInclude=NON
repertoire=.
echo Nombre d arguments = $#
if [[ $# > 4 ]]
then
echo "$0: Erreur, vous avez entré trop d'arguments" ; exit 2
else
while [[ $# -gt 0 ]] ; do
case $1 in
"-v" | "--verbose" )
leVerbose=OUI
shift
;;
"-i" | "--include" )
leInclude=OUI
shift
;;
"-d" | "--directory" )
if [[ -n $2 ]]
then
if [ -d $2 ]
then
repertoire=$2
else
echo "$0: Syntaxe : le répertoire $2 n'existe pas" ; exit 2
fi
else
echo "$0: Syntaxe : $1 doit etre accompagné d'un répertoire valide"
fi
shift ; shift ;;
* ) echo "$0: Syntaxe : $1 = parametre interdit" ; exit 2
esac
done
fi
#ca c'est pour tester mtn va les enlever
echo $leVerbose
echo $leInclude
echo $repertoire
echo ""
cd $repertoire
for i in *.c
do
echo "gcc -c $i"
done
cd /home/sj801446/Documents/M111/TP_11_bash_projet_make/appli_A/

3
appli_A/redir Executable file
View File

@ -0,0 +1,3 @@
1.c
2.c
3.c

4
appli_A_B/Help Executable file
View File

@ -0,0 +1,4 @@
Pour produire l'executable appli_A : gcc *A*.c -o appli_A
Pour produire l'executable appli_B : gcc *B*.c fichier_A3.c -o appli_B

BIN
appli_A_B/appli_A Executable file

Binary file not shown.

20
appli_A_B/appli_A.c Executable file
View File

@ -0,0 +1,20 @@
/// appliA.C
#include "fichier_A1.h"
#include "fichier_A2.h"
#include "fichier_A3.h"
int main()
{
int x, y;
structA1 A1 = structA1Creation (x, y);
structA2 A2 = structA2Creation (x, y);
structA3 A3 = structA3Creation (x, y);
structA1Afficher (A1);
structA2Afficher (A2);
structA3Afficher (A3);
return 0;
}

BIN
appli_A_B/appli_B Executable file

Binary file not shown.

20
appli_A_B/appli_B.c Executable file
View File

@ -0,0 +1,20 @@
/// BppliB.C
#include "fichier_B1.h"
#include "fichier_B2.h"
#include "fichier_B3.h"
#include "fichier_A3.h"
int main()
{
int x, y;
structB1 B1 = structB1Creation (x, y);
structB2 B2 = structB2Creation (x, y);
structB3 B3 = structB3Creation (x, y);
structA3 A3 = structA3Creation (x, y);
structB1Afficher (B1);
structB2Afficher (B2);
structB3Afficher (B3);
structA3Afficher (A3);
return 0;
}

7
appli_A_B/fichier_A1.c Executable file
View File

@ -0,0 +1,7 @@
#include <stdio.h>
#include "fichier_A1.h"
structA1 structA1Creation (int x, int y)
{ printf ("Execution de structA1Creation\n");}
void structA1Afficher (structA1 x)
{ printf ("Execution de structA1Afficher\n");}

9
appli_A_B/fichier_A1.h Executable file
View File

@ -0,0 +1,9 @@
/// Header_A1
typedef struct
{
int champX;
int champY;
} structA1;
structA1 structA1Creation (int x, int y);
void structA1Afficher (structA1 x);

9
appli_A_B/fichier_A2.c Executable file
View File

@ -0,0 +1,9 @@
#include <stdio.h>
#include "fichier_A2.h"
structA2 structA2Creation (int x, int y)
{ printf ("Execution de structA2Creation\n");}
void structA2Afficher (structA2 x)
{ printf ("Execution de structA2Afficher\n");}

9
appli_A_B/fichier_A2.h Executable file
View File

@ -0,0 +1,9 @@
/// Header_A2
typedef struct
{
int champX;
int champY;
} structA2;
structA2 structA2Creation (int x, int y);
void structA2Afficher (structA2 x);

7
appli_A_B/fichier_A3.c Executable file
View File

@ -0,0 +1,7 @@
#include <stdio.h>
#include "fichier_A3.h"
structA3 structA3Creation (int x, int y)
{ printf ("Execution de structA3Creation\n");}
void structA3Afficher (structA3 x)
{ printf ("Execution de structA3Afficher\n");}

9
appli_A_B/fichier_A3.h Executable file
View File

@ -0,0 +1,9 @@
/// Header_A3
typedef struct
{
int champX;
int champY;
} structA3;
structA3 structA3Creation (int x, int y);
void structA3Afficher (structA3 x);

7
appli_A_B/fichier_B1.c Executable file
View File

@ -0,0 +1,7 @@
#include <stdio.h>
#include "fichier_B1.h"
structB1 structB1Creation (int x, int y)
{ printf ("Execution de structB1Creation\n");}
void structB1Afficher (structB1 x)
{ printf ("Execution de structB1Afficher\n");}

10
appli_A_B/fichier_B1.h Executable file
View File

@ -0,0 +1,10 @@
#include "fichier_A1.h"
/// Header_B1
typedef struct
{
int champX;
int champY;
} structB1;
structB1 structB1Creation (int x, int y);
void structB1Afficher (structB1 x);

9
appli_A_B/fichier_B2.c Executable file
View File

@ -0,0 +1,9 @@
#include <stdio.h>
#include "fichier_B2.h"
structB2 structB2Creation (int x, int y)
{ printf ("Execution de structB2Creation\n");}
void structB2Afficher (structB2 x)
{ printf ("Execution de structB2Afficher\n");}

9
appli_A_B/fichier_B2.h Executable file
View File

@ -0,0 +1,9 @@
/// Header_B2
typedef struct
{
int champX;
int champY;
} structB2;
structB2 structB2Creation (int x, int y);
void structB2Afficher (structB2 x);

7
appli_A_B/fichier_B3.c Executable file
View File

@ -0,0 +1,7 @@
#include <stdio.h>
#include "fichier_B3.h"
structB3 structB3Creation (int x, int y)
{ printf ("Execution de structB3Creation\n");}
void structB3Afficher (structB3 x)
{ printf ("Execution de structB3Afficher\n");}

9
appli_A_B/fichier_B3.h Executable file
View File

@ -0,0 +1,9 @@
/// Header_B3
typedef struct
{
int champX;
int champY;
} structB3;
structB3 structB3Creation (int x, int y);
void structB3Afficher (structB3 x);

1
makefile Executable file
View File

@ -0,0 +1 @@
main :