hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

genutil.ha (476B)


      1 // SPDX-License-Identifier: GPL-3.0-only
      2 // (c) Hare authors <https://harelang.org>
      3 
      4 use fmt;
      5 
      6 fn mklabel(ctx: *context, name: str) str = {
      7 	static let buf: [1024]u8 = [0...];
      8 	let serial = ctx.serial;
      9 	ctx.serial += 1;
     10 	return fmt::bsprintf(buf, "@{}.{}", name, serial);
     11 };
     12 
     13 fn mktemp(ctx: *context) temporary = {
     14 	let serial = ctx.serial;
     15 	ctx.serial += 1;
     16 	return fmt::asprintf(".{}", serial);
     17 };
     18 
     19 fn mklval(ctx: *context, val: value) qtypeval = (ctx.arch.ptr, val.value);