Files
sakurac/system/on_windows_x86_64.sakura
T

58 lines
1.5 KiB
Plaintext
Raw Normal View History

2026-10-26 10:14:11 -05:00
#! @file on_windows_x86_64.sakura
#! @author John Christman (sorakatadzuma@gmail.com)
#! @copyright Malunal Studios, LLC.
#! @license MIT
#!
#! Contains what `system` needs to know of Windows on x86-64.
#!
#! What `system` needs to know of Windows on x86-64: the numbers of the
#! signals. Windows numbers none of its own, so they are Linux's on x86-64,
#! which keeps the bits `watched` gives, and the numbers `signal_of` takes, the
#! same on both.
module system when os == windows && arch == x86_64;
# The number a signal is given, as Linux gives it on x86-64.
def number_of(which: signal): i32 {
return match which {
hangup => 1,
interrupt => 2,
quit => 3,
kill => 9,
user1 => 10,
user2 => 12,
pipe => 13,
alarm => 14,
terminate => 15,
child => 17,
resume => 18,
stop => 19,
suspend => 20,
resized => 28,
};
}
#! The signal a number is given to, as Linux gives it on x86-64, where it is
#! one `signal` names.
#! @param number The number.
#! @returns The signal, or nothing.
pub def signal_of(number: i64): maybe<signal> {
return match number {
1 => signal::hangup,
2 => signal::interrupt,
3 => signal::quit,
9 => signal::kill,
10 => signal::user1,
12 => signal::user2,
13 => signal::pipe,
14 => signal::alarm,
15 => signal::terminate,
17 => signal::child,
18 => signal::resume,
19 => signal::stop,
20 => signal::suspend,
28 => signal::resized,
else => nothing{},
};
}