--- rpl/src/instructions_p3.c 2010/01/27 22:22:15 1.2 +++ rpl/src/instructions_p3.c 2011/11/19 17:53:46 1.30 @@ -1,7 +1,7 @@ /* ================================================================================ - RPL/2 (R) version 4.0.10 - Copyright (C) 1989-2010 Dr. BERTRAND Joël + RPL/2 (R) version 4.1.4 + Copyright (C) 1989-2011 Dr. BERTRAND Joël This file is part of RPL/2. @@ -20,7 +20,7 @@ */ -#include "rpl.conv.h" +#include "rpl-conv.h" /* @@ -1377,9 +1377,10 @@ instruction_pos(struct_processus *s_etat } else { - (*((integer8 *) (*s_objet_resultat).objet)) = 1 + (integer8) - (pointeur_occurrence - ((unsigned char *) - (*s_objet_argument_2).objet)); + (*((integer8 *) (*s_objet_resultat).objet)) = + position_caractere_de_chaine(s_etat_processus, + (unsigned char *) (*s_objet_argument_2).objet, + pointeur_occurrence); } } @@ -1640,6 +1641,7 @@ instruction_prompt(struct_processus *s_e struct_objet *s_objet_resultat; unsigned char *tampon; + unsigned char *tampon2; (*s_etat_processus).erreur_execution = d_ex; @@ -1684,6 +1686,23 @@ instruction_prompt(struct_processus *s_e if ((*s_objet_argument).type == CHN) { + if ((tampon = formateur(s_etat_processus, 0, s_objet_argument)) == NULL) + { + (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; + return; + } + + if ((tampon2 = transliteration(s_etat_processus, tampon, + d_locale, (*s_etat_processus).localisation)) == NULL) + { + free(tampon); + + (*s_etat_processus).erreur_execution = d_ex_erreur_transcodage; + return; + } + + free(tampon); + if ((s_objet_resultat = allocation(s_etat_processus, CHN)) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -1693,12 +1712,13 @@ instruction_prompt(struct_processus *s_e flockfile(stdin); flockfile(stdout); - (*s_objet_resultat).objet = (void *) readline((unsigned char *) - (*s_objet_argument).objet); + (*s_objet_resultat).objet = (void *) readline(tampon2); funlockfile(stdin); funlockfile(stdout); + free(tampon2); + if ((*s_objet_resultat).objet == NULL) { if (((*s_objet_resultat).objet = malloc(sizeof(unsigned char)))