diff --git a/.gitmodules b/.gitmodules index cec62ba3..397f43fb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "ir-calcul"] path = ir-calcul url = https://gitlab.adullact.net/dgfip/ir-calcul.git +[submodule "mlang-deps"] + path = mlang-deps + url = https://forge.dgfip.finances.rie.gouv.fr/dgfip/si-1e/firsth/ir/calculette/mlang-deps.git diff --git a/examples/dgfip_c/ml_primitif/c_driver_inline_4/annee.h b/examples/dgfip_c/ml_primitif/c_driver_inline_4/annee.h deleted file mode 100644 index 1a02a2d6..00000000 --- a/examples/dgfip_c/ml_primitif/c_driver_inline_4/annee.h +++ /dev/null @@ -1,9 +0,0 @@ -/****** LICENCE CECIL *****/ - -#ifndef _ANNEE_H_ -#define _ANNEE_H_ - -#include "var.h" - -#endif - diff --git a/examples/dgfip_c/ml_primitif/c_driver_inline_4/const.h b/examples/dgfip_c/ml_primitif/c_driver_inline_4/const.h deleted file mode 100644 index 8e02aa68..00000000 --- a/examples/dgfip_c/ml_primitif/c_driver_inline_4/const.h +++ /dev/null @@ -1,9 +0,0 @@ -/****** LICENCE CECIL *****/ - -#ifndef _CONST_H_ -#define _CONST_H_ - -#include "var.h" - -#endif - diff --git a/examples/dgfip_c/ml_primitif/c_driver_inline_4/dbg.h b/examples/dgfip_c/ml_primitif/c_driver_inline_4/dbg.h deleted file mode 100644 index 35d8bc83..00000000 --- a/examples/dgfip_c/ml_primitif/c_driver_inline_4/dbg.h +++ /dev/null @@ -1,37 +0,0 @@ -/****** LICENCE CECIL *****/ - -#ifndef _DEBUG_H_ -#define _DEBUG_H_ - -#include "conf.h" - -#ifdef FLG_DEBUG -extern int nb_err; -#if NB_DEBUG_C <= 0 -extern int nb_debug; -#else -extern int nb_debug01; -extern int nb_debug02; -extern int nb_debug03; -extern int nb_debug04; -#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 */ - -#endif /* _DEBUG_H_ */ - diff --git a/examples/dgfip_c/ml_primitif/c_driver_inline_4/desc_inv.h b/examples/dgfip_c/ml_primitif/c_driver_inline_4/desc_inv.h deleted file mode 100644 index 1c2506a0..00000000 --- a/examples/dgfip_c/ml_primitif/c_driver_inline_4/desc_inv.h +++ /dev/null @@ -1,9 +0,0 @@ -/****** LICENCE CECIL *****/ - -#ifndef _DESC_INV_H_ -#define _DESC_INV_H_ - -#include "var.h" - -#endif - diff --git a/examples/dgfip_c/ml_primitif/c_driver_inline_4/irdata.c b/examples/dgfip_c/ml_primitif/c_driver_inline_4/irdata.c deleted file mode 100644 index b8ab5372..00000000 --- a/examples/dgfip_c/ml_primitif/c_driver_inline_4/irdata.c +++ /dev/null @@ -1,1858 +0,0 @@ -/****** LICENCE CECIL *****/ - -#include "conf.h" - -#include -#include -#include -#include -#include -#include -#include -#include "irdata.h" -#include "var.h" - - - -#ifdef FLG_TRACE_IRDATA - -#define AFF(nom) case nom: (void) fprintf(stderr, "nom"); break - -static void trace_type(int n) -{ - switch (n) { - AFF(TYPE_CONTEXTE); - AFF(TYPE_FAMILLE); - AFF(TYPE_REVENU); - AFF(TYPE_REVENU_CORREC); - AFF(TYPE_VARIATION); - AFF(TYPE_RESTITUEE); -#ifdef FLG_DEBUG - AFF(TYPE_DEBUG); -#endif /* FLG_DEBUG */ - default: (void)fprintf(stderr, "%d!!!", n); - } -} - -static void trace_var_irdata(T_var_irdata desc) -{ - if (desc == NULL) { - fprintf(stderr, "NULL"); - } else { - int delta; - fprintf(stderr, "(\"%s\":", ((T_desc_contexte *)desc)->nom); - delta = ((T_desc_contexte *)desc) - desc_contexte; - if ((delta >= 0) && (delta < nb_contexte)) trace_type(TYPE_CONTEXTE); - else { - delta = ((T_desc_famille *)desc) - desc_famille; - if ((delta >= 0) && (delta < nb_famille)) trace_type(TYPE_FAMILLE); - else { - delta = ((T_desc_revenu *)desc) - desc_revenu; - if ((delta >= 0) && (delta < nb_revenu)) trace_type(TYPE_REVENU); - else { - delta = ((T_desc_revenu_correc *)desc) - desc_revenu_correc; - if ((delta >= 0) && (delta < nb_revenu_correc)) trace_type(TYPE_REVENU_CORREC); - else { - delta = ((T_desc_variation *)desc) - desc_variation; - if ((delta >= 0) && (delta < nb_variation)) trace_type(TYPE_VARIATION); - else { - delta = ((T_desc_restituee *)desc) - desc_restituee; - if ((delta >= 0) && (delta < nb_restituee)) trace_type(TYPE_RESTITUEE); -#ifdef FLG_DEBUG -#if NB_DEBUG_C <= 0 - else { - delta = ((T_desc_debug *)desc) - desc_debug; - if ((delta >= 0) && (delta < nb_debug)) trace_type(TYPE_DEBUG); - else fprintf(stderr, "???"); - } -#else - else { - delta = ((T_desc_debug *)desc) - desc_debug01; - if ((delta >= 0) && (delta < nb_debug01)) trace_type(TYPE_DEBUG); - else { - delta = ((T_desc_debug *)desc) - desc_debug02; - if ((delta >= 0) && (delta < nb_debug02)) trace_type(TYPE_DEBUG); - else { - delta = ((T_desc_debug *)desc) - desc_debug03; - if ((delta >= 0) && (delta < nb_debug03)) trace_type(TYPE_DEBUG); - else { - delta = ((T_desc_debug *)desc) - desc_debug04; - if ((delta >= 0) && (delta < nb_debug04)) trace_type(TYPE_DEBUG); - else fprintf(stderr, "???"); - } } } } -#endif /* NB_DEBUG_C <= 0 */ -#endif /* FLG_DEBUG */ - } - } - } - } - } - putc(')', stderr); - } -} - -#ifdef FLG_DEBUG - -static void trace_regle_calcul(T_regle_calcul desc) -{ - if (desc == NULL) { - fprintf(stderr, "NULL"); - } else { - int delta; - delta = ((T_regle_calcul)desc) - desc_call; - if ((delta >= 0) && (delta < nb_call)) - fprintf(stderr, "(\"regle_%d\")", ((T_regle_calcul)desc)->num); - else fprintf(stderr, "(inconnue)"); - } -} - -#endif /* FLG_DEBUG */ - -#if defined(FLG_DEBUG) || defined(FLG_CONTROLE_IMMEDIAT) - -static void trace_regle_verif(T_regle_verif desc) -{ - if (desc == NULL) { - fprintf(stderr, "NULL"); - } else { - int delta; - delta = ((T_regle_verif)desc) - desc_verif; - if ((delta >= 0) && (delta < nb_verif)) - fprintf(stderr, "(\"regle_%d\")", ((T_regle_verif)desc)->num); - else fprintf(stderr, "(inconnue)"); - } -} - -#endif /* FLG_DEBUG || FLG_CONTROLE_IMMEDIAT */ - -static void trace_discord(T_discord *discord) -{ - if (discord == NULL) { - fprintf(stderr, "NULL"); - } else if ((discord->erreur->type == ANOMALIE)) { - fprintf(stderr, "anomalie \"%s\"", discord->erreur->nom); - } else if ((discord->erreur->type == DISCORDANCE)) { - fprintf(stderr, "discordance \"%s\"", discord->erreur->nom); - } else if ((discord->erreur->type == INFORMATIVE)) { - fprintf(stderr, "informative \"%s\"", discord->erreur->nom); - } -} - -#endif /* FLG_TRACE_IRDATA */ - - - -int IRDATA_annee_revenu(void) -{ - return ANNEE_REVENU; -} - - - -T_irdata * IRDATA_new_irdata(void) -{ - T_irdata *irdata; - if ((irdata = (T_irdata *)malloc(sizeof(T_irdata))) == NULL) return NULL; -#ifndef FLG_COMPACT - irdata->saisie = NULL; - irdata->def_saisie = NULL; - irdata->calculee = NULL; - irdata->def_calculee = NULL; - irdata->base = NULL; - irdata->def_base = NULL; - if (taille_saisie > 0) { - if ((irdata->saisie = (double *)malloc(taille_saisie * sizeof(double))) == NULL) { - IRDATA_delete_irdata(irdata); - return NULL; - } - if ((irdata->def_saisie = (char *)malloc(taille_saisie * sizeof(char))) == NULL) { - IRDATA_delete_irdata(irdata); - return NULL; - } - } - if (taille_calculee > 0) { - if ((irdata->calculee = (double *)malloc(taille_calculee * sizeof(double))) == NULL) { - IRDATA_delete_irdata(irdata); - return NULL; - } - if ((irdata->def_calculee = (char *)malloc(taille_calculee * sizeof(char))) == NULL) { - IRDATA_delete_irdata(irdata); - return NULL; - } - } - if (taille_base > 0) { - if ((irdata->base = (double *)malloc(taille_base * sizeof(double))) == NULL) { - IRDATA_delete_irdata(irdata); - return NULL; - } - if ((irdata->def_base = (char *)malloc(taille_base * sizeof(char))) == NULL) { - IRDATA_delete_irdata(irdata); - return NULL; - } - } -#ifdef FLG_MULTITHREAD - irdata->discords = NULL; - irdata->tas_discord = NULL; - irdata->p_discord = &irdata->discords; - irdata->nb_bloquantes = 0; - irdata->max_bloquantes = 0; -#endif /* FLG_MULTITHREAD */ -#endif /* !FLG_COMPACT */ - irdata->ctx_pr_out.indent = 0; - irdata->ctx_pr_out.is_newline = 1; - irdata->ctx_pr_err.indent = 0; - irdata->ctx_pr_err.is_newline = 1; - IRDATA_reset_irdata(irdata); - return irdata; -} - -void IRDATA_delete_irdata(T_irdata *irdata) -{ - if (irdata != NULL) { -#ifndef FLG_COMPACT - if (irdata->saisie != NULL) free(irdata->saisie); - if (irdata->calculee != NULL) free(irdata->calculee); - if (irdata->base != NULL) free(irdata->base); - if (irdata->def_saisie != NULL) free(irdata->def_saisie); - if (irdata->def_calculee != NULL) free(irdata->def_calculee); - if (irdata->def_base != NULL) free(irdata->def_base); -#endif /* FLG_COMPACT */ -#ifdef FLG_MULTITHREAD - IRDATA_reset_erreur(irdata); - while (irdata->tas_discord != NULL) { - *(irdata->p_discord) = irdata->tas_discord; - irdata->tas_discord = (irdata->tas_discord)->suivant; - free (*irdata->p_discord); - } -#endif /* FLG_MULTITHREAD */ - free(irdata); - } -} - - - -#ifdef FLG_MULTITHREAD - -void IRDATA_reset_erreur(T_irdata *irdata) -{ - *irdata->p_discord = irdata->tas_discord; - irdata->tas_discord = irdata->discords; - irdata->discords = 0; - irdata->p_discord = &irdata->discords; - irdata->nb_bloquantes = 0; -} - -void IRDATA_set_max_bloquantes(struct S_irdata *irdata, const int max_ano) -{ - irdata->max_bloquantes = max_ano; -} - -#endif /* FLG_MULTITHREAD */ - - - -static void reset_tab(double *p_double, char *p_char, int nb) -{ -#ifdef FLG_GCOS - memset(p_double, 0, sizeof(double)*nb); - memset(p_char, 0, nb); -#else - while (nb > 0) { - *p_double++ = 0; - *p_char++ = 0; - nb--; - } -#endif /* FLG_GCOS */ -} - -void IRDATA_reset_irdata(T_irdata *irdata) -{ -#ifdef FLG_COMPACT - reset_tab(irdata->valeurs, irdata->defs, taille_totale); -#else - reset_tab(irdata->saisie, irdata->def_saisie, taille_saisie); - reset_tab(irdata->calculee, irdata->def_calculee, taille_calculee); - reset_tab(irdata->base, irdata->def_base, taille_base); -#endif /* FLG_COMPACT */ -#ifdef FLG_MULTITHREAD - IRDATA_reset_erreur(irdata); -#endif /* FLG_MULTITHREAD */ -} - -void IRDATA_reset_light(T_irdata *irdata) -{ -#ifdef FLG_COMPACT - reset_tab(irdata->valeurs, irdata->defs, taille_saisie + taille_calculee); -#else - reset_tab(irdata->saisie, irdata->def_saisie, taille_saisie); - reset_tab(irdata->calculee, irdata->def_calculee, taille_calculee); -#endif /* FLG_COMPACT */ -} - -void IRDATA_reset_base(T_irdata *irdata) -{ -#ifdef FLG_COMPACT - reset_tab(irdata->valeurs + taille_saisie + taille_calculee, irdata->defs + taille_saisie + taille_calculee, taille_base); -#else - reset_tab(irdata->base, irdata->def_base, taille_base); -#endif /* FLG_COMPACT */ -} - -void IRDATA_reset_calculee(T_irdata *irdata) -{ -#ifdef FLG_COMPACT - reset_tab(irdata->valeurs + taille_saisie, irdata->defs + taille_saisie, taille_calculee); -#else - reset_tab(irdata->calculee, irdata->def_calculee, taille_calculee); -#endif /* FLG_COMPACT */ -} - - - -#ifdef FLG_CORRECTIF - -void IRDATA_recopie_irdata(const T_irdata *irdata_src, T_irdata *irdata_dst) -{ -#ifdef FLG_COMPACT - memcpy(irdata_dst->valeurs, irdata_src->valeurs, taille_totale * sizeof(double)); - memcpy(irdata_dst->defs, irdata_src->defs, taille_totale); -#else - memcpy(irdata_dst->saisie, irdata_src->saisie, taille_saisie * sizeof(double)); - memcpy(irdata_dst->def_saisie, irdata_src->def_saisie, taille_saisie); - memcpy(irdata_dst->calculee, irdata_src->calculee, taille_calculee * sizeof(double)); - memcpy(irdata_dst->def_calculee, irdata_src->def_calculee, taille_calculee); - memcpy(irdata_dst->base, irdata_src->base, taille_base * sizeof(double)); - memcpy(irdata_dst->def_base, irdata_src->def_base, taille_base); -#endif /* FLG_COMPACT */ -} - -void IRDATA_recopie_irdata_light(const T_irdata *irdata_src, T_irdata *irdata_dst) -{ -#ifdef FLG_COMPACT - memcpy(irdata_dst->valeurs, irdata_src->valeurs, (taille_saisie + taille_calculee) * sizeof(double)); - memcpy(irdata_dst->defs, irdata_src->defs, (taille_saisie + taille_calculee)); -#else - memcpy(irdata_dst->saisie, irdata_src->saisie, taille_saisie * sizeof(double)); - memcpy(irdata_dst->def_saisie, irdata_src->def_saisie, taille_saisie); - memcpy(irdata_dst->calculee, irdata_src->calculee, taille_calculee * sizeof(double)); - memcpy(irdata_dst->def_calculee, irdata_src->def_calculee, taille_calculee); -#endif /* FLG_COMPACT */ -} - -#endif /* FLG_CORRECTIF */ - - - -void IRDATA_efface(T_irdata *irdata, T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "efface("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); -#endif /* FLG_TRACE_IRDATA */ -#ifdef FLG_COMPACT - T_indice indice = ((T_desc_contexte *)desc)->indice; - irdata->valeurs[indice] = 0; - irdata->defs[indice] = 0; -#else - T_indice indice = ((T_desc_contexte *)desc)->indice & INDICE_VAL; - if ((((T_desc_contexte *)desc)->indice & EST_MASQUE) != EST_SAISIE) - return; - irdata->saisie[indice] = 0; - irdata->def_saisie[indice] = 0; -#endif /* FLG_COMPACT */ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "efface = void\n"); -#endif /* FLG_TRACE_IRDATA */ -} - -void IRDATA_efface_tableau(T_irdata *irdata, T_var_irdata desc, int ind) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "efface_tableau("); - trace_var_irdata(desc); - fprintf(stderr, "[%d])\n", ind); -#endif /* FLG_TRACE_IRDATA */ -#ifdef FLG_COMPACT - T_indice indice = ((T_desc_contexte *)desc)->indice + ind; - irdata->valeurs[indice] = 0; - irdata->defs[indice] = 0; -#else - T_indice indice = (((T_desc_contexte *)desc)->indice & INDICE_VAL) + ind; - if ((((T_desc_contexte *)desc)->indice & EST_MASQUE) != EST_SAISIE) - return; - irdata->saisie[indice] = 0; - irdata->def_saisie[indice] = 0; -#endif /* FLG_COMPACT */ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "efface_tableau = void\n"); -#endif /* FLG_TRACE_IRDATA */ -} - - - -struct S_discord * IRDATA_range(T_irdata *irdata, T_var_irdata desc, double valeur) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "range("); - trace_var_irdata(desc); - fprintf(stderr, ", %.3f)\n", valeur); -#endif /* FLG_TRACE_IRDATA */ - T_discord *discord = NULL; -#ifdef FLG_MULTITHREAD - double old_valeur; - int old_val_def; -#else - static double old_valeur; - static int old_val_def; -#endif /* FLG_MULTITHREAD */ -#ifdef FLG_COMPACT - T_indice indice = ((T_desc_contexte *)desc)->indice; - old_valeur = irdata->valeurs[indice]; - old_val_def = irdata->defs[indice]; - irdata->valeurs[indice] = valeur; - irdata->defs[indice] = 1; -#else - T_indice indice = ((T_desc_contexte *)desc)->indice & INDICE_VAL; -#ifdef FLG_DEBUG - switch (((T_desc_debug *)desc)->indice & EST_MASQUE) { - case EST_SAISIE: - old_valeur = irdata->saisie[indice]; - old_val_def = irdata->def_saisie[indice]; - irdata->saisie[indice] = valeur; - irdata->def_saisie[indice] = 1; - break; - case EST_CALCULEE: - old_valeur = irdata->calculee[indice]; - old_val_def = irdata->def_calculee[indice]; - irdata->calculee[indice] = valeur; - irdata->def_calculee[indice] = 1; - break; - case EST_BASE: - old_valeur = irdata->base[indice]; - old_val_def = irdata->def_base[indice]; - irdata->base[indice] = valeur; - irdata->def_base[indice] = 1; - break; - } -#else - if ((((T_desc_contexte *)desc)->indice & EST_MASQUE) != EST_SAISIE) - return (0); - old_valeur = irdata->saisie[indice]; - old_val_def = irdata->def_saisie[indice]; - irdata->saisie[indice] = valeur; - irdata->def_saisie[indice] = 1; -#endif /* FLG_DEBUG */ -#endif /* FLG_COMPACT */ -#if ANNEE_REVENU > 2005 - if (valeur < 0) { - discord = err_NEGATIF(irdata); - } else if (discord != NULL) { - discord = (*((T_desc_contexte *)desc)->verif)(irdata); - } -#else - discord = (*((T_desc_contexte *)desc)->verif)(irdata); -#endif /* ANNEE_REVENU > 2005 */ -#ifndef FLG_GCOS - if ((discord != NULL) && (discord->erreur->type == ANOMALIE)) { -#ifdef FLG_COMPACT - irdata->valeurs[indice] = old_valeur; - irdata->defs[indice] = old_val_def; -#else -#ifdef FLG_DEBUG - switch (((T_desc_debug *)desc)->indice & EST_MASQUE) { - case EST_SAISIE: - irdata->saisie[indice] = old_valeur; - irdata->def_saisie[indice] = old_val_def; - break; - case EST_CALCULEE: - irdata->calculee[indice] = old_valeur; - irdata->def_calculee[indice] = old_val_def; - break; - case EST_BASE: - irdata->base[indice] = old_valeur; - irdata->def_base[indice] = old_val_def; - break; - } -#else - irdata->saisie[indice] = old_valeur; - irdata->def_saisie[indice] = old_val_def; -#endif /* FLG_DEBUG */ -#endif /* FLG_COMPACT */ - } -#endif /* !FLG_GCOS */ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "range = "); - trace_discord(discord); - putc('\n', stderr); -#endif /* FLG_TRACE_IRDATA */ - return discord; -} - -void IRDATA_range_base(T_irdata *irdata, T_var_irdata desc, double valeur) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "range("); - trace_var_irdata(desc); - fprintf(stderr, ", %.3f)\n", valeur); -#endif /* FLG_TRACE_IRDATA */ -#ifdef FLG_COMPACT - T_indice indice = ((T_desc_contexte *)desc)->indice; - irdata->valeurs[indice] = valeur; - irdata->defs[indice] = 1; -#else - T_indice indice = ((T_desc_contexte *)desc)->indice & INDICE_VAL; - switch (((T_desc_contexte *)desc)->indice & EST_MASQUE) { - case EST_SAISIE: - irdata->saisie[indice] = valeur; - irdata->def_saisie[indice] = 1; - break; - case EST_CALCULEE: - irdata->calculee[indice] = valeur; - irdata->def_calculee[indice] = 1; - break; - case EST_BASE: - irdata->base[indice] = valeur; - irdata->def_base[indice] = 1; - break; - } -#endif /* FLG_COMPACT */ -} - -struct S_discord * IRDATA_range_tableau(T_irdata *irdata, T_var_irdata desc, int ind, double valeur) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "range_tableau("); - trace_var_irdata(desc) ; - fprintf(stderr, "[%d], %.3f)\n", ind, valeur); -#endif /* FLG_TRACE_IRDATA */ - T_discord *discord; -#ifdef FLG_MULTITHREAD - double old_valeur; - int old_val_def; -#else - static double old_valeur; - static int old_val_def; -#endif /* FLG_MULTITHREAD */ -#ifdef FLG_COMPACT - T_indice indice = ((T_desc_contexte *)desc)->indice + ind; - old_valeur = irdata->valeurs[indice]; - old_val_def = irdata->defs[indice]; - irdata->valeurs[indice] = valeur; - irdata->defs[indice] = 1; -#else - T_indice indice = (((T_desc_contexte *)desc)->indice & INDICE_VAL) + ind; -#ifdef FLG_DEBUG - switch (((T_desc_debug *)desc)->indice & EST_MASQUE) { - case EST_SAISIE: - old_valeur = irdata->saisie[indice]; - old_val_def = irdata->def_saisie[indice]; - irdata->saisie[indice] = valeur; - irdata->def_saisie[indice] = 1; - break; - case EST_CALCULEE: - old_valeur = irdata->calculee[indice]; - old_val_def = irdata->def_calculee[indice]; - irdata->calculee[indice] = valeur; - irdata->def_calculee[indice] = 1; - break; - case EST_BASE: - old_valeur = irdata->base[indice]; - old_val_def = irdata->def_base[indice]; - irdata->base[indice] = valeur; - irdata->def_base[indice] = 1; - break; - } -#else - if ((((T_desc_contexte *)desc)->indice & EST_MASQUE) != EST_SAISIE) - return (0); - old_valeur = irdata->saisie[indice]; - old_val_def = irdata->def_saisie[indice]; - irdata->saisie[indice] = valeur; - irdata->def_saisie[indice] = 1; -#endif /* FLG_DEBUG */ -#endif /* FLG_COMPACT */ - discord = (*((T_desc_contexte *)desc)->verif)(irdata); - if ((discord != NULL) && (discord->erreur->type == ANOMALIE)) { -#ifdef FLG_COMPACT - irdata->valeurs[indice] = old_valeur; - irdata->defs[indice] = old_val_def; -#else -#ifdef FLG_DEBUG - switch (((T_desc_debug *)desc)->indice & EST_MASQUE) { - case EST_SAISIE: - irdata->saisie[indice] = old_valeur; - irdata->def_saisie[indice] = old_val_def; - break; - case EST_CALCULEE: - irdata->calculee[indice] = old_valeur; - irdata->def_calculee[indice] = old_val_def; - break; - case EST_BASE: - irdata->base[indice] = old_valeur; - irdata->def_base[indice] = old_val_def; - break; - } -#else - irdata->saisie[indice] = old_valeur; - irdata->def_saisie[indice] = old_val_def; -#endif /* FLG_DEBUG */ -#endif /* FLG_COMPACT */ - } -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "range_tableau = "); - trace_discord(discord); - putc('\n', stderr); -#endif /* FLG_TRACE_IRDATA */ - return discord; -} - - - -void IRDATA_add_valeur(T_irdata *irdata, T_var_irdata desc, double valeur) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "add_valeur("); - trace_var_irdata(desc); - fprintf(stderr, ", %.3f)\n", valeur); -#endif /* FLG_TRACE_IRDATA */ -#ifdef FLG_COMPACT - fprintf(file, "T_indice indice = ((T_desc_contexte *)desc)->indice ;\n") ; - fprintf(file, "irdata->valeurs[indice] += valeur ;\n") ; - fprintf(file, "irdata->defs[indice] = 1 ;\n") ; -#else - T_indice indice = ((T_desc_contexte *)desc)->indice & INDICE_VAL; -#ifdef FLG_DEBUG - switch (((T_desc_debug *)desc)->indice & EST_MASQUE) { - case EST_SAISIE: - irdata->saisie[indice] += valeur; - irdata->def_saisie[indice] = 1; - break; - case EST_CALCULEE: - irdata->calculee[indice] += valeur; - irdata->def_calculee[indice] = 1; - break; - case EST_BASE: - irdata->base[indice] += valeur; - irdata->def_base[indice] = 1; - break; - } -#else - if ((((T_desc_contexte *)desc)->indice & EST_MASQUE) != EST_SAISIE) - return; - irdata->saisie[indice] += valeur; - irdata->def_saisie[indice] = 1; -#endif /* FLG_DEBUG */ -#endif /* FLG_COMPACT */ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "add_valeur = void\n"); -#endif /* FLG_TRACE_IRDATA */ -} - - - -struct S_discord * IRDATA_controle_valeur(T_irdata *irdata, T_var_irdata desc, double valeur) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "controle_valeur("); - trace_var_irdata(desc); - fprintf(stderr, ", %.3f)\n", valeur); -#endif /* FLG_TRACE_IRDATA */ - T_discord *discord; -#ifdef FLG_MULTITHREAD - double old_valeur; - int old_val_def; -#else /* FLG_MULTITHREAD */ - static double old_valeur; - static int old_val_def; -#endif /* FLG_MULTITHREAD */ -#ifdef FLG_COMPACT - T_indice indice = ((T_desc_contexte *)desc)->indice; - old_valeur = irdata->valeurs[indice]; - old_val_def = irdata->defs[indice]; - irdata->valeurs[indice] = valeur; - irdata->defs[indice] = 1; -#else - T_indice indice = ((T_desc_contexte *)desc)->indice & INDICE_VAL; - if ((((T_desc_contexte *)desc)->indice & EST_MASQUE) != EST_SAISIE) - return (0); - old_valeur = irdata->saisie[indice]; - old_val_def = irdata->def_saisie[indice]; - irdata->saisie[indice] = valeur; - irdata->def_saisie[indice] = 1; -#endif /* FLG_COMPACT */ - discord = (*((T_desc_contexte *)desc)->verif)(irdata); -#ifdef FLG_COMPACT - irdata->valeurs[indice] = old_valeur; - irdata->defs[indice] = old_val_def; -#else - irdata->saisie[indice] = old_valeur; - irdata->def_saisie[indice] = old_val_def; -#endif /* FLG_COMPACT */ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "controle_valeur = "); - trace_discord(discord); - putc('\n', stderr); -#endif /* FLG_TRACE_IRDATA */ - return discord; -} - - - -double * IRDATA_extrait(T_irdata *irdata, T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "extrait("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); -#endif /* FLG_TRACE_IRDATA */ - double *retour; -#ifdef FLG_COMPACT - T_indice indice = ((T_desc_restituee *)desc)->indice; - if (!irdata->defs[indice]) retour = NULL; - else retour = &irdata->valeurs[indice]; -#else - T_indice indice = ((T_desc_restituee *)desc)->indice & INDICE_VAL; - switch (((T_desc_restituee *)desc)->indice & EST_MASQUE) { - case EST_SAISIE: - if (!irdata->def_saisie[indice]) retour = NULL; - else retour = &irdata->saisie[indice]; - break; - case EST_CALCULEE: - if (!irdata->def_calculee[indice]) retour = NULL; - else retour = &irdata->calculee[indice]; - break; - case EST_BASE: - if (!irdata->def_base[indice]) retour = NULL; - else retour = &irdata->base[indice]; - break; - default: - retour = NULL; - break; - } -#endif /* FLG_COMPACT */ -#ifdef FLG_EXTRACTION - if ((desc >= (T_var_irdata)desc_restituee) && (desc < (T_var_irdata)desc_restituee + sizeof(T_desc_restituee) * nb_restituee)) { - ((T_desc_restituee *)desc)->est_extraite = 1; - } -#endif /* FLG_EXTRACTION */ -#ifdef FLG_TRACE_IRDATA - if (retour == NULL) { - fprintf(stderr, "extrait = undef\n"); - } else { - fprintf(stderr, "extrait = %.3f\n", *retour); - } -#endif /* FLG_TRACE_IRDATA */ - return retour; -} - -double * IRDATA_extrait_special(T_irdata *irdata, T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "extrait_special("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); -#endif /* FLG_TRACE_IRDATA */ - double *retour; -#ifdef FLG_COMPACT - T_indice indice = ((T_desc_restituee *)desc)->indice; - if (!irdata->defs[indice]) retour = NULL; - else retour = &irdata->valeurs[indice]; -#else - T_indice indice = ((T_desc_restituee *)desc)->indice & INDICE_VAL; - switch (((T_desc_restituee *)desc)->indice & EST_MASQUE) { - case EST_SAISIE: - if (!irdata->def_saisie[indice]) retour = NULL; - else retour = &irdata->saisie[indice]; - break; - case EST_CALCULEE: - if (!irdata->def_calculee[indice]) retour = NULL; - else retour = &irdata->calculee[indice]; - break; - case EST_BASE: - if (!irdata->def_base[indice]) retour = NULL; - else retour = &irdata->base[indice]; - break; - default: - retour = NULL; - break; - } -#endif /* FLG_COMPACT */ -#ifdef FLG_TRACE_IRDATA - if (retour == NULL) { - fprintf(stderr, "extrait_special = undef\n"); - } else { - fprintf(stderr, "extrait_special = %.3f\n", *retour); - } -#endif /* FLG_TRACE_IRDATA */ - return retour; -} - -double * IRDATA_extrait_tableau(T_irdata *irdata, T_var_irdata desc, int ind) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "extrait_tableau("); - trace_var_irdata(desc); - fprintf(stderr, "[%d])\n", ind); -#endif /* FLG_TRACE_IRDATA */ - double *retour; -#ifdef FLG_COMPACT - T_indice indice = ((T_desc_restituee *)desc)->indice + ind; - if (!irdata->defs[indice]) retour = NULL; - else retour = &irdata->valeurs[indice]; -#else - T_indice indice = (((T_desc_restituee *)desc)->indice & INDICE_VAL) + ind; - switch (((T_desc_restituee *)desc)->indice & EST_MASQUE) { - case EST_SAISIE: - if (!irdata->def_saisie[indice]) retour = NULL; - else retour = &irdata->saisie[indice]; - break; - case EST_CALCULEE: - if (!irdata->def_calculee[indice]) retour = NULL; - else retour = &irdata->calculee[indice]; - break; - case EST_BASE: - if (!irdata->def_base[indice]) retour = NULL; - else retour = &irdata->base[indice]; - break; - default: - retour = NULL; - break; - } -#endif /* FLG_COMPACT */ -#ifdef FLG_EXTRACTION - if ((desc >= (T_var_irdata)desc_restituee) && (desc < (T_var_irdata)desc_restituee + sizeof(T_desc_restituee) * nb_restituee)) { - ((T_desc_restituee *)desc)->est_extraite = 1; - } -#endif /* FLG_EXTRACTION */ -#ifdef FLG_TRACE_IRDATA - if (retour == NULL) { - fprintf(stderr, "extrait_tableau = undef\n"); - } else { - fprintf(stderr, "extrait_tableau = %.3f\n", *retour); - } -#endif /* FLG_TRACE_IRDATA */ - return retour; -} - - - -#ifdef FLG_EXTRACTION - -struct S_extraction -{ - int nb; -#ifdef FLG_DEBUG - T_desc_debug *desc; -#if NB_DEBUG_C > 0 - int num_bank; -#endif /* NB_DEBUG_BANK_C > 0 */ -#else - T_desc_restituee *desc; -#endif /* FLG_DEBUG */ -}; - -struct S_extraction * IRDATA_init_extraction(void) -{ - struct S_extraction *retour = (struct S_extraction *)malloc(sizeof(struct S_extraction)); -#ifdef FLG_DEBUG -#if NB_DEBUG_C <= 0 - retour->nb = nb_debug; - retour->desc = desc_debug; -#else - retour->nb = nb_debug01; - retour->desc = desc_debug01; - retour->num_bank = 1; -#endif /* NB_DEBUG_C <= 0 */ -#else - retour->nb = nb_restituee; - retour->desc = desc_restituee; -#endif /* FLG_DEBUG */ - return retour; -} - -void IRDATA_detruit_extraction(struct S_extraction *extraction) -{ - free(extraction); -} - -T_var_irdata IRDATA_extraction_suivante(struct S_extraction *extraction, int type) -{ - for (;;) { -#if defined(FLG_DEBUG) && NB_DEBUG_C > 0 - while (extraction->nb == 0) { - switch (++extraction->num_bank) { - case 1: - extraction->nb = nb_debug01; - extraction->desc = desc_debug01; - break; - case 2: - extraction->nb = nb_debug02; - extraction->desc = desc_debug02; - break; - case 3: - extraction->nb = nb_debug03; - extraction->desc = desc_debug03; - break; - case 4: - extraction->nb = nb_debug04; - extraction->desc = desc_debug04; - break; - default: return NULL; - } - } -#else - if (extraction->nb == 0) return NULL; -#endif /* FLG_DEBUG && NB_DEBUG_C > 0 */ - extraction->nb--; - if (!extraction->desc->est_extraite -#ifndef FLG_DEBUG - && ((extraction->desc->type == type) || (extraction->desc->type == RESTITUEE)) -#endif /* FLG_DEBUG */ - ) { - T_var_irdata retour = (T_var_irdata)extraction->desc; - extraction->desc++; - return retour; - } - extraction->desc++; - } -} - -void IRDATA_reset_extraction(void) -{ -#ifdef FLG_DEBUG -#if NB_DEBUG_C <= 0 - T_desc_debug *desc = desc_debug; - int cnt = nb_debug; -#else - T_desc_debug *desc = desc_debug01; - int cnt = nb_debug01; - int num_bank = 1; -#endif /* NB_DEBUG_C <= 0 */ -#else - T_desc_restituee *desc = desc_restituee; - int cnt = nb_restituee; -#endif /* FLG_DEBUG */ - for (;;) { -#if defined(FLG_DEBUG) && NB_DEBUG_C > 0 - while (cnt == 0) { - switch (++num_bank) { - case 2: - cnt = nb_debug02; - desc = desc_debug02; - break; - case 3: - cnt = nb_debug03; - desc = desc_debug03; - break; - case 4: - cnt = nb_debug04; - desc = desc_debug04; - break; - default: return; - } - } -#else - if (cnt == 0) return; -#endif /* FLG_DEBUG && NB_DEBUG_C > 0 */ - desc->est_extraite = 0; - desc++; - cnt--; - } -} - -#endif /* FLG_EXTRACTION */ - -struct S_table_extraction -{ - int nb; - int type; - union { - T_desc_contexte *contexte; - T_desc_famille *famille; - T_desc_revenu *revenu; - T_desc_revenu_correc *revenu_correc; - T_desc_variation *variation; - T_desc_restituee *restituee; - } desc; -}; - -struct S_table_extraction * IRDATA_init_table_extraction(int type_table) -{ - struct S_table_extraction *retour = (struct S_table_extraction *)malloc(sizeof(struct S_table_extraction)); - retour->type = type_table; - switch (type_table) { - case TYPE_CONTEXTE: - retour->nb = nb_contexte; - retour->desc.contexte = desc_contexte; - break; - case TYPE_FAMILLE: - retour->nb = nb_famille; - retour->desc.famille = desc_famille; - break; - case TYPE_REVENU: - retour->nb = nb_revenu; - retour->desc.revenu = desc_revenu; - break; - case TYPE_REVENU_CORREC: - retour->nb = nb_revenu_correc; - retour->desc.revenu_correc = desc_revenu_correc; - break; - case TYPE_VARIATION: - retour->nb = nb_variation; - retour->desc.variation = desc_variation; - break; - case TYPE_RESTITUEE: - retour->nb = nb_restituee; - retour->desc.restituee = desc_restituee; - break; - default: - free(retour); - retour = (struct S_table_extraction *)NULL; - } - return retour; -} - -void IRDATA_detruit_table_extraction(struct S_table_extraction *extraction) -{ - free(extraction); -} - -T_var_irdata IRDATA_table_extraction_suiv(struct S_table_extraction *extraction) -{ - T_var_irdata retour; - if (extraction->nb == 0) return NULL; - extraction->nb--; - switch (extraction->type) { - case TYPE_CONTEXTE: - retour = (T_var_irdata)extraction->desc.contexte; - extraction->desc.contexte++; - break; - case TYPE_FAMILLE: - retour = (T_var_irdata)extraction->desc.famille; - extraction->desc.famille++; - break; - case TYPE_REVENU: - retour = (T_var_irdata)extraction->desc.revenu; - extraction->desc.revenu++; - break; - case TYPE_REVENU_CORREC: - retour = (T_var_irdata)extraction->desc.revenu_correc; - extraction->desc.revenu_correc++; - break; - case TYPE_VARIATION: - retour = (T_var_irdata)extraction->desc.variation; - extraction->desc.variation++; - break; - case TYPE_RESTITUEE: - retour = (T_var_irdata)extraction->desc.restituee; - extraction->desc.restituee++; - break; - } - return retour; -} - - - -char * IRDATA_cherche_revenu(const char *nom) -{ - char *retour = NULL; - int fin = 0, i = 0; - while ((fin == 0) && (i < NB_REVENU)) { - if (strcmp(nom, desc_revenu[i].code) == 0) { - retour = desc_revenu[i].nom; - fin = 1; - } - i++; - } - return retour; -} - -static char * cherche_nom(const char *nom, char *table, int taille, int sup) -{ - int inf = 0; - for (;;) { - int res; - int millieu; - char *pt_cmp; - if (inf == sup) return NULL; - millieu = (inf + sup) / 2; - pt_cmp = table + (taille * millieu); - res = strcmp(nom, ((T_desc_contexte *)pt_cmp)->nom); - if (res == 0) return pt_cmp; - if (res < 0) sup = millieu; - else inf = millieu + 1; - } -} - -T_var_irdata IRDATA_get_var_irdata(const char *nom, T_typezone2042 type) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_desc(%s,", nom); - trace_type(type); - fprintf(stderr, ")\n"); -#endif /* FLG_TRACE_IRDATA */ - char *retour; - switch (type) { - case TYPE_CONTEXTE: - retour = cherche_nom(nom, (char *)desc_contexte, sizeof(T_desc_contexte), nb_contexte); - break; - case TYPE_FAMILLE: - retour = cherche_nom(nom, (char *)desc_famille, sizeof(T_desc_famille), nb_famille); - break; - case TYPE_REVENU: - retour = cherche_nom(nom, (char *)desc_revenu, sizeof(T_desc_revenu), nb_revenu); - break; - case TYPE_REVENU_CORREC: - retour = cherche_nom(nom, (char *)desc_revenu, sizeof(T_desc_revenu), nb_revenu); - if (retour == NULL) - retour = cherche_nom(nom, (char *)desc_revenu_correc, sizeof(T_desc_revenu_correc), nb_revenu_correc); - break; - case TYPE_VARIATION: - retour = cherche_nom(nom, (char *)desc_variation, sizeof(T_desc_variation), nb_variation); - break; - case TYPE_RESTITUEE: - retour = cherche_nom(nom, (char *)desc_restituee, sizeof(T_desc_restituee), nb_restituee); -#if defined(FLG_DEBUG) && defined(FLG_EXTRACTION) - if (retour == NULL) break; - /* FALL INFO */ -#else - break; -#endif /* FLG_DEBUG && FLG_EXTRACTION */ -#ifdef FLG_DEBUG - case TYPE_DEBUG: -#if NB_DEBUG_C <= 0 - retour = cherche_nom(nom, (char *)desc_debug, sizeof(T_desc_debug), nb_debug); -#else - retour = cherche_nom(nom, (char *)desc_debug01, sizeof(T_desc_debug), nb_debug01); - if (retour == NULL) retour = cherche_nom(nom, (char *)desc_debug02, sizeof(T_desc_debug), nb_debug02); - if (retour == NULL) retour = cherche_nom(nom, (char *)desc_debug03, sizeof(T_desc_debug), nb_debug03); - if (retour == NULL) retour = cherche_nom(nom, (char *)desc_debug04, sizeof(T_desc_debug), nb_debug04); -#endif /* NB_DEBUG_C <= 0 */ - break; -#endif /* FLG_DEBUG */ - default: - retour = NULL; - break; - } -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_desc = "); - trace_var_irdata(retour); - putc('\n', stderr); -#endif /* FLG_TRACE_IRDATA */ - return retour; -} - -int IRDATA_est_du_type(T_var_irdata desc, T_typezone2042 type) -{ - switch (type) { - case TYPE_CONTEXTE: - return ((desc >= (T_var_irdata)desc_contexte) && (desc < (T_var_irdata)desc_contexte + sizeof(T_desc_contexte)*nb_contexte)); - case TYPE_FAMILLE: - return ((desc >= (T_var_irdata)desc_famille) && (desc < (T_var_irdata)desc_famille + sizeof(T_desc_famille)*nb_famille)); - case TYPE_REVENU: - return ((desc >= (T_var_irdata)desc_revenu) && (desc < (T_var_irdata)desc_revenu + sizeof(T_desc_revenu)*nb_revenu)); - case TYPE_REVENU_CORREC: - return ((desc >= (T_var_irdata)desc_revenu_correc) && (desc < (T_var_irdata)desc_revenu_correc + sizeof(T_desc_revenu_correc)*nb_revenu_correc)); - case TYPE_VARIATION: - return ((desc >= (T_var_irdata)desc_variation) && (desc < (T_var_irdata)desc_variation + sizeof(T_desc_variation)*nb_variation)); - case TYPE_RESTITUEE: - return ((desc >= (T_var_irdata)desc_restituee) && (desc < (T_var_irdata)desc_restituee + sizeof(T_desc_restituee)*nb_restituee)); - case TYPE_BASE: -#ifdef FLG_COMPACT - return ((((T_desc_contexte *)desc)->indice >= taille_saisie+taille_calculee) && (((T_desc_contexte *)desc)->indice < taille_saisie+taille_calculee+taille_base)); -#else - return ((((T_desc_contexte *)desc)->indice & EST_MASQUE) == EST_BASE); -#endif /* FLG_COMPACT */ - default: - return FALSE; - } -} - -char * IRDATA_get_nom(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_nom("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "get_nom = %s\n", ((T_desc_revenu *)desc)->nom); -#endif /* FLG_TRACE_IRDATA */ - return ((T_desc_revenu *)desc)->nom; -} - -char * IRDATA_get_lib(T_var_irdata desc) -{ - char *libelle = NULL; - -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_lib("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "get_lib = \"%s\"\n", ((T_desc_revenu *)desc)->libelle); -#endif /* FLG_TRACE_IRDATA */ - - if ((IRDATA_est_du_type(desc, TYPE_REVENU)) || (IRDATA_est_du_type(desc, TYPE_REVENU_CORREC)) || (IRDATA_est_du_type(desc, TYPE_FAMILLE))) { - libelle = ((T_desc_revenu *)desc)->libelle; - } - - if ((IRDATA_est_du_type(desc, TYPE_CONTEXTE))) { - libelle = ((T_desc_contexte *)desc)->libelle; - } - -#ifdef FLG_GENERE_LIBELLE_RESTITUEE - if (IRDATA_est_du_type(desc, TYPE_RESTITUEE)) { - libelle = ((T_desc_restituee *)desc)->libelle; - } -#endif /* FLG_GENERE_LIBELLE_RESTITUEE */ - - return (libelle); -} - -T_classe IRDATA_get_classe(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_classe("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "get_classe = %d\n", ((T_desc_revenu *)desc)->classe); -#endif /* FLG_TRACE_IRDATA */ - return ((T_desc_revenu *)desc)->classe; -} - -T_priorite IRDATA_get_priorite(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_priorite("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "get_priorite = %d\n", ((T_desc_revenu *)desc)->priorite); -#endif /* FLG_TRACE_IRDATA */ - return ((T_desc_revenu *)desc)->priorite; -} - -T_categorie_TL IRDATA_get_categorie_TL(T_var_irdata p_Descripteur) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_categorie_TL("); - trace_var_irdata(p_Descripteur); - fprintf(stderr, ")\n"); - fprintf(stderr, "get_categorie_TL = %d\n", ((T_desc_revenu *)p_Descripteur)->categorie_TL); -#endif /* FLG_TRACE_IRDATA */ - return ((T_desc_revenu *)p_Descripteur)->categorie_TL; -} - -T_cotsoc IRDATA_get_cotsoc(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_cotsoc("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "get_cotsoc = %d\n", ((T_desc_revenu *)desc)->cotsoc); -#endif /* FLG_TRACE_IRDATA */ - return ((T_desc_revenu *)desc)->cotsoc; -} - -T_ind_abat IRDATA_get_ind_abat(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_ind_abat("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "get_ind_abat = %d\n", ((T_desc_revenu *)desc)->ind_abat); -#endif /* FLG_TRACE_IRDATA */ - return ((T_desc_revenu *)desc)->ind_abat; -} - -T_acompte IRDATA_get_acompte(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_acompte("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "get_acompte = %d\n", ((T_desc_revenu *)desc)->acompte); -#endif /* FLG_TRACE_IRDATA */ - return ((T_desc_revenu *)desc)->acompte; -} - -T_avfisc IRDATA_get_avfisc(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_avfisc("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "get_avfisc = %d\n", ((T_desc_revenu *)desc)->afisc); -#endif /* FLG_TRACE_IRDATA */ - return ((T_desc_revenu *)desc)->avfisc; -} - -T_rapcat IRDATA_get_rapcat(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_rapcat("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "get_rapcat = %d\n", ((T_desc_revenu *)desc)->rapcat); -#endif /* FLG_TRACE_IRDATA */ - return ((T_desc_revenu *)desc)->rapcat; -} - -T_sanction IRDATA_get_sanction(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_sanction("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "get_sanction = %d\n", ((T_desc_revenu *)desc)->sanction); -#endif /* FLG_TRACE_IRDATA */ - return ((T_desc_revenu *)desc)->sanction; -} - -T_modcat IRDATA_get_modcat(T_var_irdata desc) -{ - if ((IRDATA_est_du_type(desc, TYPE_REVENU)) || (IRDATA_est_du_type(desc, TYPE_REVENU_CORREC))) - return ((T_desc_revenu *)desc)->modcat; - - if ((IRDATA_est_du_type(desc, TYPE_CONTEXTE))) - return ((T_desc_contexte *)desc)->modcat; - - if ((IRDATA_est_du_type(desc, TYPE_FAMILLE))) - return ((T_desc_famille *)desc)->modcat; - - return -1; -} - -T_nat_code IRDATA_get_nat_code(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_nat_code("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "get_nat_code = %d\n", ((T_desc_revenu *)desc)->nat_code); -#endif /* FLG_TRACE_IRDATA */ - return ((T_desc_revenu *)desc)->nat_code; -} - - -T_var_irdata IRDATA_get_liee(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_liee("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "get_liee = %s\n", ((T_desc_revenu *)desc)->liee); -#endif /* FLG_TRACE_IRDATA */ - return ((T_desc_revenu *)desc)->liee; -} - -T_type IRDATA_get_type(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_type("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "get_type = %d\n", ((T_desc_contexte *)desc)->type_donnee); -#endif /* FLG_TRACE_IRDATA */ - return ((T_desc_contexte *)desc)->type_donnee; -} - -T_type IRDATA_est_booleen(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_est_booleen("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "get_est_booleen = %d\n", ((T_desc_contexte *)desc)->type_donnee); -#endif /* FLG_TRACE_IRDATA */ - return ((IRDATA_get_type(desc) & BOOLEEN)); -} - -T_type IRDATA_est_numerique(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "IRDATA_est_numerique("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "IRDATA_est_numerique = %d\n", ((T_desc_contexte *)desc)->type_donnee); -#endif /* FLG_TRACE_IRDATA */ - return ((IRDATA_get_type(desc) & NUMERIQUE)); -} - -T_type IRDATA_est_date(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "IRDATA_est_date("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "IRDATA_est_date = %d\n", ((T_desc_contexte *)desc)->type_donnee); -#endif /* FLG_TRACE_IRDATA */ - return ((IRDATA_get_type(desc) & DATE)); -} - -T_type IRDATA_est_entier(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "IRDATA_est_entier("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "IRDATA_est_entier = %d\n", ((T_desc_contexte *)desc)->type_donnee); -#endif /* FLG_TRACE_IRDATA */ - return ((IRDATA_get_type(desc) & ENTIER)); -} - -T_type IRDATA_est_reel(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "IRDATA_est_reel("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "IRDATA_est_reel = %d\n", ((T_desc_contexte *)desc)->type_donnee); -#endif /* FLG_TRACE_IRDATA */ - return ((IRDATA_get_type(desc) & REEL)); -} - -T_type IRDATA_est_reel1(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "IRDATA_est_reel1("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "IRDATA_est_reel1 = %d\n", ((T_desc_contexte *)desc)->type_donnee); -#endif /* FLG_TRACE_IRDATA */ - return ((IRDATA_get_type(desc) & REEL1)); -} - -T_type IRDATA_est_reel2(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "IRDATA_est_reel2("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "IRDATA_est_reel2 = %d\n", ((T_desc_contexte *)desc)->type_donnee); -#endif /* FLG_TRACE_IRDATA */ - return ((IRDATA_get_type(desc) & REEL2)); -} - -T_type IRDATA_est_reel3(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "IRDATA_est_reel3("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "IRDATA_est_reel3 = %d\n", ((T_desc_contexte *)desc)->type_donnee); -#endif /* FLG_TRACE_IRDATA */ - return ((IRDATA_get_type(desc) & REEL3)); -} - -T_type IRDATA_est_date_JJMMAAAA(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "IRDATA_est_date_JJMMAAAA("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "IRDATA_est_date_JJMMAAAA = %d\n", ((T_desc_contexte *)desc)->type_donnee); -#endif /* FLG_TRACE_IRDATA */ - return ((IRDATA_get_type(desc) & DATE_JJMMAAAA)); -} - -T_type IRDATA_est_date_AAAA(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "IRDATA_est_date_AAAA("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "IRDATA_est_date_AAAA = %d\n", ((T_desc_contexte *)desc)->type_donnee); -#endif /* FLG_TRACE_IRDATA */ - return ((IRDATA_get_type(desc) & DATE_AAAA)); -} - -T_type IRDATA_est_date_MMAAAA(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "IRDATA_est_date_MMAAAA("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "IRDATA_est_date_MMAAAA = %d\n", ((T_desc_contexte *)desc)->type_donnee); -#endif /* FLG_TRACE_IRDATA */ - return ((IRDATA_get_type(desc) & DATE_MMAAAA)); -} - -T_type IRDATA_est_date_JJMM(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "IRDATA_est_date_JJMM("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "IRDATA_est_date_JJMM = %d\n", ((T_desc_contexte *)desc)->type_donnee); -#endif /* FLG_TRACE_IRDATA */ - return ((IRDATA_get_type(desc) & DATE_JJMM)); -} - -T_type IRDATA_est_date_MM(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "IRDATA_est_date_MM("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "IRDATA_est_date_MM = %d\n", ((T_desc_contexte *)desc)->type_donnee); -#endif /* FLG_TRACE_IRDATA */ - return ((IRDATA_get_type(desc) & DATE_MM)); -} - - - -T_ench_calcul IRDATA_get_ench_calcul(const char *ref) -{ -#if FLG_TRACE_IRDATA - fprintf(stderr, "get_ench_calcul(%s)\n", ref); -#endif /* FLG_TRACE_IRDATA */ - int cnt; - T_desc_ench *desc = desc_ench; - for (cnt = 0;; cnt++) { - if (cnt == nb_enchaine) { desc = NULL; break; } - if (strcmp(desc->nom , ref) == 0) break; - desc++; - } -#if FLG_TRACE_IRDATA - fprintf(stderr, "get_ench_calcul = "); - /*trace_regle_calcul(desc) ;*/ - putc('\n', stderr); -#endif /* FLG_TRACE_IRDATA */ - return desc; -} - -void IRDATA_exec_ench(T_irdata *irdata, T_ench_calcul p_ench) -{ -#if FLG_TRACE_IRDATA - fprintf(stderr, "exec_ench("); - /*trace_regle_calcul(p_calcul) ;*/ - fprintf(stderr, ")\n"); -#endif /* FLG_TRACE_IRDATA */ - (*p_ench->proc)(irdata); -#if FLG_TRACE_IRDATA - fprintf(stderr, "exec_ench = void\n"); -#endif /* FLG_TRACE_IRDATA */ -} - -#ifdef FLG_DEBUG - -T_regle_calcul IRDATA_get_regle_calcul(int ref) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_regle_calcul(%d)\n", ref); -#endif /* FLG_TRACE_IRDATA */ - int cnt; - T_desc_call *desc = desc_call; - for (cnt = 0;; cnt++) { - if (cnt == nb_call) { desc = NULL; break; } - if (desc->num == ref) break; - desc++; - } -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_regle_calcul = "); - trace_regle_calcul(desc); - putc('\n', stderr); -#endif /* FLG_TRACE_IRDATA */ - return desc; -} - -void IRDATA_exec_calcul(T_irdata *irdata, T_regle_calcul p_calcul) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "exec_calcul("); - trace_regle_calcul(p_calcul); - fprintf(stderr, ")\n"); -#endif /* FLG_TRACE_IRDATA */ - (*p_calcul->proc)(irdata); -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "exec_calcul = void\n"); -#endif /* FLG_TRACE_IRDATA */ -} - -#endif /* FLG_DEBUG */ - -#if defined(FLG_DEBUG) || defined(FLG_CONTROLE_IMMEDIAT) - -T_regle_verif IRDATA_get_regle_verif(int ref) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_regle_verif(%d)\n", ref); -#endif /* FLG_TRACE_IRDATA */ - int cnt; - T_desc_verif *desc = desc_verif; - for (cnt = 0;; cnt++) { - if (cnt == nb_verif) { desc = NULL; break; } - if (desc->num == ref) break; - desc++; - } -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_regle_verif = "); - trace_regle_verif(desc); - putc('\n', stderr); -#endif /* FLG_TRACE_IRDATA */ - return desc; -} - -T_discord * IRDATA_exec_verif(T_irdata *irdata, T_regle_verif p_verif) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "exec_verif("); - trace_regle_verif(p_verif); - fprintf(stderr, ")\n"); -#endif /* FLG_TRACE_IRDATA */ - T_discord *retour; - if (p_verif->proc == NULL) retour = NULL; - else retour = une_verif(irdata, p_verif->proc); -#ifdef FLG_TRACE_IRDATA - if (flg_trace_irdata) { - fprintf(stderr, "exec_verif = "); - trace_discord(retour); - putc('\n', stderr); - } - return retour; -#endif /* FLG_TRACE_IRDATA */ -} - -#endif /* FLG_DEBUG || FLG_CONTROLE_IMMEDIAT */ - - - -/****************************************************************/ -/* NOUVELLES FONCTIONS DE MANIPULATION DES ERREURS */ -/* A UTILISER DE PREFERENCE DES LA CAMPAGNE 2006. */ -/****************************************************************/ -char IRDATA_GetFamille_erreur(const T_discord *pp_discord) -{ - return pp_discord->erreur->nom[0]; -} - -const char * IRDATA_GetCodeBO_erreur(T_discord *pp_discord) -{ - return pp_discord->erreur->codebo; -} - -const char * IRDATA_GetSousCode_erreur(T_discord *pp_discord) -{ - return pp_discord->erreur->souscode; -} - -char IRDATA_GetIsIsf_erreur(const T_discord *pp_discord) -{ - char *retour; - retour = pp_discord->erreur->isisf; - return retour[0]; -} - -const char * IRDATA_GetLibelle_erreur(T_discord *pp_discord) -{ - /*variables locales*/ - char *l_libelle_seul; - - l_libelle_seul = strstr(pp_discord->erreur->message, ERREUR_DELIMITEUR); - return (l_libelle_seul ? l_libelle_seul : pp_discord->erreur->message); -} - -const char * IRDATA_GetCodeInterne_erreur(T_discord *pp_discord) -{ - return pp_discord->erreur->nom; -} - -short IRDATA_GetType_erreur(const T_discord *pp_discord) -{ - return pp_discord->erreur->type; -} - - - -/****************************************************************/ -/* ANCIENNES FONCTIONS DE MANIPULATION DES ERREURS */ -/* A NE PLUS UTILISER DE PREFERENCE APRES LA CAMPAGNE 2005. */ -/****************************************************************/ -char * IRDATA_lib_erreur(struct S_discord *discord) -{ - return discord->erreur->message; -} - -char * IRDATA_codebo_erreur(struct S_discord *discord) -{ - return discord->erreur->codebo; -} - -short IRDATA_type_erreur(const struct S_discord *discord) -{ - return discord->erreur->type; -} - -int IRDATA_erreur_bloquante(const struct S_discord *discord) -{ - return (discord->erreur->type == ANOMALIE); -} - -char * IRDATA_nom_erreur(struct S_discord *discord) -{ - return discord->erreur->nom; -} - -struct S_discord * IRDATA_erreur_suivante(struct S_discord *discord) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "err_suivante = "); - trace_discord(discord->suivant); - putc('\n', stderr); -#endif /* FLG_TRACE_IRDATA */ - return discord->suivant; -} - - - -#ifdef FLG_DEBUG - -T_desc_err * IRDATA_get_desc_err(const char *nom) -{ - return (T_desc_err *)cherche_nom(nom, (char *)desc_err, sizeof(T_desc_err), nb_err); -} - -char * IRDATA_desc_err_lib_erreur(struct S_desc_err *desc_err) -{ - return desc_err->erreur->message; -} - -short IRDATA_desc_err_type_erreur(const struct S_desc_err *desc_err) -{ - return desc_err->erreur->type; -} - -char * IRDATA_desc_err_codebo_erreur(struct S_desc_err *desc_err) -{ - return desc_err->erreur->codebo; -} - -int IRDATA_desc_err_erreur_bloquante(const struct S_desc_err *desc_err) -{ - return (desc_err->erreur->type == ANOMALIE); -} - -char * IRDATA_desc_err_nom_erreur(struct S_desc_err *desc_err) -{ - return desc_err->erreur->nom; -} - -#endif /* FLG_DEBUG */ - -double cherche_varinfo(T_irdata *irdata, char *nom) { -#define CHERCHE_VARINFO(TYP,TAB) \ - for (i = 0; i < NB_##TYP; i++) { \ - T_varinfo_##TYP *info = &(varinfo_##TYP[i]); \ - if ( \ - strcmp(nom, info->name) == 0 \ - || (info->alias != NULL && strcmp(nom, info->alias) == 0) \ - ) { \ - if (irdata->def_##TAB [info->idx] == 0) { \ - return NAN; \ - } else { \ - return irdata->TAB[info->idx]; \ - } \ - } \ - } \ - - int i; - CHERCHE_VARINFO(calculee,calculee) - CHERCHE_VARINFO(calculee_base,base) - CHERCHE_VARINFO(calculee_base_restituee,base) - CHERCHE_VARINFO(calculee_restituee,calculee) - CHERCHE_VARINFO(saisie_contexte,saisie) - CHERCHE_VARINFO(saisie_famille,saisie) - CHERCHE_VARINFO(saisie_penalite,saisie) - CHERCHE_VARINFO(saisie_revenu,saisie) - CHERCHE_VARINFO(saisie_variation,saisie) -#undef CHERCHE_VARINFO - return -1; -} - -void pr_var(T_irdata *irdata, char *prefix, char *nom) { - double val = cherche_varinfo(irdata, nom); - if (isinf(val)) { - fprintf(stderr, "XXX %s %s inconnue\n", prefix, nom); - } else if (isnan(val)) { - fprintf(stderr, "XXX %s %s = indefini\n", prefix, nom); - } else { - fprintf(stderr, "XXX %s %s = ", prefix, nom); - print_double(stderr, &(irdata->ctx_pr_err), val, 0, 30); - fprintf(stderr, "\n"); - } -} - -/* Gestion des erreurs */ - -extern int recup_disco(struct S_discord *ptr_d); - -void finalise_erreur(T_irdata *irdata) { -#ifdef FLG_MULTITHREAD - recup_disco(irdata->discords); -#else - recup_disco(discords); -#endif /* FLG_MULTITHREAD */ -} - -extern int rech_code_recu(void); - -void exporte_erreur(T_irdata *irdata) { - rech_code_recu(); -} - -/* Interface avec Mlang */ -/* -extern int trace; -extern int gen_creneau; -extern FILE *sortie; -extern T_irdata * tgv_primitif; -extern int traitement; - -#include "defcal.h" -#include "eea.h" - -int enchainement(void) { - int l_CodeErreur; - - if (trace == PROG) { - printf("enchainement()\n"); - } - if (gen_creneau == OFF) { - fputs(TRAIT, sortie); - fputs(TAB, sortie); - } - if (traitement == PRIMITIF) { - if (gen_creneau == OFF) { - fputs("\tControles de coherence - Primitif\n\n", sortie); - } else { - fputs("#CONTROLES-PRIMITIF\n", sortie); - } - enchainement_primitif(tgv_primitif); - if (trace == PROG) { - printf("Sortie enchainement primitif, code retour CER\n"); - } - return(CER); - } else { - if (gen_creneau == OFF) { - fputs("\tControles de coherence - Correctif\n\n", sortie); - } else { - fputs("#CONTROLES-CORRECTIF\n", sortie); - } - return OK; - } -} - -T_discord *IC_EnchaineCalcul(int p_Traitement, T_irdata *pp_TGV) { - T_discord * lp_Discord = NULL; - TRACE_DIALOG3("Entree dans : T_discord *IC_EnchaineCalcul([int] %d, [T_irdata *] %p).\n", p_Traitement, pp_TGV); - TRACE_DIALOG1("# IC_EnchaineCalcul\n"); - - enchaine_calcul(pp_TGV); - TRACE_DIALOG1("# Sortie de IC_EnchaineCalcul.\n"); - return lp_Discord; -} - -struct S_discord * IN_traite_double_liquidation2(T_irdata * pp_TGV,int p_traitement) { - traite_double_liquidation_2(pp_TGV); - return discords; -} -*/ diff --git a/examples/dgfip_c/ml_primitif/c_driver_inline_4/irdata.h b/examples/dgfip_c/ml_primitif/c_driver_inline_4/irdata.h deleted file mode 100644 index 75c5585a..00000000 --- a/examples/dgfip_c/ml_primitif/c_driver_inline_4/irdata.h +++ /dev/null @@ -1,260 +0,0 @@ -/****** LICENCE CECIL *****/ - -#ifndef _IRDATA_H_ -#define _IRDATA_H_ - -#include "conf.h" -#include "dbg.h" -#include "annee.h" - -#if defined(__GNUC__) || defined(__STDC__) -#define _PROTS(X) X -#else -#define _PROTS(X) () -#endif - -#define TYPE_CONTEXTE 0 -#define TYPE_FAMILLE 1 -#define TYPE_REVENU 2 -#define TYPE_REVENU_CORREC 3 -#define TYPE_VARIATION 4 -#define TYPE_RESTITUEE 5 -#define TYPE_RESTITUEE_P 6 -#define TYPE_RESTITUEE_C 7 -#define TYPE_PENALITE 8 -#define TYPE_BASE 10 - -#ifdef FLG_DEBUG -#define TYPE_DEBUG 6 -#endif /* FLG_DEBUG */ - -/* Gestion des erreurs */ -#define ERREUR_DELIMITEUR " / " -#define ERREUR_SEPARATEUR "-" - -/* Couleurs */ -#define NOIR 30 -#define ROUGE 31 -#define VERT 32 -#define JAUNE 33 -#define BLEU 34 -#define MAGENTA 35 -#define CYAN 36 -#define BLANC 37 -#define FOND_ROUGE 41 -#define FOND_VERT 42 -#define FOND_JAUNE 43 -#define FOND_BLEU 44 -#define FOND_MAGENTA 45 -#define FOND_CYAN 46 -#define FOND_BLANC 47 -#define NORMAL 0 -#define GRAS 1 -#define STANDOUT 3 -#define SOULIGNE 4 - -typedef int T_indice; -typedef long T_type; -typedef int T_classe; -typedef int T_priorite; -typedef int T_categorie_TL; -typedef int T_cotsoc; -typedef int T_ind_abat; -typedef int T_acompte; -typedef int T_avfisc; -typedef int T_rapcat; -typedef int T_sanction; -typedef int T_modcat; -typedef int T_nat_code; -typedef int T_typezone2042; - -extern int IRDATA_annee_revenu(void); - -extern struct S_irdata * IRDATA_new_irdata _PROTS((void)); -extern void IRDATA_delete_irdata _PROTS((struct S_irdata *irdata)); - -#ifdef FLG_MULTITHREAD -extern void IRDATA_reset_erreur _PROTS((struct S_irdata *irdata)); -extern void IRDATA_set_max_bloquantes _PROTS((struct S_irdata *irdata, const int max_ano)); -#endif /* FLG_MULTITHREAD */ - -extern void IRDATA_reset_irdata _PROTS((struct S_irdata *irdata)); -extern void IRDATA_reset_light _PROTS((struct S_irdata *irdata)); -extern void IRDATA_reset_base _PROTS((struct S_irdata *irdata)); -extern void IRDATA_reset_calculee _PROTS((struct S_irdata *irdata)); - -#ifdef FLG_CORRECTIF -extern void IRDATA_recopie_irdata _PROTS((const struct S_irdata *irdata_src, struct S_irdata *irdata_dst)); -extern void IRDATA_recopie_irdata_light _PROTS((const struct S_irdata *irdata_src, struct S_irdata *irdata_dst)); -#endif /* FLG_CORRECTIF */ - -extern void IRDATA_efface _PROTS((struct S_irdata *irdata, T_var_irdata var_irdata)); -extern void IRDATA_efface_tableau _PROTS((struct S_irdata *irdata, T_var_irdata var_irdata, int ind)); - -extern struct S_discord * IRDATA_range _PROTS((struct S_irdata *irdata, T_var_irdata var_irdata, double valeur)); -extern void IRDATA_range_base _PROTS((struct S_irdata *irdata, T_var_irdata var_irdata, double valeur)); -extern struct S_discord * IRDATA_range_tableau _PROTS((struct S_irdata *irdata, T_var_irdata var_irdata, int ind, double valeur)); - -extern void IRDATA_add_valeur _PROTS((struct S_irdata *irdata, T_var_irdata var_irdata, double valeur)); - -extern struct S_discord * IRDATA_controle_valeur _PROTS((struct S_irdata *irdata, T_var_irdata var_irdata, double valeur)); - -extern double * IRDATA_extrait _PROTS((struct S_irdata *irdata, T_var_irdata var_irdata)); -extern double * IRDATA_extrait_special _PROTS((struct S_irdata *irdata, T_var_irdata var_irdata)); -extern double * IRDATA_extrait_tableau _PROTS((struct S_irdata *irdata, T_var_irdata var_irdata, int ind)); - -#ifdef FLG_EXTRACTION -typedef struct S_extraction T_extraction; -extern T_extraction * IRDATA_init_extraction(void); -extern void IRDATA_detruit_extraction _PROTS((T_extraction *)); -extern T_var_irdata IRDATA_extraction_suivante _PROTS((T_extraction *, int type)); -extern void IRDATA_reset_extraction(void); -#endif /* FLG_EXTRACTION */ - -typedef struct S_table_extraction T_table_extraction; -extern T_table_extraction *IRDATA_init_table_extraction _PROTS((int)); -extern void IRDATA_detruit_table_extraction _PROTS((T_table_extraction *)); -extern T_var_irdata IRDATA_table_extraction_suiv _PROTS((T_table_extraction *)); - - - -extern char * IRDATA_cherche_revenu _PROTS((const char *nom)); -extern T_var_irdata IRDATA_get_var_irdata _PROTS((const char *nom, T_typezone2042 type)); -extern int IRDATA_est_du_type _PROTS((T_var_irdata desc, T_typezone2042 type)); -extern char * IRDATA_get_nom _PROTS((T_var_irdata var_irdata)); -extern char * IRDATA_get_lib _PROTS((T_var_irdata var_irdata)); -extern T_classe IRDATA_get_classe _PROTS((T_var_irdata var_irdata)); -extern T_priorite IRDATA_get_priorite _PROTS((T_var_irdata var_irdata)); -extern T_priorite IRDATA_get_categorie_TL _PROTS((T_var_irdata var_irdata)); -extern T_cotsoc IRDATA_get_cotsoc _PROTS((T_var_irdata var_irdata)); -extern T_ind_abat IRDATA_get_ind_abat _PROTS((T_var_irdata var_irdata)); -extern T_acompte IRDATA_get_acompte _PROTS((T_var_irdata var_irdata)); -extern T_avfisc IRDATA_get_avfisc _PROTS((T_var_irdata var_irdata)); -extern T_rapcat IRDATA_get_rapcat _PROTS((T_var_irdata var_irdata)); -extern T_sanction IRDATA_get_sanction _PROTS((T_var_irdata var_irdata)); -extern T_modcat IRDATA_get_modcat _PROTS((T_var_irdata var_irdata)); -extern T_nat_code IRDATA_get_nat_code _PROTS((T_var_irdata var_irdata)); -extern T_var_irdata IRDATA_get_liee _PROTS((T_var_irdata var_irdata)); -extern T_type IRDATA_get_type _PROTS((T_var_irdata var_irdata)); -extern T_type IRDATA_est_booleen _PROTS((T_var_irdata var_irdata)); -extern T_type IRDATA_est_numerique _PROTS((T_var_irdata var_irdata)); -extern T_type IRDATA_est_date _PROTS((T_var_irdata var_irdata)); -extern T_type IRDATA_est_date_JJMMAAAA _PROTS((T_var_irdata var_irdata)); -extern T_type IRDATA_est_date_MMAAAA _PROTS((T_var_irdata var_irdata)); -extern T_type IRDATA_est_date_AAAA _PROTS((T_var_irdata var_irdata)); -extern T_type IRDATA_est_date_JJMM _PROTS((T_var_irdata var_irdata)); -extern T_type IRDATA_est_date_MM _PROTS((T_var_irdata var_irdata)); -extern T_type IRDATA_est_entier _PROTS((T_var_irdata var_irdata)); -extern T_type IRDATA_est_reel _PROTS((T_var_irdata var_irdata)); -extern T_type IRDATA_est_reel1 _PROTS((T_var_irdata var_irdata)); -extern T_type IRDATA_est_reel2 _PROTS((T_var_irdata var_irdata)); -extern T_type IRDATA_est_reel3 _PROTS((T_var_irdata var_irdata)); - - - -typedef struct S_desc_ench *T_ench_calcul; -extern T_ench_calcul IRDATA_get_ench_calcul _PROTS((const char *ref)); -extern void IRDATA_exec_ench _PROTS((struct S_irdata *irdata, T_ench_calcul p_ench)); - -#ifdef FLG_DEBUG -typedef struct S_desc_call *T_regle_calcul; -extern T_regle_calcul IRDATA_get_regle_calcul _PROTS((int ref)); -extern void IRDATA_exec_calcul _PROTS((struct S_irdata *irdata, T_regle_calcul p_calcul)); -#endif /* FLG_DEBUG */ - -#if defined(FLG_DEBUG) || defined(FLG_CONTROLE_IMMEDIAT) -typedef struct S_desc_verif *T_regle_verif; -extern T_regle_verif IRDATA_get_regle_verif _PROTS((int ref)); -extern struct S_discord * IRDATA_exec_verif _PROTS((struct S_irdata *irdata, T_regle_verif p_verif)); -#endif /* FLG_DEBUG || FLG_CONTROLE_IMMEDIAT */ - - - -/* Gestion des erreurs */ - -char IRDATA_GetFamille_erreur _PROTS((const T_discord *discord)); -const char * IRDATA_GetCodeBo_erreur _PROTS((T_discord *discord)); -const char * IRDATA_GetSousCode_erreur _PROTS((T_discord *discord)); -char IRDATA_GetIsIsf_erreur _PROTS((const T_discord *discord)); -const char * IRDATA_GetLibelle_erreur _PROTS((T_discord *discord)); -const char * IRDATA_GetCodeInterne_erreur _PROTS((T_discord *discord)); -short IRDATA_GetType_erreur _PROTS((const T_discord * pp_discord)); - -extern char * IRDATA_lib_erreur _PROTS((struct S_discord *discord)); -extern char * IRDATA_codebo_erreur _PROTS((struct S_discord *discord)); -extern short IRDATA_type_erreur _PROTS((const struct S_discord *discord)); -extern int IRDATA_erreur_bloquante _PROTS((const struct S_discord *discord)); -extern char * IRDATA_nom_erreur _PROTS((struct S_discord *discord)); -extern struct S_discord * IRDATA_erreur_suivante _PROTS((struct S_discord *discord)); - -#ifdef FLG_DEBUG -extern struct S_desc_err * IRDATA_get_desc_err _PROTS((const char *nom)); -extern char * IRDATA_desc_err_lib_erreur _PROTS((struct S_desc_err *desc_err)); -extern char * IRDATA_desc_err_codebo_erreur _PROTS((struct S_desc_err *desc_err)); -extern short IRDATA_desc_err_type_erreur _PROTS((const struct S_desc_err *desc_err)); -extern int IRDATA_desc_err_erreur_bloquante _PROTS((const struct S_desc_err *desc_err)); -extern char * IRDATA_desc_err_nom_erreur _PROTS((struct S_desc_err *desc)); -#endif /* FLG_DEBUG */ - - - -/* Fonctions définies dans enchain.c */ - -#if ANNEE_REVENU > 2005 -extern struct S_discord * err_NEGATIF _PROTS((T_irdata *irdata)); -extern void nettoie_erreur _PROTS((T_irdata *irdata)); -#endif /* ANNEE_REVENU > 2005 */ - -#if ANNEE_REVENU > 2010 -extern struct S_discord * err_BOOLEEN _PROTS((T_irdata *irdata)); -#endif /* ANNEE_REVENU > 2010 */ - -extern void initialisation_primitive _PROTS((T_irdata *irdata)); - -#ifdef FLG_CORRECTIF -extern void initialisation_corrective _PROTS((T_irdata *irdata)); -#endif /* FLG_CORRECTIF */ - -extern struct S_discord * verif_calcul_primitive _PROTS((T_irdata *irdata)); -extern struct S_discord * verif_calcul_primitive_isf _PROTS((T_irdata *irdata)); - -#ifdef FLG_CORRECTIF -extern struct S_discord * verif_calcul_corrective _PROTS((T_irdata *irdata)); -#endif /* FLG_CORRECTIF */ - -#ifndef FLG_CONTROLE_IMMEDIAT - -extern struct S_discord * verif_saisie_cohe_primitive _PROTS((T_irdata *irdata)); -extern struct S_discord * verif_saisie_cohe_primitive_isf _PROTS((T_irdata *irdata, int appel)); - -#ifdef FLG_CONTROLE_SEPARE -#define CONTROLE_SEPARE -extern struct S_discord * verif_contexte_cohe_primitive _PROTS((T_irdata *irdata)); -extern struct S_discord * verif_famille_cohe_primitive _PROTS((T_irdata *irdata)); -extern struct S_discord * verif_revenu_cohe_primitive _PROTS((T_irdata *irdata)); -#endif /* CONTROLE_SEPARE */ - -#ifdef FLG_CORRECTIF -extern struct S_discord * verif_saisie_cohe_corrective _PROTS((T_irdata *irdata)); - -#ifdef FLG_CONTROLE_SEPARE -extern struct S_discord * verif_contexte_cohe_corrective _PROTS((T_irdata *irdata)); -extern struct S_discord * verif_famille_cohe_corrective _PROTS((T_irdata *irdata)); -extern struct S_discord * verif_revenu_cohe_corrective _PROTS((T_irdata *irdata)); -#endif /* FLG_CONTROLE_SEPARE */ - -#endif /* FLG_CORRECTIF */ - -#endif /* FLG_CONTROLE_IMMEDIAT */ - -#ifdef FLG_CORRECTIF -extern struct S_discord * verif_cohe_horizontale _PROTS((T_irdata *irdata)); -#endif /* FLG_CORRECTIF */ - -extern void pr_var(T_irdata *irdata, char *prefix, char *nom); - -extern void finalise_erreur(T_irdata *irdata); -extern void exporte_erreur(T_irdata *irdata); - -#endif /* _IRDATA_H_ */ - diff --git a/examples/dgfip_c/ml_primitif/c_driver_inline_4/var.c b/examples/dgfip_c/ml_primitif/c_driver_inline_4/var.c deleted file mode 100644 index a0260eda..00000000 --- a/examples/dgfip_c/ml_primitif/c_driver_inline_4/var.c +++ /dev/null @@ -1,91 +0,0 @@ -/****** LICENCE CECIL *****/ - -#include "var.h" - -int taille_saisie = TAILLE_SAISIE; -int taille_calculee = TAILLE_CALCULEE; -int taille_base = TAILLE_BASE; -int taille_totale = TAILLE_TOTALE; - -int nb_contexte = NB_CONTEXTE; -int nb_famille = NB_FAMILLE; -int nb_revenu = NB_REVENU; -int nb_revenu_correc = NB_REVENU_CORREC; -int nb_variation = NB_VARIATION; -int nb_penalite = NB_PENALITE; -int nb_restituee = NB_RESTITUEE; -int nb_enchaine = NB_ENCH; - -#ifdef FLG_DEBUG -int nb_err = NB_ERR; -#if NB_DEBUG_C <= 0 -int nb_debug = NB_DEBUG; -#else -int nb_debug01 = NB_DEBUG01; -int nb_debug02 = NB_DEBUG02; -int nb_debug03 = NB_DEBUG03; -int nb_debug04 = NB_DEBUG04; -#endif /* NB_DEBUG_C <= 0 */ -int nb_call = NB_CALL; -#endif - -#if defined (FLG_DEBUG) || defined (FLG_CONTROLE_IMMEDIAT) -int nb_verif = NB_VERIF; -#endif /* FLG_DEBUG || FLG_CONTROLE_IMMEDIAT */ - -T_discord * une_verif(T_irdata *irdata, struct S_discord *(*proc)(T_irdata *irdata)) { -#ifdef FLG_MULTITHREAD - init_erreur(irdata); - if (setjmp(irdata->jmp_bloq) != 0) { - return irdata->discords; - } - (*proc)(irdata); - return irdata->discords; -#else - init_erreur(); - if (setjmp(jmp_bloq) != 0) { - return discords; - } - (*proc)(irdata); - return discords; -#endif /* FLG_MULTITHREAD */ -} - - -struct S_discord * verif_saisie_cohe_primitive_isf(T_irdata *irdata, int appel) { -#ifdef FLG_MULTITHREAD - init_erreur(irdata); - if ((appel != 1) && (setjmp(irdata->jmp_bloq) != 0)) { - return irdata->discords; - } - verif_saisie_cohe_primitive_isf_raw(irdata); - return irdata->discords; -#else - init_erreur(); - if ((appel != 1) && (setjmp(jmp_bloq) != 0)) { - return discords; - } - verif_saisie_cohe_primitive_isf_raw(irdata); - return discords; -#endif /* FLG_MULTITHREAD */ -} - -T_discord * err_NEGATIF(T_irdata *irdata) { -#ifdef FLG_MULTITHREAD - init_erreur(irdata); - if (setjmp(irdata->jmp_bloq) != 0) { - return irdata->discords; - } - add_erreur(irdata, &erreur_A000, NULL); - return irdata->discords; -#else - init_erreur(); - if (setjmp(jmp_bloq) != 0) { - return discords; - } - add_erreur(irdata, &erreur_A000, NULL); - return discords; - -#endif /* FLG_MULTITHREAD */ -} - diff --git a/examples/dgfip_c/ml_primitif/c_driver_inline_4/var.h b/examples/dgfip_c/ml_primitif/c_driver_inline_4/var.h deleted file mode 100644 index 357f3006..00000000 --- a/examples/dgfip_c/ml_primitif/c_driver_inline_4/var.h +++ /dev/null @@ -1,48 +0,0 @@ -/****** LICENCE CECIL *****/ - -#ifndef _VAR_H_ -#define _VAR_H_ - -#include "mlang.h" -#include "compir.h" -#include "compir_desc.h" -#include "compir_desc_inv.h" -#include "irdata.h" - -extern int taille_saisie; -extern int taille_calculee; -extern int taille_base; -extern int taille_totale; - -extern int nb_contexte; -extern int nb_famille; -extern int nb_revenu; -extern int nb_revenu_correc; -extern int nb_variation; -extern int nb_penalite; -extern int nb_restituee; -extern int nb_enchaine; - -extern int color; -extern int typo; - -#ifdef FLG_DEBUG -extern int nb_err; -#if NB_DEBUG_C <= 0 -extern int nb_debug; -#else -extern int nb_debug01; -extern int nb_debug02; -extern int nb_debug03; -extern int nb_debug04; -#endif /* NB_DEBUG_C <= 0 */ -extern int nb_call; -#endif - -#if defined (FLG_DEBUG) || defined (FLG_CONTROLE_IMMEDIAT) -extern int nb_verif; -#endif /* FLG_DEBUG || FLG_CONTROLE_IMMEDIAT */ - -extern T_discord *une_verif _PROTS((T_irdata *irdata, struct S_discord *(*proc)(T_irdata *irdata))); -#endif - diff --git a/examples/dgfip_c/ml_primitif/c_driver_with_macro/annee.h b/examples/dgfip_c/ml_primitif/c_driver_with_macro/annee.h deleted file mode 100644 index 1a02a2d6..00000000 --- a/examples/dgfip_c/ml_primitif/c_driver_with_macro/annee.h +++ /dev/null @@ -1,9 +0,0 @@ -/****** LICENCE CECIL *****/ - -#ifndef _ANNEE_H_ -#define _ANNEE_H_ - -#include "var.h" - -#endif - diff --git a/examples/dgfip_c/ml_primitif/c_driver_with_macro/const.h b/examples/dgfip_c/ml_primitif/c_driver_with_macro/const.h deleted file mode 100644 index 8e02aa68..00000000 --- a/examples/dgfip_c/ml_primitif/c_driver_with_macro/const.h +++ /dev/null @@ -1,9 +0,0 @@ -/****** LICENCE CECIL *****/ - -#ifndef _CONST_H_ -#define _CONST_H_ - -#include "var.h" - -#endif - diff --git a/examples/dgfip_c/ml_primitif/c_driver_with_macro/dbg.h b/examples/dgfip_c/ml_primitif/c_driver_with_macro/dbg.h deleted file mode 100644 index 9690a9d8..00000000 --- a/examples/dgfip_c/ml_primitif/c_driver_with_macro/dbg.h +++ /dev/null @@ -1,38 +0,0 @@ -/****** 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 */ - -#endif /* _DEBUG_H_ */ - diff --git a/examples/dgfip_c/ml_primitif/c_driver_with_macro/desc_inv.h b/examples/dgfip_c/ml_primitif/c_driver_with_macro/desc_inv.h deleted file mode 100644 index 1c2506a0..00000000 --- a/examples/dgfip_c/ml_primitif/c_driver_with_macro/desc_inv.h +++ /dev/null @@ -1,9 +0,0 @@ -/****** LICENCE CECIL *****/ - -#ifndef _DESC_INV_H_ -#define _DESC_INV_H_ - -#include "var.h" - -#endif - diff --git a/examples/dgfip_c/ml_primitif/c_driver_with_macro/irdata.c b/examples/dgfip_c/ml_primitif/c_driver_with_macro/irdata.c deleted file mode 100644 index 13051a70..00000000 --- a/examples/dgfip_c/ml_primitif/c_driver_with_macro/irdata.c +++ /dev/null @@ -1,1742 +0,0 @@ -/****** LICENCE CECIL *****/ - -#include "conf.h" - -#include -#include -#include -#include -#include -#include -#include -#include "irdata.h" -#include "var.h" - - - -#ifdef FLG_TRACE_IRDATA - -#define AFF(nom) case nom: (void) fprintf(stderr, "nom"); break - -static void trace_type(int n) -{ - switch (n) { - AFF(TYPE_CONTEXTE); - AFF(TYPE_FAMILLE); - AFF(TYPE_REVENU); - AFF(TYPE_REVENU_CORREC); - AFF(TYPE_VARIATION); - AFF(TYPE_RESTITUEE); -#ifdef FLG_DEBUG - AFF(TYPE_DEBUG); -#endif /* FLG_DEBUG */ - default: (void)fprintf(stderr, "%d!!!", n); - } -} - -static void trace_var_irdata(T_var_irdata desc) -{ - if (desc == NULL) { - fprintf(stderr, "NULL"); - } else { - int delta; - fprintf(stderr, "(\"%s\":", ((T_desc_contexte *)desc)->nom); - delta = ((T_desc_contexte *)desc) - desc_contexte; - if ((delta >= 0) && (delta < nb_contexte)) trace_type(TYPE_CONTEXTE); - else { - delta = ((T_desc_famille *)desc) - desc_famille; - if ((delta >= 0) && (delta < nb_famille)) trace_type(TYPE_FAMILLE); - else { - delta = ((T_desc_revenu *)desc) - desc_revenu; - if ((delta >= 0) && (delta < nb_revenu)) trace_type(TYPE_REVENU); - else { - delta = ((T_desc_revenu_correc *)desc) - desc_revenu_correc; - if ((delta >= 0) && (delta < nb_revenu_correc)) trace_type(TYPE_REVENU_CORREC); - else { - delta = ((T_desc_variation *)desc) - desc_variation; - if ((delta >= 0) && (delta < nb_variation)) trace_type(TYPE_VARIATION); - else { - delta = ((T_desc_restituee *)desc) - desc_restituee; - if ((delta >= 0) && (delta < nb_restituee)) trace_type(TYPE_RESTITUEE); -#ifdef FLG_DEBUG -#if NB_DEBUG_C <= 0 - else { - delta = ((T_desc_debug *)desc) - desc_debug; - if ((delta >= 0) && (delta < nb_debug)) trace_type(TYPE_DEBUG); - else fprintf(stderr, "???"); - } -#else -#define LOOP_DEBUG(n, _) \ - else { \ - delta = ((T_desc_debug *)desc) - CAT(desc_debug, TWO_DIGITS(INC(n))); \ - if ((delta >= 0) && (delta < CAT(nb_debug, TWO_DIGITS(INC(n))))) trace_type(TYPE_DEBUG); -EVAL(REPEAT(NB_DEBUG_C, LOOP_DEBUG)) -#undef LOOP_DEBUG - else fprintf(stderr, "???"); -#define LOOP_DEBUG(n, _) \ - } -EVAL(REPEAT(NB_DEBUG_C, LOOP_DEBUG)) -#undef LOOP_DEBUG -#endif /* NB_DEBUG_C <= 0 */ -#endif /* FLG_DEBUG */ - } - } - } - } - } - putc(')', stderr); - } -} - -#ifdef FLG_DEBUG - -static void trace_regle_calcul(T_regle_calcul desc) -{ - if (desc == NULL) { - fprintf(stderr, "NULL"); - } else { - int delta; - delta = ((T_regle_calcul)desc) - desc_call; - if ((delta >= 0) && (delta < nb_call)) - fprintf(stderr, "(\"regle_%d\")", ((T_regle_calcul)desc)->num); - else fprintf(stderr, "(inconnue)"); - } -} - -#endif /* FLG_DEBUG */ - -#if defined(FLG_DEBUG) || defined(FLG_CONTROLE_IMMEDIAT) - -static void trace_regle_verif(T_regle_verif desc) -{ - if (desc == NULL) { - fprintf(stderr, "NULL"); - } else { - int delta; - delta = ((T_regle_verif)desc) - desc_verif; - if ((delta >= 0) && (delta < nb_verif)) - fprintf(stderr, "(\"regle_%d\")", ((T_regle_verif)desc)->num); - else fprintf(stderr, "(inconnue)"); - } -} - -#endif /* FLG_DEBUG || FLG_CONTROLE_IMMEDIAT */ - -static void trace_discord(T_discord *discord) -{ - if (discord == NULL) { - fprintf(stderr, "NULL"); - } else if ((discord->erreur->type == ANOMALIE)) { - fprintf(stderr, "anomalie \"%s\"", discord->erreur->nom); - } else if ((discord->erreur->type == DISCORDANCE)) { - fprintf(stderr, "discordance \"%s\"", discord->erreur->nom); - } else if ((discord->erreur->type == INFORMATIVE)) { - fprintf(stderr, "informative \"%s\"", discord->erreur->nom); - } -} - -#endif /* FLG_TRACE_IRDATA */ - - - -int IRDATA_annee_revenu(void) -{ - return ANNEE_REVENU; -} - - - -T_irdata * IRDATA_new_irdata(void) -{ - T_irdata *irdata; - if ((irdata = (T_irdata *)malloc(sizeof(T_irdata))) == NULL) return NULL; -#ifndef FLG_COMPACT - irdata->saisie = NULL; - irdata->def_saisie = NULL; - irdata->calculee = NULL; - irdata->def_calculee = NULL; - irdata->base = NULL; - irdata->def_base = NULL; - if (taille_saisie > 0) { - if ((irdata->saisie = (double *)malloc(taille_saisie * sizeof(double))) == NULL) { - IRDATA_delete_irdata(irdata); - return NULL; - } - if ((irdata->def_saisie = (char *)malloc(taille_saisie * sizeof(char))) == NULL) { - IRDATA_delete_irdata(irdata); - return NULL; - } - } - if (taille_calculee > 0) { - if ((irdata->calculee = (double *)malloc(taille_calculee * sizeof(double))) == NULL) { - IRDATA_delete_irdata(irdata); - return NULL; - } - if ((irdata->def_calculee = (char *)malloc(taille_calculee * sizeof(char))) == NULL) { - IRDATA_delete_irdata(irdata); - return NULL; - } - } - if (taille_base > 0) { - if ((irdata->base = (double *)malloc(taille_base * sizeof(double))) == NULL) { - IRDATA_delete_irdata(irdata); - return NULL; - } - if ((irdata->def_base = (char *)malloc(taille_base * sizeof(char))) == NULL) { - IRDATA_delete_irdata(irdata); - return NULL; - } - } -#ifdef FLG_MULTITHREAD - irdata->discords = NULL; - irdata->tas_discord = NULL; - irdata->p_discord = &irdata->discords; - irdata->nb_bloquantes = 0; - irdata->max_bloquantes = 0; -#endif /* FLG_MULTITHREAD */ -#endif /* !FLG_COMPACT */ - irdata->ctx_pr_out.indent = 0; - irdata->ctx_pr_out.is_newline = 1; - irdata->ctx_pr_err.indent = 0; - irdata->ctx_pr_err.is_newline = 1; - IRDATA_reset_irdata(irdata); - return irdata; -} - -void IRDATA_delete_irdata(T_irdata *irdata) -{ - if (irdata != NULL) { -#ifndef FLG_COMPACT - if (irdata->saisie != NULL) free(irdata->saisie); - if (irdata->calculee != NULL) free(irdata->calculee); - if (irdata->base != NULL) free(irdata->base); - if (irdata->def_saisie != NULL) free(irdata->def_saisie); - if (irdata->def_calculee != NULL) free(irdata->def_calculee); - if (irdata->def_base != NULL) free(irdata->def_base); -#endif /* FLG_COMPACT */ -#ifdef FLG_MULTITHREAD - IRDATA_reset_erreur(irdata); - while (irdata->tas_discord != NULL) { - *(irdata->p_discord) = irdata->tas_discord; - irdata->tas_discord = (irdata->tas_discord)->suivant; - free (*irdata->p_discord); - } -#endif /* FLG_MULTITHREAD */ - free(irdata); - } -} - - - -#ifdef FLG_MULTITHREAD - -void IRDATA_reset_erreur(T_irdata *irdata) -{ - *irdata->p_discord = irdata->tas_discord; - irdata->tas_discord = irdata->discords; - irdata->discords = 0; - irdata->p_discord = &irdata->discords; - irdata->nb_bloquantes = 0; -} - -void IRDATA_set_max_bloquantes(struct S_irdata *irdata, const int max_ano) -{ - irdata->max_bloquantes = max_ano; -} - -#endif /* FLG_MULTITHREAD */ - - - -static void reset_tab(double *p_double, char *p_char, int nb) -{ -#ifdef FLG_GCOS - memset(p_double, 0, sizeof(double)*nb); - memset(p_char, 0, nb); -#else - while (nb > 0) { - *p_double++ = 0; - *p_char++ = 0; - nb--; - } -#endif /* FLG_GCOS */ -} - -void IRDATA_reset_irdata(T_irdata *irdata) -{ -#ifdef FLG_COMPACT - reset_tab(irdata->valeurs, irdata->defs, taille_totale); -#else - reset_tab(irdata->saisie, irdata->def_saisie, taille_saisie); - reset_tab(irdata->calculee, irdata->def_calculee, taille_calculee); - reset_tab(irdata->base, irdata->def_base, taille_base); -#endif /* FLG_COMPACT */ -#ifdef FLG_MULTITHREAD - IRDATA_reset_erreur(irdata); -#endif /* FLG_MULTITHREAD */ -} - -void IRDATA_reset_light(T_irdata *irdata) -{ -#ifdef FLG_COMPACT - reset_tab(irdata->valeurs, irdata->defs, taille_saisie + taille_calculee); -#else - reset_tab(irdata->saisie, irdata->def_saisie, taille_saisie); - reset_tab(irdata->calculee, irdata->def_calculee, taille_calculee); -#endif /* FLG_COMPACT */ -} - -void IRDATA_reset_base(T_irdata *irdata) -{ -#ifdef FLG_COMPACT - reset_tab(irdata->valeurs + taille_saisie + taille_calculee, irdata->defs + taille_saisie + taille_calculee, taille_base); -#else - reset_tab(irdata->base, irdata->def_base, taille_base); -#endif /* FLG_COMPACT */ -} - -void IRDATA_reset_calculee(T_irdata *irdata) -{ -#ifdef FLG_COMPACT - reset_tab(irdata->valeurs + taille_saisie, irdata->defs + taille_saisie, taille_calculee); -#else - reset_tab(irdata->calculee, irdata->def_calculee, taille_calculee); -#endif /* FLG_COMPACT */ -} - - - -#ifdef FLG_CORRECTIF - -void IRDATA_recopie_irdata(const T_irdata *irdata_src, T_irdata *irdata_dst) -{ -#ifdef FLG_COMPACT - memcpy(irdata_dst->valeurs, irdata_src->valeurs, taille_totale * sizeof(double)); - memcpy(irdata_dst->defs, irdata_src->defs, taille_totale); -#else - memcpy(irdata_dst->saisie, irdata_src->saisie, taille_saisie * sizeof(double)); - memcpy(irdata_dst->def_saisie, irdata_src->def_saisie, taille_saisie); - memcpy(irdata_dst->calculee, irdata_src->calculee, taille_calculee * sizeof(double)); - memcpy(irdata_dst->def_calculee, irdata_src->def_calculee, taille_calculee); - memcpy(irdata_dst->base, irdata_src->base, taille_base * sizeof(double)); - memcpy(irdata_dst->def_base, irdata_src->def_base, taille_base); -#endif /* FLG_COMPACT */ -} - -void IRDATA_recopie_irdata_light(const T_irdata *irdata_src, T_irdata *irdata_dst) -{ -#ifdef FLG_COMPACT - memcpy(irdata_dst->valeurs, irdata_src->valeurs, (taille_saisie + taille_calculee) * sizeof(double)); - memcpy(irdata_dst->defs, irdata_src->defs, (taille_saisie + taille_calculee)); -#else - memcpy(irdata_dst->saisie, irdata_src->saisie, taille_saisie * sizeof(double)); - memcpy(irdata_dst->def_saisie, irdata_src->def_saisie, taille_saisie); - memcpy(irdata_dst->calculee, irdata_src->calculee, taille_calculee * sizeof(double)); - memcpy(irdata_dst->def_calculee, irdata_src->def_calculee, taille_calculee); -#endif /* FLG_COMPACT */ -} - -#endif /* FLG_CORRECTIF */ - - - -void IRDATA_efface(T_irdata *irdata, T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "efface("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); -#endif /* FLG_TRACE_IRDATA */ -#ifdef FLG_COMPACT - T_indice indice = ((T_desc_contexte *)desc)->indice; - irdata->valeurs[indice] = 0; - irdata->defs[indice] = 0; -#else - T_indice indice = ((T_desc_contexte *)desc)->indice & INDICE_VAL; - if ((((T_desc_contexte *)desc)->indice & EST_MASQUE) != EST_SAISIE) - return; - irdata->saisie[indice] = 0; - irdata->def_saisie[indice] = 0; -#endif /* FLG_COMPACT */ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "efface = void\n"); -#endif /* FLG_TRACE_IRDATA */ -} - -void IRDATA_efface_tableau(T_irdata *irdata, T_var_irdata desc, int ind) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "efface_tableau("); - trace_var_irdata(desc); - fprintf(stderr, "[%d])\n", ind); -#endif /* FLG_TRACE_IRDATA */ -#ifdef FLG_COMPACT - T_indice indice = ((T_desc_contexte *)desc)->indice + ind; - irdata->valeurs[indice] = 0; - irdata->defs[indice] = 0; -#else - T_indice indice = (((T_desc_contexte *)desc)->indice & INDICE_VAL) + ind; - if ((((T_desc_contexte *)desc)->indice & EST_MASQUE) != EST_SAISIE) - return; - irdata->saisie[indice] = 0; - irdata->def_saisie[indice] = 0; -#endif /* FLG_COMPACT */ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "efface_tableau = void\n"); -#endif /* FLG_TRACE_IRDATA */ -} - - - -struct S_discord * IRDATA_range(T_irdata *irdata, T_var_irdata desc, double valeur) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "range("); - trace_var_irdata(desc); - fprintf(stderr, ", %.3f)\n", valeur); -#endif /* FLG_TRACE_IRDATA */ - T_discord *discord = NULL; -#ifdef FLG_MULTITHREAD - double old_valeur; - int old_val_def; -#else - static double old_valeur; - static int old_val_def; -#endif /* FLG_MULTITHREAD */ -#ifdef FLG_COMPACT - T_indice indice = ((T_desc_contexte *)desc)->indice; - old_valeur = irdata->valeurs[indice]; - old_val_def = irdata->defs[indice]; - irdata->valeurs[indice] = valeur; - irdata->defs[indice] = 1; -#else - T_indice indice = ((T_desc_contexte *)desc)->indice & INDICE_VAL; -#ifdef FLG_DEBUG - switch (((T_desc_debug *)desc)->indice & EST_MASQUE) { - case EST_SAISIE: - old_valeur = irdata->saisie[indice]; - old_val_def = irdata->def_saisie[indice]; - irdata->saisie[indice] = valeur; - irdata->def_saisie[indice] = 1; - break; - case EST_CALCULEE: - old_valeur = irdata->calculee[indice]; - old_val_def = irdata->def_calculee[indice]; - irdata->calculee[indice] = valeur; - irdata->def_calculee[indice] = 1; - break; - case EST_BASE: - old_valeur = irdata->base[indice]; - old_val_def = irdata->def_base[indice]; - irdata->base[indice] = valeur; - irdata->def_base[indice] = 1; - break; - } -#else - if ((((T_desc_contexte *)desc)->indice & EST_MASQUE) != EST_SAISIE) - return (0); - old_valeur = irdata->saisie[indice]; - old_val_def = irdata->def_saisie[indice]; - irdata->saisie[indice] = valeur; - irdata->def_saisie[indice] = 1; -#endif /* FLG_DEBUG */ -#endif /* FLG_COMPACT */ -#if ANNEE_REVENU > 2005 - if (valeur < 0) { - discord = err_NEGATIF(irdata); - } else if (discord != NULL) { - discord = (*((T_desc_contexte *)desc)->verif)(irdata); - } -#else - discord = (*((T_desc_contexte *)desc)->verif)(irdata); -#endif /* ANNEE_REVENU > 2005 */ -#ifndef FLG_GCOS - if ((discord != NULL) && (discord->erreur->type == ANOMALIE)) { -#ifdef FLG_COMPACT - irdata->valeurs[indice] = old_valeur; - irdata->defs[indice] = old_val_def; -#else -#ifdef FLG_DEBUG - switch (((T_desc_debug *)desc)->indice & EST_MASQUE) { - case EST_SAISIE: - irdata->saisie[indice] = old_valeur; - irdata->def_saisie[indice] = old_val_def; - break; - case EST_CALCULEE: - irdata->calculee[indice] = old_valeur; - irdata->def_calculee[indice] = old_val_def; - break; - case EST_BASE: - irdata->base[indice] = old_valeur; - irdata->def_base[indice] = old_val_def; - break; - } -#else - irdata->saisie[indice] = old_valeur; - irdata->def_saisie[indice] = old_val_def; -#endif /* FLG_DEBUG */ -#endif /* FLG_COMPACT */ - } -#endif /* !FLG_GCOS */ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "range = "); - trace_discord(discord); - putc('\n', stderr); -#endif /* FLG_TRACE_IRDATA */ - return discord; -} - -void IRDATA_range_base(T_irdata *irdata, T_var_irdata desc, double valeur) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "range("); - trace_var_irdata(desc); - fprintf(stderr, ", %.3f)\n", valeur); -#endif /* FLG_TRACE_IRDATA */ -#ifdef FLG_COMPACT - T_indice indice = ((T_desc_contexte *)desc)->indice; - irdata->valeurs[indice] = valeur; - irdata->defs[indice] = 1; -#else - T_indice indice = ((T_desc_contexte *)desc)->indice & INDICE_VAL; - switch (((T_desc_contexte *)desc)->indice & EST_MASQUE) { - case EST_SAISIE: - irdata->saisie[indice] = valeur; - irdata->def_saisie[indice] = 1; - break; - case EST_CALCULEE: - irdata->calculee[indice] = valeur; - irdata->def_calculee[indice] = 1; - break; - case EST_BASE: - irdata->base[indice] = valeur; - irdata->def_base[indice] = 1; - break; - } -#endif /* FLG_COMPACT */ -} - -struct S_discord * IRDATA_range_tableau(T_irdata *irdata, T_var_irdata desc, int ind, double valeur) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "range_tableau("); - trace_var_irdata(desc) ; - fprintf(stderr, "[%d], %.3f)\n", ind, valeur); -#endif /* FLG_TRACE_IRDATA */ - T_discord *discord; -#ifdef FLG_MULTITHREAD - double old_valeur; - int old_val_def; -#else - static double old_valeur; - static int old_val_def; -#endif /* FLG_MULTITHREAD */ -#ifdef FLG_COMPACT - T_indice indice = ((T_desc_contexte *)desc)->indice + ind; - old_valeur = irdata->valeurs[indice]; - old_val_def = irdata->defs[indice]; - irdata->valeurs[indice] = valeur; - irdata->defs[indice] = 1; -#else - T_indice indice = (((T_desc_contexte *)desc)->indice & INDICE_VAL) + ind; -#ifdef FLG_DEBUG - switch (((T_desc_debug *)desc)->indice & EST_MASQUE) { - case EST_SAISIE: - old_valeur = irdata->saisie[indice]; - old_val_def = irdata->def_saisie[indice]; - irdata->saisie[indice] = valeur; - irdata->def_saisie[indice] = 1; - break; - case EST_CALCULEE: - old_valeur = irdata->calculee[indice]; - old_val_def = irdata->def_calculee[indice]; - irdata->calculee[indice] = valeur; - irdata->def_calculee[indice] = 1; - break; - case EST_BASE: - old_valeur = irdata->base[indice]; - old_val_def = irdata->def_base[indice]; - irdata->base[indice] = valeur; - irdata->def_base[indice] = 1; - break; - } -#else - if ((((T_desc_contexte *)desc)->indice & EST_MASQUE) != EST_SAISIE) - return (0); - old_valeur = irdata->saisie[indice]; - old_val_def = irdata->def_saisie[indice]; - irdata->saisie[indice] = valeur; - irdata->def_saisie[indice] = 1; -#endif /* FLG_DEBUG */ -#endif /* FLG_COMPACT */ - discord = (*((T_desc_contexte *)desc)->verif)(irdata); - if ((discord != NULL) && (discord->erreur->type == ANOMALIE)) { -#ifdef FLG_COMPACT - irdata->valeurs[indice] = old_valeur; - irdata->defs[indice] = old_val_def; -#else -#ifdef FLG_DEBUG - switch (((T_desc_debug *)desc)->indice & EST_MASQUE) { - case EST_SAISIE: - irdata->saisie[indice] = old_valeur; - irdata->def_saisie[indice] = old_val_def; - break; - case EST_CALCULEE: - irdata->calculee[indice] = old_valeur; - irdata->def_calculee[indice] = old_val_def; - break; - case EST_BASE: - irdata->base[indice] = old_valeur; - irdata->def_base[indice] = old_val_def; - break; - } -#else - irdata->saisie[indice] = old_valeur; - irdata->def_saisie[indice] = old_val_def; -#endif /* FLG_DEBUG */ -#endif /* FLG_COMPACT */ - } -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "range_tableau = "); - trace_discord(discord); - putc('\n', stderr); -#endif /* FLG_TRACE_IRDATA */ - return discord; -} - - - -void IRDATA_add_valeur(T_irdata *irdata, T_var_irdata desc, double valeur) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "add_valeur("); - trace_var_irdata(desc); - fprintf(stderr, ", %.3f)\n", valeur); -#endif /* FLG_TRACE_IRDATA */ -#ifdef FLG_COMPACT - fprintf(file, "T_indice indice = ((T_desc_contexte *)desc)->indice ;\n") ; - fprintf(file, "irdata->valeurs[indice] += valeur ;\n") ; - fprintf(file, "irdata->defs[indice] = 1 ;\n") ; -#else - T_indice indice = ((T_desc_contexte *)desc)->indice & INDICE_VAL; -#ifdef FLG_DEBUG - switch (((T_desc_debug *)desc)->indice & EST_MASQUE) { - case EST_SAISIE: - irdata->saisie[indice] += valeur; - irdata->def_saisie[indice] = 1; - break; - case EST_CALCULEE: - irdata->calculee[indice] += valeur; - irdata->def_calculee[indice] = 1; - break; - case EST_BASE: - irdata->base[indice] += valeur; - irdata->def_base[indice] = 1; - break; - } -#else - if ((((T_desc_contexte *)desc)->indice & EST_MASQUE) != EST_SAISIE) - return; - irdata->saisie[indice] += valeur; - irdata->def_saisie[indice] = 1; -#endif /* FLG_DEBUG */ -#endif /* FLG_COMPACT */ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "add_valeur = void\n"); -#endif /* FLG_TRACE_IRDATA */ -} - - - -struct S_discord * IRDATA_controle_valeur(T_irdata *irdata, T_var_irdata desc, double valeur) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "controle_valeur("); - trace_var_irdata(desc); - fprintf(stderr, ", %.3f)\n", valeur); -#endif /* FLG_TRACE_IRDATA */ - T_discord *discord; -#ifdef FLG_MULTITHREAD - double old_valeur; - int old_val_def; -#else /* FLG_MULTITHREAD */ - static double old_valeur; - static int old_val_def; -#endif /* FLG_MULTITHREAD */ -#ifdef FLG_COMPACT - T_indice indice = ((T_desc_contexte *)desc)->indice; - old_valeur = irdata->valeurs[indice]; - old_val_def = irdata->defs[indice]; - irdata->valeurs[indice] = valeur; - irdata->defs[indice] = 1; -#else - T_indice indice = ((T_desc_contexte *)desc)->indice & INDICE_VAL; - if ((((T_desc_contexte *)desc)->indice & EST_MASQUE) != EST_SAISIE) - return (0); - old_valeur = irdata->saisie[indice]; - old_val_def = irdata->def_saisie[indice]; - irdata->saisie[indice] = valeur; - irdata->def_saisie[indice] = 1; -#endif /* FLG_COMPACT */ - discord = (*((T_desc_contexte *)desc)->verif)(irdata); -#ifdef FLG_COMPACT - irdata->valeurs[indice] = old_valeur; - irdata->defs[indice] = old_val_def; -#else - irdata->saisie[indice] = old_valeur; - irdata->def_saisie[indice] = old_val_def; -#endif /* FLG_COMPACT */ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "controle_valeur = "); - trace_discord(discord); - putc('\n', stderr); -#endif /* FLG_TRACE_IRDATA */ - return discord; -} - - - -double * IRDATA_extrait(T_irdata *irdata, T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "extrait("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); -#endif /* FLG_TRACE_IRDATA */ - double *retour; -#ifdef FLG_COMPACT - T_indice indice = ((T_desc_restituee *)desc)->indice; - if (!irdata->defs[indice]) retour = NULL; - else retour = &irdata->valeurs[indice]; -#else - T_indice indice = ((T_desc_restituee *)desc)->indice & INDICE_VAL; - switch (((T_desc_restituee *)desc)->indice & EST_MASQUE) { - case EST_SAISIE: - if (!irdata->def_saisie[indice]) retour = NULL; - else retour = &irdata->saisie[indice]; - break; - case EST_CALCULEE: - if (!irdata->def_calculee[indice]) retour = NULL; - else retour = &irdata->calculee[indice]; - break; - case EST_BASE: - if (!irdata->def_base[indice]) retour = NULL; - else retour = &irdata->base[indice]; - break; - default: - retour = NULL; - break; - } -#endif /* FLG_COMPACT */ -#ifdef FLG_EXTRACTION - if ((desc >= (T_var_irdata)desc_restituee) && (desc < (T_var_irdata)desc_restituee + sizeof(T_desc_restituee) * nb_restituee)) { - ((T_desc_restituee *)desc)->est_extraite = 1; - } -#endif /* FLG_EXTRACTION */ -#ifdef FLG_TRACE_IRDATA - if (retour == NULL) { - fprintf(stderr, "extrait = undef\n"); - } else { - fprintf(stderr, "extrait = %.3f\n", *retour); - } -#endif /* FLG_TRACE_IRDATA */ - return retour; -} - -double * IRDATA_extrait_special(T_irdata *irdata, T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "extrait_special("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); -#endif /* FLG_TRACE_IRDATA */ - double *retour; -#ifdef FLG_COMPACT - T_indice indice = ((T_desc_restituee *)desc)->indice; - if (!irdata->defs[indice]) retour = NULL; - else retour = &irdata->valeurs[indice]; -#else - T_indice indice = ((T_desc_restituee *)desc)->indice & INDICE_VAL; - switch (((T_desc_restituee *)desc)->indice & EST_MASQUE) { - case EST_SAISIE: - if (!irdata->def_saisie[indice]) retour = NULL; - else retour = &irdata->saisie[indice]; - break; - case EST_CALCULEE: - if (!irdata->def_calculee[indice]) retour = NULL; - else retour = &irdata->calculee[indice]; - break; - case EST_BASE: - if (!irdata->def_base[indice]) retour = NULL; - else retour = &irdata->base[indice]; - break; - default: - retour = NULL; - break; - } -#endif /* FLG_COMPACT */ -#ifdef FLG_TRACE_IRDATA - if (retour == NULL) { - fprintf(stderr, "extrait_special = undef\n"); - } else { - fprintf(stderr, "extrait_special = %.3f\n", *retour); - } -#endif /* FLG_TRACE_IRDATA */ - return retour; -} - -double * IRDATA_extrait_tableau(T_irdata *irdata, T_var_irdata desc, int ind) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "extrait_tableau("); - trace_var_irdata(desc); - fprintf(stderr, "[%d])\n", ind); -#endif /* FLG_TRACE_IRDATA */ - double *retour; -#ifdef FLG_COMPACT - T_indice indice = ((T_desc_restituee *)desc)->indice + ind; - if (!irdata->defs[indice]) retour = NULL; - else retour = &irdata->valeurs[indice]; -#else - T_indice indice = (((T_desc_restituee *)desc)->indice & INDICE_VAL) + ind; - switch (((T_desc_restituee *)desc)->indice & EST_MASQUE) { - case EST_SAISIE: - if (!irdata->def_saisie[indice]) retour = NULL; - else retour = &irdata->saisie[indice]; - break; - case EST_CALCULEE: - if (!irdata->def_calculee[indice]) retour = NULL; - else retour = &irdata->calculee[indice]; - break; - case EST_BASE: - if (!irdata->def_base[indice]) retour = NULL; - else retour = &irdata->base[indice]; - break; - default: - retour = NULL; - break; - } -#endif /* FLG_COMPACT */ -#ifdef FLG_EXTRACTION - if ((desc >= (T_var_irdata)desc_restituee) && (desc < (T_var_irdata)desc_restituee + sizeof(T_desc_restituee) * nb_restituee)) { - ((T_desc_restituee *)desc)->est_extraite = 1; - } -#endif /* FLG_EXTRACTION */ -#ifdef FLG_TRACE_IRDATA - if (retour == NULL) { - fprintf(stderr, "extrait_tableau = undef\n"); - } else { - fprintf(stderr, "extrait_tableau = %.3f\n", *retour); - } -#endif /* FLG_TRACE_IRDATA */ - return retour; -} - - - -#ifdef FLG_EXTRACTION - -struct S_extraction -{ - int nb; -#ifdef FLG_DEBUG - T_desc_debug *desc; -#if NB_DEBUG_C > 0 - int num_bank; -#endif /* NB_DEBUG_BANK_C > 0 */ -#else - T_desc_restituee *desc; -#endif /* FLG_DEBUG */ -}; - -struct S_extraction * IRDATA_init_extraction(void) -{ - struct S_extraction *retour = (struct S_extraction *)malloc(sizeof(struct S_extraction)); -#ifdef FLG_DEBUG -#if NB_DEBUG_C <= 0 - retour->nb = nb_debug; - retour->desc = desc_debug; -#else - retour->nb = nb_debug01; - retour->desc = desc_debug01; - retour->num_bank = 1; -#endif /* NB_DEBUG_C <= 0 */ -#else - retour->nb = nb_restituee; - retour->desc = desc_restituee; -#endif /* FLG_DEBUG */ - return retour; -} - -void IRDATA_detruit_extraction(struct S_extraction *extraction) -{ - free(extraction); -} - -T_var_irdata IRDATA_extraction_suivante(struct S_extraction *extraction, int type) -{ - for (;;) { -#if defined(FLG_DEBUG) && NB_DEBUG_C > 0 - while (extraction->nb == 0) { - switch (++extraction->num_bank) { -#define LOOP_DEBUG(n, _) \ - case INC(n): \ - extraction->nb = CAT(nb_debug, TWO_DIGITS(INC(n))); \ - extraction->desc = CAT(desc_debug, TWO_DIGITS(INC(n))); \ - break; -EVAL(REPEAT(NB_DEBUG_C, LOOP_DEBUG)) -#undef LOOP_DEBUG - default: return NULL; - } - } -#else - if (extraction->nb == 0) return NULL; -#endif /* FLG_DEBUG && NB_DEBUG_C > 0 */ - extraction->nb--; - if (!extraction->desc->est_extraite -#ifndef FLG_DEBUG - && ((extraction->desc->type == type) || (extraction->desc->type == RESTITUEE)) -#endif /* FLG_DEBUG */ - ) { - T_var_irdata retour = (T_var_irdata)extraction->desc; - extraction->desc++; - return retour; - } - extraction->desc++; - } -} - -void IRDATA_reset_extraction(void) -{ -#ifdef FLG_DEBUG -#if NB_DEBUG_C <= 0 - T_desc_debug *desc = desc_debug; - int cnt = nb_debug; -#else - T_desc_debug *desc = desc_debug01; - int cnt = nb_debug01; - int num_bank = 1; -#endif /* NB_DEBUG_C <= 0 */ -#else - T_desc_restituee *desc = desc_restituee; - int cnt = nb_restituee; -#endif /* FLG_DEBUG */ - for (;;) { -#if defined(FLG_DEBUG) && NB_DEBUG_C > 0 - while (cnt == 0) { - switch (++num_bank) { -#define LOOP_DEBUG(n, _) \ - case INC(INC(n)): \ - cnt = CAT(nb_debug, TWO_DIGITS(INC(INC(n)))); \ - desc = CAT(desc_debug, TWO_DIGITS(INC(INC(n)))); \ - break; -EVAL(REPEAT(DEC(NB_DEBUG_C), LOOP_DEBUG)) -#undef LOOP_DEBUG - default: return; - } - } -#else - if (cnt == 0) return; -#endif /* FLG_DEBUG && NB_DEBUG_C > 0 */ - desc->est_extraite = 0; - desc++; - cnt--; - } -} - -#endif /* FLG_EXTRACTION */ - -struct S_table_extraction -{ - int nb; - int type; - union { - T_desc_contexte *contexte; - T_desc_famille *famille; - T_desc_revenu *revenu; - T_desc_revenu_correc *revenu_correc; - T_desc_variation *variation; - T_desc_restituee *restituee; - } desc; -}; - -struct S_table_extraction * IRDATA_init_table_extraction(int type_table) -{ - struct S_table_extraction *retour = (struct S_table_extraction *)malloc(sizeof(struct S_table_extraction)); - retour->type = type_table; - switch (type_table) { - case TYPE_CONTEXTE: - retour->nb = nb_contexte; - retour->desc.contexte = desc_contexte; - break; - case TYPE_FAMILLE: - retour->nb = nb_famille; - retour->desc.famille = desc_famille; - break; - case TYPE_REVENU: - retour->nb = nb_revenu; - retour->desc.revenu = desc_revenu; - break; - case TYPE_REVENU_CORREC: - retour->nb = nb_revenu_correc; - retour->desc.revenu_correc = desc_revenu_correc; - break; - case TYPE_VARIATION: - retour->nb = nb_variation; - retour->desc.variation = desc_variation; - break; - case TYPE_RESTITUEE: - retour->nb = nb_restituee; - retour->desc.restituee = desc_restituee; - break; - default: - free(retour); - retour = (struct S_table_extraction *)NULL; - } - return retour; -} - -void IRDATA_detruit_table_extraction(struct S_table_extraction *extraction) -{ - free(extraction); -} - -T_var_irdata IRDATA_table_extraction_suiv(struct S_table_extraction *extraction) -{ - T_var_irdata retour; - if (extraction->nb == 0) return NULL; - extraction->nb--; - switch (extraction->type) { - case TYPE_CONTEXTE: - retour = (T_var_irdata)extraction->desc.contexte; - extraction->desc.contexte++; - break; - case TYPE_FAMILLE: - retour = (T_var_irdata)extraction->desc.famille; - extraction->desc.famille++; - break; - case TYPE_REVENU: - retour = (T_var_irdata)extraction->desc.revenu; - extraction->desc.revenu++; - break; - case TYPE_REVENU_CORREC: - retour = (T_var_irdata)extraction->desc.revenu_correc; - extraction->desc.revenu_correc++; - break; - case TYPE_VARIATION: - retour = (T_var_irdata)extraction->desc.variation; - extraction->desc.variation++; - break; - case TYPE_RESTITUEE: - retour = (T_var_irdata)extraction->desc.restituee; - extraction->desc.restituee++; - break; - } - return retour; -} - - - -char * IRDATA_cherche_revenu(const char *nom) -{ - char *retour = NULL; - int fin = 0, i = 0; - while ((fin == 0) && (i < NB_REVENU)) { - if (strcmp(nom, desc_revenu[i].code) == 0) { - retour = desc_revenu[i].nom; - fin = 1; - } - i++; - } - return retour; -} - -static char * cherche_nom(const char *nom, char *table, int taille, int sup) -{ - int inf = 0; - for (;;) { - int res; - int millieu; - char *pt_cmp; - if (inf == sup) return NULL; - millieu = (inf + sup) / 2; - pt_cmp = table + (taille * millieu); - res = strcmp(nom, ((T_desc_contexte *)pt_cmp)->nom); - if (res == 0) return pt_cmp; - if (res < 0) sup = millieu; - else inf = millieu + 1; - } -} - -T_var_irdata IRDATA_get_var_irdata(const char *nom, T_typezone2042 type) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_desc(%s,", nom); - trace_type(type); - fprintf(stderr, ")\n"); -#endif /* FLG_TRACE_IRDATA */ - char *retour; - switch (type) { - case TYPE_CONTEXTE: - retour = cherche_nom(nom, (char *)desc_contexte, sizeof(T_desc_contexte), nb_contexte); - break; - case TYPE_FAMILLE: - retour = cherche_nom(nom, (char *)desc_famille, sizeof(T_desc_famille), nb_famille); - break; - case TYPE_REVENU: - retour = cherche_nom(nom, (char *)desc_revenu, sizeof(T_desc_revenu), nb_revenu); - break; - case TYPE_REVENU_CORREC: - retour = cherche_nom(nom, (char *)desc_revenu, sizeof(T_desc_revenu), nb_revenu); - if (retour == NULL) - retour = cherche_nom(nom, (char *)desc_revenu_correc, sizeof(T_desc_revenu_correc), nb_revenu_correc); - break; - case TYPE_VARIATION: - retour = cherche_nom(nom, (char *)desc_variation, sizeof(T_desc_variation), nb_variation); - break; - case TYPE_RESTITUEE: - retour = cherche_nom(nom, (char *)desc_restituee, sizeof(T_desc_restituee), nb_restituee); -#if defined(FLG_DEBUG) && defined(FLG_EXTRACTION) - if (retour == NULL) break; - /* FALL INFO */ -#else - break; -#endif /* FLG_DEBUG && FLG_EXTRACTION */ -#ifdef FLG_DEBUG - case TYPE_DEBUG: -#if NB_DEBUG_C <= 0 - retour = cherche_nom(nom, (char *)desc_debug, sizeof(T_desc_debug), nb_debug); -#else - retour = cherche_nom(nom, (char *)desc_debug01, sizeof(T_desc_debug), nb_debug01); -#define LOOP_DEBUG(n, _) \ - if (retour == NULL) retour = cherche_nom(nom, (char *)CAT(desc_debug, TWO_DIGITS(INC(INC(n)))), sizeof(T_desc_debug), CAT(nb_debug, TWO_DIGITS(INC(INC(n))))); -EVAL(REPEAT(DEC(NB_DEBUG_C), LOOP_DEBUG)) -#undef LOOP_DEBUG -#endif /* NB_DEBUG_C <= 0 */ - break; -#endif /* FLG_DEBUG */ - default: - retour = NULL; - break; - } -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_desc = "); - trace_var_irdata(retour); - putc('\n', stderr); -#endif /* FLG_TRACE_IRDATA */ - return retour; -} - -int IRDATA_est_du_type(T_var_irdata desc, T_typezone2042 type) -{ - switch (type) { - case TYPE_CONTEXTE: - return ((desc >= (T_var_irdata)desc_contexte) && (desc < (T_var_irdata)desc_contexte + sizeof(T_desc_contexte)*nb_contexte)); - case TYPE_FAMILLE: - return ((desc >= (T_var_irdata)desc_famille) && (desc < (T_var_irdata)desc_famille + sizeof(T_desc_famille)*nb_famille)); - case TYPE_REVENU: - return ((desc >= (T_var_irdata)desc_revenu) && (desc < (T_var_irdata)desc_revenu + sizeof(T_desc_revenu)*nb_revenu)); - case TYPE_REVENU_CORREC: - return ((desc >= (T_var_irdata)desc_revenu_correc) && (desc < (T_var_irdata)desc_revenu_correc + sizeof(T_desc_revenu_correc)*nb_revenu_correc)); - case TYPE_VARIATION: - return ((desc >= (T_var_irdata)desc_variation) && (desc < (T_var_irdata)desc_variation + sizeof(T_desc_variation)*nb_variation)); - case TYPE_RESTITUEE: - return ((desc >= (T_var_irdata)desc_restituee) && (desc < (T_var_irdata)desc_restituee + sizeof(T_desc_restituee)*nb_restituee)); - case TYPE_BASE: -#ifdef FLG_COMPACT - return ((((T_desc_contexte *)desc)->indice >= taille_saisie+taille_calculee) && (((T_desc_contexte *)desc)->indice < taille_saisie+taille_calculee+taille_base)); -#else - return ((((T_desc_contexte *)desc)->indice & EST_MASQUE) == EST_BASE); -#endif /* FLG_COMPACT */ - default: - return FALSE; - } -} - -char * IRDATA_get_nom(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_nom("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "get_nom = %s\n", ((T_desc_revenu *)desc)->nom); -#endif /* FLG_TRACE_IRDATA */ - return ((T_desc_revenu *)desc)->nom; -} - -char * IRDATA_get_lib(T_var_irdata desc) -{ - char *libelle = NULL; - -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_lib("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "get_lib = \"%s\"\n", ((T_desc_revenu *)desc)->libelle); -#endif /* FLG_TRACE_IRDATA */ - - if ((IRDATA_est_du_type(desc, TYPE_REVENU)) || (IRDATA_est_du_type(desc, TYPE_REVENU_CORREC)) || (IRDATA_est_du_type(desc, TYPE_FAMILLE))) { - libelle = ((T_desc_revenu *)desc)->libelle; - } - - if ((IRDATA_est_du_type(desc, TYPE_CONTEXTE))) { - libelle = ((T_desc_contexte *)desc)->libelle; - } - -#ifdef FLG_GENERE_LIBELLE_RESTITUEE - if (IRDATA_est_du_type(desc, TYPE_RESTITUEE)) { - libelle = ((T_desc_restituee *)desc)->libelle; - } -#endif /* FLG_GENERE_LIBELLE_RESTITUEE */ - - return (libelle); -} - -T_classe IRDATA_get_classe(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_classe("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "get_classe = %d\n", ((T_desc_revenu *)desc)->classe); -#endif /* FLG_TRACE_IRDATA */ - return ((T_desc_revenu *)desc)->classe; -} - -T_priorite IRDATA_get_priorite(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_priorite("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "get_priorite = %d\n", ((T_desc_revenu *)desc)->priorite); -#endif /* FLG_TRACE_IRDATA */ - return ((T_desc_revenu *)desc)->priorite; -} - -T_categorie_TL IRDATA_get_categorie_TL(T_var_irdata p_Descripteur) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_categorie_TL("); - trace_var_irdata(p_Descripteur); - fprintf(stderr, ")\n"); - fprintf(stderr, "get_categorie_TL = %d\n", ((T_desc_revenu *)p_Descripteur)->categorie_TL); -#endif /* FLG_TRACE_IRDATA */ - return ((T_desc_revenu *)p_Descripteur)->categorie_TL; -} - -T_cotsoc IRDATA_get_cotsoc(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_cotsoc("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "get_cotsoc = %d\n", ((T_desc_revenu *)desc)->cotsoc); -#endif /* FLG_TRACE_IRDATA */ - return ((T_desc_revenu *)desc)->cotsoc; -} - -T_ind_abat IRDATA_get_ind_abat(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_ind_abat("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "get_ind_abat = %d\n", ((T_desc_revenu *)desc)->ind_abat); -#endif /* FLG_TRACE_IRDATA */ - return ((T_desc_revenu *)desc)->ind_abat; -} - -T_acompte IRDATA_get_acompte(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_acompte("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "get_acompte = %d\n", ((T_desc_revenu *)desc)->acompte); -#endif /* FLG_TRACE_IRDATA */ - return ((T_desc_revenu *)desc)->acompte; -} - -T_avfisc IRDATA_get_avfisc(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_avfisc("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "get_avfisc = %d\n", ((T_desc_revenu *)desc)->afisc); -#endif /* FLG_TRACE_IRDATA */ - return ((T_desc_revenu *)desc)->avfisc; -} - -T_rapcat IRDATA_get_rapcat(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_rapcat("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "get_rapcat = %d\n", ((T_desc_revenu *)desc)->rapcat); -#endif /* FLG_TRACE_IRDATA */ - return ((T_desc_revenu *)desc)->rapcat; -} - -T_sanction IRDATA_get_sanction(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_sanction("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "get_sanction = %d\n", ((T_desc_revenu *)desc)->sanction); -#endif /* FLG_TRACE_IRDATA */ - return ((T_desc_revenu *)desc)->sanction; -} - -T_modcat IRDATA_get_modcat(T_var_irdata desc) -{ - if ((IRDATA_est_du_type(desc, TYPE_REVENU)) || (IRDATA_est_du_type(desc, TYPE_REVENU_CORREC))) - return ((T_desc_revenu *)desc)->modcat; - - if ((IRDATA_est_du_type(desc, TYPE_CONTEXTE))) - return ((T_desc_contexte *)desc)->modcat; - - if ((IRDATA_est_du_type(desc, TYPE_FAMILLE))) - return ((T_desc_famille *)desc)->modcat; - - return -1; -} - -T_nat_code IRDATA_get_nat_code(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_nat_code("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "get_nat_code = %d\n", ((T_desc_revenu *)desc)->nat_code); -#endif /* FLG_TRACE_IRDATA */ - return ((T_desc_revenu *)desc)->nat_code; -} - - -T_var_irdata IRDATA_get_liee(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_liee("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "get_liee = %s\n", ((T_desc_revenu *)desc)->liee); -#endif /* FLG_TRACE_IRDATA */ - return ((T_desc_revenu *)desc)->liee; -} - -T_type IRDATA_get_type(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_type("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "get_type = %d\n", ((T_desc_contexte *)desc)->type_donnee); -#endif /* FLG_TRACE_IRDATA */ - return ((T_desc_contexte *)desc)->type_donnee; -} - -T_type IRDATA_est_booleen(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_est_booleen("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "get_est_booleen = %d\n", ((T_desc_contexte *)desc)->type_donnee); -#endif /* FLG_TRACE_IRDATA */ - return ((IRDATA_get_type(desc) & BOOLEEN)); -} - -T_type IRDATA_est_numerique(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "IRDATA_est_numerique("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "IRDATA_est_numerique = %d\n", ((T_desc_contexte *)desc)->type_donnee); -#endif /* FLG_TRACE_IRDATA */ - return ((IRDATA_get_type(desc) & NUMERIQUE)); -} - -T_type IRDATA_est_date(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "IRDATA_est_date("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "IRDATA_est_date = %d\n", ((T_desc_contexte *)desc)->type_donnee); -#endif /* FLG_TRACE_IRDATA */ - return ((IRDATA_get_type(desc) & DATE)); -} - -T_type IRDATA_est_entier(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "IRDATA_est_entier("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "IRDATA_est_entier = %d\n", ((T_desc_contexte *)desc)->type_donnee); -#endif /* FLG_TRACE_IRDATA */ - return ((IRDATA_get_type(desc) & ENTIER)); -} - -T_type IRDATA_est_reel(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "IRDATA_est_reel("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "IRDATA_est_reel = %d\n", ((T_desc_contexte *)desc)->type_donnee); -#endif /* FLG_TRACE_IRDATA */ - return ((IRDATA_get_type(desc) & REEL)); -} - -T_type IRDATA_est_reel1(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "IRDATA_est_reel1("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "IRDATA_est_reel1 = %d\n", ((T_desc_contexte *)desc)->type_donnee); -#endif /* FLG_TRACE_IRDATA */ - return ((IRDATA_get_type(desc) & REEL1)); -} - -T_type IRDATA_est_reel2(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "IRDATA_est_reel2("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "IRDATA_est_reel2 = %d\n", ((T_desc_contexte *)desc)->type_donnee); -#endif /* FLG_TRACE_IRDATA */ - return ((IRDATA_get_type(desc) & REEL2)); -} - -T_type IRDATA_est_reel3(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "IRDATA_est_reel3("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "IRDATA_est_reel3 = %d\n", ((T_desc_contexte *)desc)->type_donnee); -#endif /* FLG_TRACE_IRDATA */ - return ((IRDATA_get_type(desc) & REEL3)); -} - -T_type IRDATA_est_date_JJMMAAAA(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "IRDATA_est_date_JJMMAAAA("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "IRDATA_est_date_JJMMAAAA = %d\n", ((T_desc_contexte *)desc)->type_donnee); -#endif /* FLG_TRACE_IRDATA */ - return ((IRDATA_get_type(desc) & DATE_JJMMAAAA)); -} - -T_type IRDATA_est_date_AAAA(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "IRDATA_est_date_AAAA("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "IRDATA_est_date_AAAA = %d\n", ((T_desc_contexte *)desc)->type_donnee); -#endif /* FLG_TRACE_IRDATA */ - return ((IRDATA_get_type(desc) & DATE_AAAA)); -} - -T_type IRDATA_est_date_MMAAAA(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "IRDATA_est_date_MMAAAA("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "IRDATA_est_date_MMAAAA = %d\n", ((T_desc_contexte *)desc)->type_donnee); -#endif /* FLG_TRACE_IRDATA */ - return ((IRDATA_get_type(desc) & DATE_MMAAAA)); -} - -T_type IRDATA_est_date_JJMM(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "IRDATA_est_date_JJMM("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "IRDATA_est_date_JJMM = %d\n", ((T_desc_contexte *)desc)->type_donnee); -#endif /* FLG_TRACE_IRDATA */ - return ((IRDATA_get_type(desc) & DATE_JJMM)); -} - -T_type IRDATA_est_date_MM(T_var_irdata desc) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "IRDATA_est_date_MM("); - trace_var_irdata(desc); - fprintf(stderr, ")\n"); - fprintf(stderr, "IRDATA_est_date_MM = %d\n", ((T_desc_contexte *)desc)->type_donnee); -#endif /* FLG_TRACE_IRDATA */ - return ((IRDATA_get_type(desc) & DATE_MM)); -} - - - -T_ench_calcul IRDATA_get_ench_calcul(const char *ref) -{ -#if FLG_TRACE_IRDATA - fprintf(stderr, "get_ench_calcul(%s)\n", ref); -#endif /* FLG_TRACE_IRDATA */ - int cnt; - T_desc_ench *desc = desc_ench; - for (cnt = 0;; cnt++) { - if (cnt == nb_enchaine) { desc = NULL; break; } - if (strcmp(desc->nom , ref) == 0) break; - desc++; - } -#if FLG_TRACE_IRDATA - fprintf(stderr, "get_ench_calcul = "); - /*trace_regle_calcul(desc) ;*/ - putc('\n', stderr); -#endif /* FLG_TRACE_IRDATA */ - return desc; -} - -void IRDATA_exec_ench(T_irdata *irdata, T_ench_calcul p_ench) -{ -#if FLG_TRACE_IRDATA - fprintf(stderr, "exec_ench("); - /*trace_regle_calcul(p_calcul) ;*/ - fprintf(stderr, ")\n"); -#endif /* FLG_TRACE_IRDATA */ - (*p_ench->proc)(irdata); -#if FLG_TRACE_IRDATA - fprintf(stderr, "exec_ench = void\n"); -#endif /* FLG_TRACE_IRDATA */ -} - -#ifdef FLG_DEBUG - -T_regle_calcul IRDATA_get_regle_calcul(int ref) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_regle_calcul(%d)\n", ref); -#endif /* FLG_TRACE_IRDATA */ - int cnt; - T_desc_call *desc = desc_call; - for (cnt = 0;; cnt++) { - if (cnt == nb_call) { desc = NULL; break; } - if (desc->num == ref) break; - desc++; - } -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_regle_calcul = "); - trace_regle_calcul(desc); - putc('\n', stderr); -#endif /* FLG_TRACE_IRDATA */ - return desc; -} - -void IRDATA_exec_calcul(T_irdata *irdata, T_regle_calcul p_calcul) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "exec_calcul("); - trace_regle_calcul(p_calcul); - fprintf(stderr, ")\n"); -#endif /* FLG_TRACE_IRDATA */ - (*p_calcul->proc)(irdata); -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "exec_calcul = void\n"); -#endif /* FLG_TRACE_IRDATA */ -} - -#endif /* FLG_DEBUG */ - -#if defined(FLG_DEBUG) || defined(FLG_CONTROLE_IMMEDIAT) - -T_regle_verif IRDATA_get_regle_verif(int ref) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_regle_verif(%d)\n", ref); -#endif /* FLG_TRACE_IRDATA */ - int cnt; - T_desc_verif *desc = desc_verif; - for (cnt = 0;; cnt++) { - if (cnt == nb_verif) { desc = NULL; break; } - if (desc->num == ref) break; - desc++; - } -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "get_regle_verif = "); - trace_regle_verif(desc); - putc('\n', stderr); -#endif /* FLG_TRACE_IRDATA */ - return desc; -} - -T_discord * IRDATA_exec_verif(T_irdata *irdata, T_regle_verif p_verif) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "exec_verif("); - trace_regle_verif(p_verif); - fprintf(stderr, ")\n"); -#endif /* FLG_TRACE_IRDATA */ - T_discord *retour; - if (p_verif->proc == NULL) retour = NULL; - else retour = une_verif(irdata, p_verif->proc); -#ifdef FLG_TRACE_IRDATA - if (flg_trace_irdata) { - fprintf(stderr, "exec_verif = "); - trace_discord(retour); - putc('\n', stderr); - } - return retour; -#endif /* FLG_TRACE_IRDATA */ -} - -#endif /* FLG_DEBUG || FLG_CONTROLE_IMMEDIAT */ - - - -/****************************************************************/ -/* NOUVELLES FONCTIONS DE MANIPULATION DES ERREURS */ -/* A UTILISER DE PREFERENCE DES LA CAMPAGNE 2006. */ -/****************************************************************/ -char IRDATA_GetFamille_erreur(const T_discord *pp_discord) -{ - return pp_discord->erreur->nom[0]; -} - -const char * IRDATA_GetCodeBO_erreur(T_discord *pp_discord) -{ - return pp_discord->erreur->codebo; -} - -const char * IRDATA_GetSousCode_erreur(T_discord *pp_discord) -{ - return pp_discord->erreur->souscode; -} - -char IRDATA_GetIsIsf_erreur(const T_discord *pp_discord) -{ - char *retour; - retour = pp_discord->erreur->isisf; - return retour[0]; -} - -const char * IRDATA_GetLibelle_erreur(T_discord *pp_discord) -{ - /*variables locales*/ - char *l_libelle_seul; - - l_libelle_seul = strstr(pp_discord->erreur->message, ERREUR_DELIMITEUR); - return (l_libelle_seul ? l_libelle_seul : pp_discord->erreur->message); -} - -const char * IRDATA_GetCodeInterne_erreur(T_discord *pp_discord) -{ - return pp_discord->erreur->nom; -} - -short IRDATA_GetType_erreur(const T_discord *pp_discord) -{ - return pp_discord->erreur->type; -} - - - -/****************************************************************/ -/* ANCIENNES FONCTIONS DE MANIPULATION DES ERREURS */ -/* A NE PLUS UTILISER DE PREFERENCE APRES LA CAMPAGNE 2005. */ -/****************************************************************/ -char * IRDATA_lib_erreur(struct S_discord *discord) -{ - return discord->erreur->message; -} - -char * IRDATA_codebo_erreur(struct S_discord *discord) -{ - return discord->erreur->codebo; -} - -short IRDATA_type_erreur(const struct S_discord *discord) -{ - return discord->erreur->type; -} - -int IRDATA_erreur_bloquante(const struct S_discord *discord) -{ - return (discord->erreur->type == ANOMALIE); -} - -char * IRDATA_nom_erreur(struct S_discord *discord) -{ - return discord->erreur->nom; -} - -struct S_discord * IRDATA_erreur_suivante(struct S_discord *discord) -{ -#ifdef FLG_TRACE_IRDATA - fprintf(stderr, "err_suivante = "); - trace_discord(discord->suivant); - putc('\n', stderr); -#endif /* FLG_TRACE_IRDATA */ - return discord->suivant; -} - - - -#ifdef FLG_DEBUG - -T_desc_err * IRDATA_get_desc_err(const char *nom) -{ - return (T_desc_err *)cherche_nom(nom, (char *)desc_err, sizeof(T_desc_err), nb_err); -} - -char * IRDATA_desc_err_lib_erreur(struct S_desc_err *desc_err) -{ - return desc_err->erreur->message; -} - -short IRDATA_desc_err_type_erreur(const struct S_desc_err *desc_err) -{ - return desc_err->erreur->type; -} - -char * IRDATA_desc_err_codebo_erreur(struct S_desc_err *desc_err) -{ - return desc_err->erreur->codebo; -} - -int IRDATA_desc_err_erreur_bloquante(const struct S_desc_err *desc_err) -{ - return (desc_err->erreur->type == ANOMALIE); -} - -char * IRDATA_desc_err_nom_erreur(struct S_desc_err *desc_err) -{ - return desc_err->erreur->nom; -} - -#endif /* FLG_DEBUG */ - -/* Gestion des erreurs */ - -extern int recup_disco(struct S_discord *ptr_d); - -void finalise_erreur(T_irdata *irdata) { -#ifdef FLG_MULTITHREAD - recup_disco(irdata->discords); -#else - recup_disco(discords); -#endif /* FLG_MULTITHREAD */ -} - -extern int rech_code_recu(void); - -void exporte_erreur(T_irdata *irdata) { - rech_code_recu(); -} - diff --git a/examples/dgfip_c/ml_primitif/c_driver_with_macro/irdata.h b/examples/dgfip_c/ml_primitif/c_driver_with_macro/irdata.h deleted file mode 100644 index 3920df98..00000000 --- a/examples/dgfip_c/ml_primitif/c_driver_with_macro/irdata.h +++ /dev/null @@ -1,255 +0,0 @@ -/****** LICENCE CECIL *****/ - -#ifndef _IRDATA_H_ -#define _IRDATA_H_ - -#include "conf.h" -#include "dbg.h" -#include "annee.h" - -#if defined(__GNUC__) || defined(__STDC__) -#define _PROTS(X) X -#else -#define _PROTS(X) () -#endif - -#define TYPE_CONTEXTE 0 -#define TYPE_FAMILLE 1 -#define TYPE_REVENU 2 -#define TYPE_REVENU_CORREC 3 -#define TYPE_VARIATION 4 -#define TYPE_RESTITUEE 5 -#define TYPE_RESTITUEE_P 6 -#define TYPE_RESTITUEE_C 7 -#define TYPE_PENALITE 8 -#define TYPE_BASE 10 - -#ifdef FLG_DEBUG -#define TYPE_DEBUG 6 -#endif /* FLG_DEBUG */ - -/* Gestion des erreurs */ -#define ERREUR_DELIMITEUR " / " -#define ERREUR_SEPARATEUR "-" - -/* Couleurs */ -#define NOIR 30 -#define ROUGE 31 -#define VERT 32 -#define JAUNE 33 -#define BLEU 34 -#define MAGENTA 35 -#define CYAN 36 -#define BLANC 37 -#define FOND_ROUGE 41 -#define FOND_VERT 42 -#define FOND_JAUNE 43 -#define FOND_BLEU 44 -#define FOND_MAGENTA 45 -#define FOND_CYAN 46 -#define FOND_BLANC 47 -#define NORMAL 0 -#define GRAS 1 -#define STANDOUT 3 -#define SOULIGNE 4 - -typedef int T_indice; -typedef long T_type; -typedef int T_classe; -typedef int T_priorite; -typedef int T_categorie_TL; -typedef int T_cotsoc; -typedef int T_ind_abat; -typedef int T_acompte; -typedef int T_avfisc; -typedef int T_rapcat; -typedef int T_sanction; -typedef int T_modcat; -typedef int T_nat_code; -typedef int T_typezone2042; - -extern int IRDATA_annee_revenu(void); - -extern struct S_irdata * IRDATA_new_irdata _PROTS((void)); -extern void IRDATA_delete_irdata _PROTS((struct S_irdata *irdata)); - -#ifdef FLG_MULTITHREAD -extern void IRDATA_reset_erreur _PROTS((struct S_irdata *irdata)); -extern void IRDATA_set_max_bloquantes _PROTS((struct S_irdata *irdata, const int max_ano)); -#endif /* FLG_MULTITHREAD */ - -extern void IRDATA_reset_irdata _PROTS((struct S_irdata *irdata)); -extern void IRDATA_reset_light _PROTS((struct S_irdata *irdata)); -extern void IRDATA_reset_base _PROTS((struct S_irdata *irdata)); -extern void IRDATA_reset_calculee _PROTS((struct S_irdata *irdata)); - -#ifdef FLG_CORRECTIF -extern void IRDATA_recopie_irdata _PROTS((const struct S_irdata *irdata_src, struct S_irdata *irdata_dst)); -extern void IRDATA_recopie_irdata_light _PROTS((const struct S_irdata *irdata_src, struct S_irdata *irdata_dst)); -#endif /* FLG_CORRECTIF */ - -extern void IRDATA_efface _PROTS((struct S_irdata *irdata, T_var_irdata var_irdata)); -extern void IRDATA_efface_tableau _PROTS((struct S_irdata *irdata, T_var_irdata var_irdata, int ind)); - -extern struct S_discord * IRDATA_range _PROTS((struct S_irdata *irdata, T_var_irdata var_irdata, double valeur)); -extern void IRDATA_range_base _PROTS((struct S_irdata *irdata, T_var_irdata var_irdata, double valeur)); -extern struct S_discord * IRDATA_range_tableau _PROTS((struct S_irdata *irdata, T_var_irdata var_irdata, int ind, double valeur)); - -extern void IRDATA_add_valeur _PROTS((struct S_irdata *irdata, T_var_irdata var_irdata, double valeur)); - -extern struct S_discord * IRDATA_controle_valeur _PROTS((struct S_irdata *irdata, T_var_irdata var_irdata, double valeur)); - -extern double * IRDATA_extrait _PROTS((struct S_irdata *irdata, T_var_irdata var_irdata)); -extern double * IRDATA_extrait_special _PROTS((struct S_irdata *irdata, T_var_irdata var_irdata)); -extern double * IRDATA_extrait_tableau _PROTS((struct S_irdata *irdata, T_var_irdata var_irdata, int ind)); - -#ifdef FLG_EXTRACTION -typedef struct S_extraction T_extraction; -extern T_extraction * IRDATA_init_extraction(void); -extern void IRDATA_detruit_extraction _PROTS((T_extraction *)); -extern T_var_irdata IRDATA_extraction_suivante _PROTS((T_extraction *, int type)); -extern void IRDATA_reset_extraction(void); -#endif /* FLG_EXTRACTION */ - -typedef struct S_table_extraction T_table_extraction; -extern T_table_extraction *IRDATA_init_table_extraction _PROTS((int)); -extern void IRDATA_detruit_table_extraction _PROTS((T_table_extraction *)); -extern T_var_irdata IRDATA_table_extraction_suiv _PROTS((T_table_extraction *)); - - - -extern char * IRDATA_cherche_revenu _PROTS((const char *nom)); -extern T_var_irdata IRDATA_get_var_irdata _PROTS((const char *nom, T_typezone2042 type)); -extern int IRDATA_est_du_type _PROTS((T_var_irdata desc, T_typezone2042 type)); -extern char * IRDATA_get_nom _PROTS((T_var_irdata var_irdata)); -extern char * IRDATA_get_lib _PROTS((T_var_irdata var_irdata)); -extern T_classe IRDATA_get_classe _PROTS((T_var_irdata var_irdata)); -extern T_priorite IRDATA_get_priorite _PROTS((T_var_irdata var_irdata)); -extern T_priorite IRDATA_get_categorie_TL _PROTS((T_var_irdata var_irdata)); -extern T_cotsoc IRDATA_get_cotsoc _PROTS((T_var_irdata var_irdata)); -extern T_ind_abat IRDATA_get_ind_abat _PROTS((T_var_irdata var_irdata)); -extern T_acompte IRDATA_get_acompte _PROTS((T_var_irdata var_irdata)); -extern T_avfisc IRDATA_get_avfisc _PROTS((T_var_irdata var_irdata)); -extern T_rapcat IRDATA_get_rapcat _PROTS((T_var_irdata var_irdata)); -extern T_sanction IRDATA_get_sanction _PROTS((T_var_irdata var_irdata)); -extern T_modcat IRDATA_get_modcat _PROTS((T_var_irdata var_irdata)); -extern T_nat_code IRDATA_get_nat_code _PROTS((T_var_irdata var_irdata)); -extern T_var_irdata IRDATA_get_liee _PROTS((T_var_irdata var_irdata)); -extern T_type IRDATA_get_type _PROTS((T_var_irdata var_irdata)); -extern T_type IRDATA_est_booleen _PROTS((T_var_irdata var_irdata)); -extern T_type IRDATA_est_numerique _PROTS((T_var_irdata var_irdata)); -extern T_type IRDATA_est_date _PROTS((T_var_irdata var_irdata)); -extern T_type IRDATA_est_date_JJMMAAAA _PROTS((T_var_irdata var_irdata)); -extern T_type IRDATA_est_date_MMAAAA _PROTS((T_var_irdata var_irdata)); -extern T_type IRDATA_est_date_AAAA _PROTS((T_var_irdata var_irdata)); -extern T_type IRDATA_est_date_JJMM _PROTS((T_var_irdata var_irdata)); -extern T_type IRDATA_est_date_MM _PROTS((T_var_irdata var_irdata)); -extern T_type IRDATA_est_entier _PROTS((T_var_irdata var_irdata)); -extern T_type IRDATA_est_reel _PROTS((T_var_irdata var_irdata)); -extern T_type IRDATA_est_reel1 _PROTS((T_var_irdata var_irdata)); -extern T_type IRDATA_est_reel2 _PROTS((T_var_irdata var_irdata)); -extern T_type IRDATA_est_reel3 _PROTS((T_var_irdata var_irdata)); - - - -typedef struct S_desc_ench *T_ench_calcul; -extern T_ench_calcul IRDATA_get_ench_calcul _PROTS((const char *ref)); -extern void IRDATA_exec_ench _PROTS((struct S_irdata *irdata, T_ench_calcul p_ench)); - -#ifdef FLG_DEBUG -typedef struct S_desc_call *T_regle_calcul; -extern T_regle_calcul IRDATA_get_regle_calcul _PROTS((int ref)); -extern void IRDATA_exec_calcul _PROTS((struct S_irdata *irdata, T_regle_calcul p_calcul)); -#endif /* FLG_DEBUG */ - -#if defined(FLG_DEBUG) || defined(FLG_CONTROLE_IMMEDIAT) -typedef struct S_desc_verif *T_regle_verif; -extern T_regle_verif IRDATA_get_regle_verif _PROTS((int ref)); -extern struct S_discord * IRDATA_exec_verif _PROTS((struct S_irdata *irdata, T_regle_verif p_verif)); -#endif /* FLG_DEBUG || FLG_CONTROLE_IMMEDIAT */ - - - -/* Gestion des erreurs */ - -char IRDATA_GetFamille_erreur _PROTS((const T_discord *discord)); -const char * IRDATA_GetCodeBo_erreur _PROTS((T_discord *discord)); -const char * IRDATA_GetSousCode_erreur _PROTS((T_discord *discord)); -char IRDATA_GetIsIsf_erreur _PROTS((const T_discord *discord)); -const char * IRDATA_GetLibelle_erreur _PROTS((T_discord *discord)); -const char * IRDATA_GetCodeInterne_erreur _PROTS((T_discord *discord)); -short IRDATA_GetType_erreur _PROTS((const T_discord * pp_discord)); - -extern char * IRDATA_lib_erreur _PROTS((struct S_discord *discord)); -extern char * IRDATA_codebo_erreur _PROTS((struct S_discord *discord)); -extern short IRDATA_type_erreur _PROTS((const struct S_discord *discord)); -extern int IRDATA_erreur_bloquante _PROTS((const struct S_discord *discord)); -extern char * IRDATA_nom_erreur _PROTS((struct S_discord *discord)); -extern struct S_discord * IRDATA_erreur_suivante _PROTS((struct S_discord *discord)); - -#ifdef FLG_DEBUG -extern struct S_desc_err * IRDATA_get_desc_err _PROTS((const char *nom)); -extern char * IRDATA_desc_err_lib_erreur _PROTS((struct S_desc_err *desc_err)); -extern char * IRDATA_desc_err_codebo_erreur _PROTS((struct S_desc_err *desc_err)); -extern short IRDATA_desc_err_type_erreur _PROTS((const struct S_desc_err *desc_err)); -extern int IRDATA_desc_err_erreur_bloquante _PROTS((const struct S_desc_err *desc_err)); -extern char * IRDATA_desc_err_nom_erreur _PROTS((struct S_desc_err *desc)); -#endif /* FLG_DEBUG */ - - - -/* Fonctions définies dans enchain.c */ - -#if ANNEE_REVENU > 2005 -extern struct S_discord * err_NEGATIF _PROTS((T_irdata *irdata)); -extern void nettoie_erreur _PROTS((T_irdata *irdata)); -#endif /* ANNEE_REVENU > 2005 */ - -#if ANNEE_REVENU > 2010 -extern struct S_discord * err_BOOLEEN _PROTS((T_irdata *irdata)); -#endif /* ANNEE_REVENU > 2010 */ - -extern void initialisation_primitive _PROTS((T_irdata *irdata)); - -#ifdef FLG_CORRECTIF -extern void initialisation_corrective _PROTS((T_irdata *irdata)); -#endif /* FLG_CORRECTIF */ - -extern struct S_discord * verif_calcul_primitive _PROTS((T_irdata *irdata)); -extern struct S_discord * verif_calcul_primitive_isf _PROTS((T_irdata *irdata)); - -#ifdef FLG_CORRECTIF -extern struct S_discord * verif_calcul_corrective _PROTS((T_irdata *irdata)); -#endif /* FLG_CORRECTIF */ - -#ifndef FLG_CONTROLE_IMMEDIAT - -extern struct S_discord * verif_saisie_cohe_primitive _PROTS((T_irdata *irdata)); -extern struct S_discord * verif_saisie_cohe_primitive_isf _PROTS((T_irdata *irdata, int appel)); - -#ifdef FLG_CONTROLE_SEPARE -#define CONTROLE_SEPARE -extern struct S_discord * verif_contexte_cohe_primitive _PROTS((T_irdata *irdata)); -extern struct S_discord * verif_famille_cohe_primitive _PROTS((T_irdata *irdata)); -extern struct S_discord * verif_revenu_cohe_primitive _PROTS((T_irdata *irdata)); -#endif /* CONTROLE_SEPARE */ - -#ifdef FLG_CORRECTIF -extern struct S_discord * verif_saisie_cohe_corrective _PROTS((T_irdata *irdata)); - -#ifdef FLG_CONTROLE_SEPARE -extern struct S_discord * verif_contexte_cohe_corrective _PROTS((T_irdata *irdata)); -extern struct S_discord * verif_famille_cohe_corrective _PROTS((T_irdata *irdata)); -extern struct S_discord * verif_revenu_cohe_corrective _PROTS((T_irdata *irdata)); -#endif /* FLG_CONTROLE_SEPARE */ - -#endif /* FLG_CORRECTIF */ - -#endif /* FLG_CONTROLE_IMMEDIAT */ - -#ifdef FLG_CORRECTIF -extern struct S_discord * verif_cohe_horizontale _PROTS((T_irdata *irdata)); -#endif /* FLG_CORRECTIF */ - -#endif /* _IRDATA_H_ */ - diff --git a/examples/dgfip_c/ml_primitif/c_driver_with_macro/repeat.h b/examples/dgfip_c/ml_primitif/c_driver_with_macro/repeat.h deleted file mode 100644 index 4c777b57..00000000 --- a/examples/dgfip_c/ml_primitif/c_driver_with_macro/repeat.h +++ /dev/null @@ -1,276 +0,0 @@ -/****** 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_ */ - diff --git a/examples/dgfip_c/ml_primitif/c_driver_with_macro/var.c b/examples/dgfip_c/ml_primitif/c_driver_with_macro/var.c deleted file mode 100644 index 92456703..00000000 --- a/examples/dgfip_c/ml_primitif/c_driver_with_macro/var.c +++ /dev/null @@ -1,90 +0,0 @@ -/****** LICENCE CECIL *****/ - -#include "var.h" - -int taille_saisie = TAILLE_SAISIE; -int taille_calculee = TAILLE_CALCULEE; -int taille_base = TAILLE_BASE; -int taille_totale = TAILLE_TOTALE; - -int nb_contexte = NB_CONTEXTE; -int nb_famille = NB_FAMILLE; -int nb_revenu = NB_REVENU; -int nb_revenu_correc = NB_REVENU_CORREC; -int nb_variation = NB_VARIATION; -int nb_penalite = NB_PENALITE; -int nb_restituee = NB_RESTITUEE; -int nb_enchaine = NB_ENCH; - -#ifdef FLG_DEBUG -int nb_err = NB_ERR; -#if NB_DEBUG_C <= 0 -int nb_debug = NB_DEBUG; -#else -int nb_debug01 = NB_DEBUG01; -int nb_debug02 = NB_DEBUG02; -int nb_debug03 = NB_DEBUG03; -int nb_debug04 = NB_DEBUG04; -#endif /* NB_DEBUG_C <= 0 */ -int nb_call = NB_CALL; -#endif - -#if defined (FLG_DEBUG) || defined (FLG_CONTROLE_IMMEDIAT) -int nb_verif = NB_VERIF; -#endif /* FLG_DEBUG || FLG_CONTROLE_IMMEDIAT */ - -T_discord * une_verif(T_irdata *irdata, struct S_discord *(*proc)(T_irdata *irdata)) { -#ifdef FLG_MULTITHREAD - init_erreur(irdata); - if (setjmp(irdata->jmp_bloq) != 0) { - return irdata->discords; - } - (*proc)(irdata); - return irdata->discords; -#else - init_erreur(); - if (setjmp(jmp_bloq) != 0) { - return discords; - } - (*proc)(irdata); - return discords; -#endif /* FLG_MULTITHREAD */ -} - -struct S_discord * verif_saisie_cohe_primitive_isf(T_irdata *irdata, int appel) { -#ifdef FLG_MULTITHREAD - init_erreur(irdata); - if ((appel != 1) && (setjmp(irdata->jmp_bloq) != 0)) { - return irdata->discords; - } - verif_saisie_cohe_primitive_isf_raw(irdata); - return irdata->discords; -#else - init_erreur(); - if ((appel != 1) && (setjmp(jmp_bloq) != 0)) { - return discords; - } - verif_saisie_cohe_primitive_isf_raw(irdata); - return discords; -#endif /* FLG_MULTITHREAD */ -} - -T_discord * err_NEGATIF(T_irdata *irdata) { -#ifdef FLG_MULTITHREAD - init_erreur(irdata); - if (setjmp(irdata->jmp_bloq) != 0) { - return irdata->discords; - } - add_erreur(irdata, &erreur_A000, NULL); - return irdata->discords; -#else - init_erreur(); - if (setjmp(jmp_bloq) != 0) { - return discords; - } - add_erreur(irdata, &erreur_A000, NULL); - return discords; - -#endif /* FLG_MULTITHREAD */ -} - diff --git a/examples/dgfip_c/ml_primitif/c_driver_with_macro/var.h b/examples/dgfip_c/ml_primitif/c_driver_with_macro/var.h deleted file mode 100644 index 6337418d..00000000 --- a/examples/dgfip_c/ml_primitif/c_driver_with_macro/var.h +++ /dev/null @@ -1,49 +0,0 @@ -/****** LICENCE CECIL *****/ - -#ifndef _VAR_H_ -#define _VAR_H_ - -#include "mlang.h" -#include "compir.h" -#include "compir_desc.h" -#include "compir_desc_inv.h" -#include "irdata.h" - -extern int taille_saisie; -extern int taille_calculee; -extern int taille_base; -extern int taille_totale; - -extern int nb_contexte; -extern int nb_famille; -extern int nb_revenu; -extern int nb_revenu_correc; -extern int nb_variation; -extern int nb_penalite; -extern int nb_restituee; -extern int nb_enchaine; - -extern int color; -extern int typo; - -#ifdef FLG_DEBUG -extern int nb_err; -#if NB_DEBUG_C <= 0 -extern int nb_debug; -#else -extern int nb_debug01; -extern int nb_debug02; -extern int nb_debug03; -extern int nb_debug04; -#endif /* NB_DEBUG_C <= 0 */ -extern int nb_call; -#endif - -#if defined (FLG_DEBUG) || defined (FLG_CONTROLE_IMMEDIAT) -extern int nb_verif; -#endif /* FLG_DEBUG || FLG_CONTROLE_IMMEDIAT */ - -extern T_discord *une_verif _PROTS((T_irdata *irdata, struct S_discord *(*proc)(T_irdata *irdata))); - -#endif - diff --git a/makefiles/mlang.mk b/makefiles/mlang.mk index d38db657..a8de5428 100644 --- a/makefiles/mlang.mk +++ b/makefiles/mlang.mk @@ -20,7 +20,8 @@ ifeq ($(call is_in,),) $(call make_in,,$@) else opam install . --deps-only - git submodule update --init + git submodule init ir-calcul + git submodule update ir-calcul endif init: FORCE create-switch init-without-switch @@ -30,7 +31,7 @@ ifeq ($(call is_in,),) $(call make_in,,$@) else opam switch reinstall --deps-only - git submodule update + git submodule update ir-calcul endif ################################################## diff --git a/mlang-deps b/mlang-deps new file mode 160000 index 00000000..b76fbd82 --- /dev/null +++ b/mlang-deps @@ -0,0 +1 @@ +Subproject commit b76fbd8220f2d575a1d918d2199068ba5ee8203e