Diff for /rpl/src/instructions_s2.c between versions 1.4 and 1.73

version 1.4, 2010/02/26 19:22:05 version 1.73, 2020/01/10 11:15:48
Line 1 Line 1
 /*  /*
 ================================================================================  ================================================================================
   RPL/2 (R) version 4.0.11    RPL/2 (R) version 4.1.32
   Copyright (C) 1989-2010 Dr. BERTRAND Joël    Copyright (C) 1989-2020 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 764  instruction_size(struct_processus *s_eta Line 764  instruction_size(struct_processus *s_eta
         }          }
   
         (*((integer8 *) (*s_objet_resultat).objet)) =          (*((integer8 *) (*s_objet_resultat).objet)) =
                 strlen((unsigned char *) (*s_objet_argument).objet);                  longueur_chaine(s_etat_processus,
                   (unsigned char *) (*s_objet_argument).objet);
     }      }
   
 /*  /*
Line 1034  instruction_str_fleche(struct_processus Line 1035  instruction_str_fleche(struct_processus
     unsigned char                   registre_interruption;      unsigned char                   registre_interruption;
     unsigned char                   *tampon;      unsigned char                   *tampon;
   
     unsigned long                   nombre_caracteres_supplementaires;      integer8                        nombre_caracteres_supplementaires;
     unsigned long                   position_courante;      integer8                        position_courante;
   
     (*s_etat_processus).erreur_execution = d_ex;      (*s_etat_processus).erreur_execution = d_ex;
   
Line 1092  instruction_str_fleche(struct_processus Line 1093  instruction_str_fleche(struct_processus
   
     if ((*s_objet).type == CHN)      if ((*s_objet).type == CHN)
     {      {
         position_courante = (*s_etat_processus).position_courante;  
         registre_definitions_chainees = (*s_etat_processus)  
                 .definitions_chainees;  
         registre_instruction_courante = (*s_etat_processus)  
                 .instruction_courante;  
   
         // Comptage des caractères à protéger.          // Comptage des caractères à protéger.
   
         drapeau45 = test_cfsf(s_etat_processus, 45);          drapeau45 = test_cfsf(s_etat_processus, 45);
Line 1127  instruction_str_fleche(struct_processus Line 1122  instruction_str_fleche(struct_processus
   
             if (presence_chaine == d_vrai)              if (presence_chaine == d_vrai)
             {              {
                 if ((*ptr_l) == '\\')                  switch(*ptr_l)
                   {
                       case '\\':
                       case '\t':
                       case '\b':
                       case '\n':
                       {
                           nombre_caracteres_supplementaires++;
                           break;
                       }
                   }
               }
               else
               {
                   switch(*ptr_l)
                 {                  {
                     nombre_caracteres_supplementaires++;                      case '\n':
                       case '\b':
                       case '\t':
                       {
                           nombre_caracteres_supplementaires--;
                           break;
                       }
                 }                  }
             }              }
   
Line 1140  instruction_str_fleche(struct_processus Line 1155  instruction_str_fleche(struct_processus
         // de caractères incluses. Le seul caractère protégé est le '\'          // de caractères incluses. Le seul caractère protégé est le '\'
         // qui est doublé.          // qui est doublé.
   
         if ((chaine_convertie = malloc((strlen(tampon) +          if ((chaine_convertie = malloc((strlen(tampon) + ((size_t)
                 nombre_caracteres_supplementaires + 1) * sizeof(unsigned char)))                  nombre_caracteres_supplementaires) + 1) *
                 == NULL)                  sizeof(unsigned char))) == NULL)
         {          {
             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;              (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
             return;              return;
Line 1163  instruction_str_fleche(struct_processus Line 1178  instruction_str_fleche(struct_processus
   
             if (presence_chaine == d_vrai)              if (presence_chaine == d_vrai)
             {              {
                 if ((*ptr_l) == '\\')                  switch(*ptr_l)
                   {
                       case '\\':
                       {
                           (*(++ptr_e)) = '\\';
                           break;
                       }
   
                       case '\t':
                       {
                           (*ptr_e) = '\\';
                           (*(++ptr_e)) = 't';
                           break;
                       }
   
                       case '\b':
                       {
                           (*ptr_e) = '\\';
                           (*(++ptr_e)) = 'b';
                           break;
                       }
   
                       case '\n':
                       {
                           (*ptr_e) = '\\';
                           (*(++ptr_e)) = 'n';
                           break;
                       }
                   }
               }
               else
               {
                   switch(*ptr_l)
                 {                  {
                     (*(++ptr_e)) = '\\';                      case '\n':
                       case '\b':
                       case '\t':
                       {
                           ptr_e--;
                           break;
                       }
                 }                  }
             }              }
   
Line 1175  instruction_str_fleche(struct_processus Line 1228  instruction_str_fleche(struct_processus
   
         (*ptr_e) = d_code_fin_chaine;          (*ptr_e) = d_code_fin_chaine;
   
           position_courante = (*s_etat_processus).position_courante;
           registre_definitions_chainees = (*s_etat_processus)
                   .definitions_chainees;
           registre_instruction_courante = (*s_etat_processus)
                   .instruction_courante;
           (*s_etat_processus).position_courante = 0;
         (*s_etat_processus).definitions_chainees = chaine_convertie;          (*s_etat_processus).definitions_chainees = chaine_convertie;
         free(tampon);          free(tampon);
   
Line 1197  instruction_str_fleche(struct_processus Line 1256  instruction_str_fleche(struct_processus
                     .definitions_chainees);                      .definitions_chainees);
             (*s_etat_processus).instruction_courante = commande;              (*s_etat_processus).instruction_courante = commande;
   
               (*s_etat_processus).type_en_cours = NON;
             recherche_type(s_etat_processus);              recherche_type(s_etat_processus);
   
             if ((*s_etat_processus).erreur_execution != d_ex)              if (((*s_etat_processus).erreur_execution != d_ex) ||
                       ((*s_etat_processus).erreur_systeme != d_es))
             {              {
                 liberation(s_etat_processus, s_objet);                  liberation(s_etat_processus, s_objet);
   

Removed from v.1.4  
changed lines
  Added in v.1.73


CVSweb interface <joel.bertrand@systella.fr>