home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mega CD-ROM 1
/
megacd_rom_1.zip
/
megacd_rom_1
/
MAGAZINE
/
MSJOURNA
/
MSJV4_2B.ZIP
/
PROJECT.ZOO
/
act
/
fix_le.act
< prev
next >
Wrap
Text File
|
1988-10-20
|
8KB
|
311 lines
/* This file fixes all known bugs in Language Extensions I
This updates all releases to Version 1.2
If you are not using Object Storage, just load the first two
related to the methodBrowser.
version history:
mas 5/27/88 -- method browser errors
mas 10/17/88 -- literal rects, polygon, struct fixes
mas 5/23/88 -- object storage class redef error on structs
cbd 7/14/88 -- object store bad ID error on recursive objects
acr 10/17/88 -- storing of strings changed to accomodate ()s
strings are now stored as ("a string") instead of
just (a string). Old strings will load properly.
*/!!
/* This fixes a problem where the MethodBrowser could not be
recreated when the image is brought up. */!!
now(MethodBrowser)!!
/* Recreate self according to data in instance
variables. A recreate message is sent to window objects
in OpenWindows when Actor starts up. This method returns
nil, indicating no need to show self, since the start
method does it. */
Def recreate(self)
{ loadMenu(self, loadString(324));
create(self, parent, caption, locRect, WS_POPUPWIND);
start(self, classCol, nil);
^nil
}!!
/* This fixes a problem where if you change the number of local
variables in a method in the MBrowser, the method will appear
twice in the method list box. */!!
now(MethodBrowser)!!
/* Compile the method code in the edit window. */
Def accept(self | fSym, cl, oldMethod)
{ showWaitCurs(self);
cl :=
if mode == BR_CMETH
then class(selClass)
else selClass
endif;
oldMethod := cl.methods[selMethod];
fSym := compileText(ew, cl);
if fSym
then saveMethText(self, ew.workText, fSym);
rehash(classCol);
remove(classCol, oldMethod);
loadMethods(self);
selectString(lb1, methodName(self, fSym));
endif;
setFocus(ew);
showOldCurs(self);
invalidate(ew);
}!!
/* The next changes modify literals.act to accomodate Struct, Rect
Polygon properly. They go in the file LITERALS.ACT.
*/
now(StructClass)!!
/* Create a new Struct with the contents of the elements
array as its elements. */
Def build(self, elements | coll)
{ coll := new(self, size(elements) * 2);
do(size(elements),
{using(idx) putLong(coll, asLong(elements[idx]), idx * 2);
});
^coll
}!!
now(RectClass)!!
/* Create a new Rect with the contents of the elements
array as its elements. */
Def build(self, elements | coll)
{ coll := new(self);
do(size(elements),
{using(idx) putLong(coll, asLong(elements[idx]), idx * 2);
});
^coll
}!!
now(PolygonClass);!!
/* Create a new Polygon with the contents of the points
array as its elements. */
Def build(self, points | coll)
{ ^new(self, points)
}!!
/* These fixes are related to object storage.
The first five go in ACT\OBJSTORE.ACT.
*/
now(StructClass)!!
/* Read a stored instance of the receiver from a
stream. Modified for recursive objects. */
Def getNew(self, reader, id | obj len )
{ len := getNum(reader);
obj := variableNew(self:Behavior, len);
addObject(reader, id, obj);
sync(reader);
do(overBy(0, len, 2),
{using(x) obj[x] := next(reader);
});
^obj;
}!!
now(ObjectClass)!!
/* Read a stored instance of the receiver from a
stream. Modified to handle recursive objects. */
Def getNew(self, reader, id | obj len )
{ len := getNum(reader);
if len > 0
then obj := new(self, len)
else obj := new(self)
endif;
addObject(reader, id, obj);
do(variables(self),
{using(v) setVar(obj, next(reader), v);
});
sync(reader);
do(len,
{using(x) obj:Object[x] := next(reader);
});
^obj;
}!!
now(CharClass)!!
/* Modified to handle recursive objects. */
Def getNew(self, reader, id | obj)
{ obj := defString(reader)[0];
addObject(reader, id, obj);
^obj;
}!!
now(StringClass)!!
/* Modified to handle recursive objects and strings delimited
by double quotes. */
Def getNew(self, reader, id | obj)
{ obj := defStringString(reader);
addObject(reader, id, obj);
^obj;
}!!
now(SymbolClass)!!
/* Modified to handle recursive objects */
Def getNew(self, reader, id | obj)
{ obj := asSymbol(defString(reader));
addObject(reader, id, obj);
^obj;
}!!
/* The next five fixes go in CLASSES\STOREDOB.CLS */
now(StoredObjectReader)!!
/* Add a new object to the list of objects read.
Modified to handle recursive objects. */
Def addObject(self, id, obj)
{ add(inputTable, id, obj);
^obj;
}!!
/* Parse a global object.
Fixed to handle recursive objects. */
Def global(self, id | obj sym)
{ sym := getSym(self);
if (obj := isMetaName(sym))
then ^addObject(self, id, obj := class(Actor[obj.key]));
endif;
if sym == #nil
then ^nil
endif;
if not(obj := Actor[sym])
then error(self, stackTop(), #undefGlobalError);
endif;
^addObject(self, id, obj);
}!!
/* Finish parsing a full stored object structure
from the input stream. Call readNew of the class
to parse the private data of the object.
Fixed to handle recursive objects. */
Def full(self, id | class obj)
{
if not(class := getClass(self))
then error(self, stackTop(), #undefClassError);
endif;
next(inputStream);
obj := getNew(class, self, id);
if not(atEnd(inputStream))
then next(inputStream);
endif;
^obj;
}!!
/* Parse a literal number from the input stream.
Modified to handle recursive objects. */
Def literal(self, id | obj)
{ obj := getNum(self);
addObject(self, id, obj);
^obj;
}!!
/* Return the next object that is stored on the
input stream. Return nil if none is available
or end of stream. Modified for recursive objects. */
Def next(self | id type obj)
{ id := getNum(self);
if (type := defType(self)) ~= #alias
then obj := perform(self, id, type);
if isAncestor(class(obj), KeyedCollection) cor
isAncestor(class(obj), Set)
then add(hashedObjects, obj);
endif;
^obj;
else
if obj := assocAt(inputTable, id)
then ^obj.value
else if atEnd(inputStream)
then error(self, stackTop(), #eosError);
endif;
error(self, stackTop(), #badIdError);
endif;
endif;
}!!
/* The next changes modify how strings are stored. This allows strings
to contain ()s but not double quotes. Both the old string format and
the new one will be handled properly. These go in OBJSTORE.ACT.
*/!!
now(Stream)!!
/* Return the string, scanning until delim.
The starting position is the first character of the string.
Check for an error if the delim is not found.
*/
Def copyString(self, delim | endPos, aStr)
{ endPos := find(collection, delim, position);
if not(endPos)
error(self, stackTop(), #eosError);
endif;
aStr := subString(collection, position, endPos);
position := endPos + 1;
^aStr
}!!
now(File)!!
/* Return the string, scanning until delim.
The starting position is the first character of the string.
Check for an error if the delim is not found.
*/
Def copyString(self, delim | start, aStr, length, index)
{ start := position(self);
length := size(delim);
index := 0;
loop
while (index < length) cand not(atEnd(self))
if delim[index] == next(self)
index := index + 1
else
index := 0
endif
endLoop;
if atEnd(self) cand index == 0
error(self, stackTop(), #eosError);
endif;
aStr := copyFrom(self, start, position(self)-2);
next(self);
^aStr
}!!
now(StoredObjectReader)!!
/* Return the string from the input stream that constitutes
the definition of the current String object. This will work
for strings delimited by quotes (e.g. ("String")) or those
stored under previous versions without quotes (e.g. (String)). */
Def defStringString(self | str)
{
if next(inputStream) == '"' /* new way */
^copyString(inputStream, asString('"') + ")");
else
putBack(inputStream); /* old way */
^copyWhile(inputStream, {using(ch) ch ~= ')'});
endif;
}!!
now(String)!!
/* Store a string within quotes */
Def storeDefinitionOn(self, stream, table)
{ nextPutAll(stream, asString('"') + asString(self) + asString('"'));
}!!