Often, a Logo program needs additional resources, like sounds or images. When you distribute a Logo program, you cannot rely on these resources to be present on the target computer.
Fortunately, Terrapin Logo 4 can help you. Version 4 of Terrapin Logo can load entire Zip file archives that may contain any number of Logo files, images, and other resources. If you rename the file extension of such an archive file from
logobin, you can even double-click such a file, and Logo launches and executes the programs stored inside that archive.
When Logo loads a package file, it sets the current folder to the loaded file's folder. This is mostly irrelevant for zipped archive files, but important for Logo source files. Also, it remembers the path of the archive file, and tries to load files from that archive if it cannot find a file on disk.
Of course, nothing is as easy as it seems to be. Several restrictions apply that must be kept in mind if you create a Zip archive file.
A Zip archive can contain subfolders, but Logo only auto-loads Logo files that it finds at the Zip archive's top level. Therefore, make sure that you do not zip a folder containing your Logo program and its resources, but rather all files inside your program folder.
Logo can load files out of subfolders inside a Zip archive just fine if you specify the full path name of the file. See the example below.
When Logo scans a Zip archive for Logo files, it loads these files in any order they happen to be. Logo defines the procedures and runs all top level code in each file as it loads them. If your Logo files contain top-level commands as your program, Logo may run them before all files have been loaded, and parts of your program may not be ready to execute. Therefore, you must bundle your program commands in a procedure called
MAIN. After Logo has loaded all Logo files and run all top-level commands, Logo looks up the
MAIN procedure and runs it, which would be your program. If Logo does not find a procedure named
MAIN, it displays an error message and exits.
Logo cannot treat folders inside a Zip file as normal folders. Therefore, folder commands like
SETCURDIR do not work for Zip files. You can, however, use relative paths to address your files inside a Zip archive. This command:
would load the shape
MOOSE.BMP out of a zipped folder
SHAPES inside the Zip file.
SETCURDIRcommand to set the current folder to the folder that you intend to archive so relative path references work before you run your procedures.
Every time you load a Zip archive, Logo remembers the name of that file as an additional location to search for files. Logo only remembers the last loaded file, so every new load of a Zip file makes Logo forget the location of any previously loaded Zip files.
LOADcommand, Logo stops and displays the usual error dialog.
logobinso a double-click on a
logobinfile opens Logo instead of your favorite Zip file handler.