version 1.211, 2013/03/20 17:11:45
|
version 1.274, 2015/07/21 12:22:16
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.13 |
RPL/2 (R) version 4.1.22 |
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 38
|
Line 38
|
# ifdef OpenBSD |
# ifdef OpenBSD |
# define _BSD_SOURCE |
# define _BSD_SOURCE |
# endif |
# endif |
|
|
|
# ifdef FreeBSD |
|
# define __BSD_VISIBLE 1 |
|
# endif |
#endif |
#endif |
|
|
#ifdef OS2 |
#ifdef OS2 |
Line 56
|
Line 60
|
# define sched_yield(arg) |
# define sched_yield(arg) |
#endif |
#endif |
|
|
|
#ifdef CYGWIN |
|
# define SA_ONSTACK 0 |
|
#endif |
|
|
|
|
/* |
/* |
================================================================================ |
================================================================================ |
Line 73
|
Line 81
|
#include <errno.h> |
#include <errno.h> |
#include <stdarg.h> |
#include <stdarg.h> |
#include <poll.h> |
#include <poll.h> |
|
#include <signal.h> |
|
|
#ifndef RPLARGS |
#ifndef RPLARGS |
# include <sys/mman.h> |
# include <sys/mman.h> |
Line 154
|
Line 163
|
# endif |
# endif |
|
|
# include <setjmp.h> |
# include <setjmp.h> |
# include <signal.h> |
|
# include <termios.h> |
# include <termios.h> |
# include <time.h> |
# include <time.h> |
# include <unistd.h> |
# include <unistd.h> |
Line 164
|
Line 172
|
# include "readline.h" |
# include "readline.h" |
# include "termcap.h" |
# include "termcap.h" |
# include "iconv.h" |
# include "iconv.h" |
|
# include "zlib.h" |
|
|
# include "openssl/evp.h" |
# include "openssl/evp.h" |
# ifndef OPENSSL_NO_MD2 |
# ifndef OPENSSL_NO_MD2 |
Line 207
|
Line 216
|
# undef HAVE_STACK_OVERFLOW_RECOVERY |
# undef HAVE_STACK_OVERFLOW_RECOVERY |
# endif |
# endif |
|
|
# define HAVE_INLINE |
|
# define GSL_RANGE_CHECK_OFF |
# define GSL_RANGE_CHECK_OFF |
# include "gsl/gsl_cdf.h" |
# include "gsl/gsl_cdf.h" |
# include "gsl/gsl_cblas.h" |
# include "gsl/gsl_cblas.h" |
Line 313 enum signaux_rpl
|
Line 321 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; |
|
# endif |
|
# else |
|
sem_t semaphore; |
|
sem_t 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; |
|
pid_t controle; |
|
|
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; |
# endif |
# endif |
#endif |
#endif |
|
|
#ifdef OS2 |
|
# define readline(s) readline_wrapper(s) |
|
unsigned char *readline_wrapper(unsigned char *s); |
|
#endif |
|
|
|
#if ! defined(UNION_SEMUN) && defined(IPCS_SYSV) |
#if ! defined(UNION_SEMUN) && defined(IPCS_SYSV) |
union semun |
union semun |
{ |
{ |
Line 367 union semun
|
Line 369 union semun
|
# define SIGSTKSZ 65536 |
# define SIGSTKSZ 65536 |
#endif |
#endif |
|
|
|
|
/* |
/* |
================================================================================ |
================================================================================ |
SÉMAPHORES |
SÉMAPHORES |
Line 374 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 454 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 472 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 |
|
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 531 sem_t *sem_open2(pid_t pid, int ordre);
|
Line 568 sem_t *sem_open2(pid_t pid, int ordre);
|
stderr, __VA_ARGS__) |
stderr, __VA_ARGS__) |
#define fprintf(flux, ...) transliterated_fprintf(s_etat_processus, \ |
#define fprintf(flux, ...) transliterated_fprintf(s_etat_processus, \ |
flux, __VA_ARGS__) |
flux, __VA_ARGS__) |
#define uprintf(...) transliterated_fprintf(NULL, \ |
#define uprintf(...) std_fprintf(stderr, __VA_ARGS__) |
stderr, __VA_ARGS__) |
#define ufprintf(flux, ...) std_fprintf(flux, __VA_ARGS__) |
#define ufprintf(flux, ...) transliterated_fprintf(NULL, \ |
|
flux, __VA_ARGS__) |
|
|
|
#ifdef SunOS |
#ifdef SunOS |
# define fopen(...) ({ FILE *desc; \ |
# define fopen(...) ({ FILE *desc; \ |
Line 616 sem_t *sem_open2(pid_t pid, int ordre);
|
Line 651 sem_t *sem_open2(pid_t pid, int ordre);
|
{ \ |
{ \ |
for(i = 0; i < nb; i++) \ |
for(i = 0; i < nb; i++) \ |
uprintf(" %s\n", appels[i]); \ |
uprintf(" %s\n", appels[i]); \ |
free(appels); \ |
sys_free(appels); \ |
} \ |
} \ |
else \ |
else \ |
uprintf("Nullified backtrace\n"); \ |
uprintf("Nullified backtrace\n"); \ |
Line 690 pid_t debug_fork();
|
Line 725 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 1037 enum t_type { ADR = 0, ALG, BIN, CHN, C
|
Line 1055 enum t_type { ADR = 0, ALG, BIN, CHN, C
|
Sans objet. |
Sans objet. |
Type C/Fortran : unsigned integer8 |
Type C/Fortran : unsigned integer8 |
|
|
CHN : chaine de caracteres (character*(*), unsigned char *) |
CHN : chaine de caracteres (unsigned char *) |
Sans objet. |
Sans objet. |
|
|
CPL : complexe sur 2*64 bits (complex*16, struct_complexe16 *) |
CPL : complexe sur 2*64 bits (complex*16, struct_complexe16 *) |
Line 1127 typedef struct objet
|
Line 1145 typedef struct objet
|
#ifndef RPLARGS |
#ifndef RPLARGS |
typedef struct fichier |
typedef struct fichier |
{ |
{ |
unsigned long descripteur; |
int descripteur; |
|
|
unsigned char acces; /* S/D/I */ |
unsigned char acces; /* S/D/I */ |
unsigned char binaire; /* Y/N/F */ |
unsigned char binaire; /* Y/N/F */ |
Line 1220 typedef struct bibliotheque
|
Line 1238 typedef struct bibliotheque
|
#ifndef RPLARGS |
#ifndef RPLARGS |
typedef struct descripteur_fichier |
typedef struct descripteur_fichier |
{ |
{ |
unsigned long identifiant; |
int identifiant; |
|
|
unsigned char effacement; |
unsigned char effacement; |
unsigned char type; // C (file *) ou S (sqlite *) |
unsigned char type; // C (file *) ou S (sqlite *) |
Line 1459 typedef struct descripteur_thread
|
Line 1477 typedef struct descripteur_thread
|
int pipe_injections[2]; |
int pipe_injections[2]; |
int pipe_nombre_injections[2]; |
int pipe_nombre_injections[2]; |
int pipe_interruptions[2]; |
int pipe_interruptions[2]; |
int pipe_nombre_objets_attente[2]; |
// pipe_nombre_elements_attente == 0 => initialisation ou terminaison |
int pipe_nombre_interruptions_attente[2]; |
// pipe_nombre_elements_attente == 1 => objet en attente |
|
// pipe_nombre_elements_attente == 2 => interruption en attente |
|
int pipe_nombre_elements_attente[2]; |
int pipe_acquittement[2]; |
int pipe_acquittement[2]; |
|
|
volatile integer8 nombre_objets_dans_pipe; |
volatile integer8 nombre_objets_dans_pipe; |
Line 1684 typedef struct tableau
|
Line 1704 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 1806 typedef struct arbre_variables_partagees
|
Line 1826 typedef struct arbre_variables_partagees
|
do { \ |
do { \ |
pthread_mutexattr_t attributs_mutex; \ |
pthread_mutexattr_t attributs_mutex; \ |
pthread_mutexattr_init(&attributs_mutex); \ |
pthread_mutexattr_init(&attributs_mutex); \ |
pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_NORMAL); \ |
pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_RECURSIVE); \ |
pthread_mutex_init(&(mutex), &attributs_mutex); \ |
pthread_mutex_init(&(mutex), &attributs_mutex); \ |
pthread_mutexattr_destroy(&attributs_mutex); \ |
pthread_mutexattr_destroy(&attributs_mutex); \ |
} while(0) |
} while(0) |
Line 1823 typedef struct tableau_variables
|
Line 1843 typedef struct tableau_variables
|
|
|
logical1 variable_verrouillee; |
logical1 variable_verrouillee; |
logical1 variable_masquee; |
logical1 variable_masquee; |
|
pthread_mutex_t *mutex; |
union_position_variable variable_statique; |
union_position_variable variable_statique; |
union_position_variable variable_partagee; |
union_position_variable variable_partagee; |
} struct_tableau_variables; |
} struct_tableau_variables; |
Line 1867 typedef struct liste_variables_partagees
|
Line 1888 typedef struct liste_variables_partagees
|
} struct_liste_variables_partagees; |
} struct_liste_variables_partagees; |
#endif |
#endif |
|
|
|
|
|
/* |
|
-------------------------------------------------------------------------------- |
|
Structure fonction |
|
-------------------------------------------------------------------------------- |
|
*/ |
|
|
|
#ifndef RPLARGS |
|
typedef struct fonction |
|
{ |
|
unsigned char *nom_fonction; |
|
integer8 nombre_arguments; |
|
|
|
void (*fonction)(struct processus *); |
|
|
|
volatile struct_liste_chainee *prediction_saut; |
|
volatile logical1 prediction_execution; |
|
} struct_fonction; |
|
#endif |
|
|
|
|
|
/* |
|
-------------------------------------------------------------------------------- |
|
Structure buffer |
|
-------------------------------------------------------------------------------- |
|
*/ |
|
|
|
typedef struct buffer |
|
{ |
|
unsigned char *buffer; |
|
|
|
size_t longueur_requise; |
|
int classe; |
|
} struct_buffer; |
|
|
|
|
/* |
/* |
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
Structure processus |
Structure processus |
Line 1943 typedef struct processus
|
Line 2000 typedef struct processus
|
int pipe_injections; |
int pipe_injections; |
int pipe_nombre_injections; |
int pipe_nombre_injections; |
int pipe_interruptions; |
int pipe_interruptions; |
int pipe_nombre_objets_attente; |
int pipe_nombre_elements_attente; |
int pipe_nombre_interruptions_attente; |
|
int nombre_objets_envoyes_non_lus; |
int nombre_objets_envoyes_non_lus; |
int nombre_objets_injectes; |
int nombre_objets_injectes; |
|
|
Line 2180 typedef struct processus
|
Line 2236 typedef struct processus
|
/* Traitement des erreurs */ |
/* Traitement des erreurs */ |
|
|
int erreur_compilation; |
int erreur_compilation; |
int erreur_execution; |
volatile int erreur_execution; |
int erreur_systeme; |
volatile int erreur_systeme; |
|
|
struct_objet *s_objet_errone; |
struct_objet *s_objet_errone; |
struct_objet *s_objet_erreur; |
struct_objet *s_objet_erreur; |
Line 2294 typedef struct processus
|
Line 2350 typedef struct processus
|
|
|
logical1 processus_detache; |
logical1 processus_detache; |
|
|
|
enum t_type type_en_cours; |
|
|
/* Profilage */ |
/* Profilage */ |
|
|
logical1 profilage; |
logical1 profilage; |
Line 2302 typedef struct processus
|
Line 2360 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_allocation_buffer; |
|
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 2315 typedef struct processus
|
Line 2375 typedef struct processus
|
pthread_mutex_t protection_liste_mutexes; |
pthread_mutex_t protection_liste_mutexes; |
unsigned int sections_critiques; |
unsigned int sections_critiques; |
|
|
/* Drapeau nécessaire à RESTART */ |
/* Variable d'initialisation pour SCHED */ |
|
|
|
logical1 initialisation_scheduler; |
|
|
|
/* Drapeau nécessaire à RESTART */ |
|
|
volatile logical1 requete_redemarrage; |
volatile logical1 requete_redemarrage; |
|
|
Line 2332 typedef struct processus
|
Line 2396 typedef struct processus
|
integer8 taille_pile_objets; |
integer8 taille_pile_objets; |
struct_objet *pile_objets; |
struct_objet *pile_objets; |
|
|
# define TAILLE_CACHE 1024 |
# define TAILLE_CACHE 1024 |
|
# define CACHE(type, nom) \ |
integer8 *objets_adr[TAILLE_CACHE]; |
type *objets_##nom[TAILLE_CACHE]; \ |
int pointeur_adr; |
volatile int pointeur_##nom; |
|
|
logical8 *objets_bin[TAILLE_CACHE]; |
# define CACHE2(type, nom) \ |
int pointeur_bin; |
type *nom[TAILLE_CACHE]; \ |
|
volatile int pointeur_##nom; |
complex16 *objets_cpl[TAILLE_CACHE]; |
|
int pointeur_cpl; |
CACHE(integer8, adr) |
|
CACHE(logical8, bin) |
struct fonction *objets_fct[TAILLE_CACHE]; |
CACHE(complex16, cpl) |
int pointeur_fct; |
CACHE(struct_fonction, fct) |
|
CACHE(integer8, int) |
integer8 *objets_int[TAILLE_CACHE]; |
CACHE(struct_matrice, mat) |
int pointeur_int; |
CACHE(struct_nom, nom) |
|
CACHE(real8, rel) |
struct_matrice *objets_mat[TAILLE_CACHE]; |
CACHE(struct_tableau, tab) |
int pointeur_mat; |
CACHE(struct_vecteur, vec) |
|
|
struct_nom *objets_nom[TAILLE_CACHE]; |
CACHE2(struct_liste_chainee, maillons) |
int pointeur_nom; |
CACHE2(struct_arbre_variables, variables_noeud) |
|
CACHE2(struct_arbre_variables_partagees, variables_partagees_noeud) |
real8 *objets_rel[TAILLE_CACHE]; |
CACHE2(struct_liste_variables, variables_feuille) |
int pointeur_rel; |
CACHE2(struct_variable, variables_variable) |
|
CACHE2(struct_arbre_variables *, variables_tableau_noeuds) |
struct_tableau *objets_tab[TAILLE_CACHE]; |
CACHE2(struct_arbre_variables_partagees *, |
int pointeur_tab; |
variables_tableau_noeuds_partages) |
|
|
struct_vecteur *objets_vec[TAILLE_CACHE]; |
CACHE2(struct_buffer, enveloppes_buffers) |
int pointeur_vec; |
unsigned char ***cache_buffer; |
|
int *pointeur_cache_buffer; |
struct_liste_chainee *maillons[TAILLE_CACHE]; |
|
int pointeur_maillons; |
|
|
|
struct_arbre_variables *variables_noeud[TAILLE_CACHE]; |
|
int pointeur_variables_noeud; |
|
|
|
struct_arbre_variables_partagees |
|
*variables_partagees_noeud[TAILLE_CACHE]; |
|
int pointeur_variables_partagees_noeud; |
|
|
|
struct_liste_variables *variables_feuille[TAILLE_CACHE]; |
|
int pointeur_variables_feuille; |
|
|
|
struct_variable *variables_variable[TAILLE_CACHE]; |
|
int pointeur_variables_variable; |
|
|
|
struct_arbre_variables **variables_tableau_noeuds[TAILLE_CACHE]; |
|
int pointeur_variables_tableau_noeuds; |
|
|
|
struct_arbre_variables_partagees |
|
**variables_tableau_noeuds_partages |
|
[TAILLE_CACHE]; |
|
int pointeur_variables_tableau_noeuds_partages; |
|
} struct_processus; |
} struct_processus; |
#endif |
#endif |
|
|
|
|
/* |
/* |
-------------------------------------------------------------------------------- |
================================================================================ |
Structure fonction |
MISE EN PLACE DE L'ALLOCATEUR SPÉCIFIQUE |
-------------------------------------------------------------------------------- |
================================================================================*/ |
*/ |
|
|
|
#ifndef RPLARGS |
#ifndef DEBUG_MEMOIRE |
typedef struct fonction |
# define malloc(a) rpl_malloc(s_etat_processus, a) |
{ |
# define realloc(a, b) rpl_realloc(s_etat_processus, a, b) |
unsigned char *nom_fonction; |
# define free(a) rpl_free(s_etat_processus, a) |
integer8 nombre_arguments; |
#endif |
|
|
void (*fonction)(struct_processus *); |
void *rpl_malloc(struct_processus *s_etat_processus, size_t s); |
|
void *rpl_realloc(struct_processus *s_etat_processus, void *ptr, size_t s); |
|
void rpl_free(struct_processus *s_etat_processus, void *ptr); |
|
void *sys_malloc(size_t s); |
|
void sys_free(void *ptr); |
|
|
volatile struct_liste_chainee *prediction_saut; |
/* |
volatile logical1 prediction_execution; |
* Wrapper de readline() pour que la fonction renvoie un pointeur sur un |
} struct_fonction; |
* buffer alloué par rpl_malloc(). |
#endif |
*/ |
|
|
|
#define readline(s) readline_wrapper(s_etat_processus, s) |
|
unsigned char *readline_wrapper(struct_processus *s_etat_processus, |
|
unsigned char *s); |
|
|
|
|
/* |
/* |
Line 2482 void instruction_col_fleche(struct_proce
|
Line 2531 void instruction_col_fleche(struct_proce
|
void instruction_col_moins(struct_processus *s_etat_processus); |
void instruction_col_moins(struct_processus *s_etat_processus); |
void instruction_col_plus(struct_processus *s_etat_processus); |
void instruction_col_plus(struct_processus *s_etat_processus); |
void instruction_comb(struct_processus *s_etat_processus); |
void instruction_comb(struct_processus *s_etat_processus); |
|
void instruction_compress(struct_processus *s_etat_processus); |
void instruction_con(struct_processus *s_etat_processus); |
void instruction_con(struct_processus *s_etat_processus); |
void instruction_cond(struct_processus *s_etat_processus); |
void instruction_cond(struct_processus *s_etat_processus); |
void instruction_cont(struct_processus *s_etat_processus); |
void instruction_cont(struct_processus *s_etat_processus); |
Line 2549 void instruction_elseif(struct_processus
|
Line 2599 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 2789 void instruction_return(struct_processus
|
Line 2840 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 2908 void instruction_t_vers_l(struct_process
|
Line 2961 void instruction_t_vers_l(struct_process
|
|
|
void instruction_ucase(struct_processus *s_etat_processus); |
void instruction_ucase(struct_processus *s_etat_processus); |
void instruction_uchol(struct_processus *s_etat_processus); |
void instruction_uchol(struct_processus *s_etat_processus); |
|
void instruction_uncompress(struct_processus *s_etat_processus); |
void instruction_unlock(struct_processus *s_etat_processus); |
void instruction_unlock(struct_processus *s_etat_processus); |
void instruction_unprotect(struct_processus *s_etat_processus); |
void instruction_unprotect(struct_processus *s_etat_processus); |
void instruction_until(struct_processus *s_etat_processus); |
void instruction_until(struct_processus *s_etat_processus); |
Line 2976 void conversion_chaine(struct_processus
|
Line 3030 void conversion_chaine(struct_processus
|
unsigned char *chaine, unsigned char type); |
unsigned char *chaine, unsigned char type); |
void conversion_decimal_vers_hms(real8 *angle); |
void conversion_decimal_vers_hms(real8 *angle); |
void conversion_degres_vers_radians(real8 *angle); |
void conversion_degres_vers_radians(real8 *angle); |
void conversion_element_tex(unsigned char **element, unsigned char *fonction); |
void conversion_element_tex(struct_processus *s_etat_processus, |
|
unsigned char **element, unsigned char *fonction); |
void conversion_format(struct_processus *s_etat_processus, |
void conversion_format(struct_processus *s_etat_processus, |
unsigned char *chaine); |
unsigned char *chaine); |
void conversion_hms_vers_decimal(real8 *angle); |
void conversion_hms_vers_decimal(real8 *angle); |
void conversion_majuscule_limitee(unsigned char *chaine_entree, |
void conversion_majuscule_limitee( |
unsigned char *chaine_sortie, integer8 longueur); |
unsigned char *chaine_entree, unsigned char *chaine_sortie, |
|
integer8 longueur); |
void conversion_radians_vers_degres(real8 *angle); |
void conversion_radians_vers_degres(real8 *angle); |
void copie_arbre_variables(struct_processus *s_etat_processus, |
void copie_arbre_variables(struct_processus *s_etat_processus, |
struct_processus *s_nouvel_etat_processus); |
struct_processus *s_nouvel_etat_processus); |
Line 3172 real8 correlation_statistique(struct_mat
|
Line 3228 real8 correlation_statistique(struct_mat
|
real8 covariance_statistique(struct_matrice *s_matrice, |
real8 covariance_statistique(struct_matrice *s_matrice, |
integer8 colonne_1, integer8 colonne_2, |
integer8 colonne_1, integer8 colonne_2, |
unsigned char type, logical1 *erreur); |
unsigned char type, logical1 *erreur); |
struct_vecteur *ecart_type_statistique(struct_matrice *s_matrice, |
struct_vecteur *ecart_type_statistique(struct_processus *s_etat_processus, |
unsigned char type); |
struct_matrice *s_matrice, unsigned char type); |
struct_vecteur *moyenne_statistique(struct_matrice *s_matrice); |
struct_vecteur *moyenne_statistique(struct_processus *s_etat_processus, |
struct_vecteur *sommation_colonne_statistique(struct_matrice *s_matrice, |
struct_matrice *s_matrice); |
|
struct_vecteur *sommation_colonne_statistique( |
|
struct_processus *s_etat_processus, struct_matrice *s_matrice, |
integer8 colonne); |
integer8 colonne); |
struct_vecteur *sommation_produits_colonnes_statistiques(struct_matrice |
struct_vecteur *sommation_produits_colonnes_statistiques( |
|
struct_processus *s_etat_processus, struct_matrice |
*s_matrice, integer8 colonne_1, integer8 colonne_2); |
*s_matrice, integer8 colonne_1, integer8 colonne_2); |
struct_vecteur *sommation_statistique(struct_matrice *s_matrice); |
struct_vecteur *sommation_statistique(struct_processus *s_etat_processus, |
struct_vecteur *variance_statistique(struct_matrice *s_matrice, |
struct_matrice *s_matrice); |
unsigned char type); |
struct_vecteur *variance_statistique(struct_processus *s_etat_processus, |
|
struct_matrice *s_matrice, unsigned char type); |
#endif |
#endif |
|
|
/* |
/* |
Line 3217 unsigned char *analyse_algebrique(struct
|
Line 3277 unsigned char *analyse_algebrique(struct
|
unsigned char *chaine_algebrique, struct_liste_chainee **l_base_liste); |
unsigned char *chaine_algebrique, struct_liste_chainee **l_base_liste); |
unsigned char *analyse_flux(struct_processus *s_etat_processus, |
unsigned char *analyse_flux(struct_processus *s_etat_processus, |
unsigned char *flux, integer8 longueur); |
unsigned char *flux, integer8 longueur); |
unsigned char *chiffrement(const EVP_CIPHER *type_chiffrement, |
unsigned char *chiffrement(struct_processus *s_etat_processus, |
|
const EVP_CIPHER *type_chiffrement, |
logical1 encodage, unsigned char *message, integer8 longueur_message, |
logical1 encodage, unsigned char *message, integer8 longueur_message, |
unsigned char *clef, integer8 longueur_clef, |
unsigned char *clef, integer8 longueur_clef, |
unsigned char *vecteur_initialisation, |
unsigned char *vecteur_initialisation, |
integer8 *longueur_message_chiffre); |
integer8 *longueur_message_chiffre); |
unsigned char *compactage(unsigned char *chaine); |
unsigned char *compactage(struct_processus *s_etat_processus, |
unsigned char *conversion_majuscule(unsigned char *chaine); |
unsigned char *chaine); |
|
unsigned char *conversion_majuscule(struct_processus *s_etat_processus, |
|
unsigned char *chaine); |
unsigned char *creation_nom_fichier(struct_processus *s_etat_processus, |
unsigned char *creation_nom_fichier(struct_processus *s_etat_processus, |
unsigned char *chemin); |
unsigned char *chemin); |
unsigned char *date_compilation(); |
unsigned char *date_compilation(struct_processus *s_etat_processus); |
unsigned char *extraction_chaine(unsigned char *chaine, integer8 i, integer8 j); |
unsigned char *extraction_chaine(struct_processus *s_etat_processus, |
|
unsigned char *chaine, integer8 i, integer8 j); |
unsigned char *formateur(struct_processus *s_etat_processus, long offset, |
unsigned char *formateur(struct_processus *s_etat_processus, long offset, |
struct_objet *s_objet); |
struct_objet *s_objet); |
unsigned char *formateur_fichier(struct_processus *s_etat_processus, |
unsigned char *formateur_fichier(struct_processus *s_etat_processus, |
Line 3253 unsigned char *formateur_reel(struct_pro
|
Line 3317 unsigned char *formateur_reel(struct_pro
|
unsigned char *messages(struct_processus *s_etat_processus); |
unsigned char *messages(struct_processus *s_etat_processus); |
unsigned char *pointeur_ieme_caractere(struct_processus *s_etat_processus, |
unsigned char *pointeur_ieme_caractere(struct_processus *s_etat_processus, |
unsigned char *chaine, integer8 position); |
unsigned char *chaine, integer8 position); |
unsigned char *purification_chaine(unsigned char *chaine); |
unsigned char *purification_chaine(struct_processus *s_etat_processus, |
|
unsigned char *chaine); |
unsigned char *recherche_chemin_fichiers_temporaires(struct_processus |
unsigned char *recherche_chemin_fichiers_temporaires(struct_processus |
*s_etat_processus); |
*s_etat_processus); |
unsigned char *reencodage(struct_processus *s_etat_processus, |
unsigned char *reencodage(struct_processus *s_etat_processus, |
Line 3305 logical1 initialisation_fichier_acces_in
|
Line 3370 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 3365 ssize_t write_atomic(struct_processus *s
|
Line 3432 ssize_t write_atomic(struct_processus *s
|
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
*/ |
*/ |
|
|
int alsprintf(unsigned char **strp, const char *fmt, ...); |
int alsprintf(struct_processus *s_etat_processus, |
|
unsigned char **strp, const char *fmt, ...); |
|
#ifndef RPLARGS |
|
int association_etat_processus_readline(); |
|
#endif |
int interruption_violation_access(void *adresse_fautive, int gravite); |
int interruption_violation_access(void *adresse_fautive, int gravite); |
#ifndef RPLARGS |
#ifndef RPLARGS |
|
int initialisation_etat_processus_readline(); |
|
int liberation_etat_processus_readline(); |
integer8 liste_variables(struct_processus *s_etat_processus, |
integer8 liste_variables(struct_processus *s_etat_processus, |
struct_tableau_variables *tableau); |
struct_tableau_variables *tableau); |
integer8 nombre_variables(struct_processus *s_etat_processus); |
integer8 nombre_variables(struct_processus *s_etat_processus); |
int readline_analyse_syntaxique(int count, int key); |
int readline_analyse_syntaxique(int count, int key); |
int readline_effacement(int count, int key); |
int readline_effacement(int count, int key); |
#endif |
#endif |
|
int std_fprintf(file *flux, const char *format, ...); |
int tex_fprintf(struct_processus *s_etat_processus, |
int tex_fprintf(struct_processus *s_etat_processus, |
file *flux, const char *format, ...); |
file *flux, const char *format, ...); |
int transliterated_fprintf(struct_processus *s_etat_processus, file *flux, |
int transliterated_fprintf(struct_processus *s_etat_processus, file *flux, |
const char *format, ...); |
const char *format, ...); |
int valsprintf(unsigned char **strp, const char *fmt, va_list ap); |
int valsprintf(struct_processus *s_etat_processus, |
|
unsigned char **strp, const char *fmt, va_list ap); |
int wrapper_instruction_intrinseque(void (*fonction)(), |
int wrapper_instruction_intrinseque(void (*fonction)(), |
struct_rpl_arguments *rpl_arguments); |
struct_rpl_arguments *rpl_arguments); |
|
|
Line 3429 struct_liste_chainee *analyse_rpn(struct
|
Line 3504 struct_liste_chainee *analyse_rpn(struct
|
|
|
/* |
/* |
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
|
Allocateur de buffers à cache |
|
-------------------------------------------------------------------------------- |
|
*/ |
|
|
|
void initialisation_allocateur_buffer(struct_processus *s_etat_processus); |
|
void liberation_allocateur_buffer(struct_processus *s_etat_pocessus); |
|
struct_buffer *allocation_buffer(struct_processus *s_etat_processus, |
|
size_t longueur); |
|
void liberation_buffer(struct_processus *s_etat_processus, |
|
struct_buffer *buffer); |
|
|
|
/* |
|
-------------------------------------------------------------------------------- |
Fonctions renvoyant une copie de la structure de description des processus |
Fonctions renvoyant une copie de la structure de description des processus |
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
*/ |
*/ |
Line 3490 struct_liste_variables_partagees *recher
|
Line 3578 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 |
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |