Annotation of rpl/src/instructions_c6.c, revision 1.1

1.1     ! bertrand    1: /*
        !             2: ================================================================================
        !             3:   RPL/2 (R) version 4.0.9
        !             4:   Copyright (C) 1989-2010 Dr. BERTRAND Joël
        !             5: 
        !             6:   This file is part of RPL/2.
        !             7: 
        !             8:   RPL/2 is free software; you can redistribute it and/or modify it
        !             9:   under the terms of the CeCILL V2 License as published by the french
        !            10:   CEA, CNRS and INRIA.
        !            11:  
        !            12:   RPL/2 is distributed in the hope that it will be useful, but WITHOUT
        !            13:   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        !            14:   FITNESS FOR A PARTICULAR PURPOSE.  See the CeCILL V2 License
        !            15:   for more details.
        !            16:  
        !            17:   You should have received a copy of the CeCILL License
        !            18:   along with RPL/2. If not, write to info@cecill.info.
        !            19: ================================================================================
        !            20: */
        !            21: 
        !            22: 
        !            23: #include "rpl.conv.h"
        !            24: 
        !            25: 
        !            26: /*
        !            27: ================================================================================
        !            28:   Fonction 'clusr'
        !            29: ================================================================================
        !            30:   Entrées :
        !            31: --------------------------------------------------------------------------------
        !            32:   Sorties :
        !            33: --------------------------------------------------------------------------------
        !            34:   Effets de bord : néant
        !            35: ================================================================================
        !            36: */
        !            37: 
        !            38: void
        !            39: instruction_clusr(struct_processus *s_etat_processus)
        !            40: {
        !            41:    unsigned long                   i;
        !            42: 
        !            43:    (*s_etat_processus).erreur_execution = d_ex;
        !            44: 
        !            45:    if ((*s_etat_processus).affichage_arguments == 'Y')
        !            46:    {
        !            47:        printf("\n  CLUSR ");
        !            48: 
        !            49:        if ((*s_etat_processus).langue == 'F')
        !            50:        {
        !            51:            printf("(effacement des variables)\n\n");
        !            52:            printf("  Aucun argument\n");
        !            53:        }
        !            54:        else
        !            55:        {
        !            56:            printf("(clear variables)\n\n");
        !            57:            printf("  No argument\n");
        !            58:        }
        !            59: 
        !            60:        return;
        !            61:    }
        !            62:    else if ((*s_etat_processus).test_instruction == 'Y')
        !            63:    {
        !            64:        (*s_etat_processus).nombre_arguments = -1;
        !            65:        return;
        !            66:    }
        !            67: 
        !            68:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
        !            69:    {
        !            70:        if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
        !            71:        {
        !            72:            return;
        !            73:        }
        !            74:    }
        !            75: 
        !            76:    for(i = 0; i < (*s_etat_processus).nombre_variables; i++)
        !            77:    {
        !            78:        if (((*s_etat_processus).s_liste_variables[i]).niveau == 1)
        !            79:        {
        !            80:            if (retrait_variable(s_etat_processus,
        !            81:                    ((*s_etat_processus).s_liste_variables[i]).nom, 'G')
        !            82:                    == d_erreur)
        !            83:            {
        !            84:                return;
        !            85:            }
        !            86:        }
        !            87:    }
        !            88: 
        !            89:    return;
        !            90: }
        !            91: 
        !            92: 
        !            93: /*
        !            94: ================================================================================
        !            95:   Fonction 'col->'
        !            96: ================================================================================
        !            97:   Entrées :
        !            98: --------------------------------------------------------------------------------
        !            99:   Sorties :
        !           100: --------------------------------------------------------------------------------
        !           101:   Effets de bord : néant
        !           102: ================================================================================
        !           103: */
        !           104: 
        !           105: void
        !           106: instruction_col_fleche(struct_processus *s_etat_processus)
        !           107: {
        !           108:    struct_objet                *s_objet;
        !           109:    struct_objet                *s_objet_elementaire;
        !           110: 
        !           111:    unsigned long               i;
        !           112:    unsigned long               j;
        !           113: 
        !           114:    (*s_etat_processus).erreur_execution = d_ex;
        !           115: 
        !           116:    if ((*s_etat_processus).affichage_arguments == 'Y')
        !           117:    {
        !           118:        printf("\n  COL-> ");
        !           119: 
        !           120:        if ((*s_etat_processus).langue == 'F')
        !           121:        {
        !           122:            printf("(extraction des colonnes d'une matrice)\n\n");
        !           123:        }
        !           124:        else
        !           125:        {
        !           126:            printf("(extract matrix columns)\n\n");
        !           127:        }
        !           128: 
        !           129:        printf("    1: %s, %s, %s\n", d_MIN, d_MRL, d_MCX);
        !           130:        printf("->  n: %s, %s, %s\n", d_MIN, d_MRL, d_MCX);
        !           131:        printf("    ...\n");
        !           132:        printf("    2: %s, %s, %s\n", d_MIN, d_MRL, d_MCX);
        !           133:        printf("    1: %s\n", d_INT);
        !           134: 
        !           135:        return;
        !           136:    }
        !           137:    else if ((*s_etat_processus).test_instruction == 'Y')
        !           138:    {
        !           139:        (*s_etat_processus).nombre_arguments = -1;
        !           140:        return;
        !           141:    }
        !           142: 
        !           143:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
        !           144:    {
        !           145:        if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
        !           146:        {
        !           147:            return;
        !           148:        }
        !           149:    }
        !           150: 
        !           151:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
        !           152:            &s_objet) == d_erreur)
        !           153:    {
        !           154:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
        !           155:        return;
        !           156:    }
        !           157: 
        !           158:    if ((*s_objet).type == MIN)
        !           159:    {
        !           160:        for(i = 0; i < (*((struct_matrice *)
        !           161:                (*s_objet).objet)).nombre_colonnes; i++)
        !           162:        {
        !           163:            if ((s_objet_elementaire = allocation(s_etat_processus, MIN))
        !           164:                    == NULL)
        !           165:            {
        !           166:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !           167:                return;
        !           168:            }
        !           169: 
        !           170:            (*((struct_matrice *) (*s_objet_elementaire).objet))
        !           171:                    .nombre_colonnes = 1;
        !           172:            (*((struct_matrice *) (*s_objet_elementaire).objet))
        !           173:                    .nombre_lignes = (*((struct_matrice *) (*s_objet).objet))
        !           174:                    .nombre_lignes;
        !           175: 
        !           176:            if (((*((struct_matrice *) (*s_objet_elementaire).objet)).tableau =
        !           177:                    malloc((*((struct_matrice *) (*s_objet).objet))
        !           178:                    .nombre_lignes * sizeof(integer8 *))) == NULL)
        !           179:            {
        !           180:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !           181:                return;
        !           182:            }
        !           183: 
        !           184:            for(j = 0; j < (*((struct_matrice *) (*s_objet).objet))
        !           185:                    .nombre_lignes; j++)
        !           186:            {
        !           187:                if ((((integer8 **) (*((struct_matrice *) (*s_objet_elementaire)
        !           188:                        .objet)).tableau)[j] = malloc(sizeof(integer8)))
        !           189:                        == NULL)
        !           190:                {
        !           191:                    (*s_etat_processus).erreur_systeme =
        !           192:                            d_es_allocation_memoire;
        !           193:                    return;
        !           194:                }
        !           195: 
        !           196:                ((integer8 **) (*((struct_matrice *) (*s_objet_elementaire)
        !           197:                        .objet)).tableau)[j][0] = ((integer8 **)
        !           198:                        (*((struct_matrice *) (*s_objet).objet)).tableau)[j][i];
        !           199:            }
        !           200: 
        !           201:            if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
        !           202:                    s_objet_elementaire) == d_erreur)
        !           203:            {
        !           204:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !           205:                return;
        !           206:            }
        !           207:        }
        !           208:    }
        !           209:    else if ((*s_objet).type == MRL)
        !           210:    {
        !           211:        for(i = 0; i < (*((struct_matrice *)
        !           212:                (*s_objet).objet)).nombre_colonnes; i++)
        !           213:        {
        !           214:            if ((s_objet_elementaire = allocation(s_etat_processus, MRL))
        !           215:                    == NULL)
        !           216:            {
        !           217:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !           218:                return;
        !           219:            }
        !           220: 
        !           221:            (*((struct_matrice *) (*s_objet_elementaire).objet))
        !           222:                    .nombre_colonnes = 1;
        !           223:            (*((struct_matrice *) (*s_objet_elementaire).objet))
        !           224:                    .nombre_lignes = (*((struct_matrice *) (*s_objet).objet))
        !           225:                    .nombre_lignes;
        !           226: 
        !           227:            if (((*((struct_matrice *) (*s_objet_elementaire).objet)).tableau =
        !           228:                    malloc((*((struct_matrice *) (*s_objet).objet))
        !           229:                    .nombre_lignes * sizeof(real8 *))) == NULL)
        !           230:            {
        !           231:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !           232:                return;
        !           233:            }
        !           234: 
        !           235:            for(j = 0; j < (*((struct_matrice *) (*s_objet).objet))
        !           236:                    .nombre_lignes; j++)
        !           237:            {
        !           238:                if ((((real8 **) (*((struct_matrice *) (*s_objet_elementaire)
        !           239:                        .objet)).tableau)[j] = malloc(sizeof(real8)))
        !           240:                        == NULL)
        !           241:                {
        !           242:                    (*s_etat_processus).erreur_systeme =
        !           243:                            d_es_allocation_memoire;
        !           244:                    return;
        !           245:                }
        !           246: 
        !           247:                ((real8 **) (*((struct_matrice *) (*s_objet_elementaire)
        !           248:                        .objet)).tableau)[j][0] = ((real8 **)
        !           249:                        (*((struct_matrice *) (*s_objet).objet)).tableau)[j][i];
        !           250:            }
        !           251: 
        !           252:            if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
        !           253:                    s_objet_elementaire) == d_erreur)
        !           254:            {
        !           255:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !           256:                return;
        !           257:            }
        !           258:        }
        !           259:    }
        !           260:    else if ((*s_objet).type == MCX)
        !           261:    {
        !           262:        for(i = 0; i < (*((struct_matrice *)
        !           263:                (*s_objet).objet)).nombre_colonnes; i++)
        !           264:        {
        !           265:            if ((s_objet_elementaire = allocation(s_etat_processus, MCX))
        !           266:                    == NULL)
        !           267:            {
        !           268:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !           269:                return;
        !           270:            }
        !           271: 
        !           272:            (*((struct_matrice *) (*s_objet_elementaire).objet))
        !           273:                    .nombre_colonnes = 1;
        !           274:            (*((struct_matrice *) (*s_objet_elementaire).objet))
        !           275:                    .nombre_lignes = (*((struct_matrice *) (*s_objet).objet))
        !           276:                    .nombre_lignes;
        !           277: 
        !           278:            if (((*((struct_matrice *) (*s_objet_elementaire).objet)).tableau =
        !           279:                    malloc((*((struct_matrice *) (*s_objet).objet))
        !           280:                    .nombre_lignes * sizeof(complex16 *))) == NULL)
        !           281:            {
        !           282:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !           283:                return;
        !           284:            }
        !           285: 
        !           286:            for(j = 0; j < (*((struct_matrice *) (*s_objet).objet))
        !           287:                    .nombre_lignes; j++)
        !           288:            {
        !           289:                if ((((complex16 **) (*((struct_matrice *)
        !           290:                        (*s_objet_elementaire).objet)).tableau)[j] =
        !           291:                        malloc(sizeof(complex16))) == NULL)
        !           292:                {
        !           293:                    (*s_etat_processus).erreur_systeme =
        !           294:                            d_es_allocation_memoire;
        !           295:                    return;
        !           296:                }
        !           297: 
        !           298:                (((complex16 **) (*((struct_matrice *) (*s_objet_elementaire)
        !           299:                        .objet)).tableau)[j][0]).partie_reelle =
        !           300:                        (((complex16 **) (*((struct_matrice *) (*s_objet)
        !           301:                        .objet)).tableau)[j][i]).partie_reelle;
        !           302:                (((complex16 **) (*((struct_matrice *) (*s_objet_elementaire)
        !           303:                        .objet)).tableau)[j][0]).partie_imaginaire =
        !           304:                        (((complex16 **) (*((struct_matrice *) (*s_objet)
        !           305:                        .objet)).tableau)[j][i]).partie_imaginaire;
        !           306:            }
        !           307: 
        !           308:            if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
        !           309:                    s_objet_elementaire) == d_erreur)
        !           310:            {
        !           311:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !           312:                return;
        !           313:            }
        !           314:        }
        !           315:    }
        !           316:    else
        !           317:    {
        !           318:        liberation(s_etat_processus, s_objet);
        !           319: 
        !           320:        (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
        !           321:        return;
        !           322:    }
        !           323: 
        !           324:    if ((s_objet_elementaire = allocation(s_etat_processus, INT)) == NULL)
        !           325:    {
        !           326:        (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !           327:        return;
        !           328:    }
        !           329: 
        !           330:    (*((integer8 *) (*s_objet_elementaire).objet)) =
        !           331:            (*((struct_matrice *) (*s_objet).objet)).nombre_colonnes;
        !           332: 
        !           333:    if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
        !           334:            s_objet_elementaire) == d_erreur)
        !           335:    {
        !           336:        (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !           337:        return;
        !           338:    }
        !           339: 
        !           340:    liberation(s_etat_processus, s_objet);
        !           341: 
        !           342:    return;
        !           343: }
        !           344: 
        !           345: 
        !           346: /*
        !           347: ================================================================================
        !           348:   Fonction 'clrswi'
        !           349: ================================================================================
        !           350:   Entrées : pointeur sur une structure struct_processus
        !           351: --------------------------------------------------------------------------------
        !           352:   Sorties :
        !           353: --------------------------------------------------------------------------------
        !           354:   Effets de bord : néant
        !           355: ================================================================================
        !           356: */
        !           357: 
        !           358: void
        !           359: instruction_clrswi(struct_processus *s_etat_processus)
        !           360: {
        !           361:    integer8                        interruption;
        !           362: 
        !           363:    struct_objet                    *s_objet_argument;
        !           364: 
        !           365:    (*s_etat_processus).erreur_execution = d_ex;
        !           366: 
        !           367:    if ((*s_etat_processus).affichage_arguments == 'Y')
        !           368:    {
        !           369:        printf("\n  CLRSWI ");
        !           370: 
        !           371:        if ((*s_etat_processus).langue == 'F')
        !           372:        {
        !           373:            printf("(suppression d'une interruption logicielle)\n\n");
        !           374:        }
        !           375:        else
        !           376:        {
        !           377:            printf("(software interrupt deletion)\n\n");
        !           378:        }
        !           379: 
        !           380:        printf("    1: %s\n", d_INT);
        !           381: 
        !           382:        return;
        !           383:    }
        !           384:    else if ((*s_etat_processus).test_instruction == 'Y')
        !           385:    {
        !           386:        (*s_etat_processus).nombre_arguments = -1;
        !           387:        return;
        !           388:    }
        !           389: 
        !           390:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
        !           391:    {
        !           392:        if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
        !           393:        {
        !           394:            return;
        !           395:        }
        !           396:    }
        !           397: 
        !           398:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
        !           399:            &s_objet_argument) == d_erreur)
        !           400:    {
        !           401:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
        !           402:        return;
        !           403:    }
        !           404: 
        !           405:    if ((*s_objet_argument).type == INT)
        !           406:    {
        !           407:        interruption = (*((integer8 *) (*s_objet_argument).objet));
        !           408: 
        !           409:        if ((interruption < 1) || (interruption > d_NOMBRE_INTERRUPTIONS))
        !           410:        {
        !           411:            liberation(s_etat_processus, s_objet_argument);
        !           412: 
        !           413:            (*s_etat_processus).erreur_execution = d_ex_interruption_invalide;
        !           414:            return;
        !           415:        }
        !           416: 
        !           417:        liberation(s_etat_processus, (*s_etat_processus)
        !           418:                .corps_interruptions[interruption - 1]);
        !           419:        (*s_etat_processus).corps_interruptions[interruption - 1] = NULL;
        !           420:    }
        !           421:    else
        !           422:    {
        !           423:        liberation(s_etat_processus, s_objet_argument);
        !           424: 
        !           425:        (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
        !           426:        return;
        !           427:    }
        !           428: 
        !           429:    return;
        !           430: }
        !           431: 
        !           432: 
        !           433: /*
        !           434: ================================================================================
        !           435:   Fonction 'clrcntxt'
        !           436: ================================================================================
        !           437:   Entrées :
        !           438: --------------------------------------------------------------------------------
        !           439:   Sorties :
        !           440: --------------------------------------------------------------------------------
        !           441:   Effets de bord : néant
        !           442: ================================================================================
        !           443: */
        !           444: 
        !           445: void
        !           446: instruction_clrcntxt(struct_processus *s_etat_processus)
        !           447: {
        !           448:    struct_liste_chainee                *l_element_courant;
        !           449:    struct_liste_chainee                *l_element_suivant;
        !           450: 
        !           451:    (*s_etat_processus).erreur_execution = d_ex;
        !           452: 
        !           453:    if ((*s_etat_processus).affichage_arguments == 'Y')
        !           454:    {
        !           455:        printf("\n  CLCNTXT ");
        !           456: 
        !           457:        if ((*s_etat_processus).langue == 'F')
        !           458:        {
        !           459:            printf("(effacement des contextes)\n\n");
        !           460:            printf("  Aucun argument\n");
        !           461:        }
        !           462:        else
        !           463:        {
        !           464:            printf("(clear contexts)\n\n");
        !           465:            printf("  No argument\n");
        !           466:        }
        !           467: 
        !           468:        return;
        !           469:    }
        !           470:    else if ((*s_etat_processus).test_instruction == 'Y')
        !           471:    {
        !           472:        (*s_etat_processus).nombre_arguments = -1;
        !           473:        return;
        !           474:    }
        !           475: 
        !           476:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
        !           477:    {
        !           478:        if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
        !           479:        {
        !           480:            return;
        !           481:        }
        !           482:    }
        !           483: 
        !           484:    l_element_courant = (*s_etat_processus).l_base_pile_contextes;
        !           485: 
        !           486:    while(l_element_courant != NULL)
        !           487:    {
        !           488:        l_element_suivant = (*l_element_courant).suivant;
        !           489:        liberation(s_etat_processus, (*l_element_courant).donnee);
        !           490:        free(l_element_courant);
        !           491:        l_element_courant = l_element_suivant;
        !           492:    }
        !           493: 
        !           494:    (*s_etat_processus).l_base_pile_contextes = NULL;
        !           495: 
        !           496:    return;
        !           497: }
        !           498: 
        !           499: 
        !           500: /*
        !           501: ================================================================================
        !           502:   Fonction 'continue'
        !           503: ================================================================================
        !           504:   Entrées :
        !           505: --------------------------------------------------------------------------------
        !           506:   Sorties :
        !           507: --------------------------------------------------------------------------------
        !           508:   Effets de bord : néant
        !           509: ================================================================================
        !           510: */
        !           511: 
        !           512: void
        !           513: instruction_continue(struct_processus *s_etat_processus)
        !           514: {
        !           515:    struct_liste_chainee        *l_element_courant;
        !           516: 
        !           517:    struct_objet                *s_objet;
        !           518: 
        !           519:    (*s_etat_processus).erreur_execution = d_ex;
        !           520: 
        !           521:    if ((*s_etat_processus).affichage_arguments == 'Y')
        !           522:    {
        !           523:        printf("\n  CONTINUE ");
        !           524: 
        !           525:        if ((*s_etat_processus).langue == 'F')
        !           526:        {
        !           527:            printf("(relance d'un processus suspendu)\n\n");
        !           528:        }
        !           529:        else
        !           530:        {
        !           531:            printf("(continue a pending process)\n\n");
        !           532:        }
        !           533: 
        !           534:        printf("    1: %s\n", d_PRC);
        !           535: 
        !           536:        return;
        !           537:    }
        !           538:    else if ((*s_etat_processus).test_instruction == 'Y')
        !           539:    {
        !           540:        (*s_etat_processus).nombre_arguments = -1;
        !           541:        return;
        !           542:    }
        !           543:    
        !           544:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
        !           545:    {
        !           546:        if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
        !           547:        {
        !           548:            return;
        !           549:        }
        !           550:    }
        !           551: 
        !           552:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
        !           553:            &s_objet) == d_erreur)
        !           554:    {
        !           555:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
        !           556:        return;
        !           557:    }
        !           558: 
        !           559:    if ((*s_objet).type == PRC)
        !           560:    {
        !           561:        if (pthread_mutex_lock(&((*s_etat_processus).mutex)) != 0)
        !           562:        {
        !           563:            (*s_etat_processus).erreur_systeme = d_es_processus;
        !           564:        }
        !           565:        else
        !           566:        {
        !           567:            l_element_courant = (struct_liste_chainee *)
        !           568:                    (*s_etat_processus).l_base_pile_processus;
        !           569: 
        !           570:            while(l_element_courant != NULL)
        !           571:            {
        !           572:                if ((*(*((struct_processus_fils *) (*s_objet).objet)).thread)
        !           573:                        .processus_detache == d_vrai)
        !           574:                {
        !           575:                    if ((*(*((struct_processus_fils *) (*s_objet).objet))
        !           576:                            .thread).pid == (*(*((struct_processus_fils *)
        !           577:                            (*(*l_element_courant).donnee).objet)).thread).pid)
        !           578:                    {
        !           579:                        if (kill((*(*((struct_processus_fils *)
        !           580:                                (*s_objet).objet)).thread).pid, SIGCONT) != 0)
        !           581:                        {
        !           582:                            // Le processus est peut-être dans l'état zombie.
        !           583:                        }
        !           584: 
        !           585:                        break;
        !           586:                    }
        !           587:                }
        !           588:                else
        !           589:                {
        !           590:                    if (pthread_mutex_lock(&((*(*((struct_processus_fils *)
        !           591:                            (*s_objet).objet)).thread).mutex)) != 0)
        !           592:                    {
        !           593:                        (*s_etat_processus).erreur_systeme = d_es_processus;
        !           594:                        return;
        !           595:                    }
        !           596: 
        !           597:                    if ((*(*((struct_processus_fils *)
        !           598:                            (*s_objet).objet)).thread).thread_actif == d_vrai)
        !           599:                    {
        !           600:                        if (((pthread_equal((*(*((struct_processus_fils *)
        !           601:                                (*s_objet).objet)).thread).tid,
        !           602:                                (*(*((struct_processus_fils *)
        !           603:                                (*(*l_element_courant).donnee).objet)).thread)
        !           604:                                .tid) != 0)) && ((*(*((struct_processus_fils *)
        !           605:                                (*s_objet).objet)).thread).pid ==
        !           606:                                (*(*((struct_processus_fils *)
        !           607:                                (*(*l_element_courant).donnee).objet)).thread)
        !           608:                                .pid))
        !           609:                        {
        !           610:                            if (pthread_kill((*(*((struct_processus_fils *)
        !           611:                                    (*s_objet).objet)).thread).tid, SIGCONT)
        !           612:                                    != 0)
        !           613:                            {
        !           614:                                // Le thread est peut-être dans l'état zombie.
        !           615:                            }
        !           616: 
        !           617:                            if (pthread_mutex_unlock(
        !           618:                                    &((*(*((struct_processus_fils *)
        !           619:                                    (*s_objet).objet)).thread).mutex)) != 0)
        !           620:                            {
        !           621:                                (*s_etat_processus).erreur_systeme =
        !           622:                                        d_es_processus;
        !           623:                                return;
        !           624:                            }
        !           625: 
        !           626:                            break;
        !           627:                        }
        !           628:                    }
        !           629: 
        !           630:                    if (pthread_mutex_unlock(&((*(*((struct_processus_fils *)
        !           631:                            (*s_objet).objet)).thread).mutex)) != 0)
        !           632:                    {
        !           633:                        (*s_etat_processus).erreur_systeme = d_es_processus;
        !           634:                        return;
        !           635:                    }
        !           636:                }
        !           637: 
        !           638:                l_element_courant = (*l_element_courant).suivant;
        !           639:            }
        !           640: 
        !           641:            if (pthread_mutex_unlock(&((*s_etat_processus).mutex)) != 0)
        !           642:            {
        !           643:                (*s_etat_processus).erreur_systeme = d_es_processus;
        !           644:            }
        !           645:        }
        !           646:    }
        !           647:    else
        !           648:    {
        !           649:        liberation(s_etat_processus, s_objet);
        !           650: 
        !           651:        (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
        !           652:        return;
        !           653:    }
        !           654: 
        !           655:    liberation(s_etat_processus, s_objet);
        !           656: 
        !           657:    return;
        !           658: }
        !           659: 
        !           660: 
        !           661: /*
        !           662: ================================================================================
        !           663:   Fonction 'cstop'
        !           664: ================================================================================
        !           665:   Entrées :
        !           666: --------------------------------------------------------------------------------
        !           667:   Sorties :
        !           668: --------------------------------------------------------------------------------
        !           669:   Effets de bord : néant
        !           670: ================================================================================
        !           671: */
        !           672: 
        !           673: void
        !           674: instruction_cstop(struct_processus *s_etat_processus)
        !           675: {
        !           676:    (*s_etat_processus).erreur_execution = d_ex;
        !           677: 
        !           678:    if ((*s_etat_processus).affichage_arguments == 'Y')
        !           679:    {
        !           680:        printf("\n  CSTOP ");
        !           681: 
        !           682:        if ((*s_etat_processus).langue == 'F')
        !           683:        {
        !           684:            printf("(capture du signal stop)\n\n");
        !           685:            printf("  Aucun argument\n");
        !           686:        }
        !           687:        else
        !           688:        {
        !           689:            printf("(catch stop signal)\n\n");
        !           690:            printf("  No argument\n");
        !           691:        }
        !           692: 
        !           693:        return;
        !           694:    }
        !           695:    else if ((*s_etat_processus).test_instruction == 'Y')
        !           696:    {
        !           697:        (*s_etat_processus).nombre_arguments = -1;
        !           698:        return;
        !           699:    }
        !           700:    
        !           701:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
        !           702:    {
        !           703:        if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
        !           704:        {
        !           705:            return;
        !           706:        }
        !           707:    }
        !           708: 
        !           709:    if ((*s_etat_processus).var_volatile_traitement_retarde_stop == 0)
        !           710:    {
        !           711:        (*s_etat_processus).var_volatile_traitement_retarde_stop = 1;
        !           712:    }
        !           713:    else
        !           714:    {
        !           715:        (*s_etat_processus).erreur_execution = d_ex_stop;
        !           716:    }
        !           717: 
        !           718:    return;
        !           719: }
        !           720: 
        !           721: 
        !           722: /*
        !           723: ================================================================================
        !           724:   Fonction 'clrfuse'
        !           725: ================================================================================
        !           726:   Entrées :
        !           727: --------------------------------------------------------------------------------
        !           728:   Sorties :
        !           729: --------------------------------------------------------------------------------
        !           730:   Effets de bord : néant
        !           731: ================================================================================
        !           732: */
        !           733: 
        !           734: void
        !           735: instruction_clrfuse(struct_processus *s_etat_processus)
        !           736: {
        !           737:    (*s_etat_processus).erreur_execution = d_ex;
        !           738: 
        !           739:    if ((*s_etat_processus).affichage_arguments == 'Y')
        !           740:    {
        !           741:        printf("\n  CLRFUSE ");
        !           742: 
        !           743:        if ((*s_etat_processus).langue == 'F')
        !           744:        {
        !           745:            printf("(libère un fusible)\n\n");
        !           746:            printf("  Aucun argument\n");
        !           747:        }
        !           748:        else
        !           749:        {
        !           750:            printf("(release fuse signal)\n\n");
        !           751:            printf("  No argument\n");
        !           752:        }
        !           753: 
        !           754:        return;
        !           755:    }
        !           756:    else if ((*s_etat_processus).test_instruction == 'Y')
        !           757:    {
        !           758:        (*s_etat_processus).nombre_arguments = -1;
        !           759:        return;
        !           760:    }
        !           761:    
        !           762:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
        !           763:    {
        !           764:        if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
        !           765:        {
        !           766:            return;
        !           767:        }
        !           768:    }
        !           769: 
        !           770:    if ((*s_etat_processus).presence_fusible == d_faux)
        !           771:    {
        !           772:        (*s_etat_processus).erreur_execution = d_ex_fusible;
        !           773:        return;
        !           774:    }
        !           775: 
        !           776:    if (pthread_cancel((*s_etat_processus).thread_fusible) != 0)
        !           777:    {
        !           778:        if ((*s_etat_processus).var_volatile_requete_arret == 0)
        !           779:        {
        !           780:            (*s_etat_processus).erreur_systeme = d_es_processus;
        !           781:            return;
        !           782:        }
        !           783:    }
        !           784: 
        !           785:    (*s_etat_processus).thread_fusible = 0;
        !           786:    (*s_etat_processus).presence_fusible = d_faux;
        !           787: 
        !           788:    return;
        !           789: }
        !           790: 
        !           791: 
        !           792: /*
        !           793: ================================================================================
        !           794:   Fonction 'crtab'
        !           795: ================================================================================
        !           796:   Entrées :
        !           797: --------------------------------------------------------------------------------
        !           798:   Sorties :
        !           799: --------------------------------------------------------------------------------
        !           800:   Effets de bord : néant
        !           801: ================================================================================
        !           802: */
        !           803: 
        !           804: void
        !           805: instruction_crtab(struct_processus *s_etat_processus)
        !           806: {
        !           807:    struct_liste_chainee    *l_element_courant;
        !           808: 
        !           809:    struct_objet            *s_objet_argument;
        !           810:    struct_objet            *s_objet_resultat;
        !           811: 
        !           812:    struct_objet *
        !           813:    creation_table(struct_liste_chainee *dimensions)
        !           814:    {
        !           815:        struct_objet        *s_table;
        !           816: 
        !           817:        unsigned long       i;
        !           818: 
        !           819:        if ((s_table = allocation(s_etat_processus, TBL)) == NULL)
        !           820:        {
        !           821:            return(NULL);
        !           822:        }
        !           823: 
        !           824:        (*((struct_tableau *) (*s_table).objet)).nombre_elements =
        !           825:                (unsigned long) (*((integer8 *) (*(*dimensions).donnee).objet));
        !           826: 
        !           827:        dimensions = (*dimensions).suivant;
        !           828: 
        !           829:        if (((*((struct_tableau *) (*s_table).objet)).elements =
        !           830:                malloc((*((struct_tableau *) (*s_table).objet))
        !           831:                .nombre_elements * sizeof(struct_objet *))) == NULL)
        !           832:        {
        !           833:            return(NULL);
        !           834:        }
        !           835: 
        !           836:        if (dimensions == NULL)
        !           837:        {
        !           838:            for(i = 0; i < (*((struct_tableau *) (*s_table).objet))
        !           839:                    .nombre_elements; i++)
        !           840:            {
        !           841:                if (((*((struct_tableau *) (*s_table).objet)).elements[i] =
        !           842:                        allocation(s_etat_processus, LST)) == NULL)
        !           843:                {
        !           844:                    return(NULL);
        !           845:                }
        !           846:            }
        !           847:        }
        !           848:        else
        !           849:        {
        !           850:            for(i = 0; i < (*((struct_tableau *) (*s_table).objet))
        !           851:                    .nombre_elements; i++)
        !           852:            {
        !           853:                if (((*((struct_tableau *) (*s_table).objet)).elements[i] =
        !           854:                        creation_table(dimensions)) == NULL)
        !           855:                {
        !           856:                    return(NULL);
        !           857:                }
        !           858:            }
        !           859:        }
        !           860: 
        !           861:        return(s_table);
        !           862:    }
        !           863: 
        !           864:    (*s_etat_processus).erreur_execution = d_ex;
        !           865: 
        !           866:    if ((*s_etat_processus).affichage_arguments == 'Y')
        !           867:    {
        !           868:        printf("\n  CRTAB ");
        !           869: 
        !           870:        if ((*s_etat_processus).langue == 'F')
        !           871:        {
        !           872:            printf("(création d'une table régulière)\n\n");
        !           873:        }
        !           874:        else
        !           875:        {
        !           876:            printf("(create a regular table)\n\n");
        !           877:        }
        !           878: 
        !           879:        printf("    1: %s\n", d_LST);
        !           880:        printf("->  1: %s\n", d_TAB);
        !           881: 
        !           882:        return;
        !           883:    }
        !           884:    else if ((*s_etat_processus).test_instruction == 'Y')
        !           885:    {
        !           886:        (*s_etat_processus).nombre_arguments = -1;
        !           887:        return;
        !           888:    }
        !           889: 
        !           890:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
        !           891:    {
        !           892:        if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
        !           893:        {
        !           894:            return;
        !           895:        }
        !           896:    }
        !           897: 
        !           898:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
        !           899:            &s_objet_argument) == d_erreur)
        !           900:    {
        !           901:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
        !           902:        return;
        !           903:    }
        !           904: 
        !           905:    if ((*s_objet_argument).type == LST)
        !           906:    {
        !           907:        l_element_courant = (*s_objet_argument).objet;
        !           908: 
        !           909:        if (l_element_courant == NULL)
        !           910:        {
        !           911:            liberation(s_etat_processus, s_objet_argument);
        !           912: 
        !           913:            (*s_etat_processus).erreur_execution =
        !           914:                    d_ex_argument_invalide;
        !           915:            return;
        !           916:        }
        !           917: 
        !           918:        while(l_element_courant != NULL)
        !           919:        {
        !           920:            if ((*(*l_element_courant).donnee).type != INT)
        !           921:            {
        !           922:                liberation(s_etat_processus, s_objet_argument);
        !           923: 
        !           924:                (*s_etat_processus).erreur_execution =
        !           925:                        d_ex_erreur_type_argument;
        !           926:                return;
        !           927:            }
        !           928: 
        !           929:            l_element_courant = (*l_element_courant).suivant;
        !           930:        }
        !           931: 
        !           932:        if ((s_objet_resultat =
        !           933:                creation_table((*s_objet_argument).objet)) == NULL)
        !           934:        {
        !           935:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !           936:            return;
        !           937:        }
        !           938:    }
        !           939:    else
        !           940:    {
        !           941:        liberation(s_etat_processus, s_objet_argument);
        !           942: 
        !           943:        (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
        !           944:        return;
        !           945:    }
        !           946: 
        !           947:    if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
        !           948:            s_objet_resultat) == d_erreur)
        !           949:    {
        !           950:        (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !           951:        return;
        !           952:    }
        !           953: 
        !           954:    liberation(s_etat_processus, s_objet_argument);
        !           955: 
        !           956:    return;
        !           957: }
        !           958: 
        !           959: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>