summaryrefslogtreecommitdiff
path: root/c-embed
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2024-06-19 22:13:49 +0200
committerMitja Felicijan <mitja.felicijan@gmail.com>2024-06-19 22:13:49 +0200
commitc616d4e3c3a3abfcfeb5e9d96ddfbf7d3111603a (patch)
tree236d658af6f97a56c20848f6f5994c135fca1316 /c-embed
downloadprobe-c616d4e3c3a3abfcfeb5e9d96ddfbf7d3111603a.tar.gz
Engage!
Diffstat (limited to 'c-embed')
-rw-r--r--c-embed/.clang-format4
-rw-r--r--c-embed/Makefile6
-rw-r--r--c-embed/main.c19
-rw-r--r--c-embed/test.h49
-rw-r--r--c-embed/test.txt8
5 files changed, 86 insertions, 0 deletions
diff --git a/c-embed/.clang-format b/c-embed/.clang-format
new file mode 100644
index 0000000..5f0e585
--- /dev/null
+++ b/c-embed/.clang-format
@@ -0,0 +1,4 @@
+BasedOnStyle: Chromium
+ColumnLimit: 120
+IndentWidth: 4
+
diff --git a/c-embed/Makefile b/c-embed/Makefile
new file mode 100644
index 0000000..29e4f2d
--- /dev/null
+++ b/c-embed/Makefile
@@ -0,0 +1,6 @@
+a.out:
+ xxd -i test.txt > test.h
+ gcc -Wall -Werror -Wpedantic main.c
+
+clean:
+ -rm a.out
diff --git a/c-embed/main.c b/c-embed/main.c
new file mode 100644
index 0000000..c0d2f59
--- /dev/null
+++ b/c-embed/main.c
@@ -0,0 +1,19 @@
+#include <stdio.h>
+
+#include "test.h"
+
+int main(void) {
+ printf("Testing embedding of files into binary.\n");
+
+ for (unsigned int i = 0; i < test_txt_len; i++) {
+ printf("%02x ", test_txt[i]);
+ }
+ printf("\n\n");
+
+ for (unsigned int i = 0; i < test_txt_len; i++) {
+ printf("%c", test_txt[i]);
+ }
+ printf("\n\n");
+
+ return 0;
+}
diff --git a/c-embed/test.h b/c-embed/test.h
new file mode 100644
index 0000000..cfdfa3a
--- /dev/null
+++ b/c-embed/test.h
@@ -0,0 +1,49 @@
+unsigned char test_txt[] = {
+ 0x54, 0x68, 0x65, 0x20, 0x66, 0x69, 0x72, 0x73, 0x74, 0x20, 0x72, 0x75,
+ 0x6c, 0x65, 0x20, 0x69, 0x73, 0x20, 0x74, 0x79, 0x70, 0x69, 0x63, 0x61,
+ 0x6c, 0x20, 0x6f, 0x66, 0x20, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x75, 0x6d,
+ 0x20, 0x70, 0x68, 0x79, 0x73, 0x69, 0x63, 0x73, 0x2e, 0x20, 0x49, 0x74,
+ 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x20, 0x66, 0x72, 0x6f,
+ 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x6f, 0x73, 0x74, 0x75, 0x6c,
+ 0x61, 0x74, 0x65, 0x20, 0x6f, 0x66, 0x0a, 0x75, 0x6e, 0x69, 0x74, 0x61,
+ 0x72, 0x79, 0x20, 0x65, 0x76, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e,
+ 0x2e, 0x20, 0x54, 0x68, 0x65, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64,
+ 0x20, 0x72, 0x75, 0x6c, 0x65, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x63,
+ 0x6c, 0x61, 0x73, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x20, 0x72, 0x75, 0x6c,
+ 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x64, 0x64,
+ 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x0a, 0x70, 0x72, 0x6f,
+ 0x62, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x2e, 0x20,
+ 0x49, 0x74, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x20, 0x66,
+ 0x72, 0x6f, 0x6d, 0x20, 0x64, 0x65, 0x63, 0x6f, 0x68, 0x65, 0x72, 0x65,
+ 0x6e, 0x63, 0x65, 0x20, 0x74, 0x68, 0x72, 0x6f, 0x75, 0x67, 0x68, 0x20,
+ 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e,
+ 0x20, 0x57, 0x68, 0x65, 0x6e, 0x0a, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6d,
+ 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x20, 0x73, 0x74, 0x61, 0x74, 0x65,
+ 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76,
+ 0x65, 0x64, 0x2c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x62, 0x73, 0x65,
+ 0x72, 0x76, 0x65, 0x64, 0x20, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x20,
+ 0x69, 0x73, 0x20, 0x72, 0x65, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74,
+ 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x61, 0x0a, 0x6d, 0x69, 0x78, 0x74,
+ 0x75, 0x72, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x74, 0x61, 0x74, 0x65,
+ 0x73, 0x2e, 0x20, 0x54, 0x68, 0x65, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73,
+ 0x69, 0x63, 0x61, 0x6c, 0x20, 0x72, 0x75, 0x6c, 0x65, 0x20, 0x6f, 0x66,
+ 0x20, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66,
+ 0x20, 0x70, 0x72, 0x6f, 0x62, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69,
+ 0x65, 0x73, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x74, 0x68, 0x65, 0x6e,
+ 0x20, 0x62, 0x65, 0x0a, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x64, 0x2e,
+ 0x20, 0x45, 0x6e, 0x74, 0x61, 0x6e, 0x67, 0x6c, 0x65, 0x6d, 0x65, 0x6e,
+ 0x74, 0x20, 0x62, 0x79, 0x20, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x75, 0x73, 0x20, 0x65, 0x78,
+ 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x73, 0x20, 0x46, 0x65, 0x79, 0x6e, 0x6d,
+ 0x61, 0x6e, 0x27, 0x73, 0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x20,
+ 0x72, 0x75, 0x6c, 0x65, 0x2e, 0x20, 0x54, 0x68, 0x69, 0x73, 0x0a, 0x65,
+ 0x78, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20,
+ 0x46, 0x65, 0x79, 0x6e, 0x6d, 0x61, 0x6e, 0x20, 0x52, 0x75, 0x6c, 0x65,
+ 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x63, 0x61, 0x6c, 0x63, 0x75, 0x6c,
+ 0x61, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x70, 0x72, 0x6f, 0x62, 0x61, 0x62,
+ 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x71,
+ 0x75, 0x61, 0x6e, 0x74, 0x75, 0x6d, 0x20, 0x70, 0x68, 0x79, 0x73, 0x69,
+ 0x63, 0x73, 0x0a, 0x28, 0x46, 0x65, 0x79, 0x6e, 0x6d, 0x61, 0x6e, 0x20,
+ 0x31, 0x39, 0x36, 0x36, 0x29, 0x2e, 0x0a
+};
+unsigned int test_txt_len = 547;
diff --git a/c-embed/test.txt b/c-embed/test.txt
new file mode 100644
index 0000000..a3cac17
--- /dev/null
+++ b/c-embed/test.txt
@@ -0,0 +1,8 @@
+The first rule is typical of quantum physics. It results from the postulate of
+unitary evolution. The second rule is a classical rule of the addition of
+probabilities. It results from decoherence through observation. When
+intermediate states are observed, the observed system is represented by a
+mixture of states. The classical rule of addition of probabilities must then be
+applied. Entanglement by observation thus explains Feynman's second rule. This
+explains the Feynman Rules for calculating probabilities in quantum physics
+(Feynman 1966).