shithub: femtolisp

Download patch

ref: 3c817d2e586dd916e39d54b2722c2e41a17c898d
parent: cd1803dc65daac66b7895d716238e53b6c507af4
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Thu Jan 16 21:35:24 EST 2025

reduce ifdefs

--- a/dos/platform.h
+++ b/dos/platform.h
@@ -41,3 +41,7 @@
 
 #include "cc.h"
 #include "mem.h"
+#include "mp.h"
+#include "utf.h"
+
+int wcwidth(Rune c);
--- a/flisp.h
+++ b/flisp.h
@@ -1,13 +1,6 @@
 #pragma once
 
 #include "platform.h"
-#ifndef __plan9__
-#include "mp.h"
-#include "utf.h"
-#endif
-#ifdef __dos__
-int wcwidth(Rune c);
-#endif
 #include "utf8.h"
 #include "ios.h"
 #include "tbl.h"
--- a/macos/platform.h
+++ b/macos/platform.h
@@ -46,3 +46,5 @@
 
 #include "cc.h"
 #include "mem.h"
+#include "mp.h"
+#include "utf.h"
--- a/meson.build
+++ b/meson.build
@@ -67,6 +67,9 @@
 	'nan.c',
 ]
 
+inc = [include_directories('3rd', '3rd/mp', '3rd/utf', '3rd/brieflz')]
+extras = []
+
 if host_machine.system() == 'macos'
 	platform = 'macos'
 	flisp_exe_name = 'flisp.code.bin'
@@ -102,7 +105,8 @@
 			'3rd/dlmalloc/dlmalloc.c',
 		]
 	endif
-	extras = [
+	inc += [include_directories('macos')]
+	extras += [
 		cpp.find_library('RetroConsole', required: true),
 		cpp.find_library('retrocrt', required: true),
 	]
@@ -114,7 +118,7 @@
 		'-DALLOC_LIMIT_TRIGGER=256*1024*1024',
 		language: 'c',
 	)
-	extras = []
+	inc += [include_directories('dos')]
 else
 	platform = 'posix'
 	flisp_exe_name = 'flisp'
@@ -123,15 +127,15 @@
 		'-DALLOC_LIMIT_TRIGGER=1*1024*1024',
 		language: 'c',
 	)
-	extras = []
+	inc += [include_directories('posix')]
 endif
 
+inc += [include_directories(platform)]
+
 common = static_library(
 	'common',
 	sources: src_common,
-	include_directories: include_directories(
-		platform,
-	),
+	include_directories: inc,
 	pic: false,
 )
 
@@ -205,10 +209,7 @@
 		'3rd/brieflz/brieflz.c',
 		'3rd/brieflz/depacks.c',
 	],
-	include_directories: include_directories(
-		'3rd/brieflz',
-		platform,
-	),
+	include_directories: inc,
 	pic: false,
 )
 
@@ -247,10 +248,7 @@
 		'3rd/mp/strtomp.c',
 		'3rd/mp/u16.c',
 	],
-	include_directories: include_directories(
-		'3rd/mp',
-		platform,
-	),
+	include_directories: inc,
 	pic: false,
 )
 
@@ -262,10 +260,7 @@
 		'3rd/utf/runetotype.c',
 		'3rd/utf/utfnlen.c',
 	],
-	include_directories: include_directories(
-		'3rd/utf',
-		platform,
-	),
+	include_directories: inc,
 	pic: false,
 )
 
@@ -279,13 +274,7 @@
 	dependencies: [
 		math,
 	] + extras,
-	include_directories: include_directories(
-		'3rd',
-		'3rd/brieflz',
-		'3rd/mp',
-		'3rd/utf',
-		platform,
-	),
+	include_directories: inc,
 	link_with: [
 		brieflz,
 		common,
@@ -355,9 +344,7 @@
 		sources: [
 			'3rd/mp/test.c',
 		],
-		include_directories: include_directories(
-			platform,
-		),
+		include_directories: inc,
 		link_with: [
 			common,
 			mp,
@@ -372,11 +359,7 @@
 			'3rd/mp/test/ld.c',
 			'3rd/mp/test/main.c',
 		],
-		include_directories: include_directories(
-			'3rd/mp',
-			'3rd/mp/test',
-			platform,
-		),
+		include_directories: inc,
 		link_with: [
 			common,
 			mp,
--- a/posix/platform.h
+++ b/posix/platform.h
@@ -67,3 +67,5 @@
 
 #include "cc.h"
 #include "mem.h"
+#include "mp.h"
+#include "utf.h"