version 1.30, 2011/07/22 07:38:41
|
version 1.78, 2024/01/09 07:33:55
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.1 |
RPL/2 (R) version 4.1.35 |
Copyright (C) 1989-2011 Dr. BERTRAND Joël |
Copyright (C) 1989-2024 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
|
|
Line 497 formateur_elementaire_tex(struct_process
|
Line 497 formateur_elementaire_tex(struct_process
|
unsigned char test_instruction; |
unsigned char test_instruction; |
unsigned char *tampon; |
unsigned char *tampon; |
|
|
unsigned long i; |
integer8 i; |
unsigned long j; |
integer8 j; |
unsigned long niveau; |
integer8 niveau; |
unsigned long nombre_arguments; |
integer8 nombre_arguments; |
|
|
/* |
/* |
* Entier binaire |
* Entier binaire |
Line 582 formateur_elementaire_tex(struct_process
|
Line 582 formateur_elementaire_tex(struct_process
|
|
|
if ((*s_etat_processus).instruction_valide == 'Y') |
if ((*s_etat_processus).instruction_valide == 'Y') |
{ |
{ |
if ((instruction_majuscule = conversion_majuscule( |
if ((instruction_majuscule = conversion_majuscule(s_etat_processus, |
(*s_etat_processus).instruction_courante)) == NULL) |
(*s_etat_processus).instruction_courante)) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
Line 977 formateur_elementaire_tex(struct_process
|
Line 977 formateur_elementaire_tex(struct_process
|
return; |
return; |
} |
} |
|
|
for(i = 0; i < strlen(ligne); i++) |
for(i = 0; i < (integer8) strlen(ligne); i++) |
{ |
{ |
switch(ligne[i]) |
switch(ligne[i]) |
{ |
{ |
Line 992 formateur_elementaire_tex(struct_process
|
Line 992 formateur_elementaire_tex(struct_process
|
return; |
return; |
} |
} |
|
|
strncpy(tampon, ligne, i); |
strncpy(tampon, ligne, (size_t) i); |
strcpy(&(tampon[i]), "\\times 10^{"); |
strcpy(&(tampon[i]), "\\times 10^{"); |
strcat(tampon, &(ligne[++i])); |
strcat(tampon, &(ligne[++i])); |
strcat(tampon, "}"); |
strcat(tampon, "}"); |
Line 1014 formateur_elementaire_tex(struct_process
|
Line 1014 formateur_elementaire_tex(struct_process
|
return; |
return; |
} |
} |
|
|
strncpy(tampon, ligne, ++i); |
strncpy(tampon, ligne, (size_t) ++i); |
strcpy(&(tampon[i]), "\\!"); |
strcpy(&(tampon[i]), "\\!"); |
strcat(tampon, &(ligne[i])); |
strcat(tampon, &(ligne[i])); |
i += 2; |
i += 2; |
Line 1539 formateur_elementaire_tex(struct_process
|
Line 1539 formateur_elementaire_tex(struct_process
|
{ |
{ |
niveau = 0; |
niveau = 0; |
|
|
for(i = 1; i < (strlen((unsigned char *) |
for(i = 1; i < (integer8) |
|
(strlen((unsigned char *) |
(*s_sous_objet_1).objet) - 1); i++) |
(*s_sous_objet_1).objet) - 1); i++) |
{ |
{ |
if (((unsigned char *) (*s_sous_objet_1) |
if (((unsigned char *) (*s_sous_objet_1) |
Line 1561 formateur_elementaire_tex(struct_process
|
Line 1562 formateur_elementaire_tex(struct_process
|
|
|
if (niveau == 0) |
if (niveau == 0) |
{ |
{ |
sprintf((unsigned char *) (*s_sous_objet_1) |
memmove(((unsigned char *) (*s_sous_objet_1) |
.objet, "%s", &(((unsigned char *) |
.objet), ((unsigned char *) |
(*s_sous_objet_1).objet)[1])); |
(*s_sous_objet_1).objet) + 1, |
((unsigned char *) (*s_sous_objet_1).objet) |
strlen((unsigned char *) |
[strlen((unsigned char *) |
(*s_sous_objet_1).objet)); |
(*s_sous_objet_1).objet) - 1] = |
|
d_code_fin_chaine; |
|
} |
} |
} |
} |
|
|
chaine_parametre = (unsigned char *) |
chaine_parametre = (unsigned char *) |
(*s_sous_objet_1).objet; |
(*s_sous_objet_1).objet; |
conversion_element_tex(&chaine_parametre, "^"); |
conversion_element_tex(s_etat_processus, |
|
&chaine_parametre, "^"); |
|
|
if ((*s_sous_objet_1).objet == NULL) |
if ((*s_sous_objet_1).objet == NULL) |
{ |
{ |
Line 1601 formateur_elementaire_tex(struct_process
|
Line 1601 formateur_elementaire_tex(struct_process
|
{ |
{ |
chaine_parametre = (unsigned char *) |
chaine_parametre = (unsigned char *) |
(*s_sous_objet_1).objet; |
(*s_sous_objet_1).objet; |
conversion_element_tex(&chaine_parametre, |
conversion_element_tex(s_etat_processus, |
(*((struct_fonction *) |
&chaine_parametre, (*((struct_fonction *) |
(*(*l_element_courant).donnee).objet)) |
(*(*l_element_courant).donnee).objet)) |
.nom_fonction); |
.nom_fonction); |
|
|
Line 1615 formateur_elementaire_tex(struct_process
|
Line 1615 formateur_elementaire_tex(struct_process
|
|
|
chaine_parametre = (unsigned char *) |
chaine_parametre = (unsigned char *) |
(*s_sous_objet_2).objet; |
(*s_sous_objet_2).objet; |
conversion_element_tex(&chaine_parametre, |
conversion_element_tex(s_etat_processus, |
(*((struct_fonction *) |
&chaine_parametre, (*((struct_fonction *) |
(*(*l_element_courant).donnee).objet)) |
(*(*l_element_courant).donnee).objet)) |
.nom_fonction); |
.nom_fonction); |
|
|
Line 1699 formateur_elementaire_tex(struct_process
|
Line 1699 formateur_elementaire_tex(struct_process
|
{ |
{ |
chaine_parametre = (unsigned char *) |
chaine_parametre = (unsigned char *) |
(*s_sous_objet_1).objet; |
(*s_sous_objet_1).objet; |
conversion_element_tex(&chaine_parametre, |
conversion_element_tex(s_etat_processus, |
|
&chaine_parametre, |
(*((struct_fonction *) |
(*((struct_fonction *) |
(*(*l_element_courant).donnee).objet)) |
(*(*l_element_courant).donnee).objet)) |
.nom_fonction); |
.nom_fonction); |
Line 1713 formateur_elementaire_tex(struct_process
|
Line 1714 formateur_elementaire_tex(struct_process
|
|
|
chaine_parametre = (unsigned char *) |
chaine_parametre = (unsigned char *) |
(*s_sous_objet_2).objet; |
(*s_sous_objet_2).objet; |
conversion_element_tex(&chaine_parametre, |
conversion_element_tex(s_etat_processus, |
|
&chaine_parametre, |
(*((struct_fonction *) |
(*((struct_fonction *) |
(*(*l_element_courant).donnee).objet)) |
(*(*l_element_courant).donnee).objet)) |
.nom_fonction); |
.nom_fonction); |
Line 1982 formateur_elementaire_tex(struct_process
|
Line 1984 formateur_elementaire_tex(struct_process
|
|
|
if ((*s_etat_processus).instruction_valide == 'Y') |
if ((*s_etat_processus).instruction_valide == 'Y') |
{ |
{ |
for(i = 0; i < strlen(chaine); i++) |
for(i = 0; i < (integer8) strlen(chaine); i++) |
{ |
{ |
if ((chaine[i] >= 'A') && (chaine[i] <= 'Z')) |
if ((chaine[i] >= 'A') && (chaine[i] <= 'Z')) |
{ |
{ |
chaine[i] += ('a' - 'A'); |
chaine[i] = (unsigned char) |
|
(chaine[i] + ('a' - 'A')); |
} |
} |
} |
} |
} |
} |
Line 2043 formateur_elementaire_tex(struct_process
|
Line 2046 formateur_elementaire_tex(struct_process
|
ptrl = chaine_sauvegarde; |
ptrl = chaine_sauvegarde; |
ptre = (unsigned char *) (*s_sous_objet).objet; |
ptre = (unsigned char *) (*s_sous_objet).objet; |
|
|
for(ptrl++, i = strlen(chaine_sauvegarde) - 2; i > 0; |
for(ptrl++, i = (integer8) (strlen(chaine_sauvegarde) - 2); |
i--, *ptre++ = *ptrl++); |
i > 0; i--, *ptre++ = *ptrl++); |
|
|
(*ptre) = d_code_fin_chaine; |
(*ptre) = d_code_fin_chaine; |
|
|
free(chaine_sauvegarde); |
free(chaine_sauvegarde); |
|
|
chaine_majuscule = conversion_majuscule((*((struct_nom *) |
chaine_majuscule = conversion_majuscule(s_etat_processus, |
(*(*l_element_courant).donnee).objet)).nom); |
(*((struct_nom *) (*(*l_element_courant).donnee) |
|
.objet)).nom); |
|
|
if (strcmp(chaine_majuscule, "PI") == 0) |
if (strcmp(chaine_majuscule, "PI") == 0) |
{ |
{ |
Line 2154 correction_formateur_tex(struct_processu
|
Line 2158 correction_formateur_tex(struct_processu
|
logical1 mode_mathematique; |
logical1 mode_mathematique; |
|
|
unsigned char *tampon; |
unsigned char *tampon; |
unsigned long i; |
|
|
integer8 i; |
|
|
mode_mathematique = d_faux; |
mode_mathematique = d_faux; |
|
|
for(i = 0; i < strlen((*ligne)); i++) |
for(i = 0; i < (integer8) strlen((*ligne)); i++) |
{ |
{ |
switch((*ligne)[i]) |
switch((*ligne)[i]) |
{ |
{ |
Line 2186 correction_formateur_tex(struct_processu
|
Line 2191 correction_formateur_tex(struct_processu
|
*/ |
*/ |
|
|
case '#' : |
case '#' : |
|
# if __GNUC__ >= 7 |
|
__attribute__ ((fallthrough)); |
|
# endif |
|
|
case '_' : |
case '_' : |
{ |
{ |
if (mode_mathematique == d_vrai) |
if (mode_mathematique == d_vrai) |
{ |
{ |
break; |
break; |
} |
} |
|
# if __GNUC__ >= 7 |
|
__attribute__ ((fallthrough)); |
|
# endif |
} |
} |
|
|
case '%' : |
case '%' : |
|
# if __GNUC__ >= 7 |
|
__attribute__ ((fallthrough)); |
|
# endif |
case '&' : |
case '&' : |
{ |
{ |
if ((tampon = (unsigned char *) malloc((strlen((*ligne)) + 2) * |
if ((tampon = (unsigned char *) malloc((strlen((*ligne)) + 2) * |
Line 2205 correction_formateur_tex(struct_processu
|
Line 2220 correction_formateur_tex(struct_processu
|
return; |
return; |
} |
} |
|
|
strncpy(tampon, (*ligne), i); |
strncpy(tampon, (*ligne), (size_t) i); |
strcpy(&(tampon[i]), "\\"); |
strcpy(&(tampon[i]), "\\"); |
strcat(tampon, &((*ligne)[i++])); |
strcat(tampon, &((*ligne)[i++])); |
|
|
Line 2251 impression_tex(struct_processus *s_etat_
|
Line 2266 impression_tex(struct_processus *s_etat_
|
unsigned char *nom_fichier_tex; |
unsigned char *nom_fichier_tex; |
unsigned char *nom_fichier_ps; |
unsigned char *nom_fichier_ps; |
|
|
unsigned long longueur_nom_base; |
size_t longueur_nom_base; |
|
|
longueur_nom_base = strlen((*s_etat_processus).nom_fichier_impression); |
longueur_nom_base = strlen((*s_etat_processus).nom_fichier_impression); |
|
|
Line 2332 impression_tex(struct_processus *s_etat_
|
Line 2347 impression_tex(struct_processus *s_etat_
|
|
|
if ((*s_etat_processus).rpl_home == NULL) |
if ((*s_etat_processus).rpl_home == NULL) |
{ |
{ |
if (alsprintf(&commande, ds_tex_commande, |
if (alsprintf(s_etat_processus, &commande, ds_tex_commande, |
d_exec_path, d_exec_path, d_exec_path, |
d_exec_path, d_exec_path, d_exec_path, |
(*s_etat_processus).nom_fichier_impression, |
(*s_etat_processus).nom_fichier_impression, |
d_exec_path, d_exec_path, |
d_exec_path, d_exec_path, |
Line 2344 impression_tex(struct_processus *s_etat_
|
Line 2359 impression_tex(struct_processus *s_etat_
|
return; |
return; |
} |
} |
|
|
if (alsprintf(&executable_candidat, "%s/bin/rpliconv", |
if (alsprintf(s_etat_processus, &executable_candidat, "%s/bin/rpliconv", |
d_exec_path) < 0) |
d_exec_path) < 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
} |
} |
|
|
if (controle(s_etat_processus, executable_candidat, "md5", |
if (controle_integrite(s_etat_processus, executable_candidat, |
rpliconv_md5) != d_vrai) |
"rpliconv") != d_vrai) |
{ |
|
(*s_etat_processus).erreur_systeme = d_es_somme_controle; |
|
return; |
|
} |
|
|
|
if (controle(s_etat_processus, executable_candidat, "sha1", |
|
rpliconv_sha1) != d_vrai) |
|
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_somme_controle; |
(*s_etat_processus).erreur_systeme = d_es_somme_controle; |
return; |
return; |
Line 2367 impression_tex(struct_processus *s_etat_
|
Line 2375 impression_tex(struct_processus *s_etat_
|
|
|
free(executable_candidat); |
free(executable_candidat); |
|
|
if (alsprintf(&executable_candidat, "%s/bin/rplfile", |
if (alsprintf(s_etat_processus, &executable_candidat, "%s/bin/rplfile", |
d_exec_path) < 0) |
d_exec_path) < 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
} |
} |
|
|
if (controle(s_etat_processus, executable_candidat, "md5", |
if (controle_integrite(s_etat_processus, executable_candidat, |
rplfile_md5) != d_vrai) |
"rplfile") != d_vrai) |
{ |
|
(*s_etat_processus).erreur_systeme = d_es_somme_controle; |
|
return; |
|
} |
|
|
|
if (controle(s_etat_processus, executable_candidat, "sha1", |
|
rplfile_sha1) != d_vrai) |
|
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_somme_controle; |
(*s_etat_processus).erreur_systeme = d_es_somme_controle; |
return; |
return; |
Line 2392 impression_tex(struct_processus *s_etat_
|
Line 2393 impression_tex(struct_processus *s_etat_
|
} |
} |
else |
else |
{ |
{ |
if (alsprintf(&commande, ds_tex_commande, |
if (alsprintf(s_etat_processus, &commande, ds_tex_commande, |
(*s_etat_processus).rpl_home, |
(*s_etat_processus).rpl_home, |
(*s_etat_processus).rpl_home, |
(*s_etat_processus).rpl_home, |
(*s_etat_processus).rpl_home, |
(*s_etat_processus).rpl_home, |
Line 2407 impression_tex(struct_processus *s_etat_
|
Line 2408 impression_tex(struct_processus *s_etat_
|
return; |
return; |
} |
} |
|
|
if (alsprintf(&executable_candidat, "%s/bin/rpliconv", |
if (alsprintf(s_etat_processus, &executable_candidat, "%s/bin/rpliconv", |
(*s_etat_processus).rpl_home) < 0) |
(*s_etat_processus).rpl_home) < 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
} |
} |
|
|
if (controle(s_etat_processus, executable_candidat, "md5", |
if (controle_integrite(s_etat_processus, executable_candidat, |
rpliconv_md5) != d_vrai) |
"rpliconv") != d_vrai) |
{ |
|
(*s_etat_processus).erreur_systeme = d_es_somme_controle; |
|
return; |
|
} |
|
|
|
if (controle(s_etat_processus, executable_candidat, "sha1", |
|
rpliconv_sha1) != d_vrai) |
|
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_somme_controle; |
(*s_etat_processus).erreur_systeme = d_es_somme_controle; |
return; |
return; |
Line 2430 impression_tex(struct_processus *s_etat_
|
Line 2424 impression_tex(struct_processus *s_etat_
|
|
|
free(executable_candidat); |
free(executable_candidat); |
|
|
if (alsprintf(&executable_candidat, "%s/bin/rplfile", |
if (alsprintf(s_etat_processus, &executable_candidat, "%s/bin/rplfile", |
(*s_etat_processus).rpl_home) < 0) |
(*s_etat_processus).rpl_home) < 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
} |
} |
|
|
if (controle(s_etat_processus, executable_candidat, "md5", |
if (controle_integrite(s_etat_processus, executable_candidat, |
rplfile_md5) != d_vrai) |
"rplfile") != d_vrai) |
{ |
|
(*s_etat_processus).erreur_systeme = d_es_somme_controle; |
|
return; |
|
} |
|
|
|
if (controle(s_etat_processus, executable_candidat, "sha1", |
|
rplfile_sha1) != d_vrai) |
|
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_somme_controle; |
(*s_etat_processus).erreur_systeme = d_es_somme_controle; |
return; |
return; |
Line 2463 impression_tex(struct_processus *s_etat_
|
Line 2450 impression_tex(struct_processus *s_etat_
|
{ |
{ |
free(commande); |
free(commande); |
|
|
if (alsprintf(&commande, ds_tex_postscript, nom_fichier_ps) < 0) |
if (alsprintf(s_etat_processus, &commande, ds_tex_postscript, |
|
nom_fichier_ps) < 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 2564 impression_tex(struct_processus *s_etat_
|
Line 2552 impression_tex(struct_processus *s_etat_
|
*/ |
*/ |
|
|
void |
void |
conversion_element_tex(unsigned char **element, unsigned char *fonction) |
conversion_element_tex(struct_processus *s_etat_processus, |
|
unsigned char **element, unsigned char *fonction) |
{ |
{ |
unsigned char *chaine; |
unsigned char *chaine; |
unsigned char *element_courant; |
unsigned char *element_courant; |
unsigned char *extrait; |
unsigned char *extrait; |
|
|
unsigned long debut_fonction; |
integer8 debut_fonction; |
unsigned long i; |
integer8 i; |
unsigned long niveau; |
integer8 niveau; |
unsigned long nombre_passages_par_zero; |
integer8 nombre_passages_par_zero; |
|
|
element_courant = (*element); |
element_courant = (*element); |
niveau = 0; |
niveau = 0; |
Line 2587 conversion_element_tex(unsigned char **e
|
Line 2576 conversion_element_tex(unsigned char **e
|
{ |
{ |
if (niveau == 0) |
if (niveau == 0) |
{ |
{ |
extrait = extraction_chaine((*element), debut_fonction, i - 1); |
extrait = extraction_chaine(s_etat_processus, |
|
(*element), debut_fonction, i - 1); |
|
|
if (strcmp(extrait, fonction) != 0) |
if (strcmp(extrait, fonction) != 0) |
{ |
{ |