That's good to know, thanks. I'm guessing this has a runtime dependency on other Cygwin or WSL libraries and can't easily be distributed standalone?
I'm primarily wondering what is the most minimal possible installation that I can ask a Windows user (who probably starts without either Cygwin or WSL installed) to make, in order to make use of a script that happens to involve running an SML program. For this purpose it doesn't actually have to be a REPL, though that would be nice to have generally. Just running a program and presenting the output would be enough.
Chris
On Mon, 1 May 2017, at 19:12, Michael.Norrish at data61.csiro.au wrote:
Building under Cygwin or with the official Linux subsystem gives you this.
Michael
On 1/5/17, 19:49, "polyml-bounces at inf.ed.ac.uk on behalf of Chris Cannam"
<polyml-bounces at inf.ed.ac.uk on behalf of cannam at all-day-breakfast.com> wrote:
Hello -- I'm wondering whether there is a Windows build of Poly/ML available that can be used from a within command prompt or executed from a Powershell script, in the same sort of way as SML/NJ can be on Windows, or as Poly/ML can on other platforms. As far as I can see the Windows distribution contains an executable that always opens its own window and provides its own interactive prompt, which (although nice enough) is not quite what I want at the moment. Is there such a thing out there? Thanks, Chris _______________________________________________ polyml mailing list polyml at inf.ed.ac.uk http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
Hi Chris, The Windows version of Poly/ML only puts up a GUI if it has to. When it first starts it checks to see whether the standard input and output streams are provided and uses those if it can. That means that it's possible to run Poly/ML as a background process if some other application is providing the interaction. That's how programs such as Isabelle work.
If it needs an input or output stream it normally does this by creating a Windows-style GUI. It is possible to create a version of Poly/ML that creates a console when it starts instead of the GUI. To do this you need to create a Windows executable with the subsystem:console flag set in the .EXE file. When Windows starts an executable with this flag it creates a console for it unless it is already running under the command console.
There are really three ways to do this. One that's been mentioned is to use Cygwin. This seems to create executables with the flag set but it does other things as well and requires the Cygwin DLLs. The alternative is to create a native Windows application. That can be done using either Windows Visual Studio or Msys/Mingw.
The Poly/ML source distribution includes "projects" and a "solution" for Visual Studio and you can use the free "community" edition to build Poly/ML. You will need to change the linker "subsystem" option from "Windows" to "Console" but otherwise it's fairly straightforward.
The other option is to build using Msys and Mingw. In that case you can set the subsystem by using the "--disable-windows-gui" option to "./configure". There have been a number of forks of both Msys and Mingw and I would recommend the sequence that Chun Tian posted from Isabelle. This is based on my experience with various combinations of the distributions together with the experience of Makarius.
Hope this answers your questions.
David
On 01/05/2017 19:32, Chris Cannam wrote:
That's good to know, thanks. I'm guessing this has a runtime dependency on other Cygwin or WSL libraries and can't easily be distributed standalone?
I'm primarily wondering what is the most minimal possible installation that I can ask a Windows user (who probably starts without either Cygwin or WSL installed) to make, in order to make use of a script that happens to involve running an SML program. For this purpose it doesn't actually have to be a REPL, though that would be nice to have generally. Just running a program and presenting the output would be enough.
Chris
On Mon, 1 May 2017, at 19:12, Michael.Norrish at data61.csiro.au wrote:
Building under Cygwin or with the official Linux subsystem gives you this.
Michael
On 1/5/17, 19:49, "polyml-bounces at inf.ed.ac.uk on behalf of Chris Cannam"
<polyml-bounces at inf.ed.ac.uk on behalf of cannam at all-day-breakfast.com> wrote:
Hello -- I'm wondering whether there is a Windows build of Poly/ML available that can be used from a within command prompt or executed from a Powershell script, in the same sort of way as SML/NJ can be on Windows, or as Poly/ML can on other platforms. As far as I can see the Windows distribution contains an executable that always opens its own window and provides its own interactive prompt, which (although nice enough) is not quite what I want at the moment. Is there such a thing out there? Thanks, Chris _______________________________________________ polyml mailing list polyml at inf.ed.ac.uk http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
polyml mailing list polyml at inf.ed.ac.uk http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
On 02/05/17 14:05, David Matthews wrote:
The other option is to build using Msys and Mingw. In that case you can set the subsystem by using the "--disable-windows-gui" option to "./configure". There have been a number of forks of both Msys and Mingw and I would recommend the sequence that Chun Tian posted from Isabelle. This is based on my experience with various combinations of the distributions together with the experience of Makarius.
It is great when people find re-use of the Isabelle packaging.
Recently I have formalized the Poly/ML build process for Isabelle further, up to the point where "isabelle build_polyml" does everything on the different platforms.
This administrative tool requires an Isabelle repository clone -- the official release suppresses that. See also current versions of
http://isabelle.in.tum.de/repos/isabelle/file/45632d594bdb/src/Pure/Admin/bu... http://isabelle.in.tum.de/repos/isabelle/file/45632d594bdb/Admin/polyml/READ... http://isabelle.in.tum.de/repos/isabelle/file/45632d594bdb/Admin/polyml/INST... http://isabelle.in.tum.de/repos/isabelle/file/45632d594bdb/README_REPOSITORY
Makarius
Very interesting, thanks, that gives me a lot to digest.
I had a quick go at getting a console build of the 5.7 release using VS2015. If I simply naively switch the subsystem from Windows to Console in the PolyML project, I get "main" unresolved. I can see that WinMain and main are alternatives in polystub.c, but switching to the other #ifdef branch here just gives me polymain unresolved instead.
I can see that there are separate polymain and PolyWinMain implementations in there, but before I go hacking around the various #ifdef branches to try to get polymain called, is there a config option for this that will handle it without altering the code?
Chris
On Tue, 2 May 2017, at 13:05, David Matthews wrote:
Hi Chris, The Windows version of Poly/ML only puts up a GUI if it has to. When it first starts it checks to see whether the standard input and output streams are provided and uses those if it can. That means that it's possible to run Poly/ML as a background process if some other application is providing the interaction. That's how programs such as Isabelle work.
If it needs an input or output stream it normally does this by creating a Windows-style GUI. It is possible to create a version of Poly/ML that creates a console when it starts instead of the GUI. To do this you need to create a Windows executable with the subsystem:console flag set in the .EXE file. When Windows starts an executable with this flag it creates a console for it unless it is already running under the command console.
There are really three ways to do this. One that's been mentioned is to use Cygwin. This seems to create executables with the flag set but it does other things as well and requires the Cygwin DLLs. The alternative is to create a native Windows application. That can be done using either Windows Visual Studio or Msys/Mingw.
The Poly/ML source distribution includes "projects" and a "solution" for Visual Studio and you can use the free "community" edition to build Poly/ML. You will need to change the linker "subsystem" option from "Windows" to "Console" but otherwise it's fairly straightforward.
The other option is to build using Msys and Mingw. In that case you can set the subsystem by using the "--disable-windows-gui" option to "./configure". There have been a number of forks of both Msys and Mingw and I would recommend the sequence that Chun Tian posted from Isabelle. This is based on my experience with various combinations of the distributions together with the experience of Makarius.
Hope this answers your questions.
David
On 01/05/2017 19:32, Chris Cannam wrote:
That's good to know, thanks. I'm guessing this has a runtime dependency on other Cygwin or WSL libraries and can't easily be distributed standalone?
I'm primarily wondering what is the most minimal possible installation that I can ask a Windows user (who probably starts without either Cygwin or WSL installed) to make, in order to make use of a script that happens to involve running an SML program. For this purpose it doesn't actually have to be a REPL, though that would be nice to have generally. Just running a program and presenting the output would be enough.
Chris
On Mon, 1 May 2017, at 19:12, Michael.Norrish at data61.csiro.au wrote:
Building under Cygwin or with the official Linux subsystem gives you this.
Michael
On 1/5/17, 19:49, "polyml-bounces at inf.ed.ac.uk on behalf of Chris Cannam"
<polyml-bounces at inf.ed.ac.uk on behalf of cannam at all-day-breakfast.com> wrote:
Hello -- I'm wondering whether there is a Windows build of Poly/ML available that can be used from a within command prompt or executed from a Powershell script, in the same sort of way as SML/NJ can be on Windows, or as Poly/ML can on other platforms. As far as I can see the Windows distribution contains an executable that always opens its own window and provides its own interactive prompt, which (although nice enough) is not quite what I want at the moment. Is there such a thing out there? Thanks, Chris _______________________________________________ polyml mailing list polyml at inf.ed.ac.uk http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
polyml mailing list polyml at inf.ed.ac.uk http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
On 02/05/2017 21:05, Chris Cannam wrote:
Very interesting, thanks, that gives me a lot to digest.
I had a quick go at getting a console build of the 5.7 release using VS2015. If I simply naively switch the subsystem from Windows to Console in the PolyML project, I get "main" unresolved. I can see that WinMain and main are alternatives in polystub.c, but switching to the other #ifdef branch here just gives me polymain unresolved instead.
I'd forgotten that setting the subsystem option with the Windows linker also overrides the entry point. See https://msdn.microsoft.com/en-us/library/f9t8842e.aspx . You need to set it back by setting the entry point to WinMainCRTStartup .
David
On Wed, 3 May 2017, at 08:55, David Matthews wrote:
You need to set it back by setting the entry point to WinMainCRTStartup .
That works. Brilliant, thank you. I'm very impressed by how easy Poly/ML is to build in Visual Studio.
(I'd love to see a console-only build as an alternative .exe in the official Windows distributions.)
Chris
On 03/05/2017 09:23, Chris Cannam wrote:
That works. Brilliant, thank you. I'm very impressed by how easy Poly/ML is to build in Visual Studio.
I use it as my primary build and test platform so it tends to be up to date.
(I'd love to see a console-only build as an alternative .exe in the official Windows distributions.)
That's certainly possible. Why exactly are you using a console application? My feeling has always been that Windows users expect a Windows-style GUI.
Regards, David
Hi David,
Does it make sense to have a command-line-based "polyc" and "libpolymain" static library with the GUI version of PolyML on Windows? In another words, if Visual Studio 2015 and PolyML are both installed, can we expect to have all features like those on Linux/Mac side?
I ask this because I want to have HOL4 running in that PolyML GUI, while it's still possible to have all those command-line utilities generated from "polyc".
Regards,
Chun
On 5 May 2017 at 16:00, David Matthews <David.Matthews at prolingua.co.uk> wrote:
On 03/05/2017 09:23, Chris Cannam wrote:
That works. Brilliant, thank you. I'm very impressed by how easy Poly/ML is to build in Visual Studio.
I use it as my primary build and test platform so it tends to be up to date.
(I'd love to see a console-only build as an alternative .exe in the
official Windows distributions.)
That's certainly possible. Why exactly are you using a console application? My feeling has always been that Windows users expect a Windows-style GUI.
Regards, David
polyml mailing list polyml at inf.ed.ac.uk http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
Hi Chun, polyc is a Unix shell script so it won't work on Windows as it stands. It would have to be rewritten as a .BAT file or a .EXE.
It should be possible to polyc with the Windows GUI version if you use Msys2+Mingw64. Msys provides a Unix-style shell on Windows and will build the native Windows version using the GCC toolchain using configure and make.
Regards, David
On 08/05/2017 12:28, Chun Tian (binghe) wrote:
Hi David,
Does it make sense to have a command-line-based "polyc" and "libpolymain" static library with the GUI version of PolyML on Windows? In another words, if Visual Studio 2015 and PolyML are both installed, can we expect to have all features like those on Linux/Mac side?
I ask this because I want to have HOL4 running in that PolyML GUI, while it's still possible to have all those command-line utilities generated from "polyc".
Regards,
Chun
On 5 May 2017 at 16:00, David Matthews <David.Matthews at prolingua.co.uk> wrote:
On 03/05/2017 09:23, Chris Cannam wrote:
That works. Brilliant, thank you. I'm very impressed by how easy Poly/ML is to build in Visual Studio.
I use it as my primary build and test platform so it tends to be up to date.
(I'd love to see a console-only build as an alternative .exe in the
official Windows distributions.)
That's certainly possible. Why exactly are you using a console application? My feeling has always been that Windows users expect a Windows-style GUI.
Regards, David
polyml mailing list polyml at inf.ed.ac.uk http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
polyml mailing list polyml at inf.ed.ac.uk http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
On Fri, 5 May 2017, at 15:00, David Matthews wrote:
On 03/05/2017 09:23, Chris Cannam wrote:
(I'd love to see a console-only build as an alternative .exe in the official Windows distributions.)
That's certainly possible. Why exactly are you using a console application? My feeling has always been that Windows users expect a Windows-style GUI.
Maybe because I'm not a very authentic Windows user. I usually use Linux and I like to do things from a command line, so I like tools that work similarly when invoked within Powershell or cmd.exe to how they work on other platforms.
(But I don't really like to use cygwin or other Unix tools on Windows -- partly because I'm used to having to build systems that can be used by people who don't have them installed, and partly because I find it all a bit uncanny-valley. Besides, I rather like Powershell.)
Earlier you said that the existing Windows distribution should be usable without GUI if the I/O streams are redirected. If I try something like this:
echo 'print "hello, world\n";' | & 'C:\Program Files\Poly ML\PolyML.exe'
the GUI window appears for a moment then disappears, and no output goes to the Powershell window. If I do this instead:
echo 'print "hello, world\n";' | & 'C:\Program Files\Poly ML\
PolyML.exe' > output.txt
then the GUI window doesn't appear, but output.txt is empty. Is this expected?
(With the console build I made following your guidance in this thread, these print to console and output file respectively.)
Chris
I think this is the nature of Windows: you can?t let single execution be both GUI and *real* console programs, because the ?subsystem? of a program is a flag of PE file formats. So, in my opinion, there?s no solution to let a GUI-based PolyML outputs something to the standard output stream of the CMD or Powershell window in which PolyML is started.
Maybe a more interesting question is this: if we built two Poly.exe from the same code base, one is ?Windows? subsystem, the other is ?Console? subsystem, can they share the same user-saved ?heap?? If the answer is YES, then user could freely choice one version of the two for each specific purposes. (I ask this because on Linux/Mac I see each time after I rebuilt PolyML, even with the same PolyML source code, all my HOL4 builds must be rebuilt too (otherwise they refuse to startup). I don?t understand why this is necessary.)
?Chun
Il giorno 08 mag 2017, alle ore 16:21, Chris Cannam <cannam at all-day-breakfast.com> ha scritto:
Earlier you said that the existing Windows distribution should be usable without GUI if the I/O streams are redirected. If I try something like this:
echo 'print "hello, world\n";' | & 'C:\Program Files\Poly ML\PolyML.exe'
the GUI window appears for a moment then disappears, and no output goes to the Powershell window. If I do this instead:
echo 'print "hello, world\n";' | & 'C:\Program Files\Poly ML\
PolyML.exe' > output.txt
then the GUI window doesn't appear, but output.txt is empty. Is this expected?
(With the console build I made following your guidance in this thread, these print to console and output file respectively.)
Chris _______________________________________________ polyml mailing list polyml at inf.ed.ac.uk http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
On 08/05/2017 20:11, Chun Tian (binghe) wrote:
Maybe a more interesting question is this: if we built two Poly.exe from the same code base, one is ?Windows? subsystem, the other is ?Console? subsystem, can they share the same user-saved ?heap?? If the answer is YES, then user could freely choice one version of the two for each specific purposes. (I ask this because on Linux/Mac I see each time after I rebuilt PolyML, even with the same PolyML source code, all my HOL4 builds must be rebuilt too (otherwise they refuse to startup). I don?t understand why this is necessary.)
You should be able to achieve this but it may take a bit of fiddling.
When you save a heap though PolyML.SaveState.saveState the saved state records the time stamp of the parent executable. It will only allow the saved state to be loaded into an executable with the same parent time stamp. The reason for this is that the saved state does not contain everything that it needs to run. Anything that is contained in the executable, such as the standard basis, other libraries, compiler etc, will not be saved. The saved heap just contains pointers to these but the addresses could be different in a different executable.
However, there is just one object file that contains the time stamp as well as all the ML library code. This is the one that is output through PolyML.export. In the Linux build this is normally polyexport.o and in Windows polyexport.obj. The normal build process will build a new version of this but if you rebuild an executable but use the original version of this object file the resulting executable should continue to load the original saved states.
Regards, David
On 08/05/2017 15:21, Chris Cannam wrote:
Earlier you said that the existing Windows distribution should be usable without GUI if the I/O streams are redirected. If I try something like this:
echo 'print "hello, world\n";' | & 'C:\Program Files\Poly ML\PolyML.exe'
the GUI window appears for a moment then disappears, and no output goes to the Powershell window. If I do this instead:
echo 'print "hello, world\n";' | & 'C:\Program Files\Poly ML\
PolyML.exe' > output.txt
then the GUI window doesn't appear, but output.txt is empty. Is this expected?
(With the console build I made following your guidance in this thread, these print to console and output file respectively.)
I don't use Powershell so I don't know what the "| & " sequence does. If I try the first example under cmd.exe it puts up the GUI as I would expect. Since there's no standard output it will put up the GUI. The second example puts the output in output.txt as expected.
Under the msys shell the first example writes to the console rather than putting up the GUI. Presumably msys is providing the standard output through a pipe.
Regards, David
On Thu, 11 May 2017, at 17:36, David Matthews wrote:
I don't use Powershell so I don't know what the "| & " sequence does.
As I understand it, the | is a classic pipe, and the & tells it that the next thing is the name of an external command rather than a builtin. In fact I never typed the &, the shell just added it when tab-completing the subsequent command filename.
If I try the first example under cmd.exe it puts up the GUI as I would expect. Since there's no standard output it will put up the GUI. The second example puts the output in output.txt as expected.
That's interesting, and made me wonder whether I had done something stupid in the Powershell. The answer turns out to be "maybe":
echo 'print "hello, world\n";' | & "C:\Program Files\Poly ML\PolyML.exe"
output.txt
produces no output, but
echo 'print "hello, world\n";' | & "C:\Program Files\Poly ML\PolyML.exe" | Out-File output.txt
works. And of course they both work with the console build of PolyML, which is odd.
I'm pretty new to Powershell myself (I like it for scripting but still have to keep referring to the docs) but I did understand that the ">" redirect was equivalent to using the Out-File cmdlet.
Oh well. Sorry for the mis-(re)direction there.
Chris