Skip to content

Commit 05f789f

Browse files
committed
Revert "Avoid conflicts of embedded vfs with Qt."
This reverts commit 590ae53.
1 parent 65dedd7 commit 05f789f

File tree

1 file changed

+2
-70
lines changed

1 file changed

+2
-70
lines changed

Include/np_embed.h

Lines changed: 2 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88

99
#ifndef __ASSEMBLER__
1010
#ifdef __cplusplus
11-
#if __has_include (<QtCore>)
12-
# include <QtCore>
13-
#endif
14-
1511
extern "C" {
1612
#endif
1713

@@ -30,7 +26,6 @@ extern "C" {
3026

3127
#ifdef _WIN32
3228
#include <windows.h>
33-
#include <io.h>
3429
#define PATH_MAX MAX_PATH
3530
typedef SSIZE_T ssize_t;
3631
#else
@@ -134,76 +129,13 @@ NP_DECL(void) np_flockfile(void *e);
134129
NP_DECL(void) np_funlockfile(void *e);
135130
NP_DECL(int) np_ftrylockfile(void *e);
136131

137-
#ifndef NUITKAPYTHON_EMBED_BUILD
138-
139-
/* Using a bunch of macros from
140-
* https://github.com/pfultz2/Cloak/wiki/C-Preprocessor-tricks,-tips,-and-idioms
141-
*/
142-
143-
#define CAT(a, ...) PRIMITIVE_CAT(a, __VA_ARGS__)
144-
#define PRIMITIVE_CAT(a, ...) a ## __VA_ARGS__
145-
146-
#define IIF(c) PRIMITIVE_CAT(IIF_, c)
147-
#define IIF_0(t, ...) __VA_ARGS__
148-
#define IIF_1(t, ...) t
149-
150-
#define COMPL(b) PRIMITIVE_CAT(COMPL_, b)
151-
#define COMPL_0 1
152-
#define COMPL_1 0
153-
154-
#define DEC(x) PRIMITIVE_CAT(DEC_, x)
155-
#define DEC_0 0
156-
#define DEC_1 0
157-
#define DEC_2 1
158-
#define DEC_3 2
159-
#define DEC_4 3
160-
#define DEC_5 4
161-
#define DEC_6 5
162-
#define DEC_7 6
163-
#define DEC_8 7
164-
#define DEC_9 8
165-
#define DEC_10 9
166-
#define DEC_11 10
167-
#define DEC_12 11
168-
#define DEC_13 12
169-
#define DEC_14 13
170-
#define DEC_15 14
171-
#define DEC_16 15
172-
#define DEC_17 16
173-
#define DEC_18 17
174-
#define DEC_19 18
175-
#define DEC_20 19
176-
177-
#define CHECK_N(x, n, ...) n
178-
#define CHECK(...) CHECK_N(__VA_ARGS__, 0,)
179-
#define PROBE(x) x, 1,
180-
181-
#define IS_PAREN(x) CHECK(IS_PAREN_PROBE x)
182-
#define IS_PAREN_PROBE(...) PROBE(~)
183-
184-
#define NOT(x) CHECK(PRIMITIVE_CAT(NOT_, x))
185-
#define NOT_0 PROBE(~)
186-
187-
#define BOOL(x) COMPL(NOT(x))
188-
#define IF(c) IIF(BOOL(c))
189-
190-
#define EAT(...)
191-
#define EXPAND(...) __VA_ARGS__
192-
#define WHEN(c) IF(c)(EXPAND, EAT)
193-
194-
#define EXPAND(...) __VA_ARGS__
195-
196-
#define NUM_ARGS1(_20,_19,_18,_17,_16,_15,_14,_13,_12,_11,_10,_9,_8,_7,_6,_5,_4,_3,_2,_1, n, ...) n
197-
#define NUM_ARGS0(...) NUM_ARGS1(__VA_ARGS__,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)
198-
#define NUM_ARGS(...) IF(DEC(NUM_ARGS0(__VA_ARGS__)))(NUM_ARGS0(__VA_ARGS__),IF(IS_PAREN(__VA_ARGS__ ()))(0,1))
199-
132+
#if !defined(NUITKAPYTHON_EMBED_BUILD) && !defined(__cplusplus)
200133
// Preprocessor Translation
201134
#define FILE EFILE
202135
/* File Opening and Closing */
203136
#define fopen np_fopen
204137
#define _fopen np_fopen
205-
// Basically this very complicated macro overrides only calls to open() functions that have 2 or more arguments to avoid compatibility issues.
206-
#define open(...) WHEN(DEC(NUM_ARGS( __VA_ARGS__ )))(np_open(__VA_ARGS__))WHEN(NOT(DEC(NUM_ARGS( __VA_ARGS__ ))))(open(__VA_ARGS__))
138+
#define open np_open
207139
#define _open np_open
208140
#define fdopen np_fdopen
209141
#define _fdopen np_fdopen

0 commit comments

Comments
 (0)