File:  [local] / rpl / src / instructions_y1.c
Revision 1.65: download - view: text, annotated - select for diffs - revision graph
Fri Jan 10 11:15:49 2020 UTC (4 years, 3 months ago) by bertrand
Branches: MAIN
CVS tags: rpl-4_1_32, HEAD
Modification du copyright.

    1: /*
    2: ================================================================================
    3:   RPL/2 (R) version 4.1.32
    4:   Copyright (C) 1989-2020 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 'ycol'
   29: ================================================================================
   30:   Entrées : pointeur sur une structure struct_processus
   31: --------------------------------------------------------------------------------
   32:   Sorties :
   33: --------------------------------------------------------------------------------
   34:   Effets de bord : néant
   35: ================================================================================
   36: */
   37: 
   38: void
   39: instruction_ycol(struct_processus *s_etat_processus)
   40: {
   41:     struct_objet            *s_objet_argument;
   42: 
   43:     (*s_etat_processus).erreur_execution = d_ex;
   44: 
   45:     if ((*s_etat_processus).affichage_arguments == 'Y')
   46:     {
   47:         printf("\n  YCOL ");
   48: 
   49:         if ((*s_etat_processus).langue == 'F')
   50:         {
   51:             printf("(définition de la colonne statistique Y)\n\n");
   52:         }
   53:         else
   54:         {
   55:             printf("(definition of statistical Y column)\n\n");
   56:         }
   57: 
   58:         printf("    1: %s\n", d_INT);
   59: 
   60:         return;
   61:     }
   62:     else if ((*s_etat_processus).test_instruction == 'Y')
   63:     {
   64:         (*s_etat_processus).nombre_arguments = -1;
   65:         return;
   66:     }
   67: 
   68:     if (test_cfsf(s_etat_processus, 31) == d_vrai)
   69:     {
   70:         if (empilement_pile_last(s_etat_processus, 1) == d_erreur)
   71:         {
   72:             return;
   73:         }
   74:     }
   75: 
   76:     if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
   77:             &s_objet_argument) == d_erreur)
   78:     {
   79:         (*s_etat_processus).erreur_execution = d_ex_manque_argument;
   80:         return;
   81:     }
   82: 
   83:     if ((*s_objet_argument).type == INT)
   84:     {
   85:         if ((*((integer8 *) (*s_objet_argument).objet)) <= 0)
   86:         {
   87:             liberation(s_etat_processus, s_objet_argument);
   88: 
   89:             (*s_etat_processus).erreur_execution = d_ex_argument_invalide;
   90:             return;
   91:         }
   92: 
   93:         (*s_etat_processus).colonne_statistique_2 =
   94:                 (*((integer8 *) (*s_objet_argument).objet));
   95:     }
   96:     else
   97:     {
   98:         liberation(s_etat_processus, s_objet_argument);
   99: 
  100:         (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
  101:         return;
  102:     }
  103: 
  104:     liberation(s_etat_processus, s_objet_argument);
  105: 
  106:     return;
  107: }
  108: 
  109: 
  110: /*
  111: ================================================================================
  112:   Fonction 'yield'
  113: ================================================================================
  114:   Entrées : pointeur sur une structure struct_processus
  115: --------------------------------------------------------------------------------
  116:   Sorties :
  117: --------------------------------------------------------------------------------
  118:   Effets de bord : néant
  119: ================================================================================
  120: */
  121: 
  122: void
  123: instruction_yield(struct_processus *s_etat_processus)
  124: {
  125:     (*s_etat_processus).erreur_execution = d_ex;
  126: 
  127:     if ((*s_etat_processus).affichage_arguments == 'Y')
  128:     {
  129:         printf("\n  YIELD ");
  130: 
  131:         if ((*s_etat_processus).langue == 'F')
  132:         {
  133:             printf("(libération du processeur)\n\n");
  134:             printf("  Aucun argument\n");
  135:         }
  136:         else
  137:         {
  138:             printf("(yield the processor)\n\n");
  139:             printf("  No argument\n");
  140:         }
  141: 
  142:         return;
  143:     }
  144:     else if ((*s_etat_processus).test_instruction == 'Y')
  145:     {
  146:         (*s_etat_processus).nombre_arguments = -1;
  147:         return;
  148:     }
  149: 
  150:     if ((*s_etat_processus).profilage == d_vrai)
  151:     {
  152:         profilage(s_etat_processus, "YIELD");
  153:     }
  154: 
  155:     if (test_cfsf(s_etat_processus, 31) == d_vrai)
  156:     {
  157:         if (empilement_pile_last(s_etat_processus, 0) == d_erreur)
  158:         {
  159:             return;
  160:         }
  161:     }
  162: 
  163:     sched_yield();
  164: 
  165:     if ((*s_etat_processus).profilage == d_vrai)
  166:     {
  167:         profilage(s_etat_processus, NULL);
  168:     }
  169: 
  170:     return;
  171: }
  172: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>