Annotation of rpl/src/instructions_s1.c, revision 1.62

1.1       bertrand    1: /*
                      2: ================================================================================
1.60      bertrand    3:   RPL/2 (R) version 4.1.12
1.62    ! 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: 
                     22: 
1.16      bertrand   23: #include "rpl-conv.h"
1.1       bertrand   24: 
                     25: 
                     26: /*
                     27: ================================================================================
                     28:   Fonction 'swap'
                     29: ================================================================================
                     30:   Entrées : structure processus
                     31: --------------------------------------------------------------------------------
                     32:   Sorties :
                     33: --------------------------------------------------------------------------------
                     34:   Effets de bord : néant
                     35: ================================================================================
                     36: */
                     37: 
                     38: void
                     39: instruction_swap(struct_processus *s_etat_processus)
                     40: {
                     41:    struct_liste_chainee                    *l_liste;
                     42: 
                     43:    (*s_etat_processus).erreur_execution = d_ex;
                     44: 
                     45:    if ((*s_etat_processus).affichage_arguments == 'Y')
                     46:    {
                     47:        printf("\n  SWAP ");
                     48: 
                     49:        if ((*s_etat_processus).langue == 'F')
                     50:        {
                     51:            printf("(inversion de deux objets)\n\n");
                     52:        }
                     53:        else
                     54:        {
                     55:            printf("(swap two objects)\n\n");
                     56:        }
                     57: 
                     58:        printf("    2: %s, %s, %s, %s, %s, %s,\n"
                     59:                "       %s, %s, %s, %s, %s,\n"
                     60:                "       %s, %s, %s, %s, %s,\n"
                     61:                "       %s, %s, %s, %s, %s,\n"
                     62:                "       %s\n",
                     63:                d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX,
                     64:                d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SCK,
                     65:                d_SLB, d_PRC, d_MTX, d_SQL);
                     66:        printf("    1: %s, %s, %s, %s, %s, %s,\n"
                     67:                "       %s, %s, %s, %s, %s,\n"
                     68:                "       %s, %s, %s, %s, %s,\n"
                     69:                "       %s, %s, %s, %s, %s,\n"
                     70:                "       %s\n",
                     71:                d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX,
                     72:                d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SCK,
                     73:                d_SLB, d_PRC, d_MTX, d_SQL);
                     74:        printf("->  2: %s, %s, %s, %s, %s, %s,\n"
                     75:                "       %s, %s, %s, %s, %s,\n"
                     76:                "       %s, %s, %s, %s, %s,\n"
                     77:                "       %s, %s, %s, %s, %s,\n"
                     78:                "       %s\n",
                     79:                d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX,
                     80:                d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SCK,
                     81:                d_SLB, d_PRC, d_MTX, d_SQL);
                     82:        printf("    1: %s, %s, %s, %s, %s, %s,\n"
                     83:                "       %s, %s, %s, %s, %s,\n"
                     84:                "       %s, %s, %s, %s, %s,\n"
                     85:                "       %s, %s, %s, %s, %s,\n"
                     86:                "       %s\n",
                     87:                d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX,
                     88:                d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SCK,
                     89:                d_SLB, d_PRC, d_MTX, d_SQL);
                     90: 
                     91:        return;
                     92:    }
                     93:    else if ((*s_etat_processus).test_instruction == 'Y')
                     94:    {
                     95:        (*s_etat_processus).nombre_arguments = -1;
                     96:        return;
                     97:    }
                     98: 
                     99:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                    100:    {
                    101:        if (empilement_pile_last(s_etat_processus, 2) == d_erreur)
                    102:        {
                    103:            return;
                    104:        }
                    105:    }
                    106: 
                    107:    if ((*s_etat_processus).hauteur_pile_operationnelle < 2)
                    108:    {
                    109:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                    110:        return;
                    111:    }
                    112: 
                    113:    l_liste = (*s_etat_processus).l_base_pile;
                    114:    (*s_etat_processus).l_base_pile = (*l_liste).suivant;
                    115:    (*l_liste).suivant = (*(*s_etat_processus).l_base_pile).suivant;
                    116:    (*(*s_etat_processus).l_base_pile).suivant = l_liste;
                    117: 
                    118:    return;
                    119: }
                    120: 
                    121: 
                    122: /*
                    123: ================================================================================
                    124:   Fonction 'sq'
                    125: ================================================================================
                    126:   Entrées : pointeur sur une struct_processus
                    127: --------------------------------------------------------------------------------
                    128:   Sorties :
                    129: --------------------------------------------------------------------------------
                    130:   Effets de bord : néant
                    131: ================================================================================
                    132: */
                    133: 
                    134: void
                    135: instruction_sq(struct_processus *s_etat_processus)
                    136: {
                    137:    integer8                        a;
                    138:    integer8                        r;
                    139: 
                    140:    logical1                        depassement;
                    141:    logical1                        erreur_memoire;
                    142: 
                    143:    struct_liste_chainee            *l_element_courant;
                    144:    struct_liste_chainee            *l_element_precedent;
                    145: 
                    146:    struct_objet                    *s_copie_argument;
                    147:    struct_objet                    *s_objet_argument;
                    148:    struct_objet                    *s_objet_resultat;
                    149: 
                    150:    unsigned long                   i;
                    151:    unsigned long                   j;
                    152:    unsigned long                   k;
                    153: 
                    154:    void                            *accumulateur;
                    155: 
                    156:    (*s_etat_processus).erreur_execution = d_ex;
                    157: 
                    158:    if ((*s_etat_processus).affichage_arguments == 'Y')
                    159:    {
                    160:        printf("\n  SQ ");
                    161: 
                    162:        if ((*s_etat_processus).langue == 'F')
                    163:        {
                    164:            printf("(élevation au carré)\n\n");
                    165:        }
                    166:        else
                    167:        {
                    168:            printf("(square)\n\n");
                    169:        }
                    170: 
                    171:        printf("    1: %s, %s, %s\n", d_INT, d_REL, d_CPL);
                    172:        printf("->  1: %s, %s, %s\n\n", d_INT, d_REL, d_CPL);
                    173: 
                    174:        printf("    1: %s, %s, %s\n", d_MIN, d_MRL, d_MCX);
                    175:        printf("->  1: %s, %s, %s\n\n", d_MIN, d_MRL, d_MCX);
                    176: 
                    177:        printf("    1: %s, %s\n", d_NOM, d_ALG);
                    178:        printf("->  1: %s\n\n", d_ALG);
                    179: 
                    180:        printf("    1: %s\n", d_RPN);
                    181:        printf("->  1: %s\n", d_RPN);
                    182: 
                    183:        return;
                    184:    }
                    185:    else if ((*s_etat_processus).test_instruction == 'Y')
                    186:    {
                    187:        (*s_etat_processus).nombre_arguments = 1;
                    188:        return;
                    189:    }
                    190: 
                    191:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                    192:    {
                    193:        if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
                    194:        {
                    195:            return;
                    196:        }
                    197:    }
                    198: 
                    199:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    200:            &s_objet_argument) == d_erreur)
                    201:    {
                    202:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                    203:        return;
                    204:    }
                    205: 
                    206: /*
                    207: --------------------------------------------------------------------------------
                    208:   Carré d'un entier
                    209: --------------------------------------------------------------------------------
                    210: */
                    211: 
                    212:    if ((*s_objet_argument).type == INT)
                    213:    {
                    214:        a = (*((integer8 *) (*s_objet_argument).objet));
                    215: 
                    216:        if (depassement_multiplication(&a, &a, &r) == d_absence_erreur)
                    217:        {
                    218:            if ((s_objet_resultat = allocation(s_etat_processus, INT))
                    219:                    == NULL)
                    220:            {
                    221:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    222:                return;
                    223:            }
                    224: 
                    225:            (*((integer8 *) (*s_objet_resultat).objet)) = r;
                    226:        }
                    227:        else
                    228:        {
                    229:            if ((s_objet_resultat = allocation(s_etat_processus, REL))
                    230:                    == NULL)
                    231:            {
                    232:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    233:                return;
                    234:            }
                    235: 
                    236:            (*((real8 *) (*s_objet_resultat).objet)) =
                    237:                    ((double) (*((integer8 *) (*s_objet_argument).objet))) *
                    238:                    ((double) (*((integer8 *) (*s_objet_argument).objet)));
                    239:        }
                    240:    }
                    241: 
                    242: /*
                    243: --------------------------------------------------------------------------------
                    244:   Carré d'un réel
                    245: --------------------------------------------------------------------------------
                    246: */
                    247: 
                    248:    else if ((*s_objet_argument).type == REL)
                    249:    {
                    250:        if ((s_objet_resultat = allocation(s_etat_processus, REL)) == NULL)
                    251:        {
                    252:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    253:            return;
                    254:        }
                    255: 
                    256:        (*((real8 *) (*s_objet_resultat).objet)) =
                    257:                (*((real8 *) (*s_objet_argument).objet)) *
                    258:                (*((real8 *) (*s_objet_argument).objet));
                    259:    }
                    260: 
                    261: /*
                    262: --------------------------------------------------------------------------------
                    263:   Carré d'un complexe
                    264: --------------------------------------------------------------------------------
                    265: */
                    266: 
                    267:    else if ((*s_objet_argument).type == CPL)
                    268:    {
                    269:        if ((s_objet_resultat = allocation(s_etat_processus, CPL)) == NULL)
                    270:        {
                    271:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    272:            return;
                    273:        }
                    274: 
                    275:        f77multiplicationcc_(&((*((struct_complexe16 *)
                    276:                (*s_objet_argument).objet))), &((*((struct_complexe16 *)
                    277:                (*s_objet_argument).objet))), &((*((struct_complexe16 *)
                    278:                (*s_objet_resultat).objet))));
                    279:    }
                    280: 
                    281: /*
                    282: --------------------------------------------------------------------------------
                    283:   Carré d'une matrice entière
                    284: --------------------------------------------------------------------------------
                    285: */
                    286: 
                    287:    else if ((*s_objet_argument).type == MIN)
                    288:    {
                    289:        if ((*((struct_matrice *) (*s_objet_argument).objet)).nombre_lignes !=
                    290:                (*((struct_matrice *) (*s_objet_argument).objet))
                    291:                .nombre_colonnes)
                    292:        {
                    293:            liberation(s_etat_processus, s_objet_argument);
                    294: 
                    295:            (*s_etat_processus).erreur_execution = d_ex_dimensions_invalides;
                    296:            return;
                    297:        }
                    298: 
                    299:        if ((s_objet_resultat = allocation(s_etat_processus, MIN)) == NULL)
                    300:        {
                    301:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    302:            return;
                    303:        }
                    304: 
                    305:        (*((struct_matrice *) (*s_objet_resultat).objet)).nombre_lignes =
                    306:                (*(((struct_matrice *) (*s_objet_argument)
                    307:                .objet))).nombre_lignes;
                    308:        (*((struct_matrice *) (*s_objet_resultat).objet)).nombre_colonnes =
                    309:                (*(((struct_matrice *) (*s_objet_argument)
                    310:                .objet))).nombre_colonnes;
                    311: 
                    312:        if (((*((struct_matrice *) (*s_objet_resultat).objet)).tableau =
                    313:                malloc((*(((struct_matrice *) (*s_objet_resultat)
                    314:                .objet))).nombre_lignes * sizeof(integer8 *))) == NULL)
                    315:        {
                    316:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    317:            return;
                    318:        }
                    319: 
                    320:        depassement = d_faux;
                    321: 
                    322:        for(i = 0; i < (*(((struct_matrice *) (*s_objet_resultat)
                    323:                .objet))).nombre_lignes; i++)
                    324:        {
                    325:            if (((*((struct_matrice *) (*s_objet_resultat).objet)).tableau[i] =
                    326:                    malloc((*(((struct_matrice *) (*s_objet_resultat)
                    327:                    .objet))).nombre_colonnes * sizeof(integer8))) == NULL)
                    328:            {
                    329:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    330:                return;
                    331:            }
                    332: 
                    333:            for(j = 0; j < (*(((struct_matrice *) (*s_objet_resultat)
                    334:                    .objet))).nombre_colonnes; j++)
                    335:            {
                    336:                ((integer8 **) (*((struct_matrice *)
                    337:                        (*s_objet_resultat).objet)).tableau)[i][j] = 0;
                    338: 
                    339:                for(k = 0; k < (*(((struct_matrice *) (*s_objet_argument)
                    340:                        .objet))).nombre_colonnes; k++)
                    341:                {
                    342:                    if (depassement_multiplication(&(((integer8 **)
                    343:                            (*((struct_matrice *) (*s_objet_argument).objet))
                    344:                            .tableau)[i][k]), &(((integer8 **)
                    345:                            (*((struct_matrice *) (*s_objet_argument).objet))
                    346:                            .tableau)[k][j]), &a) == d_erreur)
                    347:                    {
                    348:                        depassement = d_vrai;
                    349:                    }
                    350: 
                    351:                    if (depassement_addition(&(((integer8 **)
                    352:                            (*((struct_matrice *) (*s_objet_resultat).objet))
                    353:                            .tableau)[i][j]), &a, &r) == d_erreur)
                    354:                    {
                    355:                        depassement = d_vrai;
                    356:                    }
                    357: 
                    358:                    ((integer8 **) (*((struct_matrice *) (*s_objet_resultat)
                    359:                            .objet)).tableau)[i][j] = r;
                    360:                }
                    361:            }
                    362:        }
                    363: 
                    364:        if (depassement == d_vrai)
                    365:        {
                    366:            (*s_objet_resultat).type = MRL;
                    367:            (*((struct_matrice *) (*s_objet_resultat).objet)).type = 'R';
                    368: 
                    369:            if ((accumulateur = malloc((*(((struct_matrice *)
                    370:                    (*s_objet_argument).objet))).nombre_colonnes *
                    371:                    sizeof(real8))) == NULL)
                    372:            {
                    373:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    374:                return;
                    375:            }
                    376: 
                    377:            for(i = 0; i < (*(((struct_matrice *) (*s_objet_resultat)
                    378:                    .objet))).nombre_lignes; i++)
                    379:            {
                    380:                free(((integer8 **) (*((struct_matrice *)
                    381:                        (*s_objet_resultat).objet)).tableau)[i]);
                    382: 
                    383:                if (((*((struct_matrice *) (*s_objet_resultat).objet))
                    384:                        .tableau[i] = malloc((*(((struct_matrice *)
                    385:                        (*s_objet_resultat).objet))).nombre_colonnes *
                    386:                        sizeof(real8))) == NULL)
                    387:                {
                    388:                    (*s_etat_processus).erreur_systeme =
                    389:                            d_es_allocation_memoire;
                    390:                    return;
                    391:                }
                    392: 
                    393:                for(j = 0; j < (*(((struct_matrice *) (*s_objet_resultat)
                    394:                        .objet))).nombre_colonnes; j++)
                    395:                {
                    396:                    ((real8 **) (*((struct_matrice *)
                    397:                            (*s_objet_resultat).objet)).tableau)[i][j] = 0;
                    398: 
                    399:                    for(k = 0; k < (*(((struct_matrice *) (*s_objet_argument)
                    400:                            .objet))).nombre_colonnes; k++)
                    401:                    {
                    402:                        ((real8 *) accumulateur)[k] = ((real8)
                    403:                                (((integer8 **) (*((struct_matrice *)
                    404:                                (*s_objet_argument).objet)).tableau)[i][k]) *
                    405:                                ((real8) ((integer8 **) (*((struct_matrice *)
                    406:                                (*s_objet_argument).objet)).tableau)[k][j]));
                    407:                    }
                    408: 
                    409:                    ((real8 **) (*((struct_matrice *)
                    410:                            (*s_objet_resultat).objet)).tableau)[i][j] =
                    411:                            sommation_vecteur_reel(accumulateur,
                    412:                            &((*(((struct_matrice *) (*s_objet_argument)
                    413:                            .objet))).nombre_colonnes), &erreur_memoire);
                    414: 
                    415:                    if (erreur_memoire == d_vrai)
                    416:                    {
                    417:                        (*s_etat_processus).erreur_systeme =
                    418:                                d_es_allocation_memoire;
                    419:                        return;
                    420:                    }
                    421:                }
                    422:            }
                    423: 
                    424:            free(accumulateur);
                    425:        }
                    426:    }
                    427: 
                    428: /*
                    429: --------------------------------------------------------------------------------
                    430:   Carré d'une matrice réelle
                    431: --------------------------------------------------------------------------------
                    432: */
                    433: 
                    434:    else if ((*s_objet_argument).type == MRL)
                    435:    {
                    436:        if ((*((struct_matrice *) (*s_objet_argument).objet)).nombre_lignes !=
                    437:                (*((struct_matrice *) (*s_objet_argument).objet))
                    438:                .nombre_colonnes)
                    439:        {
                    440:            liberation(s_etat_processus, s_objet_argument);
                    441: 
                    442:            (*s_etat_processus).erreur_execution = d_ex_dimensions_invalides;
                    443:            return;
                    444:        }
                    445: 
                    446:        if ((s_objet_resultat = allocation(s_etat_processus, MRL)) == NULL)
                    447:        {
                    448:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    449:            return;
                    450:        }
                    451: 
                    452:        (*((struct_matrice *) (*s_objet_resultat).objet)).nombre_lignes =
                    453:                (*(((struct_matrice *) (*s_objet_argument)
                    454:                .objet))).nombre_lignes;
                    455:        (*((struct_matrice *) (*s_objet_resultat).objet)).nombre_colonnes =
                    456:                (*(((struct_matrice *) (*s_objet_argument)
                    457:                .objet))).nombre_colonnes;
                    458: 
                    459:        if (((*((struct_matrice *) (*s_objet_resultat).objet)).tableau =
                    460:                malloc((*(((struct_matrice *) (*s_objet_resultat)
                    461:                .objet))).nombre_lignes * sizeof(real8 *))) == NULL)
                    462:        {
                    463:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    464:            return;
                    465:        }
                    466: 
                    467:        if ((accumulateur = malloc((*(((struct_matrice *)
                    468:                (*s_objet_argument).objet))).nombre_colonnes * sizeof(real8)))
                    469:                == NULL)
                    470:        {
                    471:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    472:            return;
                    473:        }
                    474: 
                    475:        for(i = 0; i < (*(((struct_matrice *) (*s_objet_resultat)
                    476:                .objet))).nombre_lignes; i++)
                    477:        {
                    478:            if (((*((struct_matrice *) (*s_objet_resultat).objet)).tableau[i] =
                    479:                    malloc((*(((struct_matrice *) (*s_objet_resultat)
                    480:                    .objet))).nombre_colonnes * sizeof(real8))) == NULL)
                    481:            {
                    482:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    483:                return;
                    484:            }
                    485: 
                    486:            for(j = 0; j < (*(((struct_matrice *) (*s_objet_resultat)
                    487:                    .objet))).nombre_colonnes; j++)
                    488:            {
                    489:                ((real8 **) (*((struct_matrice *)
                    490:                        (*s_objet_resultat).objet)).tableau)[i][j] = 0;
                    491: 
                    492:                for(k = 0; k < (*(((struct_matrice *) (*s_objet_argument)
                    493:                        .objet))).nombre_colonnes; k++)
                    494:                {
                    495:                    ((real8 *) accumulateur)[k] =
                    496:                            (((real8 **) (*((struct_matrice *)
                    497:                            (*s_objet_argument).objet)).tableau)[i][k] *
                    498:                            ((real8 **) (*((struct_matrice *)
                    499:                            (*s_objet_argument).objet)).tableau)[k][j]);
                    500:                }
                    501: 
                    502:                ((real8 **) (*((struct_matrice *) (*s_objet_resultat).objet))
                    503:                        .tableau)[i][j] = sommation_vecteur_reel(
                    504:                        accumulateur, &((*(((struct_matrice *)
                    505:                        (*s_objet_argument).objet))).nombre_colonnes),
                    506:                        &erreur_memoire);
                    507: 
                    508:                if (erreur_memoire == d_vrai)
                    509:                {
                    510:                    (*s_etat_processus).erreur_systeme =
                    511:                            d_es_allocation_memoire;
                    512:                    return;
                    513:                }
                    514:            }
                    515:        }
                    516: 
                    517:        free(accumulateur);
                    518:    }
                    519: 
                    520: /*
                    521: --------------------------------------------------------------------------------
                    522:   Carré d'une matrice complexe
                    523: --------------------------------------------------------------------------------
                    524: */
                    525: 
                    526:    else if ((*s_objet_argument).type == MCX)
                    527:    {
                    528:        if ((*((struct_matrice *) (*s_objet_argument).objet)).nombre_lignes !=
                    529:                (*((struct_matrice *) (*s_objet_argument).objet))
                    530:                .nombre_colonnes)
                    531:        {
                    532:            liberation(s_etat_processus, s_objet_argument);
                    533: 
                    534:            (*s_etat_processus).erreur_execution = d_ex_dimensions_invalides;
                    535:            return;
                    536:        }
                    537: 
                    538:        if ((s_objet_resultat = allocation(s_etat_processus, MCX)) == NULL)
                    539:        {
                    540:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    541:            return;
                    542:        }
                    543: 
                    544:        (*((struct_matrice *) (*s_objet_resultat).objet)).nombre_lignes =
                    545:                (*(((struct_matrice *) (*s_objet_argument)
                    546:                .objet))).nombre_lignes;
                    547:        (*((struct_matrice *) (*s_objet_resultat).objet)).nombre_colonnes =
                    548:                (*(((struct_matrice *) (*s_objet_argument)
                    549:                .objet))).nombre_colonnes;
                    550: 
                    551:        if (((*((struct_matrice *) (*s_objet_resultat).objet)).tableau =
                    552:                malloc((*(((struct_matrice *) (*s_objet_resultat)
                    553:                .objet))).nombre_lignes * sizeof(struct_complexe16 *))) == NULL)
                    554:        {
                    555:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    556:            return;
                    557:        }
                    558: 
                    559:        if ((accumulateur = malloc((*(((struct_matrice *)
                    560:                (*s_objet_argument).objet))).nombre_colonnes *
                    561:                sizeof(complex16))) == NULL)
                    562:        {
                    563:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    564:            return;
                    565:        }
                    566: 
                    567:        for(i = 0; i < (*(((struct_matrice *) (*s_objet_resultat)
                    568:                .objet))).nombre_lignes; i++)
                    569:        {
                    570:            if (((*((struct_matrice *) (*s_objet_resultat).objet)).tableau[i] =
                    571:                    malloc((*(((struct_matrice *) (*s_objet_resultat)
                    572:                    .objet))).nombre_colonnes * sizeof(struct_complexe16)))
                    573:                    == NULL)
                    574:            {
                    575:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    576:                return;
                    577:            }
                    578: 
                    579:            for(j = 0; j < (*(((struct_matrice *) (*s_objet_resultat)
                    580:                    .objet))).nombre_colonnes; j++)
                    581:            {
                    582:                ((struct_complexe16 **) (*((struct_matrice *)
                    583:                        (*s_objet_resultat).objet)).tableau)[i][j]
                    584:                        .partie_reelle = 0;
                    585:                ((struct_complexe16 **) (*((struct_matrice *)
                    586:                        (*s_objet_resultat).objet)).tableau)[i][j]
                    587:                        .partie_imaginaire = 0;
                    588: 
                    589:                for(k = 0; k < (*(((struct_matrice *) (*s_objet_argument)
                    590:                        .objet))).nombre_colonnes; k++)
                    591:                {
                    592:                    f77multiplicationcc_(&(((struct_complexe16 **)
                    593:                            (*((struct_matrice *) (*s_objet_argument).objet))
                    594:                            .tableau)[i][k]), &(((struct_complexe16 **)
                    595:                            (*((struct_matrice *) (*s_objet_argument).objet))
                    596:                            .tableau)[k][j]), &(((complex16 *)
                    597:                            accumulateur)[k]));
                    598:                }
                    599: 
                    600:                ((complex16 **) (*((struct_matrice *)
                    601:                        (*s_objet_resultat).objet)).tableau)[i][j] =
                    602:                        sommation_vecteur_complexe(accumulateur,
                    603:                        &((*(((struct_matrice *)
                    604:                        (*s_objet_argument).objet))).nombre_colonnes),
                    605:                        &erreur_memoire);
                    606: 
                    607:                if (erreur_memoire == d_vrai)
                    608:                {
                    609:                    (*s_etat_processus).erreur_systeme =
                    610:                            d_es_allocation_memoire;
                    611:                    return;
                    612:                }
                    613:            }
                    614:        }
                    615: 
                    616:        free(accumulateur);
                    617:    }
                    618: 
                    619: /*
                    620: --------------------------------------------------------------------------------
                    621:   Carré d'un nom
                    622: --------------------------------------------------------------------------------
                    623: */
                    624:    else if ((*s_objet_argument).type == NOM)
                    625:    {
                    626:        if ((s_objet_resultat = allocation(s_etat_processus, ALG)) == NULL)
                    627:        {
                    628:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    629:            return;
                    630:        }
                    631: 
                    632:        if (((*s_objet_resultat).objet =
                    633:                allocation_maillon(s_etat_processus)) == NULL)
                    634:        {
                    635:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    636:            return;
                    637:        }
                    638: 
                    639:        l_element_courant = (*s_objet_resultat).objet;
                    640: 
                    641:        if (((*l_element_courant).donnee = allocation(s_etat_processus, FCT))
                    642:                == NULL)
                    643:        {
                    644:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    645:            return;
                    646:        }
                    647: 
                    648:        (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                    649:                .nombre_arguments = 0;
                    650:        (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                    651:                .fonction = instruction_vers_niveau_superieur;
                    652: 
                    653:        if (((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                    654:                .nom_fonction = malloc(3 * sizeof(unsigned char))) == NULL)
                    655:        {
                    656:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    657:            return;
                    658:        }
                    659: 
                    660:        strcpy((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                    661:                .nom_fonction, "<<");
                    662: 
                    663:        if (((*l_element_courant).suivant =
                    664:                allocation_maillon(s_etat_processus)) == NULL)
                    665:        {
                    666:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    667:            return;
                    668:        }
                    669: 
                    670:        l_element_courant = (*l_element_courant).suivant;
                    671:        (*l_element_courant).donnee = s_objet_argument;
                    672: 
                    673:        if (((*l_element_courant).suivant =
                    674:                allocation_maillon(s_etat_processus)) == NULL)
                    675:        {
                    676:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    677:            return;
                    678:        }
                    679: 
                    680:        l_element_courant = (*l_element_courant).suivant;
                    681: 
                    682:        if (((*l_element_courant).donnee = allocation(s_etat_processus, FCT))
                    683:                == NULL)
                    684:        {
                    685:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    686:            return;
                    687:        }
                    688: 
                    689:        (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                    690:                .nombre_arguments = 1;
                    691:        (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                    692:                .fonction = instruction_sq;
                    693: 
                    694:        if (((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                    695:                .nom_fonction = malloc(3 * sizeof(unsigned char))) == NULL)
                    696:        {
                    697:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    698:            return;
                    699:        }
                    700:            
                    701:        strcpy((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                    702:                .nom_fonction, "SQ");
                    703: 
                    704:        if (((*l_element_courant).suivant =
                    705:                allocation_maillon(s_etat_processus)) == NULL)
                    706:        {
                    707:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    708:            return;
                    709:        }
                    710: 
                    711:        l_element_courant = (*l_element_courant).suivant;
                    712: 
                    713:        if (((*l_element_courant).donnee = allocation(s_etat_processus, FCT))
                    714:                == NULL)
                    715:        {
                    716:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    717:            return;
                    718:        }
                    719: 
                    720:        (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                    721:                .nombre_arguments = 0;
                    722:        (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                    723:                .fonction = instruction_vers_niveau_inferieur;
                    724: 
                    725:        if (((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                    726:                .nom_fonction = malloc(3 * sizeof(unsigned char))) == NULL)
                    727:        {
                    728:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    729:            return;
                    730:        }
                    731: 
                    732:        strcpy((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                    733:                .nom_fonction, ">>");
                    734: 
                    735:        (*l_element_courant).suivant = NULL;
                    736:        s_objet_argument = NULL;
                    737:    }
                    738: 
                    739: /*
                    740: --------------------------------------------------------------------------------
                    741:   Carré d'une expression
                    742: --------------------------------------------------------------------------------
                    743: */
                    744: 
                    745:    else if (((*s_objet_argument).type == ALG) ||
                    746:            ((*s_objet_argument).type == RPN))
                    747:    {
                    748:        if ((s_copie_argument = copie_objet(s_etat_processus, s_objet_argument,
                    749:                'N')) == NULL)
                    750:        {
                    751:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    752:            return;
                    753:        }
                    754: 
                    755:        l_element_courant = (struct_liste_chainee *)
                    756:                (*s_copie_argument).objet;
                    757:        l_element_precedent = l_element_courant;
                    758: 
                    759:        while((*l_element_courant).suivant != NULL)
                    760:        {
                    761:            l_element_precedent = l_element_courant;
                    762:            l_element_courant = (*l_element_courant).suivant;
                    763:        }
                    764: 
                    765:        if (((*l_element_precedent).suivant =
                    766:                allocation_maillon(s_etat_processus)) == NULL)
                    767:        {
                    768:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    769:            return;
                    770:        }
                    771: 
                    772:        if (((*(*l_element_precedent).suivant).donnee =
                    773:                allocation(s_etat_processus, FCT)) == NULL)
                    774:        {
                    775:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    776:            return;
                    777:        }
                    778: 
                    779:        (*((struct_fonction *) (*(*(*l_element_precedent).suivant)
                    780:                .donnee).objet)).nombre_arguments = 1;
                    781:        (*((struct_fonction *) (*(*(*l_element_precedent).suivant)
                    782:                .donnee).objet)).fonction = instruction_sq;
                    783: 
                    784:        if (((*((struct_fonction *) (*(*(*l_element_precedent)
                    785:                .suivant).donnee).objet)).nom_fonction =
                    786:                malloc(3 * sizeof(unsigned char))) == NULL)
                    787:        {
                    788:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    789:            return;
                    790:        }
                    791: 
                    792:        strcpy((*((struct_fonction *) (*(*(*l_element_precedent)
                    793:                .suivant).donnee).objet)).nom_fonction, "SQ");
                    794: 
                    795:        (*(*l_element_precedent).suivant).suivant = l_element_courant;
                    796: 
                    797:        s_objet_resultat = s_copie_argument;
                    798:    }
                    799: 
                    800: /*
                    801: --------------------------------------------------------------------------------
                    802:   Carré impossible
                    803: --------------------------------------------------------------------------------
                    804: */
                    805: 
                    806:    else
                    807:    {
                    808:        liberation(s_etat_processus, s_objet_argument);
                    809: 
                    810:        (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
                    811:        return;
                    812:    }
                    813: 
                    814:    liberation(s_etat_processus, s_objet_argument);
                    815: 
                    816:    if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    817:            s_objet_resultat) == d_erreur)
                    818:    {
                    819:        return;
                    820:    }
                    821: 
                    822:    return;
                    823: }
                    824: 
                    825: 
                    826: /*
                    827: ================================================================================
                    828:   Fonction 'sqrt'
                    829: ================================================================================
                    830:   Entrées : pointeur sur une struct_processus
                    831: --------------------------------------------------------------------------------
                    832:   Sorties :
                    833: --------------------------------------------------------------------------------
                    834:   Effets de bord : néant
                    835: ================================================================================
                    836: */
                    837: 
                    838: void
                    839: instruction_sqrt(struct_processus *s_etat_processus)
                    840: {
                    841:    struct_liste_chainee            *l_element_courant;
                    842:    struct_liste_chainee            *l_element_precedent;
                    843: 
                    844:    struct_objet                    *s_copie_argument;
                    845:    struct_objet                    *s_objet_argument;
                    846:    struct_objet                    *s_objet_resultat;
                    847: 
                    848:    (*s_etat_processus).erreur_execution = d_ex;
                    849: 
                    850:    if ((*s_etat_processus).affichage_arguments == 'Y')
                    851:    {
                    852:        printf("\n  SQRT ");
                    853: 
                    854:        if ((*s_etat_processus).langue == 'F')
                    855:        {
                    856:            printf("(racine carrée)\n\n");
                    857:        }
                    858:        else
                    859:        {
                    860:            printf("(square root)\n\n");
                    861:        }
                    862: 
                    863:        printf("    1: %s, %s, %s\n", d_INT, d_REL, d_CPL);
                    864:        printf("->  1: %s, %s\n\n", d_REL, d_CPL);
                    865: 
                    866:        printf("    1: %s, %s\n", d_NOM, d_ALG);
                    867:        printf("->  1: %s\n\n", d_ALG);
                    868: 
                    869:        printf("    1: %s\n", d_RPN);
                    870:        printf("->  1: %s\n", d_RPN);
                    871: 
                    872:        return;
                    873:    }
                    874:    else if ((*s_etat_processus).test_instruction == 'Y')
                    875:    {
                    876:        (*s_etat_processus).nombre_arguments = 1;
                    877:        return;
                    878:    }
                    879: 
                    880:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                    881:    {
                    882:        if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
                    883:        {
                    884:            return;
                    885:        }
                    886:    }
                    887: 
                    888:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    889:            &s_objet_argument) == d_erreur)
                    890:    {
                    891:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                    892:        return;
                    893:    }
                    894: 
                    895: /*
                    896: --------------------------------------------------------------------------------
                    897:   Racine carrée d'un entier
                    898: --------------------------------------------------------------------------------
                    899: */
                    900: 
                    901:    if ((*s_objet_argument).type == INT)
                    902:    {
                    903:        if ((*((integer8 *) (*s_objet_argument).objet)) >= 0)
                    904:        {
                    905:            if ((s_objet_resultat = allocation(s_etat_processus, REL))
                    906:                    == NULL)
                    907:            {
                    908:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    909:                return;
                    910:            }
                    911: 
                    912:            f77racinecarreeip_(&((*((integer8 *) (*s_objet_argument).objet))),
                    913:                    &((*((real8 *) (*s_objet_resultat).objet))));
                    914:        }
                    915:        else
                    916:        {
                    917:            if ((s_objet_resultat = allocation(s_etat_processus, CPL))
                    918:                    == NULL)
                    919:            {
                    920:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    921:                return;
                    922:            }
                    923: 
                    924:            f77racinecarreein_(&((*((integer8 *) (*s_objet_argument).objet))),
                    925:                    &((*((struct_complexe16 *) (*s_objet_resultat).objet))));
                    926:        }
                    927:    }
                    928: 
                    929: /*
                    930: --------------------------------------------------------------------------------
                    931:   Racine carré d'un réel
                    932: --------------------------------------------------------------------------------
                    933: */
                    934: 
                    935:    else if ((*s_objet_argument).type == REL)
                    936:    {
                    937:        if ((*((real8 *) (*s_objet_argument).objet)) >= 0)
                    938:        {
                    939:            if ((s_objet_resultat = allocation(s_etat_processus, REL))
                    940:                    == NULL)
                    941:            {
                    942:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    943:                return;
                    944:            }
                    945: 
                    946:            f77racinecarreerp_(&((*((real8 *) (*s_objet_argument).objet))),
                    947:                    &((*((real8 *) (*s_objet_resultat).objet))));
                    948:        }
                    949:        else
                    950:        {
                    951:            if ((s_objet_resultat = allocation(s_etat_processus, CPL))
                    952:                    == NULL)
                    953:            {
                    954:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    955:                return;
                    956:            }
                    957: 
                    958:            f77racinecarreern_(&((*((real8 *) (*s_objet_argument).objet))),
                    959:                    &((*((struct_complexe16 *) (*s_objet_resultat).objet))));
                    960:        }
                    961:    }
                    962: 
                    963: /*
                    964: --------------------------------------------------------------------------------
                    965:   Racine carrée d'un complexe
                    966: --------------------------------------------------------------------------------
                    967: */
                    968: 
                    969:    else if ((*s_objet_argument).type == CPL)
                    970:    {
                    971:        if ((s_objet_resultat = allocation(s_etat_processus, CPL)) == NULL)
                    972:        {
                    973:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    974:            return;
                    975:        }
                    976: 
                    977:        f77racinecarreec_(&((*((struct_complexe16 *) (*s_objet_argument)
                    978:                .objet))), &((*((struct_complexe16 *) (*s_objet_resultat)
                    979:                .objet))));
                    980:    }
                    981: 
                    982: /*
                    983: --------------------------------------------------------------------------------
                    984:   Racine carrée d'un nom
                    985: --------------------------------------------------------------------------------
                    986: */
                    987: 
                    988:    else if ((*s_objet_argument).type == NOM)
                    989:    {
                    990:        if ((s_objet_resultat = allocation(s_etat_processus, ALG)) == NULL)
                    991:        {
                    992:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    993:            return;
                    994:        }
                    995: 
                    996:        if (((*s_objet_resultat).objet =
                    997:                allocation_maillon(s_etat_processus)) == NULL)
                    998:        {
                    999:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1000:            return;
                   1001:        }
                   1002: 
                   1003:        l_element_courant = (*s_objet_resultat).objet;
                   1004: 
                   1005:        if (((*l_element_courant).donnee = allocation(s_etat_processus, FCT))
                   1006:                == NULL)
                   1007:        {
                   1008:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1009:            return;
                   1010:        }
                   1011: 
                   1012:        (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   1013:                .nombre_arguments = 0;
                   1014:        (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   1015:                .fonction = instruction_vers_niveau_superieur;
                   1016: 
                   1017:        if (((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   1018:                .nom_fonction = malloc(3 * sizeof(unsigned char))) == NULL)
                   1019:        {
                   1020:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1021:            return;
                   1022:        }
                   1023: 
                   1024:        strcpy((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   1025:                .nom_fonction, "<<");
                   1026: 
                   1027:        if (((*l_element_courant).suivant =
                   1028:                allocation_maillon(s_etat_processus)) == NULL)
                   1029:        {
                   1030:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1031:            return;
                   1032:        }
                   1033: 
                   1034:        l_element_courant = (*l_element_courant).suivant;
                   1035:        (*l_element_courant).donnee = s_objet_argument;
                   1036: 
                   1037:        if (((*l_element_courant).suivant =
                   1038:                allocation_maillon(s_etat_processus)) == NULL)
                   1039:        {
                   1040:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1041:            return;
                   1042:        }
                   1043: 
                   1044:        l_element_courant = (*l_element_courant).suivant;
                   1045: 
                   1046:        if (((*l_element_courant).donnee = allocation(s_etat_processus, FCT))
                   1047:                == NULL)
                   1048:        {
                   1049:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1050:            return;
                   1051:        }
                   1052: 
                   1053:        (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   1054:                .nombre_arguments = 1;
                   1055:        (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   1056:                .fonction = instruction_sqrt;
                   1057: 
                   1058:        if (((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   1059:                .nom_fonction = malloc(5 * sizeof(unsigned char))) == NULL)
                   1060:        {
                   1061:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1062:            return;
                   1063:        }
                   1064:            
                   1065:        strcpy((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   1066:                .nom_fonction, "SQRT");
                   1067: 
                   1068:        if (((*l_element_courant).suivant =
                   1069:                allocation_maillon(s_etat_processus)) == NULL)
                   1070:        {
                   1071:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1072:            return;
                   1073:        }
                   1074: 
                   1075:        l_element_courant = (*l_element_courant).suivant;
                   1076: 
                   1077:        if (((*l_element_courant).donnee = allocation(s_etat_processus, FCT))
                   1078:                == NULL)
                   1079:        {
                   1080:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1081:            return;
                   1082:        }
                   1083: 
                   1084:        (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   1085:                .nombre_arguments = 0;
                   1086:        (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   1087:                .fonction = instruction_vers_niveau_inferieur;
                   1088: 
                   1089:        if (((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   1090:                .nom_fonction = malloc(3 * sizeof(unsigned char))) == NULL)
                   1091:        {
                   1092:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1093:            return;
                   1094:        }
                   1095: 
                   1096:        strcpy((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   1097:                .nom_fonction, ">>");
                   1098: 
                   1099:        (*l_element_courant).suivant = NULL;
                   1100:        s_objet_argument = NULL;
                   1101:    }
                   1102: 
                   1103: /*
                   1104: --------------------------------------------------------------------------------
                   1105:   Racine carrée d'une expression
                   1106: --------------------------------------------------------------------------------
                   1107: */
                   1108: 
                   1109:    else if (((*s_objet_argument).type == ALG) ||
                   1110:            ((*s_objet_argument).type == RPN))
                   1111:    {
                   1112:        if ((s_copie_argument = copie_objet(s_etat_processus, s_objet_argument,
                   1113:                'N')) == NULL)
                   1114:        {
                   1115:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1116:            return;
                   1117:        }
                   1118: 
                   1119:        l_element_courant = (struct_liste_chainee *)
                   1120:                (*s_copie_argument).objet;
                   1121:        l_element_precedent = l_element_courant;
                   1122: 
                   1123:        while((*l_element_courant).suivant != NULL)
                   1124:        {
                   1125:            l_element_precedent = l_element_courant;
                   1126:            l_element_courant = (*l_element_courant).suivant;
                   1127:        }
                   1128: 
                   1129:        if (((*l_element_precedent).suivant =
                   1130:                allocation_maillon(s_etat_processus)) == NULL)
                   1131:        {
                   1132:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1133:            return;
                   1134:        }
                   1135: 
                   1136:        if (((*(*l_element_precedent).suivant).donnee =
                   1137:                allocation(s_etat_processus, FCT)) == NULL)
                   1138:        {
                   1139:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1140:            return;
                   1141:        }
                   1142: 
                   1143:        (*((struct_fonction *) (*(*(*l_element_precedent).suivant)
                   1144:                .donnee).objet)).nombre_arguments = 1;
                   1145:        (*((struct_fonction *) (*(*(*l_element_precedent).suivant)
                   1146:                .donnee).objet)).fonction = instruction_sqrt;
                   1147: 
                   1148:        if (((*((struct_fonction *) (*(*(*l_element_precedent)
                   1149:                .suivant).donnee).objet)).nom_fonction =
                   1150:                malloc(5 * sizeof(unsigned char))) == NULL)
                   1151:        {
                   1152:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1153:            return;
                   1154:        }
                   1155: 
                   1156:        strcpy((*((struct_fonction *) (*(*(*l_element_precedent)
                   1157:                .suivant).donnee).objet)).nom_fonction, "SQRT");
                   1158: 
                   1159:        (*(*l_element_precedent).suivant).suivant = l_element_courant;
                   1160: 
                   1161:        s_objet_resultat = s_copie_argument;
                   1162:    }
                   1163: 
                   1164: /*
                   1165: --------------------------------------------------------------------------------
                   1166:   Racine carrée impossible
                   1167: --------------------------------------------------------------------------------
                   1168: */
                   1169: 
                   1170:    else
                   1171:    {
                   1172:        liberation(s_etat_processus, s_objet_argument);
                   1173: 
                   1174:        (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
                   1175:        return;
                   1176:    }
                   1177: 
                   1178:    liberation(s_etat_processus, s_objet_argument);
                   1179: 
                   1180:    if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   1181:            s_objet_resultat) == d_erreur)
                   1182:    {
                   1183:        return;
                   1184:    }
                   1185: 
                   1186:    return;
                   1187: }
                   1188: 
                   1189: 
                   1190: /*
                   1191: ================================================================================
                   1192:   Fonction 'same'
                   1193: ================================================================================
                   1194:   Entrées : pointeur sur une structure struct_processus
                   1195: --------------------------------------------------------------------------------
                   1196:   Sorties :
                   1197: --------------------------------------------------------------------------------
                   1198:   Effets de bord : néant
                   1199: ================================================================================
                   1200: */
                   1201: 
                   1202: void
                   1203: instruction_same(struct_processus *s_etat_processus)
                   1204: {
                   1205:    struct_liste_chainee        *l_element_courant;
                   1206:    struct_liste_chainee        *l_element_courant_1;
                   1207:    struct_liste_chainee        *l_element_courant_2;
                   1208:    struct_liste_chainee        *l_element_precedent;
                   1209: 
                   1210:    struct_objet                *s_copie_argument_1;
                   1211:    struct_objet                *s_copie_argument_2;
                   1212:    struct_objet                *s_objet_argument_1;
                   1213:    struct_objet                *s_objet_argument_2;
                   1214:    struct_objet                *s_objet_resultat;
                   1215:    struct_objet                *s_objet_resultat_intermediaire;
                   1216: 
                   1217:    logical1                    difference;
                   1218: 
                   1219:    unsigned long               i;
                   1220:    unsigned long               j;
                   1221:    unsigned long               nombre_elements;
                   1222: 
                   1223:    (*s_etat_processus).erreur_execution = d_ex;
                   1224: 
                   1225:    if ((*s_etat_processus).affichage_arguments == 'Y')
                   1226:    {
                   1227:        printf("\n  SAME ");
                   1228: 
                   1229:        if ((*s_etat_processus).langue == 'F')
                   1230:        {
                   1231:            printf("(opérateur égalité)\n\n");
                   1232:        }
                   1233:        else
                   1234:        {
                   1235:            printf("(equality operator)\n\n");
                   1236:        }
                   1237: 
                   1238:        printf("    2: %s, %s, %s\n", d_INT, d_REL, d_CPL);
                   1239:        printf("    1: %s, %s, %s\n", d_INT, d_REL, d_CPL);
                   1240:        printf("->  1: %s\n\n", d_INT);
                   1241: 
                   1242:        printf("    2: %s\n", d_BIN);
                   1243:        printf("    1: %s\n", d_BIN);
                   1244:        printf("->  1: %s\n\n", d_INT);
                   1245: 
                   1246:        printf("    2: %s\n", d_LST);
                   1247:        printf("    1: %s\n", d_LST);
                   1248:        printf("->  1: %s\n\n", d_INT);
                   1249: 
                   1250:        printf("    2: %s, %s, %s\n", d_VIN, d_VRL, d_VCX);
                   1251:        printf("    1: %s, %s, %s\n", d_VIN, d_VRL, d_VCX);
                   1252:        printf("->  1: %s\n\n", d_INT);
                   1253: 
                   1254:        printf("    2: %s, %s, %s\n", d_MIN, d_MRL, d_MCX);
                   1255:        printf("    1: %s, %s, %s\n", d_MIN, d_MRL, d_MCX);
                   1256:        printf("->  1: %s\n\n", d_INT);
                   1257: 
                   1258:        printf("    2: %s\n", d_TAB);
                   1259:        printf("    1: %s\n", d_TAB);
                   1260:        printf("->  1: %s\n\n", d_INT);
                   1261: 
                   1262:        printf("    2: %s\n", d_NOM);
                   1263:        printf("    1: %s, %s, %s, %s\n", d_NOM, d_ALG, d_INT, d_REL);
                   1264:        printf("->  1: %s\n\n", d_ALG);
                   1265: 
                   1266:        printf("    2: %s, %s, %s, %s\n", d_NOM, d_ALG, d_INT, d_REL);
                   1267:        printf("    1: %s\n", d_NOM);
                   1268:        printf("->  1: %s\n\n", d_ALG);
                   1269: 
                   1270:        printf("    2: %s\n", d_ALG);
                   1271:        printf("    1: %s\n", d_ALG);
                   1272:        printf("->  1: %s\n\n", d_ALG);
                   1273: 
                   1274:        printf("    2: %s\n", d_RPN);
                   1275:        printf("    1: %s\n", d_RPN);
                   1276:        printf("->  1: %s\n", d_RPN);
                   1277: 
1.10      bertrand 1278:        printf("    2: %s\n", d_PRC);
                   1279:        printf("    1: %s\n", d_PRC);
                   1280:        printf("->  1: %s\n", d_INT);
                   1281: 
1.1       bertrand 1282:        return;
                   1283:    }
                   1284:    else if ((*s_etat_processus).test_instruction == 'Y')
                   1285:    {
                   1286:        (*s_etat_processus).nombre_arguments = -1;
                   1287:        return;
                   1288:    }
                   1289:    
                   1290:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                   1291:    {
                   1292:        if (empilement_pile_last(s_etat_processus, 2) == d_erreur)
                   1293:        {
                   1294:        return;
                   1295:    }
                   1296:    }
                   1297: 
                   1298:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   1299:            &s_objet_argument_1) == d_erreur)
                   1300:    {
                   1301:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                   1302:        return;
                   1303:    }
                   1304: 
                   1305:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   1306:            &s_objet_argument_2) == d_erreur)
                   1307:    {
                   1308:        liberation(s_etat_processus, s_objet_argument_1);
                   1309: 
                   1310:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                   1311:        return;
                   1312:    }
                   1313: 
                   1314: /*
                   1315: --------------------------------------------------------------------------------
                   1316:   SAME sur des valeurs numériques
                   1317: --------------------------------------------------------------------------------
                   1318: */
                   1319: 
                   1320:    if ((((*s_objet_argument_1).type == INT) ||
                   1321:            ((*s_objet_argument_1).type == REL)) &&
                   1322:            (((*s_objet_argument_2).type == INT) ||
                   1323:            ((*s_objet_argument_2).type == REL)))
                   1324:    {
                   1325:        if ((s_objet_resultat = allocation(s_etat_processus, INT)) == NULL)
                   1326:        {
                   1327:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1328:            return;
                   1329:        }
                   1330: 
                   1331:        if ((*s_objet_argument_1).type == INT)
                   1332:        {
                   1333:            if ((*s_objet_argument_2).type == INT)
                   1334:            {
                   1335:                (*((integer8 *) (*s_objet_resultat).objet)) =
                   1336:                        ((*((integer8 *) (*s_objet_argument_1).objet)) ==
                   1337:                        (*((integer8 *) (*s_objet_argument_2).objet)))
                   1338:                        ? -1 : 0;
                   1339:            }
                   1340:            else
                   1341:            {
                   1342:                (*((integer8 *) (*s_objet_resultat).objet)) =
                   1343:                        ((*((integer8 *) (*s_objet_argument_1).objet)) ==
                   1344:                        (*((real8 *) (*s_objet_argument_2).objet)))
                   1345:                        ? -1 : 0;
                   1346:            }
                   1347:        }
                   1348:        else
                   1349:        {
                   1350:            if ((*s_objet_argument_2).type == INT)
                   1351:            {
                   1352:                (*((integer8 *) (*s_objet_resultat).objet)) =
                   1353:                        ((*((real8 *) (*s_objet_argument_1).objet)) ==
                   1354:                        (*((integer8 *) (*s_objet_argument_2).objet)))
                   1355:                        ? -1 : 0;
                   1356:            }
                   1357:            else
                   1358:            {
                   1359:                (*((integer8 *) (*s_objet_resultat).objet)) =
                   1360:                        ((*((real8 *) (*s_objet_argument_1).objet)) ==
                   1361:                        (*((real8 *) (*s_objet_argument_2).objet)))
                   1362:                        ? -1 : 0;
                   1363:            }
                   1364:        }
                   1365:    }
                   1366: 
                   1367: /*
                   1368: --------------------------------------------------------------------------------
                   1369:   SAME Processus
                   1370: --------------------------------------------------------------------------------
                   1371: */
                   1372: 
                   1373:    else if (((*s_objet_argument_1).type == PRC) &&
                   1374:            ((*s_objet_argument_2).type == PRC))
                   1375:    {
                   1376:        if ((s_objet_resultat = allocation(s_etat_processus, INT)) == NULL)
                   1377:        {
                   1378:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1379:            return;
                   1380:        }
                   1381: 
                   1382:        if ((*(*((struct_processus_fils *) (*s_objet_argument_1).objet)).thread)
                   1383:                .processus_detache != (*(*((struct_processus_fils *)
                   1384:                (*s_objet_argument_2).objet)).thread).processus_detache)
                   1385:        {
                   1386:            (*((integer8 *) (*s_objet_resultat).objet)) = 0;
                   1387:        }
                   1388:        else
                   1389:        {
                   1390:            if ((*(*((struct_processus_fils *) (*s_objet_argument_1).objet))
                   1391:                    .thread).processus_detache == d_vrai)
                   1392:            {
                   1393:                (*((integer8 *) (*s_objet_resultat).objet)) =
                   1394:                        ((*(*((struct_processus_fils *) (*s_objet_argument_1)
                   1395:                        .objet)).thread).pid ==
                   1396:                        (*(*((struct_processus_fils *) (*s_objet_argument_2)
                   1397:                        .objet)).thread).pid) ? -1 : 0;
                   1398:            }
                   1399:            else
                   1400:            {
                   1401:                (*((integer8 *) (*s_objet_resultat).objet)) =
                   1402:                        ((pthread_equal((*(*((struct_processus_fils *)
                   1403:                        (*s_objet_argument_1).objet)).thread).tid,
                   1404:                        (*(*((struct_processus_fils *) (*s_objet_argument_2)
                   1405:                        .objet)).thread).tid) != 0) &&
                   1406:                        ((*(*((struct_processus_fils *)
                   1407:                        (*s_objet_argument_1).objet)).thread).pid ==
                   1408:                        (*(*((struct_processus_fils *) (*s_objet_argument_2)
                   1409:                        .objet)).thread).pid)) ? -1 : 0;
                   1410:            }
                   1411:        }
                   1412:    }
                   1413: 
                   1414: /*
                   1415: --------------------------------------------------------------------------------
                   1416:   SAME complexe
                   1417: --------------------------------------------------------------------------------
                   1418: */
                   1419: 
                   1420:    else if (((*s_objet_argument_1).type == CPL) &&
                   1421:            ((*s_objet_argument_2).type == CPL))
                   1422:    {
                   1423:        if ((s_objet_resultat = allocation(s_etat_processus, INT)) == NULL)
                   1424:        {
                   1425:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1426:            return;
                   1427:        }
                   1428: 
                   1429:        (*((integer8 *) (*s_objet_resultat).objet)) =
                   1430:                (((*((struct_complexe16 *) (*s_objet_argument_1).objet))
                   1431:                .partie_reelle == (*((struct_complexe16 *) (*s_objet_argument_2)
                   1432:                .objet)).partie_reelle) && ((*((struct_complexe16 *)
                   1433:                (*s_objet_argument_1).objet)).partie_imaginaire ==
                   1434:                ((*((struct_complexe16 *) (*s_objet_argument_1).objet))
                   1435:                .partie_imaginaire))) ? -1 : 0;
                   1436:    }
                   1437: 
                   1438: /*
                   1439: --------------------------------------------------------------------------------
                   1440:   SAME binaire
                   1441: --------------------------------------------------------------------------------
                   1442: */
                   1443: 
                   1444:    else if (((*s_objet_argument_1).type == BIN) &&
                   1445:            ((*s_objet_argument_2).type == BIN))
                   1446:    {
                   1447:        if ((s_objet_resultat = allocation(s_etat_processus, INT)) == NULL)
                   1448:        {
                   1449:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1450:            return;
                   1451:        }
                   1452: 
                   1453:        (*((integer8 *) (*s_objet_resultat).objet)) = 
                   1454:                ((*((logical8 *) (*s_objet_argument_1).objet)) ==
                   1455:                (*((logical8 *) (*s_objet_argument_2).objet)))
                   1456:                ? -1 : 0;
                   1457:    }
                   1458: 
                   1459: /*
                   1460: --------------------------------------------------------------------------------
                   1461:   SAME portant sur des chaînes de caractères
                   1462: --------------------------------------------------------------------------------
                   1463: */
                   1464: 
                   1465:    else if (((*s_objet_argument_1).type == CHN) &&
                   1466:            ((*s_objet_argument_2).type == CHN))
                   1467:    {
                   1468:        if ((s_objet_resultat = allocation(s_etat_processus, INT)) == NULL)
                   1469:        {
                   1470:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1471:            return;
                   1472:        }
                   1473: 
                   1474:        (*((integer8 *) (*s_objet_resultat).objet)) =
                   1475:                (strcmp((unsigned char *) (*s_objet_argument_1).objet,
                   1476:                (unsigned char *) (*s_objet_argument_2).objet) == 0) ? -1 : 0;
                   1477:    }
                   1478: 
                   1479: /*
                   1480: --------------------------------------------------------------------------------
                   1481:   SAME portant sur des listes ou (instruction "SAME") des expressions
                   1482: --------------------------------------------------------------------------------
                   1483: */
                   1484: 
                   1485:    else if (((*s_objet_argument_1).type == FCT) &&
                   1486:            ((*s_objet_argument_2).type == FCT))
                   1487:    {
                   1488:        if ((s_objet_resultat = allocation(s_etat_processus, INT)) == NULL)
                   1489:        {
                   1490:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1491:            return;
                   1492:        }
                   1493: 
                   1494:        if ((strcmp((*((struct_fonction *) (*s_objet_argument_1).objet))
                   1495:                .nom_fonction, (*((struct_fonction *) (*s_objet_argument_2)
                   1496:                .objet)).nom_fonction) == 0) &&
                   1497:                ((*((struct_fonction *) (*s_objet_argument_1).objet))
                   1498:                .nombre_arguments == (*((struct_fonction *)
                   1499:                (*s_objet_argument_2).objet)).nombre_arguments))
                   1500:        {
                   1501:            (*((integer8 *) (*s_objet_resultat).objet)) = -1;
                   1502:        }
                   1503:        else
                   1504:        {
                   1505:            (*((integer8 *) (*s_objet_resultat).objet)) = 0;
                   1506:        }
                   1507:    }
                   1508: 
                   1509:    /*
                   1510:     * Il y a de la récursivité dans l'air...
                   1511:     */
                   1512: 
                   1513:    else if ((((*s_objet_argument_1).type == LST) &&
                   1514:            ((*s_objet_argument_2).type == LST)) ||
                   1515:            (((((*s_objet_argument_1).type == ALG) &&
                   1516:            ((*s_objet_argument_2).type == ALG)) ||
                   1517:            (((*s_objet_argument_1).type == RPN) &&
                   1518:            ((*s_objet_argument_2).type == RPN))) &&
                   1519:            (strcmp((*s_etat_processus).instruction_courante, "==") != 0)))
                   1520:    {
                   1521:        if ((s_objet_resultat = allocation(s_etat_processus, INT)) == NULL)
                   1522:        {
                   1523:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1524:            return;
                   1525:        }
                   1526: 
                   1527:        l_element_courant_1 = (struct_liste_chainee *)
                   1528:                (*s_objet_argument_1).objet;
                   1529:        l_element_courant_2 = (struct_liste_chainee *)
                   1530:                (*s_objet_argument_2).objet;
                   1531: 
                   1532:        difference = d_faux;
                   1533: 
                   1534:        while((l_element_courant_1 != NULL) && (l_element_courant_2 != NULL)
                   1535:                && (difference == d_faux))
                   1536:        {
                   1537:            if ((s_copie_argument_1 = copie_objet(s_etat_processus,
                   1538:                    (*l_element_courant_1).donnee, 'P')) == NULL)
                   1539:            {
                   1540:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1541:                return;
                   1542:            }
                   1543: 
                   1544:            if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   1545:                    s_copie_argument_1) == d_erreur)
                   1546:            {
                   1547:                return;
                   1548:            }
                   1549: 
                   1550:            if ((s_copie_argument_2 = copie_objet(s_etat_processus,
                   1551:                    (*l_element_courant_2).donnee, 'P')) == NULL)
                   1552:            {
                   1553:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1554:                return;
                   1555:            }
                   1556: 
                   1557:            if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   1558:                    s_copie_argument_2) == d_erreur)
                   1559:            {
                   1560:                return;
                   1561:            }
                   1562: 
                   1563:            instruction_same(s_etat_processus);
                   1564: 
                   1565:            if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   1566:                    &s_objet_resultat_intermediaire) == d_erreur)
                   1567:            {
                   1568:                liberation(s_etat_processus, s_objet_argument_1);
                   1569:                liberation(s_etat_processus, s_objet_argument_2);
                   1570:                liberation(s_etat_processus, s_objet_resultat);
                   1571: 
                   1572:                (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                   1573:                return;
                   1574:            }
                   1575: 
                   1576:            if ((*s_objet_resultat_intermediaire).type != INT)
                   1577:            {
                   1578:                liberation(s_etat_processus, s_objet_argument_1);
                   1579:                liberation(s_etat_processus, s_objet_argument_2);
                   1580:                liberation(s_etat_processus, s_objet_resultat);
                   1581: 
                   1582:                (*s_etat_processus).erreur_execution =
                   1583:                        d_ex_erreur_type_argument;
                   1584: 
                   1585:                return;
                   1586:            }
                   1587: 
                   1588:            difference = (*(((integer8 *) (*s_objet_resultat_intermediaire)
                   1589:                    .objet)) == 0) ? d_vrai : d_faux;
                   1590: 
                   1591:            liberation(s_etat_processus, s_objet_resultat_intermediaire);
                   1592: 
                   1593:            l_element_courant_1 = (*l_element_courant_1).suivant;
                   1594:            l_element_courant_2 = (*l_element_courant_2).suivant;
                   1595:        }
                   1596: 
                   1597:        if ((difference == d_vrai) || ((l_element_courant_1 != NULL) &&
                   1598:                (l_element_courant_2 == NULL)) ||
                   1599:                ((l_element_courant_1 == NULL) &&
                   1600:                (l_element_courant_2 != NULL)))
                   1601:        {
                   1602:            (*((integer8 *) (*s_objet_resultat).objet)) = 0;
                   1603:        }
                   1604:        else
                   1605:        {
                   1606:            (*((integer8 *) (*s_objet_resultat).objet)) = -1;
                   1607:        }
                   1608:    }
                   1609: 
                   1610: /*
                   1611: --------------------------------------------------------------------------------
                   1612:   SAME portant sur des tables des expressions
                   1613: --------------------------------------------------------------------------------
                   1614: */
                   1615:    /*
                   1616:     * Il y a de la récursivité dans l'air...
                   1617:     */
                   1618: 
                   1619:    else if (((*s_objet_argument_1).type == TBL) &&
                   1620:            ((*s_objet_argument_2).type == TBL) &&
                   1621:            (strcmp((*s_etat_processus).instruction_courante, "==") != 0))
                   1622:    {
                   1623:        if ((s_objet_resultat = allocation(s_etat_processus, INT)) == NULL)
                   1624:        {
                   1625:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1626:            return;
                   1627:        }
                   1628: 
                   1629:        if ((*((struct_tableau *) (*s_objet_argument_1).objet)).nombre_elements
                   1630:                != (*((struct_tableau *) (*s_objet_argument_2).objet))
                   1631:                .nombre_elements)
                   1632:        {
                   1633:            (*((integer8 *) (*s_objet_resultat).objet)) = 0;
                   1634:        }
                   1635:        else
                   1636:        {
                   1637:            difference = d_faux;
                   1638: 
                   1639:            for(i = 0; i < (*((struct_tableau *) (*s_objet_argument_1).objet))
                   1640:                    .nombre_elements; i++)
                   1641:            {
                   1642:                if ((s_copie_argument_1 = copie_objet(s_etat_processus,
                   1643:                        (*((struct_tableau *)
                   1644:                        (*s_objet_argument_1).objet)).elements[i],
                   1645:                        'P')) == NULL)
                   1646:                {
                   1647:                    (*s_etat_processus).erreur_systeme =
                   1648:                            d_es_allocation_memoire;
                   1649:                    return;
                   1650:                }
                   1651: 
                   1652:                if (empilement(s_etat_processus, &((*s_etat_processus)
                   1653:                        .l_base_pile), s_copie_argument_1) == d_erreur)
                   1654:                {
                   1655:                    return;
                   1656:                }
                   1657: 
                   1658:                if ((s_copie_argument_2 = copie_objet(s_etat_processus,
                   1659:                        (*((struct_tableau *)
                   1660:                        (*s_objet_argument_2).objet)).elements[i],
                   1661:                        'P')) == NULL)
                   1662:                {
                   1663:                    (*s_etat_processus).erreur_systeme =
                   1664:                            d_es_allocation_memoire;
                   1665:                    return;
                   1666:                }
                   1667: 
                   1668:                if (empilement(s_etat_processus, &((*s_etat_processus)
                   1669:                        .l_base_pile), s_copie_argument_2) == d_erreur)
                   1670:                {
                   1671:                    return;
                   1672:                }
                   1673: 
                   1674:                instruction_same(s_etat_processus);
                   1675: 
                   1676:                if (depilement(s_etat_processus, &((*s_etat_processus)
                   1677:                        .l_base_pile), &s_objet_resultat_intermediaire)
                   1678:                        == d_erreur)
                   1679:                {
                   1680:                    liberation(s_etat_processus, s_objet_argument_1);
                   1681:                    liberation(s_etat_processus, s_objet_argument_2);
                   1682:                    liberation(s_etat_processus, s_objet_resultat);
                   1683: 
                   1684:                    (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                   1685:                    return;
                   1686:                }
                   1687: 
                   1688:                if ((*s_objet_resultat_intermediaire).type != INT)
                   1689:                {
                   1690:                    liberation(s_etat_processus, s_objet_argument_1);
                   1691:                    liberation(s_etat_processus, s_objet_argument_2);
                   1692:                    liberation(s_etat_processus, s_objet_resultat);
                   1693: 
                   1694:                    (*s_etat_processus).erreur_execution =
                   1695:                            d_ex_erreur_type_argument;
                   1696:                    return;
                   1697:                }
                   1698: 
                   1699:                difference = (*(((integer8 *) (*s_objet_resultat_intermediaire)
                   1700:                        .objet)) == 0) ? d_vrai : d_faux;
                   1701: 
                   1702:                liberation(s_etat_processus, s_objet_resultat_intermediaire);
                   1703:            }
                   1704: 
                   1705:            if (difference == d_vrai)
                   1706:            {
                   1707:                (*((integer8 *) (*s_objet_resultat).objet)) = 0;
                   1708:            }
                   1709:            else
                   1710:            {
                   1711:                (*((integer8 *) (*s_objet_resultat).objet)) = -1;
                   1712:            }
                   1713:        }
                   1714:    }
                   1715: 
                   1716: 
                   1717: /*
                   1718: --------------------------------------------------------------------------------
                   1719:   SAME portant sur des vecteurs
                   1720: --------------------------------------------------------------------------------
                   1721: */
                   1722:    /*
                   1723:     * Vecteurs d'entiers
                   1724:     */
                   1725: 
                   1726:    else if (((*s_objet_argument_1).type == VIN) &&
                   1727:            ((*s_objet_argument_2).type == VIN))
                   1728:    {
                   1729:        if ((s_objet_resultat = allocation(s_etat_processus, INT)) == NULL)
                   1730:        {
                   1731:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1732:            return;
                   1733:        }
                   1734: 
                   1735:        if ((*((struct_vecteur *) (*s_objet_argument_1).objet)).taille !=
                   1736:                (*((struct_vecteur *) (*s_objet_argument_2).objet)).taille)
                   1737:        {
                   1738:            (*((integer8 *) (*s_objet_resultat).objet)) = 0;
                   1739:        }
                   1740:        else
                   1741:        {
                   1742:            difference = d_faux;
                   1743: 
                   1744:            for(i = 0; (i < (*((struct_vecteur *) (*s_objet_argument_1).objet))
                   1745:                    .taille) && (difference == d_faux); i++)
                   1746:            {
                   1747:                difference = (((integer8 *) (*((struct_vecteur *)
                   1748:                        (*s_objet_argument_1).objet)).tableau)[i] ==
                   1749:                        ((integer8 *) (*((struct_vecteur *)
                   1750:                        (*s_objet_argument_2).objet)).tableau)[i])
                   1751:                        ? d_faux : d_vrai;
                   1752:            }
                   1753: 
                   1754:            (*((integer8 *) (*s_objet_resultat).objet)) = (difference ==
                   1755:                        d_faux) ? -1 : 0;
                   1756:        }
                   1757:    }
                   1758: 
                   1759:    /*
                   1760:     * Vecteurs de réels
                   1761:     */
                   1762: 
                   1763:    else if (((*s_objet_argument_1).type == VRL) &&
                   1764:            ((*s_objet_argument_2).type == VRL))
                   1765:    {
                   1766:        if ((s_objet_resultat = allocation(s_etat_processus, INT)) == NULL)
                   1767:        {
                   1768:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1769:            return;
                   1770:        }
                   1771: 
                   1772:        if ((*((struct_vecteur *) (*s_objet_argument_1).objet)).taille !=
                   1773:                (*((struct_vecteur *) (*s_objet_argument_2).objet)).taille)
                   1774:        {
                   1775:            (*((integer8 *) (*s_objet_resultat).objet)) = 0;
                   1776:        }
                   1777:        else
                   1778:        {
                   1779:            difference = d_faux;
                   1780: 
                   1781:            for(i = 0; (i < (*((struct_vecteur *) (*s_objet_argument_1).objet))
                   1782:                    .taille) && (difference == d_faux); i++)
                   1783:            {
                   1784:                difference = (((real8 *) (*((struct_vecteur *)
                   1785:                        (*s_objet_argument_1).objet)).tableau)[i] ==
                   1786:                        ((real8 *) (*((struct_vecteur *)
                   1787:                        (*s_objet_argument_2).objet)).tableau)[i])
                   1788:                        ? d_faux : d_vrai;
                   1789:            }
                   1790: 
                   1791:            (*((integer8 *) (*s_objet_resultat).objet)) = (difference ==
                   1792:                        d_faux) ? -1 : 0;
                   1793:        }
                   1794:    }
                   1795: 
                   1796:    /*
                   1797:     * Vecteurs de complexes
                   1798:     */
                   1799: 
                   1800:    else if (((*s_objet_argument_1).type == VCX) &&
                   1801:            ((*s_objet_argument_2).type == VCX))
                   1802:    {
                   1803:        if ((s_objet_resultat = allocation(s_etat_processus, INT)) == NULL)
                   1804:        {
                   1805:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1806:            return;
                   1807:        }
                   1808: 
                   1809:        if ((*((struct_vecteur *) (*s_objet_argument_1).objet)).taille !=
                   1810:                (*((struct_vecteur *) (*s_objet_argument_2).objet)).taille)
                   1811:        {
                   1812:            (*((integer8 *) (*s_objet_resultat).objet)) = 0;
                   1813:        }
                   1814:        else
                   1815:        {
                   1816:            difference = d_faux;
                   1817: 
                   1818:            for(i = 0; (i < (*((struct_vecteur *) (*s_objet_argument_1).objet))
                   1819:                    .taille) && (difference == d_faux); i++)
                   1820:            {
                   1821:                difference = ((((struct_complexe16 *) (*((struct_vecteur *)
                   1822:                        (*s_objet_argument_1).objet)).tableau)[i].partie_reelle
                   1823:                        == ((struct_complexe16 *) (*((struct_vecteur *)
                   1824:                        (*s_objet_argument_2).objet)).tableau)[i].partie_reelle)
                   1825:                        && (((struct_complexe16 *) (*((struct_vecteur *)
                   1826:                        (*s_objet_argument_1).objet)).tableau)[i]
                   1827:                        .partie_imaginaire == ((struct_complexe16 *)
                   1828:                        (*((struct_vecteur *) (*s_objet_argument_2).objet))
                   1829:                        .tableau)[i].partie_imaginaire)) ? d_faux : d_vrai;
                   1830:            }
                   1831: 
                   1832:            (*((integer8 *) (*s_objet_resultat).objet)) = (difference ==
                   1833:                        d_faux) ? -1 : 0;
                   1834:        }
                   1835:    }
                   1836: 
                   1837: /*
                   1838: --------------------------------------------------------------------------------
                   1839:   SAME portant sur des matrices
                   1840: --------------------------------------------------------------------------------
                   1841: */
                   1842:    /*
                   1843:     * Matrice d'entiers
                   1844:     */
                   1845: 
                   1846:    else if (((*s_objet_argument_1).type == MIN) &&
                   1847:            ((*s_objet_argument_2).type == MIN))
                   1848:    {
                   1849:        if ((s_objet_resultat = allocation(s_etat_processus, INT)) == NULL)
                   1850:        {
                   1851:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1852:            return;
                   1853:        }
                   1854: 
                   1855:        if (((*((struct_matrice *) (*s_objet_argument_1).objet)).nombre_lignes
                   1856:                != (*((struct_matrice *) (*s_objet_argument_2).objet))
                   1857:                .nombre_lignes) || ((*((struct_matrice *) (*s_objet_argument_1)
                   1858:                .objet)).nombre_colonnes != (*((struct_matrice *)
                   1859:                (*s_objet_argument_2).objet)).nombre_colonnes))
                   1860:        {
                   1861:            (*((integer8 *) (*s_objet_resultat).objet)) = 0;
                   1862:        }
                   1863:        else
                   1864:        {
                   1865:            difference = d_faux;
                   1866: 
                   1867:            for(i = 0; (i < (*((struct_matrice *) (*s_objet_argument_1).objet))
                   1868:                    .nombre_lignes) && (difference == d_faux); i++)
                   1869:            {
                   1870:                for(j = 0; (j < (*((struct_matrice *) (*s_objet_argument_1)
                   1871:                        .objet)).nombre_colonnes) && (difference == d_faux);
                   1872:                        j++)
                   1873:                {
                   1874:                    difference = (((integer8 **) (*((struct_matrice *)
                   1875:                            (*s_objet_argument_1).objet)).tableau)[i][j] ==
                   1876:                            ((integer8 **) (*((struct_matrice *)
                   1877:                            (*s_objet_argument_2).objet)).tableau)[i][j])
                   1878:                            ? d_faux : d_vrai;
                   1879:                }
                   1880:            }
                   1881: 
                   1882:            (*((integer8 *) (*s_objet_resultat).objet)) = (difference ==
                   1883:                        d_faux) ? -1 : 0;
                   1884:        }
                   1885:    }
                   1886: 
                   1887:    /*
                   1888:     * Matrice de réels
                   1889:     */
                   1890: 
                   1891:    else if (((*s_objet_argument_1).type == MRL) &&
                   1892:            ((*s_objet_argument_2).type == MRL))
                   1893:    {
                   1894:        if ((s_objet_resultat = allocation(s_etat_processus, INT)) == NULL)
                   1895:        {
                   1896:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1897:            return;
                   1898:        }
                   1899: 
                   1900:        if (((*((struct_matrice *) (*s_objet_argument_1).objet)).nombre_lignes
                   1901:                != (*((struct_matrice *) (*s_objet_argument_2).objet))
                   1902:                .nombre_lignes) || ((*((struct_matrice *) (*s_objet_argument_1)
                   1903:                .objet)).nombre_colonnes != (*((struct_matrice *)
                   1904:                (*s_objet_argument_2).objet)).nombre_colonnes))
                   1905:        {
                   1906:            (*((integer8 *) (*s_objet_resultat).objet)) = 0;
                   1907:        }
                   1908:        else
                   1909:        {
                   1910:            difference = d_faux;
                   1911: 
                   1912:            for(i = 0; (i < (*((struct_matrice *) (*s_objet_argument_1).objet))
                   1913:                    .nombre_lignes) && (difference == d_faux); i++)
                   1914:            {
                   1915:                for(j = 0; (j < (*((struct_matrice *) (*s_objet_argument_1)
                   1916:                        .objet)).nombre_colonnes) && (difference == d_faux);
                   1917:                        j++)
                   1918:                {
                   1919:                    difference = (((real8 **) (*((struct_matrice *)
                   1920:                            (*s_objet_argument_1).objet)).tableau)[i][j] ==
                   1921:                            ((real8 **) (*((struct_matrice *)
                   1922:                            (*s_objet_argument_2).objet)).tableau)[i][j])
                   1923:                            ? d_faux : d_vrai;
                   1924:                }
                   1925:            }
                   1926: 
                   1927:            (*((integer8 *) (*s_objet_resultat).objet)) = (difference ==
                   1928:                        d_faux) ? -1 : 0;
                   1929:        }
                   1930:    }
                   1931: 
                   1932:    /*
                   1933:     * Matrice de complexes
                   1934:     */
                   1935: 
                   1936:    else if (((*s_objet_argument_1).type == MCX) &&
                   1937:            ((*s_objet_argument_2).type == MCX))
                   1938:    {
                   1939:        if ((s_objet_resultat = allocation(s_etat_processus, INT)) == NULL)
                   1940:        {
                   1941:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1942:            return;
                   1943:        }
                   1944: 
                   1945:        if (((*((struct_matrice *) (*s_objet_argument_1).objet)).nombre_lignes
                   1946:                != (*((struct_matrice *) (*s_objet_argument_2).objet))
                   1947:                .nombre_lignes) || ((*((struct_matrice *) (*s_objet_argument_1)
                   1948:                .objet)).nombre_colonnes != (*((struct_matrice *)
                   1949:                (*s_objet_argument_2).objet)).nombre_colonnes))
                   1950:        {
                   1951:            (*((integer8 *) (*s_objet_resultat).objet)) = 0;
                   1952:        }
                   1953:        else
                   1954:        {
                   1955:            difference = d_faux;
                   1956: 
                   1957:            for(i = 0; (i < (*((struct_matrice *) (*s_objet_argument_1).objet))
                   1958:                    .nombre_lignes) && (difference == d_faux); i++)
                   1959:            {
                   1960:                for(j = 0; (j < (*((struct_matrice *) (*s_objet_argument_1)
                   1961:                        .objet)).nombre_colonnes) && (difference == d_faux);
                   1962:                        j++)
                   1963:                {
                   1964:                    difference = ((((struct_complexe16 **) (*((struct_matrice *)
                   1965:                            (*s_objet_argument_1).objet)).tableau)[i][j]
                   1966:                            .partie_reelle == ((struct_complexe16 **)
                   1967:                            (*((struct_matrice *) (*s_objet_argument_2).objet))
                   1968:                            .tableau)[i][j].partie_reelle) &&
                   1969:                            (((struct_complexe16 **) (*((struct_matrice *)
                   1970:                            (*s_objet_argument_1).objet)).tableau)[i][j]
                   1971:                            .partie_imaginaire == ((struct_complexe16 **)
                   1972:                            (*((struct_matrice *) (*s_objet_argument_2).objet))
                   1973:                            .tableau)[i][j].partie_imaginaire))
                   1974:                            ? d_faux : d_vrai;
                   1975:                }
                   1976:            }
                   1977: 
                   1978:            (*((integer8 *) (*s_objet_resultat).objet)) = (difference ==
                   1979:                        d_faux) ? -1 : 0;
                   1980:        }
                   1981:    }
                   1982: 
                   1983: /*
                   1984: --------------------------------------------------------------------------------
                   1985:   SAME portant sur des noms (instruction "SAME")
                   1986: --------------------------------------------------------------------------------
                   1987: */
                   1988: 
                   1989:    else if (((*s_objet_argument_1).type == NOM) &&
                   1990:            ((*s_objet_argument_2).type == NOM) &&
                   1991:            (strcmp((*s_etat_processus).instruction_courante, "==") != 0))
                   1992:    {
                   1993:        if ((s_objet_resultat = allocation(s_etat_processus, INT)) == NULL)
                   1994:        {
                   1995:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1996:            return;
                   1997:        }
                   1998: 
                   1999:        (*((integer8 *) (*s_objet_resultat).objet)) =
                   2000:                (strcmp((*((struct_nom *) (*s_objet_argument_1).objet)).nom,
                   2001:                (*((struct_nom *) (*s_objet_argument_2).objet)).nom) == 0)
                   2002:                ? -1 : 0;
                   2003:    }
                   2004: 
                   2005: /*
                   2006: --------------------------------------------------------------------------------
                   2007:   SAME entre des arguments complexes (instruction '==')
                   2008: --------------------------------------------------------------------------------
                   2009: */
                   2010: 
                   2011:    /*
                   2012:     * Nom ou valeur numérique / Nom ou valeur numérique
                   2013:     */
                   2014: 
                   2015:    else if (((((*s_objet_argument_1).type == NOM) &&
                   2016:            (((*s_objet_argument_2).type == NOM) ||
                   2017:            ((*s_objet_argument_2).type == INT) ||
                   2018:            ((*s_objet_argument_2).type == REL))) ||
                   2019:            (((*s_objet_argument_2).type == NOM) &&
                   2020:            (((*s_objet_argument_1).type == INT) ||
                   2021:            ((*s_objet_argument_1).type == REL)))) &&
                   2022:            (strcmp((*s_etat_processus).instruction_courante, "==") == 0))
                   2023:    {
                   2024:        if ((s_objet_resultat = allocation(s_etat_processus, ALG)) == NULL)
                   2025:        {
                   2026:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2027:            return;
                   2028:        }
                   2029: 
                   2030:        if (((*s_objet_resultat).objet =
                   2031:                allocation_maillon(s_etat_processus)) == NULL)
                   2032:        {
                   2033:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2034:            return;
                   2035:        }
                   2036: 
                   2037:        l_element_courant = (*s_objet_resultat).objet;
                   2038: 
                   2039:        if (((*l_element_courant).donnee = allocation(s_etat_processus, FCT))
                   2040:                == NULL)
                   2041:        {
                   2042:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2043:            return;
                   2044:        }
                   2045: 
                   2046:        (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   2047:                .nombre_arguments = 0;
                   2048:        (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   2049:                .fonction = instruction_vers_niveau_superieur;
                   2050: 
                   2051:        if (((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   2052:                .nom_fonction = malloc(3 * sizeof(unsigned char))) == NULL)
                   2053:        {
                   2054:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2055:            return;
                   2056:        }
                   2057: 
                   2058:        strcpy((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   2059:                .nom_fonction, "<<");
                   2060: 
                   2061:        if (((*l_element_courant).suivant =
                   2062:                allocation_maillon(s_etat_processus)) == NULL)
                   2063:        {
                   2064:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2065:            return;
                   2066:        }
                   2067: 
                   2068:        l_element_courant = (*l_element_courant).suivant;
                   2069:        (*l_element_courant).donnee = s_objet_argument_2;
                   2070: 
                   2071:        if (((*l_element_courant).suivant =
                   2072:                allocation_maillon(s_etat_processus)) == NULL)
                   2073:        {
                   2074:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2075:            return;
                   2076:        }
                   2077: 
                   2078:        l_element_courant = (*l_element_courant).suivant;
                   2079:        (*l_element_courant).donnee = s_objet_argument_1;
                   2080: 
                   2081:        if (((*l_element_courant).suivant =
                   2082:                allocation_maillon(s_etat_processus)) == NULL)
                   2083:        {
                   2084:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2085:            return;
                   2086:        }
                   2087: 
                   2088:        l_element_courant = (*l_element_courant).suivant;
                   2089: 
                   2090:        if (((*l_element_courant).donnee = allocation(s_etat_processus, FCT))
                   2091:                == NULL)
                   2092:        {
                   2093:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2094:            return;
                   2095:        }
                   2096: 
                   2097:        (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   2098:                .nombre_arguments = 0;
                   2099:        (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   2100:                .fonction = instruction_same;
                   2101: 
                   2102:        if (((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   2103:                .nom_fonction = malloc(3 * sizeof(unsigned char))) == NULL)
                   2104:        {
                   2105:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2106:            return;
                   2107:        }
                   2108: 
                   2109:        strcpy((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   2110:                .nom_fonction, "==");
                   2111: 
                   2112:        if (((*l_element_courant).suivant =
                   2113:                allocation_maillon(s_etat_processus)) == NULL)
                   2114:        {
                   2115:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2116:            return;
                   2117:        }
                   2118: 
                   2119:        l_element_courant = (*l_element_courant).suivant;
                   2120: 
                   2121:        if (((*l_element_courant).donnee = allocation(s_etat_processus, FCT))
                   2122:                == NULL)
                   2123:        {
                   2124:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2125:            return;
                   2126:        }
                   2127: 
                   2128:        (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   2129:                .nombre_arguments = 0;
                   2130:        (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   2131:                .fonction = instruction_vers_niveau_inferieur;
                   2132: 
                   2133:        if (((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   2134:                .nom_fonction = malloc(3 * sizeof(unsigned char))) == NULL)
                   2135:        {
                   2136:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2137:            return;
                   2138:        }
                   2139: 
                   2140:        strcpy((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   2141:                .nom_fonction, ">>");
                   2142: 
                   2143:        (*l_element_courant).suivant = NULL;
                   2144: 
                   2145:        s_objet_argument_1 = NULL;
                   2146:        s_objet_argument_2 = NULL;
                   2147:    }
                   2148: 
                   2149:    /*
                   2150:     * Nom ou valeur numérique / Expression
                   2151:     */
                   2152: 
                   2153:    else if (((((*s_objet_argument_1).type == ALG) ||
                   2154:            ((*s_objet_argument_1).type == RPN)) &&
                   2155:            (strcmp((*s_etat_processus).instruction_courante, "==") == 0)) &&
                   2156:            (((*s_objet_argument_2).type == NOM) ||
                   2157:            ((*s_objet_argument_2).type == INT) ||
                   2158:            ((*s_objet_argument_2).type == REL)))
                   2159:    {
                   2160:        nombre_elements = 0;
                   2161:        l_element_courant = (struct_liste_chainee *)
                   2162:                (*s_objet_argument_1).objet;
                   2163: 
                   2164:        while(l_element_courant != NULL)
                   2165:        {
                   2166:            nombre_elements++;
                   2167:            l_element_courant = (*l_element_courant).suivant;
                   2168:        }
                   2169: 
                   2170:        if (nombre_elements == 2)
                   2171:        {
                   2172:            liberation(s_etat_processus, s_objet_argument_1);
                   2173:            liberation(s_etat_processus, s_objet_argument_2);
                   2174: 
                   2175:            (*s_etat_processus).erreur_execution = d_ex_argument_invalide;
                   2176:            return;
                   2177:        }
                   2178: 
                   2179:        if ((s_objet_resultat = copie_objet(s_etat_processus,
                   2180:                s_objet_argument_1, 'N')) == NULL)
                   2181:        {
                   2182:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2183:            return;
                   2184:        }
                   2185: 
                   2186:        l_element_courant = (struct_liste_chainee *)
                   2187:                (*s_objet_resultat).objet;
                   2188:        l_element_precedent = l_element_courant;
                   2189:        l_element_courant = (*l_element_courant).suivant;
                   2190: 
                   2191:        if (((*l_element_precedent).suivant =
                   2192:                allocation_maillon(s_etat_processus)) == NULL)
                   2193:        {
                   2194:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2195:            return;
                   2196:        }
                   2197: 
                   2198:        (*(*l_element_precedent).suivant).donnee = s_objet_argument_2;
                   2199:        (*(*l_element_precedent).suivant).suivant = l_element_courant;
                   2200: 
                   2201:        while((*l_element_courant).suivant != NULL)
                   2202:        {
                   2203:            l_element_precedent = l_element_courant;
                   2204:            l_element_courant = (*l_element_courant).suivant;
                   2205:        }
                   2206: 
                   2207:        if (((*l_element_precedent).suivant =
                   2208:                allocation_maillon(s_etat_processus)) == NULL)
                   2209:        {
                   2210:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2211:            return;
                   2212:        }
                   2213: 
                   2214:        if (((*(*l_element_precedent).suivant).donnee =
                   2215:                allocation(s_etat_processus, FCT)) == NULL)
                   2216:        {
                   2217:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2218:            return;
                   2219:        }
                   2220: 
                   2221:        (*((struct_fonction *) (*(*(*l_element_precedent).suivant)
                   2222:                .donnee).objet)).nombre_arguments = 0;
                   2223:        (*((struct_fonction *) (*(*(*l_element_precedent).suivant)
                   2224:                .donnee).objet)).fonction = instruction_same;
                   2225: 
                   2226:        if (((*((struct_fonction *) (*(*(*l_element_precedent)
                   2227:                .suivant).donnee).objet)).nom_fonction =
                   2228:                malloc((strlen((*s_etat_processus).instruction_courante) + 1) *
                   2229:                sizeof(unsigned char))) == NULL)
                   2230:        {
                   2231:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2232:            return;
                   2233:        }
                   2234: 
                   2235:        strcpy((*((struct_fonction *) (*(*(*l_element_precedent)
                   2236:                .suivant).donnee).objet)).nom_fonction,
                   2237:                (*s_etat_processus).instruction_courante);
                   2238: 
                   2239:        (*(*l_element_precedent).suivant).suivant = l_element_courant;
                   2240: 
                   2241:        s_objet_argument_2 = NULL;
                   2242:    }
                   2243: 
                   2244:    /*
                   2245:     * Expression / Nom ou valeur numérique
                   2246:     */
                   2247: 
                   2248:    else if ((((*s_objet_argument_1).type == NOM) ||
                   2249:            ((*s_objet_argument_1).type == INT) ||
                   2250:            ((*s_objet_argument_1).type == REL)) &&
                   2251:            ((((*s_objet_argument_2).type == ALG) ||
                   2252:            ((*s_objet_argument_2).type == RPN)) &&
                   2253:            (strcmp((*s_etat_processus).instruction_courante, "==") == 0)))
                   2254:    {
                   2255:        nombre_elements = 0;
                   2256:        l_element_courant = (struct_liste_chainee *)
                   2257:                (*s_objet_argument_2).objet;
                   2258: 
                   2259:        while(l_element_courant != NULL)
                   2260:        {
                   2261:            nombre_elements++;
                   2262:            l_element_courant = (*l_element_courant).suivant;
                   2263:        }
                   2264: 
                   2265:        if (nombre_elements == 2)
                   2266:        {
                   2267:            liberation(s_etat_processus, s_objet_argument_1);
                   2268:            liberation(s_etat_processus, s_objet_argument_2);
                   2269: 
                   2270:            (*s_etat_processus).erreur_execution = d_ex_argument_invalide;
                   2271:            return;
                   2272:        }
                   2273: 
                   2274:        if ((s_objet_resultat = copie_objet(s_etat_processus,
                   2275:                s_objet_argument_2, 'N')) == NULL)
                   2276:        {
                   2277:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2278:            return;
                   2279:        }
                   2280: 
                   2281:        l_element_courant = (struct_liste_chainee *)
                   2282:                (*s_objet_resultat).objet;
                   2283:        l_element_precedent = l_element_courant;
                   2284: 
                   2285:        while((*l_element_courant).suivant != NULL)
                   2286:        {
                   2287:            l_element_precedent = l_element_courant;
                   2288:            l_element_courant = (*l_element_courant).suivant;
                   2289:        }
                   2290: 
                   2291:        if (((*l_element_precedent).suivant =
                   2292:                allocation_maillon(s_etat_processus)) == NULL)
                   2293:        {
                   2294:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2295:            return;
                   2296:        }
                   2297: 
                   2298:        (*(*l_element_precedent).suivant).donnee = s_objet_argument_1;
                   2299:        l_element_precedent = (*l_element_precedent).suivant;
                   2300: 
                   2301:        if (((*l_element_precedent).suivant =
                   2302:                allocation_maillon(s_etat_processus)) == NULL)
                   2303:        {
                   2304:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2305:            return;
                   2306:        }
                   2307: 
                   2308:        if (((*(*l_element_precedent).suivant).donnee =
                   2309:                allocation(s_etat_processus, FCT)) == NULL)
                   2310:        {
                   2311:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2312:            return;
                   2313:        }
                   2314: 
                   2315:        (*((struct_fonction *) (*(*(*l_element_precedent).suivant)
                   2316:                .donnee).objet)).nombre_arguments = 0;
                   2317:        (*((struct_fonction *) (*(*(*l_element_precedent).suivant)
                   2318:                .donnee).objet)).fonction = instruction_same;
                   2319: 
                   2320:        if (((*((struct_fonction *) (*(*(*l_element_precedent)
                   2321:                .suivant).donnee).objet)).nom_fonction =
                   2322:                malloc((strlen((*s_etat_processus).instruction_courante) + 1) *
                   2323:                sizeof(unsigned char))) == NULL)
                   2324:        {
                   2325:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2326:            return;
                   2327:        }
                   2328: 
                   2329:        strcpy((*((struct_fonction *) (*(*(*l_element_precedent)
                   2330:                .suivant).donnee).objet)).nom_fonction,
                   2331:                (*s_etat_processus).instruction_courante);
                   2332: 
                   2333:        (*(*l_element_precedent).suivant).suivant = l_element_courant;
                   2334: 
                   2335:        s_objet_argument_1 = NULL;
                   2336:    }
                   2337: 
                   2338:    /*
                   2339:     * Expression / Expression
                   2340:     */
                   2341: 
                   2342:    else if ((((*s_objet_argument_1).type == ALG) &&
                   2343:            ((*s_objet_argument_2).type == ALG) &&
                   2344:            (strcmp((*s_etat_processus).instruction_courante, "==") == 0)) ||
                   2345:            (((*s_objet_argument_1).type == RPN) &&
                   2346:            ((*s_objet_argument_2).type == RPN)))
                   2347:    {
                   2348:        nombre_elements = 0;
                   2349:        l_element_courant = (struct_liste_chainee *)
                   2350:                (*s_objet_argument_1).objet;
                   2351: 
                   2352:        while(l_element_courant != NULL)
                   2353:        {
                   2354:            nombre_elements++;
                   2355:            l_element_courant = (*l_element_courant).suivant;
                   2356:        }
                   2357: 
                   2358:        if (nombre_elements == 2)
                   2359:        {
                   2360:            liberation(s_etat_processus, s_objet_argument_1);
                   2361:            liberation(s_etat_processus, s_objet_argument_2);
                   2362: 
                   2363:            (*s_etat_processus).erreur_execution = d_ex_argument_invalide;
                   2364:            return;
                   2365:        }
                   2366: 
                   2367:        nombre_elements = 0;
                   2368:        l_element_courant = (struct_liste_chainee *)
                   2369:                (*s_objet_argument_2).objet;
                   2370: 
                   2371:        while(l_element_courant != NULL)
                   2372:        {
                   2373:            nombre_elements++;
                   2374:            l_element_courant = (*l_element_courant).suivant;
                   2375:        }
                   2376: 
                   2377:        if (nombre_elements == 2)
                   2378:        {
                   2379:            liberation(s_etat_processus, s_objet_argument_1);
                   2380:            liberation(s_etat_processus, s_objet_argument_2);
                   2381: 
                   2382:            (*s_etat_processus).erreur_execution = d_ex_argument_invalide;
                   2383:            return;
                   2384:        }
                   2385: 
                   2386:        if ((s_copie_argument_1 = copie_objet(s_etat_processus,
                   2387:                s_objet_argument_1, 'N')) == NULL)
                   2388:        {
                   2389:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2390:            return;
                   2391:        }
                   2392: 
                   2393:        if ((s_copie_argument_2 = copie_objet(s_etat_processus,
                   2394:                s_objet_argument_2, 'N')) == NULL)
                   2395:        {
                   2396:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2397:            return;
                   2398:        }
                   2399: 
                   2400:        l_element_courant = (struct_liste_chainee *)
                   2401:                (*s_copie_argument_1).objet;
                   2402:        (*s_copie_argument_1).objet = (void *) (*((struct_liste_chainee *)
                   2403:                (*s_copie_argument_1).objet)).suivant;
                   2404: 
                   2405:        liberation(s_etat_processus, (*l_element_courant).donnee);
                   2406:        free(l_element_courant);
                   2407: 
                   2408:        l_element_courant = (struct_liste_chainee *)
                   2409:                (*s_copie_argument_2).objet;
                   2410:        l_element_precedent = l_element_courant;
                   2411:        s_objet_resultat = s_copie_argument_2;
                   2412: 
                   2413:        while((*l_element_courant).suivant != NULL)
                   2414:        {
                   2415:            l_element_precedent = l_element_courant;
                   2416:            l_element_courant = (*l_element_courant).suivant;
                   2417:        }
                   2418: 
                   2419:        liberation(s_etat_processus, (*l_element_courant).donnee);
                   2420:        free(l_element_courant);
                   2421: 
                   2422:        (*l_element_precedent).suivant = (struct_liste_chainee *)
                   2423:                (*s_copie_argument_1).objet;
                   2424:        free(s_copie_argument_1);
                   2425: 
                   2426:        l_element_courant = (*l_element_precedent).suivant;
                   2427:        while((*l_element_courant).suivant != NULL)
                   2428:        {
                   2429:            l_element_precedent = l_element_courant;
                   2430:            l_element_courant = (*l_element_courant).suivant;
                   2431:        }
                   2432: 
                   2433:        if (((*l_element_precedent).suivant =
                   2434:                allocation_maillon(s_etat_processus)) == NULL)
                   2435:        {
                   2436:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2437:            return;
                   2438:        }
                   2439: 
                   2440:        (*(*l_element_precedent).suivant).suivant = l_element_courant;
                   2441:        l_element_courant = (*l_element_precedent).suivant;
                   2442: 
                   2443:        if (((*l_element_courant).donnee = allocation(s_etat_processus, FCT))
                   2444:                == NULL)
                   2445:        {
                   2446:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2447:            return;
                   2448:        }
                   2449: 
                   2450:        (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   2451:                .nombre_arguments = 0;
                   2452:        (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   2453:                .fonction = instruction_same;
                   2454: 
                   2455:        if (((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   2456:                .nom_fonction = malloc((strlen(
                   2457:                (*s_etat_processus).instruction_courante) + 1) *
                   2458:                sizeof(unsigned char))) == NULL)
                   2459:        {
                   2460:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2461:            return;
                   2462:        }
                   2463: 
                   2464:        strcpy((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   2465:                .nom_fonction, (*s_etat_processus).instruction_courante);
                   2466:    }
                   2467: 
                   2468: /*
                   2469: --------------------------------------------------------------------------------
                   2470:   SAME nul
                   2471: --------------------------------------------------------------------------------
                   2472: */
                   2473: 
                   2474:    else
                   2475:    {
                   2476:        if ((s_objet_resultat = allocation(s_etat_processus, INT)) == NULL)
                   2477:        {
                   2478:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2479:            return;
                   2480:        }
                   2481: 
                   2482:        (*((integer8 *) (*s_objet_resultat).objet)) = 0;
                   2483:    }
                   2484: 
                   2485:    liberation(s_etat_processus, s_objet_argument_1);
                   2486:    liberation(s_etat_processus, s_objet_argument_2);
                   2487: 
                   2488:    if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   2489:            s_objet_resultat) == d_erreur)
                   2490:    {
                   2491:        return;
                   2492:    }
                   2493: 
                   2494:    return;
                   2495: }
                   2496: 
                   2497: 
                   2498: /*
                   2499: ================================================================================
                   2500:   Fonction 'start'
                   2501: ================================================================================
                   2502:   Entrées : structure processus
                   2503: --------------------------------------------------------------------------------
                   2504:   Sorties :
                   2505: --------------------------------------------------------------------------------
                   2506:   Effets de bord : néant
                   2507: ================================================================================
                   2508: */
                   2509: 
                   2510: void
                   2511: instruction_start(struct_processus *s_etat_processus)
                   2512: {
                   2513:    struct_objet                            *s_objet_1;
                   2514:    struct_objet                            *s_objet_2;
                   2515: 
                   2516:    (*s_etat_processus).erreur_execution = d_ex;
                   2517: 
                   2518:    if ((*s_etat_processus).affichage_arguments == 'Y')
                   2519:    {
                   2520:        printf("\n  START ");
                   2521: 
                   2522:        if ((*s_etat_processus).langue == 'F')
                   2523:        {
                   2524:            printf("(boucle définie sans compteur)\n\n");
                   2525:        }
                   2526:        else
                   2527:        {
                   2528:            printf("(define a loop without counter)\n\n");
                   2529:        }
                   2530: 
                   2531:        if ((*s_etat_processus).langue == 'F')
                   2532:        {
                   2533:            printf("  Utilisation :\n\n");
                   2534:        }
                   2535:        else
                   2536:        {
                   2537:            printf("  Usage:\n\n");
                   2538:        }
                   2539: 
                   2540:        printf("    %s/%s %s/%s START\n", d_INT, d_REL,
                   2541:                d_INT, d_REL);
                   2542:        printf("        (expression)\n");
                   2543:        printf("        [EXIT]/[CYCLE]\n");
                   2544:        printf("        ...\n");
                   2545:        printf("    NEXT\n\n");
                   2546: 
                   2547:        printf("    %s/%s %s/%s START\n", d_INT, d_REL,
                   2548:                d_INT, d_REL);
                   2549:        printf("        (expression)\n");
                   2550:        printf("        [EXIT]/[CYCLE]\n");
                   2551:        printf("        ...\n");
                   2552:        printf("    %s/%s STEP\n", d_INT, d_REL);
                   2553: 
                   2554:        return;
                   2555:    }
                   2556:    else if ((*s_etat_processus).test_instruction == 'Y')
                   2557:    {
                   2558:        (*s_etat_processus).nombre_arguments = -1;
                   2559:        return;
                   2560:    }
                   2561: 
                   2562:    if ((*s_etat_processus).erreur_systeme != d_es)
                   2563:    {
                   2564:        return;
                   2565:    }
                   2566: 
                   2567:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                   2568:    {
                   2569:        if (empilement_pile_last(s_etat_processus, 2) == d_erreur)
                   2570:        {
                   2571:            return;
                   2572:        }
                   2573:    }
                   2574: 
                   2575:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   2576:            &s_objet_1) == d_erreur)
                   2577:    {
                   2578:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                   2579:        return;
                   2580:    }
                   2581: 
1.12      bertrand 2582:    if (((*s_objet_1).type != INT) && ((*s_objet_1).type != REL))
1.1       bertrand 2583:    {
                   2584:        liberation(s_etat_processus, s_objet_1);
                   2585: 
                   2586:        (*s_etat_processus).erreur_execution = d_ex_erreur_traitement_boucle;
                   2587:        return;
                   2588:    }
                   2589: 
                   2590:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   2591:            &s_objet_2) == d_erreur)
                   2592:    {
                   2593:        liberation(s_etat_processus, s_objet_1);
                   2594: 
                   2595:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                   2596:        return;
                   2597:    }
                   2598: 
1.12      bertrand 2599:    if (((*s_objet_2).type != INT) && ((*s_objet_2).type != REL))
1.1       bertrand 2600:    {
                   2601:        liberation(s_etat_processus, s_objet_1);
                   2602:        liberation(s_etat_processus, s_objet_2);
                   2603: 
                   2604:        (*s_etat_processus).erreur_execution = d_ex_erreur_traitement_boucle;
                   2605:        return;
                   2606:    }
                   2607: 
1.54      bertrand 2608:    empilement_pile_systeme(s_etat_processus);
                   2609: 
                   2610:    if ((*s_etat_processus).erreur_systeme != d_es)
                   2611:    {
                   2612:        return;
                   2613:    }
                   2614: 
                   2615:    (*(*s_etat_processus).l_base_pile_systeme).type_cloture = 'S';
                   2616: 
1.1       bertrand 2617:    (*(*s_etat_processus).l_base_pile_systeme).indice_boucle = s_objet_2;
                   2618:    (*(*s_etat_processus).l_base_pile_systeme).limite_indice_boucle = s_objet_1;
                   2619: 
                   2620:    if ((*s_etat_processus).mode_execution_programme == 'Y')
                   2621:    {
                   2622:        (*(*s_etat_processus).l_base_pile_systeme).adresse_retour =
                   2623:                (*s_etat_processus).position_courante;
                   2624:        (*(*s_etat_processus).l_base_pile_systeme)
                   2625:                .origine_routine_evaluation = 'N';
                   2626:    }
                   2627:    else
                   2628:    {
                   2629:        (*(*s_etat_processus).l_base_pile_systeme).pointeur_objet_retour =
                   2630:                (*s_etat_processus).expression_courante;
                   2631:        (*(*s_etat_processus).l_base_pile_systeme)
                   2632:                .origine_routine_evaluation = 'Y';
                   2633:    }
                   2634: 
                   2635:    return;
                   2636: }
                   2637: 
                   2638: 
                   2639: /*
                   2640: ================================================================================
                   2641:   Fonction 'step'
                   2642: ================================================================================
                   2643:   Entrées : structure processus
                   2644: --------------------------------------------------------------------------------
                   2645:   Sorties :
                   2646: --------------------------------------------------------------------------------
                   2647:   Effets de bord : néant
                   2648: ================================================================================
                   2649: */
                   2650: 
                   2651: void
                   2652: instruction_step(struct_processus *s_etat_processus)
                   2653: {
                   2654:    struct_objet                *s_objet;
                   2655:    struct_objet                *s_copie_objet;
                   2656: 
                   2657:    logical1                    incrementation;
                   2658:    logical1                    presence_compteur;
                   2659: 
                   2660:    (*s_etat_processus).erreur_execution = d_ex;
                   2661: 
                   2662:    if ((*s_etat_processus).affichage_arguments == 'Y')
                   2663:    {
                   2664:        printf("\n  STEP ");
                   2665: 
                   2666:        if ((*s_etat_processus).langue == 'F')
                   2667:        {
                   2668:            printf("(fin d'une boucle définie)\n\n");
                   2669:        }
                   2670:        else
                   2671:        {
                   2672:            printf("(end of defined loop)\n\n");
                   2673:        }
                   2674: 
                   2675:        if ((*s_etat_processus).langue == 'F')
                   2676:        {
                   2677:            printf("  Utilisation :\n\n");
                   2678:        }
                   2679:        else
                   2680:        {
                   2681:            printf("  Usage:\n\n");
                   2682:        }
                   2683: 
                   2684:        printf("    %s/%s %s/%s START\n", d_INT, d_REL,
                   2685:                d_INT, d_REL);
                   2686:        printf("        (expression)\n");
                   2687:        printf("        [EXIT]/[CYCLE]\n");
                   2688:        printf("        ...\n");
                   2689:        printf("    (value) STEP\n\n");
                   2690: 
                   2691:        printf("    %s/%s %s/%s FOR (variable)\n", d_INT, d_REL,
                   2692:                d_INT, d_REL);
                   2693:        printf("        (expression)\n");
                   2694:        printf("        [EXIT]/[CYCLE]\n");
                   2695:        printf("        ...\n");
                   2696:        printf("    (value) STEP\n");
                   2697: 
                   2698:        return;
                   2699:    }
                   2700:    else if ((*s_etat_processus).test_instruction == 'Y')
                   2701:    {
                   2702:        (*s_etat_processus).nombre_arguments = -1;
                   2703:        return;
                   2704:    }
                   2705: 
                   2706:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                   2707:    {
                   2708:        if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
                   2709:        {
                   2710:            return;
                   2711:        }
                   2712:    }
                   2713: 
                   2714:    presence_compteur = ((*(*s_etat_processus).l_base_pile_systeme)
                   2715:            .type_cloture == 'F') ? d_vrai : d_faux;
                   2716: 
                   2717:    if (((*(*s_etat_processus).l_base_pile_systeme).type_cloture != 'S')
                   2718:            && (presence_compteur == d_faux))
                   2719:    {
                   2720:        (*s_etat_processus).erreur_execution = d_ex_erreur_traitement_boucle;
                   2721:        return;
                   2722:    }
                   2723: 
                   2724:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   2725:            &s_objet) == d_erreur)
                   2726:    {
                   2727:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                   2728:        return;
                   2729:    }
                   2730: 
                   2731:    if (((*s_objet).type != INT) &&
                   2732:            ((*s_objet).type != REL))
                   2733:    {
                   2734:        liberation(s_etat_processus, s_objet);
                   2735: 
                   2736:        (*s_etat_processus).erreur_execution = d_ex_erreur_traitement_boucle;
                   2737:        return;
                   2738:    }
                   2739:    
                   2740:    if ((*s_objet).type == INT)
                   2741:    {
                   2742:        incrementation = ((*((integer8 *) (*s_objet).objet)) >= 0)
                   2743:                ? d_vrai : d_faux;
                   2744:    }
                   2745:    else
                   2746:    {
                   2747:        incrementation = ((*((real8 *) (*s_objet).objet)) >= 0)
                   2748:                ? d_vrai : d_faux;
                   2749:    }
                   2750: 
                   2751:    if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   2752:            s_objet) == d_erreur)
                   2753:    {
                   2754:        return;
                   2755:    }
                   2756: 
                   2757:    /*
                   2758:     * Pour une boucle avec indice, on fait pointer
                   2759:     * (*(*s_etat_processus).l_base_pile_systeme).indice_boucle sur
                   2760:     * la variable correspondante. Remarque, le contenu de la variable
                   2761:     * est détruit au courant de l'opération.
                   2762:     */
                   2763: 
                   2764:    if (presence_compteur == d_vrai)
                   2765:    {
                   2766:        if (recherche_variable(s_etat_processus, (*(*s_etat_processus)
                   2767:                .l_base_pile_systeme).nom_variable) == d_faux)
                   2768:        {
                   2769:            liberation(s_etat_processus, s_objet);
                   2770: 
                   2771:            (*s_etat_processus).erreur_systeme = d_es;
                   2772:            (*s_etat_processus).erreur_execution = d_ex_variable_non_definie;
                   2773:            return;
                   2774:        }
                   2775: 
1.27      bertrand 2776:        if ((*(*s_etat_processus).pointeur_variable_courante)
                   2777:                .variable_verrouillee == d_vrai)
1.1       bertrand 2778:        {
                   2779:            liberation(s_etat_processus, s_objet);
                   2780: 
                   2781:            (*s_etat_processus).erreur_execution = d_ex_variable_verrouillee;
                   2782:            return;
                   2783:        }
                   2784:    
1.27      bertrand 2785:        if ((*(*s_etat_processus).pointeur_variable_courante).objet == NULL)
1.1       bertrand 2786:        {
                   2787:            liberation(s_etat_processus, s_objet);
                   2788: 
                   2789:            (*s_etat_processus).erreur_execution = d_ex_variable_partagee;
                   2790:            return;
                   2791:        }
                   2792: 
                   2793:        (*(*s_etat_processus).l_base_pile_systeme).indice_boucle =
1.27      bertrand 2794:                (*(*s_etat_processus).pointeur_variable_courante).objet;
1.1       bertrand 2795:    }
                   2796: 
                   2797:    /*
                   2798:     * Empilement pour calculer le nouvel indice. Au passage, la
                   2799:     * variable (*(*s_etat_processus).l_base_pile_systeme).indice_boucle
                   2800:     * est libérée.
                   2801:     */
                   2802: 
                   2803:    if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   2804:            (*(*s_etat_processus).l_base_pile_systeme).indice_boucle)
                   2805:            == d_erreur)
                   2806:    {
                   2807:        return;
                   2808:    }
                   2809: 
                   2810:    instruction_plus(s_etat_processus);
                   2811: 
                   2812:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   2813:            &s_objet) == d_erreur)
                   2814:    {
                   2815:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                   2816:        return;
                   2817:    }
                   2818: 
                   2819:    if (((*s_objet).type != INT) &&
                   2820:            ((*s_objet).type != REL))
                   2821:    {
                   2822:        liberation(s_etat_processus, s_objet);
                   2823: 
                   2824:        (*s_etat_processus).erreur_execution = d_ex_erreur_traitement_boucle;
                   2825:        return;
                   2826:    }
                   2827:    
                   2828:    if (presence_compteur == d_vrai)
                   2829:    {
                   2830:        /*
                   2831:         * L'addition crée si besoin une copie de l'objet
                   2832:         */
                   2833: 
                   2834:        (*(*s_etat_processus).l_base_pile_systeme).indice_boucle = NULL;
1.27      bertrand 2835:        (*(*s_etat_processus).pointeur_variable_courante).objet = s_objet;
1.1       bertrand 2836:    }
                   2837:    else
                   2838:    {
                   2839:        (*(*s_etat_processus).l_base_pile_systeme).indice_boucle = s_objet;
                   2840:    }
                   2841: 
                   2842:    if ((s_copie_objet = copie_objet(s_etat_processus, s_objet, 'P')) == NULL)
                   2843:    {
                   2844:        (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2845:        return;
                   2846:    }
                   2847: 
                   2848:    if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   2849:            s_copie_objet) == d_erreur)
                   2850:    {
                   2851:        return;
                   2852:    }
                   2853: 
                   2854:    if ((s_copie_objet = copie_objet(s_etat_processus,
                   2855:            (*(*s_etat_processus).l_base_pile_systeme)
                   2856:            .limite_indice_boucle, 'P')) == NULL)
                   2857:    {
                   2858:        (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2859:        return;
                   2860:    }
                   2861: 
                   2862:    if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   2863:            s_copie_objet) == d_erreur)
                   2864:    {
                   2865:        return;
                   2866:    }
                   2867:    
                   2868:    if (incrementation == d_vrai)
                   2869:    {
                   2870:        instruction_le(s_etat_processus);
                   2871:    }
                   2872:    else
                   2873:    {
                   2874:        instruction_ge(s_etat_processus);
                   2875:    }
                   2876: 
                   2877:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   2878:            &s_objet) == d_erreur)
                   2879:    {
                   2880:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                   2881:        return;
                   2882:    }
                   2883: 
                   2884:    if ((*s_objet).type != INT)
                   2885:    {
                   2886:        liberation(s_etat_processus, s_objet);
                   2887: 
                   2888:        (*s_etat_processus).erreur_execution = d_ex_erreur_traitement_boucle;
                   2889:        return;
                   2890:    }
                   2891: 
                   2892:    if ((*((integer8 *) (*s_objet).objet)) != 0)
                   2893:    {
                   2894:        if ((*(*s_etat_processus).l_base_pile_systeme)
                   2895:                .origine_routine_evaluation == 'N')
                   2896:        {
                   2897:            (*s_etat_processus).position_courante = (*(*s_etat_processus)
                   2898:                    .l_base_pile_systeme).adresse_retour;
                   2899:        }
                   2900:        else
                   2901:        {
                   2902:            (*s_etat_processus).expression_courante = (*(*s_etat_processus)
                   2903:                    .l_base_pile_systeme).pointeur_objet_retour;
                   2904:        }
                   2905:    }
                   2906:    else
                   2907:    {
                   2908:        depilement_pile_systeme(s_etat_processus);
                   2909: 
                   2910:        if ((*s_etat_processus).erreur_systeme != d_es)
                   2911:        {
                   2912:            return;
                   2913:        }
                   2914: 
                   2915:        if (presence_compteur == d_vrai)
                   2916:        {
                   2917:            (*s_etat_processus).niveau_courant--;
                   2918: 
1.56      bertrand 2919:            if (retrait_variables_par_niveau(s_etat_processus) == d_erreur)
1.1       bertrand 2920:            {
                   2921:                return;
                   2922:            }
                   2923:        }
                   2924:    }
                   2925: 
                   2926:    liberation(s_etat_processus, s_objet);
                   2927: 
                   2928:    return;
                   2929: }
                   2930: 
                   2931: 
                   2932: /*
                   2933: ================================================================================
                   2934:   Fonction 'sf'
                   2935: ================================================================================
                   2936:   Entrées : structure processus
                   2937: --------------------------------------------------------------------------------
                   2938:   Sorties :
                   2939: --------------------------------------------------------------------------------
                   2940:   Effets de bord : néant
                   2941: ================================================================================
                   2942: */
                   2943: 
                   2944: void
                   2945: instruction_sf(struct_processus *s_etat_processus)
                   2946: {
                   2947:    struct_objet                            *s_objet;
                   2948: 
                   2949:    (*s_etat_processus).erreur_execution = d_ex;
                   2950: 
                   2951:    if ((*s_etat_processus).affichage_arguments == 'Y')
                   2952:    {
                   2953:        printf("\n  SF ");
                   2954: 
                   2955:        if ((*s_etat_processus).langue == 'F')
                   2956:        {
                   2957:            printf("(positionne un indicateur binaire)\n\n");
                   2958:        }
                   2959:        else
                   2960:        {
                   2961:            printf("(set flag)\n\n");
                   2962:        }
                   2963: 
                   2964:        printf("    1: 1 <= %s <= 64\n", d_INT);
                   2965: 
                   2966:        return;
                   2967:    }
                   2968:    else if ((*s_etat_processus).test_instruction == 'Y')
                   2969:    {
                   2970:        (*s_etat_processus).nombre_arguments = -1;
                   2971:        return;
                   2972:    }
                   2973: 
                   2974:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                   2975:    {
                   2976:        if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
                   2977:        {
                   2978:            return;
                   2979:        }
                   2980:    }
                   2981: 
                   2982:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   2983:            &s_objet) == d_erreur)
                   2984:    {
                   2985:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                   2986:        return;
                   2987:    }
                   2988: 
                   2989:    if ((*s_objet).type == INT)
                   2990:    {
                   2991:        if (((*((integer8 *) (*s_objet).objet)) < 1) || ((*((integer8 *)
                   2992:                (*s_objet).objet)) > 64))
                   2993:        {
                   2994:            liberation(s_etat_processus, s_objet);
                   2995: 
                   2996:            (*s_etat_processus).erreur_execution = d_ex_drapeau_inexistant;
                   2997:            return;
                   2998:        }
                   2999: 
                   3000:        sf(s_etat_processus, (unsigned char) (*((integer8 *)
                   3001:                (*s_objet).objet)));
                   3002:    }
                   3003:    else
                   3004:    {
                   3005:        liberation(s_etat_processus, s_objet);
                   3006: 
                   3007:        (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
                   3008:        return;
                   3009:    }
                   3010: 
                   3011:    liberation(s_etat_processus, s_objet);
                   3012: 
                   3013:    return;
                   3014: }
                   3015: 
                   3016: 
                   3017: /*
                   3018: ================================================================================
                   3019:   Fonction 'stof'
                   3020: ================================================================================
                   3021:   Entrées : structure processus
                   3022: --------------------------------------------------------------------------------
                   3023:   Sorties :
                   3024: --------------------------------------------------------------------------------
                   3025:   Effets de bord : néant
                   3026: ================================================================================
                   3027: */
                   3028: 
                   3029: void
                   3030: instruction_stof(struct_processus *s_etat_processus)
                   3031: {
                   3032:    struct_objet                            *s_objet;
                   3033: 
                   3034:    t_8_bits                                masque;
                   3035: 
                   3036:    unsigned char                           indice_bit;
                   3037:    unsigned char                           indice_bloc;
                   3038:    unsigned char                           indice_drapeau;
                   3039:    unsigned char                           taille_bloc;
                   3040: 
                   3041:    unsigned long                           i;
                   3042: 
                   3043:    (*s_etat_processus).erreur_execution = d_ex;
                   3044: 
                   3045:    if ((*s_etat_processus).affichage_arguments == 'Y')
                   3046:    {
                   3047:        printf("\n  STOF ");
                   3048: 
                   3049:        if ((*s_etat_processus).langue == 'F')
                   3050:        {
                   3051:            printf("(positionne les drapeaux d'état)\n\n");
                   3052:        }
                   3053:        else
                   3054:        {
                   3055:            printf("(set flags)\n\n");
                   3056:        }
                   3057: 
                   3058:        printf("->  1: %s\n", d_BIN);
                   3059: 
                   3060:        return;
                   3061:    }
                   3062:    else if ((*s_etat_processus).test_instruction == 'Y')
                   3063:    {
                   3064:        (*s_etat_processus).nombre_arguments = -1;
                   3065:        return;
                   3066:    }
                   3067:    
                   3068:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                   3069:    {
                   3070:        if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
                   3071:        {
                   3072:            return;
                   3073:        }
                   3074:    }
                   3075: 
                   3076:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   3077:            &s_objet) == d_erreur)
                   3078:    {
                   3079:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                   3080:        return;
                   3081:    }
                   3082: 
                   3083:    if ((*s_objet).type == BIN)
                   3084:    {
                   3085:        taille_bloc = sizeof(t_8_bits) * 8;
                   3086: 
                   3087:        for(i = 0; i < 8; (*s_etat_processus).drapeaux_etat[i++] = 0);
                   3088: 
                   3089:        for(i = 1; i <= 64; i++)
                   3090:        {
                   3091:            indice_drapeau = i - 1;
                   3092:            indice_bloc = indice_drapeau / taille_bloc;
                   3093:            indice_bit = indice_drapeau % taille_bloc;
                   3094:            masque = ((t_8_bits) 1) << (taille_bloc - indice_bit - 1);
                   3095: 
                   3096:            if (((*((logical8 *) (*s_objet).objet)) &
                   3097:                    ((logical8) 1) << indice_drapeau) != 0)
                   3098:            {
                   3099:                (*s_etat_processus).drapeaux_etat[indice_bloc] |= masque;
                   3100:            }
                   3101:        }
                   3102:    }
                   3103:    else
                   3104:    {
                   3105:        liberation(s_etat_processus, s_objet);
                   3106: 
                   3107:        (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
                   3108:        return;
                   3109:    }
                   3110: 
                   3111:    liberation(s_etat_processus, s_objet);
                   3112: 
                   3113:    return;
                   3114: }
                   3115: 
                   3116: 
                   3117: /*
                   3118: ================================================================================
                   3119:   Fonction 'sto'
                   3120: ================================================================================
                   3121:   Entrées : structure processus
                   3122: --------------------------------------------------------------------------------
                   3123:   Sorties :
                   3124: --------------------------------------------------------------------------------
                   3125:   Effets de bord : néant
                   3126: ================================================================================
                   3127: */
                   3128: 
                   3129: void
                   3130: instruction_sto(struct_processus *s_etat_processus)
                   3131: {
                   3132:    struct_objet                        *s_objet_1;
                   3133:    struct_objet                        *s_objet_2;
                   3134: 
                   3135:    struct_variable                     s_variable;
                   3136: 
                   3137:    (*s_etat_processus).erreur_execution = d_ex;
                   3138: 
                   3139:    if ((*s_etat_processus).affichage_arguments == 'Y')
                   3140:    {
                   3141:        printf("\n  STO ");
                   3142: 
                   3143:        if ((*s_etat_processus).langue == 'F')
                   3144:        {
                   3145:            printf("(affecte un objet à une variable)\n\n");
                   3146:        }
                   3147:        else
                   3148:        {
                   3149:            printf("(store an object in a variable)\n\n");
                   3150:        }
                   3151: 
                   3152:        printf("    2: %s, %s, %s, %s, %s, %s,\n"
                   3153:                "       %s, %s, %s, %s, %s,\n"
                   3154:                "       %s, %s, %s, %s, %s,\n"
                   3155:                "       %s, %s, %s, %s, %s,\n"
                   3156:                "       %s\n",
                   3157:                d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX,
                   3158:                d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SCK,
                   3159:                d_SLB, d_PRC, d_MTX, d_SQL);
                   3160:        printf("    1: %s\n", d_NOM);
                   3161: 
                   3162:        return;
                   3163:    }
                   3164:    else if ((*s_etat_processus).test_instruction == 'Y')
                   3165:    {
                   3166:        (*s_etat_processus).nombre_arguments = -1;
                   3167:        return;
                   3168:    }
                   3169:    
                   3170:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                   3171:    {
                   3172:        if (empilement_pile_last(s_etat_processus, 2) == d_erreur)
                   3173:        {
                   3174:            return;
                   3175:        }
                   3176:    }
                   3177: 
                   3178:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   3179:            &s_objet_1) == d_erreur)
                   3180:    {
                   3181:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                   3182:        return;
                   3183:    }
                   3184: 
                   3185:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   3186:            &s_objet_2) == d_erreur)
                   3187:    {
                   3188:        liberation(s_etat_processus, s_objet_1);
                   3189: 
                   3190:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                   3191:        return;
                   3192:    }
                   3193: 
                   3194:    if ((*s_objet_1).type != NOM)
                   3195:    {
                   3196:        liberation(s_etat_processus, s_objet_1);
                   3197:        liberation(s_etat_processus, s_objet_2);
                   3198: 
                   3199:        (*s_etat_processus).erreur_execution = d_ex_nom_invalide;
                   3200:        return;
                   3201:    }
                   3202: 
                   3203:    if (recherche_variable(s_etat_processus, (*((struct_nom *)
                   3204:            (*s_objet_1).objet)).nom) == d_vrai)
                   3205:    {
                   3206:        /*
                   3207:         * La variable est accessible.
                   3208:         */
                   3209: 
1.27      bertrand 3210:        if ((*(*s_etat_processus).pointeur_variable_courante)
                   3211:                .variable_verrouillee == d_vrai)
1.1       bertrand 3212:        {
                   3213:            liberation(s_etat_processus, s_objet_1);
                   3214:            liberation(s_etat_processus, s_objet_2);
                   3215: 
                   3216:            (*s_etat_processus).erreur_execution = d_ex_variable_verrouillee;
                   3217:            return;
                   3218:        }
                   3219: 
1.27      bertrand 3220:        if ((*(*s_etat_processus).pointeur_variable_courante).objet == NULL)
1.1       bertrand 3221:        {
                   3222:            if (recherche_variable_partagee(s_etat_processus,
1.27      bertrand 3223:                    (*(*s_etat_processus).pointeur_variable_courante).nom,
                   3224:                    (*(*s_etat_processus).pointeur_variable_courante)
                   3225:                    .variable_partagee, (*(*s_etat_processus)
1.59      bertrand 3226:                    .pointeur_variable_courante).origine) == NULL)
1.1       bertrand 3227:            {
1.57      bertrand 3228:                if (((*s_etat_processus).autorisation_nom_implicite == 'N') &&
                   3229:                        ((*((struct_nom *) (*s_objet_1).objet)).symbole
                   3230:                        == d_faux))
1.25      bertrand 3231:                {
                   3232:                    liberation(s_etat_processus, s_objet_1);
                   3233:                    liberation(s_etat_processus, s_objet_2);
                   3234: 
                   3235:                    (*s_etat_processus).erreur_systeme = d_es;
                   3236:                    (*s_etat_processus).erreur_execution =
                   3237:                            d_ex_creation_variable_globale;
                   3238:                    return;
                   3239:                }
                   3240: 
1.1       bertrand 3241:                if ((s_variable.nom = malloc((strlen((*((struct_nom *)
                   3242:                        (*s_objet_1).objet)).nom) + 1) *
                   3243:                        sizeof(unsigned char))) == NULL)
                   3244:                {
                   3245:                    (*s_etat_processus).erreur_systeme =
                   3246:                            d_es_allocation_memoire;
                   3247:                    return;
                   3248:                }
                   3249: 
                   3250:                strcpy(s_variable.nom, (*((struct_nom *)
                   3251:                        (*s_objet_1).objet)).nom);
                   3252:                s_variable.niveau = 1;
                   3253: 
                   3254:                /*
                   3255:                 * Le niveau 0 correspond aux définitions. Les variables
                   3256:                 * commencent à 1 car elles sont toujours incluses dans
                   3257:                 * une définition.
                   3258:                 */
                   3259: 
                   3260:                s_variable.objet = s_objet_2;
                   3261: 
                   3262:                if (creation_variable(s_etat_processus, &s_variable, 'V', 'P')
                   3263:                        == d_erreur)
                   3264:                {
                   3265:                    return;
                   3266:                }
                   3267: 
                   3268:                (*s_etat_processus).erreur_systeme = d_es;
                   3269:            }
                   3270:            else
                   3271:            {
                   3272:                liberation(s_etat_processus, (*(*s_etat_processus)
1.58      bertrand 3273:                        .pointeur_variable_partagee_courante).objet);
                   3274:                (*(*s_etat_processus).pointeur_variable_partagee_courante)
                   3275:                        .objet = s_objet_2;
1.1       bertrand 3276: 
                   3277:                if (pthread_mutex_unlock(&((*(*s_etat_processus)
1.58      bertrand 3278:                        .pointeur_variable_partagee_courante).mutex)) != 0)
1.1       bertrand 3279:                {
                   3280:                    (*s_etat_processus).erreur_systeme = d_es_processus;
                   3281:                    return;
                   3282:                }
                   3283:            }
                   3284:        }
                   3285:        else
                   3286:        {
1.57      bertrand 3287:            if (((*s_etat_processus).autorisation_nom_implicite == 'N') &&
                   3288:                    ((*((struct_nom *) (*s_objet_1).objet)).symbole == d_faux))
1.25      bertrand 3289:            {
1.27      bertrand 3290:                if ((*(*s_etat_processus).pointeur_variable_courante)
                   3291:                        .niveau == 1)
1.25      bertrand 3292:                {
                   3293:                    liberation(s_etat_processus, s_objet_1);
                   3294:                    liberation(s_etat_processus, s_objet_2);
                   3295: 
                   3296:                    (*s_etat_processus).erreur_execution =
                   3297:                            d_ex_creation_variable_globale;
                   3298:                    return;
                   3299:                }
                   3300:            }
                   3301: 
1.1       bertrand 3302:            liberation(s_etat_processus,
1.27      bertrand 3303:                    (*(*s_etat_processus).pointeur_variable_courante).objet);
                   3304:            (*(*s_etat_processus).pointeur_variable_courante).objet =
                   3305:                    s_objet_2;
1.1       bertrand 3306:        }
                   3307:    }
                   3308:    else
                   3309:    {
                   3310:        /*
                   3311:         * La variable n'est pas accessible ou n'existe pas et on crée
                   3312:         * une variable globale.
                   3313:         */
                   3314: 
1.57      bertrand 3315:        if (((*s_etat_processus).autorisation_nom_implicite == 'N') &&
                   3316:                ((*((struct_nom *) (*s_objet_1).objet)).symbole == d_faux))
1.25      bertrand 3317:        {
                   3318:            liberation(s_etat_processus, s_objet_1);
                   3319:            liberation(s_etat_processus, s_objet_2);
                   3320: 
                   3321:            (*s_etat_processus).erreur_systeme = d_es;
                   3322:            (*s_etat_processus).erreur_execution =
                   3323:                    d_ex_creation_variable_globale;
                   3324:            return;
                   3325:        }
                   3326: 
1.1       bertrand 3327:        if ((s_variable.nom = malloc((strlen((*((struct_nom *)
                   3328:                (*s_objet_1).objet)).nom) + 1) * sizeof(unsigned char)))
                   3329:                == NULL)
                   3330:        {
                   3331:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   3332:            return;
                   3333:        }
                   3334: 
                   3335:        strcpy(s_variable.nom, (*((struct_nom *) (*s_objet_1).objet)).nom);
                   3336:        s_variable.niveau = 1;
                   3337: 
                   3338:        /*
                   3339:         * Le niveau 0 correspond aux définitions. Les variables
                   3340:         * commencent à 1 car elles sont toujours incluses dans
                   3341:         * une définition.
                   3342:         */
                   3343: 
                   3344:        s_variable.objet = s_objet_2;
                   3345: 
                   3346:        if (creation_variable(s_etat_processus, &s_variable, 'V', 'P')
                   3347:                == d_erreur)
                   3348:        {
                   3349:            return;
                   3350:        }
                   3351: 
                   3352:        (*s_etat_processus).erreur_systeme = d_es;
                   3353:    }
                   3354: 
                   3355:    liberation(s_etat_processus, s_objet_1);
                   3356: 
                   3357:    return;
                   3358: }
                   3359: 
                   3360: 
                   3361: /*
                   3362: ================================================================================
                   3363:   Fonction 'syseval'
                   3364: ================================================================================
                   3365:   Entrées : pointeur sur une struct_processus
                   3366: --------------------------------------------------------------------------------
                   3367:   Sorties :
                   3368: --------------------------------------------------------------------------------
                   3369:   Effets de bord : néant
                   3370: ================================================================================
                   3371: */
                   3372: 
                   3373: void
                   3374: instruction_syseval(struct_processus *s_etat_processus)
                   3375: {
                   3376:    char                        **arguments;
                   3377: 
                   3378:    int                         ios;
                   3379:    int                         pipes_entree[2];
                   3380:    int                         pipes_erreur[2];
                   3381:    int                         pipes_sortie[2];
                   3382:    int                         status;
                   3383: 
                   3384:    logical1                    drapeau_fin;
                   3385:    logical1                    presence_stdin;
                   3386: 
                   3387:    long                        i;
1.52      bertrand 3388:    long                        longueur_ecriture;
1.50      bertrand 3389:    long                        longueur_traitee;
1.1       bertrand 3390:    long                        nombre_arguments;
                   3391: 
                   3392:    pid_t                       pid;
                   3393: 
                   3394:    struct_liste_chainee        *l_element_courant;
                   3395:    struct_liste_chainee        *l_element_precedent;
                   3396:    struct_liste_chainee        *l_element_stdin;
                   3397: 
                   3398:    struct_objet                *s_objet;
                   3399:    struct_objet                *s_objet_composite;
                   3400:    struct_objet                *s_objet_resultat;
                   3401:    struct_objet                *s_objet_temporaire;
                   3402: 
                   3403:    struct sigaction            action_courante;
                   3404:    struct sigaction            action_passee;
                   3405: 
1.49      bertrand 3406:    unsigned char               *ligne;
1.1       bertrand 3407:    unsigned char               *ptr;
                   3408:    unsigned char               *ptr2;
                   3409:    unsigned char               registre_autorisation_empilement_programme;
                   3410:    unsigned char               *registre_instruction_courante;
                   3411:    unsigned char               *registre_programme;
                   3412:    unsigned char               *tampon;
                   3413: 
                   3414:    unsigned long               longueur_lecture;
                   3415:    unsigned long               longueur_tampon;
                   3416:    unsigned long               nombre_iterations;
                   3417:    unsigned long               nombre_lignes;
                   3418:    unsigned long               pointeur;
                   3419:    unsigned long               registre_position_courante;
                   3420: 
                   3421:    (*s_etat_processus).erreur_execution = d_ex;
                   3422: 
                   3423:    if ((*s_etat_processus).affichage_arguments == 'Y')
                   3424:    {
                   3425:        printf("\n  SYSEVAL ");
                   3426: 
                   3427:        if ((*s_etat_processus).langue == 'F')
                   3428:        {
                   3429:            printf("(exécute une commande système)\n\n");
                   3430:        }
                   3431:        else
                   3432:        {
                   3433:            printf("(execute a shell command)\n\n");
                   3434:        }
                   3435: 
                   3436:        printf("    1: %s\n", d_CHN);
                   3437:        printf("->  1: %s\n\n", d_LST);
                   3438: 
                   3439:        printf("    1: %s\n", d_LST);
                   3440:        printf("->  1: %s\n", d_LST);
                   3441: 
                   3442:        return;
                   3443:    }
                   3444:    else if ((*s_etat_processus).test_instruction == 'Y')
                   3445:    {
                   3446:        (*s_etat_processus).nombre_arguments = -1;
                   3447:        return;
                   3448:    }
                   3449:    
                   3450:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                   3451:    {
                   3452:        if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
                   3453:        {
                   3454:            return;
                   3455:        }
                   3456:    }
                   3457: 
                   3458:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   3459:            &s_objet) == d_erreur)
                   3460:    {
                   3461:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                   3462:        return;
                   3463:    }
                   3464: 
                   3465:    s_objet_composite = NULL;
                   3466:    l_element_stdin = NULL;
                   3467:    presence_stdin = d_faux;
                   3468: 
                   3469:    if ((*s_objet).type == LST)
                   3470:    {
                   3471:        s_objet_composite = s_objet;
                   3472:        s_objet = (*((struct_liste_chainee *) (*s_objet_composite)
                   3473:                .objet)).donnee;
                   3474:        l_element_stdin = (*((struct_liste_chainee *) (*s_objet_composite)
                   3475:                .objet)).suivant;
                   3476: 
                   3477:        l_element_courant = l_element_stdin;
                   3478: 
                   3479:        if (l_element_courant == NULL)
                   3480:        {
                   3481:            liberation(s_etat_processus, s_objet_composite);
                   3482: 
                   3483:            (*s_etat_processus).erreur_execution = d_ex_argument_invalide;
                   3484:            return;
                   3485:        }
                   3486: 
                   3487:        while(l_element_courant != NULL)
                   3488:        {
                   3489:            if ((*(*l_element_courant).donnee).type != CHN)
                   3490:            {
                   3491:                liberation(s_etat_processus, s_objet_composite);
                   3492: 
                   3493:                (*s_etat_processus).erreur_execution =
                   3494:                        d_ex_erreur_type_argument;
                   3495:                return;
                   3496:            }
                   3497: 
                   3498:            l_element_courant = (*l_element_courant).suivant;
                   3499:        }
                   3500: 
                   3501:        presence_stdin = d_vrai;
                   3502:    }
                   3503: 
                   3504:    if ((*s_objet).type == CHN)
                   3505:    {
                   3506:        registre_autorisation_empilement_programme =
                   3507:                (*s_etat_processus).autorisation_empilement_programme;
                   3508:        registre_instruction_courante =
                   3509:                (*s_etat_processus).instruction_courante;
                   3510:        registre_programme = (*s_etat_processus).definitions_chainees;
                   3511:        registre_position_courante = (*s_etat_processus).position_courante;
                   3512: 
                   3513:        (*s_etat_processus).position_courante = 0;
                   3514:        (*s_etat_processus).autorisation_empilement_programme = 'N';
                   3515: 
                   3516:        /*
                   3517:         * Échappement des guillemets
                   3518:         */
                   3519: 
1.50      bertrand 3520:        if (((*s_etat_processus).definitions_chainees =
                   3521:                formateur_flux(s_etat_processus, (unsigned char *)
                   3522:                (*s_objet).objet, &longueur_traitee)) == NULL)
1.1       bertrand 3523:        {
1.50      bertrand 3524:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   3525:            return;
1.1       bertrand 3526:        }
                   3527: 
                   3528:        /*
                   3529:         * Scission de la chaîne en différents arguments
                   3530:         */
                   3531: 
                   3532:        nombre_arguments = 0;
                   3533:        drapeau_fin = d_faux;
                   3534: 
                   3535:        do
                   3536:        {
                   3537:            if (recherche_instruction_suivante(s_etat_processus) == d_erreur)
                   3538:            {
1.50      bertrand 3539:                free((*s_etat_processus).definitions_chainees);
                   3540: 
1.1       bertrand 3541:                (*s_etat_processus).autorisation_empilement_programme =
                   3542:                        registre_autorisation_empilement_programme;
                   3543:                (*s_etat_processus).instruction_courante =
                   3544:                        registre_instruction_courante;
                   3545:                (*s_etat_processus).definitions_chainees = registre_programme;
                   3546:                (*s_etat_processus).position_courante =
                   3547:                        registre_position_courante;
                   3548: 
                   3549:                return;
                   3550:            }
                   3551: 
                   3552:            if ((*(*s_etat_processus).instruction_courante) !=
                   3553:                    d_code_fin_chaine)
                   3554:            {
                   3555:                if ((s_objet_temporaire = allocation(s_etat_processus, CHN))
                   3556:                        == NULL)
                   3557:                {
1.50      bertrand 3558:                    free((*s_etat_processus).definitions_chainees);
                   3559: 
1.1       bertrand 3560:                    (*s_etat_processus).autorisation_empilement_programme =
                   3561:                            registre_autorisation_empilement_programme;
                   3562:                    (*s_etat_processus).instruction_courante =
                   3563:                            registre_instruction_courante;
                   3564:                    (*s_etat_processus).definitions_chainees =
                   3565:                            registre_programme;
                   3566:                    (*s_etat_processus).position_courante =
                   3567:                            registre_position_courante;
                   3568: 
                   3569:                    (*s_etat_processus).erreur_systeme =
                   3570:                            d_es_allocation_memoire;
                   3571:                    return;
                   3572:                }
                   3573: 
                   3574:                (*s_objet_temporaire).objet = (*s_etat_processus)
                   3575:                        .instruction_courante;
                   3576: 
                   3577:                /*
                   3578:                 * S'il y a des guillemets en début de chaîne, il y en
                   3579:                 * a aussi à la fin de la chaîne et on les ôte. Les
                   3580:                 * guillements intermédiaires sont protégés par une
                   3581:                 * séquence d'échappement qui est enlevée.
                   3582:                 */
                   3583: 
                   3584:                if ((*s_etat_processus).instruction_courante[0] == '"')
                   3585:                {
                   3586:                    if (strlen((*s_etat_processus).instruction_courante) >= 2)
                   3587:                    {
                   3588:                        ptr = (*s_etat_processus).instruction_courante;
                   3589:                        ptr2 = ptr + 1;
                   3590: 
                   3591:                        while((*ptr2) != d_code_fin_chaine)
                   3592:                        {
                   3593:                            *ptr++ = *ptr2++;
                   3594:                        }
                   3595: 
                   3596:                        (*(--ptr)) = d_code_fin_chaine;
                   3597:                    }
                   3598:                }
                   3599: 
                   3600:                if (empilement(s_etat_processus,
                   3601:                        &((*s_etat_processus).l_base_pile),
                   3602:                        s_objet_temporaire) == d_erreur)
                   3603:                {
1.50      bertrand 3604:                    free((*s_etat_processus).definitions_chainees);
                   3605: 
                   3606:                    (*s_etat_processus).autorisation_empilement_programme =
                   3607:                            registre_autorisation_empilement_programme;
                   3608:                    (*s_etat_processus).instruction_courante =
                   3609:                            registre_instruction_courante;
                   3610:                    (*s_etat_processus).definitions_chainees =
                   3611:                            registre_programme;
                   3612:                    (*s_etat_processus).position_courante =
                   3613:                            registre_position_courante;
1.1       bertrand 3614:                    return;
                   3615:                }
                   3616:            }
                   3617:            else
                   3618:            {
                   3619:                free((*s_etat_processus).instruction_courante);
                   3620:                drapeau_fin = d_vrai;
                   3621:            }
                   3622: 
                   3623:            nombre_arguments++;
                   3624:        } while(drapeau_fin == d_faux);
                   3625: 
1.50      bertrand 3626:        free((*s_etat_processus).definitions_chainees);
                   3627: 
1.1       bertrand 3628:        (*s_etat_processus).autorisation_empilement_programme =
                   3629:                registre_autorisation_empilement_programme;
                   3630:        (*s_etat_processus).instruction_courante =
                   3631:                registre_instruction_courante;
                   3632:        (*s_etat_processus).definitions_chainees = registre_programme;
                   3633:        (*s_etat_processus).position_courante = registre_position_courante;
                   3634: 
                   3635:        if ((arguments = malloc(nombre_arguments * sizeof(char *))) == NULL)
                   3636:        {
                   3637:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   3638:            return;
                   3639:        }
                   3640: 
                   3641:        l_element_courant = (*s_etat_processus).l_base_pile;
                   3642:        nombre_arguments--;
                   3643: 
                   3644:        for(i = nombre_arguments, arguments[i--] = NULL; i >= 0; i--)
                   3645:        {
                   3646:            arguments[i] = (char *) (*(*l_element_courant).donnee).objet;
                   3647:            l_element_courant = (*l_element_courant).suivant;
                   3648:        }
                   3649: 
                   3650:        action_courante.sa_handler = SIG_IGN;
                   3651:        action_courante.sa_flags = SA_NODEFER | SA_ONSTACK;
                   3652: 
                   3653:        if (sigaction(SIGINT, &action_courante, &action_passee) != 0)
                   3654:        {
                   3655:            for(i = 0; i < nombre_arguments; i++)
                   3656:            {
                   3657:                depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   3658:                        &s_objet_temporaire);
                   3659:                liberation(s_etat_processus, s_objet_temporaire);
                   3660:            }
                   3661: 
                   3662:            free(arguments);
                   3663:            (*s_etat_processus).erreur_systeme = d_es_signal;
                   3664:            return;
                   3665:        }
                   3666: 
                   3667:        if (pipe(pipes_entree) != 0)
                   3668:        {
                   3669:            (*s_etat_processus).erreur_systeme = d_es_processus;
                   3670:            return;
                   3671:        }
                   3672:            
                   3673:        if (pipe(pipes_sortie) != 0)
                   3674:        {
                   3675:            (*s_etat_processus).erreur_systeme = d_es_processus;
                   3676:            return;
                   3677:        }
                   3678: 
                   3679:        if (pipe(pipes_erreur) != 0)
                   3680:        {
                   3681:            (*s_etat_processus).erreur_systeme = d_es_processus;
                   3682:            return;
                   3683:        }
                   3684: 
                   3685:        fflush(NULL);
                   3686: 
                   3687:        verrouillage_threads_concurrents(s_etat_processus);
                   3688:        pid = fork();
                   3689:        deverrouillage_threads_concurrents(s_etat_processus);
                   3690: 
                   3691:        if (pid < 0)
                   3692:        {
                   3693:            if (close(pipes_entree[0]) != 0)
                   3694:            {
                   3695:                (*s_etat_processus).erreur_systeme = d_es_processus;
                   3696:                return;
                   3697:            }
                   3698: 
                   3699:            if (close(pipes_entree[1]) != 0)
                   3700:            {
                   3701:                (*s_etat_processus).erreur_systeme = d_es_processus;
                   3702:                return;
                   3703:            }
                   3704: 
                   3705:            if (close(pipes_sortie[0]) != 0)
                   3706:            {
                   3707:                (*s_etat_processus).erreur_systeme = d_es_processus;
                   3708:                return;
                   3709:            }
                   3710: 
                   3711:            if (close(pipes_sortie[1]) != 0)
                   3712:            {
                   3713:                (*s_etat_processus).erreur_systeme = d_es_processus;
                   3714:                return;
                   3715:            }
                   3716: 
                   3717:            if (close(pipes_erreur[0]) != 0)
                   3718:            {
                   3719:                (*s_etat_processus).erreur_systeme = d_es_processus;
                   3720:                return;
                   3721:            }
                   3722: 
                   3723:            if (close(pipes_erreur[1]) != 0)
                   3724:            {
                   3725:                (*s_etat_processus).erreur_systeme = d_es_processus;
                   3726:                return;
                   3727:            }
                   3728: 
                   3729:            (*s_etat_processus).erreur_systeme = d_es_processus;
                   3730:            return;
                   3731:        }
                   3732:        else if (pid == 0)
                   3733:        {
                   3734:            if (close(pipes_entree[1]) != 0)
                   3735:            {
                   3736:                (*s_etat_processus).erreur_systeme = d_es_processus;
                   3737:                return;
                   3738:            }
                   3739: 
                   3740:            if (close(pipes_sortie[0]) != 0)
                   3741:            {
                   3742:                (*s_etat_processus).erreur_systeme = d_es_processus;
                   3743:                return;
                   3744:            }
                   3745: 
                   3746:            if (close(pipes_erreur[0]) != 0)
                   3747:            {
                   3748:                (*s_etat_processus).erreur_systeme = d_es_processus;
                   3749:                return;
                   3750:            }
                   3751: 
                   3752:            if (pipes_entree[0] != STDIN_FILENO)
                   3753:            {
                   3754:                if (dup2(pipes_entree[0], STDIN_FILENO) == -1)
                   3755:                {
                   3756:                    (*s_etat_processus).erreur_systeme = d_es_processus;
                   3757:                    return;
                   3758:                }
                   3759:            }
                   3760: 
                   3761:            if (pipes_sortie[1] != STDOUT_FILENO)
                   3762:            {
                   3763:                if (dup2(pipes_sortie[1], STDOUT_FILENO) == -1)
                   3764:                {
                   3765:                    (*s_etat_processus).erreur_systeme = d_es_processus;
                   3766:                    return;
                   3767:                }
                   3768:            }
                   3769: 
                   3770:            if (pipes_sortie[1] != STDERR_FILENO)
                   3771:            {
                   3772:                if (dup2(pipes_sortie[1], STDERR_FILENO) == -1)
                   3773:                {
                   3774:                    (*s_etat_processus).erreur_systeme = d_es_processus;
                   3775:                    return;
                   3776:                }
                   3777:            }
                   3778: 
                   3779:            if (nombre_arguments != 0)
                   3780:            {
                   3781:                execvp(arguments[0], arguments);
                   3782:            }
                   3783:            else
                   3784:            {
                   3785:                exit(EXIT_SUCCESS);
                   3786:            }
                   3787: 
                   3788:            /*
                   3789:             * L'appel système execvp() a généré une erreur et n'a pu exécuter
                   3790:             * argument[0] (fichier non exécutable ou inexistant).
                   3791:             */
                   3792: 
                   3793:            close(pipes_entree[0]);
                   3794:            close(pipes_sortie[1]);
                   3795: 
                   3796:            for(i = 0; i < nombre_arguments; i++)
                   3797:            {
                   3798:                depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   3799:                        &s_objet_temporaire);
                   3800:                liberation(s_etat_processus, s_objet_temporaire);
                   3801:            }
                   3802: 
                   3803:            free(arguments);
                   3804:            (*s_etat_processus).erreur_systeme = d_es_processus;
                   3805: 
                   3806:            /*
                   3807:             * Envoi d'une erreur dans le pipe idoine. On ne regarde pas
                   3808:             * le nombre d'octets écrits car l'erreur ne pourra de toute
                   3809:             * façon pas être traitée.
                   3810:             */
                   3811: 
                   3812:            write_atomic(s_etat_processus, pipes_erreur[1], " ", 1);
                   3813:            close(pipes_erreur[1]);
                   3814: 
                   3815:            exit(EXIT_SUCCESS);
                   3816:        }
                   3817:        else
                   3818:        {
                   3819:            if (close(pipes_entree[0]) != 0)
                   3820:            {
                   3821:                (*s_etat_processus).erreur_systeme = d_es_processus;
                   3822:                return;
                   3823:            }
                   3824: 
                   3825:            if (close(pipes_sortie[1]) != 0)
                   3826:            {
                   3827:                (*s_etat_processus).erreur_systeme = d_es_processus;
                   3828:                return;
                   3829:            }
                   3830: 
                   3831:            if (close(pipes_erreur[1]) != 0)
                   3832:            {
                   3833:                (*s_etat_processus).erreur_systeme = d_es_processus;
                   3834:                return;
                   3835:            }
                   3836: 
                   3837:            if (presence_stdin == d_vrai)
                   3838:            {
                   3839:                l_element_courant = l_element_stdin;
                   3840: 
                   3841:                while(l_element_courant != NULL)
                   3842:                {
1.49      bertrand 3843:                    if ((ligne = formateur_flux(s_etat_processus,
                   3844:                            (unsigned char *) (*(*l_element_courant).donnee)
                   3845:                            .objet, &longueur_ecriture)) == NULL)
                   3846:                    {
                   3847:                        (*s_etat_processus).erreur_systeme =
                   3848:                                d_es_allocation_memoire;
                   3849:                        return;
                   3850:                    }
1.1       bertrand 3851: 
1.41      bertrand 3852: #                  ifndef SEMAPHORES_NOMMES
                   3853:                        if (sem_post(&((*s_etat_processus).semaphore_fork))
                   3854:                                != 0)
                   3855: #                  else
                   3856:                        if (sem_post((*s_etat_processus).semaphore_fork) != 0)
                   3857: #                  endif
1.1       bertrand 3858:                    {
                   3859:                        (*s_etat_processus).erreur_systeme = d_es_processus;
                   3860:                        return;
                   3861:                    }
                   3862: 
                   3863:                    while(write_atomic(s_etat_processus,
1.49      bertrand 3864:                            pipes_entree[1], ligne,
1.1       bertrand 3865:                            longueur_ecriture) != longueur_ecriture)
                   3866:                    {
1.41      bertrand 3867: #                      ifndef SEMAPHORES_NOMMES
                   3868:                            while(sem_wait(&((*s_etat_processus)
                   3869:                                    .semaphore_fork)) != 0)
                   3870: #                      else
                   3871:                            while(sem_wait((*s_etat_processus)
                   3872:                                    .semaphore_fork) != 0)
                   3873: #                      endif
1.1       bertrand 3874:                        {
1.37      bertrand 3875:                            (*s_etat_processus).erreur_systeme =
                   3876:                                    d_es_processus;
                   3877:                            return;
1.1       bertrand 3878:                        }
                   3879: 
                   3880:                        if (longueur_ecriture == -1)
                   3881:                        {
                   3882:                            (*s_etat_processus).erreur_systeme = d_es_processus;
                   3883:                            return;
                   3884:                        }
                   3885: 
1.41      bertrand 3886: #                      ifndef SEMAPHORES_NOMMES
                   3887:                            if (sem_post(&((*s_etat_processus)
                   3888:                                    .semaphore_fork)) != 0)
                   3889: #                      else
                   3890:                            if (sem_post((*s_etat_processus)
                   3891:                                    .semaphore_fork) != 0)
                   3892: #                      endif
1.1       bertrand 3893:                        {
                   3894:                            (*s_etat_processus).erreur_systeme = d_es_processus;
                   3895:                            return;
                   3896:                        }
                   3897:                    }
                   3898: 
1.49      bertrand 3899:                    free(ligne);
                   3900: 
1.1       bertrand 3901:                    while(write_atomic(s_etat_processus,
                   3902:                            pipes_entree[1], "\n", 1) != 1)
                   3903:                    {
1.41      bertrand 3904: #                      ifndef SEMAPHORES_NOMMES
                   3905:                            while(sem_wait(&((*s_etat_processus)
                   3906:                                    .semaphore_fork)) != 0)
                   3907: #                      else
                   3908:                            while(sem_wait((*s_etat_processus)
                   3909:                                    .semaphore_fork) != 0)
                   3910: #                      endif
1.1       bertrand 3911:                        {
1.40      bertrand 3912:                            if (errno != EINTR)
                   3913:                            {
                   3914:                                (*s_etat_processus).erreur_systeme =
                   3915:                                        d_es_processus;
                   3916:                                return;
                   3917:                            }
1.1       bertrand 3918:                        }
                   3919: 
                   3920:                        if (longueur_ecriture == -1)
                   3921:                        {
                   3922:                            (*s_etat_processus).erreur_systeme = d_es_processus;
                   3923:                            return;
                   3924:                        }
                   3925: 
1.41      bertrand 3926: #                      ifndef SEMAPHORES_NOMMES
                   3927:                            if (sem_post(&((*s_etat_processus)
                   3928:                                    .semaphore_fork)) != 0)
                   3929: #                      else
                   3930:                            if (sem_post((*s_etat_processus)
                   3931:                                    .semaphore_fork) != 0)
                   3932: #                      endif
1.1       bertrand 3933:                        {
                   3934:                            (*s_etat_processus).erreur_systeme = d_es_processus;
                   3935:                            return;
                   3936:                        }
                   3937:                    }
                   3938: 
1.41      bertrand 3939: #                  ifndef SEMAPHORES_NOMMES
                   3940:                        while(sem_wait(&((*s_etat_processus).semaphore_fork))
                   3941:                                != 0)
                   3942: #                  else
                   3943:                        while(sem_wait((*s_etat_processus).semaphore_fork) != 0)
                   3944: #                  endif
1.1       bertrand 3945:                    {
1.40      bertrand 3946:                        if (errno != EINTR)
                   3947:                        {
                   3948:                            (*s_etat_processus).erreur_systeme = d_es_processus;
                   3949:                            return;
                   3950:                        }
1.1       bertrand 3951:                    }
                   3952: 
                   3953:                    l_element_courant = (*l_element_courant).suivant;
                   3954:                }
                   3955:            }
                   3956: 
                   3957:            if (close(pipes_entree[1]) != 0)
                   3958:            {
                   3959:                (*s_etat_processus).erreur_systeme = d_es_processus;
                   3960:                return;
                   3961:            }
                   3962: 
                   3963:            do
                   3964:            {
                   3965:                if (kill(pid, 0) != 0)
                   3966:                {
                   3967:                    break;
                   3968:                }
                   3969: 
                   3970:                /*
                   3971:                 * Récupération de la valeur de retour du processus détaché
                   3972:                 */
                   3973: 
1.41      bertrand 3974: #              ifndef SEMAPHORES_NOMMES
                   3975:                    if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)
                   3976: #              else
                   3977:                    if (sem_post((*s_etat_processus).semaphore_fork) != 0)
                   3978: #              endif
1.1       bertrand 3979:                {
                   3980:                    (*s_etat_processus).erreur_systeme = d_es_processus;
                   3981:                    return;
                   3982:                }
                   3983: 
                   3984:                if (waitpid(pid, &status, 0) == -1)
                   3985:                {
1.41      bertrand 3986: #                  ifndef SEMAPHORES_NOMMES
                   3987:                        if (sem_post(&((*s_etat_processus).semaphore_fork))
                   3988:                                != 0)
                   3989: #                  else
                   3990:                        if (sem_post((*s_etat_processus).semaphore_fork) != 0)
                   3991: #                  endif
1.1       bertrand 3992:                    {
1.37      bertrand 3993:                        (*s_etat_processus).erreur_systeme = d_es_processus;
                   3994:                        return;
1.1       bertrand 3995:                    }
                   3996: 
                   3997:                    (*s_etat_processus).erreur_systeme = d_es_processus;
                   3998:                    return;
                   3999:                }
                   4000: 
1.41      bertrand 4001: #              ifndef SEMAPHORES_NOMMES
                   4002:                    while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0)
                   4003: #              else
                   4004:                    while(sem_wait((*s_etat_processus).semaphore_fork) != 0)
                   4005: #              endif
1.1       bertrand 4006:                {
1.40      bertrand 4007:                    if (errno != EINTR)
                   4008:                    {
                   4009:                        (*s_etat_processus).erreur_systeme = d_es_processus;
                   4010:                        return;
                   4011:                    }
1.1       bertrand 4012:                }
                   4013:            } while((!WIFEXITED(status)) && (!WIFSIGNALED(status)));
                   4014: 
                   4015:            longueur_lecture = 256;
                   4016:            pointeur = 0;
                   4017:            nombre_iterations = 1;
                   4018: 
                   4019:            if ((tampon = malloc((longueur_lecture + 1) *
                   4020:                    sizeof(unsigned char))) == NULL)
                   4021:            {
                   4022:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   4023:                return;
                   4024:            }
                   4025: 
1.49      bertrand 4026:            tampon[0] = d_code_fin_chaine;
                   4027: 
1.41      bertrand 4028: #          ifndef SEMAPHORES_NOMMES
                   4029:                if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)
                   4030: #          else
                   4031:                if (sem_post((*s_etat_processus).semaphore_fork) != 0)
                   4032: #          endif
1.8       bertrand 4033:            {
                   4034:                (*s_etat_processus).erreur_systeme = d_es_processus;
                   4035:                return;
                   4036:            }
1.1       bertrand 4037: 
                   4038:            while((ios = read_atomic(s_etat_processus,
                   4039:                    pipes_sortie[0], &(tampon[pointeur]),
                   4040:                    longueur_lecture)) > 0)
                   4041:            {
1.41      bertrand 4042: #              ifndef SEMAPHORES_NOMMES
                   4043:                    while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0)
                   4044: #              else
                   4045:                    while(sem_wait((*s_etat_processus).semaphore_fork) != 0)
                   4046: #              endif
1.1       bertrand 4047:                {
1.37      bertrand 4048:                    (*s_etat_processus).erreur_systeme = d_es_processus;
                   4049:                    return;
1.1       bertrand 4050:                }
                   4051: 
                   4052:                tampon[pointeur + ios] = d_code_fin_chaine;
                   4053:                pointeur += longueur_lecture;
                   4054:                nombre_iterations++;
                   4055: 
                   4056:                if ((tampon = realloc(tampon,
                   4057:                        ((nombre_iterations * longueur_lecture) + 1) *
                   4058:                        sizeof(unsigned char))) == NULL)
                   4059:                {
                   4060:                    (*s_etat_processus).erreur_systeme =
                   4061:                            d_es_allocation_memoire;
                   4062:                    return;
                   4063:                }
                   4064: 
1.41      bertrand 4065: #              ifndef SEMAPHORES_NOMMES
                   4066:                    if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)
                   4067: #              else
                   4068:                    if (sem_post((*s_etat_processus).semaphore_fork) != 0)
                   4069: #              endif
1.1       bertrand 4070:                {
                   4071:                    (*s_etat_processus).erreur_systeme = d_es_processus;
                   4072:                    return;
                   4073:                }
                   4074:            }
                   4075: 
1.41      bertrand 4076: #          ifndef SEMAPHORES_NOMMES
                   4077:                while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0)
                   4078: #          else
                   4079:                while(sem_wait((*s_etat_processus).semaphore_fork) != 0)
                   4080: #          endif
1.1       bertrand 4081:            {
1.40      bertrand 4082:                if (errno != EINTR)
                   4083:                {
                   4084:                    (*s_etat_processus).erreur_systeme = d_es_processus;
                   4085:                    return;
                   4086:                }
1.1       bertrand 4087:            }
                   4088: 
                   4089:            if (ios == -1)
                   4090:            {
                   4091:                (*s_etat_processus).erreur_systeme = d_es_processus;
                   4092:                return;
                   4093:            }
                   4094: 
                   4095:            if (close(pipes_sortie[0]) != 0)
                   4096:            {
                   4097:                (*s_etat_processus).erreur_systeme = d_es_processus;
                   4098:                return;
                   4099:            }
                   4100: 
                   4101:            /*
                   4102:             * Transformation de la chaîne en liste
                   4103:             */
                   4104: 
1.50      bertrand 4105:            longueur_tampon = strlen(tampon);
1.1       bertrand 4106: 
                   4107:            for(i = 0, ptr = tampon, nombre_lignes = 0;
                   4108:                    i < (long) longueur_tampon; i++, ptr++)
                   4109:            {
                   4110:                if ((*ptr) == d_code_retour_chariot)
                   4111:                {
                   4112:                    nombre_lignes++;
                   4113:                    (*ptr) = d_code_fin_chaine;
                   4114:                }
                   4115:            }
                   4116: 
                   4117:            if ((s_objet_resultat = allocation(s_etat_processus, LST))
                   4118:                    == NULL)
                   4119:            {
                   4120:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   4121:                return;
                   4122:            }
                   4123: 
                   4124:            if (nombre_lignes == 0)
                   4125:            {
                   4126:                (*s_objet_resultat).objet = NULL;
                   4127:            }
                   4128:            else
                   4129:            {
                   4130:                if (((*s_objet_resultat).objet =
                   4131:                        allocation_maillon(s_etat_processus)) == NULL)
                   4132:                {
                   4133:                    (*s_etat_processus).erreur_systeme =
                   4134:                            d_es_allocation_memoire;
                   4135:                    return;
                   4136:                }
                   4137: 
                   4138:                l_element_precedent = NULL;
                   4139:                l_element_courant = (struct_liste_chainee *)
                   4140:                        (*s_objet_resultat).objet;
                   4141: 
                   4142:                for(i = 0, ptr = tampon; i < (long) nombre_lignes; i++)
                   4143:                {
                   4144:                    if (((*l_element_courant).donnee =
                   4145:                            allocation(s_etat_processus, CHN)) == NULL)
                   4146:                    {
                   4147:                        (*s_etat_processus).erreur_systeme =
                   4148:                                d_es_allocation_memoire;
                   4149:                        return;
                   4150:                    }
                   4151: 
                   4152:                    if (((*(*l_element_courant).donnee).objet =
1.50      bertrand 4153:                            analyse_flux(s_etat_processus, ptr,
1.51      bertrand 4154:                            strlen(ptr))) == NULL)
1.1       bertrand 4155:                    {
                   4156:                        (*s_etat_processus).erreur_systeme =
                   4157:                                d_es_allocation_memoire;
                   4158:                        return;
                   4159:                    }
                   4160: 
                   4161:                    while((*ptr) != d_code_fin_chaine)
                   4162:                    {
                   4163:                        ptr++;
                   4164:                    }
                   4165: 
                   4166:                    ptr++;
                   4167: 
                   4168:                    if (((*l_element_courant).suivant =
                   4169:                            allocation_maillon(s_etat_processus)) == NULL)
                   4170:                    {
                   4171:                        (*s_etat_processus).erreur_systeme =
                   4172:                                d_es_allocation_memoire;
                   4173:                        return;
                   4174:                    }
                   4175: 
                   4176:                    l_element_precedent = l_element_courant;
                   4177:                    l_element_courant = (*l_element_courant).suivant;
                   4178:                }
                   4179: 
                   4180:                free(l_element_courant);
                   4181: 
                   4182:                if (l_element_precedent != NULL)
                   4183:                {
                   4184:                    (*l_element_precedent).suivant = NULL;
                   4185:                }
                   4186:            }
                   4187: 
                   4188:            free(tampon);
                   4189:        }
                   4190: 
                   4191:        if (sigaction(SIGINT, &action_passee, NULL) != 0)
                   4192:        {
                   4193:            for(i = 0; i < nombre_arguments; i++)
                   4194:            {
                   4195:                depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   4196:                        &s_objet_temporaire);
                   4197:                liberation(s_etat_processus, s_objet_temporaire);
                   4198:            }
                   4199: 
                   4200:            free(arguments);
                   4201:            (*s_etat_processus).erreur_systeme = d_es_signal;
                   4202:            return;
                   4203:        }
                   4204: 
                   4205:        for(i = 0; i < nombre_arguments; i++)
                   4206:        {
                   4207:            depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   4208:                    &s_objet_temporaire);
                   4209:            liberation(s_etat_processus, s_objet_temporaire);
                   4210:        }
                   4211: 
                   4212:        if ((tampon = malloc(sizeof(unsigned char))) == NULL)
                   4213:        {
                   4214:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   4215:            return;
                   4216:        }
                   4217:  
1.41      bertrand 4218: #      ifndef SEMAPHORES_NOMMES
                   4219:            if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)
                   4220: #      else
                   4221:            if (sem_post((*s_etat_processus).semaphore_fork) != 0)
                   4222: #      endif
1.1       bertrand 4223:        {
                   4224:            (*s_etat_processus).erreur_systeme = d_es_processus;
                   4225:            return;
                   4226:        }
                   4227: 
                   4228:        if (read_atomic(s_etat_processus, pipes_erreur[0], tampon, 1) > 0)
                   4229:        {
                   4230:            // Le processus fils renvoie une erreur.
                   4231: 
                   4232:            (*s_etat_processus).erreur_execution = d_ex_erreur_processus;
                   4233:            liberation(s_etat_processus, s_objet_resultat);
                   4234:        }
                   4235:        else if (empilement(s_etat_processus,
                   4236:                &((*s_etat_processus).l_base_pile), s_objet_resultat)
                   4237:                == d_erreur)
                   4238:        {
1.41      bertrand 4239: #          ifndef SEMAPHORES_NOMMES
                   4240:                while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0)
                   4241: #          else
                   4242:                while(sem_wait((*s_etat_processus).semaphore_fork) != 0)
                   4243: #          endif
1.1       bertrand 4244:            {
1.40      bertrand 4245:                if (errno != EINTR)
                   4246:                {
                   4247:                    (*s_etat_processus).erreur_systeme = d_es_processus;
                   4248:                    return;
                   4249:                }
1.1       bertrand 4250:            }
                   4251: 
                   4252:            if (close(pipes_erreur[0]) != 0)
                   4253:            {
                   4254:                (*s_etat_processus).erreur_systeme = d_es_processus;
                   4255:                return;
                   4256:            }
                   4257: 
                   4258:            free(tampon);
                   4259:            return;
                   4260:        }
                   4261: 
1.41      bertrand 4262: #      ifndef SEMAPHORES_NOMMES
                   4263:            while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0)
                   4264: #      else
                   4265:            while(sem_wait((*s_etat_processus).semaphore_fork) != 0)
                   4266: #      endif
1.1       bertrand 4267:        {
1.40      bertrand 4268:            if (errno != EINTR)
                   4269:            {
                   4270:                (*s_etat_processus).erreur_systeme = d_es_processus;
                   4271:                return;
                   4272:            }
1.1       bertrand 4273:        }
                   4274: 
                   4275:        if (close(pipes_erreur[0]) != 0)
                   4276:        {
                   4277:            (*s_etat_processus).erreur_systeme = d_es_processus;
                   4278:            return;
                   4279:        }
                   4280: 
                   4281:        free(arguments);
                   4282:        free(tampon);
                   4283:    }
                   4284:    else
                   4285:    {
                   4286:        if (presence_stdin == d_vrai)
                   4287:        {
                   4288:            s_objet = s_objet_composite;
                   4289:        }
                   4290: 
                   4291:        liberation(s_etat_processus, s_objet);
                   4292: 
                   4293:        (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
                   4294:        return;
                   4295:    }
                   4296: 
                   4297:    if (presence_stdin == d_vrai)
                   4298:    {
                   4299:        s_objet = s_objet_composite;
                   4300:    }
                   4301: 
                   4302:    liberation(s_etat_processus, s_objet);
                   4303: 
                   4304:    return;
                   4305: }
                   4306: 
                   4307: 
                   4308: /*
                   4309: ================================================================================
                   4310:   Fonction 'sign'
                   4311: ================================================================================
                   4312:   Entrées :
                   4313: --------------------------------------------------------------------------------
                   4314:   Sorties :
                   4315: --------------------------------------------------------------------------------
                   4316:   Effets de bord : néant
                   4317: ================================================================================
                   4318: */
                   4319: 
                   4320: void
                   4321: instruction_sign(struct_processus *s_etat_processus)
                   4322: {
                   4323:    real8                               norme;
                   4324: 
                   4325:    struct_liste_chainee                *l_element_courant;
                   4326:    struct_liste_chainee                *l_element_precedent;
                   4327: 
                   4328:    struct_objet                        *s_copie_argument;
                   4329:    struct_objet                        *s_objet_argument;
                   4330:    struct_objet                        *s_objet_resultat;
                   4331: 
                   4332:    (*s_etat_processus).erreur_execution = d_ex;
                   4333: 
                   4334:    if ((*s_etat_processus).affichage_arguments == 'Y')
                   4335:    {
                   4336:        printf("\n  SIGN ");
                   4337: 
                   4338:        if ((*s_etat_processus).langue == 'F')
                   4339:        {
                   4340:            printf("(signe)\n\n");
                   4341:        }
                   4342:        else
                   4343:        {
                   4344:            printf("(sign)\n\n");
                   4345:        }
                   4346: 
                   4347:        printf("    1: %s, %s\n", d_INT, d_REL);
                   4348:        printf("->  1: %s\n\n", d_INT);
                   4349: 
                   4350:        printf("    1: %s\n", d_CPL);
                   4351:        printf("->  1: %s\n\n", d_CPL);
                   4352: 
                   4353:        printf("    1: %s, %s\n", d_NOM, d_ALG);
                   4354:        printf("->  1: %s\n\n", d_ALG);
                   4355: 
                   4356:        printf("    1: %s\n", d_RPN);
                   4357:        printf("->  1: %s\n", d_RPN);
                   4358: 
                   4359:        return;
                   4360:    }
                   4361:    else if ((*s_etat_processus).test_instruction == 'Y')
                   4362:    {
                   4363:        (*s_etat_processus).nombre_arguments = 1;
                   4364:        return;
                   4365:    }
                   4366:    
                   4367:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                   4368:    {
                   4369:        if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
                   4370:        {
                   4371:            return;
                   4372:        }
                   4373:    }
                   4374: 
                   4375:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   4376:            &s_objet_argument) == d_erreur)
                   4377:    {
                   4378:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                   4379:        return;
                   4380:    }
                   4381: 
                   4382: /*
                   4383: --------------------------------------------------------------------------------
                   4384:   Signe d'un entier
                   4385: --------------------------------------------------------------------------------
                   4386: */
                   4387: 
                   4388:    if ((*s_objet_argument).type == INT)
                   4389:    {
                   4390:        if ((s_objet_resultat = allocation(s_etat_processus, INT)) == NULL)
                   4391:        {
                   4392:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   4393:            return;
                   4394:        }
                   4395: 
                   4396:        if ((*((integer8 *) (*s_objet_argument).objet)) > 0)
                   4397:        {
                   4398:            (*((integer8 *) (*s_objet_resultat).objet)) = 1;
                   4399:        }
                   4400:        else if ((*((integer8 *) (*s_objet_argument).objet)) < 0)
                   4401:        {
                   4402:            (*((integer8 *) (*s_objet_resultat).objet)) = -1;
                   4403:        }
                   4404:        else
                   4405:        {
                   4406:            (*((integer8 *) (*s_objet_resultat).objet)) = 0;
                   4407:        }
                   4408:    }
                   4409: 
                   4410: /*
                   4411: --------------------------------------------------------------------------------
                   4412:   Signe d'un réel
                   4413: --------------------------------------------------------------------------------
                   4414: */
                   4415: 
                   4416:    else if ((*s_objet_argument).type == REL)
                   4417:    {
                   4418:        if ((s_objet_resultat = allocation(s_etat_processus, INT)) == NULL)
                   4419:        {
                   4420:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   4421:            return;
                   4422:        }
                   4423: 
                   4424:        if ((*((real8 *) (*s_objet_argument).objet)) > 0)
                   4425:        {
                   4426:            (*((integer8 *) (*s_objet_resultat).objet)) = 1;
                   4427:        }
                   4428:        else if ((*((real8 *) (*s_objet_argument).objet)) < 0)
                   4429:        {
                   4430:            (*((integer8 *) (*s_objet_resultat).objet)) = -1;
                   4431:        }
                   4432:        else
                   4433:        {
                   4434:            (*((integer8 *) (*s_objet_resultat).objet)) = 0;
                   4435:        }
                   4436:    }
                   4437: 
                   4438: /*
                   4439: --------------------------------------------------------------------------------
                   4440:   Vecteur unité dans la direction du complexe
                   4441: --------------------------------------------------------------------------------
                   4442: */
                   4443: 
                   4444:    else if ((*s_objet_argument).type == CPL)
                   4445:    {
                   4446:        if ((s_objet_resultat = allocation(s_etat_processus, CPL)) == NULL)
                   4447:        {
                   4448:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   4449:            return;
                   4450:        }
                   4451: 
1.4       bertrand 4452:        if (((*((struct_complexe16 *) (*s_objet_argument).objet)).partie_reelle
                   4453:                != 0) || ((*((struct_complexe16 *) (*s_objet_argument).objet))
                   4454:                .partie_imaginaire != 0))
                   4455:        {
                   4456:            f77absc_((struct_complexe16 *) (*s_objet_argument).objet, &norme);
                   4457:            f77divisioncr_((struct_complexe16 *) (*s_objet_argument).objet,
                   4458:                    &norme, (struct_complexe16 *) (*s_objet_resultat).objet);
                   4459:        }
                   4460:        else
                   4461:        {
                   4462:            (*((struct_complexe16 *) (*s_objet_argument).objet))
                   4463:                    .partie_reelle = 0;
                   4464:            (*((struct_complexe16 *) (*s_objet_argument).objet))
                   4465:                    .partie_imaginaire = 0;
                   4466:        }
1.1       bertrand 4467:    }
                   4468: 
                   4469: /*
                   4470: --------------------------------------------------------------------------------
                   4471:   Signe d'un nom
                   4472: --------------------------------------------------------------------------------
                   4473: */
                   4474: 
                   4475:    else if ((*s_objet_argument).type == NOM)
                   4476:    {
                   4477:        if ((s_objet_resultat = allocation(s_etat_processus, ALG)) == NULL)
                   4478:        {
                   4479:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   4480:            return;
                   4481:        }
                   4482: 
                   4483:        if (((*s_objet_resultat).objet =
                   4484:                allocation_maillon(s_etat_processus)) == NULL)
                   4485:        {
                   4486:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   4487:            return;
                   4488:        }
                   4489: 
                   4490:        l_element_courant = (*s_objet_resultat).objet;
                   4491: 
                   4492:        if (((*l_element_courant).donnee = allocation(s_etat_processus, FCT))
                   4493:                == NULL)
                   4494:        {
                   4495:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   4496:            return;
                   4497:        }
                   4498: 
                   4499:        (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   4500:                .nombre_arguments = 0;
                   4501:        (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   4502:                .fonction = instruction_vers_niveau_superieur;
                   4503: 
                   4504:        if (((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   4505:                .nom_fonction = malloc(3 * sizeof(unsigned char))) == NULL)
                   4506:        {
                   4507:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   4508:            return;
                   4509:        }
                   4510: 
                   4511:        strcpy((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   4512:                .nom_fonction, "<<");
                   4513: 
                   4514:        if (((*l_element_courant).suivant =
                   4515:                allocation_maillon(s_etat_processus)) == NULL)
                   4516:        {
                   4517:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   4518:            return;
                   4519:        }
                   4520: 
                   4521:        l_element_courant = (*l_element_courant).suivant;
                   4522:        (*l_element_courant).donnee = s_objet_argument;
                   4523: 
                   4524:        if (((*l_element_courant).suivant =
                   4525:                allocation_maillon(s_etat_processus)) == NULL)
                   4526:        {
                   4527:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   4528:            return;
                   4529:        }
                   4530: 
                   4531:        l_element_courant = (*l_element_courant).suivant;
                   4532: 
                   4533:        if (((*l_element_courant).donnee = allocation(s_etat_processus, FCT))
                   4534:                == NULL)
                   4535:        {
                   4536:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   4537:            return;
                   4538:        }
                   4539: 
                   4540:        (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   4541:                .nombre_arguments = 1;
                   4542:        (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   4543:                .fonction = instruction_sign;
                   4544: 
                   4545:        if (((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   4546:                .nom_fonction = malloc(5 * sizeof(unsigned char))) == NULL)
                   4547:        {
                   4548:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   4549:            return;
                   4550:        }
                   4551: 
                   4552:        strcpy((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   4553:                .nom_fonction, "SIGN");
                   4554: 
                   4555:        if (((*l_element_courant).suivant =
                   4556:                allocation_maillon(s_etat_processus)) == NULL)
                   4557:        {
                   4558:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   4559:            return;
                   4560:        }
                   4561: 
                   4562:        l_element_courant = (*l_element_courant).suivant;
                   4563: 
                   4564:        if (((*l_element_courant).donnee = allocation(s_etat_processus, FCT))
                   4565:                == NULL)
                   4566:        {
                   4567:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   4568:            return;
                   4569:        }
                   4570: 
                   4571:        (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   4572:                .nombre_arguments = 0;
                   4573:        (*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   4574:                .fonction = instruction_vers_niveau_inferieur;
                   4575: 
                   4576:        if (((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   4577:                .nom_fonction = malloc(3 * sizeof(unsigned char))) == NULL)
                   4578:        {
                   4579:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   4580:            return;
                   4581:        }
                   4582: 
                   4583:        strcpy((*((struct_fonction *) (*(*l_element_courant).donnee).objet))
                   4584:                .nom_fonction, ">>");
                   4585: 
                   4586:        (*l_element_courant).suivant = NULL;
                   4587:        s_objet_argument = NULL;
                   4588:    }
                   4589: 
                   4590: /*
                   4591: --------------------------------------------------------------------------------
                   4592:   Signe d'une expression
                   4593: --------------------------------------------------------------------------------
                   4594: */
                   4595: 
                   4596:    else if (((*s_objet_argument).type == ALG) ||
                   4597:            ((*s_objet_argument).type == RPN))
                   4598:    {
                   4599:        if ((s_copie_argument = copie_objet(s_etat_processus, s_objet_argument,
                   4600:                'N')) == NULL)
                   4601:        {
                   4602:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   4603:            return;
                   4604:        }
                   4605: 
                   4606:        l_element_courant = (struct_liste_chainee *)
                   4607:                (*s_copie_argument).objet;
                   4608:        l_element_precedent = l_element_courant;
                   4609: 
                   4610:        while((*l_element_courant).suivant != NULL)
                   4611:        {
                   4612:            l_element_precedent = l_element_courant;
                   4613:            l_element_courant = (*l_element_courant).suivant;
                   4614:        }
                   4615: 
                   4616:        if (((*l_element_precedent).suivant =
                   4617:                allocation_maillon(s_etat_processus)) == NULL)
                   4618:        {
                   4619:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   4620:            return;
                   4621:        }
                   4622: 
                   4623:        if (((*(*l_element_precedent).suivant).donnee =
                   4624:                allocation(s_etat_processus, FCT)) == NULL)
                   4625:        {
                   4626:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   4627:            return;
                   4628:        }
                   4629: 
                   4630:        (*((struct_fonction *) (*(*(*l_element_precedent).suivant)
                   4631:                .donnee).objet)).nombre_arguments = 1;
                   4632:        (*((struct_fonction *) (*(*(*l_element_precedent).suivant)
                   4633:                .donnee).objet)).fonction = instruction_sign;
                   4634: 
                   4635:        if (((*((struct_fonction *) (*(*(*l_element_precedent)
                   4636:                .suivant).donnee).objet)).nom_fonction =
                   4637:                malloc(5 * sizeof(unsigned char))) == NULL)
                   4638:        {
                   4639:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   4640:            return;
                   4641:        }
                   4642: 
                   4643:        strcpy((*((struct_fonction *) (*(*(*l_element_precedent)
                   4644:                .suivant).donnee).objet)).nom_fonction, "SIGN");
                   4645: 
                   4646:        (*(*l_element_precedent).suivant).suivant = l_element_courant;
                   4647: 
                   4648:        s_objet_resultat = s_copie_argument;
                   4649:    }
                   4650: 
                   4651: /*
                   4652: --------------------------------------------------------------------------------
                   4653:   Fonction signe impossible à réaliser
                   4654: --------------------------------------------------------------------------------
                   4655: */
                   4656: 
                   4657:    else
                   4658:    {
                   4659:        liberation(s_etat_processus, s_objet_argument);
                   4660: 
                   4661:        (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
                   4662:        return;
                   4663:    }
                   4664: 
                   4665:    if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   4666:            s_objet_resultat) == d_erreur)
                   4667:    {
                   4668:        return;
                   4669:    }
                   4670: 
                   4671:    liberation(s_etat_processus, s_objet_argument);
                   4672: 
                   4673:    return;
                   4674: }
                   4675: 
                   4676: 
                   4677: /*
                   4678: ================================================================================
                   4679:   Fonction 'select'
                   4680: ================================================================================
                   4681:   Entrées : pointeur sur une struct_processus
                   4682: --------------------------------------------------------------------------------
                   4683:   Sorties :
                   4684: --------------------------------------------------------------------------------
                   4685:   Effets de bord : néant
                   4686: ================================================================================
                   4687: */
                   4688: 
                   4689: void
                   4690: instruction_select(struct_processus *s_etat_processus)
                   4691: {
                   4692:    (*s_etat_processus).erreur_execution = d_ex;
                   4693: 
                   4694:    if ((*s_etat_processus).affichage_arguments == 'Y')
                   4695:    {
                   4696:        printf("\n  SELECT ");
                   4697: 
                   4698:        if ((*s_etat_processus).langue == 'F')
                   4699:        {
                   4700:            printf("(structure de contrôle)\n\n");
                   4701:            printf("  Utilisation :\n\n");
                   4702:        }
                   4703:        else
                   4704:        {
                   4705:            printf("(control statement)\n\n");
                   4706:            printf("  Usage:\n\n");
                   4707:        }
                   4708: 
                   4709:        printf("    SELECT (expression test)\n");
                   4710:        printf("        CASE (clause 1) THEN (expression 1) END\n");
                   4711:        printf("        CASE (clause 2) THEN (expression 2) END\n");
                   4712:        printf("        ...\n");
                   4713:        printf("        CASE (clause n) THEN (expression n) END\n");
                   4714:        printf("    DEFAULT\n");
                   4715:        printf("        (expression)\n");
                   4716:        printf("    END\n\n");
                   4717: 
                   4718:        printf("    SELECT (expression test)\n");
                   4719:        printf("        CASE (clause 1) THEN (expression 1) END\n");
                   4720:        printf("        (expression)\n");
                   4721:        printf("        CASE (clause 2) THEN (expression 2) END\n");
                   4722:        printf("    END\n");
                   4723: 
                   4724:        return;
                   4725:    }
                   4726:    else if ((*s_etat_processus).test_instruction == 'Y')
                   4727:    {
                   4728:        (*s_etat_processus).nombre_arguments = -1;
                   4729:        return;
                   4730:    }
                   4731: 
                   4732:    empilement_pile_systeme(s_etat_processus);
                   4733: 
                   4734:    if ((*s_etat_processus).erreur_systeme != d_es)
                   4735:    {
                   4736:        return;
                   4737:    }
                   4738: 
                   4739:    (*(*s_etat_processus).l_base_pile_systeme).type_cloture = 'C';
                   4740:    (*(*s_etat_processus).l_base_pile_systeme).clause = 'S';
                   4741: 
                   4742:    return;
                   4743: }
                   4744: 
                   4745: 
                   4746: /*
                   4747: ================================================================================
                   4748:   Fonction 'std'
                   4749: ================================================================================
                   4750:   Entrées : pointeur sur une struct_processus
                   4751: --------------------------------------------------------------------------------
                   4752:   Sorties :
                   4753: --------------------------------------------------------------------------------
                   4754:   Effets de bord : néant
                   4755: ================================================================================
                   4756: */
                   4757: 
                   4758: void
                   4759: instruction_std(struct_processus *s_etat_processus)
                   4760: {
                   4761:    (*s_etat_processus).erreur_execution = d_ex;
                   4762: 
                   4763:    if ((*s_etat_processus).affichage_arguments == 'Y')
                   4764:    {
                   4765:        printf("\n  STD ");
                   4766: 
                   4767:        if ((*s_etat_processus).langue == 'F')
                   4768:        {
                   4769:            printf("(format standard)\n\n");
                   4770:            printf("  Aucun argument\n");
                   4771:        }
                   4772:        else
                   4773:        {
                   4774:            printf("(standard format)\n\n");
                   4775:            printf("  No argument\n");
                   4776:        }
                   4777: 
                   4778:        return;
                   4779:    }
                   4780:    else if ((*s_etat_processus).test_instruction == 'Y')
                   4781:    {
                   4782:        (*s_etat_processus).nombre_arguments = -1;
                   4783:        return;
                   4784:    }
                   4785: 
                   4786:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                   4787:    {
                   4788:        if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
                   4789:        {
                   4790:            return;
                   4791:        }
                   4792:    }
                   4793: 
                   4794:    cf(s_etat_processus, 49);
                   4795:    cf(s_etat_processus, 50);
                   4796: 
                   4797:    return;
                   4798: }
                   4799: 
                   4800: 
                   4801: /*
                   4802: ================================================================================
                   4803:   Fonction 'sci'
                   4804: ================================================================================
                   4805:   Entrées : pointeur sur une struct_processus
                   4806: --------------------------------------------------------------------------------
                   4807:   Sorties :
                   4808: --------------------------------------------------------------------------------
                   4809:   Effets de bord : néant
                   4810: ================================================================================
                   4811: */
                   4812: 
                   4813: void
                   4814: instruction_sci(struct_processus *s_etat_processus)
                   4815: {
                   4816:    struct_objet                        *s_objet_argument;
                   4817:    struct_objet                        *s_objet;
                   4818: 
                   4819:    logical1                            i43;
                   4820:    logical1                            i44;
                   4821: 
                   4822:    unsigned char                       *valeur_binaire;
                   4823: 
                   4824:    unsigned long                       i;
                   4825:    unsigned long                       j;
                   4826: 
                   4827:    (*s_etat_processus).erreur_execution = d_ex;
                   4828: 
                   4829:    if ((*s_etat_processus).affichage_arguments == 'Y')
                   4830:    {
                   4831:        printf("\n  SCI ");
                   4832: 
                   4833:        if ((*s_etat_processus).langue == 'F')
                   4834:        {
                   4835:            printf("(format scientifique)\n\n");
                   4836:        }
                   4837:        else
                   4838:        {
                   4839:            printf("(scientific format)\n\n");
                   4840:        }
                   4841: 
                   4842:        printf("    1: %s\n", d_INT);
                   4843: 
                   4844:        return;
                   4845:    }
                   4846:    else if ((*s_etat_processus).test_instruction == 'Y')
                   4847:    {
                   4848:        (*s_etat_processus).nombre_arguments = -1;
                   4849:        return;
                   4850:    }
                   4851: 
                   4852:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                   4853:    {
                   4854:        if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
                   4855:        {
                   4856:            return;
                   4857:        }
                   4858:    }
                   4859: 
                   4860:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   4861:            &s_objet_argument) == d_erreur)
                   4862:    {
                   4863:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                   4864:        return;
                   4865:    }
                   4866: 
                   4867:    if ((*s_objet_argument).type == INT)
                   4868:    {
                   4869:        if (((*((integer8 *) (*s_objet_argument).objet)) >= 0) &&
                   4870:                ((*((integer8 *) (*s_objet_argument).objet)) <= 15))
                   4871:        {
                   4872:            if ((s_objet = allocation(s_etat_processus, BIN)) == NULL)
                   4873:            {
                   4874:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   4875:                return;
                   4876:            }
                   4877: 
                   4878:            (*((logical8 *) (*s_objet).objet)) =
                   4879:                    (*((integer8 *) (*s_objet_argument).objet));
                   4880: 
                   4881:            i43 = test_cfsf(s_etat_processus, 43);
                   4882:            i44 = test_cfsf(s_etat_processus, 44);
                   4883: 
                   4884:            sf(s_etat_processus, 44);
                   4885:            cf(s_etat_processus, 43);
                   4886: 
                   4887:            if ((valeur_binaire = formateur(s_etat_processus, 0, s_objet))
                   4888:                    == NULL)
                   4889:            {
                   4890:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   4891:                return;
                   4892:            }
                   4893: 
                   4894:            if (i43 == d_vrai)
                   4895:            {
                   4896:                sf(s_etat_processus, 43);
                   4897:            }
                   4898:            else
                   4899:            {
                   4900:                cf(s_etat_processus, 43);
                   4901:            }
                   4902: 
                   4903:            if (i44 == d_vrai)
                   4904:            {
                   4905:                sf(s_etat_processus, 44);
                   4906:            }
                   4907:            else
                   4908:            {
                   4909:                cf(s_etat_processus, 44);
                   4910:            }
                   4911: 
                   4912:            for(j = 53, i = strlen(valeur_binaire) - 2; i >= 2; i--)
                   4913:            {
                   4914:                if (valeur_binaire[i] == '0')
                   4915:                {
                   4916:                    cf(s_etat_processus, j++);
                   4917:                }
                   4918:                else
                   4919:                {
                   4920:                    sf(s_etat_processus, j++);
                   4921:                }
                   4922:            }
                   4923: 
                   4924:            for(; j <= 56; cf(s_etat_processus, j++));
                   4925: 
                   4926:            cf(s_etat_processus, 49);
                   4927:            sf(s_etat_processus, 50);
                   4928: 
                   4929:            free(valeur_binaire);
                   4930:            liberation(s_etat_processus, s_objet);
                   4931:        }
                   4932:        else
                   4933:        {
                   4934:            liberation(s_etat_processus, s_objet_argument);
                   4935: 
                   4936:            (*s_etat_processus).erreur_execution = d_ex_argument_invalide;
                   4937:            return;
                   4938:        }
                   4939:    }
                   4940:    else
                   4941:    {
                   4942:        liberation(s_etat_processus, s_objet_argument);
                   4943: 
                   4944:        (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
                   4945:        return;
                   4946:    }
                   4947: 
                   4948:    liberation(s_etat_processus, s_objet_argument);
                   4949: 
                   4950:    return;
                   4951: }
                   4952: 
                   4953: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>