version 1.11, 2010/07/14 14:19:35
|
version 1.36, 2012/01/05 10:19:00
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.0.18 |
RPL/2 (R) version 4.1.5 |
Copyright (C) 1989-2010 Dr. BERTRAND Joël |
Copyright (C) 1989-2012 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 608 instruction_chr(struct_processus *s_etat
|
Line 608 instruction_chr(struct_processus *s_etat
|
printf("(integer to character conversion)\n\n"); |
printf("(integer to character conversion)\n\n"); |
} |
} |
|
|
printf(" 1: 0 <= %s <= 255\n", d_INT); |
printf(" 1: %s\n", d_INT); |
printf("-> 1: %s\n", d_CHN); |
printf("-> 1: %s\n", d_CHN); |
|
|
return; |
return; |
Line 642 instruction_chr(struct_processus *s_etat
|
Line 642 instruction_chr(struct_processus *s_etat
|
|
|
if ((*s_objet_argument).type == INT) |
if ((*s_objet_argument).type == INT) |
{ |
{ |
if (((*((integer8 *) (*s_objet_argument).objet)) < 0) || |
if ((*((integer8 *) (*s_objet_argument).objet)) != |
((*((integer8 *) (*s_objet_argument).objet)) > 255)) |
(unsigned char) (*((integer8 *) (*s_objet_argument).objet))) |
{ |
{ |
liberation(s_etat_processus, s_objet_argument); |
liberation(s_etat_processus, s_objet_argument); |
|
|
Line 651 instruction_chr(struct_processus *s_etat
|
Line 651 instruction_chr(struct_processus *s_etat
|
return; |
return; |
} |
} |
|
|
if ((s_objet_resultat = allocation(s_etat_processus, CHN)) == NULL) |
if (isprint((unsigned char) (*((integer8 *) (*s_objet_argument).objet))) |
|
!= 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
if ((s_objet_resultat = allocation(s_etat_processus, CHN)) == NULL) |
return; |
{ |
} |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
|
return; |
|
} |
|
|
if (((*s_objet_resultat).objet = malloc(2 * sizeof(unsigned char))) |
if ((*((integer8 *) (*s_objet_argument).objet)) == '\\') |
== NULL) |
{ |
{ |
if (((*s_objet_resultat).objet = malloc(3 * |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
sizeof(unsigned char))) == NULL) |
return; |
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_allocation_memoire; |
|
return; |
|
} |
|
|
|
((unsigned char *) (*s_objet_resultat).objet)[0] = '\\'; |
|
((unsigned char *) (*s_objet_resultat).objet)[1] = '\\'; |
|
((unsigned char *) (*s_objet_resultat).objet)[2] = |
|
d_code_fin_chaine; |
|
} |
|
else if ((*((integer8 *) (*s_objet_argument).objet)) == '"') |
|
{ |
|
if (((*s_objet_resultat).objet = malloc(3 * |
|
sizeof(unsigned char))) == NULL) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_allocation_memoire; |
|
return; |
|
} |
|
|
|
((unsigned char *) (*s_objet_resultat).objet)[0] = '\\'; |
|
((unsigned char *) (*s_objet_resultat).objet)[1] = '"'; |
|
((unsigned char *) (*s_objet_resultat).objet)[2] = |
|
d_code_fin_chaine; |
|
} |
|
else |
|
{ |
|
if (((*s_objet_resultat).objet = malloc(2 * |
|
sizeof(unsigned char))) == NULL) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_allocation_memoire; |
|
return; |
|
} |
|
|
|
((unsigned char *) (*s_objet_resultat).objet)[0] = |
|
(*((integer8 *) (*s_objet_argument).objet)); |
|
((unsigned char *) (*s_objet_resultat).objet)[1] = |
|
d_code_fin_chaine; |
|
} |
} |
} |
|
else |
|
{ |
|
if ((s_objet_resultat = allocation(s_etat_processus, CHN)) == NULL) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
|
return; |
|
} |
|
|
|
if (((*s_objet_resultat).objet = malloc(5 * sizeof(unsigned char))) |
|
== NULL) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
|
return; |
|
} |
|
|
((unsigned char *) (*s_objet_resultat).objet)[0] = (*((integer8 *) |
sprintf((unsigned char *) (*s_objet_resultat).objet, "\\x%02X", |
(*s_objet_argument).objet)); |
(unsigned char) (*((integer8 *) |
((unsigned char *) (*s_objet_resultat).objet)[1] = d_code_fin_chaine; |
(*s_objet_argument).objet))); |
|
} |
} |
} |
|
|
/* |
/* |