Installation

[DEV return to this once a Linux build is working] Some further steps are required to install IUP on Linux, see demo/pGUI/lnx/installation.txt

Phix is distributed as a standard Windows installer, which unpacks to a directory (the default is C:\Program Files (x86)\Phix, less the " (x86)" on 32-bit machines) and runs ppw.bat. Alternatively you can unpack the contents manually using 7-zip and edit/run that batch file or the following commands (from ppw.bat) by hand:

        pw -p           :: (create p.exe from pw.exe)
        :: recompilation from sources (next line) is optional
        ::p -cp               :: (creates p.exe and pw.exe)
        pw pgui -settings
When installed, the Phix directory looks something like this (on Windows):
 \Phix
    p.exe           (the console version of Phix)
    p.exw           (and other compiler sources)
    phixzip.bat     (repackage script)
    ppw.bat         (setup script)
    pw.exe          (the gui version of Phix)
    readme.txt      (release notes)
    \bench          (performance tests)
    \builtins       (standard include files, e.g. database.e)
    \demo           (various example programs including pGUI and Edix)
    \docs           (these files)
    \sfx            (phix7zip.lst, details the full distribution set)
    \test           (tests to be run via p -test)
Installation does not modify anything in the system registry, nor does it create any start menu or desktop shortcuts, or set the PATH environment variable. The distribution does however include the program pgui.exw which has a setup tab to modify the registry, and can be run by either opening a command prompt in the directory where Phix was installed and entering "pw pgui" (without the quotes), or double clicking on pw.exe in that directory and entering pgui to the prompt. That program opens with the demo tab showing, feel free to experiment with a few of those before visiting the settings tab. On that settings tab you can also "micro-manage" things, creating both a setup.reg and an undo.reg that you can use to vet/modify or cleanup all settings, for more details refer to the somewhat excessively verbose details that appear when you click on the Help button, or just accept my judgement and hit "OK".

Personally I never set PATH, EUINC, or EUDIR, though they can be used if you want. (If you do not know what I mean by that, you can safely ignore it.)

On a fresh (win7) machine I normally create a start menu entry as follows:
  • Right click on Start/All Programs/Accessories/Command Prompt and select the "Pin to Start Menu" option, or if you prefer drag it onto the desktop with the right mouse button and select "Create shortcuts here".
  • Right click on the new menu item or icon and select properties.
  • Change the start directory to "C:\Program Files (x86)\Phix", or wherever you installed Phix, and change the description to something more meaningful than "Command Prompt", even if it is just "Command Prompt (Phix)".
  • Test it by clicking on the menu item/icon just created and entering "p", if everything is installed correctly and working you should see something similar to:
            Phix hybrid interpreter/compiler.
    
            Version 0.6.4  Copyright Pete Lomax 2006..2014
    
            Enter ? for options or filename to execute:
      
    Enter "-test" (or "p -test" to start with) and it should run through 59 tests and if all goes well end by displaying something like "All tests completed successfully, 1.03 seconds". Press escape or return and Phix will terminate; then enter "exit" or click on the usual top right "X" if you want to close the (MS-DOS) Command Prompt window, though normally I leave mine open all day.

Phix can be recompiled at a command prompt simply by typing 'p -c p' (or './phix -c p' on Linux), the result should look something like this:



A 'four round' approach makes it far harder to shoot myself in the foot, and that eight seconds was on a fairly heavily loaded system. The first three lines can safely be ignored unless and until you start getting 'in use' error messages, as of course can all of that output but not any other error messages which might appear.

For comparison the latest OpenEuphoria build instructions for Windows can be found here http://openeuphoria.org/wiki/view/Compiling41windows.wc and for Linux here http://openeuphoria.org/wiki/view/How%20to%20Compile%20Open%20Euphoria%20On%20Linux.wc and I suspect the same or worse is true for other programming languages; few if any can be rebuilt as easily or as quickly as Phix.

One of my favourite parlour tricks is to show 'p -cp' rebuild the compiler itself in around 8 seconds, then show 'p p p p p p p p -cp' stack 7 interpreted copies of itself on top of one another, and apart from ten or fifteen seconds longer to get started, it still completes in around the same time. Admittedly the timings shown on screen are from the rightmost "p -cp" only and would not agree with someone using a manual stopwatch, but all good fun and certainly several times faster than most would expect. Plus, in our little stack of eight compilers, the very top/last copy actually replaces the very bottom/first one!

I should note that in some (rare) cases 'p p -cp' may manage to 'leap-frog' a 'chicken and egg' situation that 'p -cp' cannot cope with, especially if you have tried to make too many changes to too many things in one step. If neither 'p -cp' nor 'p p -cp' can cope, you may need to re-work the changes into smaller discrete steps, sometimes with the 'old-style' and 'new-style' temporarily co-existing.

I do not currently ship a 64-bit version of Phix. For that you need to insert "format PE64" or "format ELF64" at the start of p.exw and recompile (p -cp). You may also want to copy/move from C:\Program Files (x86)\Phix to C:\Program Files\Phix. If all goes smoothly, the entire process can easily be completed in 30 seconds.

Optional system tweak: Recent Versions of Windows have WER (Windows Error Reporting) enabled by default. Without commenting on whether or not you may find that useful with released software, it is highly unlikely that going online to check for solutions to some problem in a program you have only just compiled is ever going to help. Should this become annoying, you might like to apply the following quick change to settings: On Windows 7, click on start and type "WER" (without the quotes) into the search box, select "Choose how to check for solutions", click on "Change report settings for all users" and instead of "Automatically check for solutions(recommended)" select "Each time a problem occurs, ask me before checking for solutions". As a bonus, you will get low-level diagnostics (code/address) via a "more details" button, that otherwise you would have to dig deep for. In truth, Phix should always catch errors before they ever get near WER, but that might cease to be true whilst making significant changes to the compiler itself.

See also Phix\sfx\phix\readme.txt if you want to set up some start menu entries.