home *** CD-ROM | disk | FTP | other *** search
- /* install.act --utilities to be used in the seal off process
-
- revision history:
-
- 02/01/88 mas -removeCompiler, removeNames, removeGlobals defined
- -cleanup redefined to not print to the display
- 03/16/88 mas -added the Object:fail method to prevent hanging
- if a message is not understood.
- 07/12/88 mzu -added the Object:error method to prevent hanging
- on untrapped high level errors.
- 07/21/88 acr -added the Object:primError method to prevent hanging
- on untrapped prim errors. */
-
- /* include an error handling routine to trap attempted execution of a
- non-existent method. The errorBox, asString, class and other
- related methods must also exist.
- */
-
- now(Object)!!
-
- /* This method is executed any time a
- late-bound message is not understood. */
- Def fail(self, stackTop, selector)
- { errorBox("Method not in system",
- "<a " + asString(class(self)) +
- "> does not understand " +
- asString(selector));
- abort(TheApp:late);
- }
- !!
-
- /* All high-level errors are handled via this
- method. The first parameter should be stackTop(),
- which gives a pointer to the activation of the
- caller. The second parameter is a symbol that
- describes the error. If the symbol is defined as
- an integer constant, the value is taken to be the
- ID of an error string. Executes abort (never
- returns).
-
- runtime version -- don't print a message or invoke debugger!
- mzu 07/12/88
- */
- Def error(self, stackTop, sym | str)
- {
- if not(str := errorString(sym))
- then str := loadString(343) + sym;
- endif;
-
- errorBox("Fatal runtime error", str);
- abort(TheApp:late);
- }
- !!
-
- /* All primitive errors are handled
- through this method. The second
- parameter is the primitive error number,
- which corresponds to an error string ID
- in the resource file.
-
- runtime version -- don't print a message or invoke debugger!
- */
- Def primError(self, stacktop, id | str)
- {
- if not(str := loadString(id))
- then str := loadString(343) + asString(id);
- endif;
-
- errorBox("Fatal runtime primitive error", str);
- abort(TheApp:late);
- }
- !!
-
- now(Behavior)!!
- Def removeMethods(self, coll)
- { do(coll, {using(sym)
- if methods[sym]
- print(self);
- print(":");
- print(remove(methods, sym));
- eol(ThePort);
- endif;});
- }!!
-
- now(Symbol)!!
- Def removeGlobal(self)
- { if assocAt(Actor,self)
- then print(self);
- Actor[self] := nil;
- remove(Actor,self);
- print(" removed."); eol(ThePort);
- endif;
- }!!
-
- now(Object)!!
-
- /* to avoid errors */
- Def removeMethods(self, dummy)
- {
- }!!
-
- Def removeNames(self)
- { classesDo(Actor,
- { using(cl) cl.name := nil;
- class(cl).name := nil;
- });
- }!!
-
-
- Def removeCompiler(self)
- { do( #(
- Lex Lex1 CurrentParser Parser Loader Analyzer
- ActorAnalyzer YaccMachine ActorParser
- ParseNode InfixNode EmptyList ListNode BlockNode RPN ImmedFunction
- IfNode IfElseNode LoopNode RetNode MsgNode CallNode
- CompileState Compiler IvChain AssgnNode IdNode
- WCalls WTraps Functions CVars
- InfixOps EarlyMethods SpecialMethods KeyWords
- Constants SourceFile Source
- CStream CompileBuf LoadBuf BlockTemps Demos
- Bug Context Debugger ActorApp
- ), {using(name) removeGlobal(name) });
- }!!
-
- now(File)!!
- /* redefine cleanup to NOT output to the display */
- Def cleanup(self | str)
- { initCache();
- str := new(String, 24);
- Call GetTempFileName(0,
- asciiz("ACT"), 0, str);
- setName(self, removeNulls(str));
- create(self);
- checkError(self);
- gc(self);
- delete(self);
- }
- !!
-
-