  
  [1X3 Watch and Influence the Communication[0X
  
  
  [1X3.1 Functions[0X
  
  [1X3.1-1 homalgIOMode[0m
  
  [2X> homalgIOMode( [0X[3Xstr[, str2[, str3]][0X[2X ) ______________________________[0Xfunction
  
  This  function  sets  different  modes  which  influence  how  much  of  the
  communication   becomes   visible.   Handling   the   string   [3Xstr[0m   is  [13Xnot[0m
  case-sensitive.  [10XhomalgIOMode[0m invokes the global function [10XhomalgMode[0m defined
  in  the  [5Xhomalg[0m  package  with  an  "appropriate" argument (see code below).
  Alternatively,  if  a  second  or more strings are given, then [10XhomalgMode[0m is
  invoked  with  the  remaining  strings  [3Xstr2[0m,  [3Xstr3[0m,  ...  at  the  end.  In
  particular,  you  can  use  [10XhomalgIOMode[0m(  [3Xstr[0m,  "" ) to reset the effect of
  invoking [10XhomalgMode[0m.
  
        [3Xstr[0m | [3Xstr[0m (long form) | mode description                                                  
      -------------------------------------------------------------------------------------------
            |                 |                                                                   
        ""  |       ""        | the default mode, i.e. the communication protocol won't be visible
            |                 | ([10XhomalgIOMode[0m( ) is a short form for [10XhomalgIOMode[0m( "" ))          
            |                 |                                                                   
        "a" |      "all"      | combine the modes "debug" and "file"                              
            |                 |                                                                   
        "b" |     "basic"     | the same as "picto" + [10XhomalgMode[0m( "basic" )                       
            |                 |                                                                   
        "d" |     "debug"     | view the complete communication protocol                          
            |                 |                                                                   
        "f" |     "file"      | dump the communication protocol into a file with the name         
            |                 | [10XConcatenation[0m( "commands_file_of_", CAS, "_with_PID_", PID )      
            |                 |                                                                   
        "p" |     "picto"     | view the abbreviated communication protocol                       
            |                 | using the preassigned pictograms                                  
            |                 |                                                                   
      -------------------------------------------------------------------------------------------
  
  All  modes  other than the "default"-mode only set their specific values and
  leave  the  other  values  untouched,  which  allows  combining them to some
  extent.  This  also  means  that in order to get from one mode to a new mode
  (without  the  aim to combine them) one needs to reset to the "default"-mode
  first.
  [13XCaution[0m:
  
  --    In  case you choose one of the modes "file" or "all" you might want to
        set  the  global variable [10XHOMALG_IO.DoNotDeleteTemporaryFiles[0m := [10Xtrue[0m;
        this  is  only  important if during the computations some matrices get
        converted  via  files  (using  [10XConvertHomalgMatrixViaFile[0m), as reading
        these files will be part of the protocol!
  
  --    It   makes   sense   for  the  dumped  communication  protocol  to  be
        (re)executed  with  the  respective  external system, only in case the
        latter is deterministic (i.e. same-input-same-output).
  
  [4X-----------------------------  Code  -----------------------------[0X
    [4XInstallGlobalFunction( homalgIOMode,[0X
    [4X  function( arg )[0X
    [4X    local nargs, mode, s;[0X
    [4X    [0X
    [4X    nargs := Length( arg );[0X
    [4X    [0X
    [4X    if nargs = 0 or ( IsString( arg[1] ) and arg[1] = "" ) then[0X
    [4X        mode := "default";[0X
    [4X    elif IsString( arg[1] ) then	## now we know, the string is not empty[0X
    [4X        s := arg[1];[0X
    [4X        if LowercaseString( s{[1]} ) = "a" then[0X
    [4X            mode := "all";[0X
    [4X        elif LowercaseString( s{[1]} ) = "b" then[0X
    [4X            mode := "basic";[0X
    [4X        elif LowercaseString( s{[1]} ) = "d" then[0X
    [4X            mode := "debug";[0X
    [4X        elif LowercaseString( s{[1]} ) = "f" then[0X
    [4X            mode := "file";[0X
    [4X        elif LowercaseString( s{[1]} ) = "p" then[0X
    [4X            mode := "picto";[0X
    [4X        else[0X
    [4X            mode := "";[0X
    [4X        fi;[0X
    [4X    else[0X
    [4X        Error( "the first argument must be a string\n" );[0X
    [4X    fi;[0X
    [4X    [0X
    [4X    if mode = "default" then[0X
    [4X        ## reset to the default values[0X
    [4X        HOMALG_IO.color_display := false;[0X
    [4X        HOMALG_IO.show_banners := true;[0X
    [4X        HOMALG_IO.save_CAS_commands_to_file := false;[0X
    [4X        HOMALG_IO.DoNotDeleteTemporaryFiles := false;[0X
    [4X        HOMALG_IO.SaveHomalgMaximumBackStream := false;[0X
    [4X        HOMALG_IO.InformAboutCASystemsWithoutActiveRings := true;[0X
    [4X        SetInfoLevel( InfoHomalgToCAS, 1 );[0X
    [4X	homalgMode( );[0X
    [4X    elif mode = "all" then[0X
    [4X        homalgIOMode( "debug" );[0X
    [4X        homalgIOMode( "file" );[0X
    [4X    elif mode = "basic" then[0X
    [4X        HOMALG_IO.color_display := true;[0X
    [4X        HOMALG_IO.show_banners := true;[0X
    [4X        SetInfoLevel( InfoHomalgToCAS, 4 );[0X
    [4X        homalgMode( "basic" );	## use homalgIOMode( "basic", "" ) to reset[0X
    [4X    elif mode = "debug" then[0X
    [4X        HOMALG_IO.color_display := true;[0X
    [4X        HOMALG_IO.show_banners := true;[0X
    [4X        SetInfoLevel( InfoHomalgToCAS, 8 );[0X
    [4X        homalgMode( "debug" );	## use homalgIOMode( "debug", "" ) to reset[0X
    [4X    elif mode = "file" then[0X
    [4X        HOMALG_IO.save_CAS_commands_to_file := true;[0X
    [4X    elif mode = "picto" then[0X
    [4X        HOMALG_IO.color_display := true;[0X
    [4X        HOMALG_IO.show_banners := true;[0X
    [4X        SetInfoLevel( InfoHomalgToCAS, 4 );[0X
    [4X	homalgMode( "logic" );	## use homalgIOMode( "picto", "" ) to reset[0X
    [4X    fi;[0X
    [4X    [0X
    [4X    if nargs > 1 and IsString( arg[2] ) then[0X
    [4X        CallFuncList( homalgMode, arg{[ 2 .. nargs ]} );[0X
    [4X    fi;[0X
    [4X    [0X
    [4Xend );[0X
  [4X------------------------------------------------------------------[0X
  
  This is the part of the global function [10XhomalgSendBlocking[0m that controls the
  visibility of the communication.
  
  [4X-----------------------------  Code  -----------------------------[0X
    [4Xio_info_level := InfoLevel( InfoHomalgToCAS );[0X
    [4X[0X
    [4Xif not IsBound( pictogram ) then[0X
    [4X    pictogram := "   ";[0X
    [4Xelif io_info_level >= 3 then[0X
    [4X    ## add colors to the pictograms[0X
    [4X    if pictogram = HOMALG_IO.Pictograms.ReducedEchelonForm and[0X
    [4X       IsBound( HOMALG.color_BOE ) then[0X
    [4X        pictogram := Concatenation( HOMALG.color_BOE, pictogram, "\033[0m" );[0X
    [4X    elif pictogram = HOMALG_IO.Pictograms.BasisOfModule and[0X
    [4X      IsBound( HOMALG.color_BOB ) then[0X
    [4X        pictogram := Concatenation( HOMALG.color_BOB, pictogram, "\033[0m" );[0X
    [4X    elif pictogram = HOMALG_IO.Pictograms.DecideZero and[0X
    [4X      IsBound( HOMALG.color_BOD ) then[0X
    [4X        pictogram := Concatenation( HOMALG.color_BOD, pictogram, "\033[0m" );[0X
    [4X    elif pictogram = HOMALG_IO.Pictograms.SyzygiesGenerators and[0X
    [4X      IsBound( HOMALG.color_BOH ) then[0X
    [4X        pictogram := Concatenation( HOMALG.color_BOH, pictogram, "\033[0m" );[0X
    [4X    elif pictogram = HOMALG_IO.Pictograms.BasisCoeff and[0X
    [4X      IsBound( HOMALG.color_BOC ) then[0X
    [4X        pictogram := Concatenation( HOMALG.color_BOC, pictogram, "\033[0m" );[0X
    [4X    elif pictogram = HOMALG_IO.Pictograms.DecideZeroEffectively and[0X
    [4X      IsBound( HOMALG.color_BOP ) then[0X
    [4X        pictogram := Concatenation( HOMALG.color_BOP, pictogram, "\033[0m" );[0X
    [4X    elif need_output or need_display then[0X
    [4X        pictogram := Concatenation( HOMALG_IO.Pictograms.color_need_output,[0X
    [4X                             pictogram, "\033[0m" );[0X
    [4X    else[0X
    [4X        pictogram := Concatenation( HOMALG_IO.Pictograms.color_need_command,[0X
    [4X                             pictogram, "\033[0m" );[0X
    [4X    fi;[0X
    [4Xfi;[0X
    [4X[0X
    [4Xif io_info_level >= 3 then[0X
    [4X    if ( io_info_level >= 7 and not need_display ) or io_info_level >= 8 then[0X
    [4X        ## print the pictogram, the prompt of the external system,[0X
    [4X        ## and the sent command[0X
    [4X        Info( InfoHomalgToCAS, 7, pictogram, " ", stream.prompt,[0X
    [4X              L{[ 1 .. Length( L ) - 1 ]} );[0X
    [4X    elif io_info_level >= 4 then[0X
    [4X        ## print the pictogram and the prompt of the external system[0X
    [4X        Info( InfoHomalgToCAS, 4, pictogram, " ", stream.prompt, "..." );[0X
    [4X    else[0X
    [4X        ## print the pictogram only[0X
    [4X        Info( InfoHomalgToCAS, 3, pictogram );[0X
    [4X    fi;[0X
    [4Xfi;[0X
  [4X------------------------------------------------------------------[0X
  
