From 4e09fdd79ab9a8308107c06c17ad540a6556c3fe Mon Sep 17 00:00:00 2001 From: William-Kenyon <115789274+William-Kenyon@users.noreply.github.com> Date: Tue, 13 Oct 2026 12:11:08 +0100 Subject: [PATCH 1/5] Creates a way to declare obsolete synonyms --- gap/obsolete.gd | 1 + gap/obsolete.gi | 15 +++++++++++++++ init.g | 1 + read.g | 1 + 4 files changed, 18 insertions(+) create mode 100644 gap/obsolete.gd create mode 100644 gap/obsolete.gi diff --git a/gap/obsolete.gd b/gap/obsolete.gd new file mode 100644 index 000000000..323443322 --- /dev/null +++ b/gap/obsolete.gd @@ -0,0 +1 @@ +DeclareGlobalFunction("DIGRAPHS_DeclareObsoleteSynonym"); \ No newline at end of file diff --git a/gap/obsolete.gi b/gap/obsolete.gi new file mode 100644 index 000000000..450254a42 --- /dev/null +++ b/gap/obsolete.gi @@ -0,0 +1,15 @@ +InstallGlobalFunction(DIGRAPHS_DeclareObsoleteSynonym, +function(oldname, func) + if not IsString(oldname) then + ErrorNoReturn("the 1st argument must be a string,"); + fi; + if not IsFunction(func) then + ErrorNoReturn("the 2nd argument must be a function,"); + fi; + + BindGlobal(oldname, function(arg...) + Info(InfoWarning, 1, "\"", oldname, "\" is obsolete and will be removed ", + "in a future version; use \"", NameFunction(func), "\" instead,"); + return CallFuncList(func, arg); + end); +end); \ No newline at end of file diff --git a/init.g b/init.g index 236ac5bd3..3a551f41d 100644 --- a/init.g +++ b/init.g @@ -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"); diff --git a/read.g b/read.g index 9755db9fa..f2eb22e4b 100644 --- a/read.g +++ b/read.g @@ -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"); From df3ee758ff8f602915ee21dfb96881bbd9886d78 Mon Sep 17 00:00:00 2001 From: William-Kenyon <115789274+William-Kenyon@users.noreply.github.com> Date: Tue, 13 Oct 2026 12:11:23 +0100 Subject: [PATCH 2/5] Tests for obsolete synonym --- tst/standard/obsolete.tst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tst/standard/obsolete.tst b/tst/standard/obsolete.tst index d72318f3c..6800ac4ee 100644 --- a/tst/standard/obsolete.tst +++ b/tst/standard/obsolete.tst @@ -1,3 +1,26 @@ +#@local +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 must be a string, +gap> DIGRAPHS_DeclareObsoleteSynonym("ConstructDigraph", "Digraph"); +Error, the 2nd argument must be a function, +gap> DIGRAPHS_DeclareObsoleteSynonym("ConstructDigraph", Digraph);; +gap> SetInfoLevel(InfoWarning, 1); +gap> ConstructDigraph([[2], [1]]); +#I "ConstructDigraph" is obsolete and will be removed in a future version; use "Digraph" instead, + +gap> SetInfoLevel(InfoWarning, 0); + +# +gap> DIGRAPHS_StopTest(); +gap> STOP_TEST("Digraphs package: standard/obsolete.tst", 0); + ## AutomorphismGroup: for a digraph with multiple edges # From 49b123921aaf83f4da5ace1a430c5d26bd85324f Mon Sep 17 00:00:00 2001 From: William-Kenyon <115789274+William-Kenyon@users.noreply.github.com> Date: Tue, 13 Oct 2026 13:31:26 +0100 Subject: [PATCH 3/5] Safer test --- tst/standard/obsolete.tst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tst/standard/obsolete.tst b/tst/standard/obsolete.tst index 6800ac4ee..7faf82647 100644 --- a/tst/standard/obsolete.tst +++ b/tst/standard/obsolete.tst @@ -1,4 +1,4 @@ -#@local +#@local prevlevel gap> START_TEST("Digraphs package: standard/obsolete.tst"); gap> LoadPackage("digraphs", false);; @@ -11,11 +11,12 @@ Error, the 1st argument must be a string, gap> DIGRAPHS_DeclareObsoleteSynonym("ConstructDigraph", "Digraph"); Error, the 2nd argument must be a function, gap> DIGRAPHS_DeclareObsoleteSynonym("ConstructDigraph", Digraph);; -gap> SetInfoLevel(InfoWarning, 1); +gap> prevlevel := InfoLevel(InfoWarning);; +gap> SetInfoLevel(InfoWarning, 1);; gap> ConstructDigraph([[2], [1]]); #I "ConstructDigraph" is obsolete and will be removed in a future version; use "Digraph" instead, -gap> SetInfoLevel(InfoWarning, 0); +gap> SetInfoLevel(InfoWarning, prevlevel);; # gap> DIGRAPHS_StopTest(); From 8e46fa30a094815f295c38017089dda1e19d7afe Mon Sep 17 00:00:00 2001 From: William-Kenyon <115789274+William-Kenyon@users.noreply.github.com> Date: Tue, 13 Oct 2026 14:08:45 +0100 Subject: [PATCH 4/5] Make tests clean up properly --- tst/standard/obsolete.tst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tst/standard/obsolete.tst b/tst/standard/obsolete.tst index 7faf82647..70923a9d5 100644 --- a/tst/standard/obsolete.tst +++ b/tst/standard/obsolete.tst @@ -8,15 +8,17 @@ gap> DIGRAPHS_StartTest(); # DIGRAPHS_DeclareObsoleteSynonym gap> DIGRAPHS_DeclareObsoleteSynonym(ChainDigraph, Digraph); Error, the 1st argument must be a string, -gap> DIGRAPHS_DeclareObsoleteSynonym("ConstructDigraph", "Digraph"); +gap> DIGRAPHS_DeclareObsoleteSynonym("Mycustomname", "Digraph"); Error, the 2nd argument must be a function, -gap> DIGRAPHS_DeclareObsoleteSynonym("ConstructDigraph", Digraph);; +gap> DIGRAPHS_DeclareObsoleteSynonym("Mycustomname", Digraph);; gap> prevlevel := InfoLevel(InfoWarning);; gap> SetInfoLevel(InfoWarning, 1);; -gap> ConstructDigraph([[2], [1]]); -#I "ConstructDigraph" is obsolete and will be removed in a future version; use "Digraph" instead, +gap> Mycustomname([[2], [1]]); +#I "Mycustomname" is obsolete and will be removed in a future version; use "Digraph" instead, gap> SetInfoLevel(InfoWarning, prevlevel);; +gap> MakeReadWriteGlobal("Mycustomname"); +gap> UnbindGlobal("Mycustomname");; # gap> DIGRAPHS_StopTest(); From 8b25ceea7e72c8bc283275d2733136ec6b3ef9ed Mon Sep 17 00:00:00 2001 From: William-Kenyon <115789274+William-Kenyon@users.noreply.github.com> Date: Wed, 14 Oct 2026 16:35:22 +0100 Subject: [PATCH 5/5] Format warning statement --- gap/obsolete.gi | 3 ++- tst/standard/obsolete.tst | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gap/obsolete.gi b/gap/obsolete.gi index 450254a42..84c98088e 100644 --- a/gap/obsolete.gi +++ b/gap/obsolete.gi @@ -9,7 +9,8 @@ function(oldname, func) BindGlobal(oldname, function(arg...) Info(InfoWarning, 1, "\"", oldname, "\" is obsolete and will be removed ", - "in a future version; use \"", NameFunction(func), "\" instead,"); + "in a future version;"); + Info(InfoWarning, 1, "use \"", NameFunction(func), "\" instead"); return CallFuncList(func, arg); end); end); \ No newline at end of file diff --git a/tst/standard/obsolete.tst b/tst/standard/obsolete.tst index 70923a9d5..15db2d466 100644 --- a/tst/standard/obsolete.tst +++ b/tst/standard/obsolete.tst @@ -14,7 +14,8 @@ 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; use "Digraph" instead, +#I "Mycustomname" is obsolete and will be removed in a future version; +#I use "Digraph" instead gap> SetInfoLevel(InfoWarning, prevlevel);; gap> MakeReadWriteGlobal("Mycustomname");