💾 Archived View for sdf.org › blippy › hare.gmi captured on 2023-01-29 at 16:06:30. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-01-29)

-=-=-=-=-=-=-

Hare programming language

Created 2022-12-04 Updated 2022-12-27

ARRAYS:

let buf : [1024]u8 = [0..];

assert(len(buf) == 1024);

FOR LOOPS:

for (true) { ... };

for (let i = 0z; i < 10 ; i += 1) { ... };

let i = 0z;

for (i< 10; i+= 1) { ... };

SIGNALS:

use unix::signal;

Ctl-C ignoring:

unix::signal::block(unix::signal::SIGINT); // ignore Ctl-C

Ctl-C capturing:

use unix::signal;

use fmt;

use time;

let quit = false;

fn myhandler(sig: int, info: *unix::signal::siginfo, ucontext: *void) void = {

fmt::printf("myhandler called. I will now exit\n")!;

quit = true;

};

export fn main() void = {

fmt::printf("Type Ctl-C to exit this program\n")!;

defer fmt::printf("defer'd main message\n")!; // this will be output

unix::signal::handle(unix::signal::SIGINT, &myhandler);

for(!quit) { time::sleep(10); };

};

EXITS

MAIN:

clib integration example

Language tutorial

libraries: extended (compress, redis, json, xml, png, linux, etc.)

libraries: standard

mailing list: users

MISC:

clrfmt

hautils - POSIX system utils written in hare

ioctl code generator

tcp server