summaryrefslogtreecommitdiffstats
path: root/hp48g20230307
diff options
context:
space:
mode:
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");
+}