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.
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
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>
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:

View File

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

8
calc.c
View File

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

6
calc.h
View File

@@ -59,7 +59,7 @@
#define HOMECHAR '~' /* char which indicates home directory */
#define DOTCHAR '.' /* char which indicates current directory */
#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 */
#else
#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 int closeall(void);
#if !defined(_WIN32)
#if !defined(_WIN32) && !defined(_WIN64)
E_FUNC int flushall(void);
#endif
@@ -186,7 +186,7 @@ E_FUNC char *calc_strdup(CONST char *);
*/
E_FUNC void initialize(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 */
#endif
E_FUNC char *version(void); /* return version string */

View File

@@ -44,9 +44,11 @@
#include "conf.h"
#include "strl.h"
#if defined(_WIN32) && !defined(__CYGWIN__)
#if defined(_WIN32) || defined(_WIN64)
#if !defined(__CYGWIN__)
# include <direct.h>
#endif
#endif
#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 */
NULL, /* our name */
NULL, /* basename of our name */
#if defined(_WIN32)
#if defined(_WIN32) || defined(_WIN64)
TRUE, /* running under windows */
#else
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 */
NULL, /* our name */
NULL, /* basename of our name */
#if defined(_WIN32)
#if defined(_WIN32) || defined(_WIN64)
TRUE, /* running under windows */
#else
FALSE, /* congrats, you are not using windows */

2
decl.h
View File

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

4
file.c
View File

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

8
func.c
View File

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

View File

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

View File

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

2
help.c
View File

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

2
hist.c
View File

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

2
hist.h
View File

@@ -46,7 +46,7 @@
#define HOMECHAR '~' /* char which indicates home directory */
#define DOTCHAR '.' /* char which indicates current directory */
#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 */
#else
#define LISTCHAR ':' /* char which separates paths in a list */

18
input.c
View File

@@ -31,7 +31,7 @@
#include <stdio.h>
#include <ctype.h>
#if !defined(_WIN32)
#if !defined(_WIN32) && !defined(_WIN64)
# include <pwd.h>
#else
# include <stdlib.h>
@@ -407,7 +407,7 @@ f_pathopen(char *name, char *mode, char *pathlist, char **openpath)
S_FUNC char *
homeexpand(char *name)
{
#if defined(_WIN32)
#if defined(_WIN32) || defined(_WIN64)
return NULL;
@@ -969,12 +969,12 @@ runrcfiles(void)
* 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.
* 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.
*
* given:
@@ -994,7 +994,7 @@ isinoderead(struct stat *sbuf)
/* scan the entire readset */
for (i=0; i < maxreadset; ++i) {
#if defined(_WIN32) || defined(__MSDOS__)
#if defined(_WIN32) || defined(_WIN64)
char tmp[MSDOS_MAX_PATH+1];
tmp[MSDOS_MAX_PATH] = '\0';
if (_fullpath(tmp, cip->i_name, MSDOS_MAX_PATH) &&
@@ -1120,10 +1120,10 @@ addreadset(char *name, char *path, struct stat *sbuf)
return -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
* path name, which under WIN32 FAT and NTFS is unique, just
* For _WIN32 or _WIN64, _fullpath expands the path to a fully qualified
* path name, which under _WIN32 or _WIN64 FAT and NTFS is unique, just
* like UNIX inodes. _fullpath also allocated the memory for
* this new longer path name.
*/

View File

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

8
seed.c
View File

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