changed System signal: to aSemaphore signal:

This commit is contained in:
hyunghwan.chung 2018-06-19 16:58:04 +00:00
parent a6d72b928c
commit d8c0453ddd
3 changed files with 32 additions and 24 deletions

View File

@ -21,6 +21,15 @@ class Collection(Object)
^count ^count
} }
method add: object
{
self subclassResponsibility: #add:.
}
## ===================================================================
## ENUMERATION
## ===================================================================
method do: block method do: block
{ {
^self subclassResponsibility: #do ^self subclassResponsibility: #do
@ -37,13 +46,6 @@ class Collection(Object)
^exception_block value. ^exception_block value.
} }
(* ------------------- TODO -------------------------------
method add: object
{
self subclassResponsibility: #add:.
}
*)
method collect: block method collect: block
{ {
| coll | | coll |
@ -924,32 +926,38 @@ class Set(Collection)
method do: block method do: block
{ {
| bs | | bs i ass |
bs := self.bucket size. bs := self.bucket size.
0 priorTo: bs by: 1 do: [:i | i := 0.
| ass | while (i < bs)
{
if ((ass := self.bucket at: i) notNil) { block value: ass value }. if ((ass := self.bucket at: i) notNil) { block value: ass value }.
]. i := i + 1.
}.
} }
method keysDo: block method keysDo: block
{ {
| bs | | bs i ass |
bs := self.bucket size. bs := self.bucket size.
0 priorTo: bs by: 1 do: [:i | i := 0.
| ass | while (i < bs)
{
if ((ass := self.bucket at: i) notNil) { block value: ass key }. if ((ass := self.bucket at: i) notNil) { block value: ass key }.
]. i := i + 1.
}.
} }
method keysAndValuesDo: block method keysAndValuesDo: block
{ {
| bs | | bs i ass |
bs := self.bucket size. bs := self.bucket size.
0 priorTo: bs by: 1 do: [:i | i := 0.
| ass | while (i < bs)
{
if ((ass := self.bucket at: i) notNil) { block value: ass key value: ass value }. if ((ass := self.bucket at: i) notNil) { block value: ass key value: ass value }.
]. i := i + 1.
}.
} }
} }

View File

@ -95,7 +95,7 @@ class MyObject(Object)
(ffi call: #printf signature: 's|iis)i' arguments: #(S'A=>%d B=>%d Hello, world %s\n' 1 2 'fly away')) dump. (ffi call: #printf signature: 's|iis)i' arguments: #(S'A=>%d B=>%d Hello, world %s\n' 1 2 'fly away')) dump.
(ffi call: #printf signature: 's|iis)i' arguments: #(S'A=>%d B=>%d Hello, world %s\n' 1 2 'jump down')) dump. (ffi call: #printf signature: 's|iis)i' arguments: #(S'A=>%d B=>%d Hello, world %s\n' 1 2 'jump down')) dump.
ffi close. ffi close.
}. }.
(('abcd' == 'abcd') ifTrue: [1] ifFalse: [2]) dump. (('abcd' == 'abcd') ifTrue: [1] ifFalse: [2]) dump.
} }
@ -325,7 +325,7 @@ i := 0.
while (i < 26) while (i < 26)
{ {
a putUint8(i, ($A asInteger + i)). a putUint8(i, ($A asInteger + i)).
System _putUint8(a, i, ($A asInteger + i)). System putUint8(a, i, ($A asInteger + i)).
i := i + 1. i := i + 1.
}. }.
while (i > 0) while (i > 0)

View File

@ -110,7 +110,7 @@ class System(Apex)
## ----------------------------------------------------- ## -----------------------------------------------------
| s | | s |
s := Semaphore new. s := Semaphore new.
self signal: s afterSecs: secs. s signalAfterSecs: secs.
s wait. s wait.
} }
@ -121,7 +121,7 @@ class System(Apex)
## ----------------------------------------------------- ## -----------------------------------------------------
| s | | s |
s := Semaphore new. s := Semaphore new.
self signal: s afterSecs: secs nanosecs: nanosecs. s signalAfterSecs: secs nanosecs: nanosecs.
s wait. s wait.
} }
} }