Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions gap/obsolete.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DeclareGlobalFunction("DIGRAPHS_DeclareObsoleteSynonym");
16 changes: 16 additions & 0 deletions gap/obsolete.gi
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
InstallGlobalFunction(DIGRAPHS_DeclareObsoleteSynonym,
function(oldname, func)
if not IsString(oldname) then
ErrorNoReturn("the 1st argument <oldname> must be a string,");
fi;
if not IsFunction(func) then
ErrorNoReturn("the 2nd argument <func> must be a function,");
fi;

BindGlobal(oldname, function(arg...)
Info(InfoWarning, 1, "\"", oldname, "\" is obsolete and will be removed ",
"in a future version;");
Info(InfoWarning, 1, "use \"", NameFunction(func), "\" instead");
return CallFuncList(func, arg);
end);
end);
1 change: 1 addition & 0 deletions init.g
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ ReadPackage("digraphs", "gap/isomorph.gd");
ReadPackage("digraphs", "gap/utils.gd");
ReadPackage("digraphs", "gap/io.gd");
ReadPackage("digraphs", "gap/grahom.gd");
ReadPackage("digraphs", "gap/obsolete.gd");
ReadPackage("digraphs", "gap/orbits.gd");
ReadPackage("digraphs", "gap/cliques.gd");
ReadPackage("digraphs", "gap/planar.gd");
Expand Down
1 change: 1 addition & 0 deletions read.g
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ ReadPackage("digraphs", "gap/display.gi");
ReadPackage("digraphs", "gap/isomorph.gi");
ReadPackage("digraphs", "gap/io.gi");
ReadPackage("digraphs", "gap/grahom.gi");
ReadPackage("digraphs", "gap/obsolete.gi");
ReadPackage("digraphs", "gap/orbits.gi");
ReadPackage("digraphs", "gap/cliques.gi");
ReadPackage("digraphs", "gap/planar.gi");
Expand Down
27 changes: 27 additions & 0 deletions tst/standard/obsolete.tst
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
#@local prevlevel
gap> START_TEST("Digraphs package: standard/obsolete.tst");
gap> LoadPackage("digraphs", false);;

#
gap> DIGRAPHS_StartTest();

# DIGRAPHS_DeclareObsoleteSynonym
gap> DIGRAPHS_DeclareObsoleteSynonym(ChainDigraph, Digraph);
Error, the 1st argument <oldname> must be a string,
gap> DIGRAPHS_DeclareObsoleteSynonym("Mycustomname", "Digraph");
Error, the 2nd argument <func> must be a function,
gap> DIGRAPHS_DeclareObsoleteSynonym("Mycustomname", Digraph);;
gap> prevlevel := InfoLevel(InfoWarning);;
gap> SetInfoLevel(InfoWarning, 1);;
gap> Mycustomname([[2], [1]]);
#I "Mycustomname" is obsolete and will be removed in a future version;
#I use "Digraph" instead
<immutable digraph with 2 vertices, 2 edges>
gap> SetInfoLevel(InfoWarning, prevlevel);;
gap> MakeReadWriteGlobal("Mycustomname");
gap> UnbindGlobal("Mycustomname");;

#
gap> DIGRAPHS_StopTest();
gap> STOP_TEST("Digraphs package: standard/obsolete.tst", 0);


## AutomorphismGroup: for a digraph with multiple edges
#
Expand Down
Loading