

;		x x x x x x x x x x
;		x x x x x x x x x x
;		x x x x x x x x x x
;		x x x x x x x x x x
;		x x x x x x x x x x
;		x x x x x x x x x x
;		x x x x x x x x x x
;		x x x x x x x x x x
;		x x x x x x x x x x
;		x x x x x x x x x x
;
;
;
;
;
;
;
;
;

	total_devices = 10 + 8 + 40 +24 
	module = ceiling(sqrt(total_devices))
	taille_matrice = module * module
	spare = taille_matrice - total_devices

	objets = list(10 8 40 24) 

	classement_objets = '()
	classement_objets = classer(objets) 

	taille_matrice / 9


	total_devices = 82
	
	colonne = ceiling(sqrt(total_devices))
	ligne = colonne
	if( ligne * colonne < total_devices then
	    ligne = colonne + 1	
	)

	if( ligne * colonne < total_devices then
	    ligne = ligne + 1	
	)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure(classer(liste)

   prog( ()	
		liste_classer = '()

		for(j 0 length(liste)-1
	        	if(j == 0 then  
	 		   a = nth(j liste)
			   b = nth(j+1 liste)
			   val = min(a b)
			)
			if(j > 0 then  
			   a = nth(j liste)
			   val = min(val a)
			)
	   	)
	
		min = val  
		declare(tab[length(liste)])

		for(i 0 length(liste)-1
		    tab[i] = nth(i liste)
	        )

		for(j 0 length(liste)-1-1
 	            for(i 0 length(liste)-1-1
	  	        a = tab[i]
	  	        b = tab[i+1]
	                if(b<a then
	                   tab[i] = b
		           tab[i+1] = a
                        )
	            )
                ) 

		for(i 0 length(liste)-1
		    liste_classer = append1(liste_classer tab[i])
		)		

		return(liste_classer)

    );prog	

)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure(traitement()
(
	if(geGetEditCellView()~>mode == "r" then
        hiDisplayAppDBox(
            ?name 'readOnlyErr
            ?dboxBanner "Error"
            ?dboxText "Layout must be opened with write permission"
            ?dialogType hicErrorDialog
            ?buttonLayout 'Close
        )
        return( nil )
    )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure(traitement()
(
   	
	
	liste_id='()

	liste_id = setof(element geGetSelectedSet() element~>objType=="inst") 

	nombre_mos = length(liste_id)


	for(i 0 length(liste_id)-2
		a = nth(i liste_type_cell)
		b = nth(i+1 liste_type_cell)
		if(a != b then
		   

		   hiDisplayAppDBox(
            ?name 'readOnlyErr
            ?dboxBanner "Error"
            ?dboxText "Layout must be opened with write permission"
            ?dialogType hicErrorDialog
            ?buttonLayout 'Close
        )
		
	)

	hiDisplayAppDBox(
            ?name 'readOnlyErr
            ?dboxBanner "Error"
            ?dboxText "Layout must be opened with write permission"
            ?dialogType hicErrorDialog
            ?buttonLayout 'Close
        )
        return( nil )


)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;printf("[Info]:Erreur - type de mos non homogenes !.\n")
;flag_erreur = t
;hiGetAttention()
;error( "Exactly one reference object must be selected" )
