27/04/05SE Info2 - S. L'haire UNIGE1 Pointeurs sur tableaux ouverts POINTER TO ARRAY OF CHAR...

8
27/04/05 SE Info2 - S. L'haire UN IGE 1 Pointeurs sur tableaux ouverts POINTER TO ARRAY OF CHAR Structure de tableaux à taille variable On a des types tableaux ouverts pour les procédure PROCEDURE MaProc(IN ch : ARRAY OF CHAR); TYPE ChaineDyn = POINTER TO ARRAY OF CHAR; VAR maChaine : ChaineDyn;

Transcript of 27/04/05SE Info2 - S. L'haire UNIGE1 Pointeurs sur tableaux ouverts POINTER TO ARRAY OF CHAR...

Page 1: 27/04/05SE Info2 - S. L'haire UNIGE1 Pointeurs sur tableaux ouverts POINTER TO ARRAY OF CHAR Structure de tableaux à taille variable On a des types tableaux.

27/04/05 SE Info2 - S. L'haire UNIGE 1

Pointeurs sur tableaux ouverts POINTER TO ARRAY OF CHAR Structure de tableaux à taille

variable On a des types tableaux ouverts

pour les procédure PROCEDURE MaProc(IN ch : ARRAY OF CHAR);

TYPE ChaineDyn = POINTER TO ARRAY OF CHAR;

VAR maChaine : ChaineDyn;

Page 2: 27/04/05SE Info2 - S. L'haire UNIGE1 Pointeurs sur tableaux ouverts POINTER TO ARRAY OF CHAR Structure de tableaux à taille variable On a des types tableaux.

27/04/05 SE Info2 - S. L'haire UNIGE 2

Pointeurs sur tableaux ouvertsTYPE ChaineDyn = POINTER TO ARRAY OF

CHAR;Chaine = ARRAY 100 OF CHAR;

VAR copy : ChaineDyn;str : Chaine;

Affectation: d'abord déclarer la taille au début exécution

NEW(copy,334);NEW(copy,LEN(str));NEW(copy,LEN(str$)+1);

Page 3: 27/04/05SE Info2 - S. L'haire UNIGE1 Pointeurs sur tableaux ouverts POINTER TO ARRAY OF CHAR Structure de tableaux à taille variable On a des types tableaux.

27/04/05 SE Info2 - S. L'haire UNIGE 3

Exemple concret

PROCEDURE Compare*(IN str1, str2 : ARRAY OF CHAR): INTEGER;

VAR copy1, copy2 : POINTER TO ARRAY OF CHAR;

BEGINNEW(copy1,LEN(str1$)+1); NEW(copy2,LEN(str2$)+1);Normaliser(str1, copy1);

Page 4: 27/04/05SE Info2 - S. L'haire UNIGE1 Pointeurs sur tableaux ouverts POINTER TO ARRAY OF CHAR Structure de tableaux à taille variable On a des types tableaux.

27/04/05 SE Info2 - S. L'haire UNIGE 4

Plusieurs dimensions

TYPETabInt = POINTER TO ARRAY OF ARRAY OF ARRAY OF INTEGER;

VAR tab : TabInt;

NEW(tab,3,3,2); alloue dynamiquement un tableau ARRAY 3,3,2 OF INTEGER;

Page 5: 27/04/05SE Info2 - S. L'haire UNIGE1 Pointeurs sur tableaux ouverts POINTER TO ARRAY OF CHAR Structure de tableaux à taille variable On a des types tableaux.

27/04/05 SE Info2 - S. L'haire UNIGE 5

Blackbox et dépendance de modules Des modules importent d'autres

modules dépendancesMODULE LhaireInfo2DemoCreate;IMPORT LhaireInfo2CompareTest; Si j'essaye de compiler + unload

LhaireInfo2CompareTest message "Unloading . LhaireInfo2CompareTest failed"

Page 6: 27/04/05SE Info2 - S. L'haire UNIGE1 Pointeurs sur tableaux ouverts POINTER TO ARRAY OF CHAR Structure de tableaux à taille variable On a des types tableaux.

27/04/05 SE Info2 - S. L'haire UNIGE 6

Dépendances Solution:

Afficher liste modules menu Info Loaded Modules

Mes modules sont listés par ordre de Priorité sélectionner mes modules puis menu Dev Unload Module list (pas Unload module tout seul)

Page 7: 27/04/05SE Info2 - S. L'haire UNIGE1 Pointeurs sur tableaux ouverts POINTER TO ARRAY OF CHAR Structure de tableaux à taille variable On a des types tableaux.

27/04/05 SE Info2 - S. L'haire UNIGE 7

Create Tool

Sélectionner le nom du module

Menu Info Create Tool

Lien pour compiler projet entier et pour unloader

Root modules module principaux

Page 8: 27/04/05SE Info2 - S. L'haire UNIGE1 Pointeurs sur tableaux ouverts POINTER TO ARRAY OF CHAR Structure de tableaux à taille variable On a des types tableaux.

27/04/05 SE Info2 - S. L'haire UNIGE 8

TP9: faire une interface simple.

Pour chaque type un bouton pour insérer, un pour modifier

Suivant et Précédent affichent les éléments de liste et remplissent champs pertinents (ne pas oublier d'effacer les autres)