Diff for /rpl/src/rpl.h between versions 1.225 and 1.254

version 1.225, 2013/05/28 22:09:56 version 1.254, 2015/01/05 13:12:42
Line 1 Line 1
 /*  /*
 ================================================================================  ================================================================================
   RPL/2 (R) version 4.1.14    RPL/2 (R) version 4.1.19
   Copyright (C) 1989-2013 Dr. BERTRAND Joël    Copyright (C) 1989-2015 Dr. BERTRAND Joël
   
   This file is part of RPL/2.    This file is part of RPL/2.
   
Line 56 Line 56
 #   define sched_yield(arg)  #   define sched_yield(arg)
 #endif  #endif
   
   #ifdef CYGWIN
   #   define SA_ONSTACK   0
   #endif
   
   
 /*  /*
 ================================================================================  ================================================================================
Line 314  enum signaux_rpl Line 318  enum signaux_rpl
 #ifndef RPLARGS  #ifndef RPLARGS
 typedef struct queue_signaux  typedef struct queue_signaux
 {  {
 #   ifndef IPCS_SYSV  
 #       ifndef SEMAPHORES_NOMMES  
             sem_t               semaphore;  
             sem_t               signalisation;  
             sem_t               arret_signalisation;  
 #       endif  
 #   else  
         sem_t                   semaphore;  
         sem_t                   signalisation;  
         sem_t                   arret_signalisation;  
 #   endif  
   
     volatile int                pointeur_lecture;      volatile int                pointeur_lecture;
     volatile int                pointeur_ecriture;      volatile int                pointeur_ecriture;
     pthread_t                   thread_signaux;  
     volatile logical1           requete_arret;      volatile logical1           requete_arret;
   
       pthread_t                   thread_signaux;
   
     volatile struct      volatile struct
     {      {
         pid_t                   pid;          pid_t                   pid;
         enum signaux_rpl        signal;          enum signaux_rpl        signal;
     }                           queue[LONGUEUR_QUEUE_SIGNAUX];      }                           queue[LONGUEUR_QUEUE_SIGNAUX];
   
   #   ifdef OS2
       sem_t                       semaphore;
       sem_t                       signalisation;
       sem_t                       arret_signalisation;
   #   endif
 } struct_queue_signaux;  } struct_queue_signaux;
   
 __EXTERN__ struct_queue_signaux     *s_queue_signaux;  __EXTERN__ struct_queue_signaux *s_queue_signaux;
 __EXTERN__ int                      f_queue_signaux;  __EXTERN__ int                  f_queue_signaux;
   
 #   ifdef SEMAPHORES_NOMMES  #   ifndef OS2
         __EXTERN__ sem_t            *semaphore_queue_signaux;      __EXTERN__ sem_t            *semaphore_queue_signaux;
         __EXTERN__ sem_t            *semaphore_signalisation;      __EXTERN__ sem_t            *semaphore_signalisation;
         __EXTERN__ sem_t            *semaphore_arret_signalisation;      __EXTERN__ sem_t            *semaphore_arret_signalisation;
 #   endif  #   endif
 #endif  #endif
   
Line 378  union semun Line 377  union semun
 */  */
   
 #ifdef IPCS_SYSV  #ifdef IPCS_SYSV
   #   ifdef DEBUG_SEMAPHORES
   #       define sem_wait(a) ({ int value; sem_getvalue(a, &value); \
                   uprintf("[%d-%llu] Semaphore %s (%p) "\
                   "waiting at %s() " \
                   "line #%d\n", (int) getpid(), (unsigned long long) i\
                           pthread_self(), \
                   #a, a, __FUNCTION__, __LINE__), fflush(stdout); \
                   if (value > 1) BUG(1, uprintf("Value %d\n", value)); \
                   sem_wait_SysV(a); })
   #   define sem_post(a) ({ int value; sem_getvalue(a, &value); \
                   uprintf("[%d-%llu] Semaphore %s (%p) "\
                   "posting at %s() " \
                   "line #%d\n", (int) getpid(), (unsigned long long) \
                           pthread_self(), \
                   #a, a, __FUNCTION__, __LINE__), fflush(stdout); \
                   if (value > 0) BUG(1, uprintf("Value %d\n", value)); \
                   sem_post_SysV(a); })
   #   define sem_destroy(a) ({ int value; sem_getvalue(a, &value); \
                   if (value == 0) BUG(1, uprintf("Value %d\n", value)); \
                   sem_destroy_SysV(a); })
   #   else
   #       define sem_destroy(a)       sem_destroy_SysV(a)
   #       define sem_wait(a)          sem_wait_SysV(a)
   #       define sem_post(a)          sem_post_SysV(a)
   #   endif
   
 #   define sem_init(a, b, c)    sem_init_SysV(a, b, c)  #   define sem_init(a, b, c)    sem_init_SysV(a, b, c)
 #   define sem_destroy(a)       sem_destroy_SysV(a)  
 #   define sem_wait(a)          sem_wait_SysV(a)  
 #   define sem_trywait(a)       sem_trywait_SysV(a)  #   define sem_trywait(a)       sem_trywait_SysV(a)
 #   define sem_timedwait(a, b)  sem_timedwait_SysV(a, b)  #   define sem_timedwait(a, b)  sem_timedwait_SysV(a, b)
 #   define sem_post(a)          sem_post_SysV(a)  
 #   define sem_getvalue(a, b)   sem_getvalue_SysV(a, b)  #   define sem_getvalue(a, b)   sem_getvalue_SysV(a, b)
 #   define sem_open(...)        sem_open_SysV(__VA_ARGS__)  #   define sem_open(...)        sem_open_SysV(__VA_ARGS__)
 #   define sem_close(a)         sem_close_SysV(a)  #   define sem_close(a)         sem_close_SysV(a)
 #   define sem_unlink(a)        sem_unlink_SysV(a)  #   define sem_unlink(a)        sem_unlink_SysV(a)
   #else
   #   ifdef DEBUG_SEMAPHORES
   #       define sem_wait(a) ({ int value; sem_getvalue(a, &value); \
                   uprintf("[%d-%llu] Semaphore %s (%p) "\
                   "waiting at %s() " \
                   "line #%d\n", (int) getpid(), (unsigned long long) \
                           pthread_self(), \
                   #a, a, __FUNCTION__, __LINE__), fflush(stdout); \
                   if (value > 1) BUG(1, uprintf("Value %d\n", value)); sem_wait(a); })
   #       define sem_post(a) ({ int value; sem_getvalue(a, &value); \
                   uprintf("[%d-%llu] Semaphore %s (%p) "\
                   "posting at %s() " \
                   "line #%d\n", (int) getpid(), (unsigned long long) \
                           pthread_self(), \
                   #a, a, __FUNCTION__, __LINE__), fflush(stdout); \
                   if (value > 0) BUG(1, uprintf("Value %d\n", value)); sem_post(a); })
   #       define sem_destroy(a) ({ int value; sem_getvalue(a, &value); \
                   if (value == 0) BUG(1, uprintf("Value %d\n", value)); \
                   sem_destroy(a); })
   #   endif
 #endif  #endif
   
   
Line 458  union semun Line 500  union semun
 #ifndef RPLARGS  #ifndef RPLARGS
 #   ifdef SEMAPHORES_NOMMES  #   ifdef SEMAPHORES_NOMMES
 #       define LONGUEUR_NOM_SEMAPHORE   64  #       define LONGUEUR_NOM_SEMAPHORE   64
 #   endif  
   
 #   ifdef SEMAPHORES_NOMMES  
 #       define __PTR__      *  #       define __PTR__      *
 #   else  #   else
 #       define __PTR__  #       define __PTR__
Line 476  union semun Line 515  union semun
   
     __EXTERN__ pid_t                pid_processus_pere;      __EXTERN__ pid_t                pid_processus_pere;
   
 #   ifdef SEMAPHORES_NOMMES  
     __EXTERN__ pthread_mutex_t      mutex_sem __STATIC_MUTEX_INITIALIZATION__;  
 #   endif  
   
     __EXTERN__ pthread_mutex_t      mutex_liste_threads      __EXTERN__ pthread_mutex_t      mutex_liste_threads
                                             __STATIC_MUTEX_INITIALIZATION__;                                              __STATIC_MUTEX_INITIALIZATION__;
     __EXTERN__ pthread_mutex_t      mutex_gestionnaires_signaux_atomique  
                                             __STATIC_MUTEX_INITIALIZATION__;  
     __EXTERN__ pthread_mutex_t      mutex_creation_variable_partagee      __EXTERN__ pthread_mutex_t      mutex_creation_variable_partagee
                                             __STATIC_MUTEX_INITIALIZATION__;                                              __STATIC_MUTEX_INITIALIZATION__;
     __EXTERN__ pthread_mutex_t      mutex_sections_critiques;      __EXTERN__ pthread_mutex_t      mutex_sections_critiques;
     __EXTERN__ pthread_mutex_t      mutex_liste_variables_partagees;      __EXTERN__ pthread_mutex_t      mutex_liste_variables_partagees;
       __EXTERN__ pthread_mutex_t      mutex_sem __STATIC_MUTEX_INITIALIZATION__;
     __EXTERN__ sem_t __PTR__        semaphore_gestionnaires_signaux;  
   
     __EXTERN__ volatile int         routine_recursive;      __EXTERN__ volatile int         routine_recursive;
 #endif  
   
 #ifdef SEMAPHORES_NOMMES  #   define SEM_FORK             0
 #define SEM_FORK                0  #   define SEM_QUEUE                1
 #define SEM_QUEUE               1  #   define SEM_SIGNALISATION        2
 #define SEM_SIGNAUX             2  #   define SEM_ARRET_SIGNALISATION  3
 #define SEM_SIGNALISATION       3  
 #define SEM_ARRET_SIGNALISATION 4      sem_t *sem_init2(unsigned int valeur, pid_t pid, int ordre);
 sem_t *sem_init2(unsigned int valeur, pid_t pid, int ordre);      sem_t *sem_init3(unsigned int valeur, pid_t pid, pthread_t tid, int ordre);
 sem_t *sem_init3(unsigned int valeur, pid_t pid, pthread_t tid, int ordre);      int sem_destroy2(sem_t *semaphore_p, pid_t pid, int ordre);
 int sem_destroy2(sem_t *semaphore_p, pid_t pid, int ordre);      int sem_destroy3(sem_t *semaphore_p, pid_t pid, pthread_t tid, int ordre);
 int sem_destroy3(sem_t *semaphore_p, pid_t pid, pthread_t tid, int ordre);      int sem_getvalue2(sem_t *semaphore, int *valeur);
 int sem_getvalue2(sem_t *semaphore, int *valeur);      sem_t *sem_open2(pid_t pid, int ordre);
 sem_t *sem_open2(pid_t pid, int ordre);  #endif
   
 // Le mutex est là uniquement pour pouvoir émuler le comportement  // Le mutex est là uniquement pour pouvoir émuler le comportement
 // de sem_getvalue() sur un système comme MacOS X qui ne possède pas  // de sem_getvalue() sur un système comme MacOS X qui ne possède pas
 // cette fonction.  // cette fonction.
   
   #ifdef Darwin
 #define sem_getvalue(semaphore, value) sem_getvalue2(semaphore, value)  #define sem_getvalue(semaphore, value) sem_getvalue2(semaphore, value)
 #define sem_post(semaphore) \  #define sem_post(semaphore) \
         ({ int r; pthread_mutex_lock(&mutex_sem); \          ({ int r; pthread_mutex_lock(&mutex_sem); \
Line 695  pid_t debug_fork(); Line 727  pid_t debug_fork();
         pthread_mutex_unlock(mutex)          pthread_mutex_unlock(mutex)
 #endif  #endif
   
 #ifdef DEBUG_SEMAPHORES  
 #define sem_wait(a) ({ int value; sem_getvalue(a, &value); \  
         uprintf("[%d-%llu] Semaphore %s (%p) "\  
         "waiting at %s() " \  
         "line #%d\n", (int) getpid(), (unsigned long long) pthread_self(), \  
         #a, a, __FUNCTION__, __LINE__), fflush(stdout); \  
         if (value > 1) BUG(1, uprintf("Value %d\n", value)); sem_wait(a); })  
 #define sem_post(a) ({ int value; sem_getvalue(a, &value); \  
         uprintf("[%d-%llu] Semaphore %s (%p) "\  
         "posting at %s() " \  
         "line #%d\n", (int) getpid(), (unsigned long long) pthread_self(), \  
         #a, a, __FUNCTION__, __LINE__), fflush(stdout); \  
         if (value > 0) BUG(1, uprintf("Value %d\n", value)); sem_post(a); })  
 #define sem_destroy(a) ({ int value; sem_getvalue(a, &value); \  
         if (value == 0) BUG(1, uprintf("Value %d\n", value)); sem_destroy(a); })  
 #endif  
   
   
 /*  /*
 ================================================================================  ================================================================================
Line 1691  typedef struct tableau Line 1706  typedef struct tableau
   
 typedef struct arbre  typedef struct arbre
 {  {
     struct_objet        *objet;      struct_liste_chainee        *feuille;
   
     unsigned long       nombre_feuilles;      integer8                    nombre_branches;
     struct arbre        **feuilles;      struct arbre                **branches;
 } struct_arbre;  } struct_arbre;
   
   
Line 2301  typedef struct processus Line 2316  typedef struct processus
   
     logical1                    processus_detache;      logical1                    processus_detache;
   
       enum t_type                 type_en_cours;
   
 /* Profilage                                            */  /* Profilage                                            */
   
     logical1                    profilage;      logical1                    profilage;
Line 2309  typedef struct processus Line 2326  typedef struct processus
     struct_liste_profilage2     *pile_profilage_fonctions;      struct_liste_profilage2     *pile_profilage_fonctions;
     struct timeval              horodatage_profilage;      struct timeval              horodatage_profilage;
   
     // Mutex spécifique au processus et donnant accès à la pile des processus  
     pthread_mutex_t             mutex;  
     pthread_mutex_t             mutex_allocation;      pthread_mutex_t             mutex_allocation;
     pthread_mutex_t             mutex_interruptions;      pthread_mutex_t             mutex_interruptions;
       pthread_mutex_t             mutex_pile_processus;
       pthread_mutex_t             mutex_signaux;
   
     // Mutex autorisant les fork()      // Mutex autorisant les fork()
     sem_t __PTR__               semaphore_fork;      sem_t __PTR__               semaphore_fork;
Line 2562  void instruction_elseif(struct_processus Line 2579  void instruction_elseif(struct_processus
 void instruction_end(struct_processus *s_etat_processus);  void instruction_end(struct_processus *s_etat_processus);
 void instruction_eng(struct_processus *s_etat_processus);  void instruction_eng(struct_processus *s_etat_processus);
 void instruction_epsilon(struct_processus *s_etat_processus);  void instruction_epsilon(struct_processus *s_etat_processus);
   void instruction_eqv(struct_processus *s_etat_processus);
 void instruction_erase(struct_processus *s_etat_processus);  void instruction_erase(struct_processus *s_etat_processus);
 void instruction_errm(struct_processus *s_etat_processus);  void instruction_errm(struct_processus *s_etat_processus);
 void instruction_errn(struct_processus *s_etat_processus);  void instruction_errn(struct_processus *s_etat_processus);
Line 2802  void instruction_return(struct_processus Line 2820  void instruction_return(struct_processus
 void instruction_revlist(struct_processus *s_etat_processus);  void instruction_revlist(struct_processus *s_etat_processus);
 void instruction_rewind(struct_processus *s_etat_processus);  void instruction_rewind(struct_processus *s_etat_processus);
 void instruction_rfuse(struct_processus *s_etat_processus);  void instruction_rfuse(struct_processus *s_etat_processus);
   void instruction_rgdl(struct_processus *s_etat_processus);
   void instruction_rgdr(struct_processus *s_etat_processus);
 void instruction_rl(struct_processus *s_etat_processus);  void instruction_rl(struct_processus *s_etat_processus);
 void instruction_rlb(struct_processus *s_etat_processus);  void instruction_rlb(struct_processus *s_etat_processus);
 void instruction_rnd(struct_processus *s_etat_processus);  void instruction_rnd(struct_processus *s_etat_processus);
Line 3319  logical1 initialisation_fichier_acces_in Line 3339  logical1 initialisation_fichier_acces_in
         sqlite3 *sqlite, integer8 position_clef, logical1 binaire);          sqlite3 *sqlite, integer8 position_clef, logical1 binaire);
 logical1 lancement_thread_signaux(struct_processus *s_etat_processus);  logical1 lancement_thread_signaux(struct_processus *s_etat_processus);
 logical1 recherche_instruction_suivante(struct_processus *s_etat_processus);  logical1 recherche_instruction_suivante(struct_processus *s_etat_processus);
   logical1 recherche_instruction_suivante_recursive(
           struct_processus *s_etat_processus, integer8 recursivite);
 logical1 retrait_variable(struct_processus *s_etat_processus,  logical1 retrait_variable(struct_processus *s_etat_processus,
         unsigned char *nom_variable, unsigned char type);          unsigned char *nom_variable, unsigned char type);
 logical1 retrait_variables_par_niveau(struct_processus *s_etat_processus);  logical1 retrait_variables_par_niveau(struct_processus *s_etat_processus);
Line 3504  struct_liste_variables_partagees *recher Line 3526  struct_liste_variables_partagees *recher
 #endif  #endif
   
 /*  /*
 --------------------------------------------------------------------------------  
   Fonctions gérant les arbres de simplification  
 --------------------------------------------------------------------------------  
 */  
   
 #ifndef RPLARGS  
 struct_arbre *creation_arbre(struct_processus *s_etat_processus,  
         struct_objet **t_objets, integer8 indice, integer8 indice_maximal);  
 void liberation_arbre(struct_processus *s_etat_processus,  
         struct_arbre *s_noeud);  
 void parcours_arbre(struct_processus *s_etat_processus, struct_arbre *s_noeud);  
 void simplification_arbre(struct_processus *s_etat_processus,  
         struct_arbre *s_noeud);  
 #endif  
   
 /*  
 --------------------------------------------------------------------------------  --------------------------------------------------------------------------------
   Fonctions gérant la complétion automatique    Fonctions gérant la complétion automatique
 --------------------------------------------------------------------------------  --------------------------------------------------------------------------------

Removed from v.1.225  
changed lines
  Added in v.1.254


CVSweb interface <joel.bertrand@systella.fr>