From 1fe6bd2440931d5d5f826cb750f752f1fd91d82e Mon Sep 17 00:00:00 2001 From: Benjamin Lorenz Date: Fri, 16 Feb 2024 10:51:26 +0100 Subject: [PATCH 1/2] bump version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 9dec021a..c6f1d949 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Polymake" uuid = "d720cf60-89b5-51f5-aff5-213f193123e7" repo = "https://github.com/oscar-system/Polymake.jl.git" -version = "0.11.13" +version = "0.11.14" [deps] BinaryWrappers = "f01c122e-0ea1-4f85-ad8f-907073ad7a9f" From 88fc9cb28e29bf7e140d20da116d3f727fcd2422 Mon Sep 17 00:00:00 2001 From: Benjamin Lorenz Date: Fri, 16 Feb 2024 10:52:17 +0100 Subject: [PATCH 2/2] add helper for qualified type name --- src/perlobj.jl | 8 +++++++- src/polymake/julia.rules | 24 ++++++++++++++---------- test/perlobj.jl | 1 + 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/perlobj.jl b/src/perlobj.jl index 07fabbb5..0a01c1df 100644 --- a/src/perlobj.jl +++ b/src/perlobj.jl @@ -20,11 +20,17 @@ function bigobject(fname::String, name::String; kwargsdata...) end function bigobject_eltype(obj::BigObject) - res = call_function(:User, :get_bigobject_elemtype, obj) + res = call_function(:common, :get_bigobject_elemtype, obj) res isa CxxWrap.StdString && !isempty(res) || error("could not determine element type of BigObject") return String(res) end +function bigobject_qualifiedname(obj::BigObject) + res = call_function(:common, :get_bigobject_qualified_name, obj) + res isa CxxWrap.StdString && !isempty(res) || error("could not determine full type of BigObject") + return String(res) +end + # polymake can either just give a reference or do a full copy. # but even that full copy will contain references to the same data # objects in memory, but this is fine since most of them are immutable anyway. diff --git a/src/polymake/julia.rules b/src/polymake/julia.rules index cccedeb8..1098a10c 100644 --- a/src/polymake/julia.rules +++ b/src/polymake/julia.rules @@ -89,6 +89,20 @@ function safe_to_string($) { return "$var"; } +function get_bigobject_elemtype($) { + my $params = $_[0]->type->params; + return "" unless defined($params) && @$params > 0; + if ($params->[0]->name =~ /^Min|Max$/) { + return $params->[1]->name; + } else { + return $params->[0]->name; + } +} + +function get_bigobject_qualified_name($) { + return $_[0]->type->qualified_name; +} + package Polymake::User; function get_shell_scalar($) { @@ -104,13 +118,3 @@ function set_shell_scalar($,$) { no strict 'refs'; ${"Polymake::User::$varname"} = $obj; } - -sub get_bigobject_elemtype($) { - my $params = $_[0]->type->params; - return "" unless defined($params) && @$params > 0; - if ($params->[0]->name =~ /^Min|Max$/) { - return $params->[1]->name; - } else { - return $params->[0]->name; - } -} diff --git a/test/perlobj.jl b/test/perlobj.jl index b92ae3e1..d076792f 100644 --- a/test/perlobj.jl +++ b/test/perlobj.jl @@ -116,6 +116,7 @@ P = @pm polytope.Polytope{Rational}(POINTS=[1 0.5 0; 1 0 1]) @test P.VERTICES isa Polymake.Matrix{Polymake.Rational} @test Polymake.bigobject_eltype(P) == "Rational" + @test Polymake.bigobject_qualifiedname(P) == "polytope::Polytope" end @testset verbose=true "PolymakeException" begin