generate variable oscompiled

test for variable
This commit is contained in:
Holger Vogt 2020-01-02 13:38:32 +01:00
parent d6418ce6b6
commit ef95ff7edc
3 changed files with 72 additions and 1 deletions

View File

@ -321,7 +321,7 @@ case $host_os in
AC_DEFINE([OS_COMPILED], [7], [macOS])
;;
* )
AC_DEFINE([OS_COMPILED], [8], [Other Operating System])
AC_DEFINE([OS_COMPILED], [0], [Other Operating System])
;;
esac

View File

@ -0,0 +1,34 @@
*ng_script test for oscompiled
.control
if $oscompiled = 0
echo [0], Other
endif
if $oscompiled = 1
echo [1], MINGW for MS Windows
endif
if $oscompiled = 2
echo [2], Cygwin for MS Windows
endif
if $oscompiled = 3
echo [3], FreeBSD
endif
if $oscompiled = 4
echo [4], OpenBSD
endif
if $oscompiled = 5
echo [5], Solaris
endif
if $oscompiled = 6
echo [6], Linux
endif
if $oscompiled = 7
echo [7], macOS
endif
if $oscompiled = 8
echo [8], Visual Studio for MS Windows
endif
.endc
.end

View File

@ -30,4 +30,41 @@ cp_init(void)
/* io redirection in streams.c:
cp_in set to cp_curin etc. */
cp_ioreset();
/*set a variable oscompiled containing the OS at compile time
[0], Other
[1], MINGW for MS Windows
[2], Cygwin for MS Windows
[3], FreeBSD
[4], OpenBSD
[5], Solaris
[6], Linux
[7], macOS
[8], Visual Studio for MS Windows
The variable may be used in a .control section to perform OS
specific actions (setting fonts etc.).
*/
int itmp;
#if OS_COMPILED == 1
itmp = 1;
#elif OS_COMPILED == 2
itmp = 2;
#elif OS_COMPILED == 3
itmp = 3;
#elif OS_COMPILED == 4
itmp = 4;
#elif OS_COMPILED == 5
itmp = 5;
#elif OS_COMPILED == 6
itmp = 6;
#elif OS_COMPILED == 7
itmp = 7;
#else
itmp = 0;
#endif
/* not using configure.ac */
#ifdef _MSC_VER
itmp = 8;
#endif
cp_vset("oscompiled", CP_NUM, &itmp);
}