Add thread attribute to the functions which need it.
[SquirrelJME.git] / tools / c-source-writer / src / test / java / cc / squirreljme / c / TestFunctionSplice.java
blob5c75771a7d7e290445544d755b9b99995557e669
1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
3 // Multi-Phasic Applications: SquirrelJME
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the Mozilla Public License Version 2.0.
7 // See license.mkd for licensing and copyright information.
8 // ---------------------------------------------------------------------------
10 package cc.squirreljme.c;
12 import net.multiphasicapps.tac.TestRunnable;
14 /**
15 * Tests function splicing.
17 * @since 2023/07/15
19 public class TestFunctionSplice
20 extends TestRunnable
22 /**
23 * {@inheritDoc}
24 * @since 2023/07/15
26 @Override
27 public void test()
28 throws Throwable
30 try (__Spool__ spool = __Spool__.__init(false))
32 // Start function
33 try (CFunctionBlock outer = spool.define(CFunctionType.of(
34 "test", CPrimitiveType.VOID)))
36 // Setup splice and write into each sub-block
37 try (CFunctionBlockSplices splices = outer.splice(3))
39 try (CFunctionBlock block = splices.splice(2))
41 block.declare(
42 CVariable.of(CPrimitiveType.SIGNED_SHORT,
43 "c"));
46 try (CFunctionBlock block = splices.splice(1))
48 block.declare(
49 CVariable.of(CPrimitiveType.SIGNED_INTEGER,
50 "b"));
53 try (CFunctionBlock block = splices.splice(0))
55 block.declare(
56 CVariable.of(CPrimitiveType.SIGNED_LONG,
57 "a"));
62 this.secondary("spliced", spool.tokens());