Le fichier source est ${UPS_HOME}/upssdk/demo/${UPS_LANGUAGE}/instance.upl.
upscmp Source=instance.upl
instance
upssng Source=instance.upl
Source Composant "Exemple d'emploi des instances" Version 4.0.0;
SegmentPrive MemoirePrivee;
SegmentProtege MemoireProtegee;
Variable
/******/
Prive :
A : Entier;
B : Caractere;
Protege :
I1 : Entier;
I2 : Entier;
Principal
/*******/
Debut
I1=NumeroInstance;
A=10;
B="Bonjour le monde";
Ecran.Ecrire("I1="+Caractere(I1));
Ecran.Ecrire("I2="+Caractere(I2));
Ecran.Ecrire("A="+Caractere(A));
Ecran.Ecrire("B="+B);
I2=CreerInstance();
Ecran.Ecrire("I1="+Caractere(I1));
Ecran.Ecrire("I2="+Caractere(I2));
Ecran.Ecrire("A="+Caractere(A));
Ecran.Ecrire("B="+B);
CommuterInstance(I2);
A=20;
B="Hello world";
Ecran.Ecrire("I1="+Caractere(I1));
Ecran.Ecrire("I2="+Caractere(I2));
Ecran.Ecrire("A="+Caractere(A));
Ecran.Ecrire("B="+B);
CommuterInstance(I1);
Ecran.Ecrire("I1="+Caractere(I1));
Ecran.Ecrire("I2="+Caractere(I2));
Ecran.Ecrire("A="+Caractere(A));
Ecran.Ecrire("B="+B);
ArreterInstance(I2);
I2=0;
Ecran.Ecrire("I1="+Caractere(I1));
Ecran.Ecrire("I2="+Caractere(I2));
Ecran.Ecrire("A="+Caractere(A));
Ecran.Ecrire("B="+B);
Fin Principal