Annotation of rpl/src/instructions_h1.c, revision 1.1
1.1 ! bertrand 1: /*
! 2: ================================================================================
! 3: RPL/2 (R) version 4.0.9
! 4: Copyright (C) 1989-2010 Dr. BERTRAND Joël
! 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:
! 23: #include "rpl.conv.h"
! 24:
! 25:
! 26: /*
! 27: ================================================================================
! 28: Fonction 'hex'
! 29: ================================================================================
! 30: Entrées :
! 31: --------------------------------------------------------------------------------
! 32: Sorties :
! 33: --------------------------------------------------------------------------------
! 34: Effets de bord : néant
! 35: ================================================================================
! 36: */
! 37:
! 38: void
! 39: instruction_hex(struct_processus *s_etat_processus)
! 40: {
! 41: (*s_etat_processus).erreur_execution = d_ex;
! 42:
! 43: if ((*s_etat_processus).affichage_arguments == 'Y')
! 44: {
! 45: printf("\n HEX ");
! 46:
! 47: if ((*s_etat_processus).langue == 'F')
! 48: {
! 49: printf("(base hexadécimale)\n\n");
! 50: printf(" Aucun argument\n");
! 51: }
! 52: else
! 53: {
! 54: printf("(hexadecimal base)\n\n");
! 55: printf(" No argument\n");
! 56: }
! 57:
! 58: return;
! 59: }
! 60: else if ((*s_etat_processus).test_instruction == 'Y')
! 61: {
! 62: (*s_etat_processus).nombre_arguments = -1;
! 63: return;
! 64: }
! 65:
! 66: sf(s_etat_processus, 43);
! 67: sf(s_etat_processus, 44);
! 68:
! 69: if (test_cfsf(s_etat_processus, 31) == d_vrai)
! 70: {
! 71: if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
! 72: {
! 73: return;
! 74: }
! 75: }
! 76:
! 77: return;
! 78: }
! 79:
! 80:
! 81: /*
! 82: ================================================================================
! 83: Fonction 'HMS->'
! 84: ================================================================================
! 85: Entrées : structure processus
! 86: --------------------------------------------------------------------------------
! 87: Sorties :
! 88: --------------------------------------------------------------------------------
! 89: Effets de bord : néant
! 90: ================================================================================
! 91: */
! 92:
! 93: void
! 94: instruction_hms_fleche(struct_processus *s_etat_processus)
! 95: {
! 96: struct_objet *s_copie;
! 97: struct_objet *s_objet;
! 98:
! 99: (*s_etat_processus).erreur_execution = d_ex;
! 100:
! 101: if ((*s_etat_processus).affichage_arguments == 'Y')
! 102: {
! 103: printf("\n HMS-> ");
! 104:
! 105: if ((*s_etat_processus).langue == 'F')
! 106: {
! 107: printf("(conversion décimale)\n\n");
! 108: }
! 109: else
! 110: {
! 111: printf("(conversion from hours minutes seconds to decimal)\n\n");
! 112: }
! 113:
! 114: printf(" 1: %s\n", d_INT);
! 115: printf("-> 1: %s\n\n", d_INT);
! 116:
! 117: printf(" 1: %s\n", d_REL);
! 118: printf("-> 1: %s\n", d_REL);
! 119:
! 120: return;
! 121: }
! 122: else if ((*s_etat_processus).test_instruction == 'Y')
! 123: {
! 124: (*s_etat_processus).nombre_arguments = -1;
! 125: return;
! 126: }
! 127:
! 128: if (test_cfsf(s_etat_processus, 31) == d_vrai)
! 129: {
! 130: if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
! 131: {
! 132: return;
! 133: }
! 134: }
! 135:
! 136: if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 137: &s_objet) == d_erreur)
! 138: {
! 139: (*s_etat_processus).erreur_execution = d_ex_manque_argument;
! 140: return;
! 141: }
! 142:
! 143: /*
! 144: --------------------------------------------------------------------------------
! 145: Argument entier
! 146: --------------------------------------------------------------------------------*/
! 147:
! 148: if ((*s_objet).type == INT)
! 149: {
! 150: /*
! 151: * On ne fait rien...
! 152: */
! 153: }
! 154:
! 155: /*
! 156: --------------------------------------------------------------------------------
! 157: Argument réel
! 158: --------------------------------------------------------------------------------
! 159: */
! 160:
! 161: else if ((*s_objet).type == REL)
! 162: {
! 163: if ((s_copie = copie_objet(s_etat_processus, s_objet, 'O')) == NULL)
! 164: {
! 165: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 166: return;
! 167: }
! 168:
! 169: liberation(s_etat_processus, s_objet);
! 170: s_objet = s_copie;
! 171:
! 172: conversion_hms_vers_decimal((real8 *) (*s_objet).objet);
! 173: }
! 174:
! 175: /*
! 176: --------------------------------------------------------------------------------
! 177: Argument invalide
! 178: --------------------------------------------------------------------------------
! 179: */
! 180:
! 181: else
! 182: {
! 183: liberation(s_etat_processus, s_objet);
! 184:
! 185: (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
! 186: return;
! 187: }
! 188:
! 189: if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 190: s_objet) == d_erreur)
! 191: {
! 192: return;
! 193: }
! 194:
! 195: return;
! 196: }
! 197:
! 198:
! 199: /*
! 200: ================================================================================
! 201: Fonction 'HMS+'
! 202: ================================================================================
! 203: Entrées : structure processus
! 204: --------------------------------------------------------------------------------
! 205: Sorties :
! 206: --------------------------------------------------------------------------------
! 207: Effets de bord : néant
! 208: ================================================================================
! 209: */
! 210:
! 211: void
! 212: instruction_hms_plus(struct_processus *s_etat_processus)
! 213: {
! 214: integer8 tampon;
! 215:
! 216: struct_objet *s_objet_argument_1;
! 217: struct_objet *s_objet_argument_2;
! 218: struct_objet *s_objet_resultat;
! 219:
! 220: (*s_etat_processus).erreur_execution = d_ex;
! 221:
! 222: if ((*s_etat_processus).affichage_arguments == 'Y')
! 223: {
! 224: printf("\n HMS+ ");
! 225:
! 226: if ((*s_etat_processus).langue == 'F')
! 227: {
! 228: printf("(addition sexadécimale)\n\n");
! 229: }
! 230: else
! 231: {
! 232: printf("(addition in hours minutes seconds format)\n\n");
! 233: }
! 234:
! 235: printf(" 2: %s\n", d_INT);
! 236: printf(" 1: %s\n", d_INT);
! 237: printf("-> 1: %s, %s\n\n", d_INT, d_REL);
! 238:
! 239: printf(" 2: %s, %s\n", d_INT, d_REL);
! 240: printf(" 1: %s, %s\n", d_INT, d_REL);
! 241: printf("-> 1: %s\n", d_REL);
! 242:
! 243: return;
! 244: }
! 245: else if ((*s_etat_processus).test_instruction == 'Y')
! 246: {
! 247: (*s_etat_processus).nombre_arguments = -1;
! 248: return;
! 249: }
! 250:
! 251: if (test_cfsf(s_etat_processus, 31) == d_vrai)
! 252: {
! 253: if (empilement_pile_last(s_etat_processus, 2) == d_erreur)
! 254: {
! 255: return;
! 256: }
! 257: }
! 258:
! 259: if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 260: &s_objet_argument_1) == d_erreur)
! 261: {
! 262: (*s_etat_processus).erreur_execution = d_ex_manque_argument;
! 263: return;
! 264: }
! 265:
! 266: if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 267: &s_objet_argument_2) == d_erreur)
! 268: {
! 269: liberation(s_etat_processus, s_objet_argument_1);
! 270: (*s_etat_processus).erreur_execution = d_ex_manque_argument;
! 271: return;
! 272: }
! 273:
! 274: /*
! 275: --------------------------------------------------------------------------------
! 276: Arguments entiers
! 277: --------------------------------------------------------------------------------*/
! 278:
! 279: if (((*s_objet_argument_1).type == INT) &&
! 280: ((*s_objet_argument_2).type == INT))
! 281: {
! 282: if (depassement_addition((integer8 *) (*s_objet_argument_1).objet,
! 283: (integer8 *) (*s_objet_argument_2).objet, &tampon) ==
! 284: d_absence_erreur)
! 285: {
! 286: if ((s_objet_resultat = allocation(s_etat_processus, INT))
! 287: == NULL)
! 288: {
! 289: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 290: return;
! 291: }
! 292:
! 293: (*((integer8 *) (*s_objet_resultat).objet)) = tampon;
! 294: }
! 295: else
! 296: {
! 297: if ((s_objet_resultat = allocation(s_etat_processus, REL))
! 298: == NULL)
! 299: {
! 300: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 301: return;
! 302: }
! 303:
! 304: (*((real8 *) (*s_objet_resultat).objet)) = ((real8)
! 305: (*((integer8 *) (*s_objet_argument_1).objet))) + ((real8)
! 306: (*((integer8 *) (*s_objet_argument_2).objet)));
! 307: }
! 308: }
! 309:
! 310: /*
! 311: --------------------------------------------------------------------------------
! 312: Au moins un argument réel
! 313: --------------------------------------------------------------------------------
! 314: */
! 315:
! 316: else if (((*s_objet_argument_1).type == REL) &&
! 317: ((*s_objet_argument_2).type == INT))
! 318: {
! 319: conversion_hms_vers_decimal((real8 *) (*s_objet_argument_1).objet);
! 320:
! 321: if ((s_objet_resultat = allocation(s_etat_processus, REL))
! 322: == NULL)
! 323: {
! 324: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 325: return;
! 326: }
! 327:
! 328: (*((real8 *) (*s_objet_resultat).objet)) = (*((integer8 *)
! 329: (*s_objet_argument_2).objet)) + (*((real8 *)
! 330: (*s_objet_argument_1).objet));
! 331:
! 332: conversion_decimal_vers_hms((real8 *) (*s_objet_resultat).objet);
! 333: }
! 334: else if (((*s_objet_argument_1).type == INT) &&
! 335: ((*s_objet_argument_2).type == REL))
! 336: {
! 337: conversion_hms_vers_decimal((real8 *) (*s_objet_argument_2).objet);
! 338:
! 339: if ((s_objet_resultat = allocation(s_etat_processus, REL))
! 340: == NULL)
! 341: {
! 342: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 343: return;
! 344: }
! 345:
! 346: (*((real8 *) (*s_objet_resultat).objet)) = (*((real8 *)
! 347: (*s_objet_argument_2).objet)) + (*((integer8 *)
! 348: (*s_objet_argument_1).objet));
! 349:
! 350: conversion_decimal_vers_hms((real8 *) (*s_objet_resultat).objet);
! 351: }
! 352: else if (((*s_objet_argument_1).type == REL) &&
! 353: ((*s_objet_argument_2).type == REL))
! 354: {
! 355: conversion_hms_vers_decimal((real8 *) (*s_objet_argument_1).objet);
! 356: conversion_hms_vers_decimal((real8 *) (*s_objet_argument_2).objet);
! 357:
! 358: if ((s_objet_resultat = allocation(s_etat_processus, REL))
! 359: == NULL)
! 360: {
! 361: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 362: return;
! 363: }
! 364:
! 365: (*((real8 *) (*s_objet_resultat).objet)) = (*((real8 *)
! 366: (*s_objet_argument_2).objet)) + (*((real8 *)
! 367: (*s_objet_argument_1).objet));
! 368:
! 369: conversion_decimal_vers_hms((real8 *) (*s_objet_resultat).objet);
! 370: }
! 371:
! 372: /*
! 373: --------------------------------------------------------------------------------
! 374: Argument invalide
! 375: --------------------------------------------------------------------------------
! 376: */
! 377:
! 378: else
! 379: {
! 380: liberation(s_etat_processus, s_objet_argument_1);
! 381: liberation(s_etat_processus, s_objet_argument_2);
! 382:
! 383: (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
! 384: return;
! 385: }
! 386:
! 387: liberation(s_etat_processus, s_objet_argument_1);
! 388: liberation(s_etat_processus, s_objet_argument_2);
! 389:
! 390: if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 391: s_objet_resultat) == d_erreur)
! 392: {
! 393: return;
! 394: }
! 395:
! 396: return;
! 397: }
! 398:
! 399:
! 400: /*
! 401: ================================================================================
! 402: Fonction 'HMS-'
! 403: ================================================================================
! 404: Entrées : structure processus
! 405: --------------------------------------------------------------------------------
! 406: Sorties :
! 407: --------------------------------------------------------------------------------
! 408: Effets de bord : néant
! 409: ================================================================================
! 410: */
! 411:
! 412: void
! 413: instruction_hms_moins(struct_processus *s_etat_processus)
! 414: {
! 415: integer8 tampon;
! 416:
! 417: struct_objet *s_objet_argument_1;
! 418: struct_objet *s_objet_argument_2;
! 419: struct_objet *s_objet_resultat;
! 420:
! 421: (*s_etat_processus).erreur_execution = d_ex;
! 422:
! 423: if ((*s_etat_processus).affichage_arguments == 'Y')
! 424: {
! 425: printf("\n HMS- ");
! 426:
! 427: if ((*s_etat_processus).langue == 'F')
! 428: {
! 429: printf("(soustraction sexadécimale)\n\n");
! 430: }
! 431: else
! 432: {
! 433: printf("(substraction in hours minutes seconds format)\n\n");
! 434: }
! 435:
! 436: printf(" 2: %s\n", d_INT);
! 437: printf(" 1: %s\n", d_INT);
! 438: printf("-> 1: %s, %s\n\n", d_INT, d_REL);
! 439:
! 440: printf(" 2: %s, %s\n", d_INT, d_REL);
! 441: printf(" 1: %s, %s\n", d_INT, d_REL);
! 442: printf("-> 1: %s\n", d_REL);
! 443:
! 444: return;
! 445: }
! 446: else if ((*s_etat_processus).test_instruction == 'Y')
! 447: {
! 448: (*s_etat_processus).nombre_arguments = -1;
! 449: return;
! 450: }
! 451:
! 452: if (test_cfsf(s_etat_processus, 31) == d_vrai)
! 453: {
! 454: if (empilement_pile_last(s_etat_processus, 2) == d_erreur)
! 455: {
! 456: return;
! 457: }
! 458: }
! 459:
! 460: if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 461: &s_objet_argument_1) == d_erreur)
! 462: {
! 463: (*s_etat_processus).erreur_execution = d_ex_manque_argument;
! 464: return;
! 465: }
! 466:
! 467: if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 468: &s_objet_argument_2) == d_erreur)
! 469: {
! 470: liberation(s_etat_processus, s_objet_argument_1);
! 471: (*s_etat_processus).erreur_execution = d_ex_manque_argument;
! 472: return;
! 473: }
! 474:
! 475: /*
! 476: --------------------------------------------------------------------------------
! 477: Arguments entiers
! 478: --------------------------------------------------------------------------------*/
! 479:
! 480: if (((*s_objet_argument_1).type == INT) &&
! 481: ((*s_objet_argument_2).type == INT))
! 482: {
! 483: (*((integer8 *) (*s_objet_argument_1).objet)) =
! 484: -(*((integer8 *) (*s_objet_argument_1).objet));
! 485:
! 486: if (depassement_addition((integer8 *) (*s_objet_argument_1).objet,
! 487: (integer8 *) (*s_objet_argument_2).objet, &tampon) ==
! 488: d_absence_erreur)
! 489: {
! 490: if ((s_objet_resultat = allocation(s_etat_processus, INT))
! 491: == NULL)
! 492: {
! 493: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 494: return;
! 495: }
! 496:
! 497: (*((integer8 *) (*s_objet_resultat).objet)) = tampon;
! 498: }
! 499: else
! 500: {
! 501: if ((s_objet_resultat = allocation(s_etat_processus, REL))
! 502: == NULL)
! 503: {
! 504: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 505: return;
! 506: }
! 507:
! 508: (*((real8 *) (*s_objet_resultat).objet)) = ((real8)
! 509: (*((integer8 *) (*s_objet_argument_1).objet))) + ((real8)
! 510: (*((integer8 *) (*s_objet_argument_2).objet)));
! 511: }
! 512: }
! 513:
! 514: /*
! 515: --------------------------------------------------------------------------------
! 516: Au moins un argument réel
! 517: --------------------------------------------------------------------------------
! 518: */
! 519:
! 520: else if (((*s_objet_argument_1).type == REL) &&
! 521: ((*s_objet_argument_2).type == INT))
! 522: {
! 523: conversion_hms_vers_decimal((real8 *) (*s_objet_argument_1).objet);
! 524:
! 525: if ((s_objet_resultat = allocation(s_etat_processus, REL))
! 526: == NULL)
! 527: {
! 528: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 529: return;
! 530: }
! 531:
! 532: (*((real8 *) (*s_objet_resultat).objet)) = (*((integer8 *)
! 533: (*s_objet_argument_2).objet)) - (*((real8 *)
! 534: (*s_objet_argument_1).objet));
! 535:
! 536: conversion_decimal_vers_hms((real8 *) (*s_objet_resultat).objet);
! 537: }
! 538: else if (((*s_objet_argument_1).type == INT) &&
! 539: ((*s_objet_argument_2).type == REL))
! 540: {
! 541: conversion_hms_vers_decimal((real8 *) (*s_objet_argument_2).objet);
! 542:
! 543: if ((s_objet_resultat = allocation(s_etat_processus, REL))
! 544: == NULL)
! 545: {
! 546: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 547: return;
! 548: }
! 549:
! 550: (*((real8 *) (*s_objet_resultat).objet)) = (*((real8 *)
! 551: (*s_objet_argument_2).objet)) - (*((integer8 *)
! 552: (*s_objet_argument_1).objet));
! 553:
! 554: conversion_decimal_vers_hms((real8 *) (*s_objet_resultat).objet);
! 555: }
! 556: else if (((*s_objet_argument_1).type == REL) &&
! 557: ((*s_objet_argument_2).type == REL))
! 558: {
! 559: conversion_hms_vers_decimal((real8 *) (*s_objet_argument_1).objet);
! 560: conversion_hms_vers_decimal((real8 *) (*s_objet_argument_2).objet);
! 561:
! 562: if ((s_objet_resultat = allocation(s_etat_processus, REL))
! 563: == NULL)
! 564: {
! 565: (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
! 566: return;
! 567: }
! 568:
! 569: (*((real8 *) (*s_objet_resultat).objet)) = (*((real8 *)
! 570: (*s_objet_argument_2).objet)) - (*((real8 *)
! 571: (*s_objet_argument_1).objet));
! 572:
! 573: conversion_decimal_vers_hms((real8 *) (*s_objet_resultat).objet);
! 574: }
! 575:
! 576: /*
! 577: --------------------------------------------------------------------------------
! 578: Argument invalide
! 579: --------------------------------------------------------------------------------
! 580: */
! 581:
! 582: else
! 583: {
! 584: liberation(s_etat_processus, s_objet_argument_1);
! 585: liberation(s_etat_processus, s_objet_argument_2);
! 586:
! 587: (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
! 588: return;
! 589: }
! 590:
! 591: liberation(s_etat_processus, s_objet_argument_1);
! 592: liberation(s_etat_processus, s_objet_argument_2);
! 593:
! 594: if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
! 595: s_objet_resultat) == d_erreur)
! 596: {
! 597: return;
! 598: }
! 599:
! 600: return;
! 601: }
! 602:
! 603:
! 604: /*
! 605: ================================================================================
! 606: Fonction 'halt'
! 607: ================================================================================
! 608: Entrées :
! 609: --------------------------------------------------------------------------------
! 610: Sorties :
! 611: --------------------------------------------------------------------------------
! 612: Effets de bord : néant
! 613: ================================================================================
! 614: */
! 615:
! 616: void
! 617: instruction_halt(struct_processus *s_etat_processus)
! 618: {
! 619: (*s_etat_processus).erreur_execution = d_ex;
! 620:
! 621: if ((*s_etat_processus).affichage_arguments == 'Y')
! 622: {
! 623: printf("\n HALT ");
! 624:
! 625: if ((*s_etat_processus).langue == 'F')
! 626: {
! 627: printf("(arrêt du programme)\n\n");
! 628: printf(" Aucun argument\n");
! 629: }
! 630: else
! 631: {
! 632: printf("(program halt)\n\n");
! 633: printf(" No argument\n");
! 634: }
! 635:
! 636: return;
! 637: }
! 638: else if ((*s_etat_processus).test_instruction == 'Y')
! 639: {
! 640: (*s_etat_processus).nombre_arguments = -1;
! 641: return;
! 642: }
! 643:
! 644: (*s_etat_processus).debug_programme = d_vrai;
! 645:
! 646: return;
! 647: }
! 648:
! 649:
! 650: /*
! 651: ================================================================================
! 652: Fonction 'histogram'
! 653: ================================================================================
! 654: Entrées :
! 655: --------------------------------------------------------------------------------
! 656: Sorties :
! 657: --------------------------------------------------------------------------------
! 658: Effets de bord : néant
! 659: ================================================================================
! 660: */
! 661:
! 662: void
! 663: instruction_histogram(struct_processus *s_etat_processus)
! 664: {
! 665: (*s_etat_processus).erreur_execution = d_ex;
! 666:
! 667: if ((*s_etat_processus).affichage_arguments == 'Y')
! 668: {
! 669: printf("\n HISTOGRAM ");
! 670:
! 671: if ((*s_etat_processus).langue == 'F')
! 672: {
! 673: printf("(graphique statistique de type histogramme)\n\n");
! 674: printf(" Aucun argument\n");
! 675: }
! 676: else
! 677: {
! 678: printf("(histogram statistical graphic)\n\n");
! 679: printf(" No argument\n");
! 680: }
! 681:
! 682: return;
! 683: }
! 684: else if ((*s_etat_processus).test_instruction == 'Y')
! 685: {
! 686: (*s_etat_processus).nombre_arguments = -1;
! 687: return;
! 688: }
! 689:
! 690: strcpy((*s_etat_processus).type_trace_sigma, "HISTOGRAMME");
! 691:
! 692: return;
! 693: }
! 694:
! 695:
! 696: /*
! 697: ================================================================================
! 698: Fonction 'help'
! 699: ================================================================================
! 700: Entrées :
! 701: --------------------------------------------------------------------------------
! 702: Sorties :
! 703: --------------------------------------------------------------------------------
! 704: Effets de bord : néant
! 705: ================================================================================
! 706: */
! 707:
! 708: void
! 709: instruction_help(struct_processus *s_etat_processus)
! 710: {
! 711: unsigned char *fonction;
! 712: unsigned char ligne[80 + 1];
! 713: unsigned char *pointeur;
! 714: unsigned char **ptr;
! 715: unsigned char *registre;
! 716:
! 717: # undef COMPLETION
! 718: # include "completion.conv.h"
! 719: # include "usages.conv.h"
! 720:
! 721: if ((*s_etat_processus).test_instruction == 'Y')
! 722: {
! 723: (*s_etat_processus).nombre_arguments = -1;
! 724: return;
! 725: }
! 726:
! 727: (*s_etat_processus).erreur_execution = d_ex;
! 728:
! 729: printf("\n");
! 730:
! 731: if ((*s_etat_processus).langue == 'F')
! 732: {
! 733: printf("Liste alphabétique des fonctions intrinsèques :\n\n");
! 734: }
! 735: else
! 736: {
! 737: printf("Alphabetical list of intrinsic functions :\n\n");
! 738: }
! 739:
! 740: ptr = commandes;
! 741: *ligne = d_code_fin_chaine;
! 742:
! 743: while(*ptr != (unsigned char *) NULL)
! 744: {
! 745: if (strcmp((*ptr), COMPLETION_RC) == 0)
! 746: {
! 747: printf("%s\n\n", ligne);
! 748: *ligne = d_code_fin_chaine;
! 749: }
! 750: else if ((strlen(ligne) + strlen(*ptr) + 2) > 80)
! 751: {
! 752: printf("%s\n", ligne);
! 753: *ligne = d_code_fin_chaine;
! 754: strcpy(ligne, " ");
! 755: strcat(ligne, *ptr);
! 756:
! 757: if (*(ptr + 1) != NULL)
! 758: {
! 759: strcat(ligne, ", ");
! 760: }
! 761: }
! 762: else
! 763: {
! 764: if (*ligne == d_code_fin_chaine)
! 765: {
! 766: strcat(ligne, " ");
! 767: }
! 768:
! 769: strcat(ligne, *ptr);
! 770:
! 771: if (*(ptr + 1) != NULL)
! 772: {
! 773: strcat(ligne, ", ");
! 774: }
! 775: }
! 776:
! 777: ptr++;
! 778: }
! 779:
! 780: if (strlen(ligne) != 0)
! 781: {
! 782: printf("%s\n", ligne);
! 783: }
! 784:
! 785: printf("\n");
! 786:
! 787: if ((*s_etat_processus).langue == 'F')
! 788: {
! 789: printf("Délimiteurs :\n\n");
! 790: printf(" aucun : scalaire, nombre entier ou réel ;\n");
! 791: printf(" ( ) : nombre complexe ;\n");
! 792: printf(" # : entier binaire ;\n");
! 793: printf(" << >> : fonction utilisateur ou équation en notation "
! 794: "polonaise inversée ;\n");
! 795: printf(" ' ' : équation en notation algébrique ou nom de "
! 796: "variable ;\n");
! 797: printf(" [ ] : vecteur ;\n");
! 798: printf(" [[ ]] : matrice ;\n");
! 799: printf(" <[ ]> : table ;\n");
! 800: printf(" \" \" : chaîne de caractères ;\n");
! 801: printf(" { } : liste ;\n");
! 802: printf(" /* */ : commentaire ;\n");
! 803: printf(" // : commentaire allant jusqu'à la fin de la ligne."
! 804: "\n\n");
! 805: printf("Fonctions classées par usage :\n");
! 806: printf("(les instructions écrites en majuscules sont insensibles à "
! 807: "la casse)\n\n");
! 808: }
! 809: else
! 810: {
! 811: printf("Delimiters :\n\n");
! 812: printf(" none : scalar, integer or real number ;\n");
! 813: printf(" ( ) : complex number ;\n");
! 814: printf(" # : binary integer ;\n");
! 815: printf(" << >> : user-defined function, or equation expressed in "
! 816: "RPN ;\n");
! 817: printf(" ' ' : algebraic equation or variable name ;\n");
! 818: printf(" [ ] : scalar vector ;\n");
! 819: printf(" [[ ]] : scalar matrix ;\n");
! 820: printf(" <[ ]> : table ;\n");
! 821: printf(" \" \" : character string ;\n");
! 822: printf(" { } : list ;\n");
! 823: printf(" /* */ : comment ;\n");
! 824: printf(" // : comment running to the end of the line.\n\n");
! 825: printf("Functions ordre by usage :\n");
! 826: printf("(instructions written in upper case are case-unsensitive)\n\n");
! 827: }
! 828:
! 829: ptr = usages;
! 830: *ligne = d_code_fin_chaine;
! 831:
! 832: while(*ptr != (unsigned char *) NULL)
! 833: {
! 834: if (strcmp((*ptr), USAGES_RC) == 0)
! 835: {
! 836: printf(" %s\n\n", ligne);
! 837: *ligne = d_code_fin_chaine;
! 838: }
! 839: else if (strcmp((*ptr), USAGES_TITRE) == 0)
! 840: {
! 841: ptr++;
! 842:
! 843: if ((*s_etat_processus).langue == 'F')
! 844: {
! 845: ptr++;
! 846: printf(" %s\n", *ptr);
! 847: }
! 848: else
! 849: {
! 850: printf(" %s\n", *ptr);
! 851: ptr++;
! 852: }
! 853: }
! 854: else if ((strlen(ligne) + strlen(*ptr) + 2) > 76)
! 855: {
! 856: printf(" %s\n", ligne);
! 857: *ligne = d_code_fin_chaine;
! 858: strcat(ligne, *ptr);
! 859:
! 860: if (*(ptr + 1) != NULL)
! 861: {
! 862: strcat(ligne, ", ");
! 863: }
! 864: }
! 865: else
! 866: {
! 867: strcat(ligne, *ptr);
! 868:
! 869: if (*(ptr + 1) != NULL)
! 870: {
! 871: strcat(ligne, ", ");
! 872: }
! 873: }
! 874:
! 875: ptr++;
! 876: }
! 877:
! 878: if (strlen(ligne) != 0)
! 879: {
! 880: printf(" %s\n", ligne);
! 881: }
! 882:
! 883: printf("\n");
! 884:
! 885: if ((*s_etat_processus).langue == 'F')
! 886: {
! 887: printf("Processus asynchrones :\n");
! 888: printf(" CTRL+C : interruption de l'instruction en cours ;\n");
! 889: printf(" CTRL+D : en mode interactif, provque un ABORT ;\n");
! 890: printf(" CTRL+Z : en cours d'exécution, provoque un HALT "
! 891: "asynchrone.\n\n");
! 892:
! 893: printf("Drapeaux (valeurs par défaut) :\n");
! 894: printf(" 1 à 30 : drapeaux banalisés (désarmés)\n");
! 895: printf(" 31 : pile LAST active (armé en mode interactif, "
! 896: "désarmé sinon)\n");
! 897: printf(" 32 : impression automatique (désarmé)\n");
! 898: printf(" 33 : retour à la ligne automatique invalidé "
! 899: "(désarmé)\n");
! 900: printf(" 34 : réservé (désarmé)\n");
! 901: printf(" 35 : évaluation symbolique des constantes (armé)\n");
! 902: printf(" 36 : évaluation symbolique des fonctions (armé)\n");
! 903: printf(" 37 à 42 : taille des entiers binaires, bit de poids faible "
! 904: "en tête (armés)\n");
! 905: printf(" 43 à 44 : base de numérotation binaire (désarmés)\n");
! 906: printf(" 45 : affichage multiligne (armé)\n");
! 907: printf(" 46 à 47 : réservés (désarmés)\n");
! 908: printf(" 48 : virgule comme séparateur décimal (désarmé)\n");
! 909: printf(" 49 à 50 : format des nombres (désarmés)\n");
! 910: printf(" 51 : tonalité désactivée (désarmé)\n");
! 911: printf(" 52 : mise à jour automatique des graphiques désactivée "
! 912: "(désarmé)\n");
! 913: printf(" 53 à 56 : nombre de chiffres décimaux, bit de poids fort "
! 914: "en tête (désarmés)\n");
! 915: printf(" 57 à 59 : réservés (désarmés)\n");
! 916: printf(" 60 : radian et non degré comme unité angulaire "
! 917: "(armé)\n");
! 918: printf(" 61 à 64 : réservés (désarmés)\n");
! 919: }
! 920: else
! 921: {
! 922: printf("Hot keys :\n");
! 923: printf(" CTRL+C : interruption ;\n");
! 924: printf(" CTRL+D : ABORT (in interactive mode only) ;\n");
! 925: printf(" CTRL+Z : HALT.\n\n");
! 926:
! 927: printf("Flags (default values) :\n");
! 928: printf(" 1 à 30 : user flags (cleared)\n");
! 929: printf(" 31 : LAST stack enabled (set in interactive mode, "
! 930: "cleared if not)\n");
! 931: printf(" 32 : automatic printing (cleared)\n");
! 932: printf(" 33 : automatic carriage return disabled "
! 933: "(cleared)\n");
! 934: printf(" 34 : reserved (cleared)\n");
! 935: printf(" 35 : constant symbolic evaluation (set)\n");
! 936: printf(" 36 : function symbolic evaluation (set)\n");
! 937: printf(" 37 à 42 : size of binary integers, while starting with "
! 938: "less significant bit (set)\n");
! 939: printf(" 43 à 44 : binary integer basis (cleared)\n");
! 940: printf(" 45 : multiline conversion (set)\n");
! 941: printf(" 46 à 47 : reserved (cleared)\n");
! 942: printf(" 48 : comma as decimal separator (cleared)\n");
! 943: printf(" 49 à 50 : numbers format (cleared)\n");
! 944: printf(" 51 : visual bell disabled (cleared)\n");
! 945: printf(" 52 : graphic automatic redrawing disabled "
! 946: "(cleared)\n");
! 947: printf(" 53 à 56 : precision, while starting with "
! 948: "less significant bit (cleared)\n");
! 949: printf(" 57 à 59 : reserved (cleared)\n");
! 950: printf(" 60 : radian mode instead of degree one (set)\n");
! 951: printf(" 61 à 64 : reserved (cleared)\n");
! 952: }
! 953:
! 954: printf("\n");
! 955:
! 956: if ((*s_etat_processus).langue == 'F')
! 957: {
! 958: printf("Types d'arguments :\n\n");
! 959: printf(" %s : entier (64 bits)\n", d_INT);
! 960: printf(" %s : réel (64 bits)\n", d_REL);
! 961: printf(" %s : complexe (128 bits)\n", d_CPL);
! 962: printf(" %s : vecteur entier\n", d_VIN);
! 963: printf(" %s : vecteur réel\n", d_VRL);
! 964: printf(" %s : vecteur complexe\n", d_VCX);
! 965: printf(" %s : matrice entière\n", d_MIN);
! 966: printf(" %s : matrice réelle\n", d_MRL);
! 967: printf(" %s : matrice complexe\n", d_MCX);
! 968: printf(" %s : table\n", d_TAB);
! 969: printf(" %s : entier binaire\n", d_BIN);
! 970: printf(" %s : nom\n", d_NOM);
! 971: printf(" %s : chaîne de caractères\n", d_CHN);
! 972: printf(" %s : liste\n", d_LST);
! 973: printf(" %s : expression algébrique\n", d_ALG);
! 974: printf(" %s : expression RPN\n", d_RPN);
! 975: printf(" %s : descripteur de fichier\n", d_FCH);
! 976: printf(" %s : socket\n", d_SCK);
! 977: printf(" %s : descripteur de bibliothèque\n", d_SLB);
! 978: printf(" %s : processus\n", d_PRC);
! 979: printf(" %s : connexion à une base de données SQL\n", d_SQL);
! 980: printf(" %s : mutex\n", d_MTX);
! 981: printf(" %s : sémaphore nommé\n", d_SPH);
! 982: }
! 983: else
! 984: {
! 985: printf("Types :\n\n");
! 986: printf(" %s : integer (64 bits)\n", d_INT);
! 987: printf(" %s : real (64 bits)\n", d_REL);
! 988: printf(" %s : complex (128 bits)\n", d_CPL);
! 989: printf(" %s : integer vector\n", d_VIN);
! 990: printf(" %s : real vector\n", d_VRL);
! 991: printf(" %s : complex vector\n", d_VCX);
! 992: printf(" %s : integer matrix\n", d_MIN);
! 993: printf(" %s : real matrix\n", d_MRL);
! 994: printf(" %s : complex matrix\n", d_MCX);
! 995: printf(" %s : table\n", d_TAB);
! 996: printf(" %s : binary integer\n", d_BIN);
! 997: printf(" %s : name\n", d_NOM);
! 998: printf(" %s : string of chars\n", d_CHN);
! 999: printf(" %s : list\n", d_LST);
! 1000: printf(" %s : algebraic expression\n", d_ALG);
! 1001: printf(" %s : RPN expression\n", d_RPN);
! 1002: printf(" %s : file descriptor\n", d_FCH);
! 1003: printf(" %s : socket\n", d_SCK);
! 1004: printf(" %s : library descriptor\n", d_SLB);
! 1005: printf(" %s : process\n", d_PRC);
! 1006: printf(" %s : connection to SQL database\n", d_SQL);
! 1007: printf(" %s : mutex\n", d_MTX);
! 1008: printf(" %s : named semaphore\n", d_SPH);
! 1009: }
! 1010:
! 1011: /*
! 1012: * HELP ne doit pas être récursif sous peine de boucler indéfiniment
! 1013: * dans la fonction.
! 1014: */
! 1015:
! 1016: if ((*s_etat_processus).affichage_arguments == 'Y')
! 1017: {
! 1018: return;
! 1019: }
! 1020:
! 1021: printf("\n");
! 1022:
! 1023: registre = (*s_etat_processus).instruction_courante;
! 1024:
! 1025: flockfile(stdin);
! 1026: flockfile(stdout);
! 1027:
! 1028: while((fonction = readline("HELP> ")) != NULL)
! 1029: {
! 1030: funlockfile(stdin);
! 1031: funlockfile(stdout);
! 1032:
! 1033: if (strcmp(fonction, "") == 0)
! 1034: {
! 1035: break;
! 1036: }
! 1037:
! 1038: /*
! 1039: * Élimination des blancs précédents l'instruction
! 1040: */
! 1041:
! 1042: pointeur = fonction;
! 1043:
! 1044: while(((*pointeur) == d_code_tabulation) ||
! 1045: ((*pointeur) == d_code_espace))
! 1046: {
! 1047: pointeur++;
! 1048: }
! 1049:
! 1050: (*s_etat_processus).instruction_courante = pointeur;
! 1051:
! 1052: /*
! 1053: * Élimination des blancs et caractères suivant la première
! 1054: * instruction.
! 1055: */
! 1056:
! 1057: while(((*pointeur) != d_code_tabulation) &&
! 1058: ((*pointeur) != d_code_espace) &&
! 1059: ((*pointeur) != d_code_fin_chaine))
! 1060: {
! 1061: pointeur++;
! 1062: }
! 1063:
! 1064: (*pointeur) = d_code_fin_chaine;
! 1065:
! 1066: add_history(pointeur);
! 1067: stifle_history(ds_longueur_historique);
! 1068:
! 1069: (*s_etat_processus).test_instruction = 'Y';
! 1070: analyse(s_etat_processus, NULL);
! 1071: (*s_etat_processus).test_instruction = 'N';
! 1072:
! 1073: if ((*s_etat_processus).instruction_valide == 'Y')
! 1074: {
! 1075: (*s_etat_processus).affichage_arguments = 'Y';
! 1076: analyse(s_etat_processus, NULL);
! 1077: (*s_etat_processus).affichage_arguments = 'N';
! 1078:
! 1079: printf("\n");
! 1080: }
! 1081: else
! 1082: {
! 1083: if ((*s_etat_processus).langue == 'F')
! 1084: {
! 1085: printf("Fonction inconnue.\n");
! 1086: }
! 1087: else
! 1088: {
! 1089: printf("Unknown function\n");
! 1090: }
! 1091: }
! 1092:
! 1093: free(fonction);
! 1094: flockfile(stdin);
! 1095: flockfile(stdout);
! 1096: }
! 1097:
! 1098: funlockfile(stdin);
! 1099: funlockfile(stdout);
! 1100:
! 1101: if (fonction == NULL)
! 1102: {
! 1103: printf("\n");
! 1104: }
! 1105:
! 1106: (*s_etat_processus).instruction_courante = registre;
! 1107:
! 1108: /*
! 1109: * Évite l'empilement de 'HELP()' dans la pile opérationnelle dans le
! 1110: * cas où la dernière commande entrée à l'invite "HELP> " n'existe pas.
! 1111: */
! 1112:
! 1113: (*s_etat_processus).instruction_valide = 'Y';
! 1114:
! 1115: return;
! 1116: }
! 1117:
! 1118: // vim: ts=4
CVSweb interface <joel.bertrand@systella.fr>