From 538fdc0c743f688adf7710bd86fd0f5cad41ed5d Mon Sep 17 00:00:00 2001 From: "Axel K. Reinhold" Date: Thu, 23 Jan 2025 09:42:48 +0100 Subject: [PATCH] codebase ISO-8859-15 Fixes #18 --- README.md | 22 +++++++++++++++++++++- arx/Makefile.in | 2 +- arx/src/cur_getk.c | 3 +++ arx/src/cur_init.c | 12 ++++++++++++ docs/index.md | 19 +++++++++++++++++++ mc/Name | 2 +- mc/src/mcfile.c | 4 ++-- 7 files changed, 59 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c64a7f3..9339823 100644 --- a/README.md +++ b/README.md @@ -46,10 +46,30 @@ You need i686 glibc installed on 64bit machines: `sudo yum install glibc.i686` `docker run -e COLUMNS -e LINES -e TERM -ti ghcr.io/freakout42/macrocalc:latest` 6. Windows .exe Download -https://github.com/freakout42/macrocalc/releases/download/v10.51/mc-10.52-w3-i386.exe.zip +https://github.com/freakout42/macrocalc/releases/download/v10.53/mc-10.53-w3-i386.exe.zip and unzip mc.exe and mc2wks.exe. Start it with any console with full pathname or double-click it with the explorer. +Non-ascii characters +-------------------- + +The sourcecode of MacroCALC is from 1979 - there is no unicode (UTF-8) support. +For international characters configure your terminal for an 8-bit codebase: + +If you are using PuTTY you must set for the session: + + Window->Translation->Remote character set = ISO-8859-15 + +With the MacOS Terminal application: + + Settings->General->Profiles->International-> + Text Encoding = Western (ISO Latin 9) + X Set locale environment variables on startup + +Start a local xterm with: + + LC_ALL=en_US.iso885915 LANG=en_US.iso885915-US xterm + Getting started --------------- Navigate through the sheet with the arrow-keys. The dot (.) marks the diff --git a/arx/Makefile.in b/arx/Makefile.in index 771b85c..0005325 100755 --- a/arx/Makefile.in +++ b/arx/Makefile.in @@ -2,7 +2,7 @@ # for: $Os ARXREL=8 -ARXVER=7 +ARXVER=8 ARX=../../arx DIRS=inc src lib diff --git a/arx/src/cur_getk.c b/arx/src/cur_getk.c index 742dfd7..5d26d89 100644 --- a/arx/src/cur_getk.c +++ b/arx/src/cur_getk.c @@ -31,6 +31,9 @@ register int ch; wrefresh (w); ch = wgetch (w); +#ifdef WIN32 +if (ch < 0) ch = 256 + ch; +#endif switch (ch) { case KEY_BS: return KEY_BACKSPACE; diff --git a/arx/src/cur_init.c b/arx/src/cur_init.c index fa6a8ea..6d8bdab 100644 --- a/arx/src/cur_init.c +++ b/arx/src/cur_init.c @@ -79,6 +79,18 @@ if (around >= 3) cur_redir = around; +#ifdef WIN32 +#define ISO_8859_15_CP 28605 +/*if (IsValidCodePage(ISO_8859_15_CP) == 0) return NULL;*/ +SetConsoleCP(ISO_8859_15_CP); +SetConsoleOutputCP(ISO_8859_15_CP); +#else +#define ISO_8859_15_CP "en_US.iso885915" +setenv("LC_ALL", ISO_8859_15_CP, 1); +setenv("LANG", ISO_8859_15_CP, 1); +/* ESC % @ */ +#endif + if ((stdscreen = initscr()) == NULL) return NULL; #ifdef DEBUG fprintf (stderr, "cur_init: %s\n", "initscr() done"); diff --git a/docs/index.md b/docs/index.md index b4ceb1d..ca705a4 100644 --- a/docs/index.md +++ b/docs/index.md @@ -65,6 +65,25 @@ Here is an example for Linux/bash: **REMEMBER TO START MacroCALC WITH THE `-u` OPTION TO USE THE UNIT FUNCTIONALITY** +### non-ascii characters + +Since the sourcecode of MacroCALC is from 1979 there is no unicode (UTF-8) support. +To get international characters configure your terminal for an 8-bit codebase: + +If you are using PuTTY you must set for the session: + + Window->Translation->Remote character set = ISO-8859-15 + +With the MacOS Terminal application: + + Settings->General->Profiles->International-> + Text Encoding = Western (ISO Latin 9) + X Set locale environment variables on startup + +Start a local xterm with: + + LC_ALL=en_US.iso885915 LANG=en_US.iso885915-US xterm + ### getting started Navigate through the sheet with the arrow-keys. The dot (.) marks the diff --git a/mc/Name b/mc/Name index 42135cb..aedd2f9 100644 --- a/mc/Name +++ b/mc/Name @@ -1 +1 @@ -mc v10.52 +mc v10.53 diff --git a/mc/src/mcfile.c b/mc/src/mcfile.c index 04c6b9e..f72c8e4 100644 --- a/mc/src/mcfile.c +++ b/mc/src/mcfile.c @@ -78,7 +78,7 @@ if (prompt == 2) { sprintf(msgcmd, "%s -r <%s", mc2wkspath(0), filename); file = popen(msgcmd, "r"); } else { - file = fopen(filename, "r"); + file = fopen(filename, "rb"); } if (file == NULL) { @@ -137,7 +137,7 @@ if (prompt == 2) { sprintf(msgcmd, "%s >%s", mc2wkspath(0), filename); file = popen(msgcmd, "w"); } else { - file = fopen(filename, "w"); + file = fopen(filename, "wb"); } if (file == NULL) {