touched up primitive failure handling a bit
This commit is contained in:
		| @ -53,28 +53,17 @@ extend Apex | ||||
|  | ||||
| 	method(#class,#primitive) basicNew. | ||||
| 	method(#class,#primitive) basicNew: size. | ||||
| 	 | ||||
| 	(* | ||||
| 	method(#class) basicNew | ||||
| 	{ | ||||
| 		| perr | | ||||
| 		<primitive: #Apex__basicNew> | ||||
| 		self primitiveFailed. | ||||
|  | ||||
| 	##	perr := thisProcess primError. | ||||
| 	##	if (perr == xxxx) { self cannotInstantiate } | ||||
| 	##	else { self primitiveFailed }. | ||||
| 	} | ||||
| 	 | ||||
| 	(* the following definition is almost equivalent to the simpler definition | ||||
| 	 *    method(#class,#primitive) basicNew: size. | ||||
| 	 * found above. | ||||
| 	 * in the following defintion, the primitiveFailed method is executed  | ||||
| 	 * from the basicNew: context. but in the simpler definition, it is executed | ||||
| 	 * in the context of the caller of the basicNew:. the context of the basicNew: | ||||
| 	 * method is not even created | ||||
| 	method(#class) basicNew: size | ||||
| 	{ | ||||
| 		| perr | | ||||
| 		<primitive: #Apex__basicNew:> | ||||
| 		self primitiveFailed. | ||||
|  | ||||
| 	##	perr := thisProcess primError. | ||||
| 	##	if (perr == xxxx) { self cannotInstantiate } | ||||
| 	##	else { self primitiveFailed }. | ||||
| 		self primitiveFailed(thisContext method) | ||||
| 	}*) | ||||
|  | ||||
| 	method(#class) new | ||||
|  | ||||
| @ -2,19 +2,13 @@ | ||||
| ## the Class object should be a variable-pointer object because | ||||
| ## it needs to accomodate class instance variables. | ||||
| ## | ||||
| class(#pointer) Class(Apex) | ||||
| class(#pointer,#limited) Class(Apex) | ||||
| { | ||||
| 	var spec, selfspec, superclass, subclasses, name, modname. | ||||
| 	var instvars, classinstvars, classvars, pooldics. | ||||
| 	var instmthdic, classmthdic, nsdic, cdic. | ||||
| 	var trsize, initv, initv_ci. | ||||
|  | ||||
| 	method(#class) basicNew | ||||
| 	{ | ||||
| 		## you must not instantiate a new class this way. | ||||
| 		self cannotInstantiate. | ||||
| 	} | ||||
|  | ||||
| 	method(#class) initialize | ||||
| 	{ | ||||
| 		^self. | ||||
|  | ||||
| @ -379,10 +379,6 @@ class PrimitiveFailureException(Exception) | ||||
| { | ||||
| } | ||||
|  | ||||
| class InstantiationFailureException(Exception) | ||||
| { | ||||
| } | ||||
|  | ||||
| class NoSuchMessageException(Exception) | ||||
| { | ||||
| } | ||||
| @ -413,30 +409,22 @@ class ProhibitedMessageException(Exception) | ||||
|  | ||||
| extend Apex | ||||
| { | ||||
| 	method(#dual,#variadic) primitiveFailed() | ||||
| 	method(#dual,#liberal) primitiveFailed(method) | ||||
| 	{ | ||||
| 		| a b | | ||||
| 		 | ||||
| 		thisContext vargCount dump. | ||||
| 		a := 1. | ||||
| 		| a b msg | | ||||
|  | ||||
| 		(*System logNl: 'Arguments: '. | ||||
| 		a := 0. | ||||
| 		b := thisContext vargCount. | ||||
| 'PRIMITIVE FAILED............................................' dump. | ||||
| self dump. | ||||
| 		while (a < b) | ||||
| 		{ | ||||
| 			(thisContext vargAt: a) dump. | ||||
| 			System logNl: (thisContext vargAt: a) asString. | ||||
| 			a := a + 1. | ||||
| 		}. | ||||
| 	 | ||||
| ('PRIMITIVE FAILED....' & (thisContext vargAt: 0)) dump. | ||||
| 	 | ||||
| 		PrimitiveFailureException signal: 'PRIMITIVE FAILED'. | ||||
| 	} | ||||
|  | ||||
| 	method(#dual) cannotInstantiate | ||||
| 	{ | ||||
| 		## TODO: use displayString or something like that instead of name.... | ||||
| 		InstantiationFailureException signal: 'Cannot instantiate ' & (self name). | ||||
| 		}.*) | ||||
| 		 | ||||
| 		msg := thisProcess primError asString. | ||||
| 		if (method notNil) { msg := msg & ' - ' & (method owner name) & '<<' & (method name) }. | ||||
| 		PrimitiveFailureException signal: msg. | ||||
| 	} | ||||
|  | ||||
| 	method(#dual) doesNotUnderstand: message_name | ||||
|  | ||||
| @ -3,18 +3,6 @@ class(#pointer,#final,#limited) Process(Object) | ||||
| { | ||||
| 	var initial_context, current_context, state, sp, prev, next, sem, perr. | ||||
|  | ||||
| 	method(#class) basicNew | ||||
| 	{ | ||||
| 		(* instantiation is not allowed. a process is strictly a VM managed object *) | ||||
| 		self cannotInstantiate | ||||
| 	} | ||||
| 	 | ||||
| 	method(#class) basicNew: size  | ||||
| 	{ | ||||
| 		(* instantiation is not allowed. a process is strictly a VM managed object *) | ||||
| 		self cannotInstantiate | ||||
| 	} | ||||
|  | ||||
| 	method prev { ^self.prev } | ||||
| 	method next { ^self.next } | ||||
|  | ||||
|  | ||||
| @ -229,22 +229,10 @@ class X11.GC(Object) from 'x11.gc' | ||||
| ## --------------------------------------------------------------------------- | ||||
|  | ||||
|  | ||||
| class X11.Component(Object) | ||||
| class(#limited) X11.Component(Object) | ||||
| { | ||||
| 	var parent. | ||||
|  | ||||
| 	method new | ||||
| 	{ | ||||
| 		## you must call new: parent instead. | ||||
| 		self cannotInstantiate | ||||
| 	} | ||||
|  | ||||
| 	method new: parent | ||||
| 	{ | ||||
| 		## you must call new: parent instead. | ||||
| 		self cannotInstantiate | ||||
| 	} | ||||
|  | ||||
| 	method parent | ||||
| 	{ | ||||
| 		^self.parent | ||||
|  | ||||
		Reference in New Issue
	
	Block a user