Diff for /rpl/src/rplexternals.h between versions 1.79 and 1.94

version 1.79, 2017/07/04 10:28:09 version 1.94, 2019/01/01 09:03:15
Line 1 Line 1
 /*  /*
 ================================================================================  ================================================================================
   RPL/2 (R) version 4.1.27    RPL/2 (R) version 4.1.30
   Copyright (C) 1989-2017 Dr. BERTRAND Joël    Copyright (C) 1989-2019 Dr. BERTRAND Joël
   
   This file is part of RPL/2.    This file is part of RPL/2.
   
Line 101 Line 101
             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)) \
                 { __VA_ARGS__; return(0); } } while(0)                  { __VA_ARGS__; return(0); } } while(0)
   #define structObject struct_objet
   #define initializeObject(a, b)  do { \
               (*a).descripteur_bibliotheque = (*b).descripteur_bibliotheque; \
               (*a).extension_type = (*b).extension_type; } while(0)
   #define objectContainer(type, a) ((type *) ((*a).objet))
   #define objectOf(a) ((*a).objet)
   #define ifIsExternal(a, b) if (((*a).type == EXT) && ((*a).extension_type == b))
   #define elseIfIsExternal(a, b) } else if (((*a).type == EXT) && \
               ((*a).extension_type == b))
   #define subType(a) ((*a).extension_type)
 #define integerFormat(a) formateur_nombre(s_etat_processus, a, 'I')  #define integerFormat(a) formateur_nombre(s_etat_processus, a, 'I')
   #define procStatus(a) (*a).s_etat_processus
   
 /*  /*
 --------------------------------------------------------------------------------  --------------------------------------------------------------------------------
Line 139 Line 150
     ({ __CATCH_SYSTEM_ERROR__; typeof(daisyChain) __daisyChain = daisyChain; \      ({ __CATCH_SYSTEM_ERROR__; typeof(daisyChain) __daisyChain = daisyChain; \
     if (__daisyChain == NULL) executionError("End of daisy chain"); \      if (__daisyChain == NULL) executionError("End of daisy chain"); \
     (__daisyChain == NULL) ? NULL : (*__daisyChain).suivant; })      (__daisyChain == NULL) ? NULL : (*__daisyChain).suivant; })
   
   #define next        suivant
   #define data        donnee
   #define daisyChain  struct_liste_chainee
           
 #define null NULL  #define null NULL
 #define nullify(ptr) __CATCH_SYSTEM_ERROR__; do { ptr = NULL; } while(0)  #define nullify(ptr) __CATCH_SYSTEM_ERROR__; do { ptr = NULL; } while(0)
Line 172 Line 187
 #define declareUnion typedef union {  #define declareUnion typedef union {
 #define as(name) } name;  #define as(name) } name;
   
 #define target(a) (*a)  #define target(a) (*(a))
 #define address(a) (&a)  #define address(a) (&(a))
   
 #define subroutine(name) int name()  #define subroutine(name) int name()
 #define beginGroup { __CATCH_SYSTEM_ERROR__;  #define beginGroup { __CATCH_SYSTEM_ERROR__;
Line 213 Line 228
     unsigned char   __taille_bloc; \      unsigned char   __taille_bloc; \
     unsigned char   __type; \      unsigned char   __type; \
     t_8_bits        __masque; \      t_8_bits        __masque; \
       void *s_etat_processus = (*rpl_arguments).s_etat_processus; \
       DISABLE_SET_BUT_NOT_USED_WARNING(s_etat_processus); \
     { \      { \
         (*rpl_arguments).instruction_valide = 'Y'; \          (*rpl_arguments).instruction_valide = 'Y'; \
         (*rpl_arguments).erreur = 0; \          (*rpl_arguments).erreur = 0; \
Line 354 Line 371
 #define endSubroutine END }  #define endSubroutine END }
   
 #define notice(s, ...) __CATCH_SYSTEM_ERROR__; \  #define notice(s, ...) __CATCH_SYSTEM_ERROR__; \
         do { if (affichage_rplso == d_vrai) \          do { ufprintf(s, __VA_ARGS__); fflush(s); } while(0)
             { ufprintf(s, __VA_ARGS__); fflush(s); } } while(0)  
 #define logger(...) __CATCH_SYSTEM_ERROR__; \  #define logger(...) __CATCH_SYSTEM_ERROR__; \
         do { syslog(LOG_NOTICE, __VA_ARGS__); } while(0)           do { syslog(LOG_NOTICE, __VA_ARGS__); } while(0) 
   
Line 967 Line 983
   
 #define createComplexMatrixObject  #define createComplexMatrixObject
   
   // Array
   
   #define isArray(rpl_object) \
       ((*rpl_object).type == TBL)
   
   #define ifIsArray(rpl_object) if (isArray(rpl_object))
   #define elseIfIsArray(rpl_object) } else if (isArray(rpl_object))
   
   #define createArray(rpl_object, size) do { \
       int __i; \
       if (rpl_object != NULL) systemError("Reallocated object"); \
       if ((rpl_object = _allocation(TBL)) == NULL) \
           systemError("Memory allocation error"); \
       (*((struct_tableau *) (*rpl_object).objet)).nombre_elements = size; \
       if (((*((struct_tableau *) (*rpl_object).objet)).elements = malloc( \
               size * sizeof(struct_objet *))) == NULL) \
           systemError("Memory allocation error"); \
       for(__i = 0; __i < size; __i++) { \
           nullify((*((struct_tableau *) (*rpl_object).objet)).elements[__i]); \
           createIntegerObject((*((struct_tableau *) (*rpl_object).objet)) \
                   .elements[__i]); } \
       } while(0)
   
   #define setObjectIntoArray(rpl_array, pos, rpl_object) do { \
           typeof(pos) __position = pos; __position--; \
           ifIsArray(rpl_array) { \
               if ((__position < 0) || (__position >= (*((struct_tableau *) \
                       (*rpl_array).objet)).nombre_elements)) \
                   executionError("Element out of range"); \
               if ((*rpl_array).nombre_occurrences > 1) \
               { \
                   struct_objet *__tmp_rpl_object; \
                   if ((__tmp_rpl_object = _copie_objet(rpl_array, 'O')) == NULL) \
                       systemError("Memory allocation error"); \
                   _liberation(rpl_array); \
                   rpl_array = __tmp_rpl_object; \
               } \
               _liberation((*((struct_tableau *) (*rpl_array).objet)) \
                       .elements[__position]); \
               (*((struct_tableau *) (*rpl_array).objet)).elements[__position] = \
                       rpl_object; \
           } \
           else executionError("Type mistmatch error"); \
           nullify(rpl_object); \
       } while(0)
   
   #define getObjectFromArray()
   
 // Binary integer  // Binary integer
   
 #define setBinaryInteger(rpl_object, value) do { \  #define setBinaryInteger(rpl_object, value) do { \
Line 1057 Line 1121
     ((*rpl_object).type == CHN)      ((*rpl_object).type == CHN)
   
 #define ifIsString(rpl_object) if (isString(rpl_object))  #define ifIsString(rpl_object) if (isString(rpl_object))
 #define elseIfIsString(rpl_object) else if (isString(rpl_object))  #define elseIfIsString(rpl_object) } else if (isString(rpl_object))
   
 #define setString(rpl_object, string) do { \  #define setString(rpl_object, string) do { \
     struct_processus *s_etat_processus; \      struct_processus *s_etat_processus; \
Line 1089 Line 1153
     ifIsString(rpl_object) string = (char *) (*rpl_object).objet; \      ifIsString(rpl_object) string = (char *) (*rpl_object).objet; \
     else executionError("Type mismatch error"); } while(0)      else executionError("Type mismatch error"); } while(0)
   
   #define unEscString(s) ({ \
       unsigned char *__a; integer8 __l; \
       __a = formateur_flux((*rpl_arguments).s_etat_processus, \
               (unsigned char *) s, &__l); \
       if (nullified(__a)) systemError("Memory allocation error"); \
       (string) __a; \
       })
   
   #define escString(rpl_object) ({ \
       unsigned char *__a; integer8 __l; \
       __a = analyse_flux((*rpl_arguments).s_etat_processus, \
               (unsigned char *) s, strlen(s)); \
       if (nullified(__a)) systemError("Memory allocation error"); \
       (string) __a; \
       })
   
 #define createStringObject(rpl_object) do { \  #define createStringObject(rpl_object) do { \
     struct_processus *s_etat_processus; \      struct_processus *s_etat_processus; \
     s_etat_processus = (*rpl_arguments).s_etat_processus; \      s_etat_processus = (*rpl_arguments).s_etat_processus; \
Line 1237 Line 1317
         } \          } \
     } } while(0)      } } while(0)
   
   // NON
   #define createObject(rpl_object) do { \
       if (rpl_object != NULL) \
           systemError("Reallocated object"); \
       if ((rpl_object = _allocation(NON)) == NULL) \
           systemError("Memory allocation error"); \
       (*rpl_object).objet = NULL; \
       } while(0)
   
 // EXT  // EXT
 #define createExternalObject(rpl_object, subtype) do { \  #define createExternalObject(rpl_object, subtype) do { \
     if (rpl_object != NULL) \      if (rpl_object != NULL) \

Removed from v.1.79  
changed lines
  Added in v.1.94


CVSweb interface <joel.bertrand@systella.fr>