Page 1 of 1

Documentation for file command line interface

Posted: 21 Dec 2020, 18:33
by Joachim Zobel
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

Re: Documentation for file command line interface

Posted: 22 Dec 2020, 14:25
by gawrilow
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.

Re: Documentation for file command line interface

Posted: 23 Dec 2020, 12:51
by joswig
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.

Re: Documentation for file command line interface

Posted: 24 Dec 2020, 07:11
by Joachim Zobel
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.