From 18d9100c978ee68ae8c5c929e499ed09698ab8e9 Mon Sep 17 00:00:00 2001 From: Claudio Daffra Date: Sat, 9 Jan 2021 19:21:46 +0100 Subject: [PATCH 1/2] nmake /F wMakefile with visual studio --- .gitignore | 2 ++ cpp1.c | 5 ++++- fpp.h | 4 ++++ usecpp.c | 11 ++++++++--- wMakefile | 20 ++++++++++++++++++++ 5 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 wMakefile diff --git a/.gitignore b/.gitignore index 1279d5b..033ebd0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ fcpp *.o *~ +*.obj +*.exe diff --git a/cpp1.c b/cpp1.c index 77556b0..7a51d11 100644 --- a/cpp1.c +++ b/cpp1.c @@ -37,8 +37,11 @@ void __stdargs _XCEXIT(long a) { return; } FILE_LOCAL ReturnCode output(struct Global *, int); /* Output one character */ FILE_LOCAL void sharp(struct Global *); INLINE FILE_LOCAL ReturnCode cppmain(struct Global *); - +#ifdef _MSC_VER +int fppPreProcess(struct fppTag *tags) +#else int PREFIX fppPreProcess(REG(a0) struct fppTag *tags) +#endif { int i=0; ReturnCode ret; /* cpp return code */ diff --git a/fpp.h b/fpp.h index f772996..264df7a 100644 --- a/fpp.h +++ b/fpp.h @@ -156,4 +156,8 @@ struct fppTag { /* Switch on WWW-mode */ #define FPPTAG_WEBMODE 33 +#ifdef _MSC_VER +int fppPreProcess(struct fppTag *tags); +#else int PREFIX fppPreProcess(REG(a0) struct fppTag *); +#endif \ No newline at end of file diff --git a/usecpp.c b/usecpp.c index 3611ed2..1836eed 100644 --- a/usecpp.c +++ b/usecpp.c @@ -117,6 +117,11 @@ struct Library *FPPBase=NULL; #define DEFAULT_CPP_PREFS_FILE "$HOME/cpp.prefs" #endif +#ifdef _MSC_VER +#define FILE_LOCAL static +#define PREFIX +#endif + FILE_LOCAL char PREFIX *own_input(char *, int, void *); FILE_LOCAL void PREFIX own_output(int, void *); FILE_LOCAL void PREFIX own_error(void *, char *, va_list); @@ -276,7 +281,7 @@ char GetPrefs(struct fppTag **tagptr, char **string) unsigned Length_U; char *PrefsBuffer_PC; char ret= 0; - char *environ; + // char *environ; *string = NULL; @@ -300,12 +305,12 @@ char GetPrefs(struct fppTag **tagptr, char **string) return ret; } } - + /* if(environ = getenv("CPP_PREFS")) { ret= !DoString(tagptr, environ); if(ret && *string) free( *string ); - } + }*/ return ret; } diff --git a/wMakefile b/wMakefile new file mode 100644 index 0000000..da60381 --- /dev/null +++ b/wMakefile @@ -0,0 +1,20 @@ +TARGET =fcpp.exe +FLAG= /WX /utf-8 /MP + +SOURCES = \ + cpp1.c \ + cpp2.c \ + cpp3.c \ + cpp4.c \ + cpp5.c \ + cpp6.c \ + usecpp.c + + +all: $(TARGET) + +$(TARGET):$(SOURCES) + cl $(FLAG) /Fe$(TARGET) $(SOURCES) + +clean: + del *.exe & del *.obj From 2e8cd08ee7133f2dd09a1e58b12581fb23bc20ba Mon Sep 17 00:00:00 2001 From: Claudio Daffra Date: Sat, 9 Jan 2021 19:51:07 +0100 Subject: [PATCH 2/2] fix eviron on windows --- usecpp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/usecpp.c b/usecpp.c index 1836eed..8be0d70 100644 --- a/usecpp.c +++ b/usecpp.c @@ -281,7 +281,7 @@ char GetPrefs(struct fppTag **tagptr, char **string) unsigned Length_U; char *PrefsBuffer_PC; char ret= 0; - // char *environ; + char *Environ; *string = NULL; @@ -305,12 +305,12 @@ char GetPrefs(struct fppTag **tagptr, char **string) return ret; } } - /* - if(environ = getenv("CPP_PREFS")) { - ret= !DoString(tagptr, environ); + + if(Environ = getenv("CPP_PREFS")) { + ret= !DoString(tagptr, Environ); if(ret && *string) free( *string ); - }*/ + } return ret; }