summaryrefslogtreecommitdiffstats
path: root/hp48g20230307
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2023-03-16 22:48:34 +0100
committerAnton Luka Šijanec <anton@sijanec.eu>2023-03-16 22:48:34 +0100
commitfcb85b1744d8095e1631e5827835c2182dc93eae (patch)
tree666b5947bf4aa08530a5dd83b3064f192db70993 /hp48g20230307
parentnormalizacija imen v velike črke, kot je originalno na kalk (diff)
downloadsola-gimb-4-fcb85b1744d8095e1631e5827835c2182dc93eae.tar
sola-gimb-4-fcb85b1744d8095e1631e5827835c2182dc93eae.tar.gz
sola-gimb-4-fcb85b1744d8095e1631e5827835c2182dc93eae.tar.bz2
sola-gimb-4-fcb85b1744d8095e1631e5827835c2182dc93eae.tar.lz
sola-gimb-4-fcb85b1744d8095e1631e5827835c2182dc93eae.tar.xz
sola-gimb-4-fcb85b1744d8095e1631e5827835c2182dc93eae.tar.zst
sola-gimb-4-fcb85b1744d8095e1631e5827835c2182dc93eae.zip
Diffstat (limited to 'hp48g20230307')
-rw-r--r--hp48g20230307/prog.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/hp48g20230307/prog.c b/hp48g20230307/prog.c
new file mode 100644
index 0000000..b29f736
--- /dev/null
+++ b/hp48g20230307/prog.c
@@ -0,0 +1,25 @@
+#include <stdio.h>
+int main (void) {
+ puts("%%HP: T(1)A(D)F(.);");
+ putchar(0xab);
+ char c = '\0';
+ unsigned paren = 0;
+ while (!feof(stdin) && !ferror(stdin)) {
+ char prevchar = c;
+ c = getchar();
+ if (prevchar == '-' && c == '>') {
+ putchar(0x8d);
+ c = '\0';
+ continue;
+ }
+ if (prevchar == '"')
+ paren++;
+ if (prevchar == '\0')
+ continue;
+ if (!(paren % 2) && (prevchar == ' ' || prevchar == '\t'))
+ putchar('\n');
+ else
+ putchar(prevchar);
+ }
+ puts("\n\xbb");
+}