/*************************************************************************************************************************************/ /* */ /* G E N E R A T I O N D E S P R E M I E R S E L E M E N T S */ /* D ' U N E S U I T E D E F I B O N A C C I G E N E R A L I S E E : */ /* */ /* */ /* Author of '$xci/valeurs_Fibonacci$K' : */ /* */ /* Jean-Francois COLONNA (LACTAMME, 20081221144939). */ /* */ /*************************************************************************************************************************************/ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* 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" #define U0 \ FZERO #define U1 \ FU /* Definition des deux premiers elements de la suite... */ #define EDITER_L_INDICE \ FAUX \ /* Doit-on editer l'indice de chaque element de la suite (introduit le 20170616102113) ? La */ \ /* valeur par defaut garantit la compatibilite anterieure... */ #define ALPHA \ FU #define BETA_ \ FU #define GAMMA \ FZERO /* Definition des ponderations (introduite le 20081221152055). */ #include xci/valeurs.01.I" /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* M A C R O S U T I L E S : */ /* */ /*************************************************************************************************************************************/ #include xci/valeurs.02.I" /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* G E N E R A T I O N D E S P R E M I E R S E L E M E N T S */ /* D ' U N E S U I T E D E F I B O N A C C I G E N E R A L I S E E : */ /* */ /*************************************************************************************************************************************/ 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. */ DEFV(Float,INIT(U_n_2,U0)); DEFV(Float,INIT(U_n_1,U1)); DEFV(Float,INIT(U_n__,UNDEF)); /* Definition des elements {U(n-2),U(n-1),U(n)}. */ DEFV(Logical,INIT(editer_l_indice,EDITER_L_INDICE)); /* Doit-on editer l'indice de chaque element de la suite (introduit le 20170616102113) ? La */ /* valeur par defaut garantit la compatibilite anterieure... */ DEFV(Float,INIT(alpha,ALPHA)); DEFV(Float,INIT(beta_,BETA_)); DEFV(Float,INIT(gamma,GAMMA)); /* Definition des ponderations (introduite le 20081221152055). */ #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); GET_ARGUMENT_F("u0=""U0=",U_n_2); GET_ARGUMENT_F("u1=""U1=",U_n_1); GET_ARGUMENT_L("editer_indice=""editer=""indice=",editer_l_indice); /* Arguments introduits le 20170616102113... */ GET_ARGUMENT_F("alpha=""a=",alpha); GET_ARGUMENT_F("beta=""b=",beta_); GET_ARGUMENT_F("gamma=""g=",gamma); PROCESS_ARGUMENTS_DE_PARAMETRAGE_DE_LA_GENERATION_DE_SUITE_DE_VALEURS_1; ) ); Test(IFLE(premiere_image,derniere_image)) Bblock DEFV(Int,INIT(indice_courant,INDEX0)); /* L'indice courant a ete introduit le 20170616102113... */ DoIn(numero_d_image,premiere_image,derniere_image,pas_des_images) Bblock Test(IL_FAUT(editer_l_indice)) Bblock CAL2(Prin2("%0*d ",NOMBRE_DE_CHIFFRES_DECIMAUX(NBRE(premiere_image,derniere_image)),indice_courant)); /* Possibilite introduite le 20170616102113... */ Eblock ATes Bblock Eblock ETes CAL2(Prin2(Cara(chain_Aconcaten5(INTRODUCTION_FORMAT,valeurs_signees,".*",format_d_edition,"\n")) ,NOMBRE_DE_DECIMALES_EFFECTIF(nombre_de_decimales) ,MULTIPLE_DE(ENTIER_FLOTTANT(U_n_2)) ) ); EGAL(U_n__,LIN2(alpha,U_n_2,beta_,U_n_1,gamma)); EGAL(U_n_2,U_n_1); EGAL(U_n_1,U_n__); /* Calcul de la suite de Fibonacci "generalisee" : */ /* */ /* U = A.U + B.U + G */ /* n n-2 n-1 */ /* */ /* avec : */ /* */ /* A = alpha = 1 */ /* B = beta = 1 */ /* G = gamma = 0 */ /* */ /* et : */ /* */ /* U = 0 */ /* 0 */ /* */ /* U = 1 */ /* 1 */ /* */ /* par defaut (en notant que l'on peut partir aussi de {1,1} ou encore de {1,2}...). */ INCR(indice_courant,I); Eblock EDoI Eblock ATes Bblock PRINT_ERREUR("la relation d'ordre stricte ('premier < dernier') n'est pas respectee"); Eblock ETes RETU_Commande; Eblock ECommande