/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        D E C O U P A G E   D E S   L I G N E S   T R O P   L O N G U E S   S U R   D E S   E S P A C E S  :                       */
/*                                                                                                                                   */
/*                                                                                                                                   */
/*        Author of '$xcp/LignesTropLongues$K' :                                                                                     */
/*                                                                                                                                   */
/*                    Jean-Francois COLONNA (LACTAMME, 20240301105119).                                                              */
/*                                                                                                                                   */
/*************************************************************************************************************************************/

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        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  :                                               */
/*                                                                                                                                   */
/*************************************************************************************************************************************/

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        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   LONGUEUR_ACCEPTABLE_POUR_LES_LIGNES                                                                                           \
                    CENT                                                                                                                \
                                        /* Longueur des lignes acceptables...                                                        */
#define   CARACTERE_DE_DECOUPAGE_DES_LIGNES                                                                                             \
                    K_BLANC                                                                                                             \
                                        /* Caractere sur lequel on peut decouper une ligne...                                        */

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

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        D E C O U P A G E   D E S   L I G N E S   T R O P   L O N G U E S   S U R   D E S   E S P A C E S  :                       */
/*                                                                                                                                   */
/*************************************************************************************************************************************/
BCommande(nombre_d_arguments,arguments)
/*-----------------------------------------------------------------------------------------------------------------------------------*/
     Bblock
     DEFV(Positive,INIT(longueur_acceptable_pour_les_lignes,LONGUEUR_ACCEPTABLE_POUR_LES_LIGNES));
                                        /* Longueur des lignes acceptables...                                                        */
     DEFV(CHAR,INIT(caractere_de_decoupage_des_lignes,CARACTERE_DE_DECOUPAGE_DES_LIGNES));
                                        /* Caractere sur lequel on peut decouper une ligne...                                        */
     /*..............................................................................................................................*/
     GET_ARGUMENTS_(nombre_d_arguments
                   ,BLOC(GET_ARGUMENT_I("longueur=""la=",longueur_acceptable_pour_les_lignes);
                         GET_ARGUMENT_K("caractere_decoupage=""decoupage=""cd=",caractere_de_decoupage_des_lignes);
                         )
                    );

     begin_nouveau_block
          Bblock
          DEFV(Positive,INIT(nombre_d_octets_de_la_ligne_courante,ZERO));
                                        /* Nombre d'octets de la ligne courante.                                                     */
          DEFV(Char,INIT(caractere_courant,K_UNDEF));
                                        /* Caractere courant.                                                                        */

          Tant(GetcharT(caractere_courant))
               Bblock
                                        /* Le caractere courant de l'entree courante est recupere ; et on boucle                     */
                                        /* sur cette recuperation tant que l'on n'est pas au bout du fichier.                        */
               INCR(nombre_d_octets_de_la_ligne_courante,I);

               CALS(Putchar(caractere_courant));

               Test(IFEQ(caractere_courant,K_LF))
                    Bblock
                    CLIR(nombre_d_octets_de_la_ligne_courante);
                    Eblock
               ATes
                    Bblock
                    Eblock
               ETes

               Test(IFLE(nombre_d_octets_de_la_ligne_courante,longueur_acceptable_pour_les_lignes))
                    Bblock
                    Eblock
               ATes
                    Bblock
                    Test(IFEQ(caractere_courant,caractere_de_decoupage_des_lignes))
                         Bblock
                         CALS(Putchar(K_LF));
                         CLIR(nombre_d_octets_de_la_ligne_courante);
                         Eblock
                    ATes
                         Bblock
                         Eblock
                    ETes
                    Eblock
               ETes
               Eblock
          ETan
          Eblock
     end_nouveau_block

     RETU_Commande;
     Eblock
ECommande



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