Annotation of rpl/src/analyse.c, revision 1.103

1.1       bertrand    1: /*
                      2: ================================================================================
1.103   ! bertrand    3:   RPL/2 (R) version 4.1.25
        !             4:   Copyright (C) 1989-2016 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.25      bertrand   23: #include "rpl-conv.h"
1.1       bertrand   24: 
                     25: 
                     26: /*
                     27: ================================================================================
1.3       bertrand   28:   Analyseur syntaxique de l'interprète RPL/2
1.1       bertrand   29: ================================================================================
                     30:   Entrées :
                     31: --------------------------------------------------------------------------------
                     32:   Sorties :
                     33: --------------------------------------------------------------------------------
                     34:   Effets de bord : néant
                     35: ================================================================================
                     36: */
                     37: 
                     38: static void
                     39: creation_instruction(struct_processus *s_etat_processus,
                     40:        unsigned char *instruction, void (*routine)())
                     41: {
                     42:    int                     i;
                     43: 
                     44:    struct_instruction      *l_instruction_courante;
                     45: 
                     46:    unsigned char           *ptr;
                     47: 
1.14      bertrand   48:    BUG(strlen(instruction) >= d_longueur_maximale_instruction,
                     49:            printf("%s -> %d >= %d\n", instruction, (int) strlen(instruction),
                     50:            d_longueur_maximale_instruction));
                     51: 
1.1       bertrand   52:    if ((*s_etat_processus).arbre_instructions == NULL)
                     53:    {
                     54:        if (((*s_etat_processus).arbre_instructions =
                     55:                malloc(sizeof(struct_instruction))) == NULL)
                     56:        {
                     57:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                     58:            return;
                     59:        }
                     60: 
                     61:        (*(*s_etat_processus).arbre_instructions).feuille = NULL;
                     62: 
1.41      bertrand   63:        if (((*(*s_etat_processus).arbre_instructions).noeuds =
1.82      bertrand   64:                malloc(((size_t) (*s_etat_processus).nombre_caracteres)
1.1       bertrand   65:                * sizeof(struct_instruction))) == NULL)
                     66:        {
                     67:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                     68:            return;
                     69:        }
                     70: 
                     71:        for(i = 0; i < (*s_etat_processus).nombre_caracteres; i++)
                     72:        {
1.41      bertrand   73:            (*(*s_etat_processus).arbre_instructions).noeuds[i] = NULL;
1.1       bertrand   74:        }
                     75:    }
                     76: 
                     77:    l_instruction_courante = (*s_etat_processus).arbre_instructions;
                     78:    ptr = instruction;
                     79: 
                     80:    while((*ptr) != d_code_fin_chaine)
                     81:    {
                     82:        BUG((*s_etat_processus).pointeurs_caracteres[*ptr] < 0,
                     83:                printf("Instruction=\"%s\", (*ptr)='%c'\n",
                     84:                instruction, *ptr));
                     85: 
1.41      bertrand   86:        if ((*l_instruction_courante).noeuds[(*s_etat_processus)
1.1       bertrand   87:                .pointeurs_caracteres[*ptr]] == NULL)
                     88:        {
                     89:            // Le noeud suivant n'existe pas, on le crée.
                     90: 
1.41      bertrand   91:            if (((*l_instruction_courante).noeuds[(*s_etat_processus)
1.1       bertrand   92:                    .pointeurs_caracteres[*ptr]] =
                     93:                    malloc(sizeof(struct_instruction))) == NULL)
                     94:            {
                     95:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                     96:                return;
                     97:            }
                     98: 
1.41      bertrand   99:            (*(*l_instruction_courante).noeuds[(*s_etat_processus)
1.1       bertrand  100:                    .pointeurs_caracteres[*ptr]]).feuille = NULL;
                    101: 
1.41      bertrand  102:            if (((*(*l_instruction_courante).noeuds[(*s_etat_processus)
                    103:                    .pointeurs_caracteres[*ptr]]).noeuds =
1.82      bertrand  104:                    malloc(((size_t) (*s_etat_processus).nombre_caracteres)
1.1       bertrand  105:                    * sizeof(struct_instruction))) == NULL)
                    106:            {
                    107:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    108:                return;
                    109:            }
                    110: 
                    111:            for(i = 0; i < (*s_etat_processus).nombre_caracteres; i++)
                    112:            {
1.41      bertrand  113:                (*(*l_instruction_courante).noeuds[(*s_etat_processus)
                    114:                        .pointeurs_caracteres[*ptr]]).noeuds[i] = NULL;
1.1       bertrand  115:            }
                    116:        }
                    117: 
1.41      bertrand  118:        l_instruction_courante = (*l_instruction_courante).noeuds
1.1       bertrand  119:                [(*s_etat_processus).pointeurs_caracteres[*ptr]];
                    120:        ptr++;
                    121:    }
                    122: 
                    123:    BUG((*l_instruction_courante).feuille != NULL,
                    124:            printf("Instruction=\"%s\"\n", instruction));
                    125: 
                    126:    (*l_instruction_courante).feuille = routine;
                    127: 
                    128:    return;
                    129: }
                    130: 
                    131: 
                    132: void
                    133: liberation_arbre_instructions(struct_processus *s_etat_processus,
                    134:        struct_instruction *arbre)
                    135: {
                    136:    int                 i;
                    137: 
                    138:    for(i = 0; i < (*s_etat_processus).nombre_caracteres; i++)
                    139:    {
1.41      bertrand  140:        if ((*arbre).noeuds[i] != NULL)
1.1       bertrand  141:        {
1.41      bertrand  142:            liberation_arbre_instructions(s_etat_processus, (*arbre).noeuds[i]);
1.1       bertrand  143:        }
                    144:    }
                    145: 
1.41      bertrand  146:    free((*arbre).noeuds);
1.1       bertrand  147:    free(arbre);
                    148: 
                    149:    return;
                    150: }
                    151: 
                    152: 
                    153: /*
                    154:  * Caractères autorisés dans les instructions
                    155:  *
                    156:  * A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
                    157:  * e i (mais traités comme des majuscules grâce à 'instruction_*_sensible()'
                    158:  * + - * / % ^ < > = ? 1 2
                    159:  */
                    160: 
                    161: void
                    162: initialisation_instructions(struct_processus *s_etat_processus)
                    163: {
                    164:    int             decalage;
                    165:    int             i;
                    166:    int             longueur_tableau;
                    167: 
                    168:    unsigned char   caractere;
                    169: 
                    170:    // Récupération de la longueur d'un unsigned char
                    171: 
                    172:    longueur_tableau = 1;
                    173:    decalage = 0;
                    174:    caractere = 1;
                    175: 
                    176:    while((1L << decalage) == (long) ((unsigned char) (caractere << decalage)))
                    177:    {
                    178:        decalage++;
                    179:        longueur_tableau *= 2;
                    180:    }
                    181: 
                    182:    if (((*s_etat_processus).pointeurs_caracteres =
1.82      bertrand  183:            malloc(((size_t) longueur_tableau * sizeof(int)))) == NULL)
1.1       bertrand  184:    {
                    185:        (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    186:        return;
                    187:    }
                    188: 
                    189:    for(i = 0; i < longueur_tableau; i++)
                    190:    {
                    191:        (*s_etat_processus).pointeurs_caracteres[i] = -1;
                    192:    }
                    193: 
                    194:    (*s_etat_processus).nombre_caracteres = 0;
                    195: 
                    196: #define DECLARATION_CARACTERE(c) \
                    197:        do { (*s_etat_processus).pointeurs_caracteres[c] = \
                    198:        (*s_etat_processus).nombre_caracteres++; } while(0)
                    199: 
                    200:    DECLARATION_CARACTERE('A');
                    201:    DECLARATION_CARACTERE('B');
                    202:    DECLARATION_CARACTERE('C');
                    203:    DECLARATION_CARACTERE('D');
                    204:    DECLARATION_CARACTERE('E');
                    205:    DECLARATION_CARACTERE('F');
                    206:    DECLARATION_CARACTERE('G');
                    207:    DECLARATION_CARACTERE('H');
                    208:    DECLARATION_CARACTERE('I');
                    209:    DECLARATION_CARACTERE('J');
                    210:    DECLARATION_CARACTERE('K');
                    211:    DECLARATION_CARACTERE('L');
                    212:    DECLARATION_CARACTERE('M');
                    213:    DECLARATION_CARACTERE('N');
                    214:    DECLARATION_CARACTERE('O');
                    215:    DECLARATION_CARACTERE('P');
                    216:    DECLARATION_CARACTERE('Q');
                    217:    DECLARATION_CARACTERE('R');
                    218:    DECLARATION_CARACTERE('S');
                    219:    DECLARATION_CARACTERE('T');
                    220:    DECLARATION_CARACTERE('U');
                    221:    DECLARATION_CARACTERE('V');
                    222:    DECLARATION_CARACTERE('W');
                    223:    DECLARATION_CARACTERE('X');
                    224:    DECLARATION_CARACTERE('Y');
                    225:    DECLARATION_CARACTERE('Z');
                    226:    DECLARATION_CARACTERE('+');
                    227:    DECLARATION_CARACTERE('-');
                    228:    DECLARATION_CARACTERE('/');
                    229:    DECLARATION_CARACTERE('*');
                    230:    DECLARATION_CARACTERE('%');
                    231:    DECLARATION_CARACTERE('^');
                    232:    DECLARATION_CARACTERE('<');
                    233:    DECLARATION_CARACTERE('>');
                    234:    DECLARATION_CARACTERE('=');
                    235:    DECLARATION_CARACTERE('?');
                    236:    DECLARATION_CARACTERE('1');
                    237:    DECLARATION_CARACTERE('2');
                    238: 
                    239: #undef DECLARATION_CARACTERE
                    240: 
                    241: #define INSTRUCTION(chaine, fonction) \
                    242:        creation_instruction(s_etat_processus, chaine, fonction)
                    243: 
                    244:    INSTRUCTION("E", instruction_sensible_e);
                    245:    INSTRUCTION("I", instruction_sensible_i);
                    246:    INSTRUCTION("+", instruction_plus);
                    247:    INSTRUCTION("-", instruction_moins);
                    248:    INSTRUCTION("*", instruction_multiplication);
                    249:    INSTRUCTION("/", instruction_division);
                    250:    INSTRUCTION("%", instruction_pourcent);
                    251:    INSTRUCTION("^", instruction_puissance);
                    252:    INSTRUCTION("<", instruction_lt);
                    253:    INSTRUCTION("=", instruction_egalite);
                    254:    INSTRUCTION(">", instruction_gt);
                    255: 
                    256:    INSTRUCTION("CF", instruction_cf);
                    257:    INSTRUCTION("CR", instruction_cr);
                    258:    INSTRUCTION("DO", instruction_do);
                    259:    INSTRUCTION("FP", instruction_fp);
                    260:    INSTRUCTION("IF", instruction_if);
                    261:    INSTRUCTION("IM", instruction_im);
                    262:    INSTRUCTION("IN", instruction_in);
                    263:    INSTRUCTION("IP", instruction_ip);
                    264:    INSTRUCTION("LN", instruction_ln);
                    265:    INSTRUCTION("LQ", instruction_lq);
                    266:    INSTRUCTION("LU", instruction_lu);
                    267:    INSTRUCTION("NS", instruction_ns);
                    268:    INSTRUCTION("OR", instruction_or);
                    269:    INSTRUCTION("PI", instruction_pi);
                    270:    INSTRUCTION("QR", instruction_qr);
                    271:    INSTRUCTION("RE", instruction_re);
                    272:    INSTRUCTION("RL", instruction_rl);
                    273:    INSTRUCTION("RR", instruction_rr);
                    274:    INSTRUCTION("SF", instruction_sf);
                    275:    INSTRUCTION("SL", instruction_sl);
                    276:    INSTRUCTION("SQ", instruction_sq);
                    277:    INSTRUCTION("SR", instruction_sr);
                    278:    INSTRUCTION("SX", instruction_sx);
                    279:    INSTRUCTION("SY", instruction_sy);
                    280:    INSTRUCTION("S+", instruction_s_plus);
                    281:    INSTRUCTION("S-", instruction_s_moins);
                    282:    INSTRUCTION("->", instruction_fleche);
                    283:    INSTRUCTION("*D", instruction_star_d);
                    284:    INSTRUCTION("*H", instruction_star_h);
                    285:    INSTRUCTION("*S", instruction_star_s);
                    286:    INSTRUCTION("*W", instruction_star_w);
                    287:    INSTRUCTION("**", instruction_puissance);
                    288:    INSTRUCTION("%T", instruction_pourcent_t);
                    289:    INSTRUCTION("<=", instruction_le);
                    290:    INSTRUCTION("<<", instruction_vers_niveau_superieur);
                    291:    INSTRUCTION("<>", instruction_ne);
                    292:    INSTRUCTION("==", instruction_same);
                    293:    INSTRUCTION("=>", instruction_ge);
                    294:    INSTRUCTION("=<", instruction_le);
                    295:    INSTRUCTION(">=", instruction_ge);
                    296:    INSTRUCTION(">>", instruction_vers_niveau_inferieur);
                    297: 
                    298:    INSTRUCTION("ABS", instruction_abs);
                    299:    INSTRUCTION("AND", instruction_and);
                    300:    //INSTRUCTION("ARC")
                    301:    //(centre, rayon, theta1, theta2 dans le sens trigonométrique)
                    302:    INSTRUCTION("ARG", instruction_arg);
                    303:    INSTRUCTION("ASL", instruction_asl);
                    304:    INSTRUCTION("ASR", instruction_asr);
                    305:    //INSTRUCTION("BAR")
                    306:    //Instruction HP48 (sélectionne le type de graphique à barres)
                    307:    //Chaque point est représenté par une barre verticale.
                    308:    INSTRUCTION("BIN", instruction_bin);
                    309:    //INSTRUCTION("BOX")
                    310:    //(point 1, point 2)
                    311:    INSTRUCTION("CHR", instruction_chr);
                    312:    INSTRUCTION("CLS", instruction_cls);
                    313:    INSTRUCTION("CON", instruction_con);
                    314:    INSTRUCTION("COS", instruction_cos);
                    315:    INSTRUCTION("COV", instruction_cov);
                    316:    INSTRUCTION("DEC", instruction_dec);
                    317:    INSTRUCTION("DEG", instruction_deg);
                    318:    INSTRUCTION("DER", instruction_der);
                    319:    INSTRUCTION("DET", instruction_det);
                    320:    INSTRUCTION("DFT", instruction_dft);
                    321:    INSTRUCTION("DOT", instruction_dot);
                    322:    INSTRUCTION("DUP", instruction_dup);
                    323:    INSTRUCTION("EGV", instruction_egv);
                    324:    INSTRUCTION("END", instruction_end);
                    325:    INSTRUCTION("ENG", instruction_eng);
1.96      bertrand  326:    INSTRUCTION("EQV", instruction_eqv);
1.1       bertrand  327:    INSTRUCTION("EXP", instruction_exp);
                    328:    INSTRUCTION("FC?", instruction_fc_test);
                    329:    INSTRUCTION("FFT", instruction_fft);
                    330:    //INSTRUCTION("FIT")
                    331:    //Extension RPL/2 (choix de la méthode de régression, par défaut, 'LINEAR'.
                    332:    //Les types sont
                    333:    //'LINEAR' => y = b + mx
                    334:    //'LOGARITHMIC' => y = b + m ln(x)
                    335:    //'EXPONENTIAL' => y = be^(mx) ou ln(y) = ln(b) + mx
                    336:    //'POWER' => y = bx^m ou ln(y) = ln(b) + m ln(x)
                    337:    INSTRUCTION("FIX", instruction_fix);
                    338:    INSTRUCTION("FOR", instruction_for);
                    339:    INSTRUCTION("FS?", instruction_fs_test);
                    340:    INSTRUCTION("GET", instruction_get);
                    341:    INSTRUCTION("HEX", instruction_hex);
                    342:    INSTRUCTION("IDN", instruction_idn);
                    343:    INSTRUCTION("IFT", instruction_ift);
                    344:    INSTRUCTION("INT", instruction_int);
                    345:    INSTRUCTION("INV", instruction_inv);
                    346:    INSTRUCTION("KEY", instruction_key);
                    347:    INSTRUCTION("LOG", instruction_log);
                    348:    INSTRUCTION("LSQ", instruction_lsq);
                    349:    INSTRUCTION("MAX", instruction_max);
                    350:    INSTRUCTION("MEM", instruction_mem);
                    351:    INSTRUCTION("MIN", instruction_min);
                    352:    INSTRUCTION("MOD", instruction_mod);
                    353:    INSTRUCTION("NEG", instruction_neg);
                    354:    INSTRUCTION("NOT", instruction_not);
                    355:    INSTRUCTION("NUM", instruction_num);
                    356:    INSTRUCTION("OCT", instruction_oct);
                    357:    INSTRUCTION("POS", instruction_pos);
                    358:    INSTRUCTION("PR1", instruction_pr1);
                    359:    INSTRUCTION("PUT", instruction_put);
                    360:    INSTRUCTION("RAD", instruction_rad);
                    361:    INSTRUCTION("RCI", instruction_rci);
                    362:    INSTRUCTION("RCL", instruction_rcl);
                    363:    INSTRUCTION("RDM", instruction_rdm);
                    364:    INSTRUCTION("RDZ", instruction_rdz);
                    365:    INSTRUCTION("RES", instruction_res);
                    366:    INSTRUCTION("RLB", instruction_rlb);
                    367:    INSTRUCTION("RND", instruction_rnd);
                    368:    INSTRUCTION("ROT", instruction_rot);
                    369:    INSTRUCTION("RRB", instruction_rrb);
                    370:    INSTRUCTION("RSD", instruction_rsd);
                    371:    INSTRUCTION("SCI", instruction_sci);
                    372:    INSTRUCTION("SIN", instruction_sin);
                    373:    INSTRUCTION("SLB", instruction_slb);
                    374:    INSTRUCTION("SRB", instruction_srb);
                    375:    INSTRUCTION("SST", instruction_sst);
                    376:    INSTRUCTION("STD", instruction_std);
                    377:    INSTRUCTION("STO", instruction_sto);
                    378:    INSTRUCTION("SVD", instruction_svd);
                    379:    INSTRUCTION("SVL", instruction_svl);
                    380:    INSTRUCTION("SUB", instruction_sub);
                    381:    INSTRUCTION("SWI", instruction_swi);
                    382:    INSTRUCTION("SX2", instruction_sx2);
                    383:    INSTRUCTION("SXY", instruction_sxy);
                    384:    INSTRUCTION("SY2", instruction_sy2);
                    385:    INSTRUCTION("TAN", instruction_tan);
                    386:    INSTRUCTION("TOT", instruction_tot);
                    387:    INSTRUCTION("TRN", instruction_trn);
                    388:    INSTRUCTION("USE", instruction_use);
                    389:    INSTRUCTION("VAR", instruction_var);
                    390:    //INSTRUCTION("V->")
                    391:    //Instruction HP48 (éclate un vecteur [ x y ] => x y quel que soit le
                    392:    //système de
                    393:    //coordonnées)
                    394:    INSTRUCTION("XOR", instruction_xor);
                    395:    INSTRUCTION("->Q", instruction_fleche_q);
                    396:    INSTRUCTION("%CH", instruction_pourcent_ch);
                    397: 
                    398:    INSTRUCTION("ACOS", instruction_acos);
                    399:    INSTRUCTION("ALOG", instruction_alog);
                    400:    INSTRUCTION("ASIN", instruction_asin);
                    401:    INSTRUCTION("ATAN", instruction_atan);
                    402:    INSTRUCTION("AXES", instruction_axes);
                    403:    INSTRUCTION("BEEP", instruction_beep);
                    404:    INSTRUCTION("B->R", instruction_b_vers_r);
                    405:    INSTRUCTION("CASE", instruction_case);
                    406:    INSTRUCTION("CEIL", instruction_ceil);
                    407:    INSTRUCTION("CLMF", instruction_clmf);
                    408:    INSTRUCTION("CNRM", instruction_cnrm);
                    409:    INSTRUCTION("COLS", instruction_cols);
                    410:    INSTRUCTION("COL+", instruction_col_plus);
                    411:    INSTRUCTION("COL-", instruction_col_moins);
                    412:    INSTRUCTION("COMB", instruction_comb);
                    413:    INSTRUCTION("COND", instruction_cond);
                    414:    INSTRUCTION("CONJ", instruction_conj);
                    415:    INSTRUCTION("CONT", instruction_cont);
                    416:    INSTRUCTION("COPY", instruction_copy);
                    417:    INSTRUCTION("CORR", instruction_corr);
                    418:    INSTRUCTION("COSH", instruction_cosh);
                    419:    INSTRUCTION("CSWP", instruction_cswp);
                    420:    INSTRUCTION("C->R", instruction_c_vers_r);
                    421:    INSTRUCTION("DATE", instruction_date);
                    422:    INSTRUCTION("DECR", instruction_decr);
                    423:    INSTRUCTION("DISP", instruction_disp);
                    424:    INSTRUCTION("DRAW", instruction_draw);
                    425:    INSTRUCTION("DRAX", instruction_drax);
                    426:    INSTRUCTION("DROP", instruction_drop);
                    427:    INSTRUCTION("DRWS", instruction_drws);
                    428:    INSTRUCTION("DUP2", instruction_dup2);
                    429:    INSTRUCTION("DUPN", instruction_dupn);
                    430:    INSTRUCTION("D->R", instruction_d_vers_r);
                    431:    INSTRUCTION("EDIT", instruction_edit);
                    432:    INSTRUCTION("EGVL", instruction_egvl);
                    433:    INSTRUCTION("ELSE", instruction_else);
                    434:    INSTRUCTION("ERRM", instruction_errm);
                    435:    INSTRUCTION("ERRN", instruction_errn);
                    436:    INSTRUCTION("EVAL", instruction_eval);
                    437:    INSTRUCTION("EXIT", instruction_exit);
                    438:    INSTRUCTION("EXPM", instruction_expm);
                    439:    INSTRUCTION("FACT", instruction_fact);
                    440:    INSTRUCTION("FC?C", instruction_fc_test_c);
                    441:    INSTRUCTION("FC?S", instruction_fc_test_s);
                    442:    //INSTRUCTION("FORM")
                    443:    INSTRUCTION("FS?C", instruction_fs_test_c);
                    444:    INSTRUCTION("FS?S", instruction_fs_test_s);
                    445:    INSTRUCTION("FUSE", instruction_fuse);
                    446:    INSTRUCTION("GEGV", instruction_gegv);
                    447:    INSTRUCTION("GETC", instruction_getc);
                    448:    INSTRUCTION("GETI", instruction_geti);
                    449:    INSTRUCTION("GETR", instruction_getr);
                    450:    INSTRUCTION("HALT", instruction_halt);
                    451:    INSTRUCTION("HEAD", instruction_head);
                    452:    INSTRUCTION("HELP", instruction_help);
                    453:    INSTRUCTION("HMS+", instruction_hms_plus);
                    454:    INSTRUCTION("HMS-", instruction_hms_moins);
                    455:    //INSTRUCTION("HOME");
                    456:    INSTRUCTION("IDFT", instruction_idft);
                    457:    INSTRUCTION("IFFT", instruction_ifft);
                    458:    INSTRUCTION("IFTE", instruction_ifte);
                    459:    INSTRUCTION("INCR", instruction_incr);
                    460:    //INSTRUCTION("ISOL");
                    461:    INSTRUCTION("ISWI", instruction_iswi);
                    462:    INSTRUCTION("KILL", instruction_kill);
                    463:    INSTRUCTION("KIND", instruction_kind);
                    464:    INSTRUCTION("LAST", instruction_last);
                    465:    INSTRUCTION("LEGV", instruction_legv);
                    466:    INSTRUCTION("LINE", instruction_line);
                    467:    INSTRUCTION("LNP1", instruction_lnp1);
                    468:    INSTRUCTION("LOCK", instruction_lock);
1.36      bertrand  469:    INSTRUCTION("L->T", instruction_l_vers_t);
1.1       bertrand  470:    INSTRUCTION("MANT", instruction_mant);
                    471:    INSTRUCTION("MARK", instruction_mark);
                    472:    //INSTRUCTION("MAXR")
                    473:    INSTRUCTION("MAXS", instruction_maxs);
                    474:    INSTRUCTION("MEAN", instruction_mean);
                    475:    //INSTRUCTION("MINR");
                    476:    INSTRUCTION("MINS", instruction_mins); // MAXDOUBLE/MINDOUBLE
                    477:    INSTRUCTION("NEXT", instruction_next);
                    478:    //INSTRUCTION("NUMX");
                    479:    //INSTRUCTION("NUMY");
                    480:    INSTRUCTION("OPEN", instruction_open);
                    481:    INSTRUCTION("OVER", instruction_over);
                    482:    //INSTRUCTION("PATH");
                    483:    INSTRUCTION("PCOV", instruction_pcov);
                    484:    INSTRUCTION("PEEK", instruction_peek);
                    485:    INSTRUCTION("PERM", instruction_perm);
                    486:    INSTRUCTION("PICK", instruction_pick);
                    487:    INSTRUCTION("PLOT", instruction_plot);
                    488:    INSTRUCTION("PMAX", instruction_pmax);
                    489:    INSTRUCTION("PMIN", instruction_pmin);
                    490:    INSTRUCTION("POKE", instruction_poke);
1.66      bertrand  491:    INSTRUCTION("POLL", instruction_poll);
1.1       bertrand  492:    INSTRUCTION("PPAR", instruction_ppar);
                    493:    INSTRUCTION("PRMD", instruction_prmd);
                    494:    INSTRUCTION("PRST", instruction_prst);
                    495:    INSTRUCTION("PUTC", instruction_putc);
                    496:    INSTRUCTION("PUTI", instruction_puti);
                    497:    INSTRUCTION("PUTR", instruction_putr);
                    498:    INSTRUCTION("PVAR", instruction_pvar);
                    499:    INSTRUCTION("P->R", instruction_p_vers_r);
                    500:    //INSTRUCTION("QUAD");
                    501:    INSTRUCTION("RAND", instruction_rand);
                    502:    INSTRUCTION("RANK", instruction_rank);
                    503:    //INSTRUCTION("RANM")
                    504:    //Instruction HP48 (crée une matrice aléatoire
                    505:    //{ nb_lignes nb_colonnes } ou tableau quelconque dont les éléments seront
                    506:    //modifiés pour prendre des valeurs aléatoires entre -9 et 9)
                    507:    INSTRUCTION("RCEQ", instruction_rceq);
                    508:    INSTRUCTION("RCIJ", instruction_rcij);
                    509:    INSTRUCTION("RCLF", instruction_rclf);
                    510:    INSTRUCTION("RCLS", instruction_rcls);
                    511:    INSTRUCTION("RCWS", instruction_rcws);
                    512:    INSTRUCTION("RDGN", instruction_rdgn);
                    513:    INSTRUCTION("READ", instruction_read);
                    514:    INSTRUCTION("RECV", instruction_recv);
                    515:    INSTRUCTION("REGV", instruction_regv);
                    516:    INSTRUCTION("REPL", instruction_repl);
1.90      bertrand  517:    INSTRUCTION("RGDL", instruction_rgdl);
                    518:    INSTRUCTION("RGDR", instruction_rgdr);
1.1       bertrand  519:    INSTRUCTION("RNRM", instruction_rnrm);
                    520:    INSTRUCTION("ROLL", instruction_roll);
                    521:    //INSTRUCTION("ROOT")
                    522:    INSTRUCTION("ROW-", instruction_row_moins);
                    523:    INSTRUCTION("ROW+", instruction_row_plus);
                    524:    //INSTRUCTION("RREF")
                    525:    //Instruction HP48 (transforme [A B] en [I C] par combinaisons linéaires
                    526:    //de lignes)
                    527:    INSTRUCTION("RSWP", instruction_rswp);
                    528:    INSTRUCTION("R->B", instruction_r_vers_b);
                    529:    INSTRUCTION("R->C", instruction_r_vers_c);
                    530:    INSTRUCTION("R->D", instruction_r_vers_d);
                    531:    INSTRUCTION("R->P", instruction_r_vers_p);
                    532:    INSTRUCTION("SAME", instruction_same);
                    533:    INSTRUCTION("SAVE", instruction_save);
                    534:    INSTRUCTION("SCLS", instruction_scls);
                    535:    INSTRUCTION("SDEV", instruction_sdev);
                    536:    INSTRUCTION("SEND", instruction_send);
                    537:    //INSTRUCTION("SHOW");
                    538:    INSTRUCTION("SIGN", instruction_sign);
                    539:    INSTRUCTION("SINH", instruction_sinh);
                    540:    INSTRUCTION("SINV", instruction_sinv);
                    541:    INSTRUCTION("SIZE", instruction_size);
                    542:    INSTRUCTION("SNEG", instruction_sneg);
                    543:    INSTRUCTION("SORT", instruction_sort);
                    544:    INSTRUCTION("SPAR", instruction_spar);
                    545:    INSTRUCTION("SQRT", instruction_sqrt);
                    546:    //INSTRUCTION("SRAD");
1.53      bertrand  547:    INSTRUCTION("SREV", instruction_srev);
1.1       bertrand  548:    //INSTRUCTION("SRNM")
                    549:    //Instruction HP48 (renvoie la norme spectrale d'un tableau. Pour une
                    550:    //matrice,
                    551:    //la norme spectrale est égale à sa plus grande valeur singulière. Pour un
                    552:    //vecteur, la fonction est équivalente à ABS.
                    553:    INSTRUCTION("STEP", instruction_step);
                    554:    INSTRUCTION("STEQ", instruction_steq);
                    555:    INSTRUCTION("STO*", instruction_sto_fois);
                    556:    INSTRUCTION("STO+", instruction_sto_plus);
                    557:    INSTRUCTION("STO-", instruction_sto_moins);
                    558:    INSTRUCTION("STO/", instruction_sto_division);
                    559:    INSTRUCTION("STOF", instruction_stof);
                    560:    INSTRUCTION("STOP", instruction_stop);
                    561:    INSTRUCTION("STOS", instruction_stos);
                    562:    INSTRUCTION("STWS", instruction_stws);
                    563:    INSTRUCTION("SWAP", instruction_swap);
                    564:    INSTRUCTION("SYNC", instruction_sync);
                    565:    INSTRUCTION("TAIL", instruction_tail);
                    566:    INSTRUCTION("TANH", instruction_tanh);
                    567:    INSTRUCTION("THEN", instruction_then);
                    568:    INSTRUCTION("TIME", instruction_time);
                    569:    INSTRUCTION("TRIM", instruction_trim);
                    570:    INSTRUCTION("TRNC", instruction_trnc);
                    571:    INSTRUCTION("TRUE", instruction_true);
                    572:    INSTRUCTION("TYPE", instruction_type);
1.36      bertrand  573:    INSTRUCTION("T->L", instruction_t_vers_l);
1.1       bertrand  574:    INSTRUCTION("UTPC", instruction_utpc);
                    575:    INSTRUCTION("UTPF", instruction_utpf);
                    576:    INSTRUCTION("UTPN", instruction_utpn);
                    577:    INSTRUCTION("UTPT", instruction_utpt);
                    578:    INSTRUCTION("VARS", instruction_vars);
                    579:    INSTRUCTION("WAIT", instruction_wait);
                    580:    INSTRUCTION("XCOL", instruction_xcol);
                    581:    INSTRUCTION("XPON", instruction_xpon);
                    582:    //INSTRUCTION("XRNG")
                    583:    //INSTRUCTION("XVOL")
                    584:    INSTRUCTION("YCOL", instruction_ycol);
                    585:    //INSTRUCTION("YRNG")
                    586:    //INSTRUCTION("YVOL")
                    587:    //INSTRUCTION("ZVOL")
                    588:    //INSTRUCTION("->V2")
                    589:    //Instruction HP48 (combine deux réels x et y en un vecteur 2D en fonction
                    590:    //du mode de coordonnées en cours => [ x y ] et ce quel que soit le système
                    591:    //de coordonnées courant)
                    592:    //INSTRUCTION("->V3")
                    593: 
                    594:    INSTRUCTION("ABORT", instruction_abort);
                    595:    INSTRUCTION("ACOSH", instruction_acosh);
                    596:    INSTRUCTION("ALARM", instruction_alarm);
                    597:    INSTRUCTION("ASINH", instruction_asinh);
                    598:    INSTRUCTION("ATANH", instruction_atanh);
                    599:    //INSTRUCTION("BYTES");
                    600:    INSTRUCTION("CENTR", instruction_centr);
                    601:    //INSTRUCTION("CIRCL");
                    602:    INSTRUCTION("CLEAR", instruction_clear);
                    603:    INSTRUCTION("CLLCD", instruction_cllcd);
                    604:    INSTRUCTION("CLOSE", instruction_close);
                    605:    INSTRUCTION("CLUSR", instruction_clusr);
                    606:    //INSTRUCTION("CLVAR");
                    607:    //INSTRUCTION("COLCT")
                    608:    INSTRUCTION("COL->", instruction_col_fleche);
                    609:    //INSTRUCTION("CONIC")
                    610:    //Instruction HP48 (sélectionne le type de tracé CONIC)
                    611:    //Permet de tracer des coniques en fonction d'équations
                    612:    //de type f(x, y) = 0.
                    613:    //INSTRUCTION("CRDIR")
                    614:    INSTRUCTION("CRMTX", instruction_crmtx);
                    615:    INSTRUCTION("CROSS", instruction_cross);
                    616:    INSTRUCTION("CRTAB", instruction_crtab);
                    617:    INSTRUCTION("CSTOP", instruction_cstop);
                    618:    INSTRUCTION("CYCLE", instruction_cycle);
                    619:    //INSTRUCTION("CYLIN")
                    620:    //Instruction HP48 (sélectionne le type de tracé CYLINDRIC)
                    621:    INSTRUCTION("DEPND", instruction_depnd);
                    622:    INSTRUCTION("DEPTH", instruction_depth);
                    623:    //INSTRUCTION("DOSUB")
                    624:    //Instruction HP48 (application séquentielle d'une fonction à une liste)
                    625:    //liste nombre_elements_traites_a_chaque_iteration fonction DOSUB
                    626:    //{ 1 2 3 4 5 }
                    627:    //2
                    628:    //<< + 2 / >>
                    629:    //DOSUB
                    630:    //=> { 1.5 2.5 3.5 4.5 }
                    631:    INSTRUCTION("DGTIZ", instruction_dgtiz);
                    632:    INSTRUCTION("DROP2", instruction_drop2);
                    633:    INSTRUCTION("DROPN", instruction_dropn);
                    634:    INSTRUCTION("ERASE", instruction_erase);
                    635:    INSTRUCTION("EXGET", instruction_exget);
                    636:    //INSTRUCTION("EXPAN");
                    637:    INSTRUCTION("EXSUB", instruction_exsub);
                    638:    INSTRUCTION("EYEPT", instruction_eyept);
                    639:    INSTRUCTION("FALSE", instruction_false);
                    640:    INSTRUCTION("FLOOR", instruction_floor);
                    641:    INSTRUCTION("GAMMA", instruction_gamma);
                    642:    INSTRUCTION("GEGVL", instruction_gegvl);
                    643:    INSTRUCTION("GLEGV", instruction_glegv);
                    644:    INSTRUCTION("GREGV", instruction_gregv);
                    645:    INSTRUCTION("HMS->", instruction_hms_fleche);
                    646:    INSTRUCTION("IFERR", instruction_iferr);
                    647:    INSTRUCTION("INDEP", instruction_indep);
                    648:    INSTRUCTION("INPUT", instruction_input);
                    649:    INSTRUCTION("JDATE", instruction_jdate);
                    650:    INSTRUCTION("LABEL", instruction_label);
                    651:    INSTRUCTION("LCASE", instruction_lcase);
                    652:    INSTRUCTION("LCHOL", instruction_lchol);
                    653:    INSTRUCTION("LCD->", instruction_lcd_fleche);
1.51      bertrand  654:    INSTRUCTION("LIMIT", instruction_limit);
1.1       bertrand  655:    //INSTRUCTION("NDIST")
                    656:    //Instruction HP48 (distribution normale, prend la moyenne au niveau 3,
                    657:    //la variance au niveau 2, un réel x au niveau 1 et renvoie la probabilité
                    658:    //qu'une variable aléatoire normale soit égale à x dans une distribution
                    659:    //normale).
                    660:    INSTRUCTION("NRAND", instruction_nrand);
                    661:    INSTRUCTION("OBGET", instruction_obget);
                    662:    INSTRUCTION("OBSUB", instruction_obsub);
                    663:    INSTRUCTION("PAPER", instruction_paper);
                    664:    //INSTRUCTION("PCOEFF")
                    665:    //INSTRUCTION("PEVAL")
                    666:    //INSTRUCTION("PGDIR")
                    667:    //INSTRUCTION("PIXEL")
                    668:    //INSTRUCTION("PLIST")
                    669:    //Instruction HP48 (produit des termes d'une liste)
                    670:    INSTRUCTION("POLAR", instruction_polar);
                    671:    INSTRUCTION("PRINT", instruction_print);
                    672:    //INSTRUCTION("PREDV");
                    673:    INSTRUCTION("PRLCD", instruction_prlcd);
                    674:    //INSTRUCTION("PROOT")
                    675:    //Instruction HP48 (calcule les racines d'un polynôme en fonction du tableau
                    676:    //de coefficients)
                    677:    INSTRUCTION("PRSTC", instruction_prstc);
                    678:    INSTRUCTION("PRUSR", instruction_prusr);
                    679:    INSTRUCTION("PRVAR", instruction_prvar);
                    680:    INSTRUCTION("PSDEV", instruction_psdev);
                    681:    INSTRUCTION("PURGE", instruction_purge);
                    682:    INSTRUCTION("RDATE", instruction_rdate);
1.65      bertrand  683:    INSTRUCTION("REGEX", instruction_regex);
1.1       bertrand  684:    INSTRUCTION("RELAX", instruction_relax);
                    685:    INSTRUCTION("RFUSE", instruction_rfuse);
                    686:    INSTRUCTION("RSTOP", instruction_rstop);
                    687:    INSTRUCTION("ROLLD", instruction_rolld);
                    688:    INSTRUCTION("ROW->", instruction_row_fleche);
                    689:    INSTRUCTION("SCALE", instruction_scale);
                    690:    INSTRUCTION("SCHED", instruction_sched);
                    691:    INSTRUCTION("SCHUR", instruction_schur);
                    692:    INSTRUCTION("SCONJ", instruction_sconj);
                    693:    INSTRUCTION("SLICE", instruction_slice);
                    694:    //INSTRUCTION("SLIST")
                    695:    //Instruction HP48 (somme des termes d'une liste)
                    696:    INSTRUCTION("SPAWN", instruction_spawn);
                    697:    INSTRUCTION("START", instruction_start);
                    698:    INSTRUCTION("STORE", instruction_store);
                    699:    INSTRUCTION("STR->", instruction_str_fleche);
                    700:    INSTRUCTION("TAYLR", instruction_taylr);
                    701:    INSTRUCTION("TITLE", instruction_title);
                    702:    //INSTRUCTION("TRACE")
                    703:    //INSTRUCTION("TRUTH")
                    704:    INSTRUCTION("UCASE", instruction_ucase);
                    705:    INSTRUCTION("UCHOL", instruction_uchol);
                    706:    INSTRUCTION("UNTIL", instruction_until);
                    707:    //INSTRUCTION("UPDIR")
                    708:    INSTRUCTION("VISIT", instruction_visit);
                    709:    INSTRUCTION("WFACK", instruction_wfack);
                    710:    INSTRUCTION("WFSWI", instruction_wfswi);
                    711:    INSTRUCTION("WHILE", instruction_while);
                    712:    //INSTRUCTION("WIDTH")
                    713:    INSTRUCTION("WRITE", instruction_write);
                    714:    INSTRUCTION("XROOT", instruction_xroot);
                    715:    INSTRUCTION("YIELD", instruction_yield);
                    716:    INSTRUCTION("->COL", instruction_fleche_col);
                    717:    INSTRUCTION("->HMS", instruction_fleche_hms);
                    718:    INSTRUCTION("->LCD", instruction_fleche_lcd);
                    719:    INSTRUCTION("->NUM", instruction_fleche_num);
                    720:    INSTRUCTION("->ROW", instruction_fleche_row);
                    721:    INSTRUCTION("->STR", instruction_fleche_str);
                    722: 
                    723:    INSTRUCTION("APPEND", instruction_append);
                    724:    INSTRUCTION("ARRY->", instruction_array_fleche);
1.12      bertrand  725:    INSTRUCTION("ATEXIT", instruction_atexit);
1.24      bertrand  726:    INSTRUCTION("ATPOKE", instruction_atpoke);
1.1       bertrand  727:    INSTRUCTION("BESSEL", instruction_bessel);
1.79      bertrand  728:    INSTRUCTION("CIPHER", instruction_cipher);
1.1       bertrand  729:    INSTRUCTION("CLRERR", instruction_clrerr);
                    730:    INSTRUCTION("CLRMTX", instruction_clrmtx);
                    731:    INSTRUCTION("CLRSWI", instruction_clrswi);
                    732:    INSTRUCTION("CREATE", instruction_create);
                    733:    INSTRUCTION("DELETE", instruction_delete);
1.59      bertrand  734: #  ifdef SHARED_MEMORY
1.60      bertrand  735:        INSTRUCTION("DETACH", instruction_detach);
1.59      bertrand  736: #  else
1.60      bertrand  737:        if ((*s_etat_processus).langue == 'F')
                    738:        {
                    739:            printf("+++Attention : DETACH est émulé par SPAWN car le système"
                    740:                    " hôte ne supporte\n"
                    741:                    "               pas de mémoire partagée !\n");
                    742:        }
                    743:        else
                    744:        {
                    745:            printf("+++Warning : DETACH is replaced by SPAWN as host system"
                    746:                    " does not support\n"
                    747:                    "             shared memory !\n");
                    748:        }
                    749: 
                    750:        INSTRUCTION("DETACH", instruction_spawn);
1.29      bertrand  751: #  endif
1.1       bertrand  752:    INSTRUCTION("DIAG->", instruction_diag_fleche);
1.78      bertrand  753:    INSTRUCTION("DIGEST", instruction_digest);
1.1       bertrand  754:    //INSTRUCTION("DOLIST")
                    755:    //Instruction HP48 (application d'une fonction à une liste)
                    756:    //liste(s) nombre_de_listes_a_traiter fonction DOLIST
                    757:    //{ 1 2 3 }
                    758:    //{ 4 5 6 }
                    759:    //{ 7 8 9 }
                    760:    //3
                    761:    //<<  * + >>
                    762:    //DOLIST
                    763:    //=> { 29 42 57 }
                    764:    INSTRUCTION("ELSEIF", instruction_elseif);
1.74      bertrand  765:    INSTRUCTION("FORALL", instruction_forall);
1.1       bertrand  766:    INSTRUCTION("FORMAT", instruction_format);
                    767:    //INSTRUCTION("HEIGHT")
                    768:    INSTRUCTION("ITRACE", instruction_itrace);
                    769:    INSTRUCTION("LIST->", instruction_list_fleche);
                    770:    INSTRUCTION("LOGGER", instruction_logger);
                    771:    INSTRUCTION("MCLRIN", instruction_mclrin);
                    772:    INSTRUCTION("NRPROC", instruction_nrproc);
1.17      bertrand  773:    INSTRUCTION("PROCID", instruction_procid);
1.1       bertrand  774:    INSTRUCTION("PROMPT", instruction_prompt);
                    775:    INSTRUCTION("RCLSWI", instruction_rclswi);
                    776:    INSTRUCTION("RECALL", instruction_recall);
                    777:    INSTRUCTION("RECODE", instruction_recode);
                    778:    INSTRUCTION("REDRAW", instruction_redraw);
                    779:    INSTRUCTION("REMOVE", instruction_remove);
                    780:    INSTRUCTION("REPEAT", instruction_repeat);
                    781:    INSTRUCTION("RETURN", instruction_return);
                    782:    INSTRUCTION("REWIND", instruction_rewind);
                    783:    //INSTRUCTION("SCREEN")
                    784:    INSTRUCTION("SELECT", instruction_select);
                    785:    //INSTRUCTION("SPHERE")
                    786:    INSTRUCTION("SHARED", instruction_shared);
                    787:    INSTRUCTION("SPLASH", instruction_splash);
                    788:    INSTRUCTION("STATIC", instruction_static);
                    789:    INSTRUCTION("STOSWI", instruction_stoswi);
                    790:    //INSTRUCTION("STREAM", instruction_stream);
                    791:    //{ 1 2 3 4 5 } << * >> STREAM => 120
                    792:    INSTRUCTION("TARGET", instruction_target);
                    793:    INSTRUCTION("UNLOCK", instruction_unlock);
                    794:    INSTRUCTION("VERIFY", instruction_verify);
                    795:    INSTRUCTION("WFDATA", instruction_wfdata);
                    796:    INSTRUCTION("WFLOCK", instruction_wflock);
                    797:    INSTRUCTION("WFPOKE", instruction_wfpoke);
                    798:    INSTRUCTION("WFPROC", instruction_wfproc);
                    799:    INSTRUCTION("WFSOCK", instruction_wfsock);
                    800:    INSTRUCTION("->ARRY", instruction_fleche_array);
                    801:    INSTRUCTION("->DIAG", instruction_fleche_diag);
                    802:    INSTRUCTION("->LIST", instruction_fleche_list);
                    803: 
                    804:    INSTRUCTION("ARRAY->", instruction_array_fleche);
                    805:    //INSTRUCTION("BARPLOT")
                    806:    //INSTRUCTION("BESTFIT")
                    807:    //Instruction HP48 (choisit le meilleur modèle de régression)
                    808:    INSTRUCTION("CLRFUSE", instruction_clrfuse);
                    809:    INSTRUCTION("CONVERT", instruction_convert);
                    810:    INSTRUCTION("CRSMPHR", instruction_crsmphr);
                    811:    INSTRUCTION("CURRENC", instruction_currenc);
                    812:    INSTRUCTION("DEFAULT", instruction_default);
                    813:    INSTRUCTION("EPSILON", instruction_epsilon);
                    814:    //INSTRUCTION("GRIDMAP")
                    815:    //Instruction HP48 (sélectionne le mode de tracé GRIDMAP)
                    816:    //Le tracé GRIDMAP transforme la grille d'échantillonnage rectiligne
                    817:    //en appliquant la fonction en cours à valeurs complexes.
                    818:    //Les coordonnées de chaque point de la grille (un nombre complexe)
                    819:    //constituent
                    820:    //les données d'entrée de la fonction qui les projette ensuite dans le
                    821:    //grille
                    822:    //de sortie.
                    823:    //f(x,y)=fnct complexe évaluée sur la grille (x,y) et affichée comme une
                    824:    //fonction paramétrique.
                    825:    INSTRUCTION("INQUIRE", instruction_inquire);
1.15      bertrand  826:    INSTRUCTION("MEMLOCK", instruction_memlock);
1.1       bertrand  827:    INSTRUCTION("MTXLOCK", instruction_mtxlock);
                    828:    INSTRUCTION("PERSIST", instruction_persist);
                    829:    INSTRUCTION("PLOTTER", instruction_plotter);
                    830:    INSTRUCTION("PRIVATE", instruction_private);
                    831:    INSTRUCTION("PROTECT", instruction_protect);
                    832:    INSTRUCTION("PSHPRFL", instruction_pshprfl);
                    833:    INSTRUCTION("PULPRFL", instruction_pulprfl);
1.64      bertrand  834:    INSTRUCTION("RESTART", instruction_restart);
1.1       bertrand  835:    INSTRUCTION("REVLIST", instruction_revlist);
                    836:    INSTRUCTION("SCATTER", instruction_scatter);
                    837:    INSTRUCTION("SUSPEND", instruction_suspend);
                    838:    INSTRUCTION("SWILOCK", instruction_swilock);
                    839:    INSTRUCTION("SYSEVAL", instruction_syseval);
                    840:    INSTRUCTION("TABLE->", instruction_table_fleche);
                    841:    INSTRUCTION("VERSION", instruction_version);
                    842:    INSTRUCTION("WORKDIR", instruction_workdir);
                    843:    INSTRUCTION("->ARRAY", instruction_fleche_array);
                    844:    INSTRUCTION("->TABLE", instruction_fleche_table);
                    845: 
                    846:    INSTRUCTION("CLRCNTXT", instruction_clrcntxt);
                    847:    INSTRUCTION("CLRSMPHR", instruction_clrsmphr);
1.83      bertrand  848:    INSTRUCTION("COMPRESS", instruction_compress);
1.1       bertrand  849:    INSTRUCTION("CONTINUE", instruction_continue);
1.73      bertrand  850:    INSTRUCTION("CRITICAL", instruction_critical);
1.1       bertrand  851:    INSTRUCTION("DUPCNTXT", instruction_dupcntxt);
                    852:    INSTRUCTION("FUNCTION", instruction_function);
1.7       bertrand  853:    INSTRUCTION("IMPLICIT", instruction_implicit);
1.50      bertrand  854:    INSTRUCTION("INFINITY", instruction_sensible_infinity);
1.1       bertrand  855:    INSTRUCTION("KEYLABEL", instruction_keylabel);
                    856:    INSTRUCTION("KEYTITLE", instruction_keytitle);
                    857:    INSTRUCTION("LOGSCALE", instruction_logscale);
                    858:    INSTRUCTION("NEWPLANE", instruction_newplane);
                    859:    INSTRUCTION("PSHCNTXT", instruction_pshcntxt);
                    860:    INSTRUCTION("PULCNTXT", instruction_pulcntxt);
                    861:    INSTRUCTION("SQLQUERY", instruction_sqlquery);
                    862:    INSTRUCTION("SWIQUEUE", instruction_swiqueue);
                    863:    INSTRUCTION("TOKENIZE", instruction_tokenize);
                    864:    INSTRUCTION("VARIABLE", instruction_variable);
                    865:    INSTRUCTION("VOLATILE", instruction_volatile);
                    866:    INSTRUCTION("WARRANTY", instruction_warranty);
                    867: 
                    868:    INSTRUCTION("AUTOSCALE", instruction_autoscale);
                    869:    INSTRUCTION("BACKSPACE", instruction_backspace);
1.22      bertrand  870:    INSTRUCTION("BACKTRACE", instruction_backtrace);
1.13      bertrand  871:    INSTRUCTION("CLRATEXIT", instruction_clratexit);
1.24      bertrand  872:    INSTRUCTION("CLRATPOKE", instruction_clratpoke);
1.1       bertrand  873:    INSTRUCTION("COPYRIGHT", instruction_copyright);
                    874:    //INSTRUCTION("CYLINDRIC");
                    875:    INSTRUCTION("DAEMONIZE", instruction_daemonize);
                    876:    INSTRUCTION("DROPCNTXT", instruction_dropcntxt);
                    877:    INSTRUCTION("EXTERNALS", instruction_externals);
                    878:    INSTRUCTION("HISTOGRAM", instruction_histogram);
1.15      bertrand  879:    INSTRUCTION("MEMUNLOCK", instruction_memunlock);
1.1       bertrand  880:    INSTRUCTION("MTXSTATUS", instruction_mtxstatus);
                    881:    INSTRUCTION("MTXUNLOCK", instruction_mtxunlock);
                    882:    INSTRUCTION("PARAMETER", instruction_parameter);
                    883:    //INSTRUCTION("PSCONTOUR")
                    884:    //INSTRUCTION("SCATRPLOT")
                    885:    //(trace un nuage de points de SDAT et la courbe de régression)
                    886:    INSTRUCTION("SMPHRDECR", instruction_smphrdecr);
                    887:    INSTRUCTION("SMPHRGETV", instruction_smphrgetv);
                    888:    INSTRUCTION("SMPHRINCR", instruction_smphrincr);
                    889:    INSTRUCTION("SWAPCNTXT", instruction_swapcntxt);
                    890:    INSTRUCTION("SWISTATUS", instruction_swistatus);
                    891:    INSTRUCTION("SWIUNLOCK", instruction_swiunlock);
                    892:    INSTRUCTION("UNPROTECT", instruction_unprotect);
                    893:    INSTRUCTION("WIREFRAME", instruction_wireframe);
                    894: 
                    895:    INSTRUCTION("MTXTRYLOCK", instruction_mtxtrylock);
                    896:    INSTRUCTION("PARAMETRIC", instruction_parametric);
                    897:    //INSTRUCTION("PARSURFACE")
                    898:    //Instruction HP48 (tracé PARSURFACE) Equation sous forme de liste
                    899:    INSTRUCTION("SLICESCALE", instruction_slicescale);
                    900:    INSTRUCTION("SQLCONNECT", instruction_sqlconnect);
                    901:    //INSTRUCTION("SLOPEFIELD")
                    902:    //Instruction HP48 (type de tracé)
                    903:    //Tracé 3D en courbes de niveaux.
                    904:    //Le type de tracé 'SLOPEFIELD' dessine un réseau de segments dont les
                    905:    //pentes
                    906:    //représentent la valeur de la fonction (x,y) en leur milieu.
                    907:    //=> utile pour y'=F(x,y)
1.83      bertrand  908:    INSTRUCTION("UNCOMPRESS", instruction_uncompress);
1.1       bertrand  909: 
                    910:    INSTRUCTION("LOCALIZATION", instruction_localization);
                    911:    INSTRUCTION("SMPHRTRYDECR", instruction_smphrtrydecr);
                    912: 
                    913:    INSTRUCTION("SQLDISCONNECT", instruction_sqldisconnect);
                    914: #undef INSTRUCTION
                    915: 
                    916:    return;
                    917: }
                    918: 
                    919: 
1.25      bertrand  920: void *
1.1       bertrand  921: analyse_instruction(struct_processus *s_etat_processus, unsigned char *ptr)
                    922: {
                    923:    int                             pointeur;
                    924: 
                    925:    struct_instruction              *l_instruction_courante;
                    926: 
                    927:    l_instruction_courante = (*s_etat_processus).arbre_instructions;
                    928: 
                    929:    while((*ptr) != d_code_fin_chaine)
                    930:    {
                    931:        pointeur = (*s_etat_processus).pointeurs_caracteres[*ptr];
                    932: 
                    933:        if (pointeur < 0)
                    934:        {
                    935:            // Caractère hors de l'alphabet des instructions
                    936: 
                    937:            return(NULL);
                    938:        }
                    939: 
1.41      bertrand  940:        if ((*l_instruction_courante).noeuds[pointeur] == NULL)
1.1       bertrand  941:        {
                    942:            // Le chemin de l'instruction candidate n'existe pas.
                    943: 
                    944:            return(NULL);
                    945:        }
                    946: 
1.41      bertrand  947:        l_instruction_courante = (*l_instruction_courante).noeuds[pointeur];
1.1       bertrand  948:        ptr++;
                    949: 
                    950:        if ((l_instruction_courante == NULL) && ((*ptr) != d_code_fin_chaine))
                    951:        {
                    952:            // Le chemin de l'instruction candidate est incomplet.
                    953: 
                    954:            return(NULL);
                    955:        }
                    956:    }
                    957: 
                    958:    if ((*l_instruction_courante).feuille != NULL)
                    959:    {
                    960:        return((*l_instruction_courante).feuille);
                    961:    }
                    962: 
                    963:    return(NULL);
                    964: }
                    965: 
                    966: 
                    967: void
                    968: analyse(struct_processus *s_etat_processus, void (*fonction)())
                    969: {
                    970:    real8                           attente;
                    971:    real8                           pourcentage;
                    972:    real8                           temps_cpu;
                    973:    real8                           temps_reel;
                    974: 
                    975:    static struct timeval           horodatage_initial;
                    976:    struct timeval                  horodatage_final;
                    977: 
1.61      bertrand  978: #  ifndef OS2
1.1       bertrand  979:    static struct rusage            usage_initial;
                    980:    struct rusage                   usage_final;
1.61      bertrand  981: #  else
                    982:    static clock_t                  usage_initial;
                    983:    clock_t                         usage_final;
                    984: #  endif
1.1       bertrand  985: 
                    986:    struct timespec                 temporisation;
                    987: 
                    988:    unsigned char                   *position;
                    989:    unsigned char                   *bibliotheque_candidate;
1.14      bertrand  990:    unsigned char                   instruction_majuscule
                    991:                                            [d_longueur_maximale_instruction];
1.1       bertrand  992:    unsigned char                   registre_instruction_valide;
                    993: 
                    994:    void                            (*instruction)();
                    995: 
                    996:    errno = 0;
                    997:    (*s_etat_processus).var_volatile_exception_gsl = 0;
                    998: 
                    999:    (*s_etat_processus).instruction_valide = 'Y';
                   1000:    (*s_etat_processus).constante_symbolique = 'N';
                   1001:    (*s_etat_processus).nombre_arguments = -2;
                   1002:    (*s_etat_processus).instruction_intrinseque = 'I';
                   1003: 
                   1004:    /*
                   1005:     * On autorise l'exécution d'un fork() dans un thread concurrent.
                   1006:     */
                   1007: 
1.57      bertrand 1008: #  ifndef SEMAPHORES_NOMMES
                   1009:        if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)
                   1010: #  else
                   1011:        if (sem_post((*s_etat_processus).semaphore_fork) != 0)
                   1012: #  endif
1.1       bertrand 1013:    {
                   1014:        (*s_etat_processus).erreur_systeme = d_es_processus;
                   1015:        return;
                   1016:    }
                   1017: 
1.57      bertrand 1018: #  ifndef SEMAPHORES_NOMMES
                   1019:        while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0)
                   1020: #  else
                   1021:        while(sem_wait((*s_etat_processus).semaphore_fork) != 0)
                   1022: #  endif
1.9       bertrand 1023:    {
1.56      bertrand 1024:        if (errno != EINTR)
                   1025:        {
                   1026:            (*s_etat_processus).erreur_systeme = d_es_processus;
                   1027:            return;
                   1028:        }
1.9       bertrand 1029:    }
                   1030: 
1.73      bertrand 1031:    /*
                   1032:     * Verrou pour les sections_critiques
                   1033:     */
                   1034: 
                   1035:    if (pthread_mutex_lock(&mutex_sections_critiques) != 0)
                   1036:    {
                   1037:        (*s_etat_processus).erreur_systeme = d_es_processus;
                   1038:        return;
                   1039:    }
                   1040: 
                   1041:    if (pthread_mutex_unlock(&mutex_sections_critiques) != 0)
                   1042:    {
                   1043:        (*s_etat_processus).erreur_systeme = d_es_processus;
                   1044:        return;
                   1045:    }
                   1046: 
1.1       bertrand 1047:    scrutation_injection(s_etat_processus);
                   1048: 
                   1049:    if (fonction == NULL)
                   1050:    {
1.14      bertrand 1051:        conversion_majuscule_limitee((*s_etat_processus).instruction_courante,
                   1052:                instruction_majuscule, d_longueur_maximale_instruction);
1.1       bertrand 1053:        instruction = analyse_instruction(s_etat_processus,
                   1054:                instruction_majuscule);
                   1055: 
                   1056:        if (instruction == NULL)
                   1057:        {
                   1058:            // L'instruction n'existe pas.
                   1059: 
                   1060:            (*s_etat_processus).instruction_valide = 'N';
                   1061:        }
                   1062:        else
                   1063:        {
                   1064:            // Exécution de l'instruction associée. Le drapeau
                   1065:            // (*s_etat_processus).instruction_valide peut passer à 'N'
                   1066:            // dans le cas d'instructions sensibles à la casse.
                   1067: 
                   1068:            if ((*s_etat_processus).niveau_profilage >= 2)
                   1069:            {
                   1070:                profilage(s_etat_processus, instruction_majuscule);
                   1071:            }
                   1072: 
                   1073:            (*s_etat_processus).instruction_valide = 'Y';
                   1074:            instruction(s_etat_processus);
                   1075: 
                   1076:            if ((*s_etat_processus).niveau_profilage >= 2)
                   1077:            {
                   1078:                profilage(s_etat_processus, NULL);
                   1079:            }
                   1080:        }
                   1081:    }
                   1082:    else
                   1083:    {
                   1084:        if ((*s_etat_processus).niveau_profilage >= 2)
                   1085:        {
                   1086:            profilage(s_etat_processus,
                   1087:                    (*s_etat_processus).instruction_courante);
                   1088:        }
                   1089: 
                   1090:        (*s_etat_processus).instruction_valide = 'Y';
                   1091:        fonction(s_etat_processus);
                   1092: 
                   1093:        if ((*s_etat_processus).niveau_profilage >= 2)
                   1094:        {
                   1095:            profilage(s_etat_processus, NULL);
                   1096:        }
                   1097:    }
                   1098: 
                   1099:    if ((*s_etat_processus).instruction_valide == 'Y')
                   1100:    {
                   1101:        (*s_etat_processus).instruction_intrinseque = 'Y';
                   1102:    }
                   1103: 
                   1104:    if ((*s_etat_processus).instruction_valide == 'N')
                   1105:    {
                   1106:        if ((position = index((*s_etat_processus).instruction_courante, '$'))
                   1107:                != NULL)
                   1108:        {
1.82      bertrand 1109:            if ((bibliotheque_candidate = malloc(((size_t) (position + 1
                   1110:                    - (*s_etat_processus).instruction_courante))
1.1       bertrand 1111:                    * sizeof(unsigned char))) == NULL)
                   1112:            {
                   1113:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1114:                return;
                   1115:            }
                   1116: 
                   1117:            (*bibliotheque_candidate) = d_code_fin_chaine;
                   1118:            strncat(bibliotheque_candidate,
1.82      bertrand 1119:                    (*s_etat_processus).instruction_courante, ((size_t)
                   1120:                    (position - (*s_etat_processus).instruction_courante)));
1.1       bertrand 1121: 
                   1122:            position++;
                   1123: 
                   1124:            if (execution_fonction_de_bibliotheque(s_etat_processus, position,
                   1125:                    bibliotheque_candidate) == d_vrai)
                   1126:            {
                   1127:                (*s_etat_processus).instruction_valide = 'Y';
                   1128:                (*s_etat_processus).instruction_intrinseque = 'N';
                   1129:            }
                   1130:            else
                   1131:            {
                   1132:                (*s_etat_processus).instruction_valide = 'N';
                   1133:            }
                   1134: 
                   1135:            free(bibliotheque_candidate);
                   1136:        }
                   1137:        else
                   1138:        {
                   1139:            if (execution_fonction_de_bibliotheque(s_etat_processus,
                   1140:                    (*s_etat_processus).instruction_courante, NULL)
                   1141:                    == d_vrai)
                   1142:            {
                   1143:                (*s_etat_processus).instruction_valide = 'Y';
                   1144:                (*s_etat_processus).instruction_intrinseque = 'N';
                   1145:            }
                   1146:            else
                   1147:            {
                   1148:                (*s_etat_processus).instruction_valide = 'N';
                   1149:            }
                   1150:        }
                   1151:    }
                   1152: 
                   1153: /*
                   1154: --------------------------------------------------------------------------------
                   1155:   Gestion des interruptions logicielles
                   1156: --------------------------------------------------------------------------------
                   1157: */
                   1158: 
                   1159:    if (((*s_etat_processus).erreur_systeme == d_es) &&
                   1160:            ((*s_etat_processus).erreur_execution == d_ex) &&
                   1161:            ((*s_etat_processus).exception == d_ep))
                   1162:    {
                   1163:        if ((*s_etat_processus).test_instruction == 'N')
                   1164:        {
1.88      bertrand 1165:            if (pthread_mutex_lock(&(*s_etat_processus).mutex_interruptions)
                   1166:                    != 0)
1.1       bertrand 1167:            {
1.87      bertrand 1168:                (*s_etat_processus).erreur_systeme = d_es_processus;
                   1169:            }
                   1170:            else
                   1171:            {
                   1172:                if ((*s_etat_processus).nombre_interruptions_non_affectees != 0)
                   1173:                {
                   1174:                    affectation_interruptions_logicielles(s_etat_processus);
                   1175:                }
                   1176: 
1.88      bertrand 1177:                if (pthread_mutex_unlock(&(*s_etat_processus)
                   1178:                        .mutex_interruptions) != 0)
                   1179:                {
                   1180:                    (*s_etat_processus).erreur_systeme = d_es_processus;
                   1181:                }
1.1       bertrand 1182:            }
                   1183: 
                   1184:            if (((*s_etat_processus).nombre_interruptions_en_queue != 0) &&
                   1185:                    ((*s_etat_processus).erreur_systeme == d_es) &&
                   1186:                    ((*s_etat_processus).erreur_execution == d_ex))
                   1187:            {
                   1188: 
                   1189:                registre_instruction_valide =
                   1190:                        (*s_etat_processus).instruction_valide;
                   1191:                traitement_interruptions_logicielles(s_etat_processus);
                   1192:                (*s_etat_processus).instruction_valide =
                   1193:                        registre_instruction_valide;
                   1194:            }
                   1195:        }
                   1196:    }
                   1197: 
                   1198: /*
                   1199: --------------------------------------------------------------------------------
                   1200:   Limitation du pourcetage de temps CPU
                   1201: --------------------------------------------------------------------------------
                   1202: */
                   1203: 
                   1204:    if ((*s_etat_processus).pourcentage_maximal_cpu < 100)
                   1205:    {
1.61      bertrand 1206: #      ifndef OS2
1.1       bertrand 1207:        getrusage(RUSAGE_SELF, &usage_final);
1.61      bertrand 1208: #      else
                   1209:        usage_final = clock();
                   1210: #      endif
                   1211: 
1.1       bertrand 1212:        gettimeofday(&horodatage_final, NULL);
                   1213: 
1.86      bertrand 1214:        if ((*s_etat_processus).initialisation_scheduler == d_vrai)
1.1       bertrand 1215:        {
                   1216:            temps_reel = ((real8) (horodatage_final.tv_sec -
                   1217:                    horodatage_initial.tv_sec)) +
                   1218:                    (((real8) (horodatage_final.tv_usec -
                   1219:                    horodatage_initial.tv_usec)) / ((real8) 1E6));
                   1220: 
1.61      bertrand 1221:            // Le temps depuis la dernière limitation est de plus de un
                   1222:            // dixième de seconde.
                   1223: 
1.1       bertrand 1224:            if (temps_reel >= 0.1)
                   1225:            {
1.61      bertrand 1226: #              ifndef OS2
1.1       bertrand 1227:                temps_cpu = ((real8) ((usage_final.ru_utime.tv_sec +
                   1228:                        usage_final.ru_stime.tv_sec) -
                   1229:                        (usage_initial.ru_utime.tv_sec +
                   1230:                        usage_initial.ru_stime.tv_sec))) +
                   1231:                        (((real8) ((usage_final.ru_utime.tv_usec +
                   1232:                        usage_final.ru_stime.tv_usec) -
                   1233:                        (usage_initial.ru_utime.tv_usec +
                   1234:                        usage_initial.ru_stime.tv_usec))) / ((real8) 1E6));
1.61      bertrand 1235: #              else
                   1236:                temps_cpu = (usage_final - usage_initial) / CLOCKS_PER_SEC;
                   1237: #              endif
1.1       bertrand 1238: 
                   1239:                pourcentage = 100 * temps_cpu / temps_reel;
                   1240: 
                   1241:                if (pourcentage > 100)
                   1242:                {
                   1243:                    pourcentage = 100;
                   1244:                }
                   1245: 
                   1246:                if (pourcentage > (*s_etat_processus).pourcentage_maximal_cpu)
                   1247:                {
                   1248:                    attente = ((pourcentage * temps_cpu) /
                   1249:                            (*s_etat_processus).pourcentage_maximal_cpu)
                   1250:                            - (pourcentage * temps_cpu / 100);
                   1251: 
1.84      bertrand 1252:                    temporisation.tv_sec = (time_t) floor(attente);
                   1253:                    temporisation.tv_nsec = (suseconds_t) ((attente
1.82      bertrand 1254:                            - ((real8) temporisation.tv_sec)) * 1E9);
1.1       bertrand 1255: 
1.62      bertrand 1256:                    while(nanosleep(&temporisation, &temporisation) == -1)
                   1257:                    {
                   1258:                        if (errno != EINTR)
                   1259:                        {
                   1260:                            break;
                   1261:                        }
                   1262:                    }
1.1       bertrand 1263:                }
                   1264: 
                   1265:                horodatage_initial = horodatage_final;
                   1266:                usage_initial = usage_final;
                   1267:            }
                   1268:        }
                   1269:        else
                   1270:        {
1.86      bertrand 1271:            (*s_etat_processus).initialisation_scheduler = d_vrai;
1.1       bertrand 1272: 
                   1273:            horodatage_initial = horodatage_final;
                   1274:            usage_initial = usage_final;
                   1275:        }
                   1276:    }
1.61      bertrand 1277:    else
                   1278:    {
1.86      bertrand 1279:        (*s_etat_processus).initialisation_scheduler = d_faux;
1.61      bertrand 1280:    }
1.1       bertrand 1281: 
                   1282: /*
                   1283: --------------------------------------------------------------------------------
                   1284:   Introduction des erreurs générées
                   1285: --------------------------------------------------------------------------------
                   1286: */
                   1287: 
                   1288:    if (((*s_etat_processus).test_instruction == 'N') &&
                   1289:            ((*s_etat_processus).instruction_valide == 'Y'))
                   1290:    {
                   1291:        traitement_asynchrone_exceptions_gsl(s_etat_processus);
                   1292: 
                   1293:        if ((*s_etat_processus).erreur_processus_fils == d_vrai)
                   1294:        {
                   1295:            (*s_etat_processus).erreur_processus_fils = d_faux;
                   1296: 
                   1297:            (*s_etat_processus).erreur_systeme =
                   1298:                    (*s_etat_processus).erreur_systeme_processus_fils;
                   1299:            (*s_etat_processus).erreur_execution =
                   1300:                    (*s_etat_processus).erreur_execution_processus_fils;
                   1301:            (*s_etat_processus).arret_si_exception = d_vrai;
                   1302: 
                   1303:            if ((*s_etat_processus).pid_erreur_processus_fils == getpid())
                   1304:            {
                   1305:                (*s_etat_processus).invalidation_message_erreur = d_faux;
                   1306:            }
                   1307:            else
                   1308:            {
                   1309:                (*s_etat_processus).invalidation_message_erreur = d_vrai;
                   1310:            }
                   1311:        }
                   1312: 
                   1313:        if (((*s_etat_processus).erreur_execution != d_ex) ||
                   1314:                ((*s_etat_processus).erreur_systeme != d_es) ||
                   1315:                ((*s_etat_processus).exception != d_ep))
                   1316:        {
                   1317:            (*s_etat_processus).niveau_derniere_erreur =
                   1318:                    (*s_etat_processus).niveau_courant;
                   1319: 
                   1320:            if ((*s_etat_processus).mode_execution_programme == 'Y')
                   1321:            {
1.21      bertrand 1322:                if ((*s_etat_processus).instruction_derniere_erreur != NULL)
                   1323:                {
                   1324:                    free((*s_etat_processus).instruction_derniere_erreur);
                   1325:                    (*s_etat_processus).instruction_derniere_erreur = NULL;
                   1326:                }
                   1327: 
1.1       bertrand 1328:                if ((*s_etat_processus).instruction_courante == NULL)
                   1329:                {
                   1330:                    if (((*s_etat_processus).instruction_derniere_erreur =
                   1331:                            malloc(16 * sizeof(unsigned char))) == NULL)
                   1332:                    {
                   1333:                        (*s_etat_processus).erreur_systeme =
                   1334:                                d_es_allocation_memoire;
                   1335:                        return;
                   1336:                    }
                   1337: 
                   1338:                    strcpy((*s_etat_processus).instruction_derniere_erreur,
                   1339:                            "<not available>");
                   1340:                }
                   1341:                else
                   1342:                {
                   1343:                    if (((*s_etat_processus).instruction_derniere_erreur =
                   1344:                            malloc((strlen((*s_etat_processus)
                   1345:                            .instruction_courante) + 1) *
                   1346:                            sizeof(unsigned char))) == NULL)
                   1347:                    {
                   1348:                        (*s_etat_processus).erreur_systeme =
                   1349:                                d_es_allocation_memoire;
                   1350:                        return;
                   1351:                    }
                   1352: 
                   1353:                    strcpy((*s_etat_processus).instruction_derniere_erreur,
                   1354:                            (*s_etat_processus).instruction_courante);
                   1355:                }
                   1356:            }
                   1357:            else
                   1358:            {
1.21      bertrand 1359:                if ((*s_etat_processus).objet_courant != NULL)
1.1       bertrand 1360:                {
1.21      bertrand 1361:                    if ((*s_etat_processus).instruction_derniere_erreur != NULL)
                   1362:                    {
                   1363:                        free((*s_etat_processus).instruction_derniere_erreur);
                   1364:                        (*s_etat_processus).instruction_derniere_erreur = NULL;
                   1365:                    }
                   1366: 
                   1367:                    if (((*s_etat_processus).instruction_derniere_erreur =
                   1368:                            formateur(s_etat_processus, 0,
                   1369:                            (*s_etat_processus).objet_courant)) == NULL)
                   1370:                    {
                   1371:                        return;
                   1372:                    }
                   1373: 
                   1374:                    (*s_etat_processus).objet_courant = NULL;
1.1       bertrand 1375:                }
                   1376:            }
                   1377:        }
                   1378:    }
                   1379: 
                   1380:    return;
                   1381: }
                   1382: 
                   1383: 
                   1384: /*
                   1385: ================================================================================
                   1386:   Traitement asynchrone des erreurs de la bibliothèque GSL
                   1387: ================================================================================
                   1388:   Entrées :
                   1389: --------------------------------------------------------------------------------
                   1390:   Sorties :
                   1391: --------------------------------------------------------------------------------
                   1392:   Effets de bord : néant
                   1393: ================================================================================
                   1394: */
                   1395: 
                   1396: void
                   1397: traitement_asynchrone_exceptions_gsl(struct_processus *s_etat_processus)
                   1398: {
                   1399:    if ((*s_etat_processus).var_volatile_exception_gsl != 0)
                   1400:    {
                   1401:        switch((*s_etat_processus).var_volatile_exception_gsl)
                   1402:        {
                   1403:            case GSL_EINVAL :
                   1404:            {
                   1405:                (*s_etat_processus).erreur_execution = d_ex_argument_invalide;
                   1406:                break;
                   1407:            }
                   1408: 
                   1409:            case GSL_EDOM :
                   1410:            {
                   1411:                (*s_etat_processus).exception = d_ep_domaine_definition;
                   1412:                break;
                   1413:            }
                   1414: 
                   1415:            case GSL_ERANGE :
                   1416:            {
                   1417:                (*s_etat_processus).exception = d_ep_resultat_indefini;
                   1418:                break;
                   1419:            }
                   1420: 
                   1421:            case GSL_EZERODIV :
                   1422:            {
                   1423:                (*s_etat_processus).exception = d_ep_division_par_zero;
                   1424:                break;
                   1425:            }
                   1426: 
                   1427:            case GSL_EUNDRFLW :
                   1428:            {
                   1429:                (*s_etat_processus).exception = d_ep_underflow;
                   1430:                break;
                   1431:            }
                   1432: 
                   1433:            case GSL_EOVRFLW :
                   1434:            {
                   1435:                (*s_etat_processus).exception = d_ep_overflow;
                   1436:                break;
                   1437:            }
                   1438: 
                   1439:            case GSL_ENOMEM :
                   1440:            {
                   1441:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1442:                break;
                   1443:            }
                   1444: 
                   1445:            case GSL_ELOSS :
                   1446:            {
                   1447:                (*s_etat_processus).exception = d_ep_perte_precision;
                   1448:                break;
                   1449:            }
                   1450: 
                   1451:            default :
                   1452:            {
                   1453:                (*s_etat_processus).erreur_execution =
                   1454:                        d_ex_routines_mathematiques;
                   1455:                break;
                   1456:            }
                   1457:        }
                   1458: 
                   1459:        (*s_etat_processus).var_volatile_exception_gsl = 0;
                   1460:    }
                   1461: 
                   1462:    return;
                   1463: }
                   1464: 
                   1465: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>