/*************************************************************************************************************************************/ /* */ /* G E N E R A T I O N D E V A L E U R S C O R R E S P O N D A N T A */ /* T O U S L E S C O U P L E S D E N O M B R E S P O S S I B L E S : */ /* */ /* */ /* Author of '$xci/valeurs_coup$K' : */ /* */ /* Jean-Francois COLONNA (LACTAMME, 20000125153619). */ /* */ /*************************************************************************************************************************************/ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* 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 : */ /* */ /*************************************************************************************************************************************/ #include xci/sequence.01.I" #include xci/valeurs.01.I" /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* M A C R O S U T I L E S : */ /* */ /*************************************************************************************************************************************/ #include xci/valeurs.02.I" #define EDITER_UNE_VALEUR(valeur) \ Bblock \ Test(IFLE(numero_d_image,derniere_image)) \ Bblock \ CAL2(Prin2(Cara(chain_Aconcaten5(INTRODUCTION_FORMAT,valeurs_signees,".*",format_d_edition,"\n")) \ ,NOMBRE_DE_DECIMALES_EFFECTIF(nombre_de_decimales) \ ,MULTIPLE_DE(ENTIER_FLOTTANT(FLOT(valeur))) \ ) \ ); \ Eblock \ ATes \ Bblock \ Eblock \ ETes \ \ INCR(numero_d_image,pas_des_images); \ /* Numero de la prochaine image... */ \ Eblock \ /* Procedure d'edition conditionnelle. */ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* G E N E R A T I O N D E V A L E U R S C O R R E S P O N D A N T A */ /* T O U S L E S C O U P L E S D E N O M B R E S P O S S I B L E S : */ /* */ /*************************************************************************************************************************************/ BCommande(nombre_d_arguments,arguments) /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock 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(pas_des_images,PAS_DES_IMAGES)); /* Pas de passage d'un numero d'image a une autre. */ #include xci/valeurs.03.I" /*..............................................................................................................................*/ GET_ARGUMENTS_(nombre_d_arguments ,BLOC(GET_ARGUMENT_I("premiere=""p=""D=",premiere_image); GET_ARGUMENT_I("derniere=""d=""A=",derniere_image); GET_ARGUMENT_I("pas=",pas_des_images); PROCESS_ARGUMENTS_DE_PARAMETRAGE_DE_LA_GENERATION_DE_SUITE_DE_VALEURS_1; /* Cette procedure fut introduite le 20061226185734... */ ) ); Test(IFLE(premiere_image,derniere_image)) Bblock DEFV(Int,INIT(premier_element_courant,UNDEF)); DEFV(Int,INIT(second_element_courant,UNDEF)); /* Numero des elements courants d'un couple. */ DEFV(Int,INIT(premier_element,premiere_image)); DEFV(Int,INIT(dernier_element,UNDEF)); DEFV(Float,INIT(dernier_element_flottant ,ADD2(ADD2(FLOT(premiere_image) ,aCOMP(RACINE_REELLE_p_DE_L_EQUATION_DU_SECOND_DEGRE(FU ,FU ,NEGA(GRO2(MOIT(FLOT(NBRE(premiere_image ,derniere_image ) ) ) ) ) ) ) ) ,FLOT(pas_des_images) ) ) ); /* Numero du premier et du dernier element. On notera que le numero du dernier element */ /* est obtenu en resolvant l'equation du second degre : */ /* */ /* x(x+1) N */ /* -------- = --- */ /* 2 2 */ /* */ /* soit : */ /* */ /* 2 N */ /* x + x - 2--- = 0 */ /* 2 */ /* */ /* ou 'N' est le nombre de nombres a editer (il est divise par 2 puisque l'on s'interesse */ /* a des couples...). */ /* */ /* On notera que l'on ne peut utiliser 'TRMU(...)' car il fait un 'INTE(...)' via */ /* 'INDX(...)'. */ EGAL(dernier_element,ADD2(INTE(dernier_element_flottant),COND(fEST_ENTIER(dernier_element_flottant),ZERO,pas_des_images))); /* Afin de pouvoir generer le bon nombre de nombres.... */ EGAL(numero_d_image,premiere_image); DoIn(premier_element_courant,premier_element,dernier_element,pas_des_images) Bblock DoIn(second_element_courant,SUCC(premier_element_courant),dernier_element,pas_des_images) Bblock EDITER_UNE_VALEUR(premier_element_courant); /* Edition du premier element du couple courant. */ EDITER_UNE_VALEUR(second_element_courant); /* Edition du second element du couple courant. */ Eblock EDoI Eblock EDoI Eblock ATes Bblock PRINT_ERREUR("la relation d'ordre stricte ('premier < dernier') n'est pas respectee"); Eblock ETes RETU_Commande; Eblock ECommande