Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
19
Task/Events/LFE/events.lfe
Normal file
19
Task/Events/LFE/events.lfe
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
(defun log (msg)
|
||||
(let ((`#(,h ,m ,s) (erlang:time)))
|
||||
(lfe_io:format "~2.B:~2.B:~2.B => ~s~n" `(,h ,m ,s ,msg))))
|
||||
|
||||
(defun task ()
|
||||
(log "Task start")
|
||||
(receive
|
||||
('go 'ok))
|
||||
(log "Task resumed"))
|
||||
|
||||
(defun run ()
|
||||
(log "Program start")
|
||||
(let ((pid (spawn (lambda () (task)))))
|
||||
(progn
|
||||
(log "Program sleeping")
|
||||
(timer:sleep 1000)
|
||||
(log "Program signalling event")
|
||||
(! pid 'go)
|
||||
(timer:sleep 100))))
|
||||
9
Task/Events/Lingo/events-1.lingo
Normal file
9
Task/Events/Lingo/events-1.lingo
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
-- the current window was closed
|
||||
on closeWindow
|
||||
...
|
||||
end
|
||||
|
||||
-- the left mouse button was pressed by the user
|
||||
on mouseDown
|
||||
...
|
||||
end
|
||||
8
Task/Events/Lingo/events-2.lingo
Normal file
8
Task/Events/Lingo/events-2.lingo
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
-- send event #mouseDown programmatically to sprite 1
|
||||
sendSprite(1, #mouseDown)
|
||||
|
||||
-- send custom event #foo to named sprite "bar"
|
||||
sendSprite("bar", #foo)
|
||||
|
||||
-- send custom event #fooBar to all existing sprites
|
||||
sendAllSprites(#fooBar)
|
||||
15
Task/Events/Lingo/events-3.lingo
Normal file
15
Task/Events/Lingo/events-3.lingo
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
mx = xtra("Msg").new()
|
||||
|
||||
-- send message WM_LBUTTONDOWN to a specific window identified by HWND hwnd
|
||||
WM_LBUTTONDOWN = 513
|
||||
MK_LBUTTON = 1
|
||||
lParam = 65536*y + x
|
||||
mx.send_msg (hwnd, WM_LBUTTONDOWN, MK_LBUTTON, lParam)
|
||||
|
||||
-- listen for WM_COPYDATA and WM_MOUSEWHEEL messages sent to current application
|
||||
-- window, notify Lingo callback function 'msgReceived' when such messages occur.
|
||||
-- This callback function will receive hwnd, message, wParam and lParam as arguments
|
||||
-- (and for WM_COPYDATA messages also the data that was sent as ByteArray).
|
||||
WM_COPYDATA = 74
|
||||
WM_MOUSEWHEEL = 522
|
||||
mx.msg_listen([WM_COPYDATA, WM_MOUSEWHEEL], VOID, #msgReceived)
|
||||
14
Task/Events/Nim/events.nim
Normal file
14
Task/Events/Nim/events.nim
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import posix
|
||||
|
||||
var p: array[2, cint]
|
||||
discard pipe p
|
||||
if fork() > 0:
|
||||
discard close p[0]
|
||||
discard sleep 1
|
||||
discard p[1].write(addr p[0], 1)
|
||||
var x: cint = 0
|
||||
discard wait x
|
||||
else:
|
||||
discard close p[1]
|
||||
discard p[0].read(addr p[1], 1)
|
||||
echo "received signal from pipe"
|
||||
6
Task/Events/Oforth/events-1.oforth
Normal file
6
Task/Events/Oforth/events-1.oforth
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
: anEvent
|
||||
| ch |
|
||||
Channel new ->ch
|
||||
#[ ch receive "Ok, event is signaled !" println ] &
|
||||
System sleep(1000)
|
||||
ch send($myEvent) ;
|
||||
11
Task/Events/Oforth/events-2.oforth
Normal file
11
Task/Events/Oforth/events-2.oforth
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import: emitter
|
||||
|
||||
: anEvent2
|
||||
| e i |
|
||||
Emitter new(null) ->e
|
||||
e onEvent($myEvent, #[ "Event is signaled !" println ])
|
||||
10 loop: i [
|
||||
1000 System sleep
|
||||
$myEvent e emit
|
||||
]
|
||||
e close ;
|
||||
Loading…
Add table
Add a link
Reference in a new issue