Diff for /rpl/src/interface_gnuplot.c between versions 1.4 and 1.23

version 1.4, 2010/02/28 14:47:14 version 1.23, 2011/06/21 07:45:27
Line 1 Line 1
 /*  /*
 ================================================================================  ================================================================================
   RPL/2 (R) version 4.0.11    RPL/2 (R) version 4.1.0.prerelease.1
   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"
 #include "gnuplot.conv.h"  #include "gnuplot-conv.h"
   
   
 /*  /*
Line 36 Line 36
 ================================================================================  ================================================================================
 */  */
   
   #ifdef OS2
   
   static unsigned char *
   ajout_shell(unsigned char *commande)
   {
       unsigned char       *tampon;
   
       if ((tampon = malloc((strlen(BOURNE_SHELL) + 5 + strlen(commande) + 2) *
               sizeof(unsigned char))) == NULL)
       {
           return(NULL);
       }
   
       sprintf(tampon, "%s -c \"%s\"", BOURNE_SHELL, commande);
       free(commande);
       return(tampon);
   }
   
   #endif
   
 void  void
 appel_gnuplot(struct_processus *s_etat_processus, unsigned char persistance)  appel_gnuplot(struct_processus *s_etat_processus, unsigned char persistance)
 {  {
Line 266  appel_gnuplot(struct_processus *s_etat_p Line 286  appel_gnuplot(struct_processus *s_etat_p
         if ((*s_etat_processus).entree_standard == NULL)          if ((*s_etat_processus).entree_standard == NULL)
         {          {
 #ifdef FORCE_GNUPLOT_PATH  #ifdef FORCE_GNUPLOT_PATH
             if ((commande_gnuplot = malloc((strlen(d_exec_path) + 6 +              if ((*s_etat_processus).rpl_home == NULL)
                     strlen(ds_gnuplot_commande)) * sizeof(unsigned char)))  
                     == NULL)  
             {              {
                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;                  if ((commande_gnuplot = malloc((strlen(d_exec_path) + 6 +
                 return;                          strlen(ds_gnuplot_commande)) * sizeof(unsigned char)))
                           == NULL)
                   {
                       (*s_etat_processus).erreur_systeme =
                               d_es_allocation_memoire;
                       return;
                   }
   
                   sprintf(commande_gnuplot, "%s/bin/%s", d_exec_path,
                           ds_gnuplot_commande);
             }              }
               else
               {
                   if ((commande_gnuplot = malloc((strlen(
                           (*s_etat_processus).rpl_home) + 6 +
                           strlen(ds_gnuplot_commande)) * sizeof(unsigned char)))
                           == NULL)
                   {
                       (*s_etat_processus).erreur_systeme =
                               d_es_allocation_memoire;
                       return;
                   }
   
             sprintf(commande_gnuplot, "%s/bin/%s", d_exec_path,                  sprintf(commande_gnuplot, "%s/bin/%s",
                     ds_gnuplot_commande);                          (*s_etat_processus).rpl_home, ds_gnuplot_commande);
               }
 #else  #else
             if ((commande_gnuplot = malloc((1 +              if ((commande_gnuplot = malloc((1 +
                     strlen(ds_gnuplot_commande)) * sizeof(unsigned char)))                      strlen(ds_gnuplot_commande)) * sizeof(unsigned char)))
Line 288  appel_gnuplot(struct_processus *s_etat_p Line 327  appel_gnuplot(struct_processus *s_etat_p
             sprintf(commande_gnuplot, "%s", ds_gnuplot_commande);              sprintf(commande_gnuplot, "%s", ds_gnuplot_commande);
 #endif  #endif
   
   #ifdef OS2
               if ((commande_gnuplot = ajout_shell(commande_gnuplot)) == NULL)
               {
                   (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   return;
               }
   #endif
   
             if (((*s_etat_processus).entree_standard =              if (((*s_etat_processus).entree_standard =
                     popen(commande_gnuplot, "w")) == NULL)                      popen(commande_gnuplot, "w")) == NULL)
             {              {
Line 320  appel_gnuplot(struct_processus *s_etat_p Line 367  appel_gnuplot(struct_processus *s_etat_p
         entree_standard = (*s_etat_processus).entree_standard;          entree_standard = (*s_etat_processus).entree_standard;
   
 #if FORCE_GNUPLOT_PATH  #if FORCE_GNUPLOT_PATH
         if ((commande_gnuplot = malloc((strlen(d_exec_path) + 6 +          if ((*s_etat_processus).rpl_home == NULL)
                 strlen(ds_gnuplot_commande_persistante)) *  
                 sizeof(unsigned char))) == NULL)  
         {          {
             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;              if ((commande_gnuplot = malloc((strlen(d_exec_path) + 6 +
             return;                      strlen(ds_gnuplot_commande_persistante)) *
                       sizeof(unsigned char))) == NULL)
               {
                   (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   return;
               }
   
               sprintf(commande_gnuplot, "%s/bin/%s", d_exec_path,
                       ds_gnuplot_commande_persistante);
         }          }
           else
           {
               if ((commande_gnuplot = malloc((strlen(
                       (*s_etat_processus).rpl_home) + 6 +
                       strlen(ds_gnuplot_commande_persistante)) *
                       sizeof(unsigned char))) == NULL)
               {
                   (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   return;
               }
   
         sprintf(commande_gnuplot, "%s/bin/%s", d_exec_path,              sprintf(commande_gnuplot, "%s/bin/%s", (*s_etat_processus).rpl_home,
                 ds_gnuplot_commande_persistante);                      ds_gnuplot_commande_persistante);
           }
 #else  #else
         if ((commande_gnuplot = malloc((1 +          if ((commande_gnuplot = malloc((1 +
                 strlen(ds_gnuplot_commande_persistante)) *                  strlen(ds_gnuplot_commande_persistante)) *
Line 342  appel_gnuplot(struct_processus *s_etat_p Line 406  appel_gnuplot(struct_processus *s_etat_p
         sprintf(commande_gnuplot, "%s", ds_gnuplot_commande_persistante);          sprintf(commande_gnuplot, "%s", ds_gnuplot_commande_persistante);
 #endif  #endif
   
   #ifdef OS2
           if ((commande_gnuplot = ajout_shell(commande_gnuplot)) == NULL)
           {
               (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
               return;
           }
   #endif
   
         if (((*s_etat_processus).entree_standard =          if (((*s_etat_processus).entree_standard =
                 popen(commande_gnuplot, "w")) == NULL)                  popen(commande_gnuplot, "w")) == NULL)
         {          {
Line 373  appel_gnuplot(struct_processus *s_etat_p Line 445  appel_gnuplot(struct_processus *s_etat_p
         entree_standard = (*s_etat_processus).entree_standard;          entree_standard = (*s_etat_processus).entree_standard;
   
 #ifdef FORCE_GNUPLOT_PATH  #ifdef FORCE_GNUPLOT_PATH
         if ((commande_gnuplot = malloc((strlen(d_exec_path) + 6 +          if ((*s_etat_processus).rpl_home == NULL)
                 strlen(ds_gnuplot_commande)) * sizeof(unsigned char)))  
                 == NULL)  
         {          {
             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;              if ((commande_gnuplot = malloc((strlen(d_exec_path) + 6 +
             return;                      strlen(ds_gnuplot_commande)) * sizeof(unsigned char)))
                       == NULL)
               {
                   (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   return;
               }
   
               sprintf(commande_gnuplot, "%s/bin/%s", d_exec_path,
                       ds_gnuplot_commande);
         }          }
           else
           {
               if ((commande_gnuplot = malloc((strlen((*s_etat_processus).rpl_home)
                       + 6 + strlen(ds_gnuplot_commande)) * sizeof(unsigned char)))
                       == NULL)
               {
                   (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   return;
               }
   
         sprintf(commande_gnuplot, "%s/bin/%s", d_exec_path,              sprintf(commande_gnuplot, "%s/bin/%s", (*s_etat_processus).rpl_home,
                 ds_gnuplot_commande);                      ds_gnuplot_commande);
           }
 #else  #else
         if ((commande_gnuplot = malloc((1 +          if ((commande_gnuplot = malloc((1 +
                 strlen(ds_gnuplot_commande)) * sizeof(unsigned char)))                  strlen(ds_gnuplot_commande)) * sizeof(unsigned char)))
Line 395  appel_gnuplot(struct_processus *s_etat_p Line 483  appel_gnuplot(struct_processus *s_etat_p
         sprintf(commande_gnuplot, "%s", ds_gnuplot_commande);          sprintf(commande_gnuplot, "%s", ds_gnuplot_commande);
 #endif  #endif
   
   #ifdef OS2
           if ((commande_gnuplot = ajout_shell(commande_gnuplot)) == NULL)
           {
               (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
               return;
           }
   #endif
         if (((*s_etat_processus).entree_standard =          if (((*s_etat_processus).entree_standard =
                 popen(commande_gnuplot, "w")) == NULL)                  popen(commande_gnuplot, "w")) == NULL)
         {          {
Line 437  appel_gnuplot(struct_processus *s_etat_p Line 532  appel_gnuplot(struct_processus *s_etat_p
         entree_standard = (*s_etat_processus).entree_standard;          entree_standard = (*s_etat_processus).entree_standard;
   
 #ifdef FORCE_GNUPLOT_PATH  #ifdef FORCE_GNUPLOT_PATH
         if ((commande_gnuplot = malloc((strlen(d_exec_path) + 6 +          if ((*s_etat_processus).rpl_home == NULL)
                 strlen(ds_gnuplot_commande)) * sizeof(unsigned char)))  
                 == NULL)  
         {          {
             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;              if ((commande_gnuplot = malloc((strlen(d_exec_path) + 6 +
             return;                      strlen(ds_gnuplot_commande)) * sizeof(unsigned char)))
                       == NULL)
               {
                   (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   return;
               }
   
               sprintf(commande_gnuplot, "%s/bin/%s", d_exec_path,
                       ds_gnuplot_commande);
         }          }
           else
           {
               if ((commande_gnuplot = malloc((strlen((*s_etat_processus).rpl_home)
                       + 6 + strlen(ds_gnuplot_commande)) * sizeof(unsigned char)))
                       == NULL)
               {
                   (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   return;
               }
   
         sprintf(commande_gnuplot, "%s/bin/%s", d_exec_path,              sprintf(commande_gnuplot, "%s/bin/%s", (*s_etat_processus).rpl_home,
                 ds_gnuplot_commande);                      ds_gnuplot_commande);
           }
 #else  #else
         if ((commande_gnuplot = malloc((1 +          if ((commande_gnuplot = malloc((1 +
                 strlen(ds_gnuplot_commande)) * sizeof(unsigned char)))                  strlen(ds_gnuplot_commande)) * sizeof(unsigned char)))
Line 459  appel_gnuplot(struct_processus *s_etat_p Line 570  appel_gnuplot(struct_processus *s_etat_p
         sprintf(commande_gnuplot, "%s", ds_gnuplot_commande);          sprintf(commande_gnuplot, "%s", ds_gnuplot_commande);
 #endif  #endif
   
   #ifdef OS2
           if ((commande_gnuplot = ajout_shell(commande_gnuplot)) == NULL)
           {
               (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
               return;
           }
   #endif
         if (((*s_etat_processus).entree_standard =          if (((*s_etat_processus).entree_standard =
                 popen(commande_gnuplot, "w")) == NULL)                  popen(commande_gnuplot, "w")) == NULL)
         {          {

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


CVSweb interface <joel.bertrand@systella.fr>