Les variables virtuelles

Ce programme présente la déclaration de variables virtuelles.

Le fichier source est ${UPS_HOME}/upssdk/demo/${UPS_LANGUAGE}/virtuel.upl.

Mode compilé

Commande de compilation

upscmp Source=virtuel.upl

Commande d'exécution

virtuel

Mode interprété

upssng Source=virtuel.upl

Fichier source

Source Composant "Exemple de variables virtuelles" Version 4.0.0;

Parametre <param.ini> Section "parametre"
/***************************************/
Variable
/******/
Public :
/******/
Protege :
/*******/
Prive :
/*****/

Public :
/******/
Procedure A(P : Booleen)
/********************/
Debut
ABis=P;
Fin Procedure

Fonction A() Retourner Booleen
/****************************/
Debut
Retourner ABis;
Fin Fonction

Procedure E(P : Date)
/*****************/
Debut
EBis=P;
Fin Procedure

Fonction E() Retourner Date
/*************************/
Debut
Retourner EBis;
Fin Fonction

Procedure G(P : Entier)
/*******************/
Debut
GBis=P;
Fin Procedure

Fonction G() Retourner Entier
/***************************/
Debut
Retourner GBis;
Fin Fonction

Procedure I(P : Reel)
/*****************/
Debut
IBis=P;
Fin Procedure

Fonction I() Retourner Reel
/*************************/
Debut
Retourner IBis;
Fin Fonction

Procedure VA1(P : Booleen)
/**********************/
Debut
VA1Bis=P;
Fin Procedure

Fonction VA1() Retourner Booleen
/******************************/
Debut
Retourner VA1Bis;
Fin Fonction

Procedure VB1(P : Entier)
/*********************/
Debut
VB1Bis=P;
Fin Procedure

Fonction VB1() Retourner Entier
/*****************************/
Debut
Retourner VB1Bis;
Fin Fonction

Procedure VC1(P : Reel)
/*******************/
Debut
VC1Bis=P;
Fin Procedure

Fonction VC1() Retourner Reel
/***************************/
Debut
Retourner VC1Bis;
Fin Fonction
Procedure VD1(P : Caractere)
> /*************************/
> Debut
VD1Bis=P;
Fin Procedure

Fonction VD1() Retourner Caractere
/********************************/
Debut
Retourner VD1Bis;
Fin Fonction

Protege :
Procedure VA2(P : Booleen)
/************************/
Debut
VA2Bis=P;
Fin Procedure

Fonction VA2() Retourner Booleen
/******************************/
Debut
Retourner VA2Bis;
Fin Fonction

Procedure VB2(P : Entier)
/*********************/
Debut
VB2Bis=P;
Fin Procedure

Fonction VB2() Retourner Entier
/*****************************/
Debut
Retourner VB2Bis;
Fin Fonction

Procedure VC2(P : Reel)
/*******************/
Debut
VC2Bis=P;
Fin Procedure

Fonction VC2() Retourner Reel
/***************************/
Debut
Retourner VC2Bis;
Fin Fonction

Procedure VD2(P : Caractere)
/************************/
Debut
VD2Bis=P;
Fin Procedure

Fonction VD2() Retourner Caractere
/********************************/
Debut
Retourner VD2Bis;
Fin Fonction

Public :
Procedure Passage(P1 : Booleen Entree Sortie, P2 : Entier Entree Sortie, P3 : Reel Entree Sortie, P4 : Caractere Entree Sortie)
/******************************************************************/
Debut
Ecran.Ecrire("P1=");
Ecran.Ecrire(P1);
Ecran.Ecrire("P2=");
Ecran.Ecrire(P2);
Ecran.Ecrire("P3=");
Ecran.Ecrire(P3);
Ecran.Ecrire("P4=");
Ecran.Ecrire(P4);
Ecran.Ecrire("\n");
P1=Faux;
P2=1515;
P3=2.71;
P4="schuss";
Fin Procedure

Principal
/*******/
Debut
Ecran.Ecrire("A=");
Ecran.Ecrire(A);
Ecran.Ecrire("E=");
Ecran.Ecrire(Caractere(E, "%jj-%mm-%A"));
Ecran.Ecrire("G=");
Ecran.Ecrire(G);
Ecran.Ecrire("I=");
Ecran.Ecrire(I);
Ecran.Ecrire("\n");

VA1=Vrai;
VB1=1;
VC1=2.0;
VD1="coucou";
VA2=Faux;
VB2=3;
VC2=4.0;
VD2="hello";

Ecran.Ecrire("VA1=");
Ecran.Ecrire(VA1);
Ecran.Ecrire("VB1=");
Ecran.Ecrire(VB1);
Ecran.Ecrire("VC1=");
Ecran.Ecrire(VC1);
Ecran.Ecrire("VD1=");
Ecran.Ecrire(VD1);
Ecran.Ecrire("VA2=");
Ecran.Ecrire(VA2);
Ecran.Ecrire("VB2=");
Ecran.Ecrire(VB2);
Ecran.Ecrire("VC2=");
Ecran.Ecrire(VC2);
Ecran.Ecrire("VD2=");
Ecran.Ecrire(VD2);
Ecran.Ecrire("\n");

Passage(VA1, VB1, VC1, VD1);
Ecran.Ecrire("VA1=");
Ecran.Ecrire(VA1);
Ecran.Ecrire("VB1=");
Ecran.Ecrire(VB1);
Ecran.Ecrire("VC1=");
Ecran.Ecrire(VC1);
Ecran.Ecrire("VD1=");
Ecran.Ecrire(VD1);
Ecran.Ecrire("\n");

VB1=0;
Ecran.Ecrire("VB1=");
Ecran.Ecrire(VB1);
VB1+=10;
Ecran.Ecrire("VB1=");
Ecran.Ecrire(VB1);
VB1-=8;
Ecran.Ecrire("VB1=");
Ecran.Ecrire(VB1);
VB1*=10;
Ecran.Ecrire("VB1=");
Ecran.Ecrire(VB1);
VB1/=10;
Ecran.Ecrire("VB1=");
Ecran.Ecrire(VB1);
VB1%=2;
Ecran.Ecrire("VB1=");
Ecran.Ecrire(VB1);
VB1&=255;
Ecran.Ecrire("VB1=");
Ecran.Ecrire(VB1);
VB1|=255;
Ecran.Ecrire("VB1=");
Ecran.Ecrire(VB1);
VB1<<=2;
Ecran.Ecrire("VB1=");
Ecran.Ecrire(VB1);
VB1>>=2;
Ecran.Ecrire("VB1=");
Ecran.Ecrire(VB1);
Ecran.Ecrire("\n");

VB1=0;
Ecran.Ecrire("++VB1=");
Ecran.Ecrire(++VB1);
Ecran.Ecrire("--VB1=");
Ecran.Ecrire(--VB1);
Ecran.Ecrire("VB1++=");
Ecran.Ecrire(VB1++);
Ecran.Ecrire("VB1--=");
Ecran.Ecrire(VB1++);
Ecran.Ecrire("\n");

VD1+="aaa";
Ecran.Ecrire("VD1=");
Ecran.Ecrire(VD1);
Fin Principal

Résultat de l'exécution

A= Vrai E= 10-10-1968 G= 10 I= 3.14 VA1= Vrai VB1= 1 VC1= 2.0 VD1= coucou VA2= Faux VB2= 3 VC2= 4.0 VD2= hello P1= Vrai P2= 1 P3= 2.0 P4= coucou VA1= Faux VB1= 1515 VC1= 2.71 VD1= schuss VB1= 0 VB1= 10 VB1= 2 VB1= 20 VB1= 2 VB1= 0 VB1= 0 VB1= 255 VB1= 1020 VB1= 255 ++VB1= 1 --VB1= 0 VB1++= 0 VB1--= 1 VD1= schussaaa