Added testing for _WIN64 when testing for _WIN32

This commit is contained in:
Landon Curt Noll
2021-12-08 12:04:13 -08:00
parent 9f3a7817d3
commit af72992ead
17 changed files with 48 additions and 44 deletions

View File

@@ -3,7 +3,7 @@ The following are the changes from calc version 2.14.0.11 to date:
Fixed a number of typos. Fixed a number of typos.
Drop support for SunOS, IRIX and MINGW32_NT-5.0 targets. Drop support for SunOS, IRIX and MINGW32_NT-5.0 targets.
Drop support for CLOCK_SGI_CYCLE. Drop support for CLOCK_SGI_CYCLE. Drop testing for __MSDOS__.
Minor improvement of various help files. Made format of help Minor improvement of various help files. Made format of help
files more consistent. files more consistent.
@@ -33,6 +33,10 @@ The following are the changes from calc version 2.14.0.11 to date:
CALC_CHARBIT. Added have_limits.h to determine if <limits.h> CALC_CHARBIT. Added have_limits.h to determine if <limits.h>
is a system include file. is a system include file.
Test for _WIN64 when testing for _WIN32.
Now assuming that <stdio.h> is availabke under _WIN32 and _WIN64.
The following are the changes from calc version 2.14.0.9 to 2.14.0.10: The following are the changes from calc version 2.14.0.9 to 2.14.0.10:

View File

@@ -42,9 +42,7 @@
# include <string.h> # include <string.h>
#else #else
#if defined(_WIN32) && defined(NOTCYGWIN)
#include <stdio.h> #include <stdio.h>
#endif
# if defined(HAVE_NEWSTR) # if defined(HAVE_NEWSTR)
E_FUNC void *memcpy(); E_FUNC void *memcpy();

8
calc.c
View File

@@ -29,14 +29,14 @@
#include <stdio.h> #include <stdio.h>
#include <signal.h> #include <signal.h>
#if !defined (_WIN32) #if !defined(_WIN32) && !defined(_WIN64)
# include <pwd.h> # include <pwd.h>
#endif #endif
#include <sys/types.h> #include <sys/types.h>
#include <ctype.h> #include <ctype.h>
#if defined(_WIN32) #if defined(_WIN32) || defined(_WIN64)
# include <io.h> # include <io.h>
# if !defined(NOTCYGWIN) # if !defined(NOTCYGWIN)
/* /*
@@ -704,7 +704,7 @@ main(int argc, char **argv)
if (!p_flag && i_flag && !stdin_tty) { if (!p_flag && i_flag && !stdin_tty) {
closeinput(); closeinput();
if(!freopen("/dev/tty", "r", stdin)) { if(!freopen("/dev/tty", "r", stdin)) {
#if defined (_WIN32) #if defined(_WIN32) || defined(_WIN64)
fprintf(stderr, fprintf(stderr,
"/dev/tty does not exist on " "/dev/tty does not exist on "
"this operating system. " "this operating system. "
@@ -734,7 +734,7 @@ main(int argc, char **argv)
!p_flag && (!havecommands||i_flag)) { !p_flag && (!havecommands||i_flag)) {
closeinput(); closeinput();
if(!freopen("/dev/tty", "r", stdin)) { if(!freopen("/dev/tty", "r", stdin)) {
#if defined (_WIN32) #if defined(_WIN32) || defined(_WIN64)
fprintf(stderr, fprintf(stderr,
"/dev/tty does not exist on " "/dev/tty does not exist on "
"this operating system. " "this operating system. "

6
calc.h
View File

@@ -59,7 +59,7 @@
#define HOMECHAR '~' /* char which indicates home directory */ #define HOMECHAR '~' /* char which indicates home directory */
#define DOTCHAR '.' /* char which indicates current directory */ #define DOTCHAR '.' /* char which indicates current directory */
#define PATHCHAR '/' /* char which separates path components */ #define PATHCHAR '/' /* char which separates path components */
#if defined(__MSDOS__) || defined(__WIN32) #if defined(_WIN32) || defined(_WIN64)
#define LISTCHAR ';' /* char which separates paths in a list */ #define LISTCHAR ';' /* char which separates paths in a list */
#else #else
#define LISTCHAR ':' /* char which separates paths in a list */ #define LISTCHAR ':' /* char which separates paths in a list */
@@ -123,7 +123,7 @@ E_FUNC int get_inode(FILEID id, ZVALUE *ino);
E_FUNC FILEID reopenid(FILEID id, char *mode, char *name); E_FUNC FILEID reopenid(FILEID id, char *mode, char *name);
E_FUNC int closeall(void); E_FUNC int closeall(void);
#if !defined(_WIN32) #if !defined(_WIN32) && !defined(_WIN64)
E_FUNC int flushall(void); E_FUNC int flushall(void);
#endif #endif
@@ -186,7 +186,7 @@ E_FUNC char *calc_strdup(CONST char *);
*/ */
E_FUNC void initialize(void); E_FUNC void initialize(void);
E_FUNC void reinitialize(void); E_FUNC void reinitialize(void);
#if !defined (_WIN32) #if !defined(_WIN32) && !defined(_WIN64)
E_FUNC int isatty(int tty); /* TRUE if fd is a tty */ E_FUNC int isatty(int tty); /* TRUE if fd is a tty */
#endif #endif
E_FUNC char *version(void); /* return version string */ E_FUNC char *version(void); /* return version string */

View File

@@ -44,9 +44,11 @@
#include "conf.h" #include "conf.h"
#include "strl.h" #include "strl.h"
#if defined(_WIN32) && !defined(__CYGWIN__) #if defined(_WIN32) || defined(_WIN64)
#if !defined(__CYGWIN__)
# include <direct.h> # include <direct.h>
#endif #endif
#endif
#include "banned.h" /* include after system header <> includes */ #include "banned.h" /* include after system header <> includes */

View File

@@ -176,7 +176,7 @@ CONFIG oldstd = { /* backward compatible standard configuration */
CTRL_D_VIRGIN_EOF, /* ^D only exits on virgin lines */ CTRL_D_VIRGIN_EOF, /* ^D only exits on virgin lines */
NULL, /* our name */ NULL, /* our name */
NULL, /* basename of our name */ NULL, /* basename of our name */
#if defined(_WIN32) #if defined(_WIN32) || defined(_WIN64)
TRUE, /* running under windows */ TRUE, /* running under windows */
#else #else
FALSE, /* congrats, you are not using windows */ FALSE, /* congrats, you are not using windows */
@@ -236,7 +236,7 @@ CONFIG newstd = { /* new non-backward compatible configuration */
CTRL_D_VIRGIN_EOF, /* ^D only exits on virgin lines */ CTRL_D_VIRGIN_EOF, /* ^D only exits on virgin lines */
NULL, /* our name */ NULL, /* our name */
NULL, /* basename of our name */ NULL, /* basename of our name */
#if defined(_WIN32) #if defined(_WIN32) || defined(_WIN64)
TRUE, /* running under windows */ TRUE, /* running under windows */
#else #else
FALSE, /* congrats, you are not using windows */ FALSE, /* congrats, you are not using windows */

2
decl.h
View File

@@ -54,7 +54,7 @@
/* /*
* MS Windows macros * MS Windows macros
*/ */
#elif defined(_WIN32) || defined(WINDOZ) #elif defined(_WIN32) || defined(_WIN64)
/* determine which type of DLL we must generate */ /* determine which type of DLL we must generate */

4
file.c
View File

@@ -46,7 +46,7 @@
#include "calcerr.h" #include "calcerr.h"
#include "strl.h" #include "strl.h"
#if defined(_WIN32) #if defined(_WIN32) || defined(_WIN64)
# include <io.h> # include <io.h>
#endif #endif
@@ -728,7 +728,7 @@ flushid(FILEID id)
} }
#if !defined(_WIN32) #if !defined(_WIN32) && !defined(_WIN64)
int int
flushall(void) flushall(void)
{ {

8
func.c
View File

@@ -33,7 +33,7 @@
#include <errno.h> #include <errno.h>
#if defined(_WIN32) #if defined(_WIN32) || defined(_WIN64)
# include <io.h> # include <io.h>
# define _access access # define _access access
#endif #endif
@@ -7474,7 +7474,7 @@ f_fflush(int count, VALUE **vals)
i = 0; i = 0;
errno = 0; errno = 0;
if (count == 0) { if (count == 0) {
#if !defined(_WIN32) #if !defined(_WIN32) && !defined(_WIN64)
i = flushall(); i = flushall();
#endif /* Windows free systems */ #endif /* Windows free systems */
} else { } else {
@@ -9043,7 +9043,7 @@ f_system(VALUE *vp)
if (conf->calc_debug & CALCDBG_SYSTEM) { if (conf->calc_debug & CALCDBG_SYSTEM) {
printf("%s\n", vp->v_str->s_str); printf("%s\n", vp->v_str->s_str);
} }
#if defined(_WIN32) #if defined(_WIN32) || defined(_WIN64)
/* if the execute length is 0 then just return 0 */ /* if the execute length is 0 then just return 0 */
if (vp->v_str->s_len == 0) { if (vp->v_str->s_len == 0) {
result.v_num = itoq((long)0); result.v_num = itoq((long)0);
@@ -9066,7 +9066,7 @@ f_sleep(int count, VALUE **vals)
res.v_type = V_NULL; res.v_type = V_NULL;
res.v_subtype = V_NOSUBTYPE; res.v_subtype = V_NOSUBTYPE;
#if !defined(_WIN32) #if !defined(_WIN32) && !defined(_WIN64)
if (count > 0) { if (count > 0) {
if (vals[0]->v_type != V_NUM || qisneg(vals[0]->v_num)) if (vals[0]->v_type != V_NUM || qisneg(vals[0]->v_num))
return error_value(E_SLEEP); return error_value(E_SLEEP);

View File

@@ -69,7 +69,7 @@ main(void)
if (value > (off_t)1) { if (value > (off_t)1) {
--value; --value;
} }
#if !defined(_WIN32) #if !defined(_WIN32) && !defined(_WIN64)
if (value <= (off_t)getppid()) { if (value <= (off_t)getppid()) {
--value; --value;
} }

View File

@@ -69,7 +69,7 @@ main(void)
if (value > (FILEPOS)1) { if (value > (FILEPOS)1) {
--value; --value;
} }
#if !defined(_WIN32) #if !defined(_WIN32) && !defined(_WIN64)
if (value <= (FILEPOS)getppid()) { if (value <= (FILEPOS)getppid()) {
--value; --value;
} }

2
help.c
View File

@@ -40,7 +40,7 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#if defined(_WIN32) #if defined(_WIN32) || defined(_WIN64)
# define popen _popen # define popen _popen
# define pclose _pclose # define pclose _pclose
#endif #endif

2
hist.c
View File

@@ -36,7 +36,7 @@
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#if !defined(_WIN32) #if !defined(_WIN32) && !defined(_WIN64)
# include <pwd.h> # include <pwd.h>
#endif #endif

2
hist.h
View File

@@ -46,7 +46,7 @@
#define HOMECHAR '~' /* char which indicates home directory */ #define HOMECHAR '~' /* char which indicates home directory */
#define DOTCHAR '.' /* char which indicates current directory */ #define DOTCHAR '.' /* char which indicates current directory */
#define PATHCHAR '/' /* char which separates path components */ #define PATHCHAR '/' /* char which separates path components */
#if defined(__MSDOS__) || defined(__WIN32) #if defined(_WIN32) || defined(_WIN64)
#define LISTCHAR ';' /* char which separates paths in a list */ #define LISTCHAR ';' /* char which separates paths in a list */
#else #else
#define LISTCHAR ':' /* char which separates paths in a list */ #define LISTCHAR ':' /* char which separates paths in a list */

18
input.c
View File

@@ -31,7 +31,7 @@
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#if !defined(_WIN32) #if !defined(_WIN32) && !defined(_WIN64)
# include <pwd.h> # include <pwd.h>
#else #else
# include <stdlib.h> # include <stdlib.h>
@@ -407,7 +407,7 @@ f_pathopen(char *name, char *mode, char *pathlist, char **openpath)
S_FUNC char * S_FUNC char *
homeexpand(char *name) homeexpand(char *name)
{ {
#if defined(_WIN32) #if defined(_WIN32) || defined(_WIN64)
return NULL; return NULL;
@@ -969,12 +969,12 @@ runrcfiles(void)
* a given device/inode, -1 otherwise. * a given device/inode, -1 otherwise.
* *
* *
* WIN32 NOTE: * _WIN32 and _WIN64 NOTE:
* *
* This function does not work under WIN32. The sbuf->st_ino is always * This function does not work under _WIN32 or _WIN64. The sbuf->st_ino is always
* zero because the FAT and NTFS filesystems do not support inodes. * zero because the FAT and NTFS filesystems do not support inodes.
* They also don't support links, which is why you need this function * They also don't support links, which is why you need this function
* under UNIX. For WIN32, use _fullpath() to determine if you have * under UNIX. For _WIN32 or _WIN64, use _fullpath() to determine if you have
* already opened a file. * already opened a file.
* *
* given: * given:
@@ -994,7 +994,7 @@ isinoderead(struct stat *sbuf)
/* scan the entire readset */ /* scan the entire readset */
for (i=0; i < maxreadset; ++i) { for (i=0; i < maxreadset; ++i) {
#if defined(_WIN32) || defined(__MSDOS__) #if defined(_WIN32) || defined(_WIN64)
char tmp[MSDOS_MAX_PATH+1]; char tmp[MSDOS_MAX_PATH+1];
tmp[MSDOS_MAX_PATH] = '\0'; tmp[MSDOS_MAX_PATH] = '\0';
if (_fullpath(tmp, cip->i_name, MSDOS_MAX_PATH) && if (_fullpath(tmp, cip->i_name, MSDOS_MAX_PATH) &&
@@ -1120,10 +1120,10 @@ addreadset(char *name, char *path, struct stat *sbuf)
return -1; return -1;
} }
strlcpy(readset[ret].name, name, name_len+1); strlcpy(readset[ret].name, name, name_len+1);
#if defined(_WIN32) || defined(__MSDOS__) #if defined(_WIN32) || defined(_WIN64)
/* /*
* For WIN32, _fullpath expands the path to a fully qualified * For _WIN32 or _WIN64, _fullpath expands the path to a fully qualified
* path name, which under WIN32 FAT and NTFS is unique, just * path name, which under _WIN32 or _WIN64 FAT and NTFS is unique, just
* like UNIX inodes. _fullpath also allocated the memory for * like UNIX inodes. _fullpath also allocated the memory for
* this new longer path name. * this new longer path name.
*/ */

View File

@@ -29,7 +29,7 @@
#include <setjmp.h> #include <setjmp.h>
#include <signal.h> #include <signal.h>
#if !defined(_WIN32) #if !defined(_WIN32) && !defined(_WIN64)
# include <pwd.h> # include <pwd.h>
#endif #endif
@@ -84,7 +84,7 @@ typedef struct {int fd;} ttystruct;
#endif #endif
#if !defined(_WIN32) #if !defined(_WIN32) && !defined(_WIN64)
# if !defined(USE_SGTTY) && !defined (USE_TERMIOS) && !defined(USE_TERMIO) # if !defined(USE_SGTTY) && !defined (USE_TERMIOS) && !defined(USE_TERMIO)
-=*#*=- A Windows free system without termio, termios or sgtty!!! -=*#*=- -=*#*=- A Windows free system without termio, termios or sgtty!!! -=*#*=-
@@ -240,7 +240,7 @@ libcalc_call_me_first(void)
* Disable SIGPIPE so that the pipe to the help file pager will * Disable SIGPIPE so that the pipe to the help file pager will
* not stop calc. * not stop calc.
*/ */
#if !defined(_WIN32) #if !defined(_WIN32) && !defined(_WIN64)
(void) signal(SIGPIPE, SIG_IGN); (void) signal(SIGPIPE, SIG_IGN);
#endif #endif
@@ -249,7 +249,7 @@ libcalc_call_me_first(void)
*/ */
if (program != NULL) { if (program != NULL) {
p = strrchr(program, '/'); p = strrchr(program, '/');
#if defined(_WIN32) || defined(__MSDOS__) #if defined(_WIN32) || defined(_WIN64)
if (p == NULL) { if (p == NULL) {
p = strrchr(program, '\\'); p = strrchr(program, '\\');
} }
@@ -481,7 +481,7 @@ cvmalloc_error(char *message)
S_FUNC void S_FUNC void
initenv(void) initenv(void)
{ {
#if !defined(_WIN32) #if !defined(_WIN32) && !defined(_WIN64)
struct passwd *ent; /* our password entry */ struct passwd *ent; /* our password entry */
#endif #endif
char *c; char *c;
@@ -512,7 +512,7 @@ initenv(void)
/* determine the $HOME value */ /* determine the $HOME value */
c = (no_env ? NULL : getenv(HOME)); c = (no_env ? NULL : getenv(HOME));
home = (c ? strdup(c) : NULL); home = (c ? strdup(c) : NULL);
#if defined(_WIN32) #if defined(_WIN32) || defined(_WIN64)
if (home == NULL || home[0] == '\0') { if (home == NULL || home[0] == '\0') {
/* free home if it was previously allocated, but empty */ /* free home if it was previously allocated, but empty */
if (home != NULL) { if (home != NULL) {

8
seed.c
View File

@@ -47,7 +47,7 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#if defined(_WIN32) #if defined(_WIN32) || defined(_WIN64)
# include <process.h> # include <process.h>
# define pid_t int # define pid_t int
#endif #endif
@@ -75,7 +75,7 @@
#if defined(HAVE_SYS_TIMES_H) #if defined(HAVE_SYS_TIMES_H)
#include <sys/times.h> #include <sys/times.h>
#endif #endif
#if !defined(_WIN32) #if !defined(_WIN32) && !defined(_WIN64)
# include <sys/resource.h> # include <sys/resource.h>
#endif #endif
#if defined(HAVE_STDLIB_H) #if defined(HAVE_STDLIB_H)
@@ -372,7 +372,7 @@ pseudo_seed(void)
struct timeval tp; /* time of day */ struct timeval tp; /* time of day */
#endif #endif
pid_t getpid; /* process ID */ pid_t getpid; /* process ID */
#if !defined(_WIN32) #if !defined(_WIN32) && !defined(_WIN64)
pid_t getppid; /* parent process ID */ pid_t getppid; /* parent process ID */
#endif #endif
#if defined(HAVE_UID_T) #if defined(HAVE_UID_T)
@@ -518,7 +518,7 @@ pseudo_seed(void)
(void) gettimeofday(&sdata.tp, NULL); (void) gettimeofday(&sdata.tp, NULL);
#endif #endif
sdata.getpid = getpid(); sdata.getpid = getpid();
#if !defined(_WIN32) #if !defined(_WIN32) && !defined(_WIN64)
sdata.getppid = getppid(); sdata.getppid = getppid();
#endif #endif
#if defined(HAVE_UID_T) #if defined(HAVE_UID_T)