Documentation for file command line interface

Questions and problems about using polymake go here.
Joachim Zobel
Posts: 8
Joined: 21 Dec 2020, 18:26

Documentation for file command line interface

Postby Joachim Zobel » 21 Dec 2020, 18:33

Hi.

A long time ago there was a command line interface that started with a data file followed by one or more properties.

Is there any documentation on this? The source code of the command line parser would also be helpful.

I need this to migrate the GAP polymaking package. My first approach (which passed the package tests) seems to naive as I take a closer look.

Thx,
Joachim

User avatar
gawrilow
Main Author
Posts: 422
Joined: 25 Dec 2010, 17:40

Re: Documentation for file command line interface

Postby gawrilow » 22 Dec 2020, 14:25

This interface has been deprecated since version 3.0 and removed in version 4.

Here https://polymake.org/doku.php/user_guid ... mmand_line you can find code examples providing equivalent functionality.

User avatar
joswig
Main Author
Posts: 279
Joined: 24 Dec 2010, 11:10

Re: Documentation for file command line interface

Postby joswig » 23 Dec 2020, 12:51

The following variant of the tutorial code is more generic and thus probably even better suited for your needs:

Code: Select all

polymake 'my $c=load("c3.poly"); print "$_\n", $c->$_, "\n\n" for "N_VERTICES", "N_FACETS";'
You can add as many properties as you like.

Joachim Zobel
Posts: 8
Joined: 21 Dec 2020, 18:26

Re: Documentation for file command line interface

Postby Joachim Zobel » 24 Dec 2020, 07:11

If it wouldn't have stopped working, nobody in the GAP team would have noticed :-).

I had hoped there would be a precise documentation. I started using ->give. Then I found out that there are methods like VISUAL, that are not properties but used for documented behavior on the gap side. Actually I am currently doing

Code: Select all

my $file = shift(@ARGV); my $rtn = 0; $rtn = 1 if $#ARGV > 1; sub give_from { my ($c, $arg) = @_; no strict 'refs'; return $c->$arg; } my $c=load($file); my @rtn = (); foreach my $arg (@ARGV) { my @sargs = split(/\b\s+\b/, $arg); $rtn = 1 if $#sargs > 1; foreach my $sarg (@sargs) { my @ssargs = split('->', $sarg); my $given = $c; # We follow the arrows foreach my $ssarg (@ssargs) { $given = give_from($given, $ssarg); } # and return what the last one gave us push(@rtn, "$sarg\n$given\n"); } } print join("\n", @rtn); return $rtn;
As you can see I am splitting at '->', which means I am on a slippery slope since only perl can parse perl. I do however want to avoid eval.

Basically I am finding out why the feature has been removed. So I thing I will stop with the above and add a script argument to GAP polymaking API.


Return to “Helpdesk”