version 1.6, 2010/02/10 10:14:19
|
version 1.44, 2011/11/26 13:05:03
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.0.11 |
RPL/2 (R) version 4.1.5 |
Copyright (C) 1989-2010 Dr. BERTRAND Joël |
Copyright (C) 1989-2011 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
|
|
Line 20
|
Line 20
|
*/ |
*/ |
|
|
|
|
#include "rpl.conv.h" |
#include "rpl-conv.h" |
|
|
|
|
/* |
/* |
Line 47 formateur(struct_processus *s_etat_proce
|
Line 47 formateur(struct_processus *s_etat_proce
|
logical4 autorisation_parenthese; |
logical4 autorisation_parenthese; |
logical4 presence_signe; |
logical4 presence_signe; |
|
|
|
long longueur_chaine; |
|
|
struct_liste_chainee *l_atome; |
struct_liste_chainee *l_atome; |
struct_liste_chainee *l_element_courant; |
struct_liste_chainee *l_element_courant; |
struct_liste_chainee *l_liste1; |
struct_liste_chainee *l_liste1; |
Line 67 formateur(struct_processus *s_etat_proce
|
Line 69 formateur(struct_processus *s_etat_proce
|
unsigned char *format_majuscule; |
unsigned char *format_majuscule; |
unsigned char *ptre; |
unsigned char *ptre; |
unsigned char *ptrl; |
unsigned char *ptrl; |
unsigned char *ptr_ecriture; |
|
unsigned char *ptr_lecture; |
|
unsigned char *registre; |
unsigned char *registre; |
unsigned char tampon[1024 + 1]; |
unsigned char tampon[1024 + 1]; |
|
|
unsigned long i; |
unsigned long i; |
unsigned long j; |
unsigned long j; |
unsigned long k; |
unsigned long k; |
unsigned long longueur_binaire; |
|
unsigned long longueur_courante; |
unsigned long longueur_courante; |
unsigned long longueur_decimale_courante; |
unsigned long longueur_decimale_courante; |
unsigned long *longueurs_maximales; |
unsigned long *longueurs_maximales; |
Line 94 formateur(struct_processus *s_etat_proce
|
Line 93 formateur(struct_processus *s_etat_proce
|
|
|
strcpy(base, " "); |
strcpy(base, " "); |
|
|
longueur_binaire = 0; |
|
masque_binaire = 0; |
masque_binaire = 0; |
|
|
if ((*s_objet).type == ADR) |
if ((*s_objet).type == ADR) |
Line 190 formateur(struct_processus *s_etat_proce
|
Line 188 formateur(struct_processus *s_etat_proce
|
# ifdef POSTGRESQL_SUPPORT |
# ifdef POSTGRESQL_SUPPORT |
if (alsprintf(&chaine, "Sql $ %016lX (%s)", |
if (alsprintf(&chaine, "Sql $ %016lX (%s)", |
(long unsigned int) (*((struct_connecteur_sql *) |
(long unsigned int) (*((struct_connecteur_sql *) |
(*s_objet).objet)).descripteur.mysql, |
(*s_objet).objet)).descripteur.postgresql, |
(*((struct_connecteur_sql *) (*s_objet).objet)).type) < 0) |
(*((struct_connecteur_sql *) (*s_objet).objet)).type) < 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
Line 392 formateur(struct_processus *s_etat_proce
|
Line 390 formateur(struct_processus *s_etat_proce
|
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
*/ |
*/ |
|
|
if (alsprintf(&chaine, "Socket %016lX", |
if (alsprintf(&chaine, "Socket $ %016lX", |
(unsigned long) (*((struct_socket *) |
(unsigned long) (*((struct_socket *) |
((*s_objet).objet))).socket) < 0) |
((*s_objet).objet))).socket) < 0) |
{ |
{ |
Line 1580 formateur(struct_processus *s_etat_proce
|
Line 1578 formateur(struct_processus *s_etat_proce
|
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
*/ |
*/ |
|
|
longueur_binaire = longueur_entiers_binaires(s_etat_processus); |
|
masque_binaire = masque_entiers_binaires(s_etat_processus); |
masque_binaire = masque_entiers_binaires(s_etat_processus); |
|
|
if ((test_cfsf(s_etat_processus, 43) == d_faux) && |
if ((test_cfsf(s_etat_processus, 43) == d_faux) && |
Line 1752 formateur(struct_processus *s_etat_proce
|
Line 1749 formateur(struct_processus *s_etat_proce
|
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
*/ |
*/ |
|
|
if ((chaine = malloc((strlen((unsigned char *) |
if (((*s_etat_processus).autorisation_conversion_chaine == 'Y') && |
((*s_objet).objet)) + 1) * sizeof(unsigned char))) == NULL) |
(test_cfsf(s_etat_processus, 34) == d_vrai)) |
{ |
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
|
return(NULL); |
|
} |
|
|
|
if ((*s_etat_processus).autorisation_conversion_chaine == 'Y') |
|
{ |
{ |
ptr_lecture = (unsigned char *) (*s_objet).objet; |
if ((chaine = formateur_flux(s_etat_processus, |
ptr_ecriture = chaine; |
(unsigned char *) (*s_objet).objet, &longueur_chaine)) |
|
== NULL) |
while((*ptr_lecture) != d_code_fin_chaine) |
|
{ |
{ |
(*ptr_ecriture) = (*ptr_lecture); |
|
|
|
// Début de la séquence d'échappement |
|
|
|
if ((*ptr_lecture) == '\\') |
|
{ |
|
if ((*(ptr_lecture + 1)) == '"') |
|
{ |
|
ptr_lecture++; |
|
(*ptr_ecriture) = '\"'; |
|
} |
|
else if ((*(ptr_lecture + 1)) == 'b') |
|
{ |
|
ptr_lecture++; |
|
(*ptr_ecriture) = '\b'; |
|
} |
|
else if ((*(ptr_lecture + 1)) == 'n') |
|
{ |
|
ptr_lecture++; |
|
(*ptr_ecriture) = '\n'; |
|
} |
|
else if ((*(ptr_lecture + 1)) == 't') |
|
{ |
|
ptr_lecture++; |
|
(*ptr_ecriture) = '\t'; |
|
} |
|
else if ((*(ptr_lecture + 1)) == '\\') |
|
{ |
|
ptr_lecture++; |
|
} |
|
else |
|
{ |
|
if ((*s_etat_processus).langue == 'F') |
|
{ |
|
printf("+++Information : Séquence d'échappement " |
|
"inconnue [%d]\n", (int) getpid()); |
|
} |
|
else |
|
{ |
|
printf("+++Warning : Unknown escape code " |
|
"[%d]\n", (int) getpid()); |
|
} |
|
} |
|
} |
|
|
|
ptr_ecriture++; |
|
ptr_lecture++; |
|
} |
|
|
|
(*ptr_ecriture) = d_code_fin_chaine; |
|
|
|
if ((chaine = realloc(chaine, (strlen(chaine) + 1) * |
|
sizeof(unsigned char))) == NULL) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
|
return(NULL); |
return(NULL); |
} |
} |
} |
} |
else |
else |
{ |
{ |
|
if ((chaine = malloc((strlen((unsigned char *) |
|
((*s_objet).objet)) + 1) * sizeof(unsigned char))) == NULL) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
|
return(NULL); |
|
} |
|
|
strcpy(chaine, (unsigned char *) ((*s_objet).objet)); |
strcpy(chaine, (unsigned char *) ((*s_objet).objet)); |
} |
} |
} |
} |
Line 3051 formateur(struct_processus *s_etat_proce
|
Line 2993 formateur(struct_processus *s_etat_proce
|
} |
} |
else if ((*s_objet).type == MTX) |
else if ((*s_objet).type == MTX) |
{ |
{ |
if (alsprintf(&chaine, "Mutex $ %016lX", (unsigned long) |
if (alsprintf(&chaine, "Mutex $ %016lX owned by $ %016lX", |
&((*((struct_mutex *) (*s_objet).objet)).mutex)) < 0) |
(unsigned long) &((*((struct_mutex *) (*s_objet).objet)).mutex), |
|
(unsigned long) (*((struct_mutex *) (*s_objet).objet)).tid) < 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return(NULL); |
return(NULL); |
Line 3528 formateur_reel(struct_processus *s_etat_
|
Line 3471 formateur_reel(struct_processus *s_etat_
|
|
|
if (type == 'R') |
if (type == 'R') |
{ |
{ |
|
# ifdef FP_INFINITE |
|
int signe; |
|
|
|
if ((signe = isinf((*((real8 *) valeur_numerique)))) != 0) |
|
{ |
|
if (signe > 0) |
|
{ |
|
strcpy(chaine, "infinity"); |
|
} |
|
else |
|
{ |
|
strcpy(chaine, "-infinity"); |
|
} |
|
|
|
return(chaine); |
|
} |
|
# endif |
|
|
|
if (isnan((*((real8 *) valeur_numerique)))) |
|
{ |
|
strcpy(chaine, "undef"); |
|
return(chaine); |
|
} |
|
|
tampon_reel = *((real8 *) valeur_numerique); |
tampon_reel = *((real8 *) valeur_numerique); |
|
|
if (tampon_reel > ((real8) 0)) |
if (tampon_reel > ((real8) 0)) |
Line 3758 formateur_reel(struct_processus *s_etat_
|
Line 3725 formateur_reel(struct_processus *s_etat_
|
|
|
if (exposant >= 0) |
if (exposant >= 0) |
{ |
{ |
sprintf(format, "%%.%luf", (longueur_utile_limite - exposant |
if ((exposant + 1) < longueur_utile_limite) |
- 1)); |
{ |
|
sprintf(format, "%%.%luf", (longueur_utile_limite - exposant |
|
- 1)); |
|
} |
|
else |
|
{ |
|
strcpy(format, "%.0f."); |
|
} |
} |
} |
else |
else |
{ |
{ |