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
23
Task/Sleep/8051-Assembly/sleep.8051
Normal file
23
Task/Sleep/8051-Assembly/sleep.8051
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
ORG RESET
|
||||
jmp main
|
||||
ORG TIMER0
|
||||
; timer interrupt only used to wake the processor
|
||||
clr tr0
|
||||
reti
|
||||
|
||||
main:
|
||||
setb ea ; enable interrupts
|
||||
setb et0 ; enable timer0 interrupt
|
||||
mov tl0, #0 ; start timer counter at zero
|
||||
mov th0, #0 ; these two values dictate the length of sleep
|
||||
|
||||
mov a, pcon ; copy power control register
|
||||
setb a.0 ; set idl bit
|
||||
setb tr0 ; start timer
|
||||
; sleeping...
|
||||
mov pcon, a ; move a back into pcon (processor sleeps after this instruction finishes)
|
||||
|
||||
; when the timer overflows and the timer interrupt returns, execution will resume at this spot
|
||||
|
||||
; Awake!
|
||||
jmp $
|
||||
4
Task/Sleep/8th/sleep.8th
Normal file
4
Task/Sleep/8th/sleep.8th
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
f:stdin f:getline
|
||||
"Sleeping..." . cr
|
||||
eval sleep
|
||||
"Awake!" . cr bye
|
||||
4
Task/Sleep/AntLang/sleep.antlang
Normal file
4
Task/Sleep/AntLang/sleep.antlang
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
milliseconds: eval[input["How long should I sleep? "]] / eval = evil, but this is just a simple demo
|
||||
echo["Sleeping..."]
|
||||
sleep[milliseconds]
|
||||
echo["Awake!"]
|
||||
15
Task/Sleep/Axe/sleep.axe
Normal file
15
Task/Sleep/Axe/sleep.axe
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
Disp "TIME:"
|
||||
input→A
|
||||
0→T
|
||||
length(A)→L
|
||||
For(I,1,L)
|
||||
If {A}<'0' or {A}>'9'
|
||||
Disp "NOT A NUMBER",i
|
||||
Return
|
||||
End
|
||||
T*10+{A}-'0'→T
|
||||
A++
|
||||
End
|
||||
Disp "SLEEPING...",i
|
||||
Pause T
|
||||
Disp "AWAKE",i
|
||||
6
Task/Sleep/ERRE/sleep.erre
Normal file
6
Task/Sleep/ERRE/sleep.erre
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
..............
|
||||
INPUT("Enter the time to sleep in seconds: ";sleep)
|
||||
PRINT("Sleeping...")
|
||||
PAUSE(sleep)
|
||||
PRINT("Awake!")
|
||||
..............
|
||||
8
Task/Sleep/FreeBASIC/sleep.freebasic
Normal file
8
Task/Sleep/FreeBASIC/sleep.freebasic
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
' FB 1.05.0 Win64
|
||||
|
||||
Dim ms As UInteger
|
||||
Input "Enter number of milliseconds to sleep" ; ms
|
||||
Print "Sleeping..."
|
||||
Sleep ms, 1 '' the "1" means Sleep can't be interrupted with a keystroke
|
||||
Print "Awake!"
|
||||
End
|
||||
3
Task/Sleep/Lasso/sleep.lasso
Normal file
3
Task/Sleep/Lasso/sleep.lasso
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
stdoutnl('Sleeping...')
|
||||
sleep(5000) // Sleep 5 seconds
|
||||
stdoutnl('Awake!')
|
||||
5
Task/Sleep/Lingo/sleep.lingo
Normal file
5
Task/Sleep/Lingo/sleep.lingo
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
on doSleep (ms)
|
||||
put "Sleeping..."
|
||||
sleep(ms)
|
||||
put "Awake!"
|
||||
end
|
||||
7
Task/Sleep/Nim/sleep.nim
Normal file
7
Task/Sleep/Nim/sleep.nim
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import os, strutils
|
||||
|
||||
echo("Enter how long I should sleep (in milliseconds):")
|
||||
var timed = parseInt(readLine(stdin).string)
|
||||
echo("Sleeping...")
|
||||
sleep(timed)
|
||||
echo("Awake!")
|
||||
1
Task/Sleep/Oforth/sleep.oforth
Normal file
1
Task/Sleep/Oforth/sleep.oforth
Normal file
|
|
@ -0,0 +1 @@
|
|||
: sleepMilli(n) "Sleeping..." . n sleep "Awake!" println ;
|
||||
4
Task/Sleep/Peloton/sleep-1.peloton
Normal file
4
Task/Sleep/Peloton/sleep-1.peloton
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<@ SAYLIT>Number of seconds: </@><@ GETVAR>secs</@>
|
||||
<@ SAYLIT>Sleeping</@>
|
||||
<@ ACTPAUVAR>secs</@>
|
||||
<@ SAYLIT>Awake</@>
|
||||
4
Task/Sleep/Peloton/sleep-2.peloton
Normal file
4
Task/Sleep/Peloton/sleep-2.peloton
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<# MontrezLittéralement>Number of seconds: </#><# PrenezUneValeurVariable>secs</#>
|
||||
<# MontrezLittéralement>Sleeping</#>
|
||||
<# AgissezFaireUnePauseVariable>secs</#>
|
||||
<# MontrezLittéralement>Awake</#>
|
||||
4
Task/Sleep/Peloton/sleep-3.peloton
Normal file
4
Task/Sleep/Peloton/sleep-3.peloton
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<@ 显示_字串_>Number of seconds: </@><@ 获取_变量_>secs</@>
|
||||
<@ 显示_字串_>Sleeping</@>
|
||||
<@ 运行_暂停动变量_>secs</@>
|
||||
<@ 显示_字串_>Awake</@>
|
||||
4
Task/Sleep/Phix/sleep.phix
Normal file
4
Task/Sleep/Phix/sleep.phix
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
atom a = prompt_number("wait for duration (in seconds, 0..20):", {0,20})
|
||||
puts(1,"Sleeping...\n")
|
||||
sleep(a)
|
||||
puts(1,"Awake!\n")
|
||||
12
Task/Sleep/Ring/sleep.ring
Normal file
12
Task/Sleep/Ring/sleep.ring
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
load "guilib.ring"
|
||||
|
||||
for n = 1 to 10
|
||||
Sleep(3)
|
||||
see "" + n + " "
|
||||
next
|
||||
see nl
|
||||
|
||||
func Sleep x
|
||||
nTime = x * 1000
|
||||
oTest = new qTest
|
||||
oTest.qsleep(nTime)
|
||||
6
Task/Sleep/Sidef/sleep.sidef
Normal file
6
Task/Sleep/Sidef/sleep.sidef
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
var sec = read(Number); # any positive number (it may be fractional)
|
||||
say "Sleeping...";
|
||||
Sys.sleep(sec); # in seconds
|
||||
#Sys.usleep(sec); # in microseconds
|
||||
#Sys.nanosleep(sec); # in nanoseconds
|
||||
say "Awake!";
|
||||
10
Task/Sleep/Swift/sleep.swift
Normal file
10
Task/Sleep/Swift/sleep.swift
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import Foundation
|
||||
|
||||
println("Enter number of seconds to sleep")
|
||||
let input = NSFileHandle.fileHandleWithStandardInput()
|
||||
var amount = NSString(data:input.availableData, encoding: NSUTF8StringEncoding)?.intValue
|
||||
var interval = NSTimeInterval(amount!)
|
||||
println("Sleeping...")
|
||||
NSThread.sleepForTimeInterval(interval)
|
||||
|
||||
println("Awake!")
|
||||
4
Task/Sleep/Ursa/sleep.ursa
Normal file
4
Task/Sleep/Ursa/sleep.ursa
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
out "Sleeping..." endl console
|
||||
# sleep for 5 seconds (5000 milliseconds)
|
||||
sleep 5000
|
||||
out "Awake!" endl console
|
||||
Loading…
Add table
Add a link
Reference in a new issue