--- rpl/src/instructions_p3.c 2010/03/04 10:17:52 1.5 +++ rpl/src/instructions_p3.c 2012/04/13 07:45:44 1.35 @@ -1,7 +1,7 @@ /* ================================================================================ - RPL/2 (R) version 4.0.12 - Copyright (C) 1989-2010 Dr. BERTRAND Joël + RPL/2 (R) version 4.1.7 + Copyright (C) 1989-2012 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); } } @@ -1639,9 +1640,13 @@ instruction_prompt(struct_processus *s_e struct_objet *s_objet_argument; struct_objet *s_objet_resultat; + unsigned char *ptr_e; + unsigned char *ptr_l; unsigned char *tampon; unsigned char *tampon2; + unsigned long i; + (*s_etat_processus).erreur_execution = d_ex; if ((*s_etat_processus).affichage_arguments == 'Y') @@ -1739,7 +1744,45 @@ instruction_prompt(struct_processus *s_e } free((unsigned char *) (*s_objet_resultat).objet); - (*s_objet_resultat).objet = tampon; + + ptr_l = tampon; + i = 0; + + while((*ptr_l) != d_code_fin_chaine) + { + if ((*ptr_l) == '\"') + { + i++; + } + + ptr_l++; + } + + if ((tampon2 = malloc((strlen(tampon) + 1 + i) * + sizeof(unsigned char))) == NULL) + { + (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; + return; + } + + ptr_l = tampon; + ptr_e = tampon2; + + while((*ptr_l) != d_code_fin_chaine) + { + if ((*ptr_l) == '\"') + { + (*ptr_e) = '\\'; + ptr_e++; + } + + (*ptr_e) = (*ptr_l); + ptr_e++; + ptr_l++; + } + + free(tampon); + (*s_objet_resultat).objet = tampon2; add_history((unsigned char *) (*s_objet_resultat).objet); stifle_history(ds_longueur_historique);