ref: 29d0d1220775bccb44a53e2c4a4f274540493d12
parent: 371bbab0130eab2a1cc9de22bf63f49d4dac0676
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sun Feb 2 22:33:57 EST 2025
give up on trying to use libc-specific iswprint and wcwidth
--- a/3rd/iswprint.c
+++ b/3rd/iswprint.c
@@ -21,7 +21,7 @@
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include "platform.h"
+#include "flisp.h"
// straight from musl
int
--- a/meson.build
+++ b/meson.build
@@ -40,9 +40,11 @@
src_flisp = [
'3rd/fn.c',
+ '3rd/iswprint.c',
'3rd/mt19937-64.c',
'3rd/spooky.c',
'3rd/tbl.c',
+ '3rd/wcwidth.c',
'src/bitvector.c',
'src/builtins.c',
'src/compress.c',
@@ -126,7 +128,6 @@
elif sys == 'dos'
platform = sys
flisp_exe_name = 'flisp.exe'
- src_flisp += ['3rd/iswprint.c', '3rd/wcwidth.c']
else
platform = 'posix'
flisp_exe_name = 'flisp'
--- a/src/dos/platform.h
+++ b/src/dos/platform.h
@@ -51,6 +51,3 @@
#include "mem.h"
#include "mp.h"
#include "utf.h"
-
-int fl_iswprint(Rune c) fl_constfn;
-int fl_wcwidth(Rune c) fl_constfn;
--- a/src/flisp.h
+++ b/src/flisp.h
@@ -210,6 +210,10 @@
bool fl_isnumber(value_t v) fl_purefn;
value_t alloc_vector(size_t n, int init);
+/* consistent iswprint and wcwidth */
+int fl_iswprint(Rune c) fl_constfn;
+int fl_wcwidth(Rune c) fl_constfn;
+
/* safe casts */
cons_t *tocons(value_t v) fl_purefn;
symbol_t *tosymbol(value_t v) fl_purefn;
--- a/src/macos/platform.h
+++ b/src/macos/platform.h
@@ -51,9 +51,6 @@
#define ALLOC_LIMIT_TRIGGER INITIAL_HEAP_SIZE
#endif
-#define fl_iswprint(r) iswprint(r)
-#define fl_wcwidth(r) wcwidth(r)
-
#include "cc.h"
#include "mem.h"
#include "mp.h"
--- a/src/plan9/platform.h
+++ b/src/plan9/platform.h
@@ -125,8 +125,6 @@
typedef uintptr size_t;
typedef enum { false, true } bool;
-int fl_iswprint(Rune c);
-int fl_wcwidth(Rune c);
int ftruncate(int f, off_t sz);
#if !defined(INITIAL_HEAP_SIZE)
--- a/src/posix/platform.h
+++ b/src/posix/platform.h
@@ -96,9 +96,6 @@
#define ALLOC_LIMIT_TRIGGER INITIAL_HEAP_SIZE
#endif
-#define fl_iswprint(r) iswprint(r)
-#define fl_wcwidth(r) wcwidth(r)
-
#include "cc.h"
#include "mem.h"
#include "mp.h"
--- a/src/posix/sys.c
+++ b/src/posix/sys.c
@@ -79,7 +79,6 @@
main(int argc, char **argv)
{
setlocale(LC_NUMERIC, "C");
- setlocale(LC_CTYPE, "");
struct utsname u;
os_version = strdup(uname(&u) == 0 ? u.release : "");
flmain(boot, sizeof(boot), argc, argv);