/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        G E N E R A T I O N   D ' U N E   S E Q U E N C E   D E   N O M B R E S   D E C I M A U X                                  */
/*        C O R R E S P O N D A N T   A U X   N U M E R O S   D ' I M A G E S   D ' U N E   S E Q U E N C E  :                       */
/*                                                                                                                                   */
/*                                                                                                                                   */
/*        Definition :                                                                                                               */
/*                                                                                                                                   */
/*                    Cette commande genere une sequence                                                                             */
/*                  de nombres decimaux correspondant                                                                                */
/*                  aux numeros des images d'une sequence.                                                                           */
/*                                                                                                                                   */
/*                                                                                                                                   */
/*        Author of '$xci/nombres$K' :                                                                                               */
/*                                                                                                                                   */
/*                    Jean-Francois COLONNA (LACTAMME, 1989??????????).                                                              */
/*                                                                                                                                   */
/*************************************************************************************************************************************/

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        I N T E R F A C E   ' listG '  :                                                                                           */
/*                                                                                                                                   */
/*                                                                                                                                   */
/*        :Debut_listG:                                                                                                              */
/*        :Fin_listG:                                                                                                                */
/*                                                                                                                                   */
/*************************************************************************************************************************************/

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        D I R E C T I V E S   S P E C I F I Q U E S   D E   C O M P I L A T I O N  :                                               */
/*                                                                                                                                   */
/*************************************************************************************************************************************/
@define   PRAGMA_CL_____PAS_DE_LIBRAIRIES_DYNAMIQUES

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        F I C H I E R S   D ' I N C L U D E S  :                                                                                   */
/*                                                                                                                                   */
/*************************************************************************************************************************************/
#include  INCLUDES_MINI

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        P A R A M E T R E S  :                                                                                                     */
/*                                                                                                                                   */
/*************************************************************************************************************************************/
#define   NOM_DE_LA_SEQUENCE                                                                                                            \
                    C_VIDE                                                                                                              \
                                        /* Nom de la sequence d'image...                                                             */

#define   SEPARATEUR_DES_ELEMENTS_DE_LA_LISTE                                                                                           \
                    C_BLANC                                                                                                             \
                                        /* Separateur a utiliser entre chaque valeur editee...                                       */

#include  xci/sequence.01.I"

#define   INCREMENT_DU_NUMERO_D_IMAGE                                                                                                   \
                    ZERO                                                                                                                \
                                        /* Increment du numero d'images (introduit le 20020819162810).                               */

#define   NOMBRE_DE_CHIFFRES_A_EDITER                                                                                                   \
                    NOMBRE_DE_CHIFFRES                                                                                                  \
                                        /* Nombre de chiffres a editer pour les numeros.                                             */

#define   METTRE_UN_NUMERO_PAR_LIGNE                                                                                                    \
                    FAUX                                                                                                                \
                                        /* Faut-il mettre un numero par ligne ('VRAI') ou bien tous les mettre les uns a la          */ \
                                        /* suite des autres ('FAUX').                                                                */

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        M A C R O S   U T I L E S  :                                                                                               */
/*                                                                                                                                   */
/*************************************************************************************************************************************/

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        G E N E R A T I O N   D ' U N E   S E Q U E N C E   D E   N O M B R E S   D E C I M A U X                                  */
/*        C O R R E S P O N D A N T   A U X   N U M E R O S   D ' I M A G E S   D ' U N E   S E Q U E N C E  :                       */
/*                                                                                                                                   */
/*************************************************************************************************************************************/
BCommande(nombre_d_arguments,arguments)
/*-----------------------------------------------------------------------------------------------------------------------------------*/
     Bblock
     DEFV(CHAR,INIC(POINTERc(nom_imageA),NOM_DE_LA_SEQUENCE));
                                        /* Nom de la sequence a generer.                                                             */
     DEFV(CHAR,INIC(POINTERc(nom_postfixe),NOM_UNDEF_VIDE));
                                        /* Nom d'un eventuel postfixe a placer derriere <nom_imageA><numero> (par exemple '$ROUGE'). */
     DEFV(CHAR,INIT(POINTERc(nom_image),NOM_UNDEF));
                                        /* Nom courant des images.                                                                   */
     DEFV(Int,INIT(premiere_image,PREMIERE_IMAGE));
                                        /* Numero de la premiere image,                                                              */
     DEFV(Int,INIT(derniere_image,DERNIERE_IMAGE));
                                        /* Numero de la derniere image.                                                              */
     DEFV(Int,INIT(numero_d_image,UNDEF));
                                        /* Numero de l'image courante.                                                               */
     DEFV(Int,INIT(increment_du_numero_d_image,INCREMENT_DU_NUMERO_D_IMAGE));
                                        /* Increment du numero d'images (introduit le 20020819162810).                               */
     DEFV(Int,INIT(pas_des_images,PAS_DES_IMAGES));
                                        /* Pas de passage d'un numero d'image a une autre.                                           */
     DEFV(CHAR,INIC(POINTERc(separateur_des_elements_de_la_liste),SEPARATEUR_DES_ELEMENTS_DE_LA_LISTE));
                                        /* Separateur a utiliser entre chaque valeur editee...                                       */
     DEFV(Int,INIT(nombre_de_chiffres_a_editer,NOMBRE_DE_CHIFFRES_A_EDITER));
                                        /* Nombre de chiffres a editer pour les numeros. ATTENTION, le 20001123171725,               */
                                        /* la variable 'nombre_de_chiffres_a_editer' est passee de 'Positive' a 'Int' afin de        */
                                        /* se retrouver avec des nombres enormes comme cela s'est vu sur '$LACT14' lors d'un         */
                                        /* 'listN' portant sur un texte inexistant ('v $Falias_listG Liste=..xci.nombres.X')         */
                                        /* avec une commande du type :                                                               */
                                        /*                                                                                           */
                                        /*                  listN     XXXX YYYY                                                      */
                                        /*                                                                                           */
                                        /* ou 'XXXX' et 'YYYY' n'existent pas dans le '$Fnota' courant...                            */
     DEFV(Logical,INIT(mettre_un_numero_par_ligne,METTRE_UN_NUMERO_PAR_LIGNE));
                                        /* Faut-il mettre un numero par ligne ('VRAI') ou bien tous les mettre les uns a la          */
                                        /* suite des autres ('FAUX').                                                                */
     /*..............................................................................................................................*/
     GET_ARGUMENTS_(nombre_d_arguments
                   ,BLOC(GET_ARGUMENT_C("imageA=""A=",nom_imageA);
                         GET_ARGUMENT_C("postfixe=",nom_postfixe);
                         GET_ARGUMENT_I("premiere=""p=",premiere_image);
                         GET_ARGUMENT_I("derniere=""d=",derniere_image);
                         GET_ARGUMENT_I("increment=""i=",increment_du_numero_d_image);
                         GET_ARGUMENT_I("pas=",pas_des_images);

                         GET_ARGUMENT_C("separateur=""s=",separateur_des_elements_de_la_liste);
                         GET_ARGUMENT_I("nombre=""n=""chiffres=",nombre_de_chiffres_a_editer);
                         GET_ARGUMENT_K("zero=",PREMIER_CARACTERE_ITb0(_chain_numero_____caractere_zero_devant_un_numero));
                         GET_ARGUMENT_L("lignes=""ligne=",mettre_un_numero_par_ligne);

                         GET_ARGUMENT_I("base_numeration=""base=",_chain_numero_____base_de_numeration);
                                        /* Argument introduit le 20091212213350...                                                   */
                         )
                    );
                                        /* ATTENTION, l'option "chiffres=" contient deux lettres doublees ("ff") ce que la fonction  */
                                        /* 'sscanf(...)' de 'SYSTEME_ES9000_AIX_CC' n'accepte pas. En consequence de quoi, sur ce    */
                                        /* SYSTEME, on ne l'utilisera pas, mais plutot "nombre=" ou "n=" (voir a titre d'exemple le  */
                                        /* fichier '$Fdirectories').                                                                 */
                                        /*                                                                                           */
                                        /* Le 20070223101714, j'ai remis "chiffres=" pour des raisons d'homogeneite avec tous        */
                                        /* les programmes qui utilisent "chiffres=" (par exemple 'v $xrc/mandel.01$K chiffres=').    */

     Test(IZLT(nombre_de_chiffres_a_editer))
          Bblock
          EGAL(nombre_de_chiffres_a_editer,NOMBRE_DE_CHIFFRES_A_EDITER);
                                        /* Nombre de chiffres par defaut...                                                          */

          PRINT_ERREUR("le nombre de chiffres demande est negatif, la valeur par defaut est donc forcee");
          CAL1(Prer1("elle vaut %d\n",nombre_de_chiffres_a_editer));
          Eblock
     ATes
          Bblock
          Eblock
     ETes

     DoQu(numero_d_image,premiere_image,derniere_image,pas_des_images)
          Bblock
          DEFV(Int,INIT(numero_effectif_d_image,ADD2(numero_d_image,increment_du_numero_d_image)));
                                        /* Introduit le 20030619094650 pour la validation du signe...                                */

          Test(IZLT(numero_effectif_d_image))
                                        /* Test introduit le 20030619094650...                                                       */
               Bblock
               PRINT_ATTENTION("un numero effectif d'image est negatif");
               CAL1(Prer2("il vaut %d et va devenir %u\n",numero_effectif_d_image,POSI(numero_effectif_d_image)));
               Eblock
          ATes
               Bblock
               Eblock
          ETes

          EGAL(nom_image
              ,COND(IFEQ_chaine(nom_postfixe,NOM_UNDEF_VIDE)
                   ,chain_Aconcaten2_sauf_nom_pipe(nom_imageA
                                                  ,chain_numero(POSI(numero_effectif_d_image)
                                                               ,nombre_de_chiffres_a_editer
                                                                )
                                                   )
                   ,chain_Aconcaten3_sauf_nom_pipe(nom_imageA
                                                  ,chain_numero(POSI(numero_effectif_d_image)
                                                               ,nombre_de_chiffres_a_editer
                                                                )
                                                  ,nom_postfixe
                                                   )
                    )
               );
                                        /* Generation du nom courant,                                                                */

          Test(IL_FAUT(mettre_un_numero_par_ligne))
               Bblock
               CAL2(Prin1("%s\n"
                         ,nom_image
                          )
                    );
                                        /* Edition du nom suivi d'un changement de ligne systematique...                             */
               Eblock
          ATes
               Bblock
               CAL2(Prin1(Cara(chain_Aconcaten2("%s"
                                               ,COND(COND(IFLE(premiere_image,derniere_image)
                                                         ,IFLT(numero_d_image,derniere_image)
                                                         ,IFGT(numero_d_image,derniere_image)
                                                          )
                                                    ,separateur_des_elements_de_la_liste
                                                    ,ptCARA(C_VIDE)
                                                     )
                                                )
                               )
                         ,nom_image
                          )
                    );
                                        /* Edition du nom suivi d'un 'BLANC' sauf pour le dernier nom...                             */
               Eblock
          ETes

          CALZ_FreCC(nom_image);
                                        /* Et enfin, liberation...                                                                   */
          Eblock
     EDoQ

     RETU_Commande;
     Eblock
ECommande



Copyright © Jean-François COLONNA, 2019-2024.
Copyright © CMAP (Centre de Mathématiques APpliquées) UMR CNRS 7641 / École polytechnique, Institut Polytechnique de Paris, 2019-2024.