/* ================================================================================ RPL/2 (R) version 4.1.25 Copyright (C) 1989-2016 Dr. BERTRAND Joël This file is part of RPL/2. RPL/2 is free software; you can redistribute it and/or modify it under the terms of the CeCILL V2 License as published by the french CEA, CNRS and INRIA. RPL/2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the CeCILL V2 License for more details. You should have received a copy of the CeCILL License along with RPL/2. If not, write to info@cecill.info. ================================================================================ */ #include "rpl-conv.h" /* ================================================================================ Fonction 'hex' ================================================================================ Entrées : -------------------------------------------------------------------------------- Sorties : -------------------------------------------------------------------------------- Effets de bord : néant ================================================================================ */ void instruction_hex(struct_processus *s_etat_processus) { (*s_etat_processus).erreur_execution = d_ex; if ((*s_etat_processus).affichage_arguments == 'Y') { printf("\n HEX "); if ((*s_etat_processus).langue == 'F') { printf("(base hexadécimale)\n\n"); printf(" Aucun argument\n"); } else { printf("(hexadecimal base)\n\n"); printf(" No argument\n"); } return; } else if ((*s_etat_processus).test_instruction == 'Y') { (*s_etat_processus).nombre_arguments = -1; return; } sf(s_etat_processus, 43); sf(s_etat_processus, 44); if (test_cfsf(s_etat_processus, 31) == d_vrai) { if (empilement_pile_last(s_etat_processus, 0) == d_erreur) { return; } } return; } /* ================================================================================ Fonction 'HMS->' ================================================================================ Entrées : structure processus -------------------------------------------------------------------------------- Sorties : -------------------------------------------------------------------------------- Effets de bord : néant ================================================================================ */ void instruction_hms_fleche(struct_processus *s_etat_processus) { struct_objet *s_copie; struct_objet *s_objet; (*s_etat_processus).erreur_execution = d_ex; if ((*s_etat_processus).affichage_arguments == 'Y') { printf("\n HMS-> "); if ((*s_etat_processus).langue == 'F') { printf("(conversion décimale)\n\n"); } else { printf("(conversion from hours minutes seconds to decimal)\n\n"); } printf(" 1: %s\n", d_INT); printf("-> 1: %s\n\n", d_INT); printf(" 1: %s\n", d_REL); printf("-> 1: %s\n", d_REL); return; } else if ((*s_etat_processus).test_instruction == 'Y') { (*s_etat_processus).nombre_arguments = -1; return; } if (test_cfsf(s_etat_processus, 31) == d_vrai) { if (empilement_pile_last(s_etat_processus, 1) == d_erreur) { return; } } if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile), &s_objet) == d_erreur) { (*s_etat_processus).erreur_execution = d_ex_manque_argument; return; } /* -------------------------------------------------------------------------------- Argument entier --------------------------------------------------------------------------------*/ if ((*s_objet).type == INT) { /* * On ne fait rien... */ } /* -------------------------------------------------------------------------------- Argument réel -------------------------------------------------------------------------------- */ else if ((*s_objet).type == REL) { if ((s_copie = copie_objet(s_etat_processus, s_objet, 'O')) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } liberation(s_etat_processus, s_objet); s_objet = s_copie; conversion_hms_vers_decimal((real8 *) (*s_objet).objet); } /* -------------------------------------------------------------------------------- Argument invalide -------------------------------------------------------------------------------- */ else { liberation(s_etat_processus, s_objet); (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument; return; } if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile), s_objet) == d_erreur) { return; } return; } /* ================================================================================ Fonction 'HMS+' ================================================================================ Entrées : structure processus -------------------------------------------------------------------------------- Sorties : -------------------------------------------------------------------------------- Effets de bord : néant ================================================================================ */ void instruction_hms_plus(struct_processus *s_etat_processus) { integer8 tampon; struct_objet *s_objet_argument_1; struct_objet *s_objet_argument_2; struct_objet *s_objet_resultat; (*s_etat_processus).erreur_execution = d_ex; if ((*s_etat_processus).affichage_arguments == 'Y') { printf("\n HMS+ "); if ((*s_etat_processus).langue == 'F') { printf("(addition sexadécimale)\n\n"); } else { printf("(addition in hours minutes seconds format)\n\n"); } printf(" 2: %s\n", d_INT); printf(" 1: %s\n", d_INT); printf("-> 1: %s, %s\n\n", d_INT, d_REL); printf(" 2: %s, %s\n", d_INT, d_REL); printf(" 1: %s, %s\n", d_INT, d_REL); printf("-> 1: %s\n", d_REL); return; } else if ((*s_etat_processus).test_instruction == 'Y') { (*s_etat_processus).nombre_arguments = -1; return; } if (test_cfsf(s_etat_processus, 31) == d_vrai) { if (empilement_pile_last(s_etat_processus, 2) == d_erreur) { return; } } if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile), &s_objet_argument_1) == d_erreur) { (*s_etat_processus).erreur_execution = d_ex_manque_argument; return; } if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile), &s_objet_argument_2) == d_erreur) { liberation(s_etat_processus, s_objet_argument_1); (*s_etat_processus).erreur_execution = d_ex_manque_argument; return; } /* -------------------------------------------------------------------------------- Arguments entiers --------------------------------------------------------------------------------*/ if (((*s_objet_argument_1).type == INT) && ((*s_objet_argument_2).type == INT)) { if (depassement_addition((integer8 *) (*s_objet_argument_1).objet, (integer8 *) (*s_objet_argument_2).objet, &tampon) == d_absence_erreur) { if ((s_objet_resultat = allocation(s_etat_processus, INT)) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } (*((integer8 *) (*s_objet_resultat).objet)) = tampon; } else { if ((s_objet_resultat = allocation(s_etat_processus, REL)) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } (*((real8 *) (*s_objet_resultat).objet)) = ((real8) (*((integer8 *) (*s_objet_argument_1).objet))) + ((real8) (*((integer8 *) (*s_objet_argument_2).objet))); } } /* -------------------------------------------------------------------------------- Au moins un argument réel -------------------------------------------------------------------------------- */ else if (((*s_objet_argument_1).type == REL) && ((*s_objet_argument_2).type == INT)) { conversion_hms_vers_decimal((real8 *) (*s_objet_argument_1).objet); if ((s_objet_resultat = allocation(s_etat_processus, REL)) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } (*((real8 *) (*s_objet_resultat).objet)) = ((real8) (*((integer8 *) (*s_objet_argument_2).objet))) + (*((real8 *) (*s_objet_argument_1).objet)); conversion_decimal_vers_hms((real8 *) (*s_objet_resultat).objet); } else if (((*s_objet_argument_1).type == INT) && ((*s_objet_argument_2).type == REL)) { conversion_hms_vers_decimal((real8 *) (*s_objet_argument_2).objet); if ((s_objet_resultat = allocation(s_etat_processus, REL)) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } (*((real8 *) (*s_objet_resultat).objet)) = (*((real8 *) (*s_objet_argument_2).objet)) + ((real8) (*((integer8 *) (*s_objet_argument_1).objet))); conversion_decimal_vers_hms((real8 *) (*s_objet_resultat).objet); } else if (((*s_objet_argument_1).type == REL) && ((*s_objet_argument_2).type == REL)) { conversion_hms_vers_decimal((real8 *) (*s_objet_argument_1).objet); conversion_hms_vers_decimal((real8 *) (*s_objet_argument_2).objet); if ((s_objet_resultat = allocation(s_etat_processus, REL)) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } (*((real8 *) (*s_objet_resultat).objet)) = (*((real8 *) (*s_objet_argument_2).objet)) + (*((real8 *) (*s_objet_argument_1).objet)); conversion_decimal_vers_hms((real8 *) (*s_objet_resultat).objet); } /* -------------------------------------------------------------------------------- Argument invalide -------------------------------------------------------------------------------- */ else { liberation(s_etat_processus, s_objet_argument_1); liberation(s_etat_processus, s_objet_argument_2); (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument; return; } liberation(s_etat_processus, s_objet_argument_1); liberation(s_etat_processus, s_objet_argument_2); if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile), s_objet_resultat) == d_erreur) { return; } return; } /* ================================================================================ Fonction 'HMS-' ================================================================================ Entrées : structure processus -------------------------------------------------------------------------------- Sorties : -------------------------------------------------------------------------------- Effets de bord : néant ================================================================================ */ void instruction_hms_moins(struct_processus *s_etat_processus) { integer8 tampon; struct_objet *s_objet_argument_1; struct_objet *s_objet_argument_2; struct_objet *s_objet_resultat; (*s_etat_processus).erreur_execution = d_ex; if ((*s_etat_processus).affichage_arguments == 'Y') { printf("\n HMS- "); if ((*s_etat_processus).langue == 'F') { printf("(soustraction sexadécimale)\n\n"); } else { printf("(substraction in hours minutes seconds format)\n\n"); } printf(" 2: %s\n", d_INT); printf(" 1: %s\n", d_INT); printf("-> 1: %s, %s\n\n", d_INT, d_REL); printf(" 2: %s, %s\n", d_INT, d_REL); printf(" 1: %s, %s\n", d_INT, d_REL); printf("-> 1: %s\n", d_REL); return; } else if ((*s_etat_processus).test_instruction == 'Y') { (*s_etat_processus).nombre_arguments = -1; return; } if (test_cfsf(s_etat_processus, 31) == d_vrai) { if (empilement_pile_last(s_etat_processus, 2) == d_erreur) { return; } } if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile), &s_objet_argument_1) == d_erreur) { (*s_etat_processus).erreur_execution = d_ex_manque_argument; return; } if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile), &s_objet_argument_2) == d_erreur) { liberation(s_etat_processus, s_objet_argument_1); (*s_etat_processus).erreur_execution = d_ex_manque_argument; return; } /* -------------------------------------------------------------------------------- Arguments entiers --------------------------------------------------------------------------------*/ if (((*s_objet_argument_1).type == INT) && ((*s_objet_argument_2).type == INT)) { if (depassement_soustraction((integer8 *) (*s_objet_argument_2).objet, (integer8 *) (*s_objet_argument_1).objet, &tampon) == d_absence_erreur) { if ((s_objet_resultat = allocation(s_etat_processus, INT)) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } (*((integer8 *) (*s_objet_resultat).objet)) = tampon; } else { if ((s_objet_resultat = allocation(s_etat_processus, REL)) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } (*((real8 *) (*s_objet_resultat).objet)) = ((real8) (*((integer8 *) (*s_objet_argument_2).objet))) - ((real8) (*((integer8 *) (*s_objet_argument_1).objet))); } } /* -------------------------------------------------------------------------------- Au moins un argument réel -------------------------------------------------------------------------------- */ else if (((*s_objet_argument_1).type == REL) && ((*s_objet_argument_2).type == INT)) { conversion_hms_vers_decimal((real8 *) (*s_objet_argument_1).objet); if ((s_objet_resultat = allocation(s_etat_processus, REL)) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } (*((real8 *) (*s_objet_resultat).objet)) = ((real8) (*((integer8 *) (*s_objet_argument_2).objet))) - (*((real8 *) (*s_objet_argument_1).objet)); conversion_decimal_vers_hms((real8 *) (*s_objet_resultat).objet); } else if (((*s_objet_argument_1).type == INT) && ((*s_objet_argument_2).type == REL)) { conversion_hms_vers_decimal((real8 *) (*s_objet_argument_2).objet); if ((s_objet_resultat = allocation(s_etat_processus, REL)) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } (*((real8 *) (*s_objet_resultat).objet)) = (*((real8 *) (*s_objet_argument_2).objet)) - ((real8) (*((integer8 *) (*s_objet_argument_1).objet))); conversion_decimal_vers_hms((real8 *) (*s_objet_resultat).objet); } else if (((*s_objet_argument_1).type == REL) && ((*s_objet_argument_2).type == REL)) { conversion_hms_vers_decimal((real8 *) (*s_objet_argument_1).objet); conversion_hms_vers_decimal((real8 *) (*s_objet_argument_2).objet); if ((s_objet_resultat = allocation(s_etat_processus, REL)) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } (*((real8 *) (*s_objet_resultat).objet)) = (*((real8 *) (*s_objet_argument_2).objet)) - (*((real8 *) (*s_objet_argument_1).objet)); conversion_decimal_vers_hms((real8 *) (*s_objet_resultat).objet); } /* -------------------------------------------------------------------------------- Argument invalide -------------------------------------------------------------------------------- */ else { liberation(s_etat_processus, s_objet_argument_1); liberation(s_etat_processus, s_objet_argument_2); (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument; return; } liberation(s_etat_processus, s_objet_argument_1); liberation(s_etat_processus, s_objet_argument_2); if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile), s_objet_resultat) == d_erreur) { return; } return; } /* ================================================================================ Fonction 'halt' ================================================================================ Entrées : -------------------------------------------------------------------------------- Sorties : -------------------------------------------------------------------------------- Effets de bord : néant ================================================================================ */ void instruction_halt(struct_processus *s_etat_processus) { (*s_etat_processus).erreur_execution = d_ex; if ((*s_etat_processus).affichage_arguments == 'Y') { printf("\n HALT "); if ((*s_etat_processus).langue == 'F') { printf("(arrêt du programme)\n\n"); printf(" Aucun argument\n"); } else { printf("(program halt)\n\n"); printf(" No argument\n"); } return; } else if ((*s_etat_processus).test_instruction == 'Y') { (*s_etat_processus).nombre_arguments = -1; return; } (*s_etat_processus).debug_programme = d_vrai; return; } /* ================================================================================ Fonction 'histogram' ================================================================================ Entrées : -------------------------------------------------------------------------------- Sorties : -------------------------------------------------------------------------------- Effets de bord : néant ================================================================================ */ void instruction_histogram(struct_processus *s_etat_processus) { (*s_etat_processus).erreur_execution = d_ex; if ((*s_etat_processus).affichage_arguments == 'Y') { printf("\n HISTOGRAM "); if ((*s_etat_processus).langue == 'F') { printf("(graphique statistique de type histogramme)\n\n"); printf(" Aucun argument\n"); } else { printf("(histogram statistical graphic)\n\n"); printf(" No argument\n"); } return; } else if ((*s_etat_processus).test_instruction == 'Y') { (*s_etat_processus).nombre_arguments = -1; return; } strcpy((*s_etat_processus).type_trace_sigma, "HISTOGRAMME"); return; } /* ================================================================================ Fonction 'help' ================================================================================ Entrées : -------------------------------------------------------------------------------- Sorties : -------------------------------------------------------------------------------- Effets de bord : néant ================================================================================ */ void instruction_help(struct_processus *s_etat_processus) { unsigned char *fonction; unsigned char ligne[80 + 1]; unsigned char *pointeur; unsigned char **ptr; unsigned char *registre; # undef COMPLETION # include "completion-conv.h" # include "usages-conv.h" if ((*s_etat_processus).test_instruction == 'Y') { (*s_etat_processus).nombre_arguments = -1; return; } (*s_etat_processus).erreur_execution = d_ex; printf("\n"); if ((*s_etat_processus).langue == 'F') { printf("Liste alphabétique des fonctions intrinsèques :\n\n"); } else { printf("Alphabetical list of intrinsic functions :\n\n"); } ptr = commandes; *ligne = d_code_fin_chaine; while(*ptr != (unsigned char *) NULL) { if (strcmp((*ptr), COMPLETION_RC) == 0) { printf("%s\n\n", ligne); *ligne = d_code_fin_chaine; } else if ((strlen(ligne) + strlen(*ptr) + 2) > 80) { printf("%s\n", ligne); *ligne = d_code_fin_chaine; strcpy(ligne, " "); strcat(ligne, *ptr); if (*(ptr + 1) != NULL) { strcat(ligne, ", "); } } else { if (*ligne == d_code_fin_chaine) { strcat(ligne, " "); } strcat(ligne, *ptr); if (*(ptr + 1) != NULL) { strcat(ligne, ", "); } } ptr++; } if (strlen(ligne) != 0) { printf("%s\n", ligne); } printf("\n"); if ((*s_etat_processus).langue == 'F') { printf("Délimiteurs :\n\n"); printf(" aucun : scalaire, nombre entier ou réel ;\n"); printf(" ( ) : nombre complexe ;\n"); printf(" # : entier binaire ;\n"); printf(" << >> : fonction utilisateur ou équation en notation " "polonaise inversée ;\n"); printf(" ' ' : équation en notation algébrique ou nom de " "variable ;\n"); printf(" [ ] : vecteur ;\n"); printf(" [[ ]] : matrice ;\n"); printf(" <[ ]> : table ;\n"); printf(" \" \" : chaîne de caractères ;\n"); printf(" { } : liste ;\n"); printf(" /* */ : commentaire ;\n"); printf(" // : commentaire allant jusqu'à la fin de la ligne." "\n\n"); printf("Fonctions classées par usage :\n"); printf("(les instructions écrites en majuscules sont insensibles à " "la casse)\n\n"); } else { printf("Delimiters :\n\n"); printf(" none : scalar, integer or real number ;\n"); printf(" ( ) : complex number ;\n"); printf(" # : binary integer ;\n"); printf(" << >> : user-defined function, or equation expressed in " "RPN ;\n"); printf(" ' ' : algebraic equation or variable name ;\n"); printf(" [ ] : scalar vector ;\n"); printf(" [[ ]] : scalar matrix ;\n"); printf(" <[ ]> : table ;\n"); printf(" \" \" : character string ;\n"); printf(" { } : list ;\n"); printf(" /* */ : comment ;\n"); printf(" // : comment running to the end of the line.\n\n"); printf("Functions ordre by usage :\n"); printf("(instructions written in upper case are case-unsensitive)\n\n"); } ptr = usages; *ligne = d_code_fin_chaine; while(*ptr != (unsigned char *) NULL) { if (strcmp((*ptr), USAGES_RC) == 0) { printf(" %s\n\n", ligne); *ligne = d_code_fin_chaine; } else if (strcmp((*ptr), USAGES_TITRE) == 0) { ptr++; if ((*s_etat_processus).langue == 'F') { ptr++; printf(" %s\n", *ptr); } else { printf(" %s\n", *ptr); ptr++; } } else if ((strlen(ligne) + strlen(*ptr) + 2) > 76) { printf(" %s\n", ligne); *ligne = d_code_fin_chaine; strcat(ligne, *ptr); if (*(ptr + 1) != NULL) { strcat(ligne, ", "); } } else { strcat(ligne, *ptr); if (*(ptr + 1) != NULL) { strcat(ligne, ", "); } } ptr++; } if (strlen(ligne) != 0) { printf(" %s\n", ligne); } printf("\n"); if ((*s_etat_processus).langue == 'F') { printf("Processus asynchrones :\n"); printf(" CTRL+c : interruption de l'instruction en cours ;\n"); printf(" CTRL+d : en mode interactif, provoque un ABORT\n"); printf(" CTRL+g : en mode interactif, provoque l'annulation de la " "commande en cours ;\n"); printf(" CTRL+z : en cours d'exécution, provoque un HALT " "asynchrone.\n\n"); printf("Drapeaux (valeurs par défaut) :\n"); printf(" 1 à 30 : drapeaux banalisés (désarmés)\n"); printf(" 31 : pile LAST active (armé en mode interactif, " "désarmé sinon)\n"); printf(" 32 : impression automatique (désarmé)\n"); printf(" 33 : retour à la ligne automatique invalidé " "(désarmé)\n"); printf(" 34 : évaluation des caractères de contrôle (armé)\n"); printf(" 35 : évaluation symbolique des constantes (armé)\n"); printf(" 36 : évaluation symbolique des fonctions (armé)\n"); printf(" 37 à 42 : taille des entiers binaires, bit de poids faible " "en tête (armés)\n"); printf(" 43 à 44 : base de numérotation binaire (désarmés)\n"); printf(" 45 : affichage multiligne (armé)\n"); printf(" 46 à 47 : réservés (désarmés)\n"); printf(" 48 : virgule comme séparateur décimal (désarmé)\n"); printf(" 49 à 50 : format des nombres (désarmés)\n"); printf(" 51 : tonalité désactivée (désarmé)\n"); printf(" 52 : mise à jour automatique des graphiques désactivée " "(désarmé)\n"); printf(" 53 à 56 : nombre de chiffres décimaux, bit de poids fort " "en tête (désarmés)\n"); printf(" 57 à 59 : réservés (désarmés)\n"); printf(" 60 : radian et non degré comme unité angulaire " "(armé)\n"); printf(" 61 à 64 : réservés (désarmés)\n"); } else { printf("Hot keys :\n"); printf(" CTRL+c : interruption ;\n"); printf(" CTRL+d : in interactive mode only sends ABORT on empty " "command line ;\n"); printf(" CTRL+g : in interactive mode only, nullifies current " "command line ;\n"); printf(" CTRL+z : HALT.\n\n"); printf("Flags (default values) :\n"); printf(" 1 to 30 : user flags (cleared)\n"); printf(" 31 : LAST stack enabled (set in interactive mode, " "cleared if not)\n"); printf(" 32 : automatic printing (cleared)\n"); printf(" 33 : automatic carriage return disabled " "(cleared)\n"); printf(" 34 : control characters evaluation (set)\n"); printf(" 35 : constant symbolic evaluation (set)\n"); printf(" 36 : function symbolic evaluation (set)\n"); printf(" 37 to 42 : size of binary integers, while starting with " "less significant bit\n"); printf(" (set)\n"); printf(" 43 to 44 : binary integer basis (cleared)\n"); printf(" 45 : multiline conversion (set)\n"); printf(" 46 to 47 : reserved (cleared)\n"); printf(" 48 : comma as decimal separator (cleared)\n"); printf(" 49 to 50 : numbers format (cleared)\n"); printf(" 51 : visual bell disabled (cleared)\n"); printf(" 52 : graphic automatic redrawing disabled " "(cleared)\n"); printf(" 53 to 56 : precision, while starting with " "less significant bit (cleared)\n"); printf(" 57 to 59 : reserved (cleared)\n"); printf(" 60 : radian mode instead of degree one (set)\n"); printf(" 61 to 64 : reserved (cleared)\n"); } printf("\n"); if ((*s_etat_processus).langue == 'F') { printf("Types d'arguments :\n\n"); printf(" %s : entier (64 bits)\n", d_INT); printf(" %s : réel (64 bits)\n", d_REL); printf(" %s : complexe (128 bits)\n", d_CPL); printf(" %s : vecteur entier\n", d_VIN); printf(" %s : vecteur réel\n", d_VRL); printf(" %s : vecteur complexe\n", d_VCX); printf(" %s : matrice entière\n", d_MIN); printf(" %s : matrice réelle\n", d_MRL); printf(" %s : matrice complexe\n", d_MCX); printf(" %s : table\n", d_TAB); printf(" %s : entier binaire\n", d_BIN); printf(" %s : nom\n", d_NOM); printf(" %s : chaîne de caractères\n", d_CHN); printf(" %s : liste\n", d_LST); printf(" %s : expression algébrique\n", d_ALG); printf(" %s : expression RPN\n", d_RPN); printf(" %s : descripteur de fichier\n", d_FCH); printf(" %s : socket\n", d_SCK); printf(" %s : descripteur de bibliothèque\n", d_SLB); printf(" %s : processus\n", d_PRC); printf(" %s : connexion à une base de données SQL\n", d_SQL); printf(" %s : mutex\n", d_MTX); printf(" %s : sémaphore nommé\n", d_SPH); } else { printf("Types :\n\n"); printf(" %s : integer (64 bits)\n", d_INT); printf(" %s : real (64 bits)\n", d_REL); printf(" %s : complex (128 bits)\n", d_CPL); printf(" %s : integer vector\n", d_VIN); printf(" %s : real vector\n", d_VRL); printf(" %s : complex vector\n", d_VCX); printf(" %s : integer matrix\n", d_MIN); printf(" %s : real matrix\n", d_MRL); printf(" %s : complex matrix\n", d_MCX); printf(" %s : table\n", d_TAB); printf(" %s : binary integer\n", d_BIN); printf(" %s : name\n", d_NOM); printf(" %s : string of chars\n", d_CHN); printf(" %s : list\n", d_LST); printf(" %s : algebraic expression\n", d_ALG); printf(" %s : RPN expression\n", d_RPN); printf(" %s : file descriptor\n", d_FCH); printf(" %s : socket\n", d_SCK); printf(" %s : library descriptor\n", d_SLB); printf(" %s : process\n", d_PRC); printf(" %s : connection to SQL database\n", d_SQL); printf(" %s : mutex\n", d_MTX); printf(" %s : named semaphore\n", d_SPH); } /* * HELP ne doit pas être récursif sous peine de boucler indéfiniment * dans la fonction. */ if ((*s_etat_processus).affichage_arguments == 'Y') { return; } printf("\n"); registre = (*s_etat_processus).instruction_courante; flockfile(stdin); flockfile(stdout); while((fonction = readline("HELP> ")) != NULL) { if (strcmp(fonction, "") == 0) { break; } funlockfile(stdin); funlockfile(stdout); /* * Élimination des blancs précédents l'instruction */ pointeur = fonction; while(((*pointeur) == d_code_tabulation) || ((*pointeur) == d_code_espace)) { pointeur++; } (*s_etat_processus).instruction_courante = pointeur; /* * Élimination des blancs et caractères suivant la première * instruction. */ while(((*pointeur) != d_code_tabulation) && ((*pointeur) != d_code_espace) && ((*pointeur) != d_code_fin_chaine)) { pointeur++; } (*pointeur) = d_code_fin_chaine; add_history(pointeur); stifle_history(ds_longueur_historique); (*s_etat_processus).test_instruction = 'Y'; analyse(s_etat_processus, NULL); (*s_etat_processus).test_instruction = 'N'; if ((*s_etat_processus).instruction_valide == 'Y') { (*s_etat_processus).affichage_arguments = 'Y'; analyse(s_etat_processus, NULL); (*s_etat_processus).affichage_arguments = 'N'; printf("\n"); } else { if ((*s_etat_processus).langue == 'F') { printf("Fonction inconnue.\n"); } else { printf("Unknown function\n"); } } free(fonction); flockfile(stdin); flockfile(stdout); } funlockfile(stdin); funlockfile(stdout); if (fonction == NULL) { printf("\n"); } (*s_etat_processus).instruction_courante = registre; /* * Évite l'empilement de 'HELP()' dans la pile opérationnelle dans le * cas où la dernière commande entrée à l'invite "HELP> " n'existe pas. */ (*s_etat_processus).instruction_valide = 'Y'; return; } // vim: ts=4