Annotation of rpl/src/rplexternals.h, revision 1.87

1.1       bertrand    1: /*
                      2: ================================================================================
1.73      bertrand    3:   RPL/2 (R) version 4.1.27
1.72      bertrand    4:   Copyright (C) 1989-2017 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: 
                     22: 
                     23: #ifndef INCLUSION_RPLARGS
                     24: #  define INCLUSION_RPLARGS
                     25: 
                     26: /*
                     27: ================================================================================
                     28:   INCLUSIONS
                     29: ================================================================================
                     30: */
                     31: 
1.74      bertrand   32: // Si TYPE_DECLARATION est défini, toutes les structures internes du RPL/2
                     33: // sont exposés pour travailler sur des nouveaux types de données.
                     34: #  ifndef TYPE_DECLARATION
                     35: #      define RPLARGS
                     36: #      define struct_processus void
                     37: #  endif
                     38: 
1.1       bertrand   39: #  include "rpl.h"
                     40: 
                     41: /*
                     42: ================================================================================
                     43:   MACROS SPECIFIQUES
                     44: ================================================================================
                     45: */
                     46: 
1.52      bertrand   47: #define __RPL__ struct_rpl_arguments *rpl_arguments; \
1.78      bertrand   48:    rpl_arguments = &__static_rpl_arguments; \
1.52      bertrand   49: 
1.47      bertrand   50: #define __CATCH_SYSTEM_ERROR__ \
                     51:        do { if (((*rpl_arguments).erreur != 0) && \
                     52:                ((*rpl_arguments).type_erreur == 'S')) \
                     53:            return 0; } while(0)
                     54: #define leave do { return(0); } while(0)
1.74      bertrand   55: #define _allocation(a) librpl_allocation((*rpl_arguments).s_etat_processus, a)
                     56: #define _copie_objet(a, b) librpl_copie_objet( \
1.8       bertrand   57:            (*rpl_arguments).s_etat_processus, a, b)
1.74      bertrand   58: #define _liberation(a) librpl_liberation((*rpl_arguments).s_etat_processus, a)
1.1       bertrand   59: 
1.52      bertrand   60: #ifdef __RPLC_MAIN
                     61:    struct_rpl_arguments __static_rpl_arguments;
1.78      bertrand   62:    void *__static_library_descriptor;
1.52      bertrand   63: #  define global
                     64: #  define initialize(a, b) a = b
1.58      bertrand   65: #  define declarePersistantObject(rpl_object) declareObject(rpl_object)
1.52      bertrand   66: #else
                     67:    extern struct_rpl_arguments __static_rpl_arguments;
1.78      bertrand   68:    extern void *__static_library_descriptor;
1.52      bertrand   69: #  define global extern
                     70: #  define initialize(a, b) a;
1.58      bertrand   71: #  define declarePersistantObject(rpl_object) extern struct_objet *rpl_object
1.52      bertrand   72: #endif
                     73: 
                     74: #define    empty int
                     75: 
1.1       bertrand   76: /*
                     77: --------------------------------------------------------------------------------
1.74      bertrand   78:   Gestion des objets
                     79: --------------------------------------------------------------------------------
                     80: */
                     81: 
                     82: // new, dup, drop, disp, parse
                     83: // __type_new(struct_rpl_arguments *rpl_arguments)
                     84: #define declareTypeExtension(fct) \
1.75      bertrand   85:        int __type_##fct(struct_processus *s_etat_processus, void **arg) { \
                     86:            char *rptr, *ptr, *iptr; \
                     87:            rptr = (char *) ((*s_etat_processus).definitions_chainees + \
                     88:                    (*s_etat_processus).position_courante); \
1.74      bertrand   89:            ptr = rptr; \
1.75      bertrand   90:            iptr = (char *) (*s_etat_processus).instruction_courante; \
                     91:            if ((ptr != rptr) && (iptr)) goto __parse_error;
1.74      bertrand   92: #define parseError { goto __parse_error; } while(0)
1.75      bertrand   93: #define typeError { return(0); } while(0)
1.77      bertrand   94: #define typeSystemError { (*s_etat_processus).erreur_systeme = \
                     95:        d_es_execution_bibliotheque; return(0); } while(0)
1.76      bertrand   96: #define typeSuccess { return(1); } while(0)
1.75      bertrand   97: #define typeFound(a) { return(a); } while(0)
1.74      bertrand   98: #define endTypeExtension __parse_error: return(0); }
                     99: #define sizeOfParse    (rptr - ptr)
1.76      bertrand  100: #define searchType(...) { recherche_type(s_etat_processus); \
1.75      bertrand  101:            if (((*s_etat_processus).erreur_execution != d_ex) || \
                    102:                    ((*s_etat_processus).erreur_systeme != d_es)) \
1.76      bertrand  103:                { __VA_ARGS__; return(0); } } while(0)
1.80      bertrand  104: #define structObject struct_objet
                    105: #define initializeObject(a, b) do { \
                    106:            (*a).descripteur_bibliotheque = (*b).descripteur_bibliotheque; \
                    107:            (*a).extension_type = (*b).extension_type; } while(0)
1.87    ! bertrand  108: #define objectContainer(type, a) ((type *) ((*a).objet))
        !           109: #define objectOf(a) ((*a).objet)
1.81      bertrand  110: #define ifIsExternal(a, b) if (((*a).type == EXT) && ((*a).extension_type == b))
                    111: #define elseIfIsExternal(a, b) } else if (((*a).type == EXT) && \
                    112:            ((*a).extension_type == b))
1.80      bertrand  113: #define    subType(a) ((*a).extension_type)
1.77      bertrand  114: #define integerFormat(a) formateur_nombre(s_etat_processus, a, 'I')
1.82      bertrand  115: #define procStatus(a) (*a).s_etat_processus
1.74      bertrand  116: 
                    117: /*
                    118: --------------------------------------------------------------------------------
1.1       bertrand  119:   Types
                    120: --------------------------------------------------------------------------------
                    121: */
                    122: 
1.58      bertrand  123: #define declareObject(rpl_object) struct_objet *rpl_object = NULL
1.1       bertrand  124: #define declareInteger(integer) integer8 integer
                    125: #define declareReal(real) real8 real
                    126: #define declareComplex(complex) complex16 complex
                    127: #define declareDaisyChain(daisyChain) struct_liste_chainee *daisyChain = NULL
                    128: 
1.47      bertrand  129: #define getDaisyChainFromList(list, daisyChain)    \
                    130:    __CATCH_SYSTEM_ERROR__; \
                    131:    do { \
1.1       bertrand  132:    typeof(list) __list = list; \
                    133:    daisyChain = NULL; \
                    134:    ifIsList(__list) { daisyChain = (*__list).objet; } \
                    135:    else executionError("Type mistmatch error"); } while(0)
                    136: 
                    137: #define fetchElementFromDaisyChain(daisyChain) \
1.47      bertrand  138:    ({ __CATCH_SYSTEM_ERROR__; typeof(daisyChain) __daisyChain = daisyChain; \
1.1       bertrand  139:    if (__daisyChain == NULL) executionError("End of daisy chain"); \
                    140:    (__daisyChain == NULL) ? NULL : (*__daisyChain).donnee; })
                    141: 
                    142: #define replaceElementIntoDaisyChain(daisyChain, element) \
1.47      bertrand  143:    __CATCH_SYSTEM_ERROR__; \
1.1       bertrand  144:    do { typeof(daisyChain) __daisyChain = daisyChain; \
                    145:    if (__daisyChain == NULL) executionError("Nullified daisy chain"); \
1.45      bertrand  146:    freeObject((*__daisyChain).donnee); \
1.1       bertrand  147:    (*__daisyChain).donnee = element; } while(0)
                    148: 
                    149: #define nextElementOfDaisyChain(daisyChain) \
1.47      bertrand  150:    ({ __CATCH_SYSTEM_ERROR__; typeof(daisyChain) __daisyChain = daisyChain; \
1.1       bertrand  151:    if (__daisyChain == NULL) executionError("End of daisy chain"); \
                    152:    (__daisyChain == NULL) ? NULL : (*__daisyChain).suivant; })
1.85      bertrand  153: 
1.86      bertrand  154: #define next       suivant
                    155: #define data       donnee
                    156: #define daisyChain struct_liste_chainee
1.1       bertrand  157:    
                    158: #define null NULL
1.47      bertrand  159: #define nullify(ptr) __CATCH_SYSTEM_ERROR__; do { ptr = NULL; } while(0)
1.1       bertrand  160: #define nullified(ptr) ((ptr) == NULL)
                    161: 
                    162: #define postIncr(x) (x++)
                    163: #define preIncr(x) (++x)
                    164: #define postDecr(x) (x--)
                    165: #define preDecr(x) (--x)
                    166: 
                    167: #define eq ==
                    168: #define ne !=
                    169: #define ge >=
                    170: #define gt >
                    171: #define le <=
                    172: #define lt <
                    173: #define not !
                    174: #define and &&
                    175: #define or ||
                    176: #define false 0
                    177: #define true -1
                    178: 
                    179: #define setFalse(a) a = false
                    180: #define setTrue(a) a = true
                    181: 
                    182: #define logical int
                    183: #define string char *
                    184: #define integer int
                    185: 
                    186: #define declareStructure typedef struct {
                    187: #define declareUnion typedef union {
                    188: #define as(name) } name;
                    189: 
1.80      bertrand  190: #define target(a) (*(a))
                    191: #define address(a) (&(a))
1.1       bertrand  192: 
1.65      bertrand  193: #define subroutine(name) int name()
1.47      bertrand  194: #define beginGroup { __CATCH_SYSTEM_ERROR__;
                    195: #define endGroup __CATCH_SYSTEM_ERROR__; }
1.46      bertrand  196: #define beginMacro do beginGroup
1.1       bertrand  197: #define endMacro endGroup while(0)
1.58      bertrand  198: #define stopRequest ({ __CATCH_SYSTEM_ERROR__; \
                    199:        test_arret((*rpl_arguments).s_etat_processus); })
1.1       bertrand  200: 
                    201: /*
                    202: --------------------------------------------------------------------------------
1.44      bertrand  203:   Signaux
                    204: --------------------------------------------------------------------------------*/
                    205: 
                    206: #define blockSignals \
1.47      bertrand  207:    { __CATCH_SYSTEM_ERROR__; sigset_t set, oldset; sigfillset(&set); \
1.44      bertrand  208:    pthread_sigmask(SIG_BLOCK, &set, &oldset);
                    209: #define unblockSignals \
1.47      bertrand  210:    pthread_sigmask(SIG_SETMASK, &oldset, NULL); __CATCH_SYSTEM_ERROR__; }
1.44      bertrand  211: 
                    212: /*
                    213: --------------------------------------------------------------------------------
1.1       bertrand  214:   Constructeurs
                    215: --------------------------------------------------------------------------------
                    216: */
                    217: 
1.31      bertrand  218: #define DISABLE_SET_BUT_NOT_USED_WARNING(a) if (&a != ((&a) + 1));
                    219: 
1.1       bertrand  220: #define HEADER \
                    221:    int             __constante; \
                    222:    logical1        __evaluation; \
                    223:    logical1        __validation_instruction = d_faux; \
                    224:    logical1        __presence_aide = d_faux; \
                    225:    logical1        __presence_validation = d_faux; \
                    226:    unsigned char   __indice_bit; \
                    227:    unsigned char   __indice_bloc; \
                    228:    unsigned char   __taille_bloc; \
                    229:    unsigned char   __type; \
                    230:    t_8_bits        __masque; \
1.85      bertrand  231:    void *s_etat_processus = (*rpl_arguments).s_etat_processus; \
                    232:    DISABLE_SET_BUT_NOT_USED_WARNING(s_etat_processus); \
1.1       bertrand  233:    { \
                    234:        (*rpl_arguments).instruction_valide = 'Y'; \
                    235:        (*rpl_arguments).erreur = 0; \
                    236:        __constante = 0; \
1.31      bertrand  237:        __evaluation = d_faux; \
                    238:        DISABLE_SET_BUT_NOT_USED_WARNING(__evaluation); \
                    239:        DISABLE_SET_BUT_NOT_USED_WARNING(__type); \
                    240:        DISABLE_SET_BUT_NOT_USED_WARNING(__indice_bit); \
                    241:        DISABLE_SET_BUT_NOT_USED_WARNING(__indice_bloc); \
                    242:        DISABLE_SET_BUT_NOT_USED_WARNING(__taille_bloc); \
                    243:        DISABLE_SET_BUT_NOT_USED_WARNING(__masque);
1.1       bertrand  244: 
                    245: #define FUNCTION \
1.47      bertrand  246:    if (__validation_instruction == d_vrai) return 0; \
1.1       bertrand  247:    if (__presence_aide == d_faux) \
                    248:    { \
                    249:        systemError("Help string not defined"); \
                    250:    } \
                    251:    else if (__presence_validation == d_faux) \
                    252:    { \
                    253:        systemError("Number of arguments not defined"); \
                    254:    } \
                    255:    __indice_bit = 0; \
                    256:    __indice_bloc = 0; \
                    257:    __taille_bloc = 0; \
                    258:    __type = 0; \
                    259:    __masque = 0; \
                    260:    {
                    261: 
                    262: #define END \
                    263:        strcpy((char *) __function_name, ""); \
                    264:        if (__constante != 0) \
                    265:            systemError("Constant definition error"); \
1.47      bertrand  266:        __CATCH_SYSTEM_ERROR__; \
1.1       bertrand  267:    } } \
1.47      bertrand  268:    leave;
1.1       bertrand  269: 
                    270: /*
                    271: --------------------------------------------------------------------------------
1.45      bertrand  272:   Destruction d'un objet
                    273: --------------------------------------------------------------------------------
                    274: */
                    275: 
1.58      bertrand  276: #define freeObject(rpl_object) \
1.47      bertrand  277:    __CATCH_SYSTEM_ERROR__; \
1.46      bertrand  278:    do { \
1.58      bertrand  279:        if (rpl_object == NULL) \
1.45      bertrand  280:            systemError("Nullified object"); \
1.74      bertrand  281:        _liberation(rpl_object); \
1.58      bertrand  282:        rpl_object = NULL; \
1.45      bertrand  283:    } while(0)
                    284: 
                    285: /*
                    286: --------------------------------------------------------------------------------
                    287:   Copie d'un objet
                    288: --------------------------------------------------------------------------------
                    289: */
                    290: 
1.58      bertrand  291: #define dupObject(rpl_object) \
1.47      bertrand  292:    __CATCH_SYSTEM_ERROR__; \
1.74      bertrand  293:    do { if (_copie_objet(rpl_object, 'P') != rpl_object) \
1.45      bertrand  294:        systemError("Memory allocation error"); } while(0)
                    295: 
                    296: /*
                    297: --------------------------------------------------------------------------------
                    298:   Déclaration des fonctions internes
                    299: --------------------------------------------------------------------------------
                    300: */
                    301: 
1.74      bertrand  302: #define CONCAT(a, b) __RPL_CONCAT(a, b)
                    303: #define __RPL_CONCAT(a, b) a##b
1.51      bertrand  304: #define FIRST(...) FIRST_HELPER(__VA_ARGS__, throwaway)
                    305: #define FIRST_HELPER(first, ...) first
                    306: #define REST(...) REST_HELPER(NUM(__VA_ARGS__), __VA_ARGS__)
                    307: #define REST_HELPER(qty, ...) REST_HELPER2(qty, __VA_ARGS__)
                    308: #define REST_HELPER2(qty, ...) REST_HELPER_##qty(__VA_ARGS__)
                    309: #define REST_HELPER_ONE(first)
                    310: #define REST_HELPER_TWOORMORE(first, ...) , __VA_ARGS__
                    311: #define NUM(...) \
                    312:        SELECT_10TH(__VA_ARGS__, TWOORMORE, TWOORMORE, TWOORMORE, TWOORMORE,\
                    313:        TWOORMORE, TWOORMORE, TWOORMORE, TWOORMORE, ONE, throwaway)
                    314: #define SELECT_10TH(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, ...) a10
                    315: 
                    316: #define declareInternalFunction(type, ...) \
                    317:    type CONCAT(__internal_, FIRST(__VA_ARGS__)) \
                    318:            (struct_rpl_arguments *rpl_arguments REST(__VA_ARGS__)) { \
                    319:    type __internal_return; __internal_return = 0; int __type; \
                    320:    DISABLE_SET_BUT_NOT_USED_WARNING(__type);
                    321: 
                    322: #define endInternalFunction return(__internal_return); }
                    323: 
                    324: #define useInternalFunction(type, ...) \
                    325:    type CONCAT(__internal_, FIRST(__VA_ARGS__)) \
                    326:            (struct_rpl_arguments *rpl_arguments REST(__VA_ARGS__))
1.45      bertrand  327: 
1.51      bertrand  328: #define callInternalFunction(...) \
                    329:    CONCAT(__internal_, FIRST(__VA_ARGS__))(rpl_arguments REST(__VA_ARGS__))
1.45      bertrand  330: 
                    331: /*
                    332: --------------------------------------------------------------------------------
1.47      bertrand  333:   Déclaration des fonctions C
                    334: --------------------------------------------------------------------------------
                    335: */
                    336: 
                    337: #define declareCFunction(type, name, ...) \
1.51      bertrand  338:        type name(__VA_ARGS__) { __RPL__ type __c_return;
                    339: #define endCFunction return(__c_return); }
1.47      bertrand  340: 
1.52      bertrand  341: #define useCFunction(type, name, ...) type name(__VA_ARGS__)
                    342: 
1.47      bertrand  343: /*
                    344: --------------------------------------------------------------------------------
1.1       bertrand  345:   Déclaration des fonctions externes
                    346: --------------------------------------------------------------------------------
                    347: */
                    348: 
                    349: #define declareExternalFunction(name) \
1.47      bertrand  350:    int __external_##name(struct_rpl_arguments *rpl_arguments) { \
1.45      bertrand  351:    char __function_name[] = "__external_"#name; \
                    352:    __static_rpl_arguments = (*rpl_arguments);
1.1       bertrand  353: 
                    354: #define useExternalFunction(function) \
1.47      bertrand  355:    int __external_##function(struct_rpl_arguments *rpl_arguments)
1.1       bertrand  356: 
                    357: #define libraryName(name) char __library_name[] = #name;
                    358: 
1.78      bertrand  359: #define __onLoading int __runOnLoading(struct_rpl_arguments *rpl_arguments, \
                    360:        void *descriptor)
                    361: #define __onClosing int __runOnClosing(struct_rpl_arguments *rpl_arguments, \
                    362:        void *descriptor)
1.1       bertrand  363: #define declareSubroutine(when) __##when { \
                    364:    char __function_name[] = #when; \
1.45      bertrand  365:    __static_rpl_arguments = (*rpl_arguments); \
1.78      bertrand  366:    __static_library_descriptor = descriptor; \
1.1       bertrand  367:    HEADER \
                    368:        declareHelpString(""); \
                    369:        numberOfArguments(0); \
                    370:    FUNCTION
                    371: #define endSubroutine END }
                    372: 
1.47      bertrand  373: #define notice(s, ...) __CATCH_SYSTEM_ERROR__; \
1.84      bertrand  374:        do { ufprintf(s, __VA_ARGS__); fflush(s); } while(0)
1.47      bertrand  375: #define logger(...) __CATCH_SYSTEM_ERROR__; \
                    376:        do { syslog(LOG_NOTICE, __VA_ARGS__); } while(0) 
1.1       bertrand  377: 
                    378: #define exportExternalFunctions(...) \
1.77      bertrand  379:    char **___external_symbols(struct_rpl_arguments *rpl_arguments, \
1.47      bertrand  380:            integer8 *nb_symbols, \
1.10      bertrand  381:            const char *version) { \
1.1       bertrand  382:        char arguments[] = #__VA_ARGS__; \
                    383:        char **tableau; \
                    384:        char *ptr1, *ptr2; \
                    385:        int drapeau; \
                    386:        unsigned long i; \
1.65      bertrand  387:        struct_processus *s_etat_processus; \
                    388:        s_etat_processus = (*rpl_arguments).s_etat_processus; \
1.10      bertrand  389:        if (strcmp(version, _d_version_rpl) != 0) \
                    390:        { \
1.15      bertrand  391:            notice(stdout, "Versions mismatch : library %s, expected %s\n", \
                    392:                    _d_version_rpl, version); \
1.10      bertrand  393:            (*nb_symbols) = -1; return(NULL); \
                    394:        } \
1.1       bertrand  395:        (*nb_symbols) = 0; ptr1 = arguments; drapeau = 0; \
                    396:        while((*ptr1) != 0) \
                    397:        { \
                    398:            if (((*ptr1) != ',') && ((*ptr1) != ' ')) drapeau = -1; \
                    399:            ptr1++; \
                    400:        } \
                    401:        if (drapeau == 0) return(NULL); \
                    402:        ptr1 = arguments; (*nb_symbols) = 1; \
                    403:        while((*ptr1) != 0) if ((*ptr1++) == ',') (*nb_symbols)++; \
                    404:        if ((tableau = malloc((*nb_symbols) * sizeof(char *))) == NULL) \
                    405:            return(NULL); \
                    406:        ptr2 = arguments; i = 0; \
                    407:        while(*ptr2 != 0) \
                    408:        { \
                    409:            while(((*ptr2) == ' ') || ((*ptr2) == ',')) ptr2++; \
                    410:            ptr1 = ptr2; \
                    411:            while(((*ptr2) != 0) && ((*ptr2) != ',') && ((*ptr2) != ' ')) \
                    412:                    ptr2++; \
                    413:            if ((tableau[i] = malloc((ptr2 + 2 + \
                    414:                    strlen(__library_name) - ptr1) * \
                    415:                    sizeof(unsigned char))) == NULL) \
                    416:                return(NULL); \
                    417:            sprintf(tableau[i], "%s$", __library_name); \
                    418:            strncat(&tableau[i][strlen(tableau[i])], ptr1, ptr2 - ptr1); \
                    419:            i++; \
                    420:            if ((*ptr2) != 0) \
                    421:            { \
                    422:                while((*ptr2) == ' ') ptr2++; \
                    423:                if ((*ptr2) == ',') ptr2++; \
                    424:            } \
                    425:        } \
                    426:        (*nb_symbols) = i; \
                    427:        return(tableau); \
                    428:    }
                    429: 
1.47      bertrand  430: #define endExternalFunction leave; }
1.1       bertrand  431: 
1.46      bertrand  432: #define callExternalFunction(function) do { \
1.47      bertrand  433:    __CATCH_SYSTEM_ERROR__; \
1.1       bertrand  434:    __taille_bloc = sizeof(t_8_bits) * 8; \
                    435:    __indice_bloc = (35 - 1) / __taille_bloc; \
                    436:    __indice_bit = (35 - 1) % __taille_bloc; \
                    437:    __masque = ((t_8_bits) 1) << (__taille_bloc - __indice_bit - 1); \
                    438:    __evaluation = ((*rpl_arguments).drapeaux_etat[__indice_bloc] & __masque) \
                    439:            ? d_vrai : d_faux; \
                    440:    __masque = ~(((t_8_bits) 1) << (__taille_bloc - __indice_bit - 1)); \
                    441:    (*rpl_arguments).drapeaux_etat[__indice_bloc] &= __masque; \
                    442:    __external_##function(rpl_arguments); \
                    443:    if (__evaluation == d_vrai) \
                    444:    { \
                    445:        __masque = ((t_8_bits) 1) << (__taille_bloc - __indice_bit - 1); \
                    446:        (*rpl_arguments).drapeaux_etat[__indice_bloc] |= __masque; \
                    447:    } \
                    448:    else \
                    449:    { \
                    450:        __masque = ~(((t_8_bits) 1) << (__taille_bloc - __indice_bit - 1)); \
                    451:        (*rpl_arguments).drapeaux_etat[__indice_bloc] &= __masque; \
                    452:    } } while(0)
                    453: 
                    454: /*
                    455: --------------------------------------------------------------------------------
                    456:   Macros spécifiques à l'en-tête
                    457: --------------------------------------------------------------------------------
                    458: */
                    459: 
1.46      bertrand  460: #define declareHelpString(h) do { \
1.1       bertrand  461:    __presence_aide = d_vrai; \
                    462:    if ((*rpl_arguments).affichage_arguments == 'Y') \
                    463:    { \
                    464:        uprintf("%s\n", h); \
1.47      bertrand  465:        return 0; \
1.1       bertrand  466:    } } while(0)
                    467: 
1.46      bertrand  468: #define declareSymbolicConstant do { \
1.1       bertrand  469:    numberOfArguments(0); \
                    470:    (*rpl_arguments).constante_symbolique = 'Y'; \
                    471:    __constante++; } while(0)
                    472: 
1.46      bertrand  473: #define numberOfArguments(n) do { \
1.1       bertrand  474:    __presence_validation = d_vrai; \
                    475:    if ((*rpl_arguments).test_instruction == 'Y') \
                    476:    { \
                    477:        if (n < 0) \
                    478:            systemError("Number of arguments must be positive or null"); \
                    479:        (*rpl_arguments).nombre_arguments = n; \
                    480:        __validation_instruction = d_vrai; \
                    481:    } \
                    482:    else \
                    483:    { \
                    484:        __taille_bloc = sizeof(t_8_bits) * 8; \
                    485:        __indice_bloc = (31 - 1) / __taille_bloc; \
                    486:        __indice_bit = (31 - 1) % __taille_bloc; \
                    487:        __masque = ((t_8_bits) 1) << (__taille_bloc - __indice_bit - 1); \
                    488:        if (((*rpl_arguments).drapeaux_etat[__indice_bloc] & __masque) != 0) \
                    489:        { \
                    490:            (*rpl_arguments).l_base_pile_last = \
                    491:                    sauvegarde_arguments(rpl_arguments, n); \
                    492:        } \
                    493:    } } while(0)
                    494: 
                    495: /*
                    496: --------------------------------------------------------------------------------
                    497:   Gestion des boucles
                    498: --------------------------------------------------------------------------------
                    499: */
                    500: 
                    501: #define loop(b, e, s) for(b; e; s) {
1.47      bertrand  502: #define endLoop __CATCH_SYSTEM_ERROR__; }
1.1       bertrand  503: 
                    504: #define repeatWhile(c) while(c) {
1.47      bertrand  505: #define endWhile __CATCH_SYSTEM_ERROR__; }
1.1       bertrand  506: 
                    507: #define doUntil do {
1.47      bertrand  508: #define repeatUntil(c) __CATCH_SYSTEM_ERROR__; } while(!(c));
1.1       bertrand  509: 
                    510: #define select(s) switch(s) {
1.47      bertrand  511: #define endSelect __CATCH_SYSTEM_ERROR__; }
1.1       bertrand  512: #define nonExclusiveCase(c) case c: {
1.47      bertrand  513: #define endNonExclusiveCase __CATCH_SYSTEM_ERROR__; }
1.1       bertrand  514: #define exclusiveCase(c) case c: {
1.47      bertrand  515: #define endExclusiveCase break; __CATCH_SYSTEM_ERROR__; }
1.1       bertrand  516: #define defaultCase default:
1.47      bertrand  517: #define endDefaultCase break; __CATCH_SYSTEM_ERROR__; }
1.1       bertrand  518: 
                    519: /*
                    520: --------------------------------------------------------------------------------
                    521:   Gestion des erreurs
                    522: --------------------------------------------------------------------------------
                    523: */
                    524: 
1.46      bertrand  525: #define returnOnError(...) do { \
1.1       bertrand  526:    if ((*rpl_arguments).erreur != 0) \
                    527:    { \
                    528:        __VA_ARGS__; \
1.47      bertrand  529:        return 0; \
1.1       bertrand  530:    } } while(0)
                    531: 
1.46      bertrand  532: #define systemError(message) do { \
1.1       bertrand  533:    (*rpl_arguments).erreur = __LINE__; \
                    534:    (*rpl_arguments).type_erreur = 'S'; \
                    535:    (*rpl_arguments).message_erreur = (unsigned char *) message; \
1.47      bertrand  536:    return 0; } while(0)
1.1       bertrand  537: 
1.46      bertrand  538: #define executionError(message) do { \
1.1       bertrand  539:    (*rpl_arguments).erreur = __LINE__; \
                    540:    (*rpl_arguments).type_erreur = 'E'; \
                    541:    (*rpl_arguments).message_erreur = (unsigned char *) message; } while(0)
                    542: 
1.46      bertrand  543: #define onSystemError(...) do { \
1.47      bertrand  544:    if (((*rpl_arguments).erreur != 0) && \
                    545:            ((*rpl_arguments).type_erreur == 'S')) \
1.45      bertrand  546:    { \
                    547:        blockSignals; \
                    548:            kill(getpid(), SIGTERM); \
                    549:        unblockSignals; \
1.47      bertrand  550:        __VA_ARGS__; \
1.45      bertrand  551:    } } while(0)
                    552: 
1.1       bertrand  553: #define onError(...) \
1.47      bertrand  554:    __CATCH_SYSTEM_ERROR__; \
1.1       bertrand  555:    do { if (((*rpl_arguments).type_erreur == 'E') && \
                    556:            ((*rpl_arguments).erreur != 0)) { __VA_ARGS__; \
                    557:            (*rpl_arguments).erreur = 0; } } while(0)
                    558: 
                    559: #define onExecution(...) \
1.47      bertrand  560:    __CATCH_SYSTEM_ERROR__; \
1.1       bertrand  561:    do { if (((*rpl_arguments).type_erreur == 'E') && \
                    562:            ((*rpl_arguments).erreur == 0)) { __VA_ARGS__; } } while(0)
                    563: 
                    564: /*
                    565: --------------------------------------------------------------------------------
                    566:   Gestion de la pile opérationnelle
                    567: --------------------------------------------------------------------------------
                    568: */
                    569: 
1.58      bertrand  570: #define pushOnStack(rpl_object) do { \
1.47      bertrand  571:    __CATCH_SYSTEM_ERROR__; \
1.1       bertrand  572:    if (((*rpl_arguments).l_base_pile = \
1.58      bertrand  573:            empilement_pile_operationnelle(rpl_arguments, rpl_object)) \
                    574:                    == NULL) \
1.1       bertrand  575:        systemError("Memory allocation error"); \
1.58      bertrand  576:    if ((*rpl_object).nombre_occurrences == 1) rpl_object = NULL; } while(0)
1.1       bertrand  577: 
1.58      bertrand  578: #define pullFromStack(rpl_object, ...) do { \
1.47      bertrand  579:    __CATCH_SYSTEM_ERROR__; \
1.1       bertrand  580:    (*rpl_arguments).l_base_pile = \
1.58      bertrand  581:            depilement_pile_operationnelle(rpl_arguments, &rpl_object); \
                    582:    if (rpl_object == NULL) \
1.1       bertrand  583:    { \
                    584:        executionError("Too few arguments"); \
                    585:    } \
                    586:    else \
                    587:    { \
                    588:        if (strlen(#__VA_ARGS__) == 0) \
                    589:        { \
                    590:            systemError("Undefined type"); \
                    591:        } \
                    592:        else \
                    593:        { \
                    594:            __type = 0; \
                    595:            if (strstr(#__VA_ARGS__, "integer") != NULL) \
1.58      bertrand  596:                if ((*rpl_object).type == INT) __type = 1; \
1.1       bertrand  597:            if (strstr(#__VA_ARGS__, "real") != NULL) \
1.58      bertrand  598:                if ((*rpl_object).type == REL) __type = 1; \
1.1       bertrand  599:            if (strstr(#__VA_ARGS__, "complex") != NULL) \
1.58      bertrand  600:                if ((*rpl_object).type == CPL) __type = 1; \
1.1       bertrand  601:            if (strstr(#__VA_ARGS__, "string") != NULL) \
1.58      bertrand  602:                if ((*rpl_object).type == CHN) __type = 1; \
1.1       bertrand  603:            if (strstr(#__VA_ARGS__, "list") != NULL) \
1.58      bertrand  604:                if ((*rpl_object).type == LST) __type = 1; \
1.78      bertrand  605:            if (strstr(#__VA_ARGS__, "external") != NULL) \
                    606:                if ((*rpl_object).type == EXT) { \
                    607:                    if ((*rpl_object).descripteur_bibliotheque == \
                    608:                            __static_library_descriptor) __type = 1; }\
1.1       bertrand  609:            if (strstr(#__VA_ARGS__, "unknown") != NULL) \
                    610:                __type = 1; \
                    611:            if (__type == 0) \
                    612:            { \
                    613:                executionError("Type not allowed"); \
                    614:            } \
                    615:        } \
                    616:    } } while(0)
                    617: 
1.78      bertrand  618: #define objectSubtype(a) (*a).extension_type
                    619: 
1.1       bertrand  620: /*
                    621: --------------------------------------------------------------------------------
                    622:   Gestion des objets
                    623: --------------------------------------------------------------------------------
                    624: */
                    625: 
                    626: #define then {
1.47      bertrand  627: #define endIf __CATCH_SYSTEM_ERROR__; }
                    628: #define elseIf __CATCH_SYSTEM_ERROR__; } else if
                    629: #define orElse __CATCH_SYSTEM_ERROR__; } else {
1.1       bertrand  630: 
                    631: // Constantes symboliques
                    632: 
1.58      bertrand  633: #define createSymbolicConstant(rpl_object, type, value) do { \
1.65      bertrand  634:    struct_processus *s_etat_processus; \
                    635:    s_etat_processus = (*rpl_arguments).s_etat_processus; \
1.1       bertrand  636:    if ((strcmp(#type, "integer") != 0) && (strcmp(#type, "real") != 0)) \
                    637:        systemError("Type not allowed for symbolic constant"); \
                    638:    __taille_bloc = sizeof(t_8_bits) * 8; \
                    639:    __indice_bloc = (35 - 1) / __taille_bloc; \
                    640:    __indice_bit = (35 - 1) % __taille_bloc; \
                    641:    __masque = ((t_8_bits) 1) << (__taille_bloc - __indice_bit - 1); \
                    642:    if (((*rpl_arguments).drapeaux_etat[__indice_bloc] & __masque) != 0) \
                    643:    { \
1.58      bertrand  644:        createNameObject(rpl_object); \
1.47      bertrand  645:        __CATCH_SYSTEM_ERROR__; \
1.1       bertrand  646:        { \
                    647:            char *__constant_name; \
                    648:            if ((__constant_name = malloc((strlen(__library_name) + \
                    649:                    strlen(__function_name) - 9) * sizeof(char))) == NULL) \
                    650:                systemError("Memory allocation error"); \
                    651:            sprintf(__constant_name, "%s$%s", __library_name, \
                    652:                    &(__function_name[11])); \
1.58      bertrand  653:            setName(rpl_object, __constant_name); \
1.1       bertrand  654:            free(__constant_name); \
                    655:        } \
                    656:    } \
                    657:    else \
                    658:    { \
                    659:        if (strcmp(#type, "integer") == 0) \
                    660:        { \
1.58      bertrand  661:            createIntegerObject(rpl_object); \
1.47      bertrand  662:            __CATCH_SYSTEM_ERROR__; \
1.58      bertrand  663:            setInteger(rpl_object, value); \
1.1       bertrand  664:        } \
                    665:        else if (strcmp(#type, "real") == 0) \
                    666:        { \
1.58      bertrand  667:            createRealObject(rpl_object); \
1.47      bertrand  668:            __CATCH_SYSTEM_ERROR__; \
1.58      bertrand  669:            setReal(rpl_object, value); \
1.1       bertrand  670:        } \
                    671:    } \
1.47      bertrand  672:    __CATCH_SYSTEM_ERROR__; \
1.1       bertrand  673:    __constante--; } while(0)
                    674: 
1.58      bertrand  675: #define createSymbolicComplexConstant(rpl_object, rp, ip) do { \
1.65      bertrand  676:    struct_processus *s_etat_processus; \
                    677:    s_etat_processus = (*rpl_arguments).s_etat_processus; \
1.1       bertrand  678:    __taille_bloc = sizeof(t_8_bits) * 8; \
                    679:    __indice_bloc = (35 - 1) / __taille_bloc; \
                    680:    __indice_bit = (35 - 1) % __taille_bloc; \
                    681:    __masque = ((t_8_bits) 1) << (__taille_bloc - __indice_bit - 1); \
                    682:    if (((*rpl_arguments).drapeaux_etat[__indice_bloc] & __masque) != 0) \
                    683:    { \
1.58      bertrand  684:        createNameObject(rpl_object); \
1.47      bertrand  685:        __CATCH_SYSTEM_ERROR__; \
1.1       bertrand  686:        { \
                    687:            char *__constant_name; \
                    688:            if ((__constant_name = malloc((strlen(__library_name) + \
                    689:                    strlen(__function_name) + 2) * sizeof(char))) == NULL) \
                    690:                systemError("Memory allocation error"); \
                    691:            sprintf(__constant_name, "%s$%s", __library_name, \
                    692:                    __function_name); \
1.58      bertrand  693:            setName(rpl_object, __constant_name); \
1.1       bertrand  694:            free(__constant_name); \
                    695:        } \
                    696:    } \
                    697:    else \
                    698:    { \
1.58      bertrand  699:        createComplexObject(rpl_object); \
1.47      bertrand  700:        __CATCH_SYSTEM_ERROR__; \
1.58      bertrand  701:        setComplex(rpl_object, rp, im); \
1.1       bertrand  702:    } \
1.47      bertrand  703:    __CATCH_SYSTEM_ERROR__; \
1.1       bertrand  704:    __constante--; } while(0)
                    705: 
                    706: // Integer
                    707: 
1.58      bertrand  708: #define setInteger(rpl_object, value) do { \
                    709:    ifIsInteger(rpl_object) \
1.1       bertrand  710:    { \
1.58      bertrand  711:        if ((*rpl_object).nombre_occurrences > 1) \
1.1       bertrand  712:        { \
1.58      bertrand  713:            struct_objet *__tmp_rpl_object; \
1.74      bertrand  714:            if ((__tmp_rpl_object = _copie_objet(rpl_object, 'O')) == NULL) \
1.1       bertrand  715:                systemError("Memory allocation error"); \
1.74      bertrand  716:            _liberation(rpl_object); \
1.58      bertrand  717:            rpl_object = __tmp_rpl_object; \
1.1       bertrand  718:        } \
1.58      bertrand  719:        (*((integer8 *) (*rpl_object).objet)) = (integer8) value; \
1.1       bertrand  720:    } \
                    721:    else executionError("Type mistmatch error"); } while(0)
                    722: 
1.58      bertrand  723: #define isInteger(rpl_object) \
                    724:    ((*rpl_object).type == INT)
1.1       bertrand  725: 
1.58      bertrand  726: #define ifIsInteger(rpl_object) if (isInteger(rpl_object))
                    727: #define elseIfIsInteger(rpl_object) } else ifIsInteger(rpl_object)
1.1       bertrand  728: 
1.58      bertrand  729: #define getInteger(rpl_object, value) do { \
1.1       bertrand  730:    value = 0; \
1.58      bertrand  731:    ifIsInteger(rpl_object) value = (*((integer8 *) (*rpl_object).objet)); \
1.1       bertrand  732:    else executionError("Type mismatch error"); } while(0)
                    733: 
1.58      bertrand  734: #define createIntegerObject(rpl_object) do { \
                    735:    if (rpl_object != NULL) \
1.1       bertrand  736:        systemError("Reallocated object"); \
1.74      bertrand  737:    if ((rpl_object = _allocation(INT)) == NULL) \
1.1       bertrand  738:        systemError("Memory allocation error"); \
1.58      bertrand  739:    setInteger(rpl_object, 0); } while(0)
1.1       bertrand  740: 
                    741: // Real
                    742: 
1.58      bertrand  743: #define setReal(rpl_object, value) do { \
                    744:    ifIsReal(rpl_object) \
1.1       bertrand  745:    { \
1.58      bertrand  746:        if ((*rpl_object).nombre_occurrences > 1) \
1.1       bertrand  747:        { \
1.58      bertrand  748:            struct_objet *__tmp_rpl_object; \
1.74      bertrand  749:            if ((__tmp_rpl_object = _copie_objet(rpl_object, 'O')) == NULL) \
1.1       bertrand  750:                systemError("Memory allocation error"); \
1.74      bertrand  751:            _liberation(rpl_object); \
1.58      bertrand  752:            rpl_object = __tmp_rpl_object; \
1.1       bertrand  753:        } \
1.58      bertrand  754:        (*((real8 *) (*rpl_object).objet)) = (real8) value; \
1.1       bertrand  755:    } \
                    756:    else executionError("Type mistmatch error"); } while(0)
                    757: 
1.58      bertrand  758: #define isReal(rpl_object) \
                    759:    ((*rpl_object).type == REL)
1.1       bertrand  760: 
1.58      bertrand  761: #define ifIsReal(rpl_object) if (isReal(rpl_object))
                    762: #define elseIfIsReal(rpl_object) } else ifIsReal(rpl_object)
1.1       bertrand  763: 
1.58      bertrand  764: #define getReal(rpl_object, value) do { \
1.1       bertrand  765:    value = 0; \
1.58      bertrand  766:    ifIsReal(rpl_object) value = (*((real8 *) (*rpl_object).objet)); \
1.1       bertrand  767:    else executionError("Type mismatch error"); } while(0)
                    768: 
1.58      bertrand  769: #define createRealObject(rpl_object) do { \
                    770:    if (rpl_object != NULL) \
1.1       bertrand  771:        systemError("Reallocated object"); \
1.74      bertrand  772:    if ((rpl_object = _allocation(REL)) == NULL) \
1.1       bertrand  773:        systemError("Memory allocation error"); \
1.58      bertrand  774:    setReal(rpl_object, 0); } while(0)
1.1       bertrand  775: 
                    776: // Complex
                    777: 
1.58      bertrand  778: #define setComplex(rpl_object, rp, ip) do { \
1.1       bertrand  779:    typeof(rp) __rp = rp; \
                    780:    typeof(ip) __ip = ip; \
1.58      bertrand  781:    ifIsComplex(rpl_object) \
1.1       bertrand  782:    { \
1.58      bertrand  783:        if ((*rpl_object).nombre_occurrences > 1) \
1.1       bertrand  784:        { \
1.58      bertrand  785:            struct_objet *__tmp_rpl_object; \
1.74      bertrand  786:            if ((__tmp_rpl_object = _copie_objet(rpl_object, 'O')) == NULL) \
1.1       bertrand  787:                systemError("Memory allocation error"); \
1.74      bertrand  788:            _liberation(rpl_object); \
1.58      bertrand  789:            rpl_object = __tmp_rpl_object; \
1.1       bertrand  790:        } \
1.58      bertrand  791:        setRealPartOfComplex(rpl_object, __rp); \
                    792:        setImaginaryPartOfComplex(rpl_object, __ip); \
1.1       bertrand  793:    } \
                    794:    else executionError("Type mismatch error"); } while(0)
                    795: 
1.58      bertrand  796: #define setRealPartOfComplex(rpl_object, value) do { \
                    797:    if ((*rpl_object).nombre_occurrences > 1) \
1.1       bertrand  798:    { \
1.58      bertrand  799:        struct_objet *__tmp_rpl_object; \
1.74      bertrand  800:        if ((__tmp_rpl_object = _copie_objet(rpl_object, 'O')) == NULL) \
1.1       bertrand  801:            systemError("Memory allocation error"); \
1.74      bertrand  802:        _liberation(rpl_object); \
1.58      bertrand  803:        rpl_object = __tmp_rpl_object; \
1.1       bertrand  804:    } \
1.58      bertrand  805:    ifIsComplex(rpl_object) (*((complex16 *) (*rpl_object).objet)) \
                    806:            .partie_reelle = value; \
1.1       bertrand  807:    else executionError("Type mismatch error"); } while(0)
                    808: 
1.58      bertrand  809: #define setImaginaryPartOfComplex(rpl_object, value) do { \
                    810:    if ((*rpl_object).nombre_occurrences > 1) \
1.1       bertrand  811:    { \
1.58      bertrand  812:        struct_objet *__tmp_rpl_object; \
1.74      bertrand  813:        if ((__tmp_rpl_object = _copie_objet(rpl_object, 'O')) == NULL) \
1.1       bertrand  814:            systemError("Memory allocation error"); \
1.74      bertrand  815:        _liberation(rpl_object); \
1.58      bertrand  816:        rpl_object = __tmp_rpl_object; \
1.1       bertrand  817:    } \
1.58      bertrand  818:    (*((complex16 *) (*rpl_object).objet)).partie_imaginaire = value; \
1.1       bertrand  819:    else executionError("Type mismatch error"); } while(0)
                    820: 
1.58      bertrand  821: #define getRealPartOfComplex(rpl_object, value) \
                    822:    value = (*((complex16 *) (*rpl_object).objet)).partie_reelle
1.1       bertrand  823: 
1.58      bertrand  824: #define getImaginaryPartOfComplex(rpl_object, value) \
                    825:    value = (*((complex16 *) (*rpl_object).objet)).partie_imaginaire
1.1       bertrand  826: 
1.58      bertrand  827: #define isComplex(rpl_object) \
                    828:    ((*rpl_object).type == CPL)
1.1       bertrand  829: 
1.58      bertrand  830: #define ifIsComplex(rpl_object) if (isComplex(rpl_object))
                    831: #define elseIfIsComplex(rpl_object) } else ifIsComplex(rpl_object)
1.1       bertrand  832: 
1.58      bertrand  833: #define getComplex(rpl_object, value) do { \
1.1       bertrand  834:    value.partie_reelle = 0; \
                    835:    value.partie_imaginaire = 0; \
1.58      bertrand  836:    ifIsComplex(rpl_object) value = (*((complex16 *) (*rpl_object).objet)); \
1.1       bertrand  837:    else systemError("Not a complex"); } while(0)
                    838: 
1.58      bertrand  839: #define createComplexObject(rpl_object) do { \
                    840:    if (rpl_object != NULL) \
1.1       bertrand  841:        systemError("Reallocated object"); \
1.74      bertrand  842:    if ((rpl_object = _allocation(CPL)) == NULL) \
1.1       bertrand  843:        systemError("Memory allocation error"); \
1.58      bertrand  844:    setComplex(rpl_object, 0, 0); } while(0)
1.1       bertrand  845: 
                    846: // Generalized vectors
                    847: 
1.58      bertrand  848: #define createVectorObject(rpl_object, size, otype, structure, cat) do { \
1.1       bertrand  849:    integer8 i; \
1.65      bertrand  850:    struct_processus *s_etat_processus; \
                    851:    s_etat_processus = (*rpl_arguments).s_etat_processus; \
1.58      bertrand  852:    if (rpl_object != NULL) \
1.1       bertrand  853:        systemError("Reallocated object"); \
1.74      bertrand  854:    if ((rpl_object = _allocation(cat)) == NULL) \
1.1       bertrand  855:        systemError("Memory allocation error"); \
1.58      bertrand  856:    (*((structure *) (*rpl_object).objet)).taille = size; \
                    857:    if (((*((structure *) (*rpl_object).objet)).tableau = \
1.1       bertrand  858:            malloc(size * sizeof(otype))) == NULL) \
                    859:        systemError("Memory allocation error"); \
                    860:    if (cat != VCX) \
                    861:    { \
                    862:        if (cat == VIN) \
1.58      bertrand  863:            (*((structure *) (*rpl_object).objet)).type = 'I'; \
1.1       bertrand  864:        else \
1.58      bertrand  865:            (*((structure *) (*rpl_object).objet)).type = 'R'; \
                    866:        for(i = 0; i < size; ((otype *) (*((structure *) (*rpl_object).objet)) \
1.1       bertrand  867:                .tableau)[i++] = (otype) 0); \
                    868:    } \
                    869:    else \
                    870:    { \
1.58      bertrand  871:        (*((structure *) (*rpl_object).objet)).type = 'C'; \
1.1       bertrand  872:        for(i = 0; i < size; i++) \
                    873:        { \
1.58      bertrand  874:            ((complex16 *) (*((structure *) (*rpl_object).objet)).tableau)[i] \
1.1       bertrand  875:                    .partie_reelle = 0; \
1.58      bertrand  876:            ((complex16 *) (*((structure *) (*rpl_object).objet)).tableau)[i] \
1.1       bertrand  877:                    .partie_imaginaire = 0; \
                    878:        } \
                    879:    } } while(0)
                    880: 
                    881: // Integer vector
                    882: 
1.58      bertrand  883: #define setIntegerIntoVector(rpl_object, value, position) do { \
1.1       bertrand  884:    typeof(position) __position = position; \
1.58      bertrand  885:    ifIsIntegerVector(rpl_object) \
1.1       bertrand  886:    { \
1.58      bertrand  887:        if ((*rpl_object).nombre_occurrences > 1) \
1.1       bertrand  888:        { \
1.58      bertrand  889:            struct_objet *__tmp_rpl_object; \
1.74      bertrand  890:            if ((__tmp_rpl_object = _copie_objet(rpl_object, 'O')) == NULL) \
1.1       bertrand  891:                systemError("Memory allocation error"); \
1.74      bertrand  892:            _liberation(rpl_object); \
1.58      bertrand  893:            rpl_object = __tmp_rpl_object; \
1.1       bertrand  894:        } \
                    895:        __position--; \
                    896:        if ((__position < 0) || (__position >= (*((struct_vecteur *) \
1.58      bertrand  897:                (*rpl_object).objet)).taille)) \
1.1       bertrand  898:            { executionError("Element out of range"); } \
                    899:        else \
1.58      bertrand  900:            ((integer8 *) (*((struct_vecteur *) (*rpl_object).objet)).tableau) \
1.1       bertrand  901:                    [__position] = (integer8) value; \
                    902:    } \
                    903:    else executionError("Type mistmatch error"); } while(0)
                    904: 
1.58      bertrand  905: #define isIntegerVector(rpl_object) \
                    906:    ((*rpl_object).type == VIN)
1.1       bertrand  907: 
1.58      bertrand  908: #define ifIsIntegerVector(rpl_object) if (isIntegerVector(rpl_object))
                    909: #define elseIfIsIntegerVector(rpl_object) } else ifIsIntegerVector(rpl_object)
1.1       bertrand  910: 
1.58      bertrand  911: #define getIntegerFromVector(rpl_object, value, position) do { \
1.1       bertrand  912:    typeof(position) __position = position; \
                    913:    value = 0; \
1.58      bertrand  914:    ifIsIntegerVector(rpl_object) \
1.1       bertrand  915:    { \
                    916:        __position--; \
                    917:        if ((__position < 0) || (__position >= (*((struct_vecteur *) \
1.58      bertrand  918:                (*rpl_object).objet)).taille)) \
1.1       bertrand  919:            executionError("Element out of range"); \
                    920:        else \
1.58      bertrand  921:            value = ((integer8 *) (*((struct_vecteur *) (*rpl_object).objet)) \
1.1       bertrand  922:                .tableau)[__position]; \
                    923:    } \
                    924:    else executionError("Type mismatch error"); } while(0)
                    925: 
1.58      bertrand  926: #define createIntegerVectorObject(rpl_object, size) \
                    927:    createVectorObject(rpl_object, size, integer8, struct_vecteur, VIN)
1.1       bertrand  928: 
                    929: // Real vector
                    930: 
1.58      bertrand  931: #define setRealIntoVector(rpl_object, value, position) do { \
1.1       bertrand  932:    typeof(position) __position = position; \
1.58      bertrand  933:    ifIsRealVector(rpl_object) \
1.1       bertrand  934:    { \
1.58      bertrand  935:        if ((*rpl_object).nombre_occurrences > 1) \
1.1       bertrand  936:        { \
1.58      bertrand  937:            struct_objet *__tmp_rpl_object; \
1.74      bertrand  938:            if ((__tmp_rpl_object = _copie_objet(rpl_object, 'O')) == NULL) \
1.1       bertrand  939:                systemError("Memory allocation error"); \
1.74      bertrand  940:            _liberation(rpl_object); \
1.58      bertrand  941:            rpl_object = __tmp_rpl_object; \
1.1       bertrand  942:        } \
                    943:        __position--; \
                    944:        if ((__position < 0) || (__position >= (*((struct_vecteur *) \
1.58      bertrand  945:                (*rpl_object).objet)).taille)) \
1.1       bertrand  946:            { executionError("Element out of range"); } \
                    947:        else \
1.58      bertrand  948:            ((real8 *) (*((struct_vecteur *) (*rpl_object).objet)).tableau) \
1.1       bertrand  949:                    [__position] = (real8) value; \
                    950:    } \
                    951:    else executionError("Type mistmatch error"); } while(0)
                    952: 
1.58      bertrand  953: #define isRealVector(rpl_object) \
                    954:    ((*rpl_object).type == VRL)
1.1       bertrand  955: 
1.58      bertrand  956: #define ifIsRealVector(rpl_object) if (isRealVector(rpl_object))
                    957: #define elseIfIsRealVector(rpl_object) } else ifIsRealVector(rpl_object)
1.1       bertrand  958: 
1.58      bertrand  959: #define getRealFromVector(rpl_object, value, position) do { \
1.1       bertrand  960:    typeof(position) __position = position; \
                    961:    value = 0; \
1.58      bertrand  962:    ifIsRealVector(rpl_object) \
1.1       bertrand  963:    { \
                    964:        __position--; \
                    965:        if ((__position < 0) || (__position >= (*((struct_vecteur *) \
1.58      bertrand  966:                (*rpl_object).objet)).taille)) \
1.1       bertrand  967:            executionError("Element out of range"); \
1.58      bertrand  968:        value = ((real8 *) (*((struct_vecteur *) (*rpl_object).objet)) \
                    969:                .tableau)[__position]; \
1.1       bertrand  970:    } \
                    971:    else executionError("Type mismatch error"); } while(0)
                    972: 
1.58      bertrand  973: #define createRealVectorObject(rpl_object, size) \
1.65      bertrand  974:    createVectorObject(rpl_object, size, real8, struct_vecteur, VRL)
1.1       bertrand  975: 
                    976: // A FIXER
                    977: 
                    978: #define createComplexVectorObject
                    979: 
                    980: #define createIntegerMatrixObject
                    981: 
                    982: #define createRealMatrixObject
                    983: 
                    984: #define createComplexMatrixObject
                    985: 
                    986: // Binary integer
                    987: 
1.58      bertrand  988: #define setBinaryInteger(rpl_object, value) do { \
                    989:    ifIsBinaryInteger(rpl_object) \
1.1       bertrand  990:    { \
1.58      bertrand  991:        if ((*rpl_object).nombre_occurrences > 1) \
1.1       bertrand  992:        { \
1.58      bertrand  993:            struct_objet *__tmp_rpl_object; \
1.74      bertrand  994:            if ((__tmp_rpl_object = _copie_objet(rpl_object, 'O')) == NULL) \
1.1       bertrand  995:                systemError("Memory allocation error"); \
1.74      bertrand  996:            _liberation(rpl_object); \
1.58      bertrand  997:            rpl_object = __tmp_rpl_object; \
1.1       bertrand  998:        } \
1.58      bertrand  999:        (*((integer8 *) (*rpl_object).objet)) = (integer8) value; \
1.1       bertrand 1000:    } \
                   1001:    else executionError("Type mistmatch error"); } while(0)
                   1002: 
1.58      bertrand 1003: #define isBinaryInteger(rpl_object) \
                   1004:    ((*rpl_object).type == BIN)
1.1       bertrand 1005: 
1.58      bertrand 1006: #define ifIsBinaryInteger(rpl_object) if (isBinaryInteger(rpl_object))
                   1007: #define elseIfIsBinaryInteger(rpl_object) } else ifIsBinaryInteger(rpl_object)
1.1       bertrand 1008: 
1.58      bertrand 1009: #define getBinaryInteger(rpl_object, value) do { \
1.1       bertrand 1010:    value = 0; \
1.58      bertrand 1011:    ifIsBinaryInteger(rpl_object) value = \
                   1012:            (*((integer8 *) (*rpl_object).objet)); \
1.1       bertrand 1013:    else executionError("Type mismatch error"); } while(0)
                   1014: 
1.58      bertrand 1015: #define createBinaryIntegerObject(rpl_object) do { \
                   1016:    if (rpl_object != NULL) \
1.1       bertrand 1017:        systemError("Reallocated object"); \
1.74      bertrand 1018:    if ((rpl_object = _allocation(BIN)) == NULL) \
1.1       bertrand 1019:        systemError("Memory allocation error"); \
1.58      bertrand 1020:    setBinaryInteger(rpl_object, 0); } while(0)
1.1       bertrand 1021: 
                   1022: // Name
                   1023: 
1.58      bertrand 1024: #define isName(rpl_object) \
                   1025:    ((*rpl_object).type == NOM)
1.1       bertrand 1026: 
1.58      bertrand 1027: #define ifIsName(rpl_object) if (isName(rpl_object))
                   1028: #define elseIfIsName(rpl_object)  } else if (isName(rpl_object))
1.1       bertrand 1029: 
1.58      bertrand 1030: #define setName(rpl_object, value) do { \
1.65      bertrand 1031:    struct_processus *s_etat_processus; \
                   1032:    s_etat_processus = (*rpl_arguments).s_etat_processus; \
1.58      bertrand 1033:    ifIsName(rpl_object) \
1.1       bertrand 1034:    { \
1.58      bertrand 1035:        if ((*rpl_object).nombre_occurrences > 1) \
1.1       bertrand 1036:        { \
1.58      bertrand 1037:            struct_objet *__tmp_rpl_object; \
1.74      bertrand 1038:            if ((__tmp_rpl_object = _copie_objet(rpl_object, 'O')) == NULL) \
1.1       bertrand 1039:                systemError("Memory allocation error"); \
1.74      bertrand 1040:            _liberation(rpl_object); \
1.58      bertrand 1041:            rpl_object = __tmp_rpl_object; \
1.1       bertrand 1042:        } \
1.58      bertrand 1043:        free((*((struct_nom *) (*rpl_object).objet)).nom); \
                   1044:        (*((struct_nom *) (*rpl_object).objet)).symbole = d_faux; \
                   1045:        if (((*((struct_nom *) (*rpl_object).objet)).nom = malloc( \
1.1       bertrand 1046:                (strlen(value) + 1) * sizeof(unsigned char))) == NULL) \
                   1047:            systemError("Memory allocation error"); \
1.58      bertrand 1048:        strcpy((char *) (*((struct_nom *) (*rpl_object).objet)).nom, \
1.1       bertrand 1049:                (char *) value); \
                   1050:    } \
                   1051:    else executionError("Type mistmatch error"); } while(0)
                   1052: 
1.59      bertrand 1053: #define setSymbolicName(rpl_object, value) do { \
                   1054:    setName(rpl_object, value); \
                   1055:    (*((struct_nom *) (*rpl_object).objet)).symbole = d_vrai; } while(0)
                   1056: 
1.58      bertrand 1057: #define createNameObject(rpl_object) do { \
1.65      bertrand 1058:    struct_processus *s_etat_processus; \
                   1059:    s_etat_processus = (*rpl_arguments).s_etat_processus; \
1.58      bertrand 1060:    if (rpl_object != NULL) \
1.1       bertrand 1061:        systemError("Reallocated object"); \
1.74      bertrand 1062:    if ((rpl_object = _allocation(NOM)) == NULL) \
1.1       bertrand 1063:        systemError("Memory allocation error"); \
1.58      bertrand 1064:    (*((struct_nom *) (*rpl_object).objet)).symbole = d_faux; \
                   1065:    if (((*((struct_nom *) (*rpl_object).objet)).nom = malloc( \
1.1       bertrand 1066:            sizeof(unsigned char))) == NULL) \
                   1067:        systemError("Memory allocation error"); \
1.58      bertrand 1068:    strcpy((char *) (*((struct_nom *) (*rpl_object).objet)).nom, ""); } while(0)
1.1       bertrand 1069: 
                   1070: // String
                   1071: 
1.58      bertrand 1072: #define isString(rpl_object) \
                   1073:    ((*rpl_object).type == CHN)
1.1       bertrand 1074: 
1.58      bertrand 1075: #define ifIsString(rpl_object) if (isString(rpl_object))
1.81      bertrand 1076: #define elseIfIsString(rpl_object) } else if (isString(rpl_object))
1.1       bertrand 1077: 
1.58      bertrand 1078: #define setString(rpl_object, string) do { \
1.65      bertrand 1079:    struct_processus *s_etat_processus; \
                   1080:    s_etat_processus = (*rpl_arguments).s_etat_processus; \
1.58      bertrand 1081:    ifIsString(rpl_object) \
1.1       bertrand 1082:    { \
1.48      bertrand 1083:        if (string == NULL) executionError("Nullified string"); else \
1.1       bertrand 1084:        { \
1.58      bertrand 1085:            if ((*rpl_object).nombre_occurrences > 1) \
1.48      bertrand 1086:            { \
1.58      bertrand 1087:                struct_objet *__tmp_rpl_object; \
1.74      bertrand 1088:                if ((__tmp_rpl_object = _copie_objet(rpl_object, 'O')) \
                   1089:                        == NULL) \
1.48      bertrand 1090:                    systemError("Memory allocation error"); \
1.74      bertrand 1091:                _liberation(rpl_object); \
1.58      bertrand 1092:                rpl_object = __tmp_rpl_object; \
1.48      bertrand 1093:            } \
1.58      bertrand 1094:            free((unsigned char *) (*rpl_object).objet); \
                   1095:            if (((*rpl_object).objet = malloc((strlen(string) + 1) * \
1.48      bertrand 1096:                    sizeof(unsigned char))) == NULL) \
1.1       bertrand 1097:                systemError("Memory allocation error"); \
1.58      bertrand 1098:            strcpy((char *) (*rpl_object).objet, string); \
1.1       bertrand 1099:        } \
                   1100:    } \
                   1101:    else executionError("Type mistmatch error"); } while(0)
                   1102: 
1.58      bertrand 1103: #define getString(rpl_object, string) do { \
1.1       bertrand 1104:    string = NULL; \
1.58      bertrand 1105:    ifIsString(rpl_object) string = (char *) (*rpl_object).objet; \
1.1       bertrand 1106:    else executionError("Type mismatch error"); } while(0)
                   1107: 
1.58      bertrand 1108: #define createStringObject(rpl_object) do { \
1.65      bertrand 1109:    struct_processus *s_etat_processus; \
                   1110:    s_etat_processus = (*rpl_arguments).s_etat_processus; \
1.58      bertrand 1111:    if (rpl_object != NULL) \
1.1       bertrand 1112:        systemError("Reallocated object"); \
1.74      bertrand 1113:    if ((rpl_object = _allocation(CHN)) == NULL) \
1.1       bertrand 1114:        systemError("Memory allocation error"); \
1.58      bertrand 1115:    if (((*rpl_object).objet = malloc(sizeof(unsigned char))) == NULL) \
1.1       bertrand 1116:        systemError("Memory allocation error"); \
1.58      bertrand 1117:    strcpy((char *) (*rpl_object).objet, ""); } while(0)
1.1       bertrand 1118: 
                   1119: // List
                   1120: 
1.58      bertrand 1121: #define isList(rpl_object) \
                   1122:    ((*rpl_object).type == LST)
1.1       bertrand 1123: 
1.58      bertrand 1124: #define ifIsList(rpl_object) if (isList(rpl_object))
                   1125: #define elseIfIsList(rpl_object) else if (isList(rpl_object))
1.1       bertrand 1126: 
1.58      bertrand 1127: #define createListObject(rpl_object) do { \
                   1128:    if (rpl_object != NULL) \
1.1       bertrand 1129:        systemError("Reallocated object"); \
1.74      bertrand 1130:    if ((rpl_object = _allocation(LST)) == NULL) \
1.1       bertrand 1131:        systemError("Memory allocation error"); \
1.58      bertrand 1132:    (*rpl_object).objet = NULL; } while(0)
1.1       bertrand 1133: 
1.58      bertrand 1134: #define addObjectToList(list, rpl_object) do { \
1.65      bertrand 1135:    struct_processus *s_etat_processus; \
                   1136:    s_etat_processus = (*rpl_arguments).s_etat_processus; \
1.1       bertrand 1137:    ifIsList(list) \
                   1138:    { \
1.58      bertrand 1139:        struct_objet *__tmp_rpl_object; \
1.74      bertrand 1140:        if ((__tmp_rpl_object = _copie_objet(list, 'N')) == NULL) \
1.1       bertrand 1141:            systemError("Memory allocation error"); \
1.74      bertrand 1142:        _liberation(list); \
1.58      bertrand 1143:        list = __tmp_rpl_object; \
1.1       bertrand 1144:        if ((*list).objet == NULL) \
                   1145:        { \
                   1146:            if (((*list).objet = malloc(sizeof(struct_liste_chainee))) \
                   1147:                    == NULL) \
                   1148:                systemError("Memory allocation error"); \
                   1149:            (*((struct_liste_chainee *) (*list).objet)).suivant = NULL; \
1.58      bertrand 1150:            (*((struct_liste_chainee *) (*list).objet)).donnee = rpl_object; \
1.1       bertrand 1151:        } \
                   1152:        else \
                   1153:        { \
                   1154:            struct_liste_chainee    *l_element_courant; \
                   1155:            l_element_courant = (*list).objet; \
                   1156:            while((*l_element_courant).suivant != NULL) \
                   1157:                l_element_courant = (*l_element_courant).suivant; \
                   1158:            if (((*l_element_courant).suivant = \
                   1159:                    malloc(sizeof(struct_liste_chainee))) == NULL) \
                   1160:                systemError("Memory allocation error"); \
                   1161:            l_element_courant = (*l_element_courant).suivant; \
                   1162:            (*l_element_courant).suivant = NULL; \
1.58      bertrand 1163:            (*l_element_courant).donnee = rpl_object; \
1.1       bertrand 1164:        } \
1.58      bertrand 1165:        rpl_object = NULL; \
1.1       bertrand 1166:    } \
                   1167:    else executionError("Type mistmatch error"); } while(0)
                   1168: 
1.58      bertrand 1169: #define insertObjectIntoList(list, rpl_object) do { \
1.65      bertrand 1170:    struct_processus *s_etat_processus; \
                   1171:    s_etat_processus = (*rpl_arguments).s_etat_processus; \
1.1       bertrand 1172:    ifIsList(list) \
                   1173:    { \
1.58      bertrand 1174:        struct_objet *__tmp_rpl_object; \
1.74      bertrand 1175:        if ((__tmp_rpl_object = _copie_objet(list, 'N')) == NULL) \
1.1       bertrand 1176:            systemError("Memory allocation error"); \
1.74      bertrand 1177:        _liberation(list); \
1.58      bertrand 1178:        list = __tmp_rpl_object; \
1.1       bertrand 1179:        if ((*list).objet == NULL) \
                   1180:        { \
                   1181:            if (((*list).objet = malloc(sizeof(struct_liste_chainee))) \
                   1182:                    == NULL) \
                   1183:                systemError("Memory allocation error"); \
                   1184:            (*((struct_liste_chainee *) (*list).objet)).suivant = NULL; \
1.58      bertrand 1185:            (*((struct_liste_chainee *) (*list).objet)).donnee = rpl_object; \
1.1       bertrand 1186:        } \
                   1187:        else \
                   1188:        { \
                   1189:            struct_liste_chainee    *l_element_courant; \
                   1190:            if ((l_element_courant = \
                   1191:                    malloc(sizeof(struct_liste_chainee))) == NULL) \
                   1192:                systemError("Memory allocation error"); \
1.58      bertrand 1193:            (*l_element_courant).donnee = rpl_object; \
1.1       bertrand 1194:            (*l_element_courant).suivant = (*list).objet; \
                   1195:            (*list).objet = l_element_courant; \
                   1196:        } \
1.58      bertrand 1197:        rpl_object = NULL; \
1.1       bertrand 1198:    } \
                   1199:    else executionError("Type mistmatch error"); } while(0)
                   1200: 
1.58      bertrand 1201: #define removeObjectFromList(list, rpl_object) do { \
1.65      bertrand 1202:    struct_processus *s_etat_processus; \
                   1203:    s_etat_processus = (*rpl_arguments).s_etat_processus; \
1.1       bertrand 1204:    ifIsList(list) \
                   1205:    { \
1.50      bertrand 1206:        if ((*list).objet != NULL) \
1.1       bertrand 1207:        { \
1.50      bertrand 1208:            struct_liste_chainee    *__current; \
                   1209:            struct_liste_chainee    *__previous; \
                   1210:            __current = (*list).objet; \
                   1211:            __previous = NULL; \
1.58      bertrand 1212:            if ((*__current).donnee == rpl_object) \
1.50      bertrand 1213:            { \
                   1214:                (*list).objet = (*__current).suivant; \
                   1215:            } \
                   1216:            else \
                   1217:            { \
                   1218:                while(__current != NULL) \
                   1219:                { \
1.58      bertrand 1220:                    if ((*__current).donnee == rpl_object) \
1.50      bertrand 1221:                    { \
                   1222:                        (*__previous).suivant = (*__current).suivant; \
                   1223:                        break; \
                   1224:                    } \
                   1225:                    __previous = __current; \
                   1226:                    __current = (*__current).suivant; \
                   1227:                } \
                   1228:            } \
1.74      bertrand 1229:            _liberation((*__current).donnee); \
1.50      bertrand 1230:            free(__current); \
                   1231:        } \
1.1       bertrand 1232:    } \
                   1233:    else executionError("Type mistmatch error"); } while(0)
                   1234: 
1.58      bertrand 1235: #define getObjectFromList(list, position, rpl_object)
1.1       bertrand 1236: 
1.58      bertrand 1237: #define putObjectIntoList(list, position, rpl_object)
1.1       bertrand 1238: 
1.58      bertrand 1239: #define getListFromList(list, position1, position2, rpl_object)
1.1       bertrand 1240: 
1.46      bertrand 1241: #define listLength(list, length) do { \
1.1       bertrand 1242:    if (list == NULL) executionError("Nullified object"); \
                   1243:    if ((*list).type != LST) \
                   1244:            executionError("Type mistmatch error"); \
                   1245:    { \
                   1246:        struct_liste_chainee        *l_element_courant; \
                   1247:        length = 0; \
                   1248:        l_element_courant = (*list).objet; \
                   1249:        while(l_element_courant != NULL) \
                   1250:        { \
                   1251:            l_element_courant = (*l_element_courant).suivant; \
                   1252:            length++; \
                   1253:        } \
                   1254:    } } while(0)
                   1255: 
1.82      bertrand 1256: // NON
                   1257: #define createObject(rpl_object) do { \
                   1258:    if (rpl_object != NULL) \
                   1259:        systemError("Reallocated object"); \
                   1260:    if ((rpl_object = _allocation(NON)) == NULL) \
                   1261:        systemError("Memory allocation error"); \
                   1262:    (*rpl_object).objet = NULL; \
                   1263:    } while(0)
                   1264: 
1.78      bertrand 1265: // EXT
                   1266: #define createExternalObject(rpl_object, subtype) do { \
                   1267:    if (rpl_object != NULL) \
                   1268:        systemError("Reallocated object"); \
                   1269:    if ((rpl_object = _allocation(EXT)) == NULL) \
                   1270:        systemError("Memory allocation error"); \
                   1271:    (*rpl_object).objet = NULL; \
                   1272:    (*rpl_object).extension_type = subtype; \
                   1273:    (*rpl_object).descripteur_bibliotheque = __static_library_descriptor; \
                   1274:    } while(0)
                   1275: 
1.1       bertrand 1276: /*
                   1277: --------------------------------------------------------------------------------
                   1278:   Allocation mémoire
                   1279: --------------------------------------------------------------------------------
                   1280: */
                   1281: 
                   1282: #define size(a) sizeof(a)
                   1283: 
                   1284: #define allocate(a) ({ void *ptr; \
1.65      bertrand 1285:    struct_processus *s_etat_processus; \
                   1286:    s_etat_processus = (*rpl_arguments).s_etat_processus; \
1.1       bertrand 1287:    if ((ptr = malloc(a)) == NULL) \
1.78      bertrand 1288:        { systemError("Memory allocation error"); \
                   1289:        __CATCH_SYSTEM_ERROR__; } ptr; }) \
1.1       bertrand 1290: 
1.69      bertrand 1291: #define reallocate(a, s) ({ void *ptr; \
                   1292:    struct_processus *s_etat_processus; \
                   1293:    s_etat_processus = (*rpl_arguments).s_etat_processus; \
                   1294:    if ((ptr = realloc(a, s)) == NULL) \
1.78      bertrand 1295:        { systemError("Memory allocation error"); \
                   1296:        __CATCH_SYSTEM_ERROR__; } ptr; }) \
1.69      bertrand 1297: 
1.65      bertrand 1298: #define deallocate(a) do { \
                   1299:    struct_processus *s_etat_processus; \
                   1300:    s_etat_processus = (*rpl_arguments).s_etat_processus; \
                   1301:    free(a); } while(0)
1.1       bertrand 1302: 
                   1303: /*
                   1304: --------------------------------------------------------------------------------
1.30      bertrand 1305:   Récupération des interruptions et des signaux
                   1306: --------------------------------------------------------------------------------
                   1307: */
                   1308: 
                   1309: #define pollSignalsAndInterrupts() \
1.47      bertrand 1310:    __CATCH_SYSTEM_ERROR__; \
1.46      bertrand 1311:    do { scrutation_injection((*rpl_arguments).s_etat_processus); } while(0)
1.30      bertrand 1312: 
                   1313: /*
                   1314: --------------------------------------------------------------------------------
1.1       bertrand 1315:   Exécution d'une fonction intrinsèque
                   1316: --------------------------------------------------------------------------------
                   1317: */
                   1318: 
1.46      bertrand 1319: #define intrinsic(function) do { \
1.1       bertrand 1320:    int __status; \
1.47      bertrand 1321:    __CATCH_SYSTEM_ERROR__; \
1.5       bertrand 1322:    __status = wrapper_instruction_intrinseque( \
                   1323:            instruction_##function, rpl_arguments); \
1.1       bertrand 1324:    if (__status == 1) executionError(#function); \
                   1325:    if (__status == 2) systemError(#function); \
                   1326:    } while(0)
                   1327: 
                   1328: #endif
                   1329: 
                   1330: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>