diff --git a/.github/workflows/publish_doc.yml b/.github/workflows/publish_doc.yml
index 40702611c..293e3671f 100644
--- a/.github/workflows/publish_doc.yml
+++ b/.github/workflows/publish_doc.yml
@@ -1,10 +1,11 @@
name: Publish documentation on GitHub Pages
on:
- workflow_run:
- workflows: [binary-releases]
- types:
- - completed
+ push:
+ branches:
+ - master
+ - dev
+ - gen-doc # Temporary
jobs:
deploy:
@@ -33,7 +34,7 @@ jobs:
uses: ocaml/setup-ocaml@v2
with:
# Version of the OCaml compiler to initialise
- ocaml-compiler: 4.11.2
+ ocaml-compiler: 4.13.1
- name: Install dependencies
run: |
diff --git a/.gitignore b/.gitignore
index 19d1ee050..d76ff145f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,5 @@ doc.html
*~
/_opam
/Makefile.config
+.interpreter_progress
+.mlang.hash
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 000000000..8c671d6cb
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,120 @@
+stages:
+ - build
+ - deploy
+ - release
+
+create-tag:
+ stage: release
+ image: gitlab.adullact.net:4567/dgfip/impots-nationaux-revenu-patrimoine-particuliers/mlang:4.14
+ needs: ["build-static"]
+ rules:
+ - if: '$CI_COMMIT_BRANCH == "master"'
+
+ script:
+ - git config --global --add safe.directory '*'
+ - git fetch --prune --prune-tags origin
+ - git fetch --tags
+ - echo "Latest tag:"
+ - git tag --sort=-creatordate | sed -n '1p'
+ - LATEST_TAG=$(git tag --sort=-creatordate | sed -n '1p')
+ - NEXT_TAG=$((LATEST_TAG + 1))
+ - echo "Creating tag $NEXT_TAG"
+ - curl --request POST --header "PRIVATE-TOKEN:$GITLAB_CI_TOKEN" "$CI_API_V4_URL/projects/$CI_PROJECT_ID/repository/tags?tag_name=$NEXT_TAG&ref=$CI_COMMIT_SHA" --fail
+ - >
+ curl --header "JOB-TOKEN: $CI_JOB_TOKEN"
+ --upload-file mlang-static.exe
+ "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/mlang/${NEXT_TAG}/mlang-static-${NEXT_TAG}.exe" --fail
+ - >
+ curl --request POST
+ --header "PRIVATE-TOKEN: $GITLAB_CI_TOKEN"
+ --header "Content-Type: application/json"
+ --data "{
+ \"name\": \"Release $NEXT_TAG\",
+ \"tag_name\": \"$NEXT_TAG\",
+ \"description\": \"Automated release created via GitLab CI.\",
+ \"assets\": {
+ \"links\": [{
+ \"name\": \"mlang-static.exe\",
+ \"url\": \"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/mlang-static/${NEXT_TAG}/mlang-static-${NEXT_TAG}.exe\"
+ }]
+ }
+ }"
+ "$CI_API_V4_URL/projects/$CI_PROJECT_ID/releases" --fail
+
+make-doc:
+ stage: deploy
+
+ needs: ["build"]
+
+ image: gitlab.adullact.net:4567/dgfip/impots-nationaux-revenu-patrimoine-particuliers/mlang:4.14
+
+ rules:
+ - if: '$CI_COMMIT_BRANCH == "dev"'
+
+ artifacts:
+ paths:
+ - examples/doc
+
+ script:
+ - git config --global --add safe.directory '*'
+ - make doc-deps
+ - make doc
+
+build-static:
+ stage: build
+
+ image: ocaml/opam:alpine-ocaml-4.14
+ variables:
+ USER: root
+
+ artifacts:
+ paths:
+ - mlang-static.exe
+ expire_in: 1 day
+
+ rules:
+ - if: '$CI_COMMIT_BRANCH == "dev" || $CI_COMMIT_BRANCH == "master" || $CI_COMMIT_MESSAGE =~ /\[build-static\]/'
+
+ script:
+ - sudo apk add --no-cache m4 perl python3 clang git build-base lzip gmp-dev gmp-static mpfr-dev libev-dev openssl-dev openssl-libs-static
+ # Bypass Git's dubious ownership security check for the CI workspace, or else opam will fail
+ - git config --global --add safe.directory '*'
+ - opam update
+ - opam install . --deps-only -y
+ - opam exec -- dune build --profile=static-release src/main_static.exe
+ - cp _build/default/src/main_static.exe mlang-static.exe
+
+build:
+ stage: build
+
+ variables:
+ OCAML_COMPILER: "4.14.2"
+# ARTIFACTS: "artifacts/$OCAML_COMPILER"
+
+ FF_USE_FASTZIP: "true"
+ # A workaround against a bug in gitlab-runner's default
+ # unzipping implementation, which partially breaks caching for the dune _build cache.
+ # See https://gitlab.com/gitlab-org/gitlab-runner/-/issues/27496 for more details.
+
+ rules:
+ - exists:
+ - dune-project
+
+ image: gitlab.adullact.net:4567/dgfip/impots-nationaux-revenu-patrimoine-particuliers/mlang:4.14
+
+ artifacts:
+ paths:
+ - src
+ when: on_success
+
+ script:
+ # Initialisation
+ - git config --global --add safe.directory $CI_PROJECT_DIR
+ - git submodule init ir-calcul
+ - git submodule update ir-calcul
+ # Installation des dépendances opam
+ # Verification de l'indentation
+ - opam exec -- dune build @fmt
+ # Compilation
+ - make build
+ - make ci_tests
diff --git a/Dockerfile.ci b/Dockerfile.ci
new file mode 100644
index 000000000..6da14b796
--- /dev/null
+++ b/Dockerfile.ci
@@ -0,0 +1,24 @@
+FROM ocaml/opam:alpine-ocaml-4.14
+
+USER root
+RUN apk add --no-cache \
+ m4 \
+ perl \
+ python3 \
+ clang \
+ git \
+ build-base \
+ lzip \
+ gmp-dev \
+ mpfr-dev
+
+USER opam
+
+WORKDIR /mlang
+
+COPY --chown=opam:opam *.opam ./
+COPY --chown=opam:opam dune-project ./
+
+RUN opam update && \
+ opam install . --deps-only -y && \
+ opam clean -a -c --logs
diff --git a/Dockerfile.static b/Dockerfile.static
new file mode 100644
index 000000000..120b92b18
--- /dev/null
+++ b/Dockerfile.static
@@ -0,0 +1,35 @@
+FROM ocaml/opam:alpine-ocaml-4.14
+
+USER root
+RUN apk add --no-cache \
+ m4 \
+ perl \
+ python3 \
+ clang \
+ git \
+ build-base \
+ lzip \
+ gmp-dev \
+ gmp-static \
+ mpfr-dev \
+ libev-dev \
+ openssl-dev \
+ openssl-libs-static
+
+# Give ownership to opam user
+RUN mkdir /mlang && chown opam:opam /mlang
+
+USER opam
+
+WORKDIR /mlang
+
+COPY --chown=opam:opam *.opam ./
+COPY --chown=opam:opam dune-project ./
+
+RUN opam update && \
+ opam install . --deps-only -y && \
+ opam clean -a -c --logs
+
+COPY --chown=opam:opam . .
+
+RUN opam exec -- dune build --profile=release src/main.exe
diff --git a/LICENCE.txt b/LICENCE.txt
new file mode 100644
index 000000000..ddf439908
--- /dev/null
+++ b/LICENCE.txt
@@ -0,0 +1,521 @@
+
+CONTRAT DE LICENCE DE LOGICIEL LIBRE CeCILL-C
+
+
+ Avertissement
+
+Ce contrat est une licence de logiciel libre issue d'une concertation
+entre ses auteurs afin que le respect de deux grands principes préside à
+sa rédaction:
+
+ * d'une part, le respect des principes de diffusion des logiciels
+ libres: accès au code source, droits étendus conférés aux
+ utilisateurs,
+ * d'autre part, la désignation d'un droit applicable, le droit
+ français, auquel elle est conforme, tant au regard du droit de la
+ responsabilité civile que du droit de la propriété intellectuelle
+ et de la protection qu'il offre aux auteurs et titulaires des
+ droits patrimoniaux sur un logiciel.
+
+Les auteurs de la licence CeCILL-C (pour Ce[a] C[nrs] I[nria] L[ogiciel]
+L[ibre]) sont:
+
+Commissariat à l'Energie Atomique - CEA, établissement public de
+recherche à caractère scientifique, technique et industriel, dont le
+siège est situé 25 rue Leblanc, immeuble Le Ponant D, 75015 Paris.
+
+Centre National de la Recherche Scientifique - CNRS, établissement
+public à caractère scientifique et technologique, dont le siège est
+situé 3 rue Michel-Ange, 75794 Paris cedex 16.
+
+Institut National de Recherche en Informatique et en Automatique -
+INRIA, établissement public à caractère scientifique et technologique,
+dont le siège est situé Domaine de Voluceau, Rocquencourt, BP 105, 78153
+Le Chesnay cedex.
+
+
+ Préambule
+
+Ce contrat est une licence de logiciel libre dont l'objectif est de
+conférer aux utilisateurs la liberté de modifier et de réutiliser le
+logiciel régi par cette licence.
+
+L'exercice de cette liberté est assorti d'une obligation de remettre à
+la disposition de la communauté les modifications apportées au code
+source du logiciel afin de contribuer à son évolution.
+
+L'accessibilité au code source et les droits de copie, de modification
+et de redistribution qui découlent de ce contrat ont pour contrepartie
+de n'offrir aux utilisateurs qu'une garantie limitée et de ne faire
+peser sur l'auteur du logiciel, le titulaire des droits patrimoniaux et
+les concédants successifs qu'une responsabilité restreinte.
+
+A cet égard l'attention de l'utilisateur est attirée sur les risques
+associés au chargement, à l'utilisation, à la modification et/ou au
+développement et à la reproduction du logiciel par l'utilisateur étant
+donné sa spécificité de logiciel libre, qui peut le rendre complexe à
+manipuler et qui le réserve donc à des développeurs ou des
+professionnels avertis possédant des connaissances informatiques
+approfondies. Les utilisateurs sont donc invités à charger et tester
+l'adéquation du logiciel à leurs besoins dans des conditions permettant
+d'assurer la sécurité de leurs systèmes et/ou de leurs données et, plus
+généralement, à l'utiliser et l'exploiter dans les mêmes conditions de
+sécurité. Ce contrat peut être reproduit et diffusé librement, sous
+réserve de le conserver en l'état, sans ajout ni suppression de clauses.
+
+Ce contrat est susceptible de s'appliquer à tout logiciel dont le
+titulaire des droits patrimoniaux décide de soumettre l'exploitation aux
+dispositions qu'il contient.
+
+
+ Article 1 - DEFINITIONS
+
+Dans ce contrat, les termes suivants, lorsqu'ils seront écrits avec une
+lettre capitale, auront la signification suivante:
+
+Contrat: désigne le présent contrat de licence, ses éventuelles versions
+postérieures et annexes.
+
+Logiciel: désigne le logiciel sous sa forme de Code Objet et/ou de Code
+Source et le cas échéant sa documentation, dans leur état au moment de
+l'acceptation du Contrat par le Licencié.
+
+Logiciel Initial: désigne le Logiciel sous sa forme de Code Source et
+éventuellement de Code Objet et le cas échéant sa documentation, dans
+leur état au moment de leur première diffusion sous les termes du Contrat.
+
+Logiciel Modifié: désigne le Logiciel modifié par au moins une
+Contribution Intégrée.
+
+Code Source: désigne l'ensemble des instructions et des lignes de
+programme du Logiciel et auquel l'accès est nécessaire en vue de
+modifier le Logiciel.
+
+Code Objet: désigne les fichiers binaires issus de la compilation du
+Code Source.
+
+Titulaire: désigne le ou les détenteurs des droits patrimoniaux d'auteur
+sur le Logiciel Initial.
+
+Licencié: désigne le ou les utilisateurs du Logiciel ayant accepté le
+Contrat.
+
+Contributeur: désigne le Licencié auteur d'au moins une Contribution
+Intégrée.
+
+Concédant: désigne le Titulaire ou toute personne physique ou morale
+distribuant le Logiciel sous le Contrat.
+
+Contribution Intégrée: désigne l'ensemble des modifications,
+corrections, traductions, adaptations et/ou nouvelles fonctionnalités
+intégrées dans le Code Source par tout Contributeur.
+
+Module Lié: désigne un ensemble de fichiers sources y compris leur
+documentation qui, sans modification du Code Source, permet de réaliser
+des fonctionnalités ou services supplémentaires à ceux fournis par le
+Logiciel.
+
+Logiciel Dérivé: désigne toute combinaison du Logiciel, modifié ou non,
+et d'un Module Lié.
+
+Parties: désigne collectivement le Licencié et le Concédant.
+
+Ces termes s'entendent au singulier comme au pluriel.
+
+
+ Article 2 - OBJET
+
+Le Contrat a pour objet la concession par le Concédant au Licencié d'une
+licence non exclusive, cessible et mondiale du Logiciel telle que
+définie ci-après à l'article 5 pour toute la durée de protection des droits
+portant sur ce Logiciel.
+
+
+ Article 3 - ACCEPTATION
+
+3.1 L'acceptation par le Licencié des termes du Contrat est réputée
+acquise du fait du premier des faits suivants:
+
+ * (i) le chargement du Logiciel par tout moyen notamment par
+ téléchargement à partir d'un serveur distant ou par chargement à
+ partir d'un support physique;
+ * (ii) le premier exercice par le Licencié de l'un quelconque des
+ droits concédés par le Contrat.
+
+3.2 Un exemplaire du Contrat, contenant notamment un avertissement
+relatif aux spécificités du Logiciel, à la restriction de garantie et à
+la limitation à un usage par des utilisateurs expérimentés a été mis à
+disposition du Licencié préalablement à son acceptation telle que
+définie à l'article 3.1 ci dessus et le Licencié reconnaît en avoir pris
+connaissance.
+
+
+ Article 4 - ENTREE EN VIGUEUR ET DUREE
+
+
+ 4.1 ENTREE EN VIGUEUR
+
+Le Contrat entre en vigueur à la date de son acceptation par le Licencié
+telle que définie en 3.1.
+
+
+ 4.2 DUREE
+
+Le Contrat produira ses effets pendant toute la durée légale de
+protection des droits patrimoniaux portant sur le Logiciel.
+
+
+ Article 5 - ETENDUE DES DROITS CONCEDES
+
+Le Concédant concède au Licencié, qui accepte, les droits suivants sur
+le Logiciel pour toutes destinations et pour la durée du Contrat dans
+les conditions ci-après détaillées.
+
+Par ailleurs, si le Concédant détient ou venait à détenir un ou
+plusieurs brevets d'invention protégeant tout ou partie des
+fonctionnalités du Logiciel ou de ses composants, il s'engage à ne pas
+opposer les éventuels droits conférés par ces brevets aux Licenciés
+successifs qui utiliseraient, exploiteraient ou modifieraient le
+Logiciel. En cas de cession de ces brevets, le Concédant s'engage à
+faire reprendre les obligations du présent alinéa aux cessionnaires.
+
+
+ 5.1 DROIT D'UTILISATION
+
+Le Licencié est autorisé à utiliser le Logiciel, sans restriction quant
+aux domaines d'application, étant ci-après précisé que cela comporte:
+
+ 1. la reproduction permanente ou provisoire du Logiciel en tout ou
+ partie par tout moyen et sous toute forme.
+
+ 2. le chargement, l'affichage, l'exécution, ou le stockage du
+ Logiciel sur tout support.
+
+ 3. la possibilité d'en observer, d'en étudier, ou d'en tester le
+ fonctionnement afin de déterminer les idées et principes qui sont
+ à la base de n'importe quel élément de ce Logiciel; et ceci,
+ lorsque le Licencié effectue toute opération de chargement,
+ d'affichage, d'exécution, de transmission ou de stockage du
+ Logiciel qu'il est en droit d'effectuer en vertu du Contrat.
+
+
+ 5.2 DROIT DE MODIFICATION
+
+Le droit de modification comporte le droit de traduire, d'adapter,
+d'arranger ou d'apporter toute autre modification au Logiciel et le
+droit de reproduire le logiciel en résultant. Il comprend en particulier
+le droit de créer un Logiciel Dérivé.
+
+Le Licencié est autorisé à apporter toute modification au Logiciel sous
+réserve de mentionner, de façon explicite, son nom en tant qu'auteur de
+cette modification et la date de création de celle-ci.
+
+
+ 5.3 DROIT DE DISTRIBUTION
+
+Le droit de distribution comporte notamment le droit de diffuser, de
+transmettre et de communiquer le Logiciel au public sur tout support et
+par tout moyen ainsi que le droit de mettre sur le marché à titre
+onéreux ou gratuit, un ou des exemplaires du Logiciel par tout procédé.
+
+Le Licencié est autorisé à distribuer des copies du Logiciel, modifié ou
+non, à des tiers dans les conditions ci-après détaillées.
+
+
+ 5.3.1 DISTRIBUTION DU LOGICIEL SANS MODIFICATION
+
+Le Licencié est autorisé à distribuer des copies conformes du Logiciel,
+sous forme de Code Source ou de Code Objet, à condition que cette
+distribution respecte les dispositions du Contrat dans leur totalité et
+soit accompagnée:
+
+ 1. d'un exemplaire du Contrat,
+
+ 2. d'un avertissement relatif à la restriction de garantie et de
+ responsabilité du Concédant telle que prévue aux articles 8
+ et 9,
+
+et que, dans le cas où seul le Code Objet du Logiciel est redistribué,
+le Licencié permette un accès effectif au Code Source complet du
+Logiciel pendant au moins toute la durée de sa distribution du Logiciel,
+étant entendu que le coût additionnel d'acquisition du Code Source ne
+devra pas excéder le simple coût de transfert des données.
+
+
+ 5.3.2 DISTRIBUTION DU LOGICIEL MODIFIE
+
+Lorsque le Licencié apporte une Contribution Intégrée au Logiciel, les
+conditions de distribution du Logiciel Modifié en résultant sont alors
+soumises à l'intégralité des dispositions du Contrat.
+
+Le Licencié est autorisé à distribuer le Logiciel Modifié sous forme de
+code source ou de code objet, à condition que cette distribution
+respecte les dispositions du Contrat dans leur totalité et soit
+accompagnée:
+
+ 1. d'un exemplaire du Contrat,
+
+ 2. d'un avertissement relatif à la restriction de garantie et de
+ responsabilité du Concédant telle que prévue aux articles 8
+ et 9,
+
+et que, dans le cas où seul le code objet du Logiciel Modifié est
+redistribué, le Licencié permette un accès effectif à son code source
+complet pendant au moins toute la durée de sa distribution du Logiciel
+Modifié, étant entendu que le coût additionnel d'acquisition du code
+source ne devra pas excéder le simple coût de transfert des données.
+
+
+ 5.3.3 DISTRIBUTION DU LOGICIEL DERIVE
+
+Lorsque le Licencié crée un Logiciel Dérivé, ce Logiciel Dérivé peut
+être distribué sous un contrat de licence autre que le présent Contrat à
+condition de respecter les obligations de mention des droits sur le
+Logiciel telles que définies à l'article 6.4. Dans le cas où la création du
+Logiciel Dérivé a nécessité une modification du Code Source le licencié
+s'engage à ce que:
+
+ 1. le Logiciel Modifié correspondant à cette modification soit régi
+ par le présent Contrat,
+ 2. les Contributions Intégrées dont le Logiciel Modifié résulte
+ soient clairement identifiées et documentées,
+ 3. le Licencié permette un accès effectif au code source du Logiciel
+ Modifié, pendant au moins toute la durée de la distribution du
+ Logiciel Dérivé, de telle sorte que ces modifications puissent
+ être reprises dans une version ultérieure du Logiciel, étant
+ entendu que le coût additionnel d'acquisition du code source du
+ Logiciel Modifié ne devra pas excéder le simple coût du transfert
+ des données.
+
+
+ 5.3.4 COMPATIBILITE AVEC LA LICENCE CeCILL
+
+Lorsqu'un Logiciel Modifié contient une Contribution Intégrée soumise au
+contrat de licence CeCILL, ou lorsqu'un Logiciel Dérivé contient un
+Module Lié soumis au contrat de licence CeCILL, les stipulations prévues
+au troisième item de l'article 6.4 sont facultatives.
+
+
+ Article 6 - PROPRIETE INTELLECTUELLE
+
+
+ 6.1 SUR LE LOGICIEL INITIAL
+
+Le Titulaire est détenteur des droits patrimoniaux sur le Logiciel
+Initial. Toute utilisation du Logiciel Initial est soumise au respect
+des conditions dans lesquelles le Titulaire a choisi de diffuser son
+oeuvre et nul autre n'a la faculté de modifier les conditions de
+diffusion de ce Logiciel Initial.
+
+Le Titulaire s'engage à ce que le Logiciel Initial reste au moins régi
+par le Contrat et ce, pour la durée visée à l'article 4.2.
+
+
+ 6.2 SUR LES CONTRIBUTIONS INTEGREES
+
+Le Licencié qui a développé une Contribution Intégrée est titulaire sur
+celle-ci des droits de propriété intellectuelle dans les conditions
+définies par la législation applicable.
+
+
+ 6.3 SUR LES MODULES LIES
+
+Le Licencié qui a développé un Module Lié est titulaire sur celui-ci des
+droits de propriété intellectuelle dans les conditions définies par la
+législation applicable et reste libre du choix du contrat régissant sa
+diffusion dans les conditions définies à l'article 5.3.3.
+
+
+ 6.4 MENTIONS DES DROITS
+
+Le Licencié s'engage expressément:
+
+ 1. à ne pas supprimer ou modifier de quelque manière que ce soit les
+ mentions de propriété intellectuelle apposées sur le Logiciel;
+
+ 2. à reproduire à l'identique lesdites mentions de propriété
+ intellectuelle sur les copies du Logiciel modifié ou non;
+
+ 3. à faire en sorte que l'utilisation du Logiciel, ses mentions de
+ propriété intellectuelle et le fait qu'il est régi par le Contrat
+ soient indiqués dans un texte facilement accessible notamment
+ depuis l'interface de tout Logiciel Dérivé.
+
+Le Licencié s'engage à ne pas porter atteinte, directement ou
+indirectement, aux droits de propriété intellectuelle du Titulaire et/ou
+des Contributeurs sur le Logiciel et à prendre, le cas échéant, à
+l'égard de son personnel toutes les mesures nécessaires pour assurer le
+respect des dits droits de propriété intellectuelle du Titulaire et/ou
+des Contributeurs.
+
+
+ Article 7 - SERVICES ASSOCIES
+
+7.1 Le Contrat n'oblige en aucun cas le Concédant à la réalisation de
+prestations d'assistance technique ou de maintenance du Logiciel.
+
+Cependant le Concédant reste libre de proposer ce type de services. Les
+termes et conditions d'une telle assistance technique et/ou d'une telle
+maintenance seront alors déterminés dans un acte séparé. Ces actes de
+maintenance et/ou assistance technique n'engageront que la seule
+responsabilité du Concédant qui les propose.
+
+7.2 De même, tout Concédant est libre de proposer, sous sa seule
+responsabilité, à ses licenciés une garantie, qui n'engagera que lui,
+lors de la redistribution du Logiciel et/ou du Logiciel Modifié et ce,
+dans les conditions qu'il souhaite. Cette garantie et les modalités
+financières de son application feront l'objet d'un acte séparé entre le
+Concédant et le Licencié.
+
+
+ Article 8 - RESPONSABILITE
+
+8.1 Sous réserve des dispositions de l'article 8.2, le Licencié a la
+faculté, sous réserve de prouver la faute du Concédant concerné, de
+solliciter la réparation du préjudice direct qu'il subirait du fait du
+Logiciel et dont il apportera la preuve.
+
+8.2 La responsabilité du Concédant est limitée aux engagements pris en
+application du Contrat et ne saurait être engagée en raison notamment:
+(i) des dommages dus à l'inexécution, totale ou partielle, de ses
+obligations par le Licencié, (ii) des dommages directs ou indirects
+découlant de l'utilisation ou des performances du Logiciel subis par le
+Licencié et (iii) plus généralement d'un quelconque dommage indirect. En
+particulier, les Parties conviennent expressément que tout préjudice
+financier ou commercial (par exemple perte de données, perte de
+bénéfices, perte d'exploitation, perte de clientèle ou de commandes,
+manque à gagner, trouble commercial quelconque) ou toute action dirigée
+contre le Licencié par un tiers, constitue un dommage indirect et
+n'ouvre pas droit à réparation par le Concédant.
+
+
+ Article 9 - GARANTIE
+
+9.1 Le Licencié reconnaît que l'état actuel des connaissances
+scientifiques et techniques au moment de la mise en circulation du
+Logiciel ne permet pas d'en tester et d'en vérifier toutes les
+utilisations ni de détecter l'existence d'éventuels défauts. L'attention
+du Licencié a été attirée sur ce point sur les risques associés au
+chargement, à l'utilisation, la modification et/ou au développement et à
+la reproduction du Logiciel qui sont réservés à des utilisateurs avertis.
+
+Il relève de la responsabilité du Licencié de contrôler, par tous
+moyens, l'adéquation du produit à ses besoins, son bon fonctionnement et
+de s'assurer qu'il ne causera pas de dommages aux personnes et aux biens.
+
+9.2 Le Concédant déclare de bonne foi être en droit de concéder
+l'ensemble des droits attachés au Logiciel (comprenant notamment les
+droits visés à l'article 5).
+
+9.3 Le Licencié reconnaît que le Logiciel est fourni "en l'état" par le
+Concédant sans autre garantie, expresse ou tacite, que celle prévue à
+l'article 9.2 et notamment sans aucune garantie sur sa valeur commerciale,
+son caractère sécurisé, innovant ou pertinent.
+
+En particulier, le Concédant ne garantit pas que le Logiciel est exempt
+d'erreur, qu'il fonctionnera sans interruption, qu'il sera compatible
+avec l'équipement du Licencié et sa configuration logicielle ni qu'il
+remplira les besoins du Licencié.
+
+9.4 Le Concédant ne garantit pas, de manière expresse ou tacite, que le
+Logiciel ne porte pas atteinte à un quelconque droit de propriété
+intellectuelle d'un tiers portant sur un brevet, un logiciel ou sur tout
+autre droit de propriété. Ainsi, le Concédant exclut toute garantie au
+profit du Licencié contre les actions en contrefaçon qui pourraient être
+diligentées au titre de l'utilisation, de la modification, et de la
+redistribution du Logiciel. Néanmoins, si de telles actions sont
+exercées contre le Licencié, le Concédant lui apportera son aide
+technique et juridique pour sa défense. Cette aide technique et
+juridique est déterminée au cas par cas entre le Concédant concerné et
+le Licencié dans le cadre d'un protocole d'accord. Le Concédant dégage
+toute responsabilité quant à l'utilisation de la dénomination du
+Logiciel par le Licencié. Aucune garantie n'est apportée quant à
+l'existence de droits antérieurs sur le nom du Logiciel et sur
+l'existence d'une marque.
+
+
+ Article 10 - RESILIATION
+
+10.1 En cas de manquement par le Licencié aux obligations mises à sa
+charge par le Contrat, le Concédant pourra résilier de plein droit le
+Contrat trente (30) jours après notification adressée au Licencié et
+restée sans effet.
+
+10.2 Le Licencié dont le Contrat est résilié n'est plus autorisé à
+utiliser, modifier ou distribuer le Logiciel. Cependant, toutes les
+licences qu'il aura concédées antérieurement à la résiliation du Contrat
+resteront valides sous réserve qu'elles aient été effectuées en
+conformité avec le Contrat.
+
+
+ Article 11 - DISPOSITIONS DIVERSES
+
+
+ 11.1 CAUSE EXTERIEURE
+
+Aucune des Parties ne sera responsable d'un retard ou d'une défaillance
+d'exécution du Contrat qui serait dû à un cas de force majeure, un cas
+fortuit ou une cause extérieure, telle que, notamment, le mauvais
+fonctionnement ou les interruptions du réseau électrique ou de
+télécommunication, la paralysie du réseau liée à une attaque
+informatique, l'intervention des autorités gouvernementales, les
+catastrophes naturelles, les dégâts des eaux, les tremblements de terre,
+le feu, les explosions, les grèves et les conflits sociaux, l'état de
+guerre...
+
+11.2 Le fait, par l'une ou l'autre des Parties, d'omettre en une ou
+plusieurs occasions de se prévaloir d'une ou plusieurs dispositions du
+Contrat, ne pourra en aucun cas impliquer renonciation par la Partie
+intéressée à s'en prévaloir ultérieurement.
+
+11.3 Le Contrat annule et remplace toute convention antérieure, écrite
+ou orale, entre les Parties sur le même objet et constitue l'accord
+entier entre les Parties sur cet objet. Aucune addition ou modification
+aux termes du Contrat n'aura d'effet à l'égard des Parties à moins
+d'être faite par écrit et signée par leurs représentants dûment habilités.
+
+11.4 Dans l'hypothèse où une ou plusieurs des dispositions du Contrat
+s'avèrerait contraire à une loi ou à un texte applicable, existants ou
+futurs, cette loi ou ce texte prévaudrait, et les Parties feraient les
+amendements nécessaires pour se conformer à cette loi ou à ce texte.
+Toutes les autres dispositions resteront en vigueur. De même, la
+nullité, pour quelque raison que ce soit, d'une des dispositions du
+Contrat ne saurait entraîner la nullité de l'ensemble du Contrat.
+
+
+ 11.5 LANGUE
+
+Le Contrat est rédigé en langue française et en langue anglaise, ces
+deux versions faisant également foi.
+
+
+ Article 12 - NOUVELLES VERSIONS DU CONTRAT
+
+12.1 Toute personne est autorisée à copier et distribuer des copies de
+ce Contrat.
+
+12.2 Afin d'en préserver la cohérence, le texte du Contrat est protégé
+et ne peut être modifié que par les auteurs de la licence, lesquels se
+réservent le droit de publier périodiquement des mises à jour ou de
+nouvelles versions du Contrat, qui posséderont chacune un numéro
+distinct. Ces versions ultérieures seront susceptibles de prendre en
+compte de nouvelles problématiques rencontrées par les logiciels libres.
+
+12.3 Tout Logiciel diffusé sous une version donnée du Contrat ne pourra
+faire l'objet d'une diffusion ultérieure que sous la même version du
+Contrat ou une version postérieure.
+
+
+ Article 13 - LOI APPLICABLE ET COMPETENCE TERRITORIALE
+
+13.1 Le Contrat est régi par la loi française. Les Parties conviennent
+de tenter de régler à l'amiable les différends ou litiges qui
+viendraient à se produire par suite ou à l'occasion du Contrat.
+
+13.2 A défaut d'accord amiable dans un délai de deux (2) mois à compter
+de leur survenance et sauf situation relevant d'une procédure d'urgence,
+les différends ou litiges seront portés par la Partie la plus diligente
+devant les Tribunaux compétents de Paris.
+
+
+Version 1.0 du 2006-09-05.
diff --git a/LICENSE.txt b/LICENSE.txt
deleted file mode 100644
index c3f5b52d3..000000000
--- a/LICENSE.txt
+++ /dev/null
@@ -1,674 +0,0 @@
-GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
-Copyright (C) 2007 Free Software Foundation, Inc.
-Everyone is permitted to copy and distribute verbatim copies
-of this license document, but changing it is not allowed.
-
- Preamble
-
-The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
-The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
-When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
-To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
-For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
-Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
-For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
-Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
-Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
-The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
-0. Definitions.
-
-"This License" refers to version 3 of the GNU General Public License.
-
-"Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
-"The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
-To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
-A "covered work" means either the unmodified Program or a work based
-on the Program.
-
-To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
-To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
-An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
-1. Source Code.
-
-The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
-A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
-The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
-The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
-The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
-The Corresponding Source for a work in source code form is that
-same work.
-
-2. Basic Permissions.
-
-All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
-You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
-Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
-3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
-No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
-When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
-4. Conveying Verbatim Copies.
-
-You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
-You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
-5. Conveying Modified Source Versions.
-
-You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
-a) The work must carry prominent notices stating that you modified
-it, and giving a relevant date.
-
-b) The work must carry prominent notices stating that it is
-released under this License and any conditions added under section
-7. This requirement modifies the requirement in section 4 to
-"keep intact all notices".
-
-c) You must license the entire work, as a whole, under this
-License to anyone who comes into possession of a copy. This
-License will therefore apply, along with any applicable section 7
-additional terms, to the whole of the work, and all its parts,
-regardless of how they are packaged. This License gives no
-permission to license the work in any other way, but it does not
-invalidate such permission if you have separately received it.
-
-d) If the work has interactive user interfaces, each must display
-Appropriate Legal Notices; however, if the Program has interactive
-interfaces that do not display Appropriate Legal Notices, your
-work need not make them do so.
-
-A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
-6. Conveying Non-Source Forms.
-
-You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
-a) Convey the object code in, or embodied in, a physical product
-(including a physical distribution medium), accompanied by the
-Corresponding Source fixed on a durable physical medium
-customarily used for software interchange.
-
-b) Convey the object code in, or embodied in, a physical product
-(including a physical distribution medium), accompanied by a
-written offer, valid for at least three years and valid for as
-long as you offer spare parts or customer support for that product
-model, to give anyone who possesses the object code either (1) a
-copy of the Corresponding Source for all the software in the
-product that is covered by this License, on a durable physical
-medium customarily used for software interchange, for a price no
-more than your reasonable cost of physically performing this
-conveying of source, or (2) access to copy the
-Corresponding Source from a network server at no charge.
-
-c) Convey individual copies of the object code with a copy of the
-written offer to provide the Corresponding Source. This
-alternative is allowed only occasionally and noncommercially, and
-only if you received the object code with such an offer, in accord
-with subsection 6b.
-
-d) Convey the object code by offering access from a designated
-place (gratis or for a charge), and offer equivalent access to the
-Corresponding Source in the same way through the same place at no
-further charge. You need not require recipients to copy the
-Corresponding Source along with the object code. If the place to
-copy the object code is a network server, the Corresponding Source
-may be on a different server (operated by you or a third party)
-that supports equivalent copying facilities, provided you maintain
-clear directions next to the object code saying where to find the
-Corresponding Source. Regardless of what server hosts the
-Corresponding Source, you remain obligated to ensure that it is
-available for as long as needed to satisfy these requirements.
-
-e) Convey the object code using peer-to-peer transmission, provided
-you inform other peers where the object code and Corresponding
-Source of the work are being offered to the general public at no
-charge under subsection 6d.
-
-A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
-A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
-"Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
-If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
-The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
-Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
-7. Additional Terms.
-
-"Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
-When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
-Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
-a) Disclaiming warranty or limiting liability differently from the
-terms of sections 15 and 16 of this License; or
-
-b) Requiring preservation of specified reasonable legal notices or
-author attributions in that material or in the Appropriate Legal
-Notices displayed by works containing it; or
-
-c) Prohibiting misrepresentation of the origin of that material, or
-requiring that modified versions of such material be marked in
-reasonable ways as different from the original version; or
-
-d) Limiting the use for publicity purposes of names of licensors or
-authors of the material; or
-
-e) Declining to grant rights under trademark law for use of some
-trade names, trademarks, or service marks; or
-
-f) Requiring indemnification of licensors and authors of that
-material by anyone who conveys the material (or modified versions of
-it) with contractual assumptions of liability to the recipient, for
-any liability that these contractual assumptions directly impose on
-those licensors and authors.
-
-All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
-If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
-Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
-8. Termination.
-
-You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
-However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
-Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
-Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
-9. Acceptance Not Required for Having Copies.
-
-You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
-10. Automatic Licensing of Downstream Recipients.
-
-Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
-An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
-You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
-11. Patents.
-
-A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
-A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
-Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
-In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
-If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
-If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
-A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
-Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
-12. No Surrender of Others' Freedom.
-
-If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
-13. Use with the GNU Affero General Public License.
-
-Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
-14. Revised Versions of this License.
-
-The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
-If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
-Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
-15. Disclaimer of Warranty.
-
-THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-16. Limitation of Liability.
-
-IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
-17. Interpretation of Sections 15 and 16.
-
-If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
-How to Apply These Terms to Your New Programs
-
-If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
-Copyright (C)
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- Copyright (C)
-This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-This is free software, and you are welcome to redistribute it
-under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
-You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-.
-
-The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-.
diff --git a/LISEZMOI.md b/LISEZMOI.md
new file mode 100644
index 000000000..987d142b1
--- /dev/null
+++ b/LISEZMOI.md
@@ -0,0 +1,181 @@
+# Note importante
+
+Le compilateur MLang est désormais hébergé sur la [forge Adullact](https://gitlab.adullact.net/dgfip/impots-nationaux-revenu-patrimoine-particuliers/Mlang).
+
+# Le compilateur Mlang
+
+
+[](https://mlanguage.github.io/mlang/mlang/index.html)
+
+Le langage M a été inventé par la Direction Générale des Finances Publiques (DGFiP) française pour transcrire le code des impôts en instructions lisibles par une machine. Il s'agit d'un petit langage dédié (DSL - Domain Specific Language) basé sur des déclarations de variables et des opérations arithmétiques. Ce travail est basé sur une rétro-ingénierie de la syntaxe et de la sémantique de M, à partir de la base de code précédemment publiée par la DGFiP sur la forge Framagit et désormais régulièrement publiée sur la forge Adullact.
+[Forge Framagit](https://framagit.org) and now regularly published on
+[Forge Adullact](https://gitlab.adullact.net/dgfip/ir-calcul).
+
+## Avertissement
+
+Il n'existe actuellement aucune garantie juridique d'aucune sorte quant à l'exactitude du code produit par le compilateur Mlang, ou des résultats produits par l'interprète de Mlang. Cependant, les auteurs ont travaillé en étroite collaboration avec la DGFiP pour valider Mlang, et le système passe tous les tests privés de la DGFiP en date de septembre 2025 pour la version des fichiers sources responsables du calcul de l'impôt des années 2018 à 2024.
+
+## Installation
+
+Mlang est implémenté en OCaml. Pour gérer les dépendances, [installez opam](https://opam.ocaml.org/doc/Install.html) et basculez vers une version d'OCaml au moins égale à 4.14.2. Afin de supporter les calculs en virgule flottante multi-précision, vous devrez également installer la bibliothèque MPFR.
+
+Pour les distributions basées sur Debian, exécutez simplement :
+
+ sudo apt install libgmp-dev libmpfr-dev git opam
+
+Pour les distributions basées sur Red Hat, exécutez d'abord :
+
+ sudo yum install gmp-devel mpfr-devel git
+
+Opam n'est packagé que pour Fedora. Pour les autres distributions utilisant RPM, veuillez vous référer à la [documentation officielle](https://opam.ocaml.org/doc/Install.html). Notez que pour utiliser la version binaire d'Opam et installer les dépendances de Mlang, vous aurez besoin d'un compilateur C et des logiciels suivants comme dépendances Opam : `patch`,`unzip`, `bubblewrap` et `bzip2`.
+
+Si vous souhaitez générer des tests à l'aide du fuzzer, vous devrez installer AFL :
+
+ sudo apt install afl++ afl++-clang
+
+Si vous n'avez jamais utilisé opam auparavant, lancez :
+
+ opam init
+ opam update -y
+
+Ensuite, vous pouvez initialiser votre projet Mlang en utilisant :
+
+ make init
+
+Cette commande crée un "switch" Opam local (analogue à un environnement virtuel), installe les dépendances OCaml de Mlang et clone le dépôt du code source M publié par la DGFiP avec :
+
+ git submodule update --init ir-calcul
+
+Vous pouvez ensuite utiliser :
+
+ make build
+
+pour construire le compilateur. Si nécessaire,
+
+ make deps
+
+réinstallera les dépendances OCaml et récupérera à nouveau le code source M.
+
+L'interprète et le backend C dans `examples/dgfip_c` devraient être utilisables immédiatement, car le compilateur C a été installé pour Opam.
+Les résultats de Mlang sont testés sur GCC et Clang, ce dernier étant préféré s'il est disponible.
+
+## Utilisation
+
+Mlang a également besoin d'un fichier M pour savoir comment exécuter le mécanisme de "liquidations multiples" qui est nécessaire pour calculer correctement l'impôt sur le revenu. Par exemple, le fichier `ir_calcul/2022/cible.m` correspond au code non publié de la DGFiP pour la version des sources M 2022 publiées dans ir-calcul.
+
+Certains drapeaux (flags) du Makefile peuvent être configurés de manière permanente en modifiant le fichier `makefiles/variables.mk`.
+
+Si vous souhaitez générer les fichiers sources du backend ML, lancez la commande :
+
+ make YEAR=<2020 ou 2022> dgfip_c_backend
+
+ou
+
+ make dgfip_c_backend
+
+avec l'année 2022 par défaut. Les fichiers sont ensuite générés dans `example/dgfip_c/ml_primitif/calc`.
+
+Si vous souhaitez générer l'exécutable du backend ML, lancez la commande :
+
+ make YEAR=<2020 ou 2022> compile_dgfip_c_backend
+
+ou
+
+ make compile_dgfip_c_backend
+
+avec l'année 2022 par défaut.
+
+## Tests
+
+Mlang est testé en utilisant le format de fichier de test `IRJ` utilisé par la DGFiP pour tester ses outils internes. Les options `--run_test` et `--run_all_tests` facilitent le processus de test de l'interprète (avec ou sans optimisations) et rapportent les erreurs de test dans un format pratique.
+
+Les backends de Mlang sont également testés en utilisant le même format `IRJ`.
+
+Lors de l'exécution de `--run_all_tests`, vous pouvez activer l'instrumentation de la couverture de code avec l'option `--code_coverage`. Une autre option intéressante est `--precision`, qui vous permet de choisir comment les nombres sont représentés pour le calcul de l'impôt. La valeur par défaut est `--precision double`, qui utilise la représentation en virgule flottante 64 bits IEEE754 et les opérations associées. C'est ce que la DGFiP utilise. L'option `--precision mpfr` vous permet d'utiliser des nombres en virgule flottante de 1024 bits pour une précision virtuellement infinie. Enfin, `--precision fixed` utilise l'arithmétique en virgule fixe avec les grands entiers fournis par GMP. Les nombres en virgule fixe sont représentés avec le format de nombre Q et `` est le nombre de bits fractionnaires. Les bits entiers sont illimités.
+
+La DGFiP ne publie pas sa base de tests interne. Cependant, des cas de test aléatoires ont été créés pour les versions 2018 à 2024 du logiciel de l'impôt sur le revenu, dans le dossier `tests`. Le fait que Mlang passe ces tests signifie seulement qu'il reproduit fidèlement le calcul effectué par la DGFiP à l'aide de logiciels non publiés. Notamment, cela ne signifie pas que les sources M (publiées par la DGFiP) et les sources M++ (recréées à partir de sources non publiées) sont fidèles à la manière dont la loi dispose que les impôts doivent être calculés.
+
+Pour vérifier que Mlang passe tous les tests aléatoires, invoquez simplement :
+
+ make tests
+
+Certains tests peuvent échouer en utilisant des paramètres de précision autres que ceux par défaut, même si le message d'erreur ne montre aucune différence entre la valeur attendue et la valeur calculée. C'est parce que nous contrôlons une différence de 0 entre le calculé et l'attendu, mais lors de calculs avec une précision plus élevée, une différence inférieure au plus petit flottant représentable peut apparaître. Pour réussir le test, nous avons fourni l'option de ligne de commande `--test_error_margin=0.0000001` pour vous permettre de définir la marge d'erreur que vous souhaitez tolérer lors de l'exécution des tests.
+
+Si vous souhaitez lancer l'interprète mlang sur tous les tests d'une année d'imposition, lancez la commande :
+
+ make YEAR=<2020 ou 2022> tests
+
+ou
+
+ make tests
+
+avec l'année 2022 par défaut.
+
+Si vous souhaitez lancer l'interprète mlang sur un test spécifique d'une année d'imposition, lancez la commande :
+
+ make YEAR=<2020 ou 2022> TEST_ONE= test_one
+
+ou
+
+ make TEST_ONE= test_one
+
+avec l'année 2022 par défaut. Les fichiers de tests sont stockés dans `tests//fuzzing`.
+
+Si vous souhaitez tester la sortie de l'interprète sur une situation que vous avez créée, éditez votre propre fichier .m_test et lancez-le avec la commande :
+
+ make YEAR=<2020 ou 2022> TEST_FILE= make test_file
+
+ou
+
+ make TEST_ONE= test_one
+
+avec l'année 2022 par défaut.
+
+Si vous souhaitez tester la sortie du backend ML sur tous les tests d'une année d'imposition, lancez la commande :
+
+ make YEAR=<2020 ou 2022> test_dgfip_c_backend
+
+ou
+
+ make TEST_ONE= test_dgfip_c_backend
+
+avec l'année 2022 par défaut.
+
+Veuillez lire le fichier `tests/README.md` pour un guide détaillé de ce qui se passe dans les fichiers d'entrée.
+
+## Documentation
+
+Le code OCaml est auto-documenté en utilisant le style ocamldoc. Elle est disponible ici. Vous pouvez également générer la documentation HTML en utilisant :
+code Code
+
+make doc
+
+Pour consulter la documentation, ouvrez simplement le fichier `documentation/index.html` avec votre navigateur.
+
+## M++
+
+Afin de calculer correctement le montant des impôts d'un foyer fiscal, la DGFiP exécute le programme M plusieurs fois, en changeant à chaque fois les valeurs de certaines variables pour activer ou désactiver des parties du calcul.
+
+La DGFiP n'a pas publié le code source de ce calcul itératif. Cependant, les auteurs de Mlang ont conçu un nouveau DSL appelé M++, utilisé pour décrire la logique de ce calcul itératif. Cette extension M est utilisée dans `m_ext/2018..2024` et a été utilisée avec succès pour le calcul de taxation primitif et correctif.
+
+## Contributions
+
+Le projet accepte les "pull requests". Il n'y a actuellement pas de guide de contribution formalisé ou de lieu de discussion centralisé sur le projet. Veuillez envoyer un e-mail aux auteurs si vous êtes intéressé :
+
+david POINT michel1 AT dgfip POINT finances POINT gouv POINT fr
+steven AT ocamlpro POINT com
+alexandre POINT doussot AT ocamlpro POINT com
+denis POINT merigoux AT inria POINT fr
+raphael POINT monat AT lip6 POINT fr
+
+Veuillez noter que le droit d'auteur de ce code appartient à la DGFiP et à l'Inria, ainsi que toutes les contributions à ce code.
+
+N'oubliez pas d'utiliser `make format` avant de soumettre vos modifications (commit) afin de garantir un style uniforme (sans quoi, le CI bloquera votre pull request).
+
+## Sémantique formelle
+
+Le dossier formal_semantics contient la formalisation du cœur du langage M, qui correspond approximativement à la représentation interne Mir dans Mlang. La formalisation de référence est écrite en Coq, dans le fichier semantique.v. Consultez l'[article de recherche](https://hal.inria.fr/hal-03002266) pour plus de détails.
+
+## Licence
+
+Le compilateur est publié sous la licence CeCILL (version 2.1).
diff --git a/Makefile b/Makefile
index 1366d5d15..52367c5ee 100644
--- a/Makefile
+++ b/Makefile
@@ -38,4 +38,8 @@ clean: FORCE remise_a_zero_versionnage
$(call make_in,$(DGFIP_DIR),clean_backend_all)
rm -f doc/doc.html
rm -rf examples/doc
+ rm -f $(INTERP_PROGRESS)
+ rm -f $(MLANG_HASH)
dune clean
+
+ci_tests: test_cram tests test_irj test_dgfip_c_backend
diff --git a/README.md b/README.md
index bbf670e4f..c12e4d79f 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,14 @@
+# Important note
+
+The MLang compiler is hosted on the [Adullact forge](https://gitlab.adullact.net/dgfip/impots-nationaux-revenu-patrimoine-particuliers/Mlang).
+
# The Mlang compiler

[](https://mlanguage.github.io/mlang/mlang/index.html)
-
The M language has been invented by the French Direction Générale des Finances
-Publiques (DGFiP), equivalent to the IRS, to transcribe the tax code into machine-readable
+Publiques (DGFiP) to transcribe the tax code into machine-readable
instructions. It is a small Domain Specific Language based on variable
declarations and arithmetic operations. This work is based on a retro-engineering
of the syntax and the semantics of M, from the codebase previously released by the DGFiP on
@@ -16,15 +19,15 @@ of the syntax and the semantics of M, from the codebase previously released by t
There is currently no legal guarantee of any kind about the correctness of the code
produced by the Mlang compiler, or by the results produced by the interpreter of
-Mlang. However, authors have been in contact with DGFiP to validate Mlang, and
-the system passes all the private DGFiP tests as of Sept. 2022 for the version
-of the source files responsible for computing the tax on the 2018, 2019, 2020 and 2021 income.
+Mlang. However, authors have been working closely with the DGFiP to validate Mlang, and
+the system passes all the private DGFiP tests as of Sept. 2025 for the version
+of the source files responsible for computing the tax the 2018 to 2024.
## Installation
Mlang is implemented in OCaml. To manage dependencies,
[install opam](https://opam.ocaml.org/doc/Install.html) and switch to a version
-of OCaml that is at least 4.0.9. In order to support multi-precision floating-point
+of OCaml that is at least 4.14.2. In order to support multi-precision floating-point
computation, you will need also need to install the MPFR library.
For Debian-based distributions, simply invoke
@@ -106,12 +109,12 @@ with default year 2022.
## Testing
-Mlang is tested using the `FIP` test file format used by the DGFiP to test
+Mlang is tested using the `IRJ` test file format used by the DGFiP to test
their internal tooling. The `--run_test` and `--run_all_tests` options ease
the testing process of the interpreter (with or without optimizations) and
report test errors in a convenient format.
-Mlang backends are also tested using the same `FIP` format.
+Mlang backends are also tested using the same `IRJ` format.
When running `--run_all_tests`, you can enable code coverage instrumentation
with the `--code_coverage` option. Another interesting option is `--precision`,
@@ -125,7 +128,7 @@ are represented with the [Q number format](https://en.wikipedia.org/wiki/Q_(numb
and `` is the number of fractional bits. The integer bits are unbounded.
The DGFiP does not publish its internal test base. However, randomized test
-cases have been created for the 2018, 2019 and 2020 income versions of the software, in the
+cases have been created for the 2018 to 2024 income versions of the software, in the
folder `tests`. The fact that Mlang passes these tests only means that
it faithfully reproduces the computation done by the DGFiP using unpublished
software. Notably, it does not mean that the M sources (published by the
@@ -192,35 +195,24 @@ Please read the `tests/README.md` for a walk-through of what happens in input fi
## Documentation
-The OCaml code is self-documented using `ocamldoc` style. You can generate the HTML
-documentation using
+The OCaml code is self-documented using `ocamldoc` style. It is available
+[here](https://mlanguage.github.io/mlang/mlang/index.html).
+You also can generate the HTML documentation using
make doc
-To browse the documentation, just open the file `doc.html` with your browser. Here
-is a high-level picture describing the architecture of the compiler:
-
-
-
-
-
-First, the code is parsed into AST (both for M and M++). Then, the AST are
-desugared into M and M++ intermediate representations. BIR stands for Backend
-IR, and collects the result of inlining the M code inside M++. OIR is the
-Optimization IR, which is a CFG-form of BIR.
+To browse the documentation, just open the file `documentation/index.html` with your browser.
-## Known Limitations
+## M++
-The code released by the DGFiP is not complete as of September 2020. Indeed,
-in order to correctly compute the amount of taxes for a fiscal household, the DGFiP
+In order to correctly compute the amount of taxes for a fiscal household, the DGFiP
executes the M program several times, each time changing the values of some variables
to enable or disable parts of the computation.
The DGFiP has not published the source code of this iterative computation. However,
the authors of Mlang have come up with a new DSL called M++, used for describing
-the logic of this iterative computation. Currently, the authors have transcribed
-the unpublished source code into the `mpp_specs/*2018_6_7*.mpp` file, which has been tested only
-for the computation of taxes for the 2018, 2019 and 2020 income.
+the logic of this iterative computation. This M extension is used in `m_ext/2018..2024`
+and has been tested successfully on the primitive and corrective taxation.
## Contributions
@@ -228,11 +220,14 @@ The project accepts pull requests. There is currently no formalized contribution
guide or centralized discussion place about the project. Please email the authors
if you are interested:
+ david DOT michel1 AT dgfip DOT finances DOT gouv DOT fr
+ steven AT ocamlpro DOT com
+ alexandre DOT doussot AT ocamlpro DOT com
denis DOT merigoux AT inria DOT fr
raphael DOT monat AT lip6 DOT fr
-Please note that the copyright of this code is owned by Inria; by contributing,
-you disclaim all copyright interests in favor of Inria.
+Please note that the copyright of this code is owned by DGFiP and Inria as well as
+all contributions to this code.
Don't forget format to use `make format` before you commit to ensure a uniform style.
@@ -246,4 +241,4 @@ more details.
## License
-The compiler is released under the GPL license (version 3).
+The compiler is released under the CeCILL license (version 2.1).
diff --git a/dune-project b/dune-project
index 27b8d13d3..f5a720f1a 100644
--- a/dune-project
+++ b/dune-project
@@ -31,7 +31,7 @@
(depends
(ocaml
(and
- (>= "4.13.0")))
+ (>= "4.14.2")))
(dune
(and :build))
(ANSITerminal
@@ -51,7 +51,7 @@
(mlgmpidl
(>= 1.2.12))
(ocamlformat
- (= 0.24.1))
+ (= 0.28.1))
(parmap
(= 1.2.3))))
@@ -63,10 +63,10 @@
(depends
(ocaml
(and
- (>= "4.11.2")))
+ (>= "4.14.2")))
(dune
(and :build))
(odoc
(>= 1.5.3))
(ocamlformat
- (= 0.24.1))))
+ (>= 0.24.1))))
diff --git a/examples/dgfip_c/ml_primitif/c_driver/aide.c b/examples/dgfip_c/ml_primitif/c_driver/aide.c
index 2d1dab66d..145370842 100644
--- a/examples/dgfip_c/ml_primitif/c_driver/aide.c
+++ b/examples/dgfip_c/ml_primitif/c_driver/aide.c
@@ -12,7 +12,10 @@ void aide_trt(FILE *sortie, T_options opts) {
fprintf(sortie, " %s\n", opts->exe);
fprintf(sortie, " -mode [primitif|correctif] (-m [p|c])\n");
fprintf(sortie, " -annee [année] (-a [année])\n");
- fprintf(sortie, " -def [variable] [valeur] (-d [variable] [valeur])\n");
+ fprintf(sortie, " -def [variable] [valeur] (-D [variable] [valeur])\n");
+ fprintf(sortie, " notation alternative:\n");
+ fprintf(sortie, " --def [variable]=[valeur]\n");
+ fprintf(sortie, " -D [variable]=[valeur])\n");
fprintf(sortie, " -recursif (-r)\n");
fprintf(sortie, " -strict (-s)\n");
fprintf(sortie, " [fichiers IRJ] ([fichiers IRJ ne commençant pas par '-'])\n");
diff --git a/examples/dgfip_c/ml_primitif/c_driver/commun.h b/examples/dgfip_c/ml_primitif/c_driver/commun.h
index 9f2614f54..aad4beb34 100644
--- a/examples/dgfip_c/ml_primitif/c_driver/commun.h
+++ b/examples/dgfip_c/ml_primitif/c_driver/commun.h
@@ -17,6 +17,12 @@ struct S_varVal {
double val;
};
+typedef struct S_traitement {
+ int ok;
+ float temps_ms;
+} T_traitement;
+
+
TYPEDEF_LISTE(S_varVal)
extern T_varVal creeVarVal(T_tas tas, char *nom, double val);
diff --git a/examples/dgfip_c/ml_primitif/c_driver/completion.c b/examples/dgfip_c/ml_primitif/c_driver/completion.c
new file mode 100644
index 000000000..2b362ae1e
--- /dev/null
+++ b/examples/dgfip_c/ml_primitif/c_driver/completion.c
@@ -0,0 +1,307 @@
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+
+
+char *nomSansIrj(T_tas tas, char *fich) {
+ size_t lng = 0;
+ char *res = NULL;
+ char *ext = NULL;
+ int i = 0;
+
+ res = strCopie(tas, fich);
+ ext = strApresDernier('.', res);
+ if (strcmp(ext, "irj") == 0 || strcmp(ext, "IRJ") == 0) {
+ for (i = strLng(res); i >= 0 && res[i] != '.'; i--);
+ if (i > 0) {
+ res[i] = 0;
+ }
+ }
+ return res;
+}
+
+char *nomDestinationPrefix(T_tas tas, T_options opts, char *chemin) {
+ char *nomFich = NULL;
+ char *dest = NULL;
+ L_char destL = NULL;
+
+ nomFich = strApresDernier('/', chemin); /* pointeur dans chemin */
+ destL = NIL(char);
+ dest = opts->args.trt.dest;
+ destL = CONS(tas, char, dest, destL);
+ if (dest[strLng(dest) - 1] != '/') {
+ destL = CONS(tas, char, strCopie(tas, "/"), destL);
+ }
+ destL = CONS(tas, char, nomSansIrj(tas, nomFich), destL);
+ RETOURNE(char, &destL, destL);
+ dest = strConcatListe(tas, destL);
+ LIBERE_LISTE(char, destL);
+ return dest;
+}
+
+char *nomDestination(T_tas tas, T_options opts, char *chemin) {
+ char *destPre = "";
+ char *dest = "";
+ char buf[8 * (sizeof (unsigned int)) + 5];
+ unsigned int idx = 1;
+
+ destPre = nomDestinationPrefix(tas, opts, chemin);
+ dest = strConcat(tas, destPre, ".irj");
+ while (estReg(dest) == 1) {
+ if (idx == 0) {
+ return NULL;
+ }
+ memLibere(dest);
+ sprintf(buf, "_%d.irj", idx);
+ dest = strConcat(tas, destPre, buf);
+ idx++;
+ }
+ return dest;
+}
+
+void extraitAnos(T_tas tas, FILE *destFile, T_irdata *tgv) {
+ L_char errs = NULL;
+ L_char errsSav = NULL;
+
+ errs = erreursVersListe(tas, tgv);
+ while (errs != NIL(char)) {
+ fprintf(destFile, "%s\n", TETE(char, errs));
+ memLibere(TETE(char, errs));
+ errsSav = errs;
+ errs = QUEUE(char, errs);
+ LIBERE_CONS(errsSav);
+ }
+}
+
+void extraitTgv(T_options opts, FILE *destFile, T_irdata *tgv) {
+ int lng = 0;
+ int i = 0;
+
+ lng = NB_variable + NB_saisie;
+ for (i = 0; i < lng; i++) {
+ T_varinfo *info = NULL;
+
+ info = varinfo[i].info;
+ if (! opts->args.trt.strict || info->est_restituee) {
+ char def = 0;
+ double val = 0.0;
+
+ lis_varinfo(tgv, ESPACE_PAR_DEFAUT, info, &def, &val);
+ val = arrondi(val * 100.0) / 100.0;
+ fprintf(destFile, "%s/%0.2f\n", info->name, val);
+ }
+ }
+}
+
+int completionAux(T_tas tas, T_options opts, char *chemin, char *dest, T_irdata *tgv) {
+ T_fich fich = NULL;
+ T_irj irj = NULL;
+ int code = IRJ_CODE_VIDE;
+ L_char lnom = NULL;
+ char *nom = NULL;
+ int ok = 1;
+ FILE *destFile = NULL;
+
+ destFile = fopen(dest, "w");
+ if (destFile == NULL) {
+ discoFichier(dest, -1);
+ ok = -1;
+ goto fin;
+ }
+ fich = ouvreFich(tas, chemin);
+ if (fich == NULL) {
+ discoFichier(chemin, -1);
+ ok = -1;
+ goto fin;
+ }
+ irj = creeIrj(tas, opts->args.trt.strict);
+ code = codeIrj(irj);
+ lnom = NIL(char);
+ while (code != IRJ_FIN && code != IRJ_INVALIDE) {
+ lisIrj(fich, irj);
+ code = codeIrj(irj);
+ switch (code) {
+ case IRJ_NOM:
+ lnom = CONS(tas, char, strCopie(tas, irj->args.nom), lnom);
+ break;
+ case IRJ_NOM_FIN:
+ RETOURNE(char, &lnom, lnom);
+ nom = strConcatListe(tas, lnom);
+ fprintf(destFile, "#NOM\n%s\n", nom);
+ break;
+ case IRJ_ENTREES_PRIMITIF_DEBUT:
+ fprintf(destFile, "#ENTREES-PRIMITIF\n");
+ break;
+ case IRJ_CONTROLES_PRIMITIF_DEBUT:
+ fprintf(destFile, "#CONTROLES-PRIMITIF\n");
+ switch (opts->args.trt.mode) {
+ case Primitif:
+ extraitAnos(tas, destFile, tgv);
+ break;
+ case Correctif:
+ break;
+ }
+ break;
+ case IRJ_RESULTATS_PRIMITIF_DEBUT:
+ fprintf(destFile, "#RESULTATS-PRIMITIF\n");
+ switch (opts->args.trt.mode) {
+ case Primitif:
+ extraitTgv(opts, destFile, tgv);
+ break;
+ case Correctif:
+ break;
+ }
+ break;
+ case IRJ_ENTREES_CORRECTIF_DEBUT:
+ case IRJ_CONTROLES_CORRECTIF_DEBUT:
+ case IRJ_RESULTATS_CORRECTIF_DEBUT:
+ /* ignorés */
+ break;
+ case IRJ_ENTREES_RAPPELS_DEBUT:
+ fprintf(destFile, "#ENTREES-RAPPELS\n");
+ break;
+ case IRJ_CONTROLES_RAPPELS_DEBUT:
+ fprintf(destFile, "#CONTROLES-RAPPELS\n");
+ switch (opts->args.trt.mode) {
+ case Primitif:
+ break;
+ case Correctif:
+ extraitAnos(tas, destFile, tgv);
+ break;
+ }
+ break;
+ case IRJ_RESULTATS_RAPPELS_DEBUT:
+ fprintf(destFile, "#RESULTATS-RAPPELS\n");
+ switch (opts->args.trt.mode) {
+ case Primitif:
+ break;
+ case Correctif:
+ extraitTgv(opts, destFile, tgv);
+ break;
+ }
+ break;
+ case IRJ_DEF_VAR:
+ switch (irj->section) {
+ case IRJ_ENTREES_PRIMITIF_DEBUT: {
+ double val = 0.0;
+
+ val = arrondi(irj->args.defVar.val * 100.0) / 100.0;
+ fprintf(destFile, "%s/%0.2f\n", irj->args.defVar.var, val);
+ break;
+ }
+ case IRJ_RESULTATS_PRIMITIF_DEBUT:
+ case IRJ_RESULTATS_CORRECTIF_DEBUT:
+ case IRJ_RESULTATS_RAPPELS_DEBUT:
+ /* */
+ break;
+ default:
+ ok = -1;
+ goto fin;
+ }
+ break;
+ case IRJ_DEF_ANO:
+ switch (irj->section) {
+ case IRJ_CONTROLES_PRIMITIF_DEBUT:
+ case IRJ_CONTROLES_CORRECTIF_DEBUT:
+ case IRJ_CONTROLES_RAPPELS_DEBUT:
+ /* */
+ break;
+ default:
+ ok = -1;
+ goto fin;
+ }
+ break;
+ case IRJ_DEF_RAP:
+ if (irj->section == IRJ_ENTREES_RAPPELS_DEBUT) {
+ double val = 0.0;
+
+ fprintf(destFile, "%0.0f/", irj->args.defRap.numero);
+ fprintf(destFile, "%0.0f/", irj->args.defRap.rappel);
+ fprintf(destFile, "%s/", irj->args.defRap.code);
+ val = arrondi(irj->args.defRap.montant * 100.0) / 100.0;
+ fprintf(destFile, "%0.2f/", irj->args.defRap.montant);
+ if (irj->args.defRap.sens == 0.0) {
+ fprintf(destFile, "R/");
+ } else if (irj->args.defRap.sens == 1.0) {
+ fprintf(destFile, "M/");
+ } else if (irj->args.defRap.sens == 2.0) {
+ fprintf(destFile, "P/");
+ } else if (irj->args.defRap.sens == 3.0) {
+ fprintf(destFile, "C/");
+ }
+ fprintf(destFile, "%0.0f/", irj->args.defRap.penalite);
+ fprintf(destFile, "%0.0f/", irj->args.defRap.base_tl);
+ fprintf(destFile, "%06.0f/", irj->args.defRap.date);
+ fprintf(destFile, "%0.0f\n", irj->args.defRap._2042_rect);
+ } else {
+ ok = -1;
+ goto fin;
+ }
+ break;
+ case IRJ_INVALIDE:
+ case IRJ_CODE_VIDE:
+ ok = -1;
+ goto fin;
+ default:
+ break;
+ }
+ }
+ if (code == IRJ_FIN) {
+ fprintf(destFile, "##\n");
+ }
+
+fin:
+ memLibere(nom);
+ fermeFich(fich);
+ if (destFile != NULL) {
+ fclose(destFile);
+ if (ok != 1) {
+ remove(dest);
+ }
+ }
+ return ok;
+}
+
+int completion(char *chemin, T_options opts) {
+ T_tas tasCpl = NULL;
+ int ok = 0;
+ T_irdata *tgv = NULL;
+
+ tasCpl = memCreeTas();
+ tgv = cree_irdata();
+ if (traitementAux(tasCpl, chemin, opts, tgv)) {
+ char *dest = NULL;
+
+ dest = nomDestination(tasCpl, opts, chemin);
+ if (dest == NULL) {
+ dest = nomDestinationPrefix(tasCpl, opts, chemin);
+ dest = strConcat(tasCpl, dest, ".irj");
+ anoLimNbFich(dest);
+ goto fin;
+ }
+ ok = completionAux(tasCpl, opts, chemin, dest, tgv);
+ }
+
+fin:
+ detruis_irdata(tgv);
+ memLibereTas(tasCpl);
+ return ok;
+}
+
diff --git a/examples/dgfip_c/ml_primitif/c_driver/completion.h b/examples/dgfip_c/ml_primitif/c_driver/completion.h
new file mode 100644
index 000000000..f771f6c8a
--- /dev/null
+++ b/examples/dgfip_c/ml_primitif/c_driver/completion.h
@@ -0,0 +1,12 @@
+#ifndef __COMPLETION_H__
+#define __COMPLETION_H__
+
+#include
+#include
+
+#include
+
+extern int completion(char *chemin, T_options opts);
+
+#endif /* __COMPLETION_H__ */
+
diff --git a/examples/dgfip_c/ml_primitif/c_driver/format.c b/examples/dgfip_c/ml_primitif/c_driver/format.c
index 592128730..9bfd043e4 100644
--- a/examples/dgfip_c/ml_primitif/c_driver/format.c
+++ b/examples/dgfip_c/ml_primitif/c_driver/format.c
@@ -10,7 +10,7 @@
#include
-int verifieFormat(char *chemin, T_options opts) {
+T_traitement verifieFormat(char *chemin, T_options opts) {
T_tas tasFmt = NULL;
T_fich fich = NULL;
T_irj irj = NULL;
@@ -18,6 +18,7 @@ int verifieFormat(char *chemin, T_options opts) {
L_char lnom = NULL;
char *nom = NULL;
int ok = 1;
+ T_traitement result;
tasFmt = memCreeTas();
fich = ouvreFich(tasFmt, chemin);
@@ -111,5 +112,7 @@ int verifieFormat(char *chemin, T_options opts) {
memLibere(nom);
fermeFich(fich);
memLibereTas(tasFmt);
- return ok;
+ result.ok = ok;
+ result.temps_ms = 0;
+ return result;
}
diff --git a/examples/dgfip_c/ml_primitif/c_driver/format.h b/examples/dgfip_c/ml_primitif/c_driver/format.h
index cd28625d0..7621ee760 100644
--- a/examples/dgfip_c/ml_primitif/c_driver/format.h
+++ b/examples/dgfip_c/ml_primitif/c_driver/format.h
@@ -3,6 +3,6 @@
#include
-extern int verifieFormat(char *chemin, T_options opts);
+extern T_traitement verifieFormat(char *chemin, T_options opts);
#endif /* __FORMAT_H__ */
diff --git a/examples/dgfip_c/ml_primitif/c_driver/ida.c b/examples/dgfip_c/ml_primitif/c_driver/ida.c
index 0247075e3..7fb130106 100644
--- a/examples/dgfip_c/ml_primitif/c_driver/ida.c
+++ b/examples/dgfip_c/ml_primitif/c_driver/ida.c
@@ -1,5 +1,6 @@
#include
#include
+#include
#include
#include
@@ -77,6 +78,17 @@ void infoLien(char *nom) {
fprintf(stdout, "IACT013 | le lien \"%s\" est ignoré\n", nom);
}
+void infoTemps(uint64_t temps_ms) {
+ uint64_t min = temps_ms/60000;
+ uint64_t sec = (temps_ms - min * 60000)/1000;
+ uint64_t mse = temps_ms - min*60000 - sec*1000;
+ fprintf(stdout, "IACT014 | Temps calcul effectif total: %lums (", temps_ms);
+ if (min > 0) fprintf(stdout, "%lumn", min);
+ if (sec > 0) fprintf(stdout, "%lus" , sec);
+ if (mse > 0) fprintf(stdout, "%lums", mse);
+ fprintf(stdout, ")\n");
+}
+
/* discos */
int discoOptsRecDup(int b) {
diff --git a/examples/dgfip_c/ml_primitif/c_driver/ida.h b/examples/dgfip_c/ml_primitif/c_driver/ida.h
index 46adf0d9a..d8d5d1c24 100644
--- a/examples/dgfip_c/ml_primitif/c_driver/ida.h
+++ b/examples/dgfip_c/ml_primitif/c_driver/ida.h
@@ -3,6 +3,7 @@
#include
#include
+#include
extern void infoActVide(void);
extern void infoActAide(void);
@@ -18,6 +19,7 @@ extern void infoNbKo(int ko, int tot);
extern void infoNbKc(int kc, int tot);
extern void infoNonRec(char *dir);
extern void infoLien(char *nom);
+extern void infoTemps(uint64_t temps_us);
extern int discoOptsRecDup(int b);
extern int discoOptsStrictDup(int b);
diff --git a/examples/dgfip_c/ml_primitif/c_driver/irdata.c b/examples/dgfip_c/ml_primitif/c_driver/irdata.c
index 56d249fdf..f7e379ec5 100644
--- a/examples/dgfip_c/ml_primitif/c_driver/irdata.c
+++ b/examples/dgfip_c/ml_primitif/c_driver/irdata.c
@@ -98,7 +98,7 @@ void finalise_erreur_prim(T_irdata *irdata) {
int trouve = 0;
T_discord *pDisco = irdata->discords;
- nettoie_erreurs_finalisees(irdata);
+ irdata->nb_err_finalise = 0;
while (pDisco != NULL) {
trouve = 0;
for (i = 0; i < irdata->nb_err_archive && ! trouve; i++) {
@@ -121,12 +121,12 @@ void finalise_erreur_prim(T_irdata *irdata) {
void exporte_erreur_prim(T_irdata *irdata) {
int i = 0;
- for (i = 0; i < irdata->nb_err_finalise; i++) {
+ for (i = 0; i < irdata->sz_err_finalise && irdata->err_finalise[i] != NULL; i++) {
ajouter_espace(&irdata->sz_err_sortie, &irdata->err_sortie, irdata->nb_err_sortie);
irdata->err_sortie[irdata->nb_err_sortie] = irdata->err_finalise[i];
irdata->nb_err_sortie++;
}
- nettoie_erreurs_finalisees(irdata);
+ irdata->nb_err_finalise = 0;
}
void finalise_erreur(T_irdata *irdata) {
diff --git a/examples/dgfip_c/ml_primitif/c_driver/main.c b/examples/dgfip_c/ml_primitif/c_driver/main.c
index 5125424e4..71a2a88f7 100644
--- a/examples/dgfip_c/ml_primitif/c_driver/main.c
+++ b/examples/dgfip_c/ml_primitif/c_driver/main.c
@@ -1,4 +1,5 @@
#include
+#include
#include
#include
#include
@@ -19,9 +20,11 @@ T_tas tasGbl = NULL;
void itereFichiers(
L_char lf, int rec,
- int (*traiteFich)(char *, T_options), T_options opts,
+ T_traitement (*traiteFich)(char *, T_options), T_options opts,
int *nbOk, int *nbKo, int *nbKc
) {
+ T_traitement resultat;
+ uint64_t temps_ms_total = 0;
*nbOk = 0;
*nbKo = 0;
*nbKc = 0;
@@ -66,8 +69,10 @@ void itereFichiers(
estr = estReg(fich);
if (! discoStat(fich, estr) && estr) {
infoReg(nomFich);
+ resultat = traiteFich(fich, opts);
+ temps_ms_total += resultat.temps_ms;
/* traitement */
- switch (traiteFich(fich, opts)) {
+ switch (resultat.ok) {
case 1:
(*nbOk)++;
infoOk(nomFich);
@@ -91,6 +96,7 @@ void itereFichiers(
memLibere(fich);
LIBERE_CONS(lfSav);
}
+ infoTemps(temps_ms_total);
}
int main(int argc, char **argv) {
diff --git a/examples/dgfip_c/ml_primitif/c_driver/options.c b/examples/dgfip_c/ml_primitif/c_driver/options.c
index d03d22f47..e7dd43218 100644
--- a/examples/dgfip_c/ml_primitif/c_driver/options.c
+++ b/examples/dgfip_c/ml_primitif/c_driver/options.c
@@ -9,6 +9,14 @@
#include
#include
+#define TEST_ARG(arg,arg_long,arg_court) \
+ ( \
+ strcmp(arg, "-" arg_long) == 0 \
+ || strcmp(arg, "-" arg_court) == 0 \
+ || strcmp(arg, "--" arg_long) == 0 \
+ || strcmp(arg, "--" arg_court) == 0 \
+ )
+
T_options analyseLdcSans(T_options opts) {
infoActVide();
opts->action = ACT_AID;
@@ -52,11 +60,11 @@ T_options analyseLdcFormat(T_tas tas, T_options opts, int argc, char **argv, int
opts->args.fmt.fichiers = NIL(char);
i++;
while (i < argc) {
- if (strcmp(argv[i], "-recursif") == 0 || strcmp(argv[i], "-r") == 0) {
+ if (TEST_ARG(argv[i], "recursif", "r")) {
nbRec++;
opts->args.fmt.recursif = VRAI;
i++;
- } else if (strcmp(argv[i], "-strict") == 0 || strcmp(argv[i], "-s") == 0) {
+ } else if (TEST_ARG(argv[i], "strict", "s")) {
nbStrict++;
opts->args.fmt.strict = VRAI;
i++;
@@ -107,7 +115,7 @@ T_options analyseLdcTraitement(T_tas tas, T_options opts, int argc, char **argv,
opts->args.trt.defs = NIL(S_varVal);
opts->args.trt.fichiers = NIL(char);
while (i < argc) {
- if (strcmp(argv[i], "-mode") == 0 || strcmp(argv[i], "-m") == 0) {
+ if (TEST_ARG(argv[i], "mode", "m")) {
T_mode mode = Primitif;
i++;
@@ -129,7 +137,7 @@ T_options analyseLdcTraitement(T_tas tas, T_options opts, int argc, char **argv,
} else {
opts->args.trt.mode = mode;
}
- } else if (strcmp(argv[i], "-annee") == 0 || strcmp(argv[i], "-a") == 0) {
+ } else if (TEST_ARG(argv[i], "annee", "a")) {
int annee = 0;
i++;
@@ -146,26 +154,39 @@ T_options analyseLdcTraitement(T_tas tas, T_options opts, int argc, char **argv,
opts->args.trt.annee = annee;
}
i++;
- } else if (strcmp(argv[i], "-recursif") == 0 || strcmp(argv[i], "-r") == 0) {
+ } else if (TEST_ARG(argv[i], "recursif", "r")) {
nbRec++;
opts->args.trt.recursif = VRAI;
i++;
- } else if (strcmp(argv[i], "-strict") == 0 || strcmp(argv[i], "-s") == 0) {
+ } else if (TEST_ARG(argv[i], "strict", "s")) {
nbStrict++;
opts->args.trt.strict = VRAI;
i++;
- } else if (strcmp(argv[i], "-def") == 0 || strcmp(argv[i], "-d") == 0) {
+ } else if (TEST_ARG(argv[i], "def", "D")) {
char *nom = NULL;
+ int j = 0;
+ char *valStr = NULL;
double val = 0.0;
T_varVal vv = NULL;
i++;
- nom = argv[i];
+ nom = strCopie(tas, argv[i]);
i++;
- if (strVersNum(argv[i], &val) != 1) {
- TRT_ERR(anoOptsDefValArg(argv[i]))
+ for (j = 0; nom[j] != '\0' && nom[j] != '='; j++);
+ if (nom[j] == '=') {
+ nom[j] = '\0';
+ valStr = &(nom[j + 1]);
+ } else {
+ valStr = argv[i];
+ i++;
+ }
+ if (strcmp(valStr, "defaut") == 0) {
+ val = INF;
+ } else if (strcmp(valStr, "indefini") == 0) {
+ val = NAN;
+ } else if (strVersNum(valStr, &val) != 1) {
+ TRT_ERR(anoOptsDefValArg(valStr))
}
- i++;
vv = creeVarVal(tas, nom, val);
if (vv == NULL) {
if (opts->args.trt.strict) {
@@ -227,15 +248,16 @@ T_options analyseLdc(T_tas tas, int argc, char **argv) {
}
/* aide */
- if (strcmp(argv[i], "-aide") == 0 || strcmp(argv[i], "-?") == 0) {
+ if (TEST_ARG(argv[i], "aide", "?")) {
return analyseLdcAide(opts, argc, argv, i);
}
/* format */
- if (strcmp(argv[i], "-format") == 0 || strcmp(argv[i], "-f") == 0) {
+ if (TEST_ARG(argv[i], "format", "f")) {
return analyseLdcFormat(tas, opts, argc, argv, i);
}
/* traitement */
return analyseLdcTraitement(tas, opts, argc, argv, i);
}
+
diff --git a/examples/dgfip_c/ml_primitif/c_driver/traitement.c b/examples/dgfip_c/ml_primitif/c_driver/traitement.c
index d702b37aa..22dc6cd8b 100644
--- a/examples/dgfip_c/ml_primitif/c_driver/traitement.c
+++ b/examples/dgfip_c/ml_primitif/c_driver/traitement.c
@@ -1,7 +1,9 @@
#include
#include
#include
+#include
#include
+#include
#include
#include
@@ -263,11 +265,31 @@ void initDefs(T_irdata *tgv, L_S_varVal defs) {
for (l = defs; l != NIL(S_varVal); l = QUEUE(S_varVal, l)) {
T_varVal vv = TETE(S_varVal, l);
- ecris_varinfo(tgv, ESPACE_PAR_DEFAUT, vv->varinfo, 1, vv->val);
+ if (isnan(vv->val)) {
+ ecris_varinfo(tgv, ESPACE_PAR_DEFAUT, vv->varinfo, 0, 0.0);
+ } else if (fabs(isinf(vv->val)) != 1) {
+ ecris_varinfo(tgv, ESPACE_PAR_DEFAUT, vv->varinfo, 1, vv->val);
+ }
}
}
-int traitement(char *chemin, T_options opts) {
+int estDansDefs(L_S_varVal defs, char *nom) {
+ L_S_varVal l = NULL;
+
+ if (nom == NULL) {
+ return 0;
+ }
+ for (l = defs; l != NIL(S_varVal); l = QUEUE(S_varVal, l)) {
+ T_varVal vv = TETE(S_varVal, l);
+
+ if (strcmp(vv->varinfo->name, nom) == 0 || strcmp(vv->varinfo->alias, nom) == 0) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+T_traitement traitement(char *chemin, T_options opts) {
T_tas tasTrt = NULL;
T_fich fich = NULL;
T_irj irj = NULL;
@@ -284,6 +306,9 @@ int traitement(char *chemin, T_options opts) {
int anneeCalc = 0;
int anneeRevenu = 0;
int ok = 1;
+ uint64_t temps_ms = 0;
+ clock_t start, end;
+ T_traitement result;
tasTrt = memCreeTas();
estCorr = FAUX;
@@ -415,18 +440,28 @@ int traitement(char *chemin, T_options opts) {
ok = -1;
goto fin;
}
- ecrisVar(tgv, "ANCSDED", 1, opts->args.trt.annee);
- ecrisVar(tgv, "V_MILLESIME", 1, anneeCalc);
+ if (! estDansDefs(opts->args.trt.defs, "V_ANCSDED")) {
+ ecrisVar(tgv, "V_ANCSDED", 1, opts->args.trt.annee);
+ }
+ if (! estDansDefs(opts->args.trt.defs, "V_MILLESIME")) {
+ ecrisVar(tgv, "V_MILLESIME", 1, anneeCalc);
+ }
switch (opts->args.trt.mode) {
case Primitif:
initDefs(tgv, opts->args.trt.defs);
+ start = clock();
enchainement_primitif_interpreteur(tgv);
+ end = clock ();
+ temps_ms = (end - start) * 1000 / CLOCKS_PER_SEC;
ok = controleResultat(tasTrt, opts, tgv, resPrim, ctlPrim);
break;
case Correctif:
ecrisVar(tgv, "MODE_CORR", 1, 1.0);
initDefs(tgv, opts->args.trt.defs);
+ start = clock();
enchainement_primitif_interpreteur(tgv);
+ end = clock ();
+ temps_ms = (end - start) * 1000 / CLOCKS_PER_SEC;
ok = controleResultat(tasTrt, opts, tgv, resRap, ctlRap);
break;
}
@@ -436,5 +471,7 @@ int traitement(char *chemin, T_options opts) {
memLibere(nom);
fermeFich(fich);
memLibereTas(tasTrt);
- return ok;
+ result.ok = ok;
+ result.temps_ms = temps_ms;
+ return result;
}
diff --git a/examples/dgfip_c/ml_primitif/c_driver/traitement.h b/examples/dgfip_c/ml_primitif/c_driver/traitement.h
index 9e4a05ab2..434d14551 100644
--- a/examples/dgfip_c/ml_primitif/c_driver/traitement.h
+++ b/examples/dgfip_c/ml_primitif/c_driver/traitement.h
@@ -1,8 +1,9 @@
#ifndef __TRAITEMENT_H__
#define __TRAITEMENT_H__
+#include
#include
-extern int traitement(char *chemin, T_options opts);
+extern T_traitement traitement(char *chemin, T_options opts);
#endif /* __TRAITEMENT_H__ */
diff --git a/examples/dgfip_c/ml_primitif/c_driver/utils.c b/examples/dgfip_c/ml_primitif/c_driver/utils.c
index 188b695a9..b29fc9bbd 100644
--- a/examples/dgfip_c/ml_primitif/c_driver/utils.c
+++ b/examples/dgfip_c/ml_primitif/c_driver/utils.c
@@ -202,3 +202,6 @@ char *strApresDernier(char c, char *s) {
}
+char nanTab[8] = {0, 0, 0, 0, 0, 0, -8, 127};
+char infTab[8] = {0, 0, 0, 0, 0, 0, -16, 127};
+
diff --git a/examples/dgfip_c/ml_primitif/c_driver/utils.h b/examples/dgfip_c/ml_primitif/c_driver/utils.h
index bc3742d0b..0fdef804a 100644
--- a/examples/dgfip_c/ml_primitif/c_driver/utils.h
+++ b/examples/dgfip_c/ml_primitif/c_driver/utils.h
@@ -6,6 +6,12 @@
#define VRAI 1
#define FAUX 0
+extern char nanTab[8];
+extern char infTab[8];
+
+#define NAN (*(double *)nanTab)
+#define INF (*(double *)infTab)
+
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long ulong;
diff --git a/ir-calcul b/ir-calcul
index 7af2b787a..fc8b85a26 160000
--- a/ir-calcul
+++ b/ir-calcul
@@ -1 +1 @@
-Subproject commit 7af2b787ac8aba998c5da59b6f1e7cc76320227c
+Subproject commit fc8b85a26bd7e4af91df0c8877d1e69a60903dfd
diff --git a/irj_checker.opam b/irj_checker.opam
index 619747f92..e266c778a 100644
--- a/irj_checker.opam
+++ b/irj_checker.opam
@@ -10,10 +10,10 @@ license: "GPL-3.0-or-later"
homepage: "https://github.com/MLanguage/mlang"
bug-reports: "https://github.com/MLanguage/mlang/issues"
depends: [
- "ocaml" {>= "4.11.2"}
+ "ocaml" {>= "4.14.2"}
"dune" {>= "2.7" & build}
"odoc" {>= "1.5.3"}
- "ocamlformat" {= "0.24.1"}
+ "ocamlformat" {>= "0.24.1"}
]
build: [
["dune" "subst"] {dev}
diff --git a/m_ext/0/cibles.m b/m_ext/0/cibles.m
index f49940f72..bb946c2e4 100644
--- a/m_ext/0/cibles.m
+++ b/m_ext/0/cibles.m
@@ -59,6 +59,11 @@
BOBO4 : calculee base primrest = 0 restituee : "" ;
BOBORES : calculee base primrest = 0 restituee : "" ;
+CONST0 : const = 0;
+CONST1 : const = 1;
+CONST2 : const = 2;
+CONST3 : const = 3;
+
espace_variables ESP : categorie saisie, base;
cible test_dans_domaine:
@@ -626,6 +631,24 @@ afficher_erreur nom(VAR) ": "
par_defaut:
afficher "Y = ?, echec\n";
)
+aiguillage (Y) : (
+ cas CONST0:
+ afficher "Y = CONST0, echec\n";
+ cas CONST1:
+ afficher "Y = CONST1, OK!\n";
+ cas indefini:
+ afficher "Y = --indefini--, echec\n";
+ par_defaut:
+ afficher "Y = ?, echec\n";
+)
+aiguillage nom (Y) : (
+ cas X:
+ afficher "X = Y, ah bon?\n";
+ cas Y:
+ afficher "Y = Y, ouf\n";
+ par_defaut:
+ afficher "Y = ?, echec\n";
+)
afficher "FIN test aiguillage\n";
# Test stop fonction
diff --git a/m_ext/2022/correctif.m b/m_ext/2022/correctif.m
index 2d14c024c..d796c8605 100644
--- a/m_ext/2022/correctif.m
+++ b/m_ext/2022/correctif.m
@@ -829,13 +829,11 @@ si present(VAR) et VAR >= 0 alors
application: iliad;
arguments: ATTR;
resultat: NAT;
-si ATTR = 0 alors
- NAT = N_REVENU;
-sinon_si ATTR = 1 alors
- NAT = N_CHARGE;
-sinon
- NAT = N_INDEFINIE;
-finsi
+aiguillage(ATTR):(
+ cas 0: NAT = N_REVENU;
+ cas 1: NAT = N_CHARGE;
+ par_defaut: NAT = N_INDEFINIE;
+)
cible get_nature:
application: iliad;
@@ -861,19 +859,14 @@ sinon_si dans_domaine(VAR, calculee *) alors
NATURE = N_INDEFINIE;
finsi
sinon_si dans_domaine(VAR, saisie contexte) alors
- si meme_variable(VAR, V_REGCO) alors
- NATURE = N_REVENU;
- sinon_si
- meme_variable(VAR, V_EAG)
- ou meme_variable(VAR, V_EAD)
- ou meme_variable(VAR, V_CNR)
- ou meme_variable(VAR, V_CNR2)
- ou meme_variable(VAR, V_CR2)
- alors
- NATURE = N_CHARGE;
- sinon
- NATURE = N_REVENU;
- finsi
+ aiguillage nom (VAR): (
+ cas V_REGCO: NATURE = N_REVENU;
+ cas V_EAG:
+ cas V_CNR:
+ cas V_CNR2:
+ cas V_CR2: NATURE = N_CHARGE;
+ par_defaut: NATURE = N_REVENU;
+ )
sinon_si
dans_domaine(VAR, saisie variation)
ou dans_domaine(VAR, saisie penalite)
@@ -2209,17 +2202,25 @@ si meme_variable(champ_evenement(R, code), REGCO) alors
application: iliad;
arguments: PENA;
resultat: TAUX;
-si PENA dans (2, 7, 10, 17) alors
- TAUX = 10;
-sinon_si PENA dans (3, 8, 11, 30, 55) alors
- TAUX = 40;
-sinon_si PENA dans (4, 5, 9, 12, 31, 32) alors
- TAUX = 80;
-sinon_si PENA = 6 alors
- TAUX = 100;
-sinon
- TAUX = 0;
-finsi
+aiguillage(PENA) : (
+ cas 2:
+ cas 7:
+ cas 10:
+ cas 17: TAUX = 10;
+ cas 3:
+ cas 8:
+ cas 11:
+ cas 30:
+ cas 55: TAUX = 40;
+ cas 4:
+ cas 5:
+ cas 9:
+ cas 12:
+ cas 31:
+ cas 32: TAUX = 80;
+ cas 6: TAUX = 100;
+ par_defaut: TAUX = 0;
+)
fonction is_minoration_sf:
application: iliad;
@@ -2304,23 +2305,19 @@ sinon_si PENA dans (4, 5, 9, 12, 31, 32) alors
cible get_code_situation_famille:
application: iliad;
arguments: RESULTAT, CORR, VAR;
-si meme_variable(VAR, 0AM) alors
- RESULTAT = SF_MARIAGE;
-sinon_si meme_variable(VAR, 0AC) alors
- RESULTAT = SF_CELIBAT;
-sinon_si meme_variable(VAR, 0AD) alors
- RESULTAT = SF_DIVORCE;
-sinon_si meme_variable(VAR, 0AO) alors
- RESULTAT = SF_PACSE;
-sinon_si meme_variable(VAR, 0AV) alors
- si positif(CORR) et GLOBAL.ANNEE_DECES_CONJOINT = GLOBAL.ANNEE_REVENU alors
- RESULTAT = SF_VEUVAGE_TRUE;
- sinon
- RESULTAT = SF_VEUVAGE_FALSE;
- finsi
-sinon
- RESULTAT = SF_INVALIDE;
-finsi
+aiguillage nom (VAR):(
+ cas 0AM: RESULTAT = SF_MARIAGE;
+ cas 0AC: RESULTAT = SF_CELIBAT;
+ cas 0AD: RESULTAT = SF_DIVORCE;
+ cas 0AO: RESULTAT = SF_PACSE;
+ cas 0AV:
+ si positif(CORR) et GLOBAL.ANNEE_DECES_CONJOINT = GLOBAL.ANNEE_REVENU alors
+ RESULTAT = SF_VEUVAGE_TRUE;
+ sinon
+ RESULTAT = SF_VEUVAGE_FALSE;
+ finsi
+ par_defaut: RESULTAT = SF_INVALIDE;
+)
cible is_rappel_strate:
application: iliad;
@@ -2611,131 +2608,132 @@ ou meme_variable(VAR, 0DB)
application: iliad;
arguments: RESULTAT, R, MAJ;
variables_temporaires: EST_SF_NAISS, EST_TAX_INIT;
-si MAJ = MAJ_TL alors
- RESULTAT = (attribut(champ_evenement(R, code), categorie_TL) != 10);
-sinon_si MAJ = MAJ_NON_TL alors
- RESULTAT = (attribut(champ_evenement(R, code), categorie_TL) = 10);
-sinon_si MAJ = MAJ_TL15 alors
- RESULTAT = (attribut(champ_evenement(R, code), categorie_TL) != 15);
-sinon_si MAJ = MAJ_NON_TL15 alors
- RESULTAT = (attribut(champ_evenement(R, code), categorie_TL) = 15);
-sinon_si MAJ = MAJ_RAPPEL_C alors
- RESULTAT = (
- champ_evenement(R, sens) = SENS_C
- et (champ_evenement(R, penalite) < 1 ou champ_evenement(R, penalite) = 99)
- et GLOBAL.CODE_PENA != 22
- );
-sinon_si MAJ = MAJ_RAPPEL_CP alors
- RESULTAT = (
- champ_evenement(R, sens) = SENS_C
- et champ_evenement(R, penalite) > 1
- );
-sinon_si MAJ = MAJ_RAPPEL_CP01 alors
- RESULTAT = (
- champ_evenement(R, sens) = SENS_C
- et champ_evenement(R, penalite) = 1
- );
-sinon_si MAJ = MAJ_RAPPEL_CP22 alors
- RESULTAT = (
- champ_evenement(R, sens) = SENS_C
- et champ_evenement(R, penalite) = 22
- );
-sinon_si MAJ = MAJ_RAPPEL_CP24 alors
- RESULTAT = (
- champ_evenement(R, sens) = SENS_C
- et champ_evenement(R, penalite) = 24
- );
-sinon_si MAJ = MAJ_RAPPEL_F alors
- calculer cible est_code_sf_naiss : avec EST_SF_NAISS, champ_evenement(R, code);
- RESULTAT = (
- champ_evenement(R, sens) = SENS_R
- et champ_evenement(R, penalite) = 1
- et positif(EST_SF_NAISS)
- );
-sinon_si MAJ = MAJ_RAPPEL_NF alors
- calculer cible est_code_sf_naiss : avec EST_SF_NAISS, champ_evenement(R, code);
- RESULTAT = (
- champ_evenement(R, sens) = SENS_R
- et champ_evenement(R, penalite) = 1
- et (non positif(EST_SF_NAISS))
- );
-sinon_si MAJ = MAJ_RAPPEL_M alors
- calculer cible est_code_sf_naiss : avec EST_SF_NAISS, champ_evenement(R, code);
- RESULTAT = (
- champ_evenement(R, sens) = SENS_M
- et (non positif(EST_SF_NAISS))
- et non (
- meme_variable(champ_evenement(R, code), REGCO)
- et (GLOBAL.PENALITE_REGCO dans (1, 22, 24, 99))
- )
- );
-sinon_si MAJ = MAJ_RAPPEL_MF alors
- calculer cible est_code_sf_naiss : avec EST_SF_NAISS, champ_evenement(R, code);
- RESULTAT = (champ_evenement(R, sens) = SENS_M et positif(EST_SF_NAISS));
-sinon_si MAJ = MAJ_RAPPEL_NON_M alors
- RESULTAT = (champ_evenement(R, sens) != SENS_M);
-sinon_si MAJ = MAJ_RAPPEL_P alors
- RESULTAT = (champ_evenement(R, sens) = SENS_P);
-sinon_si MAJ = MAJ_RAPPEL_R alors
- RESULTAT = (champ_evenement(R, sens) = SENS_R);
-sinon_si MAJ = MAJ_RAPPEL_R55 alors
- RESULTAT = (
- meme_variable(champ_evenement(R, code), REGCO)
- et (GLOBAL.PENALITE_REGCO dans (1, 99))
- );
-sinon_si MAJ = MAJ_1728 alors
- RESULTAT = (champ_evenement(R, penalite) dans (7, 8, 10, 11, 17, 18, 31));
-sinon_si MAJ = MAJ_ABAT_20 alors
- calculer cible is_rappel_abat_20_proc : avec RESULTAT, R;
-sinon_si MAJ = MAJ_CODE_1729_2A5 alors
- RESULTAT = (champ_evenement(R, penalite) dans (2, 3, 4, 5, 30, 32, 35, 55));
-sinon_si MAJ = MAJ_CODE_1729_6 alors
- RESULTAT = (champ_evenement(R, penalite) = 6);
-sinon_si MAJ = MAJ_CODE_22 alors
- RESULTAT = (
- champ_evenement(R, penalite) = 22
- et (
+aiguillage (MAJ):(
+ cas MAJ_TL:
+ RESULTAT = (attribut(champ_evenement(R, code), categorie_TL) != 10);
+ cas MAJ_NON_TL:
+ RESULTAT = (attribut(champ_evenement(R, code), categorie_TL) = 10);
+ cas MAJ_TL15:
+ RESULTAT = (attribut(champ_evenement(R, code), categorie_TL) != 15);
+ cas MAJ_NON_TL15 :
+ RESULTAT = (attribut(champ_evenement(R, code), categorie_TL) = 15);
+ cas MAJ_RAPPEL_C :
+ RESULTAT = (
+ champ_evenement(R, sens) = SENS_C
+ et (champ_evenement(R, penalite) < 1 ou champ_evenement(R, penalite) = 99)
+ et GLOBAL.CODE_PENA != 22
+ );
+ cas MAJ_RAPPEL_CP :
+ RESULTAT = (
+ champ_evenement(R, sens) = SENS_C
+ et champ_evenement(R, penalite) > 1
+ );
+ cas MAJ_RAPPEL_CP01 :
+ RESULTAT = (
+ champ_evenement(R, sens) = SENS_C
+ et champ_evenement(R, penalite) = 1
+ );
+ cas MAJ_RAPPEL_CP22 :
+ RESULTAT = (
+ champ_evenement(R, sens) = SENS_C
+ et champ_evenement(R, penalite) = 22
+ );
+ cas MAJ_RAPPEL_CP24 :
+ RESULTAT = (
+ champ_evenement(R, sens) = SENS_C
+ et champ_evenement(R, penalite) = 24
+ );
+ cas MAJ_RAPPEL_F :
+ calculer cible est_code_sf_naiss : avec EST_SF_NAISS, champ_evenement(R, code);
+ RESULTAT = (
champ_evenement(R, sens) = SENS_R
- ou meme_variable(champ_evenement(R, code), REGCO)
- )
- );
-sinon_si MAJ = MAJ_CODE_24 alors
- RESULTAT = (
- champ_evenement(R, penalite) = 24
- et (
+ et champ_evenement(R, penalite) = 1
+ et positif(EST_SF_NAISS)
+ );
+ cas MAJ_RAPPEL_NF :
+ calculer cible est_code_sf_naiss : avec EST_SF_NAISS, champ_evenement(R, code);
+ RESULTAT = (
champ_evenement(R, sens) = SENS_R
- ou meme_variable(champ_evenement(R, code), REGCO)
- )
- );
-sinon_si MAJ = MAJ_CONTEXTE_22 alors
- calculer cible est_code_tax_init : avec EST_TAX_INIT, champ_evenement(R, code);
- RESULTAT = (GLOBAL.CODE_PENA = 22 et positif(EST_TAX_INIT));
-sinon_si MAJ = MAJ_MENTION_EXP_99 alors
- calculer cible est_code_tax_init : avec EST_TAX_INIT, champ_evenement(R, code);
- RESULTAT = (
- champ_evenement(R, penalite) = 99
- et (non positif(GLOBAL.DEFAUT))
- et non (
- meme_variable(champ_evenement(R, code), REGCO)
- ou positif(EST_TAX_INIT)
- )
- );
-sinon_si MAJ = MAJ_MENTION_EXP_99R alors
- calculer cible est_code_tax_init : avec EST_TAX_INIT, champ_evenement(R, code);
- RESULTAT = (
- champ_evenement(R, penalite) = 99
- et GLOBAL.CODE_PENA != 22
- et (non positif(GLOBAL.DEFAUT))
- et (
+ et champ_evenement(R, penalite) = 1
+ et (non positif(EST_SF_NAISS))
+ );
+ cas MAJ_RAPPEL_M :
+ calculer cible est_code_sf_naiss : avec EST_SF_NAISS, champ_evenement(R, code);
+ RESULTAT = (
+ champ_evenement(R, sens) = SENS_M
+ et (non positif(EST_SF_NAISS))
+ et non (
+ meme_variable(champ_evenement(R, code), REGCO)
+ et (GLOBAL.PENALITE_REGCO dans (1, 22, 24, 99))
+ )
+ );
+ cas MAJ_RAPPEL_MF :
+ calculer cible est_code_sf_naiss : avec EST_SF_NAISS, champ_evenement(R, code);
+ RESULTAT = (champ_evenement(R, sens) = SENS_M et positif(EST_SF_NAISS));
+ cas MAJ_RAPPEL_NON_M :
+ RESULTAT = (champ_evenement(R, sens) != SENS_M);
+ cas MAJ_RAPPEL_P :
+ RESULTAT = (champ_evenement(R, sens) = SENS_P);
+ cas MAJ_RAPPEL_R :
+ RESULTAT = (champ_evenement(R, sens) = SENS_R);
+ cas MAJ_RAPPEL_R55 :
+ RESULTAT = (
meme_variable(champ_evenement(R, code), REGCO)
- ou positif(EST_TAX_INIT)
- )
- );
-sinon_si MAJ = MAJ_NON_MENTION_EXP alors
- RESULTAT = 1;
-sinon
- RESULTAT = 0;
-finsi
+ et (GLOBAL.PENALITE_REGCO dans (1, 99))
+ );
+ cas MAJ_1728 :
+ RESULTAT = (champ_evenement(R, penalite) dans (7, 8, 10, 11, 17, 18, 31));
+ cas MAJ_ABAT_20 :
+ calculer cible is_rappel_abat_20_proc : avec RESULTAT, R;
+ cas MAJ_CODE_1729_2A5 :
+ RESULTAT = (champ_evenement(R, penalite) dans (2, 3, 4, 5, 30, 32, 35, 55));
+ cas MAJ_CODE_1729_6 :
+ RESULTAT = (champ_evenement(R, penalite) = 6);
+ cas MAJ_CODE_22 :
+ RESULTAT = (
+ champ_evenement(R, penalite) = 22
+ et (
+ champ_evenement(R, sens) = SENS_R
+ ou meme_variable(champ_evenement(R, code), REGCO)
+ )
+ );
+ cas MAJ_CODE_24 :
+ RESULTAT = (
+ champ_evenement(R, penalite) = 24
+ et (
+ champ_evenement(R, sens) = SENS_R
+ ou meme_variable(champ_evenement(R, code), REGCO)
+ )
+ );
+ cas MAJ_CONTEXTE_22 :
+ calculer cible est_code_tax_init : avec EST_TAX_INIT, champ_evenement(R, code);
+ RESULTAT = (GLOBAL.CODE_PENA = 22 et positif(EST_TAX_INIT));
+ cas MAJ_MENTION_EXP_99 :
+ calculer cible est_code_tax_init : avec EST_TAX_INIT, champ_evenement(R, code);
+ RESULTAT = (
+ champ_evenement(R, penalite) = 99
+ et (non positif(GLOBAL.DEFAUT))
+ et non (
+ meme_variable(champ_evenement(R, code), REGCO)
+ ou positif(EST_TAX_INIT)
+ )
+ );
+ cas MAJ_MENTION_EXP_99R :
+ calculer cible est_code_tax_init : avec EST_TAX_INIT, champ_evenement(R, code);
+ RESULTAT = (
+ champ_evenement(R, penalite) = 99
+ et GLOBAL.CODE_PENA != 22
+ et (non positif(GLOBAL.DEFAUT))
+ et (
+ meme_variable(champ_evenement(R, code), REGCO)
+ ou positif(EST_TAX_INIT)
+ )
+ );
+ cas MAJ_NON_MENTION_EXP :
+ RESULTAT = 1;
+ par_defaut :
+ RESULTAT = 0;
+)
cible is_rappel_autorise:
application: iliad;
@@ -5513,23 +5511,19 @@ sinon_si positif(champ_evenement(R, 2042_rect)) et C1 > R1 alors
cible is_code_situation_famille:
application: iliad;
arguments: RES_SF, VAR;
-si meme_variable(VAR, 0AM) alors
- RES_SF = SF_MARIAGE;
-sinon_si meme_variable(VAR, 0AC) alors
- RES_SF = SF_CELIBAT;
-sinon_si meme_variable(VAR, 0AD) alors
- RES_SF = SF_DIVORCE;
-sinon_si meme_variable(VAR, 0AO) alors
- RES_SF = SF_PACSE;
-sinon_si meme_variable(VAR, 0AV) alors
- si GLOBAL.ANNEE_DECES_CONJOINT = GLOBAL.ANNEE_REVENU alors
- RES_SF = SF_VEUVAGE_TRUE;
- sinon
- RES_SF = SF_VEUVAGE_FALSE;
- finsi
-sinon
- RES_SF = SF_INVALIDE;
-finsi
+aiguillage nom (VAR) : (
+ cas 0AM: RES_SF = SF_MARIAGE;
+ cas 0AC: RES_SF = SF_CELIBAT;
+ cas 0AD: RES_SF = SF_DIVORCE;
+ cas 0AO: RES_SF = SF_PACSE;
+ cas 0AV:
+ si GLOBAL.ANNEE_DECES_CONJOINT = GLOBAL.ANNEE_REVENU alors
+ RES_SF = SF_VEUVAGE_TRUE;
+ sinon
+ RES_SF = SF_VEUVAGE_FALSE;
+ finsi
+ par_defaut: RES_SF = SF_INVALIDE;
+)
cible is_code_situation_famille_r:
application: iliad;
@@ -6583,41 +6577,40 @@ si non present(GLOBAL.CMAJ) alors
: variable R
: entre 0..(nb_evenements() - 1) increment 1
: dans (
- si meme_variable(champ_evenement(R, code), 8VV) alors
- GLOBAL.PRESENT_8VV = 1;
- sinon_si meme_variable(champ_evenement(R, code), 8VW) alors
- GLOBAL.PRESENT_8VW = 1;
- sinon_si meme_variable(champ_evenement(R, code), 9YT) alors
- GLOBAL.PRESENT_9YT = 1;
- si champ_evenement(R, montant) = 18 alors
- GLOBAL.MONTANT_9YT = 7;
- sinon
- GLOBAL.MONTANT_9YT = champ_evenement(R, montant);
- finsi
- GLOBAL.PENALITE_9YT = champ_evenement(R, penalite);
- GLOBAL.NUM_EVT_9YT = champ_evenement(R, numero);
- CORR.CMAJ2 = champ_evenement(R, montant);
- GLOBAL.CMAJ2 = champ_evenement(R, montant);
- si GLOBAL.MONTANT_9YT != 0 alors
- GLOBAL.SENS_9YT = champ_evenement(R, sens);
- GLOBAL.IND_20_9YT = champ_evenement(R, 2042_rect);
- GLOBAL.BASE_TL_9YT = champ_evenement(R, base_tl);
- GLOBAL.R_TARDIF = 1;
- finsi
- sinon_si meme_variable(champ_evenement(R, code), 9YU) alors
- GLOBAL.PRESENT_9YU = 1;
- GLOBAL.MONTANT_9YU = champ_evenement(R, montant);
- GLOBAL.PENALITE_9YU = champ_evenement(R, penalite);
- GLOBAL.NUM_EVT_9YU = champ_evenement(R, numero);
- GLOBAL.SENS_9YU = champ_evenement(R, sens);
- MOIS = vers_mois(champ_evenement(R, montant));
- ANNEE = vers_annee(champ_evenement(R, montant));
- CORR.DATEINR = ANNEE * 10000 + MOIS * 100 + 1;
- GLOBAL.DATEINR = CORR.DATEINR;
- CORR.MOISAN2 = champ_evenement(R, montant);
- GLOBAL.MOISAN2 = champ_evenement(R, montant);
- GLOBAL.DATE_9YU = vers_date(MOIS, ANNEE);
- finsi
+ aiguillage nom (champ_evenement(R, code)) : (
+ cas 8VV: GLOBAL.PRESENT_8VV = 1;
+ cas 8VW: GLOBAL.PRESENT_8VW = 1;
+ cas 9YT:
+ GLOBAL.PRESENT_9YT = 1;
+ si champ_evenement(R, montant) = 18 alors
+ GLOBAL.MONTANT_9YT = 7;
+ sinon
+ GLOBAL.MONTANT_9YT = champ_evenement(R, montant);
+ finsi
+ GLOBAL.PENALITE_9YT = champ_evenement(R, penalite);
+ GLOBAL.NUM_EVT_9YT = champ_evenement(R, numero);
+ CORR.CMAJ2 = champ_evenement(R, montant);
+ GLOBAL.CMAJ2 = champ_evenement(R, montant);
+ si GLOBAL.MONTANT_9YT != 0 alors
+ GLOBAL.SENS_9YT = champ_evenement(R, sens);
+ GLOBAL.IND_20_9YT = champ_evenement(R, 2042_rect);
+ GLOBAL.BASE_TL_9YT = champ_evenement(R, base_tl);
+ GLOBAL.R_TARDIF = 1;
+ finsi
+ cas 9YU:
+ GLOBAL.PRESENT_9YU = 1;
+ GLOBAL.MONTANT_9YU = champ_evenement(R, montant);
+ GLOBAL.PENALITE_9YU = champ_evenement(R, penalite);
+ GLOBAL.NUM_EVT_9YU = champ_evenement(R, numero);
+ GLOBAL.SENS_9YU = champ_evenement(R, sens);
+ MOIS = vers_mois(champ_evenement(R, montant));
+ ANNEE = vers_annee(champ_evenement(R, montant));
+ CORR.DATEINR = ANNEE * 10000 + MOIS * 100 + 1;
+ GLOBAL.DATEINR = CORR.DATEINR;
+ CORR.MOISAN2 = champ_evenement(R, montant);
+ GLOBAL.MOISAN2 = champ_evenement(R, montant);
+ GLOBAL.DATE_9YU = vers_date(MOIS, ANNEE);
+ )
)
finsi
si
diff --git a/m_ext/2024/cibles.m b/m_ext/2024/cibles.m
index 7a32d22d2..0103f8235 100644
--- a/m_ext/2024/cibles.m
+++ b/m_ext/2024/cibles.m
@@ -1037,7 +1037,7 @@ si nb_discordances() + nb_informatives() > 0 alors
cible enchainement_primitif:
application: iliad;
variables_temporaires: EXPORTE_ERREUR;
-#afficher_erreur "traite_double_liquidation2[\n";
+#afficher_erreur "enchainement_primitif[\n";
calculer cible trace_in;
calculer cible ir_verif_saisie_isf;
finalise_erreurs;
@@ -1053,10 +1053,16 @@ puis_quand nb_anomalies() = 0 faire
calculer cible ir_verif_famille;
finalise_erreurs;
puis_quand nb_anomalies() = 0 faire
- EXPORTE_ERREUR = 1;
-puis_quand nb_discordances() + nb_informatives() = 0 faire
+# EXPORTE_ERREUR = 1;
+#puis_quand nb_discordances() + nb_informatives() = 0 faire
+ calculer cible exporte_si_non_bloquantes;
calculer cible ir_verif_revenu;
finalise_erreurs;
+#puis_quand nb_anomalies() = 0 faire
+# calculer cible exporte_si_non_bloquantes;
+# calculer cible regle_1;
+# calculer cible verif_saisie_cohe_primitive;
+# finalise_erreurs;
puis_quand nb_anomalies() = 0 faire
calculer cible exporte_si_non_bloquantes;
calculer cible ir_calcul_primitif_isf;
@@ -1070,7 +1076,7 @@ puis_quand nb_anomalies() = 0 faire
finsi
finquand
calculer cible trace_out;
-#afficher_erreur "]traite_double_liquidation2\n";
+#afficher_erreur "]enchainement_primitif\n";
# ???
diff --git a/m_ext/2024/codes_1731.m b/m_ext/2024/codes_1731.m
index b3f539b24..96f78cbc8 100644
--- a/m_ext/2024/codes_1731.m
+++ b/m_ext/2024/codes_1731.m
@@ -1,886 +1,670 @@
cible range_base_corr_corrige:
application: iliad;
-si present(GLOBAL.SHBA) alors CORR.SHBA1731 = GLOBAL.SHBA; finsi
-si present(GLOBAL.BANOR) alors CORR.BANOR1731 = GLOBAL.BANOR; finsi
-si present(GLOBAL.INDSEUILBA) alors CORR.INDSEUILBA1731 = GLOBAL.INDSEUILBA; finsi
-si present(GLOBAL.REB) alors CORR.REB1731 = GLOBAL.REB; finsi
-si present(GLOBAL.R1649) alors CORR.R16491731 = GLOBAL.R1649; finsi
-si present(GLOBAL.BAEV) alors CORR.BAEV1731 = GLOBAL.BAEV; finsi
-si present(GLOBAL.BAEMV) alors CORR.BAEMV1731 = GLOBAL.BAEMV; finsi
-si present(GLOBAL.BAEP) alors CORR.BAEP1731 = GLOBAL.BAEP; finsi
-si present(GLOBAL.REVTP) alors CORR.REVTP1731 = GLOBAL.REVTP; finsi
-si present(GLOBAL.BA1) alors CORR.BA11731 = GLOBAL.BA1; finsi
-si present(GLOBAL.REVQTOTQHT) alors CORR.REVQTOTQHT1731 = GLOBAL.REVQTOTQHT; finsi
-si present(GLOBAL.PREREV) alors CORR.PREREV1731 = GLOBAL.PREREV; finsi
-si present(GLOBAL.REPRCM) alors CORR.REPRCM1731 = GLOBAL.REPRCM; finsi
-si present(GLOBAL.REPRCMB) alors CORR.REPRCMB1731 = GLOBAL.REPRCMB; finsi
-si present(GLOBAL.RFREVENU) alors CORR.RFREVENU1731 = GLOBAL.RFREVENU; finsi
-si present(GLOBAL.TSHBA) alors CORR.TSHBA1731 = GLOBAL.TSHBA; finsi
-si present(GLOBAL.DABNCNP1) alors CORR.DABNCNP11731 = GLOBAL.DABNCNP1; finsi
-si present(GLOBAL.DABNCNP2) alors CORR.DABNCNP21731 = GLOBAL.DABNCNP2; finsi
-si present(GLOBAL.DABNCNP3) alors CORR.DABNCNP31731 = GLOBAL.DABNCNP3; finsi
-si present(GLOBAL.DABNCNP4) alors CORR.DABNCNP41731 = GLOBAL.DABNCNP4; finsi
-si present(GLOBAL.DABNCNP5) alors CORR.DABNCNP51731 = GLOBAL.DABNCNP5; finsi
-si present(GLOBAL.DABNCNP6) alors CORR.DABNCNP61731 = GLOBAL.DABNCNP6; finsi
-si present(GLOBAL.DABNCNP) alors CORR.DABNCNP1731 = GLOBAL.DABNCNP; finsi
-si present(GLOBAL.DAGRI1) alors CORR.DAGRI11731 = GLOBAL.DAGRI1; finsi
-si present(GLOBAL.DAGRI2) alors CORR.DAGRI21731 = GLOBAL.DAGRI2; finsi
-si present(GLOBAL.DAGRI3) alors CORR.DAGRI31731 = GLOBAL.DAGRI3; finsi
-si present(GLOBAL.DAGRI4) alors CORR.DAGRI41731 = GLOBAL.DAGRI4; finsi
-si present(GLOBAL.DAGRI5) alors CORR.DAGRI51731 = GLOBAL.DAGRI5; finsi
-si present(GLOBAL.DAGRI6) alors CORR.DAGRI61731 = GLOBAL.DAGRI6; finsi
-si present(GLOBAL.DAGRIIMP) alors CORR.DAGRIIMP1731 = GLOBAL.DAGRIIMP; finsi
-si present(GLOBAL.DAGRI) alors CORR.DAGRI1731 = GLOBAL.DAGRI; finsi
-si present(GLOBAL.DEFAA0) alors CORR.DEFAA01731 = GLOBAL.DEFAA0; finsi
-si present(GLOBAL.DEFAA1) alors CORR.DEFAA11731 = GLOBAL.DEFAA1; finsi
-si present(GLOBAL.DEFAA2) alors CORR.DEFAA21731 = GLOBAL.DEFAA2; finsi
-si present(GLOBAL.DEFAA3) alors CORR.DEFAA31731 = GLOBAL.DEFAA3; finsi
-si present(GLOBAL.DEFAA4) alors CORR.DEFAA41731 = GLOBAL.DEFAA4; finsi
-si present(GLOBAL.DEFAA5) alors CORR.DEFAA51731 = GLOBAL.DEFAA5; finsi
-si present(GLOBAL.DEFBIC1) alors CORR.DEFBIC11731 = GLOBAL.DEFBIC1; finsi
-si present(GLOBAL.DEFBIC2) alors CORR.DEFBIC21731 = GLOBAL.DEFBIC2; finsi
-si present(GLOBAL.DEFBIC3) alors CORR.DEFBIC31731 = GLOBAL.DEFBIC3; finsi
-si present(GLOBAL.DEFBIC4) alors CORR.DEFBIC41731 = GLOBAL.DEFBIC4; finsi
-si present(GLOBAL.DEFBIC5) alors CORR.DEFBIC51731 = GLOBAL.DEFBIC5; finsi
-si present(GLOBAL.DEFBIC6) alors CORR.DEFBIC61731 = GLOBAL.DEFBIC6; finsi
-si present(GLOBAL.DEFRCM) alors CORR.DEFRCM1731 = GLOBAL.DEFRCM; finsi
-si present(GLOBAL.DEFRCM2) alors CORR.DEFRCM21731 = GLOBAL.DEFRCM2; finsi
-si present(GLOBAL.DEFRCM3) alors CORR.DEFRCM31731 = GLOBAL.DEFRCM3; finsi
-si present(GLOBAL.DEFRCM4) alors CORR.DEFRCM41731 = GLOBAL.DEFRCM4; finsi
-si present(GLOBAL.DEFRCM5) alors CORR.DEFRCM51731 = GLOBAL.DEFRCM5; finsi
-si present(GLOBAL.DEFRCM6) alors CORR.DEFRCM61731 = GLOBAL.DEFRCM6; finsi
-si present(GLOBAL.DEFRCMI) alors CORR.DEFRCMI1731 = GLOBAL.DEFRCMI; finsi
-si present(GLOBAL.DEFRFNONIBIS) alors CORR.DEFRFNONI1731 = GLOBAL.DEFRFNONIBIS; finsi
-si present(GLOBAL.DEFZU) alors CORR.DEFZU1731 = GLOBAL.DEFZU; finsi
-si present(GLOBAL.DMOND) alors CORR.DMOND1731 = GLOBAL.DMOND; finsi
-si present(GLOBAL.IPTEFN) alors CORR.IPTEFN1731 = GLOBAL.IPTEFN; finsi
-si present(GLOBAL.RFDORD) alors CORR.RFDORD1731 = GLOBAL.RFDORD; finsi
-si present(GLOBAL.DEFNPI) alors CORR.DEFNPI1731 = GLOBAL.DEFNPI; finsi
-si present(GLOBAL.TDEFNPI) alors CORR.TDEFNPI1731 = GLOBAL.TDEFNPI; finsi
-si present(GLOBAL.DFRCMN) alors CORR.DFRCMN1731 = GLOBAL.DFRCMN; finsi
-si present(GLOBAL.DFRCM1) alors CORR.DFRCM11731 = GLOBAL.DFRCM1; finsi
-si present(GLOBAL.DFRCM2) alors CORR.DFRCM21731 = GLOBAL.DFRCM2; finsi
-si present(GLOBAL.DFRCM3) alors CORR.DFRCM31731 = GLOBAL.DFRCM3; finsi
-si present(GLOBAL.DFRCM4) alors CORR.DFRCM41731 = GLOBAL.DFRCM4; finsi
-si present(GLOBAL.DFRCM5) alors CORR.DFRCM51731 = GLOBAL.DFRCM5; finsi
-si present(GLOBAL.DEFBA) alors CORR.DEFBA1731 = GLOBAL.DEFBA; finsi
-si present(GLOBAL.DLMRNT) alors CORR.DLMRN1731 = GLOBAL.DLMRNT; finsi
-si present(GLOBAL.DLMRN7) alors CORR.DLMRN71731 = GLOBAL.DLMRN7; finsi
-si present(GLOBAL.DEFBA7) alors CORR.DEFBA71731 = GLOBAL.DEFBA7; finsi
-si present(GLOBAL.DEFLOC11) alors CORR.DEFLOC111731 = GLOBAL.DEFLOC11; finsi
-si present(GLOBAL.BNCDF7) alors CORR.BNCDF71731 = GLOBAL.BNCDF7; finsi
-si present(GLOBAL.DEFLOC) alors CORR.DEFLOC1731 = GLOBAL.DEFLOC; finsi
-si present(GLOBAL.BNCDF) alors CORR.BNCDF1731 = GLOBAL.BNCDF; finsi
-si present(GLOBAL.FRDV) alors CORR.FRDV1731 = GLOBAL.FRDV; finsi
-si present(GLOBAL.FRDC) alors CORR.FRDC1731 = GLOBAL.FRDC; finsi
-si present(GLOBAL.FRD1) alors CORR.FRD11731 = GLOBAL.FRD1; finsi
-si present(GLOBAL.FRD2) alors CORR.FRD21731 = GLOBAL.FRD2; finsi
-si present(GLOBAL.FRD3) alors CORR.FRD31731 = GLOBAL.FRD3; finsi
-si present(GLOBAL.FRD4) alors CORR.FRD41731 = GLOBAL.FRD4; finsi
-si present(GLOBAL.RCMFRNET) alors CORR.RCMFRNET1731 = GLOBAL.RCMFRNET; finsi
-si present(GLOBAL.RCMFR) alors CORR.RCMFR1731 = GLOBAL.RCMFR; finsi
-si present(GLOBAL.BICNPF) alors CORR.BICNPF1731 = GLOBAL.BICNPF; finsi
-si present(GLOBAL.RFDANT) alors CORR.RFDANT1731 = GLOBAL.RFDANT; finsi
-si present(GLOBAL.TFRDV) alors CORR.TFRDV1731 = GLOBAL.TFRDV; finsi
-si present(GLOBAL.TFRDC) alors CORR.TFRDC1731 = GLOBAL.TFRDC; finsi
-si present(GLOBAL.TFRD1) alors CORR.TFRD11731 = GLOBAL.TFRD1; finsi
-si present(GLOBAL.TFRD2) alors CORR.TFRD21731 = GLOBAL.TFRD2; finsi
-si present(GLOBAL.TFRD3) alors CORR.TFRD31731 = GLOBAL.TFRD3; finsi
-si present(GLOBAL.TFRD4) alors CORR.TFRD41731 = GLOBAL.TFRD4; finsi
-si present(GLOBAL.RNIDF) alors CORR.RNIDF1731 = GLOBAL.RNIDF; finsi
-si present(GLOBAL.DFBICNPF) alors CORR.DFBICNPF1731 = GLOBAL.DFBICNPF; finsi
-si present(GLOBAL.TDFBICNPF) alors CORR.TDFBICNPF1731 = GLOBAL.TDFBICNPF; finsi
-si present(GLOBAL.DNPLOCIMPU) alors CORR.DNPLOCIMPU1731 = GLOBAL.DNPLOCIMPU; finsi
-si present(GLOBAL.DEFBNCNP) alors CORR.DEFBNCNP1731 = GLOBAL.DEFBNCNP; finsi
-si present(GLOBAL.TDEFBNCNP) alors CORR.TDEFBNCNP1731 = GLOBAL.TDEFBNCNP; finsi
-si present(GLOBAL.DIDABNCNP1) alors CORR.DIDABNCNP11731 = GLOBAL.DIDABNCNP1; finsi
-si present(GLOBAL.TDIDABNCNP1) alors CORR.TDIDABNCNP11731 = GLOBAL.TDIDABNCNP1; finsi
-si present(GLOBAL.DEFBANI) alors CORR.DEFBANI1731 = GLOBAL.DEFBANI; finsi
-si present(GLOBAL.DEFBANI470) alors CORR.DEFBANI4701731 = GLOBAL.DEFBANI470; finsi
-si present(GLOBAL.DEFBANI470BIS) alors CORR.DEFBANI470BIS1731 = GLOBAL.DEFBANI470BIS; finsi
-si present(GLOBAL.DEFBANIH470) alors CORR.DEFBANIH4701731 = GLOBAL.DEFBANIH470; finsi
-si present(GLOBAL.DEFBNCNP470) alors CORR.DEFBNCNP4701731 = GLOBAL.DEFBNCNP470; finsi
-si present(GLOBAL.DEFBNCNPH470) alors CORR.DEFBNCNPH4701731 = GLOBAL.DEFBNCNPH470; finsi
-si present(GLOBAL.DEFBICNP470) alors CORR.DEFBICNP4701731 = GLOBAL.DEFBICNP470; finsi
-si present(GLOBAL.DEFBICNPH470) alors CORR.DEFBICNPH4701731 = GLOBAL.DEFBICNPH470; finsi
-si present(GLOBAL.TDEFBANI) alors CORR.TDEFBANI1731 = GLOBAL.TDEFBANI; finsi
-si present(GLOBAL.SFDEFBANI) alors CORR.SFDEFBANI1731 = GLOBAL.SFDEFBANI; finsi
-si present(GLOBAL.SFDEFBANI470) alors CORR.SFDEFBANI4701731 = GLOBAL.SFDEFBANI470; finsi
-si present(GLOBAL.SFDEFBANIH470) alors CORR.SFDEFBANIH4701731 = GLOBAL.SFDEFBANIH470; finsi
-si present(GLOBAL.DEFLOCNP) alors CORR.DEFLOCNP1731 = GLOBAL.DEFLOCNP; finsi
-si present(GLOBAL.DEFLOCNPBIS) alors CORR.BIDON1731 = GLOBAL.DEFLOCNPBIS; finsi
-si present(GLOBAL.BRCMBISB) alors CORR.BRCMBISB1731 = GLOBAL.BRCMBISB; finsi
-si present(GLOBAL.BRCMBISQ) alors CORR.BRCMBISQ1731 = GLOBAL.BRCMBISQ; finsi
-si present(GLOBAL.BRCMBIS) alors CORR.BRCM1731 = GLOBAL.BRCMBIS; finsi
-si present(GLOBAL.BRCMQ) alors CORR.BRCMQ1731 = GLOBAL.BRCMQ; finsi
-si present(GLOBAL.DEF4BB) alors CORR.DEF4BB1731 = GLOBAL.DEF4BB; finsi
-si present(GLOBAL.DEF4BD) alors CORR.DEF4BD1731 = GLOBAL.DEF4BD; finsi
-si present(GLOBAL.DEF4BC) alors CORR.DEF4BC1731 = GLOBAL.DEF4BC; finsi
-si present(GLOBAL.TOTALQUO) alors CORR.TOTALQUO1731 = GLOBAL.TOTALQUO; finsi
-si present(GLOBAL.SPENETPV) alors CORR.SPENETPV1731 = GLOBAL.SPENETPV; finsi
-si present(GLOBAL.SPENETPC) alors CORR.SPENETPC1731 = GLOBAL.SPENETPC; finsi
-si present(GLOBAL.SPENETPP) alors CORR.SPENETPP1731 = GLOBAL.SPENETPP; finsi
-si present(GLOBAL.BNCPROPVV) alors CORR.BNCPROPVV1731 = GLOBAL.BNCPROPVV; finsi
-si present(GLOBAL.BNCPROPVC) alors CORR.BNCPROPVC1731 = GLOBAL.BNCPROPVC; finsi
-si present(GLOBAL.BNCPROPVP) alors CORR.BNCPROPVP1731 = GLOBAL.BNCPROPVP; finsi
-si present(GLOBAL.MIBRNETV) alors CORR.MIBRNETV1731 = GLOBAL.MIBRNETV; finsi
-si present(GLOBAL.MIBRNETC) alors CORR.MIBRNETC1731 = GLOBAL.MIBRNETC; finsi
-si present(GLOBAL.MIBRNETP) alors CORR.MIBRNETP1731 = GLOBAL.MIBRNETP; finsi
-si present(GLOBAL.MIBPVV) alors CORR.MIBPVV1731 = GLOBAL.MIBPVV; finsi
-si present(GLOBAL.MIBPVC) alors CORR.MIBPVC1731 = GLOBAL.MIBPVC; finsi
-si present(GLOBAL.MIBPVP) alors CORR.MIBPVP1731 = GLOBAL.MIBPVP; finsi
-si present(GLOBAL.DFANTPROV) alors CORR.DFANTPROV1731 = GLOBAL.DFANTPROV; finsi
-si present(GLOBAL.SFDFANTPROV) alors CORR.SFDFANTPROV1731 = GLOBAL.SFDFANTPROV; finsi
-si present(GLOBAL.TDFANTPROV) alors CORR.TDFANTPROV1731 = GLOBAL.TDFANTPROV; finsi
-si present(GLOBAL.TTSPRT) alors CORR.TTSPRT1731 = GLOBAL.TTSPRT; finsi
-si present(GLOBAL.TSPRT) alors CORR.TSPRT1731 = GLOBAL.TSPRT; finsi
-si present(GLOBAL.TSPRV) alors CORR.TSPRV1731 = GLOBAL.TSPRV; finsi
-si present(GLOBAL.TSPRC) alors CORR.TSPRC1731 = GLOBAL.TSPRC; finsi
-si present(GLOBAL.TSPRP) alors CORR.TSPRP1731 = GLOBAL.TSPRP; finsi
-si present(GLOBAL.TTSPRV) alors CORR.TTSPRV1731 = GLOBAL.TTSPRV; finsi
-si present(GLOBAL.TTSPRC) alors CORR.TTSPRC1731 = GLOBAL.TTSPRC; finsi
-si present(GLOBAL.TTSPRP) alors CORR.TTSPRP1731 = GLOBAL.TTSPRP; finsi
-si present(GLOBAL.SOMMEBA) alors CORR.SOMMEBA1731 = GLOBAL.SOMMEBA; finsi
-si present(GLOBAL.SOMMEBIC) alors CORR.SOMMEBIC1731 = GLOBAL.SOMMEBIC; finsi
-si present(GLOBAL.SOMMELOC) alors CORR.SOMMELOC1731 = GLOBAL.SOMMELOC; finsi
-si present(GLOBAL.SOMMEBNC) alors CORR.SOMMEBNC1731 = GLOBAL.SOMMEBNC; finsi
-si present(GLOBAL.SOMMERF) alors CORR.SOMMERF1731 = GLOBAL.SOMMERF; finsi
-si present(GLOBAL.SOMMERCM) alors CORR.SOMMERCM1731 = GLOBAL.SOMMERCM; finsi
-si present(GLOBAL.TSBV) alors CORR.TSBV1731 = GLOBAL.TSBV; finsi
-si present(GLOBAL.TSBC) alors CORR.TSBC1731 = GLOBAL.TSBC; finsi
-si present(GLOBAL.TSB1) alors CORR.TSB11731 = GLOBAL.TSB1; finsi
-si present(GLOBAL.TSB2) alors CORR.TSB21731 = GLOBAL.TSB2; finsi
-si present(GLOBAL.TSB3) alors CORR.TSB31731 = GLOBAL.TSB3; finsi
-si present(GLOBAL.TSB4) alors CORR.TSB41731 = GLOBAL.TSB4; finsi
-si present(GLOBAL.TSBP) alors CORR.TSBP1731 = GLOBAL.TSBP; finsi
-si present(GLOBAL.SOMDEFLOC) alors CORR.DEFLOC1731 = GLOBAL.SOMDEFLOC; finsi
-si present(GLOBAL.SOMBICDF) alors CORR.SOMBICDF1731 = GLOBAL.SOMBICDF; finsi
-si present(GLOBAL.SOMLOCDF) alors CORR.SOMLOCDF1731 = GLOBAL.SOMLOCDF; finsi
-si present(GLOBAL.SOMBADF) alors CORR.SOMBADF1731 = GLOBAL.SOMBADF; finsi
-si present(GLOBAL.SOMBNCDF) alors CORR.SOMBNCDF1731 = GLOBAL.SOMBNCDF; finsi
-si present(GLOBAL.RIDEFRI) alors CORR.RIDEFRI1731 = GLOBAL.RIDEFRI; finsi
-si present(GLOBAL.RDOMSOC1) alors CORR.RDOMSOC11731 = GLOBAL.RDOMSOC1; finsi
-si present(GLOBAL.RLOGSOC) alors CORR.RLOGSOC1731 = GLOBAL.RLOGSOC; finsi
-si present(GLOBAL.RCOLENT) alors CORR.RCOLENT1731 = GLOBAL.RCOLENT; finsi
-si present(GLOBAL.RLOCENT_1) alors CORR.RLOCENT1731 = GLOBAL.RLOCENT_1; finsi
-si present(GLOBAL.COD2TT) alors CORR.COD2TT1731 = GLOBAL.COD2TT; finsi
-si present(GLOBAL.RCM1) alors CORR.RCM1731 = GLOBAL.RCM1; finsi
-si present(GLOBAL.RRIREP_1) alors CORR.RRIREP1731 = GLOBAL.RRIREP_1; finsi
-si present(GLOBAL.BSURV) alors CORR.BSURV1731 = GLOBAL.BSURV; finsi
-si present(GLOBAL.DEFIBA) alors CORR.DEFIBA1731 = GLOBAL.DEFIBA; finsi
-si present(GLOBAL.DBAIP) alors CORR.DBAIP1731 = GLOBAL.DBAIP; finsi
-si present(GLOBAL.LOCNPCF) alors CORR.LOCNPCF1731 = GLOBAL.LOCNPCF; finsi
-si present(GLOBAL.NPLOCNETBIS) alors CORR.NPLOCNETBIS1731 = GLOBAL.NPLOCNETBIS; finsi
-si present(GLOBAL.SOMDLOC) alors CORR.SOMDLOC1731 = GLOBAL.SOMDLOC; finsi
-si present(GLOBAL.BICIFBIS) alors CORR.BICIFBIS1731 = GLOBAL.BICIFBIS; finsi
-si present(GLOBAL.SOMDBIC) alors CORR.SOMDBIC1731 = GLOBAL.SOMDBIC; finsi
-si present(GLOBAL.BICPROOF) alors CORR.BICPROOF1731 = GLOBAL.BICPROOF; finsi
-si present(GLOBAL.BICPROQF) alors CORR.BICPROQF1731 = GLOBAL.BICPROQF; finsi
-si present(GLOBAL.BICNPOCF) alors CORR.BICNPOCF1731 = GLOBAL.BICNPOCF; finsi
-si present(GLOBAL.BICNPQCF) alors CORR.BICNPQCF1731 = GLOBAL.BICNPQCF; finsi
-si present(GLOBAL.BACIFBIS) alors CORR.BACIFBIS1731 = GLOBAL.BACIFBIS; finsi
-si present(GLOBAL.BAHQNODEFF) alors CORR.BAHQNODEFF1731 = GLOBAL.BAHQNODEFF; finsi
-si present(GLOBAL.BAQNODEFF) alors CORR.BAQNODEFF1731 = GLOBAL.BAQNODEFF; finsi
-si present(GLOBAL.BNCNPHQCF) alors CORR.BNCNPHQCF1731 = GLOBAL.BNCNPHQCF; finsi
-si present(GLOBAL.BNCNPQCF) alors CORR.BNCNPQCF1731 = GLOBAL.BNCNPQCF; finsi
-si present(GLOBAL.BNCPHQCF) alors CORR.BNCPHQCF1731 = GLOBAL.BNCPHQCF; finsi
-si present(GLOBAL.BNCPQCF) alors CORR.BNCPQCF1731 = GLOBAL.BNCPQCF; finsi
-si present(GLOBAL.RRBGPROV) alors CORR.RRBGPROV1731 = GLOBAL.RRBGPROV; finsi
-si present(GLOBAL.DRCF) alors CORR.DRCF1731 = GLOBAL.DRCF; finsi
-si present(GLOBAL.RFCE) alors CORR.RFCE1731 = GLOBAL.RFCE; finsi
-si present(GLOBAL.RFCF) alors CORR.RFCF1731 = GLOBAL.RFCF; finsi
-si present(GLOBAL.RFCD) alors CORR.RFCD1731 = GLOBAL.RFCD; finsi
-si present(GLOBAL.DFCG) alors CORR.DFCG1731 = GLOBAL.DFCG; finsi
-si present(GLOBAL.DFCE) alors CORR.DFCE1731 = GLOBAL.DFCE; finsi
-si present(GLOBAL.RFCG) alors CORR.RFCG1731 = GLOBAL.RFCG; finsi
-si present(GLOBAL.RFON) alors CORR.RFON1731 = GLOBAL.RFON; finsi
-si present(GLOBAL.RMF) alors CORR.RMF1731 = GLOBAL.RMF; finsi
-si present(GLOBAL.SOMDBNC) alors CORR.SOMDBNC1731 = GLOBAL.SOMDBNC; finsi
-si present(GLOBAL.BNCIFBIS) alors CORR.BNCIFBIS1731 = GLOBAL.BNCIFBIS; finsi
-si present(GLOBAL.RED_1) alors CORR.RED1731 = GLOBAL.RED_1; finsi
-si present(GLOBAL.MLOCNET) alors CORR.MLOCNET1731 = GLOBAL.MLOCNET; finsi
-si present(GLOBAL.NPLOCNETV) alors CORR.NPLOCNETV1731 = GLOBAL.NPLOCNETV; finsi
-si present(GLOBAL.NPLOCNETC) alors CORR.NPLOCNETC1731 = GLOBAL.NPLOCNETC; finsi
-si present(GLOBAL.NPLOCNETPAC) alors CORR.NPLOCNETPAC1731 = GLOBAL.NPLOCNETPAC; finsi
-si present(GLOBAL.RGPROV) alors CORR.RGPROV1731 = GLOBAL.RGPROV; finsi
-si present(GLOBAL.REVDON) alors CORR.REVDON1731 = GLOBAL.REVDON; finsi
-si present(GLOBAL.DRFRP) alors CORR.DRFRP1731 = GLOBAL.DRFRP; finsi
-si present(GLOBAL.RDONIFI_1) alors CORR.RDONIFI11731 = GLOBAL.RDONIFI_1; finsi
-si present(GLOBAL.RDONIFI2_1) alors CORR.RDONIFI21731 = GLOBAL.RDONIFI2_1; finsi
-si present(GLOBAL.IFIACT) alors CORR.IFIACT1731 = GLOBAL.IFIACT; finsi
-si present(GLOBAL.AREHAB_1) alors CORR.AREHAB1731 = GLOBAL.AREHAB_1; finsi
-si present(GLOBAL.APRESSE_1) alors CORR.APRESSE1731 = GLOBAL.APRESSE_1; finsi
-si present(GLOBAL.AFORET_1) alors CORR.AFORET1731 = GLOBAL.AFORET_1; finsi
-si present(GLOBAL.AFIPDOM_1) alors CORR.AFIPDOM1731 = GLOBAL.AFIPDOM_1; finsi
-si present(GLOBAL.AFIPC_1) alors CORR.AFIPC1731 = GLOBAL.AFIPC_1; finsi
+si present(GLOBAL.A10RFOR_1) alors CORR.A10RFOR1731 = GLOBAL.A10RFOR_1; finsi
+si present(GLOBAL.ACELP1A_1) alors CORR.ACELP1A1731 = GLOBAL.ACELP1A_1; finsi
+si present(GLOBAL.ACELP1B_1) alors CORR.ACELP1B1731 = GLOBAL.ACELP1B_1; finsi
+si present(GLOBAL.ACELP1C_1) alors CORR.ACELP1C1731 = GLOBAL.ACELP1C_1; finsi
+si present(GLOBAL.ACELP1D_1) alors CORR.ACELP1D1731 = GLOBAL.ACELP1D_1; finsi
+si present(GLOBAL.ACELP1E_1) alors CORR.ACELP1E1731 = GLOBAL.ACELP1E_1; finsi
+si present(GLOBAL.ACELP2A_1) alors CORR.ACELP2A1731 = GLOBAL.ACELP2A_1; finsi
+si present(GLOBAL.ACELP2B_1) alors CORR.ACELP2B1731 = GLOBAL.ACELP2B_1; finsi
+si present(GLOBAL.ACELP2C_1) alors CORR.ACELP2C1731 = GLOBAL.ACELP2C_1; finsi
+si present(GLOBAL.ACELP2D_1) alors CORR.ACELP2D1731 = GLOBAL.ACELP2D_1; finsi
+si present(GLOBAL.ACELP2E_1) alors CORR.ACELP2E1731 = GLOBAL.ACELP2E_1; finsi
+si present(GLOBAL.ACELREPWT_1) alors CORR.ACELREPWT1731 = GLOBAL.ACELREPWT_1; finsi
+si present(GLOBAL.ACELREPWU_1) alors CORR.ACELREPWU1731 = GLOBAL.ACELREPWU_1; finsi
+si present(GLOBAL.ACELREPWV_1) alors CORR.ACELREPWV1731 = GLOBAL.ACELREPWV_1; finsi
+si present(GLOBAL.ACELREPWW_1) alors CORR.ACELREPWW1731 = GLOBAL.ACELREPWW_1; finsi
+si present(GLOBAL.ACELRT_1) alors CORR.ACELRT1731 = GLOBAL.ACELRT_1; finsi
+si present(GLOBAL.ACELRU_1) alors CORR.ACELRU1731 = GLOBAL.ACELRU_1; finsi
si present(GLOBAL.ACINE_1) alors CORR.ACINE1731 = GLOBAL.ACINE_1; finsi
-si present(GLOBAL.ASOUFIP_1) alors CORR.ASOUFIP1731 = GLOBAL.ASOUFIP_1; finsi
-si present(GLOBAL.BRENOV) alors CORR.BRENOV1731 = GLOBAL.BRENOV; finsi
+si present(GLOBAL.ACODJTJU_1) alors CORR.ACODJTJU1731 = GLOBAL.ACODJTJU_1; finsi
+si present(GLOBAL.ACODMN_1) alors CORR.ACODMN1731 = GLOBAL.ACODMN_1; finsi
+si present(GLOBAL.ACODMW_1) alors CORR.ACODMW1731 = GLOBAL.ACODMW_1; finsi
+si present(GLOBAL.ACODMZ_1) alors CORR.ACODMZ1731 = GLOBAL.ACODMZ_1; finsi
+si present(GLOBAL.ACODOU_1) alors CORR.ACODOU1731 = GLOBAL.ACODOU_1; finsi
+si present(GLOBAL.ACODOY_1) alors CORR.ACODOY1731 = GLOBAL.ACODOY_1; finsi
+si present(GLOBAL.ACODPZ_1) alors CORR.ACODPZ1731 = GLOBAL.ACODPZ_1; finsi
+si present(GLOBAL.ACOLENT_1) alors CORR.ACOLENT1731 = GLOBAL.ACOLENT_1; finsi
si present(GLOBAL.ACOMP_1) alors CORR.ACOMP1731 = GLOBAL.ACOMP_1; finsi
+si present(GLOBAL.ADOMSOC1_1) alors CORR.ADOMSOC11731 = GLOBAL.ADOMSOC1_1; finsi
+si present(GLOBAL.ADONS_1) alors CORR.ADONS1731 = GLOBAL.ADONS_1; finsi
+si present(GLOBAL.ADUFREPFU_1) alors CORR.ADUFREPFU1731 = GLOBAL.ADUFREPFU_1; finsi
si present(GLOBAL.ADUFREPFV_1) alors CORR.ADUFREPFV1731 = GLOBAL.ADUFREPFV_1; finsi
si present(GLOBAL.ADUFREPFW_1) alors CORR.ADUFREPFW1731 = GLOBAL.ADUFREPFW_1; finsi
si present(GLOBAL.ADUFREPFX_1) alors CORR.ADUFREPFX1731 = GLOBAL.ADUFREPFX_1; finsi
-si present(GLOBAL.ADUFREPFU_1) alors CORR.ADUFREPFU1731 = GLOBAL.ADUFREPFU_1; finsi
-si present(GLOBAL.APIREPRZ_1) alors CORR.APIREPRZ1731 = GLOBAL.APIREPRZ_1; finsi
-si present(GLOBAL.APIREPTZ_1) alors CORR.APIREPTZ1731 = GLOBAL.APIREPTZ_1; finsi
-si present(GLOBAL.APIREPRB_1) alors CORR.APIREPRB1731 = GLOBAL.APIREPRB_1; finsi
-si present(GLOBAL.APIREPRD_1) alors CORR.APIREPRD1731 = GLOBAL.APIREPRD_1; finsi
-si present(GLOBAL.APIREPRF_1) alors CORR.APIREPRF1731 = GLOBAL.APIREPRF_1; finsi
-si present(GLOBAL.APIREPRH_1) alors CORR.APIREPRH1731 = GLOBAL.APIREPRH_1; finsi
-si present(GLOBAL.APIREPJM_1) alors CORR.APIREPJM1731 = GLOBAL.APIREPJM_1; finsi
-si present(GLOBAL.APIREPKM_1) alors CORR.APIREPKM1731 = GLOBAL.APIREPKM_1; finsi
-si present(GLOBAL.APIREPLM_1) alors CORR.APIREPLM1731 = GLOBAL.APIREPLM_1; finsi
-si present(GLOBAL.APIREPMM_1) alors CORR.APIREPMM1731 = GLOBAL.APIREPMM_1; finsi
-si present(GLOBAL.ANORMJA_1) alors CORR.ANORMJA1731 = GLOBAL.ANORMJA_1; finsi
-si present(GLOBAL.ANORMJB_1) alors CORR.ANORMJB1731 = GLOBAL.ANORMJB_1; finsi
-si present(GLOBAL.ANORMJC_1) alors CORR.ANORMJC1731 = GLOBAL.ANORMJC_1; finsi
-si present(GLOBAL.ANORMJD_1) alors CORR.ANORMJD1731 = GLOBAL.ANORMJD_1; finsi
-si present(GLOBAL.ACELREPWW_1) alors CORR.ACELREPWW1731 = GLOBAL.ACELREPWW_1; finsi
-si present(GLOBAL.ACELREPWV_1) alors CORR.ACELREPWV1731 = GLOBAL.ACELREPWV_1; finsi
-si present(GLOBAL.ACELREPWU_1) alors CORR.ACELREPWU1731 = GLOBAL.ACELREPWU_1; finsi
-si present(GLOBAL.ACELREPWT_1) alors CORR.ACELREPWT1731 = GLOBAL.ACELREPWT_1; finsi
-si present(GLOBAL.ACELRU_1) alors CORR.ACELRU1731 = GLOBAL.ACELRU_1; finsi
-si present(GLOBAL.ACELRT_1) alors CORR.ACELRT1731 = GLOBAL.ACELRT_1; finsi
-si present(GLOBAL.ATOUREPA_1) alors CORR.ATOUREPA1731 = GLOBAL.ATOUREPA_1; finsi
-si present(GLOBAL.BAH) alors CORR.BAH1731 = GLOBAL.BAH; finsi
-si present(GLOBAL.BAALIM) alors CORR.BAALIM1731 = GLOBAL.BAALIM; finsi
-si present(GLOBAL.BSN1) alors CORR.BSN11731 = GLOBAL.BSN1; finsi
-si present(GLOBAL.BSN2) alors CORR.BSN21731 = GLOBAL.BSN2; finsi
-si present(GLOBAL.APENTCY_1) alors CORR.APENTCY1731 = GLOBAL.APENTCY_1; finsi
-si present(GLOBAL.APENTDY_1) alors CORR.APENTDY1731 = GLOBAL.APENTDY_1; finsi
-si present(GLOBAL.APENTEY_1) alors CORR.APENTEY1731 = GLOBAL.APENTEY_1; finsi
-si present(GLOBAL.APENTFY_1) alors CORR.APENTFY1731 = GLOBAL.APENTFY_1; finsi
-si present(GLOBAL.APENTGY_1) alors CORR.APENTGY1731 = GLOBAL.APENTGY_1; finsi
-si present(GLOBAL.APENTEK_1) alors CORR.APENTEK1731 = GLOBAL.APENTEK_1; finsi
-si present(GLOBAL.ASOFON_1) alors CORR.ASOFON1731 = GLOBAL.ASOFON_1; finsi
-si present(GLOBAL.AILMPF_1) alors CORR.AILMPF1731 = GLOBAL.AILMPF_1; finsi
+si present(GLOBAL.AFIPC_1) alors CORR.AFIPC1731 = GLOBAL.AFIPC_1; finsi
+si present(GLOBAL.AFIPDOM_1) alors CORR.AFIPDOM1731 = GLOBAL.AFIPDOM_1; finsi
+si present(GLOBAL.AFORET_1) alors CORR.AFORET1731 = GLOBAL.AFORET_1; finsi
+si present(GLOBAL.AILMHD_1) alors CORR.AILMHD1731 = GLOBAL.AILMHD_1; finsi
+si present(GLOBAL.AILMHE_1) alors CORR.AILMHE1731 = GLOBAL.AILMHE_1; finsi
+si present(GLOBAL.AILMHF_1) alors CORR.AILMHF1731 = GLOBAL.AILMHF_1; finsi
+si present(GLOBAL.AILMHG_1) alors CORR.AILMHG1731 = GLOBAL.AILMHG_1; finsi
+si present(GLOBAL.AILMHH_1) alors CORR.AILMHH1731 = GLOBAL.AILMHH_1; finsi
si present(GLOBAL.AILMHO_1) alors CORR.AILMHO1731 = GLOBAL.AILMHO_1; finsi
-si present(GLOBAL.AILMHT_1) alors CORR.AILMHT1731 = GLOBAL.AILMHT_1; finsi
-si present(GLOBAL.AILMPG_1) alors CORR.AILMPG1731 = GLOBAL.AILMPG_1; finsi
si present(GLOBAL.AILMHP_1) alors CORR.AILMHP1731 = GLOBAL.AILMHP_1; finsi
-si present(GLOBAL.AILMHU_1) alors CORR.AILMHU1731 = GLOBAL.AILMHU_1; finsi
-si present(GLOBAL.AILMPH_1) alors CORR.AILMPH1731 = GLOBAL.AILMPH_1; finsi
si present(GLOBAL.AILMHQ_1) alors CORR.AILMHQ1731 = GLOBAL.AILMHQ_1; finsi
-si present(GLOBAL.AILMHV_1) alors CORR.AILMHV1731 = GLOBAL.AILMHV_1; finsi
-si present(GLOBAL.AILMPI_1) alors CORR.AILMPI1731 = GLOBAL.AILMPI_1; finsi
si present(GLOBAL.AILMHR_1) alors CORR.AILMHR1731 = GLOBAL.AILMHR_1; finsi
-si present(GLOBAL.AILMHW_1) alors CORR.AILMHW1731 = GLOBAL.AILMHW_1; finsi
-si present(GLOBAL.AILMPJ_1) alors CORR.AILMPJ1731 = GLOBAL.AILMPJ_1; finsi
si present(GLOBAL.AILMHS_1) alors CORR.AILMHS1731 = GLOBAL.AILMHS_1; finsi
-si present(GLOBAL.AILMHX_1) alors CORR.AILMHX1731 = GLOBAL.AILMHX_1; finsi
-si present(GLOBAL.AILMJY_1) alors CORR.AILMJY1731 = GLOBAL.AILMJY_1; finsi
-si present(GLOBAL.AILMJX_1) alors CORR.AILMJX1731 = GLOBAL.AILMJX_1; finsi
-si present(GLOBAL.AILMJW_1) alors CORR.AILMJW1731 = GLOBAL.AILMJW_1; finsi
-si present(GLOBAL.AILMJV_1) alors CORR.AILMJV1731 = GLOBAL.AILMJV_1; finsi
-si present(GLOBAL.AILMOT_1) alors CORR.AILMOT1731 = GLOBAL.AILMOT_1; finsi
-si present(GLOBAL.AILMOS_1) alors CORR.AILMOS1731 = GLOBAL.AILMOS_1; finsi
-si present(GLOBAL.AILMOR_1) alors CORR.AILMOR1731 = GLOBAL.AILMOR_1; finsi
-si present(GLOBAL.AILMOQ_1) alors CORR.AILMOQ1731 = GLOBAL.AILMOQ_1; finsi
-si present(GLOBAL.AILMOP_1) alors CORR.AILMOP1731 = GLOBAL.AILMOP_1; finsi
-si present(GLOBAL.AILMSA_1) alors CORR.AILMSA1731 = GLOBAL.AILMSA_1; finsi
-si present(GLOBAL.AILMSB_1) alors CORR.AILMSB1731 = GLOBAL.AILMSB_1; finsi
-si present(GLOBAL.AILMSC_1) alors CORR.AILMSC1731 = GLOBAL.AILMSC_1; finsi
-si present(GLOBAL.AILMSN_1) alors CORR.AILMSN1731 = GLOBAL.AILMSN_1; finsi
-si present(GLOBAL.AILMSO_1) alors CORR.AILMSO1731 = GLOBAL.AILMSO_1; finsi
-si present(GLOBAL.AILMSP_1) alors CORR.AILMSP1731 = GLOBAL.AILMSP_1; finsi
-si present(GLOBAL.ACODMZ_1) alors CORR.ACODMZ1731 = GLOBAL.ACODMZ_1; finsi
-si present(GLOBAL.ACODPZ_1) alors CORR.ACODPZ1731 = GLOBAL.ACODPZ_1; finsi
-si present(GLOBAL.ACODOY_1) alors CORR.ACODOY1731 = GLOBAL.ACODOY_1; finsi
-si present(GLOBAL.ACODOU_1) alors CORR.ACODOU1731 = GLOBAL.ACODOU_1; finsi
-si present(GLOBAL.ACODJTJU_1) alors CORR.ACODJTJU1731 = GLOBAL.ACODJTJU_1; finsi
-si present(GLOBAL.BSOCREP) alors CORR.BSOCREP1731 = GLOBAL.BSOCREP; finsi
-si present(GLOBAL.ARESTIMO_1) alors CORR.ARESTIMO1731 = GLOBAL.ARESTIMO_1; finsi
-si present(GLOBAL.ARESTIMO1_1) alors CORR.ARESTIMO11731 = GLOBAL.ARESTIMO1_1; finsi
-si present(GLOBAL.ADONS_1) alors CORR.ADONS1731 = GLOBAL.ADONS_1; finsi
-si present(GLOBAL.BPRESCOMP) alors CORR.BPRESCOMP1731 = GLOBAL.BPRESCOMP; finsi
-si present(GLOBAL.BDIFAGRI) alors CORR.BDIFAGRI1731 = GLOBAL.BDIFAGRI; finsi
-si present(GLOBAL.ALOGDOM_1) alors CORR.ALOGDOM1731 = GLOBAL.ALOGDOM_1; finsi
-si present(GLOBAL.RLOGDOM) alors CORR.RLOGDOM1731 = GLOBAL.RLOGDOM; finsi
-si present(GLOBAL.ALOGSOC_1) alors CORR.ALOGSOC1731 = GLOBAL.ALOGSOC_1; finsi
-si present(GLOBAL.ADOMSOC1_1) alors CORR.ADOMSOC11731 = GLOBAL.ADOMSOC1_1; finsi
-si present(GLOBAL.ALOCENT_1) alors CORR.ALOCENT1731 = GLOBAL.ALOCENT_1; finsi
-si present(GLOBAL.ACOLENT_1) alors CORR.ACOLENT1731 = GLOBAL.ACOLENT_1; finsi
-si present(GLOBAL.RPRESSE_1) alors CORR.RPRESSE1731 = GLOBAL.RPRESSE_1; finsi
-si present(GLOBAL.RFORET_1) alors CORR.RFORET1731 = GLOBAL.RFORET_1; finsi
-si present(GLOBAL.RFIPDOM_1) alors CORR.RFIPDOM1731 = GLOBAL.RFIPDOM_1; finsi
-si present(GLOBAL.RFIPC_1) alors CORR.RFIPC1731 = GLOBAL.RFIPC_1; finsi
-si present(GLOBAL.RSURV_1) alors CORR.RSURV1731 = GLOBAL.RSURV_1; finsi
-si present(GLOBAL.RCINE_1) alors CORR.RCINE1731 = GLOBAL.RCINE_1; finsi
-si present(GLOBAL.RSOUFIP_1) alors CORR.RSOUFIP1731 = GLOBAL.RSOUFIP_1; finsi
-si present(GLOBAL.RRIRENOV_1) alors CORR.RRIRENOV1731 = GLOBAL.RRIRENOV_1; finsi
-si present(GLOBAL.RCOMP_1) alors CORR.RCOMP1731 = GLOBAL.RCOMP_1; finsi
-si present(GLOBAL.RDUFREP_1) alors CORR.RDUFREP1731 = GLOBAL.RDUFREP_1; finsi
-si present(GLOBAL.RPIREPRZ_1) alors CORR.RPIREPRZ1731 = GLOBAL.RPIREPRZ_1; finsi
-si present(GLOBAL.RPIREPTZ_1) alors CORR.RPIREPTZ1731 = GLOBAL.RPIREPTZ_1; finsi
-si present(GLOBAL.RPIREPRB_1) alors CORR.RPIREPRB1731 = GLOBAL.RPIREPRB_1; finsi
-si present(GLOBAL.RPIREPRD_1) alors CORR.RPIREPRD1731 = GLOBAL.RPIREPRD_1; finsi
-si present(GLOBAL.RPIREPRF_1) alors CORR.RPIREPRF1731 = GLOBAL.RPIREPRF_1; finsi
-si present(GLOBAL.RPIREPRH_1) alors CORR.RPIREPRH1731 = GLOBAL.RPIREPRH_1; finsi
-si present(GLOBAL.RPIREPJM_1) alors CORR.RPIREPJM1731 = GLOBAL.RPIREPJM_1; finsi
-si present(GLOBAL.RNORMJA_1) alors CORR.RNORMJA1731 = GLOBAL.RNORMJA_1; finsi
-si present(GLOBAL.RPIREPKM_1) alors CORR.RPIREPKM1731 = GLOBAL.RPIREPKM_1; finsi
-si present(GLOBAL.RNORMJB_1) alors CORR.RNORMJB1731 = GLOBAL.RNORMJB_1; finsi
-si present(GLOBAL.RPIREPLM_1) alors CORR.RPIREPLM1731 = GLOBAL.RPIREPLM_1; finsi
-si present(GLOBAL.RNORMJC_1) alors CORR.RNORMJC1731 = GLOBAL.RNORMJC_1; finsi
-si present(GLOBAL.RPIREPMM_1) alors CORR.RPIREPMM1731 = GLOBAL.RPIREPMM_1; finsi
-si present(GLOBAL.RNORMJD_1) alors CORR.RNORMJD1731 = GLOBAL.RNORMJD_1; finsi
-si present(GLOBAL.RPIVW_1) alors CORR.RPIVW1731 = GLOBAL.RPIVW_1; finsi
-si present(GLOBAL.RPIVX_1) alors CORR.RPIVX1731 = GLOBAL.RPIVX_1; finsi
-si present(GLOBAL.RPIVY_1) alors CORR.RPIVY1731 = GLOBAL.RPIVY_1; finsi
-si present(GLOBAL.RPIVZ_1) alors CORR.RPIVZ1731 = GLOBAL.RPIVZ_1; finsi
-si present(GLOBAL.RPISD_1) alors CORR.RPISD1731 = GLOBAL.RPISD_1; finsi
-si present(GLOBAL.RPISE_1) alors CORR.RPISE1731 = GLOBAL.RPISE_1; finsi
-si present(GLOBAL.RPISF_1) alors CORR.RPISF1731 = GLOBAL.RPISF_1; finsi
-si present(GLOBAL.RPISG_1) alors CORR.RPISG1731 = GLOBAL.RPISG_1; finsi
-si present(GLOBAL.RPIVD_1) alors CORR.RPIVD1731 = GLOBAL.RPIVD_1; finsi
-si present(GLOBAL.RPIVE_1) alors CORR.RPIVE1731 = GLOBAL.RPIVE_1; finsi
-si present(GLOBAL.RPIVF_1) alors CORR.RPIVF1731 = GLOBAL.RPIVF_1; finsi
-si present(GLOBAL.RPIVG_1) alors CORR.RPIVG1731 = GLOBAL.RPIVG_1; finsi
-si present(GLOBAL.RPIQR_1) alors CORR.RPIQR1731 = GLOBAL.RPIQR_1; finsi
-si present(GLOBAL.RPIQS_1) alors CORR.RPIQS1731 = GLOBAL.RPIQS_1; finsi
-si present(GLOBAL.RPIQT_1) alors CORR.RPIQT1731 = GLOBAL.RPIQT_1; finsi
-si present(GLOBAL.RPIQU_1) alors CORR.RPIQU1731 = GLOBAL.RPIQU_1; finsi
-si present(GLOBAL.RNORMGH_1) alors CORR.RNORMGH1731 = GLOBAL.RNORMGH_1; finsi
-si present(GLOBAL.RNORMEF_1) alors CORR.RNORMEF1731 = GLOBAL.RNORMEF_1; finsi
-si present(GLOBAL.RNORMCD_1) alors CORR.RNORMCD1731 = GLOBAL.RNORMCD_1; finsi
-si present(GLOBAL.RNORMAB_1) alors CORR.RNORMAB1731 = GLOBAL.RNORMAB_1; finsi
-si present(GLOBAL.RCELMS_1) alors CORR.RCELMS1731 = GLOBAL.RCELMS_1; finsi
-si present(GLOBAL.RCELMO_1) alors CORR.RCELMO1731 = GLOBAL.RCELMO_1; finsi
-si present(GLOBAL.RCELMT_1) alors CORR.RCELMT1731 = GLOBAL.RCELMT_1; finsi
-si present(GLOBAL.RCELMP_1) alors CORR.RCELMP1731 = GLOBAL.RCELMP_1; finsi
-si present(GLOBAL.RCELMU_1) alors CORR.RCELMU1731 = GLOBAL.RCELMU_1; finsi
-si present(GLOBAL.RCELMQ_1) alors CORR.RCELMQ1731 = GLOBAL.RCELMQ_1; finsi
-si present(GLOBAL.RCELMV_1) alors CORR.RCELMV1731 = GLOBAL.RCELMV_1; finsi
-si present(GLOBAL.RCELMR_1) alors CORR.RCELMR1731 = GLOBAL.RCELMR_1; finsi
-si present(GLOBAL.RCELYI_1) alors CORR.RCELYI1731 = GLOBAL.RCELYI_1; finsi
-si present(GLOBAL.RCELYJ_1) alors CORR.RCELYJ1731 = GLOBAL.RCELYJ_1; finsi
-si present(GLOBAL.RCELYK_1) alors CORR.RCELYK1731 = GLOBAL.RCELYK_1; finsi
-si present(GLOBAL.RCELYL_1) alors CORR.RCELYL1731 = GLOBAL.RCELYL_1; finsi
-si present(GLOBAL.RCELZI_1) alors CORR.RCELZI1731 = GLOBAL.RCELZI_1; finsi
-si present(GLOBAL.RCELZJ_1) alors CORR.RCELZJ1731 = GLOBAL.RCELZJ_1; finsi
-si present(GLOBAL.RCELZK_1) alors CORR.RCELZK1731 = GLOBAL.RCELZK_1; finsi
-si present(GLOBAL.RCELZL_1) alors CORR.RCELZL1731 = GLOBAL.RCELZL_1; finsi
-si present(GLOBAL.RCELKC_1) alors CORR.RCELKC1731 = GLOBAL.RCELKC_1; finsi
-si present(GLOBAL.RCELKD_1) alors CORR.RCELKD1731 = GLOBAL.RCELKD_1; finsi
-si present(GLOBAL.RCELHZ_1) alors CORR.RCELHZ1731 = GLOBAL.RCELHZ_1; finsi
-si present(GLOBAL.RCELKU_1) alors CORR.RCELKU1731 = GLOBAL.RCELKU_1; finsi
-si present(GLOBAL.RCELKT_1) alors CORR.RCELKT1731 = GLOBAL.RCELKT_1; finsi
-si present(GLOBAL.RCELKV_1) alors CORR.RCELKV1731 = GLOBAL.RCELKV_1; finsi
-si present(GLOBAL.RCELREPWW_1) alors CORR.RCELREPWW1731 = GLOBAL.RCELREPWW_1; finsi
-si present(GLOBAL.RCELREPWV_1) alors CORR.RCELREPWV1731 = GLOBAL.RCELREPWV_1; finsi
-si present(GLOBAL.RCELREPWU_1) alors CORR.RCELREPWU1731 = GLOBAL.RCELREPWU_1; finsi
-si present(GLOBAL.RCELREPWT_1) alors CORR.RCELREPWT1731 = GLOBAL.RCELREPWT_1; finsi
-si present(GLOBAL.RCELRU_1) alors CORR.RCELRU1731 = GLOBAL.RCELRU_1; finsi
-si present(GLOBAL.RCELRT_1) alors CORR.RCELRT1731 = GLOBAL.RCELRT_1; finsi
-si present(GLOBAL.RHEBE_1) alors CORR.RHEBE1731 = GLOBAL.RHEBE_1; finsi
-si present(GLOBAL.RREPA_1) alors CORR.RREPA1731 = GLOBAL.RREPA_1; finsi
-si present(GLOBAL.RLOCANAH_1) alors CORR.RLOCANAH1731 = GLOBAL.RLOCANAH_1; finsi
-si present(GLOBAL.RSNCV_1) alors CORR.RSNCV1731 = GLOBAL.RSNCV_1; finsi
-si present(GLOBAL.RSNCS_1) alors CORR.RSNCS1731 = GLOBAL.RSNCS_1; finsi
-si present(GLOBAL.RSNCX_1) alors CORR.RSNCX1731 = GLOBAL.RSNCX_1; finsi
-si present(GLOBAL.RSNCA_1) alors CORR.RSNCA1731 = GLOBAL.RSNCA_1; finsi
-si present(GLOBAL.RSNDC_1) alors CORR.RSNDC1731 = GLOBAL.RSNDC_1; finsi
-si present(GLOBAL.RSNCT_1) alors CORR.RSNCT1731 = GLOBAL.RSNCT_1; finsi
-si present(GLOBAL.RSNCW_1) alors CORR.RSNCW1731 = GLOBAL.RSNCW_1; finsi
-si present(GLOBAL.RSNCU_1) alors CORR.RSNCU1731 = GLOBAL.RSNCU_1; finsi
-si present(GLOBAL.RSNCO_1) alors CORR.RSNCO1731 = GLOBAL.RSNCO_1; finsi
-si present(GLOBAL.RSNCP_1) alors CORR.RSNCP1731 = GLOBAL.RSNCP_1; finsi
-si present(GLOBAL.RSNCQ_1) alors CORR.RSNCQ1731 = GLOBAL.RSNCQ_1; finsi
-si present(GLOBAL.RSNCH_1) alors CORR.RSNCH1731 = GLOBAL.RSNCH_1; finsi
-si present(GLOBAL.RSNCI_1) alors CORR.RSNCI1731 = GLOBAL.RSNCI_1; finsi
-si present(GLOBAL.RSNBS_1) alors CORR.RSNBS1731 = GLOBAL.RSNBS_1; finsi
-si present(GLOBAL.RSNBT_1) alors CORR.RSNBT1731 = GLOBAL.RSNBT_1; finsi
-si present(GLOBAL.RSNBU_1) alors CORR.RSNBU1731 = GLOBAL.RSNBU_1; finsi
-si present(GLOBAL.RSNBW_1) alors CORR.RSNBW1731 = GLOBAL.RSNBW_1; finsi
-si present(GLOBAL.RSNGW_1) alors CORR.RSNGW1731 = GLOBAL.RSNGW_1; finsi
-si present(GLOBAL.RNOUV_1) alors CORR.RNOUV1731 = GLOBAL.RNOUV_1; finsi
-si present(GLOBAL.RPENTCY_1) alors CORR.RPENTCY1731 = GLOBAL.RPENTCY_1; finsi
-si present(GLOBAL.RPENTDY_1) alors CORR.RPENTDY1731 = GLOBAL.RPENTDY_1; finsi
-si present(GLOBAL.RPENTEY_1) alors CORR.RPENTEY1731 = GLOBAL.RPENTEY_1; finsi
-si present(GLOBAL.RPENTFY_1) alors CORR.RPENTFY1731 = GLOBAL.RPENTFY_1; finsi
-si present(GLOBAL.RPENTGY_1) alors CORR.RPENTGY1731 = GLOBAL.RPENTGY_1; finsi
-si present(GLOBAL.RPENTEK_1) alors CORR.RPENTEK1731 = GLOBAL.RPENTEK_1; finsi
-si present(GLOBAL.RILMHO_1) alors CORR.RILMHO1731 = GLOBAL.RILMHO_1; finsi
-si present(GLOBAL.RILMHT_1) alors CORR.RILMHT1731 = GLOBAL.RILMHT_1; finsi
-si present(GLOBAL.RILMHP_1) alors CORR.RILMHP1731 = GLOBAL.RILMHP_1; finsi
-si present(GLOBAL.RILMHU_1) alors CORR.RILMHU1731 = GLOBAL.RILMHU_1; finsi
-si present(GLOBAL.RILMHQ_1) alors CORR.RILMHQ1731 = GLOBAL.RILMHQ_1; finsi
-si present(GLOBAL.RILMHV_1) alors CORR.RILMHV1731 = GLOBAL.RILMHV_1; finsi
-si present(GLOBAL.RILMHR_1) alors CORR.RILMHR1731 = GLOBAL.RILMHR_1; finsi
-si present(GLOBAL.RILMHW_1) alors CORR.RILMHW1731 = GLOBAL.RILMHW_1; finsi
-si present(GLOBAL.RILMHS_1) alors CORR.RILMHS1731 = GLOBAL.RILMHS_1; finsi
-si present(GLOBAL.RILMHX_1) alors CORR.RILMHX1731 = GLOBAL.RILMHX_1; finsi
-si present(GLOBAL.RILMOT_1) alors CORR.RILMOT1731 = GLOBAL.RILMOT_1; finsi
-si present(GLOBAL.RILMOS_1) alors CORR.RILMOS1731 = GLOBAL.RILMOS_1; finsi
-si present(GLOBAL.RILMOR_1) alors CORR.RILMOR1731 = GLOBAL.RILMOR_1; finsi
-si present(GLOBAL.RILMOQ_1) alors CORR.RILMOQ1731 = GLOBAL.RILMOQ_1; finsi
-si present(GLOBAL.RILMOP_1) alors CORR.RILMOP1731 = GLOBAL.RILMOP_1; finsi
-si present(GLOBAL.RILMSC_1) alors CORR.RILMSC1731 = GLOBAL.RILMSC_1; finsi
-si present(GLOBAL.RILMSB_1) alors CORR.RILMSB1731 = GLOBAL.RILMSB_1; finsi
-si present(GLOBAL.RILMSA_1) alors CORR.RILMSA1731 = GLOBAL.RILMSA_1; finsi
-si present(GLOBAL.RILMSO_1) alors CORR.RILMSO1731 = GLOBAL.RILMSO_1; finsi
-si present(GLOBAL.RILMSN_1) alors CORR.RILMSN1731 = GLOBAL.RILMSN_1; finsi
-si present(GLOBAL.RILMSP_1) alors CORR.RILMSP1731 = GLOBAL.RILMSP_1; finsi
-si present(GLOBAL.RCODOY_1) alors CORR.RCODOY1731 = GLOBAL.RCODOY_1; finsi
-si present(GLOBAL.RCODPZ_1) alors CORR.RCODPZ1731 = GLOBAL.RCODPZ_1; finsi
-si present(GLOBAL.RCODMZ_1) alors CORR.RCODMZ1731 = GLOBAL.RCODMZ_1; finsi
-si present(GLOBAL.RSOCREPR_1) alors CORR.RSOCREPR1731 = GLOBAL.RSOCREPR_1; finsi
-si present(GLOBAL.RCOD7KZ_1) alors CORR.RCOD7KZ1731 = GLOBAL.RCOD7KZ_1; finsi
-si present(GLOBAL.RCOD7KY_1) alors CORR.RCOD7KY1731 = GLOBAL.RCOD7KY_1; finsi
-si present(GLOBAL.RCOD7KX_1) alors CORR.RCOD7KX1731 = GLOBAL.RCOD7KX_1; finsi
-si present(GLOBAL.RRESTIMONX_1) alors CORR.RRESTIMONX1731 = GLOBAL.RRESTIMONX_1; finsi
-si present(GLOBAL.RRESTIMONY_1) alors CORR.RRESTIMONY1731 = GLOBAL.RRESTIMONY_1; finsi
-si present(GLOBAL.RRESTIMO_1) alors CORR.RRESTIMO1731 = GLOBAL.RRESTIMO_1; finsi
-si present(GLOBAL.RRESTIMO1_1) alors CORR.RRESTIMO11731 = GLOBAL.RRESTIMO1_1; finsi
-si present(GLOBAL.RDONS_1) alors CORR.RDONS1731 = GLOBAL.RDONS_1; finsi
-si present(GLOBAL.RDONDJ_1) alors CORR.RDONDJ1731 = GLOBAL.RDONDJ_1; finsi
-si present(GLOBAL.RDONDO_1) alors CORR.RDONDO1731 = GLOBAL.RDONDO_1; finsi
-si present(GLOBAL.BADONJ) alors CORR.BADONJ1731 = GLOBAL.BADONJ; finsi
-si present(GLOBAL.BADONO) alors CORR.BADONO1731 = GLOBAL.BADONO; finsi
-si present(GLOBAL.RRETU_1) alors CORR.RRETU1731 = GLOBAL.RRETU_1; finsi
-si present(GLOBAL.RINNO_1) alors CORR.RINNO1731 = GLOBAL.RINNO_1; finsi
-si present(GLOBAL.RRPRESCOMP_1) alors CORR.RRPRESCOMP1731 = GLOBAL.RRPRESCOMP_1; finsi
-si present(GLOBAL.RDIFAGRI_1) alors CORR.RDIFAGRI1731 = GLOBAL.RDIFAGRI_1; finsi
-si present(GLOBAL.RREHAB_1) alors CORR.RREHAB1731 = GLOBAL.RREHAB_1; finsi
-si present(GLOBAL.A10RFOR_1) alors CORR.A10RFOR1731 = GLOBAL.A10RFOR_1; finsi
-si present(GLOBAL.RLOG01_1) alors CORR.RLOG011731 = GLOBAL.RLOG01_1; finsi
-si present(GLOBAL.RLOG02_1) alors CORR.RLOG021731 = GLOBAL.RLOG02_1; finsi
-si present(GLOBAL.RLOG01_1) alors CORR.RLOG031731 = GLOBAL.RLOG01_1; finsi
-si present(GLOBAL.RLOG04_1) alors CORR.RLOG041731 = GLOBAL.RLOG04_1; finsi
-si present(GLOBAL.RLOG05_1) alors CORR.RLOG051731 = GLOBAL.RLOG05_1; finsi
-si present(GLOBAL.RLOG06_1) alors CORR.RLOG061731 = GLOBAL.RLOG06_1; finsi
-si present(GLOBAL.RLOG07_1) alors CORR.RLOG071731 = GLOBAL.RLOG07_1; finsi
-si present(GLOBAL.RLOG08_1) alors CORR.RLOG081731 = GLOBAL.RLOG08_1; finsi
-si present(GLOBAL.RLOG09_1) alors CORR.RLOG091731 = GLOBAL.RLOG09_1; finsi
-si present(GLOBAL.RLOG10_1) alors CORR.RLOG101731 = GLOBAL.RLOG10_1; finsi
-si present(GLOBAL.RLOG11_1) alors CORR.RLOG111731 = GLOBAL.RLOG11_1; finsi
-si present(GLOBAL.RLOG12_1) alors CORR.RLOG121731 = GLOBAL.RLOG12_1; finsi
-si present(GLOBAL.RLOG13_1) alors CORR.RLOG131731 = GLOBAL.RLOG13_1; finsi
-si present(GLOBAL.RLOG14_1) alors CORR.RLOG141731 = GLOBAL.RLOG14_1; finsi
-si present(GLOBAL.RLOG15_1) alors CORR.RLOG151731 = GLOBAL.RLOG15_1; finsi
-si present(GLOBAL.RLOG16_1) alors CORR.RLOG161731 = GLOBAL.RLOG16_1; finsi
-si present(GLOBAL.RLOG17_1) alors CORR.RLOG171731 = GLOBAL.RLOG17_1; finsi
-si present(GLOBAL.RLOG18_1) alors CORR.RLOG181731 = GLOBAL.RLOG18_1; finsi
-si present(GLOBAL.RLOG19_1) alors CORR.RLOG191731 = GLOBAL.RLOG19_1; finsi
-si present(GLOBAL.RLOG20_1) alors CORR.RLOG201731 = GLOBAL.RLOG20_1; finsi
-si present(GLOBAL.RLOG21_1) alors CORR.RLOG211731 = GLOBAL.RLOG21_1; finsi
-si present(GLOBAL.RLOG22_1) alors CORR.RLOG221731 = GLOBAL.RLOG22_1; finsi
-si present(GLOBAL.RLOG23_1) alors CORR.RLOG231731 = GLOBAL.RLOG23_1; finsi
-si present(GLOBAL.RLOG24_1) alors CORR.RLOG241731 = GLOBAL.RLOG24_1; finsi
-si present(GLOBAL.RLOG25_1) alors CORR.RLOG251731 = GLOBAL.RLOG25_1; finsi
-si present(GLOBAL.RLOG26_1) alors CORR.RLOG261731 = GLOBAL.RLOG26_1; finsi
-si present(GLOBAL.RLOG27_1) alors CORR.RLOG271731 = GLOBAL.RLOG27_1; finsi
-si present(GLOBAL.RLOG28_1) alors CORR.RLOG281731 = GLOBAL.RLOG28_1; finsi
-si present(GLOBAL.RLOG29_1) alors CORR.RLOG291731 = GLOBAL.RLOG29_1; finsi
-si present(GLOBAL.RLOG30_1) alors CORR.RLOG301731 = GLOBAL.RLOG30_1; finsi
-si present(GLOBAL.RLOG31_1) alors CORR.RLOG311731 = GLOBAL.RLOG31_1; finsi
-si present(GLOBAL.RLOG32_1) alors CORR.RLOG321731 = GLOBAL.RLOG32_1; finsi
-si present(GLOBAL.RLOG33_1) alors CORR.RLOG331731 = GLOBAL.RLOG33_1; finsi
-si present(GLOBAL.RLOG34_1) alors CORR.RLOG341731 = GLOBAL.RLOG34_1; finsi
-si present(GLOBAL.RLOG35_1) alors CORR.RLOG351731 = GLOBAL.RLOG35_1; finsi
-si present(GLOBAL.RLOG36_1) alors CORR.RLOG361731 = GLOBAL.RLOG36_1; finsi
-si present(GLOBAL.RLOG37_1) alors CORR.RLOG371731 = GLOBAL.RLOG37_1; finsi
-si present(GLOBAL.RLOG38_1) alors CORR.RLOG381731 = GLOBAL.RLOG38_1; finsi
-si present(GLOBAL.RLOG39_1) alors CORR.RLOG391731 = GLOBAL.RLOG39_1; finsi
-si present(GLOBAL.RLOG40_1) alors CORR.RLOG401731 = GLOBAL.RLOG40_1; finsi
-si present(GLOBAL.RLOG41_1) alors CORR.RLOG411731 = GLOBAL.RLOG41_1; finsi
-si present(GLOBAL.RLOG42_1) alors CORR.RLOG421731 = GLOBAL.RLOG42_1; finsi
-si present(GLOBAL.RLOG43_1) alors CORR.RLOG431731 = GLOBAL.RLOG43_1; finsi
-si present(GLOBAL.RLOG44_1) alors CORR.RLOG441731 = GLOBAL.RLOG44_1; finsi
-si present(GLOBAL.RLOG45_1) alors CORR.RLOG451731 = GLOBAL.RLOG45_1; finsi
-si present(GLOBAL.RLOG46_1) alors CORR.RLOG461731 = GLOBAL.RLOG46_1; finsi
-si present(GLOBAL.RLOG47_1) alors CORR.RLOG471731 = GLOBAL.RLOG47_1; finsi
-si present(GLOBAL.RLOG48_1) alors CORR.RLOG481731 = GLOBAL.RLOG48_1; finsi
-si present(GLOBAL.RLOG49_1) alors CORR.RLOG491731 = GLOBAL.RLOG49_1; finsi
-si present(GLOBAL.RLOG50_1) alors CORR.RLOG501731 = GLOBAL.RLOG50_1; finsi
-si present(GLOBAL.RLOG51_1) alors CORR.RLOG511731 = GLOBAL.RLOG51_1; finsi
-si present(GLOBAL.RLOG52_1) alors CORR.RLOG521731 = GLOBAL.RLOG52_1; finsi
-si present(GLOBAL.RLOG53_1) alors CORR.RLOG531731 = GLOBAL.RLOG53_1; finsi
-si present(GLOBAL.RLOG54_1) alors CORR.RLOG541731 = GLOBAL.RLOG54_1; finsi
-si present(GLOBAL.RLOG55_1) alors CORR.RLOG551731 = GLOBAL.RLOG55_1; finsi
-si present(GLOBAL.RLOG56_1) alors CORR.RLOG561731 = GLOBAL.RLOG56_1; finsi
-si present(GLOBAL.RLOG57_1) alors CORR.RLOG571731 = GLOBAL.RLOG57_1; finsi
-si present(GLOBAL.RLOG58_1) alors CORR.RLOG581731 = GLOBAL.RLOG58_1; finsi
-si present(GLOBAL.RLOG59_1) alors CORR.RLOG591731 = GLOBAL.RLOG59_1; finsi
-si present(GLOBAL.RLOG60_1) alors CORR.RLOG601731 = GLOBAL.RLOG60_1; finsi
-si present(GLOBAL.RLOGHVJ_1) alors CORR.RLOGHVJ1731 = GLOBAL.RLOGHVJ_1; finsi
-si present(GLOBAL.RLOGHVK_1) alors CORR.RLOGHVK1731 = GLOBAL.RLOGHVK_1; finsi
-si present(GLOBAL.RLOGHVL_1) alors CORR.RLOGHVL1731 = GLOBAL.RLOGHVL_1; finsi
-si present(GLOBAL.RSOC35_1) alors CORR.RSOC351731 = GLOBAL.RSOC35_1; finsi
-si present(GLOBAL.RSOC36_1) alors CORR.RSOC361731 = GLOBAL.RSOC36_1; finsi
-si present(GLOBAL.RSOC37_1) alors CORR.RSOC371731 = GLOBAL.RSOC37_1; finsi
-si present(GLOBAL.RSOC38_1) alors CORR.RSOC381731 = GLOBAL.RSOC38_1; finsi
-si present(GLOBAL.RSOC39_1) alors CORR.RSOC391731 = GLOBAL.RSOC39_1; finsi
-si present(GLOBAL.RSOC40_1) alors CORR.RSOC401731 = GLOBAL.RSOC40_1; finsi
-si present(GLOBAL.RSOC41_1) alors CORR.RSOC411731 = GLOBAL.RSOC41_1; finsi
-si present(GLOBAL.RSOC42_1) alors CORR.RSOC421731 = GLOBAL.RSOC42_1; finsi
-si present(GLOBAL.RSOC43_1) alors CORR.RSOC431731 = GLOBAL.RSOC43_1; finsi
-si present(GLOBAL.RSOC44_1) alors CORR.RSOC441731 = GLOBAL.RSOC44_1; finsi
-si present(GLOBAL.RSOCHYD_1) alors CORR.RSOCHYD1731 = GLOBAL.RSOCHYD_1; finsi
-si present(GLOBAL.RSOCHYC_1) alors CORR.RSOCHYC1731 = GLOBAL.RSOCHYC_1; finsi
-si present(GLOBAL.RSOCHYDR_1) alors CORR.RSOCHYDR1731 = GLOBAL.RSOCHYDR_1; finsi
-si present(GLOBAL.RSOCHYCR_1) alors CORR.RSOCHYCR1731 = GLOBAL.RSOCHYCR_1; finsi
-si present(GLOBAL.RSOCHYH_1) alors CORR.RSOCHYH1731 = GLOBAL.RSOCHYH_1; finsi
-si present(GLOBAL.RSOCHYHR_1) alors CORR.RSOCHYHR1731 = GLOBAL.RSOCHYHR_1; finsi
-si present(GLOBAL.RSOCHYI_1) alors CORR.RSOCHYI1731 = GLOBAL.RSOCHYI_1; finsi
-si present(GLOBAL.RSOCHYIR_1) alors CORR.RSOCHYIR1731 = GLOBAL.RSOCHYIR_1; finsi
-si present(GLOBAL.RSOCHYE_1) alors CORR.RSOCHYE1731 = GLOBAL.RSOCHYE_1; finsi
-si present(GLOBAL.RSOCHYER_1) alors CORR.RSOCHYER1731 = GLOBAL.RSOCHYER_1; finsi
-si present(GLOBAL.RSOCHYF_1) alors CORR.RSOCHYF1731 = GLOBAL.RSOCHYF_1; finsi
-si present(GLOBAL.RSOCHYFR_1) alors CORR.RSOCHYFR1731 = GLOBAL.RSOCHYFR_1; finsi
-si present(GLOBAL.RSOCHYG_1) alors CORR.RSOCHYG1731 = GLOBAL.RSOCHYG_1; finsi
-si present(GLOBAL.RSOCHYGR_1) alors CORR.RSOCHYGR1731 = GLOBAL.RSOCHYGR_1; finsi
-si present(GLOBAL.RLOCHFT_1) alors CORR.RLOCHFT1731 = GLOBAL.RLOCHFT_1; finsi
-si present(GLOBAL.RLOCHFO_1) alors CORR.RLOCHFO1731 = GLOBAL.RLOCHFO_1; finsi
-si present(GLOBAL.RLOCHFS_1) alors CORR.RLOCHFS1731 = GLOBAL.RLOCHFS_1; finsi
-si present(GLOBAL.RLOCHFN_1) alors CORR.RLOCHFN1731 = GLOBAL.RLOCHFN_1; finsi
-si present(GLOBAL.RLOCHFP_1) alors CORR.RLOCHFP1731 = GLOBAL.RLOCHFP_1; finsi
-si present(GLOBAL.RLOCHFU_1) alors CORR.RLOCHFU1731 = GLOBAL.RLOCHFU_1; finsi
-si present(GLOBAL.RLOCHFR_1) alors CORR.RLOCHFR1731 = GLOBAL.RLOCHFR_1; finsi
-si present(GLOBAL.RLOCHFW_1) alors CORR.RLOCHFW1731 = GLOBAL.RLOCHFW_1; finsi
-si present(GLOBAL.RLOCHFTR_1) alors CORR.RLOCHFTR1731 = GLOBAL.RLOCHFTR_1; finsi
-si present(GLOBAL.RLOCHFOR_1) alors CORR.RLOCHFOR1731 = GLOBAL.RLOCHFOR_1; finsi
-si present(GLOBAL.RLOCHFSR_1) alors CORR.RLOCHFSR1731 = GLOBAL.RLOCHFSR_1; finsi
-si present(GLOBAL.RLOCHFNR_1) alors CORR.RLOCHFNR1731 = GLOBAL.RLOCHFNR_1; finsi
-si present(GLOBAL.RLOCHGT_1) alors CORR.RLOCHGT1731 = GLOBAL.RLOCHGT_1; finsi
-si present(GLOBAL.RLOCHGS_1) alors CORR.RLOCHGS1731 = GLOBAL.RLOCHGS_1; finsi
-si present(GLOBAL.RLOCHGU_1) alors CORR.RLOCHGU1731 = GLOBAL.RLOCHGU_1; finsi
-si present(GLOBAL.RLOCHGW_1) alors CORR.RLOCHGW1731 = GLOBAL.RLOCHGW_1; finsi
-si present(GLOBAL.RLOCHGTR_1) alors CORR.RLOCHGTR1731 = GLOBAL.RLOCHGTR_1; finsi
-si present(GLOBAL.RLOCHGSR_1) alors CORR.RLOCHGSR1731 = GLOBAL.RLOCHGSR_1; finsi
-si present(GLOBAL.RLOCHHT_1) alors CORR.RLOCHHT1731 = GLOBAL.RLOCHHT_1; finsi
-si present(GLOBAL.RLOCHHS_1) alors CORR.RLOCHHS1731 = GLOBAL.RLOCHHS_1; finsi
-si present(GLOBAL.RLOCHHU_1) alors CORR.RLOCHHU1731 = GLOBAL.RLOCHHU_1; finsi
-si present(GLOBAL.RLOCHHW_1) alors CORR.RLOCHHW1731 = GLOBAL.RLOCHHW_1; finsi
-si present(GLOBAL.RLOCHHTR_1) alors CORR.RLOCHHTR1731 = GLOBAL.RLOCHHTR_1; finsi
-si present(GLOBAL.RLOCHHSR_1) alors CORR.RLOCHHSR1731 = GLOBAL.RLOCHHSR_1; finsi
-si present(GLOBAL.RLOCHIT_1) alors CORR.RLOCHIT1731 = GLOBAL.RLOCHIT_1; finsi
-si present(GLOBAL.RLOCHIS_1) alors CORR.RLOCHIS1731 = GLOBAL.RLOCHIS_1; finsi
-si present(GLOBAL.RLOCHIU_1) alors CORR.RLOCHIU1731 = GLOBAL.RLOCHIU_1; finsi
-si present(GLOBAL.RLOCHIW_1) alors CORR.RLOCHIW1731 = GLOBAL.RLOCHIW_1; finsi
-si present(GLOBAL.RLOCHITR_1) alors CORR.RLOCHITR1731 = GLOBAL.RLOCHITR_1; finsi
-si present(GLOBAL.RLOCHISR_1) alors CORR.RLOCHISR1731 = GLOBAL.RLOCHISR_1; finsi
-si present(GLOBAL.RLOCHJS_1) alors CORR.RLOCHJS1731 = GLOBAL.RLOCHJS_1; finsi
-si present(GLOBAL.RLOCHJSR_1) alors CORR.RLOCHJSR1731 = GLOBAL.RLOCHJSR_1; finsi
-si present(GLOBAL.RLOCHJT_1) alors CORR.RLOCHJT1731 = GLOBAL.RLOCHJT_1; finsi
-si present(GLOBAL.RLOCHJTR_1) alors CORR.RLOCHJTR1731 = GLOBAL.RLOCHJTR_1; finsi
-si present(GLOBAL.RLOCHJU_1) alors CORR.RLOCHJU1731 = GLOBAL.RLOCHJU_1; finsi
-si present(GLOBAL.RLOCHJW_1) alors CORR.RLOCHJW1731 = GLOBAL.RLOCHJW_1; finsi
-si present(GLOBAL.RLOCHKS_1) alors CORR.RLOCHKS1731 = GLOBAL.RLOCHKS_1; finsi
-si present(GLOBAL.RLOCHKSR_1) alors CORR.RLOCHKSR1731 = GLOBAL.RLOCHKSR_1; finsi
-si present(GLOBAL.RLOCHKT_1) alors CORR.RLOCHKT1731 = GLOBAL.RLOCHKT_1; finsi
-si present(GLOBAL.RLOCHKTR_1) alors CORR.RLOCHKTR1731 = GLOBAL.RLOCHKTR_1; finsi
-si present(GLOBAL.RLOCHKU_1) alors CORR.RLOCHKU1731 = GLOBAL.RLOCHKU_1; finsi
-si present(GLOBAL.RLOCHKW_1) alors CORR.RLOCHKW1731 = GLOBAL.RLOCHKW_1; finsi
-si present(GLOBAL.RLOGHVM_1) alors CORR.RLOGHVM1731 = GLOBAL.RLOGHVM_1; finsi
-si present(GLOBAL.RLOGHVN_1) alors CORR.RLOGHVN1731 = GLOBAL.RLOGHVN_1; finsi
-si present(GLOBAL.RSC301_1) alors CORR.RSC3011731 = GLOBAL.RSC301_1; finsi
-si present(GLOBAL.RSC302_1) alors CORR.RSC3021731 = GLOBAL.RSC302_1; finsi
-si present(GLOBAL.RSC303_1) alors CORR.RSC3031731 = GLOBAL.RSC303_1; finsi
-si present(GLOBAL.RSC304_1) alors CORR.RSC3041731 = GLOBAL.RSC304_1; finsi
-si present(GLOBAL.RSC305_1) alors CORR.RSC3051731 = GLOBAL.RSC305_1; finsi
-si present(GLOBAL.RSC306_1) alors CORR.RSC3061731 = GLOBAL.RSC306_1; finsi
-si present(GLOBAL.RSC307_1) alors CORR.RSC3071731 = GLOBAL.RSC307_1; finsi
-si present(GLOBAL.RSC308_1) alors CORR.RSC3081731 = GLOBAL.RSC308_1; finsi
-si present(GLOBAL.RSC309_1) alors CORR.RSC3091731 = GLOBAL.RSC309_1; finsi
-si present(GLOBAL.RSC310_1) alors CORR.RSC3101731 = GLOBAL.RSC310_1; finsi
-si present(GLOBAL.RSC311_1) alors CORR.RSC3111731 = GLOBAL.RSC311_1; finsi
-si present(GLOBAL.RSC312_1) alors CORR.RSC3121731 = GLOBAL.RSC312_1; finsi
+si present(GLOBAL.AILMHT_1) alors CORR.AILMHT1731 = GLOBAL.AILMHT_1; finsi
+si present(GLOBAL.AILMHU_1) alors CORR.AILMHU1731 = GLOBAL.AILMHU_1; finsi
+si present(GLOBAL.AILMHV_1) alors CORR.AILMHV1731 = GLOBAL.AILMHV_1; finsi
+si present(GLOBAL.AILMHW_1) alors CORR.AILMHW1731 = GLOBAL.AILMHW_1; finsi
+si present(GLOBAL.AILMHX_1) alors CORR.AILMHX1731 = GLOBAL.AILMHX_1; finsi
+si present(GLOBAL.AILMJV_1) alors CORR.AILMJV1731 = GLOBAL.AILMJV_1; finsi
+si present(GLOBAL.AILMJW_1) alors CORR.AILMJW1731 = GLOBAL.AILMJW_1; finsi
+si present(GLOBAL.AILMJX_1) alors CORR.AILMJX1731 = GLOBAL.AILMJX_1; finsi
+si present(GLOBAL.AILMJY_1) alors CORR.AILMJY1731 = GLOBAL.AILMJY_1; finsi
+si present(GLOBAL.AILMKE_1) alors CORR.AILMKE1731 = GLOBAL.AILMKE_1; finsi
+si present(GLOBAL.AILMKF_1) alors CORR.AILMKF1731 = GLOBAL.AILMKF_1; finsi
+si present(GLOBAL.AILMKG_1) alors CORR.AILMKG1731 = GLOBAL.AILMKG_1; finsi
+si present(GLOBAL.AILMKH_1) alors CORR.AILMKH1731 = GLOBAL.AILMKH_1; finsi
+si present(GLOBAL.AILMKI_1) alors CORR.AILMKI1731 = GLOBAL.AILMKI_1; finsi
+si present(GLOBAL.AILMOA_1) alors CORR.AILMOA1731 = GLOBAL.AILMOA_1; finsi
+si present(GLOBAL.AILMOB_1) alors CORR.AILMOB1731 = GLOBAL.AILMOB_1; finsi
+si present(GLOBAL.AILMOC_1) alors CORR.AILMOC1731 = GLOBAL.AILMOC_1; finsi
+si present(GLOBAL.AILMOD_1) alors CORR.AILMOD1731 = GLOBAL.AILMOD_1; finsi
+si present(GLOBAL.AILMOE_1) alors CORR.AILMOE1731 = GLOBAL.AILMOE_1; finsi
+si present(GLOBAL.AILMOP_1) alors CORR.AILMOP1731 = GLOBAL.AILMOP_1; finsi
+si present(GLOBAL.AILMOQ_1) alors CORR.AILMOQ1731 = GLOBAL.AILMOQ_1; finsi
+si present(GLOBAL.AILMOR_1) alors CORR.AILMOR1731 = GLOBAL.AILMOR_1; finsi
+si present(GLOBAL.AILMOS_1) alors CORR.AILMOS1731 = GLOBAL.AILMOS_1; finsi
+si present(GLOBAL.AILMOT_1) alors CORR.AILMOT1731 = GLOBAL.AILMOT_1; finsi
+si present(GLOBAL.AILMPF_1) alors CORR.AILMPF1731 = GLOBAL.AILMPF_1; finsi
+si present(GLOBAL.AILMPG_1) alors CORR.AILMPG1731 = GLOBAL.AILMPG_1; finsi
+si present(GLOBAL.AILMPH_1) alors CORR.AILMPH1731 = GLOBAL.AILMPH_1; finsi
+si present(GLOBAL.AILMPI_1) alors CORR.AILMPI1731 = GLOBAL.AILMPI_1; finsi
+si present(GLOBAL.AILMPJ_1) alors CORR.AILMPJ1731 = GLOBAL.AILMPJ_1; finsi
+si present(GLOBAL.AILMPO_1) alors CORR.AILMPO1731 = GLOBAL.AILMPO_1; finsi
+si present(GLOBAL.AILMPP_1) alors CORR.AILMPP1731 = GLOBAL.AILMPP_1; finsi
+si present(GLOBAL.AILMPQ_1) alors CORR.AILMPQ1731 = GLOBAL.AILMPQ_1; finsi
+si present(GLOBAL.AILMPR_1) alors CORR.AILMPR1731 = GLOBAL.AILMPR_1; finsi
+si present(GLOBAL.AILMPS_1) alors CORR.AILMPS1731 = GLOBAL.AILMPS_1; finsi
+si present(GLOBAL.AILMSA_1) alors CORR.AILMSA1731 = GLOBAL.AILMSA_1; finsi
+si present(GLOBAL.AILMSB_1) alors CORR.AILMSB1731 = GLOBAL.AILMSB_1; finsi
+si present(GLOBAL.AILMSC_1) alors CORR.AILMSC1731 = GLOBAL.AILMSC_1; finsi
+si present(GLOBAL.AILMSM_1) alors CORR.AILMSM1731 = GLOBAL.AILMSM_1; finsi
+si present(GLOBAL.AILMSN_1) alors CORR.AILMSN1731 = GLOBAL.AILMSN_1; finsi
+si present(GLOBAL.AILMSO_1) alors CORR.AILMSO1731 = GLOBAL.AILMSO_1; finsi
+si present(GLOBAL.AILMSP_1) alors CORR.AILMSP1731 = GLOBAL.AILMSP_1; finsi
+si present(GLOBAL.AILMSS_1) alors CORR.AILMSS1731 = GLOBAL.AILMSS_1; finsi
+si present(GLOBAL.AILMST_1) alors CORR.AILMST1731 = GLOBAL.AILMST_1; finsi
+si present(GLOBAL.ALOCENT_1) alors CORR.ALOCENT1731 = GLOBAL.ALOCENT_1; finsi
+si present(GLOBAL.ALOGDOM_1) alors CORR.ALOGDOM1731 = GLOBAL.ALOGDOM_1; finsi
+si present(GLOBAL.ALOGSOC_1) alors CORR.ALOGSOC1731 = GLOBAL.ALOGSOC_1; finsi
+si present(GLOBAL.ANOIE_1) alors CORR.ANOIE1731 = GLOBAL.ANOIE_1; finsi
+si present(GLOBAL.ANOIF_1) alors CORR.ANOIF1731 = GLOBAL.ANOIF_1; finsi
+si present(GLOBAL.ANOIG_1) alors CORR.ANOIG1731 = GLOBAL.ANOIG_1; finsi
+si present(GLOBAL.ANOIH_1) alors CORR.ANOIH1731 = GLOBAL.ANOIH_1; finsi
+si present(GLOBAL.ANOJE_1) alors CORR.ANOJE1731 = GLOBAL.ANOJE_1; finsi
+si present(GLOBAL.ANOJF_1) alors CORR.ANOJF1731 = GLOBAL.ANOJF_1; finsi
+si present(GLOBAL.ANOJG_1) alors CORR.ANOJG1731 = GLOBAL.ANOJG_1; finsi
+si present(GLOBAL.ANOJH_1) alors CORR.ANOJH1731 = GLOBAL.ANOJH_1; finsi
+si present(GLOBAL.ANORMJA_1) alors CORR.ANORMJA1731 = GLOBAL.ANORMJA_1; finsi
+si present(GLOBAL.ANORMJB_1) alors CORR.ANORMJB1731 = GLOBAL.ANORMJB_1; finsi
+si present(GLOBAL.ANORMJC_1) alors CORR.ANORMJC1731 = GLOBAL.ANORMJC_1; finsi
+si present(GLOBAL.ANORMJD_1) alors CORR.ANORMJD1731 = GLOBAL.ANORMJD_1; finsi
+si present(GLOBAL.ANORMJR_1) alors CORR.ANORMJR1731 = GLOBAL.ANORMJR_1; finsi
+si present(GLOBAL.ANORMJS_1) alors CORR.ANORMJS1731 = GLOBAL.ANORMJS_1; finsi
+si present(GLOBAL.ANORMJT_1) alors CORR.ANORMJT1731 = GLOBAL.ANORMJT_1; finsi
+si present(GLOBAL.ANORMJU_1) alors CORR.ANORMJU1731 = GLOBAL.ANORMJU_1; finsi
+si present(GLOBAL.ANORMLG_1) alors CORR.ANORMLG1731 = GLOBAL.ANORMLG_1; finsi
+si present(GLOBAL.ANORMLH_1) alors CORR.ANORMLH1731 = GLOBAL.ANORMLH_1; finsi
+si present(GLOBAL.ANORMLI_1) alors CORR.ANORMLI1731 = GLOBAL.ANORMLI_1; finsi
+si present(GLOBAL.ANORMLJ_1) alors CORR.ANORMLJ1731 = GLOBAL.ANORMLJ_1; finsi
+si present(GLOBAL.APENTCY_1) alors CORR.APENTCY1731 = GLOBAL.APENTCY_1; finsi
+si present(GLOBAL.APENTDY_1) alors CORR.APENTDY1731 = GLOBAL.APENTDY_1; finsi
+si present(GLOBAL.APENTEK_1) alors CORR.APENTEK1731 = GLOBAL.APENTEK_1; finsi
+si present(GLOBAL.APENTEY_1) alors CORR.APENTEY1731 = GLOBAL.APENTEY_1; finsi
+si present(GLOBAL.APENTFY_1) alors CORR.APENTFY1731 = GLOBAL.APENTFY_1; finsi
+si present(GLOBAL.APENTGY_1) alors CORR.APENTGY1731 = GLOBAL.APENTGY_1; finsi
+si present(GLOBAL.APIIA_1) alors CORR.APIIA1731 = GLOBAL.APIIA_1; finsi
+si present(GLOBAL.APIIB_1) alors CORR.APIIB1731 = GLOBAL.APIIB_1; finsi
+si present(GLOBAL.APIIC_1) alors CORR.APIIC1731 = GLOBAL.APIIC_1; finsi
+si present(GLOBAL.APIID_1) alors CORR.APIID1731 = GLOBAL.APIID_1; finsi
+si present(GLOBAL.APIJI_1) alors CORR.APIJI1731 = GLOBAL.APIJI_1; finsi
+si present(GLOBAL.APIJJ_1) alors CORR.APIJJ1731 = GLOBAL.APIJJ_1; finsi
+si present(GLOBAL.APIJK_1) alors CORR.APIJK1731 = GLOBAL.APIJK_1; finsi
+si present(GLOBAL.APIJL_1) alors CORR.APIJL1731 = GLOBAL.APIJL_1; finsi
+si present(GLOBAL.APIJV_1) alors CORR.APIJV1731 = GLOBAL.APIJV_1; finsi
+si present(GLOBAL.APIJW_1) alors CORR.APIJW1731 = GLOBAL.APIJW_1; finsi
+si present(GLOBAL.APIJX_1) alors CORR.APIJX1731 = GLOBAL.APIJX_1; finsi
+si present(GLOBAL.APIJY_1) alors CORR.APIJY1731 = GLOBAL.APIJY_1; finsi
+si present(GLOBAL.APINA_1) alors CORR.APINA1731 = GLOBAL.APINA_1; finsi
+si present(GLOBAL.APINB_1) alors CORR.APINB1731 = GLOBAL.APINB_1; finsi
+si present(GLOBAL.APINC_1) alors CORR.APINC1731 = GLOBAL.APINC_1; finsi
+si present(GLOBAL.APIND_1) alors CORR.APIND1731 = GLOBAL.APIND_1; finsi
+si present(GLOBAL.APIOF_1) alors CORR.APIOF1731 = GLOBAL.APIOF_1; finsi
+si present(GLOBAL.APIOG_1) alors CORR.APIOG1731 = GLOBAL.APIOG_1; finsi
+si present(GLOBAL.APIPK_1) alors CORR.APIPK1731 = GLOBAL.APIPK_1; finsi
+si present(GLOBAL.APIPL_1) alors CORR.APIPL1731 = GLOBAL.APIPL_1; finsi
+si present(GLOBAL.APIPM_1) alors CORR.APIPM1731 = GLOBAL.APIPM_1; finsi
+si present(GLOBAL.APIPN_1) alors CORR.APIPN1731 = GLOBAL.APIPN_1; finsi
+si present(GLOBAL.APIREPJM_1) alors CORR.APIREPJM1731 = GLOBAL.APIREPJM_1; finsi
+si present(GLOBAL.APIREPJN_1) alors CORR.APIREPJN1731 = GLOBAL.APIREPJN_1; finsi
+si present(GLOBAL.APIREPJO_1) alors CORR.APIREPJO1731 = GLOBAL.APIREPJO_1; finsi
+si present(GLOBAL.APIREPJP_1) alors CORR.APIREPJP1731 = GLOBAL.APIREPJP_1; finsi
+si present(GLOBAL.APIREPJQ_1) alors CORR.APIREPJQ1731 = GLOBAL.APIREPJQ_1; finsi
+si present(GLOBAL.APIREPKM_1) alors CORR.APIREPKM1731 = GLOBAL.APIREPKM_1; finsi
+si present(GLOBAL.APIREPLM_1) alors CORR.APIREPLM1731 = GLOBAL.APIREPLM_1; finsi
+si present(GLOBAL.APIREPMM_1) alors CORR.APIREPMM1731 = GLOBAL.APIREPMM_1; finsi
+si present(GLOBAL.APIREPRB_1) alors CORR.APIREPRB1731 = GLOBAL.APIREPRB_1; finsi
+si present(GLOBAL.APIREPRD_1) alors CORR.APIREPRD1731 = GLOBAL.APIREPRD_1; finsi
+si present(GLOBAL.APIREPRF_1) alors CORR.APIREPRF1731 = GLOBAL.APIREPRF_1; finsi
+si present(GLOBAL.APIREPRH_1) alors CORR.APIREPRH1731 = GLOBAL.APIREPRH_1; finsi
+si present(GLOBAL.APIREPRZ_1) alors CORR.APIREPRZ1731 = GLOBAL.APIREPRZ_1; finsi
+si present(GLOBAL.APIREPTZ_1) alors CORR.APIREPTZ1731 = GLOBAL.APIREPTZ_1; finsi
+si present(GLOBAL.APISY_1) alors CORR.APISY1731 = GLOBAL.APISY_1; finsi
+si present(GLOBAL.APISZ_1) alors CORR.APISZ1731 = GLOBAL.APISZ_1; finsi
+si present(GLOBAL.APMEJEI_1) alors CORR.APMEJEI1731 = GLOBAL.APMEJEI_1; finsi
+si present(GLOBAL.APRESSE_1) alors CORR.APRESSE1731 = GLOBAL.APRESSE_1; finsi
+si present(GLOBAL.APTZM_1) alors CORR.APTZM1731 = GLOBAL.APTZM_1; finsi
+si present(GLOBAL.AREHAB_1) alors CORR.AREHAB1731 = GLOBAL.AREHAB_1; finsi
+si present(GLOBAL.ARESTIMO1_1) alors CORR.ARESTIMO11731 = GLOBAL.ARESTIMO1_1; finsi
+si present(GLOBAL.ARESTIMO_1) alors CORR.ARESTIMO1731 = GLOBAL.ARESTIMO_1; finsi
si present(GLOBAL.ASC601_1) alors CORR.ASC6011731 = GLOBAL.ASC601_1; finsi
-si present(GLOBAL.RSC601_1) alors CORR.RSC6011731 = GLOBAL.RSC601_1; finsi
si present(GLOBAL.ASC602_1) alors CORR.ASC6021731 = GLOBAL.ASC602_1; finsi
-si present(GLOBAL.RSC602_1) alors CORR.RSC6021731 = GLOBAL.RSC602_1; finsi
si present(GLOBAL.ASC603_1) alors CORR.ASC6031731 = GLOBAL.ASC603_1; finsi
-si present(GLOBAL.RSC603_1) alors CORR.RSC6031731 = GLOBAL.RSC603_1; finsi
si present(GLOBAL.ASC604_1) alors CORR.ASC6041731 = GLOBAL.ASC604_1; finsi
-si present(GLOBAL.RSC604_1) alors CORR.RSC6041731 = GLOBAL.RSC604_1; finsi
si present(GLOBAL.ASC605_1) alors CORR.ASC6051731 = GLOBAL.ASC605_1; finsi
-si present(GLOBAL.RSC605_1) alors CORR.RSC6051731 = GLOBAL.RSC605_1; finsi
si present(GLOBAL.ASC606_1) alors CORR.ASC6061731 = GLOBAL.ASC606_1; finsi
-si present(GLOBAL.RSC606_1) alors CORR.RSC6061731 = GLOBAL.RSC606_1; finsi
si present(GLOBAL.ASC607_1) alors CORR.ASC6071731 = GLOBAL.ASC607_1; finsi
-si present(GLOBAL.RSC607_1) alors CORR.RSC6071731 = GLOBAL.RSC607_1; finsi
si present(GLOBAL.ASC608_1) alors CORR.ASC6081731 = GLOBAL.ASC608_1; finsi
-si present(GLOBAL.RSC608_1) alors CORR.RSC6081731 = GLOBAL.RSC608_1; finsi
si present(GLOBAL.ASC609_1) alors CORR.ASC6091731 = GLOBAL.ASC609_1; finsi
-si present(GLOBAL.RSC609_1) alors CORR.RSC6091731 = GLOBAL.RSC609_1; finsi
si present(GLOBAL.ASC610_1) alors CORR.ASC6101731 = GLOBAL.ASC610_1; finsi
-si present(GLOBAL.RSC610_1) alors CORR.RSC6101731 = GLOBAL.RSC610_1; finsi
si present(GLOBAL.ASC611_1) alors CORR.ASC6111731 = GLOBAL.ASC611_1; finsi
-si present(GLOBAL.RSC611_1) alors CORR.RSC6111731 = GLOBAL.RSC611_1; finsi
si present(GLOBAL.ASC612_1) alors CORR.ASC6121731 = GLOBAL.ASC612_1; finsi
-si present(GLOBAL.RSC612_1) alors CORR.RSC6121731 = GLOBAL.RSC612_1; finsi
si present(GLOBAL.ASC613_1) alors CORR.ASC6131731 = GLOBAL.ASC613_1; finsi
-si present(GLOBAL.RSC613_1) alors CORR.RSC6131731 = GLOBAL.RSC613_1; finsi
si present(GLOBAL.ASC614_1) alors CORR.ASC6141731 = GLOBAL.ASC614_1; finsi
-si present(GLOBAL.RSC614_1) alors CORR.RSC6141731 = GLOBAL.RSC614_1; finsi
si present(GLOBAL.ASC615_1) alors CORR.ASC6151731 = GLOBAL.ASC615_1; finsi
-si present(GLOBAL.RSC615_1) alors CORR.RSC6151731 = GLOBAL.RSC615_1; finsi
si present(GLOBAL.ASC616_1) alors CORR.ASC6161731 = GLOBAL.ASC616_1; finsi
-si present(GLOBAL.RSC616_1) alors CORR.RSC6161731 = GLOBAL.RSC616_1; finsi
si present(GLOBAL.ASC617_1) alors CORR.ASC6171731 = GLOBAL.ASC617_1; finsi
-si present(GLOBAL.RSC617_1) alors CORR.RSC6171731 = GLOBAL.RSC617_1; finsi
si present(GLOBAL.ASC618_1) alors CORR.ASC6181731 = GLOBAL.ASC618_1; finsi
-si present(GLOBAL.RSC618_1) alors CORR.RSC6181731 = GLOBAL.RSC618_1; finsi
si present(GLOBAL.ASC619_1) alors CORR.ASC6191731 = GLOBAL.ASC619_1; finsi
-si present(GLOBAL.RSC619_1) alors CORR.RSC6191731 = GLOBAL.RSC619_1; finsi
si present(GLOBAL.ASC620_1) alors CORR.ASC6201731 = GLOBAL.ASC620_1; finsi
-si present(GLOBAL.RSC620_1) alors CORR.RSC6201731 = GLOBAL.RSC620_1; finsi
si present(GLOBAL.ASC621_1) alors CORR.ASC6211731 = GLOBAL.ASC621_1; finsi
-si present(GLOBAL.RSC621_1) alors CORR.RSC6211731 = GLOBAL.RSC621_1; finsi
si present(GLOBAL.ASC622_1) alors CORR.ASC6221731 = GLOBAL.ASC622_1; finsi
-si present(GLOBAL.RSC622_1) alors CORR.RSC6221731 = GLOBAL.RSC622_1; finsi
si present(GLOBAL.ASC623_1) alors CORR.ASC6231731 = GLOBAL.ASC623_1; finsi
-si present(GLOBAL.RSC623_1) alors CORR.RSC6231731 = GLOBAL.RSC623_1; finsi
-si present(GLOBAL.ASC801_1) alors CORR.ASC8011731 = GLOBAL.ASC801_1; finsi
-si present(GLOBAL.RSC801_1) alors CORR.RSC8011731 = GLOBAL.RSC801_1; finsi
-si present(GLOBAL.ASC802_1) alors CORR.ASC8021731 = GLOBAL.ASC802_1; finsi
-si present(GLOBAL.RSC802_1) alors CORR.RSC8021731 = GLOBAL.RSC802_1; finsi
-si present(GLOBAL.ASC803_1) alors CORR.ASC8031731 = GLOBAL.ASC803_1; finsi
-si present(GLOBAL.RSC803_1) alors CORR.RSC8031731 = GLOBAL.RSC803_1; finsi
-si present(GLOBAL.ASC804_1) alors CORR.ASC8041731 = GLOBAL.ASC804_1; finsi
-si present(GLOBAL.RSC804_1) alors CORR.RSC8041731 = GLOBAL.RSC804_1; finsi
-si present(GLOBAL.ASC805_1) alors CORR.ASC8051731 = GLOBAL.ASC805_1; finsi
-si present(GLOBAL.RSC805_1) alors CORR.RSC8051731 = GLOBAL.RSC805_1; finsi
-si present(GLOBAL.ASC806_1) alors CORR.ASC8061731 = GLOBAL.ASC806_1; finsi
-si present(GLOBAL.RSC806_1) alors CORR.RSC8061731 = GLOBAL.RSC806_1; finsi
-si present(GLOBAL.ASC807_1) alors CORR.ASC8071731 = GLOBAL.ASC807_1; finsi
-si present(GLOBAL.RSC807_1) alors CORR.RSC8071731 = GLOBAL.RSC807_1; finsi
-si present(GLOBAL.ASC808_1) alors CORR.ASC8081731 = GLOBAL.ASC808_1; finsi
-si present(GLOBAL.RSC808_1) alors CORR.RSC8081731 = GLOBAL.RSC808_1; finsi
-si present(GLOBAL.ASC809_1) alors CORR.ASC8091731 = GLOBAL.ASC809_1; finsi
-si present(GLOBAL.RSC809_1) alors CORR.RSC8091731 = GLOBAL.RSC809_1; finsi
si present(GLOBAL.ASC7SJ_1) alors CORR.ASC7SJ1731 = GLOBAL.ASC7SJ_1; finsi
-si present(GLOBAL.RSC7SJ_1) alors CORR.RSC7SJ1731 = GLOBAL.RSC7SJ_1; finsi
si present(GLOBAL.ASC7SK_1) alors CORR.ASC7SK1731 = GLOBAL.ASC7SK_1; finsi
-si present(GLOBAL.RSC7SK_1) alors CORR.RSC7SK1731 = GLOBAL.RSC7SK_1; finsi
si present(GLOBAL.ASC7SR_1) alors CORR.ASC7SR1731 = GLOBAL.ASC7SR_1; finsi
-si present(GLOBAL.RSC7SR_1) alors CORR.RSC7SR1731 = GLOBAL.RSC7SR_1; finsi
si present(GLOBAL.ASC7TC_1) alors CORR.ASC7TC1731 = GLOBAL.ASC7TC_1; finsi
-si present(GLOBAL.RSC7TC_1) alors CORR.RSC7TC1731 = GLOBAL.RSC7TC_1; finsi
si present(GLOBAL.ASC7TD_1) alors CORR.ASC7TD1731 = GLOBAL.ASC7TD_1; finsi
-si present(GLOBAL.RSC7TD_1) alors CORR.RSC7TD1731 = GLOBAL.RSC7TD_1; finsi
si present(GLOBAL.ASC7UA_1) alors CORR.ASC7UA1731 = GLOBAL.ASC7UA_1; finsi
-si present(GLOBAL.RSC7UA_1) alors CORR.RSC7UA1731 = GLOBAL.RSC7UA_1; finsi
si present(GLOBAL.ASC7UB_1) alors CORR.ASC7UB1731 = GLOBAL.ASC7UB_1; finsi
-si present(GLOBAL.RSC7UB_1) alors CORR.RSC7UB1731 = GLOBAL.RSC7UB_1; finsi
si present(GLOBAL.ASC7UE_1) alors CORR.ASC7UE1731 = GLOBAL.ASC7UE_1; finsi
-si present(GLOBAL.RSC7UE_1) alors CORR.RSC7UE1731 = GLOBAL.RSC7UE_1; finsi
si present(GLOBAL.ASC7UG_1) alors CORR.ASC7UG1731 = GLOBAL.ASC7UG_1; finsi
-si present(GLOBAL.RSC7UG_1) alors CORR.RSC7UG1731 = GLOBAL.RSC7UG_1; finsi
si present(GLOBAL.ASC7UI_1) alors CORR.ASC7UI1731 = GLOBAL.ASC7UI_1; finsi
-si present(GLOBAL.RSC7UI_1) alors CORR.RSC7UI1731 = GLOBAL.RSC7UI_1; finsi
si present(GLOBAL.ASC7UK_1) alors CORR.ASC7UK1731 = GLOBAL.ASC7UK_1; finsi
-si present(GLOBAL.RSC7UK_1) alors CORR.RSC7UK1731 = GLOBAL.RSC7UK_1; finsi
-si present(GLOBAL.AILMHD_1) alors CORR.AILMHD1731 = GLOBAL.AILMHD_1; finsi
+si present(GLOBAL.ASC801_1) alors CORR.ASC8011731 = GLOBAL.ASC801_1; finsi
+si present(GLOBAL.ASC802_1) alors CORR.ASC8021731 = GLOBAL.ASC802_1; finsi
+si present(GLOBAL.ASC803_1) alors CORR.ASC8031731 = GLOBAL.ASC803_1; finsi
+si present(GLOBAL.ASC804_1) alors CORR.ASC8041731 = GLOBAL.ASC804_1; finsi
+si present(GLOBAL.ASC805_1) alors CORR.ASC8051731 = GLOBAL.ASC805_1; finsi
+si present(GLOBAL.ASC806_1) alors CORR.ASC8061731 = GLOBAL.ASC806_1; finsi
+si present(GLOBAL.ASC807_1) alors CORR.ASC8071731 = GLOBAL.ASC807_1; finsi
+si present(GLOBAL.ASC808_1) alors CORR.ASC8081731 = GLOBAL.ASC808_1; finsi
+si present(GLOBAL.ASC809_1) alors CORR.ASC8091731 = GLOBAL.ASC809_1; finsi
+si present(GLOBAL.ASOFON_1) alors CORR.ASOFON1731 = GLOBAL.ASOFON_1; finsi
+si present(GLOBAL.ASOUFIP_1) alors CORR.ASOUFIP1731 = GLOBAL.ASOUFIP_1; finsi
+si present(GLOBAL.ATOUREPA_1) alors CORR.ATOUREPA1731 = GLOBAL.ATOUREPA_1; finsi
+si present(GLOBAL.BA1) alors CORR.BA11731 = GLOBAL.BA1; finsi
+si present(GLOBAL.BAALIM) alors CORR.BAALIM1731 = GLOBAL.BAALIM; finsi
+si present(GLOBAL.BACIFBIS) alors CORR.BACIFBIS1731 = GLOBAL.BACIFBIS; finsi
+si present(GLOBAL.BADONJ) alors CORR.BADONJ1731 = GLOBAL.BADONJ; finsi
+si present(GLOBAL.BADONO) alors CORR.BADONO1731 = GLOBAL.BADONO; finsi
+si present(GLOBAL.BAEMV) alors CORR.BAEMV1731 = GLOBAL.BAEMV; finsi
+si present(GLOBAL.BAEP) alors CORR.BAEP1731 = GLOBAL.BAEP; finsi
+si present(GLOBAL.BAEV) alors CORR.BAEV1731 = GLOBAL.BAEV; finsi
+si present(GLOBAL.BAH) alors CORR.BAH1731 = GLOBAL.BAH; finsi
+si present(GLOBAL.BAHQNODEFF) alors CORR.BAHQNODEFF1731 = GLOBAL.BAHQNODEFF; finsi
+si present(GLOBAL.BANOR) alors CORR.BANOR1731 = GLOBAL.BANOR; finsi
+si present(GLOBAL.BAQNODEFF) alors CORR.BAQNODEFF1731 = GLOBAL.BAQNODEFF; finsi
+si present(GLOBAL.BDIFAGRI) alors CORR.BDIFAGRI1731 = GLOBAL.BDIFAGRI; finsi
+si present(GLOBAL.BICIFBIS) alors CORR.BICIFBIS1731 = GLOBAL.BICIFBIS; finsi
+si present(GLOBAL.BICNPF) alors CORR.BICNPF1731 = GLOBAL.BICNPF; finsi
+si present(GLOBAL.BICNPOCF) alors CORR.BICNPOCF1731 = GLOBAL.BICNPOCF; finsi
+si present(GLOBAL.BICNPQCF) alors CORR.BICNPQCF1731 = GLOBAL.BICNPQCF; finsi
+si present(GLOBAL.BICPROOF) alors CORR.BICPROOF1731 = GLOBAL.BICPROOF; finsi
+si present(GLOBAL.BICPROQF) alors CORR.BICPROQF1731 = GLOBAL.BICPROQF; finsi
+si present(GLOBAL.BNCDF7) alors CORR.BNCDF71731 = GLOBAL.BNCDF7; finsi
+si present(GLOBAL.BNCDF) alors CORR.BNCDF1731 = GLOBAL.BNCDF; finsi
+si present(GLOBAL.BNCIFBIS) alors CORR.BNCIFBIS1731 = GLOBAL.BNCIFBIS; finsi
+si present(GLOBAL.BNCNPHQCF) alors CORR.BNCNPHQCF1731 = GLOBAL.BNCNPHQCF; finsi
+si present(GLOBAL.BNCNPQCF) alors CORR.BNCNPQCF1731 = GLOBAL.BNCNPQCF; finsi
+si present(GLOBAL.BNCPHQCF) alors CORR.BNCPHQCF1731 = GLOBAL.BNCPHQCF; finsi
+si present(GLOBAL.BNCPQCF) alors CORR.BNCPQCF1731 = GLOBAL.BNCPQCF; finsi
+si present(GLOBAL.BNCPROPVC) alors CORR.BNCPROPVC1731 = GLOBAL.BNCPROPVC; finsi
+si present(GLOBAL.BNCPROPVP) alors CORR.BNCPROPVP1731 = GLOBAL.BNCPROPVP; finsi
+si present(GLOBAL.BNCPROPVV) alors CORR.BNCPROPVV1731 = GLOBAL.BNCPROPVV; finsi
+si present(GLOBAL.BPRESCOMP) alors CORR.BPRESCOMP1731 = GLOBAL.BPRESCOMP; finsi
+si present(GLOBAL.BRCMBIS) alors CORR.BRCM1731 = GLOBAL.BRCMBIS; finsi
+si present(GLOBAL.BRCMBISB) alors CORR.BRCMBISB1731 = GLOBAL.BRCMBISB; finsi
+si present(GLOBAL.BRCMBISQ) alors CORR.BRCMBISQ1731 = GLOBAL.BRCMBISQ; finsi
+si present(GLOBAL.BRCMQ) alors CORR.BRCMQ1731 = GLOBAL.BRCMQ; finsi
+si present(GLOBAL.BRENOV) alors CORR.BRENOV1731 = GLOBAL.BRENOV; finsi
+si present(GLOBAL.BSN1) alors CORR.BSN11731 = GLOBAL.BSN1; finsi
+si present(GLOBAL.BSN2) alors CORR.BSN21731 = GLOBAL.BSN2; finsi
+si present(GLOBAL.BSOCREP) alors CORR.BSOCREP1731 = GLOBAL.BSOCREP; finsi
+si present(GLOBAL.BSURV) alors CORR.BSURV1731 = GLOBAL.BSURV; finsi
+si present(GLOBAL.COD2TT) alors CORR.COD2TT1731 = GLOBAL.COD2TT; finsi
+si present(GLOBAL.DABNCNP1) alors CORR.DABNCNP11731 = GLOBAL.DABNCNP1; finsi
+si present(GLOBAL.DABNCNP2) alors CORR.DABNCNP21731 = GLOBAL.DABNCNP2; finsi
+si present(GLOBAL.DABNCNP3) alors CORR.DABNCNP31731 = GLOBAL.DABNCNP3; finsi
+si present(GLOBAL.DABNCNP4) alors CORR.DABNCNP41731 = GLOBAL.DABNCNP4; finsi
+si present(GLOBAL.DABNCNP5) alors CORR.DABNCNP51731 = GLOBAL.DABNCNP5; finsi
+si present(GLOBAL.DABNCNP6) alors CORR.DABNCNP61731 = GLOBAL.DABNCNP6; finsi
+si present(GLOBAL.DABNCNP) alors CORR.DABNCNP1731 = GLOBAL.DABNCNP; finsi
+si present(GLOBAL.DAGRI1) alors CORR.DAGRI11731 = GLOBAL.DAGRI1; finsi
+si present(GLOBAL.DAGRI2) alors CORR.DAGRI21731 = GLOBAL.DAGRI2; finsi
+si present(GLOBAL.DAGRI3) alors CORR.DAGRI31731 = GLOBAL.DAGRI3; finsi
+si present(GLOBAL.DAGRI4) alors CORR.DAGRI41731 = GLOBAL.DAGRI4; finsi
+si present(GLOBAL.DAGRI5) alors CORR.DAGRI51731 = GLOBAL.DAGRI5; finsi
+si present(GLOBAL.DAGRI6) alors CORR.DAGRI61731 = GLOBAL.DAGRI6; finsi
+si present(GLOBAL.DAGRI) alors CORR.DAGRI1731 = GLOBAL.DAGRI; finsi
+si present(GLOBAL.DAGRIIMP) alors CORR.DAGRIIMP1731 = GLOBAL.DAGRIIMP; finsi
+si present(GLOBAL.DBAIP) alors CORR.DBAIP1731 = GLOBAL.DBAIP; finsi
+si present(GLOBAL.DEF4BB) alors CORR.DEF4BB1731 = GLOBAL.DEF4BB; finsi
+si present(GLOBAL.DEF4BC) alors CORR.DEF4BC1731 = GLOBAL.DEF4BC; finsi
+si present(GLOBAL.DEF4BD) alors CORR.DEF4BD1731 = GLOBAL.DEF4BD; finsi
+si present(GLOBAL.DEFAA0) alors CORR.DEFAA01731 = GLOBAL.DEFAA0; finsi
+si present(GLOBAL.DEFAA1) alors CORR.DEFAA11731 = GLOBAL.DEFAA1; finsi
+si present(GLOBAL.DEFAA2) alors CORR.DEFAA21731 = GLOBAL.DEFAA2; finsi
+si present(GLOBAL.DEFAA3) alors CORR.DEFAA31731 = GLOBAL.DEFAA3; finsi
+si present(GLOBAL.DEFAA4) alors CORR.DEFAA41731 = GLOBAL.DEFAA4; finsi
+si present(GLOBAL.DEFAA5) alors CORR.DEFAA51731 = GLOBAL.DEFAA5; finsi
+si present(GLOBAL.DEFBA7) alors CORR.DEFBA71731 = GLOBAL.DEFBA7; finsi
+si present(GLOBAL.DEFBA) alors CORR.DEFBA1731 = GLOBAL.DEFBA; finsi
+si present(GLOBAL.DEFBANI470) alors CORR.DEFBANI4701731 = GLOBAL.DEFBANI470; finsi
+si present(GLOBAL.DEFBANI470BIS) alors CORR.DEFBANI470BIS1731 = GLOBAL.DEFBANI470BIS; finsi
+si present(GLOBAL.DEFBANI) alors CORR.DEFBANI1731 = GLOBAL.DEFBANI; finsi
+si present(GLOBAL.DEFBANIH470) alors CORR.DEFBANIH4701731 = GLOBAL.DEFBANIH470; finsi
+si present(GLOBAL.DEFBIC1) alors CORR.DEFBIC11731 = GLOBAL.DEFBIC1; finsi
+si present(GLOBAL.DEFBIC2) alors CORR.DEFBIC21731 = GLOBAL.DEFBIC2; finsi
+si present(GLOBAL.DEFBIC3) alors CORR.DEFBIC31731 = GLOBAL.DEFBIC3; finsi
+si present(GLOBAL.DEFBIC4) alors CORR.DEFBIC41731 = GLOBAL.DEFBIC4; finsi
+si present(GLOBAL.DEFBIC5) alors CORR.DEFBIC51731 = GLOBAL.DEFBIC5; finsi
+si present(GLOBAL.DEFBIC6) alors CORR.DEFBIC61731 = GLOBAL.DEFBIC6; finsi
+si present(GLOBAL.DEFBICNP470) alors CORR.DEFBICNP4701731 = GLOBAL.DEFBICNP470; finsi
+si present(GLOBAL.DEFBICNPH470) alors CORR.DEFBICNPH4701731 = GLOBAL.DEFBICNPH470; finsi
+si present(GLOBAL.DEFBNCNP470) alors CORR.DEFBNCNP4701731 = GLOBAL.DEFBNCNP470; finsi
+si present(GLOBAL.DEFBNCNP) alors CORR.DEFBNCNP1731 = GLOBAL.DEFBNCNP; finsi
+si present(GLOBAL.DEFBNCNPH470) alors CORR.DEFBNCNPH4701731 = GLOBAL.DEFBNCNPH470; finsi
+si present(GLOBAL.DEFIBA) alors CORR.DEFIBA1731 = GLOBAL.DEFIBA; finsi
+si present(GLOBAL.DEFLOC11) alors CORR.DEFLOC111731 = GLOBAL.DEFLOC11; finsi
+si present(GLOBAL.DEFLOC) alors CORR.DEFLOC1731 = GLOBAL.DEFLOC; finsi
+si present(GLOBAL.DEFLOCNP) alors CORR.DEFLOCNP1731 = GLOBAL.DEFLOCNP; finsi
+si present(GLOBAL.DEFLOCNPBIS) alors CORR.BIDON1731 = GLOBAL.DEFLOCNPBIS; finsi
+si present(GLOBAL.DEFNPI) alors CORR.DEFNPI1731 = GLOBAL.DEFNPI; finsi
+si present(GLOBAL.DEFRCM2) alors CORR.DEFRCM21731 = GLOBAL.DEFRCM2; finsi
+si present(GLOBAL.DEFRCM3) alors CORR.DEFRCM31731 = GLOBAL.DEFRCM3; finsi
+si present(GLOBAL.DEFRCM4) alors CORR.DEFRCM41731 = GLOBAL.DEFRCM4; finsi
+si present(GLOBAL.DEFRCM5) alors CORR.DEFRCM51731 = GLOBAL.DEFRCM5; finsi
+si present(GLOBAL.DEFRCM6) alors CORR.DEFRCM61731 = GLOBAL.DEFRCM6; finsi
+si present(GLOBAL.DEFRCM) alors CORR.DEFRCM1731 = GLOBAL.DEFRCM; finsi
+si present(GLOBAL.DEFRCMI) alors CORR.DEFRCMI1731 = GLOBAL.DEFRCMI; finsi
+si present(GLOBAL.DEFRFNONIBIS) alors CORR.DEFRFNONI1731 = GLOBAL.DEFRFNONIBIS; finsi
+si present(GLOBAL.DEFZU) alors CORR.DEFZU1731 = GLOBAL.DEFZU; finsi
+si present(GLOBAL.DFANTPROV) alors CORR.DFANTPROV1731 = GLOBAL.DFANTPROV; finsi
+si present(GLOBAL.DFBICNPF) alors CORR.DFBICNPF1731 = GLOBAL.DFBICNPF; finsi
+si present(GLOBAL.DFCE) alors CORR.DFCE1731 = GLOBAL.DFCE; finsi
+si present(GLOBAL.DFCG) alors CORR.DFCG1731 = GLOBAL.DFCG; finsi
+si present(GLOBAL.DFRCM1) alors CORR.DFRCM11731 = GLOBAL.DFRCM1; finsi
+si present(GLOBAL.DFRCM2) alors CORR.DFRCM21731 = GLOBAL.DFRCM2; finsi
+si present(GLOBAL.DFRCM3) alors CORR.DFRCM31731 = GLOBAL.DFRCM3; finsi
+si present(GLOBAL.DFRCM4) alors CORR.DFRCM41731 = GLOBAL.DFRCM4; finsi
+si present(GLOBAL.DFRCM5) alors CORR.DFRCM51731 = GLOBAL.DFRCM5; finsi
+si present(GLOBAL.DFRCMN) alors CORR.DFRCMN1731 = GLOBAL.DFRCMN; finsi
+si present(GLOBAL.DIDABNCNP1) alors CORR.DIDABNCNP11731 = GLOBAL.DIDABNCNP1; finsi
+si present(GLOBAL.DLMRN7) alors CORR.DLMRN71731 = GLOBAL.DLMRN7; finsi
+si present(GLOBAL.DLMRNT) alors CORR.DLMRN1731 = GLOBAL.DLMRNT; finsi
+si present(GLOBAL.DMOND) alors CORR.DMOND1731 = GLOBAL.DMOND; finsi
+si present(GLOBAL.DNPLOCIMPU) alors CORR.DNPLOCIMPU1731 = GLOBAL.DNPLOCIMPU; finsi
+si present(GLOBAL.DRCF) alors CORR.DRCF1731 = GLOBAL.DRCF; finsi
+si present(GLOBAL.DRFRP) alors CORR.DRFRP1731 = GLOBAL.DRFRP; finsi
+si present(GLOBAL.FRD1) alors CORR.FRD11731 = GLOBAL.FRD1; finsi
+si present(GLOBAL.FRD2) alors CORR.FRD21731 = GLOBAL.FRD2; finsi
+si present(GLOBAL.FRD3) alors CORR.FRD31731 = GLOBAL.FRD3; finsi
+si present(GLOBAL.FRD4) alors CORR.FRD41731 = GLOBAL.FRD4; finsi
+si present(GLOBAL.FRDC) alors CORR.FRDC1731 = GLOBAL.FRDC; finsi
+si present(GLOBAL.FRDV) alors CORR.FRDV1731 = GLOBAL.FRDV; finsi
+si present(GLOBAL.IFIACT) alors CORR.IFIACT1731 = GLOBAL.IFIACT; finsi
+si present(GLOBAL.INDSEUILBA) alors CORR.INDSEUILBA1731 = GLOBAL.INDSEUILBA; finsi
+si present(GLOBAL.IPTEFN) alors CORR.IPTEFN1731 = GLOBAL.IPTEFN; finsi
+si present(GLOBAL.LOCNPCF) alors CORR.LOCNPCF1731 = GLOBAL.LOCNPCF; finsi
+si present(GLOBAL.MIBPVC) alors CORR.MIBPVC1731 = GLOBAL.MIBPVC; finsi
+si present(GLOBAL.MIBPVP) alors CORR.MIBPVP1731 = GLOBAL.MIBPVP; finsi
+si present(GLOBAL.MIBPVV) alors CORR.MIBPVV1731 = GLOBAL.MIBPVV; finsi
+si present(GLOBAL.MIBRNETC) alors CORR.MIBRNETC1731 = GLOBAL.MIBRNETC; finsi
+si present(GLOBAL.MIBRNETP) alors CORR.MIBRNETP1731 = GLOBAL.MIBRNETP; finsi
+si present(GLOBAL.MIBRNETV) alors CORR.MIBRNETV1731 = GLOBAL.MIBRNETV; finsi
+si present(GLOBAL.MLOCNET) alors CORR.MLOCNET1731 = GLOBAL.MLOCNET; finsi
+si present(GLOBAL.NPLOCNETBIS) alors CORR.NPLOCNETBIS1731 = GLOBAL.NPLOCNETBIS; finsi
+si present(GLOBAL.NPLOCNETC) alors CORR.NPLOCNETC1731 = GLOBAL.NPLOCNETC; finsi
+si present(GLOBAL.NPLOCNETPAC) alors CORR.NPLOCNETPAC1731 = GLOBAL.NPLOCNETPAC; finsi
+si present(GLOBAL.NPLOCNETV) alors CORR.NPLOCNETV1731 = GLOBAL.NPLOCNETV; finsi
+si present(GLOBAL.PREREV) alors CORR.PREREV1731 = GLOBAL.PREREV; finsi
+si present(GLOBAL.R1649) alors CORR.R16491731 = GLOBAL.R1649; finsi
+si present(GLOBAL.RCELHZ_1) alors CORR.RCELHZ1731 = GLOBAL.RCELHZ_1; finsi
+si present(GLOBAL.RCELIM_1) alors CORR.RCELIM1731 = GLOBAL.RCELIM_1; finsi
+si present(GLOBAL.RCELIN_1) alors CORR.RCELIN1731 = GLOBAL.RCELIN_1; finsi
+si present(GLOBAL.RCELIO_1) alors CORR.RCELIO1731 = GLOBAL.RCELIO_1; finsi
+si present(GLOBAL.RCELIP_1) alors CORR.RCELIP1731 = GLOBAL.RCELIP_1; finsi
+si present(GLOBAL.RCELIV_1) alors CORR.RCELIV1731 = GLOBAL.RCELIV_1; finsi
+si present(GLOBAL.RCELIX_1) alors CORR.RCELIX1731 = GLOBAL.RCELIX_1; finsi
+si present(GLOBAL.RCELIY_1) alors CORR.RCELIY1731 = GLOBAL.RCELIY_1; finsi
+si present(GLOBAL.RCELIZ_1) alors CORR.RCELIZ1731 = GLOBAL.RCELIZ_1; finsi
+si present(GLOBAL.RCELKC_1) alors CORR.RCELKC1731 = GLOBAL.RCELKC_1; finsi
+si present(GLOBAL.RCELKD_1) alors CORR.RCELKD1731 = GLOBAL.RCELKD_1; finsi
+si present(GLOBAL.RCELKT_1) alors CORR.RCELKT1731 = GLOBAL.RCELKT_1; finsi
+si present(GLOBAL.RCELKU_1) alors CORR.RCELKU1731 = GLOBAL.RCELKU_1; finsi
+si present(GLOBAL.RCELKV_1) alors CORR.RCELKV1731 = GLOBAL.RCELKV_1; finsi
+si present(GLOBAL.RCELLK_1) alors CORR.RCELLK1731 = GLOBAL.RCELLK_1; finsi
+si present(GLOBAL.RCELLL_1) alors CORR.RCELLL1731 = GLOBAL.RCELLL_1; finsi
+si present(GLOBAL.RCELLO_1) alors CORR.RCELLO1731 = GLOBAL.RCELLO_1; finsi
+si present(GLOBAL.RCELLP_1) alors CORR.RCELLP1731 = GLOBAL.RCELLP_1; finsi
+si present(GLOBAL.RCELMA_1) alors CORR.RCELMA1731 = GLOBAL.RCELMA_1; finsi
+si present(GLOBAL.RCELMB_1) alors CORR.RCELMB1731 = GLOBAL.RCELMB_1; finsi
+si present(GLOBAL.RCELMC_1) alors CORR.RCELMC1731 = GLOBAL.RCELMC_1; finsi
+si present(GLOBAL.RCELMD_1) alors CORR.RCELMD1731 = GLOBAL.RCELMD_1; finsi
+si present(GLOBAL.RCELMI_1) alors CORR.RCELMI1731 = GLOBAL.RCELMI_1; finsi
+si present(GLOBAL.RCELMJ_1) alors CORR.RCELMJ1731 = GLOBAL.RCELMJ_1; finsi
+si present(GLOBAL.RCELMK_1) alors CORR.RCELMK1731 = GLOBAL.RCELMK_1; finsi
+si present(GLOBAL.RCELML_1) alors CORR.RCELML1731 = GLOBAL.RCELML_1; finsi
+si present(GLOBAL.RCELMO_1) alors CORR.RCELMO1731 = GLOBAL.RCELMO_1; finsi
+si present(GLOBAL.RCELMP_1) alors CORR.RCELMP1731 = GLOBAL.RCELMP_1; finsi
+si present(GLOBAL.RCELMQ_1) alors CORR.RCELMQ1731 = GLOBAL.RCELMQ_1; finsi
+si present(GLOBAL.RCELMR_1) alors CORR.RCELMR1731 = GLOBAL.RCELMR_1; finsi
+si present(GLOBAL.RCELMS_1) alors CORR.RCELMS1731 = GLOBAL.RCELMS_1; finsi
+si present(GLOBAL.RCELMT_1) alors CORR.RCELMT1731 = GLOBAL.RCELMT_1; finsi
+si present(GLOBAL.RCELMU_1) alors CORR.RCELMU1731 = GLOBAL.RCELMU_1; finsi
+si present(GLOBAL.RCELMV_1) alors CORR.RCELMV1731 = GLOBAL.RCELMV_1; finsi
+si present(GLOBAL.RCELNS_1) alors CORR.RCELNS1731 = GLOBAL.RCELNS_1; finsi
+si present(GLOBAL.RCELNT_1) alors CORR.RCELNT1731 = GLOBAL.RCELNT_1; finsi
+si present(GLOBAL.RCELNU_1) alors CORR.RCELNU1731 = GLOBAL.RCELNU_1; finsi
+si present(GLOBAL.RCELNV_1) alors CORR.RCELNV1731 = GLOBAL.RCELNV_1; finsi
+si present(GLOBAL.RCELOJ_1) alors CORR.RCELOJ1731 = GLOBAL.RCELOJ_1; finsi
+si present(GLOBAL.RCELOU_1) alors CORR.RCELOU1731 = GLOBAL.RCELOU_1; finsi
+si present(GLOBAL.RCELOV_1) alors CORR.RCELOV1731 = GLOBAL.RCELOV_1; finsi
+si present(GLOBAL.RCELOW_1) alors CORR.RCELOW1731 = GLOBAL.RCELOW_1; finsi
+si present(GLOBAL.RCELP1A_1) alors CORR.RCELP1A1731 = GLOBAL.RCELP1A_1; finsi
+si present(GLOBAL.RCELP1B_1) alors CORR.RCELP1B1731 = GLOBAL.RCELP1B_1; finsi
+si present(GLOBAL.RCELP1C_1) alors CORR.RCELP1C1731 = GLOBAL.RCELP1C_1; finsi
+si present(GLOBAL.RCELP1D_1) alors CORR.RCELP1D1731 = GLOBAL.RCELP1D_1; finsi
+si present(GLOBAL.RCELP1E_1) alors CORR.RCELP1E1731 = GLOBAL.RCELP1E_1; finsi
+si present(GLOBAL.RCELPC_1) alors CORR.RCELPC1731 = GLOBAL.RCELPC_1; finsi
+si present(GLOBAL.RCELPD_1) alors CORR.RCELPD1731 = GLOBAL.RCELPD_1; finsi
+si present(GLOBAL.RCELPE_1) alors CORR.RCELPE1731 = GLOBAL.RCELPE_1; finsi
+si present(GLOBAL.RCELREPWT_1) alors CORR.RCELREPWT1731 = GLOBAL.RCELREPWT_1; finsi
+si present(GLOBAL.RCELREPWU_1) alors CORR.RCELREPWU1731 = GLOBAL.RCELREPWU_1; finsi
+si present(GLOBAL.RCELREPWV_1) alors CORR.RCELREPWV1731 = GLOBAL.RCELREPWV_1; finsi
+si present(GLOBAL.RCELREPWW_1) alors CORR.RCELREPWW1731 = GLOBAL.RCELREPWW_1; finsi
+si present(GLOBAL.RCELRK_1) alors CORR.RCELRK1731 = GLOBAL.RCELRK_1; finsi
+si present(GLOBAL.RCELRL_1) alors CORR.RCELRL1731 = GLOBAL.RCELRL_1; finsi
+si present(GLOBAL.RCELRM_1) alors CORR.RCELRM1731 = GLOBAL.RCELRM_1; finsi
+si present(GLOBAL.RCELRN_1) alors CORR.RCELRN1731 = GLOBAL.RCELRN_1; finsi
+si present(GLOBAL.RCELRT_1) alors CORR.RCELRT1731 = GLOBAL.RCELRT_1; finsi
+si present(GLOBAL.RCELRU_1) alors CORR.RCELRU1731 = GLOBAL.RCELRU_1; finsi
+si present(GLOBAL.RCELUU_1) alors CORR.RCELUU1731 = GLOBAL.RCELUU_1; finsi
+si present(GLOBAL.RCELUV_1) alors CORR.RCELUV1731 = GLOBAL.RCELUV_1; finsi
+si present(GLOBAL.RCELUW_1) alors CORR.RCELUW1731 = GLOBAL.RCELUW_1; finsi
+si present(GLOBAL.RCELUX_1) alors CORR.RCELUX1731 = GLOBAL.RCELUX_1; finsi
+si present(GLOBAL.RCELVJ_1) alors CORR.RCELVJ1731 = GLOBAL.RCELVJ_1; finsi
+si present(GLOBAL.RCELVK_1) alors CORR.RCELVK1731 = GLOBAL.RCELVK_1; finsi
+si present(GLOBAL.RCELVL_1) alors CORR.RCELVL1731 = GLOBAL.RCELVL_1; finsi
+si present(GLOBAL.RCELVO_1) alors CORR.RCELVO1731 = GLOBAL.RCELVO_1; finsi
+si present(GLOBAL.RCELYI_1) alors CORR.RCELYI1731 = GLOBAL.RCELYI_1; finsi
+si present(GLOBAL.RCELYJ_1) alors CORR.RCELYJ1731 = GLOBAL.RCELYJ_1; finsi
+si present(GLOBAL.RCELYK_1) alors CORR.RCELYK1731 = GLOBAL.RCELYK_1; finsi
+si present(GLOBAL.RCELYL_1) alors CORR.RCELYL1731 = GLOBAL.RCELYL_1; finsi
+si present(GLOBAL.RCELZI_1) alors CORR.RCELZI1731 = GLOBAL.RCELZI_1; finsi
+si present(GLOBAL.RCELZJ_1) alors CORR.RCELZJ1731 = GLOBAL.RCELZJ_1; finsi
+si present(GLOBAL.RCELZK_1) alors CORR.RCELZK1731 = GLOBAL.RCELZK_1; finsi
+si present(GLOBAL.RCELZL_1) alors CORR.RCELZL1731 = GLOBAL.RCELZL_1; finsi
+si present(GLOBAL.RCINE_1) alors CORR.RCINE1731 = GLOBAL.RCINE_1; finsi
+si present(GLOBAL.RCM1) alors CORR.RCM1731 = GLOBAL.RCM1; finsi
+si present(GLOBAL.RCMFR) alors CORR.RCMFR1731 = GLOBAL.RCMFR; finsi
+si present(GLOBAL.RCMFRNET) alors CORR.RCMFRNET1731 = GLOBAL.RCMFRNET; finsi
+si present(GLOBAL.RCOD7KW_1) alors CORR.RCOD7KW1731 = GLOBAL.RCOD7KW_1; finsi
+si present(GLOBAL.RCOD7KX_1) alors CORR.RCOD7KX1731 = GLOBAL.RCOD7KX_1; finsi
+si present(GLOBAL.RCOD7KY_1) alors CORR.RCOD7KY1731 = GLOBAL.RCOD7KY_1; finsi
+si present(GLOBAL.RCOD7KZ_1) alors CORR.RCOD7KZ1731 = GLOBAL.RCOD7KZ_1; finsi
+si present(GLOBAL.RCODMN_1) alors CORR.RCODMN1731 = GLOBAL.RCODMN_1; finsi
+si present(GLOBAL.RCODMW_1) alors CORR.RCODMW1731 = GLOBAL.RCODMW_1; finsi
+si present(GLOBAL.RCODMZ_1) alors CORR.RCODMZ1731 = GLOBAL.RCODMZ_1; finsi
+si present(GLOBAL.RCODOY_1) alors CORR.RCODOY1731 = GLOBAL.RCODOY_1; finsi
+si present(GLOBAL.RCODPZ_1) alors CORR.RCODPZ1731 = GLOBAL.RCODPZ_1; finsi
+si present(GLOBAL.RCOLENT) alors CORR.RCOLENT1731 = GLOBAL.RCOLENT; finsi
+si present(GLOBAL.RCOMP_1) alors CORR.RCOMP1731 = GLOBAL.RCOMP_1; finsi
+si present(GLOBAL.RDIFAGRI_1) alors CORR.RDIFAGRI1731 = GLOBAL.RDIFAGRI_1; finsi
+si present(GLOBAL.RDOMSOC1) alors CORR.RDOMSOC11731 = GLOBAL.RDOMSOC1; finsi
+si present(GLOBAL.RDONDJ_1) alors CORR.RDONDJ1731 = GLOBAL.RDONDJ_1; finsi
+si present(GLOBAL.RDONDO_1) alors CORR.RDONDO1731 = GLOBAL.RDONDO_1; finsi
+si present(GLOBAL.RDONIFI_1) alors CORR.RDONIFI11731 = GLOBAL.RDONIFI_1; finsi
+si present(GLOBAL.RDONIFI2_1) alors CORR.RDONIFI21731 = GLOBAL.RDONIFI2_1; finsi
+si present(GLOBAL.RDONS_1) alors CORR.RDONS1731 = GLOBAL.RDONS_1; finsi
+si present(GLOBAL.RDUFREP_1) alors CORR.RDUFREP1731 = GLOBAL.RDUFREP_1; finsi
+si present(GLOBAL.REB) alors CORR.REB1731 = GLOBAL.REB; finsi
+si present(GLOBAL.RED_1) alors CORR.RED1731 = GLOBAL.RED_1; finsi
+si present(GLOBAL.REPRCMB) alors CORR.REPRCMB1731 = GLOBAL.REPRCMB; finsi
+si present(GLOBAL.REVDON) alors CORR.REVDON1731 = GLOBAL.REVDON; finsi
+si present(GLOBAL.REVQTOTQHT) alors CORR.REVQTOTQHT1731 = GLOBAL.REVQTOTQHT; finsi
+si present(GLOBAL.REVTP) alors CORR.REVTP1731 = GLOBAL.REVTP; finsi
+si present(GLOBAL.RFCD) alors CORR.RFCD1731 = GLOBAL.RFCD; finsi
+si present(GLOBAL.RFCE) alors CORR.RFCE1731 = GLOBAL.RFCE; finsi
+si present(GLOBAL.RFCF) alors CORR.RFCF1731 = GLOBAL.RFCF; finsi
+si present(GLOBAL.RFCG) alors CORR.RFCG1731 = GLOBAL.RFCG; finsi
+si present(GLOBAL.RFDANT) alors CORR.RFDANT1731 = GLOBAL.RFDANT; finsi
+si present(GLOBAL.RFDORD) alors CORR.RFDORD1731 = GLOBAL.RFDORD; finsi
+si present(GLOBAL.RFIPC_1) alors CORR.RFIPC1731 = GLOBAL.RFIPC_1; finsi
+si present(GLOBAL.RFIPDOM_1) alors CORR.RFIPDOM1731 = GLOBAL.RFIPDOM_1; finsi
+si present(GLOBAL.RFON) alors CORR.RFON1731 = GLOBAL.RFON; finsi
+si present(GLOBAL.RFORET_1) alors CORR.RFORET1731 = GLOBAL.RFORET_1; finsi
+si present(GLOBAL.RFREVENU) alors CORR.RFREVENU1731 = GLOBAL.RFREVENU; finsi
+si present(GLOBAL.RGPROV) alors CORR.RGPROV1731 = GLOBAL.RGPROV; finsi
+si present(GLOBAL.RHEBE_1) alors CORR.RHEBE1731 = GLOBAL.RHEBE_1; finsi
+si present(GLOBAL.RIDEFRI) alors CORR.RIDEFRI1731 = GLOBAL.RIDEFRI; finsi
si present(GLOBAL.RILMHD_1) alors CORR.RILMHD1731 = GLOBAL.RILMHD_1; finsi
-si present(GLOBAL.AILMHE_1) alors CORR.AILMHE1731 = GLOBAL.AILMHE_1; finsi
si present(GLOBAL.RILMHE_1) alors CORR.RILMHE1731 = GLOBAL.RILMHE_1; finsi
-si present(GLOBAL.AILMHF_1) alors CORR.AILMHF1731 = GLOBAL.AILMHF_1; finsi
si present(GLOBAL.RILMHF_1) alors CORR.RILMHF1731 = GLOBAL.RILMHF_1; finsi
-si present(GLOBAL.AILMHG_1) alors CORR.AILMHG1731 = GLOBAL.AILMHG_1; finsi
si present(GLOBAL.RILMHG_1) alors CORR.RILMHG1731 = GLOBAL.RILMHG_1; finsi
-si present(GLOBAL.AILMHH_1) alors CORR.AILMHH1731 = GLOBAL.AILMHH_1; finsi
si present(GLOBAL.RILMHH_1) alors CORR.RILMHH1731 = GLOBAL.RILMHH_1; finsi
-si present(GLOBAL.AILMKE_1) alors CORR.AILMKE1731 = GLOBAL.AILMKE_1; finsi
+si present(GLOBAL.RILMHO_1) alors CORR.RILMHO1731 = GLOBAL.RILMHO_1; finsi
+si present(GLOBAL.RILMHP_1) alors CORR.RILMHP1731 = GLOBAL.RILMHP_1; finsi
+si present(GLOBAL.RILMHQ_1) alors CORR.RILMHQ1731 = GLOBAL.RILMHQ_1; finsi
+si present(GLOBAL.RILMHR_1) alors CORR.RILMHR1731 = GLOBAL.RILMHR_1; finsi
+si present(GLOBAL.RILMHS_1) alors CORR.RILMHS1731 = GLOBAL.RILMHS_1; finsi
+si present(GLOBAL.RILMHT_1) alors CORR.RILMHT1731 = GLOBAL.RILMHT_1; finsi
+si present(GLOBAL.RILMHU_1) alors CORR.RILMHU1731 = GLOBAL.RILMHU_1; finsi
+si present(GLOBAL.RILMHV_1) alors CORR.RILMHV1731 = GLOBAL.RILMHV_1; finsi
+si present(GLOBAL.RILMHW_1) alors CORR.RILMHW1731 = GLOBAL.RILMHW_1; finsi
+si present(GLOBAL.RILMHX_1) alors CORR.RILMHX1731 = GLOBAL.RILMHX_1; finsi
si present(GLOBAL.RILMKE_1) alors CORR.RILMKE1731 = GLOBAL.RILMKE_1; finsi
-si present(GLOBAL.AILMKF_1) alors CORR.AILMKF1731 = GLOBAL.AILMKF_1; finsi
si present(GLOBAL.RILMKF_1) alors CORR.RILMKF1731 = GLOBAL.RILMKF_1; finsi
-si present(GLOBAL.AILMKG_1) alors CORR.AILMKG1731 = GLOBAL.AILMKG_1; finsi
si present(GLOBAL.RILMKG_1) alors CORR.RILMKG1731 = GLOBAL.RILMKG_1; finsi
-si present(GLOBAL.AILMKH_1) alors CORR.AILMKH1731 = GLOBAL.AILMKH_1; finsi
si present(GLOBAL.RILMKH_1) alors CORR.RILMKH1731 = GLOBAL.RILMKH_1; finsi
-si present(GLOBAL.AILMKI_1) alors CORR.AILMKI1731 = GLOBAL.AILMKI_1; finsi
si present(GLOBAL.RILMKI_1) alors CORR.RILMKI1731 = GLOBAL.RILMKI_1; finsi
-si present(GLOBAL.AILMOA_1) alors CORR.AILMOA1731 = GLOBAL.AILMOA_1; finsi
si present(GLOBAL.RILMOA_1) alors CORR.RILMOA1731 = GLOBAL.RILMOA_1; finsi
-si present(GLOBAL.AILMOB_1) alors CORR.AILMOB1731 = GLOBAL.AILMOB_1; finsi
si present(GLOBAL.RILMOB_1) alors CORR.RILMOB1731 = GLOBAL.RILMOB_1; finsi
-si present(GLOBAL.AILMOC_1) alors CORR.AILMOC1731 = GLOBAL.AILMOC_1; finsi
si present(GLOBAL.RILMOC_1) alors CORR.RILMOC1731 = GLOBAL.RILMOC_1; finsi
-si present(GLOBAL.AILMOD_1) alors CORR.AILMOD1731 = GLOBAL.AILMOD_1; finsi
si present(GLOBAL.RILMOD_1) alors CORR.RILMOD1731 = GLOBAL.RILMOD_1; finsi
-si present(GLOBAL.AILMOE_1) alors CORR.AILMOE1731 = GLOBAL.AILMOE_1; finsi
si present(GLOBAL.RILMOE_1) alors CORR.RILMOE1731 = GLOBAL.RILMOE_1; finsi
-si present(GLOBAL.AILMPO_1) alors CORR.AILMPO1731 = GLOBAL.AILMPO_1; finsi
+si present(GLOBAL.RILMOP_1) alors CORR.RILMOP1731 = GLOBAL.RILMOP_1; finsi
+si present(GLOBAL.RILMOQ_1) alors CORR.RILMOQ1731 = GLOBAL.RILMOQ_1; finsi
+si present(GLOBAL.RILMOR_1) alors CORR.RILMOR1731 = GLOBAL.RILMOR_1; finsi
+si present(GLOBAL.RILMOS_1) alors CORR.RILMOS1731 = GLOBAL.RILMOS_1; finsi
+si present(GLOBAL.RILMOT_1) alors CORR.RILMOT1731 = GLOBAL.RILMOT_1; finsi
si present(GLOBAL.RILMPO_1) alors CORR.RILMPO1731 = GLOBAL.RILMPO_1; finsi
-si present(GLOBAL.AILMPP_1) alors CORR.AILMPP1731 = GLOBAL.AILMPP_1; finsi
si present(GLOBAL.RILMPP_1) alors CORR.RILMPP1731 = GLOBAL.RILMPP_1; finsi
-si present(GLOBAL.AILMPQ_1) alors CORR.AILMPQ1731 = GLOBAL.AILMPQ_1; finsi
si present(GLOBAL.RILMPQ_1) alors CORR.RILMPQ1731 = GLOBAL.RILMPQ_1; finsi
-si present(GLOBAL.AILMPR_1) alors CORR.AILMPR1731 = GLOBAL.AILMPR_1; finsi
si present(GLOBAL.RILMPR_1) alors CORR.RILMPR1731 = GLOBAL.RILMPR_1; finsi
-si present(GLOBAL.AILMPS_1) alors CORR.AILMPS1731 = GLOBAL.AILMPS_1; finsi
si present(GLOBAL.RILMPS_1) alors CORR.RILMPS1731 = GLOBAL.RILMPS_1; finsi
-si present(GLOBAL.APIREPJN_1) alors CORR.APIREPJN1731 = GLOBAL.APIREPJN_1; finsi
-si present(GLOBAL.RPIJN_1) alors CORR.RPIJN1731 = GLOBAL.RPIJN_1; finsi
-si present(GLOBAL.APIREPJO_1) alors CORR.APIREPJO1731 = GLOBAL.APIREPJO_1; finsi
-si present(GLOBAL.RPIJO_1) alors CORR.RPIJO1731 = GLOBAL.RPIJO_1; finsi
-si present(GLOBAL.APIREPJP_1) alors CORR.APIREPJP1731 = GLOBAL.APIREPJP_1; finsi
-si present(GLOBAL.RPIJP_1) alors CORR.RPIJP1731 = GLOBAL.RPIJP_1; finsi
-si present(GLOBAL.APIREPJQ_1) alors CORR.APIREPJQ1731 = GLOBAL.APIREPJQ_1; finsi
-si present(GLOBAL.RPIJQ_1) alors CORR.RPIJQ1731 = GLOBAL.RPIJQ_1; finsi
-si present(GLOBAL.APIJV_1) alors CORR.APIJV1731 = GLOBAL.APIJV_1; finsi
-si present(GLOBAL.RPIJV_1) alors CORR.RPIJV1731 = GLOBAL.RPIJV_1; finsi
-si present(GLOBAL.APIJW_1) alors CORR.APIJW1731 = GLOBAL.APIJW_1; finsi
-si present(GLOBAL.RPIJW_1) alors CORR.RPIJW1731 = GLOBAL.RPIJW_1; finsi
-si present(GLOBAL.APIJX_1) alors CORR.APIJX1731 = GLOBAL.APIJX_1; finsi
-si present(GLOBAL.RPIJX_1) alors CORR.RPIJX1731 = GLOBAL.RPIJX_1; finsi
-si present(GLOBAL.APIJY_1) alors CORR.APIJY1731 = GLOBAL.APIJY_1; finsi
-si present(GLOBAL.RPIJY_1) alors CORR.RPIJY1731 = GLOBAL.RPIJY_1; finsi
-si present(GLOBAL.ANORMJR_1) alors CORR.ANORMJR1731 = GLOBAL.ANORMJR_1; finsi
-si present(GLOBAL.RNORMJR_1) alors CORR.RNORMJR1731 = GLOBAL.RNORMJR_1; finsi
-si present(GLOBAL.ANORMJS_1) alors CORR.ANORMJS1731 = GLOBAL.ANORMJS_1; finsi
-si present(GLOBAL.RNORMJS_1) alors CORR.RNORMJS1731 = GLOBAL.RNORMJS_1; finsi
-si present(GLOBAL.ANORMJT_1) alors CORR.ANORMJT1731 = GLOBAL.ANORMJT_1; finsi
-si present(GLOBAL.RNORMJT_1) alors CORR.RNORMJT1731 = GLOBAL.RNORMJT_1; finsi
-si present(GLOBAL.ANORMJU_1) alors CORR.ANORMJU1731 = GLOBAL.ANORMJU_1; finsi
-si present(GLOBAL.RNORMJU_1) alors CORR.RNORMJU1731 = GLOBAL.RNORMJU_1; finsi
-si present(GLOBAL.ANORMLG_1) alors CORR.ANORMLG1731 = GLOBAL.ANORMLG_1; finsi
-si present(GLOBAL.RNORMLG_1) alors CORR.RNORMLG1731 = GLOBAL.RNORMLG_1; finsi
-si present(GLOBAL.ANORMLH_1) alors CORR.ANORMLH1731 = GLOBAL.ANORMLH_1; finsi
-si present(GLOBAL.RNORMLH_1) alors CORR.RNORMLH1731 = GLOBAL.RNORMLH_1; finsi
-si present(GLOBAL.ANORMLI_1) alors CORR.ANORMLI1731 = GLOBAL.ANORMLI_1; finsi
-si present(GLOBAL.RNORMLI_1) alors CORR.RNORMLI1731 = GLOBAL.RNORMLI_1; finsi
-si present(GLOBAL.ANORMLJ_1) alors CORR.ANORMLJ1731 = GLOBAL.ANORMLJ_1; finsi
-si present(GLOBAL.RNORMLJ_1) alors CORR.RNORMLJ1731 = GLOBAL.RNORMLJ_1; finsi
-si present(GLOBAL.ANOJE_1) alors CORR.ANOJE1731 = GLOBAL.ANOJE_1; finsi
-si present(GLOBAL.RNOJE_1) alors CORR.RNOJE1731 = GLOBAL.RNOJE_1; finsi
-si present(GLOBAL.ANOJF_1) alors CORR.ANOJF1731 = GLOBAL.ANOJF_1; finsi
-si present(GLOBAL.RNOJF_1) alors CORR.RNOJF1731 = GLOBAL.RNOJF_1; finsi
-si present(GLOBAL.ANOJG_1) alors CORR.ANOJG1731 = GLOBAL.ANOJG_1; finsi
-si present(GLOBAL.RNOJG_1) alors CORR.RNOJG1731 = GLOBAL.RNOJG_1; finsi
-si present(GLOBAL.ANOJH_1) alors CORR.ANOJH1731 = GLOBAL.ANOJH_1; finsi
-si present(GLOBAL.RNOJH_1) alors CORR.RNOJH1731 = GLOBAL.RNOJH_1; finsi
-si present(GLOBAL.ANOIE_1) alors CORR.ANOIE1731 = GLOBAL.ANOIE_1; finsi
+si present(GLOBAL.RILMSA_1) alors CORR.RILMSA1731 = GLOBAL.RILMSA_1; finsi
+si present(GLOBAL.RILMSB_1) alors CORR.RILMSB1731 = GLOBAL.RILMSB_1; finsi
+si present(GLOBAL.RILMSC_1) alors CORR.RILMSC1731 = GLOBAL.RILMSC_1; finsi
+si present(GLOBAL.RILMSM_1) alors CORR.RILMSM1731 = GLOBAL.RILMSM_1; finsi
+si present(GLOBAL.RILMSN_1) alors CORR.RILMSN1731 = GLOBAL.RILMSN_1; finsi
+si present(GLOBAL.RILMSO_1) alors CORR.RILMSO1731 = GLOBAL.RILMSO_1; finsi
+si present(GLOBAL.RILMSP_1) alors CORR.RILMSP1731 = GLOBAL.RILMSP_1; finsi
+si present(GLOBAL.RILMSS_1) alors CORR.RILMSS1731 = GLOBAL.RILMSS_1; finsi
+si present(GLOBAL.RILMST_1) alors CORR.RILMST1731 = GLOBAL.RILMST_1; finsi
+si present(GLOBAL.RINNO_1) alors CORR.RINNO1731 = GLOBAL.RINNO_1; finsi
+si present(GLOBAL.RLOCANAH_1) alors CORR.RLOCANAH1731 = GLOBAL.RLOCANAH_1; finsi
+si present(GLOBAL.RLOCENT_1) alors CORR.RLOCENT1731 = GLOBAL.RLOCENT_1; finsi
+si present(GLOBAL.RLOCHFN_1) alors CORR.RLOCHFN1731 = GLOBAL.RLOCHFN_1; finsi
+si present(GLOBAL.RLOCHFNR_1) alors CORR.RLOCHFNR1731 = GLOBAL.RLOCHFNR_1; finsi
+si present(GLOBAL.RLOCHFO_1) alors CORR.RLOCHFO1731 = GLOBAL.RLOCHFO_1; finsi
+si present(GLOBAL.RLOCHFOR_1) alors CORR.RLOCHFOR1731 = GLOBAL.RLOCHFOR_1; finsi
+si present(GLOBAL.RLOCHFP_1) alors CORR.RLOCHFP1731 = GLOBAL.RLOCHFP_1; finsi
+si present(GLOBAL.RLOCHFR_1) alors CORR.RLOCHFR1731 = GLOBAL.RLOCHFR_1; finsi
+si present(GLOBAL.RLOCHFS_1) alors CORR.RLOCHFS1731 = GLOBAL.RLOCHFS_1; finsi
+si present(GLOBAL.RLOCHFSR_1) alors CORR.RLOCHFSR1731 = GLOBAL.RLOCHFSR_1; finsi
+si present(GLOBAL.RLOCHFT_1) alors CORR.RLOCHFT1731 = GLOBAL.RLOCHFT_1; finsi
+si present(GLOBAL.RLOCHFTR_1) alors CORR.RLOCHFTR1731 = GLOBAL.RLOCHFTR_1; finsi
+si present(GLOBAL.RLOCHFU_1) alors CORR.RLOCHFU1731 = GLOBAL.RLOCHFU_1; finsi
+si present(GLOBAL.RLOCHFW_1) alors CORR.RLOCHFW1731 = GLOBAL.RLOCHFW_1; finsi
+si present(GLOBAL.RLOCHGS_1) alors CORR.RLOCHGS1731 = GLOBAL.RLOCHGS_1; finsi
+si present(GLOBAL.RLOCHGSR_1) alors CORR.RLOCHGSR1731 = GLOBAL.RLOCHGSR_1; finsi
+si present(GLOBAL.RLOCHGT_1) alors CORR.RLOCHGT1731 = GLOBAL.RLOCHGT_1; finsi
+si present(GLOBAL.RLOCHGTR_1) alors CORR.RLOCHGTR1731 = GLOBAL.RLOCHGTR_1; finsi
+si present(GLOBAL.RLOCHGU_1) alors CORR.RLOCHGU1731 = GLOBAL.RLOCHGU_1; finsi
+si present(GLOBAL.RLOCHGW_1) alors CORR.RLOCHGW1731 = GLOBAL.RLOCHGW_1; finsi
+si present(GLOBAL.RLOCHHS_1) alors CORR.RLOCHHS1731 = GLOBAL.RLOCHHS_1; finsi
+si present(GLOBAL.RLOCHHSR_1) alors CORR.RLOCHHSR1731 = GLOBAL.RLOCHHSR_1; finsi
+si present(GLOBAL.RLOCHHT_1) alors CORR.RLOCHHT1731 = GLOBAL.RLOCHHT_1; finsi
+si present(GLOBAL.RLOCHHTR_1) alors CORR.RLOCHHTR1731 = GLOBAL.RLOCHHTR_1; finsi
+si present(GLOBAL.RLOCHHU_1) alors CORR.RLOCHHU1731 = GLOBAL.RLOCHHU_1; finsi
+si present(GLOBAL.RLOCHHW_1) alors CORR.RLOCHHW1731 = GLOBAL.RLOCHHW_1; finsi
+si present(GLOBAL.RLOCHIS_1) alors CORR.RLOCHIS1731 = GLOBAL.RLOCHIS_1; finsi
+si present(GLOBAL.RLOCHISR_1) alors CORR.RLOCHISR1731 = GLOBAL.RLOCHISR_1; finsi
+si present(GLOBAL.RLOCHIT_1) alors CORR.RLOCHIT1731 = GLOBAL.RLOCHIT_1; finsi
+si present(GLOBAL.RLOCHITR_1) alors CORR.RLOCHITR1731 = GLOBAL.RLOCHITR_1; finsi
+si present(GLOBAL.RLOCHIU_1) alors CORR.RLOCHIU1731 = GLOBAL.RLOCHIU_1; finsi
+si present(GLOBAL.RLOCHIW_1) alors CORR.RLOCHIW1731 = GLOBAL.RLOCHIW_1; finsi
+si present(GLOBAL.RLOCHJS_1) alors CORR.RLOCHJS1731 = GLOBAL.RLOCHJS_1; finsi
+si present(GLOBAL.RLOCHJSR_1) alors CORR.RLOCHJSR1731 = GLOBAL.RLOCHJSR_1; finsi
+si present(GLOBAL.RLOCHJT_1) alors CORR.RLOCHJT1731 = GLOBAL.RLOCHJT_1; finsi
+si present(GLOBAL.RLOCHJTR_1) alors CORR.RLOCHJTR1731 = GLOBAL.RLOCHJTR_1; finsi
+si present(GLOBAL.RLOCHJU_1) alors CORR.RLOCHJU1731 = GLOBAL.RLOCHJU_1; finsi
+si present(GLOBAL.RLOCHJW_1) alors CORR.RLOCHJW1731 = GLOBAL.RLOCHJW_1; finsi
+si present(GLOBAL.RLOCHKS_1) alors CORR.RLOCHKS1731 = GLOBAL.RLOCHKS_1; finsi
+si present(GLOBAL.RLOCHKSR_1) alors CORR.RLOCHKSR1731 = GLOBAL.RLOCHKSR_1; finsi
+si present(GLOBAL.RLOCHKT_1) alors CORR.RLOCHKT1731 = GLOBAL.RLOCHKT_1; finsi
+si present(GLOBAL.RLOCHKTR_1) alors CORR.RLOCHKTR1731 = GLOBAL.RLOCHKTR_1; finsi
+si present(GLOBAL.RLOCHKU_1) alors CORR.RLOCHKU1731 = GLOBAL.RLOCHKU_1; finsi
+si present(GLOBAL.RLOCHKW_1) alors CORR.RLOCHKW1731 = GLOBAL.RLOCHKW_1; finsi
+si present(GLOBAL.RLOG01_1) alors CORR.RLOG011731 = GLOBAL.RLOG01_1; finsi
+si present(GLOBAL.RLOG01_1) alors CORR.RLOG031731 = GLOBAL.RLOG01_1; finsi
+si present(GLOBAL.RLOG02_1) alors CORR.RLOG021731 = GLOBAL.RLOG02_1; finsi
+si present(GLOBAL.RLOG04_1) alors CORR.RLOG041731 = GLOBAL.RLOG04_1; finsi
+si present(GLOBAL.RLOG05_1) alors CORR.RLOG051731 = GLOBAL.RLOG05_1; finsi
+si present(GLOBAL.RLOG06_1) alors CORR.RLOG061731 = GLOBAL.RLOG06_1; finsi
+si present(GLOBAL.RLOG07_1) alors CORR.RLOG071731 = GLOBAL.RLOG07_1; finsi
+si present(GLOBAL.RLOG08_1) alors CORR.RLOG081731 = GLOBAL.RLOG08_1; finsi
+si present(GLOBAL.RLOG09_1) alors CORR.RLOG091731 = GLOBAL.RLOG09_1; finsi
+si present(GLOBAL.RLOG10_1) alors CORR.RLOG101731 = GLOBAL.RLOG10_1; finsi
+si present(GLOBAL.RLOG11_1) alors CORR.RLOG111731 = GLOBAL.RLOG11_1; finsi
+si present(GLOBAL.RLOG12_1) alors CORR.RLOG121731 = GLOBAL.RLOG12_1; finsi
+si present(GLOBAL.RLOG13_1) alors CORR.RLOG131731 = GLOBAL.RLOG13_1; finsi
+si present(GLOBAL.RLOG14_1) alors CORR.RLOG141731 = GLOBAL.RLOG14_1; finsi
+si present(GLOBAL.RLOG15_1) alors CORR.RLOG151731 = GLOBAL.RLOG15_1; finsi
+si present(GLOBAL.RLOG16_1) alors CORR.RLOG161731 = GLOBAL.RLOG16_1; finsi
+si present(GLOBAL.RLOG17_1) alors CORR.RLOG171731 = GLOBAL.RLOG17_1; finsi
+si present(GLOBAL.RLOG18_1) alors CORR.RLOG181731 = GLOBAL.RLOG18_1; finsi
+si present(GLOBAL.RLOG19_1) alors CORR.RLOG191731 = GLOBAL.RLOG19_1; finsi
+si present(GLOBAL.RLOG20_1) alors CORR.RLOG201731 = GLOBAL.RLOG20_1; finsi
+si present(GLOBAL.RLOG21_1) alors CORR.RLOG211731 = GLOBAL.RLOG21_1; finsi
+si present(GLOBAL.RLOG22_1) alors CORR.RLOG221731 = GLOBAL.RLOG22_1; finsi
+si present(GLOBAL.RLOG23_1) alors CORR.RLOG231731 = GLOBAL.RLOG23_1; finsi
+si present(GLOBAL.RLOG24_1) alors CORR.RLOG241731 = GLOBAL.RLOG24_1; finsi
+si present(GLOBAL.RLOG25_1) alors CORR.RLOG251731 = GLOBAL.RLOG25_1; finsi
+si present(GLOBAL.RLOG26_1) alors CORR.RLOG261731 = GLOBAL.RLOG26_1; finsi
+si present(GLOBAL.RLOG27_1) alors CORR.RLOG271731 = GLOBAL.RLOG27_1; finsi
+si present(GLOBAL.RLOG28_1) alors CORR.RLOG281731 = GLOBAL.RLOG28_1; finsi
+si present(GLOBAL.RLOG29_1) alors CORR.RLOG291731 = GLOBAL.RLOG29_1; finsi
+si present(GLOBAL.RLOG30_1) alors CORR.RLOG301731 = GLOBAL.RLOG30_1; finsi
+si present(GLOBAL.RLOG31_1) alors CORR.RLOG311731 = GLOBAL.RLOG31_1; finsi
+si present(GLOBAL.RLOG32_1) alors CORR.RLOG321731 = GLOBAL.RLOG32_1; finsi
+si present(GLOBAL.RLOG33_1) alors CORR.RLOG331731 = GLOBAL.RLOG33_1; finsi
+si present(GLOBAL.RLOG34_1) alors CORR.RLOG341731 = GLOBAL.RLOG34_1; finsi
+si present(GLOBAL.RLOG35_1) alors CORR.RLOG351731 = GLOBAL.RLOG35_1; finsi
+si present(GLOBAL.RLOG36_1) alors CORR.RLOG361731 = GLOBAL.RLOG36_1; finsi
+si present(GLOBAL.RLOG37_1) alors CORR.RLOG371731 = GLOBAL.RLOG37_1; finsi
+si present(GLOBAL.RLOG38_1) alors CORR.RLOG381731 = GLOBAL.RLOG38_1; finsi
+si present(GLOBAL.RLOG39_1) alors CORR.RLOG391731 = GLOBAL.RLOG39_1; finsi
+si present(GLOBAL.RLOG40_1) alors CORR.RLOG401731 = GLOBAL.RLOG40_1; finsi
+si present(GLOBAL.RLOG41_1) alors CORR.RLOG411731 = GLOBAL.RLOG41_1; finsi
+si present(GLOBAL.RLOG42_1) alors CORR.RLOG421731 = GLOBAL.RLOG42_1; finsi
+si present(GLOBAL.RLOG43_1) alors CORR.RLOG431731 = GLOBAL.RLOG43_1; finsi
+si present(GLOBAL.RLOG44_1) alors CORR.RLOG441731 = GLOBAL.RLOG44_1; finsi
+si present(GLOBAL.RLOG45_1) alors CORR.RLOG451731 = GLOBAL.RLOG45_1; finsi
+si present(GLOBAL.RLOG46_1) alors CORR.RLOG461731 = GLOBAL.RLOG46_1; finsi
+si present(GLOBAL.RLOG47_1) alors CORR.RLOG471731 = GLOBAL.RLOG47_1; finsi
+si present(GLOBAL.RLOG48_1) alors CORR.RLOG481731 = GLOBAL.RLOG48_1; finsi
+si present(GLOBAL.RLOG49_1) alors CORR.RLOG491731 = GLOBAL.RLOG49_1; finsi
+si present(GLOBAL.RLOG50_1) alors CORR.RLOG501731 = GLOBAL.RLOG50_1; finsi
+si present(GLOBAL.RLOG51_1) alors CORR.RLOG511731 = GLOBAL.RLOG51_1; finsi
+si present(GLOBAL.RLOG52_1) alors CORR.RLOG521731 = GLOBAL.RLOG52_1; finsi
+si present(GLOBAL.RLOG53_1) alors CORR.RLOG531731 = GLOBAL.RLOG53_1; finsi
+si present(GLOBAL.RLOG54_1) alors CORR.RLOG541731 = GLOBAL.RLOG54_1; finsi
+si present(GLOBAL.RLOG55_1) alors CORR.RLOG551731 = GLOBAL.RLOG55_1; finsi
+si present(GLOBAL.RLOG56_1) alors CORR.RLOG561731 = GLOBAL.RLOG56_1; finsi
+si present(GLOBAL.RLOG57_1) alors CORR.RLOG571731 = GLOBAL.RLOG57_1; finsi
+si present(GLOBAL.RLOG58_1) alors CORR.RLOG581731 = GLOBAL.RLOG58_1; finsi
+si present(GLOBAL.RLOG59_1) alors CORR.RLOG591731 = GLOBAL.RLOG59_1; finsi
+si present(GLOBAL.RLOG60_1) alors CORR.RLOG601731 = GLOBAL.RLOG60_1; finsi
+si present(GLOBAL.RLOGDOM) alors CORR.RLOGDOM1731 = GLOBAL.RLOGDOM; finsi
+si present(GLOBAL.RLOGHVJ_1) alors CORR.RLOGHVJ1731 = GLOBAL.RLOGHVJ_1; finsi
+si present(GLOBAL.RLOGHVK_1) alors CORR.RLOGHVK1731 = GLOBAL.RLOGHVK_1; finsi
+si present(GLOBAL.RLOGHVL_1) alors CORR.RLOGHVL1731 = GLOBAL.RLOGHVL_1; finsi
+si present(GLOBAL.RLOGHVM_1) alors CORR.RLOGHVM1731 = GLOBAL.RLOGHVM_1; finsi
+si present(GLOBAL.RLOGHVN_1) alors CORR.RLOGHVN1731 = GLOBAL.RLOGHVN_1; finsi
+si present(GLOBAL.RLOGSOC) alors CORR.RLOGSOC1731 = GLOBAL.RLOGSOC; finsi
+si present(GLOBAL.RMF) alors CORR.RMF1731 = GLOBAL.RMF; finsi
+si present(GLOBAL.RNIDF) alors CORR.RNIDF1731 = GLOBAL.RNIDF; finsi
si present(GLOBAL.RNOIE_1) alors CORR.RNOIE1731 = GLOBAL.RNOIE_1; finsi
-si present(GLOBAL.ANOIF_1) alors CORR.ANOIF1731 = GLOBAL.ANOIF_1; finsi
si present(GLOBAL.RNOIF_1) alors CORR.RNOIF1731 = GLOBAL.RNOIF_1; finsi
-si present(GLOBAL.ANOIG_1) alors CORR.ANOIG1731 = GLOBAL.ANOIG_1; finsi
si present(GLOBAL.RNOIG_1) alors CORR.RNOIG1731 = GLOBAL.RNOIG_1; finsi
-si present(GLOBAL.ANOIH_1) alors CORR.ANOIH1731 = GLOBAL.ANOIH_1; finsi
si present(GLOBAL.RNOIH_1) alors CORR.RNOIH1731 = GLOBAL.RNOIH_1; finsi
-si present(GLOBAL.RNONO_1) alors CORR.RNONO1731 = GLOBAL.RNONO_1; finsi
-si present(GLOBAL.RNONP_1) alors CORR.RNONP1731 = GLOBAL.RNONP_1; finsi
-si present(GLOBAL.RNONQ_1) alors CORR.RNONQ1731 = GLOBAL.RNONQ_1; finsi
-si present(GLOBAL.RNONR_1) alors CORR.RNONR1731 = GLOBAL.RNONR_1; finsi
-si present(GLOBAL.RCOD7KW_1) alors CORR.RCOD7KW1731 = GLOBAL.RCOD7KW_1; finsi
-si present(GLOBAL.RCELMA_1) alors CORR.RCELMA1731 = GLOBAL.RCELMA_1; finsi
-si present(GLOBAL.RCELMB_1) alors CORR.RCELMB1731 = GLOBAL.RCELMB_1; finsi
-si present(GLOBAL.RCELMC_1) alors CORR.RCELMC1731 = GLOBAL.RCELMC_1; finsi
-si present(GLOBAL.RCELMD_1) alors CORR.RCELMD1731 = GLOBAL.RCELMD_1; finsi
-si present(GLOBAL.RCELMI_1) alors CORR.RCELMI1731 = GLOBAL.RCELMI_1; finsi
-si present(GLOBAL.RCELMJ_1) alors CORR.RCELMJ1731 = GLOBAL.RCELMJ_1; finsi
-si present(GLOBAL.RCELMK_1) alors CORR.RCELMK1731 = GLOBAL.RCELMK_1; finsi
-si present(GLOBAL.RCELML_1) alors CORR.RCELML1731 = GLOBAL.RCELML_1; finsi
-si present(GLOBAL.RCELOJ_1) alors CORR.RCELOJ1731 = GLOBAL.RCELOJ_1; finsi
-si present(GLOBAL.RCELOU_1) alors CORR.RCELOU1731 = GLOBAL.RCELOU_1; finsi
-si present(GLOBAL.RCELOV_1) alors CORR.RCELOV1731 = GLOBAL.RCELOV_1; finsi
-si present(GLOBAL.RCELOW_1) alors CORR.RCELOW1731 = GLOBAL.RCELOW_1; finsi
-si present(GLOBAL.RCELNS_1) alors CORR.RCELNS1731 = GLOBAL.RCELNS_1; finsi
-si present(GLOBAL.RCELNT_1) alors CORR.RCELNT1731 = GLOBAL.RCELNT_1; finsi
-si present(GLOBAL.RCELNU_1) alors CORR.RCELNU1731 = GLOBAL.RCELNU_1; finsi
-si present(GLOBAL.RCELNV_1) alors CORR.RCELNV1731 = GLOBAL.RCELNV_1; finsi
-si present(GLOBAL.ACODMW_1) alors CORR.ACODMW1731 = GLOBAL.ACODMW_1; finsi
-si present(GLOBAL.RCODMW_1) alors CORR.RCODMW1731 = GLOBAL.RCODMW_1; finsi
-si present(GLOBAL.ACODMN_1) alors CORR.ACODMN1731 = GLOBAL.ACODMN_1; finsi
-si present(GLOBAL.RCODMN_1) alors CORR.RCODMN1731 = GLOBAL.RCODMN_1; finsi
+si present(GLOBAL.RNOJE_1) alors CORR.RNOJE1731 = GLOBAL.RNOJE_1; finsi
+si present(GLOBAL.RNOJF_1) alors CORR.RNOJF1731 = GLOBAL.RNOJF_1; finsi
+si present(GLOBAL.RNOJG_1) alors CORR.RNOJG1731 = GLOBAL.RNOJG_1; finsi
+si present(GLOBAL.RNOJH_1) alors CORR.RNOJH1731 = GLOBAL.RNOJH_1; finsi
si present(GLOBAL.RNONI_1) alors CORR.RNONI1731 = GLOBAL.RNONI_1; finsi
si present(GLOBAL.RNONJ_1) alors CORR.RNONJ1731 = GLOBAL.RNONJ_1; finsi
si present(GLOBAL.RNONK_1) alors CORR.RNONK1731 = GLOBAL.RNONK_1; finsi
si present(GLOBAL.RNONL_1) alors CORR.RNONL1731 = GLOBAL.RNONL_1; finsi
si present(GLOBAL.RNONM_1) alors CORR.RNONM1731 = GLOBAL.RNONM_1; finsi
si present(GLOBAL.RNONN_1) alors CORR.RNONN1731 = GLOBAL.RNONN_1; finsi
+si present(GLOBAL.RNONO_1) alors CORR.RNONO1731 = GLOBAL.RNONO_1; finsi
+si present(GLOBAL.RNONP_1) alors CORR.RNONP1731 = GLOBAL.RNONP_1; finsi
+si present(GLOBAL.RNONQ_1) alors CORR.RNONQ1731 = GLOBAL.RNONQ_1; finsi
+si present(GLOBAL.RNONR_1) alors CORR.RNONR1731 = GLOBAL.RNONR_1; finsi
si present(GLOBAL.RNOPF_1) alors CORR.RNOPF1731 = GLOBAL.RNOPF_1; finsi
si present(GLOBAL.RNOPG_1) alors CORR.RNOPG1731 = GLOBAL.RNOPG_1; finsi
-si present(GLOBAL.RCELPC_1) alors CORR.RCELPC1731 = GLOBAL.RCELPC_1; finsi
-si present(GLOBAL.RCELPD_1) alors CORR.RCELPD1731 = GLOBAL.RCELPD_1; finsi
-si present(GLOBAL.RCELPE_1) alors CORR.RCELPE1731 = GLOBAL.RCELPE_1; finsi
-si present(GLOBAL.RPIQI_1) alors CORR.RPIQI1731 = GLOBAL.RPIQI_1; finsi
-si present(GLOBAL.RPIQJ_1) alors CORR.RPIQJ1731 = GLOBAL.RPIQJ_1; finsi
-si present(GLOBAL.RPIQK_1) alors CORR.RPIQK1731 = GLOBAL.RPIQK_1; finsi
-si present(GLOBAL.RPIQL_1) alors CORR.RPIQL1731 = GLOBAL.RPIQL_1; finsi
-si present(GLOBAL.RPIQM_1) alors CORR.RPIQM1731 = GLOBAL.RPIQM_1; finsi
-si present(GLOBAL.RPIQN_1) alors CORR.RPIQN1731 = GLOBAL.RPIQN_1; finsi
-si present(GLOBAL.RPIQO_1) alors CORR.RPIQO1731 = GLOBAL.RPIQO_1; finsi
-si present(GLOBAL.RPIQP_1) alors CORR.RPIQP1731 = GLOBAL.RPIQP_1; finsi
-si present(GLOBAL.RPIRR_1) alors CORR.RPIRR1731 = GLOBAL.RPIRR_1; finsi
-si present(GLOBAL.RPIRS_1) alors CORR.RPIRS1731 = GLOBAL.RPIRS_1; finsi
-si present(GLOBAL.RPIRX_1) alors CORR.RPIRX1731 = GLOBAL.RPIRX_1; finsi
-si present(GLOBAL.RPIRY_1) alors CORR.RPIRY1731 = GLOBAL.RPIRY_1; finsi
-si present(GLOBAL.RPIWA_1) alors CORR.RPIWA1731 = GLOBAL.RPIWA_1; finsi
-si present(GLOBAL.RPIWB_1) alors CORR.RPIWB1731 = GLOBAL.RPIWB_1; finsi
-si present(GLOBAL.RPIXA_1) alors CORR.RPIXA1731 = GLOBAL.RPIXA_1; finsi
-si present(GLOBAL.RPIXB_1) alors CORR.RPIXB1731 = GLOBAL.RPIXB_1; finsi
-si present(GLOBAL.RPIRV_1) alors CORR.RPIRV1731 = GLOBAL.RPIRV_1; finsi
-si present(GLOBAL.RPIRW_1) alors CORR.RPIRW1731 = GLOBAL.RPIRW_1; finsi
-si present(GLOBAL.RPISH_1) alors CORR.RPISH1731 = GLOBAL.RPISH_1; finsi
-si present(GLOBAL.RPISI_1) alors CORR.RPISI1731 = GLOBAL.RPISI_1; finsi
-si present(GLOBAL.AILMSM_1) alors CORR.AILMSM1731 = GLOBAL.AILMSM_1; finsi
-si present(GLOBAL.RILMSM_1) alors CORR.RILMSM1731 = GLOBAL.RILMSM_1; finsi
-si present(GLOBAL.AILMSS_1) alors CORR.AILMSS1731 = GLOBAL.AILMSS_1; finsi
-si present(GLOBAL.AILMST_1) alors CORR.AILMST1731 = GLOBAL.AILMST_1; finsi
-si present(GLOBAL.RILMSS_1) alors CORR.RILMSS1731 = GLOBAL.RILMSS_1; finsi
-si present(GLOBAL.RILMST_1) alors CORR.RILMST1731 = GLOBAL.RILMST_1; finsi
-si present(GLOBAL.ACELP1A_1) alors CORR.ACELP1A1731 = GLOBAL.ACELP1A_1; finsi
-si present(GLOBAL.ACELP1B_1) alors CORR.ACELP1B1731 = GLOBAL.ACELP1B_1; finsi
-si present(GLOBAL.ACELP1C_1) alors CORR.ACELP1C1731 = GLOBAL.ACELP1C_1; finsi
-si present(GLOBAL.ACELP1D_1) alors CORR.ACELP1D1731 = GLOBAL.ACELP1D_1; finsi
-si present(GLOBAL.ACELP1E_1) alors CORR.ACELP1E1731 = GLOBAL.ACELP1E_1; finsi
-si present(GLOBAL.RCELP1A_1) alors CORR.RCELP1A1731 = GLOBAL.RCELP1A_1; finsi
-si present(GLOBAL.RCELP1B_1) alors CORR.RCELP1B1731 = GLOBAL.RCELP1B_1; finsi
-si present(GLOBAL.RCELP1C_1) alors CORR.RCELP1C1731 = GLOBAL.RCELP1C_1; finsi
-si present(GLOBAL.RCELP1D_1) alors CORR.RCELP1D1731 = GLOBAL.RCELP1D_1; finsi
-si present(GLOBAL.RCELP1E_1) alors CORR.RCELP1E1731 = GLOBAL.RCELP1E_1; finsi
-si present(GLOBAL.ACELP2A_1) alors CORR.ACELP2A1731 = GLOBAL.ACELP2A_1; finsi
-si present(GLOBAL.ACELP2B_1) alors CORR.ACELP2B1731 = GLOBAL.ACELP2B_1; finsi
-si present(GLOBAL.ACELP2C_1) alors CORR.ACELP2C1731 = GLOBAL.ACELP2C_1; finsi
-si present(GLOBAL.ACELP2D_1) alors CORR.ACELP2D1731 = GLOBAL.ACELP2D_1; finsi
-si present(GLOBAL.ACELP2E_1) alors CORR.ACELP2E1731 = GLOBAL.ACELP2E_1; finsi
-si present(GLOBAL.APIPK_1) alors CORR.APIPK1731 = GLOBAL.APIPK_1; finsi
-si present(GLOBAL.RPIPK_1) alors CORR.RPIPK1731 = GLOBAL.RPIPK_1; finsi
-si present(GLOBAL.APIPL_1) alors CORR.APIPL1731 = GLOBAL.APIPL_1; finsi
-si present(GLOBAL.RPIPL_1) alors CORR.RPIPL1731 = GLOBAL.RPIPL_1; finsi
-si present(GLOBAL.APIPM_1) alors CORR.APIPM1731 = GLOBAL.APIPM_1; finsi
-si present(GLOBAL.RPIPM_1) alors CORR.RPIPM1731 = GLOBAL.RPIPM_1; finsi
-si present(GLOBAL.APIPN_1) alors CORR.APIPN1731 = GLOBAL.APIPN_1; finsi
-si present(GLOBAL.RPIPN_1) alors CORR.RPIPN1731 = GLOBAL.RPIPN_1; finsi
-si present(GLOBAL.APIOF_1) alors CORR.APIOF1731 = GLOBAL.APIOF_1; finsi
-si present(GLOBAL.RPIOF_1) alors CORR.RPIOF1731 = GLOBAL.RPIOF_1; finsi
-si present(GLOBAL.APIOG_1) alors CORR.APIOG1731 = GLOBAL.APIOG_1; finsi
-si present(GLOBAL.RPIOG_1) alors CORR.RPIOG1731 = GLOBAL.RPIOG_1; finsi
-si present(GLOBAL.APINA_1) alors CORR.APINA1731 = GLOBAL.APINA_1; finsi
-si present(GLOBAL.RPINA_1) alors CORR.RPINA1731 = GLOBAL.RPINA_1; finsi
-si present(GLOBAL.APINB_1) alors CORR.APINB1731 = GLOBAL.APINB_1; finsi
-si present(GLOBAL.RPINB_1) alors CORR.RPINB1731 = GLOBAL.RPINB_1; finsi
-si present(GLOBAL.APINC_1) alors CORR.APINC1731 = GLOBAL.APINC_1; finsi
-si present(GLOBAL.RPINC_1) alors CORR.RPINC1731 = GLOBAL.RPINC_1; finsi
-si present(GLOBAL.APIND_1) alors CORR.APIND1731 = GLOBAL.APIND_1; finsi
-si present(GLOBAL.RPIND_1) alors CORR.RPIND1731 = GLOBAL.RPIND_1; finsi
-si present(GLOBAL.APISY_1) alors CORR.APISY1731 = GLOBAL.APISY_1; finsi
-si present(GLOBAL.RPISY_1) alors CORR.RPISY1731 = GLOBAL.RPISY_1; finsi
-si present(GLOBAL.APISZ_1) alors CORR.APISZ1731 = GLOBAL.APISZ_1; finsi
-si present(GLOBAL.RPISZ_1) alors CORR.RPISZ1731 = GLOBAL.RPISZ_1; finsi
-si present(GLOBAL.RCELUU_1) alors CORR.RCELUU1731 = GLOBAL.RCELUU_1; finsi
-si present(GLOBAL.RCELUV_1) alors CORR.RCELUV1731 = GLOBAL.RCELUV_1; finsi
-si present(GLOBAL.RCELUW_1) alors CORR.RCELUW1731 = GLOBAL.RCELUW_1; finsi
-si present(GLOBAL.RCELUX_1) alors CORR.RCELUX1731 = GLOBAL.RCELUX_1; finsi
-si present(GLOBAL.RCELRK_1) alors CORR.RCELRK1731 = GLOBAL.RCELRK_1; finsi
-si present(GLOBAL.RCELRL_1) alors CORR.RCELRL1731 = GLOBAL.RCELRL_1; finsi
-si present(GLOBAL.RCELRM_1) alors CORR.RCELRM1731 = GLOBAL.RCELRM_1; finsi
-si present(GLOBAL.RCELRN_1) alors CORR.RCELRN1731 = GLOBAL.RCELRN_1; finsi
-si present(GLOBAL.RCELIV_1) alors CORR.RCELIV1731 = GLOBAL.RCELIV_1; finsi
-si present(GLOBAL.RCELIX_1) alors CORR.RCELIX1731 = GLOBAL.RCELIX_1; finsi
-si present(GLOBAL.RCELIY_1) alors CORR.RCELIY1731 = GLOBAL.RCELIY_1; finsi
-si present(GLOBAL.RCELIZ_1) alors CORR.RCELIZ1731 = GLOBAL.RCELIZ_1; finsi
-si present(GLOBAL.RCELIM_1) alors CORR.RCELIM1731 = GLOBAL.RCELIM_1; finsi
-si present(GLOBAL.RCELIN_1) alors CORR.RCELIN1731 = GLOBAL.RCELIN_1; finsi
-si present(GLOBAL.RCELIO_1) alors CORR.RCELIO1731 = GLOBAL.RCELIO_1; finsi
-si present(GLOBAL.RCELIP_1) alors CORR.RCELIP1731 = GLOBAL.RCELIP_1; finsi
-si present(GLOBAL.RCELVJ_1) alors CORR.RCELVJ1731 = GLOBAL.RCELVJ_1; finsi
-si present(GLOBAL.RCELVL_1) alors CORR.RCELVL1731 = GLOBAL.RCELVL_1; finsi
-si present(GLOBAL.RCELVK_1) alors CORR.RCELVK1731 = GLOBAL.RCELVK_1; finsi
-si present(GLOBAL.RCELVO_1) alors CORR.RCELVO1731 = GLOBAL.RCELVO_1; finsi
+si present(GLOBAL.RNORMAB_1) alors CORR.RNORMAB1731 = GLOBAL.RNORMAB_1; finsi
+si present(GLOBAL.RNORMCD_1) alors CORR.RNORMCD1731 = GLOBAL.RNORMCD_1; finsi
+si present(GLOBAL.RNORMEF_1) alors CORR.RNORMEF1731 = GLOBAL.RNORMEF_1; finsi
+si present(GLOBAL.RNORMGH_1) alors CORR.RNORMGH1731 = GLOBAL.RNORMGH_1; finsi
+si present(GLOBAL.RNORMJA_1) alors CORR.RNORMJA1731 = GLOBAL.RNORMJA_1; finsi
+si present(GLOBAL.RNORMJB_1) alors CORR.RNORMJB1731 = GLOBAL.RNORMJB_1; finsi
+si present(GLOBAL.RNORMJC_1) alors CORR.RNORMJC1731 = GLOBAL.RNORMJC_1; finsi
+si present(GLOBAL.RNORMJD_1) alors CORR.RNORMJD1731 = GLOBAL.RNORMJD_1; finsi
+si present(GLOBAL.RNORMJR_1) alors CORR.RNORMJR1731 = GLOBAL.RNORMJR_1; finsi
+si present(GLOBAL.RNORMJS_1) alors CORR.RNORMJS1731 = GLOBAL.RNORMJS_1; finsi
+si present(GLOBAL.RNORMJT_1) alors CORR.RNORMJT1731 = GLOBAL.RNORMJT_1; finsi
+si present(GLOBAL.RNORMJU_1) alors CORR.RNORMJU1731 = GLOBAL.RNORMJU_1; finsi
+si present(GLOBAL.RNORMLG_1) alors CORR.RNORMLG1731 = GLOBAL.RNORMLG_1; finsi
+si present(GLOBAL.RNORMLH_1) alors CORR.RNORMLH1731 = GLOBAL.RNORMLH_1; finsi
+si present(GLOBAL.RNORMLI_1) alors CORR.RNORMLI1731 = GLOBAL.RNORMLI_1; finsi
+si present(GLOBAL.RNORMLJ_1) alors CORR.RNORMLJ1731 = GLOBAL.RNORMLJ_1; finsi
+si present(GLOBAL.RNOUV_1) alors CORR.RNOUV1731 = GLOBAL.RNOUV_1; finsi
+si present(GLOBAL.RPENTCY_1) alors CORR.RPENTCY1731 = GLOBAL.RPENTCY_1; finsi
+si present(GLOBAL.RPENTDY_1) alors CORR.RPENTDY1731 = GLOBAL.RPENTDY_1; finsi
+si present(GLOBAL.RPENTEK_1) alors CORR.RPENTEK1731 = GLOBAL.RPENTEK_1; finsi
+si present(GLOBAL.RPENTEY_1) alors CORR.RPENTEY1731 = GLOBAL.RPENTEY_1; finsi
+si present(GLOBAL.RPENTFY_1) alors CORR.RPENTFY1731 = GLOBAL.RPENTFY_1; finsi
+si present(GLOBAL.RPENTGY_1) alors CORR.RPENTGY1731 = GLOBAL.RPENTGY_1; finsi
si present(GLOBAL.RPIIA_1) alors CORR.RPIIA1731 = GLOBAL.RPIIA_1; finsi
si present(GLOBAL.RPIIB_1) alors CORR.RPIIB1731 = GLOBAL.RPIIB_1; finsi
si present(GLOBAL.RPIIC_1) alors CORR.RPIIC1731 = GLOBAL.RPIIC_1; finsi
@@ -889,34 +673,235 @@
si present(GLOBAL.RPIJJ_1) alors CORR.RPIJJ1731 = GLOBAL.RPIJJ_1; finsi
si present(GLOBAL.RPIJK_1) alors CORR.RPIJK1731 = GLOBAL.RPIJK_1; finsi
si present(GLOBAL.RPIJL_1) alors CORR.RPIJL1731 = GLOBAL.RPIJL_1; finsi
-si present(GLOBAL.RCELLK_1) alors CORR.RCELLK1731 = GLOBAL.RCELLK_1; finsi
-si present(GLOBAL.RCELLL_1) alors CORR.RCELLL1731 = GLOBAL.RCELLL_1; finsi
-si present(GLOBAL.RCELLO_1) alors CORR.RCELLO1731 = GLOBAL.RCELLO_1; finsi
-si present(GLOBAL.RCELLP_1) alors CORR.RCELLP1731 = GLOBAL.RCELLP_1; finsi
-si present(GLOBAL.APIIA_1) alors CORR.APIIA1731 = GLOBAL.APIIA_1; finsi
-si present(GLOBAL.APIIB_1) alors CORR.APIIB1731 = GLOBAL.APIIB_1; finsi
-si present(GLOBAL.APIIC_1) alors CORR.APIIC1731 = GLOBAL.APIIC_1; finsi
-si present(GLOBAL.APIID_1) alors CORR.APIID1731 = GLOBAL.APIID_1; finsi
-si present(GLOBAL.APIJI_1) alors CORR.APIJI1731 = GLOBAL.APIJI_1; finsi
-si present(GLOBAL.APIJJ_1) alors CORR.APIJJ1731 = GLOBAL.APIJJ_1; finsi
-si present(GLOBAL.APIJK_1) alors CORR.APIJK1731 = GLOBAL.APIJK_1; finsi
-si present(GLOBAL.APIJL_1) alors CORR.APIJL1731 = GLOBAL.APIJL_1; finsi
-si present(GLOBAL.RPTZM_1) alors CORR.RPTZM1731 = GLOBAL.RPTZM_1; finsi
-si present(GLOBAL.APTZM_1) alors CORR.APTZM1731 = GLOBAL.APTZM_1; finsi
+si present(GLOBAL.RPIJN_1) alors CORR.RPIJN1731 = GLOBAL.RPIJN_1; finsi
+si present(GLOBAL.RPIJO_1) alors CORR.RPIJO1731 = GLOBAL.RPIJO_1; finsi
+si present(GLOBAL.RPIJP_1) alors CORR.RPIJP1731 = GLOBAL.RPIJP_1; finsi
+si present(GLOBAL.RPIJQ_1) alors CORR.RPIJQ1731 = GLOBAL.RPIJQ_1; finsi
+si present(GLOBAL.RPIJV_1) alors CORR.RPIJV1731 = GLOBAL.RPIJV_1; finsi
+si present(GLOBAL.RPIJW_1) alors CORR.RPIJW1731 = GLOBAL.RPIJW_1; finsi
+si present(GLOBAL.RPIJX_1) alors CORR.RPIJX1731 = GLOBAL.RPIJX_1; finsi
+si present(GLOBAL.RPIJY_1) alors CORR.RPIJY1731 = GLOBAL.RPIJY_1; finsi
+si present(GLOBAL.RPINA_1) alors CORR.RPINA1731 = GLOBAL.RPINA_1; finsi
+si present(GLOBAL.RPINB_1) alors CORR.RPINB1731 = GLOBAL.RPINB_1; finsi
+si present(GLOBAL.RPINC_1) alors CORR.RPINC1731 = GLOBAL.RPINC_1; finsi
+si present(GLOBAL.RPIND_1) alors CORR.RPIND1731 = GLOBAL.RPIND_1; finsi
+si present(GLOBAL.RPIOF_1) alors CORR.RPIOF1731 = GLOBAL.RPIOF_1; finsi
+si present(GLOBAL.RPIOG_1) alors CORR.RPIOG1731 = GLOBAL.RPIOG_1; finsi
+si present(GLOBAL.RPIPK_1) alors CORR.RPIPK1731 = GLOBAL.RPIPK_1; finsi
+si present(GLOBAL.RPIPL_1) alors CORR.RPIPL1731 = GLOBAL.RPIPL_1; finsi
+si present(GLOBAL.RPIPM_1) alors CORR.RPIPM1731 = GLOBAL.RPIPM_1; finsi
+si present(GLOBAL.RPIPN_1) alors CORR.RPIPN1731 = GLOBAL.RPIPN_1; finsi
+si present(GLOBAL.RPIQI_1) alors CORR.RPIQI1731 = GLOBAL.RPIQI_1; finsi
+si present(GLOBAL.RPIQJ_1) alors CORR.RPIQJ1731 = GLOBAL.RPIQJ_1; finsi
+si present(GLOBAL.RPIQK_1) alors CORR.RPIQK1731 = GLOBAL.RPIQK_1; finsi
+si present(GLOBAL.RPIQL_1) alors CORR.RPIQL1731 = GLOBAL.RPIQL_1; finsi
+si present(GLOBAL.RPIQM_1) alors CORR.RPIQM1731 = GLOBAL.RPIQM_1; finsi
+si present(GLOBAL.RPIQN_1) alors CORR.RPIQN1731 = GLOBAL.RPIQN_1; finsi
+si present(GLOBAL.RPIQO_1) alors CORR.RPIQO1731 = GLOBAL.RPIQO_1; finsi
+si present(GLOBAL.RPIQP_1) alors CORR.RPIQP1731 = GLOBAL.RPIQP_1; finsi
+si present(GLOBAL.RPIQR_1) alors CORR.RPIQR1731 = GLOBAL.RPIQR_1; finsi
+si present(GLOBAL.RPIQS_1) alors CORR.RPIQS1731 = GLOBAL.RPIQS_1; finsi
+si present(GLOBAL.RPIQT_1) alors CORR.RPIQT1731 = GLOBAL.RPIQT_1; finsi
+si present(GLOBAL.RPIQU_1) alors CORR.RPIQU1731 = GLOBAL.RPIQU_1; finsi
+si present(GLOBAL.RPIREPJM_1) alors CORR.RPIREPJM1731 = GLOBAL.RPIREPJM_1; finsi
+si present(GLOBAL.RPIREPKM_1) alors CORR.RPIREPKM1731 = GLOBAL.RPIREPKM_1; finsi
+si present(GLOBAL.RPIREPLM_1) alors CORR.RPIREPLM1731 = GLOBAL.RPIREPLM_1; finsi
+si present(GLOBAL.RPIREPMM_1) alors CORR.RPIREPMM1731 = GLOBAL.RPIREPMM_1; finsi
+si present(GLOBAL.RPIREPRB_1) alors CORR.RPIREPRB1731 = GLOBAL.RPIREPRB_1; finsi
+si present(GLOBAL.RPIREPRD_1) alors CORR.RPIREPRD1731 = GLOBAL.RPIREPRD_1; finsi
+si present(GLOBAL.RPIREPRF_1) alors CORR.RPIREPRF1731 = GLOBAL.RPIREPRF_1; finsi
+si present(GLOBAL.RPIREPRH_1) alors CORR.RPIREPRH1731 = GLOBAL.RPIREPRH_1; finsi
+si present(GLOBAL.RPIREPRZ_1) alors CORR.RPIREPRZ1731 = GLOBAL.RPIREPRZ_1; finsi
+si present(GLOBAL.RPIREPTZ_1) alors CORR.RPIREPTZ1731 = GLOBAL.RPIREPTZ_1; finsi
+si present(GLOBAL.RPIRR_1) alors CORR.RPIRR1731 = GLOBAL.RPIRR_1; finsi
+si present(GLOBAL.RPIRS_1) alors CORR.RPIRS1731 = GLOBAL.RPIRS_1; finsi
+si present(GLOBAL.RPIRV_1) alors CORR.RPIRV1731 = GLOBAL.RPIRV_1; finsi
+si present(GLOBAL.RPIRW_1) alors CORR.RPIRW1731 = GLOBAL.RPIRW_1; finsi
+si present(GLOBAL.RPIRX_1) alors CORR.RPIRX1731 = GLOBAL.RPIRX_1; finsi
+si present(GLOBAL.RPIRY_1) alors CORR.RPIRY1731 = GLOBAL.RPIRY_1; finsi
+si present(GLOBAL.RPISD_1) alors CORR.RPISD1731 = GLOBAL.RPISD_1; finsi
+si present(GLOBAL.RPISE_1) alors CORR.RPISE1731 = GLOBAL.RPISE_1; finsi
+si present(GLOBAL.RPISF_1) alors CORR.RPISF1731 = GLOBAL.RPISF_1; finsi
+si present(GLOBAL.RPISG_1) alors CORR.RPISG1731 = GLOBAL.RPISG_1; finsi
+si present(GLOBAL.RPISH_1) alors CORR.RPISH1731 = GLOBAL.RPISH_1; finsi
+si present(GLOBAL.RPISI_1) alors CORR.RPISI1731 = GLOBAL.RPISI_1; finsi
+si present(GLOBAL.RPISY_1) alors CORR.RPISY1731 = GLOBAL.RPISY_1; finsi
+si present(GLOBAL.RPISZ_1) alors CORR.RPISZ1731 = GLOBAL.RPISZ_1; finsi
+si present(GLOBAL.RPIVD_1) alors CORR.RPIVD1731 = GLOBAL.RPIVD_1; finsi
+si present(GLOBAL.RPIVE_1) alors CORR.RPIVE1731 = GLOBAL.RPIVE_1; finsi
+si present(GLOBAL.RPIVF_1) alors CORR.RPIVF1731 = GLOBAL.RPIVF_1; finsi
+si present(GLOBAL.RPIVG_1) alors CORR.RPIVG1731 = GLOBAL.RPIVG_1; finsi
+si present(GLOBAL.RPIVW_1) alors CORR.RPIVW1731 = GLOBAL.RPIVW_1; finsi
+si present(GLOBAL.RPIVX_1) alors CORR.RPIVX1731 = GLOBAL.RPIVX_1; finsi
+si present(GLOBAL.RPIVY_1) alors CORR.RPIVY1731 = GLOBAL.RPIVY_1; finsi
+si present(GLOBAL.RPIVZ_1) alors CORR.RPIVZ1731 = GLOBAL.RPIVZ_1; finsi
+si present(GLOBAL.RPIWA_1) alors CORR.RPIWA1731 = GLOBAL.RPIWA_1; finsi
+si present(GLOBAL.RPIWB_1) alors CORR.RPIWB1731 = GLOBAL.RPIWB_1; finsi
+si present(GLOBAL.RPIXA_1) alors CORR.RPIXA1731 = GLOBAL.RPIXA_1; finsi
+si present(GLOBAL.RPIXB_1) alors CORR.RPIXB1731 = GLOBAL.RPIXB_1; finsi
si present(GLOBAL.RPMEJEI_1) alors CORR.RPMEJEI1731 = GLOBAL.RPMEJEI_1; finsi
-si present(GLOBAL.APMEJEI_1) alors CORR.APMEJEI1731 = GLOBAL.APMEJEI_1; finsi
-si present(GLOBAL.RNOLQ_1) alors CORR.RNOLQ1731 = GLOBAL.RNOLQ_1; finsi
-si present(GLOBAL.RNOLR_1) alors CORR.RNOLR1731 = GLOBAL.RNOLR_1; finsi
-si present(GLOBAL.RNOLS_1) alors CORR.RNOLS1731 = GLOBAL.RNOLS_1; finsi
-si present(GLOBAL.RNOLT_1) alors CORR.RNOLT1731 = GLOBAL.RNOLT_1; finsi
-si present(GLOBAL.RILMSX_1) alors CORR.RILMSX1731 = GLOBAL.RILMSX_1; finsi
-si present(GLOBAL.AILMSX_1) alors CORR.AILMSX1731 = GLOBAL.AILMSX_1; finsi
-si present(GLOBAL.REPRCMBIS) alors CORR.REPRCMBIS1731 = GLOBAL.REPRCMBIS; finsi
-si present(GLOBAL.RRFI) alors CORR.RRFI1731 = GLOBAL.RRFI; finsi
-si present(GLOBAL.RCM1) alors CORR.RCM11731 = GLOBAL.RCM1; finsi
-si present(GLOBAL.BIN) alors CORR.BIN1731 = GLOBAL.BIN; finsi
-si present(GLOBAL.NPLOCNETF) alors CORR.NPLOCNETF1731 = GLOBAL.NPLOCNETF; finsi
-si present(GLOBAL.RGPROVHBA) alors CORR.RGPROVHBA1731 = GLOBAL.RGPROVHBA; finsi
-si present(GLOBAL.TOTRCM) alors CORR.TOTRCM1731 = GLOBAL.TOTRCM; finsi
-si present(GLOBAL.BNN) alors CORR.BNN1731 = GLOBAL.BNN; finsi
+si present(GLOBAL.RPRESSE_1) alors CORR.RPRESSE1731 = GLOBAL.RPRESSE_1; finsi
+si present(GLOBAL.RPTZM_1) alors CORR.RPTZM1731 = GLOBAL.RPTZM_1; finsi
+si present(GLOBAL.RRBGPROV) alors CORR.RRBGPROV1731 = GLOBAL.RRBGPROV; finsi
+si present(GLOBAL.RREHAB_1) alors CORR.RREHAB1731 = GLOBAL.RREHAB_1; finsi
+si present(GLOBAL.RREPA_1) alors CORR.RREPA1731 = GLOBAL.RREPA_1; finsi
+si present(GLOBAL.RRESTIMO1_1) alors CORR.RRESTIMO11731 = GLOBAL.RRESTIMO1_1; finsi
+si present(GLOBAL.RRESTIMO_1) alors CORR.RRESTIMO1731 = GLOBAL.RRESTIMO_1; finsi
+si present(GLOBAL.RRESTIMONX_1) alors CORR.RRESTIMONX1731 = GLOBAL.RRESTIMONX_1; finsi
+si present(GLOBAL.RRESTIMONY_1) alors CORR.RRESTIMONY1731 = GLOBAL.RRESTIMONY_1; finsi
+si present(GLOBAL.RRETU_1) alors CORR.RRETU1731 = GLOBAL.RRETU_1; finsi
+si present(GLOBAL.RRIRENOV_1) alors CORR.RRIRENOV1731 = GLOBAL.RRIRENOV_1; finsi
+si present(GLOBAL.RRIREP_1) alors CORR.RRIREP1731 = GLOBAL.RRIREP_1; finsi
+si present(GLOBAL.RRPRESCOMP_1) alors CORR.RRPRESCOMP1731 = GLOBAL.RRPRESCOMP_1; finsi
+si present(GLOBAL.RSC301_1) alors CORR.RSC3011731 = GLOBAL.RSC301_1; finsi
+si present(GLOBAL.RSC302_1) alors CORR.RSC3021731 = GLOBAL.RSC302_1; finsi
+si present(GLOBAL.RSC303_1) alors CORR.RSC3031731 = GLOBAL.RSC303_1; finsi
+si present(GLOBAL.RSC304_1) alors CORR.RSC3041731 = GLOBAL.RSC304_1; finsi
+si present(GLOBAL.RSC305_1) alors CORR.RSC3051731 = GLOBAL.RSC305_1; finsi
+si present(GLOBAL.RSC306_1) alors CORR.RSC3061731 = GLOBAL.RSC306_1; finsi
+si present(GLOBAL.RSC307_1) alors CORR.RSC3071731 = GLOBAL.RSC307_1; finsi
+si present(GLOBAL.RSC308_1) alors CORR.RSC3081731 = GLOBAL.RSC308_1; finsi
+si present(GLOBAL.RSC309_1) alors CORR.RSC3091731 = GLOBAL.RSC309_1; finsi
+si present(GLOBAL.RSC310_1) alors CORR.RSC3101731 = GLOBAL.RSC310_1; finsi
+si present(GLOBAL.RSC311_1) alors CORR.RSC3111731 = GLOBAL.RSC311_1; finsi
+si present(GLOBAL.RSC312_1) alors CORR.RSC3121731 = GLOBAL.RSC312_1; finsi
+si present(GLOBAL.RSC601_1) alors CORR.RSC6011731 = GLOBAL.RSC601_1; finsi
+si present(GLOBAL.RSC602_1) alors CORR.RSC6021731 = GLOBAL.RSC602_1; finsi
+si present(GLOBAL.RSC603_1) alors CORR.RSC6031731 = GLOBAL.RSC603_1; finsi
+si present(GLOBAL.RSC604_1) alors CORR.RSC6041731 = GLOBAL.RSC604_1; finsi
+si present(GLOBAL.RSC605_1) alors CORR.RSC6051731 = GLOBAL.RSC605_1; finsi
+si present(GLOBAL.RSC606_1) alors CORR.RSC6061731 = GLOBAL.RSC606_1; finsi
+si present(GLOBAL.RSC607_1) alors CORR.RSC6071731 = GLOBAL.RSC607_1; finsi
+si present(GLOBAL.RSC608_1) alors CORR.RSC6081731 = GLOBAL.RSC608_1; finsi
+si present(GLOBAL.RSC609_1) alors CORR.RSC6091731 = GLOBAL.RSC609_1; finsi
+si present(GLOBAL.RSC610_1) alors CORR.RSC6101731 = GLOBAL.RSC610_1; finsi
+si present(GLOBAL.RSC611_1) alors CORR.RSC6111731 = GLOBAL.RSC611_1; finsi
+si present(GLOBAL.RSC612_1) alors CORR.RSC6121731 = GLOBAL.RSC612_1; finsi
+si present(GLOBAL.RSC613_1) alors CORR.RSC6131731 = GLOBAL.RSC613_1; finsi
+si present(GLOBAL.RSC614_1) alors CORR.RSC6141731 = GLOBAL.RSC614_1; finsi
+si present(GLOBAL.RSC615_1) alors CORR.RSC6151731 = GLOBAL.RSC615_1; finsi
+si present(GLOBAL.RSC616_1) alors CORR.RSC6161731 = GLOBAL.RSC616_1; finsi
+si present(GLOBAL.RSC617_1) alors CORR.RSC6171731 = GLOBAL.RSC617_1; finsi
+si present(GLOBAL.RSC618_1) alors CORR.RSC6181731 = GLOBAL.RSC618_1; finsi
+si present(GLOBAL.RSC619_1) alors CORR.RSC6191731 = GLOBAL.RSC619_1; finsi
+si present(GLOBAL.RSC620_1) alors CORR.RSC6201731 = GLOBAL.RSC620_1; finsi
+si present(GLOBAL.RSC621_1) alors CORR.RSC6211731 = GLOBAL.RSC621_1; finsi
+si present(GLOBAL.RSC622_1) alors CORR.RSC6221731 = GLOBAL.RSC622_1; finsi
+si present(GLOBAL.RSC623_1) alors CORR.RSC6231731 = GLOBAL.RSC623_1; finsi
+si present(GLOBAL.RSC7SJ_1) alors CORR.RSC7SJ1731 = GLOBAL.RSC7SJ_1; finsi
+si present(GLOBAL.RSC7SK_1) alors CORR.RSC7SK1731 = GLOBAL.RSC7SK_1; finsi
+si present(GLOBAL.RSC7SR_1) alors CORR.RSC7SR1731 = GLOBAL.RSC7SR_1; finsi
+si present(GLOBAL.RSC7TC_1) alors CORR.RSC7TC1731 = GLOBAL.RSC7TC_1; finsi
+si present(GLOBAL.RSC7TD_1) alors CORR.RSC7TD1731 = GLOBAL.RSC7TD_1; finsi
+si present(GLOBAL.RSC7UA_1) alors CORR.RSC7UA1731 = GLOBAL.RSC7UA_1; finsi
+si present(GLOBAL.RSC7UB_1) alors CORR.RSC7UB1731 = GLOBAL.RSC7UB_1; finsi
+si present(GLOBAL.RSC7UE_1) alors CORR.RSC7UE1731 = GLOBAL.RSC7UE_1; finsi
+si present(GLOBAL.RSC7UG_1) alors CORR.RSC7UG1731 = GLOBAL.RSC7UG_1; finsi
+si present(GLOBAL.RSC7UI_1) alors CORR.RSC7UI1731 = GLOBAL.RSC7UI_1; finsi
+si present(GLOBAL.RSC7UK_1) alors CORR.RSC7UK1731 = GLOBAL.RSC7UK_1; finsi
+si present(GLOBAL.RSC801_1) alors CORR.RSC8011731 = GLOBAL.RSC801_1; finsi
+si present(GLOBAL.RSC802_1) alors CORR.RSC8021731 = GLOBAL.RSC802_1; finsi
+si present(GLOBAL.RSC803_1) alors CORR.RSC8031731 = GLOBAL.RSC803_1; finsi
+si present(GLOBAL.RSC804_1) alors CORR.RSC8041731 = GLOBAL.RSC804_1; finsi
+si present(GLOBAL.RSC805_1) alors CORR.RSC8051731 = GLOBAL.RSC805_1; finsi
+si present(GLOBAL.RSC806_1) alors CORR.RSC8061731 = GLOBAL.RSC806_1; finsi
+si present(GLOBAL.RSC807_1) alors CORR.RSC8071731 = GLOBAL.RSC807_1; finsi
+si present(GLOBAL.RSC808_1) alors CORR.RSC8081731 = GLOBAL.RSC808_1; finsi
+si present(GLOBAL.RSC809_1) alors CORR.RSC8091731 = GLOBAL.RSC809_1; finsi
+si present(GLOBAL.RSNBS_1) alors CORR.RSNBS1731 = GLOBAL.RSNBS_1; finsi
+si present(GLOBAL.RSNBT_1) alors CORR.RSNBT1731 = GLOBAL.RSNBT_1; finsi
+si present(GLOBAL.RSNBU_1) alors CORR.RSNBU1731 = GLOBAL.RSNBU_1; finsi
+si present(GLOBAL.RSNBW_1) alors CORR.RSNBW1731 = GLOBAL.RSNBW_1; finsi
+si present(GLOBAL.RSNCA_1) alors CORR.RSNCA1731 = GLOBAL.RSNCA_1; finsi
+si present(GLOBAL.RSNCH_1) alors CORR.RSNCH1731 = GLOBAL.RSNCH_1; finsi
+si present(GLOBAL.RSNCI_1) alors CORR.RSNCI1731 = GLOBAL.RSNCI_1; finsi
+si present(GLOBAL.RSNCO_1) alors CORR.RSNCO1731 = GLOBAL.RSNCO_1; finsi
+si present(GLOBAL.RSNCP_1) alors CORR.RSNCP1731 = GLOBAL.RSNCP_1; finsi
+si present(GLOBAL.RSNCQ_1) alors CORR.RSNCQ1731 = GLOBAL.RSNCQ_1; finsi
+si present(GLOBAL.RSNCS_1) alors CORR.RSNCS1731 = GLOBAL.RSNCS_1; finsi
+si present(GLOBAL.RSNCT_1) alors CORR.RSNCT1731 = GLOBAL.RSNCT_1; finsi
+si present(GLOBAL.RSNCU_1) alors CORR.RSNCU1731 = GLOBAL.RSNCU_1; finsi
+si present(GLOBAL.RSNCV_1) alors CORR.RSNCV1731 = GLOBAL.RSNCV_1; finsi
+si present(GLOBAL.RSNCW_1) alors CORR.RSNCW1731 = GLOBAL.RSNCW_1; finsi
+si present(GLOBAL.RSNCX_1) alors CORR.RSNCX1731 = GLOBAL.RSNCX_1; finsi
+si present(GLOBAL.RSNDC_1) alors CORR.RSNDC1731 = GLOBAL.RSNDC_1; finsi
+si present(GLOBAL.RSNGW_1) alors CORR.RSNGW1731 = GLOBAL.RSNGW_1; finsi
+si present(GLOBAL.RSOC35_1) alors CORR.RSOC351731 = GLOBAL.RSOC35_1; finsi
+si present(GLOBAL.RSOC36_1) alors CORR.RSOC361731 = GLOBAL.RSOC36_1; finsi
+si present(GLOBAL.RSOC37_1) alors CORR.RSOC371731 = GLOBAL.RSOC37_1; finsi
+si present(GLOBAL.RSOC38_1) alors CORR.RSOC381731 = GLOBAL.RSOC38_1; finsi
+si present(GLOBAL.RSOC39_1) alors CORR.RSOC391731 = GLOBAL.RSOC39_1; finsi
+si present(GLOBAL.RSOC40_1) alors CORR.RSOC401731 = GLOBAL.RSOC40_1; finsi
+si present(GLOBAL.RSOC41_1) alors CORR.RSOC411731 = GLOBAL.RSOC41_1; finsi
+si present(GLOBAL.RSOC42_1) alors CORR.RSOC421731 = GLOBAL.RSOC42_1; finsi
+si present(GLOBAL.RSOC43_1) alors CORR.RSOC431731 = GLOBAL.RSOC43_1; finsi
+si present(GLOBAL.RSOC44_1) alors CORR.RSOC441731 = GLOBAL.RSOC44_1; finsi
+si present(GLOBAL.RSOCHYC_1) alors CORR.RSOCHYC1731 = GLOBAL.RSOCHYC_1; finsi
+si present(GLOBAL.RSOCHYCR_1) alors CORR.RSOCHYCR1731 = GLOBAL.RSOCHYCR_1; finsi
+si present(GLOBAL.RSOCHYD_1) alors CORR.RSOCHYD1731 = GLOBAL.RSOCHYD_1; finsi
+si present(GLOBAL.RSOCHYDR_1) alors CORR.RSOCHYDR1731 = GLOBAL.RSOCHYDR_1; finsi
+si present(GLOBAL.RSOCHYE_1) alors CORR.RSOCHYE1731 = GLOBAL.RSOCHYE_1; finsi
+si present(GLOBAL.RSOCHYER_1) alors CORR.RSOCHYER1731 = GLOBAL.RSOCHYER_1; finsi
+si present(GLOBAL.RSOCHYF_1) alors CORR.RSOCHYF1731 = GLOBAL.RSOCHYF_1; finsi
+si present(GLOBAL.RSOCHYFR_1) alors CORR.RSOCHYFR1731 = GLOBAL.RSOCHYFR_1; finsi
+si present(GLOBAL.RSOCHYG_1) alors CORR.RSOCHYG1731 = GLOBAL.RSOCHYG_1; finsi
+si present(GLOBAL.RSOCHYGR_1) alors CORR.RSOCHYGR1731 = GLOBAL.RSOCHYGR_1; finsi
+si present(GLOBAL.RSOCHYH_1) alors CORR.RSOCHYH1731 = GLOBAL.RSOCHYH_1; finsi
+si present(GLOBAL.RSOCHYHR_1) alors CORR.RSOCHYHR1731 = GLOBAL.RSOCHYHR_1; finsi
+si present(GLOBAL.RSOCHYI_1) alors CORR.RSOCHYI1731 = GLOBAL.RSOCHYI_1; finsi
+si present(GLOBAL.RSOCHYIR_1) alors CORR.RSOCHYIR1731 = GLOBAL.RSOCHYIR_1; finsi
+si present(GLOBAL.RSOCREPR_1) alors CORR.RSOCREPR1731 = GLOBAL.RSOCREPR_1; finsi
+si present(GLOBAL.RSOUFIP_1) alors CORR.RSOUFIP1731 = GLOBAL.RSOUFIP_1; finsi
+si present(GLOBAL.RSURV_1) alors CORR.RSURV1731 = GLOBAL.RSURV_1; finsi
+si present(GLOBAL.SFDEFBANI470) alors CORR.SFDEFBANI4701731 = GLOBAL.SFDEFBANI470; finsi
+si present(GLOBAL.SFDEFBANI) alors CORR.SFDEFBANI1731 = GLOBAL.SFDEFBANI; finsi
+si present(GLOBAL.SFDEFBANIH470) alors CORR.SFDEFBANIH4701731 = GLOBAL.SFDEFBANIH470; finsi
+si present(GLOBAL.SFDFANTPROV) alors CORR.SFDFANTPROV1731 = GLOBAL.SFDFANTPROV; finsi
+si present(GLOBAL.SHBA) alors CORR.SHBA1731 = GLOBAL.SHBA; finsi
+si present(GLOBAL.SOMBADF) alors CORR.SOMBADF1731 = GLOBAL.SOMBADF; finsi
+si present(GLOBAL.SOMBICDF) alors CORR.SOMBICDF1731 = GLOBAL.SOMBICDF; finsi
+si present(GLOBAL.SOMBNCDF) alors CORR.SOMBNCDF1731 = GLOBAL.SOMBNCDF; finsi
+si present(GLOBAL.SOMDBIC) alors CORR.SOMDBIC1731 = GLOBAL.SOMDBIC; finsi
+si present(GLOBAL.SOMDBNC) alors CORR.SOMDBNC1731 = GLOBAL.SOMDBNC; finsi
+si present(GLOBAL.SOMDEFLOC) alors CORR.DEFLOC1731 = GLOBAL.SOMDEFLOC; finsi
+si present(GLOBAL.SOMDLOC) alors CORR.SOMDLOC1731 = GLOBAL.SOMDLOC; finsi
+si present(GLOBAL.SOMLOCDF) alors CORR.SOMLOCDF1731 = GLOBAL.SOMLOCDF; finsi
+si present(GLOBAL.SOMMEBA) alors CORR.SOMMEBA1731 = GLOBAL.SOMMEBA; finsi
+si present(GLOBAL.SOMMEBIC) alors CORR.SOMMEBIC1731 = GLOBAL.SOMMEBIC; finsi
+si present(GLOBAL.SOMMEBNC) alors CORR.SOMMEBNC1731 = GLOBAL.SOMMEBNC; finsi
+si present(GLOBAL.SOMMELOC) alors CORR.SOMMELOC1731 = GLOBAL.SOMMELOC; finsi
+si present(GLOBAL.SOMMERCM) alors CORR.SOMMERCM1731 = GLOBAL.SOMMERCM; finsi
+si present(GLOBAL.SOMMERF) alors CORR.SOMMERF1731 = GLOBAL.SOMMERF; finsi
+si present(GLOBAL.SPENETPC) alors CORR.SPENETPC1731 = GLOBAL.SPENETPC; finsi
+si present(GLOBAL.SPENETPP) alors CORR.SPENETPP1731 = GLOBAL.SPENETPP; finsi
+si present(GLOBAL.SPENETPV) alors CORR.SPENETPV1731 = GLOBAL.SPENETPV; finsi
+si present(GLOBAL.TDEFBANI) alors CORR.TDEFBANI1731 = GLOBAL.TDEFBANI; finsi
+si present(GLOBAL.TDEFBNCNP) alors CORR.TDEFBNCNP1731 = GLOBAL.TDEFBNCNP; finsi
+si present(GLOBAL.TDEFNPI) alors CORR.TDEFNPI1731 = GLOBAL.TDEFNPI; finsi
+si present(GLOBAL.TDFANTPROV) alors CORR.TDFANTPROV1731 = GLOBAL.TDFANTPROV; finsi
+si present(GLOBAL.TDFBICNPF) alors CORR.TDFBICNPF1731 = GLOBAL.TDFBICNPF; finsi
+si present(GLOBAL.TDIDABNCNP1) alors CORR.TDIDABNCNP11731 = GLOBAL.TDIDABNCNP1; finsi
+si present(GLOBAL.TFRD1) alors CORR.TFRD11731 = GLOBAL.TFRD1; finsi
+si present(GLOBAL.TFRD2) alors CORR.TFRD21731 = GLOBAL.TFRD2; finsi
+si present(GLOBAL.TFRD3) alors CORR.TFRD31731 = GLOBAL.TFRD3; finsi
+si present(GLOBAL.TFRD4) alors CORR.TFRD41731 = GLOBAL.TFRD4; finsi
+si present(GLOBAL.TFRDC) alors CORR.TFRDC1731 = GLOBAL.TFRDC; finsi
+si present(GLOBAL.TFRDV) alors CORR.TFRDV1731 = GLOBAL.TFRDV; finsi
+si present(GLOBAL.TOTALQUO) alors CORR.TOTALQUO1731 = GLOBAL.TOTALQUO; finsi
+si present(GLOBAL.TSB1) alors CORR.TSB11731 = GLOBAL.TSB1; finsi
+si present(GLOBAL.TSB2) alors CORR.TSB21731 = GLOBAL.TSB2; finsi
+si present(GLOBAL.TSB3) alors CORR.TSB31731 = GLOBAL.TSB3; finsi
+si present(GLOBAL.TSB4) alors CORR.TSB41731 = GLOBAL.TSB4; finsi
+si present(GLOBAL.TSBC) alors CORR.TSBC1731 = GLOBAL.TSBC; finsi
+si present(GLOBAL.TSBP) alors CORR.TSBP1731 = GLOBAL.TSBP; finsi
+si present(GLOBAL.TSBV) alors CORR.TSBV1731 = GLOBAL.TSBV; finsi
+si present(GLOBAL.TSHBA) alors CORR.TSHBA1731 = GLOBAL.TSHBA; finsi
+si present(GLOBAL.TSPRC) alors CORR.TSPRC1731 = GLOBAL.TSPRC; finsi
+si present(GLOBAL.TSPRP) alors CORR.TSPRP1731 = GLOBAL.TSPRP; finsi
+si present(GLOBAL.TSPRT) alors CORR.TSPRT1731 = GLOBAL.TSPRT; finsi
+si present(GLOBAL.TSPRV) alors CORR.TSPRV1731 = GLOBAL.TSPRV; finsi
+si present(GLOBAL.TTSPRC) alors CORR.TTSPRC1731 = GLOBAL.TTSPRC; finsi
+si present(GLOBAL.TTSPRP) alors CORR.TTSPRP1731 = GLOBAL.TTSPRP; finsi
+si present(GLOBAL.TTSPRT) alors CORR.TTSPRT1731 = GLOBAL.TTSPRT; finsi
+si present(GLOBAL.TTSPRV) alors CORR.TTSPRV1731 = GLOBAL.TTSPRV; finsi
diff --git a/m_ext/2025/correctif.m b/m_ext/2025/correctif.m
index a9bdb0762..1501cd87e 100644
--- a/m_ext/2025/correctif.m
+++ b/m_ext/2025/correctif.m
@@ -776,19 +776,14 @@ sinon_si dans_domaine(VAR, calculee *) alors
NATURE = N_INDEFINIE;
finsi
sinon_si dans_domaine(VAR, saisie contexte) alors
- si meme_variable(VAR, V_REGCO) alors
- NATURE = N_REVENU;
- sinon_si
- meme_variable(VAR, V_EAG)
- ou meme_variable(VAR, V_EAD)
- ou meme_variable(VAR, V_CNR)
- ou meme_variable(VAR, V_CNR2)
- ou meme_variable(VAR, V_CR2)
- alors
- NATURE = N_CHARGE;
- sinon
- NATURE = N_REVENU;
- finsi
+ aiguillage nom (VAR): (
+ cas V_REGCO: NATURE = N_REVENU;
+ cas V_EAG:
+ cas V_CNR:
+ cas V_CNR2:
+ cas V_CR2: NATURE = N_CHARGE;
+ par_defaut: NATURE = N_REVENU;
+ )
sinon_si
dans_domaine(VAR, saisie variation)
ou dans_domaine(VAR, saisie penalite)
diff --git a/makefiles/c_backend.mk b/makefiles/c_backend.mk
index e14bd388d..b3ae6325a 100644
--- a/makefiles/c_backend.mk
+++ b/makefiles/c_backend.mk
@@ -56,7 +56,7 @@ calc/mlang.h: $(SOURCE_FILES) $(SOURCE_EXT_FILES) | calc_dir
@echo " MPP_FUNCTION=$(MPP_FUNCTION_BACKEND)"
@echo " DGFIP_TARGET_FLAGS=$(DGFIP_TARGET_FLAGS)"
@echo " DGFIP_COMMON_FLAGS=$(DGFIP_COMMON_FLAGS)"
- @$(MLANG_DGFIP) \
+ opam exec -- $(MLANG_DGFIP) \
--income-year=$(YEAR) \
--comparison_error_margin=$(COMPARISON_ERROR_MARGIN) \
--dgfip_options=$(DGFIP_TARGET_FLAGS),$(DGFIP_COMMON_FLAGS) \
@@ -64,6 +64,7 @@ calc/mlang.h: $(SOURCE_FILES) $(SOURCE_EXT_FILES) | calc_dir
--output calc/enchain.c \
$(SOURCE_FILES) $(SOURCE_EXT_FILES) $(QUIET)
cd calc && rm -f $(DRIVER_FILES)
+ @echo "Compilation OK"
endif
ifeq ($(call is_in,$(DGFIP_DIR)),1)
@@ -113,7 +114,7 @@ cal: $(DRIVER_TARGETS)
do \
$(MAKE_DGFIP_CALC) $$I || exit; \
done
- cd calc && $(CC) -lm *.o -o ../cal
+ cd calc && $(CC) *.o -o ../cal -lm
@echo "Compilation terminée"
endif
@@ -137,7 +138,7 @@ endif
ifeq ($(call is_in,$(DGFIP_DIR)),1)
backend_tests: compile_dgfip_c_backend
- ./cal -mode primitif -recursif ${TEST_FILES}
+ ./cal -mode primitif -recursif ${TEST_VAR_DEFS} ${TEST_FILES}
endif
ifeq ($(call is_in,$(DGFIP_DIR)),1)
@@ -147,7 +148,6 @@ test_dgfip_c_backend: FORCE
$(call make_in,$(DGFIP_DIR),$@)
endif
-
##################################################
# Cleaners
##################################################
@@ -174,11 +174,22 @@ clean_backend_c: FORCE
rm -f calc/*.inc
rm -f calc/version.*
rm -f calc/*.ml
+ if [ -d calc/m ] ; \
+ then \
+ rm -f calc/m/* ; \
+ rmdir calc/m ; \
+ fi
if [ -d calc/zos ] ; \
then \
rm -f calc/zos/* ; \
rmdir calc/zos ; \
fi
+ if [ -d calc/m ] ; \
+ then \
+ rm -f calc/m/* ; \
+ rmdir calc/m ; \
+ fi
+
else
clean_backend_c: FORCE
$(call make_in,$(DGFIP_DIR),$@)
diff --git a/makefiles/functions.mk b/makefiles/functions.mk
index 7f64e223b..48543b892 100644
--- a/makefiles/functions.mk
+++ b/makefiles/functions.mk
@@ -2,6 +2,12 @@
# Fonctions utiles #
##################################
+# saut de ligne, à utiliser avec ${\n}
+define \n
+
+
+endef
+
define to_bool
$(if $(1),1,)
endef
diff --git a/makefiles/mlang.mk b/makefiles/mlang.mk
index 77ad9ea16..ab59f6bcf 100644
--- a/makefiles/mlang.mk
+++ b/makefiles/mlang.mk
@@ -19,7 +19,7 @@ init-without-switch: FORCE
ifeq ($(call is_in,),)
$(call make_in,,$@)
else
- opam install . --deps-only
+ opam install . --deps-only --yes
git submodule init ir-calcul
git submodule update ir-calcul
endif
@@ -46,16 +46,28 @@ format: FORCE
ifeq ($(call is_in,),)
$(call make_in,,$@)
else
- dune build @fmt --auto-promote | true
+ opam exec -- dune build @fmt --auto-promote | true
endif
+.ONESHELL:
dune: FORCE
ifeq ($(call is_in,),)
$(call make_in,,$@)
else
- echo $(shell pwd)
+ echo $$(pwd)
+ OLDHASH=$$(cat $(MLANG_HASH))
sed -i 's/(version %%VERSION%%)/(version ${shell git describe --always --dirty --tag})/' dune-project
- LINKING_MODE=$(LINKING_MODE) dune build $(DUNE_OPTIONS)
+ LINKING_MODE='$(LINKING_MODE)' opam exec -- dune build $(DUNE_OPTIONS)
+ sha1sum _build/default/src/main.exe | awk '{print $$1}' > $(MLANG_HASH)
+ HASH=$$(cat $(MLANG_HASH))
+ echo "OLDHASH: '$$OLDHASH'"
+ echo "HASH: '$$HASH'"
+ if [ "$$HASH" = "$$OLDHASH" ]; then \
+ echo "binary is the same"; \
+ else \
+ echo "binary is new"; \
+ rm -f $(INTERP_PROGRESS)
+ fi
$(call make_in_raw,,remise_a_zero_versionnage)
endif
@@ -85,34 +97,34 @@ test: FORCE build-dev
ifeq ($(call is_in,),)
$(call make_in,,$@)
else
- OCAMLRUNPARAM=b $(MLANG_TEST) --run_test=$(TEST_FILE) $(SOURCE_FILES) $(SOURCE_EXT_FILES)
+ OCAMLRUNPARAM=b opam exec -- $(MLANG_TEST) --run_test=$(TEST_FILE) $(SOURCE_FILES) $(SOURCE_EXT_FILES)
endif
# use: TESTS_DIR=bla make test
-tests: FORCE build
+tests: FORCE build-release
ifeq ($(call is_in,),)
$(call make_in,,$@)
else
- $(MLANG_TEST) $(MLANGOPTS) --run_all_tests=$(TESTS_DIR)/ $(TEST_FILTER_FLAG) $(SOURCE_FILES) $(SOURCE_EXT_FILES)
+ opam exec -- $(MLANG_TEST) $(MLANGOPTS) --run_all_tests=$(TESTS_DIR)/ $(TEST_FILTER_FLAG) $(SOURCE_FILES) $(SOURCE_EXT_FILES)
endif
test_one: FORCE build-dev
ifeq ($(call is_in,),)
$(call make_in,,$@)
else
- OCAMLRUNPARAM=b $(MLANG_TEST) --run_test=$(TESTS_DIR)/$(TEST_ONE) $(SOURCE_FILES) $(SOURCE_EXT_FILES)
+ OCAMLRUNPARAM=b opam exec -- $(MLANG_TEST) --run_test=$(TESTS_DIR)/$(TEST_ONE) $(SOURCE_FILES) $(SOURCE_EXT_FILES)
endif
test_file: FORCE build-dev
ifeq ($(call is_in,),)
$(call make_in,,$@)
else
- OCAMLRUNPARAM=b $(MLANG_TEST) --run_test=$(TEST_FILE) $(SOURCE_FILES) $(SOURCE_EXT_FILES)
+ OCAMLRUNPARAM=b opam exec -- $(MLANG_TEST) --run_test=$(TEST_FILE) $(SOURCE_FILES) $(SOURCE_EXT_FILES)
endif
test_irj: FORCE build-dev
@for dir in $(IRJ_TESTS_DIRS); do \
- OCAMLRUNPARAM=b dune exec -- irj_checker $$dir -mhuman; \
+ OCAMLRUNPARAM=b opam exec -- dune exec -- irj_checker $$dir -mhuman; \
if [ $$? -ne 0 ]; \
then \
echo "Failed test $$dir"; \
@@ -121,7 +133,7 @@ test_irj: FORCE build-dev
done;
test_cram:
- dune build @runtest
+ opam exec -- dune build @runtest
##################################################
# Doc
@@ -143,16 +155,18 @@ sphinx-doc: FORCE build dev-doc
mkdir -p $(TARGET_DIR_SPHINX_DOC_SRC)/_static/dev
cp -r $(shell pwd)/_build/default/_doc/_html/* $(TARGET_DIR_SPHINX_DOC_SRC)/_static/dev
.venv/bin/sphinx-build -M html $(TARGET_DIR_SPHINX_DOC_SRC) $(TARGET_DIR_DOC_BUILD)
+
+latex-doc: sphinx-doc
.venv/bin/sphinx-build -M latexpdf $(TARGET_DIR_SPHINX_DOC_SRC) $(TARGET_DIR_DOC_BUILD)
-dev-doc: FORCE build
+dev-doc:
ifeq ($(call is_in,),)
$(call make_in,,$@)
else
- dune build @doc
+ opam exec -- dune build @doc
endif
-doc: FORCE build dev-doc sphinx-doc
+doc: dev-doc sphinx-doc
ifeq ($(call is_in,),)
$(call make_in,,$@)
else
diff --git a/makefiles/variables.mk b/makefiles/variables.mk
index 355fde3f1..b9d48f4f5 100644
--- a/makefiles/variables.mk
+++ b/makefiles/variables.mk
@@ -8,6 +8,7 @@
GCC=gcc
MUSL_HOME?=/usr/local/musl
+OPTIM_FLAG?=
##################################################
# Tax computation configuration
@@ -16,47 +17,55 @@ MUSL_HOME?=/usr/local/musl
MPP_FUNCTION_BACKEND?=enchainement_primitif
MPP_FUNCTION?=enchainement_primitif_interpreteur
SOURCE_EXT_DIR=$(ROOT_DIR)/m_ext/$(YEAR)
-# Add a TESTS_DIR for 2024 when available
-ifeq ($(filter $(YEAR), 2024 2025), $(YEAR))
- SOURCE_FILES?=$(call source_dir_sans_cibles_m,$(ROOT_DIR)/ir-calcul/M_SVN/$(YEAR)/code_m/)
- SOURCE_EXT_FILES?=\
- $(SOURCE_EXT_DIR)/cibles.m \
- $(SOURCE_EXT_DIR)/codes_1731.m \
- $(SOURCE_EXT_DIR)/commence_par_5.m \
- $(SOURCE_EXT_DIR)/commence_par_7.m \
- $(SOURCE_EXT_DIR)/commence_par_H.m \
- $(SOURCE_EXT_DIR)/correctif.m \
- $(SOURCE_EXT_DIR)/main.m
- TESTS_DIR?=$(ROOT_DIR)/tests/$(YEAR)/fuzzing
-else ifeq ($(filter $(YEAR), 2022 2023), $(YEAR))
- SOURCE_FILES?=$(call source_dir_sans_cibles_m,$(ROOT_DIR)/ir-calcul/sources$(YEAR)*/)
- SOURCE_EXT_FILES?=\
- $(SOURCE_EXT_DIR)/cibles.m \
- $(SOURCE_EXT_DIR)/codes_1731.m \
- $(SOURCE_EXT_DIR)/commence_par_5.m \
- $(SOURCE_EXT_DIR)/commence_par_7.m \
- $(SOURCE_EXT_DIR)/commence_par_H.m \
- $(SOURCE_EXT_DIR)/correctif.m \
- $(SOURCE_EXT_DIR)/main.m
- TESTS_DIR?=$(ROOT_DIR)/tests/$(YEAR)/fuzzing
+REPO?=ir
+# Add a TESTS_DIR for 2025 when available
+ifeq ($(REPO),svn)
+ SOURCE_FILES?=$(call source_dir_sans_cibles_m,$(ROOT_DIR)/ir-calcul/M_SVN/$(YEAR)/code_m/)
+ SOURCE_EXT_FILES?=\
+ $(SOURCE_EXT_DIR)/cibles.m \
+ $(SOURCE_EXT_DIR)/codes_1731.m \
+ $(SOURCE_EXT_DIR)/commence_par_5.m \
+ $(SOURCE_EXT_DIR)/commence_par_7.m \
+ $(SOURCE_EXT_DIR)/commence_par_H.m \
+ $(SOURCE_EXT_DIR)/correctif.m \
+ $(SOURCE_EXT_DIR)/main.m
+ TESTS_DIR?=$(ROOT_DIR)/tests/$(YEAR)/fuzzing
+else ifeq ($(filter $(YEAR), 2022 2023 2024), $(YEAR))
+ SOURCE_FILES?=$(call source_dir_sans_cibles_m,$(ROOT_DIR)/ir-calcul/sources$(YEAR)*/)
+ SOURCE_EXT_FILES?=\
+ $(SOURCE_EXT_DIR)/cibles.m \
+ $(SOURCE_EXT_DIR)/codes_1731.m \
+ $(SOURCE_EXT_DIR)/commence_par_5.m \
+ $(SOURCE_EXT_DIR)/commence_par_7.m \
+ $(SOURCE_EXT_DIR)/commence_par_H.m \
+ $(SOURCE_EXT_DIR)/correctif.m \
+ $(SOURCE_EXT_DIR)/main.m
+ TESTS_DIR?=$(ROOT_DIR)/tests/$(YEAR)/fuzzing
else ifeq ($(filter $(YEAR), 2018 2019 2020 2021), $(YEAR))
- SOURCE_FILES?=$(call source_dir,$(ROOT_DIR)/ir-calcul/sources$(YEAR)*/)
- SOURCE_EXT_FILES?=$(call source_dir_ext,$(ROOT_DIR)/m_ext/$(YEAR)/)
- TESTS_DIR?=$(ROOT_DIR)/tests/$(YEAR)/fuzzing
+ SOURCE_FILES?=$(call source_dir,$(ROOT_DIR)/ir-calcul/sources$(YEAR)*/)
+ SOURCE_EXT_FILES?=$(call source_dir_ext,$(ROOT_DIR)/m_ext/$(YEAR)/)
+ TESTS_DIR?=$(ROOT_DIR)/tests/$(YEAR)/fuzzing
else ifeq ($(filter $(YEAR), 0), $(YEAR))
- SOURCE_FILES?=#$(call source_dir,$(ROOT_DIR)/m_ext/$(YEAR)/src/)
- SOURCE_EXT_FILES?=$(call source_dir_ext,$(ROOT_DIR)/m_ext/$(YEAR)/)
- TESTS_DIR?=$(ROOT_DIR)/tests/$(YEAR)
+ SOURCE_FILES?=#$(call source_dir,$(ROOT_DIR)/m_ext/$(YEAR)/src/)
+ SOURCE_EXT_FILES?=$(call source_dir_ext,$(ROOT_DIR)/m_ext/$(YEAR)/)
+ TESTS_DIR?=$(ROOT_DIR)/tests/$(YEAR)
else
- $(warning WARNING: there is no default configuration for year: $(YEAR))
- $(warning WARNING: example specification files and fuzzer tests are not included for year: $(YEAR))
+ $(warning WARNING: there is no default configuration for year: $(YEAR))
+ $(warning WARNING: example specification files and fuzzer tests are not included for year: $(YEAR))
+endif
+
+# Positionne l'année pour les tests fuzzés
+ifeq ($(filter $(YEAR), 2024), $(YEAR))
+ TEST_VAR_DEFS=-D ANCSDED=2026 -D V_MILLESIME=defaut
+else
+ TEST_VAR_DEFS=
endif
##################################################
# Mlang configuration
##################################################
-MLANG_BIN=dune exec $(ROOT_DIR)/_build/default/src/main.exe --
+MLANG_BIN=dune exec mlang --
PRECISION?=double
MLANG_DEFAULT_OPTS=\
@@ -78,12 +87,10 @@ endif
# Options pour le compilateur C
# Attention, très long à compiler avec GCC en O2/O3
COMMON_CFLAGS?=-std=c89 -pedantic
-ifeq ($(CC), clang)
- COMPILER_SPECIFIC_CFLAGS=-O2
-# COMPILER_SPECIFIC_CFLAGS=
-else ifeq ($(CC), gcc)
- COMPILER_SPECIFIC_CFLAGS=-O1
+ifdef OPTIM_FLAG
+ COMPILER_SPECIFIC_CFLAGS=-O$(OPTIM_FLAG)
endif
+
BACKEND_CFLAGS?=$(COMMON_CFLAGS) $(COMPILER_SPECIFIC_CFLAGS)
# Directory of the driver sources for tax calculator
@@ -122,7 +129,7 @@ MLANG_INTERPRETER_OPTS=\
--comparison_error_margin=$(COMPARISON_ERROR_MARGIN) \
--mpp_function=$(MPP_FUNCTION)
-MLANG_TEST=$(MLANG_BIN) $(MLANG_DEFAULT_OPTS) $(MLANG_INTERPRETER_OPTS) $(CODE_COVERAGE_FLAG)
+MLANG_TEST=$(MLANG_BIN) $(MLANG_DEFAULT_OPTS) $(MLANG_INTERPRETER_OPTS) $(CODE_COVERAGE_FLAG) $(TEST_VAR_DEFS)
DGFIP_DIR?=examples/dgfip_c/ml_primitif
@@ -132,3 +139,6 @@ MAKE_DGFIP_CALC=$(MAKE) --no-print-directory -f $(ROOT_DIR)/Makefile -C $(ROOT_D
IRJ_BIN=irj_checker
IRJ_TESTS_DIRS?=tests/2019 tests/2020 tests/2022 tests/2023
+
+INTERP_PROGRESS=examples/dgfip_c/ml_primitif/.interpreter_progress
+MLANG_HASH=examples/dgfip_c/ml_primitif/.mlang.hash
diff --git a/mlang-deps b/mlang-deps
index 03f6a0a59..0a49fb8e7 160000
--- a/mlang-deps
+++ b/mlang-deps
@@ -1 +1 @@
-Subproject commit 03f6a0a59555a5311abd0e670010aecb142548c0
+Subproject commit 0a49fb8e7ed2527ce02bf7cd73e4998cc8d80c89
diff --git a/mlang.opam b/mlang.opam
index f82831209..c16ecb47b 100644
--- a/mlang.opam
+++ b/mlang.opam
@@ -15,7 +15,7 @@ license: "GPL-3.0-or-later"
homepage: "https://github.com/MLanguage/mlang"
bug-reports: "https://github.com/MLanguage/mlang/issues"
depends: [
- "ocaml" {>= "4.13.0"}
+ "ocaml" {>= "4.14.2"}
"dune" {>= "2.7" & build}
"ANSITerminal" {= "0.8.2"}
"cmdliner" {= "1.3.0"}
@@ -25,7 +25,7 @@ depends: [
"dune-build-info" {= "2.9.3"}
"num" {>= "1.3"}
"mlgmpidl" {>= "1.2.12"}
- "ocamlformat" {= "0.24.1"}
+ "ocamlformat" {= "0.28.1"}
"parmap" {= "1.2.3"}
]
build: [
diff --git a/scripts/lazy_compile/build.sh b/scripts/lazy_compile/build.sh
new file mode 100644
index 000000000..51d071b72
--- /dev/null
+++ b/scripts/lazy_compile/build.sh
@@ -0,0 +1 @@
+opam exec -- ocamlfind ocamlc -package str -package unix -package cmdliner -linkpkg -o lazy_compile utils.ml dep_graph.mli dep_graph.ml cli.mli cli.ml main.ml
diff --git a/scripts/lazy_compile/cli.ml b/scripts/lazy_compile/cli.ml
new file mode 100644
index 000000000..89d13dcd6
--- /dev/null
+++ b/scripts/lazy_compile/cli.ml
@@ -0,0 +1,46 @@
+open Cmdliner
+
+let cfiles_dir_ref = ref `Uninit
+
+let config_file_ref = ref `Uninit
+
+let get (type t) (v : [ `Uninit | `Init of t ] ref) : t =
+ match !v with `Uninit -> failwith "Uninitialized option" | `Init v -> v
+
+let set (type t) (v : t) (r : [ `Uninit | `Init of t ] ref) : unit =
+ r := `Init v
+
+let set_cfiles_dir (f : string) = set f cfiles_dir_ref
+
+let set_config_file f = set f config_file_ref
+
+let cfiles_dir () = get cfiles_dir_ref
+
+let config_file () = get config_file_ref
+
+(* -- Cmdliner -- *)
+
+let arg_cfiles_dir =
+ Arg.(
+ value & opt (some string) None & info [ "file-dir"; "F" ] ~doc:"C files dir")
+
+let arg_config_file =
+ Arg.(
+ value & opt (some string) None & info [ "config"; "C" ] ~doc:"Config file")
+
+let init_vars cfiles_dir config_file =
+ Option.iter set_config_file config_file;
+ Option.iter set_cfiles_dir cfiles_dir
+
+let lcc_term = Term.(const init_vars $ arg_cfiles_dir $ arg_config_file)
+
+let info =
+ let doc = "Lazy C compiler" in
+ let man = [] in
+ let exits = Cmd.Exit.defaults in
+ Cmd.info "lcc" ~version:"0.0.1" ~doc ~exits ~man
+
+let read_args () =
+ match Cmdliner.Cmd.eval_value @@ Cmdliner.Cmd.v info lcc_term with
+ | Ok _v -> ()
+ | Error _e -> failwith "Cli failed"
diff --git a/scripts/lazy_compile/cli.mli b/scripts/lazy_compile/cli.mli
new file mode 100644
index 000000000..2a8fb5a7a
--- /dev/null
+++ b/scripts/lazy_compile/cli.mli
@@ -0,0 +1,5 @@
+val cfiles_dir : unit -> string
+
+val config_file : unit -> string
+
+val read_args : unit -> unit
diff --git a/scripts/lazy_compile/config b/scripts/lazy_compile/config
new file mode 100644
index 000000000..c28bfe3e8
--- /dev/null
+++ b/scripts/lazy_compile/config
@@ -0,0 +1,15 @@
+# External dependencies
+assert.h:echo ""
+dirent.h:echo ""
+errno.h:echo ""
+fcntl.h:echo ""
+float.h:echo ""
+limits.h:echo ""
+math.h:echo ""
+setjmp.h:echo ""
+stdio.h:echo ""
+stdlib.h:echo ""
+string.h:echo ""
+sys/stat.h:echo ""
+time.h:echo ""
+unistd.h:echo ""
\ No newline at end of file
diff --git a/scripts/lazy_compile/dep_graph.ml b/scripts/lazy_compile/dep_graph.ml
new file mode 100644
index 000000000..5f487e291
--- /dev/null
+++ b/scripts/lazy_compile/dep_graph.ml
@@ -0,0 +1,259 @@
+open Utils
+
+type file =
+ (* Files that needs to be compiled. *)
+ | Mlang_gen of {
+ mname : string;
+ (* The base name of the file *)
+ mhash : Digest.t;
+ (* Its content's digest *)
+ mdeps : string list; (* Its dependencies *)
+ }
+ (* External dependencies, no need to compile them *)
+ | Ext_dep of {
+ edname : string;
+ (* The basename of the dependency *)
+ edvers : string; (* The dependency verison *)
+ }
+
+type t = {
+ graph : file StrMap.t;
+ (* map of file basenames to their file representation *)
+ cfiles : string list;
+ (* The list of files to compile *)
+ ext_dep : (string * string) list; (* name * command to get version *)
+ }
+
+exception MissingFileDeclaration of string
+
+let empty =
+ { graph = StrMap.empty; cfiles = []; ext_dep = [] }
+
+(** The regexp that matches the following substrings: #include
+ #include"str" #include
+
+ Why the last two? Because we will compile the C files eventually and
+ invalid C intructions will be rejected, so why bother. TODO: make it
+ better if you want. *)
+let magic_regexp = Str.regexp {|^.*#include \(<\|"\)\(.*\)\(>\|"\)|}
+
+let get_cfiles_of_dir cfiles_dir =
+ let files = Sys.readdir cfiles_dir in
+ Array.fold_left
+ (fun acc f ->
+ if f = "" then acc
+ else
+ match (Filename.extension f, f.[0]) with
+ | (".c" | ".h"), ('a' .. 'z' | 'A' .. 'Z' | '0' .. '9') -> f :: acc
+ | _ -> acc)
+ [] files
+(** Pretty prints a file. For debug only. *)
+let pp_file fmt (f : file) =
+ match f with
+ | Mlang_gen { mdeps; mhash; _ } ->
+ Format.fprintf fmt "M(%s)[%a]" (Digest.to_hex mhash)
+ (pp_list ~sep:";@," ~pp:Format.pp_print_string)
+ mdeps
+ | Ext_dep { edvers; _ } -> Format.fprintf fmt "E(%s)" edvers
+
+(** Pretty prints a graph. For debug only. *)
+let pp fmt (t : t) =
+ Format.fprintf fmt
+ "Files to compile: [%a]@;External dependencies: [%a]@;Graph: %a@;"
+ (pp_list ~sep:";" ~pp:Format.pp_print_string)
+ t.cfiles
+ (pp_list ~sep:";" ~pp:(fun fmt (v, _) -> Format.pp_print_string fmt v))
+ t.ext_dep
+ (pp_str_map ~sep:(",", "@,") ~pp:pp_file)
+ t.graph
+
+(** Checks if a line is a C include. If so, returns the file included.
+ Otherwise, returns [None]. *)
+let line_states_it_depends_on l =
+ if Str.string_match magic_regexp l 0 then Some (Str.matched_group 2 l)
+ else None
+
+(** Returns the list of dependencies of a given file. *)
+let file_states_it_depends_on f =
+ let i = open_in f in
+ let rec loop acc =
+ match input_line i with
+ | exception End_of_file ->
+ close_in i;
+ acc
+ | l -> (
+ match line_states_it_depends_on l with
+ | None -> loop acc
+ | Some f -> loop (f :: acc))
+ in
+ loop []
+
+(** Adds a file to the graph. The file must have been declared in either the
+ field [mlang_generated] or the [ext_dep one]; otherwise, raises
+ [MissingFileDeclaration]. If it already belongs to the graph, does
+ nothing. *)
+let rec add_file_to_graph ~cfiles_dir t filename =
+ if StrMap.mem filename t.graph then (* Already treated *)
+ t
+ else if List.mem filename t.cfiles then
+ (* File to compile: calculating its digest & dependencies. *)
+ let cfile = Filename.concat cfiles_dir filename in
+ let hash = Digest.file cfile in
+ let deps = file_states_it_depends_on cfile in
+ let t =
+ {
+ t with
+ graph =
+ StrMap.add filename
+ (Mlang_gen { mname = filename; mhash = hash; mdeps = deps })
+ t.graph;
+ }
+ in
+ (* Recursively adds its dependencies to the graph. *)
+ List.fold_left (add_file_to_graph ~cfiles_dir) t deps
+ else
+ match List.find (fun f -> filename = fst f) t.ext_dep with
+ | _, cmd ->
+ (* This is an external dependency. Running the command version to add
+ it to the graph. *)
+ let edvers = run_command cmd in
+ {
+ t with
+ graph =
+ StrMap.add filename
+ (Ext_dep { edname = filename; edvers })
+ t.graph;
+ }
+ | exception Not_found ->
+ (* File is neither a mlang file nor an external dependency. *)
+ raise (MissingFileDeclaration filename)
+
+(** Returns the name of the compilation output file. *)
+let output_file_name cfile =
+ Filename.concat Env.output_dir (Filename.chop_extension cfile ^ ".o")
+
+(** Compiles [cfile]. *)
+let compile_file ~cfiles_dir ~cfile ~ofile =
+ let pedantic = if Env.pedantic = "0" then "" else "--pedantic " in
+ let cmd =
+ Format.sprintf "%s -std=c89 -I%s %s -O2 -c %s -o %s" Env.cc
+ cfiles_dir pedantic cfile ofile
+ in
+ Log.log "Compiling file %S..." cfile;
+ let res = run_command cmd in
+ Log.log "%s" res;
+ Log.log "Compilation of file %S complete-> %S" cfile ofile;
+ res
+
+(** Intermediary function; From an [old] dependency map corresponding to an old
+ compilation, and a [new_] dependency map built from a configuration file,
+ compiles a graph node (that should come from [new_]). The [compiled] map
+ stores for each file basename a boolean stating the files depending on it
+ will need to be recompiled ([true]) or do not need recompilation ([false]).
+ If the node is an external dependency, checks if the version is the same
+ than in [old]. If so, maps it in [compiled] to [false], otherwise to [true].
+ If the node is an mlang generated file, compiles all its dependencies &
+ checks if one needed to be recompiled: if so, maps it in [compiled] to
+ [true], otherwise to [false]. *)
+let rec compile_node_ ~cfiles_dir ~(old : t) ~(new_ : t)
+ (compiled : bool StrMap.t) : file -> bool StrMap.t * bool =
+ function
+ | Ext_dep { edname; edvers } ->
+ let should_recompile =
+ match StrMap.find edname old.graph with
+ | exception Not_found ->
+ Log.warn "External dependency %S not found in old graph" edname;
+ true
+ | Mlang_gen _ ->
+ Log.warn "External dependency %S defined as mlang file in old graph"
+ edname;
+ true
+ | Ext_dep { edvers = edvers'; _ } -> edvers <> edvers'
+ in
+ (compiled, should_recompile)
+ | Mlang_gen { mname; mhash; mdeps } -> (
+ Log.debug "Compiling mlang generated file %S" mname;
+ Log.debug "Dependencies: %i" (List.length mdeps);
+ let ofile = output_file_name mname in
+ let compile () =
+ let (_ : string) =
+ compile_file ~cfiles_dir ~cfile:(Filename.concat cfiles_dir mname) ~ofile
+ in
+ (StrMap.add mname true compiled, true)
+ in
+ let dont_recompile () = (StrMap.add mname false compiled, false) in
+ match StrMap.find mname compiled with
+ | b -> (compiled, b)
+ | exception Not_found -> (
+ (* Compiles dependencies *)
+ let compiled, should_recompile =
+ List.fold_left
+ (fun (set, should_recomp_acc) dep ->
+ Log.debug "Compile dependency %S" dep;
+ let set, should_recomp =
+ compile_node_ ~cfiles_dir ~old ~new_ set
+ (StrMap.find dep new_.graph)
+ in
+ (set, should_recomp_acc || should_recomp))
+ (compiled, false) mdeps
+ in
+ (* TODO: recompile here *)
+ match StrMap.find mname old.graph with
+ | Ext_dep _ | (exception Not_found) -> compile ()
+ | Mlang_gen { mhash = mhash'; _ }
+ when mhash <> mhash' || should_recompile
+ || not (Sys.file_exists ofile) ->
+ compile ()
+ | Mlang_gen _ -> dont_recompile ()))
+
+(** Compiles the mlang_generated files of a graph. *)
+let compile ~cfiles_dir ~old ~new_ =
+ List.fold_left
+ (fun compiled d ->
+ let compiled, _ =
+ compile_node_ ~cfiles_dir ~old ~new_ compiled (StrMap.find d new_.graph)
+ in
+ compiled)
+ StrMap.empty new_.cfiles
+
+(** From a list of mlang files and external dependencies, returns the graph
+ with all the mlang files and its dependencies. Fails with
+ [MissingFileDeclaration] if an mlang file depends on a file that is
+ neither in [files_of_dir] nor [ext_dep]. *)
+let make ~cfiles_dir ~ext_dep =
+ let cfiles = get_cfiles_of_dir cfiles_dir in
+ let empty_graph = { graph = StrMap.empty; cfiles; ext_dep } in
+ List.fold_left (add_file_to_graph ~cfiles_dir) empty_graph cfiles
+
+(* -- Graph serialization -- *)
+
+let lazy_compile_version () = Digest.file Sys.argv.(0)
+
+(** Writes a (marshaled) graph. *)
+let write (g : t) =
+ let fname = Filename.concat Env.output_dir Env.graph_filename
+ and lc_version = lazy_compile_version () in
+ let out = open_out fname in
+ try
+ Marshal.to_channel out (lc_version, g) [ No_sharing ];
+ close_out out
+ with
+ | exn ->
+ Log.err "Failing to write graph in %S: %s." fname (Printexc.to_string exn);
+ close_out out;
+ Sys.remove fname;
+ raise exn
+
+(** Reads a graph serialized by [write]. In case of failure, returns an empty
+ graph. *)
+let read () =
+ try
+ let c = open_in (Filename.concat Env.output_dir Env.graph_filename) in
+ let (lcversion, g) = Marshal.from_channel c in
+ if lcversion = lazy_compile_version () then
+ g
+ else begin
+ Log.warn "Newer version of lazy compile: ignoring old data.";
+ empty
+ end
+ with Failure _ | Sys_error _ | End_of_file -> empty
diff --git a/scripts/lazy_compile/dep_graph.mli b/scripts/lazy_compile/dep_graph.mli
new file mode 100644
index 000000000..e25406f4d
--- /dev/null
+++ b/scripts/lazy_compile/dep_graph.mli
@@ -0,0 +1,28 @@
+
+(** A module for dependency graphs. This graph will be saved after the project
+ compilation for future compilation. When the script starts, it will read the
+ old graph and compare the files digests. If a file does not have the same
+ digest in the two graph, its compilation (and the compilation of all the
+ files depending on it) must be restarted. *)
+
+type t
+
+exception MissingFileDeclaration of string
+(** This is raised when we try to add a file to the graph that is not in the
+ mlang_generated list nor in the ext_dep. *)
+
+val pp : Format.formatter -> t -> unit
+(** Pretty prints a dependency graph. *)
+
+val make :
+ cfiles_dir:string -> ext_dep:(string * string) list -> t
+(** Reads the cfiles_dir directory and builds the corresponding dependency graph. *)
+
+val compile: cfiles_dir:string -> old:t -> new_:t -> bool Utils.StrMap.t
+(** Compiles the graph files in the correct dependency order.
+ [old] holds the previous dependency graph, so that only files that have been updated
+ are recompiled. *)
+
+val write : t -> unit
+
+val read : unit -> t
diff --git a/scripts/lazy_compile/main.ml b/scripts/lazy_compile/main.ml
new file mode 100644
index 000000000..738b68f3a
--- /dev/null
+++ b/scripts/lazy_compile/main.ml
@@ -0,0 +1,123 @@
+(** Usage:
+
+ $ lazy_compile -F [FILEDIR] -C [CONFIGFILE]
+
+ Can be configured with additional environment variables.
+ - [OUTPUT_DIR]: the dir to write the .o files (default: output). Generated
+ if it does not exist (default: output).
+ - [DEPGRAPH_FILENAME]: the file in which is serialized the dependency graph.
+ Written in [OUTPUT_DIR] (default: .depgraph).
+ - [DEBUG]: displays debug messages (default: 0).
+ - [PEDANTIC]: makes gcc pedantic (default: 1).
+ - [CC]: the C compiler to use (default: gcc).
+
+ How to compile:
+
+ $ bash build.sh
+
+ TODOs:
+ - logs in files;
+ - versioning depgraph files or stop using Marshal (that may deserialize
+ something badly and make the script fail even badlier). *)
+
+open Utils
+
+(** Handles the configuration file. The configuration file syntax is the
+ following:
+ - "# External dependencies"
+ - A list of pairs "file:command" where 'file' is the name of the external
+ dependency as it would appear in the C file including it, and 'command' is
+ a command returning the version of the file, which will be used to check
+ if it changed between two compilations. *)
+module Config = struct
+ let header = "# External dependencies"
+
+ (** The regexp for reading the external dependencies pairs. *)
+ let ext_dep_regexp = Str.regexp {|^\(.*\):\(.*\)$|}
+
+ (** Reads [config_file] and builds the external depenency list of the project.
+ *)
+ let read ~config_file =
+ let chan = open_in config_file in
+ let rec empty_header_then_deps () =
+ match input_line chan with
+ | "" -> empty_header_then_deps ()
+ | l ->
+ if l <> header then (
+ Log.err "[Error] File should start with %s, not %S" header l;
+ raise (Failure "Config.read"))
+ else edeps []
+ and edeps acc =
+ match input_line chan with
+ | exception End_of_file -> acc
+ | "" -> edeps acc
+ | l ->
+ if Str.string_match ext_dep_regexp l 0 then
+ edeps ((Str.matched_group 1 l, Str.matched_group 2 l) :: acc)
+ else (
+ Log.err
+ "[Error] Invalid external dependency line %s. Expected : \
+ 'filename':'command'"
+ l;
+ raise (Failure "Config.read"))
+ in
+ try
+ let edeps = empty_header_then_deps () in
+ close_in chan;
+ edeps
+ with exn ->
+ close_in chan;
+ raise exn
+end
+
+(** Compiles the file specified in the [config_file]. *)
+let compile ~cfiles_dir ~config_file =
+ Log.log "Starting compilation...";
+ let old = Dep_graph.read () in
+ Log.debug "Old graph: %a" Dep_graph.pp old;
+ let new_ =
+ let ext_dep = Config.read ~config_file in
+ Dep_graph.make ~cfiles_dir ~ext_dep
+ in
+ Log.debug "New graph: %a" Dep_graph.pp new_;
+ let m : bool StrMap.t = Dep_graph.compile ~cfiles_dir ~old ~new_ in
+ let newly_compiled =
+ StrMap.fold (fun k b acc -> if b then k :: acc else acc) m []
+ in
+ if newly_compiled = [] then
+ Log.log "Nothing changed. Not recompiling project."
+ else (
+ Log.log "Compilation over.";
+ Log.log "Files compiled: %a"
+ (pp_list ~sep:", " ~pp:Format.pp_print_string)
+ newly_compiled;
+ Dep_graph.write new_)
+
+(** Checks the cfiles dir exists. Also, creates the output dir if it does not
+ exist. *)
+let init ~cfiles_dir =
+ (* Checking existence of cfiles_dir *)
+ let () =
+ match Sys.is_directory cfiles_dir with
+ | exception Sys_error _ ->
+ Format.ksprintf failwith "Directory %S does not exist" cfiles_dir
+ | true -> ()
+ | false -> Format.ksprintf failwith "File %S is not a directory" cfiles_dir
+ in
+ (* Checking existence of output dir *)
+ let () =
+ match Sys.is_directory Env.output_dir with
+ | exception Sys_error _ -> Sys.mkdir Env.output_dir 0o777
+ | true -> ()
+ | false ->
+ Format.ksprintf failwith "File %S is not a directory" Env.output_dir
+ in
+ ()
+
+let main () =
+ let () = Cli.read_args () in
+ let cfiles_dir = Cli.cfiles_dir () and config_file = Cli.config_file () in
+ init ~cfiles_dir;
+ compile ~cfiles_dir ~config_file
+
+let () = main ()
diff --git a/scripts/lazy_compile/utils.ml b/scripts/lazy_compile/utils.ml
new file mode 100644
index 000000000..5845a0585
--- /dev/null
+++ b/scripts/lazy_compile/utils.ml
@@ -0,0 +1,77 @@
+
+
+module Env = struct
+ (** Returns the value of an env variable [k]. If absent, returns [default]. *)
+ let getenv ~default k =
+ match Sys.getenv k with v -> v | exception Not_found -> default
+
+ (** The output dir *)
+ let output_dir = getenv ~default:"output" "OUTPUT_DIR"
+
+ (** The graph filename *)
+ let graph_filename = getenv ~default:".depgraph" "DEPGRAPH_FILENAME"
+
+ (** If set to something else than "0", display debug messages.*)
+ let debug = getenv ~default:"0" "DEBUG"
+
+ let pedantic = getenv ~default:"1" "PEDANTIC"
+
+ let cc = getenv ~default:"gcc" "CC"
+end
+
+module StrSet = Set.Make (String)
+module StrMap = Map.Make (String)
+
+(** Pretty prints a list. *)
+let pp_list ~sep ~pp fmt l =
+ Format.pp_print_list ~pp_sep:(fun fmt _ -> Format.fprintf fmt sep) pp fmt l
+
+(** Pretty prints a string map. *)
+let pp_str_map ~sep ~pp fmt m =
+ let skb, sl = sep in
+ StrMap.iter
+ (fun k b ->
+ Format.fprintf fmt "%s%t%a%t" k
+ (fun fmt -> Format.fprintf fmt skb)
+ pp b
+ (fun fmt -> Format.fprintf fmt sl))
+ m
+
+(** Runs a command and returns its output as a string *)
+let run_command (cmd : string) : string =
+ let ic = Unix.open_process_in cmd in
+ let buf = Buffer.create 1024 in
+ (try
+ while true do
+ Buffer.add_string buf (input_line ic);
+ Buffer.add_char buf '\n'
+ done
+ with End_of_file -> ());
+ ignore (Unix.close_process_in ic);
+ Buffer.contents buf
+
+module Log = struct
+ let dbg = int_of_string_opt Env.debug
+
+ let log : 'a. ('a, Format.formatter, unit) format -> 'a =
+ fun ppf -> Format.(fprintf std_formatter ("[APP] " ^^ ppf ^^ "@."))
+
+ let err : 'a. ('a, Format.formatter, unit) format -> 'a =
+ fun ppf ->
+ Format.(fprintf err_formatter ("[ERR] " ^^ ppf ^^ "@."))
+
+ let warn : 'a. ('a, Format.formatter, unit) format -> 'a =
+ fun ppf ->
+ match dbg with
+ | Some i when i >= 1 ->
+ Format.(fprintf std_formatter ("[WRN] " ^^ ppf ^^ "@."))
+ | _ -> Format.(ifprintf std_formatter ppf)
+
+ let debug : 'a. ('a, Format.formatter, unit) format -> 'a =
+ fun ppf ->
+ match dbg with
+ | Some i when i >= 2 ->
+ Format.(fprintf std_formatter ("[DBG] " ^^ ppf ^^ "@."))
+ | _ -> Format.(ifprintf std_formatter ppf)
+
+end
diff --git a/scripts/lazy_compile/utils.mli b/scripts/lazy_compile/utils.mli
new file mode 100644
index 000000000..9820d2677
--- /dev/null
+++ b/scripts/lazy_compile/utils.mli
@@ -0,0 +1,55 @@
+
+(** Environment variables used through the script. *)
+module Env : sig
+ val output_dir : string
+ (** The directory where compiled files are written into. *)
+
+ val graph_filename : string
+ (** The filename in which we write the results of the compilation. *)
+
+ val debug : string
+ (** The verbosity of the script. Should be an integer. *)
+
+ val pedantic : string
+ (** The verbosity of the compuler. Should be an integer. *)
+
+ val cc : string
+ (** The used compiler. *)
+end
+
+(** Collections *)
+
+module StrSet : Set.S with type elt = string
+module StrMap : Map.S with type key = string
+
+(** Pretty printers *)
+
+val pp_list :
+ sep:(unit, Format.formatter, unit) format ->
+ pp:(Format.formatter -> 'a -> unit) ->
+ Format.formatter -> 'a list -> unit
+
+val pp_str_map :
+ sep:(unit, Format.formatter, unit) format *
+ (unit, Format.formatter, unit) format ->
+ pp:(Format.formatter -> 'a -> unit) ->
+ Format.formatter -> 'a StrMap.t -> unit
+
+val run_command : string -> string
+(** Runs a command and outputs its result as a string *)
+
+(** Different logs helpers, using [Env.debug] to select which
+ are active. *)
+module Log : sig
+ val log : ('a, Format.formatter, unit) format -> 'a
+ (** Prints in stdout *)
+
+ val err : ('a, Format.formatter, unit) format -> 'a
+ (** Prints in stderr *)
+
+ val warn : ('a, Format.formatter, unit) format -> 'a
+ (** Prints in stdout if debug >= 1 *)
+
+ val debug : ('a, Format.formatter, unit) format -> 'a
+ (** Prints in stdout if debug >= 2 *)
+end
diff --git a/src/dune b/src/dune
index 1a3906950..f9516a95a 100644
--- a/src/dune
+++ b/src/dune
@@ -9,7 +9,13 @@
;; show warnings but still allow release in release mode
(release
(flags
- (:standard -w +a-4-40..42-44-45-70 -warn-error -a))))
+ (:standard -w +a-4-40..42-44-45-70 -warn-error -a)))
+ (static-release
+ (flags
+ (:standard \ -opaque))
+ (ocamlopt_flags
+ (:standard -O3))
+ (inline_tests disabled)))
(rule
(with-stdout-to
@@ -19,8 +25,26 @@
(executable
(name main)
(package mlang)
+ (modules
+ (:standard \ main_static))
(public_name mlang)
(flags
(:standard
(:include linking-flags-mlang.sexp)))
(libraries mlang))
+
+(rule
+ (copy main.ml main_static.ml))
+
+(executable
+ (name main_static)
+ (package mlang)
+ (modules main_static)
+ (public_name mlang-static)
+ (enabled_if
+ (= %{profile} static-release))
+ (flags
+ (-ccopt -static)
+ (:standard
+ (:include linking-flags-mlang.sexp)))
+ (libraries mlang))
diff --git a/src/irj_checker/backend_irj/pas_calc.ml b/src/irj_checker/backend_irj/pas_calc.ml
index 07d5d41e4..63173e8fd 100644
--- a/src/irj_checker/backend_irj/pas_calc.ml
+++ b/src/irj_checker/backend_irj/pas_calc.ml
@@ -1,3 +1,18 @@
+(******************************************************************************)
+(* *)
+(* Droit d'auteur (c) 2024 - 2026 DGFiP - INRIA *)
+(* *)
+(* Ce programme est distribué sous la licence CeCILL-C: vous pouvez le *)
+(* redistribuer et/ou le modifier sous les contraintes de celle-ci. *)
+(* *)
+(* L'accessibilité au code source et les droits de copie, de modification et *)
+(* de redistribution qui découlent de ce contrat ont pour contrepartie de *)
+(* n'offrir aux utilisateurs qu'une garantie limitée et de ne faire peser sur *)
+(* l'auteur du logiciel, le titulaire des droits patrimoniaux et les *)
+(* concédants successifs qu'une responsabilité restreinte. *)
+(* *)
+(******************************************************************************)
+
open Utils
open Irj_utils.Irj_ast
diff --git a/src/irj_checker/irj_checker.ml b/src/irj_checker/irj_checker.ml
index b6e4dc741..d667d90c5 100644
--- a/src/irj_checker/irj_checker.ml
+++ b/src/irj_checker/irj_checker.ml
@@ -1,17 +1,17 @@
-(* Copyright (C) 2023-2024 DGFiP, contributor: David Declerck, Mathieu Durero
-
- This program is free software: you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free Software
- Foundation, either version 3 of the License, or (at your option) any later
- version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see . *)
+(******************************************************************************)
+(* *)
+(* Droit d'auteur (c) 2024 - 2026 DGFiP - INRIA *)
+(* *)
+(* Ce programme est distribué sous la licence CeCILL-C: vous pouvez le *)
+(* redistribuer et/ou le modifier sous les contraintes de celle-ci. *)
+(* *)
+(* L'accessibilité au code source et les droits de copie, de modification et *)
+(* de redistribution qui découlent de ce contrat ont pour contrepartie de *)
+(* n'offrir aux utilisateurs qu'une garantie limitée et de ne faire peser sur *)
+(* l'auteur du logiciel, le titulaire des droits patrimoniaux et les *)
+(* concédants successifs qu'une responsabilité restreinte. *)
+(* *)
+(******************************************************************************)
(** The Irj_checker Module is a simple entry point to use the Mlang IRJ file
parser in order to perform syntactic checks on test files or produce other
@@ -24,8 +24,6 @@ open Cmdliner
open Irj_utils
open Utils
-type message_format_enum = Human | GNU
-
type validation_mode_enum = Strict | Corrective | Primitive
type transformation_target = None | PasCalcP | PasCalcC
@@ -38,11 +36,10 @@ let gen_file generator test_data =
Format.pp_print_newline out_fmt ();
Format.pp_print_flush out_fmt ()
-let irj_check_file (f : string) (message_format : message_format_enum)
- (validation_mode : validation_mode_enum)
+let irj_check_file (f : string) (validation_mode : validation_mode_enum)
(transform_target : transformation_target) : unit =
try
- let test_data = Irj_file.parse_file f in
+ let test_data = Irj_file.parse_input (Filename f) in
let test_data =
match validation_mode with
| Primitive ->
@@ -59,7 +56,7 @@ let irj_check_file (f : string) (message_format : message_format_enum)
in
match transform_target with
| None ->
- Cli.result_print "%s: checked as %s with %d primitive codes!"
+ Ppf.result_print "%s: checked as %s with %d primitive codes!"
test_data.nom
(match test_data.rapp with
| Some _ -> "corrective"
@@ -67,34 +64,29 @@ let irj_check_file (f : string) (message_format : message_format_enum)
(List.length test_data.prim.entrees)
| PasCalcP -> gen_file Pas_calc.gen_pas_calc_json_primitif test_data.prim
| PasCalcC -> gen_file Pas_calc.gen_pas_calc_json_correctif test_data
- with Errors.StructuredError (msg, pos, kont) ->
- (match message_format with
- | Human ->
- Cli.error_print "There has been an error in %S: %a" f
- Errors.format_structured_error
- | GNU -> Format.eprintf "%a" Errors.format_structured_error_gnu_format)
- (msg, pos);
+ with Errors.StructuredError (msg, kont) ->
+ Ppf.error_print "There has been an error in %S: %a" f
+ Ppf.format_structured_message msg;
(match kont with None -> () | Some kont -> kont ());
exit 123
-let rec irj_checker (f : string) (message_format : message_format_enum)
- (validation_mode : validation_mode_enum)
+let rec irj_checker (f : string) (validation_mode : validation_mode_enum)
(transform_target : transformation_target) : unit =
if not (Sys.file_exists f) then (
- Cli.error_print "%s: this path is not a valid file in the filesystem" f;
+ Ppf.error_print "%s: this path is not a valid file in the filesystem" f;
exit 124);
if Sys.is_directory f then
Array.iter
(fun sub ->
- irj_checker (Filename.concat f sub) message_format validation_mode
- transform_target)
+ irj_checker (Filename.concat f sub) validation_mode transform_target)
(Sys.readdir f)
- else irj_check_file f message_format validation_mode transform_target
+ else irj_check_file f validation_mode transform_target
-let irj_checker (f : string) (message_format : message_format_enum)
+let irj_checker (f : string) (message_format : Config.message_format)
(validation_mode : validation_mode_enum)
(transform_target : transformation_target) : unit =
- irj_checker f message_format validation_mode transform_target
+ Config.message_format := message_format;
+ irj_checker f validation_mode transform_target
let validation_mode_opt =
[ ("strict", Strict); ("corrective", Corrective); ("primitive", Primitive) ]
@@ -110,12 +102,12 @@ let validation_mode =
only the corresponding files are accepted, for instance primitive \
file in corrective mode will raise an error.")
-let message_format_opt = [ ("human", Human); ("gnu", GNU) ]
+let message_format_opt = [ ("human", Config.ANSI); ("gnu", GNU) ]
let message_format =
Arg.(
value
- & opt (enum message_format_opt) Human
+ & opt (enum message_format_opt) Config.ANSI
& info [ "m"; "message-format" ]
~doc:
"Selects the format of error and warning messages emitted by the \
diff --git a/src/main.ml b/src/main.ml
index 78a3ed5ac..024d78129 100644
--- a/src/main.ml
+++ b/src/main.ml
@@ -1,17 +1,16 @@
-(* Copyright (C) 2019-2021 Inria, contributor: Denis Merigoux
-
-
- This program is free software: you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free Software
- Foundation, either version 3 of the License, or (at your option) any later
- version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see . *)
+(******************************************************************************)
+(* *)
+(* Droit d'auteur (c) 2019 - 2026 DGFiP - INRIA *)
+(* *)
+(* Ce programme est distribué sous la licence CeCILL-C: vous pouvez le *)
+(* redistribuer et/ou le modifier sous les contraintes de celle-ci. *)
+(* *)
+(* L'accessibilité au code source et les droits de copie, de modification et *)
+(* de redistribution qui découlent de ce contrat ont pour contrepartie de *)
+(* n'offrir aux utilisateurs qu'une garantie limitée et de ne faire peser sur *)
+(* l'auteur du logiciel, le titulaire des droits patrimoniaux et les *)
+(* concédants successifs qu'une responsabilité restreinte. *)
+(* *)
+(******************************************************************************)
let () = Mlang.Driver.main ()
diff --git a/src/mlang/backend_compilers/bir_to_dgfip_c.ml b/src/mlang/backend_compilers/bir_to_dgfip_c.ml
index 5388c17f7..abf97ee7c 100644
--- a/src/mlang/backend_compilers/bir_to_dgfip_c.ml
+++ b/src/mlang/backend_compilers/bir_to_dgfip_c.ml
@@ -1,19 +1,19 @@
-(* Copyright (C) 2019-2021 Inria, contributor: Denis Merigoux
-
-
- This program is free software: you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free Software
- Foundation, either version 3 of the License, or (at your option) any later
- version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see . *)
+(******************************************************************************)
+(* *)
+(* Droit d'auteur (c) 2020 - 2026 DGFiP - INRIA *)
+(* *)
+(* Ce programme est distribué sous la licence CeCILL-C: vous pouvez le *)
+(* redistribuer et/ou le modifier sous les contraintes de celle-ci. *)
+(* *)
+(* L'accessibilité au code source et les droits de copie, de modification et *)
+(* de redistribution qui découlent de ce contrat ont pour contrepartie de *)
+(* n'offrir aux utilisateurs qu'une garantie limitée et de ne faire peser sur *)
+(* l'auteur du logiciel, le titulaire des droits patrimoniaux et les *)
+(* concédants successifs qu'une responsabilité restreinte. *)
+(* *)
+(******************************************************************************)
+module C = Constr
module D = DecoupledExpr
module VID = Dgfip_varid
@@ -127,708 +127,213 @@ let str_escape str =
in
aux 0
-let fresh_c_local =
- let c = ref 0 in
- fun name ->
- let s = name ^ string_of_int !c in
- incr c;
- s
-
let rec lis_tabaccess (p : Mir.program) m_sp_opt v m_idx =
- let d_irdata = D.ddirect @@ D.dinstr "irdata" in
- let set_vars, idx_def, idx_val =
- let e_idx = generate_c_expr p m_idx in
- (e_idx.set_vars, e_idx.def_test, e_idx.value_comp)
- in
- let res = fresh_c_local "res" in
- let res_def = Pp.spr "%s_def" res in
- let res_val = Pp.spr "%s_val" res in
- let d_fun =
- D.dfun "lis_tabaccess"
- [
- d_irdata;
- D.ddirect @@ D.dinstr @@ VID.gen_var_space_id m_sp_opt v;
- D.ddirect @@ D.dinstr @@ Pp.spr "%d" (Com.Var.loc_tab_idx v);
- idx_def;
- idx_val;
- D.ddirect @@ D.dinstr @@ Pp.spr "&%s" res_def;
- D.ddirect @@ D.dinstr @@ Pp.spr "&%s" res_val;
- ]
- in
- let set_vars =
- set_vars
- @ [
- (D.Def, res_def, d_fun); (D.Val, res_val, D.ddirect @@ D.dinstr res_val);
- ]
- in
- let def_test = D.dinstr res_def in
- let value_comp = D.dinstr res_val in
- D.build_transitive_composition { set_vars; def_test; value_comp }
+ let e_idx = generate_c_expr p m_idx in
+ D.make_let e_idx (fun vardef varval ->
+ D.atomic
+ @@ D.dfun_with_ptr "lis_tabaccess" (fun ~ptrdef ~ptrval ->
+ [
+ C.irdata;
+ C.(Varspace_of (m_sp_opt, v));
+ C.Lit (float_of_int (Com.Var.loc_tab_idx v));
+ D.def_expr_to_constr vardef;
+ varval;
+ ptrdef;
+ ptrval;
+ ]))
-and generate_c_expr (p : Mir.program) (e : Mir.expression Pos.marked) :
- D.expression_composition =
- let comparison op se1 se2 =
- let safe_def = false in
- let set_vars = se1.D.set_vars @ se2.D.set_vars in
- let def_test = D.dand se1.D.def_test se2.D.def_test in
- let value_comp =
- let op =
- let open Com in
- match Pos.unmark op with
- | Gt -> ">"
- | Gte -> ">="
- | Lt -> "<"
- | Lte -> "<="
- | Eq -> "=="
- | Neq -> "!="
- in
- D.comp op se1.value_comp se2.value_comp
- in
- D.build_transitive_composition ~safe_def { set_vars; def_test; value_comp }
- in
- let binop op se1 se2 =
- match Pos.unmark op with
- | _ ->
- let set_vars = se1.D.set_vars @ se2.D.set_vars in
- let def_test =
- match Pos.unmark op with
- | Com.And | Com.Mul | Com.Div | Com.Mod ->
- D.dand se1.def_test se2.def_test
- | Com.Or | Com.Add | Com.Sub -> D.dor se1.def_test se2.def_test
- in
- let op e1 e2 =
- match Pos.unmark op with
- | Com.And -> D.dand e1 e2
- | Com.Or -> D.dor e1 e2
- | Com.Add -> D.plus e1 e2
- | Com.Sub -> D.sub e1 e2
- | Com.Mul -> D.mult e1 e2
- | Com.Div -> D.ite e2 (D.div e1 e2) (D.lit 0.)
- | Com.Mod -> D.ite e2 (D.modulo e1 e2) (D.lit 0.)
- in
- let value_comp = op se1.value_comp se2.value_comp in
- D.build_transitive_composition ~safe_def:true
- { set_vars; def_test; value_comp }
- in
- let unop op se =
- let set_vars = se.D.set_vars in
- let def_test = se.def_test in
- let op, safe_def =
- match op with Com.Not -> (D.dnot, false) | Com.Minus -> (D.minus, true)
- in
- let value_comp = op se.value_comp in
- D.build_transitive_composition ~safe_def { set_vars; def_test; value_comp }
- in
- match Pos.unmark e with
- | Com.TestInSet (positive, e0, values) ->
- let se0 = generate_c_expr p e0 in
- let ldef, lval = D.locals_from_m () in
- let sle0 =
- {
- D.set_vars = [];
- D.def_test = D.local_var ldef;
- D.value_comp = D.local_var lval;
- }
- in
- let declare_local constr =
- D.let_local ldef se0.def_test (D.let_local lval se0.value_comp constr)
+and code_access (p : Mir.program) m_acc =
+ match m_acc with
+ | Com.VarAccess (_, v) ->
+ D.atomic
+ { set_vars = []; def_test = D.DE.detrue; value_comp = C.Varinfo v }
+ | Com.TabAccess ((_, v), m_i) ->
+ D.make_let (generate_c_expr p m_i) (fun vardef varval ->
+ D.atomic
+ {
+ set_vars = [];
+ def_test = vardef;
+ value_comp = C.Varinfo_tab (v, D.def_expr_to_constr vardef, varval);
+ })
+ | Com.FieldAccess (_, ie, f, _) ->
+ D.make_let (generate_c_expr p ie) (fun vardef varval ->
+ D.atomic
+ {
+ set_vars = [];
+ def_test = vardef;
+ value_comp =
+ C.Varinfo_field
+ (D.def_expr_to_constr vardef, varval, Pos.unmark f);
+ })
+
+and access p acc =
+ match acc with
+ | Com.VarAccess (m_sp_opt, var) ->
+ let def_test = D.DE.devar @@ C.M (m_sp_opt, var, Def) in
+ let value_comp = C.M (m_sp_opt, var, Val) in
+ D.atomic { set_vars = []; def_test; value_comp }
+ | TabAccess ((m_sp_opt, v), m_idx) -> lis_tabaccess p m_sp_opt v m_idx
+ | FieldAccess (m_sp_opt, me, f, _) ->
+ let fn = Pp.spr "event_field_%s" (Pos.unmark f) in
+ D.make_let (generate_c_expr p me) (fun vardef varval ->
+ let arg_exprs = [ D.def_expr_to_constr vardef; varval ] in
+ let d_fun =
+ D.dfun_with_ptr fn (fun ~ptrdef ~ptrval ->
+ [ C.irdata; C.Varspace_current m_sp_opt; ptrdef; ptrval ]
+ @ arg_exprs)
+ in
+ D.atomic
+ @@ { d_fun with def_test = D.DE.deand [ vardef; d_fun.def_test ] })
+
+and generate_test_in_set p positive e0 values =
+ D.make_let (generate_c_expr p e0) (fun vardef varval ->
+ let varval_expr =
+ D.atomic { set_vars = []; def_test = vardef; value_comp = varval }
in
let or_chain =
List.fold_left
(fun or_chain set_value ->
let equal_test =
match set_value with
- | Com.VarValue (Pos.Mark (VarAccess (m_sp_opt, v), _)) ->
- let s_v =
- let def_test = D.m_var m_sp_opt v Def in
- let value_comp = D.m_var m_sp_opt v Val in
- D.{ set_vars = []; def_test; value_comp }
- in
- comparison (Pos.without Com.Eq) sle0 s_v
- | Com.VarValue (Pos.Mark (TabAccess (m_sp_opt, v, m_i), _)) ->
- let s_v = lis_tabaccess p m_sp_opt v m_i in
- comparison (Pos.without Com.Eq) sle0 s_v
- | Com.VarValue (Pos.Mark (FieldAccess (m_sp_opt, me, f, _), _)) ->
- let fn = Pp.spr "event_field_%s" (Pos.unmark f) in
- let res = fresh_c_local "result" in
- let res_def = Pp.spr "%s_def" res in
- let res_val = Pp.spr "%s_val" res in
- let res_def_ptr = Pp.spr "&%s" res_def in
- let res_val_ptr = Pp.spr "&%s" res_val in
- let set_vars, arg_exprs =
- let e = generate_c_expr p me in
- (e.set_vars, [ e.def_test; e.value_comp ])
- in
- let var_space_id = VID.gen_var_space_id_opt m_sp_opt in
- let d_fun =
- D.dfun fn
- ([
- D.ddirect @@ D.dinstr "irdata";
- D.ddirect @@ D.dinstr var_space_id;
- D.ddirect @@ D.dinstr res_def_ptr;
- D.ddirect @@ D.dinstr res_val_ptr;
- ]
- @ arg_exprs)
- in
- let set_vars =
- set_vars
- @ [
- (D.Def, res_def, d_fun);
- (D.Val, res_val, D.ddirect (D.dinstr res_val));
- ]
- in
- let def_test = D.dinstr res_def in
- let value_comp = D.dinstr res_val in
- let s_f = D.{ set_vars; def_test; value_comp } in
- comparison (Pos.without Com.Eq) sle0 s_f
+ | Com.VarValue acc ->
+ D.comparison (Pos.without Com.Eq) varval_expr
+ (access p (Pos.unmark acc))
| Com.FloatValue i ->
- let s_i =
- {
- D.set_vars = [];
- D.def_test = D.dtrue;
- D.value_comp = D.lit (Pos.unmark i);
- }
- in
- comparison (Pos.without Com.Eq) sle0 s_i
+ D.comparison (Pos.without Com.Eq) varval_expr
+ D.(atomic @@ elit @@ Pos.unmark i)
| Com.IntervalValue (bn, en) ->
let s_bn =
- let bn' = float_of_int (Pos.unmark bn) in
- D.{ set_vars = []; def_test = dtrue; value_comp = lit bn' }
+ bn |> Pos.unmark |> float_of_int |> D.elit |> D.atomic
+ and s_en =
+ en |> Pos.unmark |> float_of_int |> D.elit |> D.atomic
in
- let s_en =
- let en' = float_of_int (Pos.unmark en) in
- D.{ set_vars = []; def_test = dtrue; value_comp = lit en' }
- in
- binop (Pos.without Com.And)
- (comparison (Pos.without Com.Gte) sle0 s_bn)
- (comparison (Pos.without Com.Lte) sle0 s_en)
+ D.binop (Pos.without Com.And)
+ (D.comparison (Pos.without Com.Gte) varval_expr s_bn)
+ (D.comparison (Pos.without Com.Lte) varval_expr s_en)
in
- binop (Pos.without Com.Or) or_chain equal_test)
- D.{ set_vars = []; def_test = dfalse; value_comp = lit 0. }
+ D.binop (Pos.without Com.Or) or_chain equal_test)
+ (D.atomic @@ { (D.eundefined ()) with def_test = vardef })
values
in
- let se = if positive then or_chain else unop Com.Not or_chain in
- {
- D.set_vars = se0.set_vars @ se.set_vars;
- D.def_test = declare_local se.def_test;
- D.value_comp = declare_local se.value_comp;
- }
- | Comparison (op, e1, e2) ->
+ if positive then or_chain else D.unop Com.Not or_chain)
+
+and funcall p f args =
+ match (f, args) with
+ | Com.Supzero, [ arg ] -> D.Func.supzero @@ generate_c_expr p arg
+ | PresentFunc, [ arg ] -> D.Func.present @@ generate_c_expr p arg
+ | NullFunc, [ arg ] -> D.Func.null @@ generate_c_expr p arg
+ | ArrFunc, [ arg ] -> D.Func.arr @@ generate_c_expr p arg
+ | InfFunc, [ arg ] -> D.Func.inf @@ generate_c_expr p arg
+ | AbsFunc, [ arg ] -> D.Func.abs @@ generate_c_expr p arg
+ | MaxFunc, [ e1; e2 ] ->
let se1 = generate_c_expr p e1 in
let se2 = generate_c_expr p e2 in
- comparison op se1 se2
- | Binop (op, e1, e2) ->
+ D.Func.max se1 se2
+ | MinFunc, [ e1; e2 ] ->
let se1 = generate_c_expr p e1 in
let se2 = generate_c_expr p e2 in
- binop op se1 se2
- | Unop (op, e) -> unop op @@ generate_c_expr p e
- | Conditional (c, t, f_opt) ->
- let cond = generate_c_expr p c in
- let thenval = generate_c_expr p t in
- let elseval =
- match f_opt with
- | None -> D.{ set_vars = []; def_test = dfalse; value_comp = lit 0. }
- | Some f -> generate_c_expr p f
- in
- let set_vars =
- cond.D.set_vars @ thenval.D.set_vars @ elseval.D.set_vars
- in
+ D.Func.min se1 se2
+ | Multimax, [ e1; Pos.Mark (Com.Var (VarAccess v), _) ] ->
+ D.Func.multimax (generate_c_expr p e1) v
+ | NbEvents, _ -> D.Func.nb_events () (* should expect strictly no argument *)
+ | Func fn, args -> D.Func.call fn @@ List.map (generate_c_expr p) args
+ | _ -> assert false (* should not happen *)
+
+and attribute p acc attr =
+ D.make_let (code_access p acc) (fun vardef varval ->
let def_test =
- D.dand cond.def_test
- (D.ite cond.value_comp thenval.def_test elseval.def_test)
- in
- let value_comp =
- D.ite cond.value_comp thenval.value_comp elseval.value_comp
- in
- D.build_transitive_composition { set_vars; def_test; value_comp }
- | FuncCall (Pos.Mark (Supzero, _), [ arg ]) ->
- let se = generate_c_expr p arg in
- let set_vars = se.D.set_vars in
- let cond = D.dand se.def_test (D.comp ">=" se.value_comp (D.lit 0.0)) in
- let def_test = D.ite cond D.dfalse se.def_test in
- let value_comp = D.ite cond (D.lit 0.0) se.value_comp in
- D.build_transitive_composition { set_vars; def_test; value_comp }
- | FuncCall (Pos.Mark (PresentFunc, _), [ arg ]) ->
- let se = generate_c_expr p arg in
- let set_vars = se.D.set_vars in
- let def_test = D.dtrue in
- let value_comp = se.def_test in
- D.build_transitive_composition ~safe_def:true
- { set_vars; def_test; value_comp }
- | FuncCall (Pos.Mark (NullFunc, _), [ arg ]) ->
- let se = generate_c_expr p arg in
- let set_vars = se.D.set_vars in
- let def_test = se.def_test in
- let value_comp =
- D.dand def_test (D.comp "==" se.value_comp (D.lit 0.0))
- in
- D.build_transitive_composition ~safe_def:true
- { set_vars; def_test; value_comp }
- | FuncCall (Pos.Mark (ArrFunc, _), [ arg ]) ->
- let se = generate_c_expr p arg in
- let set_vars = se.D.set_vars in
- let def_test = se.def_test in
- let value_comp = D.dfun "my_arr" [ se.value_comp ] in
- (* Here we boldly assume that rounding value of `undef` will give zero,
- given the invariant. Pretty sure that not true, in case of doubt, turn
- `safe_def` to false *)
- D.build_transitive_composition ~safe_def:true
- { set_vars; def_test; value_comp }
- | FuncCall (Pos.Mark (InfFunc, _), [ arg ]) ->
- let se = generate_c_expr p arg in
- let set_vars = se.D.set_vars in
- let def_test = se.def_test in
- let value_comp = D.dfun "my_floor" [ se.value_comp ] in
- (* same as above *)
- D.build_transitive_composition ~safe_def:true
- { set_vars; def_test; value_comp }
- | FuncCall (Pos.Mark (AbsFunc, _), [ arg ]) ->
- let se = generate_c_expr p arg in
- let set_vars = se.D.set_vars in
- let def_test = se.def_test in
- let value_comp = D.dfun "fabs" [ se.value_comp ] in
- D.build_transitive_composition ~safe_def:true
- { set_vars; def_test; value_comp }
- | FuncCall (Pos.Mark (MaxFunc, _), [ e1; e2 ]) ->
- let se1 = generate_c_expr p e1 in
- let se2 = generate_c_expr p e2 in
- let set_vars = se1.D.set_vars @ se2.D.set_vars in
- let def_test = D.dor se1.def_test se2.def_test in
- let value_comp = D.dfun "max" [ se1.value_comp; se2.value_comp ] in
- D.build_transitive_composition ~safe_def:true
- { set_vars; def_test; value_comp }
- | FuncCall (Pos.Mark (MinFunc, _), [ e1; e2 ]) ->
- let se1 = generate_c_expr p e1 in
- let se2 = generate_c_expr p e2 in
- let set_vars = se1.D.set_vars @ se2.D.set_vars in
- let def_test = D.dor se1.def_test se2.def_test in
- let value_comp = D.dfun "min" [ se1.value_comp; se2.value_comp ] in
- D.build_transitive_composition ~safe_def:true
- { set_vars; def_test; value_comp }
- | FuncCall (Pos.Mark (Multimax, _), [ e1; Pos.Mark (Var m_acc, _) ]) -> (
- match m_acc with
- | VarAccess (m_sp_opt, v) ->
- let ptr = VID.gen_info_ptr v in
- let d_irdata = D.ddirect (D.dinstr "irdata") in
- let set_vars, bound_def, bound_val =
- let bound = generate_c_expr p e1 in
- (bound.set_vars, bound.def_test, bound.value_comp)
- in
- let res = fresh_c_local "res" in
- let res_def = Pp.spr "%s_def" res in
- let res_val = Pp.spr "%s_val" res in
- let res_def_ptr = Pp.spr "&%s" res_def in
- let res_val_ptr = Pp.spr "&%s" res_val in
- let d_fun =
- D.dfun "multimax_varinfo"
- [
- d_irdata;
- D.ddirect @@ D.dinstr @@ VID.gen_var_space_id m_sp_opt v;
- D.ddirect @@ D.dinstr ptr;
- bound_def;
- bound_val;
- D.ddirect @@ D.dinstr res_def_ptr;
- D.ddirect @@ D.dinstr res_val_ptr;
- ]
- in
- let set_vars =
- set_vars
- @ [
- (D.Def, res_def, d_fun);
- (D.Val, res_val, D.ddirect @@ D.dinstr res_val);
- ]
- in
- let def_test = D.dinstr res_def in
- let value_comp = D.dinstr res_val in
- D.build_transitive_composition { set_vars; def_test; value_comp }
- | TabAccess _ | FieldAccess _ -> assert false)
- | FuncCall (Pos.Mark (NbEvents, _), _) ->
- let def_test = D.dinstr "1.0" in
- let value_comp = D.dinstr "nb_evenements(irdata)" in
- D.build_transitive_composition { set_vars = []; def_test; value_comp }
- | FuncCall (Pos.Mark (Func fn, _), args) ->
- let res = fresh_c_local "result" in
- let res_def = Pp.spr "%s_def" res in
- let res_val = Pp.spr "%s_val" res in
- let res_def_ptr = Pp.spr "&%s" res_def in
- let res_val_ptr = Pp.spr "&%s" res_val in
- let set_vars, arg_exprs =
- let rec aux (set_vars, arg_exprs) = function
- | [] -> (List.rev set_vars, List.rev arg_exprs)
- | a :: la ->
- let e = generate_c_expr p a in
- let set_vars = List.rev e.set_vars @ set_vars in
- let arg_exprs = e.value_comp :: e.def_test :: arg_exprs in
- aux (set_vars, arg_exprs) la
- in
- aux ([], []) args
- in
- let d_fun =
- D.dfun fn
- ([
- D.ddirect (D.dinstr "irdata");
- D.ddirect (D.dinstr res_def_ptr);
- D.ddirect (D.dinstr res_val_ptr);
- ]
- @ arg_exprs)
- in
- let set_vars =
- set_vars
- @ [
- (D.Def, res_def, d_fun);
- (D.Val, res_val, D.ddirect (D.dinstr res_val));
+ D.DE.deand
+ [
+ vardef;
+ D.DE.devar @@ C.Fun (Pp.spr "attribut_%s_def" attr, [ varval ]);
]
+ and value_comp = C.Fun (Pp.spr "attribut_%s" attr, [ varval ]) in
+ D.(
+ atomic
+ @@ build_transitive_composition ~safe_def:true
+ { set_vars = []; def_test; value_comp }))
+
+and size p acc =
+ D.make_let (code_access p acc) (fun vardef varval ->
+ let f =
+ D.dfun_with_ptr "size_varinfo" (fun ~ptrdef ~ptrval ->
+ [ varval; ptrdef; ptrval ])
in
- let def_test = D.dinstr res_def in
- let value_comp = D.dinstr res_val in
- D.build_transitive_composition { set_vars; def_test; value_comp }
- | FuncCall _ -> assert false (* should not happen *)
- | Literal (Float f) ->
- { set_vars = []; def_test = D.dtrue; value_comp = D.lit f }
- | Literal Undefined ->
- { set_vars = []; def_test = D.dfalse; value_comp = D.lit 0. }
- | Var (VarAccess (m_sp_opt, var)) ->
- let def_test = D.m_var m_sp_opt var Def in
- let value_comp = D.m_var m_sp_opt var Val in
- { set_vars = []; def_test; value_comp }
- | Var (TabAccess (m_sp_opt, v, m_idx)) -> lis_tabaccess p m_sp_opt v m_idx
- | Var (FieldAccess (m_sp_opt, me, f, _)) ->
- let fn = Pp.spr "event_field_%s" (Pos.unmark f) in
- let res = fresh_c_local "result" in
- let res_def = Pp.spr "%s_def" res in
- let res_val = Pp.spr "%s_val" res in
- let res_def_ptr = Pp.spr "&%s" res_def in
- let res_val_ptr = Pp.spr "&%s" res_val in
- let set_vars, arg_exprs =
- let e = generate_c_expr p me in
- (e.set_vars, [ e.def_test; e.value_comp ])
- in
+ D.atomic { f with def_test = D.DE.deand [ vardef; f.def_test ] })
+
+and is_type p acc typ =
+ D.make_let (code_access p acc) (fun vardef varval ->
let d_fun =
- D.dfun fn
- ([
- D.ddirect @@ D.dinstr "irdata";
- D.ddirect @@ D.dinstr @@ VID.gen_var_space_id_opt m_sp_opt;
- D.ddirect @@ D.dinstr res_def_ptr;
- D.ddirect @@ D.dinstr res_val_ptr;
- ]
- @ arg_exprs)
- in
- let set_vars =
- set_vars
- @ [
- (D.Def, res_def, d_fun);
- (D.Val, res_val, D.ddirect (D.dinstr res_val));
- ]
+ D.dfun_with_ptr "est_type" (fun ~ptrdef ~ptrval ->
+ [ varval; C.Typ typ; ptrdef; ptrval ])
in
- let def_test = D.dinstr res_def in
- let value_comp = D.dinstr res_val in
- D.build_transitive_composition { set_vars; def_test; value_comp }
- | Attribut (m_acc, a) -> (
- let attr = Pos.unmark a in
- match Pos.unmark m_acc with
- | VarAccess (_, v) | TabAccess (_, v, _) ->
- let ptr = VID.gen_info_ptr v in
- let def_test =
- D.dinstr (Pp.spr "attribut_%s_def((T_varinfo *)%s)" attr ptr)
- in
- let value_comp =
- D.dinstr (Pp.spr "attribut_%s((T_varinfo *)%s)" attr ptr)
- in
- D.build_transitive_composition { set_vars = []; def_test; value_comp }
- | FieldAccess (_, ie, f, _) ->
- let d_irdata = D.ddirect (D.dinstr "irdata") in
- let set_vars, evt_d_fun =
- let e = generate_c_expr p ie in
- let evt_fn = Pp.spr "event_field_%s_var" (Pos.unmark f) in
- (e.set_vars, D.dfun evt_fn [ d_irdata; e.def_test; e.value_comp ])
- in
- let def_test =
- D.dfun (Pp.spr "attribut_%s_def" attr) [ D.ddirect evt_d_fun ]
- in
- let value_comp =
- D.dfun (Pp.spr "attribut_%s" attr) [ D.ddirect evt_d_fun ]
- in
- D.build_transitive_composition { set_vars; def_test; value_comp })
- | Size m_acc -> (
- match Pos.unmark m_acc with
- | VarAccess (_, v) ->
- let ptr = VID.gen_info_ptr v in
- let def_test = D.dinstr "1.0" in
- let value_comp = D.dinstr (Format.sprintf "(%s->size)" ptr) in
- D.build_transitive_composition { set_vars = []; def_test; value_comp }
- | TabAccess _ ->
- let def_test = D.dinstr "1.0" in
- let value_comp = D.dinstr "1.0" in
- D.build_transitive_composition { set_vars = []; def_test; value_comp }
- | FieldAccess (_, ie, f, _) ->
- let d_irdata = D.ddirect (D.dinstr "irdata") in
- let set_vars, evt_d_fun =
- let e = generate_c_expr p ie in
- let evt_fn = Pp.spr "event_field_%s_var" (Pos.unmark f) in
- (e.set_vars, D.dfun evt_fn [ d_irdata; e.def_test; e.value_comp ])
- in
- let res = fresh_c_local "res" in
- let res_def = Pp.spr "%s_def" res in
- let res_val = Pp.spr "%s_val" res in
- let res_def_ptr = Pp.spr "&%s" res_def in
- let res_val_ptr = Pp.spr "&%s" res_val in
+ D.atomic { d_fun with def_test = D.DE.deand [ vardef; d_fun.def_test ] })
+
+and same_variable p acc0 acc1 =
+ D.make_let (code_access p acc0) (fun d0 v0 ->
+ D.make_let (code_access p acc1) (fun d1 v1 ->
let d_fun =
- D.dfun "size_varinfo"
- [
- D.ddirect evt_d_fun;
- D.ddirect (D.dinstr res_def_ptr);
- D.ddirect (D.dinstr res_val_ptr);
- ]
- in
- let set_vars =
- set_vars
- @ [
- (D.Def, res_def, d_fun);
- (D.Val, res_val, D.ddirect (D.dinstr res_val));
- ]
+ D.dfun_with_ptr "meme_variable" (fun ~ptrdef ~ptrval ->
+ [ v0; v1; ptrdef; ptrval ])
in
- let def_test = D.dinstr res_def in
- let value_comp = D.dinstr res_val in
- D.build_transitive_composition { set_vars; def_test; value_comp })
- | Type (m_acc, m_typ) ->
- let d_irdata = D.ddirect (D.dinstr "irdata") in
- let set_vars0, evt_d_fun0 =
- match Pos.unmark m_acc with
- | Com.VarAccess (_, v) ->
- ([], D.ddirect @@ D.dinstr @@ VID.gen_info_ptr v)
- | Com.TabAccess (_, v, m_i) ->
- let ei = generate_c_expr p m_i in
- let d_fun =
- D.dfun "lis_tabaccess_varinfo"
- [
- d_irdata;
- D.ddirect @@ D.dinstr @@ Pp.spr "%d" (Com.Var.loc_tab_idx v);
- ei.def_test;
- ei.value_comp;
- ]
- in
- (ei.set_vars, D.ddirect @@ d_fun)
- | Com.FieldAccess (_, ie, f, _) ->
- let e = generate_c_expr p ie in
- let fn = Pp.spr "event_field_%s_var" (Pos.unmark f) in
- let d_fun = D.dfun fn [ d_irdata; e.def_test; e.value_comp ] in
- (e.set_vars, D.ddirect d_fun)
- in
- let c_type =
- match Pos.unmark m_typ with
- | Boolean -> "TYPE_BOOLEEN"
- | DateYear -> "TYPE_DATE_AAAA"
- | DateDayMonthYear -> "TYPE_DATE_JJMMAAAA"
- | DateMonth -> "TYPE_DATE_MM"
- | Integer -> "TYPE_ENTIER"
- | Real -> "TYPE_REEL"
- in
- let res = fresh_c_local "res" in
- let res_def = Pp.spr "%s_def" res in
- let res_val = Pp.spr "%s_val" res in
- let res_def_ptr = Pp.spr "&%s" res_def in
- let res_val_ptr = Pp.spr "&%s" res_val in
+ D.atomic
+ { d_fun with def_test = D.DE.deand [ d0; d1; d_fun.def_test ] }))
+
+and in_domain (p : Mir.program) acc cvm =
+ assert (Com.CatVar.Map.cardinal cvm = 1);
+ let cv = fst @@ Com.CatVar.Map.min_binding cvm in
+ let id_cv = (Com.CatVar.Map.find cv p.program_var_categories).id_int in
+ D.make_let (code_access p acc) (fun vardef varval ->
let d_fun =
- D.dfun "est_type"
- [
- evt_d_fun0;
- D.ddirect @@ D.dinstr c_type;
- D.ddirect @@ D.dinstr res_def_ptr;
- D.ddirect @@ D.dinstr res_val_ptr;
- ]
+ D.dfun_with_ptr "dans_domaine" (fun ~ptrdef ~ptrval ->
+ [ varval; C.Lit (float_of_int id_cv); ptrdef; ptrval ])
in
- let set_vars =
- set_vars0
- @ [
- (D.Def, res_def, d_fun);
- (D.Val, res_val, D.ddirect (D.dinstr res_val));
- ]
+ D.atomic { d_fun with def_test = D.DE.deand [ vardef; d_fun.def_test ] })
+
+and generate_c_expr (p : Mir.program) (e : Mir.expression Pos.marked) :
+ D.expression_composition =
+ match Pos.unmark e with
+ | Com.TestInSet (positive, e0, values) ->
+ generate_test_in_set p positive e0 values
+ | Comparison (op, e1, e2) ->
+ let se1 = generate_c_expr p e1 in
+ let se2 = generate_c_expr p e2 in
+ D.comparison op se1 se2
+ | Binop (op, e1, e2) ->
+ let se1 = generate_c_expr p e1 in
+ let se2 = generate_c_expr p e2 in
+ D.binop op se1 se2
+ | Unop (op, e) -> D.unop op @@ generate_c_expr p e
+ | Conditional (c, t, f_opt) ->
+ let cond = generate_c_expr p c in
+ let thenval = generate_c_expr p t in
+ let elseval =
+ match f_opt with
+ | None ->
+ (* todo: check if necessary *)
+ D.atomic
+ { set_vars = []; def_test = D.DE.defalse; value_comp = C.Lit 0. }
+ | Some f -> generate_c_expr p f
in
- let def_test = D.dinstr res_def in
- let value_comp = D.dinstr res_val in
- D.build_transitive_composition { set_vars; def_test; value_comp }
+ D.conditional cond thenval elseval
+ | FuncCall (f, args) -> funcall p (Pos.unmark f) args
+ | Literal { lit = Float f; _ } -> D.atomic @@ D.elit f
+ | Literal { lit = Undefined; _ } -> D.atomic @@ D.eundefined ()
+ | Var acc -> access p acc
+ | Attribut (m_acc, a) -> attribute p (Pos.unmark m_acc) (Pos.unmark a)
+ | Size m_acc -> size p @@ Pos.unmark m_acc
+ | Type (m_acc, m_typ) -> is_type p (Pos.unmark m_acc) (Pos.unmark m_typ)
| SameVariable (m_acc0, m_acc1) ->
- let d_irdata = D.ddirect (D.dinstr "irdata") in
- let code_access m_acc =
- match Pos.unmark m_acc with
- | Com.VarAccess (_, v) ->
- ([], D.ddirect @@ D.dinstr @@ VID.gen_info_ptr v)
- | Com.TabAccess (_, v, m_i) ->
- let ei = generate_c_expr p m_i in
- let d_fun =
- D.dfun "lis_tabaccess_varinfo"
- [
- d_irdata;
- D.ddirect @@ D.dinstr @@ Pp.spr "%d" (Com.Var.loc_tab_idx v);
- ei.def_test;
- ei.value_comp;
- ]
- in
- (ei.set_vars, D.ddirect @@ d_fun)
- | Com.FieldAccess (_, ie, f, _) ->
- let e = generate_c_expr p ie in
- let fn = Pp.spr "event_field_%s_var" (Pos.unmark f) in
- let d_fun = D.dfun fn [ d_irdata; e.def_test; e.value_comp ] in
- (e.set_vars, D.ddirect d_fun)
- in
- let set_vars0, evt_d_fun0 = code_access m_acc0 in
- let set_vars1, evt_d_fun1 = code_access m_acc1 in
- let res = fresh_c_local "res" in
- let res_def = Pp.spr "%s_def" res in
- let res_val = Pp.spr "%s_val" res in
- let res_def_ptr = Pp.spr "&%s" res_def in
- let res_val_ptr = Pp.spr "&%s" res_val in
- let d_fun =
- D.dfun "meme_variable"
- [
- evt_d_fun0;
- evt_d_fun1;
- D.ddirect @@ D.dinstr res_def_ptr;
- D.ddirect @@ D.dinstr res_val_ptr;
- ]
- in
- let set_vars =
- set_vars0 @ set_vars1
- @ [
- (D.Def, res_def, d_fun);
- (D.Val, res_val, D.ddirect (D.dinstr res_val));
- ]
- in
- let def_test = D.dinstr res_def in
- let value_comp = D.dinstr res_val in
- D.build_transitive_composition { set_vars; def_test; value_comp }
- | InDomain (m_acc, cvm) -> (
- assert (Com.CatVar.Map.cardinal cvm = 1);
- let cv = fst @@ Com.CatVar.Map.min_binding cvm in
- let id_cv = (Com.CatVar.Map.find cv p.program_var_categories).id_int in
- match Pos.unmark m_acc with
- | VarAccess (_, v) ->
- let ptr = VID.gen_info_ptr v in
- let res = fresh_c_local "res" in
- let res_def = Pp.spr "%s_def" res in
- let res_val = Pp.spr "%s_val" res in
- let res_def_ptr = Pp.spr "&%s" res_def in
- let res_val_ptr = Pp.spr "&%s" res_val in
- let d_fun =
- D.dfun "dans_domaine"
- [
- D.ddirect @@ D.dinstr ptr;
- D.ddirect @@ D.dinstr @@ Pp.spr "%d" id_cv;
- D.ddirect @@ D.dinstr res_def_ptr;
- D.ddirect @@ D.dinstr res_val_ptr;
- ]
- in
- let set_vars =
- [
- (D.Def, res_def, d_fun);
- (D.Val, res_val, D.ddirect (D.dinstr res_val));
- ]
- in
- let def_test = D.dinstr res_def in
- let value_comp = D.dinstr res_val in
- D.build_transitive_composition { set_vars; def_test; value_comp }
- | TabAccess (_, v, m_i) ->
- let d_irdata = D.ddirect (D.dinstr "irdata") in
- let res = fresh_c_local "res" in
- let res_def = Pp.spr "%s_def" res in
- let res_val = Pp.spr "%s_val" res in
- let res_def_ptr = Pp.spr "&%s" res_def in
- let res_val_ptr = Pp.spr "&%s" res_val in
- let set_vars, d_fun =
- let ei = generate_c_expr p m_i in
- let d_fun =
- D.dfun "dans_domaine_tabaccess"
- [
- d_irdata;
- D.ddirect @@ D.dinstr @@ Pp.spr "%d" (Com.Var.loc_tab_idx v);
- ei.def_test;
- ei.value_comp;
- D.ddirect @@ D.dinstr @@ Pp.spr "%d" id_cv;
- D.ddirect @@ D.dinstr res_def_ptr;
- D.ddirect @@ D.dinstr res_val_ptr;
- ]
- in
- (ei.set_vars, d_fun)
- in
- let set_vars =
- set_vars
- @ [
- (D.Def, res_def, d_fun);
- (D.Val, res_val, D.ddirect (D.dinstr res_val));
- ]
- in
- let def_test = D.dinstr res_def in
- let value_comp = D.dinstr res_val in
- D.build_transitive_composition { set_vars; def_test; value_comp }
- | FieldAccess (_, ie, f, _) ->
- let d_irdata = D.ddirect (D.dinstr "irdata") in
- let set_vars, evt_d_fun =
- let e = generate_c_expr p ie in
- let evt_fn = Pp.spr "event_field_%s_var" (Pos.unmark f) in
- (e.set_vars, D.dfun evt_fn [ d_irdata; e.def_test; e.value_comp ])
- in
- let res = fresh_c_local "res" in
- let res_def = Pp.spr "%s_def" res in
- let res_val = Pp.spr "%s_val" res in
- let res_def_ptr = Pp.spr "&%s" res_def in
- let res_val_ptr = Pp.spr "&%s" res_val in
- let d_fun =
- D.dfun "dans_domaine"
- [
- D.ddirect evt_d_fun;
- D.ddirect @@ D.dinstr @@ Pp.spr "%d" id_cv;
- D.ddirect @@ D.dinstr res_def_ptr;
- D.ddirect @@ D.dinstr res_val_ptr;
- ]
- in
- let set_vars =
- set_vars
- @ [
- (D.Def, res_def, d_fun);
- (D.Val, res_val, D.ddirect (D.dinstr res_val));
- ]
- in
- let def_test = D.dinstr res_def in
- let value_comp = D.dinstr res_val in
- D.build_transitive_composition { set_vars; def_test; value_comp })
- | NbAnomalies ->
- let def_test = D.dinstr "1.0" in
- let value_comp = D.dinstr "nb_anomalies(irdata)" in
- D.build_transitive_composition { set_vars = []; def_test; value_comp }
- | NbDiscordances ->
- let def_test = D.dinstr "1.0" in
- let value_comp = D.dinstr "nb_discordances(irdata)" in
- D.build_transitive_composition { set_vars = []; def_test; value_comp }
- | NbInformatives ->
- let def_test = D.dinstr "1.0" in
- let value_comp = D.dinstr "nb_informatives(irdata)" in
- D.build_transitive_composition { set_vars = []; def_test; value_comp }
- | NbBloquantes ->
- let def_test = D.dinstr "1.0" in
- let value_comp = D.dinstr "nb_bloquantes(irdata)" in
- D.build_transitive_composition { set_vars = []; def_test; value_comp }
+ same_variable p (Pos.unmark m_acc0) (Pos.unmark m_acc1)
+ | InDomain (m_acc, cvm) -> in_domain p (Pos.unmark m_acc) cvm
+ | NbAnomalies -> D.Func.nb_anomalies ()
+ | NbDiscordances -> D.Func.nb_discordances ()
+ | NbInformatives -> D.Func.nb_informatives ()
+ | NbBloquantes -> D.Func.nb_bloquantes ()
| NbCategory _ | FuncCallLoop _ | Loop _ -> assert false
let generate_expr_with_res_in p dgfip_flags oc res_def res_val expr =
- let pr form = Format.fprintf oc form in
- let locals, set, def, value = D.build_expression @@ generate_c_expr p expr in
- if D.is_always_true def then
- pr "@;@[{%a%a%a%a@]@;}" D.format_local_declarations locals
- (D.format_set_vars dgfip_flags)
- set
- (D.format_assign dgfip_flags res_def)
- def
- (D.format_assign dgfip_flags res_val)
- value
- else
- pr "@;@[{%a%a%a@;@[if (%s) {%a@]@;} else %s = 0.0;@]@;}"
- D.format_local_declarations locals
- (D.format_set_vars dgfip_flags)
- set
- (D.format_assign dgfip_flags res_def)
- def res_def
- (D.format_assign dgfip_flags res_val)
- value res_val
+ generate_c_expr p expr |> D.write_c_expr dgfip_flags oc res_def res_val
let generate_m_assign (p : Mir.program) (dgfip_flags : Dgfip_options.flags)
(m_sp_opt : Com.var_space) (var : Com.Var.t) (oc : Format.formatter)
@@ -854,14 +359,14 @@ let generate_var_def_tab (p : Mir.program) (dgfip_flags : Dgfip_options.flags)
pr "@;@[{";
let idx_tab = Com.Var.loc_tab_idx var in
pr "@;T_varinfo *info = tab_varinfo[%d];" idx_tab;
- let idx = fresh_c_local "idx" in
+ let idx = D.fresh_c_local "idx" in
let idx_def = idx ^ "_def" in
let idx_val = idx ^ "_val" in
pr "@;char %s;@;double %s;@;int %s;" idx_def idx_val idx;
generate_expr_with_res_in p dgfip_flags oc idx_def idx_val vidx;
pr "@;%s = (int)%s;" idx idx_val;
pr "@;@[if (%s && 0 <= %s && %s < info->size) {" idx_def idx idx;
- let res = fresh_c_local "res" in
+ let res = D.fresh_c_local "res" in
let res_def = res ^ "_def" in
let res_val = res ^ "_val" in
pr "@;char %s;@;double %s;" res_def res_val;
@@ -879,14 +384,14 @@ let generate_event_field_def (p : Mir.program)
(expr : Mir.expression Pos.marked) (oc : Format.formatter) : unit =
let pr form = Format.fprintf oc form in
pr "@;@[{";
- let idx = fresh_c_local "idx" in
+ let idx = D.fresh_c_local "idx" in
let idx_def = idx ^ "_def" in
let idx_val = idx ^ "_val" in
pr "@;char %s;@;double %s;@;int %s;" idx_def idx_val idx;
generate_expr_with_res_in p dgfip_flags oc idx_def idx_val idx_expr;
pr "@;%s = (int)%s;" idx idx_val;
pr "@;@[if (%s && 0 <= %s && %s < irdata->nb_events) {" idx_def idx idx;
- let res = fresh_c_local "res" in
+ let res = D.fresh_c_local "res" in
let res_def = res ^ "_def" in
let res_val = res ^ "_val" in
pr "@;char %s;@;double %s;" res_def res_val;
@@ -900,7 +405,7 @@ let generate_event_field_def (p : Mir.program)
(VID.gen_var_space_id_opt m_sp_opt)
idx field res_def res_val
| Some ei ->
- let i = fresh_c_local "i" in
+ let i = D.fresh_c_local "i" in
let i_def = i ^ "_def" in
let i_val = i ^ "_val" in
pr "@;char %s;@;double %s;@;int %s;" i_def i_val i;
@@ -923,7 +428,7 @@ let generate_event_field_ref (p : Mir.program)
(field : string) (var : Com.Var.t) (oc : Format.formatter) : unit =
if (StrMap.find field p.program_event_fields).is_var then (
let pr form = Format.fprintf oc form in
- let idx = fresh_c_local "idx" in
+ let idx = D.fresh_c_local "idx" in
let idx_def = idx ^ "_def" in
let idx_val = idx ^ "_val" in
let var_info_ptr = VID.gen_info_ptr var in
@@ -944,7 +449,7 @@ let rec generate_stmt (env : env) (dgfip_flags : Dgfip_options.flags)
match Pos.unmark m_acc with
| VarAccess (m_sp_opt, v) ->
generate_var_def p dgfip_flags m_sp_opt v expr oc
- | TabAccess (m_sp_opt, v, m_idx) ->
+ | TabAccess ((m_sp_opt, v), m_idx) ->
generate_var_def_tab p dgfip_flags m_sp_opt v m_idx expr oc
| FieldAccess (m_sp_opt, i, f, _) ->
let fn = Pos.unmark f in
@@ -955,7 +460,7 @@ let rec generate_stmt (env : env) (dgfip_flags : Dgfip_options.flags)
| Affectation (Pos.Mark (MultipleFormulaes _, _)) -> assert false
| IfThenElse (cond_expr, iftrue, iffalse) ->
pr "@;@[{";
- let cond = fresh_c_local "cond" in
+ let cond = D.fresh_c_local "cond" in
let cond_def = cond ^ "_def" in
let cond_val = cond ^ "_val" in
pr "@;char %s;@;double %s;" cond_def cond_val;
@@ -968,7 +473,6 @@ let rec generate_stmt (env : env) (dgfip_flags : Dgfip_options.flags)
pr "@]@;}";
pr "@]@;}"
| Switch (e, l) ->
- pr "@;@[{";
(* Undef & Default should be unique, but just in case we take them all *)
let undef_branches, default_branches, other_branches =
List.fold_left
@@ -976,58 +480,102 @@ let rec generate_stmt (env : env) (dgfip_flags : Dgfip_options.flags)
List.fold_left
(fun (und, def, oth) c ->
match c with
- | Com.Default -> (und, l :: def, oth)
- | Com.(Value Undefined) -> (l :: und, def, oth)
- | Com.(Value (Float f)) -> (und, def, (f, l) :: oth))
+ | Com.CDefault -> (und, l :: def, oth)
+ | Com.(CValue Undefined) -> (l :: und, def, oth)
+ | Com.(CValue (Float f)) -> (und, def, (`Float f, l) :: oth)
+ | Com.CVar v -> (und, def, (`Var v, l) :: oth))
acc cl)
([], [], []) l
in
let undef_branches = List.rev undef_branches
and default_branches = List.rev default_branches
and other_branches = List.rev other_branches in
- let exp = fresh_c_local "exp" in
+ let exp = D.fresh_c_local "exp" in
let exp_def = exp ^ "_def" in
let exp_val = exp ^ "_val" in
+ let is_var_switch =
+ match e with SESameVariable _ -> true | SEValue _ -> false
+ in
+ let var_of_switch () =
+ assert is_var_switch;
+ match e with SESameVariable e -> e | _ -> assert false
+ in
+ pr "@;@[{";
pr "@;char %s;@;double %s;" exp_def exp_val;
- generate_expr_with_res_in p dgfip_flags oc exp_def exp_val e;
- pr "@;@[if (%s) {" exp_def;
- pr "@;";
+ let () =
+ (* Check is def if necessary *)
+ match e with
+ | SESameVariable _ -> pr "{@;"
+ | SEValue e ->
+ generate_expr_with_res_in p dgfip_flags oc exp_def exp_val e;
+ pr "@;@[if (%s) {@;" exp_def
+ in
+ pr "/* Switch cases */@;";
(* Expression is defined *)
let () =
+ let pp_case (v, br) =
+ match v with
+ | `Float v ->
+ assert (not is_var_switch);
+ pr "if (EQ_E((%s),(%#.19g))) {@;@[%a@]@;}" exp_val v
+ (generate_stmts env dgfip_flags p)
+ br
+ | `Var v ->
+ assert is_var_switch;
+ let e = var_of_switch () in
+ let compared_var = Pos.unmark e in
+ let is_same = D.fresh_c_local "is_same_var" in
+ let is_same_def = is_same ^ "_def" in
+ let is_same_val = is_same ^ "_val" in
+ pr "@;char %s;@;double %s;" is_same_def is_same_val;
+ let ex =
+ Pos.same (Com.SameVariable (v, Pos.same compared_var e)) e
+ in
+ generate_expr_with_res_in p dgfip_flags oc is_same_def is_same_val
+ ex;
+ pr "if (%s) {@;@[%a@]@;}" is_same_val
+ (generate_stmts env dgfip_flags p)
+ br
+ in
+ let rec loop_else = function
+ | [] -> (
+ (* Default branch *)
+ match (default_branches, other_branches) with
+ | [], _ -> ()
+ | hd :: _, [] ->
+ pr "/* Default switch case */@;";
+ pr "@;@[%a@]" (generate_stmts env dgfip_flags p) hd
+ | hd :: _, _ ->
+ pr "/* Default switch case */@;";
+ pr "@;else {@[%a@]@;}"
+ (generate_stmts env dgfip_flags p)
+ hd)
+ | c :: tl ->
+ pr "else {@;@[ ";
+ pp_case c;
+ loop_else tl;
+ pr "@]@;}@;"
+ in
match other_branches with
| [] -> ()
- | (v, br) :: tl ->
- pr "if (EQ_E((%s),(%#.19g))) {@;@[%a@]@;}" exp_val v
- (generate_stmts env dgfip_flags p)
- br;
- List.iter
- (fun (v, br) ->
- pr "@; else if (EQ_E((%s),(%#.19g))) {@;@[%a@]@;}" exp_val
- v
- (generate_stmts env dgfip_flags p)
- br)
- tl
- in
- let () =
- match (default_branches, other_branches) with
- | [], _ -> ()
- | hd :: _, [] ->
- pr "@;@[%a@]" (generate_stmts env dgfip_flags p) hd
- | hd :: _, _ ->
- pr "@;else {@[%a@]@;}" (generate_stmts env dgfip_flags p) hd
+ | c :: tl ->
+ pp_case c;
+ loop_else tl
in
- pr "@;}";
+ pr "}@;/* End of switch cases & default */@;";
(* Expression is undefined *)
let () =
match undef_branches with
| [] -> ()
- | hd :: _ -> pr " else %a" (generate_stmts env dgfip_flags p) hd
+ | hd :: _ ->
+ pr "/* Undefined switch case */@;";
+ pr " else %a" (generate_stmts env dgfip_flags p) hd
in
- pr "@]@;}@]"
+ pr "@]}"
| WhenDoElse (wdl, ed) ->
- let goto_label = fresh_c_local "when_do_block" in
- let fin_label = fresh_c_local "when_do_end" in
- let cond = fresh_c_local "when_do_cond" in
+ let goto_label = D.fresh_c_local "when_do_block" in
+ let fin_label = D.fresh_c_local "when_do_end" in
+ let cond = D.fresh_c_local "when_do_cond" in
let cond_def = cond ^ "_def" in
let cond_val = cond ^ "_val" in
pr "@;@[{";
@@ -1049,7 +597,7 @@ let rec generate_stmt (env : env) (dgfip_flags : Dgfip_options.flags)
pr "@;%s:{}" fin_label;
pr "@]@;}"
| VerifBlock stmts ->
- let goto_label = fresh_c_local "verif_block" in
+ let goto_label = D.fresh_c_local "verif_block" in
pr "@;@[{";
pr "@;if (setjmp(irdata->jmp_bloq) != 0) goto %s;" goto_label;
pr "%a" (generate_stmts env dgfip_flags p) stmts;
@@ -1061,7 +609,7 @@ let rec generate_stmt (env : env) (dgfip_flags : Dgfip_options.flags)
| StdOut -> ("stdout", "&(irdata->ctx_pr_out)")
| StdErr -> ("stderr", "&(irdata->ctx_pr_err)")
in
- let print = fresh_c_local "print" in
+ let print = D.fresh_c_local "print" in
let print_def = print ^ "_def" in
let print_val = print ^ "_val" in
pr "@;@[{";
@@ -1073,14 +621,9 @@ let rec generate_stmt (env : env) (dgfip_flags : Dgfip_options.flags)
pr "@;print_string(%s, %s, \"%s\");" print_std pr_ctx
(str_escape s)
| PrintAccess (info, m_a) -> (
- let pr_sp m_sp_opt v_opt =
- let vsd_id =
- match v_opt with
- | Some v -> VID.gen_var_space_id m_sp_opt v
- | None -> VID.gen_var_space_id_opt m_sp_opt
- in
- let vsd = Pp.spr "irdata->var_spaces[%s]" vsd_id in
- let vsd0 = Pp.spr "irdata->var_spaces[irdata->var_space]" in
+ let pr_sp m_sp_opt _v_opt =
+ let vsd = VID.gen_var_space m_sp_opt in
+ let vsd0 = VID.gen_var_space None in
pr "@;@[if (%s.id != %s.id) {" vsd vsd0;
pr "@;print_string(%s, %s, %s.name);" print_std pr_ctx vsd;
pr "@;print_string(%s, %s, \".\");" print_std pr_ctx;
@@ -1094,7 +637,7 @@ let rec generate_stmt (env : env) (dgfip_flags : Dgfip_options.flags)
match info with Com.Name -> "name" | Com.Alias -> "alias"
in
pr "@;print_string(%s, %s, %s->%s);" print_std pr_ctx ptr fld
- | TabAccess (m_sp_opt, v, m_idx) ->
+ | TabAccess ((m_sp_opt, v), m_idx) ->
pr_sp m_sp_opt (Some v);
pr "@;@[{";
pr "T_varinfo *info;";
@@ -1168,11 +711,11 @@ let rec generate_stmt (env : env) (dgfip_flags : Dgfip_options.flags)
pr "@;%s = %s;" ref_val (VID.gen_val_ptr m_sp_opt var);
pr "@]@;}";
set_args (n + 1) vl' al'
- | Com.TabAccess (m_sp_opt, var, vidx) ->
+ | Com.TabAccess ((m_sp_opt, var), vidx) ->
pr "@;@[if (must_exec) {";
let idx_tab = Com.Var.loc_tab_idx var in
pr "@;T_varinfo *info = tab_varinfo[%d];" idx_tab;
- let idx = fresh_c_local "idx" in
+ let idx = D.fresh_c_local "idx" in
let idx_def = idx ^ "_def" in
let idx_val = idx ^ "_val" in
pr "@;char %s;@;double %s;@;int %s;" idx_def idx_val idx;
@@ -1193,7 +736,7 @@ let rec generate_stmt (env : env) (dgfip_flags : Dgfip_options.flags)
set_args (n + 1) vl' al'
| Com.FieldAccess (m_sp_opt, e, Pos.Mark (f, _), _) ->
pr "@;@[if (must_exec) {";
- let idx = fresh_c_local "idx" in
+ let idx = D.fresh_c_local "idx" in
let idx_def = idx ^ "_def" in
let idx_val = idx ^ "_val" in
pr "@;char %s;@;double %s;@;int %s;" idx_def idx_val idx;
@@ -1217,7 +760,7 @@ let rec generate_stmt (env : env) (dgfip_flags : Dgfip_options.flags)
set_args 0 target.target_args targs;
(match m_sp_opt with
| None -> ()
- | Some (_, vs_id) -> pr "@;irdata->var_space = %d;" vs_id);
+ | Some (_, vs_id) -> pr "@;change_var_space_courant(irdata, %d);" vs_id);
(match targs with
| [] -> pr "@;%s(irdata);" tn
| _ ->
@@ -1226,14 +769,19 @@ let rec generate_stmt (env : env) (dgfip_flags : Dgfip_options.flags)
pr "@]@;}@;");
(match m_sp_opt with
| None -> ()
- | Some _ -> pr "@;irdata->var_space = var_space_sav;");
- pr "@;if (irdata->abandon) {@;@[";
- sanitize ~up_to:`Bottom env;
- pr "@;goto %s;" env.quit_label;
- pr "@]@;}@;";
+ | Some _ -> pr "@;change_var_space_courant(irdata, var_space_sav);");
+ if
+ (not (Utils.Config.optim_no_check_unstoppable ()))
+ || target.target_stoppable
+ then begin
+ pr "@;if (irdata->abandon) {@;@[";
+ sanitize ~up_to:`Bottom env;
+ pr "@;goto %s;" env.quit_label;
+ pr "@]@;}@;"
+ end;
pr "@]@;}@;"
| Iterate (var, al, var_params, stmts) ->
- let it_name = fresh_c_local "iterate" in
+ let it_name = D.fresh_c_local "iterate" in
let ref_name = VID.gen_ref_name_ptr var in
let ref_info = VID.gen_info_ptr var in
let ref_space = VID.gen_ref_var_space_ptr var in
@@ -1254,11 +802,11 @@ let rec generate_stmt (env : env) (dgfip_flags : Dgfip_options.flags)
pr "@;%s = %s;" ref_val (VID.gen_val_ptr m_sp_opt v);
pr "%a" (generate_stmts env dgfip_flags p) stmts;
pr "@]@;}"
- | Com.TabAccess (m_sp_opt, var, vidx) ->
+ | Com.TabAccess ((m_sp_opt, var), vidx) ->
pr "@;@[{";
let idx_tab = Com.Var.loc_tab_idx var in
pr "@;T_varinfo *info = tab_varinfo[%d];" idx_tab;
- let idx = fresh_c_local "idx" in
+ let idx = D.fresh_c_local "idx" in
let idx_def = idx ^ "_def" in
let idx_val = idx ^ "_val" in
pr "@;char %s;@;double %s;@;int %s;" idx_def idx_val idx;
@@ -1279,7 +827,7 @@ let rec generate_stmt (env : env) (dgfip_flags : Dgfip_options.flags)
pr "@]@;}"
| Com.FieldAccess (m_sp_opt, e, Pos.Mark (f, _), _) ->
pr "@;@[{";
- let idx = fresh_c_local "idx" in
+ let idx = D.fresh_c_local "idx" in
let idx_def = idx ^ "_def" in
let idx_val = idx ^ "_val" in
pr "@;char %s;@;double %s;@;int %s;" idx_def idx_val idx;
@@ -1304,7 +852,7 @@ let rec generate_stmt (env : env) (dgfip_flags : Dgfip_options.flags)
let vcd = Com.CatVar.Map.find vc p.program_var_categories in
let ref_sp = VID.gen_var_space_id_opt m_sp_opt in
let ref_tab = VID.gen_tab vcd.loc in
- let cond = fresh_c_local "cond" in
+ let cond = D.fresh_c_local "cond" in
let cond_def = cond ^ "_def" in
let cond_val = cond ^ "_val" in
pr "@;@[{";
@@ -1338,7 +886,7 @@ let rec generate_stmt (env : env) (dgfip_flags : Dgfip_options.flags)
(* !!! *)
let itval_val = VID.gen_val None var in
(* !!! *)
- let postfix = fresh_c_local "" in
+ let postfix = D.fresh_c_local "" in
let i_val = Format.sprintf "i_val%s" postfix in
let e0_def = Format.sprintf "e0_def%s" postfix in
let e0_val = Format.sprintf "e0_val%s" postfix in
@@ -1374,13 +922,13 @@ let rec generate_stmt (env : env) (dgfip_flags : Dgfip_options.flags)
var_intervals;
pr "@;@]%s:;} /* End of scope %s */" id id
| ArrangeEvents (sort, filter, add, stmts) ->
- let events_sav = fresh_c_local "events_sav" in
- let events_tmp = fresh_c_local "events_tmp" in
- let nb_events_sav = fresh_c_local "nb_events_sav" in
- let nb_add = fresh_c_local "nb_add" in
- let cpt_i = fresh_c_local "i" in
- let cpt_j = fresh_c_local "j" in
- let evt = fresh_c_local "evt" in
+ let events_sav = D.fresh_c_local "events_sav" in
+ let events_tmp = D.fresh_c_local "events_tmp" in
+ let nb_events_sav = D.fresh_c_local "nb_events_sav" in
+ let nb_add = D.fresh_c_local "nb_add" in
+ let cpt_i = D.fresh_c_local "i" in
+ let cpt_j = D.fresh_c_local "j" in
+ let evt = D.fresh_c_local "evt" in
let pp_sanitize () =
pr "@;free(irdata->events);";
pr "@;irdata->events = %s;" events_sav;
@@ -1397,7 +945,7 @@ let rec generate_stmt (env : env) (dgfip_flags : Dgfip_options.flags)
(match add with
| Some expr ->
pr "@;@[{";
- let cond = fresh_c_local "cond" in
+ let cond = D.fresh_c_local "cond" in
let cond_def = cond ^ "_def" in
let cond_val = cond ^ "_val" in
pr "@;char %s;@;double %s;" cond_def cond_val;
@@ -1405,7 +953,7 @@ let rec generate_stmt (env : env) (dgfip_flags : Dgfip_options.flags)
pr "@;%s = (int)%s;" nb_add cond_val;
pr "@;if (%s < 0) %s = 0;" nb_add nb_add;
pr "@;@[if (%s && 0 < %s) {" cond_def nb_add;
- let cpt_k = fresh_c_local "k" in
+ let cpt_k = D.fresh_c_local "k" in
pr "@;int %s = 0;" cpt_k;
pr "@;%s = (T_event **)malloc((%s + %s) * (sizeof (T_event *)));"
events_tmp nb_events_sav nb_add;
@@ -1439,7 +987,7 @@ let rec generate_stmt (env : env) (dgfip_flags : Dgfip_options.flags)
(* !!! *)
let ref_val = VID.gen_val None var in
(* !!! *)
- let cond = fresh_c_local "cond" in
+ let cond = D.fresh_c_local "cond" in
let cond_def = cond ^ "_def" in
let cond_val = cond ^ "_val" in
pr "@;char %s;@;double %s;" cond_def cond_val;
@@ -1502,8 +1050,8 @@ let rec generate_stmt (env : env) (dgfip_flags : Dgfip_options.flags)
(* !!! *)
let ref1_val = VID.gen_val None var1 in
(* !!! *)
- let cmp_def = fresh_c_local "cmp_def" in
- let cmp_val = fresh_c_local "cmp_val" in
+ let cmp_def = D.fresh_c_local "cmp_def" in
+ let cmp_val = D.fresh_c_local "cmp_val" in
pr "@;char %s;@;double %s;" cmp_def cmp_val;
pr "@;%s = 1;" ref0_def;
pr "@;%s = (double)i;" ref0_val;
@@ -1535,8 +1083,8 @@ let rec generate_stmt (env : env) (dgfip_flags : Dgfip_options.flags)
pr "@]@;}"
| Restore (al, var_params, evts, evtfs, stmts) ->
pr "@;@[{";
- let rest_name = fresh_c_local "restore" in
- let rest_evt_name = fresh_c_local "restore_evt" in
+ let rest_name = D.fresh_c_local "restore" in
+ let rest_evt_name = D.fresh_c_local "restore_evt" in
let pp_sanitize () =
pr "@;env_restaurer(&%s);@;" rest_name;
pr "@;env_restaurer_evt(&%s);@;" rest_evt_name
@@ -1553,11 +1101,11 @@ let rec generate_stmt (env : env) (dgfip_flags : Dgfip_options.flags)
let sz = VID.gen_size var in
pr "@;env_sauvegarder(&%s, %s, %s, %s);" rest_name def_ptr val_ptr
sz
- | Com.TabAccess (m_sp_opt, var, vidx) ->
+ | Com.TabAccess ((m_sp_opt, var), vidx) ->
pr "@;@[{";
let idx_tab = Com.Var.loc_tab_idx var in
pr "@;T_varinfo *info = tab_varinfo[%d];" idx_tab;
- let idx = fresh_c_local "idx" in
+ let idx = D.fresh_c_local "idx" in
let idx_def = idx ^ "_def" in
let idx_val = idx ^ "_val" in
pr "@;char %s;@;double %s;@;int %s;" idx_def idx_val idx;
@@ -1577,7 +1125,7 @@ let rec generate_stmt (env : env) (dgfip_flags : Dgfip_options.flags)
pr "@]@;}"
| Com.FieldAccess (m_sp_opt, e, Pos.Mark (f, _), _) ->
pr "@;@[{";
- let idx = fresh_c_local "idx" in
+ let idx = D.fresh_c_local "idx" in
let idx_def = idx ^ "_def" in
let idx_val = idx ^ "_val" in
pr "@;char %s;@;double %s;@;int %s;" idx_def idx_val idx;
@@ -1597,7 +1145,7 @@ let rec generate_stmt (env : env) (dgfip_flags : Dgfip_options.flags)
al;
List.iter
(fun (var, vcs, expr, m_sp_opt) ->
- let it_name = fresh_c_local "iterate" in
+ let it_name = D.fresh_c_local "iterate" in
Com.CatVar.Map.iter
(fun vc _ ->
let vcd = Com.CatVar.Map.find vc p.program_var_categories in
@@ -1607,7 +1155,7 @@ let rec generate_stmt (env : env) (dgfip_flags : Dgfip_options.flags)
let ref_info = VID.gen_info_ptr var in
let ref_def = VID.gen_def_ptr None var in
let ref_val = VID.gen_val_ptr None var in
- let cond = fresh_c_local "cond" in
+ let cond = D.fresh_c_local "cond" in
let cond_def = cond ^ "_def" in
let cond_val = cond ^ "_val" in
pr "@;@[{";
@@ -1635,7 +1183,7 @@ let rec generate_stmt (env : env) (dgfip_flags : Dgfip_options.flags)
var_params;
List.iter
(fun expr ->
- let idx = fresh_c_local "idx" in
+ let idx = D.fresh_c_local "idx" in
let idx_def = idx ^ "_def" in
let idx_val = idx ^ "_val" in
pr "@;@[{";
@@ -1652,12 +1200,12 @@ let rec generate_stmt (env : env) (dgfip_flags : Dgfip_options.flags)
evts;
List.iter
(fun (var, expr) ->
- let idx = fresh_c_local "idx" in
+ let idx = D.fresh_c_local "idx" in
let ref_def = VID.gen_def None var in
(* !!! *)
let ref_val = VID.gen_val None var in
(* !!! *)
- let cond = fresh_c_local "cond" in
+ let cond = D.fresh_c_local "cond" in
let cond_def = cond ^ "_def" in
let cond_val = cond ^ "_val" in
pr "@;@[{";
@@ -1785,7 +1333,7 @@ let generate_function (dgfip_flags : Dgfip_options.flags) (p : Mir.program)
let pr fmt = Format.fprintf oc fmt in
let fd = StrMap.find fn p.program_functions in
pr "@.@[%a {" (generate_function_prototype false) fd;
- let sav = fresh_c_local "sav" in
+ let sav = D.fresh_c_local "sav" in
let sav_nb_tmps = Pp.spr "%s_nb_tmps_target" sav in
let sav_nb_refs = Pp.spr "%s_nb_refs_target" sav in
pr "@;int %s = irdata->nb_tmps_target;" sav_nb_tmps;
@@ -1855,11 +1403,22 @@ let generate_target (dgfip_flags : Dgfip_options.flags) (p : Mir.program)
let pr fmt = Format.fprintf oc fmt in
let tf = StrMap.find f p.program_targets in
pr "@.@[%a {" (generate_target_prototype false) f;
- let sav = fresh_c_local "sav" in
+ let sav = D.fresh_c_local "sav" in
let sav_nb_tmps = Pp.spr "%s_nb_tmps_target" sav in
let sav_nb_refs = Pp.spr "%s_nb_refs_target" sav in
pr "@;int %s = irdata->nb_tmps_target;" sav_nb_tmps;
pr "@;int %s = irdata->nb_refs_target;" sav_nb_refs;
+ (* Adding pointers to current space. These variable names match the ones
+ generated by Dgfip_varid.gen_tgv_def/gen_tgv_val. *)
+ if Utils.Config.optim_local_var_for_arrays () then begin
+ pr "@;char *def_saisie = irdata->def_saisie;";
+ pr "@;double *saisie = irdata->saisie;";
+ pr "@;char *def_calculee = irdata->def_calculee;";
+ pr "@;double *calculee = irdata->calculee;";
+ pr "@;char *def_base = irdata->def_base;";
+ pr "@;double *base = irdata->base;"
+ end;
+ pr "@;T_var_space var_space = irdata->var_space_courant;";
pr "%a" generate_cible_tmp_decls tf;
pr "@;irdata->nb_tmps_target = %d;"
(StrMap.fold (fun _ v n -> n + Com.Var.size v) tf.target_tmp_vars 0);
diff --git a/src/mlang/backend_compilers/bir_to_dgfip_c.mli b/src/mlang/backend_compilers/bir_to_dgfip_c.mli
index 6a6fa57d6..aec1e3c48 100644
--- a/src/mlang/backend_compilers/bir_to_dgfip_c.mli
+++ b/src/mlang/backend_compilers/bir_to_dgfip_c.mli
@@ -1,18 +1,17 @@
-(* Copyright (C) 2019-2021 Inria, contributor: Denis Merigoux
-
-
- This program is free software: you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free Software
- Foundation, either version 3 of the License, or (at your option) any later
- version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see . *)
+(******************************************************************************)
+(* *)
+(* Droit d'auteur (c) 2019 - 2026 DGFiP - INRIA *)
+(* *)
+(* Ce programme est distribué sous la licence CeCILL-C: vous pouvez le *)
+(* redistribuer et/ou le modifier sous les contraintes de celle-ci. *)
+(* *)
+(* L'accessibilité au code source et les droits de copie, de modification et *)
+(* de redistribution qui découlent de ce contrat ont pour contrepartie de *)
+(* n'offrir aux utilisateurs qu'une garantie limitée et de ne faire peser sur *)
+(* l'auteur du logiciel, le titulaire des droits patrimoniaux et les *)
+(* concédants successifs qu'une responsabilité restreinte. *)
+(* *)
+(******************************************************************************)
(** This module with a single entry point generates C files from a
{!Bir.program}. *)
diff --git a/src/mlang/backend_compilers/constr.ml b/src/mlang/backend_compilers/constr.ml
new file mode 100644
index 000000000..ea46bc1b9
--- /dev/null
+++ b/src/mlang/backend_compilers/constr.ml
@@ -0,0 +1,195 @@
+(******************************************************************************)
+(* *)
+(* Droit d'auteur (c) 2026 DGFiP - INRIA *)
+(* *)
+(* Ce programme est distribué sous la licence CeCILL-C: vous pouvez le *)
+(* redistribuer et/ou le modifier sous les contraintes de celle-ci. *)
+(* *)
+(* L'accessibilité au code source et les droits de copie, de modification et *)
+(* de redistribution qui découlent de ce contrat ont pour contrepartie de *)
+(* n'offrir aux utilisateurs qu'une garantie limitée et de ne faire peser sur *)
+(* l'auteur du logiciel, le titulaire des droits patrimoniaux et les *)
+(* concédants successifs qu'une responsabilité restreinte. *)
+(* *)
+(******************************************************************************)
+
+module VID = Dgfip_varid
+
+type dflag = Def | Val | VarInfo | VarSpace
+
+type local_var =
+ | Anon (* inlined sub-expression, not intended for reuse *)
+ | Refered of int
+(* declared local variable, either M local or locally bound in the constructors
+ below *)
+
+(** Contructors used for building C instructions. *)
+type t =
+ | True
+ | False
+ | Lit of float
+ | M of Com.var_space * Com.Var.t * dflag
+ | Local of local_var
+ | And of t * t
+ | Or of t * t
+ | Not of t
+ | Minus of t
+ | Plus of t * t
+ | Sub of t * t
+ | Mult of t * t
+ | Div of t * t
+ | Modulo of t * t
+ | Comp of string * t * t
+ | Fun of string * t list
+ | Varinfo of Dgfip_varid.varinfo
+ | Varinfo_tab of Dgfip_varid.varinfo * t * t
+ | Varinfo_field of t * t * string
+ | Varspace_current of Com.var_space
+ | Varspace_of of Com.var_space * Dgfip_varid.varinfo
+ | Typ of Com.value_typ
+ | Instr of string
+ | Direct of t
+ | Ite of t * t * t
+ | It0 of t * t
+ | Let_local of local_var * t * t
+
+let irdata = Direct (Instr "irdata")
+
+let dflag_id = function Def -> 0 | Val -> 1 | VarInfo -> 2 | VarSpace -> 3
+
+let typ_id = function
+ | Com.Boolean -> 0
+ | DateYear -> 1
+ | DateDayMonthYear -> 2
+ | DateMonth -> 3
+ | Integer -> 4
+ | Real -> 5
+
+let compare_dflag d d' = Int.compare (dflag_id d) (dflag_id d')
+
+let compare_typ t t' = Int.compare (typ_id t) (typ_id t')
+
+let compare_local_var lv lv' =
+ match (lv, lv') with
+ | Anon, Anon -> 0
+ | Refered i, Refered i' -> Int.compare i i'
+ | Anon, _ -> 1
+ | _, Anon -> -1
+
+(** Operator to aggregate comparisons *)
+let ( >< ) i j = if i <> 0 then i else j
+
+let compare_varspace =
+ Option.compare (fun (Pos.Mark (i, _), _) (Pos.Mark (j, _), _) ->
+ String.compare (Com.get_var_name i) (Com.get_var_name j))
+
+let rec compare (c1 : t) (c2 : t) : int =
+ match (c1, c2) with
+ | True, True | False, False -> 0
+ | Lit f, Lit f' -> Float.compare f f'
+ | M (vs, v, d), M (vs', v', d') ->
+ Int.compare v.id v'.id >< compare_dflag d d' >< compare_varspace vs vs'
+ (* | Local lv, Local lv' -> compare_local_var lv lv' *)
+ | And (e1, e2), And (e1', e2')
+ | Or (e1, e2), Or (e1', e2')
+ | Plus (e1, e2), Plus (e1', e2')
+ | Sub (e1, e2), Sub (e1', e2')
+ | Mult (e1, e2), Mult (e1', e2')
+ | Div (e1, e2), Div (e1', e2')
+ | Modulo (e1, e2), Modulo (e1', e2') ->
+ compare e1 e1' >< compare e2 e2'
+ | Not e, Not e' | Minus e, Minus e' -> compare e e'
+ | Comp (s, e1, e2), Comp (s', e1', e2') ->
+ String.compare s s' >< compare e1 e1' >< compare e2 e2'
+ | Fun (s, l), Fun (s', l') -> String.compare s s' >< List.compare compare l l'
+ | Varinfo v, Varinfo v' -> Int.compare v.id v'.id
+ | Varinfo_tab (vi, d, v), Varinfo_tab (vi', d', v') ->
+ Int.compare vi.id vi'.id >< compare d d' >< compare v v'
+ | Varinfo_field (d, v, s), Varinfo_field (d', v', s') ->
+ compare d d' >< compare v v' >< String.compare s s'
+ | Varspace_current vs, Varspace_current vs' -> compare_varspace vs vs'
+ | Varspace_of (vs, vi), Varspace_of (vs', vi') ->
+ compare_varspace vs vs' >< Int.compare vi.id vi'.id
+ | Typ t, Typ t' -> compare_typ t t'
+ | Instr s, Instr s' -> String.compare s s'
+ | Direct t, Direct t' -> compare t t'
+ | Ite (c, t, e), Ite (c', t', e') ->
+ compare c c' >< compare t t' >< compare e e'
+ | It0 (c, t), It0 (c', t') -> compare c c' >< compare t t'
+ | Let_local (lv, e1, e2), Let_local (lv', e1', e2') ->
+ compare_local_var lv lv' >< compare e1 e1' >< compare e2 e2'
+ | True, _ -> 1
+ | _, True -> -1
+ | False, _ -> 1
+ | _, False -> -1
+ | Lit _, _ -> 1
+ | _, Lit _ -> -1
+ | M _, _ -> 1
+ | _, M _ -> -1
+ | Local _, _ -> 1
+ | _, Local _ -> -1
+ | And _, _ -> 1
+ | _, And _ -> -1
+ | Or _, _ -> 1
+ | _, Or _ -> -1
+ | Not _, _ -> 1
+ | _, Not _ -> -1
+ | Minus _, _ -> 1
+ | _, Minus _ -> -1
+ | Plus _, _ -> 1
+ | _, Plus _ -> -1
+ | Sub _, _ -> 1
+ | _, Sub _ -> -1
+ | Mult _, _ -> 1
+ | _, Mult _ -> -1
+ | Div _, _ -> 1
+ | _, Div _ -> -1
+ | Modulo _, _ -> 1
+ | _, Modulo _ -> -1
+ | Comp _, _ -> 1
+ | _, Comp _ -> -1
+ | Fun _, _ -> 1
+ | _, Fun _ -> -1
+ | Varinfo _, _ -> 1
+ | _, Varinfo _ -> -1
+ | Varinfo_tab _, _ -> 1
+ | _, Varinfo_tab _ -> -1
+ | Varinfo_field _, _ -> 1
+ | _, Varinfo_field _ -> -1
+ | Varspace_current _, _ -> 1
+ | _, Varspace_current _ -> -1
+ | Varspace_of _, _ -> 1
+ | _, Varspace_of _ -> -1
+ | Typ _, _ -> 1
+ | _, Typ _ -> -1
+ | Instr _, _ -> 1
+ | _, Instr _ -> -1
+ | Direct _, _ -> 1
+ | _, Direct _ -> -1
+ | Ite _, _ -> 1
+ | _, Ite _ -> -1
+ | It0 _, _ -> 1
+ | _, It0 _ -> -1
+(* | Let_local _, _ -> 1 | _, Let_local _ -> -1 *)
+
+(** smart constructors *)
+
+let anon = Anon
+
+let locals_from_m =
+ let counter = ref 0 in
+ let fresh_id () =
+ let v = !counter in
+ counter := !counter + 1;
+ v
+ in
+ fun () ->
+ let lvar_id = fresh_id () in
+ (Refered (-(2 * lvar_id)), Refered (-((2 * lvar_id) + 1)))
+
+let new_local : unit -> local_var =
+ let c = ref 0 in
+ fun () ->
+ let i = !c in
+ incr c;
+ Refered i
diff --git a/src/mlang/backend_compilers/constr.mli b/src/mlang/backend_compilers/constr.mli
new file mode 100644
index 000000000..785556b5b
--- /dev/null
+++ b/src/mlang/backend_compilers/constr.mli
@@ -0,0 +1,70 @@
+(******************************************************************************)
+(* *)
+(* Droit d'auteur (c) 2026 DGFiP - INRIA *)
+(* *)
+(* Ce programme est distribué sous la licence CeCILL-C: vous pouvez le *)
+(* redistribuer et/ou le modifier sous les contraintes de celle-ci. *)
+(* *)
+(* L'accessibilité au code source et les droits de copie, de modification et *)
+(* de redistribution qui découlent de ce contrat ont pour contrepartie de *)
+(* n'offrir aux utilisateurs qu'une garantie limitée et de ne faire peser sur *)
+(* l'auteur du logiciel, le titulaire des droits patrimoniaux et les *)
+(* concédants successifs qu'une responsabilité restreinte. *)
+(* *)
+(******************************************************************************)
+
+type local_var = private Anon | Refered of int
+
+(** States the kind/type of a variable/expression. *)
+type dflag =
+ | Def (** For pure boolean expressions, used for definition check *)
+ | Val (** For arithmetical expressions, used for actual calculations *)
+ | VarInfo (** For variable data *)
+ | VarSpace (** For var spaces *)
+
+(** Constuctors used for building C instructions. *)
+type t =
+ | True
+ | False
+ | Lit of float
+ | M of Com.var_space * Com.Var.t * dflag
+ | Local of local_var
+ | And of t * t
+ | Or of t * t
+ | Not of t
+ | Minus of t
+ | Plus of t * t
+ | Sub of t * t
+ | Mult of t * t
+ | Div of t * t
+ | Modulo of t * t
+ | Comp of string * t * t
+ | Fun of string * t list
+ | Varinfo of Dgfip_varid.varinfo
+ | Varinfo_tab of Dgfip_varid.varinfo * t * t
+ | Varinfo_field of t * t * string
+ | Varspace_current of Com.var_space
+ | Varspace_of of Com.var_space * Dgfip_varid.varinfo
+ | Typ of Com.value_typ
+ | Instr of string
+ | Direct of t
+ | Ite of t * t * t
+ | It0 of t * t
+ | Let_local of local_var * t * t
+
+val irdata : t
+(** A shortcut for representing the irdata construction
+ ([Direct Instr "irdata"]) *)
+
+val compare : t -> t -> int
+
+(** {2 Local variables} *)
+
+val anon : local_var
+
+val locals_from_m : unit -> local_var * local_var
+(** Return a couple of local variable from a MIR one, for defineness and
+ valuation in this order. *)
+
+val new_local : unit -> local_var
+(** Create a fresh local variable *)
diff --git a/src/mlang/backend_compilers/decoupledExpr.ml b/src/mlang/backend_compilers/decoupledExpr.ml
index 7cbcfaa9c..425b76855 100644
--- a/src/mlang/backend_compilers/decoupledExpr.ml
+++ b/src/mlang/backend_compilers/decoupledExpr.ml
@@ -1,5 +1,27 @@
+(******************************************************************************)
+(* *)
+(* Droit d'auteur (c) 2022 - 2026 DGFiP - INRIA *)
+(* *)
+(* Ce programme est distribué sous la licence CeCILL-C: vous pouvez le *)
+(* redistribuer et/ou le modifier sous les contraintes de celle-ci. *)
+(* *)
+(* L'accessibilité au code source et les droits de copie, de modification et *)
+(* de redistribution qui découlent de ce contrat ont pour contrepartie de *)
+(* n'offrir aux utilisateurs qu'une garantie limitée et de ne faire peser sur *)
+(* l'auteur du logiciel, le titulaire des droits patrimoniaux et les *)
+(* concédants successifs qu'une responsabilité restreinte. *)
+(* *)
+(******************************************************************************)
+
module VID = Dgfip_varid
+let fresh_c_local =
+ let c = ref 0 in
+ fun name ->
+ let s = name ^ string_of_int !c in
+ incr c;
+ s
+
let generate_variable ?(def_flag = false) ?(trace_flag = false)
(m_sp_opt : Com.var_space) (var : Com.Var.t) : string =
try
@@ -18,13 +40,9 @@ let generate_variable ?(def_flag = false) ?(trace_flag = false)
(Format.asprintf "Variable %s not found in TGV"
(Pos.unmark var.Com.Var.name))
-type local_var =
- | Anon (* inlined sub-expression, not intended for reuse *)
- | Refered of int
-(* declared local variable, either M local or locally bound in the constructors
- below *)
+type dflag = Constr.dflag = Def | Val | VarInfo | VarSpace
-type dflag = Def | Val (* distinguish C types int and double *)
+type local_var = Constr.local_var
type stack_slot = { kind : dflag; depth : int }
@@ -33,6 +51,8 @@ type stack_assignment = { slot : stack_slot; subexpr : expr }
and local_stacks = {
def_top : int;
val_top : int;
+ var_top : int;
+ spa_top : int;
var_substs : (int * (expr * dflag)) list;
}
@@ -43,29 +63,38 @@ and expr =
| Dfalse
| Dlit of float
| Dvar of expr_var
- | Dand of expr * expr
- | Dor of expr * expr
+ | Dvarinfo of varinfo_access
+ | Dvarspace of Com.var_space * Com.Var.t option
+ (* If var is a ref, using it to get the var space *)
+ | Dand of expr list
+ | Dor of expr list
| Dunop of string * expr
| Dbinop of string * expr * expr
| Dfun of string * expr list
| Dite of expr * expr * expr
+ | Dtyp of Com.value_typ
| Dinstr of string
| Ddirect of expr
+and varinfo_access =
+ | VIvar of Com.Var.t
+ | VItab of Com.Var.t * expr * expr (* variable, var_def, var_val *)
+ | VIfield of expr * expr * string (* var_def, var_val, field *)
+
and expr_var = Local of stack_slot | M of Com.var_space * Com.Var.t * dflag
and t = expr * dflag * local_vars
-and constr = local_stacks -> local_vars -> t
-
-type expression_composition = {
- set_vars : (dflag * string * constr) list;
- def_test : constr;
- value_comp : constr;
-}
+and builder = local_stacks -> local_vars -> t
type stack_position = Not_to_stack | Must_be_pushed | On_top of dflag
+(* let dflag_id = function Def -> 0 | Val -> 1 | VarInfo -> 2 | VarSpace -> 3 *)
+
+let pp_local_var fmt = function
+ | Constr.Anon -> Format.fprintf fmt "--anon--"
+ | Refered v -> Format.fprintf fmt "var-%i" v
+
let is_always_true ((expr, _kind, _lv) : t) = expr = Dtrue
let cast (kind : dflag) (expr : expr) =
@@ -75,6 +104,12 @@ let cast (kind : dflag) (expr : expr) =
| Dlit 0., Def -> Dfalse
| Dlit _, Def -> Dtrue
| _, Def -> Dbinop ("!=", expr, Dlit 0.)
+ | Dvarinfo _, VarInfo -> expr
+ | Dvarspace _, VarSpace -> expr
+ | Dvarinfo _, _ -> failwith "Invalid cast of varinfo"
+ | _, VarInfo -> failwith "Invalid cast to varinfo"
+ | Dvarspace _, _ -> failwith "Invalid cast of varspace"
+ | _, VarSpace -> failwith "Invalid cast to varspace"
| _, Val -> expr
(** local stacks operations *)
@@ -83,6 +118,8 @@ let bump_stack (kind : dflag) (st : local_stacks) =
match kind with
| Def -> { st with def_top = st.def_top + 1 }
| Val -> { st with val_top = st.val_top + 1 }
+ | VarInfo -> { st with var_top = st.var_top + 1 }
+ | VarSpace -> { st with spa_top = st.spa_top + 1 }
let add_substitution (st : local_stacks) (v : local_var) (kind : dflag)
(expr : expr) =
@@ -91,17 +128,21 @@ let add_substitution (st : local_stacks) (v : local_var) (kind : dflag)
| Refered v -> { st with var_substs = (v, (expr, kind)) :: st.var_substs }
let stack_top (kind : dflag) (st : local_stacks) =
- match kind with Def -> st.def_top | Val -> st.val_top
+ match kind with
+ | Def -> st.def_top
+ | Val -> st.val_top
+ | VarInfo -> st.var_top
+ | VarSpace -> st.spa_top
let is_in_stack_scope ({ kind; depth } : stack_slot) (st : local_stacks) =
- match kind with Def -> depth < st.def_top | Val -> depth < st.val_top
+ depth < stack_top kind st
let is_on_top ({ kind; depth } : stack_slot) (st : local_stacks) =
- match kind with Def -> depth = st.def_top | Val -> depth = st.val_top
+ depth = stack_top kind st
let rec expr_position (expr : expr) (st : local_stacks) =
match expr with
- | Dtrue | Dfalse | Dlit _ | Dvar (M _) -> Not_to_stack
+ | Dtrue | Dfalse | Dlit _ | Dvar (M _) | Dtyp _ -> Not_to_stack
| Dvar (Local slot) ->
if is_in_stack_scope slot st then Not_to_stack
else if is_on_top slot st then On_top slot.kind
@@ -116,7 +157,9 @@ let rec expr_position (expr : expr) (st : local_stacks) =
| _, _ -> Not_to_stack (* Either already stored, or duplicatable *)
end
| Ddirect _ -> Not_to_stack
- | _ -> Must_be_pushed
+ | Dbinop _ | Dand _ | Dor _ | Dunop _ | Dfun _ | Dite _ | Dinstr _
+ | Dvarinfo _ | Dvarspace _ ->
+ Must_be_pushed
(* allocate to local variable if necessary *)
let store_local (stacks : local_stacks) (ctx : local_vars) (v : local_var)
@@ -140,63 +183,37 @@ let store_local (stacks : local_stacks) (ctx : local_vars) (v : local_var)
(* the following functions resolve [constr] values by applying them to a given
context (both stacks state and existing local allocations) *)
-let collapse_constr (stacks : local_stacks) (ctx : local_vars) (constr : constr)
- =
- let expr, kind, lv = constr stacks ctx in
+let collapse_builder (stacks : local_stacks) (ctx : local_vars)
+ (builder : builder) =
+ let expr, kind, lv = builder stacks ctx in
(expr, kind, lv @ ctx)
(* eval and store with enforced kind *)
let push_with_kind (stacks : local_stacks) (ctx : local_vars) (kind : dflag)
- (constr : constr) =
- let expr, ekind, lv = constr stacks ctx in
+ (builder : builder) =
+ let expr, ekind, lv = builder stacks ctx in
let expr = if kind = ekind then expr else cast kind expr in
- let stacks, lv, expr = store_local stacks lv Anon kind expr in
+ let stacks, lv, expr = store_local stacks lv Constr.anon kind expr in
(stacks, lv, expr)
(* eval and store without enforcing kind *)
-let push (stacks : local_stacks) (ctx : local_vars) (constr : constr) =
- let expr, kind, lv = constr stacks ctx in
- let stacks, lv, expr = store_local stacks lv Anon kind expr in
+let push (stacks : local_stacks) (ctx : local_vars) (builder : builder) =
+ let expr, kind, lv = builder stacks ctx in
+ let stacks, lv, expr = store_local stacks lv Constr.anon kind expr in
(stacks, lv, expr, kind)
-(** smart constructors *)
+module DE = Def_expr.Make (Constr)
-let locals_from_m =
- let counter = ref 0 in
- let fresh_id () =
- let v = !counter in
- counter := !counter + 1;
- v
- in
- fun () ->
- let lvar_id = fresh_id () in
- (Refered (-(2 * lvar_id)), Refered (-((2 * lvar_id) + 1)))
+let true_ _ _ = (Dtrue, Constr.Def, [])
-let new_local : unit -> local_var =
- let c = ref 0 in
- fun () ->
- let i = !c in
- incr c;
- Refered i
-
-let let_local (v : local_var) (bound : constr) (body : constr)
- (stacks : local_stacks) (ctx : local_vars) =
- let bound, kind, lv = collapse_constr stacks ctx bound in
- let stacks, ctx, _ = store_local stacks lv v kind bound in
- collapse_constr stacks ctx body
+let false_ _ _ = (Dfalse, Constr.Def, [])
-let dtrue _stacks _lv : t = (Dtrue, Def, [])
+let lit f _ _ = (Dlit f, Constr.Val, [])
-let dfalse _stacks _lv : t = (Dfalse, Def, [])
-
-let lit (f : float) _stacks _lv : t = (Dlit f, Val, [])
-
-let m_var (m_sp_opt : Com.var_space) (v : Com.Var.t) (df : dflag) _stacks _lv :
- t =
+let m_var (m_sp_opt : Com.var_space) (v : Com.Var.t) (df : dflag) _ _ =
(Dvar (M (m_sp_opt, v, df)), df, [])
-let local_var (lvar : local_var) (stacks : local_stacks) (ctx : local_vars) : t
- =
+let local_var (lvar : local_var) (stacks : local_stacks) (ctx : local_vars) =
match lvar with
| Anon -> Errors.raise_error "Tried to access anonymous local variable"
| Refered v -> (
@@ -205,16 +222,21 @@ let local_var (lvar : local_var) (stacks : local_stacks) (ctx : local_vars) : t
| None -> (
match List.assoc_opt lvar ctx with
| Some { slot; _ } -> (Dvar (Local slot), slot.kind, [])
- | None -> Errors.raise_error "Local variable not found in context"))
+ | None ->
+ Format.kasprintf Errors.raise_error
+ "Local variable %i not found in context. Local vars: [%a]; \
+ stacks subst: [%a]"
+ v
+ (Format.pp_print_list
+ ~pp_sep:(fun fmt _ -> Format.fprintf fmt ",")
+ pp_local_var)
+ (List.map fst ctx)
+ (Format.pp_print_list
+ ~pp_sep:(fun fmt _ -> Format.fprintf fmt ",")
+ (fun fmt (i, _) -> Format.fprintf fmt "%i" i))
+ stacks.var_substs))
-(* Note on constructors with several subexpressions. To correctly allocate
- subvalues in the stacks, the stacks state must flow through all constructor
- arguments to increment "pointers" accordingly. The state at entry represents
- the point at which the constructed expression is expected to be allocated (if
- needed). *)
-
-let dand (e1 : constr) (e2 : constr) (stacks : local_stacks) (ctx : local_vars)
- : t =
+let and_ e1 e2 stacks ctx =
let stacks', lv1, e1 = push_with_kind stacks ctx Def e1 in
let _, lv2, e2 = push_with_kind stacks' ctx Def e2 in
match (e1, e2) with
@@ -222,10 +244,13 @@ let dand (e1 : constr) (e2 : constr) (stacks : local_stacks) (ctx : local_vars)
| _, Dtrue -> (e1, Def, lv1)
| Dfalse, _ | _, Dfalse -> (Dfalse, Def, [])
| Dvar v1, Dvar v2 when v1 = v2 -> (e1, Def, lv1)
- | _ -> (Dand (e1, e2), Def, lv2 @ lv1)
+ | Dand l1, Dand l2 -> (Dand (l1 @ l2), Def, lv2 @ lv1)
+ | _, Dand l -> (Dand (e1 :: l), Def, lv2 @ lv1)
+ | Dand l, _ -> (Dand (l @ [ e2 ]), Def, lv2 @ lv1)
+ | _, _ -> (Dand [ e1; e2 ], Def, lv2 @ lv1)
-let dor (e1 : constr) (e2 : constr) (stacks : local_stacks) (ctx : local_vars) :
- t =
+let or_ (e1 : builder) (e2 : builder) (stacks : local_stacks) (ctx : local_vars)
+ =
let stacks', lv1, e1 = push_with_kind stacks ctx Def e1 in
let _, lv2, e2 = push_with_kind stacks' ctx Def e2 in
match (e1, e2) with
@@ -233,9 +258,12 @@ let dor (e1 : constr) (e2 : constr) (stacks : local_stacks) (ctx : local_vars) :
| Dfalse, _ -> (e2, Def, lv2)
| _, Dfalse -> (e1, Def, lv1)
| Dvar v1, Dvar v2 when v1 = v2 -> (e1, Def, lv1)
- | _ -> (Dor (e1, e2), Def, lv2 @ lv1)
+ | Dor l1, Dor l2 -> (Dor (l1 @ l2), Def, lv2 @ lv1)
+ | _, Dor l -> (Dor (e1 :: l), Def, lv2 @ lv1)
+ | Dor l, _ -> (Dor (l @ [ e2 ]), Def, lv2 @ lv1)
+ | _, _ -> (Dor [ e1; e2 ], Def, lv2 @ lv1)
-let dnot (e : constr) (stacks : local_stacks) (ctx : local_vars) : t =
+let not_ (e : builder) (stacks : local_stacks) (ctx : local_vars) =
let _, lv, e = push_with_kind stacks ctx Def e in
match e with
| Dtrue -> (Dfalse, Def, [])
@@ -243,15 +271,15 @@ let dnot (e : constr) (stacks : local_stacks) (ctx : local_vars) : t =
| Dunop ("!", e) -> (e, Def, lv)
| _ -> (Dunop ("!", e), Def, lv)
-let minus (e : constr) (stacks : local_stacks) (ctx : local_vars) : t =
+let minus (e : builder) (stacks : local_stacks) (ctx : local_vars) =
let _, lv, e = push_with_kind stacks ctx Val e in
match e with
| Dlit f -> (Dlit (-.f), Val, [])
| Dunop ("-", e) -> (e, Val, lv)
| _ -> (Dunop ("-", e), Val, lv)
-let plus (e1 : constr) (e2 : constr) (stacks : local_stacks) (ctx : local_vars)
- : t =
+let plus (e1 : builder) (e2 : builder) (stacks : local_stacks)
+ (ctx : local_vars) =
(* This optimisation causes some valuation to end at -0.0 where +0.0 was
expected. Staying conservative for now *)
let reduce_zero_add = false in
@@ -263,8 +291,8 @@ let plus (e1 : constr) (e2 : constr) (stacks : local_stacks) (ctx : local_vars)
| Dlit f1, Dlit f2 -> (Dlit (f1 +. f2), Val, [])
| _ -> (Dbinop ("+", e1, e2), Val, lv2 @ lv1)
-let sub (e1 : constr) (e2 : constr) (stacks : local_stacks) (ctx : local_vars) :
- t =
+let sub (e1 : builder) (e2 : builder) (stacks : local_stacks) (ctx : local_vars)
+ =
let stacks', lv1, e1 = push_with_kind stacks ctx Val e1 in
let _, lv2, e2 = push_with_kind stacks' ctx Val e2 in
match (e1, e2) with
@@ -273,8 +301,8 @@ let sub (e1 : constr) (e2 : constr) (stacks : local_stacks) (ctx : local_vars) :
| Dlit f1, Dlit f2 -> (Dlit (f1 -. f2), Val, [])
| _ -> (Dbinop ("-", e1, e2), Val, lv2 @ lv1)
-let mult (e1 : constr) (e2 : constr) (stacks : local_stacks) (ctx : local_vars)
- : t =
+let mult (e1 : builder) (e2 : builder) (stacks : local_stacks)
+ (ctx : local_vars) =
let stacks', lv1, e1 = push_with_kind stacks ctx Val e1 in
let _, lv2, e2 = push_with_kind stacks' ctx Val e2 in
match (e1, e2) with
@@ -284,8 +312,8 @@ let mult (e1 : constr) (e2 : constr) (stacks : local_stacks) (ctx : local_vars)
| Dlit f1, Dlit f2 -> (Dlit (f1 *. f2), Val, [])
| _ -> (Dbinop ("*", e1, e2), Val, lv2 @ lv1)
-let div (e1 : constr) (e2 : constr) (stacks : local_stacks) (ctx : local_vars) :
- t =
+let div (e1 : builder) (e2 : builder) (stacks : local_stacks) (ctx : local_vars)
+ =
let stacks', lv1, e1 = push_with_kind stacks ctx Val e1 in
let _, lv2, e2 = push_with_kind stacks' ctx Val e2 in
match (e1, e2) with
@@ -295,8 +323,8 @@ let div (e1 : constr) (e2 : constr) (stacks : local_stacks) (ctx : local_vars) :
(Dlit f, Val, [])
| _ -> (Dbinop ("/", e1, e2), Val, lv2 @ lv1)
-let modulo (e1 : constr) (e2 : constr) (stacks : local_stacks)
- (ctx : local_vars) : t =
+let modulo (e1 : builder) (e2 : builder) (stacks : local_stacks)
+ (ctx : local_vars) =
let stacks', lv1, e1 = push_with_kind stacks ctx Val e1 in
let _, lv2, e2 = push_with_kind stacks' ctx Val e2 in
match (e1, e2) with
@@ -306,18 +334,14 @@ let modulo (e1 : constr) (e2 : constr) (stacks : local_stacks)
(Dlit f, Val, [])
| _ -> (Dfun ("fmod", [ e1; e2 ]), Val, lv2 @ lv1)
-let comp op (e1 : constr) (e2 : constr) (stacks : local_stacks)
- (ctx : local_vars) : t =
+let comp op (e1 : builder) (e2 : builder) (stacks : local_stacks)
+ (ctx : local_vars) =
let stacks', lv1, e1 = push_with_kind stacks ctx Val e1 in
let _, lv2, e2 = push_with_kind stacks' ctx Val e2 in
let comp (o : Com.comp_op) =
match (e1, e2) with
| Dlit f1, Dlit f2 ->
- if
- Mir_interpreter.FloatDefInterp.compare_numbers o
- (Mir_number.RegularFloatNumber.of_float f1)
- (Mir_number.RegularFloatNumber.of_float f2)
- then Dtrue
+ if M_ir.Mir_number.RegularFloatNumber.compare o f1 f2 then Dtrue
else Dfalse
| Dvar v1, Dvar v2 ->
if String.equal op "==" && v1 = v2 then Dtrue else Dbinop (op, e1, e2)
@@ -335,27 +359,44 @@ let comp op (e1 : constr) (e2 : constr) (stacks : local_stacks)
in
(e, Def, lv2 @ lv1)
-let dfun (f : string) (args : constr list) (stacks : local_stacks)
- (ctx : local_vars) : t =
+let fun_ (f : string) (args : builder list) (stacks : local_stacks)
+ (ctx : local_vars) =
let (_, lv), args =
List.fold_left_map
(fun (stacks, lv) e ->
- let stacks, lv', e = push_with_kind stacks ctx Val e in
+ let stacks, lv', e, _ = push stacks ctx e in
((stacks, lv' @ lv), e))
(stacks, []) args
in
(* TODO : distinguish kinds *)
(Dfun (f, args), Val, lv)
-let dinstr (i : string) (_stacks : local_stacks) (_ctx : local_vars) : t =
- (Dinstr i, Val, [])
+let varinfo v _ _ = (Dvarinfo (VIvar v), VarInfo, [])
+
+let varinfo_tab ~tab ~def ~value stacks ctx =
+ let stacks, lv, def = push_with_kind stacks ctx Def def in
+ let _stacks, lv', value = push_with_kind stacks ctx Val value in
+ (Dvarinfo (VItab (tab, def, value)), VarInfo, lv @ lv')
+
+let varinfo_field ~def ~value ~field stacks ctx =
+ let stacks, lv, def = push_with_kind stacks ctx Def def in
+ let _stacks, lv', value = push_with_kind stacks ctx Val value in
+ (Dvarinfo (VIfield (def, value, field)), VarInfo, lv @ lv')
+
+let varspace_current m _ _ = (Dvarspace (m, None), VarSpace, [])
+
+let varspace_of m v _ _ = (Dvarspace (m, Some v), VarSpace, [])
+
+let typ t _ _ = (Dtyp t, Def, [])
-let ddirect (c : constr) (stacks : local_stacks) (ctx : local_vars) : t =
- let expr, flags, ctx = c stacks ctx in
- (Ddirect expr, flags, ctx)
+let instr i _ _ = (Dinstr i, Val, [])
-let ite (c : constr) (t : constr) (e : constr) (stacks : local_stacks)
- (ctx : local_vars) : t =
+let direct c stacks ctx =
+ let e, d, ctx = c stacks ctx in
+ (Ddirect e, d, ctx)
+
+let ite (c : builder) (t : builder) (e : builder) (stacks : local_stacks)
+ (ctx : local_vars) =
let stacks', lvc, c = push_with_kind stacks ctx Def c in
let stacks', lvt, t, tkind = push stacks' ctx t in
let _, lve, e, ekind = push stacks' ctx e in
@@ -368,72 +409,275 @@ let ite (c : constr) (t : constr) (e : constr) (stacks : local_stacks)
| Dfalse, _, _ -> (e, ekind, lve)
| _, Dtrue, Dtrue | _, Dfalse, Dfalse -> (t, tkind, lvt)
| _, Dlit 1., Dlit 0. -> (c, Def, lvc)
+ | _, Dlit 0., Dlit 1. -> (Dunop ("!", c), Def, lvc)
| _, Dlit f, Dlit f' when f = f' -> (Dlit f, ite_kind, [])
| _ -> (Dite (c, t, e), ite_kind, lve @ lvt @ lvc)
-let it0 (c : constr) (t : constr) (stacks : local_stacks) (ctx : local_vars) : t
- =
+let it0 (c : builder) (t : builder) (stacks : local_stacks) (ctx : local_vars) =
(* Version of [ite] where the else is zero with kind matching the then to
avoid casting later *)
let stacks', lvc, c = push_with_kind stacks ctx Def c in
let _, lvt, t, tkind = push stacks' ctx t in
- let e, ekind =
- match tkind with Def -> (Dfalse, Def) | Val -> (Dlit 0., Val)
+ let e =
+ match tkind with
+ | Def -> Dfalse
+ | Val -> Dlit 0.
+ | VarInfo -> failwith "Cannot make an IT with a VarInfo"
+ | VarSpace -> failwith "Cannot make an IT with a VarSpace"
in
match (c, t) with
| Dtrue, _ -> (t, tkind, lvt)
- | Dfalse, _ -> (e, ekind, [])
+ | Dfalse, _ -> (e, tkind, [])
| _, (Dlit 1. | Dtrue) -> (c, Def, lvc)
| _, (Dlit 0. | Dfalse) -> (t, tkind, [])
| _ -> (Dite (c, t, e), tkind, lvt @ lvc)
-let build_transitive_composition ?(safe_def = false)
- ({ set_vars; def_test; value_comp } : expression_composition) :
- expression_composition =
+let let_local (v : local_var) (bound : builder) (body : builder)
+ (stacks : local_stacks) (ctx : local_vars) =
+ let bound, kind, lv = collapse_builder stacks ctx bound in
+ let stacks, ctx, _ = store_local stacks lv v kind bound in
+ collapse_builder stacks ctx body
+
+let rec make_constr : Constr.t -> builder = function
+ | True -> true_
+ | False -> false_
+ | Lit f -> lit f
+ | M (vs, v, d) -> m_var vs v d
+ | Local lv -> local_var lv
+ | And (e1, e2) -> and_ (make_constr e1) (make_constr e2)
+ | Or (e1, e2) -> or_ (make_constr e1) (make_constr e2)
+ | Not e -> not_ (make_constr e)
+ | Minus e -> minus (make_constr e)
+ | Plus (e1, e2) -> plus (make_constr e1) (make_constr e2)
+ | Sub (e1, e2) -> sub (make_constr e1) (make_constr e2)
+ | Mult (e1, e2) -> mult (make_constr e1) (make_constr e2)
+ | Div (e1, e2) -> div (make_constr e1) (make_constr e2)
+ | Modulo (e1, e2) -> modulo (make_constr e1) (make_constr e2)
+ | Comp (s, e1, e2) -> comp s (make_constr e1) (make_constr e2)
+ | Fun (s, l) -> fun_ s (List.map make_constr l)
+ | Varinfo v -> varinfo v
+ | Varinfo_tab (tab, d, v) ->
+ varinfo_tab ~tab ~def:(make_constr d) ~value:(make_constr v)
+ | Varinfo_field (d, v, field) ->
+ varinfo_field ~def:(make_constr d) ~value:(make_constr v) ~field
+ | Varspace_current vs -> varspace_current vs
+ | Varspace_of (m, v) -> varspace_of m v
+ | Typ t -> typ t
+ | Instr i -> instr i
+ | Direct e -> direct (make_constr e)
+ | Ite (c, t, e) -> ite (make_constr c) (make_constr t) (make_constr e)
+ | It0 (c, t) -> it0 (make_constr c) (make_constr t)
+ | Let_local (lv, e, i) -> let_local lv (make_constr e) (make_constr i)
+
+type atomic_expression_composition = {
+ set_vars : (dflag * string * Constr.t) list;
+ def_test : DE.t;
+ value_comp : Constr.t;
+}
+
+type expression_composition =
+ | AtomicExpr of atomic_expression_composition
+ | Cond of
+ expression_composition * expression_composition * expression_composition
+ | Let of {
+ vardef : string;
+ varval : string;
+ body : expression_composition;
+ followup : expression_composition;
+ }
+
+let atomic e = AtomicExpr e
+
+let make_generic_let =
+ let fresh_name =
+ let cpt = ref 0 in
+ fun () ->
+ let vardef = Format.sprintf "vardef%i" !cpt
+ and varval = Format.sprintf "varval%i" !cpt in
+ incr cpt;
+ (vardef, varval)
+ in
+ fun f ->
+ let vardef, varval = fresh_name () in
+ f vardef varval
+
+let make_let body followup =
+ match body with
+ | AtomicExpr e -> begin
+ match followup e.def_test e.value_comp with
+ | AtomicExpr e' ->
+ atomic @@ { e' with set_vars = e.set_vars @ e'.set_vars }
+ | _ ->
+ make_generic_let (fun vardef varval ->
+ Let
+ {
+ vardef;
+ varval;
+ body;
+ followup =
+ followup
+ (DE.devar @@ Constr.Instr vardef)
+ (Constr.Instr varval);
+ })
+ end
+ | _ ->
+ make_generic_let (fun vardef varval ->
+ Let
+ {
+ vardef;
+ varval;
+ body;
+ followup =
+ followup (DE.devar @@ Constr.Instr vardef) (Constr.Instr varval);
+ })
+
+let make_lets (bodys : expression_composition list)
+ (followup : (DE.t * Constr.t) list -> expression_composition) =
+ let rec loop acc = function
+ | [] -> followup (List.rev acc)
+ | body :: tl -> make_let body (fun d v -> loop ((d, v) :: acc) tl)
+ in
+ loop [] bodys
+
+let def_expr_to_constr e =
+ let map = DE.get_assoc e in
+ let rec loop = function
+ | Def_expr.DEand [] -> Constr.True
+ | DEand (hd :: tl) ->
+ List.fold_left
+ (fun acc e ->
+ let c = loop e in
+ Constr.And (acc, c))
+ (loop hd) tl
+ | DEor [] -> False
+ | DEor (hd :: tl) ->
+ List.fold_left
+ (fun acc e ->
+ let c = loop e in
+ Constr.Or (acc, c))
+ (loop hd) tl
+ | DEnot e -> Not (loop e)
+ | DEatom v -> Def_expr.AtomMap.find v map
+ in
+ let def_expr = DE.get_expr e in
+ let def_expr =
+ if Config.optim_shorten_def () then Def_expr.Shorten_def.apply def_expr
+ else def_expr
+ in
+ loop def_expr
+
+let build_transitive_composition ~safe_def
+ ({ set_vars; def_test; value_comp } : atomic_expression_composition) :
+ atomic_expression_composition =
(* `safe_def` can be set on call when we are sure that `value_comp` will
always happen to be zero when `def_test` ends up false. E.g. arithmetic
operation have such semantic property (funny question is what's the
causality ?). This allows to remove a check to the definition flag when we
compute the value, avoiding a lot of unnecessary code. *)
- let value_comp = if safe_def then value_comp else it0 def_test value_comp in
+ let value_comp =
+ if safe_def then value_comp
+ else It0 (def_expr_to_constr def_test, value_comp)
+ in
{ set_vars; def_test; value_comp }
-type local_decls = int * int (* in practice, stacks sizes *)
+let dfun_with_ptr (f : string)
+ (args : ptrdef:Constr.t -> ptrval:Constr.t -> Constr.t list) :
+ atomic_expression_composition =
+ let res = fresh_c_local "res" in
+ let res_def = Pp.spr "%s_def" res in
+ let res_val = Pp.spr "%s_val" res in
+ let res_def_ptr = Pp.spr "&%s" res_def in
+ let res_val_ptr = Pp.spr "&%s" res_val in
+ let d_fun =
+ Constr.Fun
+ ( f,
+ args ~ptrdef:(Direct (Instr res_def_ptr))
+ ~ptrval:(Direct (Instr res_val_ptr)) )
+ in
+ let set_vars =
+ [ (Def, res_def, d_fun); (Val, res_val, Direct (Instr res_val)) ]
+ in
+ let def_test = DE.devar @@ Instr res_def in
+ let value_comp = Constr.Instr res_val in
+ build_transitive_composition ~safe_def:false
+ { set_vars; def_test; value_comp }
+
+let eundefined () =
+ { set_vars = []; def_test = DE.defalse; value_comp = Lit 0. }
+
+let elit f = { set_vars = []; def_test = DE.detrue; value_comp = Lit f }
+
+type local_decls = {
+ def_stk_size : int;
+ val_stk_size : int;
+ var_stk_size : int;
+ var_spa_size : int;
+}
+(* in practice, stacks sizes *)
(* evaluate a complete (AKA, context free) expression. Not to be used for
further construction. *)
-let build_expression (expr_comp : expression_composition) :
+let build_atomic_expression (expr_comp : atomic_expression_composition) :
local_decls * (dflag * string * t) list * t * t =
- let empty_stacks = { def_top = 0; val_top = 0; var_substs = [] } in
+ let empty_stacks =
+ { def_top = 0; val_top = 0; var_top = 0; spa_top = 0; var_substs = [] }
+ in
+ let empty_local_decls =
+ {
+ def_stk_size = -1;
+ val_stk_size = -1;
+ var_stk_size = -1;
+ var_spa_size = -1;
+ }
+ in
let empty_locals = [] in
let set_tests =
List.map
- (fun (kd, vn, constr) ->
- (kd, vn, collapse_constr empty_stacks empty_locals constr))
+ (fun (kd, vn, builder) ->
+ ( kd,
+ vn,
+ collapse_builder empty_stacks empty_locals (make_constr builder) ))
expr_comp.set_vars
in
let set_locals =
List.concat (List.map (fun (_, _, (_, _, locals)) -> locals) set_tests)
in
let ((_, _, def_locals) as def_test) =
- collapse_constr empty_stacks empty_locals expr_comp.def_test
+ collapse_builder empty_stacks empty_locals
+ (make_constr @@ def_expr_to_constr expr_comp.def_test)
in
let ((_, _, value_locals) as value_comp) =
- collapse_constr empty_stacks empty_locals expr_comp.value_comp
+ collapse_builder empty_stacks empty_locals
+ (make_constr expr_comp.value_comp)
in
let stacks_size =
List.fold_left
- (fun (def_s, val_s) (_, { slot; _ }) ->
+ (fun ld (_, { slot; _ }) ->
match slot.kind with
- | Def -> (max slot.depth def_s, val_s)
- | Val -> (def_s, max slot.depth val_s))
- (-1, -1)
+ | Def -> { ld with def_stk_size = max slot.depth ld.def_stk_size }
+ | Val -> { ld with val_stk_size = max slot.depth ld.val_stk_size }
+ | VarInfo -> { ld with var_stk_size = max slot.depth ld.var_stk_size }
+ | VarSpace -> { ld with var_spa_size = max slot.depth ld.var_spa_size })
+ empty_local_decls
(set_locals @ def_locals @ value_locals)
in
(stacks_size, set_tests, def_test, value_comp)
+let rec build_expression = function
+ | AtomicExpr e -> `Atom (build_atomic_expression e)
+ | Cond (c, t, e) ->
+ `Cond (build_expression c, build_expression t, build_expression e)
+ | Let { vardef; varval; body; followup } ->
+ `Let (vardef, varval, build_expression body, build_expression followup)
+
let format_slot fmt ({ kind; depth } : stack_slot) =
- let kind = match kind with Def -> "int" | Val -> "real" in
+ let kind =
+ match kind with
+ | Def -> "int"
+ | Val -> "real"
+ | VarInfo -> "varinfo"
+ | VarSpace -> "space"
+ in
Format.fprintf fmt "%s%d" kind depth
let format_expr_var (dgfip_flags : Dgfip_options.flags) fmt (ev : expr_var) =
@@ -459,12 +703,20 @@ let rec format_dexpr (dgfip_flags : Dgfip_options.flags) fmt (de : expr) =
(* Print literal floats as precisely as possible *)
Format.fprintf fmt "%#.19g" f)
| Dvar evar -> format_expr_var dgfip_flags fmt evar
- | Dand (de1, de2) ->
- Format.fprintf fmt "@[(%a@ && %a@])" format_dexpr de1 format_dexpr
- de2
- | Dor (de1, de2) ->
- Format.fprintf fmt "@[(%a@ || %a@])" format_dexpr de1 format_dexpr
- de2
+ | Dand l ->
+ let sep = if Config.optim_simple_binary_op () then " & " else " && " in
+ Format.fprintf fmt "@[(%a)@]"
+ (Format.pp_print_list
+ ~pp_sep:(fun fmt _ -> Format.pp_print_string fmt sep)
+ format_dexpr)
+ l
+ | Dor l ->
+ let sep = if Config.optim_simple_binary_op () then " | " else " || " in
+ Format.fprintf fmt "@[(%a)@]"
+ (Format.pp_print_list
+ ~pp_sep:(fun fmt _ -> Format.pp_print_string fmt sep)
+ format_dexpr)
+ l
| Dunop (op, de) -> Format.fprintf fmt "@[(%s%a@])" op format_dexpr de
| Dbinop (op, de1, de2) -> begin
match op with
@@ -496,21 +748,42 @@ let rec format_dexpr (dgfip_flags : Dgfip_options.flags) fmt (de : expr) =
~pp_sep:(fun fmt () -> Format.fprintf fmt ",@ ")
format_dexpr)
des
+ | Dvarinfo v -> format_varinfo dgfip_flags fmt v
+ | Dvarspace (m_sp_opt, v_opt) ->
+ Format.fprintf fmt "@[%s@]"
+ (match v_opt with
+ | Some v -> VID.gen_var_space_id m_sp_opt v
+ | None -> VID.gen_var_space_id_opt m_sp_opt)
+ | Dtyp t -> Format.fprintf fmt "@[%s@]" @@ VID.gen_typ t
| Dinstr instr -> Format.fprintf fmt "%s" instr
| Ddirect expr -> format_dexpr fmt expr
| Dite (dec, det, dee) ->
Format.fprintf fmt "@[(%a ?@ %a@ : %a@])" format_dexpr dec
format_dexpr det format_dexpr dee
-let rec format_local_declarations fmt
- ((def_stk_size, val_stk_size) : local_decls) =
- if def_stk_size >= 0 then (
- Format.fprintf fmt "@;@[register int int%d;@]" def_stk_size;
- format_local_declarations fmt (def_stk_size - 1, val_stk_size))
- else if val_stk_size >= 0 then (
- Format.fprintf fmt "@;@[register double real%d;@]" val_stk_size;
- format_local_declarations fmt (def_stk_size, val_stk_size - 1))
- else ()
+and format_varinfo dgfip_flags fmt : varinfo_access -> unit = function
+ | VIvar v -> Format.fprintf fmt "%s" (VID.gen_info_ptr v)
+ | VItab (v, def, value) ->
+ Format.fprintf fmt "@[lis_tabaccess_varinfo(irdata, %d, %a, %a)@]"
+ (Com.Var.loc_tab_idx v) (format_dexpr dgfip_flags) def
+ (format_dexpr dgfip_flags) value
+ | VIfield (def, value, field) ->
+ Format.fprintf fmt "@[event_field_%s_var(irdata, %a, %a)@]" field
+ (format_dexpr dgfip_flags) def (format_dexpr dgfip_flags) value
+
+let format_local_declarations fmt (ld : local_decls) =
+ for i = 0 to ld.def_stk_size do
+ Format.fprintf fmt "@;@[register int int%d;@]" i
+ done;
+ for i = 0 to ld.val_stk_size do
+ Format.fprintf fmt "@;@[register double real%d;@]" i
+ done;
+ for i = 0 to ld.var_stk_size do
+ Format.fprintf fmt "@;@[T_varinfo* varinfo%d;@]" i
+ done;
+ for i = 0 to ld.var_spa_size do
+ Format.fprintf fmt "@;@[int space%d;@]" i
+ done
let format_local_vars_defs (dgfip_flags : Dgfip_options.flags) fmt
(lv : local_vars) =
@@ -531,9 +804,297 @@ let format_set_vars (dgfip_flags : Dgfip_options.flags) fmt
(set_vars : (dflag * string * t) list) =
List.iter
(fun ((kd, vn, _expr) : dflag * string * t) ->
- Pp.fpr fmt "@;%s %s;" (match kd with Def -> "char" | Val -> "double") vn)
+ Pp.fpr fmt "@;%s %s;"
+ (match kd with
+ | Def -> "char"
+ | Val -> "double"
+ | VarInfo -> "T_varinfo*"
+ | VarSpace -> "int")
+ vn)
set_vars;
List.iter
(fun ((_kd, vn, expr) : dflag * string * t) ->
format_assign dgfip_flags vn fmt expr)
set_vars
+
+(* Building basic expressions *)
+
+let comparison op (se1 : expression_composition) (se2 : expression_composition)
+ =
+ make_let se1 (fun d1 v1 ->
+ make_let se2 (fun d2 v2 ->
+ let safe_def = false in
+ let def_test = DE.deand [ d1; d2 ] in
+ let value_comp =
+ let op =
+ let open Com in
+ match Pos.unmark op with
+ | Gt -> ">"
+ | Gte -> ">="
+ | Lt -> "<"
+ | Lte -> "<="
+ | Eq -> "=="
+ | Neq -> "!="
+ in
+ Constr.Comp (op, v1, v2)
+ in
+ AtomicExpr
+ (build_transitive_composition ~safe_def
+ { set_vars = []; def_test; value_comp })))
+
+let binop op (se1 : expression_composition) (se2 : expression_composition) =
+ make_let se1 (fun d1 v1 ->
+ make_let se2 (fun d2 v2 ->
+ let safe_def = true in
+ let def_test =
+ match Pos.unmark op with
+ | Com.And | Com.Mul | Com.Div | Com.Mod -> DE.deand [ d1; d2 ]
+ | Com.Or | Com.Add | Com.Sub -> DE.deor [ d1; d2 ]
+ in
+ let op e1 e2 =
+ match Pos.unmark op with
+ | Com.And -> Constr.And (e1, e2)
+ | Com.Or -> Or (e1, e2)
+ | Com.Add -> Plus (e1, e2)
+ | Com.Sub -> Sub (e1, e2)
+ | Com.Mul -> Mult (e1, e2)
+ | Com.Div -> Ite (e2, Div (e1, e2), Lit 0.)
+ | Com.Mod -> Ite (e2, Modulo (e1, e2), Lit 0.)
+ in
+ let value_comp = op v1 v2 in
+ AtomicExpr
+ (build_transitive_composition ~safe_def
+ { set_vars = []; def_test; value_comp })))
+
+let unop op se =
+ let op, safe_def =
+ match op with
+ | Com.Not -> ((fun e -> Constr.Not e), false)
+ | Com.Minus -> ((fun e -> Minus e), true)
+ in
+ make_let se (fun vardef varval ->
+ let value_comp = op varval in
+ let def_test = vardef in
+ AtomicExpr
+ (build_transitive_composition ~safe_def
+ { set_vars = []; def_test; value_comp }))
+
+let conditional cond thenval elseval =
+ (* make_let cond (fun dc vc -> *)
+ (* make_let thenval (fun dt vt -> *)
+ (* make_let elseval (fun de ve -> *)
+ (* let def_test = DE.deand [ dc; DE.deite (DE.devar vc) dt de ] in *)
+ (* let value_comp = Constr.Ite (vc, vt, ve) in *)
+ (* AtomicExpr *)
+ (* (build_transitive_composition ~safe_def:false *)
+ (* { set_vars = []; def_test; value_comp })))) *)
+
+ (* let set_vars = cond.set_vars @ thenval.set_vars @ elseval.set_vars in *)
+ (* let def_test = *)
+ (* DE.deand *)
+ (* [ *)
+ (* cond.def_test; *)
+ (* DE.deite (DE.devar cond.value_comp) thenval.def_test elseval.def_test; *)
+ (* ] *)
+ (* in *)
+ (* let value_comp = *)
+ (* Constr.Ite (cond.value_comp, thenval.value_comp, elseval.value_comp) *)
+ (* in *)
+ (* build_transitive_composition { set_vars; def_test; value_comp } *)
+ Cond (cond, thenval, elseval)
+
+module Func = struct
+ let supzero se =
+ make_let se (fun vardef varval ->
+ let def_test : DE.t =
+ DE.(deand [ vardef; devar (Comp (">", varval, Lit 0.0)) ])
+ in
+ atomic
+ @@ build_transitive_composition ~safe_def:false
+ { set_vars = []; def_test; value_comp = varval })
+
+ (* TODO: this code calculates the value of the expression before checking its
+ definition. There may be a way to only calculate the definition. *)
+ let present se =
+ make_let se (fun vardef _varval ->
+ let def_test = DE.detrue in
+ let value_comp = def_expr_to_constr vardef in
+ atomic
+ @@ build_transitive_composition ~safe_def:true
+ { set_vars = []; def_test; value_comp })
+
+ let null se =
+ make_let se (fun vardef varval ->
+ (* S: Checking if expr is defined in expression is probably useless *)
+ let value_comp =
+ Constr.And (def_expr_to_constr vardef, Comp ("==", varval, Lit 0.0))
+ in
+ atomic
+ @@ build_transitive_composition ~safe_def:true
+ { set_vars = []; def_test = vardef; value_comp })
+
+ let arr se =
+ make_let se (fun vardef varval ->
+ let value_comp = Constr.Fun ("my_arr", [ varval ]) in
+ (* Here we boldly assume that rounding value of `undef` will give zero,
+ given the invariant. Pretty sure that not true, in case of doubt, turn
+ `safe_def` to false *)
+ atomic
+ @@ build_transitive_composition ~safe_def:true
+ { set_vars = []; def_test = vardef; value_comp })
+
+ let inf se =
+ make_let se (fun vardef varval ->
+ let value_comp = Constr.Fun ("my_floor", [ varval ]) in
+ (* same as above *)
+ atomic
+ @@ build_transitive_composition ~safe_def:true
+ { set_vars = []; def_test = vardef; value_comp })
+
+ let abs se =
+ make_let se (fun vardef varval ->
+ let value_comp = Constr.Fun ("fabs", [ varval ]) in
+ atomic
+ @@ build_transitive_composition ~safe_def:true
+ { set_vars = []; def_test = vardef; value_comp })
+
+ let max se1 se2 =
+ make_let se1 (fun d1 v1 ->
+ make_let se2 (fun d2 v2 ->
+ let def_test = DE.deor [ d1; d2 ] in
+ let value_comp = Constr.Fun ("max", [ v1; v2 ]) in
+ atomic
+ @@ build_transitive_composition ~safe_def:true
+ { set_vars = []; def_test; value_comp }))
+
+ let min se1 se2 =
+ make_let se1 (fun d1 v1 ->
+ make_let se2 (fun d2 v2 ->
+ let def_test = DE.deor [ d1; d2 ] in
+ let value_comp = Constr.Fun ("min", [ v1; v2 ]) in
+ atomic
+ @@ build_transitive_composition ~safe_def:true
+ { set_vars = []; def_test; value_comp }))
+
+ let multimax (e : expression_composition) (m_sp_opt, v) =
+ let ptr = VID.gen_info_ptr v in
+ make_let e (fun vardef varval ->
+ let d_fun =
+ dfun_with_ptr "multimax_varinfo" (fun ~ptrdef ~ptrval ->
+ [
+ Constr.irdata;
+ Direct (Instr (VID.gen_var_space_id m_sp_opt v));
+ Direct (Instr ptr);
+ def_expr_to_constr vardef;
+ varval;
+ ptrdef;
+ ptrval;
+ ])
+ in
+ atomic @@ build_transitive_composition ~safe_def:true d_fun)
+
+ let nb_events () =
+ let def_test = DE.detrue in
+ let value_comp = Constr.Fun ("nb_evenements", [ Constr.irdata ]) in
+ atomic
+ @@ build_transitive_composition ~safe_def:true
+ { set_vars = []; def_test; value_comp }
+
+ let nb_anomalies () =
+ let def_test = DE.detrue in
+ let value_comp = Constr.Fun ("nb_anomalies", [ Constr.irdata ]) in
+ atomic
+ @@ build_transitive_composition ~safe_def:true
+ { set_vars = []; def_test; value_comp }
+
+ let nb_discordances () =
+ let def_test = DE.detrue in
+ let value_comp = Constr.Fun ("nb_discordances", [ Constr.irdata ]) in
+ atomic
+ @@ build_transitive_composition ~safe_def:true
+ { set_vars = []; def_test; value_comp }
+
+ let nb_informatives () =
+ let def_test = DE.detrue in
+ let value_comp = Constr.Fun ("nb_informatives", [ Constr.irdata ]) in
+ atomic
+ @@ build_transitive_composition ~safe_def:true
+ { set_vars = []; def_test; value_comp }
+
+ let nb_bloquantes () =
+ let def_test = DE.detrue in
+ let value_comp = Constr.Fun ("nb_bloquantes", [ Constr.irdata ]) in
+ atomic
+ @@ build_transitive_composition ~safe_def:true
+ { set_vars = []; def_test; value_comp }
+
+ let call fn args =
+ let d_fun args =
+ atomic
+ @@ dfun_with_ptr fn (fun ~ptrdef ~ptrval ->
+ Constr.irdata :: ptrdef :: ptrval :: args)
+ in
+ make_lets args (fun l ->
+ let args =
+ List.flatten @@ List.map (fun (d, v) -> [ def_expr_to_constr d; v ]) l
+ in
+ d_fun args)
+end
+
+let write_atomic_decoupled_expr dgfip_flags oc res_def res_val
+ (locals, set, def, value) =
+ let pr form = Format.fprintf oc form in
+ if is_always_true def then
+ pr "@;@[{%a%a%a%a@]@;}" format_local_declarations locals
+ (format_set_vars dgfip_flags)
+ set
+ (format_assign dgfip_flags res_def)
+ def
+ (format_assign dgfip_flags res_val)
+ value
+ else
+ pr "@;@[{%a%a%a@;@[if (%s) {%a@]@;} else %s = 0.0;@]@;}"
+ format_local_declarations locals
+ (format_set_vars dgfip_flags)
+ set
+ (format_assign dgfip_flags res_def)
+ def res_def
+ (format_assign dgfip_flags res_val)
+ value res_val
+
+let fresh_cond_vars =
+ let cpt = ref 0 in
+ fun () ->
+ let res_def = Format.sprintf "cond_def%i" !cpt
+ and res_val = Format.sprintf "cond_val%i" !cpt in
+ incr cpt;
+ (res_def, res_val)
+
+let rec write_decoupled_expr dgfip_flags oc =
+ let pr form = Format.fprintf oc form in
+ fun res_def res_val -> function
+ | `Atom a -> write_atomic_decoupled_expr dgfip_flags oc res_def res_val a
+ | `Cond (c, t, e) ->
+ let d, v = fresh_cond_vars () in
+ pr "@;{@[";
+ pr "@;int %s;" d;
+ pr "@;double %s;" v;
+ write_decoupled_expr dgfip_flags oc d v c;
+ pr "@;if(%s == 0) {%s = 0; %s = 0.0;}" d res_def res_val;
+ pr "@;else if (EQ_E(%s,0.0)) {@;@[" v;
+ write_decoupled_expr dgfip_flags oc res_def res_val e;
+ pr "@;}@] else {@;@[";
+ write_decoupled_expr dgfip_flags oc res_def res_val t;
+ pr "@;}@]";
+ pr "@;}@]"
+ | `Let (vardef, varval, body, followup) ->
+ pr "@;{@[";
+ pr "@;int %s;" vardef;
+ pr "@;double %s;" varval;
+ write_decoupled_expr dgfip_flags oc vardef varval body;
+ write_decoupled_expr dgfip_flags oc res_def res_val followup;
+ pr "@;}@]"
+
+let write_c_expr dgfip_flags oc res_def res_val expr =
+ expr |> build_expression
+ |> write_decoupled_expr dgfip_flags oc res_def res_val
diff --git a/src/mlang/backend_compilers/decoupledExpr.mli b/src/mlang/backend_compilers/decoupledExpr.mli
index 1ba26a603..7b1bbf2e8 100644
--- a/src/mlang/backend_compilers/decoupledExpr.mli
+++ b/src/mlang/backend_compilers/decoupledExpr.mli
@@ -1,7 +1,27 @@
+(******************************************************************************)
+(* *)
+(* Droit d'auteur (c) 2022 - 2026 DGFiP - INRIA *)
+(* *)
+(* Ce programme est distribué sous la licence CeCILL-C: vous pouvez le *)
+(* redistribuer et/ou le modifier sous les contraintes de celle-ci. *)
+(* *)
+(* L'accessibilité au code source et les droits de copie, de modification et *)
+(* de redistribution qui découlent de ce contrat ont pour contrepartie de *)
+(* n'offrir aux utilisateurs qu'une garantie limitée et de ne faire peser sur *)
+(* l'auteur du logiciel, le titulaire des droits patrimoniaux et les *)
+(* concédants successifs qu'une responsabilité restreinte. *)
+(* *)
+(******************************************************************************)
+
+val fresh_c_local : string -> string
+(** Generates a fresh string that is certain to be different from all strings
+ generated by this function (given the initial string has no digits in it).
+*)
+
val generate_variable :
?def_flag:bool -> ?trace_flag:bool -> Com.var_space -> Com.Var.t -> string
-type dflag = Def | Val
+type dflag = Def | Val | VarInfo | VarSpace
(** {1 Low-level M computation} *)
@@ -9,25 +29,15 @@ type dflag = Def | Val
expressions so they can be expressed independantly and more thoroughtly
optimized. Definition of such expression follows as such:
- - Express the computation of definess and valuation independantly through
- the use of constructors in {!section:constr}
- - Sub-expressions can be used to build up the M expression tree (see
- {!expression_composition})
- - A fully defined expression can be processed into a optimized value that
+ - express the computation of definess and valuation independantly through
+ the use of constructors in {!section:constr};
+ - sub-expressions can be used to build up the M expression tree (see
+ {!expression_composition});
+ - the dependency between local variables used throughout the computation by
+ delaying their construction within ({!builder});
+ - a fully defined expression can be processed into a optimized value that
can be printed ({!build_expression}) *)
-(** {2 Local variables} *)
-
-type local_var
-(** Variable local to the computed expression *)
-
-val locals_from_m : unit -> local_var * local_var
-(** Return a couple of local variable from a MIR one, for defineness and
- valuation in this order. *)
-
-val new_local : unit -> local_var
-(** Create a fresh local variable *)
-
(** {2:constr Expression constructors} *)
(** These are the smart constructors used to build expressions. In effect, they
@@ -45,117 +55,126 @@ val new_local : unit -> local_var
where [x] and [y] are previously defined {!local_var}s *)
-type constr
-(** Constructed decoupled expression *)
-
-val dtrue : constr
-(** True value *)
-
-val dfalse : constr
-(** False value *)
-
-val lit : float -> constr
-(** Float literal *)
-
-val m_var : Com.var_space -> Com.Var.t -> dflag -> constr
-(** Value from TGV. [m_var v off df] represents an access to the TGV variable
- [v] with [df] to read defineness or valuation. [off] is the access type for
- M array, and should be [None] most of the time. For array access, see
- {!access}. *)
+module DE : Def_expr.S with type expr = Constr.t
-val let_local : local_var -> constr -> constr -> constr
-(** Local let-binding. [let_local v defining_expr body_expr] is akin to OCaml
- [let v = defining_expr in body_expr] *)
+val def_expr_to_constr : DE.t -> Constr.t
-val local_var : local_var -> constr
-(** Access local variable value *)
-
-val dand : constr -> constr -> constr
-(** Boolean and *)
+(** {2 Decoupled expressions} *)
-val dor : constr -> constr -> constr
-(** Boolean or *)
+(** While {!constr} is the expression language for decoupled values, the
+ following represents complete and optimized expressions for M computations
+*)
-val dnot : constr -> constr
-(** Boolean not *)
+type atomic_expression_composition = {
+ set_vars : (dflag * string * Constr.t) list;
+ def_test : DE.t;
+ value_comp : Constr.t;
+}
+(** Representation of an M computation in construction. [def_test] for the
+ defineness flag, and [value_comp] for the actual valuation. *)
-val minus : constr -> constr
-(** Negate value *)
+type expression_composition
-val plus : constr -> constr -> constr
-(** Float addition *)
+val atomic : atomic_expression_composition -> expression_composition
-val sub : constr -> constr -> constr
-(** Float substraction *)
+val make_let :
+ expression_composition ->
+ (DE.t -> Constr.t -> expression_composition) ->
+ expression_composition
-val mult : constr -> constr -> constr
-(** Float multiplication *)
+val build_transitive_composition :
+ safe_def:bool ->
+ atomic_expression_composition ->
+ atomic_expression_composition
+(** Refine an expression composition to enfore M invariants. Mainly the fact
+ that undefined value are valuated to zero. [value_comp] of the argument is
+ expected to be defined assuming the expression {i is} defined. [safe_def]
+ defines if [value_comp] computation will evaluate to zero if [def_test] do,
+ allowing the guard to be optimized away. *)
+
+val eundefined : unit -> atomic_expression_composition
+(** The representation of undefined *)
+
+val elit : float -> atomic_expression_composition
+(** Literals have a simple enough representation they can be written as an
+ expression composition without relying on constructions. *)
+
+val comparison :
+ Com.comp_op Pos.marked ->
+ expression_composition ->
+ expression_composition ->
+ expression_composition
+
+val binop :
+ Com.binop Pos.marked ->
+ expression_composition ->
+ expression_composition ->
+ expression_composition
+
+val unop : Com.unop -> expression_composition -> expression_composition
+
+val conditional :
+ expression_composition ->
+ expression_composition ->
+ expression_composition ->
+ expression_composition
+
+val dfun_with_ptr :
+ string ->
+ (ptrdef:Constr.t -> ptrval:Constr.t -> Constr.t list) ->
+ atomic_expression_composition
+(** [dfun_with_ptr fn args]
+
+ Some functions use pointers to save the definition status & the value of a
+ calculation. This function builds the expression composition defining these
+ pointers and their position as arguments ([args] serves as a specification
+ of how to build the list of arguments). *)
-val div : constr -> constr -> constr
-(** Float division. Care to guard for division by zero as it is not intrisectly
- guarranteed *)
+type local_decls
+(** Representation of local variables existing in an expression *)
-val modulo : constr -> constr -> constr
-(** Float modulo. Care to guard for modulo by zero as it is not intrisectly
- guarranteed *)
+val write_c_expr :
+ Dgfip_options.flags ->
+ Format.formatter ->
+ string ->
+ string ->
+ expression_composition ->
+ unit
+(** Crush {!constr} values into closed expressions {!t} *)
-val comp : string -> constr -> constr -> constr
-(** Comparison operation. The operator is given as C-style string literal *)
+val format_local_declarations : Format.formatter -> local_decls -> unit
-val dfun : string -> constr list -> constr
-(** Function call *)
+module Func : sig
+ val supzero : expression_composition -> expression_composition
-val dinstr : string -> constr
-(** Direct instruction *)
+ val present : expression_composition -> expression_composition
-val ddirect : constr -> constr
-(** Direct instruction, not pushed *)
+ val null : expression_composition -> expression_composition
-val ite : constr -> constr -> constr -> constr
-(** Functionnal if-the-else construction. [ite cond_expr then_expr else_expr] is
- akin to [if cond_expr then then_expr else else_expr] *)
+ val arr : expression_composition -> expression_composition
-(** {2 Decoupled expressions} *)
+ val inf : expression_composition -> expression_composition
-(** While {!constr} is the expression language for decoupled values, the
- following represents complete and optimized expressions for M computations
-*)
+ val abs : expression_composition -> expression_composition
-type expression_composition = {
- set_vars : (dflag * string * constr) list;
- def_test : constr;
- value_comp : constr;
-}
-(** Representation of an M computation in construction. [def_test] for the
- defineness flag, and [value_comp] for the actual valuation. *)
+ val max :
+ expression_composition -> expression_composition -> expression_composition
-val build_transitive_composition :
- ?safe_def:bool -> expression_composition -> expression_composition
-(** Refine an expression composition to enfore M invariants. Mainly the fact
- that undefined value are valuated to zero. [value_comp] of the argument is
- expected to be defined assuming the expression {i is} defined. [safe_def],
- which defaults to [false], can be set when the defined [value_comp]
- computation will evaluate to zero if [def_test] do, allowing the guard to be
- optimized away. *)
+ val min :
+ expression_composition -> expression_composition -> expression_composition
-type t
-(** Decoupled expression type. Closed representation of a computation. *)
+ val multimax :
+ expression_composition -> Com.Var.t Com.var_id -> expression_composition
-val is_always_true : t -> bool
-(** Tells if the expression [t] reprensents a value statically different to zero
-*)
+ val nb_events : unit -> expression_composition
-type local_decls
-(** Representation of local variables existing in an expression *)
+ val nb_anomalies : unit -> expression_composition
-val build_expression :
- expression_composition -> local_decls * (dflag * string * t) list * t * t
-(** Crush {!constr} values into closed expressions {!t} *)
+ val nb_discordances : unit -> expression_composition
-val format_local_declarations : Format.formatter -> local_decls -> unit
+ val nb_informatives : unit -> expression_composition
-val format_assign :
- Dgfip_options.flags -> string -> Format.formatter -> t -> unit
+ val nb_bloquantes : unit -> expression_composition
-val format_set_vars :
- Dgfip_options.flags -> Format.formatter -> (dflag * string * t) list -> unit
+ val call : string -> expression_composition list -> expression_composition
+end
diff --git a/src/mlang/backend_compilers/def_expr.ml b/src/mlang/backend_compilers/def_expr.ml
new file mode 100644
index 000000000..8be672ff0
--- /dev/null
+++ b/src/mlang/backend_compilers/def_expr.ml
@@ -0,0 +1,274 @@
+(******************************************************************************)
+(* *)
+(* Droit d'auteur (c) 2026 DGFiP - INRIA *)
+(* *)
+(* Ce programme est distribué sous la licence CeCILL-C: vous pouvez le *)
+(* redistribuer et/ou le modifier sous les contraintes de celle-ci. *)
+(* *)
+(* L'accessibilité au code source et les droits de copie, de modification et *)
+(* de redistribution qui découlent de ce contrat ont pour contrepartie de *)
+(* n'offrir aux utilisateurs qu'une garantie limitée et de ne faire peser sur *)
+(* l'auteur du logiciel, le titulaire des droits patrimoniaux et les *)
+(* concédants successifs qu'une responsabilité restreinte. *)
+(* *)
+(******************************************************************************)
+
+type atom = int
+
+type replacement = { canon : atom; to_replace : atom }
+
+type def_expr =
+ | DEand of def_expr list
+ | DEor of def_expr list
+ | DEnot of def_expr
+ | DEatom of atom
+
+let fresh_atom =
+ let i = ref 0 in
+ fun () ->
+ let res = !i in
+ incr i;
+ res
+
+let true_ = DEand []
+
+let false_ = DEor []
+
+let rec not_ = function
+ | DEnot e -> e
+ | DEand l -> DEor (List.map not_ l)
+ | DEor l -> DEand (List.map not_ l)
+ | f -> DEnot f
+
+let or_ e1 e2 =
+ match (e1, e2) with
+ | DEand [], _ | _, DEand [] -> DEand []
+ | DEor [], e | e, DEor [] -> e
+ | DEatom v1, DEatom v2 when v1 = v2 -> e1
+ | e, DEnot ne when compare e ne = 0 -> DEand []
+ | DEnot ne, e when compare e ne = 0 -> DEand []
+ | DEor l1, DEor l2 -> DEor (l1 @ l2)
+ | _, DEor l -> DEor (e1 :: l)
+ | DEor l, _ -> DEor (l @ [ e2 ])
+ | _, _ -> DEor [ e1; e2 ]
+
+let and_ e1 e2 =
+ match (e1, e2) with
+ | DEor [], _ | _, DEor [] -> DEor []
+ | DEand [], e | e, DEand [] -> e
+ | e, DEnot ne when compare e ne = 0 -> DEor []
+ | DEnot ne, e when compare e ne = 0 -> DEor []
+ | DEatom v1, DEatom v2 when v1 = v2 -> e1
+ | DEand l1, DEand l2 -> DEand (l1 @ l2)
+ | _, DEand l -> DEand (e1 :: l)
+ | DEand l, _ -> DEand (l @ [ e2 ])
+ | _, _ -> DEand [ e1; e2 ]
+
+let ands l =
+ match l with [] -> DEand [] | hd :: tl -> List.fold_left and_ hd tl
+
+let ors l = match l with [] -> DEor [] | hd :: tl -> List.fold_left or_ hd tl
+
+let is_true t = t = true_
+
+let is_false t = t = false_
+
+let compare_atom = Int.compare
+
+module AtomMap = Map.Make (Int)
+
+module type S = sig
+ type expr
+
+ type t
+
+ val defalse : t
+
+ val detrue : t
+
+ val deand : t list -> t
+
+ val deor : t list -> t
+
+ val denot : t -> t
+
+ val devar : expr -> t
+
+ val deite : t -> t -> t -> t
+
+ val get_expr : t -> def_expr
+
+ val get_assoc : t -> expr AtomMap.t
+end
+
+module Make (OrderedExprs : sig
+ type t
+
+ val compare : t -> t -> int
+end) : S with type expr = OrderedExprs.t = struct
+ type expr = OrderedExprs.t
+
+ module ExprMap = Map.Make (OrderedExprs)
+
+ type t = { expr : def_expr; map : atom ExprMap.t }
+ (** An definition expression that can be translated back into its original
+ expression type through the map. *)
+
+ let defalse = { expr = DEor []; map = ExprMap.empty }
+
+ let detrue = { expr = DEand []; map = ExprMap.empty }
+
+ let rec compare e e' =
+ match (e, e') with
+ | DEand l, DEand l' | DEor l, DEor l' -> List.compare compare l l'
+ | DEnot e, DEnot e' -> compare e e'
+ | DEatom s, DEatom s' -> compare_atom s s'
+ | DEand _, _ -> 1
+ | _, DEand _ -> -1
+ | DEor _, _ -> 1
+ | _, DEor _ -> -1
+ | DEnot _, _ -> 1
+ | _, DEnot _ -> -1
+
+ let uniq_list l =
+ List.sort_uniq (fun { expr; _ } { expr = e'; _ } -> compare expr e') l
+
+ (** When two expressions are created independently, their atom identifier may
+ be different. This function detects when an expression has two different
+ atoms and aggregates replacements to perform on the final expression. *)
+ let merge_maps ~replacements m m' =
+ let replacements = ref replacements in
+ let map =
+ ExprMap.merge
+ (fun _e v v' ->
+ match (v, v') with
+ | Some e, None | None, Some e -> Some e
+ | None, None -> None
+ | Some v, Some v' ->
+ if compare_atom v v' <> 0 then
+ replacements := { canon = v; to_replace = v' } :: !replacements;
+ Some v)
+ m m'
+ in
+ (map, !replacements)
+
+ (** Applies a replacement on a formula. *)
+ let apply_replacement_on_expr f { canon; to_replace } =
+ let rec loop = function
+ | DEatom v when v = to_replace -> DEatom canon
+ | DEatom _ as v -> v
+ | DEnot e -> DEnot (loop e)
+ | DEor l -> DEor (List.map loop l)
+ | DEand l -> DEand (List.map loop l)
+ in
+ loop f
+
+ (** Returns the map associated to a list of expression that will be used in a
+ same formula, as well as the list of expressions updated to be consistent
+ with the said map. *)
+ let merge_exprs l =
+ let l' = uniq_list l in
+ let map, replacements =
+ List.fold_left
+ (fun (acc, replacements) { map; _ } -> merge_maps ~replacements map acc)
+ (ExprMap.empty, []) l'
+ in
+ let exprs =
+ List.map
+ (fun l -> List.fold_left apply_replacement_on_expr l.expr replacements)
+ l'
+ in
+ (map, exprs)
+
+ let deand (l : t list) : t =
+ let map, exprs = merge_exprs l in
+ { map; expr = ands exprs }
+
+ let deor l =
+ let map, exprs = merge_exprs l in
+ { map; expr = ors exprs }
+
+ let denot e = { e with expr = not_ e.expr }
+
+ let devar v =
+ let s = fresh_atom () in
+ { expr = DEatom s; map = ExprMap.singleton v s }
+
+ let deite c t e = deor [ deand [ c; t ]; deand [ denot c; e ] ]
+
+ let get_expr e = e.expr
+
+ let get_assoc t =
+ ExprMap.fold (fun k b acc -> AtomMap.add b k acc) t.map AtomMap.empty
+end
+
+module Shorten_def = struct
+ (* From a def_expr list, returns:
+ - the list of def_expr with no atom ('var' and 'not vars');
+ - the map of atoms with their prefix ([true] for 'var', [false] for 'not var'). *)
+ let split_forms (l : def_expr list) : def_expr list * (atom * bool) list =
+ List.fold_left
+ (fun (l', map) -> function
+ | DEatom v -> (l', (v, true) :: map)
+ | DEnot (DEatom v) -> (l', (v, false) :: map)
+ | f -> (f :: l', map))
+ ([], []) l
+
+ (* From an (atom => bool) map, replaces atoms in a formula
+ if they belong to the map by their truth value. If negate is
+ set to true, reverses their truth value. *)
+ let apply_known_on_atoms ~negate ~known f =
+ let rec loop f =
+ match f with
+ | DEatom v -> begin
+ match List.assoc v known <> negate with
+ | true -> true_
+ | false -> false_
+ | exception Not_found -> f
+ end
+ | DEnot f -> not_ @@ loop f
+ | DEor l -> ors (List.map loop l)
+ | DEand l -> ands (List.map loop l)
+ in
+ loop f
+
+ (* Reverses the behavior of the split_forms returned map. *)
+ let knowns_to_form m =
+ List.fold_left
+ (fun acc (i, b) -> if b then DEatom i :: acc else not_ (DEatom i) :: acc)
+ [] m
+
+ (* Applies simple boolean simplifications. For any atom [v] and formulas [f]
+ and [g] :
+ - if [f] = [v] /\ [g], replaces occurences of [v] by [true] in [g];
+ - if [f] = [v] \/ [g], replaces occurences of [v] by [false] in [g].
+
+ This simplification is done recursively on formulas. *)
+ let apply f =
+ let rec loop f =
+ match f with
+ | DEatom _ -> f
+ | DEnot f -> not_ (loop f)
+ | DEor l ->
+ (* Separates non-atoms (l) from atoms (known) *)
+ let l, known = split_forms l in
+ (* Apply known atoms on non-atoms formula. We negate the atoms:
+ for a formula [f = atom \/ f'], we can assume occurences of [atom]
+ in [f'] are false (for if they were true, [f] would be true
+ anyway). *)
+ let l = List.map (apply_known_on_atoms ~negate:true ~known) l in
+ (* Recursively applying the whole simplification on non-atoms *)
+ let l = List.map loop l in
+ (* Re-building the formula list *)
+ let l = knowns_to_form known @ l in
+ ors l
+ | DEand l ->
+ (* Same procedure than DEor, except we do not negate the atoms. *)
+ let l, known = split_forms l in
+ let l = List.map (apply_known_on_atoms ~negate:false ~known) l in
+ let l = List.map loop l in
+ let l = knowns_to_form known @ l in
+ ands l
+ in
+ loop f
+end
diff --git a/src/mlang/backend_compilers/def_expr.mli b/src/mlang/backend_compilers/def_expr.mli
new file mode 100644
index 000000000..cbe6d984b
--- /dev/null
+++ b/src/mlang/backend_compilers/def_expr.mli
@@ -0,0 +1,89 @@
+(******************************************************************************)
+(* *)
+(* Droit d'auteur (c) 2026 DGFiP - INRIA *)
+(* *)
+(* Ce programme est distribué sous la licence CeCILL-C: vous pouvez le *)
+(* redistribuer et/ou le modifier sous les contraintes de celle-ci. *)
+(* *)
+(* L'accessibilité au code source et les droits de copie, de modification et *)
+(* de redistribution qui découlent de ce contrat ont pour contrepartie de *)
+(* n'offrir aux utilisateurs qu'une garantie limitée et de ne faire peser sur *)
+(* l'auteur du logiciel, le titulaire des droits patrimoniaux et les *)
+(* concédants successifs qu'une responsabilité restreinte. *)
+(* *)
+(******************************************************************************)
+
+type atom
+(** An atomic proposition. *)
+
+module AtomMap : Map.S with type key = atom
+
+(** Abstract representation of boolean expressions used to represent definition
+ tests. They should only be used for this and not for M boolean conditions
+ (that are 3-valued boolean values). *)
+type def_expr =
+ | DEand of def_expr list
+ | DEor of def_expr list
+ | DEnot of def_expr
+ | DEatom of atom
+
+val is_true : def_expr -> bool
+
+val is_false : def_expr -> bool
+
+(** Module signature of expressions whose atoms are generic expressions. Generic
+ expressions are replaced by atoms, and a map keeps the correspondance
+ between expressions and atoms. If the same expression is used twice, it will
+ be represented by the same atom. *)
+module type S = sig
+ type expr
+ (** Generic expressions. *)
+
+ type t
+ (** Abstract boolean expression. *)
+
+ val defalse : t
+ (** Reprents the [false] litteral. *)
+
+ val detrue : t
+ (** Reprents the [true] litteral. *)
+
+ val deand : t list -> t
+ (** AND operator. Removes duplicates, applies basic boolean simplifications.
+ *)
+
+ val deor : t list -> t
+ (** OR operator. Removes duplicates, applies basic boolean simplifications. *)
+
+ val denot : t -> t
+ (** NOT operator. Applies basic boolean simplifications. *)
+
+ val devar : expr -> t
+ (** An atomic expression. *)
+
+ val deite : t -> t -> t -> t
+ (** [deite c t e] Shortcut for [(c /\ t) \/ ((not c) /\ e)]. *)
+
+ val get_expr : t -> def_expr
+ (** Returns the raw definition expression. *)
+
+ val get_assoc : t -> expr AtomMap.t
+ (** Computes a map linking atoms to expressions. *)
+end
+
+module Make (OrderedExprs : sig
+ type t
+
+ val compare : t -> t -> int
+end) : S with type expr = OrderedExprs.t
+
+(** A module containing several optimisations on def expressions. *)
+module Shorten_def : sig
+ val apply : def_expr -> def_expr
+ (** Applies simple boolean simplifications. For any atom [v] and formulas [f]
+ and [g] :
+ - if [f] = [v] /\ [g], replaces occurences of [v] by [true] in [g];
+ - if [f] = [v] \/ [g], replaces occurences of [v] by [false] in [g].
+
+ This simplification is done recursively on formulas. *)
+end
diff --git a/src/mlang/backend_compilers/dgfip_compir_files.ml b/src/mlang/backend_compilers/dgfip_compir_files.ml
index d47ba2d90..14d816c2b 100644
--- a/src/mlang/backend_compilers/dgfip_compir_files.ml
+++ b/src/mlang/backend_compilers/dgfip_compir_files.ml
@@ -1,18 +1,17 @@
-(* Copyright (C) 2019 Inria, contributor: David Declerck
-
-
- This program is free software: you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free Software
- Foundation, either version 3 of the License, or (at your option) any later
- version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see . *)
+(******************************************************************************)
+(* *)
+(* Droit d'auteur (c) 2024 - 2026 DGFiP - INRIA *)
+(* *)
+(* Ce programme est distribué sous la licence CeCILL-C: vous pouvez le *)
+(* redistribuer et/ou le modifier sous les contraintes de celle-ci. *)
+(* *)
+(* L'accessibilité au code source et les droits de copie, de modification et *)
+(* de redistribution qui découlent de ce contrat ont pour contrepartie de *)
+(* n'offrir aux utilisateurs qu'une garantie limitée et de ne faire peser sur *)
+(* l'auteur du logiciel, le titulaire des droits patrimoniaux et les *)
+(* concédants successifs qu'une responsabilité restreinte. *)
+(* *)
+(******************************************************************************)
let open_file filename =
let folder = Filename.dirname !Config.output_file in
@@ -169,8 +168,8 @@ let sort_vars_by_name is_ebcdic vars =
if is_ebcdic then Strings.compare_ebcdic else Strings.compare_default
in
List.fast_sort
- (fun (_, _, _, _, name1, _, _, _, _, _) (_, _, _, _, name2, _, _, _, _, _) ->
- compare_name name1 name2)
+ (fun (_, _, _, _, name1, _, _, _, _, _) (_, _, _, _, name2, _, _, _, _, _)
+ -> compare_name name1 name2)
vars
(* Retrieve all the variables, sorted by alias, and compute their IDs *)
@@ -399,10 +398,9 @@ let gen_var fmt req_type opt ~idx ~name ~tvar ~is_output ~typ_opt ~attributes
Format.fprintf fmt ", %d" (get_attr "primrest" attributes);
if opt.with_libelle then Format.fprintf fmt ", \"%s\"" desc
else Format.fprintf fmt " /*\"%s\"*/" desc;
- begin
- match ((req_type : gen_type), tvar) with
- | Input _, Income -> Format.fprintf fmt ", \"%s\"" name
- | _ -> ()
+ begin match ((req_type : gen_type), tvar) with
+ | Input _, Income -> Format.fprintf fmt ", \"%s\"" name
+ | _ -> ()
end;
Format.fprintf fmt " },\n"
@@ -435,14 +433,13 @@ let gen_table fmt is_ebcdic vars req_type opt =
in
let table_name = req_type_name req_type in
let table_NAME = String.uppercase_ascii table_name in
- begin
- match req_type with
- | Debug _i ->
- Format.fprintf fmt "T_desc_debug desc_%s[NB_%s + 1] = {\n" table_name
- table_NAME
- | _ ->
- Format.fprintf fmt "T_desc_%s desc_%s[NB_%s + 1] = {\n" table_name
- table_name table_NAME
+ begin match req_type with
+ | Debug _i ->
+ Format.fprintf fmt "T_desc_debug desc_%s[NB_%s + 1] = {\n" table_name
+ table_NAME
+ | _ ->
+ Format.fprintf fmt "T_desc_%s desc_%s[NB_%s + 1] = {\n" table_name
+ table_name table_NAME
end;
let empty = ref true in
@@ -841,18 +838,18 @@ let gen_compir_h fmt flags vars vars_debug =
nb_restituee;
(if flags.Dgfip_options.flg_debug then
- if flags.nb_debug_c <= 0 then
- let nb = match nb_debug with [ nb ] -> nb | _ -> assert false in
- Format.fprintf fmt "#define NB_DEBUG %d\n" nb
- else
- let i =
- List.fold_left
- (fun i nb ->
- Format.fprintf fmt "#define NB_DEBUG%02d %d\n" i nb;
- i + 1)
- 1 nb_debug
- in
- assert (i = flags.nb_debug_c + 1));
+ if flags.nb_debug_c <= 0 then
+ let nb = match nb_debug with [ nb ] -> nb | _ -> assert false in
+ Format.fprintf fmt "#define NB_DEBUG %d\n" nb
+ else
+ let i =
+ List.fold_left
+ (fun i nb ->
+ Format.fprintf fmt "#define NB_DEBUG%02d %d\n" i nb;
+ i + 1)
+ 1 nb_debug
+ in
+ assert (i = flags.nb_debug_c + 1));
Format.fprintf fmt
{|
diff --git a/src/mlang/backend_compilers/dgfip_gen_files.ml b/src/mlang/backend_compilers/dgfip_gen_files.ml
index 152ddcf47..cf3ae6aca 100644
--- a/src/mlang/backend_compilers/dgfip_gen_files.ml
+++ b/src/mlang/backend_compilers/dgfip_gen_files.ml
@@ -1,18 +1,17 @@
-(* Copyright (C) 2019 Inria, contributor: David Declerck
-
-
- This program is free software: you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free Software
- Foundation, either version 3 of the License, or (at your option) any later
- version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see . *)
+(******************************************************************************)
+(* *)
+(* Droit d'auteur (c) 2021 - 2026 DGFiP - INRIA *)
+(* *)
+(* Ce programme est distribué sous la licence CeCILL-C: vous pouvez le *)
+(* redistribuer et/ou le modifier sous les contraintes de celle-ci. *)
+(* *)
+(* L'accessibilité au code source et les droits de copie, de modification et *)
+(* de redistribution qui découlent de ce contrat ont pour contrepartie de *)
+(* n'offrir aux utilisateurs qu'une garantie limitée et de ne faire peser sur *)
+(* l'auteur du logiciel, le titulaire des droits patrimoniaux et les *)
+(* concédants successifs qu'une responsabilité restreinte. *)
+(* *)
+(******************************************************************************)
let open_file filename =
let folder = Filename.dirname !Config.output_file in
@@ -375,11 +374,18 @@ let gen_dbg fmt =
{|int change_couleur(int couleur, int typographie);
int get_couleur(void);
int get_typo(void);
-
+
#ifdef FLG_TRACE
+
+#ifdef FLG_API
+#define TRACE_FILE fd_trace_dialog
+#else
+#define TRACE_FILE stderr
+#endif /* FLG_API */
+
extern int niv_trace;
-extern void aff1(char *nom);
+extern void aff1(const char *nom);
extern void aff_val(const char *nom, const T_irdata *irdata, int indice, int niv, const char *chaine, int is_tab, int expr, int maxi);
@@ -485,16 +491,19 @@ typedef struct S_ref_var T_ref_var;
Pp.fpr fmt
{|
struct S_irdata {
+ /* Les pointeurs suivants sont mis à jour à chaque changement du champ var_space */
char *def_saisie;
double *saisie;
char *def_calculee;
double *calculee;
char *def_base;
double *base;
+ T_var_space var_space_courant;
|};
IntMap.iter
(fun _ (vsd : Com.variable_space) ->
let sp = Pos.unmark vsd.vs_name in
+ Pp.fpr fmt "/* Espace de nom %s */" sp;
Pp.fpr fmt " char *def_saisie_%s;@\n" sp;
Pp.fpr fmt " double *saisie_%s;@\n" sp;
Pp.fpr fmt " char *def_calculee_%s;@\n" sp;
@@ -659,6 +668,16 @@ let gen_lib fmt (cprog : Mir.program) flags =
|}
taille_saisie taille_calculee taille_base taille_totale nb_ench;
+ Pp.fpr fmt
+ {|/* pour rétrocompatibilité avec le code C historique */
+#define NB_SAISIE %d
+#define NB_CALCULEE %d
+#define NB_BASE %d
+#define NB_TOTALE %d
+
+|}
+ taille_saisie taille_calculee taille_base taille_totale;
+
Pp.fpr fmt "#define TAILLE_TMP_VARS %d\n" cprog.program_stats.sz_all_tmps;
Pp.fpr fmt "#define TAILLE_REFS %d\n" cprog.program_stats.nb_all_refs;
Pp.fpr fmt "#define TAILLE_TAB_VARINFO %d\n"
@@ -736,15 +755,22 @@ extern void nettoie_erreurs_finalisees _PROTS((T_irdata *irdata ));
extern void exporte_erreur _PROTS((T_irdata *irdata ));
extern T_irdata *cree_irdata(void);
-extern void init_saisie(T_irdata *irdata, int sp);
-extern void init_calculee(T_irdata *irdata, int sp);
-extern void init_base(T_irdata *irdata, int sp);
+extern void change_var_space_courant(T_irdata *irdata, int var_space);
+extern void init_saisie_spc(T_irdata *irdata, int sp);
+extern void init_calculee_spc(T_irdata *irdata, int sp);
+extern void init_base_spc(T_irdata *irdata, int sp);
+extern void init_saisie(T_irdata *irdata);
+extern void init_calculee(T_irdata *irdata);
+extern void init_base(T_irdata *irdata);
extern void init_erreur(T_irdata *irdata);
extern void detruis_irdata(T_irdata *irdata);
extern void set_max_bloquantes(T_irdata *irdata, const int max_ano);
-extern void recopie_saisie(T_irdata *irdata_src, int sp_src, T_irdata *irdata_dst, int sp_dst);
-extern void recopie_calculee(T_irdata *irdata_src, int sp_src, T_irdata *irdata_dst, int sp_dst);
-extern void recopie_base(T_irdata *irdata_src, int sp_src, T_irdata *irdata_dst, int sp_dst);
+extern void recopie_saisie_spc(T_irdata *irdata_src, int sp_src, T_irdata *irdata_dst, int sp_dst);
+extern void recopie_calculee_spc(T_irdata *irdata_src, int sp_src, T_irdata *irdata_dst, int sp_dst);
+extern void recopie_base_spc(T_irdata *irdata_src, int sp_src, T_irdata *irdata_dst, int sp_dst);
+extern void recopie_saisie(T_irdata *irdata_src, T_irdata *irdata_dst);
+extern void recopie_calculee(T_irdata *irdata_src, T_irdata *irdata_dst);
+extern void recopie_base(T_irdata *irdata_src, T_irdata *irdata_dst);
extern void ecris_saisie(T_irdata *irdata, int idx, char def, double val);
extern void ecris_calculee(T_irdata *irdata, int idx, char def, double val);
extern void ecris_base(T_irdata *irdata, int idx, char def, double val);
@@ -873,36 +899,35 @@ let gen_decl_targets fmt (cprog : Mir.program) =
let gen_mlang_h fmt cprog flags stats_varinfos =
let pr form = Pp.fpr fmt form in
- pr "/****** LICENCE CECIL *****/\n\n";
- pr "#ifndef _MLANG_H_\n";
- pr "#define _MLANG_H_\n";
- pr "\n";
- pr "#include \n";
- pr "#include \n";
- pr "#include \n";
- pr "#include \n";
- pr "#include \n";
- pr "#include \n";
- pr "\n";
- pr "#include \"conf.h\"\n";
- pr "\n";
- pr "#define _PROTS(X) X\n";
- pr "\n";
- pr "#define ANNEE_REVENU %04d\n" flags.Dgfip_options.annee_revenu;
- pr "\n";
+ pr "/****** LICENCE CECIL *****/\n@.";
+ pr "#ifndef _MLANG_H_@.";
+ pr "#define _MLANG_H_@.@.";
+ pr "#include @.";
+ pr "#include @.";
+ pr "#include @.";
+ pr "#include @.";
+ pr "#include @.";
+ pr "#include @.";
+ pr "@.";
+ pr "#include \"conf.h\"@.";
+ pr "@.";
+ pr "#define _PROTS(X) X@.";
+ pr "@.";
+ pr "#define ANNEE_REVENU %04d@." flags.Dgfip_options.annee_revenu;
+ pr "@.";
gen_decl_varinfos fmt cprog stats_varinfos;
- pr "\n";
+ pr "@.";
gen_const fmt cprog;
- pr "\n";
+ pr "@.";
(* The debug functions need T_irdata to be defined so we put them after *)
gen_dbg fmt;
- pr "\n";
+ pr "@.";
gen_lib fmt cprog flags;
- pr "\n";
+ pr "@.";
gen_decl_functions fmt cprog;
- pr "\n";
+ pr "@.";
gen_decl_targets fmt cprog;
- pr "#endif /* _MLANG_H_ */\n\n"
+ pr "@.#endif /* _MLANG_H_ */@."
let gen_mlang_c fmt (cprog : Mir.program) flags =
Pp.fpr fmt "%s"
@@ -1311,40 +1336,52 @@ static void init_tab(char *p_def, double *p_val, int nb) {
memset(p_def, 0, nb);
}
-void init_saisie(T_irdata *irdata, int sp) {
+void init_saisie_espace(char *def, double *val) {
+ if (def == NULL || val == NULL) return;
+ init_tab(def, val, TAILLE_SAISIE);
+}
+
+void init_calculee_espace(char *def, double *val) {
+ if (def == NULL || val == NULL) return;
+ init_tab(def, val, TAILLE_CALCULEE);
+}
+
+void init_base_espace(char *def, double *val) {
+ if (def == NULL || val == NULL) return;
+ init_tab(def, val, TAILLE_BASE);
+}
+
+void init_saisie_spc(T_irdata *irdata, int sp) {
if (irdata == NULL) return;
if (sp < 0 || NB_ESPACES_VARIABLES <= sp) sp = ESPACE_PAR_DEFAUT;
if (irdata->var_spaces[sp].saisie == NULL) return;
init_tab(irdata->var_spaces[sp].def_saisie, irdata->var_spaces[sp].saisie, TAILLE_SAISIE);
}
-void init_saisie_espace(char *def, double *val) {
- if (def == NULL || val == NULL) return;
- init_tab(def, val, TAILLE_SAISIE);
-}
-
-void init_calculee(T_irdata *irdata, int sp) {
+void init_calculee_spc(T_irdata *irdata, int sp) {
if (irdata == NULL) return;
if (sp < 0 || NB_ESPACES_VARIABLES <= sp) sp = ESPACE_PAR_DEFAUT;
if (irdata->var_spaces[sp].calculee == NULL) return;
init_tab(irdata->var_spaces[sp].def_calculee, irdata->var_spaces[sp].calculee, TAILLE_CALCULEE);
}
-void init_calculee_espace(char *def, double *val) {
- if (def == NULL || val == NULL) return;
- init_tab(def, val, TAILLE_CALCULEE);
-}
-
-void init_base(T_irdata *irdata, int sp) {
+void init_base_spc(T_irdata *irdata, int sp) {
if (irdata == NULL) return;
if (sp < 0 || NB_ESPACES_VARIABLES <= sp) sp = ESPACE_PAR_DEFAUT;
if (irdata->var_spaces[sp].base == NULL) return;
init_tab(irdata->var_spaces[sp].def_base, irdata->var_spaces[sp].base, TAILLE_BASE);
}
-void init_base_espace(char *def, double *val) {
- if (def == NULL || val == NULL) return;
- init_tab(def, val, TAILLE_BASE);
+void init_saisie(T_irdata *irdata) {
+ init_saisie_spc(irdata, ESPACE_PAR_DEFAUT);
+}
+
+void init_calculee(T_irdata *irdata) {
+ init_calculee_spc(irdata, ESPACE_PAR_DEFAUT);
+}
+
+void init_base(T_irdata *irdata) {
+ init_base_spc(irdata, ESPACE_PAR_DEFAUT);
}
void init_erreur(T_irdata *irdata) {
@@ -1423,6 +1460,18 @@ void detruis_irdata(T_irdata *irdata) {
free(irdata);
}
+void change_var_space_courant (T_irdata *irdata, int var_space){
+ T_var_space var_space_courant = irdata->var_spaces[var_space];
+ irdata->var_space = var_space;
+ irdata->var_space_courant = var_space_courant;
+ irdata->def_saisie = var_space_courant.def_saisie;
+ irdata->saisie = var_space_courant.saisie;
+ irdata->def_calculee = var_space_courant.def_calculee;
+ irdata->calculee = var_space_courant.calculee;
+ irdata->def_base = var_space_courant.def_base;
+ irdata->base = var_space_courant.base;
+}
+
T_irdata *cree_irdata(void) {
T_irdata *irdata = NULL;
@@ -1480,7 +1529,7 @@ T_irdata *cree_irdata(void) {
id sp;
Pp.fpr fmt " irdata->var_spaces[%d].base = irdata->base_%s;@\n" id sp)
cprog.program_var_spaces_idx;
- Pp.fpr fmt " irdata->var_space = ESPACE_PAR_DEFAUT;\n";
+ Pp.fpr fmt " change_var_space_courant(irdata, ESPACE_PAR_DEFAUT);\n";
Pp.fpr fmt "%s"
{| irdata->tmps = NULL;
if (TAILLE_TMP_VARS > 0) {
@@ -1533,7 +1582,7 @@ void set_max_bloquantes(T_irdata *irdata, const int max_ano) {
}
}
-void recopie_saisie(T_irdata *irdata_src, int sp_src, T_irdata *irdata_dst, int sp_dst) {
+void recopie_saisie_spc(T_irdata *irdata_src, int sp_src, T_irdata *irdata_dst, int sp_dst) {
if (irdata_src == NULL || irdata_dst == NULL) return;
if (0 < sp_src || sp_src <= NB_ESPACES_VARIABLES) sp_src = ESPACE_PAR_DEFAUT;
if (0 < sp_dst || sp_dst <= NB_ESPACES_VARIABLES) sp_dst = ESPACE_PAR_DEFAUT;
@@ -1552,7 +1601,7 @@ void recopie_saisie(T_irdata *irdata_src, int sp_src, T_irdata *irdata_dst, int
);
}
-void recopie_calculee(T_irdata *irdata_src, int sp_src, T_irdata *irdata_dst, int sp_dst) {
+void recopie_calculee_spc(T_irdata *irdata_src, int sp_src, T_irdata *irdata_dst, int sp_dst) {
if (irdata_src == NULL || irdata_dst == NULL) return;
if (0 < sp_src || sp_src <= NB_ESPACES_VARIABLES) sp_src = ESPACE_PAR_DEFAUT;
if (0 < sp_dst || sp_dst <= NB_ESPACES_VARIABLES) sp_dst = ESPACE_PAR_DEFAUT;
@@ -1571,7 +1620,7 @@ void recopie_calculee(T_irdata *irdata_src, int sp_src, T_irdata *irdata_dst, in
);
}
-void recopie_base(T_irdata *irdata_src, int sp_src, T_irdata *irdata_dst, int sp_dst) {
+void recopie_base_spc(T_irdata *irdata_src, int sp_src, T_irdata *irdata_dst, int sp_dst) {
if (irdata_src == NULL || irdata_dst == NULL) return;
if (0 < sp_src || sp_src <= NB_ESPACES_VARIABLES) sp_src = ESPACE_PAR_DEFAUT;
if (0 < sp_dst || sp_dst <= NB_ESPACES_VARIABLES) sp_dst = ESPACE_PAR_DEFAUT;
@@ -1590,6 +1639,18 @@ void recopie_base(T_irdata *irdata_src, int sp_src, T_irdata *irdata_dst, int sp
);
}
+void recopie_saisie(T_irdata *irdata_src, T_irdata *irdata_dst) {
+ recopie_saisie_spc(irdata_src, ESPACE_PAR_DEFAUT, irdata_dst, ESPACE_PAR_DEFAUT);
+}
+
+void recopie_calculee(T_irdata *irdata_src, T_irdata *irdata_dst) {
+ recopie_calculee_spc(irdata_src, ESPACE_PAR_DEFAUT, irdata_dst, ESPACE_PAR_DEFAUT);
+}
+
+void recopie_base(T_irdata *irdata_src, T_irdata *irdata_dst) {
+ recopie_base_spc(irdata_src, ESPACE_PAR_DEFAUT, irdata_dst, ESPACE_PAR_DEFAUT);
+}
+
static void ecris_tab(char *t_def, double *t_val, int t_nb, int idx, char def, double val) {
if (t_val == NULL || t_def == NULL || idx < 0 || t_nb <= idx) return;
if (def == 0) t_def[idx] = 0;
@@ -2065,12 +2126,99 @@ double *lis_tabaccess_val_ptr(
return lis_varinfo_val_ptr(irdata, var_space, info);
}
+void trace_tabaccess(
+ const char *chaine, int niv,
+ T_irdata *irdata, int var_space, int idx_tab,
+ char idx_def, double idx_val
+) {
+#ifdef FLG_TRACE
+ T_varinfo *info = NULL;
+ int idx = (int)idx_val;
+ char res_def = 0;
+ double res_val = 0.0;
+ char *nom = NULL;
+
+ if (irdata == NULL || idx_tab < 0 || TAILLE_TAB_VARINFO <= idx_tab) return;
+ info = tab_varinfo[idx_tab];
+ nom = info->name;
+
+ if (idx_def == 0) {
+ if (niv_trace >= niv) {
+#ifdef FLG_COLORS
+ fprintf(TRACE_FILE, "\033[%d;%dm%s[undef] %s 0\033[0m\n",
+ color, typo, nom, chaine);
+#else
+ fprintf(TRACE_FILE, "%s[undef] %s 0m\n", nom, chaine);
+#endif /* FLG_COLORS */
+ }
+ return;
+ } else if (idx < 0) {
+ if (niv_trace >= niv) {
+#ifdef FLG_COLORS
+ fprintf(TRACE_FILE, "\033[%d;%dm%s[%d] %s 0\033[0m\n",
+ color, typo, nom, idx, chaine);
+#else
+ fprintf(TRACE_FILE, "%s[%d] %s 0m\n", nom, idx, chaine);
+#endif /* FLG_COLORS */
+ }
+ return;
+ } else if (idx >= info->size) {
+#ifdef FLG_COLORS
+ fprintf(TRACE_FILE,
+ "\033[%d;%dmerreur: indice (%d) superieur au maximum (%d)\033[0m\n",
+ color, typo, idx, info->size);
+#else
+ fprintf(TRACE_FILE, "erreur: indice (%d) superieur au maximum (%d)\n",
+ idx, info->size);
+#endif /* FLG_COLORS */
+ idx = 0;
+ }
+
+ info = tab_varinfo[idx_tab + idx + 1];
+ lis_varinfo(irdata, var_space, info, &res_def, &res_val);
+ if (res_def == 0) {
+ if (res_val != 0.0) {
+#ifdef FLG_COLORS
+ fprintf(TRACE_FILE, "\033[%d;%dm%s[%d] : erreur undef = %lf\033[0m\n",
+ color, typo, nom, idx, res_val);
+#else
+ fprintf(TRACE_FILE, "%s[%d] : erreur undef = %lf\n", nom, idx, res_val);
+#endif /* FLG_COLORS */
+ } else if (niv_trace >= niv) {
+#ifdef FLG_COLORS
+ fprintf(TRACE_FILE, "\033[%d;%dm%s[%d] %s undef\033[0m\n",
+ color, typo, nom, idx, chaine);
+#else
+ fprintf(TRACE_FILE, "%s[%d] %s undef\n", nom, idx, chaine);
+#endif /* FLG_COLORS */
+ }
+ } else if (res_def != 1) {
+#ifdef FLG_COLORS
+ fprintf(TRACE_FILE, "\033[%d;%dm%s[%d] : erreur flag def = %d\033[0m\n",
+ color, typo, nom, idx, res_def);
+#else
+ fprintf(TRACE_FILE, "%s[%d] : erreur flag def = %d\n", nom, idx, res_def);
+#endif /* FLG_COLORS */
+ } else if (niv_trace >= niv) {
+#ifdef FLG_COLORS
+ fprintf(TRACE_FILE, "\033[%d;%dm%s[%d] %s %lf\033[0m\n",
+ color, typo, nom, idx, chaine, res_val);
+#else
+ fprintf(TRACE_FILE, "%s[%d] %s %lf\n", nom, idx, chaine, res_val);
+#endif /* FLG_COLORS */
+ }
+#endif /* FLG_TRACE */
+}
+
char lis_tabaccess(
T_irdata *irdata, int var_space, int idx_tab,
char idx_def, double idx_val,
char *res_def, double *res_val
) {
T_varinfo *info = lis_tabaccess_varinfo(irdata, idx_tab, idx_def, idx_val);
+#ifdef FLG_TRACE
+ trace_tabaccess(":", 3, irdata, var_space, idx_tab, idx_def, idx_val);
+#endif /* FLG_TRACE */
int idx = 0;
if (info == NULL) {
*res_val = 0.0;
@@ -2106,6 +2254,9 @@ void ecris_tabaccess(
) {
T_varinfo *info = lis_tabaccess_varinfo(irdata, idx_tab, idx_def, idx_val);
ecris_varinfo(irdata, var_space, info, def, val);
+#ifdef FLG_TRACE
+ trace_tabaccess("<-", 2, irdata, var_space, idx_tab, idx_def, idx_val);
+#endif /* FLG_TRACE */
/* tableau originel */
/*ecris_varinfo_tab(irdata, var_space, idx_tab, idx_def, idx_val, def, val);*/
}
@@ -2205,15 +2356,7 @@ char est_type(T_varinfo *info, int type, char *res_def, double *res_val) {
/* int niv_trace = 3; */
-#ifdef FLG_API
-#define TRACE_FILE fd_trace_dialog
-#else
-#define TRACE_FILE stderr
-#endif /* FLG_API */
-
-void aff1(nom)
-char *nom ;
-{
+void aff1(const char *nom) {
#ifdef FLG_COLORS
if (niv_trace >= 1) fprintf(stderr, "\033[%d;%dm%s\033[0m", color, typo, nom) ;
#else
diff --git a/src/mlang/backend_compilers/dgfip_varid.ml b/src/mlang/backend_compilers/dgfip_varid.ml
index 48ca81ce1..627bf397e 100644
--- a/src/mlang/backend_compilers/dgfip_varid.ml
+++ b/src/mlang/backend_compilers/dgfip_varid.ml
@@ -1,21 +1,22 @@
-(* Copyright (C) 2019 Inria, contributor: David Declerck
-
-
- This program is free software: you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free Software
- Foundation, either version 3 of the License, or (at your option) any later
- version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see . *)
+(******************************************************************************)
+(* *)
+(* Droit d'auteur (c) 2021 - 2026 DGFiP - INRIA *)
+(* *)
+(* Ce programme est distribué sous la licence CeCILL-C: vous pouvez le *)
+(* redistribuer et/ou le modifier sous les contraintes de celle-ci. *)
+(* *)
+(* L'accessibilité au code source et les droits de copie, de modification et *)
+(* de redistribution qui découlent de ce contrat ont pour contrepartie de *)
+(* n'offrir aux utilisateurs qu'une garantie limitée et de ne faire peser sur *)
+(* l'auteur du logiciel, le titulaire des droits patrimoniaux et les *)
+(* concédants successifs qu'une responsabilité restreinte. *)
+(* *)
+(******************************************************************************)
(* TGV variables accessors *)
+type varinfo = Com.Var.t
+
let gen_tab = function
| Com.CatVar.LocInput -> "saisie"
| Com.CatVar.LocComputed -> "calculee"
@@ -28,8 +29,9 @@ let gen_tgv_def (m_sp_opt : Com.var_space) (l : Com.loc_tgv) vn =
let sp = Com.get_normal_var @@ Pos.unmark m_sp in
Pp.spr "(irdata->def_%s_%s[%d/*%s*/])" tab sp l.loc_idx vn
| None ->
- Pp.spr "(irdata->var_spaces[irdata->var_space].def_%s[%d/*%s*/])" tab
- l.loc_idx vn
+ if Utils.Config.optim_local_var_for_arrays () then
+ Pp.spr "(def_%s[%d/*%s*/])" tab l.loc_idx vn
+ else Pp.spr "(irdata->def_%s[%d/*%s*/])" tab l.loc_idx vn
let gen_tgv_val (m_sp_opt : Com.var_space) (l : Com.loc_tgv) vn =
let tab = gen_tab l.loc_cat in
@@ -38,8 +40,9 @@ let gen_tgv_val (m_sp_opt : Com.var_space) (l : Com.loc_tgv) vn =
let sp = Com.get_normal_var @@ Pos.unmark m_sp in
Pp.spr "(irdata->%s_%s[%d/*%s*/])" tab sp l.loc_idx vn
| None ->
- Pp.spr "(irdata->var_spaces[irdata->var_space].%s[%d/*%s*/])" tab
- l.loc_idx vn
+ if Utils.Config.optim_local_var_for_arrays () then
+ Pp.spr "(%s[%d/*%s*/])" tab l.loc_idx vn
+ else Pp.spr "(irdata->%s[%d/*%s*/])" tab l.loc_idx vn
let gen_tgv_def_ptr (m_sp_opt : Com.var_space) (l : Com.loc_tgv) vn =
Pp.spr "&%s" (gen_tgv_def m_sp_opt l vn)
@@ -160,6 +163,22 @@ let gen_var_space_id_opt = function
| None -> "(irdata->var_space)"
| Some (_, i_sp) -> Pp.spr "%d" i_sp
+let gen_var_space = function
+ | None -> "(irdata->current_var_space)"
+ | Some (_, i_sp) -> Pp.spr "irdata->var_spaces[%d]" i_sp
+
+let gen_var_space_var (m_sp_opt : Com.var_space) (v : Com.Var.t) =
+ match v.loc with
+ | LocTgv _ | LocTmp _ -> gen_var_space m_sp_opt
+ | LocRef (_, i) -> (
+ match m_sp_opt with
+ | None ->
+ Pp.spr
+ "(irdata->var_spaces[irdata->refs[irdata->refs_org + \
+ %d].var_space])"
+ i
+ | Some (_, i_sp) -> Pp.spr "irdata->var_spaces[%d]" i_sp)
+
let gen_var_space_id (m_sp_opt : Com.var_space) (v : Com.Var.t) =
match v.loc with
| LocTgv _ | LocTmp _ -> gen_var_space_id_opt m_sp_opt
@@ -167,3 +186,11 @@ let gen_var_space_id (m_sp_opt : Com.var_space) (v : Com.Var.t) =
match m_sp_opt with
| None -> Pp.spr "(irdata->refs[irdata->refs_org + %d].var_space)" i
| Some (_, i_sp) -> Pp.spr "%d" i_sp)
+
+let gen_typ = function
+ | Com.Boolean -> "TYPE_BOOLEEN"
+ | DateYear -> "TYPE_DATE_AAAA"
+ | DateDayMonthYear -> "TYPE_DATE_JJMMAAAA"
+ | DateMonth -> "TYPE_DATE_MM"
+ | Integer -> "TYPE_ENTIER"
+ | Real -> "TYPE_REEL"
diff --git a/src/mlang/backend_compilers/dune b/src/mlang/backend_compilers/dune
index 6868f596b..b82e88022 100644
--- a/src/mlang/backend_compilers/dune
+++ b/src/mlang/backend_compilers/dune
@@ -3,4 +3,4 @@
(public_name mlang.backend_compilers)
(flags
(:standard -open Utils -open M_ir -open M_frontend))
- (libraries m_frontend m_ir utils menhirLib parmap))
+ (libraries m_frontend m_ir m_interpreter utils menhirLib parmap))
diff --git a/src/mlang/backend_compilers/prelude.ml b/src/mlang/backend_compilers/prelude.ml
index c593edd7e..69e649ee2 100644
--- a/src/mlang/backend_compilers/prelude.ml
+++ b/src/mlang/backend_compilers/prelude.ml
@@ -1,17 +1,16 @@
-(* Copyright (C) 2019-2021 Inria, contributor: Denis Merigoux
-
-
- This program is free software: you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free Software
- Foundation, either version 3 of the License, or (at your option) any later
- version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see . *)
+(******************************************************************************)
+(* *)
+(* Droit d'auteur (c) 2019 - 2026 DGFiP - INRIA *)
+(* *)
+(* Ce programme est distribué sous la licence CeCILL-C: vous pouvez le *)
+(* redistribuer et/ou le modifier sous les contraintes de celle-ci. *)
+(* *)
+(* L'accessibilité au code source et les droits de copie, de modification et *)
+(* de redistribution qui découlent de ce contrat ont pour contrepartie de *)
+(* n'offrir aux utilisateurs qu'une garantie limitée et de ne faire peser sur *)
+(* l'auteur du logiciel, le titulaire des droits patrimoniaux et les *)
+(* concédants successifs qu'une responsabilité restreinte. *)
+(* *)
+(******************************************************************************)
let message : string = Format.asprintf "File generated by the Mlang compiler"
diff --git a/src/mlang/driver.ml b/src/mlang/driver.ml
index 08c77b19e..41e3306d4 100644
--- a/src/mlang/driver.ml
+++ b/src/mlang/driver.ml
@@ -1,140 +1,102 @@
-(* Copyright (C) 2019-2021 Inria, contributor: Denis Merigoux
-
-
- This program is free software: you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free Software
- Foundation, either version 3 of the License, or (at your option) any later
- version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see . *)
+(******************************************************************************)
+(* *)
+(* Droit d'auteur (c) 2019 - 2026 DGFiP - INRIA *)
+(* *)
+(* Ce programme est distribué sous la licence CeCILL-C: vous pouvez le *)
+(* redistribuer et/ou le modifier sous les contraintes de celle-ci. *)
+(* *)
+(* L'accessibilité au code source et les droits de copie, de modification et *)
+(* de redistribution qui découlent de ce contrat ont pour contrepartie de *)
+(* n'offrir aux utilisateurs qu'une garantie limitée et de ne faire peser sur *)
+(* l'auteur du logiciel, le titulaire des droits patrimoniaux et les *)
+(* concédants successifs qu'une responsabilité restreinte. *)
+(* *)
+(******************************************************************************)
open Backend_compilers
open Irj_utils
-open Lexing
open M_ir
open M_frontend
-open Mlexer
exception Exit
-(* The legacy compiler plays a nasty trick on us, that we have to reproduce:
- rule 1 is modified to add assignments to APPLI_XXX variables according to the
- target application (OCEANS, BATCH and ILIAD). *)
-let patch_rule_1 (backend : Config.backend) (dgfip_flags : Dgfip_options.flags)
- (program : Mast.program) : Mast.program =
- let open Mast in
- let var_exists name =
- List.exists
- (List.exists (fun m_item ->
- match Pos.unmark m_item with
- | VariableDecl (ComputedVar m_cv) ->
- Pos.unmark (Pos.unmark m_cv).comp_name = name
- | VariableDecl (InputVar m_iv) ->
- Pos.unmark (Pos.unmark m_iv).input_name = name
- | _ -> false))
- program
- in
- let mk_assign name value l =
- if var_exists name then
- let m_access =
- Pos.without (Com.VarAccess (None, Pos.without (Com.Normal name)))
- in
- let litt = Com.Literal (Com.Float (if value then 1.0 else 0.0)) in
- let cmd = Com.SingleFormula (VarDecl (m_access, Pos.without litt)) in
- Pos.without cmd :: l
- else l
- in
- let oceans, batch, iliad =
- match backend with
- | Dgfip_c ->
- (dgfip_flags.flg_cfir, dgfip_flags.flg_gcos, dgfip_flags.flg_iliad)
- | UnknownBackend -> (false, false, true)
- in
- List.map
- (List.map (fun m_item ->
- match Pos.unmark m_item with
- | Rule r when Pos.unmark r.rule_number = 1 ->
- let fl =
- List.map
- (fun f -> Pos.same (Com.Affectation f) f)
- ([]
- |> mk_assign "APPLI_OCEANS" oceans
- |> mk_assign "APPLI_BATCH" batch
- |> mk_assign "APPLI_ILIAD" iliad)
- in
- let r' = { r with rule_formulaes = r.rule_formulaes @ fl } in
- Pos.same (Rule r') m_item
- | _ -> m_item))
- program
-
-let parse () =
- let current_progress, finish = Cli.create_progress_bar "Parsing" in
-
- let parse filebuf source_file =
- current_progress source_file;
- let lex_curr_p = { filebuf.lex_curr_p with pos_fname = source_file } in
- let filebuf = { filebuf with lex_curr_p } in
- match Mparser.source_file token filebuf with
- | commands -> commands
- | exception Mparser.Error ->
- Errors.raise_spanned_error "M syntax error"
- (Parse_utils.mk_position (filebuf.lex_start_p, filebuf.lex_curr_p))
- in
-
- let parse_file source_file =
- let input = open_in source_file in
- let filebuf = Lexing.from_channel input in
- try
- parse filebuf source_file
- (* We're catching exceptions to properly close the input channel *)
- with Errors.StructuredError _ as e ->
- close_in input;
- raise e
- in
-
- let parse_m_dgfip m_program =
- if !Config.without_dgfip_m then m_program
- else
- let parse_internal str =
- let filebuf = Lexing.from_string str in
- let source_file = Dgfip_m.internal_m in
- parse filebuf source_file
- in
- let decs = parse_internal Dgfip_m.declarations in
- let events = parse_internal Dgfip_m.event_declaration in
- events :: decs :: m_program
- in
-
- let parse_m_files m_program =
- let parse_file_progress source_file =
- current_progress source_file;
- parse_file source_file
+module Err = struct
+ type driver_error =
+ | Cmdline_arg_parsing_failed
+ | Missing_output
+ | Term_eval_error
+ | Uncaught_exception
+ | Unknown_backend
+
+ type t = Config of Config.Err.t | Driver of driver_error
+
+ let treat_config_error (e : Config.Err.t) : string =
+ let open M_messages.Config in
+ match e with
+ | Config Option_mpp_function_required -> option_mpp_function_required
+ | Config (Invalid_precision_option precision) ->
+ invalid_precision_option ~precision
+ | Config (Invalid_long_size long_size) -> invalid_long_size ~long_size
+ | Config (Invalid_message_format message_format) ->
+ invalid_message_format ~message_format
+ | Config (Invalid_roundops_option roundops) ->
+ invalid_roundops_option ~roundops
+ | Config Unspecified_roundops -> unspecified_roundops
+ | Config No_m_files -> no_m_files
+ | Config Cannot_display_time_and_force_nondeterministic_display ->
+ cannot_display_time_and_force_nondeterminism
+ | Dgfip DGFiP_backend_without_DGFiP_options ->
+ dgfip_backend_without_dgfip_options
+ | Dgfip Invalid_term_in_dgfip_options -> invalid_term_in_dgfip_options
+ | Dgfip Failed_parsing_of_dgfip_options -> failed_parsing_of_dgfip_options
+ | Dgfip Uncaught_exception_while_reading_dgfip_options ->
+ uncaught_exception_while_reading_dgfip_options
+
+ let treat_driver_error (e : driver_error) : string =
+ let open M_messages.Driver in
+ match e with
+ | Cmdline_arg_parsing_failed -> cmdline_arg_parsing_failed
+ | Missing_output -> missing_output
+ | Term_eval_error -> term_eval_error
+ | Uncaught_exception -> uncaught_exception
+ | Unknown_backend -> unknown_backend
+
+ let raise t =
+ let msg =
+ match t with
+ | Config c -> treat_config_error c
+ | Driver d -> treat_driver_error d
in
- (*FIXME: use a fold here *)
- let prog =
- List.map parse_file_progress @@ Config.get_files !Config.source_files
- in
- List.rev prog @ m_program
- in
-
- let m_program =
- [] |> parse_m_dgfip |> parse_m_files |> List.rev
- |> patch_rule_1 !Config.backend !Config.dgfip_flags
- in
- finish "completed!";
- m_program
+ Errors.raise_error msg
+end
+
+let process_dgfip_options (backend : Config.backend)
+ ~(application_names : string list) (dgfip_options : string list option) =
+ match backend with
+ | Dgfip_c -> begin
+ match dgfip_options with
+ | None ->
+ Ppf.error_print
+ "when using the DGFiP backend, DGFiP options MUST be provided";
+ raise Exit
+ | Some options -> begin
+ match
+ Dgfip_options.process_dgfip_options ~application_names options
+ with
+ | Ok (`Ok flags) -> flags
+ | Ok _ -> assert false
+ | Error _ ->
+ Ppf.error_print "parsing of DGFiP options failed, aborting";
+ raise Exit
+ end
+ end
+ | UnknownBackend -> Dgfip_options.default_flags
let run_single_test m_program test =
- Mir_interpreter.repl_debug := true;
+ M_interpreter.Eval.repl_debug := true;
Test_interpreter.check_one_test m_program test !Config.value_sort
!Config.round_ops;
- Cli.result_print "Test passed!"
+ Ppf.result_str M_messages.Driver.test_passed
let run_multiple_tests m_program tests =
let filter_function =
@@ -146,36 +108,41 @@ let run_multiple_tests m_program tests =
!Config.round_ops filter_function
let extract m_program =
- Cli.debug_print "Extracting the desired function from the whole program...";
+ Ppf.debug_print "Extracting the desired function from the whole program...";
match !Config.backend with
| Config.Dgfip_c ->
- Cli.debug_print "Compiling the codebase to DGFiP C...";
- if !Config.output_file = "" then
- Errors.raise_error "an output file must be defined with --output";
+ Ppf.debug_print "Compiling the codebase to DGFiP C...";
+ if !Config.output_file = "" then Err.raise @@ Driver Missing_output;
Dgfip_gen_files.generate_auxiliary_files !Config.dgfip_flags m_program;
Bir_to_dgfip_c.generate_c_program !Config.dgfip_flags m_program
!Config.output_file;
- Cli.debug_print "Result written to %s" !Config.output_file
- | UnknownBackend -> Errors.raise_error "No backend specified!"
+ Ppf.debug_print "Result written to %s" !Config.output_file
+ | UnknownBackend -> Err.raise @@ Driver Unknown_backend
+
+let unsafe_driver () =
+ Ppf.debug_print "Reading M files...";
+ let progress_bar = Ppf.create_progress_bar "Parsing" in
+ let files = Config.get_files !Config.source_files in
+ let m_program = Parsing.parse files progress_bar in
+ Ppf.debug_print "Elaborating...";
+ let m_program = Expander.proceed m_program in
+ let m_program = Validator.proceed !Config.mpp_function m_program in
+ let m_program = Mast_to_mir.translate m_program in
+ let m_program = Mir.expand_functions m_program in
+ Ppf.debug_print "Creating combined program suitable for execution...";
+ match !Config.execution_mode with
+ | SingleTest test -> run_single_test m_program test
+ | MultipleTests tests -> run_multiple_tests m_program tests
+ | Extraction -> extract m_program
let driver () =
- try
- Cli.debug_print "Reading M files...";
- let m_program = parse () in
- Cli.debug_print "Elaborating...";
- let m_program = Expander.proceed m_program in
- let m_program = Validator.proceed !Config.mpp_function m_program in
- let m_program = Mast_to_mir.translate m_program in
- let m_program = Mir.expand_functions m_program in
- Cli.debug_print "Creating combined program suitable for execution...";
- match !Config.execution_mode with
- | SingleTest test -> run_single_test m_program test
- | MultipleTests tests -> run_multiple_tests m_program tests
- | Extraction -> extract m_program
- with Errors.StructuredError (msg, pos_list, kont) as e ->
- Cli.error_print "%a" Errors.format_structured_error (msg, pos_list);
- (match kont with None -> () | Some kont -> kont ());
- raise e
+ try unsafe_driver () with
+ | M_frontend.Parse_utils.Parsing_error { msg; pos } ->
+ Errors.raise_spanned_error msg pos
+ | Errors.BlockingError { raised_in; error_message = _ } ->
+ (* Error message should be printed by the module raising the error *)
+ Ppf.error_print "%s"
+ @@ M_messages.Driver.blocking_error_raised_in raised_in
let set_opts (files : string list) (application_names : string list)
(without_dgfip_m : bool) (debug : bool) (var_info_debug : string list)
@@ -186,12 +153,22 @@ let set_opts (files : string list) (application_names : string list)
(precision : string option) (roundops : string option)
(comparison_error_margin : float option) (income_year : int)
(m_clean_calls : bool) (dgfip_options : string list option)
- (no_nondet_display : bool) =
+ (no_nondet_display : bool) (plain_output : bool) (trace : bool)
+ (trace_output_file : string option) (message_format : Config.message_format)
+ (optims : Config.optim list)
+ (var_defs : (string * float option option) list) =
+ begin match (trace, trace_output_file) with
+ | false, Some _ ->
+ Ppf.warning_print
+ "trace_output_file has been given, but tracing has not been set."
+ | _, _ -> ()
+ end;
Config.set_opts ~files ~application_names ~without_dgfip_m ~debug
~var_info_debug ~display_time ~print_cycles ~backend ~output ~run_tests
~dgfip_test_filter ~run_test ~mpp_function ~optimize_unsafe_float ~precision
~roundops ~comparison_error_margin ~income_year ~m_clean_calls
- ~dgfip_options ~no_nondet_display
+ ~dgfip_options ~no_nondet_display ~plain_output ~trace ~trace_output_file
+ ~message_format ~optims ~var_defs
let run () =
let eval_cli =
@@ -200,16 +177,14 @@ let run () =
match eval_cli with
| Ok `Help | Ok `Version | Ok (`Ok `Displayed_dgfip_help) -> ()
| Ok (`Ok `Run) -> driver ()
- | Ok (`Ok (`Error m)) -> Errors.raise_error m
- | Error `Exn ->
- Errors.raise_error
- "Uncaught exception while reading command line arguments"
- | Error `Parse -> Errors.raise_error "Parsing command line arguments failed"
- | Error `Term -> Errors.raise_error "Term evaluation error"
+ | Ok (`Ok (`Error m)) -> Err.(raise (Config m))
+ | Error `Exn -> Err.(raise @@ Driver Uncaught_exception)
+ | Error `Parse -> Err.(raise @@ Driver Cmdline_arg_parsing_failed)
+ | Error `Term -> Err.(raise @@ Driver Term_eval_error)
let main () =
try run ()
- with Errors.StructuredError (msg, pos_list, kont) as e ->
- Cli.error_print "%a" Errors.format_structured_error (msg, pos_list);
+ with Errors.StructuredError (msg, kont) as e ->
+ Ppf.error_print "%a" Ppf.format_structured_message msg;
(match kont with None -> () | Some kont -> kont ());
raise e
diff --git a/src/mlang/dune b/src/mlang/dune
index 0e489f79d..fef472719 100644
--- a/src/mlang/dune
+++ b/src/mlang/dune
@@ -3,7 +3,8 @@
(flags
(:standard -open Utils))
(libraries re ANSITerminal parmap cmdliner threads dune-build-info num gmp
- menhirLib m_frontend m_ir irj_utils backend_compilers))
+ menhirLib m_frontend m_ir irj_utils backend_compilers ocamlgraph
+ m_messages m_interpreter))
(documentation
(package mlang)
diff --git a/src/mlang/index.mld b/src/mlang/index.mld
index 8d409e935..da3c711b9 100644
--- a/src/mlang/index.mld
+++ b/src/mlang/index.mld
@@ -6,7 +6,7 @@ intermediate representations going from the source code to the target backend.
{1 Frontend}
First, the source code is parsed according to the Menhir grammar specified in {!module: Mlang.M_frontend.Mparser}.
-The grammar is not exactly LR(1) so we rely on {!module: Mlang.M_frontend.Parse_utils} to backtrack, especially on symbol parsing. The target intermediate representation is {!module: Mlang.M_frontend.Mast}, which is very close to the concrete syntax and can be printed using {!module: Mlang.M_frontend.Format_mast}.
+The grammar is not exactly LR(1) so we rely on {!module: Mlang.M_frontend.Parse_utils} to backtrack, especially on symbol parsing. {!module: Mlang.M_frontend.Syntax_messages} treats the error messages in the different failing cases. The target intermediate representation is {!module: Mlang.M_frontend.Mast}, which is very close to the concrete syntax and can be printed using {!module: Mlang.M_frontend.Format_mast}.
The frontend also handles ast expansion with {!module: Mlang.M_frontend.Expander} and validation with {!module: Mlang.M_frontend.Validator}.
{!modules:
@@ -15,6 +15,7 @@ The frontend also handles ast expansion with {!module: Mlang.M_frontend.Expander
Mlang.M_frontend.Mlexer
Mlang.M_frontend.Mparser
Mlang.M_frontend.Parse_utils
+ Mlang.M_frontend.Syntax_messages
Mlang.M_frontend.Validator }
{1 Intermediate Representation}
@@ -28,10 +29,25 @@ and basically all programs typecheck ; however {!module: Mlang.M_frontend.Valida
Mlang.M_ir.Com
Mlang.M_ir.Format_mir
Mlang.M_ir.Mir
- Mlang.M_ir.Mir_interpreter
Mlang.M_ir.Mir_number
Mlang.M_ir.Mir_roundops }
+{1 Interpreter}
+
+The intepreter is the reference for the M semantics. The C code Mlang generates must
+follow it.
+The main interpreter module is {!module: Mlang.Mir_interpreter.Eval} which defines two
+functions: {!Mlang.Mir_interpreter.Eval.evaluate_program} and {!Mlang.Mir_interpreter.Eval.evaluate_expr}. It also defines several modules that evaluates programs and expression
+with different float precisions.
+
+{!modules:
+ Mlang.Mir_interpreter.Anomaly
+ Mlang.Mir_interpreter.Context
+ Mlang.Mir_interpreter.Eval
+ Mlang.Mir_interpreter.Functions
+ Mlang.Mir_interpreter.Print
+ Mlang.Mir_interpreter.Types }
+
{1 Testing}
Mlang comes with a testing framework for M programs that is based on
diff --git a/src/mlang/m_frontend/dune b/src/mlang/m_frontend/dune
index adb2113e0..424926cca 100644
--- a/src/mlang/m_frontend/dune
+++ b/src/mlang/m_frontend/dune
@@ -2,11 +2,66 @@
(menhir
(modules mparser)
- (flags --explain))
+ (flags --exn-carries-state --explain))
(library
(public_name mlang.frontend)
(name m_frontend)
(flags
(:standard -open Utils -open M_ir))
- (libraries utils m_ir))
+ (libraries utils m_ir m_messages))
+
+; Generates the Syntax_messages module
+
+(rule
+ (target syntax_messages.ml)
+ (deps
+ (:parser mparser.mly)
+ (:msg syntax.messages))
+ (action
+ (with-stdout-to
+ %{target}
+ (run menhir %{parser} --base %{parser} --compile-errors %{msg}))))
+
+; Rules to check parser updates and properly merging the changes
+
+(rule
+ (target new.messages)
+ (deps
+ (:parser mparser.mly))
+ (action
+ (with-stdout-to
+ %{target}
+ (run menhir %{parser} --base %{parser} --list-errors))))
+
+(rule
+ (target updated.messages)
+ (deps
+ (:parser mparser.mly)
+ (:msg syntax.messages))
+ (action
+ (with-stdout-to
+ %{target}
+ (run menhir %{parser} --base %{parser} --update-errors %{msg}))))
+
+(rule
+ (target syntax.messages.updated)
+ (deps
+ (:parser mparser.mly)
+ (:new new.messages)
+ (:updated updated.messages))
+ (action
+ (with-stdout-to
+ %{target}
+ (run menhir %{parser} --base %{parser} --merge-errors %{new}
+ --merge-errors %{updated}))))
+
+; Tests the syntax.messages file when the parser changes.
+; To update the file, use dune runtest --auto-update
+
+(rule
+ (alias runtest)
+ (package mlang)
+ (deps syntax.messages syntax.messages.updated)
+ (action
+ (diff syntax.messages syntax.messages.updated)))
diff --git a/src/mlang/m_frontend/expander.ml b/src/mlang/m_frontend/expander.ml
index d37c203a2..fb5dc7b80 100644
--- a/src/mlang/m_frontend/expander.ml
+++ b/src/mlang/m_frontend/expander.ml
@@ -1,15 +1,17 @@
-(* This program is free software: you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free Software
- Foundation, either version 3 of the License, or (at your option) any later
- version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see . *)
+(******************************************************************************)
+(* *)
+(* Droit d'auteur (c) 2023 - 2026 DGFiP - INRIA *)
+(* *)
+(* Ce programme est distribué sous la licence CeCILL-C: vous pouvez le *)
+(* redistribuer et/ou le modifier sous les contraintes de celle-ci. *)
+(* *)
+(* L'accessibilité au code source et les droits de copie, de modification et *)
+(* de redistribution qui découlent de ce contrat ont pour contrepartie de *)
+(* n'offrir aux utilisateurs qu'une garantie limitée et de ne faire peser sur *)
+(* l'auteur du logiciel, le titulaire des droits patrimoniaux et les *)
+(* concédants successifs qu'une responsabilité restreinte. *)
+(* *)
+(******************************************************************************)
module Err = struct
let constant_already_defined old_pos pos =
@@ -311,7 +313,7 @@ let add_const (Pos.Mark (name, name_pos)) (Pos.Mark (cval, cval_pos)) const_map
Err.constant_already_defined old_pos name_pos
| None -> (
match cval with
- | Com.AtomLiteral (Com.Float f) ->
+ | Com.AtomLiteral { lit = Com.Float f; _ } ->
ConstMap.add name (Pos.mark f name_pos) const_map
| Com.AtomVar (Pos.Mark (Com.Normal const, _)) -> (
match ConstMap.find_opt const const_map with
@@ -338,7 +340,10 @@ let rec expand_variable (const_map : const_context) (loop_map : loop_context)
match Pos.unmark m_var with
| Com.Normal name -> (
match ConstMap.find_opt name const_map with
- | Some (Pos.Mark (f, _)) -> Pos.same (Com.AtomLiteral (Float f)) m_var
+ | Some (Pos.Mark (f, pos)) ->
+ let from_const = Pos.mark name pos in
+ let atom = Com.mk_atomlit ~from_const (Float f) in
+ Pos.same atom m_var
| None -> Pos.same (Com.AtomVar m_var) m_var)
| Com.Generic gen_name ->
if List.length gen_name.Com.parameters == 0 then
@@ -425,16 +430,16 @@ let var_or_int_value (const_map : const_context)
match ConstMap.find_opt name const_map with
| Some (Pos.Mark (fvalue, _)) -> IntIndex (int_of_float fvalue)
| None -> VarIndex (Pos.unmark m_v))
- | Com.AtomLiteral (Com.Float f) -> IntIndex (int_of_float f)
- | Com.AtomLiteral Com.Undefined -> assert false
+ | Com.AtomLiteral { lit = Com.Float f; _ } -> IntIndex (int_of_float f)
+ | Com.AtomLiteral { lit = Com.Undefined; _ } -> assert false
let var_or_int (m_atom : Com.m_var_name Com.atom Pos.marked) =
match Pos.unmark m_atom with
| Com.AtomVar (Pos.Mark (Normal v, _)) -> VarName v
| Com.AtomVar (Pos.Mark (Generic _, _)) ->
Err.generic_variable_not_allowed_in_left_part_of_loop (Pos.get m_atom)
- | Com.AtomLiteral (Com.Float f) -> RangeInt (int_of_float f)
- | Com.AtomLiteral Com.Undefined -> assert false
+ | Com.AtomLiteral { lit = Com.Float f; _ } -> RangeInt (int_of_float f)
+ | Com.AtomLiteral { lit = Com.Undefined; _ } -> assert false
let loop_variables_size (lpvl : loop_param_value list) (pos : Pos.t) =
let size_err p = Err.loop_variables_have_different_sizes p in
@@ -559,7 +564,7 @@ let expand_loop_variables (lvs : Com.m_var_name Com.loop_variables Pos.marked)
type 'v access_or_literal =
| ExpAccess of 'v Com.m_access
- | ExpLiteral of Com.literal
+ | ExpLiteral of Com.literal_with_orig
let rec expand_access (const_map : const_context) (loop_map : loop_context)
(Pos.Mark (a, a_pos) : Com.m_var_name Com.m_access) :
@@ -583,7 +588,7 @@ let rec expand_access (const_map : const_context) (loop_map : loop_context)
| Pos.Mark (AtomVar m_v', _) ->
let a' = Com.VarAccess (m_sp_opt', m_v') in
ExpAccess (Pos.mark a' a_pos))
- | TabAccess (m_sp_opt, m_v, m_i) -> (
+ | TabAccess ((m_sp_opt, m_v), m_i) -> (
match expand_variable const_map loop_map m_v with
| Pos.Mark (AtomLiteral _, v_pos) -> Err.constant_forbidden_as_table v_pos
| Pos.Mark (AtomVar m_v', _) ->
@@ -597,7 +602,7 @@ let rec expand_access (const_map : const_context) (loop_map : loop_context)
m_sp_opt
in
let m_i' = expand_expression const_map loop_map m_i in
- let a' = Com.TabAccess (m_sp_opt', m_v', m_i') in
+ let a' = Com.TabAccess ((m_sp_opt', m_v'), m_i') in
ExpAccess (Pos.mark a' a_pos))
| FieldAccess (m_sp_opt, e, f, i_f) ->
let m_sp_opt' =
@@ -612,6 +617,14 @@ let rec expand_access (const_map : const_context) (loop_map : loop_context)
let e' = expand_expression const_map loop_map e in
ExpAccess (Pos.mark (Com.FieldAccess (m_sp_opt', e', f, i_f)) a_pos)
+and expand_switch_expression (const_map : const_context)
+ (loop_map : loop_context) = function
+ | Com.SEValue e -> Com.SEValue (expand_expression const_map loop_map e)
+ | SESameVariable v -> (
+ match expand_access const_map loop_map v with
+ | ExpAccess m_a -> SESameVariable m_a
+ | ExpLiteral _ -> SESameVariable v)
+
and expand_expression (const_map : const_context) (loop_map : loop_context)
(m_expr : Mast.expression Pos.marked) : Mast.expression Pos.marked =
let open Com in
@@ -624,7 +637,8 @@ and expand_expression (const_map : const_context) (loop_map : loop_context)
match set_value with
| VarValue (Pos.Mark (a, a_pos)) -> (
match expand_access const_map loop_map (Pos.mark a a_pos) with
- | ExpLiteral (Float f) -> FloatValue (Pos.mark f a_pos)
+ | ExpLiteral { lit = Float f; _ } ->
+ FloatValue (Pos.mark f a_pos)
| ExpAccess m_a -> VarValue m_a
| _ -> assert false)
| FloatValue _ | IntervalValue _ -> set_value)
@@ -679,7 +693,7 @@ and expand_expression (const_map : const_context) (loop_map : loop_context)
List.fold_left
(fun res loop_expr ->
Pos.same (Binop (Pos.same Or m_expr, res, loop_expr)) m_expr)
- (Pos.same (Literal (Float 0.0)) m_expr)
+ (Pos.same (Com.mk_lit (Float 0.0)) m_expr)
loop_exprs
| Attribut (Pos.Mark (a, a_pos), attr) -> (
match expand_access const_map loop_map (Pos.same a m_expr) with
@@ -731,7 +745,7 @@ let expand_formula (const_map : const_context)
let v' =
match expand_variable const_map ParamsMap.empty v with
| Pos.Mark (AtomVar m_v, v_pos) -> Pos.mark (Pos.unmark m_v) v_pos
- | Pos.Mark (AtomLiteral (Float _), v_pos) ->
+ | Pos.Mark (AtomLiteral { lit = Float _; _ }, v_pos) ->
Err.constant_forbidden_as_lvalue v_pos
| _ -> assert false
in
@@ -757,7 +771,7 @@ let expand_formula (const_map : const_context)
let v' =
match expand_variable const_map loop_map v with
| Pos.Mark (AtomVar m_v, v_pos) -> Pos.mark (Pos.unmark m_v) v_pos
- | Pos.Mark (AtomLiteral (Float _), v_pos) ->
+ | Pos.Mark (AtomLiteral { lit = Float _; _ }, v_pos) ->
Err.constant_forbidden_as_lvalue v_pos
| _ -> assert false
in
@@ -766,6 +780,14 @@ let expand_formula (const_map : const_context)
let res = loop_context_provider translator in
List.rev res @ prev
+let expand_switch_case const_map loop_map c =
+ match c with
+ | Com.CVar e -> (
+ match expand_access const_map loop_map e with
+ | ExpLiteral l -> Com.CValue l.lit
+ | ExpAccess a -> Com.CVar a)
+ | CValue _ | CDefault -> c
+
let rec expand_instruction (const_map : const_context)
(prev : Mast.instruction Pos.marked list)
(m_instr : Mast.instruction Pos.marked) : Mast.instruction Pos.marked list =
@@ -781,9 +803,18 @@ let rec expand_instruction (const_map : const_context)
let ielse' = expand_instructions const_map ielse in
Pos.same (Com.IfThenElse (expr', ithen', ielse')) m_instr :: prev
| Com.Switch (e, l) ->
- let e' = expand_expression const_map ParamsMap.empty e in
+ let e' = expand_switch_expression const_map ParamsMap.empty e in
let l' =
- List.map (fun (c, l) -> (c, expand_instructions const_map l)) l
+ List.map
+ (fun (cl, l) ->
+ let cl =
+ match e with
+ | SESameVariable _ -> cl
+ | SEValue _ ->
+ List.map (expand_switch_case const_map ParamsMap.empty) cl
+ in
+ (cl, expand_instructions const_map l))
+ l
in
Pos.same (Com.Switch (e', l')) m_instr :: prev
| Com.WhenDoElse (wdl, ed) ->
diff --git a/src/mlang/m_frontend/expander.mli b/src/mlang/m_frontend/expander.mli
index 890dc8580..aeefe7b9a 100644
--- a/src/mlang/m_frontend/expander.mli
+++ b/src/mlang/m_frontend/expander.mli
@@ -1,15 +1,17 @@
-(* This program is free software: you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free Software
- Foundation, either version 3 of the License, or (at your option) any later
- version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see . *)
+(******************************************************************************)
+(* *)
+(* Droit d'auteur (c) 2019 - 2026 DGFiP - INRIA *)
+(* *)
+(* Ce programme est distribué sous la licence CeCILL-C: vous pouvez le *)
+(* redistribuer et/ou le modifier sous les contraintes de celle-ci. *)
+(* *)
+(* L'accessibilité au code source et les droits de copie, de modification et *)
+(* de redistribution qui découlent de ce contrat ont pour contrepartie de *)
+(* n'offrir aux utilisateurs qu'une garantie limitée et de ne faire peser sur *)
+(* l'auteur du logiciel, le titulaire des droits patrimoniaux et les *)
+(* concédants successifs qu'une responsabilité restreinte. *)
+(* *)
+(******************************************************************************)
val proceed : Mast.program -> Mast.program
(** Expands the program by:
diff --git a/src/mlang/m_frontend/format_mast.ml b/src/mlang/m_frontend/format_mast.ml
index 2103d14a8..dd1c110e5 100644
--- a/src/mlang/m_frontend/format_mast.ml
+++ b/src/mlang/m_frontend/format_mast.ml
@@ -1,18 +1,17 @@
-(* Copyright (C) 2019-2021 Inria, contributor: Denis Merigoux
-
-
- This program is free software: you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free Software
- Foundation, either version 3 of the License, or (at your option) any later
- version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see . *)
+(******************************************************************************)
+(* *)
+(* Droit d'auteur (c) 2019 - 2026 DGFiP - INRIA *)
+(* *)
+(* Ce programme est distribué sous la licence CeCILL-C: vous pouvez le *)
+(* redistribuer et/ou le modifier sous les contraintes de celle-ci. *)
+(* *)
+(* L'accessibilité au code source et les droits de copie, de modification et *)
+(* de redistribution qui découlent de ce contrat ont pour contrepartie de *)
+(* n'offrir aux utilisateurs qu'une garantie limitée et de ne faire peser sur *)
+(* l'auteur du logiciel, le titulaire des droits patrimoniaux et les *)
+(* concédants successifs qu'une responsabilité restreinte. *)
+(* *)
+(******************************************************************************)
(** AST pretty printer *)
diff --git a/src/mlang/m_frontend/format_mast.mli b/src/mlang/m_frontend/format_mast.mli
index 4062b0c65..1c6ff8cb6 100644
--- a/src/mlang/m_frontend/format_mast.mli
+++ b/src/mlang/m_frontend/format_mast.mli
@@ -1,18 +1,17 @@
-(* Copyright (C) 2019-2021 Inria, contributor: Denis Merigoux
-
-
- This program is free software: you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free Software
- Foundation, either version 3 of the License, or (at your option) any later
- version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see . *)
+(******************************************************************************)
+(* *)
+(* Droit d'auteur (c) 2019 - 2026 DGFiP - INRIA *)
+(* *)
+(* Ce programme est distribué sous la licence CeCILL-C: vous pouvez le *)
+(* redistribuer et/ou le modifier sous les contraintes de celle-ci. *)
+(* *)
+(* L'accessibilité au code source et les droits de copie, de modification et *)
+(* de redistribution qui découlent de ce contrat ont pour contrepartie de *)
+(* n'offrir aux utilisateurs qu'une garantie limitée et de ne faire peser sur *)
+(* l'auteur du logiciel, le titulaire des droits patrimoniaux et les *)
+(* concédants successifs qu'une responsabilité restreinte. *)
+(* *)
+(******************************************************************************)
val format_var_type : Mast.var_type -> string
diff --git a/src/mlang/m_frontend/mast.ml b/src/mlang/m_frontend/mast.ml
index aa458d56c..a8eaec290 100644
--- a/src/mlang/m_frontend/mast.ml
+++ b/src/mlang/m_frontend/mast.ml
@@ -1,18 +1,17 @@
-(* Copyright (C) 2019-2021 Inria, contributor: Denis Merigoux
-
-
- This program is free software: you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free Software
- Foundation, either version 3 of the License, or (at your option) any later
- version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see . *)
+(******************************************************************************)
+(* *)
+(* Droit d'auteur (c) 2019 - 2026 DGFiP - INRIA *)
+(* *)
+(* Ce programme est distribué sous la licence CeCILL-C: vous pouvez le *)
+(* redistribuer et/ou le modifier sous les contraintes de celle-ci. *)
+(* *)
+(* L'accessibilité au code source et les droits de copie, de modification et *)
+(* de redistribution qui découlent de ce contrat ont pour contrepartie de *)
+(* n'offrir aux utilisateurs qu'une garantie limitée et de ne faire peser sur *)
+(* l'auteur du logiciel, le titulaire des droits patrimoniaux et les *)
+(* concédants successifs qu'une responsabilité restreinte. *)
+(* *)
+(******************************************************************************)
(** Abstract Syntax Tree for M *)
diff --git a/src/mlang/m_frontend/mast_to_mir.ml b/src/mlang/m_frontend/mast_to_mir.ml
index ea2b26b90..6dd1b7241 100644
--- a/src/mlang/m_frontend/mast_to_mir.ml
+++ b/src/mlang/m_frontend/mast_to_mir.ml
@@ -1,18 +1,17 @@
-(* Copyright (C) 2019-2021 Inria, contributor: Denis Merigoux
-
-
- This program is free software: you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free Software
- Foundation, either version 3 of the License, or (at your option) any later
- version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see . *)
+(******************************************************************************)
+(* *)
+(* Droit d'auteur (c) 2019 - 2026 DGFiP - INRIA *)
+(* *)
+(* Ce programme est distribué sous la licence CeCILL-C: vous pouvez le *)
+(* redistribuer et/ou le modifier sous les contraintes de celle-ci. *)
+(* *)
+(* L'accessibilité au code source et les droits de copie, de modification et *)
+(* de redistribution qui découlent de ce contrat ont pour contrepartie de *)
+(* n'offrir aux utilisateurs qu'une garantie limitée et de ne faire peser sur *)
+(* l'auteur du logiciel, le titulaire des droits patrimoniaux et les *)
+(* concédants successifs qu'une responsabilité restreinte. *)
+(* *)
+(******************************************************************************)
(** {!module: Mast} to {!module: Mir} translation of M programs. *)
@@ -210,6 +209,7 @@ let complete_vars (prog : Validator.program) : Validator.program * Mir.stats =
in
(prog, stats)
+(* hyp: this function registers tehe variables to the tgv map in program *)
let complete_target_vars ((prog : Validator.program), (stats : Mir.stats)) :
Validator.program * Mir.stats =
let fold _ (t : Validator.target) (prog_dict, max_nb_args) =
@@ -222,6 +222,7 @@ let complete_target_vars ((prog : Validator.program), (stats : Mir.stats)) :
IntMap.add var.id var prog_dict
| None -> prog_dict
in
+ (* hyp: processing target args *)
let prog_dict, _ =
let idx_init =
if is_f then -t.target_sz_tmps + 1 else -t.target_nb_refs
@@ -234,6 +235,7 @@ let complete_target_vars ((prog : Validator.program), (stats : Mir.stats)) :
(prog_dict, n + 1))
(prog_dict, idx_init) t.target_args
in
+ (* hyp: processing tmp vars *)
let prog_dict, _ =
let idx_init =
let tmp_sz =
@@ -253,17 +255,14 @@ let complete_target_vars ((prog : Validator.program), (stats : Mir.stats)) :
(prog_dict, n + Com.Var.size var))
t.target_tmp_vars (prog_dict, idx_init)
in
+ (* hyp: processing cells if tmp vars are arrays *)
let prog_dict =
StrMap.fold
(fun _name m_id prog_dict ->
let var = IntMap.find (Pos.unmark m_id) prog_dict in
match Com.Var.get_table var with
- | Some tab ->
- let table =
- let map (v : Com.Var.t) = IntMap.find v.id prog_dict in
- Some (Array.map map tab)
- in
- let var = Com.Var.set_table var table in
+ | Some table ->
+ let var = Com.Var.set_table var (Some table) in
IntMap.add var.id var prog_dict
| None -> prog_dict)
t.target_tmp_vars prog_dict
@@ -300,9 +299,8 @@ let complete_tabs ((prog : Validator.program), (stats : Mir.stats)) :
let rec loop map tab i =
if i = vsz then (map, tab)
else
- let iVar = IntMap.find tab.(i).Com.Var.id prog_dict in
+ let iVar = IntMap.find tab.(i) prog_dict in
let map = map_add iVar map in
- tab.(i) <- iVar;
loop map tab (i + 1)
in
loop map tab 0
@@ -348,7 +346,7 @@ let complete_stats ((prog : Validator.program), (stats : Mir.stats)) :
and aux_access tdata m_a =
match Pos.unmark m_a with
| Com.VarAccess _ -> (0, 0, 0, tdata)
- | Com.TabAccess (_, _, mi) | Com.FieldAccess (_, mi, _, _) ->
+ | Com.TabAccess (_, mi) | Com.FieldAccess (_, mi, _, _) ->
aux_expr tdata mi
and aux_instr tdata (Pos.Mark (instr, _pos)) =
match instr with
@@ -382,7 +380,7 @@ let complete_stats ((prog : Validator.program), (stats : Mir.stats)) :
let nbRef = max nbRefI @@ max nbRefT nbRefE in
(nb, sz, nbRef, tdata)
| Com.Switch (expr, l) ->
- let nbI, szI, nbRefI, tdata = aux_expr tdata expr in
+ let nbI, szI, nbRefI, tdata = aux_switch_expr tdata expr in
List.fold_left
(fun (mNb, mSz, mNbRef, tdata) (_, l) ->
let nb, sz, rbRef, tdata = aux_instrs tdata l in
@@ -527,11 +525,15 @@ let complete_stats ((prog : Validator.program), (stats : Mir.stats)) :
(0, 0, 0, tdata)
| Com.ComputeDomain _ | Com.ComputeChaining _ | Com.ComputeVerifs _ ->
assert false
+ and aux_switch_expr tdata se =
+ match se with
+ | Com.SEValue e -> aux_expr tdata e
+ | Com.SESameVariable m -> aux_access tdata m
and aux_expr tdata (Pos.Mark (expr, _pos)) =
match expr with
| Com.TestInSet (_, me, values) ->
let fold (nb, sz, nbRef, tdata) = function
- | Com.VarValue (Pos.Mark (TabAccess (_, _, mei), _))
+ | Com.VarValue (Pos.Mark (TabAccess (_, mei), _))
| Com.VarValue (Pos.Mark (FieldAccess (_, mei, _, _), _)) ->
let nb', sz', nbRef', tdata = aux_expr tdata mei in
(max nb nb', max sz sz', max nbRef nbRef', tdata)
@@ -543,26 +545,25 @@ let complete_stats ((prog : Validator.program), (stats : Mir.stats)) :
let nb'', sz'', nbRef'', tdata = aux_expr tdata me in
(max nb' nb'', max sz' sz'', max nbRef' nbRef'', tdata)
| Com.Unop (_, me)
- | Com.Var (TabAccess (_, _, me))
+ | Com.Var (TabAccess (_, me))
| Com.Var (FieldAccess (_, me, _, _))
- | Com.Size (Pos.Mark (TabAccess (_, _, me), _))
+ | Com.Size (Pos.Mark (TabAccess (_, me), _))
| Com.Size (Pos.Mark (FieldAccess (_, me, _, _), _))
- | Com.Type (Pos.Mark (TabAccess (_, _, me), _), _)
+ | Com.Type (Pos.Mark (TabAccess (_, me), _), _)
| Com.Type (Pos.Mark (FieldAccess (_, me, _, _), _), _)
- | Com.Attribut (Pos.Mark (TabAccess (_, _, me), _), _)
+ | Com.Attribut (Pos.Mark (TabAccess (_, me), _), _)
| Com.Attribut (Pos.Mark (FieldAccess (_, me, _, _), _), _) ->
aux_expr tdata me
| Com.Comparison (_, me0, me1)
| Com.Binop (_, me0, me1)
| Com.SameVariable
- ( Pos.Mark (TabAccess (_, _, me0), _),
- Pos.Mark (TabAccess (_, _, me1), _) )
+ (Pos.Mark (TabAccess (_, me0), _), Pos.Mark (TabAccess (_, me1), _))
| Com.SameVariable
- ( Pos.Mark (TabAccess (_, _, me0), _),
+ ( Pos.Mark (TabAccess (_, me0), _),
Pos.Mark (FieldAccess (_, me1, _, _), _) )
| Com.SameVariable
( Pos.Mark (FieldAccess (_, me0, _, _), _),
- Pos.Mark (TabAccess (_, _, me1), _) )
+ Pos.Mark (TabAccess (_, me1), _) )
| Com.SameVariable
( Pos.Mark (FieldAccess (_, me0, _, _), _),
Pos.Mark (FieldAccess (_, me1, _, _), _) ) ->
@@ -685,13 +686,13 @@ let rec translate_expression (p : Validator.program) (dict : Com.Var.t IntMap.t)
Attribut (Pos.mark access' pos, a)
else
match StrMap.find_opt (Pos.unmark a) (Com.Var.attrs var) with
- | Some l -> Literal (Float (float (Pos.unmark l)))
- | None -> Literal Undefined)
- | TabAccess (_, m_id, _) -> (
+ | Some l -> Com.mk_lit (Float (float (Pos.unmark l)))
+ | None -> Com.mk_lit Undefined)
+ | TabAccess ((_, m_id), _) -> (
let var = get_var dict m_id in
match StrMap.find_opt (Pos.unmark a) (Com.Var.attrs var) with
- | Some l -> Literal (Float (float (Pos.unmark l)))
- | None -> Literal Undefined)
+ | Some l -> Com.mk_lit (Float (float (Pos.unmark l)))
+ | None -> Com.mk_lit Undefined)
| FieldAccess (m_sp_opt, e, f, _) ->
let m_sp_opt' =
Option.map
@@ -711,8 +712,8 @@ let rec translate_expression (p : Validator.program) (dict : Com.Var.t IntMap.t)
if Com.Var.is_ref var then
let access' = translate_access p dict access in
Size (Pos.mark access' pos)
- else Literal (Float (float @@ Com.Var.size var))
- | TabAccess _ -> Literal (Float 1.0)
+ else Com.mk_lit (Float (float @@ Com.Var.size var))
+ | TabAccess _ -> Com.mk_lit (Float 1.0)
| FieldAccess (m_sp_opt, e, f, _) ->
let m_sp_opt' =
Option.map
@@ -741,8 +742,8 @@ let rec translate_expression (p : Validator.program) (dict : Com.Var.t IntMap.t)
InDomain (Pos.mark access' pos, cvm)
else if
Com.Var.is_tgv var && Com.CatVar.Map.mem (Com.Var.cat var) cvm
- then Literal (Float 1.0)
- else Literal (Float 0.0)
+ then Com.mk_lit (Float 1.0)
+ else Com.mk_lit (Float 0.0)
| _ ->
let access' = translate_access p dict access in
InDomain (Pos.mark access' pos, cvm))
@@ -769,17 +770,31 @@ and translate_access (p : Validator.program) (dict : Com.Var.t IntMap.t)
let m_sp_opt' = trans_m_sp_opt m_sp_opt in
let v' = get_var dict m_v in
Com.VarAccess (m_sp_opt', v')
- | TabAccess (m_sp_opt, m_v, m_i) ->
+ | TabAccess ((m_sp_opt, m_v), m_i) ->
let m_sp_opt' = trans_m_sp_opt m_sp_opt in
let v' = get_var dict m_v in
let m_i' = translate_expression p dict m_i in
- Com.TabAccess (m_sp_opt', v', m_i')
+ Com.TabAccess ((m_sp_opt', v'), m_i')
| FieldAccess (m_sp_opt, i, f, _) ->
let m_sp_opt' = trans_m_sp_opt m_sp_opt in
let i' = translate_expression p dict i in
let ef = StrMap.find (Pos.unmark f) p.prog_event_fields in
Com.FieldAccess (m_sp_opt', i', f, ef.index)
+and translate_switch_expression (p : Validator.program)
+ (dict : Com.Var.t IntMap.t) = function
+ | Com.SEValue v -> Com.SEValue (translate_expression p dict v)
+ | SESameVariable v ->
+ SESameVariable (Pos.same (translate_access p dict (Pos.unmark v)) v)
+
+let translate_case (p : Validator.program) (dict : Com.Var.t IntMap.t)
+ (case : int Pos.marked Com.case) : Com.Var.t Com.case =
+ match case with
+ | CDefault -> CDefault
+ | CValue v -> CValue v
+ | CVar (Pos.Mark (acc, pos)) ->
+ CVar (Pos.mark (translate_access p dict acc) pos)
+
(** {2 Translation of instructions} *)
let rec translate_prog (p : Validator.program) (dict : Com.Var.t IntMap.t)
@@ -813,12 +828,13 @@ let rec translate_prog (p : Validator.program) (dict : Com.Var.t IntMap.t)
let instr' = Com.IfThenElse (expr, prog_then, prog_else) in
aux (Pos.mark instr' pos :: res, dict) il
| Pos.Mark (Com.Switch (e, l), pos) :: il ->
- let e' = translate_expression p dict e in
+ let e' = translate_switch_expression p dict e in
let revl', dict =
List.fold_left
(fun (revl, dict) (c, l) ->
+ let c' = List.map (translate_case p dict) c in
let l', dict = aux ([], dict) l in
- ((c, l') :: revl, dict))
+ ((c', l') :: revl, dict))
([], dict) l
in
let i' = Com.Switch (e', List.rev revl') in
@@ -1038,6 +1054,7 @@ let get_targets (p : Validator.program) (dict : Com.Var.t IntMap.t)
let target_prog, dict =
translate_prog p dict ref_depth itval_depth t.target_prog
in
+ let target_stoppable = t.target_stoppable in
let target =
Com.
{
@@ -1051,6 +1068,7 @@ let get_targets (p : Validator.program) (dict : Com.Var.t IntMap.t)
target_nb_tmps;
target_sz_tmps;
target_nb_refs;
+ target_stoppable;
}
in
(StrMap.add (Pos.unmark target_name) target targets, dict))
diff --git a/src/mlang/m_frontend/mast_to_mir.mli b/src/mlang/m_frontend/mast_to_mir.mli
index d5c5d8f4d..4a3788640 100644
--- a/src/mlang/m_frontend/mast_to_mir.mli
+++ b/src/mlang/m_frontend/mast_to_mir.mli
@@ -1,18 +1,17 @@
-(* Copyright (C) 2019-2021 Inria, contributor: Denis Merigoux
-
-
- This program is free software: you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free Software
- Foundation, either version 3 of the License, or (at your option) any later
- version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see . *)
+(******************************************************************************)
+(* *)
+(* Droit d'auteur (c) 2021 - 2026 DGFiP - INRIA *)
+(* *)
+(* Ce programme est distribué sous la licence CeCILL-C: vous pouvez le *)
+(* redistribuer et/ou le modifier sous les contraintes de celle-ci. *)
+(* *)
+(* L'accessibilité au code source et les droits de copie, de modification et *)
+(* de redistribution qui découlent de ce contrat ont pour contrepartie de *)
+(* n'offrir aux utilisateurs qu'une garantie limitée et de ne faire peser sur *)
+(* l'auteur du logiciel, le titulaire des droits patrimoniaux et les *)
+(* concédants successifs qu'une responsabilité restreinte. *)
+(* *)
+(******************************************************************************)
(** {!module: Mast} to {!module: M_ir.Mir} translation of M programs. *)
diff --git a/src/mlang/m_frontend/mlexer.mli b/src/mlang/m_frontend/mlexer.mli
index c57ba66a8..50ff6ad98 100644
--- a/src/mlang/m_frontend/mlexer.mli
+++ b/src/mlang/m_frontend/mlexer.mli
@@ -1,17 +1,16 @@
-(* Copyright (C) 2019-2021 Inria, contributor: Denis Merigoux
-
-
- This program is free software: you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free Software
- Foundation, either version 3 of the License, or (at your option) any later
- version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see . *)
+(******************************************************************************)
+(* *)
+(* Droit d'auteur (c) 2019 - 2026 DGFiP - INRIA *)
+(* *)
+(* Ce programme est distribué sous la licence CeCILL-C: vous pouvez le *)
+(* redistribuer et/ou le modifier sous les contraintes de celle-ci. *)
+(* *)
+(* L'accessibilité au code source et les droits de copie, de modification et *)
+(* de redistribution qui découlent de ce contrat ont pour contrepartie de *)
+(* n'offrir aux utilisateurs qu'une garantie limitée et de ne faire peser sur *)
+(* l'auteur du logiciel, le titulaire des droits patrimoniaux et les *)
+(* concédants successifs qu'une responsabilité restreinte. *)
+(* *)
+(******************************************************************************)
val token : Lexing.lexbuf -> Mparser.token
diff --git a/src/mlang/m_frontend/mlexer.mll b/src/mlang/m_frontend/mlexer.mll
index 5b859f6a9..b8c9402b5 100644
--- a/src/mlang/m_frontend/mlexer.mll
+++ b/src/mlang/m_frontend/mlexer.mll
@@ -202,4 +202,4 @@ and string buf = parse
}
| eof {
Format.ksprintf Errors.raise_error "Unterminated string literal %S" (Buffer.contents buf)
- }
\ No newline at end of file
+ }
diff --git a/src/mlang/m_frontend/mparser.mly b/src/mlang/m_frontend/mparser.mly
index 894d23f1a..b53c7b604 100644
--- a/src/mlang/m_frontend/mparser.mly
+++ b/src/mlang/m_frontend/mparser.mly
@@ -25,9 +25,16 @@ along with this program. If not, see .
| CompSubTyp of string Pos.marked
| Attr of variable_attribute
+ let parse_to_atom (v: parse_val) (pos : Pos.t) : Com.m_var_name Com.atom =
+ match v with
+ | ParseVar v -> AtomVar (Pos.mark v pos)
+ | ParseInt v -> Com.mk_atomlit (Float (float_of_int v))
+
(** Module generated automaticcaly by Menhir, the parser generator *)
%}
+%start source_file
+
%token SYMBOL STRING
%token PLUS MINUS TIMES DIV MOD
@@ -68,8 +75,6 @@ along with this program. If not, see .
%nonassoc NOT
(* %nonassoc SYMBOL *)
-%start source_file
-
%%
%inline with_pos(X):
@@ -484,10 +489,6 @@ rule_etc:
in
aux [] begPos uname
in
- List.iter (fun (Pos.Mark (i, _)) ->
- Format.printf "Tag %S@." i;
- )
- (Pos.unmark rule_tag_names);
let rule_number =
try Pos.map int_of_string num
with _ ->
@@ -770,7 +771,7 @@ instruction:
let expr =
match eo with
| Some expr -> expr
- | None -> Pos.without (Com.Literal (Com.Float 1.0))
+ | None -> Pos.without (Com.mk_lit (Com.Float 1.0))
in
Some (ComputeVerifs (dom, expr, m_sp_opt))
}
@@ -887,13 +888,30 @@ instruction:
| STOP TARGET SEMICOLON { Some (Stop SKTarget) }
| STOP s = SYMBOL SEMICOLON { Some (Stop (SKId (Some s))) }
| STOP SEMICOLON { Some (Stop (SKId None)) }
-| MATCH LPAREN e = with_pos(expression) RPAREN COLON LPAREN l = nonempty_list(switch_case) RPAREN
- { Some (Switch (e, l)) }
+| s = switch_kind COLON LPAREN l = nonempty_list(switch_case) RPAREN
+ { Some (Switch (s, l)) }
+
+switch_kind:
+ | MATCH NAME LPAREN acc = with_pos(var_access) RPAREN { Com.SESameVariable acc }
+ | MATCH LPAREN e = with_pos(expression) RPAREN { Com.SEValue e }
+
+switch_case_kind:
+ | s = SYMBOL
+ {
+ let pos = mk_position $sloc in
+ match parse_literal $sloc s with
+ | l -> Com.CValue l
+ | exception (Errors.StructuredError _) ->
+ match parse_variable_or_int $sloc s with
+ | ParseVar v ->
+ Com.CVar (Pos.mark (Com.VarAccess (None, Pos.mark v pos)) pos)
+ | ParseInt i -> Com.CValue (Float (float_of_int i))
+ }
+ | UNDEFINED { Com.CValue Com.Undefined }
switch_case_value:
-| CASE s = SYMBOL COLON { Value (Com.Float (float_of_string s)) }
-| CASE UNDEFINED COLON { Value Com.Undefined }
-| BY_DEFAULT COLON { Com.Default }
+| CASE sck = switch_case_kind COLON { sck }
+| BY_DEFAULT COLON { Com.CDefault }
switch_cases_rev:
| sc = switch_case_value { [ sc ] }
@@ -1029,7 +1047,7 @@ it_param:
let expr =
match eo with
| Some expr -> expr
- | None -> Pos.without (Com.Literal (Com.Float 1.0))
+ | None -> Pos.without (Com.mk_lit (Com.Float 1.0))
in
let m_sp_opt = match spo with Some m_sp -> Some (m_sp, -1) | None -> None in
`VarCatsIt (vcats, expr, m_sp_opt)
@@ -1081,7 +1099,7 @@ rest_param:
let expr =
match eo with
| Some expr -> expr
- | None -> Pos.without (Com.Literal (Com.Float 1.0))
+ | None -> Pos.without (Com.mk_lit (Com.Float 1.0))
in
let m_sp_opt = match spo with Some m_sp -> Some (m_sp, -1) | None -> None in
`VarCatsRest (var, vcats, expr, m_sp_opt)
@@ -1139,13 +1157,13 @@ var_access:
let m_v = Pos.same (parse_variable $sloc (Pos.unmark v)) v in
match m_i_opt with
| None -> Com.VarAccess (Some (m_sp, -1), m_v)
- | Some m_i -> Com.TabAccess (Some (m_sp, -1), m_v, m_i)
+ | Some m_i -> Com.TabAccess ((Some (m_sp, -1), m_v), m_i)
}
| v = symbol_with_pos m_i_opt = with_pos(brackets)? {
let m_v = Pos.same (parse_variable $sloc (Pos.unmark v)) v in
match m_i_opt with
| None -> Com.VarAccess (None, m_v)
- | Some m_i -> Com.TabAccess (None, m_v, m_i)
+ | Some m_i -> Com.TabAccess ((None, m_v), m_i)
}
| sp = symbol_with_pos DOT EVENT_FIELD LPAREN idx = with_pos(expression)
COMMA f = symbol_with_pos RPAREN {
@@ -1347,13 +1365,13 @@ enumeration_item:
let a =
match m_i_opt with
| None -> Com.VarAccess (Some (m_sp, -1), m_v)
- | Some m_i -> Com.TabAccess (Some (m_sp, -1), m_v, m_i)
+ | Some m_i -> Com.TabAccess ((Some (m_sp, -1), m_v), m_i)
in
Com.VarValue (Pos.mark a (mk_position $sloc))
}
| v = symbol_with_pos LBRACKET m_i = with_pos(expression) RBRACKET {
let m_v = Pos.same (parse_variable $sloc (Pos.unmark v)) v in
- let a = Com.TabAccess (None, m_v, m_i) in
+ let a = Com.TabAccess ((None, m_v), m_i) in
Com.VarValue (Pos.mark a (mk_position $sloc))
}
| v = SYMBOL {
@@ -1440,11 +1458,11 @@ factor:
LBRACKET m_i = with_pos(sum_expression) RBRACKET {
let m_sp = Pos.same (parse_variable $sloc (Pos.unmark sp)) sp in
let m_v = Pos.same (parse_variable $sloc (Pos.unmark v)) v in
- Var (TabAccess (Some (m_sp, -1), m_v, m_i))
+ Var (TabAccess ((Some (m_sp, -1), m_v), m_i))
}
| v = symbol_with_pos LBRACKET m_i = with_pos(sum_expression) RBRACKET {
let m_v = Pos.same (parse_variable $sloc (Pos.unmark v)) v in
- Var (TabAccess (None, m_v, m_i))
+ Var (TabAccess ((None, m_v), m_i))
}
| sp = symbol_with_pos DOT v = symbol_with_pos {
let m_sp = Pos.same (parse_variable $sloc (Pos.unmark sp)) sp in
@@ -1456,7 +1474,7 @@ factor:
| Com.AtomVar v -> Com.Var (VarAccess (None, v))
| Com.AtomLiteral l -> Com.Literal l
}
-| UNDEFINED { Com.Literal Undefined }
+| UNDEFINED { Com.mk_lit Undefined }
| LPAREN e = expression RPAREN { e }
loop_expression:
diff --git a/src/mlang/m_frontend/parse_utils.ml b/src/mlang/m_frontend/parse_utils.ml
index 3e9b7a6ef..64024ca6e 100644
--- a/src/mlang/m_frontend/parse_utils.ml
+++ b/src/mlang/m_frontend/parse_utils.ml
@@ -1,23 +1,28 @@
-(* Copyright (C) 2019-2021 Inria, contributor: Denis Merigoux
-
-
- This program is free software: you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free Software
- Foundation, either version 3 of the License, or (at your option) any later
- version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see . *)
+(******************************************************************************)
+(* *)
+(* Droit d'auteur (c) 2019 - 2026 DGFiP - INRIA *)
+(* *)
+(* Ce programme est distribué sous la licence CeCILL-C: vous pouvez le *)
+(* redistribuer et/ou le modifier sous les contraintes de celle-ci. *)
+(* *)
+(* L'accessibilité au code source et les droits de copie, de modification et *)
+(* de redistribution qui découlent de ce contrat ont pour contrepartie de *)
+(* n'offrir aux utilisateurs qu'une garantie limitée et de ne faire peser sur *)
+(* l'auteur du logiciel, le titulaire des droits patrimoniaux et les *)
+(* concédants successifs qu'une responsabilité restreinte. *)
+(* *)
+(******************************************************************************)
+
+exception Parsing_error of { msg : string; pos : Pos.t }
module E = Errors
+type loc = Lexing.position * Lexing.position
+
let mk_position sloc = Pos.make (fst sloc).Lexing.pos_fname sloc
+let make_loc loc = loc
+
(** {1 Frontend variable names}*)
let parse_variable_name sloc (s : string) : string =
@@ -90,10 +95,10 @@ let parse_literal sloc (s : string) : Com.literal =
let parse_to_atom (v : parse_val) (pos : Pos.t) : Com.m_var_name Com.atom =
match v with
| ParseVar v -> AtomVar (Pos.mark v pos)
- | ParseInt v -> AtomLiteral (Float (float_of_int v))
+ | ParseInt v -> Com.mk_atomlit (Float (float_of_int v))
let parse_atom sloc (s : string) : Com.m_var_name Com.atom =
- try Com.AtomLiteral (Com.Float (float_of_string s))
+ try Com.mk_atomlit (Com.Float (float_of_string s))
with Failure _ ->
Com.AtomVar (Pos.mark (parse_variable sloc s) (mk_position sloc))
diff --git a/src/mlang/m_frontend/parse_utils.mli b/src/mlang/m_frontend/parse_utils.mli
index de49d47e4..af5d9c8fa 100644
--- a/src/mlang/m_frontend/parse_utils.mli
+++ b/src/mlang/m_frontend/parse_utils.mli
@@ -1,28 +1,33 @@
-(* Copyright (C) 2019-2021 Inria, contributor: Denis Merigoux
-
-
- This program is free software: you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free Software
- Foundation, either version 3 of the License, or (at your option) any later
- version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see . *)
+(******************************************************************************)
+(* *)
+(* Droit d'auteur (c) 2021 - 2026 DGFiP - INRIA *)
+(* *)
+(* Ce programme est distribué sous la licence CeCILL-C: vous pouvez le *)
+(* redistribuer et/ou le modifier sous les contraintes de celle-ci. *)
+(* *)
+(* L'accessibilité au code source et les droits de copie, de modification et *)
+(* de redistribution qui découlent de ce contrat ont pour contrepartie de *)
+(* n'offrir aux utilisateurs qu'une garantie limitée et de ne faire peser sur *)
+(* l'auteur du logiciel, le titulaire des droits patrimoniaux et les *)
+(* concédants successifs qu'une responsabilité restreinte. *)
+(* *)
+(******************************************************************************)
(** Helpers for parsing *)
+exception Parsing_error of { msg : string; pos : Pos.t }
+
(** {1 Frontend variable names}*)
(** A parsed variable can be a regular variable or an integer literal *)
type parse_val = ParseVar of Com.var_name | ParseInt of int
+type loc = Lexing.position * Lexing.position
+
val mk_position : Lexing.position * Lexing.position -> Pos.t
+val make_loc : loc -> loc
+
val parse_variable : Lexing.position * Lexing.position -> string -> Com.var_name
(** Checks whether the variable contains parameters *)
diff --git a/src/mlang/m_frontend/syntax.messages b/src/mlang/m_frontend/syntax.messages
new file mode 100644
index 000000000..042a24260
--- /dev/null
+++ b/src/mlang/m_frontend/syntax.messages
@@ -0,0 +1,6277 @@
+source_file: SYMBOL COLON INPUT SYMBOL EQUALS WITH
+##
+## Ends in an error in state: 16.
+##
+## variable_attribute -> symbol_with_pos EQUALS . variable_attribute_value [ SYMBOL GIVEN_BACK COLON BASE ALIAS ]
+##
+## The known suffix of the stack is as follows:
+## symbol_with_pos EQUALS
+##
+
+Lang:missing_value_after_equal
+
+source_file: SYMBOL COLON COMPUTED SYMBOL WITH
+##
+## Ends in an error in state: 77.
+##
+## variable_attribute -> symbol_with_pos . EQUALS variable_attribute_value [ SYMBOL GIVEN_BACK COLON BASE ]
+##
+## The known suffix of the stack is as follows:
+## symbol_with_pos
+##
+
+Lang:incomplete_attr_definition
+
+source_file: SYMBOL COLON COMPUTED BASE WITH
+##
+## Ends in an error in state: 84.
+##
+## list(comp_attr_or_subtyp) -> comp_attr_or_subtyp . list(comp_attr_or_subtyp) [ COLON ]
+##
+## The known suffix of the stack is as follows:
+## comp_attr_or_subtyp
+##
+
+Lang:incomplete_attr_list
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON IF SYMBOL WITH
+##
+## Ends in an error in state: 111.
+##
+## factor -> SYMBOL . [ TIMES THEN STEP SEMICOLON RPAREN RBRACKET RANGE PLUS OR NOT NEQ MOD MINUS LTE LT IN GTE GT EQUALS ENDIF ELSE DO DIV COMMA COLON AND ]
+## function_name -> SYMBOL . [ LPAREN ]
+## symbol_with_pos -> SYMBOL . [ LBRACKET DOT ]
+##
+## The known suffix of the stack is as follows:
+## SYMBOL
+##
+
+Lang:unexpected_symbol
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON SYMBOL EQUALS WITH
+##
+## Ends in an error in state: 546.
+##
+## formula -> var_access EQUALS . expression [ SEMICOLON ]
+##
+## The known suffix of the stack is as follows:
+## var_access EQUALS
+##
+
+Lang:missing_value_after_equal
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON IF SYMBOL THEN CLEAN_ERRORS SEMICOLON ELSE CLEAN_ERRORS SEMICOLON WITH
+##
+## Ends in an error in state: 638.
+##
+## instruction_else_branch -> ELSE instruction_list_rev . ENDIF [ WHEN VERIFY VERIFICATION VARIABLE_SPACE VARIABLE THEN_WHEN TARGET SYMBOL STOP RULE RPAREN RESTORE RAISE_ERROR PRINT_ERR PRINT OUTPUT NOTHING MATCH ITERATE IF FOR FONCTION FINALIZE_ERRORS EXPORT_ERRORS EVENT_FIELD EVENT EOF ENDWHEN ENDIF ELSE_DO ELSEIF ELSE DOMAIN COMPUTE CLEAN_FINALIZED_ERRORS CLEAN_ERRORS CHAINING CASE BY_DEFAULT ARRANGE_EVENTS APPLICATION ]
+## instruction_list_rev -> instruction_list_rev . instruction [ WHEN VERIFY SYMBOL STOP RESTORE RAISE_ERROR PRINT_ERR PRINT NOTHING MATCH ITERATE IF FOR FINALIZE_ERRORS EXPORT_ERRORS EVENT_FIELD ENDIF COMPUTE CLEAN_FINALIZED_ERRORS CLEAN_ERRORS ARRANGE_EVENTS ]
+##
+## The known suffix of the stack is as follows:
+## ELSE instruction_list_rev
+##
+
+Lang:missing_endif
+
+source_file: TARGET SYMBOL COLON APPLICATION WITH
+##
+## Ends in an error in state: 386.
+##
+## target_header_elt -> APPLICATION . COLON symbol_enumeration SEMICOLON [ WHEN VERIFY TEMP_VARS SYMBOL STOP RESTORE RAISE_ERROR PRINT_ERR PRINT NOTHING MATCH ITERATE INPUT_ARGS IF FOR FINALIZE_ERRORS EXPORT_ERRORS EVENT_FIELD COMPUTE CLEAN_FINALIZED_ERRORS CLEAN_ERRORS ARRANGE_EVENTS APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## APPLICATION
+##
+
+Lang:missing_colon
+
+source_file: WITH
+##
+## Ends in an error in state: 0.
+##
+## source_file' -> . source_file [ # ]
+##
+## The known suffix of the stack is as follows:
+##
+##
+
+
+
+source_file: SYMBOL WITH
+##
+## Ends in an error in state: 1.
+##
+## comp_variable_name -> SYMBOL . COLON [ TABLE COMPUTED ]
+## const_variable_name -> SYMBOL . COLON CONST [ EQUALS ]
+## error_name -> SYMBOL . COLON [ INFORMATIVE DISCORDANCE ANOMALY ]
+## fonction -> SYMBOL . COLON FONCTION SYMBOL SEMICOLON [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+## input_variable_name -> SYMBOL . COLON [ INPUT ]
+##
+## The known suffix of the stack is as follows:
+## SYMBOL
+##
+
+
+
+source_file: SYMBOL COLON WITH
+##
+## Ends in an error in state: 2.
+##
+## comp_variable_name -> SYMBOL COLON . [ TABLE COMPUTED ]
+## const_variable_name -> SYMBOL COLON . CONST [ EQUALS ]
+## error_name -> SYMBOL COLON . [ INFORMATIVE DISCORDANCE ANOMALY ]
+## fonction -> SYMBOL COLON . FONCTION SYMBOL SEMICOLON [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+## input_variable_name -> SYMBOL COLON . [ INPUT ]
+##
+## The known suffix of the stack is as follows:
+## SYMBOL COLON
+##
+
+
+
+source_file: SYMBOL COLON FONCTION WITH
+##
+## Ends in an error in state: 3.
+##
+## fonction -> SYMBOL COLON FONCTION . SYMBOL SEMICOLON [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## SYMBOL COLON FONCTION
+##
+
+
+
+source_file: SYMBOL COLON FONCTION SYMBOL WITH
+##
+## Ends in an error in state: 4.
+##
+## fonction -> SYMBOL COLON FONCTION SYMBOL . SEMICOLON [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## SYMBOL COLON FONCTION SYMBOL
+##
+
+
+
+source_file: SYMBOL COLON FONCTION SYMBOL SEMICOLON WITH
+##
+## Ends in an error in state: 8.
+##
+## list(with_pos(symbol_colon_etc)) -> symbol_colon_etc . list(with_pos(symbol_colon_etc)) [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## symbol_colon_etc
+##
+
+
+
+source_file: SYMBOL COLON INPUT WITH
+##
+## Ends in an error in state: 11.
+##
+## input_variable -> input_variable_name INPUT . list(input_attr_or_category) input_variable_alias COLON input_descr option(value_type) SEMICOLON [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## input_variable_name INPUT
+##
+
+
+
+source_file: SYMBOL COLON INPUT SYMBOL WITH
+##
+## Ends in an error in state: 15.
+##
+## input_attr_or_category -> symbol_with_pos . [ SYMBOL GIVEN_BACK ALIAS ]
+## variable_attribute -> symbol_with_pos . EQUALS variable_attribute_value [ SYMBOL GIVEN_BACK ALIAS ]
+##
+## The known suffix of the stack is as follows:
+## symbol_with_pos
+##
+
+
+
+source_file: SYMBOL COLON INPUT ALIAS WITH
+##
+## Ends in an error in state: 20.
+##
+## input_variable_alias -> ALIAS . SYMBOL [ COLON ]
+##
+## The known suffix of the stack is as follows:
+## ALIAS
+##
+
+
+
+source_file: SYMBOL COLON INPUT ALIAS SYMBOL WITH
+##
+## Ends in an error in state: 22.
+##
+## input_variable -> input_variable_name INPUT list(input_attr_or_category) input_variable_alias . COLON input_descr option(value_type) SEMICOLON [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## input_variable_name INPUT list(input_attr_or_category) input_variable_alias
+##
+
+
+
+source_file: SYMBOL COLON INPUT ALIAS SYMBOL COLON WITH
+##
+## Ends in an error in state: 23.
+##
+## input_variable -> input_variable_name INPUT list(input_attr_or_category) input_variable_alias COLON . input_descr option(value_type) SEMICOLON [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## input_variable_name INPUT list(input_attr_or_category) input_variable_alias COLON
+##
+
+
+
+source_file: SYMBOL COLON INPUT ALIAS SYMBOL COLON STRING WITH
+##
+## Ends in an error in state: 25.
+##
+## input_variable -> input_variable_name INPUT list(input_attr_or_category) input_variable_alias COLON input_descr . option(value_type) SEMICOLON [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## input_variable_name INPUT list(input_attr_or_category) input_variable_alias COLON input_descr
+##
+
+
+
+source_file: SYMBOL COLON COMPUTED COLON STRING TYPE WITH
+##
+## Ends in an error in state: 26.
+##
+## value_type -> TYPE . value_type_prim [ SEMICOLON ]
+##
+## The known suffix of the stack is as follows:
+## TYPE
+##
+
+
+
+source_file: SYMBOL COLON INPUT ALIAS SYMBOL COLON STRING TYPE BOOLEAN WITH
+##
+## Ends in an error in state: 35.
+##
+## input_variable -> input_variable_name INPUT list(input_attr_or_category) input_variable_alias COLON input_descr option(value_type) . SEMICOLON [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## input_variable_name INPUT list(input_attr_or_category) input_variable_alias COLON input_descr option(value_type)
+##
+
+
+
+source_file: SYMBOL COLON INPUT GIVEN_BACK WITH
+##
+## Ends in an error in state: 37.
+##
+## list(input_attr_or_category) -> input_attr_or_category . list(input_attr_or_category) [ ALIAS ]
+##
+## The known suffix of the stack is as follows:
+## input_attr_or_category
+##
+
+
+
+source_file: SYMBOL COLON ANOMALY WITH
+##
+## Ends in an error in state: 45.
+##
+## error_ -> error_name type_error . COLON error_descr COLON error_descr COLON error_descr COLON error_descr option(error_message) SEMICOLON [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## error_name type_error
+##
+
+
+
+source_file: SYMBOL COLON ANOMALY COLON WITH
+##
+## Ends in an error in state: 46.
+##
+## error_ -> error_name type_error COLON . error_descr COLON error_descr COLON error_descr COLON error_descr option(error_message) SEMICOLON [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## error_name type_error COLON
+##
+
+
+
+source_file: SYMBOL COLON ANOMALY COLON STRING WITH
+##
+## Ends in an error in state: 48.
+##
+## error_ -> error_name type_error COLON error_descr . COLON error_descr COLON error_descr COLON error_descr option(error_message) SEMICOLON [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## error_name type_error COLON error_descr
+##
+
+
+
+source_file: SYMBOL COLON ANOMALY COLON STRING COLON WITH
+##
+## Ends in an error in state: 49.
+##
+## error_ -> error_name type_error COLON error_descr COLON . error_descr COLON error_descr COLON error_descr option(error_message) SEMICOLON [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## error_name type_error COLON error_descr COLON
+##
+
+
+
+source_file: SYMBOL COLON ANOMALY COLON STRING COLON STRING WITH
+##
+## Ends in an error in state: 50.
+##
+## error_ -> error_name type_error COLON error_descr COLON error_descr . COLON error_descr COLON error_descr option(error_message) SEMICOLON [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## error_name type_error COLON error_descr COLON error_descr
+##
+
+
+
+source_file: SYMBOL COLON ANOMALY COLON STRING COLON STRING COLON WITH
+##
+## Ends in an error in state: 51.
+##
+## error_ -> error_name type_error COLON error_descr COLON error_descr COLON . error_descr COLON error_descr option(error_message) SEMICOLON [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## error_name type_error COLON error_descr COLON error_descr COLON
+##
+
+
+
+source_file: SYMBOL COLON ANOMALY COLON STRING COLON STRING COLON STRING WITH
+##
+## Ends in an error in state: 52.
+##
+## error_ -> error_name type_error COLON error_descr COLON error_descr COLON error_descr . COLON error_descr option(error_message) SEMICOLON [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## error_name type_error COLON error_descr COLON error_descr COLON error_descr
+##
+
+
+
+source_file: SYMBOL COLON ANOMALY COLON STRING COLON STRING COLON STRING COLON WITH
+##
+## Ends in an error in state: 53.
+##
+## error_ -> error_name type_error COLON error_descr COLON error_descr COLON error_descr COLON . error_descr option(error_message) SEMICOLON [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## error_name type_error COLON error_descr COLON error_descr COLON error_descr COLON
+##
+
+
+
+source_file: SYMBOL COLON ANOMALY COLON STRING COLON STRING COLON STRING COLON STRING WITH
+##
+## Ends in an error in state: 54.
+##
+## error_ -> error_name type_error COLON error_descr COLON error_descr COLON error_descr COLON error_descr . option(error_message) SEMICOLON [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## error_name type_error COLON error_descr COLON error_descr COLON error_descr COLON error_descr
+##
+
+
+
+source_file: SYMBOL COLON ANOMALY COLON STRING COLON STRING COLON STRING COLON STRING COLON WITH
+##
+## Ends in an error in state: 55.
+##
+## error_message -> COLON . error_descr [ SEMICOLON ]
+##
+## The known suffix of the stack is as follows:
+## COLON
+##
+
+
+
+source_file: SYMBOL COLON ANOMALY COLON STRING COLON STRING COLON STRING COLON STRING COLON STRING WITH
+##
+## Ends in an error in state: 57.
+##
+## error_ -> error_name type_error COLON error_descr COLON error_descr COLON error_descr COLON error_descr option(error_message) . SEMICOLON [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## error_name type_error COLON error_descr COLON error_descr COLON error_descr COLON error_descr option(error_message)
+##
+
+
+
+source_file: SYMBOL COLON CONST WITH
+##
+## Ends in an error in state: 61.
+##
+## const_variable -> const_variable_name . EQUALS const_value SEMICOLON [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## const_variable_name
+##
+
+
+
+source_file: SYMBOL COLON CONST EQUALS WITH
+##
+## Ends in an error in state: 62.
+##
+## const_variable -> const_variable_name EQUALS . const_value SEMICOLON [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## const_variable_name EQUALS
+##
+
+
+
+source_file: SYMBOL COLON CONST EQUALS SYMBOL WITH
+##
+## Ends in an error in state: 64.
+##
+## const_variable -> const_variable_name EQUALS const_value . SEMICOLON [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## const_variable_name EQUALS const_value
+##
+
+
+
+source_file: SYMBOL COLON TABLE WITH
+##
+## Ends in an error in state: 68.
+##
+## comp_variable_table -> TABLE . LBRACKET SYMBOL RBRACKET [ SEMICOLON COMPUTED COMMA ]
+##
+## The known suffix of the stack is as follows:
+## TABLE
+##
+
+
+
+source_file: SYMBOL COLON TABLE LBRACKET WITH
+##
+## Ends in an error in state: 69.
+##
+## comp_variable_table -> TABLE LBRACKET . SYMBOL RBRACKET [ SEMICOLON COMPUTED COMMA ]
+##
+## The known suffix of the stack is as follows:
+## TABLE LBRACKET
+##
+
+
+
+source_file: SYMBOL COLON TABLE LBRACKET SYMBOL WITH
+##
+## Ends in an error in state: 70.
+##
+## comp_variable_table -> TABLE LBRACKET SYMBOL . RBRACKET [ SEMICOLON COMPUTED COMMA ]
+##
+## The known suffix of the stack is as follows:
+## TABLE LBRACKET SYMBOL
+##
+
+
+
+source_file: SYMBOL COLON TABLE LBRACKET SYMBOL RBRACKET WITH
+##
+## Ends in an error in state: 72.
+##
+## comp_variable -> comp_variable_name option(with_pos(comp_variable_table)) . COMPUTED list(comp_attr_or_subtyp) COLON comp_variable_descr option(value_type) SEMICOLON [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## comp_variable_name option(with_pos(comp_variable_table))
+##
+
+
+
+source_file: SYMBOL COLON COMPUTED WITH
+##
+## Ends in an error in state: 73.
+##
+## comp_variable -> comp_variable_name option(with_pos(comp_variable_table)) COMPUTED . list(comp_attr_or_subtyp) COLON comp_variable_descr option(value_type) SEMICOLON [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## comp_variable_name option(with_pos(comp_variable_table)) COMPUTED
+##
+
+
+
+source_file: SYMBOL COLON COMPUTED COLON WITH
+##
+## Ends in an error in state: 79.
+##
+## comp_variable -> comp_variable_name option(with_pos(comp_variable_table)) COMPUTED list(comp_attr_or_subtyp) COLON . comp_variable_descr option(value_type) SEMICOLON [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## comp_variable_name option(with_pos(comp_variable_table)) COMPUTED list(comp_attr_or_subtyp) COLON
+##
+
+
+
+source_file: SYMBOL COLON COMPUTED COLON STRING WITH
+##
+## Ends in an error in state: 81.
+##
+## comp_variable -> comp_variable_name option(with_pos(comp_variable_table)) COMPUTED list(comp_attr_or_subtyp) COLON comp_variable_descr . option(value_type) SEMICOLON [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## comp_variable_name option(with_pos(comp_variable_table)) COMPUTED list(comp_attr_or_subtyp) COLON comp_variable_descr
+##
+
+
+
+source_file: SYMBOL COLON COMPUTED COLON STRING TYPE BOOLEAN WITH
+##
+## Ends in an error in state: 82.
+##
+## comp_variable -> comp_variable_name option(with_pos(comp_variable_table)) COMPUTED list(comp_attr_or_subtyp) COLON comp_variable_descr option(value_type) . SEMICOLON [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## comp_variable_name option(with_pos(comp_variable_table)) COMPUTED list(comp_attr_or_subtyp) COLON comp_variable_descr option(value_type)
+##
+
+
+
+source_file: VERIFICATION WITH
+##
+## Ends in an error in state: 92.
+##
+## verification -> VERIFICATION . symbol_list_with_pos COLON APPLICATION COLON symbol_enumeration SEMICOLON nonempty_list(with_pos(verification_condition)) [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## VERIFICATION
+##
+
+
+
+source_file: VERIFICATION SYMBOL WITH
+##
+## Ends in an error in state: 93.
+##
+## nonempty_list(symbol_with_pos) -> symbol_with_pos . [ SEMICOLON RPAREN COMMA COLON ]
+## nonempty_list(symbol_with_pos) -> symbol_with_pos . nonempty_list(symbol_with_pos) [ SEMICOLON RPAREN COMMA COLON ]
+##
+## The known suffix of the stack is as follows:
+## symbol_with_pos
+##
+
+
+
+source_file: VERIFICATION SYMBOL SEMICOLON
+##
+## Ends in an error in state: 95.
+##
+## verification -> VERIFICATION symbol_list_with_pos . COLON APPLICATION COLON symbol_enumeration SEMICOLON nonempty_list(with_pos(verification_condition)) [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## VERIFICATION symbol_list_with_pos
+##
+## WARNING: This example involves spurious reductions.
+## This implies that, although the LR(1) items shown above provide an
+## accurate view of the past (what has been recognized so far), they
+## may provide an INCOMPLETE view of the future (what was expected next).
+## In state 93, spurious reduction of production nonempty_list(symbol_with_pos) -> symbol_with_pos
+## In state 338, spurious reduction of production symbol_list_with_pos -> nonempty_list(symbol_with_pos)
+##
+
+
+
+source_file: VERIFICATION SYMBOL COLON WITH
+##
+## Ends in an error in state: 96.
+##
+## verification -> VERIFICATION symbol_list_with_pos COLON . APPLICATION COLON symbol_enumeration SEMICOLON nonempty_list(with_pos(verification_condition)) [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## VERIFICATION symbol_list_with_pos COLON
+##
+
+
+
+source_file: VERIFICATION SYMBOL COLON APPLICATION WITH
+##
+## Ends in an error in state: 97.
+##
+## verification -> VERIFICATION symbol_list_with_pos COLON APPLICATION . COLON symbol_enumeration SEMICOLON nonempty_list(with_pos(verification_condition)) [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## VERIFICATION symbol_list_with_pos COLON APPLICATION
+##
+
+
+
+source_file: VERIFICATION SYMBOL COLON APPLICATION COLON WITH
+##
+## Ends in an error in state: 98.
+##
+## verification -> VERIFICATION symbol_list_with_pos COLON APPLICATION COLON . symbol_enumeration SEMICOLON nonempty_list(with_pos(verification_condition)) [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## VERIFICATION symbol_list_with_pos COLON APPLICATION COLON
+##
+
+
+
+source_file: CHAINING SYMBOL APPLICATION COLON SYMBOL WITH
+##
+## Ends in an error in state: 99.
+##
+## separated_nonempty_list(COMMA,symbol_with_pos) -> symbol_with_pos . [ SEMICOLON ]
+## separated_nonempty_list(COMMA,symbol_with_pos) -> symbol_with_pos . COMMA separated_nonempty_list(COMMA,symbol_with_pos) [ SEMICOLON ]
+##
+## The known suffix of the stack is as follows:
+## symbol_with_pos
+##
+
+
+
+source_file: CHAINING SYMBOL APPLICATION COLON SYMBOL COMMA WITH
+##
+## Ends in an error in state: 100.
+##
+## separated_nonempty_list(COMMA,symbol_with_pos) -> symbol_with_pos COMMA . separated_nonempty_list(COMMA,symbol_with_pos) [ SEMICOLON ]
+##
+## The known suffix of the stack is as follows:
+## symbol_with_pos COMMA
+##
+
+
+
+source_file: VERIFICATION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WITH
+##
+## Ends in an error in state: 103.
+##
+## verification -> VERIFICATION symbol_list_with_pos COLON APPLICATION COLON symbol_enumeration SEMICOLON . nonempty_list(with_pos(verification_condition)) [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## VERIFICATION symbol_list_with_pos COLON APPLICATION COLON symbol_enumeration SEMICOLON
+##
+
+
+
+source_file: VERIFICATION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON IF WITH
+##
+## Ends in an error in state: 104.
+##
+## verification_condition -> IF . expression THEN ERROR symbol_with_pos option(with_pos(variable_name)) SEMICOLON [ VERIFICATION VARIABLE_SPACE VARIABLE TARGET SYMBOL RULE OUTPUT IF FONCTION EVENT EOF DOMAIN CHAINING APPLICATION ]
+##
+## The known suffix of the stack is as follows:
+## IF
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN TYPE WITH
+##
+## Ends in an error in state: 107.
+##
+## function_call -> TYPE . LPAREN var_access COMMA value_type_prim RPAREN [ TIMES THEN STEP SEMICOLON RPAREN RBRACKET RANGE PLUS OR NOT NEQ MOD MINUS LTE LT IN GTE GT EQUALS ENDIF ELSE DO DIV COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## TYPE
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN TYPE LPAREN WITH
+##
+## Ends in an error in state: 108.
+##
+## function_call -> TYPE LPAREN . var_access COMMA value_type_prim RPAREN [ TIMES THEN STEP SEMICOLON RPAREN RBRACKET RANGE PLUS OR NOT NEQ MOD MINUS LTE LT IN GTE GT EQUALS ENDIF ELSE DO DIV COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## TYPE LPAREN
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON RESTORE COLON EVENT_FIELD WITH
+##
+## Ends in an error in state: 109.
+##
+## var_access -> EVENT_FIELD . LPAREN expression COMMA symbol_with_pos RPAREN [ SEMICOLON RPAREN COMMA COLON ]
+##
+## The known suffix of the stack is as follows:
+## EVENT_FIELD
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON RESTORE COLON EVENT_FIELD LPAREN WITH
+##
+## Ends in an error in state: 110.
+##
+## var_access -> EVENT_FIELD LPAREN . expression COMMA symbol_with_pos RPAREN [ SEMICOLON RPAREN COMMA COLON ]
+##
+## The known suffix of the stack is as follows:
+## EVENT_FIELD LPAREN
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN SIZE WITH
+##
+## Ends in an error in state: 112.
+##
+## function_call -> SIZE . LPAREN var_access RPAREN [ TIMES THEN STEP SEMICOLON RPAREN RBRACKET RANGE PLUS OR NOT NEQ MOD MINUS LTE LT IN GTE GT EQUALS ENDIF ELSE DO DIV COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## SIZE
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN SIZE LPAREN WITH
+##
+## Ends in an error in state: 113.
+##
+## function_call -> SIZE LPAREN . var_access RPAREN [ TIMES THEN STEP SEMICOLON RPAREN RBRACKET RANGE PLUS OR NOT NEQ MOD MINUS LTE LT IN GTE GT EQUALS ENDIF ELSE DO DIV COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## SIZE LPAREN
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN SIZE LPAREN SYMBOL EQUALS
+##
+## Ends in an error in state: 114.
+##
+## function_call -> SIZE LPAREN var_access . RPAREN [ TIMES THEN STEP SEMICOLON RPAREN RBRACKET RANGE PLUS OR NOT NEQ MOD MINUS LTE LT IN GTE GT EQUALS ENDIF ELSE DO DIV COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## SIZE LPAREN var_access
+##
+## WARNING: This example involves spurious reductions.
+## This implies that, although the LR(1) items shown above provide an
+## accurate view of the past (what has been recognized so far), they
+## may provide an INCOMPLETE view of the future (what was expected next).
+## In state 116, spurious reduction of production option(with_pos(brackets)) ->
+## In state 317, spurious reduction of production var_access -> symbol_with_pos option(with_pos(brackets))
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON SYMBOL WITH
+##
+## Ends in an error in state: 116.
+##
+## var_access -> symbol_with_pos . DOT symbol_with_pos option(with_pos(brackets)) [ SEMICOLON RPAREN EQUALS COMMA COLON ]
+## var_access -> symbol_with_pos . option(with_pos(brackets)) [ SEMICOLON RPAREN EQUALS COMMA COLON ]
+## var_access -> symbol_with_pos . DOT EVENT_FIELD LPAREN expression COMMA symbol_with_pos RPAREN [ SEMICOLON RPAREN EQUALS COMMA COLON ]
+##
+## The known suffix of the stack is as follows:
+## symbol_with_pos
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON SYMBOL LBRACKET WITH
+##
+## Ends in an error in state: 117.
+##
+## brackets -> LBRACKET . expression RBRACKET [ SEMICOLON RPAREN EQUALS COMMA COLON ]
+##
+## The known suffix of the stack is as follows:
+## LBRACKET
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN SAME_VARIABLE WITH
+##
+## Ends in an error in state: 118.
+##
+## function_call -> SAME_VARIABLE . LPAREN var_access COMMA var_access RPAREN [ TIMES THEN STEP SEMICOLON RPAREN RBRACKET RANGE PLUS OR NOT NEQ MOD MINUS LTE LT IN GTE GT EQUALS ENDIF ELSE DO DIV COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## SAME_VARIABLE
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN SAME_VARIABLE LPAREN WITH
+##
+## Ends in an error in state: 119.
+##
+## function_call -> SAME_VARIABLE LPAREN . var_access COMMA var_access RPAREN [ TIMES THEN STEP SEMICOLON RPAREN RBRACKET RANGE PLUS OR NOT NEQ MOD MINUS LTE LT IN GTE GT EQUALS ENDIF ELSE DO DIV COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## SAME_VARIABLE LPAREN
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN SAME_VARIABLE LPAREN SYMBOL EQUALS
+##
+## Ends in an error in state: 120.
+##
+## function_call -> SAME_VARIABLE LPAREN var_access . COMMA var_access RPAREN [ TIMES THEN STEP SEMICOLON RPAREN RBRACKET RANGE PLUS OR NOT NEQ MOD MINUS LTE LT IN GTE GT EQUALS ENDIF ELSE DO DIV COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## SAME_VARIABLE LPAREN var_access
+##
+## WARNING: This example involves spurious reductions.
+## This implies that, although the LR(1) items shown above provide an
+## accurate view of the past (what has been recognized so far), they
+## may provide an INCOMPLETE view of the future (what was expected next).
+## In state 116, spurious reduction of production option(with_pos(brackets)) ->
+## In state 317, spurious reduction of production var_access -> symbol_with_pos option(with_pos(brackets))
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN SAME_VARIABLE LPAREN SYMBOL COMMA WITH
+##
+## Ends in an error in state: 121.
+##
+## function_call -> SAME_VARIABLE LPAREN var_access COMMA . var_access RPAREN [ TIMES THEN STEP SEMICOLON RPAREN RBRACKET RANGE PLUS OR NOT NEQ MOD MINUS LTE LT IN GTE GT EQUALS ENDIF ELSE DO DIV COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## SAME_VARIABLE LPAREN var_access COMMA
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN SAME_VARIABLE LPAREN SYMBOL COMMA SYMBOL EQUALS
+##
+## Ends in an error in state: 122.
+##
+## function_call -> SAME_VARIABLE LPAREN var_access COMMA var_access . RPAREN [ TIMES THEN STEP SEMICOLON RPAREN RBRACKET RANGE PLUS OR NOT NEQ MOD MINUS LTE LT IN GTE GT EQUALS ENDIF ELSE DO DIV COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## SAME_VARIABLE LPAREN var_access COMMA var_access
+##
+## WARNING: This example involves spurious reductions.
+## This implies that, although the LR(1) items shown above provide an
+## accurate view of the past (what has been recognized so far), they
+## may provide an INCOMPLETE view of the future (what was expected next).
+## In state 116, spurious reduction of production option(with_pos(brackets)) ->
+## In state 317, spurious reduction of production var_access -> symbol_with_pos option(with_pos(brackets))
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN NOT WITH
+##
+## Ends in an error in state: 124.
+##
+## expression -> NOT . expression [ THEN STEP SEMICOLON RPAREN RBRACKET RANGE OR ENDIF ELSE DO COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## NOT
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN NB_INFORMATIVES WITH
+##
+## Ends in an error in state: 125.
+##
+## function_call -> NB_INFORMATIVES . LPAREN RPAREN [ TIMES THEN STEP SEMICOLON RPAREN RBRACKET RANGE PLUS OR NOT NEQ MOD MINUS LTE LT IN GTE GT EQUALS ENDIF ELSE DO DIV COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## NB_INFORMATIVES
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN NB_INFORMATIVES LPAREN WITH
+##
+## Ends in an error in state: 126.
+##
+## function_call -> NB_INFORMATIVES LPAREN . RPAREN [ TIMES THEN STEP SEMICOLON RPAREN RBRACKET RANGE PLUS OR NOT NEQ MOD MINUS LTE LT IN GTE GT EQUALS ENDIF ELSE DO DIV COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## NB_INFORMATIVES LPAREN
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN NB_DISCORDANCES WITH
+##
+## Ends in an error in state: 128.
+##
+## function_call -> NB_DISCORDANCES . LPAREN RPAREN [ TIMES THEN STEP SEMICOLON RPAREN RBRACKET RANGE PLUS OR NOT NEQ MOD MINUS LTE LT IN GTE GT EQUALS ENDIF ELSE DO DIV COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## NB_DISCORDANCES
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN NB_DISCORDANCES LPAREN WITH
+##
+## Ends in an error in state: 129.
+##
+## function_call -> NB_DISCORDANCES LPAREN . RPAREN [ TIMES THEN STEP SEMICOLON RPAREN RBRACKET RANGE PLUS OR NOT NEQ MOD MINUS LTE LT IN GTE GT EQUALS ENDIF ELSE DO DIV COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## NB_DISCORDANCES LPAREN
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN NB_CATEGORY WITH
+##
+## Ends in an error in state: 131.
+##
+## function_call -> NB_CATEGORY . LPAREN var_category_id RPAREN [ TIMES THEN STEP SEMICOLON RPAREN RBRACKET RANGE PLUS OR NOT NEQ MOD MINUS LTE LT IN GTE GT EQUALS ENDIF ELSE DO DIV COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## NB_CATEGORY
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN NB_CATEGORY LPAREN WITH
+##
+## Ends in an error in state: 132.
+##
+## function_call -> NB_CATEGORY LPAREN . var_category_id RPAREN [ TIMES THEN STEP SEMICOLON RPAREN RBRACKET RANGE PLUS OR NOT NEQ MOD MINUS LTE LT IN GTE GT EQUALS ENDIF ELSE DO DIV COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## NB_CATEGORY LPAREN
+##
+
+
+
+source_file: DOMAIN VERIFICATION AUTHORIZE INPUT WITH
+##
+## Ends in an error in state: 134.
+##
+## var_category_id -> INPUT . TIMES [ SEMICOLON RPAREN COMMA COLON ]
+## var_category_id -> INPUT . nonempty_list(symbol_with_pos) [ SEMICOLON RPAREN COMMA COLON ]
+##
+## The known suffix of the stack is as follows:
+## INPUT
+##
+
+
+
+source_file: DOMAIN VERIFICATION AUTHORIZE COMPUTED WITH
+##
+## Ends in an error in state: 137.
+##
+## var_category_id -> COMPUTED . TIMES [ SEMICOLON RPAREN COMMA COLON ]
+## var_category_id -> COMPUTED . BASE [ SEMICOLON RPAREN COMMA COLON ]
+## var_category_id -> COMPUTED . [ SEMICOLON RPAREN COMMA COLON ]
+##
+## The known suffix of the stack is as follows:
+## COMPUTED
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN NB_CATEGORY LPAREN COMPUTED SEMICOLON
+##
+## Ends in an error in state: 140.
+##
+## function_call -> NB_CATEGORY LPAREN var_category_id . RPAREN [ TIMES THEN STEP SEMICOLON RPAREN RBRACKET RANGE PLUS OR NOT NEQ MOD MINUS LTE LT IN GTE GT EQUALS ENDIF ELSE DO DIV COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## NB_CATEGORY LPAREN var_category_id
+##
+## WARNING: This example involves spurious reductions.
+## This implies that, although the LR(1) items shown above provide an
+## accurate view of the past (what has been recognized so far), they
+## may provide an INCOMPLETE view of the future (what was expected next).
+## In state 137, spurious reduction of production var_category_id -> COMPUTED
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN NB_BLOCKING WITH
+##
+## Ends in an error in state: 142.
+##
+## function_call -> NB_BLOCKING . LPAREN RPAREN [ TIMES THEN STEP SEMICOLON RPAREN RBRACKET RANGE PLUS OR NOT NEQ MOD MINUS LTE LT IN GTE GT EQUALS ENDIF ELSE DO DIV COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## NB_BLOCKING
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN NB_BLOCKING LPAREN WITH
+##
+## Ends in an error in state: 143.
+##
+## function_call -> NB_BLOCKING LPAREN . RPAREN [ TIMES THEN STEP SEMICOLON RPAREN RBRACKET RANGE PLUS OR NOT NEQ MOD MINUS LTE LT IN GTE GT EQUALS ENDIF ELSE DO DIV COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## NB_BLOCKING LPAREN
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN NB_ANOMALIES WITH
+##
+## Ends in an error in state: 145.
+##
+## function_call -> NB_ANOMALIES . LPAREN RPAREN [ TIMES THEN STEP SEMICOLON RPAREN RBRACKET RANGE PLUS OR NOT NEQ MOD MINUS LTE LT IN GTE GT EQUALS ENDIF ELSE DO DIV COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## NB_ANOMALIES
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN NB_ANOMALIES LPAREN WITH
+##
+## Ends in an error in state: 146.
+##
+## function_call -> NB_ANOMALIES LPAREN . RPAREN [ TIMES THEN STEP SEMICOLON RPAREN RBRACKET RANGE PLUS OR NOT NEQ MOD MINUS LTE LT IN GTE GT EQUALS ENDIF ELSE DO DIV COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## NB_ANOMALIES LPAREN
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN MINUS WITH
+##
+## Ends in an error in state: 148.
+##
+## factor -> MINUS . factor [ TIMES THEN STEP SEMICOLON RPAREN RBRACKET RANGE PLUS OR NOT NEQ MOD MINUS LTE LT IN GTE GT EQUALS ENDIF ELSE DO DIV COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## MINUS
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN LPAREN WITH
+##
+## Ends in an error in state: 149.
+##
+## factor -> LPAREN . expression RPAREN [ TIMES THEN STEP SEMICOLON RPAREN RBRACKET RANGE PLUS OR NOT NEQ MOD MINUS LTE LT IN GTE GT EQUALS ENDIF ELSE DO DIV COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## LPAREN
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN IN_DOMAIN WITH
+##
+## Ends in an error in state: 150.
+##
+## function_call -> IN_DOMAIN . LPAREN var_access COMMA var_category_id RPAREN [ TIMES THEN STEP SEMICOLON RPAREN RBRACKET RANGE PLUS OR NOT NEQ MOD MINUS LTE LT IN GTE GT EQUALS ENDIF ELSE DO DIV COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## IN_DOMAIN
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN IN_DOMAIN LPAREN WITH
+##
+## Ends in an error in state: 151.
+##
+## function_call -> IN_DOMAIN LPAREN . var_access COMMA var_category_id RPAREN [ TIMES THEN STEP SEMICOLON RPAREN RBRACKET RANGE PLUS OR NOT NEQ MOD MINUS LTE LT IN GTE GT EQUALS ENDIF ELSE DO DIV COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## IN_DOMAIN LPAREN
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN IN_DOMAIN LPAREN SYMBOL EQUALS
+##
+## Ends in an error in state: 152.
+##
+## function_call -> IN_DOMAIN LPAREN var_access . COMMA var_category_id RPAREN [ TIMES THEN STEP SEMICOLON RPAREN RBRACKET RANGE PLUS OR NOT NEQ MOD MINUS LTE LT IN GTE GT EQUALS ENDIF ELSE DO DIV COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## IN_DOMAIN LPAREN var_access
+##
+## WARNING: This example involves spurious reductions.
+## This implies that, although the LR(1) items shown above provide an
+## accurate view of the past (what has been recognized so far), they
+## may provide an INCOMPLETE view of the future (what was expected next).
+## In state 116, spurious reduction of production option(with_pos(brackets)) ->
+## In state 317, spurious reduction of production var_access -> symbol_with_pos option(with_pos(brackets))
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN IN_DOMAIN LPAREN SYMBOL COMMA WITH
+##
+## Ends in an error in state: 153.
+##
+## function_call -> IN_DOMAIN LPAREN var_access COMMA . var_category_id RPAREN [ TIMES THEN STEP SEMICOLON RPAREN RBRACKET RANGE PLUS OR NOT NEQ MOD MINUS LTE LT IN GTE GT EQUALS ENDIF ELSE DO DIV COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## IN_DOMAIN LPAREN var_access COMMA
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN IN_DOMAIN LPAREN SYMBOL COMMA COMPUTED SEMICOLON
+##
+## Ends in an error in state: 154.
+##
+## function_call -> IN_DOMAIN LPAREN var_access COMMA var_category_id . RPAREN [ TIMES THEN STEP SEMICOLON RPAREN RBRACKET RANGE PLUS OR NOT NEQ MOD MINUS LTE LT IN GTE GT EQUALS ENDIF ELSE DO DIV COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## IN_DOMAIN LPAREN var_access COMMA var_category_id
+##
+## WARNING: This example involves spurious reductions.
+## This implies that, although the LR(1) items shown above provide an
+## accurate view of the past (what has been recognized so far), they
+## may provide an INCOMPLETE view of the future (what was expected next).
+## In state 137, spurious reduction of production var_category_id -> COMPUTED
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN IF WITH
+##
+## Ends in an error in state: 156.
+##
+## ternary_operator -> IF . expression THEN expression option(else_branch) ENDIF [ TIMES THEN STEP SEMICOLON RPAREN RBRACKET RANGE PLUS OR NOT NEQ MOD MINUS LTE LT IN GTE GT EQUALS ENDIF ELSE DO DIV COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## IF
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN FOR WITH
+##
+## Ends in an error in state: 157.
+##
+## expression -> FOR . loop_expression [ THEN STEP SEMICOLON RPAREN RBRACKET RANGE OR ENDIF ELSE DO COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## FOR
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON FOR ONE WITH
+##
+## Ends in an error in state: 159.
+##
+## loop_variables_range -> ONE . loop_variable_value_name IN enumeration_loop [ COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## ONE
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON FOR ONE SYMBOL WITH
+##
+## Ends in an error in state: 160.
+##
+## loop_variables_range -> ONE loop_variable_value_name . IN enumeration_loop [ COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## ONE loop_variable_value_name
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON FOR ONE SYMBOL IN WITH
+##
+## Ends in an error in state: 161.
+##
+## loop_variables_range -> ONE loop_variable_value_name IN . enumeration_loop [ COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## ONE loop_variable_value_name IN
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON FOR SYMBOL EQUALS SYMBOL WITH
+##
+## Ends in an error in state: 162.
+##
+## enumeration_loop_item -> SYMBOL . [ SEMICOLON COMMA COLON AND ]
+## interval_loop -> SYMBOL . range_or_minus SYMBOL [ SEMICOLON COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## SYMBOL
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON FOR SYMBOL EQUALS SYMBOL MINUS WITH
+##
+## Ends in an error in state: 165.
+##
+## interval_loop -> SYMBOL range_or_minus . SYMBOL [ SEMICOLON COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## SYMBOL range_or_minus
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON FOR SYMBOL EQUALS SYMBOL MINUS SYMBOL WITH
+##
+## Ends in an error in state: 168.
+##
+## enumeration_loop -> enumeration_loop_item . [ SEMICOLON COLON AND ]
+## enumeration_loop -> enumeration_loop_item . COMMA enumeration_loop [ SEMICOLON COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## enumeration_loop_item
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON FOR SYMBOL EQUALS SYMBOL COMMA WITH
+##
+## Ends in an error in state: 169.
+##
+## enumeration_loop -> enumeration_loop_item COMMA . enumeration_loop [ SEMICOLON COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## enumeration_loop_item COMMA
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON FOR SYMBOL EQUALS SYMBOL AND
+##
+## Ends in an error in state: 174.
+##
+## separated_nonempty_list(SEMICOLON,loop_variables_value) -> loop_variables_value . [ COLON ]
+## separated_nonempty_list(SEMICOLON,loop_variables_value) -> loop_variables_value . SEMICOLON separated_nonempty_list(SEMICOLON,loop_variables_value) [ COLON ]
+##
+## The known suffix of the stack is as follows:
+## loop_variables_value
+##
+## WARNING: This example involves spurious reductions.
+## This implies that, although the LR(1) items shown above provide an
+## accurate view of the past (what has been recognized so far), they
+## may provide an INCOMPLETE view of the future (what was expected next).
+## In state 162, spurious reduction of production enumeration_loop_item -> SYMBOL
+## In state 168, spurious reduction of production enumeration_loop -> enumeration_loop_item
+## In state 179, spurious reduction of production loop_variables_value -> loop_variable_value_name EQUALS enumeration_loop
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON FOR SYMBOL EQUALS SYMBOL SEMICOLON WITH
+##
+## Ends in an error in state: 175.
+##
+## separated_nonempty_list(SEMICOLON,loop_variables_value) -> loop_variables_value SEMICOLON . separated_nonempty_list(SEMICOLON,loop_variables_value) [ COLON ]
+##
+## The known suffix of the stack is as follows:
+## loop_variables_value SEMICOLON
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON FOR SYMBOL WITH
+##
+## Ends in an error in state: 177.
+##
+## loop_variables_value -> loop_variable_value_name . EQUALS enumeration_loop [ SEMICOLON COLON ]
+##
+## The known suffix of the stack is as follows:
+## loop_variable_value_name
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON FOR SYMBOL EQUALS WITH
+##
+## Ends in an error in state: 178.
+##
+## loop_variables_value -> loop_variable_value_name EQUALS . enumeration_loop [ SEMICOLON COLON ]
+##
+## The known suffix of the stack is as follows:
+## loop_variable_value_name EQUALS
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON FOR ONE SYMBOL IN SYMBOL SEMICOLON
+##
+## Ends in an error in state: 181.
+##
+## loop_variables_ranges -> loop_variables_range . [ COLON ]
+## loop_variables_ranges -> loop_variables_range . AND loop_variables_ranges [ COLON ]
+##
+## The known suffix of the stack is as follows:
+## loop_variables_range
+##
+## WARNING: This example involves spurious reductions.
+## This implies that, although the LR(1) items shown above provide an
+## accurate view of the past (what has been recognized so far), they
+## may provide an INCOMPLETE view of the future (what was expected next).
+## In state 162, spurious reduction of production enumeration_loop_item -> SYMBOL
+## In state 168, spurious reduction of production enumeration_loop -> enumeration_loop_item
+## In state 171, spurious reduction of production loop_variables_range -> ONE loop_variable_value_name IN enumeration_loop
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON FOR ONE SYMBOL IN SYMBOL AND WITH
+##
+## Ends in an error in state: 182.
+##
+## loop_variables_ranges -> loop_variables_range AND . loop_variables_ranges [ COLON ]
+##
+## The known suffix of the stack is as follows:
+## loop_variables_range AND
+##
+
+
+
+source_file: FONCTION SYMBOL COLON APPLICATION COLON SYMBOL SEMICOLON WHEN FOR SYMBOL EQUALS SYMBOL COLON WITH
+##
+## Ends in an error in state: 185.
+##
+## loop_expression -> loop_variables COLON . expression [ THEN STEP SEMICOLON RPAREN RBRACKET RANGE OR ENDIF ELSE DO COMMA COLON AND ]
+##
+## The known suffix of the stack is as follows:
+## loop_variables COLON
+##
+
+