version 1.38, 2013/12/03 09:36:15
|
version 1.73, 2025/04/15 10:17:56
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.17 |
RPL/2 (R) version 4.1.36 |
Copyright (C) 1989-2013 Dr. BERTRAND Joël |
Copyright (C) 1989-2025 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
|
|
Line 21
|
Line 21
|
|
|
|
|
#ifdef RPLCAS |
#ifdef RPLCAS |
|
# define RPLCXX |
|
|
// Giac inclut <semaphore.h> et définit sem_t. Or l'émulation |
// Giac inclut <semaphore.h> et définit sem_t. Or l'émulation |
// des IPCS POSIX requiert une redéfinition de sem_t. |
// des IPCS POSIX requiert une redéfinition de sem_t. |
Line 28
|
Line 29
|
# ifdef IPCS_SYSV |
# ifdef IPCS_SYSV |
// NetBSD : _SEMAPHORE_H_ |
// NetBSD : _SEMAPHORE_H_ |
# define _SEMAPHORE_H_ |
# define _SEMAPHORE_H_ |
|
// Linux : _SEMAPHORE_H |
|
# define _SEMAPHORE_H |
# endif |
# endif |
|
|
# include "giac.h" |
# pragma GCC diagnostic push |
|
# pragma GCC diagnostic ignored "-Wstrict-aliasing" |
|
# pragma GCC diagnostic ignored "-Wunused-parameter" |
|
# pragma GCC diagnostic ignored "-Wempty-body" |
|
# pragma GCC diagnostic ignored "-Wunknown-pragmas" |
|
# include "giacPCH.h" |
|
# pragma GCC diagnostic pop |
|
|
# undef PACKAGE |
# undef PACKAGE |
# undef PACKAGE_NAME |
# undef PACKAGE_NAME |
Line 46 extern "C"
|
Line 55 extern "C"
|
# include "rpl-conv.h" |
# include "rpl-conv.h" |
} |
} |
|
|
#include <iostream> |
#ifdef RPLCAS |
|
# include <iostream> |
|
#endif |
|
|
using namespace std; |
using namespace std; |
|
|
Line 124 conversion_rpl_vers_cas(struct_processus
|
Line 135 conversion_rpl_vers_cas(struct_processus
|
|
|
liberation(s_etat_processus, *s_objet); |
liberation(s_etat_processus, *s_objet); |
|
|
if (depilement(s_etat_processus, &(s_etat_processus |
if (depilement(s_etat_processus, &(s_etat_processus->l_base_pile), |
->l_base_pile), s_objet) == d_erreur) |
s_objet) == d_erreur) |
{ |
{ |
return(NULL); |
return(NULL); |
} |
} |
Line 227 conversion_rpl_vers_cas(struct_processus
|
Line 238 conversion_rpl_vers_cas(struct_processus
|
strstr(reinterpret_cast<char *>(index), |
strstr(reinterpret_cast<char *>(index), |
(const char *) "relax"))) != NULL) |
(const char *) "relax"))) != NULL) |
{ |
{ |
strncpy(reinterpret_cast<char *>(index), " +", 5); |
memcpy(reinterpret_cast<char *>(index), " +", 5); |
} |
} |
|
|
// Si le résultat vaut infinity, on rajoute le signe +. |
// Si le résultat vaut infinity, on rajoute le signe +. |
Line 412 conversion_cas_vers_rpl(struct_processus
|
Line 423 conversion_cas_vers_rpl(struct_processus
|
================================================================================ |
================================================================================ |
*/ |
*/ |
|
|
|
#pragma GCC diagnostic push |
|
#pragma GCC diagnostic ignored "-Wunused-parameter" |
void |
void |
interface_cas(struct_processus *s_etat_processus, |
interface_cas(struct_processus *s_etat_processus, |
enum t_rplcas_commandes commande) |
enum t_rplcas_commandes commande) |
{ |
{ |
# ifdef RPLCAS |
#ifdef RPLCAS |
struct_objet *s_objet_argument_1; |
struct_objet *s_objet_argument_1; |
struct_objet *s_objet_argument_2; |
struct_objet *s_objet_argument_2; |
struct_objet *s_objet_temporaire; |
struct_objet *s_objet_temporaire; |
Line 438 interface_cas(struct_processus *s_etat_p
|
Line 451 interface_cas(struct_processus *s_etat_p
|
{ |
{ |
s_etat_processus->contexte_cas = new giac::context; |
s_etat_processus->contexte_cas = new giac::context; |
} |
} |
catch(bad_alloc exception) |
catch(bad_alloc &exception) |
{ |
{ |
s_etat_processus->erreur_systeme = d_es_allocation_memoire; |
s_etat_processus->erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 453 interface_cas(struct_processus *s_etat_p
|
Line 466 interface_cas(struct_processus *s_etat_p
|
contexte = reinterpret_cast<giac::context *>( |
contexte = reinterpret_cast<giac::context *>( |
s_etat_processus->contexte_cas); |
s_etat_processus->contexte_cas); |
|
|
|
giac::angle_radian((test_cfsf(s_etat_processus, 60) == d_vrai) ? 1 : 0, |
|
contexte); |
|
|
if ((s_etat_processus->erreur_execution != d_ex) || |
if ((s_etat_processus->erreur_execution != d_ex) || |
(s_etat_processus->erreur_systeme != d_es)) |
(s_etat_processus->erreur_systeme != d_es)) |
{ |
{ |
Line 512 interface_cas(struct_processus *s_etat_p
|
Line 528 interface_cas(struct_processus *s_etat_p
|
reinterpret_cast<unsigned char *>(const_cast<char *>( |
reinterpret_cast<unsigned char *>(const_cast<char *>( |
chaine.c_str()))); |
chaine.c_str()))); |
} |
} |
catch(bad_alloc exception) |
catch(bad_alloc &exception) |
{ |
{ |
s_etat_processus->erreur_systeme = d_es_allocation_memoire; |
s_etat_processus->erreur_systeme = d_es_allocation_memoire; |
} |
} |
Line 673 interface_cas(struct_processus *s_etat_p
|
Line 689 interface_cas(struct_processus *s_etat_p
|
reinterpret_cast<unsigned char *>(const_cast<char *>( |
reinterpret_cast<unsigned char *>(const_cast<char *>( |
chaine.c_str()))); |
chaine.c_str()))); |
} |
} |
catch(bad_alloc exception) |
catch(bad_alloc &exception) |
{ |
{ |
s_etat_processus->erreur_systeme = d_es_allocation_memoire; |
s_etat_processus->erreur_systeme = d_es_allocation_memoire; |
} |
} |
Line 693 interface_cas(struct_processus *s_etat_p
|
Line 709 interface_cas(struct_processus *s_etat_p
|
|
|
break; |
break; |
} |
} |
|
|
|
case RPLCAS_SIMPLIFICATION: |
|
{ |
|
if (depilement(s_etat_processus, &(s_etat_processus->l_base_pile), |
|
&s_objet_argument_1) == d_erreur) |
|
{ |
|
s_etat_processus->erreur_execution = d_ex_manque_argument; |
|
return; |
|
} |
|
|
|
if ((argument_1 = conversion_rpl_vers_cas(s_etat_processus, |
|
&s_objet_argument_1)) == NULL) |
|
{ |
|
s_etat_processus->erreur_systeme = d_es_allocation_memoire; |
|
return; |
|
} |
|
|
|
liberation(s_etat_processus, s_objet_argument_1); |
|
|
|
try |
|
{ |
|
gen expression( |
|
string(reinterpret_cast<const char *>(argument_1)), |
|
contexte); |
|
|
|
gen resultat = simplify(expression, contexte); |
|
string chaine = "'" + resultat.print() + "'"; |
|
|
|
conversion_cas_vers_rpl(s_etat_processus, |
|
reinterpret_cast<unsigned char *>(const_cast<char *>( |
|
chaine.c_str()))); |
|
} |
|
catch(bad_alloc &exception) |
|
{ |
|
s_etat_processus->erreur_systeme = d_es_allocation_memoire; |
|
} |
|
catch(...) |
|
{ |
|
s_etat_processus->erreur_execution = d_ex_erreur_interne_rplcas; |
|
} |
|
|
|
free(argument_1); |
|
|
|
break; |
|
} |
} |
} |
|
|
return; |
return; |
|
|
#else |
#else |
|
|
if (s_etat_processus->langue == 'F') |
if (s_etat_processus->langue == 'F') |
Line 714 interface_cas(struct_processus *s_etat_p
|
Line 774 interface_cas(struct_processus *s_etat_p
|
|
|
#endif |
#endif |
} |
} |
|
#pragma GCC diagnostic pop |
|
|
// vim: ts=4 |
// vim: ts=4 |