www.delorie.com/gnu/docs/smalltalk/gst_19.html   search  
 
Buy GNU books!


GNU Smalltalk User's Guide

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.7 Packages

Thanks to Andreas Klimas' insight, GNU Smalltalk now includes a powerful packaging system which allows one to file in components (goodies in Smalltalk's very folkloristic terminology) without caring of whether they need other goodies to be loaded.

The packaging system is implemented by a Smalltalk class, PackageLoader, which looks for information about packages in the file named (guess what) `packages', in the current image directory. There are two ways to load something using the packaging system. The first way is to use the PackageLoader's fileInPackage: and fileInPackages: methods. For example:
 
    PackageLoader fileInPackages: #('Blox' 'Browser').
    PackageLoader fileInPackage: 'Compiler'.

The second way is to use the `Load.st' file which lies in the GST image directory. For example, start GNU Smalltalk with this command line:

gst -qsK Load.st -a Browser Blox Compiler(5)

and GST will automatically file in:

Then it will save the Smalltalk image, and finally exit!

To provide support for this system, you have to give away with your GST goodies a small file (say you call it `mypkg') which looks like this:
 
# This is the comment for the package file for
# the absolutely WONDERFUL package MyPackage

MyPackage
    MyPrereq1 MyPrereq2 C:MyCallout1 C:MyCallout2
    MyFilein1.st MyFilein2.st libmymodule
    yourDirectoryName      # absolute or relative to packages file's path

then people who install your package will only have to do
 
    gst-package mypkg

which is a small shell script which will execute these two commands
 
    cat mypkg >> packages
    gst -qsK Load.st -a MyPackage

Simple, isn't it? For examples of package declarations, have a look at the `packages' file as distributed with GNU Smalltalk.

The rest of this chapter discusses the packages provided with GNU Smalltalk.

2.7.1 Blox  
2.7.2 The Smalltalk-in-Smalltalk compiler  
2.7.3 Internationalization and localization support  
2.7.4 The SUnit testing package  
2.7.5 TCP, WebServer, NetClients  
2.7.6 An XML parser and object model for GNU Smalltalk  
2.7.7 Minor packages  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003