Annotation of rpl/src/rpl.h, revision 1.198

1.1       bertrand    1: /*
                      2: ================================================================================
1.189     bertrand    3:   RPL/2 (R) version 4.1.12
1.197     bertrand    4:   Copyright (C) 1989-2013 Dr. BERTRAND Joël
1.1       bertrand    5: 
                      6:   This file is part of RPL/2.
                      7: 
                      8:   RPL/2 is free software; you can redistribute it and/or modify it
                      9:   under the terms of the CeCILL V2 License as published by the french
                     10:   CEA, CNRS and INRIA.
                     11:  
                     12:   RPL/2 is distributed in the hope that it will be useful, but WITHOUT
                     13:   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
                     14:   FITNESS FOR A PARTICULAR PURPOSE.  See the CeCILL V2 License
                     15:   for more details.
                     16:  
                     17:   You should have received a copy of the CeCILL License
                     18:   along with RPL/2. If not, write to info@cecill.info.
                     19: ================================================================================
                     20: */
                     21: 
1.183     bertrand   22: 
1.1       bertrand   23: #ifndef INCLUSION_RPL
                     24: #define INCLUSION_RPL
1.10      bertrand   25: 
1.101     bertrand   26: #ifndef __RPLCAS
                     27: #  define _GNU_SOURCE
1.116     bertrand   28: #  define _XOPEN_SOURCE        700
1.101     bertrand   29: #endif
                     30: 
1.10      bertrand   31: #define _REENTRANT
                     32: 
1.101     bertrand   33: #ifndef __RPLCAS
                     34: #  ifdef Darwin
                     35: #      define  _DARWIN_C_SOURCE
                     36: #  endif
1.32      bertrand   37: 
1.101     bertrand   38: #  ifdef OpenBSD
                     39: #      define _BSD_SOURCE
                     40: #  endif
1.56      bertrand   41: #endif
                     42: 
1.51      bertrand   43: #ifdef OS2
1.101     bertrand   44: #  ifndef __RPLCAS
                     45: #      define _BSD_SOURCE
                     46: #  endif
1.51      bertrand   47: 
                     48: #  include <types.h>
                     49:    enum { SHUT_RD = 0, SHUT_WR, SHUT_RDWR };
                     50: #  define SHUT_RD      SHUT_RD
                     51: #  define SHUT_WR      SHUT_WR
                     52: #  define SHUT_RDWR    SHUT_RDWR
                     53: 
                     54: #  include "getaddrinfo-conv.h"
1.53      bertrand   55: 
                     56: #  define sched_yield(arg)
1.51      bertrand   57: #endif
                     58: 
1.37      bertrand   59: 
1.1       bertrand   60: /*
                     61: ================================================================================
                     62:   INCLUSIONS
                     63: ================================================================================
                     64: */
                     65: 
                     66: #include <stdio.h>
                     67: #include <stdlib.h>
                     68: #include <math.h>
                     69: #include <string.h>
                     70: #include <strings.h>
                     71: #include <syslog.h>
                     72: #include <errno.h>
1.18      bertrand   73: #include <stdarg.h>
1.151     bertrand   74: #include <poll.h>
1.1       bertrand   75: 
                     76: #ifndef RPLARGS
1.32      bertrand   77: #  include <sys/mman.h>
1.56      bertrand   78: #  include <sys/time.h>
1.1       bertrand   79: #  include <sys/resource.h>
                     80: #  include <sys/select.h>
                     81: #  include <sys/socket.h>
                     82: #  include <sys/stat.h>
                     83: #  include <sys/timeb.h>
                     84: #  include <sys/types.h>
                     85: #  include <sys/un.h>
                     86: #  include <sys/wait.h>
                     87: 
                     88: #  include <arpa/inet.h>
                     89: #  include <netinet/in.h>
                     90: #  include <netdb.h>
                     91: 
                     92: #  include <dlfcn.h>
                     93: #  include <fcntl.h>
                     94: #  include <pthread.h>
1.150     bertrand   95: #  include <regex.h>
1.51      bertrand   96: 
                     97: #  ifdef OS2
                     98: #      undef pthread_mutexattr_settype
                     99: #      define pthread_mutexattr_settype(a, b)
                    100: #  endif
                    101: 
1.1       bertrand  102: #  include <pwd.h>
1.134     bertrand  103: #  ifdef SHARED_MEMORY
                    104: #      include <sys/shm.h>
                    105: #  endif
1.57      bertrand  106: 
1.130     bertrand  107: #  ifndef IPCS_SYSV
                    108: #      include <semaphore.h>
                    109: #  else
                    110: #      include <sys/ipc.h>
                    111: #      include <sys/sem.h>
1.55      bertrand  112: 
1.130     bertrand  113: #      ifdef OS2
                    114: #          define INCL_DOSSEMAPHORES
                    115: #          define INCL_DOSMEMMGR
                    116: #          define INCL_DOSERRORS
                    117: #          include <os2.h>
                    118: 
                    119:            typedef struct _OS2SEM
                    120:            {
                    121:                HMTX    hmtx;
                    122:                HEV     hev;
                    123:                ULONG   shared;
                    124:                ULONG   *cnt;
                    125:                ULONG   *nopened;
                    126:                ULONG   allocated;
                    127:            } sem_t;
                    128: #      else // IPCS_SYSV
                    129:            typedef struct
                    130:            {
                    131:                int             sem;
                    132:                int             alloue;
                    133:                unsigned char   *path;
                    134:                pid_t           pid;
                    135:                pthread_t       tid;
                    136:            } sem_t;
                    137: #      endif
1.53      bertrand  138: 
1.130     bertrand  139: #      ifndef SEM_FAILED
                    140: #          define SEM_FAILED   NULL
                    141: #      endif
1.126     bertrand  142: 
1.130     bertrand  143:        sem_t *sem_open_SysV(const char *nom, int oflag, ...);
                    144:        int sem_init_SysV(sem_t *sem, int shared, unsigned int value);
                    145:        int sem_close_SysV(sem_t *sem);
                    146:        int sem_wait_SysV(sem_t *sem);
                    147:        int sem_trywait_SysV(sem_t *sem);
1.170     bertrand  148:        int sem_timedwait_SysV(sem_t *sem, struct timespec *ts);
1.130     bertrand  149:        int sem_post_SysV(sem_t *sem);
                    150:        int sem_getvalue_SysV(sem_t *sem, int *value);
1.170     bertrand  151:        int sem_unlink_SysV(char *nom);
1.130     bertrand  152:        int sem_destroy_SysV(sem_t *sem);
1.51      bertrand  153: #  endif
                    154: 
1.1       bertrand  155: #  include <setjmp.h>
                    156: #  include <signal.h>
                    157: #  include <termios.h>
                    158: #  include <time.h>
                    159: #  include <unistd.h>
                    160: #  include <locale.h>
                    161: 
                    162: #  include "history.h"
                    163: #  include "readline.h"
                    164: #  include "termcap.h"
                    165: #  include "iconv.h"
                    166: 
1.13      bertrand  167: #  include "openssl/evp.h"
1.194     bertrand  168: #  ifndef OPENSSL_NO_MD2
                    169: #      include "openssl/md2.h"
                    170: #  endif
                    171: #  ifndef OPENSSL_NO_MD4
                    172: #      include "openssl/md4.h"
                    173: #  endif
                    174: #  ifndef OPENSSL_NO_MD5
                    175: #      include "openssl/md5.h"
                    176: #  endif
                    177: #  ifndef OPENSSL_NO_MDC2
                    178: #      include "openssl/mdc2.h"
                    179: #  endif
                    180: #  ifndef OPENSSL_NO_RIPEMD
                    181: #      include "openssl/ripemd.h"
                    182: #  endif
                    183: #  ifndef OPENSSL_NO_SHA
                    184: #      include "openssl/sha.h"
                    185: #  endif
                    186: #  ifndef OPENSSL_NO_WHIRLPOOL
                    187: #      include "openssl/whrlpool.h"
                    188: #  endif
1.195     bertrand  189: #  ifndef OPENSSL_NO_AES
                    190: #      include "openssl/aes.h"
                    191: #  endif
1.196     bertrand  192: #  ifndef OPENSSL_NO_CAMELLIA
                    193: #      include "openssl/camellia.h"
                    194: #  endif
                    195: #  ifndef OPENSSL_NO_RC2
                    196: #      include "openssl/rc2.h"
                    197: #  endif
                    198: #  ifndef OPENSSL_NO_IDEA
                    199: #      include "openssl/idea.h"
                    200: #  endif
1.194     bertrand  201: 
1.15      bertrand  202: #  include "sqlite3.h"
1.132     bertrand  203: #  include "sigsegv.h"
1.135     bertrand  204: #  ifdef OS2
                    205:        // Bug de libsigsegv
                    206: #      undef HAVE_STACK_OVERFLOW_RECOVERY
                    207: #  endif
1.13      bertrand  208: 
1.1       bertrand  209: #  define HAVE_INLINE
                    210: #  define GSL_RANGE_CHECK_OFF
                    211: #  include "gsl/gsl_cdf.h"
                    212: #  include "gsl/gsl_cblas.h"
                    213: #  include "gsl/gsl_errno.h"
                    214: #  include "gsl/gsl_fft_complex.h"
                    215: #  include "gsl/gsl_permutation.h"
                    216: #  include "gsl/gsl_randist.h"
                    217: #  include "gsl/gsl_rng.h"
                    218: #  include "gsl/gsl_sf.h"
                    219: #endif
                    220: 
                    221: #ifdef SunOS
                    222: #  include <ieeefp.h>
                    223: #endif
                    224: 
1.177     bertrand  225: // Définition spécifique à Hurd
1.23      bertrand  226: #ifndef PIPE_BUF
                    227: #  define fpathconf (".", _PC_PIPE_BUF)
                    228: #endif
                    229: 
1.1       bertrand  230: #ifdef MYSQL_SUPPORT
                    231: #   include <mysql.h>
                    232: #   define mysqlclose(arg)     mysql_close(arg.mysql)
                    233: #else
                    234: #   define mysqlclose(arg)
                    235: #endif
                    236: 
                    237: #ifdef POSTGRESQL_SUPPORT
                    238: #   include <libpq-fe.h>
                    239: #  define postgresqlclose(arg) PQfinish(arg.postgresql)
                    240: #else
                    241: #   define postgresqlclose(arg)
                    242: #endif
                    243: 
1.25      bertrand  244: #include "librplprototypes.h"
1.1       bertrand  245: 
1.61      bertrand  246: #ifndef RPLARGS
                    247: #  ifndef UNIX_PATH_MAX
                    248:        struct sockaddr_un sizecheck;
                    249: #      define UNIX_PATH_MAX sizeof(sizecheck.sun_path)
                    250: #  endif
1.56      bertrand  251: #endif
                    252: 
1.163     bertrand  253: #ifdef MAIN_RPL
                    254: #  define __EXTERN__
                    255: #  define __STATIC_MUTEX_INITIALIZATION__ = PTHREAD_MUTEX_INITIALIZER
                    256: #else
                    257: #  define __EXTERN__                       extern
                    258: #  define __STATIC_MUTEX_INITIALIZATION__
                    259: #endif
                    260: 
1.60      bertrand  261: /*
                    262: ================================================================================
1.177     bertrand  263:   Bugs spécifiques
1.60      bertrand  264: ================================================================================
                    265: */
                    266: 
1.177     bertrand  267: // Néant
1.164     bertrand  268: 
                    269: /*
                    270: ================================================================================
                    271:   TYPES
                    272: ================================================================================
                    273: */
                    274: 
                    275: typedef FILE                   file;
                    276: typedef unsigned char          t_8_bits;
                    277: 
                    278: #ifndef RPLARGS
                    279: #  include "rpltypes-conv.h"
                    280: #else
                    281: #  include "rpltypes.h"
                    282: #endif
                    283: 
1.120     bertrand  284: enum signaux_rpl
                    285: {
1.122     bertrand  286:    rpl_signull = 0,
1.120     bertrand  287:    rpl_sigint,
                    288:    rpl_sigterm,
1.177     bertrand  289:    rpl_sigstart,       // Signal envoyé par un père pour lancer son fils.
                    290:    rpl_sigcont,        // Signal de redémarrage d'un processus arrêté par
1.120     bertrand  291:                        // SUSPEND
1.177     bertrand  292:    rpl_sigstop,        // Signal d'arrêt envoyé par l'instruction STOP ou
1.120     bertrand  293:                        // FUSE. (FSTOP)
1.177     bertrand  294:    rpl_sigabort,       // Signal envoyé par l'instruction ABORT (à regrouper
1.120     bertrand  295:                        // avec FABORT)
1.177     bertrand  296:    rpl_sigurg,         // Signal d'arrêt urgent
                    297:    rpl_siginject,      // Signal indiquant la présence d'une donnée à lire
                    298:                        // envoyée depuis le père
                    299:    rpl_sigalrm,        // Signal d'alarme (erreur système) depuis un fils
1.120     bertrand  300:    rpl_sighup,
                    301:    rpl_sigtstp,
1.121     bertrand  302:    rpl_sigexcept,
1.120     bertrand  303:    rpl_sigmax
                    304: };
                    305: 
                    306: #define    LONGUEUR_QUEUE_SIGNAUX          1024
                    307: 
1.177     bertrand  308: // Une structure s_queue_signaux est créée par processus (et non par thread).
                    309: // Elle est projetée dans un segment de mémoire partagée pour qu'elle soit
                    310: // accessible à la fois du père et des fils.
1.120     bertrand  311: 
1.133     bertrand  312: #ifndef RPLARGS
1.120     bertrand  313: typedef struct queue_signaux
                    314: {
1.126     bertrand  315: #  ifndef IPCS_SYSV
                    316: #      ifndef SEMAPHORES_NOMMES
                    317:            sem_t               semaphore;
1.164     bertrand  318:            sem_t               signalisation;
1.126     bertrand  319: #      endif
                    320: #  else
                    321:        sem_t                   semaphore;
1.164     bertrand  322:        sem_t                   signalisation;
1.123     bertrand  323: #  endif
1.57      bertrand  324: 
1.120     bertrand  325:    volatile int                pointeur_lecture;
                    326:    volatile int                pointeur_ecriture;
1.164     bertrand  327:    pthread_t                   thread_signaux;
                    328:    volatile logical1           requete_arret;
1.63      bertrand  329: 
1.120     bertrand  330:    volatile struct
                    331:    {
                    332:        pid_t                   pid;
                    333:        enum signaux_rpl        signal;
                    334:    }                           queue[LONGUEUR_QUEUE_SIGNAUX];
                    335: } struct_queue_signaux;
1.63      bertrand  336: 
1.163     bertrand  337: __EXTERN__ struct_queue_signaux        *s_queue_signaux;
                    338: __EXTERN__ int                     f_queue_signaux;
                    339: 
                    340: #  ifdef SEMAPHORES_NOMMES
                    341:        __EXTERN__ sem_t            *semaphore_queue_signaux;
1.164     bertrand  342:        __EXTERN__ sem_t            *semaphore_signalisation;
1.62      bertrand  343: #  endif
1.57      bertrand  344: #endif
                    345: 
1.63      bertrand  346: #ifdef OS2
                    347: #  define readline(s) readline_wrapper(s)
1.67      bertrand  348:    unsigned char *readline_wrapper(unsigned char *s);
1.63      bertrand  349: #endif
                    350: 
1.68      bertrand  351: #if ! defined(UNION_SEMUN) && defined(IPCS_SYSV)
1.60      bertrand  352: union semun
                    353: {
                    354:    int                 val;
                    355:    struct semid_ds     *buf;
                    356:    unsigned short      *array;
                    357:    struct seminfo      *__buf;
                    358: };
                    359: #endif
                    360: 
1.132     bertrand  361: #ifndef RTLD_LOCAL
                    362: #  define RTLD_LOCAL       0
                    363: #endif
                    364: 
                    365: #ifndef SIGSTKSZ
                    366: #  define SIGSTKSZ         65536
                    367: #endif
1.53      bertrand  368: 
                    369: /*
                    370: ================================================================================
1.177     bertrand  371:   SÉMAPHORES
1.53      bertrand  372: ================================================================================
                    373: */
                    374: 
1.68      bertrand  375: #ifdef IPCS_SYSV
1.53      bertrand  376: #  define sem_init(a, b, c)    sem_init_SysV(a, b, c)
                    377: #  define sem_destroy(a)       sem_destroy_SysV(a)
                    378: #  define sem_wait(a)          sem_wait_SysV(a)
                    379: #  define sem_trywait(a)       sem_trywait_SysV(a)
1.170     bertrand  380: #  define sem_timedwait(a, b)  sem_timedwait_SysV(a, b)
1.53      bertrand  381: #  define sem_post(a)          sem_post_SysV(a)
                    382: #  define sem_getvalue(a, b)   sem_getvalue_SysV(a, b)
                    383: #  define sem_open(...)        sem_open_SysV(__VA_ARGS__)
                    384: #  define sem_close(a)         sem_close_SysV(a)
                    385: #  define sem_unlink(a)        sem_unlink_SysV(a)
                    386: #endif
                    387: 
                    388: 
1.1       bertrand  389: /*
                    390: ================================================================================
                    391:   SIGNAUX
                    392: ================================================================================
                    393: */
                    394: 
                    395: #ifndef RPLARGS
1.57      bertrand  396: 
1.177     bertrand  397: // Signaux utilisés par défaut :
1.57      bertrand  398: // SIGINT
                    399: // SIGTSTP
                    400: // SIGCONT
                    401: // SIGPIPE
1.177     bertrand  402: // SIGUSR1 et SIGUSR2 sont utilisé par libsigsegv.
1.153     bertrand  403: // SIGHUP
                    404: // SIGALRM
1.37      bertrand  405: 
1.171     bertrand  406: #  define SIGTEST                  255
1.118     bertrand  407: 
1.37      bertrand  408: // Nombre d'interruptions disponibles
1.1       bertrand  409: #  define d_NOMBRE_INTERRUPTIONS   64
                    410: #endif
                    411: 
                    412: /*
                    413: ================================================================================
1.177     bertrand  414:   Granularité temporelle
1.1       bertrand  415: ================================================================================
                    416: */
                    417: 
                    418: #ifndef RPLARGS
                    419: #  define GRANULARITE_us           10
                    420: #  define GRANULARITE_us_max       100000
                    421: #  define INCR_GRANULARITE(g) \
                    422:    do  g = 1000 * ((g >= (GRANULARITE_us_max * 1000)) \
                    423:            ? GRANULARITE_us_max : ((g / 1000) + GRANULARITE_us)); while(0)
                    424: #endif
                    425: 
                    426: /*
                    427: ================================================================================
                    428:   Options de debug
                    429: ================================================================================
                    430: */
                    431: 
                    432: #ifndef RPLARGS
                    433: #  define d_debug_pile_utilisateur         ((integer8) 0x1)
                    434: #  define d_debug_pile_systeme             ((integer8) 0x2)
                    435: #  define d_debug_appels_fonctions         ((integer8) 0x4)
                    436: #  define d_debug_processus                ((integer8) 0x8)
                    437: #  define d_debug_analyse                  ((integer8) 0x10)
                    438: #  define d_debug_fusible                  ((integer8) 0x20)
                    439: #  define d_debug_variables                ((integer8) 0x40)
                    440: #  define d_debug_fonctions_intrinseques   ((integer8) 0x80)
                    441: #  define d_debug_niveaux                  ((integer8) 0x100)
                    442: #  define d_conversion_RPN                 ((integer8) 0x200)
                    443: #  define d_traitement_interruption        ((integer8) 0x400)
                    444: #  define d_debug_signaux                  ((integer8) 0x800)
                    445: #endif
                    446: 
                    447: /*
                    448: ================================================================================
                    449:   Variables globales
                    450: ================================================================================
                    451: */
                    452: 
                    453: #ifndef RPLARGS
1.22      bertrand  454: #  ifdef SEMAPHORES_NOMMES
                    455: #      define LONGUEUR_NOM_SEMAPHORE   64
                    456: #  endif
1.57      bertrand  457: 
1.163     bertrand  458: #  ifdef SEMAPHORES_NOMMES
                    459: #      define __PTR__      *
                    460: #  else
                    461: #      define __PTR__
                    462: #  endif
1.22      bertrand  463: 
1.163     bertrand  464:    __EXTERN__ jmp_buf              contexte_ecriture;
                    465:    __EXTERN__ jmp_buf              contexte_impression;
                    466:    __EXTERN__ jmp_buf              contexte_initial;
                    467:    __EXTERN__ jmp_buf              contexte_processus;
                    468:    __EXTERN__ jmp_buf              contexte_thread;
1.118     bertrand  469: 
1.171     bertrand  470:    __EXTERN__ volatile int         signal_test;
1.119     bertrand  471: 
1.163     bertrand  472:    __EXTERN__ pid_t                pid_processus_pere;
1.1       bertrand  473: 
1.163     bertrand  474: #  ifdef SEMAPHORES_NOMMES
                    475:    __EXTERN__ pthread_mutex_t      mutex_sem __STATIC_MUTEX_INITIALIZATION__;
                    476: #  endif
1.22      bertrand  477: 
1.163     bertrand  478:    __EXTERN__ pthread_mutex_t      mutex_liste_threads
                    479:                                            __STATIC_MUTEX_INITIALIZATION__;
1.188     bertrand  480:    __EXTERN__ pthread_mutex_t      mutex_gestionnaires_signaux_atomique
1.187     bertrand  481:                                            __STATIC_MUTEX_INITIALIZATION__;
1.188     bertrand  482:    __EXTERN__ pthread_mutex_t      mutex_creation_variable_partagee
1.163     bertrand  483:                                            __STATIC_MUTEX_INITIALIZATION__;
1.175     bertrand  484:    __EXTERN__ pthread_mutex_t      mutex_sections_critiques;
1.188     bertrand  485:    __EXTERN__ pthread_mutex_t      mutex_liste_variables_partagees;
1.118     bertrand  486: 
1.163     bertrand  487:    __EXTERN__ sem_t __PTR__        semaphore_gestionnaires_signaux;
1.119     bertrand  488: 
1.163     bertrand  489:    __EXTERN__ volatile int         routine_recursive;
1.1       bertrand  490: #endif
                    491: 
1.22      bertrand  492: #ifdef SEMAPHORES_NOMMES
1.131     bertrand  493: #define SEM_FORK           0
                    494: #define    SEM_QUEUE           1
                    495: #define    SEM_SIGNAUX         2
1.164     bertrand  496: #define SEM_SIGNALISATION  3
1.131     bertrand  497: sem_t *sem_init2(unsigned int valeur, pid_t pid, int ordre);
                    498: sem_t *sem_init3(unsigned int valeur, pid_t pid, pthread_t tid, int ordre);
                    499: int sem_destroy2(sem_t *semaphore_p, pid_t pid, int ordre);
                    500: int sem_destroy3(sem_t *semaphore_p, pid_t pid, pthread_t tid, int ordre);
1.125     bertrand  501: int sem_getvalue2(sem_t *semaphore, int *valeur);
1.131     bertrand  502: sem_t *sem_open2(pid_t pid, int ordre);
1.22      bertrand  503: 
1.177     bertrand  504: // Le mutex est là uniquement pour pouvoir émuler le comportement
                    505: // de sem_getvalue() sur un système comme MacOS X qui ne possède pas
1.125     bertrand  506: // cette fonction.
1.22      bertrand  507: 
                    508: #define sem_getvalue(semaphore, value) sem_getvalue2(semaphore, value)
                    509: #define sem_post(semaphore) \
                    510:        ({ int r; pthread_mutex_lock(&mutex_sem); \
                    511:        r = sem_post(semaphore), pthread_mutex_unlock(&mutex_sem); r; })
                    512: #define sem_wait(semaphore) \
                    513:        ({ int r; pthread_mutex_lock(&mutex_sem); \
                    514:        r = sem_wait(semaphore), pthread_mutex_unlock(&mutex_sem); r; })
                    515: #define sem_trywait(semaphore) \
                    516:        ({ int r; pthread_mutex_lock(&mutex_sem); \
                    517:        r = sem_trywait(semaphore), pthread_mutex_unlock(&mutex_sem); r; })
                    518: #endif
                    519: 
1.1       bertrand  520: /*
                    521: ================================================================================
                    522:   Macros
                    523: ================================================================================
                    524: */
                    525: 
1.177     bertrand  526: // Par défaut, tout est redirigé vers stderr sauf indication explicite de
1.1       bertrand  527: // stdout.
                    528: 
                    529: #define printf(...) transliterated_fprintf(s_etat_processus, \
                    530:            stderr, __VA_ARGS__)
                    531: #define fprintf(flux, ...) transliterated_fprintf(s_etat_processus, \
                    532:            flux, __VA_ARGS__)
                    533: #define uprintf(...) transliterated_fprintf(NULL, \
                    534:            stderr, __VA_ARGS__)
                    535: #define ufprintf(flux, ...) transliterated_fprintf(NULL, \
                    536:            flux, __VA_ARGS__)
                    537: 
                    538: #ifdef SunOS
                    539: #  define fopen(...) ({ FILE *desc; \
                    540:            while((desc = fopen(__VA_ARGS__)) == NULL) \
                    541:            { if ((errno != EINTR) && (errno != 0)) break; } desc; })
1.69      bertrand  542: #  define freopen(...) ({ FILE *desc; \
                    543:            while((desc = freopen(__VA_ARGS__)) == NULL) \
                    544:            { if ((errno != EINTR) && (errno != 0)) break; } desc; })
1.1       bertrand  545: #  define fclose(...) ({ int ios; \
                    546:            while((ios = fclose(__VA_ARGS__)) != 0) \
                    547:            { if ((errno != EINTR) && (errno != 0)) break; } ios; })
                    548: #  define fflush(flux) ({ int ios; \
                    549:            while((ios = fflush((flux == stdout) ? stderr : flux)) != 0) \
                    550:            { if ((errno != EINTR) && (errno != 0)) break; } ios; })
                    551: #  define sem_open(...) ({ sem_t *semaphore; \
                    552:            while((semaphore = sem_open(__VA_ARGS__)) == SEM_FAILED) \
                    553:            { if (errno != EINTR) break; }  semaphore; })
                    554: #else // !SunOS
                    555: #  define fflush(flux) fflush((flux == stdout) ? stderr : flux)
                    556: #endif
                    557: 
1.177     bertrand  558: // Ajout d'un timeout sur les fonctions pipe() pour éviter une erreur
                    559: // système dans le cas où l'on a atteint le nombre maximale de fichiers
1.1       bertrand  560: // ouverts.
                    561: 
                    562: #define pipe(descripteurs) \
                    563:    ({ \
                    564:        struct timespec temporisation; \
                    565:        int erreur, nombre_echecs; \
                    566:        nombre_echecs = 0; \
                    567:        do \
                    568:        { \
                    569:            if ((erreur = pipe(descripteurs)) == 0) break; \
                    570:            nombre_echecs++; \
                    571:            temporisation.tv_sec = 0; \
                    572:            temporisation.tv_nsec = ((long) 1000000000) * rand(); \
                    573:            nanosleep(&temporisation, NULL); \
                    574:        } while(nombre_echecs < 100); \
                    575:        erreur; \
                    576:     })
                    577: 
1.177     bertrand  578: // Redéfinition de abs pour un fonctionnement en entier de type long long int
1.1       bertrand  579: 
1.51      bertrand  580: #ifdef __GNUC__
1.1       bertrand  581: #  define abs(i) ({ typeof(i) _i; _i = (i); (_i >= 0) ? _i : -_i; })
1.177     bertrand  582: // typeof() est une extension de gcc, mais est présent sur d'autres compilateurs
                    583: // comme Sun Studio. Dans le cas où typeof() n'existe pas, il est possible
                    584: // d'utiliser la macro suivante, mais elle possède un effet de bord dû à
                    585: // l'évaluation multiple de l'argument.
1.1       bertrand  586: #else
                    587: #  define abs(i) (((i) >= 0) ? (i) : (-i))
                    588: #endif
                    589: 
1.9       bertrand  590: #define NOTICE(m) \
                    591:    do \
                    592:    { \
                    593:        ufprintf(stderr, "[%d-%llu] %s() from %s at line %d: %s\n", \
                    594:                getpid(), (unsigned long long) pthread_self(), \
                    595:                __FUNCTION__, __FILE__, __LINE__, m); \
                    596:        fflush(stderr); \
                    597:    } while(0)
                    598: 
                    599: #ifdef __GLIBC__
                    600: #include <execinfo.h>
1.34      bertrand  601: #define __BACKTRACE
1.1       bertrand  602: #define BACKTRACE(n) \
                    603:    do \
                    604:    { \
                    605:        void            *buffer[n]; \
                    606:        int             nb, i; \
                    607:        char            **appels; \
                    608:        pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; \
                    609:        nb = backtrace(buffer, n); \
                    610:        appels = backtrace_symbols(buffer, nb); \
                    611:        pthread_mutex_lock(&mutex); \
                    612:        uprintf("[%d-%llu] BACKTRACE <%s()> at line #%d\n", \
                    613:                getpid(), pthread_self(), __FUNCTION__, __LINE__); \
                    614:        if (appels != NULL) \
                    615:        { \
                    616:            for(i = 0; i < nb; i++) \
1.23      bertrand  617:                uprintf("    %s\n", appels[i]); \
1.1       bertrand  618:            free(appels); \
                    619:        } \
                    620:        else \
                    621:            uprintf("Nullified backtrace\n"); \
                    622:        uprintf("[%d-%llu] END OF BACKTRACE\n", getpid(), pthread_self()); \
                    623:        fflush(stdout); \
                    624:        pthread_mutex_unlock(&mutex); \
                    625:    } while(0)
1.9       bertrand  626: #else
                    627: #define BACKTRACE(n) NOTICE("BACKTRACE only defined in glibc")
                    628: #endif
1.1       bertrand  629: 
1.35      bertrand  630: #ifdef __BACKTRACE
                    631: #  define BUG(b, ...) \
                    632:            do { if (b) { uprintf("[%d] BUG! <%s()> at line #%d of %s\n", \
                    633:            (int) getpid(), __FUNCTION__, __LINE__, __FILE__); \
                    634:            __VA_ARGS__; fflush(stdout); \
                    635:            BACKTRACE(64); \
                    636:            pthread_kill(pthread_self(), SIGBUS); }} while(0)
                    637: #else
                    638: #  define BUG(b, ...) \
                    639:            do { if (b) { uprintf("[%d] BUG! <%s()> at line #%d of %s\n", \
                    640:            (int) getpid(), __FUNCTION__, __LINE__, __FILE__); \
                    641:            __VA_ARGS__; fflush(stdout); \
                    642:            pthread_kill(pthread_self(), SIGBUS); }} while(0)
                    643: #endif
                    644: 
1.1       bertrand  645: 
                    646: /*
                    647: ================================================================================
                    648:   Affichage des points de retour des fonctions
                    649: ================================================================================
                    650: */
                    651: 
1.9       bertrand  652: #ifdef DEBUG_MEMOIRE
1.35      bertrand  653: void analyse_post_mortem();
1.9       bertrand  654: void *debug_memoire_ajout(size_t taille, const unsigned char *fonction,
                    655:        unsigned long ligne, const unsigned char *argument);
1.39      bertrand  656: void debug_memoire_initialisation();
1.9       bertrand  657: void *debug_memoire_modification(void *pointeur, size_t taille,
                    658:        const unsigned char *fonction, unsigned long ligne,
                    659:        const unsigned char *argument);
                    660: void debug_memoire_retrait(void *ptr);
1.35      bertrand  661: void debug_memoire_verification();
1.9       bertrand  662: 
1.39      bertrand  663: pid_t debug_fork();
                    664: 
1.9       bertrand  665: #define malloc(s) debug_memoire_ajout(s, __FUNCTION__, __LINE__, #s)
                    666: #define free(s) debug_memoire_retrait(s)
                    667: #define realloc(s, t) debug_memoire_modification(s, t, \
                    668:            __FUNCTION__, __LINE__, #t)
1.39      bertrand  669: #define fork() debug_fork()
1.9       bertrand  670: #endif
                    671: 
1.1       bertrand  672: #ifdef DEBUG_RETURN
                    673: #define return uprintf("[%d] Return from <%s()> at line #%d " \
                    674:        "(%s [%d])\n", (int) getpid(), __FUNCTION__, \
1.9       bertrand  675:        __LINE__, strerror(errno), errno); fflush(stdout); errno = 0; return
1.1       bertrand  676: #endif
                    677: 
                    678: #ifdef DEBUG_MUTEX
                    679: #define pthread_mutex_lock(mutex) uprintf("[%d-%llu] Mutex %s (%p) " \
                    680:        "locking at %s() " \
                    681:        "line #%d\n", (int) getpid(), (unsigned long long) pthread_self(), \
                    682:        #mutex, mutex, __FUNCTION__, __LINE__), fflush(stdout), \
                    683:        pthread_mutex_lock(mutex)
                    684: #define pthread_mutex_unlock(mutex) uprintf("[%d-%llu] Mutex %s (%p) " \
                    685:        "unlocking at " \
                    686:        "%s() line #%d\n", (int) getpid(), (unsigned long long) \
                    687:        pthread_self(), #mutex, mutex, __FUNCTION__, __LINE__), \
                    688:        fflush(stdout), \
                    689:        pthread_mutex_unlock(mutex)
                    690: #endif
                    691: 
                    692: #ifdef DEBUG_SEMAPHORES
                    693: #define sem_wait(a) ({ int value; sem_getvalue(a, &value); \
                    694:        uprintf("[%d-%llu] Semaphore %s (%p) "\
                    695:        "waiting at %s() " \
                    696:        "line #%d\n", (int) getpid(), (unsigned long long) pthread_self(), \
                    697:        #a, a, __FUNCTION__, __LINE__), fflush(stdout); \
                    698:        if (value > 1) BUG(1, uprintf("Value %d\n", value)); sem_wait(a); })
                    699: #define sem_post(a) ({ int value; sem_getvalue(a, &value); \
                    700:        uprintf("[%d-%llu] Semaphore %s (%p) "\
                    701:        "posting at %s() " \
                    702:        "line #%d\n", (int) getpid(), (unsigned long long) pthread_self(), \
                    703:        #a, a, __FUNCTION__, __LINE__), fflush(stdout); \
                    704:        if (value > 0) BUG(1, uprintf("Value %d\n", value)); sem_post(a); })
                    705: #define sem_destroy(a) ({ int value; sem_getvalue(a, &value); \
                    706:        if (value == 0) BUG(1, uprintf("Value %d\n", value)); sem_destroy(a); })
                    707: #endif
                    708: 
                    709: 
                    710: /*
                    711: ================================================================================
                    712:   DEFINIONS
                    713: ================================================================================
                    714: */
                    715: 
                    716: /*
                    717: --------------------------------------------------------------------------------
                    718:   Valeurs
                    719: --------------------------------------------------------------------------------
                    720: */
                    721: 
                    722: #define d_faux                 ((logical1) 0L)
                    723: #define d_vrai                 ((logical1) -1L)
                    724: 
                    725: #define d_absence_erreur       ((logical1) d_faux)
                    726: #define d_erreur               ((logical1) d_vrai)
                    727: 
1.31      bertrand  728: #define d_code_fin_chaine                  '\0'
                    729: #define d_code_espace                      ' '
                    730: #define d_code_retour_chariot              '\n'
                    731: #define d_code_tabulation                  '\t'
                    732: #define d_longueur_maximale_instruction        16
1.1       bertrand  733: 
                    734: #define d_INT                  "integer"
                    735: #define    d_REL                   "real"
                    736: #define d_CPL                  "complex"
                    737: #define d_VIN                  "[ integer ]"
                    738: #define d_VRL                  "[ real ]"
                    739: #define d_VCX                  "[ complex ]"
                    740: #define d_MIN                  "[[ integer ]]"
                    741: #define d_MRL                  "[[ real ]]"
                    742: #define d_MCX                  "[[ complex ]]"
                    743: #define d_BIN                  "# binary[bodh]"
                    744: #define d_NOM                  "'name'"
                    745: #define d_CHN                  "\"string\""
                    746: #define d_LST                  "{ list }"
                    747: #define d_ALG                  "'algebraic'"
                    748: #define d_RPN                  "<< RPN >>"
                    749: #define d_FCH                  "File $n { format }"
                    750: #define d_SLB                  "Library $n"
                    751: #define d_SQL                  "Sql $n (type)"
                    752: #define d_PRC                  "Process $n"
                    753: #define d_SCK                  "Socket $n { format }"
                    754: #define d_SPH                  "Semaphore $n 'name'"
                    755: #define d_TAB                  "<[ table ]>"
                    756: #define d_MTX                  "Mutex $n"
                    757: 
                    758: /*
                    759: --------------------------------------------------------------------------------
1.177     bertrand  760:   Paramètres du système
1.1       bertrand  761: --------------------------------------------------------------------------------
                    762: */
                    763: 
                    764: #ifndef RPLARGS
                    765: #  define ds_beep                              ""
                    766: #  define ds_fichier_historique                ".RPL2_history"
                    767: #  define ds_imposition_separateur_decimal     d_vrai
                    768: #  define ds_longueur_historique               256
                    769: #  define ds_nombre_maximum_fichiers_ouverts   65536
                    770: #  define ds_preprocesseur                     "rplpp " \
                    771:                                                    "--nostdinc -C 2> /dev/null"
                    772: #  define ds_rplcore                           "rpl-core"
                    773: #  define ds_rplprofile                        "rpl-profile"
                    774: #  define ds_sdat                              "SDAT"
                    775: #endif
                    776: 
                    777: /*
                    778: --------------------------------------------------------------------------------
1.177     bertrand  779:   Erreurs système
1.1       bertrand  780: --------------------------------------------------------------------------------
                    781: */
1.192     bertrand  782: 
1.36      bertrand  783: #ifdef DEBUG_ERREURS
                    784: #  ifdef MESSAGES
                    785: #      define __erreur(i)  i
1.59      bertrand  786: #      define __erreur_(i) i
1.36      bertrand  787: #  else
1.59      bertrand  788: #      undef _ERREURS_VARIABLES
                    789: #      ifdef _ERREURS_VARIABLES
                    790: #          define __erreur_(i) __erreur(i)
                    791: #      else
                    792: #          define __erreur_(i) i
                    793: #      endif
1.36      bertrand  794: #      define __erreur(i)  ({ if (strstr(__FUNCTION__, "recherche_variable") \
1.60      bertrand  795:                == NULL) ufprintf(stderr, \
                    796:                "ERROR %d AT %s() FROM %s LINE %d\n", \
                    797:                i, __FUNCTION__, __FILE__, __LINE__); i; })
1.36      bertrand  798: #  endif
                    799: #else
                    800: #  define __erreur(i)  i
1.59      bertrand  801: #  define __erreur_(i) i
1.36      bertrand  802: #endif
                    803: 
1.1       bertrand  804: 
1.177     bertrand  805: // -1 : erreur provoquée par une bibliothèque externe
1.1       bertrand  806: #ifndef RPLARGS
                    807: #  define d_es                                 2000
1.36      bertrand  808: #  define d_es_allocation_memoire              __erreur(2001)
1.59      bertrand  809: #  define d_es_variable_introuvable            __erreur_(2002)
1.36      bertrand  810: #  define d_es_pile_vide                       __erreur(2003)
                    811: #  define d_es_end_incoherent                  __erreur(2004)
                    812: #  define d_es_peripherique_stdin              __erreur(2005)
                    813: #  define d_es_erreur_fichier                  __erreur(2006)
                    814: #  define d_es_execution_bibliotheque          __erreur(2007)
                    815: #  define d_es_signal                          __erreur(2008)
                    816: #  define d_es_processus                       __erreur(2009)
                    817: #  define d_es_pile_operationnelle_vide        __erreur(2010)
                    818: #  define d_es_nombre_max_descripteurs         __erreur(2011)
                    819: #  define d_es_interruption_invalide           __erreur(2012)
                    820: #  define d_es_contexte                        __erreur(2013)
                    821: #  define d_es_somme_controle                  __erreur(2014)
1.60      bertrand  822: #  define d_es_semaphore                       __erreur(2015)
1.145     bertrand  823: #  define d_es_mutex_acquis_autre_thread       __erreur(2016)
1.1       bertrand  824: #endif
                    825: 
                    826: /*
                    827: --------------------------------------------------------------------------------
                    828:   Exceptions
                    829: --------------------------------------------------------------------------------
                    830: */
                    831: 
                    832: #ifndef RPLARGS
                    833: #  define d_ep                                 1000
1.36      bertrand  834: #  define d_ep_division_par_zero               __erreur(1001)
                    835: #  define d_ep_matrice_non_inversible          __erreur(1002)
                    836: #  define d_ep_resultat_indefini               __erreur(1003)
                    837: #  define d_ep_underflow                       __erreur(1004)
                    838: #  define d_ep_overflow                        __erreur(1005)
                    839: #  define d_ep_domaine_definition              __erreur(1006)
                    840: #  define d_ep_perte_precision                 __erreur(1007)
                    841: #  define d_ep_decomposition_QR                __erreur(1008)
                    842: #  define d_ep_matrice_non_definie_positive    __erreur(1009)
                    843: #  define d_ep_decomposition_QZ                __erreur(1010)
                    844: #  define d_ep_decomposition_SVD               __erreur(1011)
1.1       bertrand  845: #endif
                    846: 
                    847: /*
                    848: --------------------------------------------------------------------------------
                    849:   Erreurs de compilation
                    850: --------------------------------------------------------------------------------
                    851: */
                    852: 
                    853: #ifndef RPLARGS
                    854: #  define d_ec                                 3000
1.36      bertrand  855: #  define d_ec_niveau_definition_negatif       __erreur(3001)
                    856: #  define d_ec_nom_definition_invalide         __erreur(3002)
                    857: #  define d_ec_erreur_boucle_definie           __erreur(3003)
                    858: #  define d_ec_erreur_instruction_end          __erreur(3004)
                    859: #  define d_ec_erreur_instruction_until        __erreur(3005)
                    860: #  define d_ec_source_incoherent               __erreur(3006)
                    861: #  define d_ec_erreur_instruction_while        __erreur(3007)
                    862: #  define d_ec_erreur_instruction_then         __erreur(3008)
                    863: #  define d_ec_erreur_instruction_else         __erreur(3009)
                    864: #  define d_ec_erreur_instruction_elseif       __erreur(3010)
                    865: #  define d_ec_erreur_instruction_select       __erreur(3011)
                    866: #  define d_ec_erreur_instruction_case         __erreur(3012)
1.1       bertrand  867: #endif
                    868: 
                    869: /*
                    870: --------------------------------------------------------------------------------
1.177     bertrand  871:   Erreurs à l'exécution
1.1       bertrand  872: --------------------------------------------------------------------------------
                    873: */
                    874: 
1.177     bertrand  875: // -1 : erreur provoquée par une bibliothèque externe
1.1       bertrand  876: #ifndef RPLARGS
                    877: #  define d_ex                                 0
1.36      bertrand  878: #  define d_ex_pile_vide                       __erreur(1)
                    879: #  define d_ex_manque_argument                 __erreur(2)
                    880: #  define d_ex_argument_invalide               __erreur(3)
                    881: #  define d_ex_erreur_type_argument            __erreur(4)
                    882: #  define d_ex_nom_reserve                     __erreur(5)
                    883: #  define d_ex_nombre_arguments                __erreur(6)
                    884: #  define d_ex_dimensions_invalides            __erreur(7)
                    885: #  define d_ex_expression_invalide             __erreur(8)
                    886: #  define d_ex_absence_graphique_courant       __erreur(9)
                    887: #  define d_ex_erreur_traitement_condition     __erreur(10)
                    888: #  define d_ex_erreur_traitement_boucle        __erreur(11)
1.59      bertrand  889: #  define d_ex_variable_non_definie            __erreur_(12)
1.36      bertrand  890: #  define d_ex_drapeau_inexistant              __erreur(13)
                    891: #  define d_ex_nom_invalide                    __erreur(14)
                    892: #  define d_ex_element_inexistant              __erreur(15)
                    893: #  define d_ex_absence_variable                __erreur(16)
                    894: #  define d_ex_erreur_evaluation               __erreur(17)
                    895: #  define d_ex_semaphore                       __erreur(18)
                    896: #  define d_ex_longueur_fft                    __erreur(19)
                    897: #  define d_ex_queue_impression                __erreur(20)
                    898: #  define d_ex_type_trace_invalide             __erreur(21)
                    899: #  define d_ex_erreur_fichier                  __erreur(22)
                    900: #  define d_ex_absence_equation                __erreur(23)
                    901: #  define d_ex_erreur_bibliotheque             __erreur(24)
                    902: #  define d_ex_execution_bibliotheque          __erreur(25)
                    903: #  define d_ex_stop                            __erreur(26)
                    904: #  define d_ex_matrice_statistique_invalide    __erreur(27)
                    905: #  define d_ex_dimensions_matrice_statistique  __erreur(28)
                    906: #  define d_ex_absence_observations            __erreur(29)
                    907: #  define d_ex_statistiques_echantillon        __erreur(30)
                    908: #  define d_ex_observations_inexistantes       __erreur(31)
                    909: #  define d_ex_syntaxe                         __erreur(32)
                    910: #  define d_ex_cycle_hors_boucle               __erreur(33)
                    911: #  define d_ex_conversion_unite                __erreur(34)
                    912: #  define d_ex_erreur_parametre_fichier        __erreur(35)
                    913: #  define d_ex_erreur_acces_fichier            __erreur(36)
                    914: #  define d_ex_erreur_requete_fichier          __erreur(37)
                    915: #  define d_ex_erreur_format_fichier           __erreur(38)
                    916: #  define d_ex_fichier_verrouille              __erreur(39)
                    917: #  define d_ex_verrou_indefini                 __erreur(40)
                    918: #  define d_ex_fin_de_fichier_atteinte         __erreur(41)
                    919: #  define d_ex_debut_de_fichier_atteint        __erreur(42)
                    920: #  define d_ex_erreur_type_fichier             __erreur(43)
                    921: #  define d_ex_fichier_vide                    __erreur(44)
                    922: #  define d_ex_dimensions_differentes          __erreur(45)
                    923: #  define d_ex_routines_mathematiques          __erreur(46)
                    924: #  define d_ex_exit_hors_boucle                __erreur(47)
                    925: #  define d_ex_longueur_dft                    __erreur(48)
                    926: #  define d_ex_contexte                        __erreur(49)
                    927: #  define d_ex_processus                       __erreur(50)
                    928: #  define d_ex_image_processus                 __erreur(51)
                    929: #  define d_ex_erreur_sql                      __erreur(52)
                    930: #  define d_ex_variable_verrouillee            __erreur(53)
                    931: #  define d_ex_variable_volatile               __erreur(54)
                    932: #  define d_ex_erreur_processus                __erreur(55)
                    933: #  define d_ex_erreur_impression               __erreur(56)
                    934: #  define d_ex_nombre_arguments_fonction       __erreur(57)
                    935: #  define d_ex_fonction_indisponible           __erreur(58)
                    936: #  define d_ex_bibliotheque_chargee            __erreur(59)
                    937: #  define d_ex_aucun_symbole                   __erreur(60)
                    938: #  define d_ex_definition_ambigue              __erreur(61)
                    939: #  define d_ex_fichier_hors_contexte           __erreur(62)
                    940: #  define d_ex_socket_en_ecoute                __erreur(63)
                    941: #  define d_ex_interruption_invalide           __erreur(64)
                    942: #  define d_ex_erreur_transcodage              __erreur(65)
                    943: #  define d_ex_absence_processus_pere          __erreur(66)
                    944: #  define d_ex_creation_variable               __erreur(67)
                    945: #  define d_ex_fusible                         __erreur(68)
                    946: #  define d_ex_iswi_hors_interruption          __erreur(69)
                    947: #  define d_ex_daemon                          __erreur(70)
                    948: #  define d_ex_mutex                           __erreur(71)
                    949: #  define d_ex_variable_statique_partagee      __erreur(72)
                    950: #  define d_ex_variable_partagee               __erreur(73)
                    951: #  define d_ex_graphique_memorise              __erreur(74)
                    952: #  define d_ex_matrice_non_diagonale           __erreur(75)
                    953: #  define d_ex_locales                         __erreur(76)
                    954: #  define d_ex_representation                  __erreur(77)
                    955: #  define d_ex_erreur_profilage                __erreur(78)
                    956: #  define d_ex_enregistrement_inexistant       __erreur(79)
                    957: #  define d_ex_clef_inexistante                __erreur(80)
                    958: #  define d_ex_nom_implicite                   __erreur(81)
1.39      bertrand  959: #  define d_ex_version_bibliotheque            __erreur(82)
1.84      bertrand  960: #  define d_ex_creation_variable_globale       __erreur(83)
1.104     bertrand  961: #  define d_ex_erreur_interne_rplcas           __erreur(84)
1.138     bertrand  962: #  define d_ex_fichier_corrompu                __erreur(85)
1.145     bertrand  963: #  define d_ex_mutex_acquis_autre_thread       __erreur(86)
1.150     bertrand  964: #  define d_ex_expression_reguliere            __erreur(87)
1.160     bertrand  965: #  define d_ex_instruction_indisponible        __erreur(88)
1.193     bertrand  966: #  define d_ex_chiffrement                     __erreur(89)
                    967: #  define d_ex_chiffrement_indisponible        __erreur(90)
1.195     bertrand  968: #  define d_ex_longueur_clef_chiffrement       __erreur(91)
1.1       bertrand  969: #endif
                    970: 
                    971: 
                    972: /*
                    973: ================================================================================
                    974:   STRUCTURES
                    975: ================================================================================
                    976: */
                    977: 
                    978: /*
                    979: --------------------------------------------------------------------------------
                    980:   Structure objet
                    981: --------------------------------------------------------------------------------
                    982: */
                    983: 
1.55      bertrand  984: #ifdef MIN
                    985: #  undef MIN
                    986: #endif
                    987: 
                    988: #ifdef MAX
                    989: #  undef MAX
                    990: #endif
                    991: 
1.71      bertrand  992: #define ADR    __RPL_ADR
                    993: #define ALG    __RPL_ALG
1.55      bertrand  994: #define BIN    __RPL_BIN
                    995: #define CHN    __RPL_CHN
                    996: #define CPL    __RPL_CPL
                    997: #define FCH    __RPL_FCH
                    998: #define FCT    __RPL_FCT
                    999: #define INT    __RPL_INT
                   1000: #define LST    __RPL_LST
                   1001: #define MCX    __RPL_MCX
                   1002: #define MIN    __RPL_MIN
                   1003: #define MRL    __RPL_MRL
                   1004: #define MTX    __RPL_MTX
                   1005: #define NOM    __RPL_NOM
                   1006: #define NON    __RPL_NON
                   1007: #define PRC    __RPL_PRC
                   1008: #define REL    __RPL_REL
                   1009: #define RPN    __RPL_RPN
                   1010: #define SCK    __RPL_SCK
                   1011: #define SLB    __RPL_SLB
1.71      bertrand 1012: #define SPH    __RPL_SPH
1.55      bertrand 1013: #define SQL    __RPL_SQL
1.71      bertrand 1014: #define TBL    __RPL_TBL
1.55      bertrand 1015: #define VCX    __RPL_VCX
                   1016: #define VIN    __RPL_VIN
                   1017: #define VRL    __RPL_VRL
                   1018: 
1.102     bertrand 1019: enum t_rplcas_commandes        { RPLCAS_INTEGRATION = 0, RPLCAS_LIMITE };
1.55      bertrand 1020: 
1.1       bertrand 1021: enum t_type        { ADR = 0, ALG, BIN, CHN, CPL, FCH, FCT, INT, LST,
                   1022:                MCX, MIN, MRL, MTX, NOM, NON, PRC, REL, RPN, SCK,
                   1023:                SLB, SPH, SQL, TBL, VCX, VIN, VRL };
                   1024: 
                   1025:    /*
1.177     bertrand 1026:    ADR : adresse sur 32 bits (au moins) non signés (unsigned long)
                   1027:            Adresse d'une définition à interpréter.
1.1       bertrand 1028: 
1.177     bertrand 1029:    ALG : expression algébrique (struct_liste_chainee *)
                   1030:            La liste chaînée contient la définition convertie en notation
                   1031:            polonaise inversée. Ce type diffère du type 'RPN' au niveau
                   1032:            du format de sortie (notation algébrique).
1.1       bertrand 1033: 
                   1034:    BIN : entier binaire sur 64 bits (unsigned integer8 *)
                   1035:            Sans objet.
                   1036:            Type C/Fortran : unsigned integer8
                   1037: 
                   1038:    CHN : chaine de caracteres (character*(*), unsigned char *)
                   1039:            Sans objet.
                   1040: 
                   1041:    CPL : complexe sur 2*64 bits (complex*16, struct_complexe16 *)
                   1042:            Sans objet.
                   1043:            Type C/Fortran : complex16
                   1044: 
                   1045:    FCH : descripteur de fichier (struct_fichier *).
                   1046: 
1.177     bertrand 1047:    FCT : déclaration d'une fonction et de son nombre d'arguments
                   1048:            (struct_fonction *). Ce type n'est nécessaire que dans le
1.1       bertrand 1049:            traitement des types 'ALG' et 'RPN'.
                   1050: 
                   1051:    INT : entier sur 64 bits (integer*8, integer8 *)
                   1052:            Sans objet.
                   1053:            Type C/Fortran : integer8
                   1054: 
                   1055:    LST : liste (struct_liste_chainee *)
1.177     bertrand 1056:            Les objets sont enregistrés sous forme de liste chaînée récursive.
                   1057:            Cela permet de traiter des tableaux de données hétérogènes de
                   1058:            grandes dimensions. Le nombre de dimensions maximal est fixé par
                   1059:            la mémoire de la station.
1.1       bertrand 1060: 
                   1061:    MCX : matrice de complexes (struct_matrice *)
                   1062:            Sans objet.
                   1063: 
                   1064:    MIN : matrice d'entiers (struct_matrice *)
                   1065:            Sans objet.
                   1066: 
                   1067:    MRL : matrice de reels (struct_matrice *)
                   1068:            Sans objet.
                   1069: 
                   1070:    MTX : mutex (struct_mutex *)
                   1071:            Sans objet.
                   1072: 
                   1073:    NOM : nom de variable (struct_nom *)
                   1074:            Sans objet.
                   1075: 
                   1076:    PRC : processus (struct_processus_fils *)
                   1077:            Sans objet.
                   1078: 
                   1079:    REL : reel sur 64 bits (real*8, real8 *)
                   1080:            Sans objet.
                   1081: 
                   1082:    RPN : definition (struct_liste_chainee *)
1.177     bertrand 1083:            Ce type diffère du type 'ALG' au niveau du format de sortie
                   1084:            (notation polonaise inversée).
1.1       bertrand 1085: 
                   1086:    SCK : socket (struct_socket *)
                   1087: 
1.177     bertrand 1088:    SLB : bibliothèque dynamique partagée (struct_bibliotheque *) 
1.1       bertrand 1089:            Sans objet.
                   1090: 
1.177     bertrand 1091:    SPH : sémaphore nommé (struct_semaphore *)
1.1       bertrand 1092: 
1.177     bertrand 1093:    SQL : connecteur sur une base de données SQL (struct_connecteur_sql *)
1.1       bertrand 1094: 
                   1095:    TBL : tableau multidimensionnel d'objets (struct_tableau *).
                   1096: 
                   1097:    VCX : vecteur de complexes (struct_vecteur *)
                   1098:            Sans objet.
                   1099: 
                   1100:    VIN : vecteur d'entiers (struct_vecteur *)
                   1101:            Sans objet.
                   1102: 
                   1103:    VRL : vecteur de reels (struct_vecteur *)
                   1104:            Sans objet.
                   1105:    */
                   1106: 
                   1107: typedef struct objet
                   1108: {
                   1109:    enum t_type         type;
                   1110: 
                   1111:    volatile long       nombre_occurrences;
                   1112: 
                   1113:    pthread_mutex_t     mutex;
                   1114: 
                   1115:    void                *objet;
                   1116: } struct_objet;
                   1117: 
                   1118: 
                   1119: /*
                   1120: --------------------------------------------------------------------------------
                   1121:   Structure fichier
                   1122: --------------------------------------------------------------------------------
                   1123: */
                   1124: 
                   1125: #ifndef RPLARGS
                   1126: typedef struct fichier
                   1127: {
                   1128:    unsigned long               descripteur;
                   1129: 
                   1130:    unsigned char               acces;          /* S/D/I */
                   1131:    unsigned char               binaire;        /* Y/N/F */
                   1132:    unsigned char               ouverture;
                   1133:    unsigned char               protection;
                   1134:    unsigned char               *nom;
                   1135: 
                   1136:    struct_objet                *format;
                   1137: 
                   1138:    pid_t                       pid;
                   1139:    pthread_t                   tid;
                   1140: 
                   1141:    integer8                    position_clef;
                   1142: } struct_fichier;
                   1143: #endif
                   1144: 
                   1145: 
                   1146: /*
                   1147: --------------------------------------------------------------------------------
                   1148:   Structure mutex
                   1149: --------------------------------------------------------------------------------
                   1150: */
                   1151: 
                   1152: #ifndef RPLARGS
                   1153: typedef struct rpl_mutex
                   1154: {
                   1155:    pthread_mutex_t     mutex;
1.144     bertrand 1156:    pthread_t           tid;
1.1       bertrand 1157: } struct_mutex;
                   1158: #endif
                   1159: 
                   1160: 
                   1161: /*
                   1162: --------------------------------------------------------------------------------
1.177     bertrand 1163:   Structure sémaphore
1.1       bertrand 1164: --------------------------------------------------------------------------------
                   1165: */
                   1166: 
                   1167: #ifndef RPLARGS
                   1168: typedef struct semaphore
                   1169: {
                   1170:    unsigned char   *nom;
                   1171:    sem_t           *semaphore;
                   1172: } struct_semaphore;
                   1173: #endif
                   1174: 
                   1175: 
                   1176: /*
                   1177: --------------------------------------------------------------------------------
                   1178:   Structure marque
                   1179: --------------------------------------------------------------------------------
                   1180: */
                   1181: 
                   1182: #ifndef RPLARGS
                   1183: typedef struct marque
                   1184: {
                   1185:    unsigned char       *label;
                   1186:    unsigned char       *position;
                   1187: 
                   1188:    struct marque       *suivant;
                   1189: } struct_marque;
                   1190: #endif
                   1191: 
                   1192: 
                   1193: /*
                   1194: --------------------------------------------------------------------------------
1.177     bertrand 1195:   Structure bibliothèque
1.1       bertrand 1196: --------------------------------------------------------------------------------
                   1197: */
                   1198: 
                   1199: #ifndef RPLARGS
                   1200: typedef struct bibliotheque
                   1201: {
                   1202:    void                        *descripteur;
                   1203: 
                   1204:    pid_t                       pid;
                   1205:    pthread_t                   tid;
                   1206: 
                   1207:    unsigned char               *nom;
                   1208: } struct_bibliotheque;
                   1209: #endif
                   1210: 
                   1211: 
                   1212: /*
                   1213: --------------------------------------------------------------------------------
                   1214:   Structure descripteur fichier
                   1215: --------------------------------------------------------------------------------
                   1216: */
                   1217: 
                   1218: #ifndef RPLARGS
                   1219: typedef struct descripteur_fichier
                   1220: {
                   1221:    unsigned long               identifiant;
                   1222: 
                   1223:    unsigned char               effacement;
1.15      bertrand 1224:    unsigned char               type; // C (file *) ou S (sqlite *)
1.1       bertrand 1225:    unsigned char               *nom;
                   1226: 
                   1227:    pid_t                       pid;
                   1228:    pthread_t                   tid;
                   1229: 
1.159     bertrand 1230:    union
                   1231:    {
                   1232:        file                    *descripteur_c;
                   1233:        sqlite3                 *descripteur_sqlite;
                   1234:    };
1.1       bertrand 1235: } struct_descripteur_fichier;
                   1236: #endif
                   1237: 
                   1238: 
                   1239: /*
                   1240: --------------------------------------------------------------------------------
                   1241:   Structure connecteur SQL
                   1242: --------------------------------------------------------------------------------
                   1243: */
                   1244: 
                   1245: #ifndef RPLARGS
                   1246: typedef struct connecteur_sql
                   1247: {
                   1248:    pid_t                       pid;
                   1249:    pthread_t                   tid;
                   1250: 
                   1251:    /*
                   1252:     * "MYSQL"
                   1253:     * "POSTGRESQL"
                   1254:     */
                   1255: 
                   1256:    unsigned char               *type;
                   1257:    unsigned char               *locale;
                   1258: 
                   1259:    union
                   1260:    {
                   1261: #      ifdef MYSQL_SUPPORT
                   1262:            MYSQL               *mysql;
                   1263: #      endif
                   1264: #      ifdef POSTGRESQL_SUPPORT
                   1265:            PGconn              *postgresql;
                   1266: #      endif
1.191     bertrand 1267:        sqlite3                 *sqlite;
1.1       bertrand 1268:    } descripteur;
                   1269: } struct_connecteur_sql;
                   1270: #endif
                   1271: 
                   1272: #define sqlclose(s_objet) \
                   1273:    if (strcmp((*((struct_connecteur_sql *) (*s_objet).objet)).type, "MYSQL") \
                   1274:            == 0) \
                   1275:        mysqlclose((*((struct_connecteur_sql *) (*s_objet).objet)) \
                   1276:                .descripteur); \
                   1277:    else if (strcmp((*((struct_connecteur_sql *) (*s_objet).objet)).type, \
                   1278:            "POSTGRESQL") == 0) \
                   1279:        postgresqlclose((*((struct_connecteur_sql *) (*s_objet).objet)) \
                   1280:                .descripteur); \
1.191     bertrand 1281:    else if (strcmp((*((struct_connecteur_sql *) (*s_objet).objet)).type, \
                   1282:            "SQLITE") == 0) \
                   1283:        sqlite3_close((*((struct_connecteur_sql *) (*s_objet).objet)) \
                   1284:                .descripteur.sqlite); \
1.1       bertrand 1285:    else \
                   1286:        BUG(1, uprintf("SQL type '%s' not allowed!", \
                   1287:                (*((struct_connecteur_sql *) (*s_objet).objet)).type));
                   1288: 
                   1289: /*
                   1290: --------------------------------------------------------------------------------
                   1291:   Structure socket
                   1292: --------------------------------------------------------------------------------
                   1293: */
                   1294: 
                   1295: #ifndef RPLARGS
                   1296: typedef struct socket
                   1297: {
                   1298:    int                         domaine;
                   1299:    int                         socket;
                   1300: 
                   1301:    pid_t                       pid;
                   1302:    pthread_t                   tid;
                   1303: 
                   1304:    unsigned char               *adresse;
                   1305:    unsigned char               *adresse_distante;
                   1306:    unsigned char               binaire;
                   1307:    unsigned char               socket_en_ecoute;
                   1308:    logical1                    socket_connectee;
                   1309:    unsigned char               effacement;
                   1310:    unsigned char               localisation;
                   1311:    unsigned char               protection;
                   1312:    unsigned char               type[19 + 1];
                   1313: 
                   1314:    struct_objet                *format;
                   1315: } struct_socket;
                   1316: #endif
                   1317: 
                   1318: /*
                   1319: --------------------------------------------------------------------------------
1.177     bertrand 1320:   Structure liste chaînee
1.1       bertrand 1321: --------------------------------------------------------------------------------
                   1322: */
                   1323: 
                   1324: typedef struct liste_chainee
                   1325: {
                   1326:    struct liste_chainee        *suivant;
                   1327: 
                   1328:    struct_objet                *donnee;
                   1329: } struct_liste_chainee; 
                   1330: 
                   1331: 
                   1332: /*
                   1333: --------------------------------------------------------------------------------
1.166     bertrand 1334:   Structure de gestion des signaux en provenance de rplsignal
                   1335: --------------------------------------------------------------------------------
                   1336: */
                   1337: 
                   1338: #define d_NOMBRE_SIGNAUX               64
                   1339: 
                   1340: typedef struct gestion_signaux
                   1341: {
                   1342:    unsigned char               masque_signaux[d_NOMBRE_SIGNAUX];
                   1343: 
                   1344:    /*
1.177     bertrand 1345:     * 'I' : signal ignoré
                   1346:     * 'Q' : signal mis en queue pour un traitement ultérieur
1.166     bertrand 1347:     * 'N' : traitement normal du signal
                   1348:     */
                   1349: 
                   1350:    integer8                    queue_signaux[d_NOMBRE_SIGNAUX];
                   1351:    integer8                    nombre_signaux_en_queue;
                   1352:    struct_objet                *corps_signaux[d_NOMBRE_SIGNAUX];
                   1353: 
                   1354:    pthread_mutex_t             mutex;
                   1355: } struct_gestion_signaux;
                   1356: 
                   1357: #ifndef MAIN_RPL
                   1358: #  define __STATIC_GESTION_SIGNAUX__
                   1359: #else
                   1360: #  define __STATIC_GESTION_SIGNAUX__ = { .mutex = PTHREAD_MUTEX_INITIALIZER }
                   1361: #endif
                   1362: 
                   1363: __EXTERN__ volatile struct_gestion_signaux signaux_externes
                   1364:        __STATIC_GESTION_SIGNAUX__;
                   1365: 
                   1366: 
                   1367: /*
                   1368: --------------------------------------------------------------------------------
1.1       bertrand 1369:   Structure liste profilage
                   1370: --------------------------------------------------------------------------------
                   1371: */
                   1372: 
                   1373: typedef struct liste_profilage
                   1374: {
                   1375:    struct liste_profilage      *suivant;
                   1376: 
                   1377:    unsigned char               *fonction;
                   1378: 
                   1379:    struct timeval              dernier_appel;
                   1380:    struct timeval              cumul;
                   1381: 
                   1382:    integer8                    nombre_appels;
                   1383: } struct_liste_profilage; 
                   1384: 
                   1385: typedef struct liste_profilage2
                   1386: {
                   1387:    struct liste_profilage2     *suivant;
                   1388: 
                   1389:    unsigned char               *fonction;
                   1390: } struct_liste_profilage2; 
                   1391: 
                   1392: /*
                   1393: --------------------------------------------------------------------------------
1.177     bertrand 1394:   Structure contenant les fichiers graphiques (liste chaînée)
1.1       bertrand 1395: --------------------------------------------------------------------------------
                   1396: */
                   1397: 
                   1398: #ifndef RPLARLS
                   1399: typedef struct fichier_graphique
                   1400: {
                   1401:    struct fichier_graphique    *suivant;
                   1402: 
                   1403:    logical1                    presence_axes;
                   1404: 
                   1405:    unsigned char               *nom;
                   1406:    unsigned char               type[21];
                   1407: 
                   1408:    unsigned char               *legende;
                   1409: 
                   1410:    int                         dimensions;
                   1411: 
                   1412:    integer8                    systeme_axes;
                   1413: } struct_fichier_graphique;
                   1414: #endif
                   1415: 
                   1416: /*
                   1417: --------------------------------------------------------------------------------
                   1418:   Structure nom
                   1419: --------------------------------------------------------------------------------
                   1420: */
                   1421: 
                   1422: typedef struct nom
                   1423: {
                   1424:    unsigned char               *nom;
                   1425:    logical1                    symbole;    /* d_vrai/d_faux */
1.177     bertrand 1426:    // symbole == d_vrai signifie que le nom a été introduit dans un
1.1       bertrand 1427:    // calcul sans les apostrophes.
                   1428: } struct_nom;
                   1429: 
                   1430: 
                   1431: /*
                   1432: --------------------------------------------------------------------------------
                   1433:   Structure processus fils
                   1434: --------------------------------------------------------------------------------
                   1435: */
                   1436: 
                   1437: #ifndef RPLARGS
                   1438: typedef struct descripteur_thread
                   1439: {
                   1440:    struct processus            *s_etat_processus;
                   1441:    struct processus            *s_nouvel_etat_processus;
                   1442: 
                   1443:    struct_objet                *argument;
                   1444: 
1.13      bertrand 1445:    pid_t                       pid;
                   1446:    volatile pthread_t          tid;
1.1       bertrand 1447: 
                   1448:    pthread_t                   thread_pere;
                   1449: 
                   1450:    pthread_mutex_t             mutex;
1.70      bertrand 1451:    pthread_mutex_t             mutex_nombre_references;
1.43      bertrand 1452: 
1.1       bertrand 1453:    volatile logical1           thread_actif;
                   1454: 
                   1455:    int                         pipe_erreurs[2];
                   1456:    int                         pipe_objets[2];
                   1457:    int                         pipe_injections[2];
                   1458:    int                         pipe_nombre_injections[2];
                   1459:    int                         pipe_interruptions[2];
                   1460:    int                         pipe_nombre_objets_attente[2];
                   1461:    int                         pipe_nombre_interruptions_attente[2];
                   1462:    int                         pipe_acquittement[2];
                   1463: 
                   1464:    volatile integer8           nombre_objets_dans_pipe;
                   1465:    volatile integer8           nombre_interruptions_dans_pipe;
                   1466: 
                   1467:    logical1                    processus_detache;
                   1468:    logical1                    destruction_objet;
                   1469: 
                   1470:    volatile signed long        nombre_references;
                   1471: } struct_descripteur_thread;
                   1472: 
                   1473: typedef struct processus_fils
                   1474: {
                   1475:    struct_descripteur_thread       *thread;
                   1476: } struct_processus_fils;
                   1477: #endif
                   1478: 
                   1479: 
                   1480: /*
                   1481: --------------------------------------------------------------------------------
                   1482:   Structure liste pile systeme
                   1483: --------------------------------------------------------------------------------
                   1484: */
                   1485: 
                   1486: #ifndef RPLARGS
                   1487: typedef struct liste_pile_systeme
                   1488: {
                   1489:    struct liste_pile_systeme   *suivant;
                   1490: 
                   1491:    struct_liste_chainee        *pointeur_objet_retour;
                   1492: 
                   1493:    struct_objet                *indice_boucle;
                   1494:    struct_objet                *limite_indice_boucle;
                   1495:    struct_objet                *objet_de_test;
                   1496: 
                   1497:    logical1                    arret_si_exception;
                   1498:    logical1                    creation_variables_statiques;
                   1499:    logical1                    creation_variables_partagees;
                   1500:    logical1                    evaluation_expression;
                   1501: 
                   1502:    unsigned char               clause;
                   1503: 
                   1504:    /*
                   1505:    clause :
                   1506:    I : IF
                   1507:    R : IFERR
1.177     bertrand 1508:    X : IFERR indiquant la présence d'une erreur.
1.1       bertrand 1509:    T : THEN
                   1510:    E : ELSE
                   1511:    Z : traitement en cours de ELSE
                   1512:    D : DO
                   1513:    U : UNTIL
                   1514:    W : WHILE
                   1515:    M : WHILE avec une clause fausse.
                   1516:    S : SELECT
1.177     bertrand 1517:    K : aucun cas CASE n'a encore été traité.
                   1518:    C : au moins un cas de SELECT...CASE a été traité.
1.1       bertrand 1519:    Q : traitement en cours d'un cas CASE.
                   1520:    F : traitement du cas DEFAULT
                   1521:    */
                   1522: 
                   1523:    unsigned char               retour_definition;
                   1524:    unsigned char               *nom_variable;
                   1525:    unsigned char               origine_routine_evaluation;
                   1526:    unsigned char               type_cloture;
                   1527: 
                   1528:    /*
1.177     bertrand 1529:    type clôture :
1.175     bertrand 1530:    C     SELECT   : END termine un test SELECT/DEFAULT/END.
                   1531:    D     DO       : END termine une boucle DO/UNTIL/END.
                   1532:    I     IF       : END termine un test IF/THEN (ELSE)/END.
                   1533:    J     IFERR    : END termine un test IFERR/THEN (ELSE)/END.
                   1534:    K     CASE     : END termine un test CASE/THEN/END
                   1535:    W     WHILE    : END termine une boucle WHILE/REPEAT/END.
                   1536:    Q     CRITICAL : END termine une section critique CRITICAL/END
1.47      bertrand 1537: 
                   1538:    F     FOR     : NEXT ou STEP termine une boucle avec compteur.
                   1539:    S     START   : NEXT ou STEP termine une boucle sans compteur.
1.177     bertrand 1540:    L     LOOP    : boucle utilisé dans le traitement de l'instruction RETURN.
                   1541:            Elle correspond à une boucle FOR ou START mais sans son
1.1       bertrand 1542:            initialisation.
1.176     bertrand 1543:    A     FORALL  : NEXT termine une boucle sur un objet.
1.1       bertrand 1544:    */
                   1545: 
                   1546:    unsigned long               adresse_retour;
                   1547:    unsigned long               niveau_courant;
1.48      bertrand 1548:    struct_objet                *pointeur_adresse_retour;
1.1       bertrand 1549: } struct_liste_pile_systeme;
                   1550: #endif
                   1551: 
                   1552: 
                   1553: /*
                   1554: --------------------------------------------------------------------------------
                   1555:   Structure variable
                   1556: --------------------------------------------------------------------------------
                   1557: */
                   1558: 
                   1559: #ifndef RPLARGS
                   1560: typedef union position_variable
                   1561: {
                   1562:    unsigned long       adresse;
                   1563:    struct_objet        *pointeur;
                   1564: } union_position_variable;
                   1565: 
                   1566: typedef struct variable
                   1567: {
                   1568:    unsigned char           *nom;
1.178     bertrand 1569:    unsigned char           origine; // P(rogramme) ou E(valuation)
1.1       bertrand 1570: 
                   1571:    unsigned long           niveau;
                   1572: 
                   1573:    union_position_variable variable_statique;
                   1574:    union_position_variable variable_partagee;
                   1575: 
                   1576:    struct_objet            *objet;
                   1577: 
                   1578:    logical1                variable_verrouillee;
                   1579: } struct_variable;
                   1580: 
                   1581: #endif
                   1582: 
                   1583: /*
                   1584: --------------------------------------------------------------------------------
1.177     bertrand 1585:   Structure variable partagée
1.1       bertrand 1586: --------------------------------------------------------------------------------
                   1587: */
                   1588: 
                   1589: #ifndef RPLARGS
                   1590: 
                   1591: typedef struct variable_partage
                   1592: {
                   1593:    unsigned char               *nom;
                   1594:    unsigned char               origine;
                   1595: 
                   1596:    unsigned long               niveau;
                   1597: 
                   1598:    union_position_variable     variable_partagee;
                   1599: 
                   1600:    struct_objet                *objet;
1.185     bertrand 1601: 
                   1602:    pthread_mutex_t             mutex;
1.1       bertrand 1603: } struct_variable_partagee;
                   1604: 
                   1605: #endif
                   1606: 
                   1607: 
                   1608: /*
                   1609: --------------------------------------------------------------------------------
                   1610:   Structure variable statique
                   1611: --------------------------------------------------------------------------------
                   1612: */
                   1613: 
                   1614: #ifndef RPLARGS
                   1615: typedef struct variable_statique
                   1616: {
                   1617:    unsigned char           *nom;
                   1618:    unsigned char           origine;
                   1619: 
1.177     bertrand 1620:    // Position de création de la variable statique dans le programme ou dans
1.1       bertrand 1621:    // l'expression. 'origine' vaut 'P' pour programme ou 'E' pour expression.
                   1622: 
                   1623:    unsigned long           niveau;
                   1624: 
                   1625:    union_position_variable variable_statique;
                   1626: 
                   1627:    struct_objet            *objet;
                   1628: } struct_variable_statique;
                   1629: #endif
                   1630: 
                   1631: 
                   1632: /*
                   1633: --------------------------------------------------------------------------------
                   1634:   Structure vecteur
                   1635: --------------------------------------------------------------------------------
                   1636: */
                   1637: 
                   1638: typedef struct vecteur
                   1639: {
                   1640:    unsigned long       taille;
                   1641: 
                   1642:    unsigned char       type; /* C (complex*16), R (real*8), I (integer*8) */
                   1643: 
                   1644:    void                *tableau;
                   1645: } struct_vecteur;
                   1646: 
                   1647: 
                   1648: /*
                   1649: --------------------------------------------------------------------------------
                   1650:   Structure matrice
                   1651: --------------------------------------------------------------------------------
                   1652: */
                   1653: 
                   1654: typedef struct matrice
                   1655: {
                   1656:    unsigned long       nombre_lignes;
                   1657:    unsigned long       nombre_colonnes;
                   1658: 
                   1659:    unsigned char       type; /* C (complex*16), R (real*8), I (integer*8) */
                   1660: 
                   1661:    void                **tableau;
                   1662: } struct_matrice;
                   1663: 
                   1664: 
                   1665: /*
                   1666: --------------------------------------------------------------------------------
                   1667:   Structure tableau
                   1668: --------------------------------------------------------------------------------
                   1669: */
                   1670: 
                   1671: typedef struct tableau
                   1672: {
                   1673:    unsigned long       nombre_elements;
                   1674: 
                   1675:    struct_objet        **elements;
                   1676: } struct_tableau;
                   1677: 
                   1678: 
                   1679: /*
                   1680: --------------------------------------------------------------------------------
                   1681:   Structure arbre
                   1682: --------------------------------------------------------------------------------
                   1683: */
                   1684: 
                   1685: typedef struct arbre
                   1686: {
                   1687:    struct_objet        *objet;
                   1688: 
                   1689:    unsigned long       nombre_feuilles;
                   1690:    struct arbre        **feuilles;
                   1691: } struct_arbre;
                   1692: 
                   1693: 
                   1694: /*
                   1695: --------------------------------------------------------------------------------
                   1696:   Structures de gestion des instructions externes
                   1697: --------------------------------------------------------------------------------
                   1698: */
                   1699: 
                   1700: typedef struct instruction_externe
                   1701: {
                   1702:    unsigned char       *nom;
                   1703:    unsigned char       *nom_bibliotheque;
                   1704:    void                *descripteur_bibliotheque;
                   1705: } struct_instruction_externe;
                   1706: 
                   1707: 
                   1708: /*
                   1709: --------------------------------------------------------------------------------
                   1710:   Structure argument (pour les fonctions dynamiques)
                   1711: --------------------------------------------------------------------------------
                   1712: */
                   1713: 
                   1714: typedef struct rpl_arguments
                   1715: {
                   1716: /* Piles operationnelles                               */
                   1717: 
                   1718:    struct_liste_chainee        *l_base_pile;
                   1719:    struct_liste_chainee        *l_base_pile_last;
                   1720: 
                   1721: /* Etat du calculateur                                 */
                   1722: 
                   1723:    t_8_bits                    drapeaux_etat[8];
                   1724: 
                   1725: /* Traitement des erreurs                              */
                   1726: 
                   1727:    unsigned char               *message_erreur;
1.177     bertrand 1728:    unsigned char               type_erreur;            /* S = système
                   1729:                                                           E = exécution */
1.1       bertrand 1730:    integer8                    erreur;
                   1731: 
                   1732: /* Traitement des messages d'aide                      */
                   1733: 
                   1734:    logical1                    aide;                   /* Affichage d'un
                   1735:                                                           message d'aide
                   1736:                                                           par la routine */
                   1737: 
                   1738: /* Nombre d'arguments                                  */
                   1739: 
                   1740:    unsigned char               affichage_arguments;
                   1741:    unsigned char               constante_symbolique;
                   1742:    unsigned char               instruction_valide;
                   1743:    unsigned char               test_instruction;
                   1744: 
                   1745:    integer8                    nombre_arguments;
                   1746:    // Nombre d'arguments de la fonction, positif ou nul.
                   1747: 
                   1748:    void                        *s_etat_processus;
                   1749: } struct_rpl_arguments;
                   1750: 
1.79      bertrand 1751: /*
                   1752: --------------------------------------------------------------------------------
1.177     bertrand 1753:   Structure d'arbre des instructions intrinsèques
1.79      bertrand 1754: --------------------------------------------------------------------------------
                   1755: */
                   1756: 
                   1757: #ifndef RPLARGS
                   1758: typedef struct instruction
                   1759: {
1.88      bertrand 1760:    struct instruction      **noeuds;
1.79      bertrand 1761:    void                    (*feuille)(struct processus *);
                   1762: } struct_instruction;
                   1763: #endif
                   1764: 
                   1765: /*
                   1766: --------------------------------------------------------------------------------
1.178     bertrand 1767:   Structure d'arbre des variables globales et locales
1.79      bertrand 1768: --------------------------------------------------------------------------------
                   1769: */
                   1770: 
                   1771: #ifndef RPLARGS
                   1772: typedef struct arbre_variables
                   1773: {
1.179     bertrand 1774:    unsigned int                        noeuds_utilises;
                   1775:                                        // Nombre de noeuds utilisés dans le
                   1776:                                        // tableau **noeuds
                   1777:    signed int                          indice_tableau_pere;
                   1778:                                        // Position de la structure dans le
                   1779:                                        // tableau **noeuds du père
                   1780: 
                   1781:    struct arbre_variables              *noeud_pere;
                   1782:    struct arbre_variables              **noeuds;
                   1783: 
                   1784:    struct liste_variables              *feuille;
                   1785:    struct liste_variables_statiques    *feuille_statique;
1.187     bertrand 1786: } struct_arbre_variables;
                   1787: 
                   1788: typedef struct arbre_variables_partagees
                   1789: {
                   1790:    unsigned int                        noeuds_utilises;
                   1791:                                        // Nombre de noeuds utilisés dans le
                   1792:                                        // tableau **noeuds
                   1793:    signed int                          indice_tableau_pere;
                   1794:                                        // Position de la structure dans le
                   1795:                                        // tableau **noeuds du père
                   1796: 
                   1797:    struct arbre_variables_partagees    *noeud_pere;
                   1798:    struct arbre_variables_partagees    **noeuds;
                   1799: 
                   1800:    struct liste_variables_partagees    *feuille;
1.185     bertrand 1801: 
1.187     bertrand 1802:    pthread_mutex_t                     mutex_feuille;
                   1803: } struct_arbre_variables_partagees;
1.82      bertrand 1804: 
1.185     bertrand 1805: #define INITIALISATION_MUTEX(mutex) \
                   1806:    do { \
                   1807:        pthread_mutexattr_t     attributs_mutex; \
                   1808:        pthread_mutexattr_init(&attributs_mutex); \
                   1809:        pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_NORMAL); \
                   1810:        pthread_mutex_init(&(mutex), &attributs_mutex); \
                   1811:        pthread_mutexattr_destroy(&attributs_mutex); \
                   1812:    } while(0)
                   1813: 
1.91      bertrand 1814: typedef struct tableau_variables
                   1815: {
                   1816:    unsigned char           origine;
                   1817:    unsigned char           *nom;       // pointeur sur la struct_variable
1.177     bertrand 1818:                                        // réelle et non copie de la chaîne
1.91      bertrand 1819:    unsigned long           niveau;
                   1820: 
                   1821:    struct_objet            *objet;     // pointeur sur l'objet et non copie
                   1822:                                        // de l'objet.
                   1823: 
                   1824:    logical1                variable_verrouillee;
1.181     bertrand 1825:    logical1                variable_masquee;
1.91      bertrand 1826:    union_position_variable variable_statique;
                   1827:    union_position_variable variable_partagee;
                   1828: } struct_tableau_variables;
                   1829: 
1.180     bertrand 1830: // La liste des variables est une liste doublement chaînée et circulaire.
1.82      bertrand 1831: typedef struct liste_variables
                   1832: {
1.83      bertrand 1833:    union
                   1834:    {
1.86      bertrand 1835:        // Utilisation dans la gestion des variables
1.83      bertrand 1836:        struct_variable                 *variable;
1.177     bertrand 1837:        // Utilisation dans la pile système (variables par niveau)
1.83      bertrand 1838:        struct_liste_chainee            *liste;
                   1839:    };
                   1840: 
1.86      bertrand 1841:    struct arbre_variables              *noeud_pere;
1.90      bertrand 1842:    struct arbre_variables              *noeud;
1.82      bertrand 1843:    struct liste_variables              *suivant;
                   1844:    struct liste_variables              *precedent;
1.83      bertrand 1845: } struct_liste_variables;
1.82      bertrand 1846: 
1.180     bertrand 1847: // La liste des variables statiques et une liste double chaînée et non
                   1848: // circulaire.
1.179     bertrand 1849: typedef struct liste_variables_statiques
                   1850: {
                   1851:    struct liste_variables_statiques    *suivant;
1.180     bertrand 1852:    struct liste_variables_statiques    *precedent;
                   1853:    struct liste_variables_statiques    *reference;
1.182     bertrand 1854:    struct_arbre_variables              *feuille;
1.179     bertrand 1855:    struct_variable_statique            *variable;
                   1856: } struct_liste_variables_statiques;
1.185     bertrand 1857: 
                   1858: typedef struct liste_variables_partagees
                   1859: {
                   1860:    struct liste_variables_partagees    *suivant;
                   1861:    struct liste_variables_partagees    *precedent;
                   1862:    struct liste_variables_partagees    *reference;
1.187     bertrand 1863:    struct_arbre_variables_partagees    *feuille;
1.185     bertrand 1864:    struct_variable_partagee            *variable;
1.187     bertrand 1865:    pthread_t                           tid;
                   1866:    pid_t                               pid;
1.185     bertrand 1867: } struct_liste_variables_partagees;
1.79      bertrand 1868: #endif
1.1       bertrand 1869: 
                   1870: /*
                   1871: --------------------------------------------------------------------------------
                   1872:   Structure processus
                   1873: --------------------------------------------------------------------------------
                   1874: */
                   1875: 
                   1876: #ifndef RPLARGS
                   1877: typedef struct processus
                   1878: {
                   1879: /* Pointeurs sur le programme                          */
                   1880: 
                   1881:    unsigned char               *definitions_chainees;
                   1882:    struct_liste_chainee        *expression_courante;
                   1883: 
                   1884:    unsigned char               *instruction_courante;
                   1885:    struct_objet                *objet_courant;
                   1886:    unsigned char               evaluation_expression_compilee;     /*Y/N*/
                   1887: 
                   1888:    unsigned char               *nom_fichier_source;
                   1889:    unsigned char               *nom_fichier_historique;
                   1890: 
1.7       bertrand 1891:    unsigned char               autorisation_conversion_chaine;     /*Y/N*/
1.1       bertrand 1892:    unsigned char               autorisation_empilement_programme;  /*Y/N*/
                   1893:    unsigned char               autorisation_evaluation_nom;        /*Y/N*/
1.20      bertrand 1894:    unsigned char               autorisation_nom_implicite;         /*Y/N*/
1.5       bertrand 1895:    unsigned char               evaluation_forcee;                  /*Y/N*/
1.1       bertrand 1896:    unsigned char               instruction_valide;                 /*Y/N*/
                   1897:    unsigned char               instruction_intrinseque;            /*Y/I/N*/
                   1898:    unsigned char               test_instruction;                   /*Y/N*/
                   1899:    unsigned char               affichage_arguments;                /*Y/N*/
                   1900:    unsigned char               constante_symbolique;               /*Y/N*/
                   1901:    unsigned char               traitement_symbolique;              /*Y/N*/
                   1902:    unsigned char               mode_execution_programme;           /*Y/I/N*/
                   1903:    unsigned char               mode_interactif;                    /*Y/N*/
                   1904:    unsigned char               mode_evaluation_expression;         /*Y/N*/
                   1905:    unsigned char               traitement_cycle_exit;              /*N/E/C*/
1.73      bertrand 1906:    unsigned char               recherche_type;                     /*Y/N*/
1.1       bertrand 1907: 
                   1908:    unsigned long               position_courante;
                   1909:    unsigned long               longueur_definitions_chainees;
                   1910: 
                   1911: /* Pointeurs sur les instructions                      */
                   1912: 
                   1913:    int                         *pointeurs_caracteres;
                   1914:    int                         nombre_caracteres;
1.79      bertrand 1915:    struct_instruction          *arbre_instructions;
1.1       bertrand 1916: 
                   1917: /* Requetes                                                */
                   1918: 
                   1919:    unsigned char               requete_arret;                      /*Y/N*/
                   1920: 
                   1921: /* Piles operationnelles                               */
                   1922: 
                   1923:    struct_liste_chainee        *l_base_pile;
                   1924:    struct_liste_chainee        *l_base_pile_last;
                   1925: 
                   1926:    unsigned long               hauteur_pile_operationnelle;
                   1927: 
                   1928: /* Piles systemes                                      */
                   1929: 
                   1930:    struct_liste_pile_systeme   *l_base_pile_systeme;
                   1931: 
                   1932:    unsigned long               hauteur_pile_systeme;
                   1933: 
                   1934: /* Gestion des processus                                */
                   1935: 
                   1936:    volatile
                   1937:    struct_liste_chainee        *l_base_pile_processus;
                   1938: 
                   1939:    logical1                    presence_pipes;
                   1940: 
                   1941:    int                         pipe_acquittement;
                   1942:    int                         pipe_donnees;
                   1943:    int                         pipe_injections;
                   1944:    int                         pipe_nombre_injections;
                   1945:    int                         pipe_interruptions;
                   1946:    int                         pipe_nombre_objets_attente;
                   1947:    int                         pipe_nombre_interruptions_attente;
                   1948:    int                         nombre_objets_envoyes_non_lus;
                   1949:    int                         nombre_objets_injectes;
                   1950: 
                   1951:    real8                       pourcentage_maximal_cpu;
                   1952:    real8                       temps_maximal_cpu;
                   1953: 
                   1954:    logical1                    presence_fusible;
                   1955:    pthread_t                   thread_fusible;
                   1956:    pthread_t                   thread_surveille_par_fusible;
1.184     bertrand 1957:    pthread_t                   thread_signaux;
                   1958:    int                         pipe_signaux[2];
1.1       bertrand 1959: 
1.120     bertrand 1960:    volatile int                pointeur_signal_ecriture;
                   1961:    volatile int                pointeur_signal_lecture;
                   1962:    volatile enum signaux_rpl   signaux_en_queue[LONGUEUR_QUEUE_SIGNAUX];
                   1963:    volatile logical1           demarrage_fils;
                   1964:    volatile logical1           redemarrage_processus;
1.119     bertrand 1965: 
1.1       bertrand 1966: /* Contextes                                           */
                   1967: 
                   1968:    struct_liste_chainee        *l_base_pile_contextes;
                   1969:    struct_liste_chainee        *l_base_pile_taille_contextes;
                   1970: 
                   1971: /* Variables                                           */
                   1972: 
1.177     bertrand 1973:    // La liste des variables par niveau est doublement chaînée.
                   1974:    // À tout moment, elle pointe sur le niveau le plus haut existant et
1.82      bertrand 1975:    // l_liste_variable_par_niveau->precedent renvoie la liste des
1.177     bertrand 1976:    // définitions. l_liste_variable_par_niveau->precedent->precedent pointe
1.82      bertrand 1977:    // sur la liste des variables globales.
                   1978:    //
1.177     bertrand 1979:    // À l'initialisation :
1.82      bertrand 1980:    // l_liste_variables_par_niveau->suivant == l_liste_variables_par_niveau
                   1981:    // l_liste_variables_par_niveau->precedent == l_liste_variables_par_niveau
                   1982: 
1.79      bertrand 1983:    struct_arbre_variables      *s_arbre_variables;
1.83      bertrand 1984:    struct_liste_variables      *l_liste_variables_par_niveau;
1.180     bertrand 1985:    struct_liste_variables_statiques
                   1986:                                *l_liste_variables_statiques;
1.187     bertrand 1987: 
                   1988:    struct_arbre_variables_partagees
                   1989:                                **s_arbre_variables_partagees;
1.185     bertrand 1990:    struct_liste_variables_partagees
1.187     bertrand 1991:                                **l_liste_variables_partagees;
1.180     bertrand 1992: 
1.93      bertrand 1993:    logical1                    niveau_supprime;
1.83      bertrand 1994: 
                   1995:    struct_variable             *pointeur_variable_courante;
                   1996:    struct_liste_variables      *pointeur_feuille_courante;
1.180     bertrand 1997:    struct_variable_statique    *pointeur_variable_statique_courante;
1.185     bertrand 1998:    struct_variable_partagee    *pointeur_variable_partagee_courante;
1.1       bertrand 1999: 
1.81      bertrand 2000:    int                         *pointeurs_caracteres_variables;
                   2001:    int                         nombre_caracteres_variables;
                   2002: 
1.1       bertrand 2003:    unsigned long               niveau_courant;
                   2004:    unsigned long               niveau_initial;
                   2005: 
                   2006:    logical1                    creation_variables_statiques;
                   2007:    logical1                    creation_variables_partagees;
                   2008:    logical1                    gel_liste_variables;
                   2009: 
                   2010: /* Fichiers                                                */
                   2011: 
                   2012:    struct_liste_chainee        *s_fichiers;
                   2013: 
                   2014: /* Sockets                                             */
                   2015: 
                   2016:    struct_liste_chainee        *s_sockets;
                   2017: 
1.177     bertrand 2018: /* Connecteurs aux bases de données                    */
1.1       bertrand 2019: 
                   2020:    struct_liste_chainee        *s_connecteurs_sql;
                   2021: 
1.177     bertrand 2022: /* Bibliothèques dynamiques                                */
1.1       bertrand 2023: 
                   2024:    struct_liste_chainee        *s_bibliotheques;
                   2025:    struct_instruction_externe  *s_instructions_externes;
                   2026:    unsigned long               nombre_instructions_externes;
                   2027: 
                   2028: /* Fichier d'impression                                    */
                   2029: 
                   2030:    unsigned char               *nom_fichier_impression;
                   2031:    unsigned char               format_papier[16];
                   2032: 
                   2033: /* Parametres graphiques                               */
                   2034: 
                   2035:    struct_fichier_graphique    *fichiers_graphiques;    /* NULL */
                   2036: 
                   2037:    unsigned char               type_trace_eq[21];
                   2038: 
                   2039:                                /*
                   2040:                                 * 2D :
                   2041:                                 * FONCTION
                   2042:                                 * PARAMETRIQUE
                   2043:                                 * POLAIRE
                   2044:                                 * COURBES DE NIVEAU
                   2045:                                 *
                   2046:                                 * 3D :
                   2047:                                 * GRILLE 3D
                   2048:                                 * COURBE PARAMETRIQUE // A FAIRE
                   2049:                                 * SURFACE PARAMETRIQUE // A FAIRE
                   2050:                                 * CYNLINDRIQUE // A FAIRE
                   2051:                                 * SPHERIQUE // A FAIRE
                   2052:                                 */
                   2053: 
                   2054:    unsigned char               type_trace_sigma[21];
                   2055: 
                   2056:                                /*
                   2057:                                 * POINTS
                   2058:                                 * HISTOGRAMME
                   2059:                                 * TABLE TRACANTE
                   2060:                                 */
                   2061: 
                   2062:                                /*
                   2063:                                 * ECHELLES
                   2064:                                 */
                   2065: 
                   2066:    integer8                    systeme_axes;
                   2067: 
                   2068:    real8                       x_min;
                   2069:    real8                       x_max;
                   2070:    real8                       y_min;
                   2071:    real8                       y_max;
                   2072:    real8                       z_min;
                   2073:    real8                       z_max;
                   2074: 
                   2075:    real8                       x_tics;
                   2076:    real8                       y_tics;
                   2077:    real8                       z_tics;
                   2078:    
                   2079:    integer8                    mx_tics;
                   2080:    integer8                    my_tics;
                   2081:    integer8                    mz_tics;
                   2082: 
                   2083:    logical1                    x_lines;
                   2084:    logical1                    y_lines;
                   2085:    logical1                    z_lines;
                   2086: 
                   2087:    logical1                    mx_lines;
                   2088:    logical1                    my_lines;
                   2089:    logical1                    mz_lines;
                   2090: 
                   2091:                                /*
                   2092:                                 * -1 : absent du graphique
                   2093:                                 *  0 : graduations automatiques
                   2094:                                 * >0 : valeur manuelle
                   2095:                                 */
                   2096: 
                   2097:    real8                       x2_min;
                   2098:    real8                       x2_max;
                   2099:    real8                       y2_min;
                   2100:    real8                       y2_max;
                   2101:    real8                       z2_min;
                   2102:    real8                       z2_max;
                   2103: 
                   2104:    real8                       x2_tics;
                   2105:    real8                       y2_tics;
                   2106:    real8                       z2_tics;
                   2107: 
                   2108:    integer8                    mx2_tics;
                   2109:    integer8                    my2_tics;
                   2110:    integer8                    mz2_tics;
                   2111: 
                   2112:    logical1                    x2_lines;
                   2113:    logical1                    y2_lines;
                   2114:    logical1                    z2_lines;
                   2115: 
                   2116:    logical1                    mx2_lines;
                   2117:    logical1                    my2_lines;
                   2118:    logical1                    mz2_lines;
                   2119: 
                   2120:    real8                       resolution;
                   2121: 
                   2122:    logical1                    souris_active;
                   2123: 
                   2124:    logical1                    echelle_automatique_x;
                   2125:    logical1                    echelle_automatique_y;
                   2126:    logical1                    echelle_automatique_z;
                   2127: 
                   2128:    logical1                    echelle_automatique_x2;
                   2129:    logical1                    echelle_automatique_y2;
                   2130:    logical1                    echelle_automatique_z2;
                   2131: 
                   2132:    logical1                    echelle_log_x;
                   2133:    logical1                    echelle_log_y;
                   2134:    logical1                    echelle_log_z;
                   2135: 
                   2136:    logical1                    echelle_log_x2;
                   2137:    logical1                    echelle_log_y2;
                   2138:    logical1                    echelle_log_z2;
                   2139: 
                   2140:    real8                       point_de_vue_theta;
                   2141:    real8                       point_de_vue_phi;
                   2142:    real8                       echelle_3D;
                   2143: 
                   2144:    unsigned char               *label_x;
                   2145:    unsigned char               *label_y;
                   2146:    unsigned char               *label_z;
                   2147:    unsigned char               *titre;
                   2148:    unsigned char               *legende;
                   2149: 
                   2150:    unsigned char               *nom_fichier_gnuplot;
                   2151:    unsigned char               *type_fichier_gnuplot;
                   2152: 
                   2153:    struct_objet                *indep;
                   2154:    struct_objet                *depend;
                   2155:    struct_objet                *parametres_courbes_de_niveau;
                   2156: 
                   2157:    struct_marque               *s_marques;
                   2158: 
                   2159:    file                        *entree_standard;
                   2160: 
                   2161:    logical1                    requete_nouveau_plan;
                   2162:    logical1                    mise_a_jour_trace_requise;
                   2163: 
                   2164: /* Parametres statistiques                             */
                   2165: 
                   2166:    integer8                    colonne_statistique_1;
                   2167:    integer8                    colonne_statistique_2;
                   2168: 
                   2169: /* Etat du calculateur                                 */
                   2170: 
                   2171:    t_8_bits                    drapeaux_etat[8];
                   2172: 
                   2173: /* Traitement des exceptions                           */
                   2174: 
                   2175:    logical1                    arret_si_exception;
                   2176:    unsigned int                exception;
                   2177:    unsigned int                derniere_exception;
                   2178:    unsigned int                exception_processus_fils;
                   2179: 
                   2180: /* Traitement des erreurs                              */
                   2181: 
                   2182:    unsigned int                erreur_compilation;
                   2183:    unsigned int                erreur_execution;
                   2184:    unsigned int                erreur_systeme;
                   2185: 
                   2186:    struct_objet                *s_objet_errone;
                   2187:    struct_objet                *s_objet_erreur;
                   2188: 
                   2189:    logical1                    erreur_scrutation;
                   2190: 
                   2191:    volatile unsigned int       erreur_systeme_processus_fils;
                   2192:    unsigned int                erreur_execution_processus_fils;
                   2193: 
                   2194:    pid_t                       pid_erreur_processus_fils;
                   2195: 
                   2196:    logical1                    erreur_processus_fils;
                   2197: 
                   2198:    integer8                    derniere_erreur_fonction_externe;
                   2199: 
                   2200:    unsigned int                derniere_erreur_systeme;
                   2201:    unsigned int                derniere_erreur_execution;
                   2202:    unsigned int                derniere_erreur_evaluation;
                   2203: 
                   2204:    unsigned char               *instruction_derniere_erreur;
                   2205: 
                   2206:    unsigned long               niveau_derniere_erreur;
                   2207: 
                   2208:    logical1                    core;
                   2209:    logical1                    invalidation_message_erreur;
                   2210: 
                   2211: /* Debug                                               */
                   2212: 
                   2213:    logical1                    debug;
                   2214:    integer8                    type_debug;
                   2215:    logical1                    debug_programme;
                   2216:    logical1                    execution_pas_suivant;
                   2217:    logical1                    traitement_instruction_halt;
                   2218: 
                   2219: /* Interruptions logicielles                           */
                   2220: 
                   2221:    unsigned char               masque_interruptions[d_NOMBRE_INTERRUPTIONS];
                   2222: 
                   2223:    /*
1.177     bertrand 2224:     * 'I' : interruption ignorée
                   2225:     * 'Q' : interruption mise en queue pour un traitement ultérieur
1.1       bertrand 2226:     * 'N' : traitement normal de l'interruption
                   2227:     */
                   2228: 
                   2229:    integer8                    queue_interruptions[d_NOMBRE_INTERRUPTIONS];
                   2230:    integer8                    nombre_interruptions_en_queue;
                   2231:    struct_liste_chainee        *pile_origine_interruptions
                   2232:                                        [d_NOMBRE_INTERRUPTIONS];
                   2233:    volatile integer8           nombre_interruptions_non_affectees;
                   2234: 
                   2235:    struct_objet                *corps_interruptions[d_NOMBRE_INTERRUPTIONS];
                   2236: 
                   2237:    unsigned char               traitement_interruption;  /* Y/N */
                   2238:    unsigned char               traitement_interruptible; /* Y/N */
1.50      bertrand 2239:    unsigned char               traitement_at_poke;       /* Y/N */
1.1       bertrand 2240: 
1.26      bertrand 2241:    struct_objet                *at_exit;
1.50      bertrand 2242:    struct_objet                *at_poke;
1.25      bertrand 2243: 
1.1       bertrand 2244: /* Variables volatiles                                 */
                   2245: 
                   2246:    volatile sig_atomic_t       var_volatile_alarme;
1.177     bertrand 2247:    // Traitement de ctrl+C et des arrêts brutaux
1.1       bertrand 2248:    volatile sig_atomic_t       var_volatile_requete_arret;
                   2249:    // Traitement de ctrl+Z
                   2250:    volatile sig_atomic_t       var_volatile_requete_arret2;
                   2251:    volatile sig_atomic_t       var_volatile_traitement_retarde_stop;
                   2252:    volatile sig_atomic_t       var_volatile_traitement_sigint;
                   2253: 
1.65      bertrand 2254:    volatile sig_atomic_t       var_volatile_processus_racine;
1.1       bertrand 2255:    volatile sig_atomic_t       var_volatile_processus_pere;
                   2256:    volatile sig_atomic_t       var_volatile_recursivite;
                   2257: 
1.27      bertrand 2258:    volatile sig_atomic_t       arret_depuis_abort;
                   2259: 
1.1       bertrand 2260:    volatile int                var_volatile_exception_gsl;
                   2261: 
                   2262: /* Autres                                              */
                   2263: 
1.13      bertrand 2264:    char                        *rpl_home;
                   2265: 
1.1       bertrand 2266:    gsl_rng                     *generateur_aleatoire;
                   2267:    const gsl_rng_type          *type_generateur_aleatoire;
                   2268: 
1.110     bertrand 2269:    void                        *contexte_cas;
                   2270: 
1.1       bertrand 2271:    integer8                    nombre_arguments;
                   2272: 
                   2273:    /*
1.177     bertrand 2274:     * Il s'agit du nombre d'arguments utilisé pour l'évaluation
                   2275:     * des expressions algébriques.
                   2276:     * -1 : la fonction ne peut être dans un objet de type ALG.
1.1       bertrand 2277:     * -2 : nombre d'arguments inconnu
1.177     bertrand 2278:     *  0 : la fonction doit apparaître en notation infixe
                   2279:     * >0 : la fonction apparaît comme une fonction normale
1.1       bertrand 2280:     */
                   2281: 
                   2282:    logical1                    lancement_interactif;
                   2283: 
                   2284:    unsigned char               *chemin_fichiers_temporaires;
                   2285:    unsigned char               langue;
                   2286:    unsigned char               retour_routine_evaluation;
                   2287:    unsigned char               *localisation;
                   2288: 
                   2289:    unsigned long               niveau_recursivite;
                   2290: 
                   2291:    pid_t                       pid_processus_pere;
                   2292:    pthread_t                   tid_processus_pere;
1.153     bertrand 2293:    pthread_t                   tid;
1.1       bertrand 2294: 
                   2295:    logical1                    processus_detache;
                   2296: 
                   2297: /* Profilage                                           */
                   2298: 
                   2299:    logical1                    profilage;
                   2300:    int                         niveau_profilage;
                   2301:    struct_liste_profilage      *pile_profilage;
                   2302:    struct_liste_profilage2     *pile_profilage_fonctions;
                   2303:    struct timeval              horodatage_profilage;
                   2304: 
1.177     bertrand 2305:    // Mutex spécifique au processus et donnant accès à la pile des processus
1.1       bertrand 2306:    pthread_mutex_t             mutex;
1.43      bertrand 2307:    pthread_mutex_t             mutex_allocation;
1.1       bertrand 2308: 
1.121     bertrand 2309:    // Mutex autorisant les fork()
1.164     bertrand 2310:    sem_t __PTR__               semaphore_fork;
1.1       bertrand 2311: 
                   2312: /* Mutexes                                         */
                   2313: 
                   2314:    struct_liste_chainee        *liste_mutexes;
                   2315:    pthread_mutex_t             protection_liste_mutexes;
1.175     bertrand 2316:    unsigned int                sections_critiques;
1.1       bertrand 2317: 
1.177     bertrand 2318: /* Drapeau nécessaire à RESTART                    */
1.147     bertrand 2319: 
1.148     bertrand 2320:    volatile logical1           requete_redemarrage;
1.147     bertrand 2321: 
1.177     bertrand 2322: /* Gestion optimisée de la mémoire                 */
1.1       bertrand 2323: 
                   2324:    double                      estimation_taille_pile_tampon;
                   2325:    unsigned long               taille_pile_tampon;
                   2326:    struct_liste_chainee        *pile_tampon;
                   2327: 
                   2328:    double                      estimation_taille_pile_systeme_tampon;
                   2329:    unsigned long               taille_pile_systeme_tampon;
                   2330:    struct_liste_pile_systeme   *pile_systeme_tampon;
                   2331: 
                   2332:    unsigned long               taille_pile_objets;
                   2333:    struct_objet                *pile_objets;
                   2334: 
1.79      bertrand 2335: #  define TAILLE_CACHE 16384
1.1       bertrand 2336: 
                   2337:    unsigned long               *objets_adr[TAILLE_CACHE];
                   2338:    int                         pointeur_adr;
                   2339: 
                   2340:    logical8                    *objets_bin[TAILLE_CACHE];
                   2341:    int                         pointeur_bin;
                   2342: 
                   2343:    complex16                   *objets_cpl[TAILLE_CACHE];
                   2344:    int                         pointeur_cpl;
                   2345: 
                   2346:    struct fonction             *objets_fct[TAILLE_CACHE];
                   2347:    int                         pointeur_fct;
                   2348: 
                   2349:    integer8                    *objets_int[TAILLE_CACHE];
                   2350:    int                         pointeur_int;
                   2351: 
                   2352:    struct_matrice              *objets_mat[TAILLE_CACHE];
                   2353:    int                         pointeur_mat;
                   2354: 
                   2355:    struct_nom                  *objets_nom[TAILLE_CACHE];
                   2356:    int                         pointeur_nom;
                   2357: 
                   2358:    real8                       *objets_rel[TAILLE_CACHE];
                   2359:    int                         pointeur_rel;
                   2360: 
                   2361:    struct_tableau              *objets_tab[TAILLE_CACHE];
                   2362:    int                         pointeur_tab;
                   2363: 
                   2364:    struct_vecteur              *objets_vec[TAILLE_CACHE];
                   2365:    int                         pointeur_vec;
                   2366: 
                   2367:    struct_liste_chainee        *maillons[TAILLE_CACHE];
                   2368:    int                         pointeur_maillons;
1.97      bertrand 2369: 
                   2370:    struct_arbre_variables      *variables_noeud[TAILLE_CACHE];
                   2371:    int                         pointeur_variables_noeud;
                   2372: 
1.187     bertrand 2373:    struct_arbre_variables_partagees
                   2374:                                *variables_partagees_noeud[TAILLE_CACHE];
                   2375:    int                         pointeur_variables_partagees_noeud;
                   2376: 
1.97      bertrand 2377:    struct_liste_variables      *variables_feuille[TAILLE_CACHE];
                   2378:    int                         pointeur_variables_feuille;
                   2379: 
                   2380:    struct_variable             *variables_variable[TAILLE_CACHE];
                   2381:    int                         pointeur_variables_variable;
                   2382: 
                   2383:    struct_arbre_variables      **variables_tableau_noeuds[TAILLE_CACHE];
                   2384:    int                         pointeur_variables_tableau_noeuds;
1.187     bertrand 2385: 
                   2386:    struct_arbre_variables_partagees
                   2387:                                **variables_tableau_noeuds_partages
                   2388:                                [TAILLE_CACHE];
                   2389:    int                         pointeur_variables_tableau_noeuds_partages;
1.1       bertrand 2390: } struct_processus;
                   2391: #endif
                   2392: 
                   2393: /*
                   2394: --------------------------------------------------------------------------------
                   2395:   Structure fonction
                   2396: --------------------------------------------------------------------------------
                   2397: */
                   2398: 
                   2399: #ifndef RPLARGS
                   2400: typedef struct fonction
                   2401: {
                   2402:    unsigned char                       *nom_fonction;
                   2403:    unsigned long                       nombre_arguments;
                   2404: 
                   2405:    void                                (*fonction)(struct_processus *);
                   2406: 
                   2407:    volatile struct_liste_chainee       *prediction_saut;
                   2408:    volatile logical1                   prediction_execution;
                   2409: } struct_fonction;
                   2410: #endif
                   2411: 
                   2412: 
                   2413: /*
                   2414: ================================================================================
                   2415:   PROTOTYPES
                   2416: ================================================================================
                   2417: */
                   2418: 
                   2419: /*
                   2420: --------------------------------------------------------------------------------
1.177     bertrand 2421:   Procédures d'exécution des mots-clef du langage RPL/2
1.1       bertrand 2422: --------------------------------------------------------------------------------
                   2423: */
                   2424: 
                   2425: // BEGIN C PROTOTYPES
                   2426: void instruction_sensible_e(struct_processus *s_etat_processus);
                   2427: void instruction_sensible_i(struct_processus *s_etat_processus);
1.108     bertrand 2428: void instruction_sensible_infinity(struct_processus *s_etat_processus);
1.1       bertrand 2429: 
                   2430: void instruction_abort(struct_processus *s_etat_processus);
                   2431: void instruction_abs(struct_processus *s_etat_processus);
                   2432: void instruction_acos(struct_processus *s_etat_processus);
                   2433: void instruction_acosh(struct_processus *s_etat_processus);
                   2434: void instruction_alarm(struct_processus *s_etat_processus);
                   2435: void instruction_alog(struct_processus *s_etat_processus);
                   2436: void instruction_and(struct_processus *s_etat_processus);
                   2437: void instruction_append(struct_processus *s_etat_processus);
                   2438: void instruction_array_fleche(struct_processus *s_etat_processus);
                   2439: void instruction_arg(struct_processus *s_etat_processus);
                   2440: void instruction_asin(struct_processus *s_etat_processus);
                   2441: void instruction_asinh(struct_processus *s_etat_processus);
                   2442: void instruction_asl(struct_processus *s_etat_processus);
                   2443: void instruction_asr(struct_processus *s_etat_processus);
                   2444: void instruction_atan(struct_processus *s_etat_processus);
                   2445: void instruction_atanh(struct_processus *s_etat_processus);
1.26      bertrand 2446: void instruction_atexit(struct_processus *s_etat_processus);
1.50      bertrand 2447: void instruction_atpoke(struct_processus *s_etat_processus);
1.1       bertrand 2448: void instruction_autoscale(struct_processus *s_etat_processus);
                   2449: void instruction_axes(struct_processus *s_etat_processus);
                   2450: 
                   2451: void instruction_b_vers_r(struct_processus *s_etat_processus);
                   2452: void instruction_backspace(struct_processus *s_etat_processus);
1.48      bertrand 2453: void instruction_backtrace(struct_processus *s_etat_processus);
1.1       bertrand 2454: void instruction_beep(struct_processus *s_etat_processus);
                   2455: void instruction_bessel(struct_processus *s_etat_processus);
                   2456: void instruction_bin(struct_processus *s_etat_processus);
                   2457: 
                   2458: void instruction_c_vers_r(struct_processus *s_etat_processus);
                   2459: void instruction_case(struct_processus *s_etat_processus);
                   2460: void instruction_ceil(struct_processus *s_etat_processus);
                   2461: void instruction_centr(struct_processus *s_etat_processus);
                   2462: void instruction_cf(struct_processus *s_etat_processus);
                   2463: void instruction_chr(struct_processus *s_etat_processus);
1.193     bertrand 2464: void instruction_cipher(struct_processus *s_etat_processus);
1.1       bertrand 2465: void instruction_clear(struct_processus *s_etat_processus);
                   2466: void instruction_cllcd(struct_processus *s_etat_processus);
                   2467: void instruction_clmf(struct_processus *s_etat_processus);
                   2468: void instruction_close(struct_processus *s_etat_processus);
1.28      bertrand 2469: void instruction_clratexit(struct_processus *s_etat_processus);
1.50      bertrand 2470: void instruction_clratpoke(struct_processus *s_etat_processus);
1.1       bertrand 2471: void instruction_clrcntxt(struct_processus *s_etat_processus);
                   2472: void instruction_clrerr(struct_processus *s_etat_processus);
                   2473: void instruction_clrfuse(struct_processus *s_etat_processus);
                   2474: void instruction_clrmtx(struct_processus *s_etat_processus);
                   2475: void instruction_clrsmphr(struct_processus *s_etat_processus);
                   2476: void instruction_clrswi(struct_processus *s_etat_processus);
                   2477: void instruction_cls(struct_processus *s_etat_processus);
                   2478: void instruction_clusr(struct_processus *s_etat_processus);
                   2479: void instruction_cnrm(struct_processus *s_etat_processus);
                   2480: void instruction_cols(struct_processus *s_etat_processus);
                   2481: void instruction_col_fleche(struct_processus *s_etat_processus);
                   2482: void instruction_col_moins(struct_processus *s_etat_processus);
                   2483: void instruction_col_plus(struct_processus *s_etat_processus);
                   2484: void instruction_comb(struct_processus *s_etat_processus);
                   2485: void instruction_con(struct_processus *s_etat_processus);
                   2486: void instruction_cond(struct_processus *s_etat_processus);
                   2487: void instruction_cont(struct_processus *s_etat_processus);
                   2488: void instruction_continue(struct_processus *s_etat_processus);
                   2489: void instruction_conj(struct_processus *s_etat_processus);
                   2490: void instruction_convert(struct_processus *s_etat_processus);
                   2491: void instruction_copy(struct_processus *s_etat_processus);
                   2492: void instruction_copyright(struct_processus *s_etat_processus);
                   2493: void instruction_corr(struct_processus *s_etat_processus);
                   2494: void instruction_cos(struct_processus *s_etat_processus);
                   2495: void instruction_cosh(struct_processus *s_etat_processus);
                   2496: void instruction_cov(struct_processus *s_etat_processus);
                   2497: void instruction_cr(struct_processus *s_etat_processus);
                   2498: void instruction_create(struct_processus *s_etat_processus);
1.175     bertrand 2499: void instruction_critical(struct_processus *s_etat_processus);
1.1       bertrand 2500: void instruction_crmtx(struct_processus *s_etat_processus);
                   2501: void instruction_cross(struct_processus *s_etat_processus);
                   2502: void instruction_crsmphr(struct_processus *s_etat_processus);
                   2503: void instruction_crtab(struct_processus *s_etat_processus);
                   2504: void instruction_cstop(struct_processus *s_etat_processus);
                   2505: void instruction_cswp(struct_processus *s_etat_processus);
                   2506: void instruction_currenc(struct_processus *s_etat_processus);
                   2507: void instruction_cycle(struct_processus *s_etat_processus);
                   2508: 
                   2509: void instruction_d_vers_r(struct_processus *s_etat_processus);
                   2510: void instruction_daemonize(struct_processus *s_etat_processus);
                   2511: void instruction_date(struct_processus *s_etat_processus);
                   2512: void instruction_dec(struct_processus *s_etat_processus);
                   2513: void instruction_decr(struct_processus *s_etat_processus);
                   2514: void instruction_default(struct_processus *s_etat_processus);
                   2515: void instruction_deg(struct_processus *s_etat_processus);
                   2516: void instruction_delete(struct_processus *s_etat_processus);
                   2517: void instruction_depnd(struct_processus *s_etat_processus);
                   2518: void instruction_depth(struct_processus *s_etat_processus);
                   2519: void instruction_der(struct_processus *s_etat_processus);
                   2520: void instruction_det(struct_processus *s_etat_processus);
                   2521: void instruction_detach(struct_processus *s_etat_processus);
                   2522: void instruction_dft(struct_processus *s_etat_processus);
                   2523: void instruction_dgtiz(struct_processus *s_etat_processus);
                   2524: void instruction_diag_fleche(struct_processus *s_etat_processus);
1.193     bertrand 2525: void instruction_digest(struct_processus *s_etat_processus);
1.1       bertrand 2526: void instruction_disp(struct_processus *s_etat_processus);
                   2527: void instruction_division(struct_processus *s_etat_processus);
                   2528: void instruction_do(struct_processus *s_etat_processus);
                   2529: void instruction_dot(struct_processus *s_etat_processus);
                   2530: void instruction_draw(struct_processus *s_etat_processus);
                   2531: void instruction_drax(struct_processus *s_etat_processus);
                   2532: void instruction_drop(struct_processus *s_etat_processus);
                   2533: void instruction_drop2(struct_processus *s_etat_processus);
                   2534: void instruction_dropcntxt(struct_processus *s_etat_processus);
                   2535: void instruction_dropn(struct_processus *s_etat_processus);
                   2536: void instruction_drws(struct_processus *s_etat_processus);
                   2537: void instruction_dup(struct_processus *s_etat_processus);
                   2538: void instruction_dup2(struct_processus *s_etat_processus);
                   2539: void instruction_dupcntxt(struct_processus *s_etat_processus);
                   2540: void instruction_dupn(struct_processus *s_etat_processus);
                   2541: 
                   2542: void instruction_e(struct_processus *s_etat_processus);
                   2543: void instruction_edit(struct_processus *s_etat_processus);
                   2544: void instruction_egalite(struct_processus *s_etat_processus);
                   2545: void instruction_egv(struct_processus *s_etat_processus);
                   2546: void instruction_egvl(struct_processus *s_etat_processus);
                   2547: void instruction_else(struct_processus *s_etat_processus);
                   2548: void instruction_elseif(struct_processus *s_etat_processus);
                   2549: void instruction_end(struct_processus *s_etat_processus);
                   2550: void instruction_eng(struct_processus *s_etat_processus);
                   2551: void instruction_epsilon(struct_processus *s_etat_processus);
                   2552: void instruction_erase(struct_processus *s_etat_processus);
                   2553: void instruction_errm(struct_processus *s_etat_processus);
                   2554: void instruction_errn(struct_processus *s_etat_processus);
                   2555: void instruction_eval(struct_processus *s_etat_processus);
                   2556: void instruction_exget(struct_processus *s_etat_processus);
                   2557: void instruction_exit(struct_processus *s_etat_processus);
                   2558: void instruction_exp(struct_processus *s_etat_processus);
                   2559: void instruction_expm(struct_processus *s_etat_processus);
                   2560: void instruction_exsub(struct_processus *s_etat_processus);
                   2561: void instruction_externals(struct_processus *s_etat_processus);
                   2562: void instruction_eyept(struct_processus *s_etat_processus);
                   2563: 
                   2564: void instruction_fact(struct_processus *s_etat_processus);
                   2565: void instruction_false(struct_processus *s_etat_processus);
                   2566: void instruction_fc_test(struct_processus *s_etat_processus);
                   2567: void instruction_fc_test_c(struct_processus *s_etat_processus);
                   2568: void instruction_fc_test_s(struct_processus *s_etat_processus);
                   2569: void instruction_fft(struct_processus *s_etat_processus);
                   2570: void instruction_fix(struct_processus *s_etat_processus);
                   2571: void instruction_fleche(struct_processus *s_etat_processus);
                   2572: void instruction_fleche_array(struct_processus *s_etat_processus);
                   2573: void instruction_fleche_col(struct_processus *s_etat_processus);
                   2574: void instruction_fleche_diag(struct_processus *s_etat_processus);
                   2575: void instruction_fleche_hms(struct_processus *s_etat_processus);
                   2576: void instruction_fleche_lcd(struct_processus *s_etat_processus);
                   2577: void instruction_fleche_list(struct_processus *s_etat_processus);
                   2578: void instruction_fleche_num(struct_processus *s_etat_processus);
                   2579: void instruction_fleche_q(struct_processus *s_etat_processus);
                   2580: void instruction_fleche_row(struct_processus *s_etat_processus);
                   2581: void instruction_fleche_str(struct_processus *s_etat_processus);
                   2582: void instruction_fleche_table(struct_processus *s_etat_processus);
                   2583: void instruction_floor(struct_processus *s_etat_processus);
                   2584: void instruction_for(struct_processus *s_etat_processus);
1.176     bertrand 2585: void instruction_forall(struct_processus *s_etat_processus);
1.1       bertrand 2586: void instruction_format(struct_processus *s_etat_processus);
                   2587: void instruction_fp(struct_processus *s_etat_processus);
                   2588: void instruction_fs_test(struct_processus *s_etat_processus);
                   2589: void instruction_fs_test_c(struct_processus *s_etat_processus);
                   2590: void instruction_fs_test_s(struct_processus *s_etat_processus);
                   2591: void instruction_function(struct_processus *s_etat_processus);
                   2592: void instruction_fuse(struct_processus *s_etat_processus);
                   2593: 
                   2594: void instruction_gamma(struct_processus *s_etat_processus);
                   2595: void instruction_ge(struct_processus *s_etat_processus);
                   2596: void instruction_gegv(struct_processus *s_etat_processus);
                   2597: void instruction_gegvl(struct_processus *s_etat_processus);
                   2598: void instruction_get(struct_processus *s_etat_processus);
                   2599: void instruction_getc(struct_processus *s_etat_processus);
                   2600: void instruction_geti(struct_processus *s_etat_processus);
                   2601: void instruction_getr(struct_processus *s_etat_processus);
                   2602: void instruction_glegv(struct_processus *s_etat_processus);
                   2603: void instruction_gregv(struct_processus *s_etat_processus);
                   2604: void instruction_gt(struct_processus *s_etat_processus);
                   2605: 
                   2606: void instruction_halt(struct_processus *s_etat_processus);
                   2607: void instruction_head(struct_processus *s_etat_processus);
                   2608: void instruction_help(struct_processus *s_etat_processus);
                   2609: void instruction_hex(struct_processus *s_etat_processus);
                   2610: void instruction_histogram(struct_processus *s_etat_processus);
                   2611: void instruction_hms_fleche(struct_processus *s_etat_processus);
                   2612: void instruction_hms_moins(struct_processus *s_etat_processus);
                   2613: void instruction_hms_plus(struct_processus *s_etat_processus);
                   2614: 
                   2615: void instruction_i(struct_processus *s_etat_processus);
                   2616: void instruction_idft(struct_processus *s_etat_processus);
                   2617: void instruction_idn(struct_processus *s_etat_processus);
                   2618: void instruction_if(struct_processus *s_etat_processus);
                   2619: void instruction_iferr(struct_processus *s_etat_processus);
                   2620: void instruction_ifft(struct_processus *s_etat_processus);
                   2621: void instruction_ift(struct_processus *s_etat_processus);
                   2622: void instruction_ifte(struct_processus *s_etat_processus);
                   2623: void instruction_im(struct_processus *s_etat_processus);
1.20      bertrand 2624: void instruction_implicit(struct_processus *s_etat_processus);
1.1       bertrand 2625: void instruction_in(struct_processus *s_etat_processus);
                   2626: void instruction_incr(struct_processus *s_etat_processus);
                   2627: void instruction_indep(struct_processus *s_etat_processus);
                   2628: void instruction_input(struct_processus *s_etat_processus);
1.108     bertrand 2629: void instruction_infinity(struct_processus *s_etat_processus);
1.1       bertrand 2630: void instruction_inquire(struct_processus *s_etat_processus);
                   2631: void instruction_int(struct_processus *s_etat_processus);
                   2632: void instruction_interrupt(struct_processus *s_etat_processus);
                   2633: void instruction_inv(struct_processus *s_etat_processus);
                   2634: void instruction_ip(struct_processus *s_etat_processus);
                   2635: void instruction_iswi(struct_processus *s_etat_processus);
                   2636: void instruction_itrace(struct_processus *s_etat_processus);
                   2637: 
                   2638: void instruction_jdate(struct_processus *s_etat_processus);
                   2639: 
                   2640: void instruction_key(struct_processus *s_etat_processus);
                   2641: void instruction_keylabel(struct_processus *s_etat_processus);
                   2642: void instruction_keytitle(struct_processus *s_etat_processus);
                   2643: void instruction_kill(struct_processus *s_etat_processus);
                   2644: void instruction_kind(struct_processus *s_etat_processus);
                   2645: 
                   2646: void instruction_label(struct_processus *s_etat_processus);
                   2647: void instruction_last(struct_processus *s_etat_processus);
                   2648: void instruction_lcase(struct_processus *s_etat_processus);
                   2649: void instruction_lcd_fleche(struct_processus *s_etat_processus);
                   2650: void instruction_lchol(struct_processus *s_etat_processus);
                   2651: void instruction_le(struct_processus *s_etat_processus);
                   2652: void instruction_legv(struct_processus *s_etat_processus);
1.109     bertrand 2653: void instruction_limit(struct_processus *s_etat_processus);
1.1       bertrand 2654: void instruction_line(struct_processus *s_etat_processus);
                   2655: void instruction_list_fleche(struct_processus *s_etat_processus);
                   2656: void instruction_ln(struct_processus *s_etat_processus);
                   2657: void instruction_lnp1(struct_processus *s_etat_processus);
                   2658: void instruction_localization(struct_processus *s_etat_processus);
                   2659: void instruction_lock(struct_processus *s_etat_processus);
                   2660: void instruction_log(struct_processus *s_etat_processus);
                   2661: void instruction_logger(struct_processus *s_etat_processus);
                   2662: void instruction_logscale(struct_processus *s_etat_processus);
                   2663: void instruction_lq(struct_processus *s_etat_processus);
                   2664: void instruction_lsq(struct_processus *s_etat_processus);
                   2665: void instruction_lt(struct_processus *s_etat_processus);
                   2666: void instruction_lu(struct_processus *s_etat_processus);
1.76      bertrand 2667: void instruction_l_vers_t(struct_processus *s_etat_processus);
1.1       bertrand 2668: 
                   2669: void instruction_mant(struct_processus *s_etat_processus);
                   2670: void instruction_mark(struct_processus *s_etat_processus);
                   2671: void instruction_max(struct_processus *s_etat_processus);
                   2672: void instruction_maxs(struct_processus *s_etat_processus);
                   2673: void instruction_mclrin(struct_processus *s_etat_processus);
                   2674: void instruction_mean(struct_processus *s_etat_processus);
                   2675: void instruction_mem(struct_processus *s_etat_processus);
1.32      bertrand 2676: void instruction_memlock(struct_processus *s_etat_processus);
                   2677: void instruction_memunlock(struct_processus *s_etat_processus);
1.1       bertrand 2678: void instruction_min(struct_processus *s_etat_processus);
                   2679: void instruction_mins(struct_processus *s_etat_processus);
                   2680: void instruction_mod(struct_processus *s_etat_processus);
                   2681: void instruction_moins(struct_processus *s_etat_processus);
                   2682: void instruction_mtxlock(struct_processus *s_etat_processus);
                   2683: void instruction_mtxstatus(struct_processus *s_etat_processus);
                   2684: void instruction_mtxtrylock(struct_processus *s_etat_processus);
                   2685: void instruction_mtxunlock(struct_processus *s_etat_processus);
                   2686: void instruction_multiplication(struct_processus *s_etat_processus);
                   2687: 
                   2688: void instruction_ne(struct_processus *s_etat_processus);
                   2689: void instruction_neg(struct_processus *s_etat_processus);
                   2690: void instruction_next(struct_processus *s_etat_processus);
                   2691: void instruction_newplane(struct_processus *s_etat_processus);
                   2692: void instruction_not(struct_processus *s_etat_processus);
                   2693: void instruction_nrand(struct_processus *s_etat_processus);
                   2694: void instruction_nrproc(struct_processus *s_etat_processus);
                   2695: void instruction_ns(struct_processus *s_etat_processus);
                   2696: void instruction_num(struct_processus *s_etat_processus);
                   2697: 
                   2698: void instruction_obget(struct_processus *s_etat_processus);
                   2699: void instruction_obsub(struct_processus *s_etat_processus);
                   2700: void instruction_oct(struct_processus *s_etat_processus);
                   2701: void instruction_open(struct_processus *s_etat_processus);
                   2702: void instruction_or(struct_processus *s_etat_processus);
                   2703: void instruction_over(struct_processus *s_etat_processus);
                   2704: 
                   2705: void instruction_p_vers_r(struct_processus *s_etat_processus);
                   2706: void instruction_paper(struct_processus *s_etat_processus);
                   2707: void instruction_parameter(struct_processus *s_etat_processus);
                   2708: void instruction_parametric(struct_processus *s_etat_processus);
                   2709: void instruction_pcov(struct_processus *s_etat_processus);
                   2710: void instruction_peek(struct_processus *s_etat_processus);
                   2711: void instruction_perm(struct_processus *s_etat_processus);
                   2712: void instruction_persist(struct_processus *s_etat_processus);
                   2713: void instruction_pi(struct_processus *s_etat_processus);
                   2714: void instruction_pick(struct_processus *s_etat_processus);
                   2715: void instruction_plot(struct_processus *s_etat_processus);
                   2716: void instruction_plotter(struct_processus *s_etat_processus);
                   2717: void instruction_plus(struct_processus *s_etat_processus);
                   2718: void instruction_pmax(struct_processus *s_etat_processus);
                   2719: void instruction_pmin(struct_processus *s_etat_processus);
                   2720: void instruction_poke(struct_processus *s_etat_processus);
                   2721: void instruction_polar(struct_processus *s_etat_processus);
1.152     bertrand 2722: void instruction_poll(struct_processus *s_etat_processus);
1.1       bertrand 2723: void instruction_pos(struct_processus *s_etat_processus);
                   2724: void instruction_pourcent(struct_processus *s_etat_processus);
                   2725: void instruction_pourcent_ch(struct_processus *s_etat_processus);
                   2726: void instruction_pourcent_t(struct_processus *s_etat_processus);
                   2727: void instruction_ppar(struct_processus *s_etat_processus);
                   2728: void instruction_pr1(struct_processus *s_etat_processus);
                   2729: void instruction_print(struct_processus *s_etat_processus);
                   2730: void instruction_private(struct_processus *s_etat_processus);
                   2731: void instruction_prlcd(struct_processus *s_etat_processus);
                   2732: void instruction_prmd(struct_processus *s_etat_processus);
1.34      bertrand 2733: void instruction_procid(struct_processus *s_etat_processus);
1.1       bertrand 2734: void instruction_prompt(struct_processus *s_etat_processus);
                   2735: void instruction_protect(struct_processus *s_etat_processus);
                   2736: void instruction_prst(struct_processus *s_etat_processus);
                   2737: void instruction_prstc(struct_processus *s_etat_processus);
                   2738: void instruction_prusr(struct_processus *s_etat_processus);
                   2739: void instruction_prvar(struct_processus *s_etat_processus);
                   2740: void instruction_psdev(struct_processus *s_etat_processus);
                   2741: void instruction_puissance(struct_processus *s_etat_processus);
                   2742: void instruction_purge(struct_processus *s_etat_processus);
                   2743: void instruction_pshcntxt(struct_processus *s_etat_processus);
                   2744: void instruction_pshprfl(struct_processus *s_etat_processus);
                   2745: void instruction_pulcntxt(struct_processus *s_etat_processus);
                   2746: void instruction_pulprfl(struct_processus *s_etat_processus);
                   2747: void instruction_put(struct_processus *s_etat_processus);
                   2748: void instruction_putc(struct_processus *s_etat_processus);
                   2749: void instruction_puti(struct_processus *s_etat_processus);
                   2750: void instruction_putr(struct_processus *s_etat_processus);
                   2751: void instruction_pvar(struct_processus *s_etat_processus);
                   2752: 
                   2753: void instruction_qr(struct_processus *s_etat_processus);
                   2754: 
                   2755: void instruction_r_vers_b(struct_processus *s_etat_processus);
                   2756: void instruction_r_vers_c(struct_processus *s_etat_processus);
                   2757: void instruction_r_vers_d(struct_processus *s_etat_processus);
                   2758: void instruction_r_vers_p(struct_processus *s_etat_processus);
                   2759: void instruction_rad(struct_processus *s_etat_processus);
                   2760: void instruction_rand(struct_processus *s_etat_processus);
                   2761: void instruction_rank(struct_processus *s_etat_processus);
                   2762: void instruction_rceq(struct_processus *s_etat_processus);
                   2763: void instruction_rci(struct_processus *s_etat_processus);
                   2764: void instruction_rcij(struct_processus *s_etat_processus);
                   2765: void instruction_rcl(struct_processus *s_etat_processus);
                   2766: void instruction_rclf(struct_processus *s_etat_processus);
                   2767: void instruction_rcls(struct_processus *s_etat_processus);
                   2768: void instruction_rclswi(struct_processus *s_etat_processus);
                   2769: void instruction_rcws(struct_processus *s_etat_processus);
                   2770: void instruction_rdate(struct_processus *s_etat_processus);
                   2771: void instruction_rdm(struct_processus *s_etat_processus);
                   2772: void instruction_rdgn(struct_processus *s_etat_processus);
                   2773: void instruction_rdz(struct_processus *s_etat_processus);
                   2774: void instruction_re(struct_processus *s_etat_processus);
                   2775: void instruction_read(struct_processus *s_etat_processus);
                   2776: void instruction_recode(struct_processus *s_etat_processus);
                   2777: void instruction_recv(struct_processus *s_etat_processus);
                   2778: void instruction_redraw(struct_processus *s_etat_processus);
1.150     bertrand 2779: void instruction_regex(struct_processus *s_etat_processus);
1.1       bertrand 2780: void instruction_relax(struct_processus *s_etat_processus);
                   2781: void instruction_remove(struct_processus *s_etat_processus);
                   2782: void instruction_res(struct_processus *s_etat_processus);
1.149     bertrand 2783: void instruction_restart(struct_processus *s_etat_processus);
1.1       bertrand 2784: void instruction_recall(struct_processus *s_etat_processus);
                   2785: void instruction_regv(struct_processus *s_etat_processus);
                   2786: void instruction_repeat(struct_processus *s_etat_processus);
                   2787: void instruction_repl(struct_processus *s_etat_processus);
                   2788: void instruction_return(struct_processus *s_etat_processus);
                   2789: void instruction_revlist(struct_processus *s_etat_processus);
                   2790: void instruction_rewind(struct_processus *s_etat_processus);
                   2791: void instruction_rfuse(struct_processus *s_etat_processus);
                   2792: void instruction_rl(struct_processus *s_etat_processus);
                   2793: void instruction_rlb(struct_processus *s_etat_processus);
                   2794: void instruction_rnd(struct_processus *s_etat_processus);
                   2795: void instruction_rnrm(struct_processus *s_etat_processus);
                   2796: void instruction_roll(struct_processus *s_etat_processus);
                   2797: void instruction_rolld(struct_processus *s_etat_processus);
                   2798: void instruction_rot(struct_processus *s_etat_processus);
                   2799: void instruction_row_fleche(struct_processus *s_etat_processus);
                   2800: void instruction_row_moins(struct_processus *s_etat_processus);
                   2801: void instruction_row_plus(struct_processus *s_etat_processus);
                   2802: void instruction_rr(struct_processus *s_etat_processus);
                   2803: void instruction_rrb(struct_processus *s_etat_processus);
                   2804: void instruction_rsd(struct_processus *s_etat_processus);
                   2805: void instruction_rstop(struct_processus *s_etat_processus);
                   2806: void instruction_rswp(struct_processus *s_etat_processus);
                   2807: 
                   2808: void instruction_s_moins(struct_processus *s_etat_processus);
                   2809: void instruction_s_plus(struct_processus *s_etat_processus);
                   2810: void instruction_same(struct_processus *s_etat_processus);
                   2811: void instruction_save(struct_processus *s_etat_processus);
                   2812: void instruction_scatter(struct_processus *s_etat_processus);
                   2813: void instruction_scale(struct_processus *s_etat_processus);
                   2814: void instruction_sched(struct_processus *s_etat_processus);
                   2815: void instruction_schur(struct_processus *s_etat_processus);
                   2816: void instruction_sci(struct_processus *s_etat_processus);
                   2817: void instruction_scls(struct_processus *s_etat_processus);
                   2818: void instruction_sconj(struct_processus *s_etat_processus);
                   2819: void instruction_sdev(struct_processus *s_etat_processus);
                   2820: void instruction_select(struct_processus *s_etat_processus);
                   2821: void instruction_send(struct_processus *s_etat_processus);
                   2822: void instruction_sf(struct_processus *s_etat_processus);
                   2823: void instruction_shared(struct_processus *s_etat_processus);
                   2824: void instruction_sign(struct_processus *s_etat_processus);
                   2825: void instruction_sin(struct_processus *s_etat_processus);
                   2826: void instruction_sinh(struct_processus *s_etat_processus);
                   2827: void instruction_sinv(struct_processus *s_etat_processus);
                   2828: void instruction_size(struct_processus *s_etat_processus);
                   2829: void instruction_sl(struct_processus *s_etat_processus);
                   2830: void instruction_slb(struct_processus *s_etat_processus);
                   2831: void instruction_slice(struct_processus *s_etat_processus);
                   2832: void instruction_slicescale(struct_processus *s_etat_processus);
                   2833: void instruction_smphrdecr(struct_processus *s_etat_processus);
                   2834: void instruction_smphrgetv(struct_processus *s_etat_processus);
                   2835: void instruction_smphrincr(struct_processus *s_etat_processus);
                   2836: void instruction_smphrtrydecr(struct_processus *s_etat_processus);
                   2837: void instruction_sneg(struct_processus *s_etat_processus);
                   2838: void instruction_sort(struct_processus *s_etat_processus);
                   2839: void instruction_spar(struct_processus *s_etat_processus);
                   2840: void instruction_spawn(struct_processus *s_etat_processus);
                   2841: void instruction_splash(struct_processus *s_etat_processus);
                   2842: void instruction_sq(struct_processus *s_etat_processus);
                   2843: void instruction_sqlconnect(struct_processus *s_etat_processus);
                   2844: void instruction_sqldisconnect(struct_processus *s_etat_processus);
                   2845: void instruction_sqlquery(struct_processus *s_etat_processus);
                   2846: void instruction_sqrt(struct_processus *s_etat_processus);
                   2847: void instruction_sr(struct_processus *s_etat_processus);
                   2848: void instruction_srb(struct_processus *s_etat_processus);
1.112     bertrand 2849: void instruction_srev(struct_processus *s_etat_processus);
1.1       bertrand 2850: void instruction_sst(struct_processus *s_etat_processus);
                   2851: void instruction_star_d(struct_processus *s_etat_processus);
                   2852: void instruction_star_h(struct_processus *s_etat_processus);
                   2853: void instruction_star_s(struct_processus *s_etat_processus);
                   2854: void instruction_star_w(struct_processus *s_etat_processus);
                   2855: void instruction_start(struct_processus *s_etat_processus);
                   2856: void instruction_static(struct_processus *s_etat_processus);
                   2857: void instruction_std(struct_processus *s_etat_processus);
                   2858: void instruction_step(struct_processus *s_etat_processus);
                   2859: void instruction_steq(struct_processus *s_etat_processus);
                   2860: void instruction_sto(struct_processus *s_etat_processus);
                   2861: void instruction_sto_division(struct_processus *s_etat_processus);
                   2862: void instruction_sto_fois(struct_processus *s_etat_processus);
                   2863: void instruction_sto_moins(struct_processus *s_etat_processus);
                   2864: void instruction_sto_plus(struct_processus *s_etat_processus);
                   2865: void instruction_stof(struct_processus *s_etat_processus);
                   2866: void instruction_stop(struct_processus *s_etat_processus);
                   2867: void instruction_store(struct_processus *s_etat_processus);
                   2868: void instruction_stos(struct_processus *s_etat_processus);
                   2869: void instruction_stoswi(struct_processus *s_etat_processus);
                   2870: void instruction_str_fleche(struct_processus *s_etat_processus);
                   2871: void instruction_stws(struct_processus *s_etat_processus);
                   2872: void instruction_sub(struct_processus *s_etat_processus);
                   2873: void instruction_suspend(struct_processus *s_etat_processus);
                   2874: void instruction_svd(struct_processus *s_etat_processus);
                   2875: void instruction_svl(struct_processus *s_etat_processus);
                   2876: void instruction_swap(struct_processus *s_etat_processus);
                   2877: void instruction_swi(struct_processus *s_etat_processus);
                   2878: void instruction_swilock(struct_processus *s_etat_processus);
                   2879: void instruction_swiqueue(struct_processus *s_etat_processus);
                   2880: void instruction_swistatus(struct_processus *s_etat_processus);
                   2881: void instruction_swiunlock(struct_processus *s_etat_processus);
                   2882: void instruction_swapcntxt(struct_processus *s_etat_processus);
                   2883: void instruction_sx(struct_processus *s_etat_processus);
                   2884: void instruction_sx2(struct_processus *s_etat_processus);
                   2885: void instruction_sxy(struct_processus *s_etat_processus);
                   2886: void instruction_sy(struct_processus *s_etat_processus);
                   2887: void instruction_sy2(struct_processus *s_etat_processus);
                   2888: void instruction_sync(struct_processus *s_etat_processus);
                   2889: void instruction_syseval(struct_processus *s_etat_processus);
                   2890: 
                   2891: void instruction_table_fleche(struct_processus *s_etat_processus);
                   2892: void instruction_tail(struct_processus *s_etat_processus);
                   2893: void instruction_tan(struct_processus *s_etat_processus);
                   2894: void instruction_tanh(struct_processus *s_etat_processus);
                   2895: void instruction_target(struct_processus *s_etat_processus);
                   2896: void instruction_taylr(struct_processus *s_etat_processus);
                   2897: void instruction_then(struct_processus *s_etat_processus);
                   2898: void instruction_time(struct_processus *s_etat_processus);
                   2899: void instruction_title(struct_processus *s_etat_processus);
                   2900: void instruction_tokenize(struct_processus *s_etat_processus);
                   2901: void instruction_tot(struct_processus *s_etat_processus);
                   2902: void instruction_trim(struct_processus *s_etat_processus);
                   2903: void instruction_trn(struct_processus *s_etat_processus);
                   2904: void instruction_trnc(struct_processus *s_etat_processus);
                   2905: void instruction_true(struct_processus *s_etat_processus);
                   2906: void instruction_type(struct_processus *s_etat_processus);
1.76      bertrand 2907: void instruction_t_vers_l(struct_processus *s_etat_processus);
1.1       bertrand 2908: 
                   2909: void instruction_ucase(struct_processus *s_etat_processus);
                   2910: void instruction_uchol(struct_processus *s_etat_processus);
                   2911: void instruction_unlock(struct_processus *s_etat_processus);
                   2912: void instruction_unprotect(struct_processus *s_etat_processus);
                   2913: void instruction_until(struct_processus *s_etat_processus);
                   2914: void instruction_use(struct_processus *s_etat_processus);
                   2915: void instruction_utpc(struct_processus *s_etat_processus);
                   2916: void instruction_utpf(struct_processus *s_etat_processus);
                   2917: void instruction_utpn(struct_processus *s_etat_processus);
                   2918: void instruction_utpt(struct_processus *s_etat_processus);
                   2919: 
                   2920: void instruction_var(struct_processus *s_etat_processus);
                   2921: void instruction_variable(struct_processus *s_etat_processus);
                   2922: void instruction_vars(struct_processus *s_etat_processus);
                   2923: void instruction_verify(struct_processus *s_etat_processus);
                   2924: void instruction_vers_niveau_inferieur(struct_processus *s_etat_processus);
                   2925: void instruction_vers_niveau_superieur(struct_processus *s_etat_processus);
                   2926: void instruction_version(struct_processus *s_etat_processus);
                   2927: void instruction_visit(struct_processus *s_etat_processus);
                   2928: void instruction_volatile(struct_processus *s_etat_processus);
                   2929: 
                   2930: void instruction_wait(struct_processus *s_etat_processus);
                   2931: void instruction_warranty(struct_processus *s_etat_processus);
                   2932: void instruction_wfdata(struct_processus *s_etat_processus);
                   2933: void instruction_wfack(struct_processus *s_etat_processus);
                   2934: void instruction_wflock(struct_processus *s_etat_processus);
                   2935: void instruction_wfpoke(struct_processus *s_etat_processus);
                   2936: void instruction_wfproc(struct_processus *s_etat_processus);
                   2937: void instruction_wfsock(struct_processus *s_etat_processus);
                   2938: void instruction_wfswi(struct_processus *s_etat_processus);
                   2939: void instruction_while(struct_processus *s_etat_processus);
                   2940: void instruction_wireframe(struct_processus *s_etat_processus);
                   2941: void instruction_workdir(struct_processus *s_etat_processus);
                   2942: void instruction_write(struct_processus *s_etat_processus);
                   2943: 
                   2944: void instruction_xcol(struct_processus *s_etat_processus);
                   2945: void instruction_xor(struct_processus *s_etat_processus);
                   2946: void instruction_xpon(struct_processus *s_etat_processus);
                   2947: void instruction_xroot(struct_processus *s_etat_processus);
                   2948: 
                   2949: void instruction_ycol(struct_processus *s_etat_processus);
                   2950: void instruction_yield(struct_processus *s_etat_processus);
                   2951: 
                   2952: /*
                   2953: --------------------------------------------------------------------------------
1.177     bertrand 2954:   Procédures
1.1       bertrand 2955: --------------------------------------------------------------------------------
                   2956: */
                   2957: 
                   2958: #ifndef RPLARGS
                   2959: void affectation_interruptions_logicielles(struct_processus *s_etat_processus);
                   2960: void affichage_pile(struct_processus *s_etat_processus,
                   2961:        struct_liste_chainee *l_element_courant, unsigned long
                   2962:        niveau_courant);
                   2963: #endif
                   2964: 
                   2965: void *allocation_maillon(struct_processus *s_etat_processus);
                   2966: 
                   2967: #ifndef RPLARGS
                   2968: void analyse(struct_processus *s_etat_processus, void (*fonction)());
1.34      bertrand 2969: void *analyse_instruction(struct_processus *s_etat_processus,
1.1       bertrand 2970:        unsigned char *candidat);
                   2971: void appel_gnuplot(struct_processus *s_etat_processus,
                   2972:        unsigned char persistance);
                   2973: void cf(struct_processus *s_etat_processus, unsigned char indice_drapeau);
                   2974: void cond(struct_processus *s_etat_processus,
                   2975:        struct_matrice *s_matrice, real8 *condition);
1.142     bertrand 2976: void conversion_chaine(struct_processus *s_etat_processus,
                   2977:        unsigned char *chaine, unsigned char type);
1.1       bertrand 2978: void conversion_decimal_vers_hms(real8 *angle);
                   2979: void conversion_degres_vers_radians(real8 *angle);
                   2980: void conversion_element_tex(unsigned char **element, unsigned char *fonction);
                   2981: void conversion_format(struct_processus *s_etat_processus,
                   2982:        unsigned char *chaine);
                   2983: void conversion_hms_vers_decimal(real8 *angle);
1.31      bertrand 2984: void conversion_majuscule_limitee(unsigned char *chaine_entree, 
                   2985:        unsigned char *chaine_sortie, unsigned long longueur);
1.1       bertrand 2986: void conversion_radians_vers_degres(real8 *angle);
1.95      bertrand 2987: void copie_arbre_variables(struct_processus *s_etat_processus,
                   2988:        struct_processus *s_nouvel_etat_processus);
1.1       bertrand 2989: void correction_formateur_tex(struct_processus *s_etat_processus,
                   2990:        unsigned char **ligne);
                   2991: void depilement_pile_systeme(struct_processus *s_etat_processus);
                   2992: void derivation(struct_processus *s_etat_processus,
                   2993:        struct_objet **s_expression);
                   2994: void determinant(struct_processus *s_etat_processus, struct_matrice *s_matrice,
                   2995:        void *valeur);
                   2996: void deverrouillage_threads_concurrents(struct_processus *s_etat_processus);
                   2997: void ecriture_pile(struct_processus *s_etat_processus, file *flux,
                   2998:        struct_liste_chainee *l_element_courant, unsigned long niveau_courant);
                   2999: void ecriture_profil(struct_processus *s_etat_processus);
1.23      bertrand 3000: void effacement_pile_systeme(struct_processus *s_etat_processus);
1.1       bertrand 3001: void empilement_pile_systeme(struct_processus *s_etat_processus);
                   3002: void encart(struct_processus *s_etat_processus, unsigned long duree);
                   3003: void evaluation_romberg(struct_processus *s_etat_processus,
                   3004:        struct_objet *s_expression, unsigned char *variable, real8 *point,
                   3005:        real8 *valeur, logical1 *validite);
                   3006: void factorisation_cholesky(struct_processus *s_etat_processus,
                   3007:        struct_matrice *s_matrice, unsigned char mode);
                   3008: void factorisation_lq(struct_processus *s_etat_processus,
                   3009:        struct_matrice *s_matrice, void **tau);
                   3010: void factorisation_lu(struct_processus *s_etat_processus,
                   3011:        struct_matrice *s_matrice, struct_matrice **s_permutation);
                   3012: void factorisation_qr(struct_processus *s_etat_processus,
                   3013:        struct_matrice *s_matrice, void **tau);
                   3014: void factorisation_schur(struct_processus *s_etat_processus,
                   3015:        struct_matrice *s_matrice, struct_matrice **s_schur);
                   3016: void *fusible(void *argument);
                   3017: void formateur_tex(struct_processus *s_etat_processus, struct_objet *s_objet,
                   3018:        unsigned char environnement);
                   3019: void formateur_elementaire_tex(struct_processus *s_etat_processus,
                   3020:        file *fichier, struct_objet *s_objet, unsigned char environnement);
                   3021: void impression_pile(struct_processus *s_etat_processus,
                   3022:            struct_liste_chainee *l_element_courant,
                   3023:            unsigned char methode, unsigned long niveau_courant);
                   3024: void impression_tex(struct_processus *s_etat_processus);
                   3025: void informations(struct_processus *s_etat_processus);
                   3026: void initialisation_allocateur(struct_processus *s_etat_processus);
                   3027: void initialisation_completion(void);
1.110     bertrand 3028: void initialisation_contexte_cas(struct_processus *s_etat_processus);
1.1       bertrand 3029: void initialisation_drapeaux(struct_processus *s_etat_processus);
                   3030: void initialisation_generateur_aleatoire(struct_processus *s_etat_processus,
                   3031:        logical1 initialisation_automatique, unsigned long int racine);
                   3032: void initialisation_instructions(struct_processus *s_etat_processus);
1.81      bertrand 3033: void initialisation_variables(struct_processus *s_etat_processus);
1.1       bertrand 3034: #endif
                   3035: 
                   3036: void initialisation_objet(struct_objet *s_objet);
                   3037: 
                   3038: #ifndef RPLARGS
                   3039: void insertion_thread(struct_processus *s_etat_processus,
                   3040:        logical1 thread_principal);
                   3041: void insertion_thread_surveillance(struct_processus *s_etat_processus,
                   3042:        struct_descripteur_thread *s_argument_thread);
                   3043: void integrale_romberg(struct_processus *s_etat_processus,
                   3044:        struct_objet *s_expression, unsigned char *variable,
                   3045:        real8 a, real8 b, real8 precision);
1.102     bertrand 3046: void interface_cas(struct_processus *s_etat_processus,
                   3047:        enum t_rplcas_commandes commande);
1.120     bertrand 3048: void interruption1(int signal);
                   3049: void interruption2(int signal);
                   3050: void interruption3(int signal);
                   3051: void interruption4(int signal);
                   3052: void interruption5(int signal);
1.148     bertrand 3053: void interruption6(int signal);
1.132     bertrand 3054: void interruption_depassement_pile(int urgence, stackoverflow_context_t scp);
1.1       bertrand 3055: void inversion_matrice(struct_processus *s_etat_processus,
                   3056:        struct_matrice *s_matrice);
                   3057: void lancement_daemon(struct_processus *s_etat_processus);
                   3058: void *lancement_thread(void *argument);
                   3059: #endif
                   3060: 
                   3061: void liberation(struct_processus *s_etat_processus, struct_objet *s_objet);
                   3062: void liberation_maillon(struct_processus *s_etat_processus,
                   3063:        struct_liste_chainee *maillon);
                   3064: 
                   3065: #ifndef RPLARGS
                   3066: void liberation_allocateur(struct_processus *s_etat_processus);
                   3067: void liberation_arbre_instructions(struct_processus *s_etat_processus,
                   3068:        struct_instruction *arbre);
1.82      bertrand 3069: void liberation_arbre_variables(struct_processus *s_etat_processus,
                   3070:        struct_arbre_variables *arbre, logical1 definitions);
1.186     bertrand 3071: void liberation_arbre_variables_partagees(struct_processus *s_etat_processus,
1.187     bertrand 3072:        struct_arbre_variables_partagees *arbre);
1.110     bertrand 3073: void liberation_contexte_cas(struct_processus *s_etat_processus);
1.1       bertrand 3074: void liberation_generateur_aleatoire(struct_processus *s_etat_processus);
1.187     bertrand 3075: void liberation_mutexes_arbre_variables_partagees(struct_processus
                   3076:        *s_etat_processus, struct_arbre_variables_partagees *l_element_courant);
1.1       bertrand 3077: void liberation_threads(struct_processus *s_etat_processus);
                   3078: void liberation_profil(struct_processus *s_etat_processus);
                   3079: void localisation_courante(struct_processus *s_etat_processus);
                   3080: void modification_pid_thread_pere(struct_processus *s_etat_processus);
                   3081: void moindres_carres(struct_processus *s_etat_processus,
                   3082:        struct_matrice *s_matrice_a, struct_matrice *s_matrice_b,
                   3083:        struct_matrice *s_matrice_x);
                   3084: void profilage(struct_processus *s_etat_processus, unsigned char *fonction);
                   3085: void rang(struct_processus *s_etat_processus, struct_matrice *s_matrice,
                   3086:        integer8 *valeur);
                   3087: void recherche_type(struct_processus *s_etat_processus);
                   3088: void retrait_thread(struct_processus *s_etat_processus);
                   3089: void retrait_thread_surveillance(struct_processus *s_etat_processus,
                   3090:        struct_descripteur_thread *s_argument_thread);
                   3091: void rplcore(struct_processus *s_etat_processus);
1.133     bertrand 3092: #endif
                   3093: 
1.34      bertrand 3094: void scrutation_injection(struct_processus *s_etat_processus);
1.133     bertrand 3095: 
                   3096: #ifndef RPLARGS
1.119     bertrand 3097: void scrutation_interruptions(struct_processus *s_etat_processus);
1.1       bertrand 3098: void sf(struct_processus *s_etat_processus, unsigned char indice_drapeau);
                   3099: void *surveillance_processus(void *argument);
                   3100: void swap(void *variable_1, void *variable_2, unsigned long taille_octets);
1.184     bertrand 3101: void *thread_signaux(void *argument);
1.44      bertrand 3102: void trace(struct_processus *s_etat_processus, FILE *flux);
1.1       bertrand 3103: void traitement_asynchrone_exceptions_gsl(struct_processus *s_etat_processus);
                   3104: void traitement_exceptions_gsl(const char *reason, const char *file,
                   3105:        int line, int gsl_errno);
                   3106: void traitement_interruptions_logicielles(struct_processus *s_etat_processus);
                   3107: void tri_base_symboles_externes(struct_processus *s_etat_processus);
                   3108: void tri_vecteur(real8 *vecteur, unsigned long taille);
                   3109: void valeurs_propres(struct_processus *s_etat_processus,
                   3110:        struct_matrice *s_matrice,
                   3111:        struct_vecteur *s_valeurs_propres,
                   3112:        struct_matrice *s_vecteurs_propres_gauches,
                   3113:        struct_matrice *s_vecteur_propres_droits);
                   3114: void valeurs_propres_generalisees(struct_processus *s_etat_processus,
                   3115:        struct_matrice *s_matrice,
                   3116:        struct_matrice *s_metrique,
                   3117:        struct_vecteur *s_valeurs_propres,
                   3118:        struct_matrice *s_vecteurs_propres_gauches,
                   3119:        struct_matrice *s_vecteur_propres_droits);
                   3120: void valeurs_singulieres(struct_processus *s_etat_processus,
                   3121:        struct_matrice *s_matrice,
                   3122:        struct_matrice *u, struct_vecteur *s, struct_matrice *vh);
                   3123: void verrouillage_threads_concurrents(struct_processus *s_etat_processus);
                   3124: #endif
                   3125: 
1.120     bertrand 3126: /*
                   3127: --------------------------------------------------------------------------------
                   3128:   Fonctions de gestion des signaux
                   3129: --------------------------------------------------------------------------------
                   3130: */
                   3131: 
1.57      bertrand 3132: #ifndef RPLARGS
1.120     bertrand 3133: void creation_queue_signaux(struct_processus *s_etat_processus);
                   3134: void liberation_queue_signaux(struct_processus *s_etat_processus);
                   3135: void destruction_queue_signaux(struct_processus *s_etat_processus);
                   3136: int envoi_signal_contexte(struct_processus *s_etat_processus,
                   3137:        enum signaux_rpl signal);
                   3138: int envoi_signal_processus(pid_t pid, enum signaux_rpl signal);
                   3139: int envoi_signal_thread(pthread_t tid, enum signaux_rpl signal);
1.57      bertrand 3140: #endif
                   3141: 
1.1       bertrand 3142: /*
                   3143: --------------------------------------------------------------------------------
1.177     bertrand 3144:   Fonctions de sommation de vecteur dans perte de précision
1.1       bertrand 3145: --------------------------------------------------------------------------------
                   3146: */
                   3147: 
                   3148: real8 sommation_vecteur_reel(real8 *vecteur, unsigned long *taille,
                   3149:        logical1 *erreur_memoire);
                   3150: complex16 sommation_vecteur_complexe(complex16 *vecteur, unsigned long *taille,
                   3151:        logical1 *erreur_memoire);
                   3152: 
                   3153: /*
                   3154: --------------------------------------------------------------------------------
                   3155:   Routine principale
                   3156: --------------------------------------------------------------------------------
                   3157: */
                   3158: 
                   3159: #ifndef RPLARGS
1.147     bertrand 3160: int rplinit(int argc, char *argv[], char *envp[],
                   3161:        unsigned char ***resultats, char *rpl_home);
1.1       bertrand 3162: #endif
                   3163: 
                   3164: /*
                   3165: --------------------------------------------------------------------------------
                   3166:   Routines de statistiques
                   3167: --------------------------------------------------------------------------------
                   3168: */
                   3169: 
                   3170: #ifndef RPLARGS
                   3171: real8 correlation_statistique(struct_matrice *s_matrice,
                   3172:        unsigned long colonne_1, unsigned long colonne_2, logical1 *erreur);
                   3173: real8 covariance_statistique(struct_matrice *s_matrice,
                   3174:        unsigned long colonne_1, unsigned long colonne_2,
                   3175:        unsigned char type, logical1 *erreur);
                   3176: struct_vecteur *ecart_type_statistique(struct_matrice *s_matrice,
                   3177:        unsigned char type);
                   3178: struct_vecteur *moyenne_statistique(struct_matrice *s_matrice);
                   3179: struct_vecteur *sommation_colonne_statistique(struct_matrice *s_matrice,
                   3180:        unsigned long colonne);
                   3181: struct_vecteur *sommation_produits_colonnes_statistiques(struct_matrice
                   3182:        *s_matrice, unsigned long colonne_1, unsigned long colonne_2);
                   3183: struct_vecteur *sommation_statistique(struct_matrice *s_matrice);
                   3184: struct_vecteur *variance_statistique(struct_matrice *s_matrice,
                   3185:        unsigned char type);
                   3186: #endif
                   3187: 
                   3188: /*
                   3189: --------------------------------------------------------------------------------
1.177     bertrand 3190:   Gestion des bibliothèques
1.1       bertrand 3191: --------------------------------------------------------------------------------
                   3192: */
                   3193: 
                   3194: #ifndef RPLARGS
                   3195: void *chargement_bibliotheque(struct_processus *s_etat_processus,
                   3196:        unsigned char *bibliotheque);
                   3197: logical1 execution_fonction_de_bibliotheque(struct_processus *s_etat_processus,
                   3198:        unsigned char *nom_fonction, unsigned char *bibliothque);
                   3199: logical1 retrait_bibliotheque(struct_processus *s_etat_processus,
                   3200:        struct_bibliotheque *descripteur);
                   3201: #endif
                   3202: 
                   3203: struct_liste_chainee *depilement_pile_operationnelle(struct_rpl_arguments
                   3204:        *s_rpl_arguments, struct_objet **s_objet);
                   3205: struct_liste_chainee *empilement_pile_operationnelle(struct_rpl_arguments
                   3206:        *s_rpl_arguments, struct_objet *s_objet);
                   3207: struct_liste_chainee *sauvegarde_arguments(struct_rpl_arguments
                   3208:        *s_rpl_arguments, unsigned long nombre_arguments);
                   3209: 
                   3210: /*
                   3211: --------------------------------------------------------------------------------
                   3212:   Fonctions retournant un CHARACTER*(*)
                   3213: --------------------------------------------------------------------------------
                   3214: */
                   3215: 
                   3216: #ifndef RPLARGS
                   3217: unsigned char *analyse_algebrique(struct_processus *s_etat_processus,
                   3218:        unsigned char *chaine_algebrique, struct_liste_chainee **l_base_liste);
1.168     bertrand 3219: unsigned char *analyse_flux(struct_processus *s_etat_processus,
1.169     bertrand 3220:        unsigned char *flux, long longueur);
1.195     bertrand 3221: unsigned char *chiffrement(const EVP_CIPHER *type_chiffrement,
                   3222:        logical1 encodage, unsigned char *message, unsigned int
                   3223:        longueur_message, unsigned char *clef, unsigned int longueur_clef,
                   3224:        unsigned char *vecteur_initialisation,
                   3225:        unsigned int *longueur_message_chiffre);
1.1       bertrand 3226: unsigned char *compactage(unsigned char *chaine);
                   3227: unsigned char *conversion_majuscule(unsigned char *chaine);
                   3228: unsigned char *creation_nom_fichier(struct_processus *s_etat_processus,
                   3229:        unsigned char *chemin);
1.136     bertrand 3230: unsigned char *date_compilation();
1.1       bertrand 3231: unsigned char *extraction_chaine(unsigned char *chaine, unsigned long i,
                   3232:        unsigned long j);
                   3233: unsigned char *formateur(struct_processus *s_etat_processus, long offset,
                   3234:        struct_objet *s_objet);
                   3235: unsigned char *formateur_fichier(struct_processus *s_etat_processus,
                   3236:        struct_objet *s_objet, struct_objet *s_format,
                   3237:        long longueur, long longueur_champ, unsigned char format,
                   3238:        unsigned char type, long *longueur_effective, long *recursivite);
1.77      bertrand 3239: unsigned char *formateur_flux(struct_processus *s_etat_processus,
                   3240:        unsigned char *donnees, long *longueur);
1.1       bertrand 3241: unsigned char *formateur_fichier_nombre(struct_processus *s_etat_processus,
                   3242:        void *valeur_numerique, unsigned char type,
                   3243:        long longueur, long longueur_champ, unsigned char format);
1.138     bertrand 3244: unsigned char *formateur_fichier_binaire_nombre(struct_processus
                   3245:        *s_etat_processus, void *valeur_numerique, unsigned char type,
                   3246:        long longueur, long *longueur_conversion);
1.1       bertrand 3247: unsigned char *formateur_fichier_reel(struct_processus *s_etat_processus,
                   3248:        void *valeur_numerique, unsigned char type,
                   3249:        long longueur, long longueur_champ, unsigned char format);
                   3250: unsigned char *formateur_nombre(struct_processus *s_etat_processus,
                   3251:        void *valeur_numerique, unsigned char type);
                   3252: unsigned char *formateur_reel(struct_processus *s_etat_processus,
                   3253:        void *valeur_numerique, unsigned char type);
                   3254: unsigned char *messages(struct_processus *s_etat_processus);
1.140     bertrand 3255: unsigned char *pointeur_ieme_caractere(struct_processus *s_etat_processus,
                   3256:        unsigned char *chaine, integer8 position);
1.1       bertrand 3257: unsigned char *purification_chaine(unsigned char *chaine);
1.195     bertrand 3258: unsigned char *recherche_chemin_fichiers_temporaires(struct_processus
                   3259:        *s_etat_processus);
1.1       bertrand 3260: unsigned char *reencodage(struct_processus *s_etat_processus,
                   3261:        unsigned char *chaine_entree, unsigned char *codage_entree,
                   3262:        unsigned char *codage_sortie);
                   3263: unsigned char *transliteration(struct_processus *s_etat_processus,
                   3264:        unsigned char *chaine_entree, unsigned char *codage_entree,
                   3265:        unsigned char *codage_sortie);
                   3266: #endif
                   3267: 
                   3268: /*
                   3269: --------------------------------------------------------------------------------
                   3270:   Fonctions retournant un INTEGER*1 (drapeau d'erreur)
                   3271: --------------------------------------------------------------------------------
                   3272: */
                   3273: 
                   3274: #ifndef RPLARGS
                   3275: logical1 analyse_syntaxique(struct_processus *s_etat_processus);
1.184     bertrand 3276: logical1 arret_thread_signaux(struct_processus *s_etat_processus);
1.1       bertrand 3277: logical1 caracteristiques_fichier(struct_processus *s_etat_processus,
                   3278:        unsigned char *nom, logical1 *existence, logical1 *ouverture,
                   3279:        unsigned long *unite);
1.13      bertrand 3280: logical1 controle(struct_processus *s_etat_processus, unsigned char *fichier,
                   3281:        unsigned char *type, unsigned char *somme_candidate);
1.146     bertrand 3282: logical1 controle_integrite(struct_processus *s_etat_processus,
                   3283:        unsigned char *executable_candidat, unsigned char *executable);
1.1       bertrand 3284: logical1 creation_variable(struct_processus *s_etat_processus,
                   3285:        struct_variable *s_variable,
                   3286:        unsigned char autorisation_creation_variable_statique,
                   3287:        unsigned char autorisation_creation_variable_partagee);
                   3288: logical1 creation_variable_partagee(struct_processus *s_etat_processus,
                   3289:        struct_variable_partagee *s_variable);
                   3290: logical1 creation_variable_statique(struct_processus *s_etat_processus,
                   3291:        struct_variable_statique *s_variable);
                   3292: logical1 chainage(struct_processus *s_etat_processus);
                   3293: logical1 compilation(struct_processus *s_etat_processus);
                   3294: logical1 depilement(struct_processus *s_etat_processus,
                   3295:        struct_liste_chainee **l_base_liste, struct_objet **s_objet);
                   3296: logical1 destruction_fichier(unsigned char *nom_fichier);
                   3297: logical1 empilement(struct_processus *s_etat_processus,
                   3298:        struct_liste_chainee **l_base_liste, struct_objet *s_objet);
                   3299: logical1 empilement_pile_last(struct_processus *s_etat_processus,
                   3300:        unsigned long nombre_arguments);
                   3301: logical1 evaluation(struct_processus *s_etat_processus, struct_objet *s_objet,
                   3302:        unsigned char type_evaluation);
1.15      bertrand 3303: logical1 initialisation_fichier_acces_direct(struct_processus *s_etat_processus,
                   3304:        sqlite3 *sqlite, logical1 binaire);
                   3305: logical1 initialisation_fichier_acces_indexe(struct_processus *s_etat_processus,
1.17      bertrand 3306:        sqlite3 *sqlite, integer8 position_clef, logical1 binaire);
1.184     bertrand 3307: logical1 lancement_thread_signaux(struct_processus *s_etat_processus);
1.1       bertrand 3308: logical1 recherche_instruction_suivante(struct_processus *s_etat_processus);
                   3309: logical1 retrait_variable(struct_processus *s_etat_processus,
                   3310:        unsigned char *nom_variable, unsigned char type);
1.180     bertrand 3311: logical1 retrait_variables_par_niveau(struct_processus *s_etat_processus);
1.1       bertrand 3312: logical1 retrait_variable_partagee(struct_processus *s_etat_processus,
                   3313:        unsigned char *nom_variable, union_position_variable position);
1.186     bertrand 3314: logical1 retrait_variables_partagees_locales(
1.182     bertrand 3315:        struct_processus *s_etat_processus);
1.1       bertrand 3316: logical1 retrait_variable_statique(struct_processus *s_etat_processus,
                   3317:        unsigned char *nom_variable, union_position_variable position);
1.186     bertrand 3318: logical1 retrait_variables_statiques_locales(
                   3319:        struct_processus *s_etat_processus);
1.1       bertrand 3320: logical1 sequenceur(struct_processus *s_etat_processus);
                   3321: logical1 sequenceur_optimise(struct_processus *s_etat_processus);
                   3322: #endif
                   3323: 
                   3324: /*
                   3325: --------------------------------------------------------------------------------
                   3326:   Fonctions retournant un INTEGER*1 (drapeau)
                   3327: --------------------------------------------------------------------------------
                   3328: */
                   3329: 
                   3330: logical1 depassement_addition(integer8 *a, integer8 *b, integer8 *resultat);
                   3331: logical1 depassement_multiplication(integer8 *a, integer8 *b,
                   3332:        integer8 *resultat);
                   3333: logical1 depassement_puissance(integer8 *a, integer8 *b, integer8 *resultat);
                   3334: 
                   3335: #ifndef RPLARGS
                   3336: logical1 ecriture_pipe(struct_processus *s_etat_processus, int pipe,
                   3337:        struct_objet *s_objet);
                   3338: logical1 recherche_variable(struct_processus *s_etat_processus,
                   3339:        unsigned char *nom_variable);
1.87      bertrand 3340: logical1 recherche_variable_globale(struct_processus *s_etat_processus,
                   3341:        unsigned char *nom_variable);
1.1       bertrand 3342: logical1 test_cfsf(struct_processus *s_etat_processus,
                   3343:        unsigned char indice_drapeau);
                   3344: logical1 test_expression_rpn(unsigned char *chaine);
                   3345: logical1 test_fonction(unsigned char *chaine);
1.140     bertrand 3346: logical1 validation_chaine(unsigned char *chaine);
1.1       bertrand 3347: #endif
                   3348: 
                   3349: /*
                   3350: --------------------------------------------------------------------------------
                   3351:   Fonctions retournant un ssize_t
                   3352: --------------------------------------------------------------------------------
                   3353: */
                   3354: 
                   3355: #ifndef RPLARGS
1.34      bertrand 3356: ssize_t read_atomic(struct_processus *s_etat_processus,
1.1       bertrand 3357:        int fd, void *buf, size_t count);
1.34      bertrand 3358: ssize_t write_atomic(struct_processus *s_etat_processus,
1.1       bertrand 3359:        int fd, void *buf, size_t count);
                   3360: #endif
                   3361: 
                   3362: /*
                   3363: --------------------------------------------------------------------------------
                   3364:   Fonctions renvoyant un int
                   3365: --------------------------------------------------------------------------------
                   3366: */
                   3367: 
1.4       bertrand 3368: int alsprintf(unsigned char **strp, const char *fmt, ...);
1.132     bertrand 3369: int interruption_violation_access(void *adresse_fautive, int gravite);
1.133     bertrand 3370: #ifndef RPLARGS
1.91      bertrand 3371: int liste_variables(struct_processus *s_etat_processus,
1.187     bertrand 3372:        struct_tableau_variables *tableau);
                   3373: int nombre_variables(struct_processus *s_etat_processus);
1.156     bertrand 3374: int readline_analyse_syntaxique(int count, int key);
1.157     bertrand 3375: int readline_effacement(int count, int key);
1.133     bertrand 3376: #endif
1.9       bertrand 3377: int tex_fprintf(struct_processus *s_etat_processus,
                   3378:        file *flux, const char *format, ...);
1.3       bertrand 3379: int transliterated_fprintf(struct_processus *s_etat_processus, file *flux,
                   3380:        const char *format, ...);
1.4       bertrand 3381: int valsprintf(unsigned char **strp, const char *fmt, va_list ap);
1.1       bertrand 3382: int wrapper_instruction_intrinseque(void (*fonction)(),
                   3383:        struct_rpl_arguments *rpl_arguments);
                   3384: 
                   3385: /*
                   3386: --------------------------------------------------------------------------------
                   3387:   Fonctions renvoyant un INTEGER*1 (longueur d'un entier binaire)
                   3388: --------------------------------------------------------------------------------
                   3389: */
                   3390: 
                   3391: #ifndef RPLARGS
                   3392: unsigned char longueur_entiers_binaires(struct_processus *s_etat_processus);
                   3393: #endif
                   3394: 
                   3395: /*
                   3396: --------------------------------------------------------------------------------
1.177     bertrand 3397:   Fonctions retournant un INTEGER*8 (valeur binaire non signée)
1.1       bertrand 3398: --------------------------------------------------------------------------------
                   3399: */
                   3400: 
                   3401: #ifndef RPLARGS
                   3402: logical8 masque_entiers_binaires(struct_processus *s_etat_processus);
                   3403: #endif
                   3404: 
                   3405: /*
                   3406: --------------------------------------------------------------------------------
                   3407:   Fonctions retournant un INTEGER*8 (entier standard RPL/2)
                   3408: --------------------------------------------------------------------------------
                   3409: */
                   3410: 
                   3411: #ifndef RPLARGS
                   3412: integer8 occupation_memoire(struct_objet *s_objet);
1.139     bertrand 3413: integer8 longueur_chaine(struct_processus *s_etat_processus,
                   3414:        unsigned char *chaine);
1.142     bertrand 3415: integer8 position_caractere_de_chaine(struct_processus *s_etat_processus,
                   3416:        unsigned char *chaine, unsigned char *position);
1.1       bertrand 3417: #endif
                   3418: 
                   3419: /*
                   3420: --------------------------------------------------------------------------------
1.177     bertrand 3421:   Fonctions renvoyant une liste chaînée (pointeur sur *struct_liste_chainee)
1.1       bertrand 3422: --------------------------------------------------------------------------------
                   3423: */
                   3424: 
                   3425: #ifndef RPLARGS
                   3426: struct_liste_chainee *analyse_rpn(struct_processus *s_etat_processus,
                   3427:        unsigned char *chaine_rpn);
                   3428: #endif
                   3429: 
                   3430: /*
                   3431: --------------------------------------------------------------------------------
                   3432:   Fonctions renvoyant une copie de la structure de description des processus
                   3433: --------------------------------------------------------------------------------
                   3434: */
                   3435: 
                   3436: #ifndef RPLARGS
                   3437: struct_processus *copie_etat_processus(struct_processus *s_etat_processus);
                   3438: #endif
                   3439: 
                   3440: /*
                   3441: --------------------------------------------------------------------------------
1.15      bertrand 3442:   Fonctions renvoyant un pointeur sur un fichier (file *) ou un descripteur
1.1       bertrand 3443: --------------------------------------------------------------------------------
                   3444: */
                   3445: 
                   3446: #ifndef RPLARGS
                   3447: file *creation_fichier_tex(struct_processus *s_etat_processus);
1.15      bertrand 3448: struct_descripteur_fichier *descripteur_fichier(struct_processus
                   3449:        *s_etat_processus, struct_fichier *s_fichier);
1.1       bertrand 3450: #endif
                   3451: 
                   3452: /*
                   3453: --------------------------------------------------------------------------------
                   3454:   Fonctions renvoyant un pointeur sur une *struct_objet
                   3455: --------------------------------------------------------------------------------
                   3456: */
                   3457: 
                   3458: struct_objet *copie_objet(struct_processus *s_etat_processus,
                   3459:        struct_objet *s_objet, unsigned char type);
                   3460: 
1.133     bertrand 3461: struct_objet *allocation(struct_processus *s_etat_processus, enum t_type type);
1.1       bertrand 3462: #ifndef RPLARGS
                   3463: struct_objet *formateur_date(struct_processus *s_etat_processus,
                   3464:        struct timeval *temps);
                   3465: struct_objet *lecture_pipe(struct_processus *s_etat_processus, int pipe);
                   3466: struct_objet *parametres_sql(struct_processus *s_etat_processus,
                   3467:        struct_objet *s_parametres);
                   3468: struct_objet *simplification(struct_processus *s_etat_processus,
                   3469:        struct_objet *s_objet);
1.180     bertrand 3470: 
1.182     bertrand 3471: struct_arbre_variables *allocation_noeud(struct_processus *s_etat_processus);
                   3472: struct_arbre_variables **allocation_tableau_noeuds(
                   3473:        struct_processus *s_etat_processus);
                   3474: 
1.180     bertrand 3475: /*
                   3476: --------------------------------------------------------------------------------
                   3477:   Fonctions renvoyant un pointeur sur une *struct_liste_variables_statiques
1.187     bertrand 3478:   ou *struct_liste_variables_partagees
1.180     bertrand 3479: --------------------------------------------------------------------------------
                   3480: */
                   3481: 
                   3482: struct_liste_variables_statiques *recherche_variable_statique(struct_processus
                   3483:        *s_etat_processus, unsigned char *nom_variable,
1.187     bertrand 3484:        union_position_variable position, unsigned char origine);
                   3485: struct_liste_variables_partagees *recherche_variable_partagee(struct_processus
                   3486:        *s_etat_processus, unsigned char *nom_variable,
                   3487:        union_position_variable position, unsigned char origine);
1.1       bertrand 3488: #endif
                   3489: 
                   3490: /*
                   3491: --------------------------------------------------------------------------------
1.177     bertrand 3492:   Fonctions gérant les arbres de simplification
1.1       bertrand 3493: --------------------------------------------------------------------------------
                   3494: */
                   3495: 
                   3496: #ifndef RPLARGS
                   3497: struct_arbre *creation_arbre(struct_processus *s_etat_processus,
                   3498:        struct_objet **t_objets, unsigned long indice,
                   3499:        unsigned long indice_maximal);
                   3500: void liberation_arbre(struct_processus *s_etat_processus,
                   3501:        struct_arbre *s_noeud);
                   3502: void parcours_arbre(struct_processus *s_etat_processus, struct_arbre *s_noeud);
                   3503: void simplification_arbre(struct_processus *s_etat_processus,
                   3504:        struct_arbre *s_noeud);
                   3505: #endif
                   3506: 
                   3507: /*
                   3508: --------------------------------------------------------------------------------
1.177     bertrand 3509:   Fonctions gérant la complétion automatique
1.1       bertrand 3510: --------------------------------------------------------------------------------
                   3511: */
                   3512: 
                   3513: char **completion_rpl();
                   3514: char *generateur_commandes();
                   3515: char **completion_matches();
                   3516: 
                   3517: // END C PROTOTYPES
                   3518: 
                   3519: /*
                   3520: --------------------------------------------------------------------------------
1.177     bertrand 3521:   Arithmétique
1.1       bertrand 3522: --------------------------------------------------------------------------------
                   3523: */
                   3524: 
                   3525: void f77absc_(complex16 *c, real8 *resultat);
                   3526: 
                   3527: void f77additioncc_(complex16 *ca, complex16 *cb, complex16 *resultat);
                   3528: void f77additionci_(complex16 *ca, integer8 *ib, complex16 *resultat);
                   3529: void f77additioncr_(complex16 *ca, real8 *rb, complex16 *resultat);
                   3530: 
                   3531: void f77divisioncc_(complex16 *ca, complex16 *rb, complex16 *resultat);
                   3532: void f77divisionci_(complex16 *ca, integer8 *ib, complex16 *resultat);
                   3533: void f77divisioncr_(complex16 *ca, real8 *rb, complex16 *resultat);
                   3534: void f77divisionic_(integer8 *ib, complex16 *cb, complex16 *resultat);
                   3535: void f77divisionrc_(real8 *ra, complex16 *cb, complex16 *resultat);
                   3536: 
                   3537: void f77multiplicationcc_(complex16 *ca, complex16 *cb, complex16 *resultat);
                   3538: void f77multiplicationci_(complex16 *ca, integer8 *ib, complex16 *resultat);
                   3539: void f77multiplicationcr_(complex16 *ca, real8 *rb, complex16 *resultat);
                   3540: 
                   3541: void f77puissancecc_(complex16 *ca, complex16 *cb, complex16 *resultat);
1.181     bertrand 3542: void f77puissanceci_(complex16 *ca, integer8 *ib, complex16 *resultat);
1.1       bertrand 3543: void f77puissancecr_(complex16 *ca, real8 *rb, complex16 *resultat);
                   3544: void f77puissanceic_(integer8 *ia, complex16 *cb, complex16 *resultat);
                   3545: void f77puissanceii_(integer8 *ia, integer8 *ib, integer8 *resultat);
                   3546: void f77puissanceir_(integer8 *ia, real8 *rb, real8 *resultat);
                   3547: void f77puissancerc_(real8 *ra, complex16 *cb, complex16 *resultat);
1.181     bertrand 3548: void f77puissanceri_(real8 *ra, integer8 *ib, real8 *resultat);
1.1       bertrand 3549: void f77puissancerr_(real8 *ra, real8 *rb, real8 *resultat);
                   3550: 
                   3551: void f77racinecarreec_(complex16 *ca, complex16 *resultat);
                   3552: void f77racinecarreein_(integer8 *ia, complex16 *resultat);
                   3553: void f77racinecarreeip_(integer8 *ia, real8 *resultat);
                   3554: void f77racinecarreern_(real8 *ia, complex16 *resultat);
                   3555: void f77racinecarreerp_(real8 *ia, real8 *resultat);
                   3556: 
                   3557: void f77soustractioncc_(complex16 *ca, complex16 *cb, complex16 *resultat);
                   3558: void f77soustractionci_(complex16 *ca, integer8 *ib, complex16 *resultat);
                   3559: void f77soustractioncr_(complex16 *ca, real8 *rb, complex16 *resultat);
                   3560: void f77soustractionic_(integer8 *ib, complex16 *cb, complex16 *resultat);
                   3561: void f77soustractionrc_(real8 *ra, complex16 *cb, complex16 *resultat);
                   3562: 
                   3563: /*
                   3564: --------------------------------------------------------------------------------
1.177     bertrand 3565:   Trigonométrie complexe
1.1       bertrand 3566: --------------------------------------------------------------------------------
                   3567: */
                   3568: 
                   3569: void f77acos_(complex16 *argument, complex16 *resultat);
                   3570: void f77asin_(complex16 *argument, complex16 *resultat);
                   3571: void f77atan_(complex16 *argument, complex16 *resultat, integer4 *erreur);
                   3572: void f77cos_(complex16 *argument, complex16 *resultat);
                   3573: void f77sin_(complex16 *argument, complex16 *resultat);
                   3574: void f77tan_(complex16 *argument, complex16 *resultat, integer4 *erreur);
                   3575: 
                   3576: /*
                   3577: --------------------------------------------------------------------------------
                   3578:   Fonctions hyperboliques
                   3579: --------------------------------------------------------------------------------
                   3580: */
                   3581: 
                   3582: void f77acoshc_(complex16 *argument, complex16 *resultat);
                   3583: void f77alogc_(complex16 *argument, complex16 *resultat);
                   3584: void f77asinhc_(complex16 *argument, complex16 *resultat);
                   3585: void f77atanhc_(complex16 *argument, complex16 *resultat);
                   3586: void f77cosh_(complex16 *argument, complex16 *resultat);
                   3587: void f77expc_(complex16 *argument, complex16 *resultat);
                   3588: void f77lnc_(complex16 *argument, complex16 *resultat, integer4 *erreur);
                   3589: void f77lnin_(integer8 *argument, complex16 *resultat, integer4 *erreur);
                   3590: void f77lnrn_(real8 *argument, complex16 *resultat, integer4 *erreur);
                   3591: void f77logc_(complex16 *argument, complex16 *resultat, integer4 *erreur);
                   3592: void f77login_(integer8 *argument, complex16 *resultat, integer4 *erreur);
                   3593: void f77logrn_(real8 *argument, complex16 *resultat, integer4 *erreur);
                   3594: void f77sinh_(complex16 *argument, complex16 *resultat);
                   3595: void f77tanh_(complex16 *argument, complex16 *resultat, integer4 *erreur);
                   3596: void f77acoshi_(integer8 *argument, real8 *resultat);
                   3597: void f77acoshr_(real8 *argument, real8 *resultat);
                   3598: void f77asinhi_(integer8 *argument, real8 *resultat);
                   3599: void f77asinhr_(real8 *argument, real8 *resultat);
                   3600: void f77atanhi_(integer8 *argument, real8 *resultat);
                   3601: void f77atanhr_(real8 *argument, real8 *resultat);
                   3602: void f77lnip_(integer8 *argument, real8 *resultat, integer4 *erreur);
                   3603: void f77lnrp_(real8 *argument, real8 *resultat, integer4 *erreur);
                   3604: void f77logip_(integer8 *argument, real8 *resultat, integer4 *erreur);
                   3605: void f77logrp_(real8 *argument, real8 *resultat, integer4 *erreur);
                   3606: 
                   3607: /*
                   3608: --------------------------------------------------------------------------------
                   3609:   Calculs divers
                   3610: --------------------------------------------------------------------------------
                   3611: */
                   3612: 
                   3613: void f90arrangement(integer8 *n, integer8 *k, real8 *resultat);
                   3614: void f90combinaison(integer8 *n, integer8 *k, real8 *resultat);
                   3615: void f90fcd(real8 *x, integer8 *n1, integer8 *n2, real8 *resultat);
                   3616: void f90gausscd(real8 *x, real8 *moyenne, real8 *variance, real8 *resultat);
                   3617: void f90tcd(real8 *x, integer8 *n, real8 *resultat);
                   3618: void f90x2cd(real8 *x, integer8 *n, real8 *resultat);
                   3619: 
                   3620: // BEGIN C PROTOTYPES
                   3621: void dft(complex16 *dft, integer4 *nombre_lignes, integer4 *nombre_colonnes,
                   3622:        integer4 *inverse, integer4 *erreur);
                   3623: // END C PROTOTYPES
                   3624: 
                   3625: /*
                   3626: --------------------------------------------------------------------------------
                   3627:   Fonctions Lapack
                   3628: --------------------------------------------------------------------------------
                   3629: */
                   3630: 
                   3631:    /*
                   3632:     * Calcul de la longueur d'un espace de travail
                   3633:     */
                   3634: 
                   3635: #ifndef RPLARGS
                   3636: integer4 ilaenv_(integer4 *optimal, char *nom_fonction, char *option,
                   3637:        integer4 *n1, integer4 *n2, integer4 *n3, integer4 *n4,
                   3638:        integer4 longueur_nom_fonction, integer4 longueur_option);
                   3639: 
                   3640:    /*
                   3641:     * Inversion
                   3642:     */
                   3643: 
                   3644: void dgetri_(integer4 *ordre_a, real8 *a, integer4 *lda, integer4 *pivot,
                   3645:        real8 *work, integer4 *dim_work, integer4 *ios);
                   3646: void zgetri_(integer4 *ordre_a, complex16 *a, integer4 *lda, integer4 *pivot,
                   3647:        complex16 *work, integer4 *dim_work, integer4 *ios);
                   3648: 
                   3649:    /*
                   3650:     * Valeurs propres
                   3651:     */
                   3652: 
                   3653: void zgeev_(unsigned char *calcul_vp_gauches, unsigned char *calcul_vp_droits,
                   3654:        integer4 *dim_matrice1, complex16 *matrice_f77,
                   3655:        integer4 *dim_matrice2, complex16 *valeurs_propres,
                   3656:        complex16 *vpg_f77, integer4 *dim_matrice3,
                   3657:        complex16 *vpd_f77, integer4 *dim_matrice4,
                   3658:        complex16 *work, integer4 *lwork, real8 *rwork,
                   3659:        integer4 *erreur, integer4 longueur_1, integer4 longueur_2);
                   3660: 
                   3661:    /*
1.177     bertrand 3662:     * Valeurs propres généralisées
1.1       bertrand 3663:     */
                   3664: 
                   3665: void zggev_(unsigned char *calcul_vp_gauches, unsigned char *calcul_vp_droits,
                   3666:        integer4 *dim_matrice1, complex16 *matrice_f77,
                   3667:        integer4 *dim_matrice2, complex16 *metrique_f77,
                   3668:        integer4 *dim_matrice3, complex16 *alpha, complex16 *beta,
                   3669:        complex16 *vpg_f77, integer4 *dim_matrice4,
                   3670:        complex16 *vpd_f77, integer4 *dim_matrice5,
                   3671:        complex16 *work, integer4 *lwork, real8 *rwork,
                   3672:        integer4 *erreur, integer4 longueur_1, integer4 longueur_2);
                   3673: 
                   3674:    /*
1.177     bertrand 3675:     * Moindres carrés
1.1       bertrand 3676:     */
                   3677: 
                   3678: void dgelsd_(integer4 *nombre_lignes_a, integer4 *nombre_colonnes_a,
                   3679:        integer4 *nombre_colonnes_b, real8 *matrice_a, integer4 *lda,
                   3680:        real8 *matrice_b, integer4 *ldb, real8 *valeurs_singulieres,
                   3681:        real8 *rcond, integer4 *rank, real8 *work, integer4 *lwork,
                   3682:        integer4 *iwork, integer4 *info);
                   3683: void zgelsd_(integer4 *nombre_lignes_a, integer4 *nombre_colonnes_a,
                   3684:        integer4 *nombre_colonnes_b, complex16 *matrice_a, integer4 *lda,
                   3685:        complex16 *matrice_b, integer4 *ldb, real8 *valeurs_singulieres,
                   3686:        real8 *rcond, integer4 *rank, complex16 *work, integer4 *lwork,
                   3687:        real8 *rwork, integer4 *iwork, integer4 *info);
                   3688: 
                   3689:    /*
1.177     bertrand 3690:     * Moindres carrés généralisé
1.1       bertrand 3691:     */
                   3692: 
                   3693:    /*
1.177     bertrand 3694:     * Décomposition en valeurs singulières
1.1       bertrand 3695:     */
                   3696: 
                   3697: void dgesvd_(unsigned char *jobu, unsigned char *jobvh,
                   3698:        integer4 *m, integer4 *n, real8 *a, integer4 *lda,
                   3699:        real8 *s, real8 *u, integer4 *ldu, real8 *vh, integer4 *ldvh,
                   3700:        real8 *work, integer4 *lwork, integer4 *info, integer4 longueur_jobu,
                   3701:        integer4 longueur_jobvh);
                   3702: void zgesvd_(unsigned char *jobu, unsigned char *jobvh,
                   3703:        integer4 *m, integer4 *n, real8 *a, integer4 *lda,
                   3704:        real8 *s, real8 *u, integer4 *ldu, real8 *vh, integer4 *ldvh,
                   3705:        real8 *work, integer4 *lwork, real8 *rwork, integer4 *info,
                   3706:        integer4 longueur_jobu, integer4 longueur_jobvh);
                   3707: 
                   3708:    /*
                   3709:     * Factorisations diverses
                   3710:     */
                   3711: 
                   3712:        /* LU de Crout */
                   3713: void dgetrf_(integer4 *nb_lignes_a, integer4 *nb_colonnes_a, real8 *a,
                   3714:        integer4 *lda, integer4 *pivot, integer4 *ios);
                   3715: void zgetrf_(integer4 *nb_lignes_a, integer4 *nb_colonnes_a, complex16 *a,
                   3716:        integer4 *lda, integer4 *pivot, integer4 *ios);
                   3717: 
                   3718:        /* LQ */
                   3719: void dgelq2_(integer4 *nb_lignes_a, integer4 *nb_colonnes_a, real8 *a,
                   3720:        integer4 *lda, real8 *tau, real8 *work, integer4 *ios);
                   3721: void zgelq2_(integer4 *nb_lignes_a, integer4 *nb_colonnes_a, complex16 *a,
                   3722:        integer4 *lda, complex16 *tau, complex16 *work, integer4 *ios);
                   3723: 
                   3724:        /* QR */
                   3725: void dgeqp3_(integer4 *nb_lignes_a, integer4 *nb_colonnes_a, real8 *a,
                   3726:        integer4 *lda, integer4 *pivot, real8 *tau, real8 *work,
                   3727:        integer4 *lwork, integer4 *ios);
                   3728: void zgeqp3_(integer4 *nb_lignes_a, integer4 *nb_colonnes_a, complex16 *a,
                   3729:        integer4 *lda, integer4 *pivot, complex16 *tau, complex16 *work,
                   3730:        integer4 *lwork, real8 *rwork, integer4 *ios);
                   3731: 
                   3732:        /* Cholesky */
                   3733: void dpptrf_(unsigned char *mode, integer4 *n, complex16 *triangle,
                   3734:        integer4 *ios, integer4 longueur);
                   3735: void zpptrf_(unsigned char *mode, integer4 *n, complex16 *triangle,
                   3736:        integer4 *ios, integer4 longueur);
                   3737: 
                   3738:        /* Schur */
                   3739: void dgees_(unsigned char *calcul_vecteur, unsigned char *valeurs_triees,
                   3740:        logical4 (*fonction_tri)(), integer4 *n, real8 *a,
                   3741:        integer4 *lda, integer4 *sdim, real8 *wr, real8 *wi,
                   3742:        real8 *vs, integer4 *ldvs, real8 *work, integer4 *lwork,
                   3743:        logical4 *bwork, integer4 *info, integer4 l1, integer4 l2);
                   3744: void zgees_(unsigned char *calcul_vecteur, unsigned char *valeurs_triees,
                   3745:        logical4 (*fonction_tri)(), integer4 *n, complex16 *a,
                   3746:        integer4 *lda, integer4 *sdim, complex16 *w,
                   3747:        complex16 *vs, integer4 *ldvs, complex16 *work, integer4 *lwork,
                   3748:        real8 *rwork, logical4 *bwork, integer4 *info,
                   3749:        integer4 l1, integer4 l2);
                   3750: 
1.177     bertrand 3751:        /* Déterminant et rang */
1.1       bertrand 3752: void dgecon_(unsigned char *norm, integer4 *n, real8 *a, integer4 *lda,
                   3753:        real8 *anorm, real8 *rcond, real8 *work, integer4 *iwork,
                   3754:        integer4 *info, integer4 l1);
                   3755: void dgelsy_(integer4 *m, integer4 *n, integer4 *nrhs, real8 *a,
                   3756:        integer4 *lda, real8 *b, integer4 *ldb, integer4 *jpvt, real8 *rcond,
                   3757:        integer4 *rank, real8 *work, integer4 *lwork, integer4 *info);
                   3758: real8 dlange_(unsigned char *norme, integer4 *n, integer4 *m, real8 *a,
                   3759:        integer4 *lda, real8 *work, integer4 longueur);
                   3760: real8 zlange_(unsigned char *norme, integer4 *n, integer4 *m, real8 *a,
                   3761:        integer4 *lda, real8 *work, integer4 longueur);
                   3762: void zgecon_(unsigned char *norm, integer4 *n, complex16 *a, integer4 *lda,
                   3763:        real8 *anorm, real8 *rcond, complex16 *work, real8 *rwork,
                   3764:        integer4 *info, integer4 l1);
                   3765: void zgelsy_(integer4 *m, integer4 *n, integer4 *nrhs, complex16 *a,
                   3766:        integer4 *lda, complex16 *b, integer4 *ldb, integer4 *jpvt,
                   3767:        real8 *rcond, integer4 *rank, complex16 *work, integer4 *lwork,
                   3768:        real8 *rwork, integer4 *info);
                   3769: #endif
                   3770: 
                   3771: /*
1.177     bertrand 3772:  * Fonction testant la requête d'arrêt (nécessaire pour tester le
                   3773:  * drapeau depuis une bibliothèque).
1.1       bertrand 3774:  */
                   3775: 
1.34      bertrand 3776: int test_arret(struct_processus *s_etat_processus);
1.1       bertrand 3777: 
                   3778: #endif
                   3779: 
                   3780: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>