/*************************************************************************************************************************************/
/* */
/* T E S T D E L ' E X E C U T I O N D E ' $X ' S S O U S ' $CSH ' D A N S ' v $xcc/cpp$Z SOUS_CSH ' : */
/* */
/* */
/* Author of '$xtKg/Exec_X_CSH.01$K' : */
/* */
/* Jean-Francois COLONNA (LACTAMME, 20240117103104). */
/* */
/*************************************************************************************************************************************/
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* 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 : */
/* */
/*************************************************************************************************************************************/
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* M A C R O S U T I L E S : */
/* */
/*************************************************************************************************************************************/
#define MULTIPLICATION(constante) \
MUL2(CENT,constante)
#define K3 \
TROIS
#define K300 \
MULTIPLICATION(K3)
#define K4 \
QUATRE
#define K400 \
MULTIPLICATION(K4)
#define PRINT_D(message,constante) \
Bblock \
CAL2(Prin2("%s=%d\n",message,constante)); \
Eblock
#define PRINT_F(message,constante) \
Bblock \
CAL2(Prin2("%s=%+.^^^\n",message,constante)); \
Eblock
#define PRINT_C(code) \
Bblock \
BLOC(code); \
Eblock
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* T E S T D E L ' E X E C U T I O N D E ' $X ' S S O U S ' $CSH ' D A N S ' v $xcc/cpp$Z SOUS_CSH ' : */
/* */
/*************************************************************************************************************************************/
BCommande(nombre_d_arguments,arguments)
/*-----------------------------------------------------------------------------------------------------------------------------------*/
Bblock
DEFV(Int,INIT(niveau,0x00123456));
/*..............................................................................................................................*/
BSaveModifyVariable(Positive
,nombre_de_chiffres_des_editions_flottantes
,DIX
);
GET_ARGUMENTS_(nombre_d_arguments
,BLOC(VIDE;)
);
PRINT_D("c1",[[[[[[[[C1[[[[[[[['$xcg/ADD2.01$X x=1 y=100 signe="$K_VIDE"']]]]]]]]C1]]]]]]]]);
PRINT_D("c2",[[[[[[[[C2[[[[[[[['$xcg/ADD2.01$X x=2 y=200 signe="$K_VIDE"']]]]]]]]C2]]]]]]]]);
/* Exemples simples ou les constantes numeriques sont des suites de chiffres... */
PRINT_D("c3",[[[[[[[[C3[[[[[[[['eval $xcg/ADD2.01$X 'x=K3' 'y=`calcul K300`' signe="$K_VIDE"']]]]]]]]C3]]]]]]]]);
PRINT_D("c4",[[[[[[[[C4[[[[[[[['eval $xcg/ADD2.01$X 'x=K4' 'y=`calcul K400`' signe="$K_VIDE"']]]]]]]]C4]]]]]]]]);
/* Exemples plus compliques ou les constantes numeriques sont des parametres. On notera */
/* l'usage des '$K_QS's et des '$K_QA's : */
/* */
/* */
/* ---- pour delimiter la commande a executer sous '$CSH' ---- */
/* | | */
/* | | */
/* | Pour separer les arguments | */
/* | "x=" et "y=" ainsi que pour utiliser | */
/* | les constantes 'K4' et 'K400' | */
/* | de 'v $xcc/cpp$Z'. | */
/* | | */
/* | ---- --------------- | */
/* | | | | | | */
/* \|/ \|/ \| |/ \|/ \|/ */
/* . . . . . . */
/* */
/* 'eval $xcg/ADD2.01$X 'x=K4' 'y=`calcul K400`' signe="$K_VIDE"' */
/* ---- . . */
/* | /|\ /|\ */
/* | | | */
/* | | | */
/* | ------------------ Pour faire interpreter 'calcul' */
/* | par '$CSH' */
/* | */
/* | */
/* ---------------> Pour forcer l'evaluation de 'calcul'... */
/* */
CAL2(Prin0("\n"));
PRINT_F("pi(1)",[[[[[[[[DEC_PI_1[[[[[[[['echo 'PI'']]]]]]]]DEC_PI_1]]]]]]]]);
/* Definition 1 de 'pi'... */
PRINT_F("pi(2)",[[[[[[[[DEC_PI_2[[[[[[[['$BC --mathlib $xtb/Decimales_pi.02 | $CA']]]]]]]]DEC_PI_2]]]]]]]]);
/* Definition 2 de 'pi'... */
/* */
/* L'usage de "| $CA" est destine a eliminer les messages : */
/* */
/* bc (...) */
/* Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 (...) Free Software Foundation, Inc. */
/* This is free software with ABSOLUTELY NO WARRANTY. */
/* For details type `warranty'. */
/* */
/* et ne garder donc que la valeur calculee... */
PRINT_F("pi(3)",[[[[[[[[DEC_PI_3[[[[[[[['echo 3.14']]]]]]]]DEC_PI_3]]]]]]]]);
/* Definition 3 de 'pi'... */
#define COM_41 \
echo 3.141
PRINT_F("pi(4)",[[[[[[[[DEC_PI_4[[[[[[[['eval 'COM_41'']]]]]]]]DEC_PI_4]]]]]]]]);
/* Definition 4 de 'pi'... */
#define COM_51 \
set VaLeUr_PI=3.1415
#define COM_52 \
echo "$VaLeUr_PI"
PRINT_F("pi(5)",[[[[[[[[DEC_PI_5[[[[[[[['eval 'COM_51' ; eval 'COM_52'']]]]]]]]DEC_PI_5]]]]]]]]);
/* Definition 5 de 'pi'... */
/* */
/* A noter l'utilisation des '$K_QS' : */
/* */
/* 'eval 'COM_41' ; eval 'COM_42'' */
/* . . . . .. */
/* /|\ /|\ /|\ /|\ /||\ */
/* | | | | || */
/* | | | | || */
/* ----- -------- -- */
/* */
/* et ainsi, 'COM_41' et 'COM_42', etant a l'exterieur des paires de '$K_QS's, sont */
/* remplacees par leurs valeurs numeriques... */
#define COM_61 \
FilSTmpB FVaLeUr_PI
#define COM_62 \
echo "3.14159" >> "$FVaLeUr_PI"
#define COM_63 \
"$CA" "$FVaLeUr_PI"
#define COM_64 \
FilSTmpE FVaLeUr_PI
PRINT_F("pi(6)",[[[[[[[[DEC_PI_6[[[[[[[['eval 'COM_61' ; eval 'COM_62' ; eval 'COM_63' ; eval 'COM_64'']]]]]]]]DEC_PI_6]]]]]]]]);
/* Definition 6 de 'pi'... */
#define COM_71 \
FilSTmpB FVaLeUr_PI
#define COM_72 \
echo "3.141592" >> "$FVaLeUr_PI"
#define COM_73 \
"$CA" "$FVaLeUr_PI"
#define COM_74 \
FilSTmpE FVaLeUr_PI
#define COM_7 \
(COM_71 ; COM_72 ; COM_73 ; COM_74)
PRINT_F("pi(7)",[[[[[[[[DEC_PI_7[[[[[[[['eval 'COM_7'']]]]]]]]DEC_PI_7]]]]]]]]);
/* Definition 7 de 'pi'... */
#define COM_81 \
FilSTmpB FVaLeUr_PI
#define COM_82 \
echo "scale=8;" >> "$FVaLeUr_PI"
#define COM_83 \
echo "16*a(1/5)-4*a(1/239);" >> "$FVaLeUr_PI"
#define COM_84 \
echo "quit;" >> "$FVaLeUr_PI"
#define COM_85 \
"$BC" "--mathlib" "$FVaLeUr_PI" | "$CA"
#define COM_86 \
FilSTmpE FVaLeUr_PI
#define COM_8 \
(COM_81 ; COM_82 ; COM_83 ; COM_84 ; COM_85 ; COM_86)
PRINT_F("pi(8)",[[[[[[[[DEC_PI_8[[[[[[[['eval 'COM_8'']]]]]]]]DEC_PI_8]]]]]]]]);
/* Definition 8 de 'pi'... */
#define COM_91 \
FilSTmpB FVaLeUr_PI
#define COM_92 \
echo "scale=`calcul "NOMBRE_DE_CHIFFRES_DES_EDITIONS_FLOTTANTES"`;" >> "$FVaLeUr_PI"
/* Ceci a implique la modification 'v $xcp/Konstantes$K 20101119165021' afin qu'il n'y ait */
/* pas de parenthenses ci-dessus car, en effet, sinon cela demandait avant cette date */
/* l'execution de : */
/* */
/* echo "scale=`calcul " ( ( ( ( 16 ) + ( 1 ) ) ) + ( 1 ) ) "`;" */
/* */
/* ce qui donnait le message d'erreur suivant : */
/* */
/* Badly placed ()'s. */
/* */
/* dont j'ignore l'emetteur... */
#define COM_93 \
echo "16*a(1/5)-4*a(1/239);" >> "$FVaLeUr_PI"
#define COM_94 \
echo "quit;" >> "$FVaLeUr_PI"
#define COM_95 \
"$BC" "--mathlib" "$FVaLeUr_PI" | "$CA"
#define COM_96 \
FilSTmpE FVaLeUr_PI
#define COM_9 \
(COM_91 ; COM_92 ; COM_93 ; COM_94 ; COM_95 ; COM_96)
PRINT_F("pi(9)",[[[[[[[[DEC_PI_9[[[[[[[['eval 'COM_9'']]]]]]]]DEC_PI_9]]]]]]]]);
/* Definition 9 de 'pi'... */
CAL2(Prin0("\n"));
#define COM_A1 \
"$CA" "$xtKg/Exec_X_CSH.01.01$I"
/* Recuperation du '$I' a inclure... */
#define COM_A2 \
(eval "$GRE" "-v $K_QD""^ */\*$K_QD")
/* Suppression des commentaires de type '$c'... */
#define COM_A3 \
(eval "$SE" "-e $K_QD""s+ *+ +g$K_QD" "-e $K_QD""s+\\\n++g$K_QD")
/* Suppression des espaces redondants et des "\n"... */
#define COM_A4 \
(eval "$R" "$K_QD$K_NL$K_QD" "$K_QD$K_BLANC$K_QD")
/* Mise sur une seule ligne... */
#define COM_A5 \
"$xcp/ferme_K_NL$X"
/* Fermeture de la ligne unique... */
#define COM_A \
(COM_A1 | COM_A2 | COM_A3 | COM_A4 | COM_A5)
PRINT_C([[[[[[[[CODE_C_1[[[[[[[['eval 'COM_A'']]]]]]]]CODE_C_1]]]]]]]]);
/* Insertion d'un code '$c' 01... */
ESaveModifyVariable(Positive
,nombre_de_chiffres_des_editions_flottantes
);
RETU_Commande;
Eblock
ECommande