aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXavier ASUS <xavi92psx@gmail.com>2019-10-28 15:53:52 +0100
committerXavier ASUS <xavi92psx@gmail.com>2019-10-28 15:58:52 +0100
commitdc6912769121c335c6b09a6c002a4a8e0528703a (patch)
treefbc5bf85229996940d767c1ee1592eb2536a2f54 /src
downloadstm8-dce-example-dc6912769121c335c6b09a6c002a4a8e0528703a.tar.gz
First commit
Diffstat (limited to 'src')
-rw-r--r--src/bar.c15
-rw-r--r--src/main.c30
2 files changed, 45 insertions, 0 deletions
diff --git a/src/bar.c b/src/bar.c
new file mode 100644
index 0000000..7282ea2
--- /dev/null
+++ b/src/bar.c
@@ -0,0 +1,15 @@
+#include "bar.h"
+
+void bar(const int x)
+{
+ int i;
+
+ /* Some stupid calculations here and there. */
+ for (i = 0; i < 90; i++)
+ {
+ if (i - x)
+ {
+ for (;;);
+ }
+ }
+}
diff --git a/src/main.c b/src/main.c
new file mode 100644
index 0000000..03e5944
--- /dev/null
+++ b/src/main.c
@@ -0,0 +1,30 @@
+#include "bar.h"
+
+struct example
+{
+ int a;
+ char b;
+ int *c;
+};
+
+static void foo(struct example *const st)
+{
+ if (st)
+ {
+ if (st->c)
+ {
+ (*st->c)++;
+ }
+ }
+}
+
+_Noreturn void main(void)
+{
+ static struct example st;
+
+ foo(&st);
+
+ bar(st.a);
+
+ for (;;);
+}