diff --git a/examples/dgfip_c/desc_static.h.inc b/examples/dgfip_c/desc_static.h.inc index 6f520cae6..49a556178 100644 --- a/examples/dgfip_c/desc_static.h.inc +++ b/examples/dgfip_c/desc_static.h.inc @@ -4,14 +4,6 @@ #include "conf.h" -struct S_desc_var -{ - char *nom; - int indice; - long type_donnee; - T_discord * (*verif)(T_irdata *); -}; - typedef struct S_desc_contexte { char *nom; @@ -56,7 +48,7 @@ typedef struct S_desc_revenu int rapcat; int sanction; int modcat; - T_desc_var *liee; + T_var_irdata liee; char *libelle; char *code; } T_desc_revenu; @@ -78,7 +70,7 @@ typedef struct S_desc_revenu_correc int rapcat; int sanction; int modcat; - T_desc_var *liee; + T_var_irdata liee; char *libelle; } T_desc_revenu_correc; @@ -131,7 +123,7 @@ typedef struct S_desc_debug int sanction; int modcat; int nat_code; - T_desc_var *liee; + T_var_irdata liee; #ifdef FLG_EXTRACTION int est_extraite; #endif /* FLG_EXTRACTION */ diff --git a/examples/dgfip_c/irdata.c b/examples/dgfip_c/irdata.c index 5756cf463..07d48ed37 100644 --- a/examples/dgfip_c/irdata.c +++ b/examples/dgfip_c/irdata.c @@ -6,6 +6,16 @@ #include #include "var.h" +struct S_desc_var +{ + char *nom; + int indice; + long type_donnee; + T_discord * (*verif)(T_irdata *); +}; + +typedef struct S_desc_var T_desc_var; + static bool alloc_tab(double **tab, char **def_tab, int taille) { if ((tab == NULL) || (def_tab == NULL)) { @@ -154,8 +164,9 @@ void IRDATA_reset_erreur(T_irdata *irdata) #endif /* FLG_MULTITHREAD */ } -T_discord * IRDATA_range(T_irdata *irdata, T_desc_var *desc, double valeur) +T_discord * IRDATA_range(T_irdata *irdata, T_var_irdata p_desc, double valeur) { + T_desc_var *desc = (T_desc_var *)p_desc; int indice = 0; T_discord *discord = NULL; if (valeur < 0) { @@ -181,8 +192,9 @@ T_discord * IRDATA_range(T_irdata *irdata, T_desc_var *desc, double valeur) return discord; } -void IRDATA_range_base(T_irdata *irdata, T_desc_var *desc, double valeur) +void IRDATA_range_base(T_irdata *irdata, T_var_irdata p_desc, double valeur) { + T_desc_var *desc = (T_desc_var *)p_desc; #ifdef FLG_COMPACT int indice = desc->indice; irdata->defs[indice] = 1; @@ -206,8 +218,9 @@ void IRDATA_range_base(T_irdata *irdata, T_desc_var *desc, double valeur) #endif /* FLG_COMPACT */ } -struct S_discord * IRDATA_range_tableau(T_irdata *irdata, T_desc_var *desc, int ind, double valeur) +struct S_discord * IRDATA_range_tableau(T_irdata *irdata, T_var_irdata p_desc, int ind, double valeur) { + T_desc_var *desc = (T_desc_var *)p_desc; int indice = 0; T_discord *discord = NULL; discord = (*desc->verif)(irdata); @@ -238,8 +251,9 @@ struct S_discord * IRDATA_range_tableau(T_irdata *irdata, T_desc_var *desc, int return discord; } -double * IRDATA_extrait_special(T_irdata *irdata, T_desc_var *desc) +double * IRDATA_extrait_special(T_irdata *irdata, T_var_irdata p_desc) { + T_desc_var *desc = (T_desc_var *)p_desc; double *res = NULL; #ifdef FLG_COMPACT int indice = desc->indice; @@ -264,8 +278,9 @@ double * IRDATA_extrait_special(T_irdata *irdata, T_desc_var *desc) return res; } -double * IRDATA_extrait_tableau(T_irdata *irdata, T_desc_var *desc, int ind) +double * IRDATA_extrait_tableau(T_irdata *irdata, T_var_irdata p_desc, int ind) { + T_desc_var *desc = (T_desc_var *)p_desc; double *res = NULL; #ifdef FLG_COMPACT int indice = desc->indice + ind; @@ -290,7 +305,7 @@ double * IRDATA_extrait_tableau(T_irdata *irdata, T_desc_var *desc, int ind) return res; } -static T_desc_var * cherche_desc_var(const char *nom, T_desc_var *table, int taille, int sup) +static T_var_irdata cherche_desc_var(const char *nom, T_var_irdata table, int taille, int sup) { T_desc_var *desc = NULL; int res = -1, inf = 0, millieu; @@ -302,12 +317,12 @@ static T_desc_var * cherche_desc_var(const char *nom, T_desc_var *table, int tai else if (res > 0) inf = millieu + 1; } if (res == 0) - return desc; + return (T_var_irdata)desc; else return NULL; } -T_desc_var * IRDATA_cherche_desc_var(const char *nom) +T_var_irdata IRDATA_cherche_desc_var(const char *nom) { static T_desc_var * desc[6] = { (T_desc_var *)desc_contexte, (T_desc_var *)desc_famille, (T_desc_var *)desc_revenu, @@ -321,7 +336,7 @@ T_desc_var * IRDATA_cherche_desc_var(const char *nom) int i = 0; for (i = 0; i < 6; ++i) { T_desc_var *res = cherche_desc_var(nom, desc[i], size[i], nb[i]); - if (res != NULL) return res; + if (res != NULL) return (T_var_irdata)res; } return NULL; } diff --git a/examples/dgfip_c/irdata.h b/examples/dgfip_c/irdata.h index 85217176c..e03f49168 100644 --- a/examples/dgfip_c/irdata.h +++ b/examples/dgfip_c/irdata.h @@ -24,9 +24,8 @@ #define DATE (DATE_JJMMAAAA|DATE_MMAAAA|DATE_AAAA|DATE_JJMM|DATE_MM) #define NUMERIQUE (ENTIER|REEL|REEL1|REEL2|REEL3) -#define T_var_irdata T_desc_var * +typedef void *T_var_irdata; -typedef struct S_desc_var T_desc_var; typedef struct S_irdata T_irdata; typedef struct S_discord T_discord; typedef struct S_erreur T_erreur; @@ -43,14 +42,14 @@ extern void IRDATA_recopie_irdata(T_irdata *src_irdata, T_irdata *dst_irdata); extern void IRDATA_reset_erreur(T_irdata *irdata); -extern T_discord * IRDATA_range(T_irdata *irdata, T_desc_var *desc, double valeur); -extern void IRDATA_range_base(T_irdata *irdata, T_desc_var *desc, double valeur); -struct S_discord *IRDATA_range_tableau(T_irdata *irdata, T_desc_var *desc, int ind, double valeur); +extern T_discord * IRDATA_range(T_irdata *irdata, T_var_irdata desc, double valeur); +extern void IRDATA_range_base(T_irdata *irdata, T_var_irdata desc, double valeur); +struct S_discord *IRDATA_range_tableau(T_irdata *irdata, T_var_irdata desc, int ind, double valeur); -extern double * IRDATA_extrait_special (T_irdata *irdata, T_desc_var *desc); -double * IRDATA_extrait_tableau(T_irdata *irdata, T_desc_var *desc, int ind); +extern double * IRDATA_extrait_special (T_irdata *irdata, T_var_irdata desc); +double * IRDATA_extrait_tableau(T_irdata *irdata, T_var_irdata desc, int ind); -extern T_desc_var * IRDATA_cherche_desc_var(const char *nom); +extern T_var_irdata IRDATA_cherche_desc_var(const char *nom); extern T_discord * err_NEGATIF(T_irdata *irdata); diff --git a/examples/dgfip_c/ml_primitif/stubs.c b/examples/dgfip_c/ml_primitif/stubs.c index fd3f57698..4d8759ecc 100644 --- a/examples/dgfip_c/ml_primitif/stubs.c +++ b/examples/dgfip_c/ml_primitif/stubs.c @@ -37,6 +37,18 @@ CAMLexport value caml_alloc_some(value v) extern T_desc_penalite desc_penalite[]; extern T_desc_debug desc_debug01[]; +struct S_desc_var +{ + char *nom; + int indice; + long type_donnee; + T_discord * (*verif)(T_irdata *); +}; + +typedef struct S_desc_var T_desc_var; + +#define T_var_irdata T_desc_var * + typedef void (*ench_fun)(T_irdata *); typedef struct ench_t {