3 Watch and Influence the Communication 3.1 Functions 3.1-1 homalgIOMode homalgIOMode( str[, str2[, str3]] )  function This function sets different modes which influence how much of the communication becomes visible. Handling the string str is not case-sensitive. homalgIOMode invokes the global function homalgMode defined in the homalg package with an appropriate argument (see code below). Alternatively, if a second or more strings are given, then homalgMode is invoked with the remaining strings str2, str3, ... at the end. In particular, you can use homalgIOMode( str, "" ) to reset the effect of invoking homalgMode. str │ str (long form) │ mode description ────┼─────────────────┼─────────────────────────────────────────────────────────────────── │ │ "" │ "" │ the default mode, i.e. the communication protocol won't be visible │ │ (homalgIOMode( ) is a short form for homalgIOMode( "" )) │ │ "a" │ "all" │ combine the modes "debug" and "file" │ │ "b" │ "basic" │ the same as "picto" + homalgMode( "basic" ) │ │ "d" │ "debug" │ view the complete communication protocol │ │ "f" │ "file" │ dump the communication protocol into a file with the name │ │ Concatenation( "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. Caution:  In case you choose one of the modes "file" or "all" you might want to set the global variable HOMALG_IO.DoNotDeleteTemporaryFiles := true; this is only important if during the computations some matrices get converted via files (using ConvertHomalgMatrixViaFile), 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).  Code  InstallGlobalFunction( homalgIOMode,  function( arg )  local nargs, mode, s;    nargs := Length( arg );    if nargs = 0 or ( IsString( arg[1] ) and arg[1] = "" ) then  mode := "default";  elif IsString( arg[1] ) then ## now we know, the string is not empty  s := arg[1];  if LowercaseString( s{[1]} ) = "a" then  mode := "all";  elif LowercaseString( s{[1]} ) = "b" then  mode := "basic";  elif LowercaseString( s{[1]} ) = "d" then  mode := "debug";  elif LowercaseString( s{[1]} ) = "f" then  mode := "file";  elif LowercaseString( s{[1]} ) = "p" then  mode := "picto";  else  mode := "";  fi;  else  Error( "the first argument must be a string\n" );  fi;    if mode = "default" then  ## reset to the default values  HOMALG_IO.color_display := false;  HOMALG_IO.show_banners := true;  HOMALG_IO.save_CAS_commands_to_file := false;  HOMALG_IO.DoNotDeleteTemporaryFiles := false;  HOMALG_IO.SaveHomalgMaximumBackStream := false;  HOMALG_IO.InformAboutCASystemsWithoutActiveRings := true;  SetInfoLevel( InfoHomalgToCAS, 1 );  homalgMode( );  elif mode = "all" then  homalgIOMode( "debug" );  homalgIOMode( "file" );  elif mode = "basic" then  HOMALG_IO.color_display := true;  HOMALG_IO.show_banners := true;  SetInfoLevel( InfoHomalgToCAS, 4 );  homalgMode( "basic" ); ## use homalgIOMode( "basic", "" ) to reset  elif mode = "debug" then  HOMALG_IO.color_display := true;  HOMALG_IO.show_banners := true;  SetInfoLevel( InfoHomalgToCAS, 8 );  homalgMode( "debug" ); ## use homalgIOMode( "debug", "" ) to reset  elif mode = "file" then  HOMALG_IO.save_CAS_commands_to_file := true;  elif mode = "picto" then  HOMALG_IO.color_display := true;  HOMALG_IO.show_banners := true;  SetInfoLevel( InfoHomalgToCAS, 4 );  homalgMode( "logic" ); ## use homalgIOMode( "picto", "" ) to reset  fi;    if nargs > 1 and IsString( arg[2] ) then  CallFuncList( homalgMode, arg{[ 2 .. nargs ]} );  fi;   end );  This is the part of the global function homalgSendBlocking that controls the visibility of the communication.  Code  io_info_level := InfoLevel( InfoHomalgToCAS );  if not IsBound( pictogram ) then  pictogram := HOMALG_IO.Pictograms.unknown;  picto := pictogram; elif io_info_level >= 3 then  picto := pictogram;  ## add colors to the pictograms  if pictogram = HOMALG_IO.Pictograms.ReducedEchelonForm and  IsBound( HOMALG_MATRICES.color_BOE ) then  pictogram := Concatenation( HOMALG_MATRICES.color_BOE, pictogram, "\033[0m" );  elif pictogram = HOMALG_IO.Pictograms.BasisOfModule and  IsBound( HOMALG_MATRICES.color_BOB ) then  pictogram := Concatenation( HOMALG_MATRICES.color_BOB, pictogram, "\033[0m" );  elif pictogram = HOMALG_IO.Pictograms.DecideZero and  IsBound( HOMALG_MATRICES.color_BOD ) then  pictogram := Concatenation( HOMALG_MATRICES.color_BOD, pictogram, "\033[0m" );  elif pictogram = HOMALG_IO.Pictograms.SyzygiesGenerators and  IsBound( HOMALG_MATRICES.color_BOH ) then  pictogram := Concatenation( HOMALG_MATRICES.color_BOH, pictogram, "\033[0m" );  elif pictogram = HOMALG_IO.Pictograms.BasisCoeff and  IsBound( HOMALG_MATRICES.color_BOC ) then  pictogram := Concatenation( HOMALG_MATRICES.color_BOC, pictogram, "\033[0m" );  elif pictogram = HOMALG_IO.Pictograms.DecideZeroEffectively and  IsBound( HOMALG_MATRICES.color_BOP ) then  pictogram := Concatenation( HOMALG_MATRICES.color_BOP, pictogram, "\033[0m" );  elif need_output or need_display then  pictogram := Concatenation( HOMALG_IO.Pictograms.color_need_output,  pictogram, "\033[0m" );  else  pictogram := Concatenation( HOMALG_IO.Pictograms.color_need_command,  pictogram, "\033[0m" );  fi; else  picto := pictogram; fi;  if io_info_level >= 3 then  if ( io_info_level >= 7 and not need_display ) or io_info_level >= 8 then  ## print the pictogram, the prompt of the external system,  ## and the sent command  Info( InfoHomalgToCAS, 7, pictogram, " ", stream.prompt,  L{[ 1 .. Length( L ) - 1 ]} );  elif io_info_level >= 4 then  ## print the pictogram and the prompt of the external system  Info( InfoHomalgToCAS, 4, pictogram, " ", stream.prompt, "..." );  else  ## print the pictogram only  Info( InfoHomalgToCAS, 3, pictogram );  fi;   fi;  3.2 The Pictograms 3.2-1 HOMALG_IO.Pictograms HOMALG_IO.Pictograms global variable The record of pictograms is a component of the record HOMALG_IO.  Code  Pictograms := rec(    ##  ## colors:  ##    ## pictogram color of a "need_command" or assignment operation:  color_need_command := "\033[1;33;44m",    ## pictogram color of a "need_output" or "need_display" operation:  color_need_output := "\033[1;34;43m",    ##  ## good morning computer algebra system:  ##    ## initialize:  initialize := "ini",    ## define macros:  define := "def",    ## get time:  time := ":ms",    ## memory usage:  memory := "mem",    ## unknown:  unknown := "???",    ##  ## external garbage collection:  ##    ## delete a variable:  delete := "xxx",    ## delete serveral variables:  multiple_delete := "XXX",    ## trigger the garbage collector:  garbage_collector := "grb",    ##  ## create lists:  ##    ## define a list:  CreateList := "lst",    ##  ## create rings:  ##    ## define a ring:  CreateHomalgRing := "R:=",    ## get the names of the "variables" defining the ring:  variables := "var",    ## define zero:  Zero := "0:=",    ## define one:  One := "1:=",    ## define minus one:  MinusOne := "-:=",    ##  ## mandatory ring operations:  ##    ## get the name of an element:  ## (important if the CAS pretty-prints ring elements,  ## we need names that can be used as input!)  ## (install a method instead of a homalgTable entry)  homalgSetName := "\"a\"",    ## a = 0 ?  IsZero := "a=0",    ## a = 1 ?  IsOne := "a=1",    ## substract two ring elements  ## (needed by SimplerEquivalentMatrix in case  ## CopyRow/ColumnToIdentityMatrix are not defined):  Minus := "a-b",    ## divide the element a by the unit u  ## (needed by SimplerEquivalentMatrix in case  ## DivideEntryByUnit is not defined):  DivideByUnit := "a/u",    ## important ring operations:  ## (important for performance since existing  ## fallback methods cause a lot of traffic):    ## is u a unit?  ## (mainly needed by the fallback methods for matrices, see below):  IsUnit := "?/u",    ##  ## optional ring operations:  ##    ## copy an element:  CopyElement := "a>a",    ## add two ring elements:  Sum := "a+b",    ## multiply two ring elements:  Product := "a*b",    ## the (greatest) common divisor:  Gcd := "gcd",    ## cancel the (greatest) common divisor:  CancelGcd := "ccd",    ## random polynomial:  RandomPol := "rpl",    ## numerator:  Numerator := "num",    ## denominator:  Denominator := "den",    ## evaluate polynomial:  Evaluate := "evl",    ## degree of a multivariate polynomial  DegreeOfRingElement := "deg",    ## is irreducible:  IsIrreducible := "irr",    ##  ## create matrices:  ##    ## define a matrix:  HomalgMatrix := "A:=",    ## copy a matrix:  CopyMatrix := "A>A",    ## load a matrix from file:  LoadHomalgMatrixFromFile := "A<<",    ## save a matrix to file:  SaveHomalgMatrixToFile := "A>>",    ## get a matrix entry as a string:  MatElm := " row+col Gauss, PIR -> Smith, Dedekind domain -> Krull, etc ...):  BestBasis := "(\\)",    ## compute elementary divisors:  ElementaryDivisors := "div",    ##  ## for the eye:  ##    ## display objects:  Display := "dsp",    ## the LaTeX code of the mathematical entity:  homalgLaTeX := "TeX",   )