fixed the invalid memory access issue in moo_compucharsucstr() and similar functions.
added the log.default_type_mask field restructured the builtin primitive function table
This commit is contained in:
		| @ -312,8 +312,10 @@ extend Error | ||||
| 		^false | ||||
| 	} | ||||
|  | ||||
| 	method(#primitive) asInteger. | ||||
| 	method(#primitive) asCharacter. | ||||
| 	method asError { ^self } | ||||
| 	method(#primitive) asInteger. | ||||
|  | ||||
| 	method(#primitive) asString. | ||||
|  | ||||
| 	method signal | ||||
|  | ||||
| @ -1,5 +1,24 @@ | ||||
| class Magnitude(Object) | ||||
| { | ||||
| 	method <  aMagnitude { self subclassResponsibility: #<	} | ||||
| 	method >  aMagnitude { ^aMagnitude < self } | ||||
| 	method <= aMagnitude { ^(aMagnitude < self) not } | ||||
| 	method >= aMagnitude { ^(self < aMagnitude) not } | ||||
|      | ||||
| 	method between: min and: max  | ||||
| 	{ | ||||
| 		^self >= min and: [self <= max] | ||||
| 	} | ||||
|  | ||||
| 	method min: aMagnitude | ||||
| 	{ | ||||
| 		^self < aMagnitude ifTrue: [self] ifFalse: [aMagnitude] | ||||
| 	} | ||||
|  | ||||
| 	method max: aMagnitude | ||||
| 	{ | ||||
| 		^self > aMagnitude ifTrue: [self] ifFalse: [aMagnitude] | ||||
| 	} | ||||
| } | ||||
|  | ||||
| class Association(Magnitude) | ||||
| @ -45,59 +64,17 @@ class Association(Magnitude) | ||||
|  | ||||
| class(#limited) Character(Magnitude) | ||||
| { | ||||
| ##	method(#primitive,#class) fromCode: code. | ||||
| ##	method(#primitive) toCode. | ||||
| ##	method(#primitive,#class) codePoint: code. | ||||
| ##	method(#primitive) codePoint. | ||||
|  | ||||
| 	method asCharacter { ^self } | ||||
| 	method(#primitive) asError. | ||||
| 	method(#primitive) asInteger. | ||||
|  | ||||
| 	method = aCharacter | ||||
| 	{ | ||||
| 		<primitive: #Character_eq> | ||||
| 		self primitiveFailed. | ||||
| 	} | ||||
|  | ||||
| 	method ~= char | ||||
| 	{ | ||||
| 		<primitive: #Character_ne> | ||||
| 		self primitiveFailed. | ||||
| 	} | ||||
|  | ||||
| 	method < char | ||||
| 	{ | ||||
| 		<primitive: #Character_lt> | ||||
| 		self primitiveFailed. | ||||
| 	} | ||||
|  | ||||
| 	method > char | ||||
| 	{ | ||||
| 		<primitive: #Character_gt> | ||||
| 		self primitiveFailed. | ||||
| 	} | ||||
|  | ||||
| 	method <= char | ||||
| 	{ | ||||
| 		<primitive: #Character_le> | ||||
| 		self primitiveFailed. | ||||
| 	} | ||||
|  | ||||
| 	method >= char | ||||
| 	{ | ||||
| 		<primitive: #Character_ge> | ||||
| 		self primitiveFailed. | ||||
| 	} | ||||
| 	 | ||||
| 	method - char | ||||
| 	{ | ||||
| 		<primitive: #Character_sub> | ||||
| 		^(self asInteger - char asInteger) asCharacter | ||||
| 	} | ||||
| 	 | ||||
| 	method + char | ||||
| 	{ | ||||
| 		<primitive: #Character_add> | ||||
| 		^(self asInteger + char asInteger) asCharacter | ||||
| 	} | ||||
|  | ||||
| 	method(#primitive) < char. | ||||
| 	method(#primitive) > char. | ||||
| 	method(#primitive) <= char. | ||||
| 	method(#primitive) >= char. | ||||
| } | ||||
|  | ||||
| class(#limited) Number(Magnitude) | ||||
| @ -345,15 +322,12 @@ class(#limited) Integer(Number) | ||||
| 		count := 0. | ||||
| 		while (count < self) { aBlock value. count := count + 1 } | ||||
| 	} | ||||
| 	 | ||||
| 	method asInteger { ^self } | ||||
| } | ||||
|  | ||||
| class(#limited) SmallInteger(Integer) | ||||
| { | ||||
| 	## method basicSize | ||||
| 	## { | ||||
| 	## 	^0 | ||||
| 	## } | ||||
|  | ||||
| 	method(#primitive) asCharacter. | ||||
| 	method(#primitive) asError. | ||||
| } | ||||
|  | ||||
| @ -371,29 +371,6 @@ class(#final,#limited) ProcessScheduler(Object) | ||||
| 	var(#get) suspended_count := 0. | ||||
| 	var suspended_head, suspended_tail. | ||||
|  | ||||
| 	method activeProcess | ||||
| 	{ | ||||
| 		^self.active. | ||||
| 	} | ||||
|  | ||||
| 	method resume: process | ||||
| 	{ | ||||
| 		<primitive: #_processor_schedule> | ||||
| 		self primitiveFailed. | ||||
|  | ||||
| 		(* The primitive does something like the following in principle: | ||||
| 		(self.tally == 0) | ||||
| 			ifTrue: [ | ||||
| 				self.head := process. | ||||
| 				self.tail := process. | ||||
| 				self.tally := 1. | ||||
| 			] | ||||
| 			ifFalse: [ | ||||
| 				process ps_next: self.head. | ||||
| 				self.head ps_prev: process. | ||||
| 				self.head := process. | ||||
| 				self.tally := self.tally + 1. | ||||
| 			]. | ||||
| 		*) | ||||
| 	} | ||||
| 	method activeProcess { ^self.active } | ||||
| 	method resume: aProcess { ^aProcess resume } | ||||
| } | ||||
|  | ||||
| @ -57,7 +57,7 @@ class(#byte) IP4Address(IPAddress) | ||||
| 				if (acc > 255) { Exception signal: ('invalid IPv4 address B ' & str). }. | ||||
| 				digits := digits + 1. | ||||
| 			} | ||||
| 			elsif (c == $.) | ||||
| 			elsif (c = $.) | ||||
| 			{ | ||||
| 				if (dots >= 3 or: [digits == 0]) { Exception signal: ('invalid IPv4 address C ' & str). }. | ||||
| 				self basicAt: dots put: acc. | ||||
|  | ||||
		Reference in New Issue
	
	Block a user