Using BLITZ under Windows

 

 

 

Harry H. Porter III, Ph. D.

Department of Computer Science

Portland State University

 

T.J. Craig

Westminster College

Salt Lake City

 

March 25, 2009

 



 

 

 

Introduction

 

BLITZ can be used under the Windows operating system and this document describes how.

 

To run under Windows, youÕll have to use a third-party package called Cygwin.  Cygwin makes it possible to run most Linux / Unix programs under Windows.  This document includes information about installing Cygwin and then installing BLITZ.

 

This has been tested for Windows XP using the current version of Cygwin (1.5.25-15) on March 25, 2009.

 

 

 

Step 1: Download and Install Cygwin

 

Download and install Cygwin from

 

http://www.cygwin.com

 

Cygwin is a UNIX emulator that runs on Windows.  When you download and install it from the Cygwin website, you can select all the default settings, except that BLITZ will require additional libraries that are not part of the default installation.  You must individually select these additional libraries during the Cygwin installation or BLITZ will not run correctly.

 

When you get to the ÒSelect PackagesÓ screen, add the following packages:

 

á      Devel  - gcc-g++: C++ compiler

á      Devel  - gcc4-g++: G++ subpackage

á      Devel  - make

 

When you select the above options, several other dependent components will automatically be selected.  Do not change any of these.  Let Cygwin automatically include related components.

 

Note that the installation does not include any text editors by default.  YouÕll need to edit files; you can either edit the files through Windows or you can also install Unix editors like ÒviÓ and ÒemacsÓ with Cygwin.  The Unix editors can be found in the ÒEditorsÓ section of the Cygwin installation list.

 

á      Editors - VI (vim)

á      Editors - EMACs

 

 

 

Step 2: Create ÒBlitzSrcÓ Folder

 

Create a folder in your home area in Cygwin called ÒBlitzSrcÓ.  You can either do this via the Windows host (using something like Explorer) or directly in the Cygwin shell, with the following Unix command:

 

mkdir ~/BlitzSrc

 

You may also want to take a minute to edit your Ò.bashrcÓ file at this point, to customize your aliases, etc., if this is something that you are familiar with.

 

 

 

Step 3: Download BLITZ Source Files

 

Download all the files from the BLITZ web site and place them in your new BlitzSrc directory.  The files can be found at:

 

http://www.cs.pdx.edu/~harry/Blitz/BlitzSrc

 

You can use the FTP program to transfer the files from the BLITZ website (the ÒremoteÓ) to your computer (the ÒlocalÓ).  First, get into your new directory and start up FTP:

 

cd ~/BlitzSrc

ftp ftp.cs.pdx.edu

 

FTP will require you to log in; use the name

 

anonymous

 

You'll be asked to provide your email address as a password.

 

Then, within FTP at the Òftp>Ó prompt, change directory on the remote:

 

cd /pub/users/harry/Blitz/BlitzSrc

 

To list all the files in the remote directory, type:

 

ls

 

FTP tends to assume that files contain ASCII text and will automatically translate the end-of-line characters from NL to CR-NL.  This will create a problem, so switch from ASCII mode to BINARY mode with the command:

 

binary

 

To copy all files from the remote directory into the current directory on your local machine, type

 

mget *

 

Note that the file Òmakefile-SolarisÓ is not required, but it wonÕt hurt.

 

To suppress verbose interaction, answer ÒaÓ to the Òmget filename [anpqy?]?Ó prompt, if it appears.

 

Other useful FTP commands are

 

get <filename>, help, quit, pwd

 

For further info on FTP, google the web with:

 

man ftp

 

If you are using a Windows browser to download the files, the browser may try to save the ÒmakefileÓ file as Òmakefile.txtÓ.  If this happens, use the ÒmvÓ command in the Cygwin shell to rename the file to just ÒmakefileÓ with no extension.  You must do this from the Cygwin shell:

 

mv makefile.txt makefile

 

This is important, because as you download other files without extensions, you will need to rename them for use with BLITZ.

 

You should have these files:

 

asm.c

ast.cc

ast.h

blitz.c

check.c

check.cc

diskUtil.c

dumpObj.c

endian.c

gen.cc

hexdump.c

ir.cc

ir.h

lddd.c

lexer.cc

main.cc

main.h

makefile

makefile-Solaris   (this file is not needed)

mapping.cc

parser.cc

printAst.cc

 

 

 

 

Step 4: Compile the BLITZ Source

 

Compile the downloaded files by running the Unix ÒmakeÓ utility:

 

cd ~/BlitzSrc

make

 

Make will generate several lines of output, but you should not see any errors.  If you do see errors go back and verify that all the required Cygwin libraries were downloaded and that all the required BLITZ files were downloaded and placed in the BlitzSrc directory.

 

You should now have the following new files in this directory:

 

asm.exe

ast.o

blitz.exe

check.exe

check.o

diskUtil.exe

dumpObj.exe

endian.exe

gen.o

hexdump.exe

ir.o

kpl.exe

lddd.exe

lexer.o

main.o

mapping.o

parser.o

printAst.o

 

You can remove the Ò.oÓ files with this command:

 

rm *.o

 

 

 

Step 5: Create ÒBlitzToolsÓ Directory & Move Executables

 

Create a new directory called ÒBlitzToolsÓ in your home area and move the executables into it.  You can use either the Windows host or the following commands in the Cygwin shell:

 

mkdir ~/BlitzTools

mv ~/BlitzSrc/*.exe ~/BlitzTools

 

You should now see the following files with the ÒlsÓ command:

 

ls ~/BlitzTools

asm.exe      check.exe      dumpObj.exe    hexdump.exe    lddd.exe

blitz.exe    diskUtil.exe   endian.exe     kpl.exe

 

 

 

Step 6: Set the PATH Environment

 

Setup the shellÕs PATH environment variable so that you can use the BLITZ tools.

 

By default Cygwin only installs the Bash shell, so youÕll need to use the ÒexportÓ command to change the PATH variable.  However, simply running the ÒexportÓ command in your Cygwin shell will only set the path temporarily.  Unfortunately, it will be reset every time you restart the Cygwin shell.

 

To make the change permanent, edit the file

 

.bashrc

 

in your home directory.  If you know the ÒviÓ editor, type:

 

vi ~/.bashrc

 

and add the following line to the end of the file:

 

export PATH=${HOME}/BlitzTools:${PATH}

 

 

 

Step 7: Make Sure Everything Works

 

Next, verify that the BLITZ tools are working and usable.  Type the following command:

 

kpl

 

You should see:

 

*****  ERROR: Missing package name on command line

 

**********  1 error detected!  **********

 

If you see this message, Cygwin is configured correctly to run BLITZ.

 

If you see ANYTHING else, BLITZ is NOT setup correctly and you need to go back and review each step. 

 

You are now ready for the first BLITZ project!