Skip to content

Commit c8130b4

Browse files
authored
Merge pull request #1205 from zickgraf/master
Some simplifications
2 parents ddb65ee + 20bd177 commit c8130b4

File tree

5 files changed

+16
-108
lines changed

5 files changed

+16
-108
lines changed

CAP/PackageInfo.g

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ SetPackageInfo( rec(
1010

1111
PackageName := "CAP",
1212
Subtitle := "Categories, Algorithms, Programming",
13-
Version := "2022.12-09",
13+
Version := "2022.12-10",
1414
Date := Concatenation( "01/", ~.Version{[ 6, 7 ]}, "/", ~.Version{[ 1 .. 4 ]} ),
1515
License := "GPL-2.0-or-later",
1616

CAP/gap/ToolsForCategories.gd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ DeclareGlobalFunction( "CAP_INTERNAL_REPLACE_STRING_WITH_FILTER" );
2424
#! Applies <Ref Func="CAP_INTERNAL_REPLACE_STRING_WITH_FILTER" /> to all elements of <A>list</A> and returns the result.
2525
DeclareGlobalFunction( "CAP_INTERNAL_REPLACE_STRINGS_WITH_FILTERS" );
2626

27-
DeclareGlobalFunction( "CAP_INTERNAL_REPLACE_STRING_WITH_FILTER_FOR_JULIA" );
2827
DeclareGlobalFunction( "CAP_INTERNAL_REPLACE_STRINGS_WITH_FILTERS_FOR_JULIA" );
2928

3029
#! @Arguments list, additional list

CAP/gap/ToolsForCategories.gi

Lines changed: 13 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -212,129 +212,38 @@ InstallGlobalFunction( CAP_INTERNAL_REPLACE_STRINGS_WITH_FILTERS,
212212

213213
end );
214214

215-
InstallGlobalFunction( CAP_INTERNAL_REPLACE_STRING_WITH_FILTER_FOR_JULIA,
215+
InstallGlobalFunction( CAP_INTERNAL_REPLACE_STRINGS_WITH_FILTERS_FOR_JULIA,
216216

217-
function( filter_or_string, args... )
217+
function( list, args... )
218218
local category;
219219

220220
if Length( args ) > 1 then
221-
Error( "CAP_INTERNAL_REPLACE_STRING_WITH_FILTER_FOR_JULIA must be called with at most two arguments" );
221+
Error( "CAP_INTERNAL_REPLACE_STRINGS_WITH_FILTERS_FOR_JULIA must be called with at most two arguments" );
222222
elif Length( args ) = 1 then
223223
category := args[1];
224224
else
225225
category := false;
226226
fi;
227227

228-
if IsFilter( filter_or_string ) then
229-
return filter_or_string;
230-
elif IsString( filter_or_string ) then
231-
if filter_or_string = "category" then
232-
if category <> false then
233-
return CategoryFilter( category );
234-
else
235-
return IsCapCategory;
236-
fi;
237-
elif filter_or_string = "object" then
238-
if category <> false then
239-
return ObjectFilter( category );
240-
else
241-
return IsCapCategoryObject;
242-
fi;
243-
elif filter_or_string = "morphism" then
244-
if category <> false then
245-
return MorphismFilter( category );
246-
else
247-
return IsCapCategoryMorphism;
248-
fi;
249-
elif filter_or_string = "twocell" then
250-
if category <> false then
251-
return TwoCellFilter( category );
252-
else
253-
return IsCapCategoryTwoCell;
254-
fi;
255-
elif filter_or_string = "object_in_range_category_of_homomorphism_structure" then
228+
return List( list, function ( l )
229+
local filter;
230+
231+
filter := CAP_INTERNAL_REPLACE_STRING_WITH_FILTER( l, category );
232+
233+
if filter = IsList then
256234

257-
if category <> false and not HasRangeCategoryOfHomomorphismStructure( category ) then
258-
259-
Display( Concatenation( "WARNING: You are calling an Add function for a CAP operation for \"", Name( category ), "\" which is part of a homomorphism structure but the category has no RangeCategoryOfHomomorphismStructure (yet)" ) );
260-
261-
fi;
235+
return ValueGlobal( "IsJuliaObject" );
262236

263-
if category <> false and HasRangeCategoryOfHomomorphismStructure( category ) then
264-
return ObjectFilter( RangeCategoryOfHomomorphismStructure( category ) );
265-
else
266-
return IsCapCategoryObject;
267-
fi;
268-
elif filter_or_string = "morphism_in_range_category_of_homomorphism_structure" then
237+
else
269238

270-
if category <> false and not HasRangeCategoryOfHomomorphismStructure( category ) then
271-
272-
Display( Concatenation( "WARNING: You are calling an Add function for a CAP operation for \"", Name( category ), "\" which is part of a homomorphism structure but the category has no RangeCategoryOfHomomorphismStructure (yet)" ) );
273-
274-
fi;
239+
return filter;
275240

276-
if category <> false and HasRangeCategoryOfHomomorphismStructure( category ) then
277-
return MorphismFilter( RangeCategoryOfHomomorphismStructure( category ) );
278-
else
279-
return IsCapCategoryMorphism;
280-
fi;
281-
elif filter_or_string = "other_category" then
282-
return IsCapCategory;
283-
elif filter_or_string = "other_object" then
284-
return IsCapCategoryObject;
285-
elif filter_or_string = "other_morphism" then
286-
return IsCapCategoryMorphism;
287-
elif filter_or_string = "other_twocell" then
288-
return IsCapCategoryTwoCell;
289-
elif filter_or_string = "list_of_objects" then
290-
return ValueGlobal( "IsJuliaObject" );
291-
elif filter_or_string = "list_of_morphisms" then
292-
return ValueGlobal( "IsJuliaObject" );
293-
elif filter_or_string = "list_of_twocells" then
294-
return ValueGlobal( "IsJuliaObject" );
295-
elif filter_or_string = "object_datum" then
296-
if category <> false and ObjectDatumType( category ) <> fail and ObjectDatumType( category ).filter = IsList then
297-
return ValueGlobal( "IsJuliaObject" );
298-
else
299-
return IsObject;
300-
fi;
301-
elif filter_or_string = "morphism_datum" then
302-
if category <> false and MorphismDatumType( category ) <> fail and MorphismDatumType( category ).filter = IsList then
303-
return ValueGlobal( "IsJuliaObject" );
304-
else
305-
return IsObject;
306-
fi;
307-
elif filter_or_string = "nonneg_integer_or_infinity" then
308-
return IsCyclotomic;
309-
else
310-
Error( "filter type ", filter_or_string, " is not recognized, see the documentation for allowed values" );
311241
fi;
312242

313-
else
314-
315-
Error( "the first argument must be a string or filter" );
316-
317-
fi;
243+
end );
318244

319245
end );
320246

321-
InstallGlobalFunction( CAP_INTERNAL_REPLACE_STRINGS_WITH_FILTERS_FOR_JULIA,
322-
323-
function( list, args... )
324-
local category;
325-
326-
if Length( args ) > 1 then
327-
Error( "CAP_INTERNAL_REPLACE_STRINGS_WITH_FILTERS_FOR_JULIA must be called with at most two arguments" );
328-
elif Length( args ) = 1 then
329-
category := args[1];
330-
else
331-
category := false;
332-
fi;
333-
334-
return List( list, l -> CAP_INTERNAL_REPLACE_STRING_WITH_FILTER_FOR_JULIA( l, category ) );
335-
336-
end );
337-
338247
InstallGlobalFunction( "CAP_INTERNAL_MERGE_FILTER_LISTS",
339248

340249
function( filter_list, additional_filters )

CompilerForCAP/PackageInfo.g

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ SetPackageInfo( rec(
1010

1111
PackageName := "CompilerForCAP",
1212
Subtitle := "Speed up computations in CAP categories",
13-
Version := "2022.12-07",
13+
Version := "2022.12-08",
1414
Date := Concatenation( "01/", ~.Version{[ 6, 7 ]}, "/", ~.Version{[ 1 .. 4 ]} ),
1515
License := "GPL-2.0-or-later",
1616

CompilerForCAP/gap/EnhancedSyntaxTree.gi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ InstallGlobalFunction( ENHANCED_SYNTAX_TREE, function ( func )
525525

526526
# using LocationFunc causes a segfault (https://github.com/gap-system/gap/issues/4507)
527527
# COVERAGE_IGNORE_NEXT_LINE
528-
Print( "WARNING: operation ", tree.funcref.gvar, ", located in function at ", FilenameFunc( func ), ":", StartlineFunc( func ), " can probably not be resolved.\n" );
528+
Print( "WARNING: operation ", tree.funcref.gvar, ", located in function at ", FilenameFunc( func ), ":", StartlineFunc( func ), " with name\n", NameFunction( func ), "\ncan probably not be resolved.\n" );
529529

530530
fi;
531531

0 commit comments

Comments
 (0)