--- rpl/src/formateur.c 2017/01/18 15:44:17 1.81 +++ rpl/src/formateur.c 2018/05/30 09:27:31 1.89 @@ -1,7 +1,7 @@ /* ================================================================================ - RPL/2 (R) version 4.1.26 - Copyright (C) 1989-2017 Dr. BERTRAND Joël + RPL/2 (R) version 4.1.29 + Copyright (C) 1989-2018 Dr. BERTRAND Joël This file is part of RPL/2. @@ -42,6 +42,8 @@ formateur(struct_processus *s_etat_proce int parentheses_groupe_gauche; int parentheses_groupe_droit; + integer8 (*__type_disp)(struct_processus *, void **); + logical1 registre45; logical4 autorisation_parenthese; @@ -3296,8 +3298,7 @@ formateur(struct_processus *s_etat_proce if (chaine == NULL) { - (*s_etat_processus).erreur_systeme = - d_es_allocation_memoire; + (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return(NULL); } @@ -3306,6 +3307,77 @@ formateur(struct_processus *s_etat_proce strcat(chaine, " ]"); } } + else if ((*s_objet).type == NON) + { + if ((chaine = malloc((strlen("System object") + 1) + * sizeof(unsigned char))) == NULL) + { + (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; + return(NULL); + } + + strcpy(chaine, "System object"); + } + else if ((*s_objet).type == EXT) + { + l_element_courant = (*s_etat_processus).s_bibliotheques; + + while(l_element_courant != NULL) + { + if ((*((struct_bibliotheque *) (*l_element_courant).donnee)) + .descripteur == (*s_objet).descripteur_bibliotheque) + { + if ((__type_disp = dlsym((*s_objet).descripteur_bibliotheque, + "__type_disp")) == NULL) + { + // Symbole externe non affichable + + if ((chaine = malloc((strlen( + "External symbol (disp function not found)") + 1) + * sizeof(unsigned char))) == NULL) + { + (*s_etat_processus).erreur_systeme = + d_es_allocation_memoire; + return(NULL); + } + + strcpy(chaine, "External symbol (disp function not found)"); + } + else + { + // Symbole externe affichable + void **arg; + + arg = (void **) &s_objet; + __type_disp(s_etat_processus, arg); + chaine = (unsigned char *) (*arg); + } + + break; + } + + l_element_courant = (*l_element_courant).suivant; + } + + if (l_element_courant == NULL) + { + // Symbole externe non affichable + + if ((chaine = malloc((strlen("External symbol") + 1) + * sizeof(unsigned char))) == NULL) + { + (*s_etat_processus).erreur_systeme = + d_es_allocation_memoire; + return(NULL); + } + + strcpy(chaine, "External symbol"); + } + } + else + { + BUG(1, uprintf("Unknown symbol type\n")); + } return(chaine); }