Fichier pile_lifo.jps — Modifié le 3 Mai 2006 à 14 h 40

pile_lifo.pdf
Source
%% auteur : 


%% gh
%% Pile LIFO

%% échelle et étendue de l'image
60 setxunit
0 7 setxrange
-.5 8.5 setyrange

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% définitions des couleurs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

/coul0 {0 0 0 0.5 setcmykcolor} def %gris
/coul1 {noir} def
/coul2 {rouge} def
/coul3 {orange} def
/coul4 {bleu} def

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% tracé des cadres
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
/coul1
3 setlinewidth
[0 7 0 0 1.5 0 1.5 7] (-) ligne
[2 7 2 0 3.5 0 3.5 7] (-) ligne
[4 7 4 0 5.5 0 5.5 7] (-) ligne

6 setlinewidth
.2 2.9 1.3 2.9 (-) line
2.2 1.9 3.3 1.9 (-) line
4.2 3.9 5.3 3.9 (-) line

3 setlinewidth
.75 0 .75 2.9 .4 12 (-) ressort
2.75 0 2.75 1.9 .4 12 (-) ressort
4.75 0 4.75 3.9 .4 12 (-) ressort

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% tracé des éléments
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
.5 setlinewidth
/fillstyle {coul4 fill} def
/element1 { % pour représenter les éléments de la 1ère pile
  setxvar x
  [.75 x 2.5 add .7 .49 0] ellipse*
  } def
/element2 { % pour représenter les éléments de la 2ème pile
  setxvar x
  [2.75 x 2.5 add .7 .49 0] ellipse*
  } def
/element3 { % pour représenter les éléments de la 3ème pile
  setxvar x
  [4.75 x 2.5 add .7 .49 0] ellipse*
  } def
  
1 1 4 {element1}for
0 1 4 {element2}for
2 1 4 {element3}for
[6 8 .7 .49 0] ellipse*

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Flèches
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(pop2) node
() 5.6 7.6 cctext
(pop1) node
() 4.8 7 cctext

3 setlinewidth
/arrowscale {2.5 dup} def
coul2
(pop1) (pop2) (->) ncarc

pointilles
2.75 8.5 2.75 7 (->) line

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% légende
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

setPalatino
coul4
(pile) .75 0 [1.7 dup] dctext
(empile) 2.75 0 [1.7 dup] dctext
(dépile) 4.75 0 [1.7 dup] dctext