Annotation of rpl/src/instructions_e2.c, revision 1.30

1.1       bertrand    1: /*
                      2: ================================================================================
1.30    ! bertrand    3:   RPL/2 (R) version 4.1.3
1.17      bertrand    4:   Copyright (C) 1989-2011 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.13      bertrand   23: #include "rpl-conv.h"
1.1       bertrand   24: 
                     25: 
                     26: /*
                     27: ================================================================================
                     28:   Fonction 'egvl'
                     29: ================================================================================
                     30:   Entrées : pointeur sur une structure struct_processus
                     31: --------------------------------------------------------------------------------
                     32:   Sorties :
                     33: --------------------------------------------------------------------------------
                     34:   Effets de bord : néant
                     35: ================================================================================
                     36: */
                     37: 
                     38: void
                     39: instruction_egvl(struct_processus *s_etat_processus)
                     40: {
                     41:    struct_objet                *s_objet_argument;
                     42:    struct_objet                *s_objet_resultat;
                     43: 
                     44:    (*s_etat_processus).erreur_execution = d_ex;
                     45: 
                     46:    if ((*s_etat_processus).affichage_arguments == 'Y')
                     47:    {
                     48:        printf("\n  EGVL ");
                     49:        
                     50:        if ((*s_etat_processus).langue == 'F')
                     51:        {
                     52:            printf("(valeurs propres)\n\n");
                     53:        }
                     54:        else
                     55:        {
                     56:            printf("(eigenvalues)\n\n");
                     57:        }
                     58: 
                     59:        printf("    1: %s, %s, %s\n", d_MIN, d_MRL, d_MCX);
                     60:        printf("->  1: %s\n", d_VCX);
                     61: 
                     62:        return;
                     63:    }
                     64:    else if ((*s_etat_processus).test_instruction == 'Y')
                     65:    {
                     66:        (*s_etat_processus).nombre_arguments = -1;
                     67:        return;
                     68:    }
                     69: 
                     70:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                     71:    {
                     72:        if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
                     73:        {
                     74:            return;
                     75:        }
                     76:    }
                     77: 
                     78:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                     79:            &s_objet_argument) == d_erreur)
                     80:    {
                     81:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                     82:        return;
                     83:    }
                     84: 
                     85: /*
                     86: --------------------------------------------------------------------------------
                     87:   L'argument est une matrice carrée
                     88: --------------------------------------------------------------------------------
                     89: */
                     90: 
                     91:    if (((*s_objet_argument).type == MIN) ||
                     92:            ((*s_objet_argument).type == MRL) ||
                     93:            ((*s_objet_argument).type == MCX))
                     94:    {
                     95:        if ((*((struct_matrice *) (*s_objet_argument).objet)).nombre_lignes !=
                     96:                (*((struct_matrice *) (*s_objet_argument).objet))
                     97:                .nombre_colonnes)
                     98:        {
                     99:            liberation(s_etat_processus, s_objet_argument);
                    100: 
                    101:            (*s_etat_processus).erreur_execution = d_ex_dimensions_invalides;
                    102:            return;
                    103:        }
                    104: 
                    105:        if ((s_objet_resultat = allocation(s_etat_processus, VCX))
                    106:                == NULL)
                    107:        {
                    108:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    109:            return;
                    110:        }
                    111: 
                    112:        valeurs_propres(s_etat_processus,
                    113:                (struct_matrice *) (*s_objet_argument).objet,
                    114:                (struct_vecteur *) (*s_objet_resultat).objet,
                    115:                NULL, NULL);
                    116: 
                    117:        if ((*s_etat_processus).erreur_systeme != d_es)
                    118:        {
                    119:            return;
                    120:        }
                    121: 
                    122:        if (((*s_etat_processus).exception != d_ep) ||
                    123:                ((*s_etat_processus).erreur_execution != d_ex))
                    124:        {
                    125:            liberation(s_etat_processus, s_objet_argument);
                    126:            liberation(s_etat_processus, s_objet_resultat);
                    127:            return;
                    128:        }
                    129:    }
                    130: 
                    131: /*
                    132: --------------------------------------------------------------------------------
                    133:   Type incompatible
                    134: --------------------------------------------------------------------------------
                    135: */
                    136: 
                    137:    else
                    138:    {
                    139:        liberation(s_etat_processus, s_objet_argument);
                    140: 
                    141:        (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
                    142:        return;
                    143:    }
                    144: 
                    145:    liberation(s_etat_processus, s_objet_argument);
                    146: 
                    147:    if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    148:            s_objet_resultat) == d_erreur)
                    149:    {
                    150:        return;
                    151:    }
                    152: 
                    153:    return;
                    154: }
                    155: 
                    156: 
                    157: /*
                    158: ================================================================================
                    159:   Fonction 'egv'
                    160: ================================================================================
                    161:   Entrées : pointeur sur une structure struct_processus
                    162: --------------------------------------------------------------------------------
                    163:   Sorties :
                    164: --------------------------------------------------------------------------------
                    165:   Effets de bord : néant
                    166: ================================================================================
                    167: */
                    168: 
                    169: void
                    170: instruction_egv(struct_processus *s_etat_processus)
                    171: {
                    172:    struct_objet                *s_objet_argument;
                    173:    struct_objet                *s_objet_resultat_1;
                    174:    struct_objet                *s_objet_resultat_2;
                    175:    struct_objet                *s_objet_resultat_3;
                    176: 
                    177:    (*s_etat_processus).erreur_execution = d_ex;
                    178: 
                    179:    if ((*s_etat_processus).affichage_arguments == 'Y')
                    180:    {
                    181:        printf("\n  EGV ");
                    182:        
                    183:        if ((*s_etat_processus).langue == 'F')
                    184:        {
                    185:            printf("(valeurs et vecteurs propres)\n\n");
                    186:        }
                    187:        else
                    188:        {
                    189:            printf("(eigenvalues and eigenvectors)\n\n");
                    190:        }
                    191: 
                    192:        printf("    1: %s, %s, %s\n", d_MIN, d_MRL, d_MCX);
                    193:        printf("->  3: %s\n", d_MCX);
                    194:        printf("    2: %s\n", d_MCX);
                    195:        printf("    1: %s\n", d_VCX);
                    196: 
                    197:        return;
                    198:    }
                    199:    else if ((*s_etat_processus).test_instruction == 'Y')
                    200:    {
                    201:        (*s_etat_processus).nombre_arguments = -1;
                    202:        return;
                    203:    }
                    204: 
                    205:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                    206:    {
                    207:        if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
                    208:        {
                    209:            return;
                    210:        }
                    211:    }
                    212: 
                    213:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    214:            &s_objet_argument) == d_erreur)
                    215:    {
                    216:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                    217:        return;
                    218:    }
                    219: 
                    220: /*
                    221: --------------------------------------------------------------------------------
                    222:   L'argument est une matrice carrée
                    223: --------------------------------------------------------------------------------
                    224: */
                    225: 
                    226:    if (((*s_objet_argument).type == MIN) ||
                    227:            ((*s_objet_argument).type == MRL) ||
                    228:            ((*s_objet_argument).type == MCX))
                    229:    {
                    230:        if ((*((struct_matrice *) (*s_objet_argument).objet)).nombre_lignes !=
                    231:                (*((struct_matrice *) (*s_objet_argument).objet))
                    232:                .nombre_colonnes)
                    233:        {
                    234:            liberation(s_etat_processus, s_objet_argument);
                    235: 
                    236:            (*s_etat_processus).erreur_execution = d_ex_dimensions_invalides;
                    237:            return;
                    238:        }
                    239: 
                    240:        if ((s_objet_resultat_1 = allocation(s_etat_processus, VCX))
                    241:                == NULL)
                    242:        {
                    243:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    244:            return;
                    245:        }
                    246: 
                    247:        if ((s_objet_resultat_2 = allocation(s_etat_processus, MCX))
                    248:                == NULL)
                    249:        {
                    250:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    251:            return;
                    252:        }
                    253: 
                    254:        if ((s_objet_resultat_3 = allocation(s_etat_processus, MCX))
                    255:                == NULL)
                    256:        {
                    257:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    258:            return;
                    259:        }
                    260: 
                    261:        valeurs_propres(s_etat_processus,
                    262:                (struct_matrice *) (*s_objet_argument).objet,
                    263:                (struct_vecteur *) (*s_objet_resultat_1).objet,
                    264:                (struct_matrice *) (*s_objet_resultat_3).objet,
                    265:                (struct_matrice *) (*s_objet_resultat_2).objet);
                    266: 
                    267:        if ((*s_etat_processus).erreur_systeme != d_es)
                    268:        {
                    269:            return;
                    270:        }
                    271: 
                    272:        if (((*s_etat_processus).exception != d_ep) ||
                    273:                ((*s_etat_processus).erreur_execution != d_ex))
                    274:        {
                    275:            liberation(s_etat_processus, s_objet_argument);
                    276:            liberation(s_etat_processus, s_objet_resultat_1);
                    277:            liberation(s_etat_processus, s_objet_resultat_2);
                    278:            liberation(s_etat_processus, s_objet_resultat_3);
                    279:            return;
                    280:        }
                    281:    }
                    282: 
                    283: /*
                    284: --------------------------------------------------------------------------------
                    285:   Type incompatible
                    286: --------------------------------------------------------------------------------
                    287: */
                    288: 
                    289:    else
                    290:    {
                    291:        liberation(s_etat_processus, s_objet_argument);
                    292: 
                    293:        (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
                    294:        return;
                    295:    }
                    296: 
                    297:    liberation(s_etat_processus, s_objet_argument);
                    298: 
                    299:    if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    300:            s_objet_resultat_3) == d_erreur)
                    301:    {
                    302:        return;
                    303:    }
                    304: 
                    305:    if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    306:            s_objet_resultat_2) == d_erreur)
                    307:    {
                    308:        return;
                    309:    }
                    310: 
                    311:    if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    312:            s_objet_resultat_1) == d_erreur)
                    313:    {
                    314:        return;
                    315:    }
                    316: 
                    317:    return;
                    318: }
                    319: 
                    320: 
                    321: /*
                    322: ================================================================================
                    323:   Fonction 'erase' (detruit la queue d'impression)
                    324: ================================================================================
                    325:   Entrées : structure processus
                    326: --------------------------------------------------------------------------------
                    327:   Sorties :
                    328: --------------------------------------------------------------------------------
                    329:   Effets de bord : néant
                    330: ================================================================================
                    331: */
                    332: 
                    333: void
                    334: instruction_erase(struct_processus *s_etat_processus)
                    335: {
                    336:    (*s_etat_processus).erreur_execution = d_ex;
                    337: 
                    338:    if ((*s_etat_processus).affichage_arguments == 'Y')
                    339:    {
                    340:        printf("\n  ERASE ");
                    341: 
                    342:        if ((*s_etat_processus).langue == 'F')
                    343:        {
                    344:            printf("(efface la file d'impression)\n\n");
                    345:            printf("  Aucun argument\n");
                    346:        }
                    347:        else
                    348:        {
                    349:            printf("(erase the printer queue)\n\n");
                    350:            printf("  No argument\n");
                    351:        }
                    352: 
                    353:        return;
                    354:    }
                    355:    else if ((*s_etat_processus).test_instruction == 'Y')
                    356:    {
                    357:        (*s_etat_processus).nombre_arguments = -1;
                    358:        return;
                    359:    }
                    360: 
                    361:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                    362:    {
                    363:        if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
                    364:        {
                    365:            return;
                    366:        }
                    367:    }
                    368: 
                    369:    if ((*s_etat_processus).nom_fichier_impression != NULL)
                    370:    {
                    371:        if (destruction_fichier((*s_etat_processus).nom_fichier_impression)
                    372:                == d_erreur)
                    373:        {
                    374:            (*s_etat_processus).erreur_systeme = d_es_erreur_fichier;
                    375:            return;
                    376:        }
                    377: 
                    378:        free((*s_etat_processus).nom_fichier_impression);
                    379:        (*s_etat_processus).nom_fichier_impression = NULL;
                    380:    }
                    381: 
                    382:    return;
                    383: }
                    384: 
                    385: 
                    386: /*
                    387: ================================================================================
                    388:   Fonction 'epsilon' (renvoie la le plus petit réel e tel x + e != x)
                    389: ================================================================================
                    390:   Entrées : structure processus
                    391: --------------------------------------------------------------------------------
                    392:   Sorties :
                    393: --------------------------------------------------------------------------------
                    394:   Effets de bord : néant
                    395: ================================================================================
                    396: */
                    397: 
                    398: void
                    399: instruction_epsilon(struct_processus *s_etat_processus)
                    400: {
                    401:    struct_objet            *s_copie;
                    402:    struct_objet            *s_objet;
                    403: 
                    404:    (*s_etat_processus).erreur_execution = d_ex;
                    405: 
                    406:    if ((*s_etat_processus).affichage_arguments == 'Y')
                    407:    {
                    408:        printf("\n  EPSILON ");
                    409:        
                    410:        if ((*s_etat_processus).langue == 'F')
                    411:        {
                    412:            printf("(epsilon machine)\n\n");
                    413:        }
                    414:        else
                    415:        {
                    416:            printf("(computer epsilon)\n\n");
                    417:        }
                    418: 
                    419:        printf("    1: %s\n", d_INT);
                    420:        printf("->  1: %s\n\n", d_INT);
                    421: 
                    422:        printf("    1: %s\n", d_CPL);
                    423:        printf("->  1: %s\n\n", d_CPL);
                    424: 
                    425:        printf("    1: %s\n", d_REL);
                    426:        printf("->  1: %s\n", d_REL);
                    427: 
                    428:        return;
                    429:    }
                    430:    else if ((*s_etat_processus).test_instruction == 'Y')
                    431:    {
                    432:        (*s_etat_processus).nombre_arguments = 1;
                    433:        return;
                    434:    }
                    435: 
                    436:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                    437:    {
                    438:        if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
                    439:        {
                    440:            return;
                    441:        }
                    442:    }
                    443: 
                    444:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    445:            &s_objet) == d_erreur)
                    446:    {
                    447:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                    448:        return;
                    449:    }
                    450: 
                    451:    if ((s_copie = copie_objet(s_etat_processus, s_objet, 'O')) == NULL)
                    452:    {
                    453:        (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    454:        return;
                    455:    }
                    456: 
                    457:    liberation(s_etat_processus, s_objet);
                    458:    s_objet = s_copie;
                    459: 
                    460:    /*
                    461:     * L'argument est un entier et la routine renvoie 1.
                    462:     */
                    463: 
                    464:    if ((*s_objet).type == INT)
                    465:    {
                    466:        (*((integer8 *) (*s_objet).objet)) = 1;
                    467:    }
                    468: 
                    469:    /*
                    470:     * L'argument est un réel
                    471:     */
                    472: 
                    473:    else if ((*s_objet).type == REL)
                    474:    {
                    475:        if ((*((real8 *) (*s_objet).objet)) == 0)
                    476:        {
                    477:            (*((real8 *) (*s_objet).objet)) = nextafter((double) 0, (double) 1);
                    478:        }
                    479:        else
                    480:        {
                    481:            (*((real8 *) (*s_objet).objet)) = nextafter(-abs(*((real8 *)
                    482:                    (*s_objet).objet)), 0) + abs(*((real8 *) (*s_objet).objet));
                    483:        }
                    484:    }
                    485: 
                    486:    /*
                    487:     * L'argument est un complexe
                    488:     */
                    489: 
                    490:    else if ((*s_objet).type == CPL)
                    491:    {
                    492:        (*((complex16 *) (*s_objet).objet)).partie_reelle =
                    493:                nextafter(-abs((*((complex16 *) (*s_objet).objet))
                    494:                .partie_reelle), 0) + abs((*((complex16 *) (*s_objet).objet))
                    495:                .partie_reelle);
                    496:        (*((complex16 *) (*s_objet).objet)).partie_imaginaire =
                    497:                nextafter(-abs((*((complex16 *) (*s_objet).objet))
                    498:                .partie_imaginaire), 0) + abs((*((complex16 *)
                    499:                (*s_objet).objet)).partie_imaginaire);
                    500:    }
                    501:    else
                    502:    {
                    503:        liberation(s_etat_processus, s_objet);
                    504: 
                    505:        (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
                    506:        return;
                    507:    }
                    508: 
                    509:    if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    510:            s_objet) == d_erreur)
                    511:    {
                    512:        return;
                    513:    }
                    514: 
                    515:    return;
                    516: }
                    517: 
                    518: 
                    519: /*
                    520: ================================================================================
                    521:   Fonction 'errn' (detruit la queue d'impression)
                    522: ================================================================================
                    523:   Entrées : structure processus
                    524: --------------------------------------------------------------------------------
                    525:   Sorties :
                    526: --------------------------------------------------------------------------------
                    527:   Effets de bord : néant
                    528: ================================================================================
                    529: */
                    530: 
                    531: void
                    532: instruction_errn(struct_processus *s_etat_processus)
                    533: {
                    534:    struct_objet            *s_objet_resultat;
                    535: 
                    536:    (*s_etat_processus).erreur_execution = d_ex;
                    537: 
                    538:    if ((*s_etat_processus).affichage_arguments == 'Y')
                    539:    {
                    540:        printf("\n  ERRN ");
                    541:        
                    542:        if ((*s_etat_processus).langue == 'F')
                    543:        {
                    544:            printf("(numéro de la dernière erreur)\n\n");
                    545:        }
                    546:        else
                    547:        {
                    548:            printf("(last error number)\n\n");
                    549:        }
                    550: 
                    551:        printf("->  1: %s\n", d_INT);
                    552: 
                    553:        return;
                    554:    }
                    555:    else if ((*s_etat_processus).test_instruction == 'Y')
                    556:    {
                    557:        (*s_etat_processus).nombre_arguments = -1;
                    558:        return;
                    559:    }
                    560: 
                    561:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                    562:    {
                    563:        if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
                    564:        {
                    565:            return;
                    566:        }
                    567:    }
                    568: 
                    569:    if ((s_objet_resultat = allocation(s_etat_processus, INT)) == NULL)
                    570:    {
                    571:        (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    572:        return;
                    573:    }
                    574: 
                    575:    if ((*s_etat_processus).derniere_exception != d_ep)
                    576:    {
                    577:        (*((integer8 *) (*s_objet_resultat).objet)) =
                    578:                1000 + ((*s_etat_processus).derniere_exception - d_ep);
                    579:    }
                    580:    else if ((*s_etat_processus).derniere_erreur_execution != d_ex)
                    581:    {
                    582:        (*((integer8 *) (*s_objet_resultat).objet)) =
                    583:                0 + ((*s_etat_processus).derniere_erreur_execution - d_ex);
                    584:    }
                    585:    else if ((*s_etat_processus).derniere_erreur_systeme != d_es)
                    586:    {
                    587:        /*
                    588:         * On ne doit jamais passer par ici !
                    589:         */
                    590: 
                    591:        (*((integer8 *) (*s_objet_resultat).objet)) =
                    592:                2000 + ((*s_etat_processus).derniere_erreur_systeme - d_es);
                    593:    }
                    594:    else
                    595:    {
                    596:        (*((integer8 *) (*s_objet_resultat).objet)) = 0;
                    597:    }
                    598:        
                    599:    if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    600:            s_objet_resultat) == d_erreur)
                    601:    {
                    602:        return;
                    603:    }
                    604: 
                    605:    return;
                    606: }
                    607: 
                    608: 
                    609: /*
                    610: ================================================================================
                    611:   Fonction 'errm'
                    612: ================================================================================
                    613:   Entrées : structure processus
                    614: --------------------------------------------------------------------------------
                    615:   Sorties :
                    616: --------------------------------------------------------------------------------
                    617:   Effets de bord : néant
                    618: ================================================================================
                    619: */
                    620: 
                    621: void
                    622: instruction_errm(struct_processus *s_etat_processus)
                    623: {
                    624:    struct_objet            *s_objet_resultat;
                    625: 
                    626:    unsigned int            registre_erreur_execution;
                    627:    unsigned int            registre_erreur_systeme;
                    628:    unsigned int            registre_exception;
                    629: 
                    630:    (*s_etat_processus).erreur_execution = d_ex;
                    631: 
                    632:    if ((*s_etat_processus).affichage_arguments == 'Y')
                    633:    {
                    634:        printf("\n  ERRM ");
                    635:        
                    636:        if ((*s_etat_processus).langue == 'F')
                    637:        {
                    638:            printf("(dernier message d'erreur)\n\n");
                    639:        }
                    640:        else
                    641:        {
                    642:            printf("(last error message)\n\n");
                    643:        }
                    644: 
                    645:        printf("->  1: %s\n", d_CHN);
                    646: 
                    647:        return;
                    648:    }
                    649:    else if ((*s_etat_processus).test_instruction == 'Y')
                    650:    {
                    651:        (*s_etat_processus).nombre_arguments = -1;
                    652:        return;
                    653:    }
                    654: 
                    655:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                    656:    {
                    657:        if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
                    658:        {
                    659:            return;
                    660:        }
                    661:    }
                    662: 
                    663:    if ((s_objet_resultat = allocation(s_etat_processus, CHN)) == NULL)
                    664:    {
                    665:        (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    666:        return;
                    667:    }
                    668: 
                    669:    registre_exception = (*s_etat_processus).exception;
                    670:    registre_erreur_execution = (*s_etat_processus).erreur_execution;
                    671:    registre_erreur_systeme = (*s_etat_processus).erreur_systeme;
                    672: 
                    673:    (*s_etat_processus).exception =
                    674:            (*s_etat_processus).derniere_exception;
                    675:    (*s_etat_processus).erreur_execution =
                    676:            (*s_etat_processus).derniere_erreur_execution;
                    677:    (*s_etat_processus).erreur_systeme =
                    678:            (*s_etat_processus).derniere_erreur_systeme;
                    679: 
                    680:    if (((*s_objet_resultat).objet =
                    681:            messages(s_etat_processus)) == NULL)
                    682:    {
                    683:        (*s_etat_processus).exception =
                    684:                registre_exception;
                    685:        (*s_etat_processus).erreur_execution =
                    686:                registre_erreur_execution;
                    687:        (*s_etat_processus).erreur_systeme =
                    688:                registre_erreur_systeme;
                    689: 
                    690:        (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    691:        return;
                    692:    }
                    693: 
                    694:    (*s_etat_processus).exception = registre_exception;
                    695:    (*s_etat_processus).erreur_execution = registre_erreur_execution;
                    696:    (*s_etat_processus).erreur_systeme = registre_erreur_systeme;
                    697: 
                    698:    if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    699:            s_objet_resultat) == d_erreur)
                    700:    {
                    701:        return;
                    702:    }
                    703: 
                    704:    return;
                    705: }
                    706: 
                    707: 
                    708: /*
                    709: ================================================================================
                    710:   Fonction 'edit'
                    711: ================================================================================
                    712:   Entrées : structure processus
                    713: --------------------------------------------------------------------------------
                    714:   Sorties :
                    715: --------------------------------------------------------------------------------
                    716:   Effets de bord : néant
                    717: ================================================================================
                    718: */
                    719: 
                    720: void
                    721: instruction_edit(struct_processus *s_etat_processus)
                    722: {
                    723: #  ifdef VIM_SUPPORT
1.13      bertrand  724: #  include "vim-conv.h"
1.1       bertrand  725: 
                    726:    file                    *fichier;
                    727: 
                    728:    logical1                drapeau49;
                    729:    logical1                drapeau50;
                    730: 
                    731:    struct_liste_chainee    *registre_pile_last;
                    732: 
                    733:    struct_objet            *s_copie;
                    734:    struct_objet            *s_objet;
                    735:    struct_objet            *s_objet_nom;
                    736: 
                    737:    unsigned char           *chaine;
                    738:    unsigned char           *commande;
                    739:    unsigned char           *nom_fichier;
1.3       bertrand  740:    unsigned char           registre;
1.1       bertrand  741: 
                    742:    (*s_etat_processus).erreur_execution = d_ex;
                    743: 
                    744:    if ((*s_etat_processus).affichage_arguments == 'Y')
                    745:    {
                    746:        printf("\n  EDIT ");
                    747: 
                    748:        if ((*s_etat_processus).langue == 'F')
                    749:        {
                    750:            printf("(édition d'un objet)\n\n");
                    751:        }
                    752:        else
                    753:        {
                    754:            printf("(edit object)\n\n");
                    755:        }
                    756: 
                    757:        printf("    1: %s, %s, %s, %s, %s, %s,\n"
                    758:                "       %s, %s, %s, %s, %s,\n"
                    759:                "       %s, %s, %s, %s, %s\n",
                    760:                d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX,
                    761:                d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN);
                    762:        printf("->  n: %s, %s, %s, %s, %s, %s,\n"
                    763:                "       %s, %s, %s, %s, %s,\n"
                    764:                "       %s, %s, %s, %s, %s\n",
                    765:                d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX,
                    766:                d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN);
                    767:        printf("    ...\n");
                    768:        printf("    1: %s, %s, %s, %s, %s, %s,\n"
                    769:                "       %s, %s, %s, %s, %s,\n"
                    770:                "       %s, %s, %s, %s, %s\n",
                    771:                d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX,
                    772:                d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN);
                    773:        return;
                    774:    }
                    775:    else if ((*s_etat_processus).test_instruction == 'Y')
                    776:    {
                    777:        (*s_etat_processus).nombre_arguments = -1;
                    778:        return;
                    779:    }
                    780: 
                    781:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                    782:    {
                    783:        if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
                    784:        {
                    785:            return;
                    786:        }
                    787:    }
                    788: 
                    789:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    790:            &s_objet) == d_erreur)
                    791:    {
                    792:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                    793:        return;
                    794:    }
                    795: 
                    796:    if (((*s_objet).type != INT) &&
                    797:            ((*s_objet).type != REL) &&
                    798:            ((*s_objet).type != CPL) &&
                    799:            ((*s_objet).type != VIN) &&
                    800:            ((*s_objet).type != VRL) &&
                    801:            ((*s_objet).type != VCX) &&
                    802:            ((*s_objet).type != MIN) &&
                    803:            ((*s_objet).type != MRL) &&
                    804:            ((*s_objet).type != MCX) &&
                    805:            ((*s_objet).type != TBL) &&
                    806:            ((*s_objet).type != BIN) &&
                    807:            ((*s_objet).type != NOM) &&
                    808:            ((*s_objet).type != CHN) &&
                    809:            ((*s_objet).type != LST) &&
                    810:            ((*s_objet).type != ALG) &&
                    811:            ((*s_objet).type != RPN))
                    812:    {
                    813:        liberation(s_etat_processus, s_objet);
                    814: 
                    815:        (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
                    816:        return;
                    817:    }
                    818: 
                    819:    if ((s_copie = copie_objet(s_etat_processus, s_objet, 'O')) == NULL)
                    820:    {
                    821:        (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    822:        return;
                    823:    }
                    824: 
                    825:    liberation(s_etat_processus, s_objet);
                    826:    s_objet = s_copie;
                    827: 
                    828:    // Création d'un fichier temporaire à éditer
                    829: 
                    830:    if ((nom_fichier = creation_nom_fichier(s_etat_processus,
                    831:            (*s_etat_processus).chemin_fichiers_temporaires)) == NULL)
                    832:    {
                    833:        (*s_etat_processus).erreur_systeme = d_es_erreur_fichier;
                    834:        return;
                    835:    }
                    836: 
                    837:    drapeau49 = test_cfsf(s_etat_processus, 49);
                    838:    drapeau50 = test_cfsf(s_etat_processus, 50);
                    839: 
                    840:    cf(s_etat_processus, 49);
                    841:    cf(s_etat_processus, 50);
                    842: 
                    843:    // Ecriture de l'objet dans le fichier en mode STD et multiligne
                    844: 
                    845:    if ((fichier = fopen(nom_fichier, "w+")) == NULL)
                    846:    {
                    847:        (*s_etat_processus).erreur_systeme = d_es_erreur_fichier;
                    848:        return;
                    849:    }
                    850: 
1.3       bertrand  851:    registre = (*s_etat_processus).autorisation_conversion_chaine;
                    852:    (*s_etat_processus).autorisation_conversion_chaine = 'N';
                    853: 
1.1       bertrand  854:    if ((chaine = formateur(s_etat_processus, 0, s_objet)) == NULL)
                    855:    {
1.3       bertrand  856:        (*s_etat_processus).autorisation_conversion_chaine = registre;
                    857: 
1.1       bertrand  858:        (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    859:        return;
                    860:    }
                    861: 
1.3       bertrand  862:    (*s_etat_processus).autorisation_conversion_chaine = registre;
                    863: 
1.1       bertrand  864:    if ((*s_objet).type == CHN)
                    865:    {
                    866:        if (fprintf(fichier, "\"%s\"\n", chaine) != (int) (strlen(chaine) + 3))
                    867:        {
                    868:            (*s_etat_processus).erreur_systeme = d_es_erreur_fichier;
                    869:            return;
                    870:        }
                    871:    }
                    872:    else
                    873:    {
                    874:        if (fprintf(fichier, "%s\n", chaine) != (int) (strlen(chaine) + 1))
                    875:        {
                    876:            (*s_etat_processus).erreur_systeme = d_es_erreur_fichier;
                    877:            return;
                    878:        }
                    879:    }
                    880: 
                    881:    free(chaine);
                    882: 
                    883:    if (fclose(fichier) != 0)
                    884:    {
                    885:        (*s_etat_processus).erreur_systeme = d_es_erreur_fichier;
                    886:        return;
                    887:    }
                    888: 
1.5       bertrand  889:    if ((commande = malloc((strlen(ds_vim_commande) + strlen(nom_fichier)
                    890:            - 1) * sizeof(unsigned char))) == NULL)
1.1       bertrand  891:    {
1.5       bertrand  892:        (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    893:        return;
                    894:    }
1.1       bertrand  895: 
1.5       bertrand  896:    sprintf(commande, ds_vim_commande, nom_fichier);
1.1       bertrand  897: 
1.5       bertrand  898:    if (system(commande) != 0)
                    899:    {
                    900:        free(commande);
1.1       bertrand  901: 
1.5       bertrand  902:        (*s_etat_processus).erreur_systeme = d_es_processus;
                    903:        return;
                    904:    }
1.1       bertrand  905: 
1.5       bertrand  906:    free(commande);
1.1       bertrand  907: 
1.5       bertrand  908:    if ((s_objet_nom = allocation(s_etat_processus, CHN)) == NULL)
                    909:    {
                    910:        (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    911:        return;
                    912:    }
1.1       bertrand  913: 
1.5       bertrand  914:    if (((*s_objet_nom).objet = malloc((strlen(nom_fichier) + 1)
                    915:            * sizeof(unsigned char))) == NULL)
                    916:    {
                    917:        (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    918:        return;
                    919:    }
1.1       bertrand  920: 
1.5       bertrand  921:    strcpy((unsigned char *) (*s_objet_nom).objet, nom_fichier);
1.1       bertrand  922: 
1.5       bertrand  923:    if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    924:            s_objet_nom) == d_erreur)
                    925:    {
                    926:        return;
                    927:    }
1.1       bertrand  928: 
1.5       bertrand  929:    registre_pile_last = (*s_etat_processus).l_base_pile_last;
                    930:    (*s_etat_processus).l_base_pile_last = NULL;
1.1       bertrand  931: 
1.5       bertrand  932:    instruction_recall(s_etat_processus);
1.1       bertrand  933: 
1.5       bertrand  934:    if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
                    935:    {
                    936:        return;
                    937:    }
1.1       bertrand  938: 
1.5       bertrand  939:    (*s_etat_processus).l_base_pile_last = registre_pile_last;
1.1       bertrand  940: 
1.5       bertrand  941:    // Destruction du fichier temporaire
1.1       bertrand  942: 
1.5       bertrand  943:    if (destruction_fichier(nom_fichier) == d_erreur)
                    944:    {
                    945:        (*s_etat_processus).erreur_systeme = d_es_erreur_fichier;
                    946:        return;
                    947:    }
1.1       bertrand  948: 
1.5       bertrand  949:    free(nom_fichier);
1.1       bertrand  950: 
1.5       bertrand  951:    if (((*s_etat_processus).erreur_systeme != d_es) ||
                    952:            ((*s_etat_processus).erreur_execution != d_ex) ||
                    953:            ((*s_etat_processus).exception != d_ep))
                    954:    {
                    955:        liberation(s_etat_processus, s_objet);
1.1       bertrand  956: 
1.5       bertrand  957:        return;
                    958:    }
1.1       bertrand  959: 
1.5       bertrand  960:    if ((*s_etat_processus).erreur_systeme != d_es)
                    961:    {
                    962:        return;
                    963:    }
1.1       bertrand  964: 
1.5       bertrand  965:    if ((*s_etat_processus).erreur_execution == d_ex_fichier_vide)
                    966:    {
                    967:        if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    968:                s_objet) == d_erreur)
1.1       bertrand  969:        {
1.5       bertrand  970:            return;
1.1       bertrand  971:        }
                    972: 
1.5       bertrand  973:        (*s_etat_processus).erreur_execution = d_ex;
                    974:    }
                    975:    else
1.1       bertrand  976:    {
                    977:        liberation(s_etat_processus, s_objet);
                    978:    }
                    979: 
                    980:    if (drapeau49 == d_vrai)
                    981:    {
                    982:        sf(s_etat_processus, 49);
                    983:    }
                    984:    else
                    985:    {
                    986:        cf(s_etat_processus, 49);
                    987:    }
                    988: 
                    989:    if (drapeau50 == d_vrai)
                    990:    {
                    991:        sf(s_etat_processus, 50);
                    992:    }
                    993:    else
                    994:    {
                    995:        cf(s_etat_processus, 50);
                    996:    }
                    997: 
                    998: #  endif
                    999: 
                   1000:    return;
                   1001: }
                   1002: 
                   1003: 
                   1004: /*
                   1005: ================================================================================
                   1006:   Fonction 'externals'
                   1007: ================================================================================
                   1008:   Entrées : structure processus
                   1009: --------------------------------------------------------------------------------
                   1010:   Sorties :
                   1011: --------------------------------------------------------------------------------
                   1012:   Effets de bord : néant
                   1013: ================================================================================
                   1014: */
                   1015: 
                   1016: void
                   1017: instruction_externals(struct_processus *s_etat_processus)
                   1018: {
                   1019:    logical1                ambiguite;
                   1020: 
                   1021:    unsigned long           i;
                   1022: 
                   1023:    struct_liste_chainee    *l_element_courant;
                   1024: 
                   1025:    struct_objet            *s_objet;
                   1026: 
                   1027:    (*s_etat_processus).erreur_execution = d_ex;
                   1028: 
                   1029:    if ((*s_etat_processus).affichage_arguments == 'Y')
                   1030:    {
                   1031:        printf("\n  EXTERNALS ");
                   1032: 
                   1033:        if ((*s_etat_processus).langue == 'F')
                   1034:        {
                   1035:            printf("(liste des définitions externes)\n\n");
                   1036:        }
                   1037:        else
                   1038:        {
                   1039:            printf("(list of external definitions)\n\n");
                   1040:        }
                   1041: 
                   1042:        printf("->  1: %s\n", d_LST);
                   1043:        return;
                   1044:    }
                   1045:    else if ((*s_etat_processus).test_instruction == 'Y')
                   1046:    {
                   1047:        (*s_etat_processus).nombre_arguments = -1;
                   1048:        return;
                   1049:    }
                   1050: 
                   1051:    if ((s_objet = allocation(s_etat_processus, LST)) == NULL)
                   1052:    {
                   1053:        (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1054:        return;
                   1055:    }
                   1056: 
                   1057:    (*s_objet).objet = NULL;
                   1058: 
                   1059:    /*
                   1060:     * { "fonction" } si la fonction n'est pas ambiguë
                   1061:     * { "bibliotheque$fonction" } sinon.
                   1062:     */
                   1063: 
                   1064:    l_element_courant = NULL;
                   1065: 
                   1066:    for(i = 0; i < (*s_etat_processus).nombre_instructions_externes; i++)
                   1067:    {
                   1068:        if (l_element_courant == NULL)
                   1069:        {
                   1070:            if (((*s_objet).objet = allocation_maillon(s_etat_processus))
                   1071:                    == NULL)
                   1072:            {
                   1073:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1074:                return;
                   1075:            }
                   1076: 
                   1077:            l_element_courant = (*s_objet).objet;
                   1078:        }
                   1079:        else
                   1080:        {
                   1081:            if (((*l_element_courant).suivant =
                   1082:                    allocation_maillon(s_etat_processus)) == NULL)
                   1083:            {
                   1084:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1085:                return;
                   1086:            }
                   1087: 
                   1088:            l_element_courant = (*l_element_courant).suivant;
                   1089:        }
                   1090: 
                   1091:        (*l_element_courant).suivant = NULL;
                   1092: 
                   1093:        if (((*l_element_courant).donnee = allocation(s_etat_processus, CHN))
                   1094:                == NULL)
                   1095:        {
                   1096:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1097:            return;
                   1098:        }
                   1099: 
                   1100:        ambiguite = d_faux;
                   1101: 
                   1102:        if (i > 0)
                   1103:        {
                   1104:            if (strcmp((*s_etat_processus).s_instructions_externes[i].nom,
                   1105:                    (*s_etat_processus).s_instructions_externes[i - 1].nom)
                   1106:                    == 0)
                   1107:            {
                   1108:                ambiguite = d_vrai;
                   1109:            }
                   1110:        }
                   1111: 
                   1112:        if (((i + 1) < (*s_etat_processus).nombre_instructions_externes) &&
                   1113:                (ambiguite == d_faux))
                   1114:        {
                   1115:            if (strcmp((*s_etat_processus).s_instructions_externes[i].nom,
                   1116:                    (*s_etat_processus).s_instructions_externes[i + 1].nom)
                   1117:                    == 0)
                   1118:            {
                   1119:                ambiguite = d_vrai;
                   1120:            }
                   1121:        }
                   1122: 
                   1123:        if (ambiguite == d_faux)
                   1124:        {
                   1125:            if (((*(*l_element_courant).donnee).objet = malloc((strlen(
                   1126:                    (*s_etat_processus).s_instructions_externes[i].nom) + 1)
                   1127:                    * sizeof(unsigned char))) == NULL)
                   1128:            {
                   1129:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1130:                return;
                   1131:            }
                   1132: 
                   1133:            strcpy((unsigned char *) (*(*l_element_courant).donnee).objet,
                   1134:                    (*s_etat_processus).s_instructions_externes[i].nom);
                   1135:        }
                   1136:        else
                   1137:        {
                   1138:            if (((*(*l_element_courant).donnee).objet = malloc((strlen(
                   1139:                    (*s_etat_processus).s_instructions_externes[i].nom) +
                   1140:                    strlen((*s_etat_processus).s_instructions_externes[i]
                   1141:                    .nom_bibliotheque) + 2) * sizeof(unsigned char))) == NULL)
                   1142:            {
                   1143:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1144:                return;
                   1145:            }
                   1146: 
                   1147:            sprintf((unsigned char *) (*(*l_element_courant).donnee).objet,
                   1148:                    "%s$%s", (*s_etat_processus).s_instructions_externes[i]
                   1149:                    .nom_bibliotheque, (*s_etat_processus)
                   1150:                    .s_instructions_externes[i].nom);
                   1151:        }
                   1152:    }
                   1153: 
                   1154:    if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   1155:            s_objet) == d_erreur)
                   1156:    {
                   1157:        return;
                   1158:    }
                   1159: 
                   1160:    return;
                   1161: }
                   1162: 
                   1163: 
                   1164: /*
                   1165: ================================================================================
                   1166:   Fonction 'exit'
                   1167: ================================================================================
                   1168:   Entrées : structure processus
                   1169: --------------------------------------------------------------------------------
                   1170:   Sorties :
                   1171: --------------------------------------------------------------------------------
                   1172:   Effets de bord : néant
                   1173: ================================================================================
                   1174: */
                   1175: 
                   1176: void
                   1177: instruction_exit(struct_processus *s_etat_processus)
                   1178: {
                   1179:    logical1                        drapeau_boucle_definie;
                   1180:    logical1                        drapeau_presence_fin_boucle;
                   1181:    logical1                        erreur;
                   1182:    logical1                        presence_boucle;
                   1183:    logical1                        presence_compteur;
                   1184: 
                   1185:    struct_liste_pile_systeme       *l_element_pile_systeme;
                   1186: 
                   1187:    unsigned char                   *instruction_majuscule;
                   1188:    unsigned char                   *tampon;
                   1189: 
                   1190:    unsigned long                   niveau;
                   1191: 
                   1192:    void                            (*fonction)();
                   1193: 
                   1194:    (*s_etat_processus).erreur_execution = d_ex;
                   1195: 
                   1196:    if ((*s_etat_processus).affichage_arguments == 'Y')
                   1197:    {
                   1198:        printf("\n  EXIT ");
                   1199: 
                   1200:        if ((*s_etat_processus).langue == 'F')
                   1201:        {
                   1202:            printf("(structure de contrôle)\n\n");
                   1203:            printf("  Utilisation :\n\n");
                   1204:        }
                   1205:        else
                   1206:        {
                   1207:            printf("(control statement)\n\n");
                   1208:            printf("  Usage:\n\n");
                   1209:        }
                   1210: 
                   1211:        printf("    START/FOR\n");
                   1212:        printf("        (expression 1)\n");
                   1213:        printf("        EXIT\n");
                   1214:        printf("        (expression 2)\n");
                   1215:        printf("    NEXT/STEP\n\n");
                   1216: 
                   1217:        printf("    DO\n");
                   1218:        printf("        (expression 1)\n");
                   1219:        printf("        EXIT\n");
                   1220:        printf("        (expression 2)\n");
                   1221:        printf("    UNTIL\n");
                   1222:        printf("        (expression test 1)\n");
                   1223:        printf("        [EXIT\n");
                   1224:        printf("        (expression test 2)]\n");
                   1225:        printf("    END\n\n");
                   1226: 
                   1227:        printf("    WHILE\n");
                   1228:        printf("        (expression test 1)\n");
                   1229:        printf("        [EXIT\n");
                   1230:        printf("        (expression test 2)]\n");
                   1231:        printf("    REPEAT\n");
                   1232:        printf("        (expression 1)\n");
                   1233:        printf("        EXIT\n");
                   1234:        printf("        (expression 2)\n");
                   1235:        printf("    END\n");
                   1236: 
                   1237:        return;
                   1238:    }
                   1239:    else if ((*s_etat_processus).test_instruction == 'Y')
                   1240:    {
                   1241:        (*s_etat_processus).nombre_arguments = -1;
                   1242:        return;
                   1243:    }
                   1244: 
                   1245:    /*
                   1246:     * Test de la présence de l'instruction EXIT dans une boucle
                   1247:     */
                   1248: 
                   1249:    l_element_pile_systeme = (*s_etat_processus).l_base_pile_systeme;
                   1250:    presence_boucle = d_faux;
                   1251:    drapeau_boucle_definie = d_faux;
                   1252: 
                   1253:    while((l_element_pile_systeme != NULL) && (presence_boucle == d_faux))
                   1254:    {
                   1255:        if (((*l_element_pile_systeme).type_cloture == 'S') ||
                   1256:                ((*l_element_pile_systeme).type_cloture == 'F'))
                   1257:        {
                   1258:            presence_boucle = d_vrai;
                   1259:            drapeau_boucle_definie = d_vrai;
                   1260:        }
                   1261:        else if (((*l_element_pile_systeme).type_cloture ==  'D') ||
                   1262:                ((*l_element_pile_systeme).type_cloture == 'W'))
                   1263:        {
                   1264:            presence_boucle = d_vrai;
                   1265:            drapeau_boucle_definie = d_faux;
                   1266:        }
                   1267: 
                   1268:        l_element_pile_systeme = (*l_element_pile_systeme).suivant;
                   1269:    }
                   1270: 
                   1271:    if (presence_boucle == d_faux)
                   1272:    {
                   1273:        (*s_etat_processus).erreur_execution = d_ex_exit_hors_boucle;
                   1274:        return;
                   1275:    }
                   1276: 
                   1277:    if ((*s_etat_processus).mode_execution_programme == 'Y')
                   1278:    {
                   1279:        drapeau_presence_fin_boucle = d_vrai;
                   1280:        tampon = (*s_etat_processus).instruction_courante;
                   1281:        niveau = 1;
                   1282: 
                   1283:        instruction_majuscule = conversion_majuscule("");
                   1284: 
                   1285:        if (drapeau_boucle_definie == d_vrai)
                   1286:        {
                   1287:            while(!(((strcmp(instruction_majuscule, "NEXT") == 0) ||
                   1288:                    (strcmp(instruction_majuscule, "STEP") == 0)) &&
                   1289:                    (niveau == 0)))
                   1290:            {
                   1291:                free(instruction_majuscule);
                   1292: 
                   1293:                erreur = recherche_instruction_suivante(s_etat_processus);
                   1294: 
                   1295:                if (erreur == d_erreur)
                   1296:                {
                   1297:                    return;
                   1298:                }
                   1299: 
                   1300:                if (recherche_variable(s_etat_processus,
                   1301:                        (*s_etat_processus).instruction_courante) == d_vrai)
                   1302:                {
                   1303:                    instruction_majuscule = conversion_majuscule("");
                   1304: 
1.21      bertrand 1305:                    if ((*(*s_etat_processus).pointeur_variable_courante)
1.1       bertrand 1306:                            .objet == NULL)
                   1307:                    {
                   1308:                        if (pthread_mutex_lock(&((*(*s_etat_processus)
                   1309:                                .s_liste_variables_partagees).mutex)) != 0)
                   1310:                        {
                   1311:                            (*s_etat_processus).erreur_systeme =
                   1312:                                    d_es_processus;
                   1313:                            return;
                   1314:                        }
                   1315: 
                   1316:                        if (recherche_variable_partagee(s_etat_processus,
1.21      bertrand 1317:                                (*(*s_etat_processus)
                   1318:                                .pointeur_variable_courante).nom,
                   1319:                                (*(*s_etat_processus)
                   1320:                                .pointeur_variable_courante).variable_partagee,
                   1321:                                (*(*s_etat_processus)
                   1322:                                .pointeur_variable_courante).origine) == d_vrai)
                   1323:                        {
                   1324:                            if ((*(*(*s_etat_processus)
                   1325:                                    .pointeur_variable_courante).objet).type
1.1       bertrand 1326:                                    == ADR)
                   1327:                            {
                   1328:                                empilement_pile_systeme(s_etat_processus);
                   1329: 
                   1330:                                if ((*s_etat_processus).erreur_systeme != d_es)
                   1331:                                {
                   1332:                                    if (pthread_mutex_unlock(
                   1333:                                            &((*(*s_etat_processus)
                   1334:                                            .s_liste_variables_partagees)
                   1335:                                            .mutex)) != 0)
                   1336:                                    {
                   1337:                                        (*s_etat_processus).erreur_systeme =
                   1338:                                                d_es_processus;
                   1339:                                        return;
                   1340:                                    }
                   1341: 
                   1342:                                    return;
                   1343:                                }
                   1344: 
                   1345:                                (*(*s_etat_processus).l_base_pile_systeme)
                   1346:                                        .adresse_retour =
                   1347:                                        (*s_etat_processus).position_courante;
                   1348: 
                   1349:                                (*(*s_etat_processus).l_base_pile_systeme)
                   1350:                                        .retour_definition = 'Y';
                   1351:                                (*(*s_etat_processus).l_base_pile_systeme)
                   1352:                                        .niveau_courant =
                   1353:                                        (*s_etat_processus).niveau_courant;
                   1354: 
                   1355:                                (*s_etat_processus).position_courante =
                   1356:                                        (*((unsigned long *)
1.21      bertrand 1357:                                        ((*(*(*s_etat_processus)
                   1358:                                        .pointeur_variable_courante).objet)
1.1       bertrand 1359:                                        .objet)));
                   1360: 
                   1361:                                (*s_etat_processus)
                   1362:                                        .autorisation_empilement_programme
                   1363:                                        = 'N';
                   1364:                            }
                   1365:                        }
                   1366:                        else
                   1367:                        {
                   1368:                            (*s_etat_processus).erreur_systeme = d_es;
                   1369:                        }
                   1370: 
                   1371:                        if (pthread_mutex_unlock(&((*(*s_etat_processus)
                   1372:                                .s_liste_variables_partagees).mutex)) != 0)
                   1373:                        {
                   1374:                            (*s_etat_processus).erreur_systeme =
                   1375:                                    d_es_processus;
                   1376:                            return;
                   1377:                        }
                   1378:                    }
                   1379:                    else
                   1380:                    {
1.21      bertrand 1381:                        if ((*(*(*s_etat_processus).pointeur_variable_courante)
                   1382:                                .objet).type == ADR)
1.1       bertrand 1383:                        {
                   1384:                            empilement_pile_systeme(s_etat_processus);
                   1385: 
                   1386:                            if ((*s_etat_processus).erreur_systeme != d_es)
                   1387:                            {
                   1388:                                return;
                   1389:                            }
                   1390: 
                   1391:                            (*(*s_etat_processus).l_base_pile_systeme)
                   1392:                                    .adresse_retour =
                   1393:                                    (*s_etat_processus).position_courante;
                   1394: 
                   1395:                            (*(*s_etat_processus).l_base_pile_systeme)
                   1396:                                    .retour_definition = 'Y';
                   1397:                            (*(*s_etat_processus).l_base_pile_systeme)
                   1398:                                    .niveau_courant =
                   1399:                                    (*s_etat_processus).niveau_courant;
                   1400: 
                   1401:                            (*s_etat_processus).position_courante =
1.21      bertrand 1402:                                    (*((unsigned long *)
                   1403:                                    ((*(*(*s_etat_processus)
                   1404:                                    .pointeur_variable_courante).objet)
1.1       bertrand 1405:                                    .objet)));
                   1406: 
                   1407:                            (*s_etat_processus)
                   1408:                                    .autorisation_empilement_programme
                   1409:                                    = 'N';
                   1410:                        }
                   1411:                    }
                   1412:                }
                   1413:                else
                   1414:                {
                   1415:                    (*s_etat_processus).erreur_systeme = d_es;
                   1416:                    instruction_majuscule = conversion_majuscule(
                   1417:                            (*s_etat_processus).instruction_courante);
                   1418: 
                   1419:                    if (instruction_majuscule == NULL)
                   1420:                    {
                   1421:                        return;
                   1422:                    }
                   1423: 
                   1424:                    /*
                   1425:                     * Traitement de la pile système par les
                   1426:                     * différentes instructions.
                   1427:                     */
                   1428: 
                   1429:                    if ((strcmp(instruction_majuscule, "IF") == 0) ||
                   1430:                            (strcmp(instruction_majuscule, "IFERR") == 0) ||
                   1431:                            (strcmp(instruction_majuscule, "DO") == 0) ||
                   1432:                            (strcmp(instruction_majuscule, "WHILE") == 0) ||
                   1433:                            (strcmp(instruction_majuscule, "FOR") == 0) ||
                   1434:                            (strcmp(instruction_majuscule, "START") == 0) ||
                   1435:                            (strcmp(instruction_majuscule, "SELECT") == 0)
                   1436:                            || (strcmp(instruction_majuscule, "CASE") == 0)
                   1437:                            || (strcmp(instruction_majuscule, "<<") == 0))
                   1438:                    {
                   1439:                        if (strcmp(instruction_majuscule, "<<") == 0)
                   1440:                        {
                   1441:                            analyse(s_etat_processus, NULL);
                   1442:                        }
                   1443:                        else
                   1444:                        {
                   1445:                            if ((strcmp(instruction_majuscule, "FOR") == 0) ||
                   1446:                                    (strcmp(instruction_majuscule, "START")
                   1447:                                    == 0))
                   1448:                            {
                   1449:                                niveau++;
                   1450:                            }
                   1451: 
                   1452:                            empilement_pile_systeme(s_etat_processus);
                   1453: 
                   1454:                            if ((*s_etat_processus).erreur_systeme != d_es)
                   1455:                            {
                   1456:                                return;
                   1457:                            }
                   1458:                        }
                   1459:                    }
                   1460:                    else if ((strcmp(instruction_majuscule, "END") == 0) ||
                   1461:                            (strcmp(instruction_majuscule, "NEXT") == 0) ||
                   1462:                            (strcmp(instruction_majuscule, "STEP") == 0) ||
                   1463:                            (strcmp(instruction_majuscule, ">>") == 0))
                   1464:                    {
                   1465:                        if (strcmp(instruction_majuscule, ">>") == 0)
                   1466:                        {
                   1467:                            analyse(s_etat_processus, NULL);
                   1468: 
                   1469:                            if ((*s_etat_processus).retour_routine_evaluation
                   1470:                                    == 'Y')
                   1471:                            {
                   1472:                                drapeau_presence_fin_boucle = d_faux;
                   1473:                                free((*s_etat_processus).instruction_courante);
                   1474: 
                   1475:                                break;
                   1476:                            }
                   1477:                        }
                   1478:                        else
                   1479:                        {
                   1480:                            if ((strcmp(instruction_majuscule, "NEXT") == 0) ||
                   1481:                                    (strcmp(instruction_majuscule, "STEP")
                   1482:                                    == 0))
                   1483:                            {
                   1484:                                niveau--;
                   1485: 
                   1486:                                if (niveau != 0)
                   1487:                                {
                   1488:                                    depilement_pile_systeme(s_etat_processus);
                   1489:                                }
                   1490:                            }
                   1491:                            else
                   1492:                            {
                   1493:                                depilement_pile_systeme(s_etat_processus);
                   1494:                            }
                   1495: 
                   1496:                            if ((*s_etat_processus).erreur_systeme != d_es)
                   1497:                            {
                   1498:                                return;
                   1499:                            }
                   1500:                        }
                   1501:                    }
                   1502:                }
                   1503: 
                   1504:                free((*s_etat_processus).instruction_courante);
                   1505:            }
                   1506:        }
                   1507:        else
                   1508:        {
                   1509:            while(!((strcmp(instruction_majuscule, "END") == 0) &&
                   1510:                    (niveau == 0)))
                   1511:            {
                   1512:                free(instruction_majuscule);
                   1513: 
                   1514:                erreur = recherche_instruction_suivante(s_etat_processus);
                   1515: 
                   1516:                if (erreur == d_erreur)
                   1517:                {
                   1518:                    return;
                   1519:                }
                   1520: 
                   1521:                if (recherche_variable(s_etat_processus,
                   1522:                        (*s_etat_processus).instruction_courante) == d_vrai)
                   1523:                {
                   1524:                    instruction_majuscule = conversion_majuscule("");
                   1525: 
1.21      bertrand 1526:                    if ((*(*s_etat_processus).pointeur_variable_courante)
1.1       bertrand 1527:                            .objet == NULL)
                   1528:                    {
                   1529:                        if (pthread_mutex_lock(&((*(*s_etat_processus)
                   1530:                                .s_liste_variables_partagees).mutex)) != 0)
                   1531:                        {
                   1532:                            (*s_etat_processus).erreur_systeme =
                   1533:                                    d_es_processus;
                   1534:                            return;
                   1535:                        }
                   1536: 
                   1537:                        if (recherche_variable_partagee(s_etat_processus,
1.21      bertrand 1538:                                (*(*s_etat_processus)
                   1539:                                .pointeur_variable_courante).nom,
                   1540:                                (*(*s_etat_processus)
                   1541:                                .pointeur_variable_courante).variable_partagee,
                   1542:                                (*(*s_etat_processus)
                   1543:                                .pointeur_variable_courante).origine) == d_vrai)
                   1544:                        {
                   1545:                            if ((*(*(*s_etat_processus)
                   1546:                                    .pointeur_variable_courante).objet).type
1.1       bertrand 1547:                                    == ADR)
                   1548:                            {
                   1549:                                empilement_pile_systeme(s_etat_processus);
                   1550: 
                   1551:                                if ((*s_etat_processus).erreur_systeme != d_es)
                   1552:                                {
                   1553:                                    if (pthread_mutex_unlock(
                   1554:                                            &((*(*s_etat_processus)
                   1555:                                            .s_liste_variables_partagees)
                   1556:                                            .mutex)) != 0)
                   1557:                                    {
                   1558:                                        (*s_etat_processus).erreur_systeme =
                   1559:                                                d_es_processus;
                   1560:                                        return;
                   1561:                                    }
                   1562: 
                   1563:                                    return;
                   1564:                                }
                   1565: 
                   1566:                                (*(*s_etat_processus).l_base_pile_systeme)
                   1567:                                        .adresse_retour =
                   1568:                                        (*s_etat_processus).position_courante;
                   1569: 
                   1570:                                (*(*s_etat_processus).l_base_pile_systeme)
                   1571:                                        .retour_definition = 'Y';
                   1572:                                (*(*s_etat_processus).l_base_pile_systeme)
                   1573:                                        .niveau_courant =
                   1574:                                        (*s_etat_processus).niveau_courant;
                   1575: 
                   1576:                                (*s_etat_processus).position_courante =
                   1577:                                        (*((unsigned long *)
1.21      bertrand 1578:                                        ((*(*(*s_etat_processus)
                   1579:                                        .pointeur_variable_courante).objet)
1.1       bertrand 1580:                                        .objet)));
                   1581: 
                   1582:                                (*s_etat_processus)
                   1583:                                        .autorisation_empilement_programme
                   1584:                                        = 'N';
                   1585:                            }
                   1586:                        }
                   1587:                        else
                   1588:                        {
                   1589:                            (*s_etat_processus).erreur_systeme = d_es;
                   1590:                        }
                   1591: 
                   1592:                        if (pthread_mutex_unlock(&((*(*s_etat_processus)
                   1593:                                .s_liste_variables_partagees).mutex)) != 0)
                   1594:                        {
                   1595:                            (*s_etat_processus).erreur_systeme =
                   1596:                                    d_es_processus;
                   1597:                            return;
                   1598:                        }
                   1599:                    }
                   1600:                    else
                   1601:                    {
1.21      bertrand 1602:                        if ((*(*(*s_etat_processus).pointeur_variable_courante)
                   1603:                                .objet).type == ADR)
1.1       bertrand 1604:                        {
                   1605:                            empilement_pile_systeme(s_etat_processus);
                   1606: 
                   1607:                            if ((*s_etat_processus).erreur_systeme != d_es)
                   1608:                            {
                   1609:                                return;
                   1610:                            }
                   1611: 
                   1612:                            (*(*s_etat_processus).l_base_pile_systeme)
                   1613:                                    .adresse_retour =
                   1614:                                    (*s_etat_processus).position_courante;
                   1615: 
                   1616:                            (*(*s_etat_processus).l_base_pile_systeme)
                   1617:                                    .retour_definition = 'Y';
                   1618:                            (*(*s_etat_processus).l_base_pile_systeme)
                   1619:                                    .niveau_courant =
                   1620:                                    (*s_etat_processus).niveau_courant;
                   1621: 
                   1622:                            (*s_etat_processus).position_courante =
1.21      bertrand 1623:                                    (*((unsigned long *)
                   1624:                                    ((*(*(*s_etat_processus)
                   1625:                                    .pointeur_variable_courante).objet)
1.1       bertrand 1626:                                    .objet)));
                   1627: 
                   1628:                            (*s_etat_processus)
                   1629:                                    .autorisation_empilement_programme
                   1630:                                    = 'N';
                   1631:                        }
                   1632:                    }
                   1633:                }
                   1634:                else
                   1635:                {
                   1636:                    (*s_etat_processus).erreur_systeme = d_es;
                   1637:                    instruction_majuscule = conversion_majuscule(
                   1638:                            (*s_etat_processus).instruction_courante);
                   1639: 
                   1640:                    if (instruction_majuscule == NULL)
                   1641:                    {
                   1642:                        return;
                   1643:                    }
                   1644: 
                   1645:                    /*
                   1646:                     * Traitement de la pile système par les
                   1647:                     * différentes instructions.
                   1648:                     */
                   1649: 
                   1650:                    if ((strcmp(instruction_majuscule, "IF") == 0) ||
                   1651:                            (strcmp(instruction_majuscule, "IFERR") == 0) ||
                   1652:                            (strcmp(instruction_majuscule, "DO") == 0) ||
                   1653:                            (strcmp(instruction_majuscule, "WHILE") == 0) ||
                   1654:                            (strcmp(instruction_majuscule, "FOR") == 0) ||
                   1655:                            (strcmp(instruction_majuscule, "START") == 0) ||
                   1656:                            (strcmp(instruction_majuscule, "SELECT") == 0)
                   1657:                            || (strcmp(instruction_majuscule, "CASE") == 0)
                   1658:                            || (strcmp(instruction_majuscule, "<<") == 0))
                   1659:                    {
                   1660:                        if (strcmp(instruction_majuscule, "<<") == 0)
                   1661:                        {
                   1662:                            analyse(s_etat_processus, NULL);
                   1663:                        }
                   1664:                        else
                   1665:                        {
                   1666:                            if ((strcmp(instruction_majuscule, "DO") == 0) ||
                   1667:                                    (strcmp(instruction_majuscule, "WHILE")
                   1668:                                    == 0))
                   1669:                            {
                   1670:                                niveau++;
                   1671:                            }
                   1672: 
                   1673:                            empilement_pile_systeme(s_etat_processus);
                   1674: 
                   1675:                            if ((*s_etat_processus).erreur_systeme != d_es)
                   1676:                            {
                   1677:                                return;
                   1678:                            }
                   1679:                        }
                   1680:                    }
                   1681:                    else if ((strcmp(instruction_majuscule, "END") == 0) ||
                   1682:                            (strcmp(instruction_majuscule, "NEXT") == 0) ||
                   1683:                            (strcmp(instruction_majuscule, "STEP") == 0) ||
                   1684:                            (strcmp(instruction_majuscule, ">>") == 0))
                   1685:                    {
                   1686:                        if (strcmp(instruction_majuscule, ">>") == 0)
                   1687:                        {
                   1688:                            analyse(s_etat_processus, NULL);
                   1689: 
                   1690:                            if ((*s_etat_processus).retour_routine_evaluation
                   1691:                                    == 'Y')
                   1692:                            {
                   1693:                                drapeau_presence_fin_boucle = d_faux;
                   1694:                                free((*s_etat_processus).instruction_courante);
                   1695: 
                   1696:                                break;
                   1697:                            }
                   1698:                        }
                   1699:                        else
                   1700:                        {
                   1701:                            if (strcmp(instruction_majuscule, "END") == 0)
                   1702:                            {
                   1703:                                if (((*(*s_etat_processus).l_base_pile_systeme)
                   1704:                                        .type_cloture == 'D') ||
                   1705:                                        ((*(*s_etat_processus)
                   1706:                                        .l_base_pile_systeme).type_cloture
                   1707:                                        == 'W'))
                   1708:                                {
                   1709:                                    niveau--;
                   1710:                                }
                   1711: 
                   1712:                                depilement_pile_systeme(s_etat_processus);
                   1713:                            }
                   1714:                            else
                   1715:                            {
                   1716:                                depilement_pile_systeme(s_etat_processus);
                   1717:                            }
                   1718: 
                   1719:                            if ((*s_etat_processus).erreur_systeme != d_es)
                   1720:                            {
                   1721:                                return;
                   1722:                            }
                   1723:                        }
                   1724:                    }
                   1725:                }
                   1726: 
                   1727:                free((*s_etat_processus).instruction_courante);
                   1728:            }
                   1729:        }
                   1730: 
                   1731:        if (drapeau_presence_fin_boucle == d_faux)
                   1732:        {
                   1733:            (*s_etat_processus).traitement_cycle_exit = 'E';
                   1734:        }
                   1735:        else
                   1736:        {
                   1737:            (*s_etat_processus).traitement_cycle_exit = 'N';
                   1738:        }
                   1739: 
                   1740:        free(instruction_majuscule);
                   1741:        (*s_etat_processus).instruction_courante = tampon;
                   1742:    }
                   1743:    else
                   1744:    {
                   1745:        /* EXIT apparaissant dans l'évaluation d'une expression */
                   1746: 
                   1747:        drapeau_presence_fin_boucle = d_faux;
                   1748:        instruction_majuscule = NULL;
                   1749:        niveau = 1;
                   1750: 
                   1751:        if (drapeau_boucle_definie == d_vrai)
                   1752:        {
                   1753:            while((*s_etat_processus).expression_courante != NULL)
                   1754:            {
                   1755:                while((*(*(*s_etat_processus).expression_courante)
                   1756:                        .donnee).type != FCT)
                   1757:                {
                   1758:                    if ((*s_etat_processus).expression_courante == NULL)
                   1759:                    {
                   1760:                        (*s_etat_processus).erreur_execution =
                   1761:                                d_ex_erreur_traitement_boucle;
                   1762:                        return;
                   1763:                    }
                   1764: 
                   1765:                    (*s_etat_processus).expression_courante =
                   1766:                            (*(*s_etat_processus).expression_courante).suivant;
                   1767:                }
                   1768: 
                   1769:                fonction = (*((struct_fonction *) (*(*(*s_etat_processus)
                   1770:                        .expression_courante).donnee).objet)).fonction;
                   1771: 
                   1772:                if ((fonction == instruction_if) ||
                   1773:                        (fonction == instruction_iferr) ||
                   1774:                        (fonction == instruction_do) ||
                   1775:                        (fonction == instruction_while) ||
                   1776:                        (fonction == instruction_for) ||
                   1777:                        (fonction == instruction_start) ||
                   1778:                        (fonction == instruction_select) ||
                   1779:                        (fonction == instruction_case) ||
                   1780:                        (fonction == instruction_vers_niveau_superieur))
                   1781:                {
                   1782:                    if (fonction == instruction_vers_niveau_superieur)
                   1783:                    {
                   1784:                        analyse(s_etat_processus,
                   1785:                                instruction_vers_niveau_superieur);
                   1786:                    }
                   1787:                    else
                   1788:                    {
                   1789:                        if ((fonction == instruction_for) ||
                   1790:                                (fonction == instruction_start))
                   1791:                        {
                   1792:                            niveau++;
                   1793:                        }
                   1794: 
                   1795:                        empilement_pile_systeme(s_etat_processus);
                   1796: 
                   1797:                        if ((*s_etat_processus).erreur_systeme != d_es)
                   1798:                        {
                   1799:                            return;
                   1800:                        }
                   1801:                    }
                   1802:                }
                   1803:                else if ((fonction == instruction_end) ||
                   1804:                        (fonction == instruction_next) ||
                   1805:                        (fonction == instruction_step) ||
                   1806:                        (fonction == instruction_vers_niveau_inferieur))
                   1807:                {
                   1808:                    if (fonction == instruction_vers_niveau_inferieur)
                   1809:                    {
                   1810:                        tampon = (*s_etat_processus).instruction_courante;
                   1811:                        (*s_etat_processus).instruction_courante =
                   1812:                                instruction_majuscule;
                   1813: 
                   1814:                        analyse(s_etat_processus,
                   1815:                                instruction_vers_niveau_inferieur);
                   1816: 
                   1817:                        (*s_etat_processus).instruction_courante = tampon;
                   1818:                    }
                   1819:                    else
                   1820:                    {
                   1821:                        if ((fonction == instruction_next) ||
                   1822:                                (fonction == instruction_step))
                   1823:                        {
                   1824:                            niveau--;
                   1825: 
                   1826:                            if (niveau != 0)
                   1827:                            {
                   1828:                                depilement_pile_systeme(s_etat_processus);
                   1829:                            }
                   1830:                            else
                   1831:                            {
                   1832:                                drapeau_presence_fin_boucle = d_vrai;
                   1833:                                break;
                   1834:                            }
                   1835:                        }
                   1836:                        else
                   1837:                        {
                   1838:                            depilement_pile_systeme(s_etat_processus);
                   1839:                        }
                   1840: 
                   1841:                        if ((*s_etat_processus).erreur_systeme != d_es)
                   1842:                        {
                   1843:                            return;
                   1844:                        }
                   1845:                    }
                   1846:                }
                   1847: 
                   1848:                (*s_etat_processus).expression_courante = (*(*s_etat_processus)
                   1849:                        .expression_courante).suivant;
                   1850:            }
                   1851:        }
                   1852:        else
                   1853:        {
                   1854:            while((*s_etat_processus).expression_courante != NULL)
                   1855:            {
                   1856:                while((*(*(*s_etat_processus).expression_courante)
                   1857:                        .donnee).type != FCT)
                   1858:                {
                   1859:                    if ((*s_etat_processus).expression_courante == NULL)
                   1860:                    {
                   1861:                        (*s_etat_processus).erreur_execution =
                   1862:                                d_ex_erreur_traitement_boucle;
                   1863:                        return;
                   1864:                    }
                   1865: 
                   1866:                    (*s_etat_processus).expression_courante =
                   1867:                            (*(*s_etat_processus).expression_courante).suivant;
                   1868:                }
                   1869: 
                   1870:                fonction = (*((struct_fonction *) (*(*(*s_etat_processus)
                   1871:                        .expression_courante).donnee).objet)).fonction;
                   1872: 
                   1873:                if ((fonction == instruction_if) ||
                   1874:                        (fonction == instruction_iferr) ||
                   1875:                        (fonction == instruction_do) ||
                   1876:                        (fonction == instruction_while) ||
                   1877:                        (fonction == instruction_for) ||
                   1878:                        (fonction == instruction_start) ||
                   1879:                        (fonction == instruction_select) ||
                   1880:                        (fonction == instruction_case) ||
                   1881:                        (fonction == instruction_vers_niveau_superieur))
                   1882:                {
                   1883:                    if (fonction == instruction_vers_niveau_superieur)
                   1884:                    {
                   1885:                        analyse(s_etat_processus,
                   1886:                                instruction_vers_niveau_superieur);
                   1887:                    }
                   1888:                    else
                   1889:                    {
                   1890:                        if ((fonction == instruction_do) ||
                   1891:                                (fonction == instruction_while))
                   1892:                        {
                   1893:                            niveau++;
                   1894:                        }
                   1895: 
                   1896:                        empilement_pile_systeme(s_etat_processus);
                   1897: 
                   1898:                        if ((*s_etat_processus).erreur_systeme != d_es)
                   1899:                        {
                   1900:                            return;
                   1901:                        }
                   1902:                    }
                   1903:                }
                   1904:                else if ((fonction == instruction_end) ||
                   1905:                        (fonction == instruction_next) ||
                   1906:                        (fonction == instruction_step) ||
                   1907:                        (fonction == instruction_vers_niveau_inferieur))
                   1908:                {
                   1909:                    if (fonction == instruction_vers_niveau_inferieur)
                   1910:                    {
                   1911:                        analyse(s_etat_processus,
                   1912:                                instruction_vers_niveau_inferieur);
                   1913:                    }
                   1914:                    else
                   1915:                    {
                   1916:                        if (fonction == instruction_end)
                   1917:                        {
                   1918:                            if (((*(*s_etat_processus).l_base_pile_systeme)
                   1919:                                    .type_cloture == 'D') ||
                   1920:                                    ((*(*s_etat_processus).l_base_pile_systeme)
                   1921:                                    .type_cloture == 'W'))
                   1922:                            {
                   1923:                                niveau--;
                   1924:                            }
                   1925: 
                   1926:                            depilement_pile_systeme(s_etat_processus);
                   1927: 
                   1928:                            if (niveau == 0)
                   1929:                            {
                   1930:                                drapeau_presence_fin_boucle = d_vrai;
                   1931:                                break;
                   1932:                            }
                   1933:                        }
                   1934:                        else
                   1935:                        {
                   1936:                            depilement_pile_systeme(s_etat_processus);
                   1937:                        }
                   1938: 
                   1939:                        if ((*s_etat_processus).erreur_systeme != d_es)
                   1940:                        {
                   1941:                            return;
                   1942:                        }
                   1943:                    }
                   1944:                }
                   1945: 
                   1946:                (*s_etat_processus).expression_courante = (*(*s_etat_processus)
                   1947:                        .expression_courante).suivant;
                   1948:            }
                   1949:        }
                   1950: 
                   1951:        if (drapeau_presence_fin_boucle == d_faux)
                   1952:        {
                   1953:            (*s_etat_processus).traitement_cycle_exit = 'E';
                   1954:        }
                   1955:        else
                   1956:        {
                   1957:            (*s_etat_processus).traitement_cycle_exit = 'N';
                   1958:        }
                   1959:    }
                   1960: 
                   1961:    if ((drapeau_boucle_definie == d_vrai) &&
                   1962:            (drapeau_presence_fin_boucle == d_vrai))
                   1963:    {
                   1964:        presence_compteur = ((*(*s_etat_processus).l_base_pile_systeme)
                   1965:                .type_cloture == 'F') ? d_vrai : d_faux;
                   1966: 
                   1967:        if (((*(*s_etat_processus).l_base_pile_systeme).type_cloture != 'S')
                   1968:                && (presence_compteur == d_faux))
                   1969:        {
                   1970:            (*s_etat_processus).erreur_execution =
                   1971:                    d_ex_erreur_traitement_boucle;
                   1972:            return;
                   1973:        }
                   1974: 
                   1975:        depilement_pile_systeme(s_etat_processus);
                   1976: 
                   1977:        if ((*s_etat_processus).erreur_systeme != d_es)
                   1978:        {
                   1979:            return;
                   1980:        }
                   1981: 
                   1982:        if (presence_compteur == d_vrai)
                   1983:        {
                   1984:            (*(*s_etat_processus).l_base_pile_systeme).indice_boucle = NULL;
                   1985:            (*s_etat_processus).niveau_courant--;
                   1986: 
                   1987:            if (retrait_variable_par_niveau(s_etat_processus) == d_erreur)
                   1988:            {
                   1989:                return;
                   1990:            }
                   1991:        }
                   1992:    }
                   1993: 
                   1994:    return;
                   1995: }
                   1996: 
                   1997: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>