This file is indexed.

/usr/share/gap/pkg/tomlib/gap/tmadmin.tmi is in gap-table-of-marks 1r2p5-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
#############################################################################
##
#W  tmadmin.tmi         GAP table of marks library           Thomas Merkwitz
##
#H  @(#)$Id: tmadmin.tmi,v 1.10 2008/01/08 10:48:38 gap Exp $
##
#Y  Copyright (C)  1997,  Lehrstuhl D fuer Mathematik,  RWTH Aachen,  Germany
##
##  This file contains the implementation part of all functions to
##  handle the table of marks library
##
Revision.( "tomlib/gap/tmadmin_tmi" ) :=
    "@(#)$Id: tmadmin.tmi,v 1.10 2008/01/08 10:48:38 gap Exp $";


#############################################################################
##
#F  ReadTom( <name> ) . . . . . . . . . . . . . . . . . tables of marks files
##
##  This function is used to read data files of the tables of marks library.
##
BindGlobal( "ReadTom",
    name -> ReadPackage( "tomlib", Concatenation( "data/", name ) ) );


#############################################################################
##
#V  LIBTOMLIST
##
##  <Ref Var="LIBTOMLIST"/> provides all necessary information about the
##  library of table of marks.
##  It is a record with the following components.
##  <P/>
##  <List>
##  <Mark><C>files</C></Mark>
##  <Item>
##     list of data filenames, relative to the directory
##     <F>pkg/tomlib/data</F> and without the suffix <C>.tom</C>,
##  </Item>
##  <Mark><C>namelist</C></Mark>
##  <Item>
##     list whose <M>i</M>-th entry corresponds to the <M>i</M>-th entry
##     of the <C>files</C> component and is itself a list of identifier
##     information about the tables of marks stored in this file;
##     for each table of marks, the list of admissible identifiers is stored,
##     with first entry the identifier that is used in the data file;
##     note that some tables may be not actually installed, see the component
##     <C>noninstalled</C> below,
##  </Item>
##  <Mark><C>names</C></Mark>
##  <Item>
##     list of admissible identifiers of tables of marks that are stored
##     in files that are actually available,
##  </Item>
##  <Mark><C>noninstalled</C></Mark>
##  <Item>
##     list of admissible identifiers of tables of marks that are stored
##     in files that are not available,
##  </Item>
##  <Mark><C>positions</C></Mark>
##  <Item>
##     list of pairs, the value <M>[ i, j ]</M> at position <M>k</M> means
##     that the table of marks with admissible identifier the <M>k</M>-th
##     entry of the <C>names</C> component is the <M>j</M>-th table in the
##     <M>i</M>-th data file,
##  </Item>
##  <Mark><C>fusions</C></Mark>
##  <Item>
##     list whose <M>i</M>-th entry corresponds to the <M>i</M>-th entry
##     of the <C>files</C> component and is itself a list of fusion
##     information about the tables of marks stored in this file;
##     for each table of marks,
##     the list of pairs <C>[ <A>id</A>, <A>nr</A> ]</C> is stored,
##     where <A>id</A> is the identifiers of a table of marks of a subgroup
##     such that the fusion into the current table of marks is known
##     (in the sense of a calls of <Ref Func="ALFT"/>),
##     and <A>nr</A> is the number of the class of these subgroups in the
##     current table of marks.
##  </Item>
##  <List>
##  <P/>
##  The record is stored in the file <F>data/tmprimar.tom</F>.
##  The function <C>MakeLIBTOMLIST</C> creates its final version at runtime.
##
DeclareAutoreadableVariables( "tomlib", "data/tmprimar.tom",
    [ "LIBTOMLIST" ] );


#############################################################################
##
#F  IsNameOfNoninstalledTableOfMarks( <string> )
##
BindGlobal( "IsNameOfNoninstalledTableOfMarks", function( string )
    if LowercaseString( string ) in LIBTOMLIST.noninstalled then
      Info( InfoTom, 1,
            "The table of marks for ", string , " is not installed",
            " on your system!" );
      return true;
    fi;
    return false;
    end );


#############################################################################
##
#F  MakeLIBTOMLIST
##
##  adds additional components to LIBTOMLIST to make things easier.
##
InstallGlobalFunction( MakeLIBTOMLIST, function()
    local name, i, j, dir, nonexisting;

    # Check which files exist and are readable.
    dir:= DirectoriesPackageLibrary( "tomlib", "data" );
    nonexisting:= [];
    for i in [ 1 .. Length( LIBTOMLIST.files ) ] do
      name:= Filename( dir, Concatenation( LIBTOMLIST.files[i], ".tom" ) );
      if name = fail or IsReadableFile( name ) <> true then
        Add( nonexisting, i );
      fi;
    od;

    LIBTOMLIST.names:=[];
    if not IsBound(LIBTOMLIST.noninstalled) then
        LIBTOMLIST.noninstalled := [];
    fi;
    LIBTOMLIST.positions:=[];

    for i in [1..Length(LIBTOMLIST.namelist)] do
        for j in [1..Length(LIBTOMLIST.namelist[i])] do
            for name in LIBTOMLIST.namelist[i][j] do
                if i in nonexisting then
                    Add( LIBTOMLIST.noninstalled , name );
#T Better turn names to lower case here,
#T instead of expecting that the lower case version is in the list!
                else
                    Add(LIBTOMLIST.positions,[i,j]);
                    Add(LIBTOMLIST.names,name);
                fi;
            od;
        od;
    od;

    LIBTOMLIST.namelist{ nonexisting } := List( nonexisting, x -> [] );
    LIBTOMLIST.fusions{ nonexisting }  := List( nonexisting, x -> [] );
end );


#############################################################################
##
#F  TableOfMarksFromLibrary( <string> )
##
InstallGlobalFunction( TableOfMarksFromLibrary, function( string )
    local pos, name, file, number, filenumber;

    # first get the correct file
    name:=LowercaseString(string);
    pos:=Position(LIBTOMLIST.names,name);
    if pos = fail then
      if IsNameOfNoninstalledTableOfMarks( string ) then
        return fail;
      else
        Info( InfoTom, 1,
              "no table of marks with name ", string, " found" );
        return fail;
      fi;
    fi;

    filenumber:=LIBTOMLIST.positions[pos][1];
    file:=LIBTOMLIST.files[filenumber];
    number:=LIBTOMLIST.positions[pos][2];

    # is it necessary to read a new file?
    if not IsBound(LIBTOMKNOWN.(file)) or LIBTOMKNOWN.LOADSTATUS.(file)[1] =
                                      "unloaded" then
      # change the loadstatus of the files and remove one if necessary
      # and allowed
      if  LIBTOMKNOWN.UNLOAD then
        # find the oldest file which is not userloaded and remove it
        for name in RecNames(LIBTOMKNOWN.LOADSTATUS) do
          LIBTOMKNOWN.LOADSTATUS.(name)[2]:=
                            LIBTOMKNOWN.LOADSTATUS.(name)[2]-1;
          if LIBTOMKNOWN.LOADSTATUS.(name)[2] = 0 then
            LIBTOMKNOWN.(name):=rec();
            LIBTOMKNOWN.LOADSTATUS.(name)[1]:="unloaded";
          fi;
        od;
      fi;

      # read it
      ReadTom( Concatenation( file, ".tom" ) );
#T get rid of ReadTom?

      # reset the load status
      if LIBTOMKNOWN.UNLOAD then
        LIBTOMKNOWN.LOADSTATUS.(file):=["loaded",LIBTOMKNOWN.MAX];
      fi;
    fi;

    return LIBTOMKNOWN.(file)[number];
    end );


#############################################################################
##
#F  ConvertToLibTom( <record> )
##
InstallGlobalFunction( ConvertToLibTom, function( record )
    local   names;
    
    names:= RecNames( record );
    ConvertToTableOfMarks( record );
    
    # StandardGeneratorsInfo is not listed in TableOfMarksComponents
    if "StandardGeneratorsInfo" in names then
        Setter( StandardGeneratorsInfo )( record,
                record!.( "StandardGeneratorsInfo" ) );
    fi;
    
    SetFilterObj( record, IsLibTomRep );
    return record;
end );


#############################################################################
##
#F  SetActualLibFileName( <string> )
##
InstallGlobalFunction( SetActualLibFileName, function( file )
    LIBTOMKNOWN.(file):= [];
    LIBTOMKNOWN.ACTUAL:= file;
    LIBTOMKNOWN.LOADSTATUS.(file):= [ "userloaded", 0 ];
end );

#############################################################################
##
#F  LIBTOM( <arg> )
##
MakeReadWriteGlobal( "LIBTOM" );
UnbindGlobal( "LIBTOM" );
DeclareGlobalFunction( "LIBTOM" );

InstallGlobalFunction( LIBTOM, function( arg )
    local record, entry, nrgens, i, name;

    # Make the components.
    record:= rec( Identifier                  := arg[1],
                  SubsTom                     := arg[2],
                  MarksTom                    := arg[3],
                  NrSubsTom                   := arg[4],
                  OrdersTom                   := arg[5],
                  NormalizersTom              := arg[6],
                  DerivedSubgroupsTomUnique   := arg[7],
                  UnderlyingGroup             := arg[8],
                  StraightLineProgramsTom     := arg[9] );

    if Length( arg ) = 11 then
      record.GeneratorsSubgroupsTom:= [ arg[10], arg[11] ];
    fi;

    if IsList( record.UnderlyingGroup ) then

      # Store the underlying group if it is known.
      record.UnderlyingGroup:= GroupWithGenerators( record.UnderlyingGroup );

      # If standard generators are known then store them in the table.
      for entry in LIBTOMKNOWN.STDGEN do
        if record.Identifier = entry[1] then
          record.StandardGeneratorsInfo:= [ rec(
              generators  := entry[3],
              description := entry[4],
              script      := ScriptFromString( entry[4] ),
              ATLAS       := ( entry[2] <> "N" ) ) ];
          if IsInt( entry[2] ) then
            record.StandardGeneratorsInfo[1].standardization:= entry[2];
          fi;
          if 4 < Length( entry ) then
            # Store two straight line programs for standardizing.
            record.StandardGeneratorsInfo[1].ATLASFromTom:= CallFuncList(
                StraightLineProgram, entry[5] );
            record.StandardGeneratorsInfo[1].TomFromATLAS:= CallFuncList(
                StraightLineProgram, entry[6] );
          fi;
          break;
        fi;
      od;

    fi;

    # Construct the straight line programs.
    if record.StraightLineProgramsTom <> 0 then
      nrgens:= Length( GeneratorsOfGroup( record.UnderlyingGroup ) );
      for i in [ 1 .. Length( record.StraightLineProgramsTom ) ] do
        if arg[9][i] = [[[]]] then
          # special case for the trivial subgroup
          record.StraightLineProgramsTom[i]:=
              StraightLineProgram( [[]], nrgens );
        else
          record.StraightLineProgramsTom[i]:= List( arg[9][i],
              x -> StraightLineProgram( x, nrgens ) );
        fi;
      od;
    fi;

    # Remove superfluous components.
    for name in RecNames( record ) do
      if record.( name ) = 0 then
        Unbind( record.( name ) );
      fi;
    od;

    # Make the table of marks object.
    record:= ConvertToLibTom( record );

    # Set some attribute values.
    SetSize( UnderlyingGroup( record ),
             OrdersTom( record )[ Length( OrdersTom( record ) ) ] );
    SetTableOfMarks( UnderlyingGroup( record ), record );

    Add( LIBTOMKNOWN.( LIBTOMKNOWN.ACTUAL ), record );
end );


#############################################################################
##
#F  ACLT( <name>, <component>, <value> )
##
InstallGlobalFunction( ACLT, function( name, component, value )
    local pos, tom, nrgens, newvalue, i;

    # Get the table of marks with name <name>.
    pos:= Position( LIBTOMLIST.names, name );
    if pos = fail then
      Error( "no table of marks with name ", name, " known" );
    fi;
    pos:= LIBTOMLIST.positions[ pos ][2];
    tom:= LIBTOMKNOWN.( LIBTOMKNOWN.ACTUAL )[ pos ];

    # Handle special components.
    if component = "sortperm" then
#T what is this `sortperm' really good for??
      return;
    elif component = "otherwords" then
      nrgens:= Length( GeneratorsOfGroup( tom!.UnderlyingGroup ) );
      newvalue:= [];
      for i in [ 1 .. Length( value ) ] do
        if IsBound( value[i] ) then
          newvalue[i]:= List( value[i],
                              x -> StraightLineProgram( x, nrgens ) );
        fi;
      od;
      value:= newvalue;
    fi;

    # Set the additional component.
    tom!.( component ):= value;
end );


#############################################################################
##
#F  AFLT( <source>, <destination>, <fusion> )
##
InstallGlobalFunction( AFLT, function( source, destination, fusion )
    local pos, fus, tom;

    # get the table of marks with name <source>
    pos:=Position(LIBTOMLIST.names,source);
    if pos = fail then
         Error("no table of marks with name ",source," known\n");
    fi;
    if LIBTOMKNOWN.ACTUAL <> LIBTOMLIST.files[LIBTOMLIST.positions[pos][1]] then
         Error("source \"",source,"\" is not stored in file ",
                          Concatenation(LIBTOMKNOWN.ACTUAL,".tom"));
    fi;
    pos:=LIBTOMLIST.positions[pos][2];
    tom:=LIBTOMKNOWN.(LIBTOMKNOWN.ACTUAL)[pos];

    # do some tests
    for fus in FusionsTom(tom) do
        if fus = [destination,fusion] then
             return;
        elif fus[1]  = destination and fus[2][Length(fus[2])] =
                      fusion[Length(fusion)] then
             Error("there is already another fusion from \"",source,
                   "\" to \"",destination,"\" stored on \"",source,"\"\n");
        fi;
    od;

    # add the fusion
    Add(FusionsTom(LIBTOMKNOWN.(LIBTOMKNOWN.ACTUAL)[pos]),
           [destination,fusion]);
end );


#############################################################################
##
#F  AllLibTomNames()
##
InstallGlobalFunction( AllLibTomNames, function()
    local result, file;

    result:=[];
    for file in LIBTOMLIST.namelist do
        Append(result,List(file,x->x[1]));
    od;
    return result;
end );


#############################################################################
##
#F  NamesLibTom( <tom> )
#F  NamesLibTom( <string> )
##
InstallMethod( NamesLibTom,
    [ IsTableOfMarks and IsLibTomRep ],
    x -> NamesLibTom( Identifier( x ) ) );

InstallMethod( NamesLibTom,
    [ IsString ],
    function( string )
    local pos;

    if IsNameOfNoninstalledTableOfMarks( string ) then
      return fail;
    fi;
    pos:=Position(LIBTOMLIST.names,LowercaseString(string));
    if pos = fail then
      Info( InfoTom, 1,
            "no library table of marks whith name \"", string, "\" found" );
      return fail;
    else
      pos:= LIBTOMLIST.positions[ pos ];
      return LIBTOMLIST.namelist[ pos[1] ][ pos[2] ];
    fi;
    end );


#############################################################################
##
#M  NotifiedFusionsOfLibTom( <tom> )
#M  NotifiedFusionsOfLibTom( <string> )
#M  FusionsOfLibTom( <tom> )
#M  FusionsOfLibTom( <string> )
##
InstallMethod( FusionsOfLibTom,
    [ IsTableOfMarks and IsLibTomRep ],
    tom -> Filtered( FusionsTom( tom ),
                     x -> not x[1] in LIBTOMLIST.noninstalled ) );

InstallMethod( FusionsOfLibTom,
    [ IsString ],
    function(string)
    local tom;
    tom:=TableOfMarks(string);
    if tom = fail then
       return fail;
    else
       return Filtered( FusionsTom(tom),
                  x-> not x[1] in LIBTOMLIST.noninstalled);
    fi;
end );

InstallMethod( NotifiedFusionsOfLibTom,
    [ IsTableOfMarks and IsLibTomRep ],
    tom -> List( Filtered( FusionsTom( tom ),
                           x -> not x[1] in LIBTOMLIST.noninstalled ),
                 x -> [ x[1], x[2][ Length( x[2] ) ] ] ) );

InstallMethod( NotifiedFusionsOfLibTom,
    [ IsString ],
    function( string )
    local result, i, j, f;

    if IsNameOfNoninstalledTableOfMarks( string ) then
      return fail;
    elif not LowercaseString(string) in LIBTOMLIST.names then
      Info( InfoTom, 1,
            "no library table of marks with name \"", string, "\" found" );
      return fail;
    fi;

    result:= [];
    for i in [ 1 .. Length( LIBTOMLIST.namelist ) ] do
      for j in [ 1 .. Length( LIBTOMLIST.namelist[i] ) ] do
        for f in LIBTOMLIST.fusions[i][j] do
          if LowercaseString( f[1] ) in NamesLibTom( string ) then
            Add( result, [ LIBTOMLIST.namelist[i][j][1], f[2] ] );
          fi;
        od;
      od;
    od;
    return result;
    end );


#############################################################################
##
#M  NotifiedFusionsToLibTom( <tom> )
#M  NotifiedFusionsToLibTom( <string> )
#M  FusionsToLibTom( <tom> )
#M  FusionsToLibTom( <string> )
##
InstallMethod( FusionsToLibTom,
    [ IsTableOfMarks and IsLibTomRep ],
    x -> FusionsToLibTom( Identifier( x ) ) );

InstallMethod( FusionsToLibTom,
    [ IsString ],
    function(string)
    local result, tom, f, fus, fusions;

    if IsNameOfNoninstalledTableOfMarks( string ) then
      return fail;
    elif not LowercaseString(string) in LIBTOMLIST.names then
      Info( InfoTom, 1,
            "no library table of marks with name \"", string, "\" found" );
      return fail;
    fi;

    result:=[];
    fusions:=NotifiedFusionsToLibTom(string);

    # get the fusion maps
    for fus in fusions do
      tom:=TableOfMarks(fus[1]);
      for f in FusionsTom(tom) do
        if f[1] in NamesLibTom(string) and f[2][Length(f[2])] = fus[2] then
           Add(result,[fus[1],f[2]]);
        fi;
      od;
    od;

    return result;
    end );

InstallMethod( NotifiedFusionsToLibTom,
    [ IsTableOfMarks and IsLibTomRep ],
    x -> NotifiedFusionsToLibTom( Identifier( x ) ) );

InstallMethod( NotifiedFusionsToLibTom,
    [ IsString ],
    function( string )
    local pos;

    if IsNameOfNoninstalledTableOfMarks( string ) then
      return fail;
    fi;
    pos:=Position(LIBTOMLIST.names,LowercaseString(string));
    if pos = fail then
      Info( InfoTom, 1,
            "no library table of marks with name \"", string, "\" found" );
      return fail;
    fi;

    pos:=LIBTOMLIST.positions[pos];
    return Filtered(LIBTOMLIST.fusions[pos[1]][pos[2]], x-> not x[1] in
                     LIBTOMLIST.noninstalled );
end );


#############################################################################
##
#F  UnloadTableOfMarksData()
##
InstallGlobalFunction( UnloadTableOfMarksData, function()
    local name;

    for name in RecNames( LIBTOMKNOWN.LOADSTATUS ) do
      Unbind( LIBTOMKNOWN.LOADSTATUS.( name ) );
      Unbind( LIBTOMKNOWN.( name ) );
    od;
    end );


#############################################################################
##
#E