Annotation of rpl/src/instructions_p4.c, revision 1.19

1.1       bertrand    1: /*
                      2: ================================================================================
1.17      bertrand    3:   RPL/2 (R) version 4.1.0.prerelease.0
1.15      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.11      bertrand   23: #include "rpl-conv.h"
1.1       bertrand   24: 
                     25: 
                     26: /*
                     27: ================================================================================
                     28:   Fonction 'pr1'
                     29: ================================================================================
                     30:   Entrées :
                     31: --------------------------------------------------------------------------------
                     32:   Sorties :
                     33: --------------------------------------------------------------------------------
                     34:   Effets de bord : néant
                     35: ================================================================================
                     36: */
                     37: 
                     38: void
                     39: instruction_pr1(struct_processus *s_etat_processus)
                     40: {
                     41:    struct_objet                    *s_objet;
                     42: 
                     43:    (*s_etat_processus).erreur_execution = d_ex;
                     44: 
                     45:    if ((*s_etat_processus).affichage_arguments == 'Y')
                     46:    {
                     47:        printf("\n  PR1 ");
                     48: 
                     49:        if ((*s_etat_processus).langue == 'F')
                     50:        {
                     51:            printf("(impression d'un objet)\n\n");
                     52:        }
                     53:        else
                     54:        {
                     55:            printf("(print object)\n\n");
                     56:        }
                     57: 
                     58:        printf("    1: %s, %s, %s, %s, %s, %s,\n"
                     59:                "       %s, %s, %s, %s, %s,\n"
                     60:                "       %s, %s, %s, %s, %s,\n"
                     61:                "       %s\n",
                     62:                d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX,
                     63:                d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SLB);
                     64:        printf("->  1: %s, %s, %s, %s, %s, %s,\n"
                     65:                "       %s, %s, %s, %s, %s,\n"
                     66:                "       %s, %s, %s, %s, %s,\n"
                     67:                "       %s\n",
                     68:                d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX,
                     69:                d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SLB);
                     70: 
                     71:        return;
                     72:    }
                     73:    else if ((*s_etat_processus).test_instruction == 'Y')
                     74:    {
                     75:        (*s_etat_processus).nombre_arguments = -1;
                     76:        return;
                     77:    }
                     78: 
                     79:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                     80:    {
                     81:        if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
                     82:        {
                     83:            return;
                     84:        }
                     85:    }
                     86: 
                     87:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                     88:            &s_objet) == d_erreur)
                     89:    {
                     90:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                     91:        return;
                     92:    }
                     93: 
                     94:    formateur_tex(s_etat_processus, s_objet, 'N');
                     95: 
                     96:    /*
                     97:     * La fonction pr1 ne modifie pas la pile
                     98:     */
                     99: 
                    100:    if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    101:            s_objet) == d_erreur)
                    102:    {
                    103:        return;
                    104:    }
                    105: 
                    106:    return;
                    107: }
                    108: 
                    109: 
                    110: /*
                    111: ================================================================================
                    112:   Fonction 'print'
                    113: ================================================================================
                    114:   Entrées :
                    115: --------------------------------------------------------------------------------
                    116:   Sorties :
                    117: --------------------------------------------------------------------------------
                    118:   Effets de bord : néant
                    119: ================================================================================
                    120: */
                    121: 
                    122: void
                    123: instruction_print(struct_processus *s_etat_processus)
                    124: {
                    125:    (*s_etat_processus).erreur_execution = d_ex;
                    126: 
                    127:    if ((*s_etat_processus).affichage_arguments == 'Y')
                    128:    {
                    129:        printf("\n  PRINT ");
                    130: 
                    131:        if ((*s_etat_processus).langue == 'F')
                    132:        {
                    133:            printf("(impression puis destruction de la file d'impression)"
                    134:                    "\n\n");
                    135:            printf("  Aucun argument\n");
                    136:        }
                    137:        else
                    138:        {
                    139:            printf("(print and purge the printer queue)\n\n");
                    140:            printf("  No argument\n");
                    141:        }
                    142: 
                    143:        return;
                    144:    }
                    145:    else if ((*s_etat_processus).test_instruction == 'Y')
                    146:    {
                    147:        (*s_etat_processus).nombre_arguments = -1;
                    148:        return;
                    149:    }
                    150: 
                    151:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                    152:    {
                    153:        if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
                    154:        {
                    155:            return;
                    156:        }
                    157:    }
                    158: 
                    159:    if ((*s_etat_processus).nom_fichier_impression == NULL)
                    160:    {
                    161:        (*s_etat_processus).erreur_execution = d_ex_queue_impression;
                    162:        return;
                    163:    }
                    164: 
                    165: #  ifdef POSTSCRIPT_SUPPORT
                    166:        impression_tex(s_etat_processus);
                    167: #  else
                    168:        if ((*s_etat_processus).langue == 'F')
                    169:        {
                    170:            printf("+++Attention : Support de TeX non compilé !\n");
                    171:        }
                    172:        else
                    173:        {
                    174:            printf("+++Warning : TeX not available !\n");
                    175:        }
                    176: 
                    177:        fflush(stdout);
                    178: #  endif
                    179: 
                    180:    return;
                    181: }
                    182: 
                    183: 
                    184: /*
                    185: ================================================================================
                    186:   Fonction 'prst'
                    187: ================================================================================
                    188:   Entrées :
                    189: --------------------------------------------------------------------------------
                    190:   Sorties :
                    191: --------------------------------------------------------------------------------
                    192:   Effets de bord : néant
                    193: ================================================================================
                    194: */
                    195: 
                    196: void
                    197: instruction_prst(struct_processus *s_etat_processus)
                    198: {
                    199:    (*s_etat_processus).erreur_execution = d_ex;
                    200: 
                    201:    if ((*s_etat_processus).affichage_arguments == 'Y')
                    202:    {
                    203:        printf("\n  PRST ");
                    204: 
                    205:        if ((*s_etat_processus).langue == 'F')
                    206:        {
                    207:            printf("(imprime la pile opérationnelle)\n\n");
                    208:        }
                    209:        else
                    210:        {
                    211:            printf("(print stack)\n\n");
                    212:        }
                    213: 
                    214:        printf("    n: %s, %s, %s, %s, %s, %s,\n"
                    215:                "       %s, %s, %s, %s, %s,\n"
                    216:                "       %s, %s, %s, %s, %s,\n"
                    217:                "       %s\n",
                    218:                d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX,
                    219:                d_MIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SLB);
                    220:        printf("    ...\n");
                    221:        printf("    1: %s, %s, %s, %s, %s, %s,\n"
                    222:                "       %s, %s, %s, %s, %s,\n"
                    223:                "       %s, %s, %s, %s, %s,\n"
                    224:                "       %s\n",
                    225:                d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX,
                    226:                d_MIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SLB);
                    227:        printf("->  n: %s, %s, %s, %s, %s, %s,\n"
                    228:                "       %s, %s, %s, %s, %s,\n"
                    229:                "       %s, %s, %s, %s, %s,\n"
                    230:                "       %s\n",
                    231:                d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX,
                    232:                d_MIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SLB);
                    233:        printf("    ...\n");
                    234:        printf("    1: %s, %s, %s, %s, %s, %s,\n"
                    235:                "       %s, %s, %s, %s, %s,\n"
                    236:                "       %s, %s, %s, %s, %s,\n"
                    237:                "       %s\n",
                    238:                d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX,
                    239:                d_MIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SLB);
                    240: 
                    241:        return;
                    242:    }
                    243:    else if ((*s_etat_processus).test_instruction == 'Y')
                    244:    {
                    245:        (*s_etat_processus).nombre_arguments = -1;
                    246:        return;
                    247:    }
                    248: 
                    249:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                    250:    {
                    251:        if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
                    252:        {
                    253:            return;
                    254:        }
                    255:    }
                    256: 
                    257:    impression_pile(s_etat_processus, (*s_etat_processus).l_base_pile,
                    258:            'E', 1);
                    259:    return;
                    260: }
                    261: 
                    262: 
                    263: /*
                    264: ================================================================================
                    265:   Fonction 'prstc'
                    266: ================================================================================
                    267:   Entrées :
                    268: --------------------------------------------------------------------------------
                    269:   Sorties :
                    270: --------------------------------------------------------------------------------
                    271:   Effets de bord : néant
                    272: ================================================================================
                    273: */
                    274: 
                    275: void
                    276: instruction_prstc(struct_processus *s_etat_processus)
                    277: {
                    278:    (*s_etat_processus).erreur_execution = d_ex;
                    279: 
                    280:    if ((*s_etat_processus).affichage_arguments == 'Y')
                    281:    {
                    282:        printf("\n  PRSTC ");
                    283: 
                    284:        if ((*s_etat_processus).langue == 'F')
                    285:        {
                    286:            printf("(imprime la pile opérationnelle en mode compact)\n\n");
                    287:        }
                    288:        else
                    289:        {
                    290:            printf("(print stack in compact mode)\n\n");
                    291:        }
                    292: 
                    293:        printf("    n: %s, %s, %s, %s, %s, %s,\n"
                    294:                "       %s, %s, %s, %s, %s,\n"
                    295:                "       %s, %s, %s, %s, %s,\n"
                    296:                "       %s\n",
                    297:                d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX,
                    298:                d_MIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SLB);
                    299:        printf("    ...\n");
                    300:        printf("    1: %s, %s, %s, %s, %s, %s,\n"
                    301:                "       %s, %s, %s, %s, %s,\n"
                    302:                "       %s, %s, %s, %s, %s,\n"
                    303:                "       %s\n",
                    304:                d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX,
                    305:                d_MIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SLB);
                    306:        printf("->  n: %s, %s, %s, %s, %s, %s,\n"
                    307:                "       %s, %s, %s, %s, %s,\n"
                    308:                "       %s, %s, %s, %s, %s,\n"
                    309:                "       %s\n",
                    310:                d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX,
                    311:                d_MIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SLB);
                    312:        printf("    ...\n");
                    313:        printf("    1: %s, %s, %s, %s, %s, %s,\n"
                    314:                "       %s, %s, %s, %s, %s,\n"
                    315:                "       %s, %s, %s, %s, %s,\n"
                    316:                "       %s\n",
                    317:                d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX,
                    318:                d_MIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SLB);
                    319: 
                    320:        return;
                    321:    }
                    322:    else if ((*s_etat_processus).test_instruction == 'Y')
                    323:    {
                    324:        (*s_etat_processus).nombre_arguments = -1;
                    325:        return;
                    326:    }
                    327: 
                    328:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                    329:    {
                    330:        if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
                    331:        {
                    332:            return;
                    333:        }
                    334:    }
                    335: 
                    336:    impression_pile(s_etat_processus, (*s_etat_processus).l_base_pile,
                    337:            'C', 1);
                    338:    return;
                    339: }
                    340: 
                    341: 
                    342: /*
                    343: ================================================================================
                    344:   Fonction 'prvar'
                    345: ================================================================================
                    346:   Entrées :
                    347: --------------------------------------------------------------------------------
                    348:   Sorties :
                    349: --------------------------------------------------------------------------------
                    350:   Effets de bord : néant
                    351: ================================================================================
                    352: */
                    353: 
                    354: void
                    355: instruction_prvar(struct_processus *s_etat_processus)
                    356: {
                    357:    struct_objet                    *s_objet;
                    358: 
                    359:    (*s_etat_processus).erreur_execution = d_ex;
                    360: 
                    361:    if ((*s_etat_processus).affichage_arguments == 'Y')
                    362:    {
                    363:        printf("\n  PRVAR ");
                    364: 
                    365:        if ((*s_etat_processus).langue == 'F')
                    366:        {
                    367:            printf("(imprime le contenu d'une variable)\n\n");
                    368:        }
                    369:        else
                    370:        {
                    371:            printf("(print variable)\n\n");
                    372:        }
                    373: 
                    374:        printf("    1: %s\n", d_NOM);
                    375: 
                    376:        return;
                    377:    }
                    378:    else if ((*s_etat_processus).test_instruction == 'Y')
                    379:    {
                    380:        (*s_etat_processus).nombre_arguments = -1;
                    381:        return;
                    382:    }
                    383: 
                    384:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                    385:    {
                    386:        if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
                    387:        {
                    388:            return;
                    389:        }
                    390:    }
                    391: 
                    392:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    393:            &s_objet) == d_erreur)
                    394:    {
                    395:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                    396:        return;
                    397:    }
                    398: 
                    399:    if ((*s_objet).type != NOM)
                    400:    {
                    401:        liberation(s_etat_processus, s_objet);
                    402: 
                    403:        (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
                    404:        return;
                    405:    }
                    406: 
                    407:    if (recherche_variable(s_etat_processus, (*((struct_nom *)
                    408:            (*s_objet).objet)).nom) == d_faux)
                    409:    {
                    410:        (*s_etat_processus).erreur_systeme = d_es;
                    411:        (*s_etat_processus).erreur_execution = d_ex_variable_non_definie;
                    412: 
                    413:        liberation(s_etat_processus, s_objet);
                    414:        return;
                    415:    }
                    416: 
1.19    ! bertrand  417:    if ((*(*s_etat_processus).pointeur_variable_courante).objet != NULL)
1.1       bertrand  418:    {
1.19    ! bertrand  419:        formateur_tex(s_etat_processus, (*(*s_etat_processus)
        !           420:                .pointeur_variable_courante).objet, 'N');
1.1       bertrand  421:    }
                    422:    else
                    423:    {
                    424:        if (pthread_mutex_lock(&((*(*s_etat_processus)
                    425:                .s_liste_variables_partagees).mutex)) != 0)
                    426:        {
                    427:            (*s_etat_processus).erreur_systeme = d_es_processus;
                    428:            return;
                    429:        }
                    430: 
                    431:        if (recherche_variable_partagee(s_etat_processus,
1.19    ! bertrand  432:                (*(*s_etat_processus).pointeur_variable_courante).nom,
        !           433:                (*(*s_etat_processus).pointeur_variable_courante)
        !           434:                .variable_partagee, (*(*s_etat_processus)
        !           435:                .pointeur_variable_courante).origine) == d_faux)
1.1       bertrand  436:        {
                    437:            if (pthread_mutex_unlock(&((*(*s_etat_processus)
                    438:                    .s_liste_variables_partagees).mutex)) != 0)
                    439:            {
                    440:                (*s_etat_processus).erreur_systeme = d_es_processus;
                    441:                return;
                    442:            }
                    443: 
                    444:            (*s_etat_processus).erreur_systeme = d_es;
                    445:            (*s_etat_processus).erreur_execution = d_ex_variable_non_definie;
                    446: 
                    447:            liberation(s_etat_processus, s_objet);
                    448:            return;
                    449:        }
                    450: 
                    451:        formateur_tex(s_etat_processus, (*(*s_etat_processus)
                    452:                .s_liste_variables_partagees).table
                    453:                [(*(*s_etat_processus).s_liste_variables_partagees)
                    454:                .position_variable].objet, 'N');
                    455: 
                    456:        if (pthread_mutex_unlock(&((*(*s_etat_processus)
                    457:                .s_liste_variables_partagees).mutex)) != 0)
                    458:        {
                    459:            (*s_etat_processus).erreur_systeme = d_es_processus;
                    460:            return;
                    461:        }
                    462:    }
                    463: 
                    464:    liberation(s_etat_processus, s_objet);
                    465: 
                    466:    return;
                    467: }
                    468: 
                    469: 
                    470: /*
                    471: ================================================================================
                    472:   Fonction 'prusr'
                    473: ================================================================================
                    474:   Entrées :
                    475: --------------------------------------------------------------------------------
                    476:   Sorties :
                    477: --------------------------------------------------------------------------------
                    478:   Effets de bord : néant
                    479: ================================================================================
                    480: */
                    481: 
                    482: void
                    483: instruction_prusr(struct_processus *s_etat_processus)
                    484: {
                    485:    struct_objet                s_objet;
                    486: 
                    487:    (*s_etat_processus).erreur_execution = d_ex;
                    488: 
                    489:    if ((*s_etat_processus).affichage_arguments == 'Y')
                    490:    {
                    491:        printf("\n  PRUSR ");
                    492: 
                    493:        if ((*s_etat_processus).langue == 'F')
                    494:        {
                    495:            printf("(impression de toutes les variables utilisateur)\n\n");
                    496:            printf("  Aucun argument\n");
                    497:        }
                    498:        else
                    499:        {
                    500:            printf("(print all user variables)\n\n");
                    501:            printf("  No argument\n");
                    502:        }
                    503: 
                    504:        return;
                    505:    }
                    506:    else if ((*s_etat_processus).test_instruction == 'Y')
                    507:    {
                    508:        (*s_etat_processus).nombre_arguments = -1;
                    509:        return;
                    510:    }
                    511: 
                    512:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                    513:    {
                    514:        if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
                    515:        {
                    516:            return;
                    517:        }
                    518:    }
                    519: 
                    520:    s_objet.type = CHN;
                    521: 
1.19    ! bertrand  522:    /*
1.1       bertrand  523:    for(i = 0; i < (*s_etat_processus).nombre_variables; i++)
                    524:    {
                    525:        if ((s_objet.objet = malloc((strlen((*s_etat_processus)
                    526:                .s_liste_variables[i].nom) + 64) * sizeof(unsigned char)))
                    527:                == NULL)
                    528:        {
                    529:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    530:            return;
                    531:        }
                    532: 
                    533:        sprintf((unsigned char *) s_objet.objet, "\\noindent %s [%lu]\n",
                    534:                (*s_etat_processus).s_liste_variables[i].nom,
                    535:                (*s_etat_processus).s_liste_variables[i].niveau);
                    536: 
                    537:        formateur_tex(s_etat_processus, &s_objet, 'N');
                    538:        free(s_objet.objet);
                    539:    }
1.19    ! bertrand  540:    */
1.1       bertrand  541: 
                    542:    return;
                    543: }
                    544: 
                    545: 
                    546: /*
                    547: ================================================================================
                    548:   Fonction 'prmd'
                    549: ================================================================================
                    550:   Entrées :
                    551: --------------------------------------------------------------------------------
                    552:   Sorties :
                    553: --------------------------------------------------------------------------------
                    554:   Effets de bord : néant
                    555: ================================================================================
                    556: */
                    557: 
                    558: void
                    559: instruction_prmd(struct_processus *s_etat_processus)
                    560: {
                    561:    long                        longueur_utile;
                    562:    long                        longueur_utile_limite;
                    563: 
                    564:    struct_objet                s_objet;
                    565: 
                    566:    unsigned long               i;
                    567:    unsigned long               j;
                    568: 
                    569:    (*s_etat_processus).erreur_execution = d_ex;
                    570: 
                    571:    if ((*s_etat_processus).affichage_arguments == 'Y')
                    572:    {
                    573:        printf("\n  PRMD ");
                    574: 
                    575:        if ((*s_etat_processus).langue == 'F')
                    576:        {
                    577:            printf("(impression de l'état du séquenceur)\n\n");
                    578:            printf("  Aucun argument\n");
                    579:        }
                    580:        else
                    581:        {
                    582:            printf("(print sequencer state)\n\n");
                    583:            printf("  No argument\n");
                    584:        }
                    585: 
                    586:        return;
                    587:    }
                    588:    else if ((*s_etat_processus).test_instruction == 'Y')
                    589:    {
                    590:        (*s_etat_processus).nombre_arguments = -1;
                    591:        return;
                    592:    }
                    593: 
                    594:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                    595:    {
                    596:        if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
                    597:        {
                    598:            return;
                    599:        }
                    600:    }
                    601: 
                    602:    s_objet.type = CHN;
                    603: 
                    604:    if ((s_objet.objet = malloc(128 * sizeof(unsigned char))) == NULL)
                    605:    {
                    606:        (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    607:        return;
                    608:    }
                    609: 
                    610:    longueur_utile = 0;
                    611:    j = 1;
                    612: 
                    613:    for(i = 53; i <= 56; i++)
                    614:    {
                    615:        longueur_utile += (test_cfsf(s_etat_processus, (unsigned char) i)
                    616:                == d_vrai) ? j : 0;
                    617:        j *= 2;
                    618:    }
                    619: 
                    620:    longueur_utile_limite = 12;
                    621: 
                    622:    if (longueur_utile > longueur_utile_limite)
                    623:    {
                    624:        longueur_utile = longueur_utile_limite;
                    625:    }
                    626: 
                    627:    if ((test_cfsf(s_etat_processus, 49) == d_faux) &&
                    628:            (test_cfsf(s_etat_processus, 50) == d_faux))
                    629:    {
                    630:        if ((*s_etat_processus).langue == 'F')
                    631:        {
                    632:            sprintf((unsigned char *) s_objet.objet,
                    633:                    "\\noindent Mode d'affichage numérique: standard\n");
                    634:        }
                    635:        else
                    636:        {
                    637:            sprintf((unsigned char *) s_objet.objet,
                    638:                    "\\noindent Numerical mode: standard\n");
                    639:        }
                    640:    }
                    641:    else if ((test_cfsf(s_etat_processus, 49) == d_faux) &&
                    642:            (test_cfsf(s_etat_processus, 50) == d_vrai))
                    643:    {
                    644:        if ((*s_etat_processus).langue == 'F')
                    645:        {
                    646:            sprintf((unsigned char *) s_objet.objet,
                    647:                    "\\noindent Mode d'affichage numérique: "
                    648:                    "scientifique (%ld)\n", longueur_utile);
                    649:        }
                    650:        else
                    651:        {
                    652:            sprintf((unsigned char *) s_objet.objet,
                    653:                    "\\noindent Numerical mode: scientific (%ld)\n",
                    654:                    longueur_utile);
                    655:        }
                    656:    }
                    657:    else if ((test_cfsf(s_etat_processus, 49) == d_vrai) &&
                    658:            (test_cfsf(s_etat_processus, 50) == d_faux))
                    659:    {
                    660:        if ((*s_etat_processus).langue == 'F')
                    661:        {
                    662:            sprintf((unsigned char *) s_objet.objet,
                    663:                    "\\noindent Mode d'affichage numérique: "
                    664:                    "virgule fixe (%ld)\n", longueur_utile);
                    665:        }
                    666:        else
                    667:        {
                    668:            sprintf((unsigned char *) s_objet.objet,
                    669:                    "\\noindent Numerical mode: fixed point (%ld)\n", longueur_utile);
                    670:        }
                    671:    }
                    672:    else 
                    673:    {
                    674:        if ((*s_etat_processus).langue == 'F')
                    675:        {
                    676:            sprintf((unsigned char *) s_objet.objet,
                    677:                    "\\noindent Mode d'affichage numérique: notation ingénieur "
                    678:                    "(%ld)\n", longueur_utile);
                    679:        }
                    680:        else
                    681:        {
                    682:            sprintf((unsigned char *) s_objet.objet,
                    683:                    "\\noindent Numerical mode: engineer "
                    684:                    "(%ld)\n", longueur_utile);
                    685:        }
                    686:    }
                    687: 
                    688: 
                    689:    formateur_tex(s_etat_processus, &s_objet, 'N');
                    690:    free(s_objet.objet);
                    691: 
                    692:    if ((s_objet.objet = malloc(128 * sizeof(unsigned char))) == NULL)
                    693:    {
                    694:        (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    695:        return;
                    696:    }
                    697: 
                    698:    if ((*s_etat_processus).langue == 'F')
                    699:    {
                    700:        sprintf((unsigned char *) s_objet.objet,
                    701:                "\\noindent \\'Echelle angulaire: %s\n",
                    702:                (test_cfsf(s_etat_processus, 60) == d_faux)
                    703:                ? "degrés" : "radians");
                    704:    }
                    705:    else
                    706:    {
                    707:        sprintf((unsigned char *) s_objet.objet,
                    708:                "\\noindent Angular scale: %s\n",
                    709:                (test_cfsf(s_etat_processus, 60) == d_faux)
                    710:                ? "degrees" : "radians");
                    711:    }
                    712: 
                    713:    formateur_tex(s_etat_processus, &s_objet, 'N');
                    714:    free(s_objet.objet);
                    715: 
                    716:    if ((s_objet.objet = malloc(128 * sizeof(unsigned char))) == NULL)
                    717:    {
                    718:        (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    719:        return;
                    720:    }
                    721: 
                    722:    if ((test_cfsf(s_etat_processus, 43) == d_faux) &&
                    723:            (test_cfsf(s_etat_processus, 44) == d_faux))
                    724:    {
                    725:        if ((*s_etat_processus).langue == 'F')
                    726:        {
                    727:            sprintf((unsigned char *) s_objet.objet,
                    728:                    "\\noindent Base des entiers : décimale\n");
                    729:        }
                    730:        else
                    731:        {
                    732:            sprintf((unsigned char *) s_objet.objet,
                    733:                    "\\noindent Integer base: decimal\n");
                    734:        }
                    735:    }
                    736:    else if ((test_cfsf(s_etat_processus, 43) == d_vrai) &&
                    737:            (test_cfsf(s_etat_processus, 44) == d_faux))
                    738:    {
                    739:        if ((*s_etat_processus).langue == 'F')
                    740:        {
                    741:            sprintf((unsigned char *) s_objet.objet,
                    742:                    "\\noindent Base des entiers : octale\n");
                    743:        }
                    744:        else
                    745:        {
                    746:            sprintf((unsigned char *) s_objet.objet,
                    747:                    "\\noindent Integer base: octal\n");
                    748:        }
                    749:    }
                    750:    else if ((test_cfsf(s_etat_processus, 43) == d_vrai) &&
                    751:            (test_cfsf(s_etat_processus, 44) == d_vrai))
                    752:    {
                    753:        if ((*s_etat_processus).langue == 'F')
                    754:        {
                    755:            sprintf((unsigned char *) s_objet.objet,
                    756:                    "\\noindent Base des entiers : hexadécimale\n");
                    757:        }
                    758:        else
                    759:        {
                    760:            sprintf((unsigned char *) s_objet.objet,
                    761:                    "\\noindent Integer base: hexadecimal\n");
                    762:        }
                    763:    }
                    764:    else
                    765:    {
                    766:        if ((*s_etat_processus).langue == 'F')
                    767:        {
                    768:            sprintf((unsigned char *) s_objet.objet,
                    769:                    "\\noindent Base des entiers : binaire\n");
                    770:        }
                    771:        else
                    772:        {
                    773:            sprintf((unsigned char *) s_objet.objet,
                    774:                    "\\noindent Integer base: binary\n");
                    775:        }
                    776:    }
                    777:    
                    778:    formateur_tex(s_etat_processus, &s_objet, 'N');
                    779:    free(s_objet.objet);
                    780: 
                    781:    if ((s_objet.objet = malloc(128 * sizeof(unsigned char))) == NULL)
                    782:    {
                    783:        (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    784:        return;
                    785:    }
                    786: 
                    787:    if ((*s_etat_processus).langue == 'F')
                    788:    {
                    789:        sprintf((unsigned char *) s_objet.objet,
                    790:                "\\noindent Longueur des entiers : %d bits\n",
                    791:                longueur_entiers_binaires(s_etat_processus));
                    792:    }
                    793:    else
                    794:    {
                    795:        sprintf((unsigned char *) s_objet.objet,
                    796:                "\\noindent Length of integers: %d bits\n",
                    797:                longueur_entiers_binaires(s_etat_processus));
                    798:    }
                    799: 
                    800:    formateur_tex(s_etat_processus, &s_objet, 'N');
                    801:    free(s_objet.objet);
                    802: 
                    803:    if ((s_objet.objet = malloc(128 * sizeof(unsigned char))) == NULL)
                    804:    {
                    805:        (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    806:        return;
                    807:    }
                    808: 
                    809:    if ((*s_etat_processus).langue == 'F')
                    810:    {
                    811:        sprintf((unsigned char *) s_objet.objet,
                    812:                "\\noindent Séparateur décimal: %s\n",
                    813:                (test_cfsf(s_etat_processus, 48) == d_faux)
                    814:                ? "point" : "virgule");
                    815:    }
                    816:    else
                    817:    {
                    818:        sprintf((unsigned char *) s_objet.objet,
                    819:                "\\noindent Radix: %s\n",
                    820:                (test_cfsf(s_etat_processus, 48) == d_faux)
                    821:                ? "period" : "coma");
                    822:    }
                    823: 
                    824:    formateur_tex(s_etat_processus, &s_objet, 'N');
                    825:    free(s_objet.objet);
                    826: 
                    827:    return;
                    828: }
                    829: 
                    830: 
                    831: /*
                    832: ================================================================================
                    833:   Fonction 'pmin'
                    834: ================================================================================
                    835:   Entrées :
                    836: --------------------------------------------------------------------------------
                    837:   Sorties :
                    838: --------------------------------------------------------------------------------
                    839:   Effets de bord : néant
                    840: ================================================================================
                    841: */
                    842: 
                    843: void
                    844: instruction_pmin(struct_processus *s_etat_processus)
                    845: {
                    846:    struct_objet                    *s_objet;
                    847: 
                    848:    (*s_etat_processus).erreur_execution = d_ex;
                    849: 
                    850:    if ((*s_etat_processus).affichage_arguments == 'Y')
                    851:    {
                    852:        printf("\n  PMIN ");
                    853: 
                    854:        if ((*s_etat_processus).langue == 'F')
                    855:        {
                    856:            printf("(minima d'un graphique 2D)\n\n");
                    857:        }
                    858:        else
                    859:        {
                    860:            printf("(2D-graphic minima)\n\n");
                    861:        }
                    862: 
                    863:        printf("    1: %s\n", d_CPL);
                    864: 
                    865:        return;
                    866:    }
                    867:    else if ((*s_etat_processus).test_instruction == 'Y')
                    868:    {
                    869:        (*s_etat_processus).nombre_arguments = -1;
                    870:        return;
                    871:    }
                    872: 
                    873:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                    874:    {
                    875:        if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
                    876:        {
                    877:            return;
                    878:        }
                    879:    }
                    880: 
                    881:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    882:            &s_objet) == d_erreur)
                    883:    {
                    884:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                    885:        return;
                    886:    }
                    887: 
                    888:    if ((*s_objet).type == CPL)
                    889:    {
                    890:        if ((*s_etat_processus).systeme_axes == 0)
                    891:        {
                    892:            (*s_etat_processus).x_min = (*((complex16 *) (*s_objet).objet))
                    893:                    .partie_reelle;
                    894:            (*s_etat_processus).y_min = (*((complex16 *) (*s_objet).objet))
                    895:                    .partie_imaginaire;
                    896:        }
                    897:        else
                    898:        {
                    899:            (*s_etat_processus).x2_min = (*((complex16 *) (*s_objet).objet))
                    900:                    .partie_reelle;
                    901:            (*s_etat_processus).y2_min = (*((complex16 *) (*s_objet).objet))
                    902:                    .partie_imaginaire;
                    903:        }
                    904:    }
                    905:    else
                    906:    {
                    907:        liberation(s_etat_processus, s_objet);
                    908: 
                    909:        (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
                    910:        return;
                    911:    }
                    912: 
                    913:    liberation(s_etat_processus, s_objet);
                    914: 
                    915:    if (test_cfsf(s_etat_processus, 52) == d_faux)
                    916:    {
                    917:        if ((*s_etat_processus).fichiers_graphiques != NULL)
                    918:        {
                    919:            appel_gnuplot(s_etat_processus, 'N');
                    920:        }
                    921:    }
                    922: 
                    923:    return;
                    924: }
                    925: 
                    926: 
                    927: /*
                    928: ================================================================================
                    929:   Fonction 'pmax'
                    930: ================================================================================
                    931:   Entrées :
                    932: --------------------------------------------------------------------------------
                    933:   Sorties :
                    934: --------------------------------------------------------------------------------
                    935:   Effets de bord : néant
                    936: ================================================================================
                    937: */
                    938: 
                    939: void
                    940: instruction_pmax(struct_processus *s_etat_processus)
                    941: {
                    942:    struct_objet                    *s_objet;
                    943: 
                    944:    (*s_etat_processus).erreur_execution = d_ex;
                    945: 
                    946:    if ((*s_etat_processus).affichage_arguments == 'Y')
                    947:    {
                    948:        printf("\n  PMAX ");
                    949: 
                    950:        if ((*s_etat_processus).langue == 'F')
                    951:        {
                    952:            printf("(maxima d'un graphique 2D)\n\n");
                    953:        }
                    954:        else
                    955:        {
                    956:            printf("(2D-graphic maxima)\n\n");
                    957:        }
                    958: 
                    959:        printf("    1: %s\n", d_CPL);
                    960: 
                    961:        return;
                    962:    }
                    963:    else if ((*s_etat_processus).test_instruction == 'Y')
                    964:    {
                    965:        (*s_etat_processus).nombre_arguments = -1;
                    966:        return;
                    967:    }
                    968: 
                    969:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                    970:    {
                    971:        if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
                    972:        {
                    973:            return;
                    974:        }
                    975:    }
                    976: 
                    977:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    978:            &s_objet) == d_erreur)
                    979:    {
                    980:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                    981:        return;
                    982:    }
                    983: 
                    984:    if ((*s_objet).type == CPL)
                    985:    {
                    986:        if ((*s_etat_processus).systeme_axes == 0)
                    987:        {
                    988:            (*s_etat_processus).x_max = (*((complex16 *) (*s_objet).objet))
                    989:                    .partie_reelle;
                    990:            (*s_etat_processus).y_max = (*((complex16 *) (*s_objet).objet))
                    991:                    .partie_imaginaire;
                    992:        }
                    993:        else
                    994:        {
                    995:            (*s_etat_processus).x2_max = (*((complex16 *) (*s_objet).objet))
                    996:                    .partie_reelle;
                    997:            (*s_etat_processus).y2_max = (*((complex16 *) (*s_objet).objet))
                    998:                    .partie_imaginaire;
                    999:        }
                   1000:    }
                   1001:    else
                   1002:    {
                   1003:        liberation(s_etat_processus, s_objet);
                   1004: 
                   1005:        (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
                   1006:        return;
                   1007:    }
                   1008: 
                   1009:    liberation(s_etat_processus, s_objet);
                   1010: 
                   1011:    if (test_cfsf(s_etat_processus, 52) == d_faux)
                   1012:    {
                   1013:        if ((*s_etat_processus).fichiers_graphiques != NULL)
                   1014:        {
                   1015:            appel_gnuplot(s_etat_processus, 'N');
                   1016:        }
                   1017:    }
                   1018: 
                   1019:    return;
                   1020: }
                   1021: 
                   1022: 
                   1023: /*
                   1024: ================================================================================
                   1025:   Fonction 'persist'
                   1026: ================================================================================
                   1027:   Entrées :
                   1028: --------------------------------------------------------------------------------
                   1029:   Sorties :
                   1030: --------------------------------------------------------------------------------
                   1031:   Effets de bord : néant
                   1032: ================================================================================
                   1033: */
                   1034: 
                   1035: void
                   1036: instruction_persist(struct_processus *s_etat_processus)
                   1037: {
                   1038:    (*s_etat_processus).erreur_execution = d_ex;
                   1039: 
                   1040:    if ((*s_etat_processus).affichage_arguments == 'Y')
                   1041:    {
                   1042:        printf("\n  PERSIST ");
                   1043: 
                   1044:        if ((*s_etat_processus).langue == 'F')
                   1045:        {
                   1046:            printf("(détachement d'un graphique)\n\n");
                   1047:            printf("  Aucun argument\n");
                   1048:        }
                   1049:        else
                   1050:        {
                   1051:            printf("(spawn a graphic output)\n\n");
                   1052:            printf("  No argument\n");
                   1053:        }
                   1054: 
                   1055:        return;
                   1056:    }
                   1057:    else if ((*s_etat_processus).test_instruction == 'Y')
                   1058:    {
                   1059:        (*s_etat_processus).nombre_arguments = -1;
                   1060:        return;
                   1061:    }
                   1062: 
                   1063:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                   1064:    {
                   1065:        if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
                   1066:        {
                   1067:            return;
                   1068:        }
                   1069:    }
                   1070: 
                   1071:    appel_gnuplot(s_etat_processus, 'E');
                   1072: 
                   1073:    return;
                   1074: }
                   1075: 
                   1076: 
                   1077: /*
                   1078: ================================================================================
                   1079:   Fonction 'polar' (passe en mode d'affichage r=f(t))
                   1080: ================================================================================
                   1081:   Entrées : structure processus
                   1082: --------------------------------------------------------------------------------
                   1083:   Sorties :
                   1084: --------------------------------------------------------------------------------
                   1085:   Effets de bord : néant
                   1086: ================================================================================
                   1087: */
                   1088: 
                   1089: void
                   1090: instruction_polar(struct_processus *s_etat_processus)
                   1091: {
                   1092:    (*s_etat_processus).erreur_execution = d_ex;
                   1093: 
                   1094:    if ((*s_etat_processus).affichage_arguments == 'Y')
                   1095:    {
                   1096:        printf("\n  POLAR ");
                   1097: 
                   1098:        if ((*s_etat_processus).langue == 'F')
                   1099:        {
                   1100:            printf("(tracé théta=f(r))\n\n");
                   1101:            printf("  Aucun argument\n");
                   1102:        }
                   1103:        else
                   1104:        {
                   1105:            printf("(plot theta=f(r))\n\n");
                   1106:            printf("  No argument\n");
                   1107:        }
                   1108: 
                   1109:        return;
                   1110:    }
                   1111:    else if ((*s_etat_processus).test_instruction == 'Y')
                   1112:    {
                   1113:        (*s_etat_processus).nombre_arguments = -1;
                   1114:        return;
                   1115:    }
                   1116:    
                   1117:    strcpy((*s_etat_processus).type_trace_eq, "POLAIRE");
                   1118: 
                   1119:    return;
                   1120: }
                   1121: 
                   1122: 
                   1123: /*
                   1124: ================================================================================
                   1125:   Fonction 'parametric' (passe en mode d'affichage r=f(t))
                   1126: ================================================================================
                   1127:   Entrées : structure processus
                   1128: --------------------------------------------------------------------------------
                   1129:   Sorties :
                   1130: --------------------------------------------------------------------------------
                   1131:   Effets de bord : néant
                   1132: ================================================================================
                   1133: */
                   1134: 
                   1135: void
                   1136: instruction_parametric(struct_processus *s_etat_processus)
                   1137: {
                   1138:    (*s_etat_processus).erreur_execution = d_ex;
                   1139: 
                   1140:    if ((*s_etat_processus).affichage_arguments == 'Y')
                   1141:    {
                   1142:        printf("\n  PARAMETRIC ");
                   1143: 
                   1144:        if ((*s_etat_processus).langue == 'F')
                   1145:        {
                   1146:            printf("(tracé (x,y)=f(t)+i*g(t))\n\n");
                   1147:            printf("  Aucun argument\n");
                   1148:        }
                   1149:        else
                   1150:        {
                   1151:            printf("(plot (x,y)=f(t)+i*g(t))\n\n");
                   1152:            printf("  No argument\n");
                   1153:        }
                   1154: 
                   1155:        return;
                   1156:    }
                   1157:    else if ((*s_etat_processus).test_instruction == 'Y')
                   1158:    {
                   1159:        (*s_etat_processus).nombre_arguments = -1;
                   1160:        return;
                   1161:    }
                   1162:    
                   1163:    strcpy((*s_etat_processus).type_trace_eq, "PARAMETRIQUE");
                   1164: 
                   1165:    return;
                   1166: }
                   1167: 
                   1168: 
                   1169: /*
                   1170: ================================================================================
                   1171:   Fonction 'perm'
                   1172: ================================================================================
                   1173:   Entrées :
                   1174: --------------------------------------------------------------------------------
                   1175:   Sorties :
                   1176: --------------------------------------------------------------------------------
                   1177:   Effets de bord : néant
                   1178: ================================================================================
                   1179: */
                   1180: 
                   1181: void
                   1182: instruction_perm(struct_processus *s_etat_processus)
                   1183: {
                   1184:    integer8                        k;
                   1185:    integer8                        n;
                   1186:    integer8                        cint_max;
                   1187: 
                   1188:    real8                           c;
                   1189: 
                   1190:    struct_objet                    *s_objet_argument_1;
                   1191:    struct_objet                    *s_objet_argument_2;
                   1192:    struct_objet                    *s_objet_resultat;
                   1193: 
                   1194:    unsigned long                   i;
                   1195: 
                   1196:    (*s_etat_processus).erreur_execution = d_ex;
                   1197: 
                   1198:    if ((*s_etat_processus).affichage_arguments == 'Y')
                   1199:    {
                   1200:        printf("\n  PERM ");
                   1201: 
                   1202:        if ((*s_etat_processus).langue == 'F')
                   1203:        {
                   1204:            printf("(permutation)\n\n");
                   1205:        }
                   1206:        else
                   1207:        {
                   1208:            printf("(permutation)\n\n");
                   1209:        }
                   1210: 
                   1211:        printf("    2: %s\n", d_INT);
                   1212:        printf("    1: %s\n", d_INT);
                   1213:        printf("->  1: %s, %s\n", d_INT, d_REL);
                   1214: 
                   1215:        return;
                   1216:    }
                   1217:    else if ((*s_etat_processus).test_instruction == 'Y')
                   1218:    {
                   1219:        (*s_etat_processus).nombre_arguments = 2;
                   1220:        return;
                   1221:    }
                   1222:    
                   1223:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                   1224:    {
                   1225:        if (empilement_pile_last(s_etat_processus, 2) == d_erreur)
                   1226:        {
                   1227:            return;
                   1228:        }
                   1229:    }
                   1230: 
                   1231:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   1232:            &s_objet_argument_1) == d_erreur)
                   1233:    {
                   1234:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                   1235:        return;
                   1236:    }
                   1237: 
                   1238:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   1239:            &s_objet_argument_2) == d_erreur)
                   1240:    {
                   1241:        liberation(s_etat_processus, s_objet_argument_1);
                   1242: 
                   1243:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                   1244:        return;
                   1245:    }
                   1246: 
                   1247:    if (((*s_objet_argument_1).type == INT) &&
                   1248:            ((*s_objet_argument_2).type == INT))
                   1249:    {
                   1250:        n = (*((integer8 *) (*s_objet_argument_2).objet));
                   1251:        k = (*((integer8 *) (*s_objet_argument_1).objet));
                   1252: 
                   1253:        if ((n < 0) || (k < 0) || (k > n))
                   1254:        {
                   1255:            liberation(s_etat_processus, s_objet_argument_1);
                   1256:            liberation(s_etat_processus, s_objet_argument_2);
                   1257: 
                   1258:            (*s_etat_processus).erreur_execution = d_ex_argument_invalide;
                   1259:            return;
                   1260:        }
                   1261: 
                   1262:        f90arrangement(&n, &k, &c);
                   1263: 
                   1264:        for(i = 1, cint_max = 1; i < (8 * sizeof(integer8)) - 1; cint_max =
                   1265:                (cint_max << 1) + 1, i++);
                   1266: 
                   1267:        if (c > cint_max)
                   1268:        {
                   1269:            if ((s_objet_resultat = allocation(s_etat_processus, REL))
                   1270:                    == NULL)
                   1271:            {
                   1272:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1273:                return;
                   1274:            }
                   1275: 
                   1276:            (*((real8 *) (*s_objet_resultat).objet)) = c;
                   1277:        }
                   1278:        else
                   1279:        {
                   1280:            if ((s_objet_resultat = allocation(s_etat_processus, INT))
                   1281:                    == NULL)
                   1282:            {
                   1283:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1284:                return;
                   1285:            }
                   1286: 
                   1287:            if (fabs(c - floor(c)) < fabs(ceil(c) - c))
                   1288:            {
                   1289:                (*((integer8 *) (*s_objet_resultat).objet)) =
                   1290:                        (integer8) floor(c);
                   1291:            } 
                   1292:            else
                   1293:            {
                   1294:                (*((integer8 *) (*s_objet_resultat).objet)) =
                   1295:                        1 + (integer8) floor(c);
                   1296:            } 
                   1297:        }
                   1298:    }
                   1299:    else
                   1300:    {
                   1301:        liberation(s_etat_processus, s_objet_argument_1);
                   1302:        liberation(s_etat_processus, s_objet_argument_2);
                   1303: 
                   1304:        (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
                   1305:        return;
                   1306:    }
                   1307: 
                   1308:    liberation(s_etat_processus, s_objet_argument_1);
                   1309:    liberation(s_etat_processus, s_objet_argument_2);
                   1310: 
                   1311:    if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   1312:            s_objet_resultat) == d_erreur)
                   1313:    {
                   1314:        return;
                   1315:    }
                   1316: 
                   1317:    return;
                   1318: }
                   1319: 
                   1320: 
                   1321: /*
                   1322: ================================================================================
                   1323:   Fonction 'psdev'
                   1324: ================================================================================
                   1325:   Entrées :
                   1326: --------------------------------------------------------------------------------
                   1327:   Sorties :
                   1328: --------------------------------------------------------------------------------
                   1329:   Effets de bord : néant
                   1330: ================================================================================
                   1331: */
                   1332: 
                   1333: void
                   1334: instruction_psdev(struct_processus *s_etat_processus)
                   1335: {
                   1336:    struct_objet                        *s_objet_statistique;
                   1337:    struct_objet                        *s_objet_resultat;
                   1338:    struct_objet                        *s_objet_temporaire;
                   1339: 
                   1340:    unsigned long                       nombre_colonnes;
                   1341: 
                   1342:    (*s_etat_processus).erreur_execution = d_ex;
                   1343: 
                   1344:    if ((*s_etat_processus).affichage_arguments == 'Y')
                   1345:    {
                   1346:        printf("\n  PSDEV ");
                   1347: 
                   1348:        if ((*s_etat_processus).langue == 'F')
                   1349:        {
                   1350:            printf("(écart-type d'une population)\n\n");
                   1351:        }
                   1352:        else
                   1353:        {
                   1354:            printf("(population standard deviation)\n\n");
                   1355:        }
                   1356: 
                   1357:        printf("->  1: %s, %s, %s, %s\n", d_INT, d_REL, d_VIN, d_VRL);
                   1358: 
                   1359:        return;
                   1360:    }
                   1361:    else if ((*s_etat_processus).test_instruction == 'Y')
                   1362:    {
                   1363:        (*s_etat_processus).nombre_arguments = -1;
                   1364:        return;
                   1365:    }
                   1366: 
                   1367:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                   1368:    {
                   1369:        if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
                   1370:        {
                   1371:            return;
                   1372:        }
                   1373:    }
                   1374: 
                   1375:    /*
                   1376:     * Recherche d'une variable globale référencée par SIGMA
                   1377:     */
                   1378: 
1.19    ! bertrand 1379:    if (recherche_variable_globale(s_etat_processus, ds_sdat) == d_faux)
1.1       bertrand 1380:    {
                   1381:        /*
                   1382:         * Aucune variable SIGMA
                   1383:         */
                   1384: 
                   1385:        (*s_etat_processus).erreur_systeme = d_es;
1.19    ! bertrand 1386: 
        !          1387:        if ((*s_etat_processus).erreur_execution == d_ex)
        !          1388:        {
        !          1389:            (*s_etat_processus).erreur_execution = d_ex_absence_observations;
        !          1390:        }
        !          1391: 
1.1       bertrand 1392:        return;
                   1393:    }
                   1394:    else
                   1395:    {
1.19    ! bertrand 1396:        if (((*(*(*s_etat_processus).pointeur_variable_courante).objet)
        !          1397:                .type != MIN) && ((*(*(*s_etat_processus)
        !          1398:                .pointeur_variable_courante).objet).type != MRL))
1.1       bertrand 1399:        {
1.19    ! bertrand 1400:            (*s_etat_processus).erreur_execution =
        !          1401:                    d_ex_matrice_statistique_invalide;
1.1       bertrand 1402:            return;
                   1403:        }
                   1404: 
1.19    ! bertrand 1405:        nombre_colonnes = (*((struct_matrice *) (*(*(*s_etat_processus)
        !          1406:                .pointeur_variable_courante).objet).objet)).nombre_colonnes;
1.1       bertrand 1407:    }
                   1408: 
1.19    ! bertrand 1409:    s_objet_statistique = (*(*s_etat_processus).pointeur_variable_courante)
        !          1410:            .objet;
1.1       bertrand 1411: 
                   1412:    if (((*s_objet_statistique).type == MIN) ||
                   1413:            ((*s_objet_statistique).type == MRL))
                   1414:    {
                   1415:        if ((s_objet_resultat = allocation(s_etat_processus, NON)) == NULL)
                   1416:        {
                   1417:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1418:            return;
                   1419:        }
                   1420: 
                   1421:        if (((*s_objet_resultat).objet = ecart_type_statistique(
                   1422:                (struct_matrice *) (*s_objet_statistique).objet, 'P')) == NULL)
                   1423:        {
                   1424:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1425:            return;
                   1426:        }
                   1427: 
                   1428:        if (nombre_colonnes == 1)
                   1429:        {
                   1430:            if ((*((struct_vecteur *) (*s_objet_resultat).objet)).type == 'I')
                   1431:            {
                   1432:                (*s_objet_resultat).type = VIN;
                   1433:                s_objet_temporaire = s_objet_resultat;
                   1434: 
                   1435:                if ((s_objet_resultat = allocation(s_etat_processus, INT))
                   1436:                        == NULL)
                   1437:                {
                   1438:                    (*s_etat_processus).erreur_systeme =
                   1439:                            d_es_allocation_memoire;
                   1440:                    return;
                   1441:                }
                   1442: 
                   1443:                (*((integer8 *) (*s_objet_resultat).objet)) =
                   1444:                        ((integer8 *) (*((struct_vecteur *)
                   1445:                        (*s_objet_temporaire).objet)).tableau)[0];
                   1446: 
                   1447:                liberation(s_etat_processus, s_objet_temporaire);
                   1448:            }
                   1449:            else
                   1450:            {
                   1451:                (*s_objet_resultat).type = VRL;
                   1452:                s_objet_temporaire = s_objet_resultat;
                   1453: 
                   1454:                if ((s_objet_resultat = allocation(s_etat_processus, REL))
                   1455:                        == NULL)
                   1456:                {
                   1457:                    (*s_etat_processus).erreur_systeme =
                   1458:                            d_es_allocation_memoire;
                   1459:                    return;
                   1460:                }
                   1461: 
                   1462:                (*((real8 *) (*s_objet_resultat).objet)) =
                   1463:                        ((real8 *) (*((struct_vecteur *)
                   1464:                        (*s_objet_temporaire).objet)).tableau)[0];
                   1465: 
                   1466:                liberation(s_etat_processus, s_objet_temporaire);
                   1467:            }
                   1468:        }
                   1469:        else
                   1470:        {
                   1471:            if ((*((struct_vecteur *) (*s_objet_resultat).objet)).type == 'I')
                   1472:            {
                   1473:                (*s_objet_resultat).type = VIN;
                   1474:            }
                   1475:            else
                   1476:            {
                   1477:                (*s_objet_resultat).type = VRL;
                   1478:            }
                   1479:        }
                   1480: 
                   1481:        if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   1482:                s_objet_resultat) == d_erreur)
                   1483:        {
                   1484:            return;
                   1485:        }
                   1486:    }
                   1487:    else
                   1488:    {
                   1489:        (*s_etat_processus).erreur_execution =
                   1490:                d_ex_matrice_statistique_invalide;
                   1491:        return;
                   1492:    }
                   1493: 
                   1494:    return;
                   1495: }
                   1496: 
                   1497: 
                   1498: /*
                   1499: ================================================================================
                   1500:   Fonction 'pvar'
                   1501: ================================================================================
                   1502:   Entrées :
                   1503: --------------------------------------------------------------------------------
                   1504:   Sorties :
                   1505: --------------------------------------------------------------------------------
                   1506:   Effets de bord : néant
                   1507: ================================================================================
                   1508: */
                   1509: 
                   1510: void
                   1511: instruction_pvar(struct_processus *s_etat_processus)
                   1512: {
                   1513:    struct_objet                        *s_objet_statistique;
                   1514:    struct_objet                        *s_objet_resultat;
                   1515:    struct_objet                        *s_objet_temporaire;
                   1516: 
                   1517:    unsigned long                       nombre_colonnes;
                   1518: 
                   1519:    (*s_etat_processus).erreur_execution = d_ex;
                   1520: 
                   1521:    if ((*s_etat_processus).affichage_arguments == 'Y')
                   1522:    {
                   1523:        printf("\n  PVAR ");
                   1524: 
                   1525:        if ((*s_etat_processus).langue == 'F')
                   1526:        {
                   1527:            printf("(variance d'une population)\n\n");
                   1528:        }
                   1529:        else
                   1530:        {
                   1531:            printf("(population variance)\n\n");
                   1532:        }
                   1533: 
                   1534:        printf("->  1: %s, %s, %s, %s\n", d_INT, d_REL, d_VIN, d_VRL);
                   1535: 
                   1536:        return;
                   1537:    }
                   1538:    else if ((*s_etat_processus).test_instruction == 'Y')
                   1539:    {
                   1540:        (*s_etat_processus).nombre_arguments = -1;
                   1541:        return;
                   1542:    }
                   1543: 
                   1544:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                   1545:    {
                   1546:        if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
                   1547:        {
                   1548:            return;
                   1549:        }
                   1550:    }
                   1551: 
                   1552:    /*
                   1553:     * Recherche d'une variable globale référencée par SIGMA
                   1554:     */
                   1555: 
1.19    ! bertrand 1556:    if (recherche_variable_globale(s_etat_processus, ds_sdat) == d_faux)
1.1       bertrand 1557:    {
                   1558:        /*
                   1559:         * Aucune variable SIGMA
                   1560:         */
                   1561: 
                   1562:        (*s_etat_processus).erreur_systeme = d_es;
1.19    ! bertrand 1563: 
        !          1564:        if ((*s_etat_processus).erreur_execution == d_ex)
        !          1565:        {
        !          1566:            (*s_etat_processus).erreur_execution = d_ex_absence_observations;
        !          1567:        }
        !          1568: 
1.1       bertrand 1569:        return;
                   1570:    }
                   1571:    else
                   1572:    {
1.19    ! bertrand 1573:        if (((*(*(*s_etat_processus).pointeur_variable_courante).objet)
        !          1574:                .type != MIN) && ((*(*(*s_etat_processus)
        !          1575:                .pointeur_variable_courante).objet).type != MRL))
1.1       bertrand 1576:        {
1.19    ! bertrand 1577:            (*s_etat_processus).erreur_execution =
        !          1578:                    d_ex_matrice_statistique_invalide;
1.1       bertrand 1579:            return;
                   1580:        }
                   1581: 
1.19    ! bertrand 1582:        nombre_colonnes = (*((struct_matrice *) (*(*(*s_etat_processus)
        !          1583:                .pointeur_variable_courante).objet).objet)).nombre_colonnes;
1.1       bertrand 1584:    }
                   1585: 
1.19    ! bertrand 1586:    s_objet_statistique = (*(*s_etat_processus).pointeur_variable_courante)
        !          1587:            .objet;
1.1       bertrand 1588: 
                   1589:    if (((*s_objet_statistique).type == MIN) ||
                   1590:            ((*s_objet_statistique).type == MRL))
                   1591:    {
                   1592:        if ((s_objet_resultat = allocation(s_etat_processus, NON))
                   1593:                == NULL)
                   1594:        {
                   1595:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1596:            return;
                   1597:        }
                   1598: 
                   1599:        if (((*s_objet_resultat).objet = variance_statistique((struct_matrice *)
                   1600:                (*s_objet_statistique).objet, 'P')) == NULL)
                   1601:        {
                   1602:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1603:            return;
                   1604:        }
                   1605: 
                   1606:        if (nombre_colonnes == 1)
                   1607:        {
                   1608:            if ((*((struct_vecteur *) (*s_objet_resultat).objet)).type == 'I')
                   1609:            {
                   1610:                (*s_objet_resultat).type = VIN;
                   1611:                s_objet_temporaire = s_objet_resultat;
                   1612: 
                   1613:                if ((s_objet_resultat = allocation(s_etat_processus, INT))
                   1614:                        == NULL)
                   1615:                {
                   1616:                    (*s_etat_processus).erreur_systeme =
                   1617:                            d_es_allocation_memoire;
                   1618:                    return;
                   1619:                }
                   1620: 
                   1621:                (*((integer8 *) (*s_objet_resultat).objet)) =
                   1622:                        ((integer8 *) (*((struct_vecteur *)
                   1623:                        (*s_objet_temporaire).objet)).tableau)[0];
                   1624: 
                   1625:                liberation(s_etat_processus, s_objet_temporaire);
                   1626:            }
                   1627:            else
                   1628:            {
                   1629:                (*s_objet_resultat).type = VRL;
                   1630:                s_objet_temporaire = s_objet_resultat;
                   1631: 
                   1632:                if ((s_objet_resultat = allocation(s_etat_processus, REL))
                   1633:                        == NULL)
                   1634:                {
                   1635:                    (*s_etat_processus).erreur_systeme =
                   1636:                            d_es_allocation_memoire;
                   1637:                    return;
                   1638:                }
                   1639: 
                   1640:                (*((real8 *) (*s_objet_resultat).objet)) =
                   1641:                        ((real8 *) (*((struct_vecteur *)
                   1642:                        (*s_objet_temporaire).objet)).tableau)[0];
                   1643: 
                   1644:                liberation(s_etat_processus, s_objet_temporaire);
                   1645:            }
                   1646:        }
                   1647:        else
                   1648:        {
                   1649:            if ((*((struct_vecteur *) (*s_objet_resultat).objet)).type == 'I')
                   1650:            {
                   1651:                (*s_objet_resultat).type = VIN;
                   1652:            }
                   1653:            else
                   1654:            {
                   1655:                (*s_objet_resultat).type = VRL;
                   1656:            }
                   1657:        }
                   1658: 
                   1659:        if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   1660:                s_objet_resultat) == d_erreur)
                   1661:        {
                   1662:            return;
                   1663:        }
                   1664:    }
                   1665:    else
                   1666:    {
                   1667:        (*s_etat_processus).erreur_execution =
                   1668:                d_ex_matrice_statistique_invalide;
                   1669:        return;
                   1670:    }
                   1671: 
                   1672:    return;
                   1673: }
                   1674: 
                   1675: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>