-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba4d6bf
commit e3bc2e7
Showing
2 changed files
with
318 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/****** LICENCE CECIL *****/ | ||
|
||
#ifndef _DEBUG_H_ | ||
#define _DEBUG_H_ | ||
|
||
#include "conf.h" | ||
#include "repeat.h" | ||
|
||
#ifdef FLG_DEBUG | ||
extern int nb_err; | ||
#if NB_DEBUG_C <= 0 | ||
extern int nb_debug; | ||
#else | ||
#define LOOP_DEBUG(n, _) \ | ||
extern int CAT(nb_debug, TWO_DIGITS(INC(n))); | ||
EVAL(REPEAT(NB_DEBUG_C, LOOP_DEBUG)) | ||
#undef LOOP_DEBUG | ||
#endif /* NB_DEBUG_C <= 0 */ | ||
extern int nb_call; | ||
#endif /* FLG_DEBUG */ | ||
|
||
#if defined(FLG_DEBUG) || defined(FLG_CONTROLE_IMMEDIAT) | ||
extern int nb_verif; | ||
#endif /* FLG_DEBUG || FLG_CONTROLE_IMMEDIAT */ | ||
|
||
#ifdef FLG_TRACE | ||
extern int niv_trace; | ||
extern void aff1 _PROTS((const char *nom)); | ||
extern void aff_val _PROTS((const char *nom, const T_irdata *irdata, int indice, int niv, const char *chaine, int is_tab, int expr, int maxi)); | ||
extern void aff_double _PROTS((const char *nom, double valeur)); | ||
#define aff2(nom,irdata,indice) aff_val(nom,irdata,indice,2,"<-", 0, 0, 1) | ||
#define aff2_tab(nom,irdata,indice,expr,maxi) aff_val(nom,irdata,indice,2,"<-", 1, expr, maxi) | ||
#define aff3(nom,irdata,indice) aff_val(nom,irdata,indice,3,":", 0, 0, 1) | ||
#define aff3_tab(nom,irdata,indice,expr,maxi) aff_val(nom,irdata,indice,3,":", 1, expr, maxi) | ||
#endif /* FLG_TRACE */ | ||
|
||
#if defined(FLG_DEBUG) || defined(FLG_CONTROLE_IMMEDIAT) | ||
extern T_discord *une_verif _PROTS((T_irdata *irdata, void (*)(T_irdata *irdata))); | ||
#endif /* FLG_DEBUG || FLG_CONTROLE_IMMEDIAT */ | ||
|
||
#endif /* _DEBUG_H_ */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,276 @@ | ||
/****** LICENCE CECIL *****/ | ||
|
||
#ifndef _REPEAT_H_ | ||
#define _REPEAT_H_ | ||
|
||
#define CAT(a, ...) PRIMITIVE_CAT(a, __VA_ARGS__) | ||
#define PRIMITIVE_CAT(a, ...) a ## __VA_ARGS__ | ||
|
||
#define INC(x) PRIMITIVE_CAT(INC_, x) | ||
#define INC_0 1 | ||
#define INC_1 2 | ||
#define INC_2 3 | ||
#define INC_3 4 | ||
#define INC_4 5 | ||
#define INC_5 6 | ||
#define INC_6 7 | ||
#define INC_7 8 | ||
#define INC_8 9 | ||
#define INC_9 10 | ||
#define INC_10 11 | ||
#define INC_11 12 | ||
#define INC_12 13 | ||
#define INC_13 14 | ||
#define INC_14 15 | ||
#define INC_15 16 | ||
#define INC_16 17 | ||
#define INC_17 18 | ||
#define INC_18 19 | ||
#define INC_19 20 | ||
#define INC_20 21 | ||
#define INC_21 22 | ||
#define INC_22 23 | ||
#define INC_23 24 | ||
#define INC_24 25 | ||
#define INC_25 26 | ||
#define INC_26 27 | ||
#define INC_27 28 | ||
#define INC_28 29 | ||
#define INC_29 30 | ||
#define INC_30 31 | ||
#define INC_31 32 | ||
#define INC_32 33 | ||
#define INC_33 34 | ||
#define INC_34 35 | ||
#define INC_35 36 | ||
#define INC_36 37 | ||
#define INC_37 38 | ||
#define INC_38 39 | ||
#define INC_39 40 | ||
#define INC_40 41 | ||
#define INC_41 42 | ||
#define INC_42 43 | ||
#define INC_43 44 | ||
#define INC_44 45 | ||
#define INC_45 46 | ||
#define INC_46 47 | ||
#define INC_47 48 | ||
#define INC_48 49 | ||
#define INC_49 50 | ||
#define INC_50 51 | ||
#define INC_51 52 | ||
#define INC_52 53 | ||
#define INC_53 54 | ||
#define INC_54 55 | ||
#define INC_55 56 | ||
#define INC_56 57 | ||
#define INC_57 58 | ||
#define INC_58 59 | ||
#define INC_59 60 | ||
#define INC_60 61 | ||
#define INC_61 62 | ||
#define INC_62 63 | ||
#define INC_63 64 | ||
#define INC_64 65 | ||
#define INC_65 66 | ||
#define INC_66 67 | ||
#define INC_67 68 | ||
#define INC_68 69 | ||
#define INC_69 70 | ||
#define INC_70 71 | ||
#define INC_71 72 | ||
#define INC_72 73 | ||
#define INC_73 74 | ||
#define INC_74 75 | ||
#define INC_75 76 | ||
#define INC_76 77 | ||
#define INC_77 78 | ||
#define INC_78 79 | ||
#define INC_79 80 | ||
#define INC_80 81 | ||
#define INC_81 82 | ||
#define INC_82 83 | ||
#define INC_83 84 | ||
#define INC_84 85 | ||
#define INC_85 86 | ||
#define INC_86 87 | ||
#define INC_87 88 | ||
#define INC_88 89 | ||
#define INC_89 90 | ||
#define INC_90 91 | ||
#define INC_91 92 | ||
#define INC_92 93 | ||
#define INC_93 94 | ||
#define INC_94 95 | ||
#define INC_95 96 | ||
#define INC_96 97 | ||
#define INC_97 98 | ||
#define INC_98 99 | ||
#define INC_99 100 | ||
#define INC_100 101 | ||
|
||
#define DEC(x) PRIMITIVE_CAT(DEC_, x) | ||
#define DEC_0 0 | ||
#define DEC_1 0 | ||
#define DEC_2 1 | ||
#define DEC_3 2 | ||
#define DEC_4 3 | ||
#define DEC_5 4 | ||
#define DEC_6 5 | ||
#define DEC_7 6 | ||
#define DEC_8 7 | ||
#define DEC_9 8 | ||
#define DEC_10 9 | ||
#define DEC_11 10 | ||
#define DEC_12 11 | ||
#define DEC_13 12 | ||
#define DEC_14 13 | ||
#define DEC_15 14 | ||
#define DEC_16 15 | ||
#define DEC_17 16 | ||
#define DEC_18 17 | ||
#define DEC_19 18 | ||
#define DEC_20 19 | ||
#define DEC_21 20 | ||
#define DEC_22 21 | ||
#define DEC_23 22 | ||
#define DEC_24 23 | ||
#define DEC_25 24 | ||
#define DEC_26 25 | ||
#define DEC_27 26 | ||
#define DEC_28 27 | ||
#define DEC_29 28 | ||
#define DEC_30 29 | ||
#define DEC_31 30 | ||
#define DEC_32 31 | ||
#define DEC_33 32 | ||
#define DEC_34 33 | ||
#define DEC_35 34 | ||
#define DEC_36 35 | ||
#define DEC_37 36 | ||
#define DEC_38 37 | ||
#define DEC_39 38 | ||
#define DEC_40 39 | ||
#define DEC_41 40 | ||
#define DEC_42 41 | ||
#define DEC_43 42 | ||
#define DEC_44 43 | ||
#define DEC_45 44 | ||
#define DEC_46 45 | ||
#define DEC_47 46 | ||
#define DEC_48 47 | ||
#define DEC_49 48 | ||
#define DEC_50 49 | ||
#define DEC_51 50 | ||
#define DEC_52 51 | ||
#define DEC_53 52 | ||
#define DEC_54 53 | ||
#define DEC_55 54 | ||
#define DEC_56 55 | ||
#define DEC_57 56 | ||
#define DEC_58 57 | ||
#define DEC_59 58 | ||
#define DEC_60 59 | ||
#define DEC_61 60 | ||
#define DEC_62 61 | ||
#define DEC_63 62 | ||
#define DEC_64 63 | ||
#define DEC_65 64 | ||
#define DEC_66 65 | ||
#define DEC_67 66 | ||
#define DEC_68 67 | ||
#define DEC_69 68 | ||
#define DEC_70 69 | ||
#define DEC_71 70 | ||
#define DEC_72 71 | ||
#define DEC_73 72 | ||
#define DEC_74 73 | ||
#define DEC_75 74 | ||
#define DEC_76 75 | ||
#define DEC_77 76 | ||
#define DEC_78 77 | ||
#define DEC_79 78 | ||
#define DEC_80 79 | ||
#define DEC_81 80 | ||
#define DEC_82 81 | ||
#define DEC_83 82 | ||
#define DEC_84 83 | ||
#define DEC_85 84 | ||
#define DEC_86 85 | ||
#define DEC_87 86 | ||
#define DEC_88 87 | ||
#define DEC_89 88 | ||
#define DEC_90 89 | ||
#define DEC_91 90 | ||
#define DEC_92 91 | ||
#define DEC_93 92 | ||
#define DEC_94 93 | ||
#define DEC_95 94 | ||
#define DEC_96 95 | ||
#define DEC_97 96 | ||
#define DEC_98 97 | ||
#define DEC_99 98 | ||
#define DEC_100 99 | ||
|
||
#define IIF(c) PRIMITIVE_CAT(IIF_, c) | ||
#define IIF_0(t, ...) __VA_ARGS__ | ||
#define IIF_1(t, ...) t | ||
|
||
#define COMPL(b) PRIMITIVE_CAT(COMPL_, b) | ||
#define COMPL_0 1 | ||
#define COMPL_1 0 | ||
|
||
#define CHECK_N(x, n, ...) n | ||
#define CHECK(...) CHECK_N(__VA_ARGS__, 0,) | ||
#define PROBE(x) x, 1, | ||
|
||
#define NOT(x) CHECK(PRIMITIVE_CAT(NOT_, x)) | ||
#define NOT_0 PROBE(~) | ||
|
||
#define BELOW_10(x) CHECK(PRIMITIVE_CAT(BELOW_10_, x)) | ||
#define BELOW_10_0 PROBE(~) | ||
#define BELOW_10_1 PROBE(~) | ||
#define BELOW_10_2 PROBE(~) | ||
#define BELOW_10_3 PROBE(~) | ||
#define BELOW_10_4 PROBE(~) | ||
#define BELOW_10_5 PROBE(~) | ||
#define BELOW_10_6 PROBE(~) | ||
#define BELOW_10_7 PROBE(~) | ||
#define BELOW_10_8 PROBE(~) | ||
#define BELOW_10_9 PROBE(~) | ||
|
||
#define TWO_DIGITS(n) IF(BELOW_10(n))(CAT(0, n), n) | ||
|
||
#define BOOL(x) COMPL(NOT(x)) | ||
#define IF(c) IIF(BOOL(c)) | ||
|
||
#define EMPTY() | ||
#define DEFER(id) id EMPTY() | ||
#define OBSTRUCT(...) __VA_ARGS__ DEFER(EMPTY)() | ||
#define EXPAND(...) __VA_ARGS__ | ||
#define EAT(...) | ||
#define WHEN(c) IF(c)(EXPAND, EAT) | ||
|
||
#define REPEAT(count, macro, ...) \ | ||
WHEN(count) \ | ||
( \ | ||
OBSTRUCT(REPEAT_INDIRECT) () \ | ||
( \ | ||
DEC(count), macro, __VA_ARGS__ \ | ||
) \ | ||
OBSTRUCT(macro) \ | ||
( \ | ||
DEC(count), __VA_ARGS__ \ | ||
) \ | ||
) | ||
#define REPEAT_INDIRECT() REPEAT | ||
|
||
#define EVAL(...) EVAL1(EVAL1(EVAL1(__VA_ARGS__))) | ||
#define EVAL1(...) EVAL2(EVAL2(EVAL2(__VA_ARGS__))) | ||
#define EVAL2(...) EVAL3(EVAL3(EVAL3(__VA_ARGS__))) | ||
#define EVAL3(...) EVAL4(EVAL4(EVAL4(__VA_ARGS__))) | ||
#define EVAL4(...) EVAL5(EVAL5(EVAL5(__VA_ARGS__))) | ||
#define EVAL5(...) __VA_ARGS__ | ||
|
||
#endif /* _REPEAT_H_ */ | ||
|