[comp.lang.smalltalk] LOADER

sukumar@ut-emx.UUCP (sukumar) (08/23/90)

I have an application in which i have a complicated object. I would
like to save th eobject on a file and later restore it.

is there any easy way to do it in V/286. The old V had a loader
which would have done the job. Apparently V/286 does not.

Any hints/suggestions are welcome.

Please reply by MAIL to sukumar@vondrake.cc.utexas.edu

thanks

sukumar r.


-- 
Sukumar Rathnam 
Multi Participant Task Support Systems Research Group, CMIS UT Austin.
Internet : sukumar@emx.utexas.edu
Home : #3011 Whitis Avenue, Apt #106, Austin TX 78705. Tel: 512-474-2771
Office : MSIS Dept., CBA 5.202, The University Of Texas, Austin TX 78712

klimas@iccgcc.decnet.ab.com (08/25/90)

In article <36638@ut-emx.UUCP>, sukumar@ut-emx.UUCP (sukumar) writes:
> I have an application in which i have a complicated object. I would
> like to save th eobject on a file and later restore it.
> 
> is there any easy way to do it in V/286. The old V had a loader
> which would have done the job. Apparently V/286 does not.
> 
> Any hints/suggestions are welcome.
	V286 does come with some code for crossloading V objects into
	V286 images and vice versa.  There is a real simple modification to the
	crossloader coad to make it fully V286 compliant.  I don't remember
	what the exact modification was but it was no big deal if
	you take a look at the code.

sukumar@emx.utexas.edu (Sukumar Rathnam) (09/05/90)

Here is the summary of responses I received about the loader.
As an interesting side effect I have a hack which will save object
instances. I apologize for the delay as our m/c was undergoing
a triple coronory by-pass and a major OS upgrade.
------------------------------------------------------------------

From: Michael Felt <michael@psy.vu.nl>
Since you have the old loader the only change you need to make
is a statement using the method becomes:

In V becomes: swaps both sides while in /286 it is only
a becomes: b (i.e. b does not also become a).

Further, I know that digitalk has been working on a new
loader that doesn't use becomes: at all (becomes: on /286 is SLOW!)

And, by the way, with this patch the loader also works on
smalltalk mac.

michael


From: RICK@and.cs.liv.ac.uk
Subject:        LOADER
   I think this may do what you want. Its part of the Gnu Smalltalk system, and
is used for on demand loading of class definitions. If you have a class called
Fish, in a file Fish.st, you just evaluate the expression:

   Autoload class: #Fish from: 'Fish.st'

Ive only been writing Smalltalk for a short while, and have never used Digitalk,
so Im not certain that it will work, but its probably worth a try.

Since Autoload is covered by the Gnu general licence, I have to tell you where
to get the rest of Gnu Smalltalk from. You can get it from sevevral of the
anonymous ftp sites in the US - wuarchive.wustl.edu is one. Its quite a good
system, considering its still under development, and free. When version 1.2 is
released its probably worth looking at, if you have a machine on which it will
run.

Let me know if it works or not, or if you need a hand, 

        Rick.

        Liverpool University 
        Computer Science Department.


--------------------------------------------------------------------------------

Object subclass: #Autoload
       instanceVariableNames: 'className fileName'
       classVariableNames: ''
       poolDictionaries: ''
       category: 'Cool hacks' !

Autoload comment:
'I am not a part of the normal Smalltalk kernel class system.  I provide the
ability to do late-loading or "on demand loading" of class definitions.
Through me, you can define any class to be loaded when any message is sent to
the class itself (such as to create an instance).' !

!Autoload class methodsFor: 'instance creation'!

class: classNameString from: fileNameString
    ^Autoload new autoloadInitClass: classNameString 
		  initFile: fileNameString
!!


!Autoload methodsFor: 'accessing'!

doesNotUnderstand: aMessage
    | s |
    Smalltalk removeKey: className.
    FileStream fileIn: fileName.
    ^aMessage reinvokeFor: (Smalltalk at: className
				      ifAbsent: [ ^Autoload error: 
'Autoloaded file should have defined class "', className, '" but didn''t' ])
!!



!Autoload methodsFor: 'private'!

autoloadInitClass: aClassName initFile: aFileName
    className _ aClassName asSymbol.
    Smalltalk at: className put: self.
    fileName _ aFileName.
!!

Autoload superclass: nil!	"force undefined methods"