Annotation of rpl/src/formateur.c, revision 1.83

1.1       bertrand    1: /*
                      2: ================================================================================
1.82      bertrand    3:   RPL/2 (R) version 4.1.27
1.81      bertrand    4:   Copyright (C) 1989-2017 Dr. BERTRAND Joël
1.1       bertrand    5: 
                      6:   This file is part of RPL/2.
                      7: 
                      8:   RPL/2 is free software; you can redistribute it and/or modify it
                      9:   under the terms of the CeCILL V2 License as published by the french
                     10:   CEA, CNRS and INRIA.
                     11:  
                     12:   RPL/2 is distributed in the hope that it will be useful, but WITHOUT
                     13:   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
                     14:   FITNESS FOR A PARTICULAR PURPOSE.  See the CeCILL V2 License
                     15:   for more details.
                     16:  
                     17:   You should have received a copy of the CeCILL License
                     18:   along with RPL/2. If not, write to info@cecill.info.
                     19: ================================================================================
                     20: */
                     21: 
                     22: 
1.16      bertrand   23: #include "rpl-conv.h"
1.1       bertrand   24: 
                     25: 
                     26: /*
                     27: ================================================================================
                     28:   Routine de formation des données pour l'affichage
                     29: ================================================================================
                     30:   Entrées : structure sur l'état du processus et objet à afficher
                     31: --------------------------------------------------------------------------------
                     32:   Sorties : chaine de caractères
                     33: --------------------------------------------------------------------------------
                     34:   Effets de bord : néant
                     35: ================================================================================
                     36: */
                     37: 
                     38: unsigned char *
                     39: formateur(struct_processus *s_etat_processus, long offset_initial,
                     40:        struct_objet *s_objet)
                     41: {
                     42:    int                         parentheses_groupe_gauche;
                     43:    int                         parentheses_groupe_droit;
                     44: 
1.83    ! bertrand   45:    integer8                    (*__type_disp)(struct_processus
        !            46:                                        *s_etat_processus, void **arg);
        !            47: 
1.1       bertrand   48:    logical1                    registre45;
                     49: 
                     50:    logical4                    autorisation_parenthese;
                     51:    logical4                    presence_signe;
                     52: 
1.58      bertrand   53:    logical8                    masque_binaire;
1.41      bertrand   54: 
1.1       bertrand   55:    struct_liste_chainee        *l_atome;
                     56:    struct_liste_chainee        *l_element_courant;
                     57:    struct_liste_chainee        *l_liste1;
                     58:    struct_liste_chainee        *l_liste2;
                     59: 
                     60:    struct_objet                *s_sous_objet;
                     61:    struct_objet                *s_sous_objet_1;
                     62:    struct_objet                *s_sous_objet_2;
                     63:    struct_objet                *s_sous_objet_3;
                     64: 
                     65:    unsigned char               base[1 + 1];
                     66:    unsigned char               *chaine;
                     67:    unsigned char               *chaine_fonction;
                     68:    unsigned char               *chaine_formatee;
                     69:    unsigned char               *chaine_tampon;
                     70:    unsigned char               *chaine_sauvegarde;
                     71:    unsigned char               *format;
                     72:    unsigned char               *format_majuscule;
                     73:    unsigned char               *ptre;
                     74:    unsigned char               *ptrl;
                     75:    unsigned char               *registre;
                     76:    unsigned char               tampon[1024 + 1];
                     77: 
1.58      bertrand   78:    integer8                    i;
                     79:    integer8                    j;
                     80:    integer8                    k;
                     81:    integer8                    longueur_chaine;
                     82:    integer8                    longueur_courante;
                     83:    integer8                    longueur_decimale_courante;
                     84:    integer8                    *longueurs_maximales;
                     85:    integer8                    nombre_arguments;
                     86:    integer8                    nombre_arguments_fonction;
                     87:    integer8                    nombre_colonnes;
                     88:    integer8                    nombre_elements;
                     89:    integer8                    nombre_lignes;
                     90:    integer8                    offset;
1.1       bertrand   91: 
                     92:    chaine = NULL;
                     93:    chaine_formatee = NULL;
                     94:    chaine_sauvegarde = NULL;
                     95: 
                     96:    strcpy(base, " ");
                     97: 
                     98:    masque_binaire = 0;
                     99: 
                    100:    if ((*s_objet).type == ADR)
                    101:    {
                    102: 
                    103: /*
                    104: --------------------------------------------------------------------------------
                    105:   Adresse
                    106: --------------------------------------------------------------------------------
                    107: */
                    108: 
1.74      bertrand  109:        if (alsprintf(s_etat_processus, &chaine,
                    110:                "@ %016llX", (*((unsigned long long *)
1.3       bertrand  111:                ((*s_objet).objet)))) < 0)
1.1       bertrand  112:        {
                    113:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    114:            return(NULL);
                    115:        }
                    116:    }
                    117:    else if ((*s_objet).type == SLB)
                    118:    {
                    119: 
                    120: /*
                    121: --------------------------------------------------------------------------------
                    122:   Bibliothèque partagée
                    123: --------------------------------------------------------------------------------
                    124: */
                    125: 
1.69      bertrand  126: #      pragma GCC diagnostic push
                    127: #      pragma GCC diagnostic ignored "-Wpointer-to-int-cast"
                    128: 
1.74      bertrand  129:        if (alsprintf(s_etat_processus, &chaine, "Library $ %016llX [%s]",
1.63      bertrand  130:                (unsigned long long) (*((struct_bibliotheque *)
1.3       bertrand  131:                (*s_objet).objet)).descripteur, (*((struct_bibliotheque *)
                    132:                (*s_objet).objet)).nom) < 0)
1.1       bertrand  133:        {
                    134:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    135:            return(NULL);
                    136:        }
1.69      bertrand  137: 
                    138: #      pragma GCC diagnostic pop
                    139: 
1.1       bertrand  140:    }
                    141:    else if ((*s_objet).type == SPH)
                    142:    {
                    143: 
                    144: /*
                    145: --------------------------------------------------------------------------------
                    146:   Sémaphore
                    147: --------------------------------------------------------------------------------
                    148: */
                    149: 
1.69      bertrand  150: #      pragma GCC diagnostic push
                    151: #      pragma GCC diagnostic ignored "-Wpointer-to-int-cast"
                    152: 
1.74      bertrand  153:        if (alsprintf(s_etat_processus,
                    154:                &chaine, "Semaphore $ %016llX '%s'", (unsigned long long)
1.3       bertrand  155:                &((*((struct_semaphore *) (*s_objet).objet)).semaphore),
                    156:                (*((struct_semaphore *) (*s_objet).objet)).nom) < 0)
1.1       bertrand  157:        {
                    158:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    159:            return(NULL);
                    160:        }
1.69      bertrand  161: 
                    162: #      pragma GCC diagnostic pop
                    163: 
1.1       bertrand  164:    }
                    165:    else if ((*s_objet).type == SQL)
                    166:    {
                    167: 
                    168: /*
                    169: --------------------------------------------------------------------------------
                    170:   Connecteur SQL
                    171: --------------------------------------------------------------------------------
                    172: */
                    173: 
                    174:        if (strcmp((*((struct_connecteur_sql *) (*s_objet).objet)).type,
                    175:                "MYSQL") == 0)
                    176:        {
                    177: #          ifdef MYSQL_SUPPORT
1.74      bertrand  178:            if (alsprintf(s_etat_processus, &chaine, "Sql $ %016llX (%s)",
1.63      bertrand  179:                    (unsigned long long) (*((struct_connecteur_sql *)
1.1       bertrand  180:                    (*s_objet).objet)).descripteur.mysql,
1.3       bertrand  181:                    (*((struct_connecteur_sql *) (*s_objet).objet)).type) < 0)
                    182:            {
                    183:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    184:                return(NULL);
                    185:            }
1.1       bertrand  186: #          else
                    187:            if ((*s_etat_processus).langue == 'F')
                    188:            {
                    189:                printf("+++Attention : Support de MySQL "
                    190:                        "non compilé !\n");
                    191:            }
                    192:            else
                    193:            {
                    194:                printf("+++Warning : MySQL support "
                    195:                        "not available !\n");
                    196:            }
                    197: 
                    198:            fflush(stdout);
                    199: #          endif
                    200:        }
                    201:        else if (strcmp((*((struct_connecteur_sql *) (*s_objet).objet)).type,
                    202:                "POSTGRESQL") == 0)
                    203:        {
                    204: #          ifdef POSTGRESQL_SUPPORT
1.74      bertrand  205:            if (alsprintf(s_etat_processus, &chaine, "Sql $ %016llX (%s)",
1.63      bertrand  206:                    (unsigned long long) (*((struct_connecteur_sql *)
1.9       bertrand  207:                    (*s_objet).objet)).descripteur.postgresql,
1.3       bertrand  208:                    (*((struct_connecteur_sql *) (*s_objet).objet)).type) < 0)
                    209:            {
                    210:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    211:                return(NULL);
                    212:            }
1.1       bertrand  213: #          else
                    214:            if ((*s_etat_processus).langue == 'F')
                    215:            {
                    216:                printf("+++Attention : Support de PostgreSQL "
                    217:                        "non compilé !\n");
                    218:            }
                    219:            else
                    220:            {
                    221:                printf("+++Warning : PostgreSQL support "
                    222:                        "not available !\n");
                    223:            }
                    224: 
                    225:            fflush(stdout);
                    226: #          endif
                    227:        }
                    228:        else
                    229:        {
                    230:            BUG(1, printf("SQL type '%s' not allowed!",
                    231:                    (*((struct_connecteur_sql *) (*s_objet).objet))
                    232:                    .type));
                    233:        }
                    234:    }
                    235:    else if ((*s_objet).type == PRC)
                    236:    {
                    237: 
                    238: /*
                    239: --------------------------------------------------------------------------------
                    240:   Processus
                    241: --------------------------------------------------------------------------------
                    242: */
                    243: 
                    244:        if ((*(*((struct_processus_fils *) (*s_objet).objet)).thread)
                    245:                .processus_detache == d_vrai)
                    246:        {
1.74      bertrand  247:            if (alsprintf(s_etat_processus, &chaine,
                    248:                    "Process $ %016llX", (unsigned long long)
1.1       bertrand  249:                    (*(*((struct_processus_fils *) (*s_objet).objet)).thread)
1.3       bertrand  250:                    .pid) < 0)
1.1       bertrand  251:            {
                    252:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    253:                return(NULL);
                    254:            }
                    255:        }
                    256:        else
                    257:        {
1.74      bertrand  258:            if (alsprintf(s_etat_processus, &chaine,
                    259:                    "Light weight process $ %016llX/%016llX",
1.63      bertrand  260:                    (unsigned long long) (*(*((struct_processus_fils *)
1.1       bertrand  261:                    (*s_objet).objet)).thread).pid,
1.63      bertrand  262:                    (unsigned long long) (*(*((struct_processus_fils *)
1.3       bertrand  263:                    (*s_objet).objet)).thread).tid) < 0)
1.1       bertrand  264:            {
                    265:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    266:                return(NULL);
                    267:            }
                    268:        }
                    269:    }
                    270:    else if ((*s_objet).type == FCH)
                    271:    {
                    272: 
                    273: /*
                    274: --------------------------------------------------------------------------------
                    275:   Fichier
                    276: --------------------------------------------------------------------------------
                    277: */
                    278: 
1.74      bertrand  279:        if (alsprintf(s_etat_processus,
                    280:                &chaine, "File $ %016llX", (unsigned long long)
1.3       bertrand  281:                (*((struct_fichier *) ((*s_objet).objet))).descripteur) < 0)
1.1       bertrand  282:        {
                    283:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    284:            return(NULL);
                    285:        }
                    286: 
                    287:        registre45 = test_cfsf(s_etat_processus, 45);
                    288:        cf(s_etat_processus, 45);
                    289: 
                    290:        if ((format = formateur(s_etat_processus, 0, (*((struct_fichier *)
                    291:                ((*s_objet).objet))).format)) == NULL)
                    292:        {
                    293:            return(NULL);
                    294:        }
                    295: 
                    296:        if (registre45 == d_vrai)
                    297:        {
                    298:            sf(s_etat_processus, 45);
                    299:        }
                    300:        else
                    301:        {
                    302:            cf(s_etat_processus, 45);
                    303:        }
                    304: 
1.74      bertrand  305:        if ((format_majuscule = conversion_majuscule(s_etat_processus,
                    306:                format)) == NULL)
1.1       bertrand  307:        {
1.74      bertrand  308:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
1.1       bertrand  309:            return(NULL);
                    310:        }
                    311: 
                    312:        free(format);
                    313: 
                    314:        registre = chaine;
                    315: 
                    316:        if ((chaine = malloc((strlen(registre) + 1 +
                    317:                strlen(format_majuscule) + 1) * sizeof(unsigned char)))
                    318:                == NULL)
                    319:        {
                    320:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    321:            return(NULL);
                    322:        }
                    323: 
                    324:        sprintf(chaine, "%s %s", registre, format_majuscule);
                    325:        free(registre);
                    326: 
                    327:        tampon[0] = d_code_fin_chaine;
                    328: 
                    329:        if ((*((struct_fichier *) ((*s_objet).objet))).acces == 'S')
                    330:        {
                    331:            strcat(tampon, "SEQUENTIAL, ");
                    332:        }
                    333:        else if ((*((struct_fichier *) ((*s_objet).objet))).acces == 'D')
                    334:        {
                    335:            strcat(tampon, "DIRECT, ");
                    336:        }
                    337:        else
                    338:        {
                    339:            strcat(tampon, "KEYED, ");
                    340:        }
                    341: 
                    342:        if ((*((struct_fichier *) ((*s_objet).objet))).binaire == 'N')
                    343:        {
                    344:            strcat(tampon, "FORMATTED, ");
                    345:        }
                    346:        else if ((*((struct_fichier *) ((*s_objet).objet))).binaire == 'Y')
                    347:        {
                    348:            strcat(tampon, "UNFORMATTED, ");
                    349:        }
                    350:        else
                    351:        {
                    352:            strcat(tampon, "FLOW, ");
                    353:        }
                    354: 
                    355:        if ((*((struct_fichier *) ((*s_objet).objet))).ouverture == 'N')
                    356:        {
                    357:            strcat(tampon, "NEW, ");
                    358:        }
                    359:        else if ((*((struct_fichier *) ((*s_objet).objet))).ouverture == 'O')
                    360:        {
                    361:            strcat(tampon, "OLD, ");
                    362:        }
                    363:        else if ((*((struct_fichier *) ((*s_objet).objet))).ouverture == 'R')
                    364:        {
                    365:            strcat(tampon, "REPLACE, ");
                    366:        }
                    367:        else if ((*((struct_fichier *) ((*s_objet).objet))).ouverture == 'U')
                    368:        {
                    369:            strcat(tampon, "UNKNOWN, ");
                    370:        }
                    371:        else
                    372:        {
                    373:            strcat(tampon, "SCRATCH, ");
                    374:        }
                    375: 
                    376:        if ((*((struct_fichier *) ((*s_objet).objet))).protection == 'R')
                    377:        {
                    378:            strcat(tampon, "READONLY");
                    379:        }
                    380:        else if ((*((struct_fichier *) ((*s_objet).objet))).protection == 'W')
                    381:        {
                    382:            strcat(tampon, "WRITEONLY");
                    383:        }
                    384:        else
                    385:        {
                    386:            strcat(tampon, "READWRITE");
                    387:        }
                    388: 
                    389:        registre = chaine;
                    390: 
                    391:        if ((chaine = malloc((strlen(chaine) + 6 + strlen(tampon) +
                    392:                strlen((*((struct_fichier *) ((*s_objet).objet))).nom) + 1) *
                    393:                sizeof(unsigned char))) == NULL)
                    394:        {
                    395:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    396:            return(NULL);
                    397:        }
                    398: 
                    399:        sprintf(chaine, "%s [%s <%s>]", registre, (*((struct_fichier *)
                    400:                ((*s_objet).objet))).nom, tampon);
                    401:        free(registre);
                    402: 
                    403:        free(format_majuscule);
                    404:    }
                    405:    else if ((*s_objet).type == SCK)
                    406:    {
                    407: 
                    408: /*
                    409: --------------------------------------------------------------------------------
                    410:   Socket
                    411: --------------------------------------------------------------------------------
                    412: */
                    413: 
1.74      bertrand  414:        if (alsprintf(s_etat_processus, &chaine,
                    415:                "Socket $ %016llX", (unsigned long long)
1.59      bertrand  416:                (*((struct_socket *) ((*s_objet).objet))).socket) < 0)
1.1       bertrand  417:        {
                    418:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    419:            return(NULL);
                    420:        }
                    421: 
                    422:        registre45 = test_cfsf(s_etat_processus, 45);
                    423:        cf(s_etat_processus, 45);
                    424: 
                    425:        if ((format = formateur(s_etat_processus, 0, (*((struct_socket *)
                    426:                ((*s_objet).objet))).format)) == NULL)
                    427:        {
                    428:            return(NULL);
                    429:        }
                    430: 
                    431:        if (registre45 == d_vrai)
                    432:        {
                    433:            sf(s_etat_processus, 45);
                    434:        }
                    435:        else
                    436:        {
                    437:            cf(s_etat_processus, 45);
                    438:        }
                    439: 
1.74      bertrand  440:        if ((format_majuscule = conversion_majuscule(s_etat_processus,
                    441:                format)) == NULL)
1.1       bertrand  442:        {
                    443:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    444:            return(NULL);
                    445:        }
                    446: 
                    447:        free(format);
                    448: 
                    449:        registre = chaine;
                    450: 
                    451:        if ((chaine = malloc((strlen(registre) + 1 +
                    452:                strlen(format_majuscule) + 1) * sizeof(unsigned char)))
                    453:                == NULL)
                    454:        {
                    455:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    456:            return(NULL);
                    457:        }
                    458: 
                    459:        sprintf(chaine, "%s %s", registre, format_majuscule);
                    460:        free(registre);
                    461: 
                    462:        tampon[0] = d_code_fin_chaine;
                    463: 
                    464:        strcat(tampon, (*((struct_socket *) ((*s_objet).objet))).type);
                    465:        strcat(tampon, ", ");
                    466: 
                    467:        if ((*((struct_socket *) ((*s_objet).objet))).domaine == PF_UNIX)
                    468:        {
                    469:            strcat(tampon, "UNIX, ");
                    470:        }
                    471:        else if ((*((struct_socket *) ((*s_objet).objet))).domaine == PF_INET)
                    472:        {
                    473:            strcat(tampon, "IPV4, ");
                    474:        }
                    475:        else if ((*((struct_socket *) ((*s_objet).objet))).domaine == PF_INET6)
                    476:        {
                    477:            strcat(tampon, "IPV6, ");
                    478:        }
                    479: 
                    480:        if ((*((struct_socket *) ((*s_objet).objet))).localisation == 'L')
                    481:        {
                    482:            strcat(tampon, "LOCAL, ");
                    483:        }
                    484:        else
                    485:        {
                    486:            strcat(tampon, "FOREIGN, ");
                    487:        }
                    488: 
                    489:        if ((*((struct_socket *) ((*s_objet).objet))).binaire == 'N')
                    490:        {
                    491:            strcat(tampon, "FORMATTED, ");
                    492:        }
                    493:        else if ((*((struct_socket *) ((*s_objet).objet))).binaire == 'Y')
                    494:        {
                    495:            strcat(tampon, "UNFORMATTED, ");
                    496:        }
                    497:        else
                    498:        {
                    499:            strcat(tampon, "FLOW, ");
                    500:        }
                    501: 
                    502:        if ((*((struct_socket *) ((*s_objet).objet))).protection == 'R')
                    503:        {
                    504:            strcat(tampon, "READONLY");
                    505:        }
                    506:        else if ((*((struct_fichier *) ((*s_objet).objet))).protection == 'W')
                    507:        {
                    508:            strcat(tampon, "WRITEONLY");
                    509:        }
                    510:        else
                    511:        {
                    512:            strcat(tampon, "READWRITE");
                    513:        }
                    514: 
                    515:        registre = chaine;
                    516: 
                    517:        if ((*((struct_socket *) ((*s_objet).objet))).localisation == 'L')
                    518:        { // Socket locale
                    519:            if ((strcmp((*((struct_socket *) ((*s_objet).objet))).type,
                    520:                    "STREAM") == 0) || (strcmp((*((struct_socket *)
                    521:                    ((*s_objet).objet))).type, "SEQUENTIAL DATAGRAM") == 0))
                    522:            {
                    523:                if (strcmp((*((struct_socket *) ((*s_objet).objet)))
                    524:                        .adresse_distante, "") == 0)
                    525:                { // Socket connectée en écoute
                    526:                    if ((chaine = malloc((strlen(registre) + 16 +
                    527:                            strlen(tampon) + strlen((*((struct_socket *)
                    528:                            ((*s_objet).objet))).adresse) +
                    529:                            + 1) * sizeof(unsigned char))) == NULL)
                    530:                    {
                    531:                        (*s_etat_processus).erreur_systeme =
                    532:                                d_es_allocation_memoire;
                    533:                        return(NULL);
                    534:                    }
                    535: 
                    536:                    sprintf(chaine, "%s [%s LISTENING <%s>]", registre,
                    537:                            (*((struct_socket *) ((*s_objet).objet))).adresse,
                    538:                            tampon);
                    539:                }
                    540:                else
                    541:                { // Socket connecté
                    542:                    if ((chaine = malloc((strlen(registre) + 12 +
                    543:                            strlen(tampon) + strlen((*((struct_socket *)
                    544:                            ((*s_objet).objet))).adresse) +
                    545:                            strlen((*((struct_socket *) ((*s_objet).objet)))
                    546:                            .adresse_distante)
                    547:                            + 1) * sizeof(unsigned char))) == NULL)
                    548:                    {
                    549:                        (*s_etat_processus).erreur_systeme =
                    550:                                d_es_allocation_memoire;
                    551:                        return(NULL);
                    552:                    }
                    553: 
                    554:                    sprintf(chaine, "%s [%s FROM %s <%s>]", registre,
                    555:                            (*((struct_socket *) ((*s_objet).objet))).adresse,
                    556:                            (*((struct_socket *) ((*s_objet).objet)))
                    557:                            .adresse_distante, tampon);
                    558:                }
                    559:            }
                    560:            else // Socket non connectée
                    561:            {
                    562:                if ((chaine = malloc((strlen(registre) + 6 +
                    563:                        strlen(tampon) + strlen((*((struct_socket *)
                    564:                        ((*s_objet).objet))).adresse) +
                    565:                        + 1) * sizeof(unsigned char))) == NULL)
                    566:                {
                    567:                    (*s_etat_processus).erreur_systeme =
                    568:                            d_es_allocation_memoire;
                    569:                    return(NULL);
                    570:                }
                    571: 
                    572:                sprintf(chaine, "%s [%s <%s>]", registre,
                    573:                        (*((struct_socket *) ((*s_objet).objet))).adresse,
                    574:                        tampon);
                    575:            }
                    576:        }
                    577:        else
                    578:        { // Socket distante
                    579:            if ((strcmp((*((struct_socket *) ((*s_objet).objet))).type,
                    580:                    "STREAM") == 0) || (strcmp((*((struct_socket *)
                    581:                    ((*s_objet).objet))).type, "SEQUENTIAL DATAGRAM") == 0))
                    582:            {
                    583:                if ((chaine = malloc((strlen(registre) + 9 +
                    584:                        strlen((*((struct_socket *) ((*s_objet).objet)))
                    585:                        .adresse) + strlen(tampon)
                    586:                        + 1) * sizeof(unsigned char))) == NULL)
                    587:                {
                    588:                    (*s_etat_processus).erreur_systeme =
                    589:                            d_es_allocation_memoire;
                    590:                    return(NULL);
                    591:                }
                    592: 
                    593:                sprintf(chaine, "%s [TO %s <%s>]", registre,
                    594:                        (*((struct_socket *) ((*s_objet).objet)))
                    595:                        .adresse, tampon);
                    596:            }
                    597:            else
                    598:            {
                    599:                if (strcmp((*((struct_socket *) ((*s_objet).objet)))
                    600:                        .adresse_distante, "") == 0)
                    601:                {
                    602:                    if ((chaine = malloc((strlen(registre) + 5 +
                    603:                            strlen(tampon) + 1) * sizeof(unsigned char)))
                    604:                            == NULL)
                    605:                    {
                    606:                        (*s_etat_processus).erreur_systeme =
                    607:                                d_es_allocation_memoire;
                    608:                        return(NULL);
                    609:                    }
                    610: 
                    611:                    sprintf(chaine, "%s [<%s>]", registre, tampon);
                    612:                }
                    613:                else
                    614:                {
                    615:                    if ((chaine = malloc((strlen(registre) + 9 +
                    616:                            strlen((*((struct_socket *) ((*s_objet).objet)))
                    617:                            .adresse_distante) + strlen(tampon)
                    618:                            + 1) * sizeof(unsigned char))) == NULL)
                    619:                    {
                    620:                        (*s_etat_processus).erreur_systeme =
                    621:                                d_es_allocation_memoire;
                    622:                        return(NULL);
                    623:                    }
                    624: 
                    625:                    sprintf(chaine, "%s [TO %s <%s>]", registre,
                    626:                            (*((struct_socket *) ((*s_objet).objet)))
                    627:                            .adresse_distante, tampon);
                    628:                }
                    629:            }
                    630:        }
                    631: 
                    632:        free(registre);
                    633:        free(format_majuscule);
                    634:    }
                    635:    else if ((*s_objet).type == ALG)
                    636:    {
                    637: 
                    638: /*
                    639: --------------------------------------------------------------------------------
                    640:   Expression algébrique
                    641: --------------------------------------------------------------------------------
                    642: */
                    643: 
                    644:        l_element_courant = (struct_liste_chainee *) (*s_objet).objet;
                    645: 
                    646:        while(l_element_courant != NULL)
                    647:        {
                    648:            if ((*(*l_element_courant).donnee).type == FCT)
                    649:            {
                    650:                if ((strcmp((*((struct_fonction *) (*(*l_element_courant)
                    651:                        .donnee).objet)).nom_fonction, "<<") != 0) &&
                    652:                        (strcmp((*((struct_fonction *) (*(*l_element_courant)
                    653:                        .donnee).objet)).nom_fonction, ">>") != 0))
                    654:                {
                    655:                    if ((strcmp((*((struct_fonction *) (*(*l_element_courant)
                    656:                            .donnee).objet)).nom_fonction, "+") == 0) ||
                    657:                            (strcmp((*((struct_fonction *)
                    658:                            (*(*l_element_courant).donnee).objet))
                    659:                            .nom_fonction, "-") == 0) || (strcmp(
                    660:                            (*((struct_fonction *) (*(*l_element_courant)
                    661:                            .donnee).objet)).nom_fonction, "*") == 0) ||
                    662:                            (strcmp((*((struct_fonction *)
                    663:                            (*(*l_element_courant).donnee).objet)).nom_fonction,
                    664:                            "/") == 0) || (strcmp((*((struct_fonction *)
                    665:                            (*(*l_element_courant).donnee).objet)).nom_fonction,
                    666:                            "^") == 0) || (strcmp((*((struct_fonction *)
                    667:                            (*(*l_element_courant).donnee).objet)).nom_fonction,
                    668:                            "<") == 0) || (strcmp((*((struct_fonction *)
                    669:                            (*(*l_element_courant).donnee).objet)).nom_fonction,
                    670:                            ">") == 0) || (strcmp((*((struct_fonction *)
                    671:                            (*(*l_element_courant).donnee).objet)).nom_fonction,
                    672:                            "==") == 0) || (strcmp((*((struct_fonction *)
                    673:                            (*(*l_element_courant).donnee).objet)).nom_fonction,
                    674:                            "<>") == 0) || (strcmp((*((struct_fonction *)
                    675:                            (*(*l_element_courant).donnee).objet)).nom_fonction,
                    676:                            "<=") == 0) || (strcmp((*((struct_fonction *)
                    677:                            (*(*l_element_courant).donnee).objet)).nom_fonction,
                    678:                            "=<") == 0) || (strcmp((*((struct_fonction *)
                    679:                            (*(*l_element_courant).donnee).objet)).nom_fonction,
                    680:                            ">=") == 0) || (strcmp((*((struct_fonction *)
                    681:                            (*(*l_element_courant).donnee).objet)).nom_fonction,
                    682:                            "=>") == 0))
                    683:                    {
                    684:                        if (depilement(s_etat_processus, &((*s_etat_processus)
                    685:                                .l_base_pile), &s_sous_objet_2) == d_erreur)
                    686:                        {
                    687:                            return(NULL);
                    688:                        }
                    689: 
                    690:                        chaine_sauvegarde = (*s_etat_processus)
                    691:                                .instruction_courante;
                    692: 
                    693:                        if (((*s_etat_processus).instruction_courante =
                    694:                                (unsigned char *) malloc((strlen(
                    695:                                (unsigned char *) (*s_sous_objet_2).objet) + 2
                    696:                                + 1) * sizeof(unsigned char))) == NULL)
                    697:                        {
                    698:                            (*s_etat_processus).instruction_courante =
                    699:                                    chaine_sauvegarde;
                    700:                            (*s_etat_processus).erreur_systeme =
                    701:                                    d_es_allocation_memoire;
                    702:                            return(NULL);
                    703:                        }
                    704: 
                    705:                        sprintf((*s_etat_processus).instruction_courante,
                    706:                                "'%s'", (unsigned char *)
                    707:                                (*s_sous_objet_2).objet);
                    708: 
                    709:                        presence_signe = (((*s_etat_processus)
                    710:                                .instruction_courante[1] == '+')
                    711:                                || ((*s_etat_processus).instruction_courante[1]
                    712:                                == '-')) ? d_vrai : d_faux;
                    713: 
1.71      bertrand  714:                        (*s_etat_processus).type_en_cours = NON;
1.1       bertrand  715:                        recherche_type(s_etat_processus);
                    716: 
                    717:                        if ((*s_etat_processus).erreur_execution != d_ex)
                    718:                        {
                    719:                            // Aucune erreur d'exécution ne peut être
                    720:                            // retournée, car l'argument est cohérent.
                    721: 
                    722:                            return(NULL);
                    723:                        }
                    724: 
                    725:                        if (depilement(s_etat_processus, &((*s_etat_processus)
                    726:                                .l_base_pile), &s_sous_objet_3) == d_erreur)
                    727:                        {
                    728:                            return(NULL);
                    729:                        }
                    730: 
                    731:                        free((*s_etat_processus).instruction_courante);
                    732: 
                    733:                        (*s_etat_processus).instruction_courante =
                    734:                                chaine_sauvegarde;
                    735: 
                    736:                        autorisation_parenthese = d_faux;
                    737: 
                    738:                        if ((*s_sous_objet_3).type == ALG)
                    739:                        {
                    740:                            l_atome = (struct_liste_chainee *)
                    741:                                    (*s_sous_objet_3).objet;
                    742:                            chaine_fonction = "";
                    743:                            nombre_arguments_fonction = 0;
                    744: 
                    745:                            while(l_atome != NULL)
                    746:                            {
                    747:                                if ((*(*l_atome).donnee).type == FCT)
                    748:                                {
                    749:                                    if (strcmp((*((struct_fonction *)
                    750:                                            (*(*l_atome).donnee).objet))
                    751:                                            .nom_fonction, ">>") != 0)
                    752:                                    {
                    753:                                        chaine_fonction = (*((struct_fonction *)
                    754:                                                (*(*l_atome).donnee).objet))
                    755:                                                .nom_fonction;
                    756:                                        nombre_arguments_fonction =
                    757:                                                (*((struct_fonction *)
                    758:                                                (*(*l_atome).donnee).objet))
                    759:                                                .nombre_arguments;
                    760:                                    }
                    761:                                }
                    762: 
                    763:                                l_atome = (*l_atome).suivant;
                    764:                            }
                    765: 
                    766:                            if (strcmp((*((struct_fonction *)
                    767:                                    (*(*l_element_courant).donnee).objet))
                    768:                                    .nom_fonction, "+") == 0)
                    769:                            {
                    770:                                if ((strcmp(chaine_fonction, "AND") == 0) ||
                    771:                                        (strcmp(chaine_fonction, "XOR") == 0) ||
1.72      bertrand  772:                                        (strcmp(chaine_fonction, "EQV") == 0) ||
1.1       bertrand  773:                                        (strcmp(chaine_fonction, "OR") == 0))
                    774:                                {
                    775:                                    autorisation_parenthese = d_vrai;
                    776:                                }
                    777:                            }
                    778:                            else if (strcmp((*((struct_fonction *)
                    779:                                    (*(*l_element_courant).donnee).objet))
                    780:                                    .nom_fonction, "-") == 0)
                    781:                            {
                    782:                                if (nombre_arguments_fonction != 0)
                    783:                                {
                    784:                                    autorisation_parenthese = d_faux;
                    785:                                }
                    786:                                else
                    787:                                {
                    788:                                    autorisation_parenthese = d_vrai;
                    789:                                }
                    790:                            }
                    791:                            else if (strcmp((*((struct_fonction *)
                    792:                                    (*(*l_element_courant).donnee).objet))
                    793:                                    .nom_fonction, "*") == 0)
                    794:                            {
                    795:                                if ((strcmp(chaine_fonction, "+") == 0) ||
                    796:                                        (strcmp(chaine_fonction, "-") == 0) ||
                    797:                                        (strcmp(chaine_fonction, "AND") == 0) ||
                    798:                                        (strcmp(chaine_fonction, "XOR") == 0) ||
1.72      bertrand  799:                                        (strcmp(chaine_fonction, "EQV") == 0) ||
1.1       bertrand  800:                                        (strcmp(chaine_fonction, "OR") == 0))
                    801:                                {
                    802:                                    autorisation_parenthese = d_vrai;
                    803:                                }
                    804:                            }
                    805:                            else if (strcmp((*((struct_fonction *)
                    806:                                    (*(*l_element_courant).donnee).objet))
                    807:                                    .nom_fonction, "/") == 0)
                    808:                            {
                    809:                                if (nombre_arguments_fonction != 0)
                    810:                                {
                    811:                                    autorisation_parenthese = d_faux;
                    812:                                }
                    813:                                else
                    814:                                {
                    815:                                    autorisation_parenthese = d_vrai;
                    816:                                }
                    817:                            }
                    818:                            else if ((strcmp((*((struct_fonction *)
                    819:                                    (*(*l_element_courant).donnee).objet))
                    820:                                    .nom_fonction, "^") == 0))
                    821:                            {
                    822:                                if (nombre_arguments_fonction != 0)
                    823:                                {
                    824:                                    autorisation_parenthese = d_faux;
                    825:                                }
                    826:                                else
                    827:                                {
                    828:                                    autorisation_parenthese = d_vrai;
                    829:                                }
                    830:                            }
                    831:                        }
                    832: 
                    833:                        if ((autorisation_parenthese == d_vrai) ||
                    834:                                (presence_signe == d_vrai))
                    835:                        {
                    836:                            chaine_sauvegarde = (unsigned char *)
                    837:                                    (*s_sous_objet_2).objet;
                    838: 
1.58      bertrand  839:                            if (((*s_sous_objet_2).objet =
1.1       bertrand  840:                                    malloc((strlen(chaine_sauvegarde) + 2 + 1)
                    841:                                    * sizeof(unsigned char))) == NULL)
                    842:                            {
                    843:                                (*s_etat_processus).erreur_systeme =
                    844:                                        d_es_allocation_memoire;
                    845:                                return(NULL);
                    846:                            }
                    847: 
                    848:                            sprintf((unsigned char *) (*s_sous_objet_2).objet,
                    849:                                    "(%s)", chaine_sauvegarde);
                    850:                            free(chaine_sauvegarde);
                    851:                        }
                    852: 
                    853:                        liberation(s_etat_processus, s_sous_objet_3);
                    854: 
                    855:                        if (depilement(s_etat_processus, &((*s_etat_processus)
                    856:                                .l_base_pile), &s_sous_objet_1) == d_erreur)
                    857:                        {
                    858:                            return(NULL);
                    859:                        }
                    860: 
                    861:                        chaine_sauvegarde = (*s_etat_processus)
                    862:                                .instruction_courante;
                    863: 
                    864:                        if (((*s_etat_processus).instruction_courante =
                    865:                                (unsigned char *) malloc((strlen(
                    866:                                (unsigned char *) (*s_sous_objet_1).objet) + 2
                    867:                                + 1) * sizeof(unsigned char))) == NULL)
                    868:                        {
                    869:                            (*s_etat_processus).instruction_courante =
                    870:                                    chaine_sauvegarde;
                    871:                            (*s_etat_processus).erreur_systeme =
                    872:                                    d_es_allocation_memoire;
                    873:                            return(NULL);
                    874:                        }
                    875: 
                    876:                        sprintf((*s_etat_processus).instruction_courante,
                    877:                                "'%s'", (unsigned char *)
                    878:                                (*s_sous_objet_1).objet);
                    879: 
1.71      bertrand  880:                        (*s_etat_processus).type_en_cours = NON;
1.1       bertrand  881:                        recherche_type(s_etat_processus);
                    882: 
                    883:                        if ((*s_etat_processus).erreur_execution != d_ex)
                    884:                        {
                    885:                            // Aucune erreur d'exécution ne peut être
                    886:                            // retournée, car l'argument est cohérent.
                    887: 
                    888:                            return(NULL);
                    889:                        }
                    890: 
                    891:                        if (depilement(s_etat_processus, &((*s_etat_processus)
                    892:                                .l_base_pile), &s_sous_objet_3) == d_erreur)
                    893:                        {
                    894:                            return(NULL);
                    895:                        }
                    896: 
                    897:                        free((*s_etat_processus).instruction_courante);
                    898: 
                    899:                        (*s_etat_processus).instruction_courante =
                    900:                                chaine_sauvegarde;
                    901: 
                    902:                        autorisation_parenthese = d_faux;
                    903: 
                    904:                        if ((*s_sous_objet_3).type == ALG)
                    905:                        {
                    906:                            l_atome = (struct_liste_chainee *)
                    907:                                    (*s_sous_objet_3).objet;
                    908:                            chaine_fonction = "";
                    909: 
                    910:                            while(l_atome != NULL)
                    911:                            {
                    912:                                if ((*(*l_atome).donnee).type == FCT)
                    913:                                {
                    914:                                    if (strcmp((*((struct_fonction *)
                    915:                                            (*(*l_atome).donnee).objet))
                    916:                                            .nom_fonction, ">>") != 0)
                    917:                                    {
                    918:                                        chaine_fonction = (*((struct_fonction *)
                    919:                                                (*(*l_atome).donnee).objet))
                    920:                                                .nom_fonction;
                    921:                                    }
                    922:                                }
                    923: 
                    924:                                l_atome = (*l_atome).suivant;
                    925:                            }
                    926: 
                    927:                            if ((strcmp((*((struct_fonction *)
                    928:                                    (*(*l_element_courant).donnee).objet))
                    929:                                    .nom_fonction, "+") == 0) ||
                    930:                                    (strcmp((*((struct_fonction *)
                    931:                                    (*(*l_element_courant).donnee).objet))
                    932:                                    .nom_fonction, "-") == 0))
                    933:                            {
                    934:                                if ((strcmp(chaine_fonction, "AND") == 0) ||
                    935:                                        (strcmp(chaine_fonction, "XOR") == 0) ||
1.72      bertrand  936:                                        (strcmp(chaine_fonction, "EQV") == 0) ||
1.1       bertrand  937:                                        (strcmp(chaine_fonction, "OR") == 0))
                    938:                                {
                    939:                                    autorisation_parenthese = d_vrai;
                    940:                                }
                    941:                            }
                    942:                            else if ((strcmp((*((struct_fonction *)
                    943:                                    (*(*l_element_courant).donnee).objet))
                    944:                                    .nom_fonction, "*") == 0) ||
                    945:                                    (strcmp((*((struct_fonction *)
                    946:                                    (*(*l_element_courant).donnee).objet))
                    947:                                    .nom_fonction, "/") == 0))
                    948:                            {
                    949:                                if ((strcmp(chaine_fonction, "+") == 0) ||
                    950:                                        (strcmp(chaine_fonction, "-") == 0) ||
                    951:                                        (strcmp(chaine_fonction, "AND") == 0) ||
                    952:                                        (strcmp(chaine_fonction, "XOR") == 0) ||
1.72      bertrand  953:                                        (strcmp(chaine_fonction, "EQV") == 0) ||
1.1       bertrand  954:                                        (strcmp(chaine_fonction, "OR") == 0))
                    955:                                {
                    956:                                    autorisation_parenthese = d_vrai;
                    957:                                }
                    958:                            }
                    959:                            else if ((strcmp((*((struct_fonction *)
                    960:                                    (*(*l_element_courant).donnee).objet))
                    961:                                    .nom_fonction, "^") == 0))
                    962:                            {
                    963:                                autorisation_parenthese = d_vrai;
                    964:                            }
                    965:                        }
                    966: 
                    967:                        if (autorisation_parenthese == d_vrai)
                    968:                        {
                    969:                            chaine_sauvegarde = (unsigned char *)
                    970:                                    (*s_sous_objet_1).objet;
                    971: 
1.58      bertrand  972:                            if (((*s_sous_objet_1).objet =
1.1       bertrand  973:                                    malloc((strlen(chaine_sauvegarde) + 2 + 1)
                    974:                                    * sizeof(unsigned char))) == NULL)
                    975:                            {
                    976:                                (*s_etat_processus).erreur_systeme =
                    977:                                        d_es_allocation_memoire;
                    978:                                return(NULL);
                    979:                            }
                    980: 
                    981:                            sprintf((unsigned char *) (*s_sous_objet_1).objet,
                    982:                                    "(%s)", chaine_sauvegarde);
                    983:                            free(chaine_sauvegarde);
                    984:                        }
                    985: 
                    986:                        liberation(s_etat_processus, s_sous_objet_3);
                    987: 
                    988:                        if ((s_sous_objet = allocation(s_etat_processus, CHN))
                    989:                                == NULL)
                    990:                        {
                    991:                            (*s_etat_processus).erreur_systeme =
                    992:                                    d_es_allocation_memoire;
                    993:                            return(NULL);
                    994:                        }
                    995: 
1.58      bertrand  996:                        if (((*s_sous_objet).objet = malloc((strlen(
1.1       bertrand  997:                                (unsigned char *) (*s_sous_objet_1).objet) +
                    998:                                strlen((*((struct_fonction *)
                    999:                                (*(*l_element_courant).donnee).objet))
                   1000:                                .nom_fonction) + strlen((unsigned char *)
                   1001:                                (*s_sous_objet_2).objet) + 1) *
                   1002:                                sizeof(unsigned char))) == NULL)
                   1003:                        {
                   1004:                            (*s_etat_processus).erreur_systeme =
                   1005:                                    d_es_allocation_memoire;
                   1006:                            return(NULL);
                   1007:                        }
                   1008: 
                   1009:                        sprintf((unsigned char *) (*s_sous_objet).objet,
                   1010:                                "%s%s%s", (unsigned char *)
                   1011:                                (*s_sous_objet_1)
                   1012:                                .objet, (*((struct_fonction *)
                   1013:                                (*(*l_element_courant).donnee).objet))
                   1014:                                .nom_fonction, (unsigned char *)
                   1015:                                (*s_sous_objet_2).objet);
                   1016: 
                   1017:                        liberation(s_etat_processus, s_sous_objet_1);
                   1018:                        liberation(s_etat_processus, s_sous_objet_2);
                   1019: 
                   1020:                        if (empilement(s_etat_processus, &((*s_etat_processus)
                   1021:                                .l_base_pile), s_sous_objet) == d_erreur)
                   1022:                        {
                   1023:                            return(NULL);
                   1024:                        }
                   1025:                    }
                   1026:                    else if (strcmp((*((struct_fonction *)
                   1027:                            (*(*l_element_courant).donnee).objet)).nom_fonction,
                   1028:                            "=") == 0)
                   1029:                    {
                   1030:                        if (depilement(s_etat_processus, &((*s_etat_processus)
                   1031:                                .l_base_pile), &s_sous_objet_2) == d_erreur)
                   1032:                        {
                   1033:                            return(NULL);
                   1034:                        }
                   1035: 
                   1036:                        if (depilement(s_etat_processus, &((*s_etat_processus)
                   1037:                                .l_base_pile), &s_sous_objet_1) == d_erreur)
                   1038:                        {
                   1039:                            return(NULL);
                   1040:                        }
                   1041: 
                   1042:                        if ((s_sous_objet = allocation(s_etat_processus, CHN))
                   1043:                                == NULL)
                   1044:                        {
                   1045:                            (*s_etat_processus).erreur_systeme =
                   1046:                                    d_es_allocation_memoire;
                   1047:                            return(NULL);
                   1048:                        }
                   1049: 
                   1050:                        autorisation_parenthese = d_vrai;
                   1051:                        l_atome = l_element_courant;
                   1052: 
                   1053:                        if (l_atome != NULL)
                   1054:                        {
                   1055:                            if ((*l_atome).suivant != NULL)
                   1056:                            {
                   1057:                                l_atome = (*l_atome).suivant;
                   1058: 
                   1059:                                if ((*(*l_atome).donnee).type == FCT)
                   1060:                                {
                   1061:                                    if (strcmp((*((struct_fonction *)
                   1062:                                            (*(*l_atome).donnee).objet))
                   1063:                                            .nom_fonction, ">>") == 0)
                   1064:                                    {
                   1065:                                        if ((*l_atome).suivant == NULL)
                   1066:                                        {
                   1067:                                            autorisation_parenthese = d_faux;
                   1068:                                        }
                   1069:                                    }
                   1070:                                }
                   1071:                            }
                   1072:                        }
                   1073: 
                   1074:                        if (autorisation_parenthese == d_vrai)
                   1075:                        {
                   1076:                            if (((*s_sous_objet).objet =
1.58      bertrand 1077:                                    malloc((strlen(
1.1       bertrand 1078:                                    (unsigned char *) (*s_sous_objet_1).objet) +
                   1079:                                    strlen((*((struct_fonction *)
                   1080:                                    (*(*l_element_courant).donnee).objet))
                   1081:                                    .nom_fonction) + strlen((unsigned char *)
                   1082:                                    (*s_sous_objet_2).objet) + 2 + 1) *
                   1083:                                    sizeof(unsigned char))) == NULL)
                   1084:                            {
                   1085:                                (*s_etat_processus).erreur_systeme =
                   1086:                                        d_es_allocation_memoire;
                   1087:                                return(NULL);
                   1088:                            }
                   1089: 
                   1090:                            sprintf((unsigned char *) (*s_sous_objet).objet,
                   1091:                                    "(%s%s%s)", (unsigned char *)
                   1092:                                    (*s_sous_objet_1)
                   1093:                                    .objet, (*((struct_fonction *)
                   1094:                                    (*(*l_element_courant).donnee).objet))
                   1095:                                    .nom_fonction, (unsigned char *)
                   1096:                                    (*s_sous_objet_2).objet);
                   1097:                        }
                   1098:                        else
                   1099:                        {
                   1100:                            if (((*s_sous_objet).objet =
1.58      bertrand 1101:                                    malloc((strlen(
1.1       bertrand 1102:                                    (unsigned char *) (*s_sous_objet_1).objet) +
                   1103:                                    strlen((*((struct_fonction *)
                   1104:                                    (*(*l_element_courant).donnee).objet))
                   1105:                                    .nom_fonction) + strlen((unsigned char *)
                   1106:                                    (*s_sous_objet_2).objet) + 1) *
                   1107:                                    sizeof(unsigned char))) == NULL)
                   1108:                            {
                   1109:                                (*s_etat_processus).erreur_systeme =
                   1110:                                        d_es_allocation_memoire;
                   1111:                                return(NULL);
                   1112:                            }
                   1113: 
                   1114:                            sprintf((unsigned char *) (*s_sous_objet).objet,
                   1115:                                    "%s%s%s", (unsigned char *)
                   1116:                                    (*s_sous_objet_1)
                   1117:                                    .objet, (*((struct_fonction *)
                   1118:                                    (*(*l_element_courant).donnee).objet))
                   1119:                                    .nom_fonction, (unsigned char *)
                   1120:                                    (*s_sous_objet_2).objet);
                   1121:                        }
                   1122: 
                   1123:                        liberation(s_etat_processus, s_sous_objet_1);
                   1124:                        liberation(s_etat_processus, s_sous_objet_2);
                   1125: 
                   1126:                        if (empilement(s_etat_processus, &((*s_etat_processus)
                   1127:                                .l_base_pile), s_sous_objet) == d_erreur)
                   1128:                        {
                   1129:                            return(NULL);
                   1130:                        }
                   1131:                    }
                   1132:                    else if (strcmp((*((struct_fonction *)
                   1133:                            (*(*l_element_courant).donnee).objet)).nom_fonction,
                   1134:                            "NOT") == 0)
                   1135:                    {
                   1136:                        if (depilement(s_etat_processus, &((*s_etat_processus)
                   1137:                                .l_base_pile), &s_sous_objet_1) == d_erreur)
                   1138:                        {
                   1139:                            return(NULL);
                   1140:                        }
                   1141: 
                   1142:                        if ((s_sous_objet = allocation(s_etat_processus, CHN))
                   1143:                                == NULL)
                   1144:                        {
                   1145:                            (*s_etat_processus).erreur_systeme =
                   1146:                                    d_es_allocation_memoire;
                   1147:                            return(NULL);
                   1148:                        }
                   1149: 
                   1150:                        if (((*s_sous_objet).objet = (unsigned char *) malloc(
                   1151:                                (strlen((unsigned char *) (*s_sous_objet_1)
                   1152:                                .objet) + 5 + 1) * sizeof(unsigned char))) ==
                   1153:                                NULL)
                   1154:                        {
                   1155:                            (*s_etat_processus).erreur_systeme =
                   1156:                                    d_es_allocation_memoire;
                   1157:                            return(NULL);
                   1158:                        }
                   1159: 
                   1160:                        sprintf((unsigned char *) (*s_sous_objet).objet,
                   1161:                                "%s(%s)", (*((struct_fonction *)
                   1162:                                (*(*l_element_courant).donnee).objet))
                   1163:                                .nom_fonction, (unsigned char *)
                   1164:                                (*s_sous_objet_1).objet );
                   1165: 
                   1166:                        liberation(s_etat_processus, s_sous_objet_1);
                   1167: 
                   1168:                        if (empilement(s_etat_processus, &((*s_etat_processus)
                   1169:                                .l_base_pile), s_sous_objet) == d_erreur)
                   1170:                        {
                   1171:                            return(NULL);
                   1172:                        }
                   1173:                    }
                   1174:                    else if ((strcmp((*((struct_fonction *)
                   1175:                            (*(*l_element_courant).donnee).objet)).nom_fonction,
                   1176:                            "OR") == 0) || (strcmp((*((struct_fonction *)
                   1177:                            (*(*l_element_courant).donnee).objet)).nom_fonction,
                   1178:                            "XOR") == 0) || (strcmp((*((struct_fonction *)
                   1179:                            (*(*l_element_courant).donnee).objet)).nom_fonction,
1.72      bertrand 1180:                            "EQV") == 0) || (strcmp((*((struct_fonction *)
                   1181:                            (*(*l_element_courant).donnee).objet)).nom_fonction,
1.1       bertrand 1182:                            "AND") == 0))
                   1183:                    {
                   1184:                        if (depilement(s_etat_processus, &((*s_etat_processus)
                   1185:                                .l_base_pile), &s_sous_objet_2) == d_erreur)
                   1186:                        {
                   1187:                            return(NULL);
                   1188:                        }
                   1189: 
                   1190:                        if (depilement(s_etat_processus, &((*s_etat_processus)
                   1191:                                .l_base_pile), &s_sous_objet_1) == d_erreur)
                   1192:                        {
                   1193:                            return(NULL);
                   1194:                        }
                   1195: 
                   1196:                        if ((s_sous_objet = allocation(s_etat_processus, CHN))
                   1197:                                == NULL)
                   1198:                        {
                   1199:                            (*s_etat_processus).erreur_systeme =
                   1200:                                    d_es_allocation_memoire;
                   1201:                            return(NULL);
                   1202:                        }
                   1203: 
                   1204:                        parentheses_groupe_gauche = 0;
                   1205:                        parentheses_groupe_droit = 0;
                   1206: 
                   1207:                        chaine_sauvegarde = (*s_etat_processus)
                   1208:                                .instruction_courante;
                   1209: 
                   1210:                        if (((*s_etat_processus).instruction_courante =
                   1211:                                (unsigned char *) malloc((strlen(
                   1212:                                (unsigned char *) (*s_sous_objet_1).objet) + 2
                   1213:                                + 1) * sizeof(unsigned char))) == NULL)
                   1214:                        {
                   1215:                            (*s_etat_processus).instruction_courante =
                   1216:                                    chaine_sauvegarde;
                   1217:                            (*s_etat_processus).erreur_systeme =
                   1218:                                    d_es_allocation_memoire;
                   1219:                            return(NULL);
                   1220:                        }
                   1221: 
                   1222:                        sprintf((*s_etat_processus).instruction_courante,
                   1223:                                "'%s'", (unsigned char *)
                   1224:                                (*s_sous_objet_1).objet);
                   1225: 
1.71      bertrand 1226:                        (*s_etat_processus).type_en_cours = NON;
1.1       bertrand 1227:                        recherche_type(s_etat_processus);
                   1228: 
                   1229:                        if ((*s_etat_processus).erreur_execution != d_ex)
                   1230:                        {
                   1231:                            // Aucune erreur d'exécution ne peut être
                   1232:                            // retournée, car l'argument est cohérent.
                   1233: 
                   1234:                            return(NULL);
                   1235:                        }
                   1236: 
                   1237:                        if (depilement(s_etat_processus, &((*s_etat_processus)
                   1238:                                .l_base_pile), &s_sous_objet_3) == d_erreur)
                   1239:                        {
                   1240:                            return(NULL);
                   1241:                        }
                   1242: 
                   1243:                        free((*s_etat_processus).instruction_courante);
                   1244: 
                   1245:                        (*s_etat_processus).instruction_courante =
                   1246:                                chaine_sauvegarde;
                   1247: 
                   1248:                        if ((*s_sous_objet_3).type == ALG)
                   1249:                        {
                   1250:                            l_atome = (struct_liste_chainee *)
                   1251:                                    (*s_sous_objet_3).objet;
                   1252:                            chaine_fonction = "";
                   1253: 
                   1254:                            while(l_atome != NULL)
                   1255:                            {
                   1256:                                if ((*(*l_atome).donnee).type == FCT)
                   1257:                                {
                   1258:                                    if (strcmp((*((struct_fonction *)
                   1259:                                            (*(*l_atome).donnee).objet))
                   1260:                                            .nom_fonction, ">>") != 0)
                   1261:                                    {
                   1262:                                        chaine_fonction = (*((struct_fonction *)
                   1263:                                                (*(*l_atome).donnee).objet))
                   1264:                                                .nom_fonction;
                   1265:                                    }
                   1266:                                }
                   1267: 
                   1268:                                l_atome = (*l_atome).suivant;
                   1269:                            }
                   1270: 
                   1271:                            if (((strcmp(chaine_fonction, "OR") == 0) ||
1.72      bertrand 1272:                                    (strcmp(chaine_fonction, "EQV") == 0) ||
1.1       bertrand 1273:                                    (strcmp(chaine_fonction, "XOR") == 0)) &&
                   1274:                                    (strcmp((*((struct_fonction *)
                   1275:                                    (*(*l_element_courant).donnee).objet))
                   1276:                                    .nom_fonction, "AND") == 0))
                   1277:                            {
                   1278:                                parentheses_groupe_gauche = 2;
                   1279:                            }
                   1280:                        }
                   1281: 
                   1282:                        liberation(s_etat_processus, s_sous_objet_3);
                   1283: 
                   1284:                        chaine_sauvegarde = (*s_etat_processus)
                   1285:                                .instruction_courante;
                   1286: 
                   1287:                        if (((*s_etat_processus).instruction_courante =
                   1288:                                (unsigned char *) malloc((strlen(
                   1289:                                (unsigned char *) (*s_sous_objet_2).objet) + 2
                   1290:                                + 1) * sizeof(unsigned char))) == NULL)
                   1291:                        {
                   1292:                            (*s_etat_processus).instruction_courante =
                   1293:                                    chaine_sauvegarde;
                   1294:                            (*s_etat_processus).erreur_systeme =
                   1295:                                    d_es_allocation_memoire;
                   1296:                            return(NULL);
                   1297:                        }
                   1298: 
                   1299:                        sprintf((*s_etat_processus).instruction_courante,
                   1300:                                "'%s'", (unsigned char *)
                   1301:                                (*s_sous_objet_2).objet);
                   1302: 
1.71      bertrand 1303:                        (*s_etat_processus).type_en_cours = NON;
1.1       bertrand 1304:                        recherche_type(s_etat_processus);
                   1305: 
                   1306:                        if ((*s_etat_processus).erreur_execution != d_ex)
                   1307:                        {
                   1308:                            // Aucune erreur d'exécution ne peut être
                   1309:                            // retournée, car l'argument est cohérent.
                   1310: 
                   1311:                            return(NULL);
                   1312:                        }
                   1313: 
                   1314:                        if (depilement(s_etat_processus, &((*s_etat_processus)
                   1315:                                .l_base_pile), &s_sous_objet_3) == d_erreur)
                   1316:                        {
                   1317:                            return(NULL);
                   1318:                        }
                   1319: 
                   1320:                        free((*s_etat_processus).instruction_courante);
                   1321: 
                   1322:                        (*s_etat_processus).instruction_courante =
                   1323:                                chaine_sauvegarde;
                   1324: 
                   1325:                        if ((*s_sous_objet_3).type == ALG)
                   1326:                        {
                   1327:                            l_atome = (struct_liste_chainee *)
                   1328:                                    (*s_sous_objet_3).objet;
                   1329:                            chaine_fonction = "";
                   1330: 
                   1331:                            while(l_atome != NULL)
                   1332:                            {
                   1333:                                if ((*(*l_atome).donnee).type == FCT)
                   1334:                                {
                   1335:                                    if (strcmp((*((struct_fonction *)
                   1336:                                            (*(*l_atome).donnee).objet))
                   1337:                                            .nom_fonction, ">>") != 0)
                   1338:                                    {
                   1339:                                        chaine_fonction = (*((struct_fonction *)
                   1340:                                                (*(*l_atome).donnee).objet))
                   1341:                                                .nom_fonction;
                   1342:                                    }
                   1343:                                }
                   1344: 
                   1345:                                l_atome = (*l_atome).suivant;
                   1346:                            }
                   1347: 
                   1348:                            if (((strcmp(chaine_fonction, "OR") == 0) ||
1.72      bertrand 1349:                                    (strcmp(chaine_fonction, "EQV") == 0) ||
1.1       bertrand 1350:                                    (strcmp(chaine_fonction, "XOR") == 0)) &&
                   1351:                                    (strcmp((*((struct_fonction *)
                   1352:                                    (*(*l_element_courant).donnee).objet))
                   1353:                                    .nom_fonction, "AND") == 0))
                   1354:                            {
                   1355:                                parentheses_groupe_droit = 2;
                   1356:                            }
                   1357:                        }
                   1358: 
                   1359:                        liberation(s_etat_processus, s_sous_objet_3);
                   1360: 
1.58      bertrand 1361:                        if (((*s_sous_objet).objet = malloc((strlen(
1.1       bertrand 1362:                                (unsigned char *) (*s_sous_objet_1).objet) +
                   1363:                                strlen((*((struct_fonction *)
                   1364:                                (*(*l_element_courant).donnee).objet))
                   1365:                                .nom_fonction) + strlen((unsigned char *)
                   1366:                                (*s_sous_objet_2).objet) + 2 + 1 +
1.58      bertrand 1367:                                ((size_t) parentheses_groupe_gauche) +
                   1368:                                ((size_t) parentheses_groupe_droit)) *
1.1       bertrand 1369:                                sizeof(unsigned char))) == NULL)
                   1370:                        {
                   1371:                            (*s_etat_processus).erreur_systeme =
                   1372:                                    d_es_allocation_memoire;
                   1373:                            return(NULL);
                   1374:                        }
                   1375: 
                   1376:                        sprintf((unsigned char *) (*s_sous_objet).objet,
                   1377:                                (parentheses_groupe_gauche == 0)
                   1378:                                ? ((parentheses_groupe_droit == 0)
                   1379:                                    ? "%s %s %s"
                   1380:                                    : "%s %s (%s)")
                   1381:                                : ((parentheses_groupe_droit == 0)
                   1382:                                    ? "(%s) %s %s"
                   1383:                                    : "(%s) %s (%s)"),
                   1384:                                (unsigned char *) (*s_sous_objet_1)
                   1385:                                .objet, (*((struct_fonction *)
                   1386:                                (*(*l_element_courant).donnee).objet))
                   1387:                                .nom_fonction, (unsigned char *)
                   1388:                                (*s_sous_objet_2).objet);
                   1389: 
                   1390:                        liberation(s_etat_processus, s_sous_objet_1);
                   1391:                        liberation(s_etat_processus, s_sous_objet_2);
                   1392: 
                   1393:                        if (empilement(s_etat_processus, &((*s_etat_processus)
                   1394:                                .l_base_pile), s_sous_objet) == d_erreur)
                   1395:                        {
                   1396:                            (*s_etat_processus).erreur_systeme =
                   1397:                                    d_es_allocation_memoire;
                   1398:                            return(NULL);
                   1399:                        }
                   1400:                    }
                   1401:                    else
                   1402:                    {
                   1403:                        nombre_arguments = (*((struct_fonction *)
                   1404:                                (*(*l_element_courant).donnee).objet))
                   1405:                                .nombre_arguments;
                   1406: 
                   1407:                        if ((chaine = (unsigned char *)
                   1408:                                malloc(sizeof(unsigned char))) == NULL)
                   1409:                        {
                   1410:                            (*s_etat_processus).erreur_systeme =
                   1411:                                    d_es_allocation_memoire;
                   1412:                            return(NULL);
                   1413:                        }
                   1414:                        
                   1415:                        chaine[0] = d_code_fin_chaine;
                   1416: 
                   1417:                        for(i = 0; i < nombre_arguments; i++)
                   1418:                        {
                   1419:                            if ((nombre_arguments - i) > 1)
                   1420:                            {
                   1421:                                l_liste1 = (*s_etat_processus).l_base_pile;
                   1422: 
                   1423:                                for(j = 2; j < (nombre_arguments - i); j++)
                   1424:                                {
                   1425:                                    l_liste1 = (*l_liste1).suivant;
                   1426:                                }
                   1427: 
                   1428:                                l_liste2 = (*l_liste1).suivant;
                   1429:                                (*l_liste1).suivant = (*l_liste2).suivant;
                   1430:                                (*l_liste2).suivant = (*s_etat_processus)
                   1431:                                        .l_base_pile;
                   1432:                                (*s_etat_processus).l_base_pile = l_liste2;
                   1433:                            }
                   1434:                            
                   1435:                            if (depilement(s_etat_processus,
                   1436:                                    &((*s_etat_processus).l_base_pile),
                   1437:                                    &s_sous_objet) == d_erreur)
                   1438:                            {
                   1439:                                return(NULL);
                   1440:                            }
                   1441: 
                   1442:                            chaine_sauvegarde = chaine;
                   1443: 
                   1444:                            if (strlen(chaine_sauvegarde) == 0)
                   1445:                            {
                   1446:                                if ((chaine = (unsigned char *) malloc((strlen(
                   1447:                                        (unsigned char *) (*s_sous_objet).objet)
                   1448:                                        + 1) * sizeof(unsigned char))) == NULL)
                   1449:                                {
                   1450:                                    (*s_etat_processus).erreur_systeme =
                   1451:                                            d_es_allocation_memoire;
                   1452:                                    return(NULL);
                   1453:                                }
                   1454: 
                   1455:                                sprintf(chaine, "%s", (unsigned char *)
                   1456:                                        (*s_sous_objet).objet);
                   1457:                            }
                   1458:                            else
                   1459:                            {
                   1460:                                if ((chaine = (unsigned char *) malloc((strlen(
                   1461:                                        chaine_sauvegarde) + 1 + strlen(
                   1462:                                        (unsigned char *) (*s_sous_objet).objet)
                   1463:                                        + 1) * sizeof(unsigned char))) == NULL)
                   1464:                                {
                   1465:                                    (*s_etat_processus).erreur_systeme =
                   1466:                                            d_es_allocation_memoire;
                   1467:                                    return(NULL);
                   1468:                                }
                   1469: 
                   1470:                                sprintf(chaine, "%s,%s", chaine_sauvegarde,
                   1471:                                        (unsigned char *) (*s_sous_objet)
                   1472:                                        .objet);
                   1473:                            }
                   1474: 
                   1475:                            free(chaine_sauvegarde);
                   1476:                            liberation(s_etat_processus, s_sous_objet);
                   1477:                        }
                   1478: 
                   1479:                        chaine_sauvegarde = chaine;
                   1480: 
                   1481:                        if ((chaine = (unsigned char *) malloc((strlen(
                   1482:                                (*((struct_fonction *) (*(*l_element_courant)
                   1483:                                .donnee).objet)).nom_fonction) + 2 +
                   1484:                                strlen(chaine_sauvegarde) + 1) *
                   1485:                                sizeof(unsigned char))) == NULL)
                   1486:                        {
                   1487:                            (*s_etat_processus).erreur_systeme =
                   1488:                                    d_es_allocation_memoire;
                   1489:                            return(NULL);
                   1490:                        }
                   1491: 
                   1492:                        sprintf(chaine, "%s(%s)", (*((struct_fonction *)
                   1493:                                (*(*l_element_courant).donnee).objet))
                   1494:                                .nom_fonction, chaine_sauvegarde);
                   1495:                        free(chaine_sauvegarde);
                   1496: 
                   1497:                        if ((s_sous_objet = allocation(s_etat_processus, CHN))
                   1498:                                == NULL)
                   1499:                        {
                   1500:                            (*s_etat_processus).erreur_systeme =
                   1501:                                    d_es_allocation_memoire;
                   1502:                            return(NULL);
                   1503:                        }
                   1504: 
1.58      bertrand 1505:                        (*s_sous_objet).objet = chaine;
1.1       bertrand 1506: 
                   1507:                        if (empilement(s_etat_processus, &((*s_etat_processus)
                   1508:                                .l_base_pile), s_sous_objet) == d_erreur)
                   1509:                        {
                   1510:                            return(NULL);
                   1511:                        }
                   1512:                    }
                   1513:                }
                   1514:            }
                   1515:            else
                   1516:            {
                   1517:                if ((s_sous_objet = allocation(s_etat_processus, CHN))
                   1518:                        == NULL)
                   1519:                {
                   1520:                    (*s_etat_processus).erreur_systeme =
                   1521:                            d_es_allocation_memoire;
                   1522:                    return(NULL);
                   1523:                }
                   1524: 
1.58      bertrand 1525:                if (((*s_sous_objet).objet = formateur(
1.1       bertrand 1526:                        s_etat_processus, 0, (*l_element_courant).donnee))
                   1527:                        == NULL)
                   1528:                {
                   1529:                    (*s_etat_processus).erreur_systeme =
                   1530:                            d_es_allocation_memoire;
                   1531:                    return(NULL);
                   1532:                }
                   1533: 
                   1534:                if (((*(*l_element_courant).donnee).type == ALG)
                   1535:                        || (((*(*l_element_courant).donnee).type == NOM)
                   1536:                        && ((*((struct_nom *) (*(*l_element_courant)
                   1537:                        .donnee).objet)).symbole == d_vrai)))
                   1538:                {
                   1539:                    chaine_sauvegarde = (unsigned char *) (*s_sous_objet).objet;
                   1540: 
                   1541:                    if (((*s_sous_objet).objet = malloc((strlen(
                   1542:                            chaine_sauvegarde) - 1) *
                   1543:                            sizeof(unsigned char))) == NULL)
                   1544:                    {
                   1545:                        (*s_etat_processus).erreur_systeme =
                   1546:                                d_es_allocation_memoire;
                   1547:                        return(NULL);
                   1548:                    }
                   1549: 
                   1550:                    ptrl = chaine_sauvegarde;
                   1551:                    ptre = (unsigned char *) (*s_sous_objet).objet;
                   1552: 
1.58      bertrand 1553:                    for(ptrl++, i = ((integer8) strlen(chaine_sauvegarde)) - 2;
                   1554:                            i > 0; i--, *ptre++ = *ptrl++);
1.1       bertrand 1555: 
                   1556:                    (*ptre) = d_code_fin_chaine;
                   1557: 
                   1558:                    free(chaine_sauvegarde);
                   1559:                }
                   1560:                else if ((*(*l_element_courant).donnee).type == CHN)
                   1561:                {
                   1562:                    chaine_sauvegarde = (unsigned char *) (*s_sous_objet).objet;
                   1563: 
                   1564:                    if (((*s_sous_objet).objet = malloc((strlen(
                   1565:                            chaine_sauvegarde) + 3) *
                   1566:                            sizeof(unsigned char))) == NULL)
                   1567:                    {
                   1568:                        (*s_etat_processus).erreur_systeme =
                   1569:                                d_es_allocation_memoire;
                   1570:                        return(NULL);
                   1571:                    }
                   1572: 
                   1573:                    sprintf((unsigned char *) (*s_sous_objet).objet,
                   1574:                            "\"%s\"", chaine_sauvegarde);
                   1575: 
                   1576:                    free(chaine_sauvegarde);
                   1577:                }
                   1578: 
                   1579:                if (empilement(s_etat_processus, &((*s_etat_processus)
                   1580:                        .l_base_pile), s_sous_objet) == d_erreur)
                   1581:                {
                   1582:                    return(NULL);
                   1583:                }
                   1584:            }
                   1585: 
                   1586:            l_element_courant = (*l_element_courant).suivant;
                   1587:        }
                   1588: 
                   1589:        if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   1590:                &s_sous_objet) == d_erreur)
                   1591:        {
                   1592:            return(NULL);
                   1593:        }
                   1594: 
                   1595:        if ((chaine = (unsigned char *) malloc((strlen((unsigned char *)
                   1596:                (*s_sous_objet).objet) + 2 + 1) * sizeof(unsigned char)))
                   1597:                == NULL)
                   1598:        {
                   1599:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1600:            return(NULL);
                   1601:        }
                   1602: 
                   1603:        sprintf(chaine, "'%s'", (unsigned char *) (*s_sous_objet).objet);
                   1604:        liberation(s_etat_processus, s_sous_objet);
                   1605:    }
                   1606:    else if ((*s_objet).type == BIN)
                   1607:    {
                   1608: 
                   1609: /*
                   1610: --------------------------------------------------------------------------------
                   1611:   Entier binaire en base 2, 8, 10 ou 16
                   1612: --------------------------------------------------------------------------------
                   1613: */
                   1614: 
                   1615:        masque_binaire = masque_entiers_binaires(s_etat_processus);
                   1616: 
                   1617:        if ((test_cfsf(s_etat_processus, 43) == d_faux) &&
                   1618:                (test_cfsf(s_etat_processus, 44) == d_faux))
                   1619:        {
                   1620: 
                   1621: /*
                   1622: -- Base décimale ---------------------------------------------------------------
                   1623: */
                   1624: 
1.63      bertrand 1625:            sprintf(tampon, "%llu", (*((unsigned long long *)
1.1       bertrand 1626:                    ((*s_objet).objet))) & masque_binaire);
                   1627:            strcpy(base, "d");
                   1628:        }
                   1629:        else if ((test_cfsf(s_etat_processus, 43) == d_vrai) &&
                   1630:                (test_cfsf(s_etat_processus, 44) == d_faux))
                   1631:        {
                   1632: 
                   1633: /*
                   1634: -- Base octale -----------------------------------------------------------------
                   1635: */
                   1636: 
1.63      bertrand 1637:            sprintf(tampon, "%llo", (*((unsigned long long *)
1.1       bertrand 1638:                    ((*s_objet).objet))) & masque_binaire);
                   1639:            strcpy(base, "o");
                   1640:        }
                   1641:        else if (test_cfsf(s_etat_processus, 44) == d_vrai)
                   1642:        {
                   1643: 
                   1644: /*
                   1645: -- Bases hexadécimale et binaire -----------------------------------------------
                   1646: */
                   1647: 
1.63      bertrand 1648:            sprintf(tampon, "%llX", (*((unsigned long long *)
1.1       bertrand 1649:                    ((*s_objet).objet))) & masque_binaire);
                   1650: 
                   1651:            if (test_cfsf(s_etat_processus, 43) == d_vrai)
                   1652:            {
                   1653:                strcpy(base, "h");
                   1654:            }
                   1655:            else
                   1656:            {
                   1657:                chaine = (unsigned char *) malloc((strlen(tampon) + 1)
                   1658:                        * sizeof(unsigned char));
                   1659: 
                   1660:                if (chaine == NULL)
                   1661:                {
                   1662:                    (*s_etat_processus).erreur_systeme =
                   1663:                            d_es_allocation_memoire;
                   1664:                    return(NULL);
                   1665:                }
                   1666: 
                   1667:                strcpy(chaine, tampon);
                   1668:                tampon[0] = 0;
                   1669: 
1.58      bertrand 1670:                for(i = 0; i < (integer8) strlen(chaine); i++)
1.1       bertrand 1671:                {
                   1672:                    switch(chaine[i])
                   1673:                    {
                   1674:                        case '0' :
                   1675:                        {
                   1676:                            strcat(tampon, (i != 0) ? "0000" : "0");
                   1677:                            break;
                   1678:                        }
                   1679:                        case '1' :
                   1680:                        {
                   1681:                                strcat(tampon, (i != 0) ? "0001" : "1");
                   1682:                            break;
                   1683:                        }
                   1684:                        case '2' :
                   1685:                        {
                   1686:                            strcat(tampon, (i != 0) ? "0010" : "10");
                   1687:                            break;
                   1688:                        }
                   1689:                        case '3' :
                   1690:                        {
                   1691:                            strcat(tampon, (i != 0) ? "0011" : "11");
                   1692:                            break;
                   1693:                        }
                   1694:                        case '4' :
                   1695:                        {
                   1696:                            strcat(tampon, (i != 0) ? "0100" : "100");
                   1697:                            break;
                   1698:                        }
                   1699:                        case '5' :
                   1700:                        {
                   1701:                            strcat(tampon, (i != 0) ? "0101" : "101");
                   1702:                            break;
                   1703:                        }
                   1704:                        case '6' :
                   1705:                        {
                   1706:                            strcat(tampon, (i != 0) ? "0110" : "110");
                   1707:                            break;
                   1708:                        }
                   1709:                        case '7' :
                   1710:                        {
                   1711:                            strcat(tampon, (i != 0) ? "0111" : "111");
                   1712:                            break;
                   1713:                        }
                   1714:                        case '8' :
                   1715:                        {
                   1716:                            strcat(tampon, "1000");
                   1717:                            break;
                   1718:                        }
                   1719:                        case '9' :
                   1720:                        {
                   1721:                            strcat(tampon, "1001");
                   1722:                            break;
                   1723:                        }
                   1724:                        case 'A' :
                   1725:                        {
                   1726:                            strcat(tampon, "1010");
                   1727:                            break;
                   1728:                        }
                   1729:                        case 'B' :
                   1730:                        {
                   1731:                            strcat(tampon, "1011");
                   1732:                            break;
                   1733:                        }
                   1734:                        case 'C' :
                   1735:                        {
                   1736:                            strcat(tampon, "1100");
                   1737:                            break;
                   1738:                        }
                   1739:                        case 'D' :
                   1740:                        {
                   1741:                            strcat(tampon, "1101");
                   1742:                            break;
                   1743:                        }
                   1744:                        case 'E' :
                   1745:                        {
                   1746:                            strcat(tampon, "1110");
                   1747:                            break;
                   1748:                        }
                   1749:                        case 'F' :
                   1750:                        {
                   1751:                            strcat(tampon, "1111");
                   1752:                            break;
                   1753:                        }
                   1754:                    }
                   1755:                }
                   1756: 
                   1757:                free(chaine);
                   1758:                strcpy(base, "b");
                   1759:            }
                   1760:        }
                   1761: 
                   1762:        chaine = (unsigned char *) malloc((strlen(tampon) + 4)
                   1763:                * sizeof(unsigned char));
                   1764: 
                   1765:        if (chaine == NULL)
                   1766:        {
                   1767:            (*s_etat_processus).erreur_systeme =
                   1768:                    d_es_allocation_memoire;
                   1769:            return(NULL);
                   1770:        }
                   1771: 
                   1772:        strcpy(chaine, "# ");
                   1773: 
                   1774:        strcat(chaine, tampon);
                   1775:        strcat(chaine, base);
                   1776:    }
                   1777:    else if ((*s_objet).type == CHN)
                   1778:    {
                   1779: 
                   1780: /*
                   1781: --------------------------------------------------------------------------------
                   1782:   Chaîne de caractères
                   1783: --------------------------------------------------------------------------------
                   1784: */
                   1785: 
1.23      bertrand 1786:        if (((*s_etat_processus).autorisation_conversion_chaine == 'Y') &&
                   1787:                (test_cfsf(s_etat_processus, 34) == d_vrai))
1.5       bertrand 1788:        {
1.41      bertrand 1789:            if ((chaine = formateur_flux(s_etat_processus,
                   1790:                    (unsigned char *) (*s_objet).objet, &longueur_chaine))
                   1791:                    == NULL)
1.5       bertrand 1792:            {
1.41      bertrand 1793:                return(NULL);
1.5       bertrand 1794:            }
1.41      bertrand 1795:        }
                   1796:        else
                   1797:        {
                   1798:            if ((chaine = malloc((strlen((unsigned char *)
                   1799:                    ((*s_objet).objet)) + 1) * sizeof(unsigned char))) == NULL)
1.5       bertrand 1800:            {
                   1801:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1802:                return(NULL);
                   1803:            }
1.41      bertrand 1804: 
1.5       bertrand 1805:            strcpy(chaine, (unsigned char *) ((*s_objet).objet));
                   1806:        }
1.1       bertrand 1807:    }
                   1808:    else if ((*s_objet).type == CPL)
                   1809:    {
                   1810: 
                   1811: /*
                   1812: --------------------------------------------------------------------------------
                   1813:   Complexe
                   1814: --------------------------------------------------------------------------------
                   1815: */
                   1816: 
1.58      bertrand 1817:        chaine_formatee = formateur_nombre(s_etat_processus,
1.1       bertrand 1818:                ((struct_complexe16 *) ((*s_objet).objet)), 'C');
                   1819: 
                   1820:        if (chaine_formatee == NULL)
                   1821:        {
                   1822:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1823:            return(NULL);
                   1824:        }
                   1825: 
                   1826:        chaine = (unsigned char *) malloc((strlen(chaine_formatee)
                   1827:                + 1) * sizeof(unsigned char));
                   1828: 
                   1829:        if (chaine == NULL)
                   1830:        {
                   1831:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1832:            return(NULL);
                   1833:        }
                   1834: 
                   1835:        strcpy(chaine, chaine_formatee);
                   1836:        free(chaine_formatee);
                   1837:    }
                   1838:    else if ((*s_objet).type == RPN)
                   1839:    {
                   1840: 
                   1841: /*
                   1842: --------------------------------------------------------------------------------
                   1843:   Définition
                   1844: --------------------------------------------------------------------------------
                   1845: */
                   1846: 
                   1847:        l_element_courant = (struct_liste_chainee *) ((*s_objet).objet);
                   1848:        chaine_sauvegarde = chaine;
                   1849: 
                   1850:        while(l_element_courant != NULL)
                   1851:        {
1.57      bertrand 1852:            if ((chaine_formatee = formateur(s_etat_processus, offset_initial,
1.1       bertrand 1853:                    (*l_element_courant).donnee)) == NULL)
                   1854:            {
                   1855:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1856:                return(NULL);
                   1857:            }
                   1858: 
                   1859:            if ((*(*l_element_courant).donnee).type == CHN)
                   1860:            {
                   1861:                chaine_tampon = chaine_formatee;
                   1862: 
                   1863:                if ((chaine_formatee = (unsigned char *) malloc((strlen(
                   1864:                        chaine_tampon) + 3) * sizeof(unsigned char))) == NULL)
                   1865:                {
                   1866:                    (*s_etat_processus).erreur_systeme =
                   1867:                            d_es_allocation_memoire;
                   1868:                    return(NULL);
                   1869:                }
                   1870: 
                   1871:                sprintf(chaine_formatee, "\"%s\"", chaine_tampon);
                   1872:                free(chaine_tampon);
                   1873:            }
                   1874: 
                   1875:            l_element_courant = (*l_element_courant).suivant;
                   1876: 
                   1877:            if (chaine != NULL)
                   1878:            {
                   1879:                chaine_sauvegarde = chaine;
                   1880: 
                   1881:                if ((chaine = (unsigned char *) malloc((strlen(
                   1882:                        chaine_sauvegarde) + strlen(chaine_formatee) + 2) *
                   1883:                        sizeof(unsigned char))) == NULL)
                   1884:                {
                   1885:                    (*s_etat_processus).erreur_systeme =
                   1886:                            d_es_allocation_memoire;
                   1887:                    return(NULL);
                   1888:                }
                   1889: 
                   1890:                strcpy(chaine, chaine_sauvegarde);
                   1891:                free(chaine_sauvegarde);
                   1892:                strcat(chaine, " ");
                   1893:                strcat(chaine, chaine_formatee);
                   1894:                free(chaine_formatee);
                   1895:            }
                   1896:            else
                   1897:            {
                   1898:                chaine = chaine_formatee;
                   1899:            }
                   1900:        }
                   1901: 
                   1902:        chaine_sauvegarde = chaine;
                   1903:        chaine = (unsigned char *) malloc((strlen(chaine_sauvegarde) + 1) *
                   1904:                sizeof(unsigned char));
                   1905: 
                   1906:        if (chaine == NULL)
                   1907:        {
                   1908:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1909:            return(NULL);
                   1910:        }
                   1911: 
                   1912:        chaine_sauvegarde[strlen(chaine_sauvegarde)] = d_code_fin_chaine;
                   1913:        strcpy(chaine, chaine_sauvegarde);
                   1914:        free(chaine_sauvegarde);
                   1915:    }
                   1916:    else if ((*s_objet).type == INT)
                   1917:    {
                   1918: 
                   1919: /*
                   1920: --------------------------------------------------------------------------------
                   1921:   Entier
                   1922: --------------------------------------------------------------------------------
                   1923: */
                   1924: 
1.58      bertrand 1925:        chaine_formatee = formateur_nombre(s_etat_processus,
1.1       bertrand 1926:                ((integer8 *) ((*s_objet).objet)), 'I');
                   1927: 
                   1928:        if (chaine_formatee == NULL)
                   1929:        {
                   1930:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1931:            return(NULL);
                   1932:        }
                   1933: 
                   1934:        chaine = (unsigned char *) malloc((strlen(chaine_formatee) + 1)
                   1935:                * sizeof(unsigned char));
                   1936: 
                   1937:        if (chaine == NULL)
                   1938:        {
                   1939:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1940:            return(NULL);
                   1941:        }
                   1942: 
                   1943:        strcpy(chaine, chaine_formatee);
                   1944:        free(chaine_formatee);
                   1945:    }
                   1946:    else if ((*s_objet).type == FCT)
                   1947:    {
                   1948: 
                   1949: /*
                   1950: --------------------------------------------------------------------------------
                   1951:   Fonction
                   1952: --------------------------------------------------------------------------------
                   1953: */
                   1954: 
                   1955:        chaine = (unsigned char *) malloc((strlen((*((struct_fonction *)
                   1956:                ((*s_objet).objet))).nom_fonction) + 1) *
                   1957:                sizeof(unsigned char));
                   1958: 
                   1959:        if (chaine == NULL)
                   1960:        {
                   1961:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1962:            return(NULL);
                   1963:        }
                   1964: 
                   1965:        strcpy(chaine, (unsigned char *) (*((struct_fonction *)
                   1966:                ((*s_objet).objet))).nom_fonction);
                   1967:    }
                   1968:    else if ((*s_objet).type == TBL)
                   1969:    {
                   1970: 
                   1971: /*
                   1972: --------------------------------------------------------------------------------
                   1973:   Tableau
                   1974: --------------------------------------------------------------------------------
                   1975: */
                   1976: 
                   1977:        chaine = (unsigned char *) malloc(4 * sizeof(unsigned char));
                   1978: 
                   1979:        if (chaine == NULL)
                   1980:        {
                   1981:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1982:            return(NULL);
                   1983:        }
                   1984: 
                   1985:        strcpy(chaine, "<[ ");
1.58      bertrand 1986:        offset = ((integer8) strlen(chaine)) + offset_initial;
1.1       bertrand 1987: 
                   1988:        for(i = 0; i < (*((struct_tableau *) (*s_objet).objet))
                   1989:                .nombre_elements; i++)
                   1990:        {
                   1991:            chaine_sauvegarde = chaine;
1.60      bertrand 1992:            chaine_formatee = formateur(s_etat_processus, (long) offset,
1.1       bertrand 1993:                    (*((struct_tableau *) (*s_objet).objet)).elements[i]);
                   1994: 
                   1995:            if (chaine_formatee == NULL)
                   1996:            {
                   1997:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1998:                return(NULL);
                   1999:            }
                   2000: 
                   2001:            if ((*(*((struct_tableau *) (*s_objet).objet)).elements[i])
                   2002:                    .type == CHN)
                   2003:            {
                   2004:                chaine = (unsigned char *) malloc((strlen(chaine_formatee)
                   2005:                        + strlen(chaine_sauvegarde) + 3)
                   2006:                        * sizeof(unsigned char));
                   2007: 
                   2008:                if (chaine == NULL)
                   2009:                {
                   2010:                    (*s_etat_processus).erreur_systeme =
                   2011:                            d_es_allocation_memoire;
                   2012:                    return(NULL);
                   2013:                }
                   2014: 
                   2015:                strcpy(chaine, chaine_sauvegarde);
                   2016:                free(chaine_sauvegarde);
                   2017:                strcat(chaine, "\"");
                   2018:                strcat(chaine, chaine_formatee);
                   2019:                free(chaine_formatee);
                   2020:                strcat(chaine, "\"");
                   2021:            }
                   2022:            else if ((*(*((struct_tableau *) (*s_objet).objet))
                   2023:                    .elements[i]).type == CHN)
                   2024:            {
                   2025:                chaine = (unsigned char *) malloc((strlen(chaine_formatee)
                   2026:                        + strlen(chaine_sauvegarde) + 1)
                   2027:                        * sizeof(unsigned char));
                   2028: 
                   2029:                if (chaine == NULL)
                   2030:                {
                   2031:                    (*s_etat_processus).erreur_systeme =
                   2032:                            d_es_allocation_memoire;
                   2033:                    return(NULL);
                   2034:                }
                   2035: 
                   2036:                sprintf(chaine, "%s%s", chaine_sauvegarde, chaine_formatee);
                   2037:                free(chaine_sauvegarde);
                   2038:                free(chaine_formatee);
                   2039:            }
                   2040:            else
                   2041:            {
                   2042:                chaine = (unsigned char *) malloc((strlen(chaine_formatee)
                   2043:                        + strlen(chaine_sauvegarde) + 1)
                   2044:                        * sizeof(unsigned char));
                   2045: 
                   2046:                if (chaine == NULL)
                   2047:                {
                   2048:                    (*s_etat_processus).erreur_systeme =
                   2049:                            d_es_allocation_memoire;
                   2050:                    return(NULL);
                   2051:                }
                   2052: 
                   2053:                sprintf(chaine, "%s%s", chaine_sauvegarde, chaine_formatee);
                   2054:                free(chaine_sauvegarde);
                   2055:                free(chaine_formatee);
                   2056:            }
                   2057: 
                   2058:            if (test_cfsf(s_etat_processus, 45) == d_vrai)
                   2059:            {
                   2060:                chaine_sauvegarde = chaine;
                   2061: 
                   2062:                chaine = (unsigned char *) malloc(
                   2063:                        (strlen(chaine_sauvegarde) + 2)
                   2064:                        * sizeof(unsigned char));
                   2065: 
                   2066:                if (chaine == NULL)
                   2067:                {
                   2068:                    (*s_etat_processus).erreur_systeme =
                   2069:                            d_es_allocation_memoire;
                   2070:                    return(NULL);
                   2071:                }
                   2072: 
                   2073:                strcpy(chaine, chaine_sauvegarde);
                   2074:                free(chaine_sauvegarde);
                   2075:                strcat(chaine, "\n");
                   2076: 
                   2077:                if ((*((struct_tableau *) (*s_objet).objet))
                   2078:                        .nombre_elements != (i + 1))
                   2079:                {
                   2080:                    chaine_sauvegarde = chaine;
                   2081: 
                   2082:                    chaine = (unsigned char *) malloc(
1.58      bertrand 2083:                            (strlen(chaine_sauvegarde) + 1 + ((size_t) offset))
1.1       bertrand 2084:                            * sizeof(unsigned char));
                   2085: 
                   2086:                    if (chaine == NULL)
                   2087:                    {
                   2088:                        (*s_etat_processus).erreur_systeme =
                   2089:                                d_es_allocation_memoire;
                   2090:                        return(NULL);
                   2091:                    }
                   2092: 
                   2093:                    strcpy(chaine, chaine_sauvegarde);
                   2094:                    free(chaine_sauvegarde);
                   2095:                    ptre = &(chaine[strlen(chaine)]);
                   2096: 
                   2097:                    for(k = 0; k < offset; k++, *(ptre++) = ' ');
                   2098: 
                   2099:                    (*ptre) = d_code_fin_chaine;
                   2100:                }
                   2101:            }
                   2102:            else
                   2103:            {
                   2104:                if ((*((struct_tableau *) (*s_objet).objet))
                   2105:                        .nombre_elements != (i + 1))
                   2106:                {
                   2107:                    chaine_sauvegarde = chaine;
                   2108: 
                   2109:                    chaine = (unsigned char *) malloc(
                   2110:                            (strlen(chaine_sauvegarde) + 2)
                   2111:                            * sizeof(unsigned char));
                   2112: 
                   2113:                    if (chaine == NULL)
                   2114:                    {
                   2115:                        (*s_etat_processus).erreur_systeme =
                   2116:                                d_es_allocation_memoire;
                   2117:                        return(NULL);
                   2118:                    }
                   2119: 
                   2120:                    strcpy(chaine, chaine_sauvegarde);
                   2121:                    free(chaine_sauvegarde);
                   2122:                    strcat(chaine, " ");
                   2123:                }
                   2124:            }
                   2125:        }
                   2126: 
                   2127:        if (test_cfsf(s_etat_processus, 45) == d_vrai)
                   2128:        {
                   2129:            if (chaine[strlen(chaine) - 1] == '\n')
                   2130:            {
                   2131:                chaine[strlen(chaine) - 1] = d_code_fin_chaine;
                   2132:            }
                   2133:        }
                   2134: 
                   2135:        if ((*((struct_tableau *) (*s_objet).objet)).nombre_elements != 0)
                   2136:        {
                   2137:            chaine_sauvegarde = chaine;
                   2138:            chaine = (unsigned char *) malloc((strlen(chaine_sauvegarde) + 4)
                   2139:                    * sizeof(unsigned char));
                   2140: 
                   2141:            if (chaine == NULL)
                   2142:            {
                   2143:                (*s_etat_processus).erreur_systeme =
                   2144:                        d_es_allocation_memoire;
                   2145:                return(NULL);
                   2146:            }
                   2147: 
                   2148:            strcpy(chaine, chaine_sauvegarde);
                   2149:            free(chaine_sauvegarde);
                   2150:            strcat(chaine, " ]>");
                   2151:        }
                   2152:        else
                   2153:        {
                   2154:            chaine_sauvegarde = chaine;
                   2155:            chaine = (unsigned char *) malloc((strlen(chaine_sauvegarde) + 3)
                   2156:                    * sizeof(unsigned char));
                   2157: 
                   2158:            if (chaine == NULL)
                   2159:            {
                   2160:                (*s_etat_processus).erreur_systeme =
                   2161:                        d_es_allocation_memoire;
                   2162:                return(NULL);
                   2163:            }
                   2164: 
                   2165:            strcpy(chaine, chaine_sauvegarde);
                   2166:            free(chaine_sauvegarde);
                   2167:            strcat(chaine, "]>");
                   2168:        }
                   2169:    }
                   2170:    else if ((*s_objet).type == LST)
                   2171:    {
                   2172: 
                   2173: /*
                   2174: --------------------------------------------------------------------------------
                   2175:   Liste
                   2176: --------------------------------------------------------------------------------
                   2177: */
                   2178: 
                   2179:        chaine = (unsigned char *) malloc(3 * sizeof(unsigned char));
                   2180: 
                   2181:        if (chaine == NULL)
                   2182:        {
                   2183:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2184:            return(NULL);
                   2185:        }
                   2186: 
                   2187:        strcpy(chaine, "{ ");
                   2188: 
                   2189:        l_element_courant = (struct_liste_chainee *) ((*s_objet).objet);
                   2190:        nombre_elements = 0;
1.58      bertrand 2191:        offset = ((integer8) strlen(chaine)) + offset_initial;
1.1       bertrand 2192: 
                   2193:        while(l_element_courant != NULL)
                   2194:        {
                   2195:            chaine_sauvegarde = chaine;
1.60      bertrand 2196:            chaine_formatee = formateur(s_etat_processus, (long) offset,
1.1       bertrand 2197:                    (*l_element_courant).donnee);
                   2198: 
                   2199:            if (chaine_formatee == NULL)
                   2200:            {
                   2201:                (*s_etat_processus).erreur_systeme =
                   2202:                        d_es_allocation_memoire;
                   2203:                return(NULL);
                   2204:            }
                   2205: 
                   2206:            if ((*(*l_element_courant).donnee).type == CHN)
                   2207:            {
                   2208:                chaine = (unsigned char *) malloc((strlen(chaine_formatee)
                   2209:                        + strlen(chaine_sauvegarde) + 3)
                   2210:                        * sizeof(unsigned char));
                   2211: 
                   2212:                if (chaine == NULL)
                   2213:                {
                   2214:                    (*s_etat_processus).erreur_systeme =
                   2215:                            d_es_allocation_memoire;
                   2216:                    return(NULL);
                   2217:                }
                   2218: 
                   2219:                strcpy(chaine, chaine_sauvegarde);
                   2220:                free(chaine_sauvegarde);
                   2221:                strcat(chaine, "\"");
                   2222:                strcat(chaine, chaine_formatee);
                   2223:                free(chaine_formatee);
                   2224:                strcat(chaine, "\"");
                   2225:            }
                   2226:            else if ((*(*l_element_courant).donnee).type == NOM)
                   2227:            {
                   2228:                chaine = (unsigned char *) malloc((strlen(chaine_formatee)
                   2229:                        + strlen(chaine_sauvegarde) + 1)
                   2230:                        * sizeof(unsigned char));
                   2231: 
                   2232:                if (chaine == NULL)
                   2233:                {
                   2234:                    (*s_etat_processus).erreur_systeme =
                   2235:                            d_es_allocation_memoire;
                   2236:                    return(NULL);
                   2237:                }
                   2238: 
                   2239:                sprintf(chaine, "%s%s", chaine_sauvegarde, chaine_formatee);
                   2240:                free(chaine_sauvegarde);
                   2241:                free(chaine_formatee);
                   2242:            }
                   2243:            else
                   2244:            {
                   2245:                chaine = (unsigned char *) malloc((strlen(chaine_formatee)
                   2246:                        + strlen(chaine_sauvegarde) + 1)
                   2247:                        * sizeof(unsigned char));
                   2248: 
                   2249:                if (chaine == NULL)
                   2250:                {
                   2251:                    (*s_etat_processus).erreur_systeme =
                   2252:                            d_es_allocation_memoire;
                   2253:                    return(NULL);
                   2254:                }
                   2255: 
                   2256:                sprintf(chaine, "%s%s", chaine_sauvegarde, chaine_formatee);
                   2257:                free(chaine_sauvegarde);
                   2258:                free(chaine_formatee);
                   2259:            }
                   2260: 
                   2261:            if (test_cfsf(s_etat_processus, 45) == d_vrai)
                   2262:            {
                   2263:                chaine_sauvegarde = chaine;
                   2264: 
                   2265:                chaine = (unsigned char *) malloc(
                   2266:                        (strlen(chaine_sauvegarde) + 2)
                   2267:                        * sizeof(unsigned char));
                   2268: 
                   2269:                if (chaine == NULL)
                   2270:                {
                   2271:                    (*s_etat_processus).erreur_systeme =
                   2272:                            d_es_allocation_memoire;
                   2273:                    return(NULL);
                   2274:                }
                   2275: 
                   2276:                strcpy(chaine, chaine_sauvegarde);
                   2277:                free(chaine_sauvegarde);
                   2278:                strcat(chaine, "\n");
                   2279: 
                   2280:                if ((*l_element_courant).suivant != NULL)
                   2281:                {
                   2282:                    chaine_sauvegarde = chaine;
                   2283: 
                   2284:                    chaine = (unsigned char *) malloc(
1.58      bertrand 2285:                            (strlen(chaine_sauvegarde) + 1 + ((size_t) offset))
1.1       bertrand 2286:                            * sizeof(unsigned char));
                   2287: 
                   2288:                    if (chaine == NULL)
                   2289:                    {
                   2290:                        (*s_etat_processus).erreur_systeme =
                   2291:                                d_es_allocation_memoire;
                   2292:                        return(NULL);
                   2293:                    }
                   2294: 
                   2295:                    strcpy(chaine, chaine_sauvegarde);
                   2296:                    free(chaine_sauvegarde);
                   2297:                    ptre = &(chaine[strlen(chaine)]);
                   2298: 
                   2299:                    for(k = 0; k < offset; k++, *(ptre++) = ' ');
                   2300: 
                   2301:                    (*ptre) = d_code_fin_chaine;
                   2302:                }
                   2303:            }
                   2304:            else
                   2305:            {
                   2306:                if ((*l_element_courant).suivant != NULL)
                   2307:                {
                   2308:                    chaine_sauvegarde = chaine;
                   2309: 
                   2310:                    chaine = (unsigned char *) malloc(
                   2311:                            (strlen(chaine_sauvegarde) + 2)
                   2312:                            * sizeof(unsigned char));
                   2313: 
                   2314:                    if (chaine == NULL)
                   2315:                    {
                   2316:                        (*s_etat_processus).erreur_systeme =
                   2317:                                d_es_allocation_memoire;
                   2318:                        return(NULL);
                   2319:                    }
                   2320: 
                   2321:                    strcpy(chaine, chaine_sauvegarde);
                   2322:                    free(chaine_sauvegarde);
                   2323:                    strcat(chaine, " ");
                   2324:                }
                   2325:            }
                   2326: 
                   2327:            nombre_elements++;
                   2328:            l_element_courant = (*l_element_courant).suivant;
                   2329:        }
                   2330: 
                   2331:        if (test_cfsf(s_etat_processus, 45) == d_vrai)
                   2332:        {
                   2333:            if (chaine[strlen(chaine) - 1] == '\n')
                   2334:            {
                   2335:                chaine[strlen(chaine) - 1] = d_code_fin_chaine;
                   2336:            }
                   2337:        }
                   2338: 
                   2339:        if (nombre_elements != 0)
                   2340:        {
                   2341:            chaine_sauvegarde = chaine;
                   2342:            chaine = (unsigned char *) malloc((strlen(chaine_sauvegarde) + 3)
                   2343:                    * sizeof(unsigned char));
                   2344: 
                   2345:            if (chaine == NULL)
                   2346:            {
                   2347:                (*s_etat_processus).erreur_systeme =
                   2348:                        d_es_allocation_memoire;
                   2349:                return(NULL);
                   2350:            }
                   2351: 
                   2352:            strcpy(chaine, chaine_sauvegarde);
                   2353:            free(chaine_sauvegarde);
                   2354:            strcat(chaine, " }");
                   2355:        }
                   2356:        else
                   2357:        {
                   2358:            chaine_sauvegarde = chaine;
                   2359:            chaine = (unsigned char *) malloc((strlen(chaine_sauvegarde) + 2)
                   2360:                    * sizeof(unsigned char));
                   2361: 
                   2362:            if (chaine == NULL)
                   2363:            {
                   2364:                (*s_etat_processus).erreur_systeme =
                   2365:                        d_es_allocation_memoire;
                   2366:                return(NULL);
                   2367:            }
                   2368: 
                   2369:            strcpy(chaine, chaine_sauvegarde);
                   2370:            free(chaine_sauvegarde);
                   2371:            strcat(chaine, "}");
                   2372:        }
                   2373:    }
                   2374:    else if ((*s_objet).type == MCX)
                   2375:    {
                   2376: 
                   2377: /*
                   2378: --------------------------------------------------------------------------------
                   2379:   Matrice complexe
                   2380: --------------------------------------------------------------------------------
                   2381: */
                   2382: 
                   2383:        nombre_lignes = (*((struct_matrice *) ((*s_objet).objet)))
                   2384:                .nombre_lignes;
                   2385:        nombre_colonnes = (*((struct_matrice *) ((*s_objet).objet)))
                   2386:                .nombre_colonnes;
                   2387: 
                   2388:        chaine = (unsigned char *) malloc(3 * sizeof(unsigned char));
                   2389: 
                   2390:        if (chaine != NULL)
                   2391:        {
                   2392:            strcpy(chaine, "[[");
1.58      bertrand 2393:            offset = ((integer8) strlen(chaine)) + offset_initial - 1;
1.1       bertrand 2394: 
1.59      bertrand 2395:            if ((longueurs_maximales = malloc(sizeof(integer8) * 2 *
1.58      bertrand 2396:                    ((size_t) nombre_colonnes))) == NULL)
1.1       bertrand 2397:            {
                   2398:                (*s_etat_processus).erreur_systeme =
                   2399:                        d_es_allocation_memoire;
                   2400:                return(NULL);
                   2401:            }
                   2402: 
                   2403:            if (test_cfsf(s_etat_processus, 45) == d_vrai)
                   2404:            {
                   2405:                for(j = 0; j < (2 * nombre_colonnes); j++)
                   2406:                {
                   2407:                    longueurs_maximales[j] = 0;
                   2408:                }
                   2409: 
                   2410:                for(i = 0; i < nombre_lignes; i++)
                   2411:                {
                   2412:                    for(j = 0; j < nombre_colonnes; j++)
                   2413:                    {
                   2414:                        chaine_formatee = formateur_nombre(s_etat_processus,
1.58      bertrand 2415:                                &(((struct_complexe16 **)
1.1       bertrand 2416:                                ((*((struct_matrice *)
                   2417:                                ((*s_objet).objet))).tableau))[i][j]), 'C');
                   2418: 
                   2419:                        if (chaine_formatee == NULL)
                   2420:                        {
                   2421:                            (*s_etat_processus).erreur_systeme =
                   2422:                                    d_es_allocation_memoire;
                   2423:                            return(NULL);
                   2424:                        }
                   2425: 
1.58      bertrand 2426:                        longueur_courante = (integer8) strlen(chaine_formatee);
1.1       bertrand 2427:                        longueur_decimale_courante = 0;
                   2428: 
                   2429:                        if ((ptrl = index(chaine_formatee,
                   2430:                                (test_cfsf(s_etat_processus, 48) == d_vrai)
                   2431:                                ? '.' : ',')) != NULL)
                   2432:                        {
                   2433:                            longueur_decimale_courante = longueur_courante
                   2434:                                    - (ptrl - chaine_formatee);
                   2435:                            longueur_courante = ptrl - chaine_formatee;
                   2436:                        }
                   2437: 
                   2438:                        free(chaine_formatee);
                   2439: 
                   2440:                        if (longueurs_maximales[2 * j] < longueur_courante)
                   2441:                        {
                   2442:                            longueurs_maximales[2 * j] = longueur_courante;
                   2443:                        }
                   2444: 
                   2445:                        if (longueurs_maximales[(2 * j) + 1] <
                   2446:                                longueur_decimale_courante)
                   2447:                        {
                   2448:                            longueurs_maximales[(2 * j) + 1] =
                   2449:                                    longueur_decimale_courante;
                   2450:                        }
                   2451:                    }
                   2452:                }
                   2453:            }
                   2454: 
                   2455:            for(i = 0; i < nombre_lignes; i++)
                   2456:            {
                   2457:                for(j = 0; j < nombre_colonnes; j++)
                   2458:                {
                   2459:                    chaine_formatee = formateur_nombre(s_etat_processus,
1.58      bertrand 2460:                            &(((struct_complexe16 **)
1.1       bertrand 2461:                            ((*((struct_matrice *)
                   2462:                            ((*s_objet).objet))).tableau))[i][j]), 'C');
                   2463: 
                   2464:                    if (chaine_formatee == NULL)
                   2465:                    {
                   2466:                        (*s_etat_processus).erreur_systeme =
                   2467:                                d_es_allocation_memoire;
                   2468:                        return(NULL);
                   2469:                    }
                   2470: 
1.58      bertrand 2471:                    longueur_courante = (integer8) strlen(chaine_formatee);
1.1       bertrand 2472:                    longueur_decimale_courante = 0;
                   2473: 
                   2474:                    if ((ptrl = index(chaine_formatee,
                   2475:                            (test_cfsf(s_etat_processus, 48) == d_vrai)
                   2476:                            ? '.' : ',')) != NULL)
                   2477:                    {
                   2478:                        longueur_decimale_courante = longueur_courante
                   2479:                                - (ptrl - chaine_formatee);
                   2480:                        longueur_courante = ptrl - chaine_formatee;
                   2481:                    }
                   2482: 
                   2483:                    chaine_sauvegarde = chaine;
                   2484: 
                   2485:                    if (test_cfsf(s_etat_processus, 45) == d_vrai)
                   2486:                    {
                   2487: 
                   2488:                        chaine = (unsigned char *) malloc(
                   2489:                                (strlen(chaine_sauvegarde) +
1.58      bertrand 2490:                                ((size_t) longueur_courante) +
                   2491:                                ((size_t) longueur_decimale_courante) +
                   2492:                                ((size_t) longueurs_maximales[2 * j]) +
                   2493:                                ((size_t) longueurs_maximales[(2 * j) + 1]) + 2)
1.1       bertrand 2494:                                * sizeof(unsigned char));
                   2495: 
                   2496:                        if (chaine == NULL)
                   2497:                        {
                   2498:                            (*s_etat_processus).erreur_systeme =
                   2499:                                    d_es_allocation_memoire;
                   2500:                            return(NULL);
                   2501:                        }
                   2502: 
                   2503:                        strcpy(chaine, chaine_sauvegarde);
                   2504:                        free(chaine_sauvegarde);
                   2505:                        strcat(chaine, " ");
                   2506: 
                   2507:                        ptre = &(chaine[strlen(chaine)]);
                   2508: 
                   2509:                        for (k = 0; k < (longueurs_maximales[2 * j]
                   2510:                                - longueur_courante); k++, *(ptre++) = ' ');
                   2511: 
                   2512:                        (*ptre) = d_code_fin_chaine;
                   2513:                        strcat(chaine, chaine_formatee);
                   2514:                        ptre = &(chaine[strlen(chaine)]);
                   2515: 
                   2516:                        for(k = 0; k < (longueurs_maximales[(2 * j) + 1]
                   2517:                                - longueur_decimale_courante);
                   2518:                                k++, *(ptre++) = ' ');
                   2519: 
                   2520:                        (*ptre) = d_code_fin_chaine;
                   2521:                    }
                   2522:                    else
                   2523:                    {
                   2524:                        chaine = (unsigned char *) malloc(
                   2525:                                (strlen(chaine_sauvegarde) +
1.58      bertrand 2526:                                ((size_t) longueur_courante) +
                   2527:                                ((size_t) longueur_decimale_courante)
1.1       bertrand 2528:                                + 2) * sizeof(unsigned char));
                   2529: 
                   2530:                        if (chaine == NULL)
                   2531:                        {
                   2532:                            (*s_etat_processus).erreur_systeme =
                   2533:                                    d_es_allocation_memoire;
                   2534:                            return(NULL);
                   2535:                        }
                   2536: 
                   2537:                        strcpy(chaine, chaine_sauvegarde);
                   2538:                        free(chaine_sauvegarde);
                   2539:                        strcat(chaine, " ");
                   2540:                        strcat(chaine, chaine_formatee);
                   2541:                    }
                   2542: 
                   2543:                    free(chaine_formatee);
                   2544:                }
                   2545: 
                   2546:                chaine_sauvegarde = chaine;
                   2547: 
                   2548:                if (i != (nombre_lignes - 1))
                   2549:                {
                   2550:                    if (test_cfsf(s_etat_processus, 45) == d_vrai)
                   2551:                    {
                   2552:                        chaine = (unsigned char *) malloc(
1.58      bertrand 2553:                                (strlen(chaine_sauvegarde) + 5 +
                   2554:                                ((size_t) offset)) * sizeof(unsigned char));
1.1       bertrand 2555: 
                   2556:                        if (chaine == NULL)
                   2557:                        {
                   2558:                            (*s_etat_processus).erreur_systeme =
                   2559:                                    d_es_allocation_memoire;
                   2560:                            return(NULL);
                   2561:                        }
                   2562: 
                   2563:                        strcpy(chaine, chaine_sauvegarde);
                   2564:                        free(chaine_sauvegarde);
                   2565:                        strcat(chaine, " ]\n");
                   2566:                        ptre = &(chaine[strlen(chaine)]);
                   2567: 
                   2568:                        for(k = 0; k < offset; k++, *(ptre++) = ' ');
                   2569: 
                   2570:                        (*ptre) = d_code_fin_chaine;
                   2571:                        strcat(chaine, "[");
                   2572:                    }
                   2573:                    else
                   2574:                    {
                   2575:                        chaine = (unsigned char *) malloc(
                   2576:                                (strlen(chaine_sauvegarde) + 4)
                   2577:                                * sizeof(unsigned char));
                   2578: 
                   2579:                        if (chaine == NULL)
                   2580:                        {
                   2581:                            (*s_etat_processus).erreur_systeme =
                   2582:                                    d_es_allocation_memoire;
                   2583:                            return(NULL);
                   2584:                        }
                   2585: 
                   2586:                        strcpy(chaine, chaine_sauvegarde);
                   2587:                        free(chaine_sauvegarde);
                   2588:                        strcat(chaine, " ][");
                   2589:                    }
                   2590:                }
                   2591:            }
                   2592: 
                   2593:            free(longueurs_maximales);
                   2594: 
                   2595:            chaine_sauvegarde = chaine;
                   2596:            chaine = (unsigned char *) malloc((strlen(chaine_sauvegarde)
                   2597:                    + 4) * sizeof(unsigned char));
                   2598: 
                   2599:            if (chaine == NULL)
                   2600:            {
                   2601:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2602:                return(NULL);
                   2603:            }
                   2604: 
                   2605:            strcpy(chaine, chaine_sauvegarde);
                   2606:            free(chaine_sauvegarde);
                   2607:            strcat(chaine, " ]]");
                   2608:        }
                   2609:    }
                   2610:    else if ((*s_objet).type == MIN)
                   2611:    {
                   2612: 
                   2613: /*
                   2614: --------------------------------------------------------------------------------
                   2615:   Matrice entière
                   2616: --------------------------------------------------------------------------------
                   2617: */
                   2618: 
                   2619:        nombre_lignes = (*((struct_matrice *) ((*s_objet).objet)))
                   2620:                .nombre_lignes;
                   2621:        nombre_colonnes = (*((struct_matrice *) ((*s_objet).objet)))
                   2622:                .nombre_colonnes;
                   2623: 
                   2624:        chaine = (unsigned char *) malloc(3 * sizeof(unsigned char));
                   2625: 
                   2626:        if (chaine != NULL)
                   2627:        {
                   2628:            strcpy(chaine, "[[");
1.58      bertrand 2629:            offset = ((integer8) strlen(chaine)) + offset_initial - 1;
1.1       bertrand 2630: 
1.59      bertrand 2631:            if ((longueurs_maximales = malloc(sizeof(integer8) *
1.58      bertrand 2632:                    ((size_t) nombre_colonnes))) == NULL)
1.1       bertrand 2633:            {
                   2634:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2635:                return(NULL);
                   2636:            }
                   2637: 
                   2638:            if (test_cfsf(s_etat_processus, 45) == d_vrai)
                   2639:            {
                   2640:                for(j = 0; j < nombre_colonnes; j++)
                   2641:                {
                   2642:                    longueurs_maximales[j] = 0;
                   2643:                }
                   2644: 
                   2645:                for(i = 0; i < nombre_lignes; i++)
                   2646:                {
                   2647:                    for(j = 0; j < nombre_colonnes; j++)
                   2648:                    {
                   2649:                        chaine_formatee = formateur_nombre(s_etat_processus,
1.58      bertrand 2650:                                &(((integer8 **) ((*((struct_matrice *)
1.1       bertrand 2651:                                ((*s_objet).objet))).tableau))[i][j]), 'I');
                   2652: 
                   2653:                        if (chaine_formatee == NULL)
                   2654:                        {
                   2655:                            (*s_etat_processus).erreur_systeme =
                   2656:                                    d_es_allocation_memoire;
                   2657:                            return(NULL);
                   2658:                        }
                   2659: 
1.58      bertrand 2660:                        longueur_courante = (integer8) strlen(chaine_formatee);
1.1       bertrand 2661:                        free(chaine_formatee);
                   2662: 
                   2663:                        if (longueurs_maximales[j] < longueur_courante)
                   2664:                        {
                   2665:                            longueurs_maximales[j] = longueur_courante;
                   2666:                        }
                   2667:                    }
                   2668:                }
                   2669:            }
                   2670: 
                   2671:            for(i = 0; i < nombre_lignes; i++)
                   2672:            {
                   2673:                for(j = 0; j < nombre_colonnes; j++)
                   2674:                {
                   2675:                    chaine_formatee = formateur_nombre(s_etat_processus,
1.58      bertrand 2676:                            &(((integer8 **) ((*((struct_matrice *)
1.1       bertrand 2677:                            ((*s_objet).objet))).tableau))[i][j]), 'I');
                   2678: 
                   2679:                    if (chaine_formatee == NULL)
                   2680:                    {
                   2681:                        (*s_etat_processus).erreur_systeme =
                   2682:                                d_es_allocation_memoire;
                   2683:                        return(NULL);
                   2684:                    }
                   2685: 
1.58      bertrand 2686:                    longueur_courante = (integer8) strlen(chaine_formatee);
1.1       bertrand 2687:                    chaine_sauvegarde = chaine;
                   2688: 
                   2689:                    if (test_cfsf(s_etat_processus, 45) == d_vrai)
                   2690:                    {
                   2691:                        chaine = (unsigned char *) malloc(
1.58      bertrand 2692:                                (strlen(chaine_sauvegarde) +
                   2693:                                ((size_t) longueur_courante)
                   2694:                                + ((size_t) longueurs_maximales[j]) + 2)
1.1       bertrand 2695:                                * sizeof(unsigned char));
                   2696: 
                   2697:                        if (chaine == NULL)
                   2698:                        {
                   2699:                            (*s_etat_processus).erreur_systeme =
                   2700:                                    d_es_allocation_memoire;
                   2701:                            return(NULL);
                   2702:                        }
                   2703: 
                   2704:                        strcpy(chaine, chaine_sauvegarde);
                   2705:                        free(chaine_sauvegarde);
                   2706:                        strcat(chaine, " ");
                   2707: 
                   2708:                        ptre = &(chaine[strlen(chaine)]);
                   2709: 
                   2710:                        for(k = 0; k < (longueurs_maximales[j]
                   2711:                                - longueur_courante); k++, *(ptre++) = ' ');
                   2712: 
                   2713:                        (*ptre) = d_code_fin_chaine;
                   2714:                    }
                   2715:                    else
                   2716:                    {
                   2717:                        chaine = (unsigned char *) malloc(
1.58      bertrand 2718:                                (strlen(chaine_sauvegarde) +
                   2719:                                ((size_t) longueur_courante)
1.1       bertrand 2720:                                + 2) * sizeof(unsigned char));
                   2721: 
                   2722:                        if (chaine == NULL)
                   2723:                        {
                   2724:                            (*s_etat_processus).erreur_systeme =
                   2725:                                    d_es_allocation_memoire;
                   2726:                            return(NULL);
                   2727:                        }
                   2728: 
                   2729:                        strcpy(chaine, chaine_sauvegarde);
                   2730:                        free(chaine_sauvegarde);
                   2731:                        strcat(chaine, " ");
                   2732:                    }
                   2733: 
                   2734:                    strcat(chaine, chaine_formatee);
                   2735:                    free(chaine_formatee);
                   2736:                }
                   2737: 
                   2738:                chaine_sauvegarde = chaine;
                   2739: 
                   2740:                if (i != (nombre_lignes - 1))
                   2741:                {
                   2742:                    if (test_cfsf(s_etat_processus, 45) == d_vrai)
                   2743:                    {
                   2744:                        chaine = (unsigned char *) malloc(
1.58      bertrand 2745:                                (strlen(chaine_sauvegarde) + 5 +
                   2746:                                ((size_t) offset)) * sizeof(unsigned char));
1.1       bertrand 2747: 
                   2748:                        if (chaine == NULL)
                   2749:                        {
                   2750:                            (*s_etat_processus).erreur_systeme =
                   2751:                                    d_es_allocation_memoire;
                   2752:                            return(NULL);
                   2753:                        }
                   2754: 
                   2755:                        strcpy(chaine, chaine_sauvegarde);
                   2756:                        free(chaine_sauvegarde);
                   2757:                        strcat(chaine, " ]\n");
                   2758:                        ptre = &(chaine[strlen(chaine)]);
                   2759: 
                   2760:                        for(k = 0; k < offset; k++, *(ptre++) = ' ');
                   2761: 
                   2762:                        (*ptre) = d_code_fin_chaine;
                   2763:                        strcat(chaine, "[");
                   2764:                    }
                   2765:                    else
                   2766:                    {
                   2767:                        chaine = (unsigned char *) malloc(
                   2768:                                (strlen(chaine_sauvegarde) + 4)
                   2769:                                * sizeof(unsigned char));
                   2770: 
                   2771:                        if (chaine == NULL)
                   2772:                        {
                   2773:                            (*s_etat_processus).erreur_systeme =
                   2774:                                    d_es_allocation_memoire;
                   2775:                            return(NULL);
                   2776:                        }
                   2777: 
                   2778:                        strcpy(chaine, chaine_sauvegarde);
                   2779:                        free(chaine_sauvegarde);
                   2780:                        strcat(chaine, " ][");
                   2781:                    }
                   2782:                }
                   2783:            }
                   2784: 
                   2785:            free(longueurs_maximales);
                   2786: 
                   2787:            chaine_sauvegarde = chaine;
                   2788:            chaine = (unsigned char *) malloc((strlen(chaine_sauvegarde)
                   2789:                    + 4) * sizeof(unsigned char));
                   2790: 
                   2791:            if (chaine == NULL)
                   2792:            {
                   2793:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2794:                return(NULL);
                   2795:            }
                   2796: 
                   2797:            strcpy(chaine, chaine_sauvegarde);
                   2798:            free(chaine_sauvegarde);
                   2799:            strcat(chaine, " ]]");
                   2800:        }
                   2801:    }
                   2802:    else if ((*s_objet).type == MRL)
                   2803:    {
                   2804: 
                   2805: /*
                   2806: --------------------------------------------------------------------------------
                   2807:   Matrice réelle
                   2808: --------------------------------------------------------------------------------
                   2809: */
                   2810: 
                   2811:        nombre_lignes = (*((struct_matrice *) ((*s_objet).objet)))
                   2812:                .nombre_lignes;
                   2813:        nombre_colonnes = (*((struct_matrice *) ((*s_objet).objet)))
                   2814:                .nombre_colonnes;
                   2815: 
                   2816:        chaine = (unsigned char *) malloc(3 * sizeof(unsigned char));
                   2817: 
                   2818:        if (chaine != NULL)
                   2819:        {
                   2820:            strcpy(chaine, "[[");
1.58      bertrand 2821:            offset = ((integer8) strlen(chaine)) + offset_initial - 1;
1.1       bertrand 2822: 
1.59      bertrand 2823:            if ((longueurs_maximales = malloc(sizeof(integer8) * 2 *
1.58      bertrand 2824:                    ((size_t) nombre_colonnes))) == NULL)
1.1       bertrand 2825:            {
                   2826:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   2827:                return(NULL);
                   2828:            }
                   2829: 
                   2830:            if (test_cfsf(s_etat_processus, 45) == d_vrai)
                   2831:            {
                   2832:                for(j = 0; j < (2 * nombre_colonnes); j++)
                   2833:                {
                   2834:                    longueurs_maximales[j] = 0;
                   2835:                }
                   2836: 
                   2837:                for(i = 0; i < nombre_lignes; i++)
                   2838:                {
                   2839:                    for(j = 0; j < nombre_colonnes; j++)
                   2840:                    {
                   2841:                        chaine_formatee = formateur_nombre(s_etat_processus,
1.58      bertrand 2842:                                &(((real8 **) ((*((struct_matrice *)
1.1       bertrand 2843:                                ((*s_objet).objet))).tableau))[i][j]), 'R');
                   2844: 
                   2845:                        if (chaine_formatee == NULL)
                   2846:                        {
                   2847:                            (*s_etat_processus).erreur_systeme =
                   2848:                                    d_es_allocation_memoire;
                   2849:                            return(NULL);
                   2850:                        }
                   2851: 
1.58      bertrand 2852:                        longueur_courante = (integer8) strlen(chaine_formatee);
1.1       bertrand 2853:                        longueur_decimale_courante = 0;
                   2854: 
                   2855:                        if ((ptrl = index(chaine_formatee,
                   2856:                                (test_cfsf(s_etat_processus, 48) == d_vrai)
                   2857:                                ? ',' : '.')) != NULL)
                   2858:                        {
                   2859:                            longueur_decimale_courante = longueur_courante
                   2860:                                    - (ptrl - chaine_formatee);
                   2861:                            longueur_courante = ptrl - chaine_formatee;
                   2862:                        }
                   2863: 
                   2864:                        free(chaine_formatee);
                   2865: 
                   2866:                        if (longueurs_maximales[2 * j] < longueur_courante)
                   2867:                        {
                   2868:                            longueurs_maximales[2 * j] = longueur_courante;
                   2869:                        }
                   2870: 
                   2871:                        if (longueurs_maximales[(2 * j) + 1] <
                   2872:                                longueur_decimale_courante)
                   2873:                        {
                   2874:                            longueurs_maximales[(2 * j) + 1] =
                   2875:                                    longueur_decimale_courante;
                   2876:                        }
                   2877:                    }
                   2878:                }
                   2879:            }
                   2880: 
                   2881:            for(i = 0; i < nombre_lignes; i++)
                   2882:            {
                   2883:                for(j = 0; j < nombre_colonnes; j++)
                   2884:                {
                   2885:                    chaine_formatee = formateur_nombre(s_etat_processus,
1.58      bertrand 2886:                            &(((real8 **) ((*((struct_matrice *)
1.1       bertrand 2887:                            ((*s_objet).objet))).tableau))[i][j]), 'R');
                   2888: 
                   2889:                    if (chaine_formatee == NULL)
                   2890:                    {
                   2891:                        (*s_etat_processus).erreur_systeme =
                   2892:                                d_es_allocation_memoire;
                   2893:                        return(NULL);
                   2894:                    }
                   2895: 
1.58      bertrand 2896:                    longueur_courante = (integer8) strlen(chaine_formatee);
1.1       bertrand 2897:                    longueur_decimale_courante = 0;
                   2898: 
                   2899:                    if ((ptrl = index(chaine_formatee,
                   2900:                            (test_cfsf(s_etat_processus, 48) == d_vrai)
                   2901:                            ? ',' : '.')) != NULL)
                   2902:                    {
                   2903:                        longueur_decimale_courante = longueur_courante
                   2904:                                - (ptrl - chaine_formatee);
                   2905:                        longueur_courante = ptrl - chaine_formatee;
                   2906:                    }
                   2907: 
                   2908:                    chaine_sauvegarde = chaine;
                   2909: 
                   2910:                    if (test_cfsf(s_etat_processus, 45) == d_vrai)
                   2911:                    {
                   2912:                        chaine = (unsigned char *) malloc(
                   2913:                                (strlen(chaine_sauvegarde) +
1.58      bertrand 2914:                                ((size_t) longueur_courante) +
                   2915:                                ((size_t) longueur_decimale_courante) +
                   2916:                                ((size_t) longueurs_maximales[2 * j]) +
                   2917:                                ((size_t) longueurs_maximales[(2 * j) + 1]) + 2)
1.1       bertrand 2918:                                * sizeof(unsigned char));
                   2919: 
                   2920:                        if (chaine == NULL)
                   2921:                        {
                   2922:                            (*s_etat_processus).erreur_systeme =
                   2923:                                    d_es_allocation_memoire;
                   2924:                            return(NULL);
                   2925:                        }
                   2926: 
                   2927:                        strcpy(chaine, chaine_sauvegarde);
                   2928:                        free(chaine_sauvegarde);
                   2929:                        strcat(chaine, " ");
                   2930: 
                   2931:                        ptre = &(chaine[strlen(chaine)]);
                   2932: 
                   2933:                        for(k = 0; k < (longueurs_maximales[2 * j]
                   2934:                                - longueur_courante); k++, *(ptre++) = ' ');
                   2935: 
                   2936:                        (*ptre) = d_code_fin_chaine;
                   2937:                        strcat(chaine, chaine_formatee);
                   2938:                        ptre = &(chaine[strlen(chaine)]);
                   2939: 
                   2940:                        for(k = 0; k < (longueurs_maximales[(2 * j) + 1]
                   2941:                                - longueur_decimale_courante);
                   2942:                                k++, *(ptre++) = ' ');
                   2943: 
                   2944:                        (*ptre) = d_code_fin_chaine;
                   2945:                    }
                   2946:                    else
                   2947:                    {
                   2948:                        chaine = (unsigned char *) malloc(
                   2949:                                (strlen(chaine_sauvegarde) +
1.58      bertrand 2950:                                ((size_t) longueur_courante) +
                   2951:                                ((size_t) longueur_decimale_courante)
1.1       bertrand 2952:                                + 2) * sizeof(unsigned char));
                   2953: 
                   2954:                        if (chaine == NULL)
                   2955:                        {
                   2956:                            (*s_etat_processus).erreur_systeme =
                   2957:                                    d_es_allocation_memoire;
                   2958:                            return(NULL);
                   2959:                        }
                   2960: 
                   2961:                        strcpy(chaine, chaine_sauvegarde);
                   2962:                        free(chaine_sauvegarde);
                   2963:                        strcat(chaine, " ");
                   2964:                        strcat(chaine, chaine_formatee);
                   2965:                    }
                   2966:                    
                   2967:                    free(chaine_formatee);
                   2968:                }
                   2969: 
                   2970:                chaine_sauvegarde = chaine;
                   2971: 
                   2972:                if (i != (nombre_lignes - 1))
                   2973:                {
                   2974:                    if (test_cfsf(s_etat_processus, 45) == d_vrai)
                   2975:                    {
                   2976:                        chaine = (unsigned char *) malloc(
1.58      bertrand 2977:                                (strlen(chaine_sauvegarde) + 5 +
                   2978:                                ((size_t) offset)) * sizeof(unsigned char));
1.1       bertrand 2979:                        
                   2980:                        if (chaine == NULL)
                   2981:                        {
                   2982:                            (*s_etat_processus).erreur_systeme =
                   2983:                                    d_es_allocation_memoire;
                   2984:                            return(NULL);
                   2985:                        }
                   2986: 
                   2987:                        strcpy(chaine, chaine_sauvegarde);
                   2988:                        free(chaine_sauvegarde);
                   2989:                        strcat(chaine, " ]\n");
                   2990:                        ptre = &(chaine[strlen(chaine)]);
                   2991: 
                   2992:                        for(k = 0; k < offset; k++, *(ptre++) = ' ');
                   2993: 
                   2994:                        (*ptre) = d_code_fin_chaine;
                   2995:                        strcat(chaine, "[");
                   2996:                    }
                   2997:                    else
                   2998:                    {
                   2999:                        chaine = (unsigned char *) malloc(
                   3000:                                (strlen(chaine_sauvegarde) + 4)
                   3001:                                * sizeof(unsigned char));
                   3002: 
                   3003:                        if (chaine == NULL)
                   3004:                        {
                   3005:                            (*s_etat_processus).erreur_systeme =
                   3006:                                    d_es_allocation_memoire;
                   3007:                            return(NULL);
                   3008:                        }
                   3009: 
                   3010:                        strcpy(chaine, chaine_sauvegarde);
                   3011:                        free(chaine_sauvegarde);
                   3012:                        strcat(chaine, " ][");
                   3013:                    }
                   3014:                }
                   3015:            }
                   3016: 
                   3017:            free(longueurs_maximales);
                   3018: 
                   3019:            chaine_sauvegarde = chaine;
                   3020:            chaine = (unsigned char *) malloc((strlen(chaine_sauvegarde)
                   3021:                    + 4) * sizeof(unsigned char));
                   3022: 
                   3023:            if (chaine == NULL)
                   3024:            {
                   3025:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   3026:                return(NULL);
                   3027:            }
                   3028: 
                   3029:            strcpy(chaine, chaine_sauvegarde);
                   3030:            free(chaine_sauvegarde);
                   3031:            strcat(chaine, " ]]");
                   3032:        }
                   3033:    }
                   3034:    else if ((*s_objet).type == MTX)
                   3035:    {
1.74      bertrand 3036:        if (alsprintf(s_etat_processus, &chaine,
                   3037:                "Mutex $ %016llX owned by $ %016llX",
1.60      bertrand 3038:                &((*((struct_mutex *) (*s_objet).objet)).mutex),
1.59      bertrand 3039:                (logical8) (*((struct_mutex *) (*s_objet).objet)).tid) < 0)
1.1       bertrand 3040:        {
                   3041:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   3042:            return(NULL);
                   3043:        }
                   3044:    }
                   3045:    else if ((*s_objet).type == NOM)
                   3046:    {
                   3047: 
                   3048: /*
                   3049: --------------------------------------------------------------------------------
                   3050:   Nom
                   3051: --------------------------------------------------------------------------------
                   3052: */
                   3053: 
                   3054:        if ((*((struct_nom *) (*s_objet).objet)).symbole == d_vrai)
                   3055:        {
                   3056:            chaine = (unsigned char *) malloc((strlen((*((struct_nom *)
                   3057:                    (*s_objet).objet)).nom) + 3) * sizeof(unsigned char));
                   3058: 
                   3059:            if (chaine == NULL)
                   3060:            {
                   3061:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   3062:                return(NULL);
                   3063:            }
                   3064: 
                   3065:            sprintf(chaine, "'%s'", (*((struct_nom *) (*s_objet).objet)).nom);
                   3066:        }
                   3067:        else
                   3068:        {
                   3069:            chaine = (unsigned char *) malloc((strlen((*((struct_nom *)
                   3070:                    (*s_objet).objet)).nom) + 1) * sizeof(unsigned char));
                   3071: 
                   3072:            if (chaine == NULL)
                   3073:            {
                   3074:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   3075:                return(NULL);
                   3076:            }
                   3077: 
                   3078:            sprintf(chaine, "%s", (*((struct_nom *) (*s_objet).objet)).nom);
                   3079:        }
                   3080:    }
                   3081:    else if ((*s_objet).type == REL)
                   3082:    {
                   3083: 
                   3084: /*
                   3085: --------------------------------------------------------------------------------
                   3086:   Réel
                   3087: --------------------------------------------------------------------------------
                   3088: */
                   3089: 
1.58      bertrand 3090:        chaine_formatee = formateur_nombre(s_etat_processus,
1.1       bertrand 3091:                ((real8 *) ((*s_objet).objet)), 'R');
                   3092: 
                   3093:        if (chaine_formatee == NULL)
                   3094:        {
                   3095:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   3096:            return(NULL);
                   3097:        }
                   3098: 
                   3099:        chaine = (unsigned char *) malloc((strlen(chaine_formatee) + 1)
                   3100:                * sizeof(unsigned char));
                   3101: 
                   3102:        if (chaine == NULL)
                   3103:        {
                   3104:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   3105:            return(NULL);
                   3106:        }
                   3107: 
                   3108:        strcpy(chaine, chaine_formatee);
                   3109:        free(chaine_formatee);
                   3110:    }
                   3111:    else if ((*s_objet).type == VCX)
                   3112:    {
                   3113: 
                   3114: /*
                   3115: --------------------------------------------------------------------------------
                   3116:   Vecteur complexe
                   3117: --------------------------------------------------------------------------------
                   3118: */
                   3119: 
                   3120:        nombre_colonnes = (*((struct_vecteur *) ((*s_objet).objet)))
                   3121:                .taille;
                   3122: 
                   3123:        chaine = (unsigned char *) malloc(2 * sizeof(unsigned char));
                   3124: 
                   3125:        if (chaine != NULL)
                   3126:        {
                   3127:            strcpy(chaine, "[");
                   3128: 
                   3129:            for(i = 0; i < nombre_colonnes; i++)
                   3130:            {
1.58      bertrand 3131:                chaine_formatee = formateur_nombre(s_etat_processus,
1.1       bertrand 3132:                        &(((struct_complexe16 *) ((*((struct_vecteur *)
                   3133:                        ((*s_objet).objet))).tableau))[i]), 'C');
                   3134: 
                   3135:                if (chaine_formatee == NULL)
                   3136:                {
                   3137:                    (*s_etat_processus).erreur_systeme =
                   3138:                            d_es_allocation_memoire;
                   3139:                    return(NULL);
                   3140:                }
                   3141: 
                   3142:                chaine_sauvegarde = chaine;
                   3143:                chaine = (unsigned char *) malloc(
                   3144:                        (strlen(chaine_sauvegarde) + strlen(chaine_formatee)
                   3145:                        + 2) * sizeof(unsigned char));
                   3146: 
                   3147:                if (chaine == NULL)
                   3148:                {
                   3149:                    (*s_etat_processus).erreur_systeme =
                   3150:                            d_es_allocation_memoire;
                   3151:                    return(NULL);
                   3152:                }
                   3153: 
                   3154:                strcpy(chaine, chaine_sauvegarde);
                   3155:                free(chaine_sauvegarde);
                   3156:                strcat(chaine, " ");
                   3157:                strcat(chaine, chaine_formatee);
                   3158:                free(chaine_formatee);
                   3159:            }
                   3160: 
                   3161:            chaine_sauvegarde = chaine;
                   3162:            chaine = (unsigned char *) malloc(
                   3163:                    (strlen(chaine_sauvegarde) + 3)
                   3164:                    * sizeof(unsigned char));
                   3165: 
                   3166:            if (chaine == NULL)
                   3167:            {
                   3168:                (*s_etat_processus).erreur_systeme =
                   3169:                        d_es_allocation_memoire;
                   3170:                return(NULL);
                   3171:            }
                   3172: 
                   3173:            strcpy(chaine, chaine_sauvegarde);
                   3174:            free(chaine_sauvegarde);
                   3175:            strcat(chaine, " ]");
                   3176:        }
                   3177:    }
                   3178:    else if ((*s_objet).type == VIN)
                   3179:    {
                   3180: 
                   3181: /*
                   3182: --------------------------------------------------------------------------------
                   3183:   Vecteur entier
                   3184: --------------------------------------------------------------------------------
                   3185: */
                   3186: 
                   3187:        nombre_colonnes = (*((struct_vecteur *) ((*s_objet).objet)))
                   3188:                .taille;
                   3189: 
                   3190:        chaine = (unsigned char *) malloc(2 * sizeof(unsigned char));
                   3191: 
                   3192:        if (chaine != NULL)
                   3193:        {
                   3194:            strcpy(chaine, "[");
                   3195: 
                   3196:            for(i = 0; i < nombre_colonnes; i++)
                   3197:            {
1.58      bertrand 3198:                chaine_formatee = formateur_nombre(s_etat_processus,
1.1       bertrand 3199:                        &(((integer8 *) ((*((struct_vecteur *)
                   3200:                        ((*s_objet).objet))).tableau))[i]), 'I');
                   3201: 
                   3202:                if (chaine_formatee == NULL)
                   3203:                {
                   3204:                    (*s_etat_processus).erreur_systeme =
                   3205:                            d_es_allocation_memoire;
                   3206:                    return(NULL);
                   3207:                }
                   3208: 
                   3209:                chaine_sauvegarde = chaine;
                   3210:                chaine = (unsigned char *) malloc(
                   3211:                        (strlen(chaine_sauvegarde) + strlen(chaine_formatee)
                   3212:                        + 2) * sizeof(unsigned char));
                   3213: 
                   3214:                if (chaine == NULL)
                   3215:                {
                   3216:                    (*s_etat_processus).erreur_systeme =
                   3217:                            d_es_allocation_memoire;
                   3218:                    return(NULL);
                   3219:                }
                   3220: 
                   3221:                strcpy(chaine, chaine_sauvegarde);
                   3222:                free(chaine_sauvegarde);
                   3223:                strcat(chaine, " ");
                   3224:                strcat(chaine, chaine_formatee);
                   3225:                free(chaine_formatee);
                   3226:            }
                   3227: 
                   3228:            chaine_sauvegarde = chaine;
                   3229:            chaine = (unsigned char *) malloc(
                   3230:                    (strlen(chaine_sauvegarde) + 3)
                   3231:                    * sizeof(unsigned char));
                   3232: 
                   3233:            if (chaine == NULL)
                   3234:            {
                   3235:                (*s_etat_processus).erreur_systeme =
                   3236:                        d_es_allocation_memoire;
                   3237:                return(NULL);
                   3238:            }
                   3239: 
                   3240:            strcpy(chaine, chaine_sauvegarde);
                   3241:            free(chaine_sauvegarde);
                   3242:            strcat(chaine, " ]");
                   3243:        }
                   3244:    }
                   3245:    else if ((*s_objet).type == VRL)
                   3246:    {
                   3247: 
                   3248: /*
                   3249: --------------------------------------------------------------------------------
                   3250:   Vecteur réel
                   3251: --------------------------------------------------------------------------------
                   3252: */
                   3253: 
                   3254:        nombre_colonnes = (*((struct_vecteur *) ((*s_objet).objet)))
                   3255:                .taille;
                   3256: 
                   3257:        chaine = (unsigned char *) malloc(2 * sizeof(unsigned char));
                   3258: 
                   3259:        if (chaine != NULL)
                   3260:        {
                   3261:            strcpy(chaine, "[");
                   3262: 
                   3263:            for(i = 0; i < nombre_colonnes; i++)
                   3264:            {
1.58      bertrand 3265:                chaine_formatee = formateur_nombre(s_etat_processus,
1.1       bertrand 3266:                        &(((real8 *) ((*((struct_vecteur *)
                   3267:                        ((*s_objet).objet))).tableau))[i]), 'R');
                   3268: 
                   3269:                if (chaine_formatee == NULL)
                   3270:                {
                   3271:                    (*s_etat_processus).erreur_systeme =
                   3272:                            d_es_allocation_memoire;
                   3273:                    return(NULL);
                   3274:                }
                   3275: 
                   3276:                chaine_sauvegarde = chaine;
                   3277:                chaine = (unsigned char *) malloc(
                   3278:                        (strlen(chaine_sauvegarde) + strlen(chaine_formatee)
                   3279:                        + 2) * sizeof(unsigned char));
                   3280: 
                   3281:                if (chaine == NULL)
                   3282:                {
                   3283:                    (*s_etat_processus).erreur_systeme =
                   3284:                            d_es_allocation_memoire;
                   3285:                    return(NULL);
                   3286:                }
                   3287: 
                   3288:                strcpy(chaine, chaine_sauvegarde);
                   3289:                free(chaine_sauvegarde);
                   3290:                strcat(chaine, " ");
                   3291:                strcat(chaine, chaine_formatee);
                   3292:                free(chaine_formatee);
                   3293:            }
                   3294: 
                   3295:            chaine_sauvegarde = chaine;
                   3296:            chaine = (unsigned char *) malloc(
                   3297:                    (strlen(chaine_sauvegarde) + 3)
                   3298:                    * sizeof(unsigned char));
                   3299: 
                   3300:            if (chaine == NULL)
                   3301:            {
1.83    ! bertrand 3302:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
1.1       bertrand 3303:                return(NULL);
                   3304:            }
                   3305: 
                   3306:            strcpy(chaine, chaine_sauvegarde);
                   3307:            free(chaine_sauvegarde);
                   3308:            strcat(chaine, " ]");
                   3309:        }
                   3310:    }
1.83    ! bertrand 3311:    else if ((*s_objet).type == EXT)
        !          3312:    {
        !          3313:        if ((__type_disp = dlsym((*s_objet).descripteur_bibliotheque,
        !          3314:                "__type_disp")) == NULL)
        !          3315:        {
        !          3316:            // Symbole externe non affichable
        !          3317: 
        !          3318:            if ((chaine = malloc((strlen("External symbol") + 1)
        !          3319:                    * sizeof(unsigned char))) == NULL)
        !          3320:            {
        !          3321:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !          3322:            }
        !          3323: 
        !          3324:            strcpy(chaine, "External symbol");
        !          3325:        }
        !          3326:        else
        !          3327:        {
        !          3328:            // Symbole externe affichable
        !          3329:            __type_disp(s_etat_processus, (void **) &chaine);
        !          3330:        }
        !          3331:    }
        !          3332:    else
        !          3333:    {
        !          3334:        BUG(1, uprintf("Unknown symbol type\n"));
        !          3335:    }
1.1       bertrand 3336: 
                   3337:    return(chaine);
                   3338: }
                   3339: 
                   3340: 
                   3341: /*
                   3342: ================================================================================
                   3343:   Routines qui transforment un nombre entier, réel ou complexe en chaîne de
                   3344:   caractères suivant le format courant
                   3345: ================================================================================
                   3346:   Entrées : pointeur générique sur la donnée numérique à convertir,
                   3347:   type de l'entité (I, R ou C).
                   3348: --------------------------------------------------------------------------------
                   3349:   Sorties : chaîne de caractères allouée dans la routine
                   3350: --------------------------------------------------------------------------------
                   3351:   Effets de bord : néant
                   3352: ================================================================================
                   3353: */
                   3354: 
                   3355: /*
                   3356: --------------------------------------------------------------------------------
                   3357:   Formatage des complexes, réels et entiers
                   3358: --------------------------------------------------------------------------------
                   3359: */
                   3360: 
                   3361: unsigned char *
                   3362: formateur_nombre(struct_processus *s_etat_processus,
                   3363:        void *valeur_numerique, unsigned char type)
                   3364: {
                   3365:    unsigned char               *chaine;
                   3366:    unsigned char               *construction_chaine;
                   3367:    unsigned char               *sauvegarde;
                   3368:    unsigned char               *tampon;
                   3369: 
                   3370:    chaine = NULL;
                   3371: 
                   3372:    switch(type)
                   3373:    {
                   3374:        case 'C' :
                   3375:        {
                   3376:            construction_chaine = (unsigned char *) malloc(
                   3377:                    2 * sizeof(unsigned char));
                   3378: 
                   3379:            if (construction_chaine == NULL)
                   3380:            {
                   3381:                (*s_etat_processus).erreur_systeme =
                   3382:                        d_es_allocation_memoire;
                   3383:                return(NULL);
                   3384:            }
                   3385: 
                   3386:            strcpy(construction_chaine, "(");
                   3387: 
                   3388:            tampon = formateur_reel(s_etat_processus,
1.58      bertrand 3389:                    &((*((struct_complexe16 *)
1.1       bertrand 3390:                    valeur_numerique)).partie_reelle), 'R');
                   3391: 
                   3392:            if (tampon == NULL)
                   3393:            {
                   3394:                (*s_etat_processus).erreur_systeme =
                   3395:                        d_es_allocation_memoire;
                   3396:                return(NULL);
                   3397:            }
                   3398: 
                   3399:            sauvegarde = construction_chaine;
                   3400: 
                   3401:            construction_chaine = (unsigned char *) malloc(
                   3402:                    (strlen(sauvegarde) + strlen(tampon) + 2)
                   3403:                    * sizeof(unsigned char));
                   3404: 
                   3405:            if (construction_chaine == NULL)
                   3406:            {
                   3407:                (*s_etat_processus).erreur_systeme =
                   3408:                        d_es_allocation_memoire;
                   3409:                return(NULL);
                   3410:            }
                   3411: 
                   3412:            strcpy(construction_chaine, sauvegarde);
                   3413:            free(sauvegarde);
                   3414:            strcat(construction_chaine, tampon);
                   3415:            free(tampon);
                   3416: 
                   3417:            if (test_cfsf(s_etat_processus, 48) == d_faux)
                   3418:            {
                   3419:                strcat(construction_chaine, ",");
                   3420:            }
                   3421:            else
                   3422:            {
                   3423:                strcat(construction_chaine, ".");
                   3424:            }
                   3425: 
                   3426:            tampon = formateur_reel(s_etat_processus,
1.58      bertrand 3427:                    &((*((struct_complexe16 *)
1.1       bertrand 3428:                    valeur_numerique)).partie_imaginaire), 'R');
                   3429: 
                   3430:            if (tampon == NULL)
                   3431:            {
                   3432:                (*s_etat_processus).erreur_systeme =
                   3433:                        d_es_allocation_memoire;
                   3434:                return(NULL);
                   3435:            }
                   3436: 
                   3437:            sauvegarde = construction_chaine;
                   3438: 
                   3439:            construction_chaine = (unsigned char *) malloc(
                   3440:                    (strlen(sauvegarde) + strlen(tampon) + 2)
                   3441:                    * sizeof(unsigned char));
                   3442: 
                   3443:            if (construction_chaine == NULL)
                   3444:            {
                   3445:                (*s_etat_processus).erreur_systeme =
                   3446:                        d_es_allocation_memoire;
                   3447:                return(NULL);
                   3448:            }
                   3449: 
                   3450:            strcpy(construction_chaine, sauvegarde);
                   3451:            free(sauvegarde);
                   3452:            strcat(construction_chaine, tampon);
                   3453:            free(tampon);
                   3454:            strcat(construction_chaine, ")");
                   3455: 
                   3456:            chaine = construction_chaine;
                   3457: 
                   3458:            break;
                   3459:        }
                   3460: 
                   3461:        case 'R' :
                   3462:        {
                   3463:            chaine = formateur_reel(s_etat_processus, valeur_numerique, 'R');
                   3464: 
                   3465:            if (chaine == NULL)
                   3466:            {
                   3467:                (*s_etat_processus).erreur_systeme =
                   3468:                        d_es_allocation_memoire;
                   3469:                return(NULL);
                   3470:            }
                   3471: 
                   3472:            break;
                   3473:        }
                   3474: 
                   3475:        default :
                   3476:        case 'I' :
                   3477:        {
                   3478:            chaine = formateur_reel(s_etat_processus, valeur_numerique, 'I');
                   3479: 
                   3480:            if (chaine == NULL)
                   3481:            {
                   3482:                (*s_etat_processus).erreur_systeme =
                   3483:                        d_es_allocation_memoire;
                   3484:                return(NULL);
                   3485:            }
                   3486: 
                   3487:            break;
                   3488:        }
                   3489:    }
                   3490: 
                   3491:    return(chaine);
                   3492: }
                   3493: 
                   3494: 
                   3495: /*
                   3496: --------------------------------------------------------------------------------
                   3497:   Formateur des réels et entiers
                   3498: --------------------------------------------------------------------------------
                   3499: */
                   3500: 
                   3501: unsigned char *
                   3502: formateur_reel(struct_processus *s_etat_processus,
                   3503:        void *valeur_numerique, unsigned char type)
                   3504: {
                   3505:    real8                   mantisse;
                   3506:    real8                   tampon_reel;
                   3507: 
                   3508:    integer8                tampon_entier;
                   3509: 
                   3510:    logical1                i49;
                   3511:    logical1                i50;
                   3512: 
                   3513:    long                    correction;
1.4       bertrand 3514:    long                    dernier_chiffre_significatif;
1.1       bertrand 3515:    long                    exposant;
1.58      bertrand 3516:    long                    i;
                   3517:    long                    j;
1.1       bertrand 3518:    long                    longueur_utile;
                   3519:    long                    longueur_utile_limite;
                   3520: 
                   3521:    unsigned char           *chaine;
1.3       bertrand 3522:    unsigned char           format[32 + 1];
1.1       bertrand 3523:    unsigned char           mode[3 + 1];
                   3524:    unsigned char           *ptr;
1.3       bertrand 3525:    unsigned char           tampon[32 + 1];
1.1       bertrand 3526: 
                   3527:    chaine = (unsigned char *) malloc((32 + 1) * sizeof(unsigned char));
                   3528: 
                   3529:    if (chaine == NULL)
                   3530:    {
                   3531:        (*s_etat_processus).erreur_systeme =
                   3532:                d_es_allocation_memoire;
                   3533:        return(NULL);
                   3534:    }
                   3535: 
                   3536:    if (type == 'R')
                   3537:    {
1.36      bertrand 3538: #      ifdef FP_INFINITE
1.38      bertrand 3539:        int     signe;
                   3540: 
                   3541:        if ((signe = isinf((*((real8 *) valeur_numerique)))) != 0)
1.36      bertrand 3542:        {
1.38      bertrand 3543:            if (signe > 0)
                   3544:            {
                   3545:                strcpy(chaine, "infinity");
                   3546:            }
                   3547:            else
                   3548:            {
                   3549:                strcpy(chaine, "-infinity");
                   3550:            }
                   3551: 
1.36      bertrand 3552:            return(chaine);
                   3553:        }
                   3554: #      endif
                   3555: 
1.37      bertrand 3556:        if (isnan((*((real8 *) valeur_numerique))))
                   3557:        {
                   3558:            strcpy(chaine, "undef");
                   3559:            return(chaine);
                   3560:        }
                   3561: 
1.1       bertrand 3562:        tampon_reel = *((real8 *) valeur_numerique);
                   3563: 
                   3564:        if (tampon_reel > ((real8) 0))
                   3565:        {
                   3566:            exposant = (long) floor(log10(tampon_reel));
                   3567:        }
                   3568:        else if (tampon_reel < ((real8) 0))
                   3569:        {
                   3570:            exposant = (long) floor(log10(-tampon_reel));
                   3571:        }
                   3572:        else
                   3573:        {
                   3574:            exposant = 0;
                   3575:        }
                   3576: 
1.58      bertrand 3577:        mantisse = (*((real8 *) valeur_numerique)) / pow(10, (double) exposant);
1.1       bertrand 3578:    }
                   3579:    else
                   3580:    {
                   3581:        tampon_entier = *((integer8 *) valeur_numerique);
                   3582: 
                   3583:        if (tampon_entier > ((integer8) 0))
                   3584:        {
1.58      bertrand 3585:            exposant = (long) floor(log10((double) tampon_entier));
1.1       bertrand 3586:        }
                   3587:        else if (tampon_entier < ((integer8) 0))
                   3588:        {
1.56      bertrand 3589:            if (tampon_entier != INT64_MIN)
                   3590:            {
1.58      bertrand 3591:                exposant = (long) floor(log10((double) -tampon_entier));
1.56      bertrand 3592:            }
                   3593:            else
                   3594:            {
                   3595:                tampon_reel = (real8) tampon_entier;
                   3596:                exposant = (long) floor(log10(-tampon_reel));
                   3597:            }
1.1       bertrand 3598:        }
                   3599:        else
                   3600:        {
                   3601:            exposant = 0;
                   3602:        }
                   3603: 
1.58      bertrand 3604:        mantisse = ((real8) (*((integer8 *) valeur_numerique))) /
                   3605:                pow(10, (double) exposant);
1.1       bertrand 3606:    }
                   3607: 
                   3608:    longueur_utile = 0;
                   3609:    j = 1;
                   3610: 
                   3611:    for(i = 53; i <= 56; i++)
                   3612:    {
                   3613:        longueur_utile += (test_cfsf(s_etat_processus, (unsigned char) i)
                   3614:                == d_vrai) ? j : 0;
                   3615:        j *= 2;
                   3616:    }
                   3617: 
                   3618:    longueur_utile_limite = 15;
                   3619: 
                   3620:    if (longueur_utile > longueur_utile_limite)
                   3621:    {
                   3622:        longueur_utile = longueur_utile_limite;
                   3623:    }
                   3624: 
                   3625:    i49 = test_cfsf(s_etat_processus, 49);
                   3626:    i50 = test_cfsf(s_etat_processus, 50);
                   3627: 
                   3628:    if (i49 == d_faux)
                   3629:    {
                   3630:        if (i50 == d_faux)
                   3631:        {
                   3632: 
                   3633: /*
                   3634: --------------------------------------------------------------------------------
                   3635:   Mode standard
                   3636: --------------------------------------------------------------------------------
                   3637: */
                   3638: 
                   3639:            strcpy(mode, "STD");
                   3640:        }
                   3641:        else
                   3642:        {
                   3643: 
                   3644: /*
                   3645: --------------------------------------------------------------------------------
                   3646:   Mode scientifique
                   3647: --------------------------------------------------------------------------------
                   3648: */
                   3649: 
                   3650:            strcpy(mode, "SCI");
                   3651:        }
                   3652:    }
                   3653:    else
                   3654:    {
                   3655:        if (i50 == d_faux)
                   3656:        {
                   3657: 
                   3658: /*
                   3659: --------------------------------------------------------------------------------
                   3660:   Mode fixe
                   3661: --------------------------------------------------------------------------------
                   3662: */
                   3663: 
                   3664:            strcpy(mode, "FIX");
                   3665:        }
                   3666:        else
                   3667:        {
                   3668: 
                   3669: /*
                   3670: --------------------------------------------------------------------------------
                   3671:   Mode ingénieur
                   3672: --------------------------------------------------------------------------------
                   3673: */
                   3674: 
                   3675:            strcpy(mode, "ENG");
                   3676:        }
                   3677:    }
                   3678: 
1.4       bertrand 3679:    // Test portant sur le nombre de chiffres significatifs dans
                   3680:    // le cas du format STD pour que 1.2E-15 apparaisse en notation
                   3681:    // SCI car il y a une perte de précision dans l'affichage.
                   3682: 
                   3683:    if ((strcmp(mode, "STD") == 0) && (type == 'R'))
                   3684:    {
                   3685:        if (abs(*((real8 *) valeur_numerique)) < 1)
                   3686:        {
                   3687:            dernier_chiffre_significatif = -exposant;
                   3688:            sprintf(tampon, ".%f", mantisse);
                   3689: 
                   3690:            ptr = &(tampon[strlen(tampon) - 1]);
                   3691: 
                   3692:            while((*ptr) != '.')
                   3693:            {
                   3694:                if ((*ptr) != '0')
                   3695:                {
                   3696:                    dernier_chiffre_significatif++;
                   3697:                }
                   3698: 
                   3699:                ptr--;
                   3700:            }
                   3701:        }
                   3702:        else
                   3703:        {
                   3704:            dernier_chiffre_significatif = 0;
                   3705:        }
                   3706:    }
                   3707:    else
                   3708:    {
                   3709:        dernier_chiffre_significatif = 0;
                   3710:    }
                   3711: 
1.1       bertrand 3712:    if ((strcmp(mode, "SCI") == 0) ||
                   3713:            ((strcmp(mode, "STD") == 0) && ((exposant >
1.4       bertrand 3714:            longueur_utile_limite) || (dernier_chiffre_significatif > 15) ||
1.1       bertrand 3715:            (exposant < -longueur_utile_limite))) ||
                   3716:            ((strcmp(mode, "FIX") == 0) &&
                   3717:            ((exposant >= longueur_utile_limite) ||
                   3718:            (exposant < -longueur_utile))))
                   3719:    {
                   3720:        chaine[0] = d_code_fin_chaine;
                   3721:        format[0] = d_code_fin_chaine;
                   3722: 
                   3723:        if (strcmp(mode, "STD") == 0)
                   3724:        {
                   3725:            longueur_utile = longueur_utile_limite - 1;
                   3726:        }
                   3727: 
                   3728:        sprintf(format, "%%.%luf", longueur_utile);
                   3729:        sprintf(tampon, format, mantisse);
                   3730:        strcpy(chaine, tampon);
                   3731: 
                   3732:        if (strcmp(mode, "STD") == 0)
                   3733:        {
                   3734:            ptr = &(chaine[strlen(chaine) - 1]);
                   3735:            while(((*ptr) == '0') || ((*ptr) == '.'))
                   3736:            {
                   3737:                (*ptr) = d_code_fin_chaine;
                   3738:                ptr--;
                   3739:            }
                   3740:        }
                   3741: 
                   3742:        strcat(chaine, "E");
                   3743:        sprintf(tampon, "%ld", exposant);
                   3744:        strcat(chaine, tampon);
                   3745:    }
                   3746:    else if (strcmp(mode, "FIX") == 0)
                   3747:    {
                   3748:        chaine[0] = d_code_fin_chaine;
                   3749:        format[0] = d_code_fin_chaine;
                   3750: 
                   3751:        if (longueur_utile + exposant >= longueur_utile_limite)
                   3752:        {
                   3753:            longueur_utile = longueur_utile_limite - (exposant + 1);
                   3754:        }
                   3755: 
                   3756:        sprintf(format, "%%.%luf", longueur_utile);
                   3757: 
1.58      bertrand 3758:        sprintf(tampon, format, (mantisse * pow(10, (double) exposant)));
1.1       bertrand 3759:        strcpy(chaine, tampon);
                   3760:    }
                   3761:    else if (strcmp(mode, "ENG") == 0)
                   3762:    {
                   3763:        chaine[0] = d_code_fin_chaine;
                   3764:        format[0] = d_code_fin_chaine;
                   3765: 
                   3766:        correction = labs(exposant) % 3;
                   3767: 
                   3768:        if (exposant < 0)
                   3769:        {
                   3770:            if (correction == 0)
                   3771:            {
                   3772:                correction = 3;
                   3773:            }
                   3774: 
                   3775:            correction =  3 - correction;
                   3776:        }
                   3777: 
                   3778:        longueur_utile -= correction;
                   3779:        sprintf(format, "%%.%luf", longueur_utile);
                   3780: 
1.58      bertrand 3781:        sprintf(tampon, format, (mantisse * pow(10, (double) correction)));
1.1       bertrand 3782:        strcpy(chaine, tampon);
                   3783:        strcat(chaine, "E");
                   3784:        sprintf(tampon, "%ld", (exposant - correction));
                   3785:        strcat(chaine, tampon);
                   3786:    }
                   3787:    else
                   3788:    {
                   3789:        if (type == 'I')
                   3790:        {
                   3791:            chaine[0] = d_code_fin_chaine;
                   3792:            sprintf(tampon, "%lld", *((integer8 *) valeur_numerique));
                   3793:        }
                   3794:        else
                   3795:        {
                   3796:            chaine[0] = d_code_fin_chaine;
                   3797:            format[0] = d_code_fin_chaine;
                   3798: 
                   3799:            if (exposant >= 0)
                   3800:            {
1.27      bertrand 3801:                if ((exposant + 1) < longueur_utile_limite)
                   3802:                {
                   3803:                    sprintf(format, "%%.%luf", (longueur_utile_limite - exposant
                   3804:                            - 1));
                   3805:                }
                   3806:                else
                   3807:                {
                   3808:                    strcpy(format, "%.0f.");
                   3809:                }
1.1       bertrand 3810:            }
                   3811:            else
                   3812:            {
                   3813:                sprintf(format, "%%.%luf", longueur_utile_limite);
                   3814:            }
                   3815: 
                   3816:            sprintf(tampon, format, *((real8 *) valeur_numerique));
                   3817: 
1.58      bertrand 3818:            i = ((long) strlen(tampon)) - 1;
1.1       bertrand 3819:            while(tampon[i] == '0')
                   3820:            {
                   3821:                tampon[i] = d_code_fin_chaine;
                   3822:                i--;
                   3823:            }
                   3824: 
                   3825:            if (ds_imposition_separateur_decimal == d_faux)
                   3826:            {
1.58      bertrand 3827:                i = ((long) strlen(tampon)) - 1;
1.1       bertrand 3828:                if (tampon[i] == '.')
                   3829:                {
                   3830:                    tampon[i] = d_code_fin_chaine;
                   3831:                }
                   3832:            }
                   3833:        }
1.4       bertrand 3834: 
1.1       bertrand 3835:        strcpy(chaine, tampon);
                   3836:    }
                   3837: 
                   3838:    if (test_cfsf(s_etat_processus, 48) == d_vrai)
                   3839:    {
1.58      bertrand 3840:        for(i = 0; i < (long) strlen(chaine); i++)
1.1       bertrand 3841:        {
                   3842:            if (chaine[i] == '.')
                   3843:            {
                   3844:                chaine[i] = ',';
                   3845:            }
                   3846:        }
                   3847:    }
                   3848: 
                   3849:    return(chaine);
                   3850: }
                   3851: 
                   3852: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>