view anagram/support/port.h @ 6:607e3be6bad8

Adjust to the moving target called the C++ standard. Apparently nowadays it's not allowed to define an explicit copy constructor but not an assignment operator. Consequently, defining the explicit copy constructor in terms of the implicit/automatic assignment operator for general convenience no longer works. Add assignment operators. Caution: not tested with the IBM compiler, but there's no particular reason it shouldn't work.
author David A. Holland
date Mon, 30 May 2022 23:46:22 -0400
parents 13d2b8934445
children
line wrap: on
line source

/*
 * AnaGram, A System for Syntax Directed Programming
 * Copyright 1993-2002 Parsifal Software. All Rights Reserved.
 * Copyright 2006 David A. Holland. All rights reserved.
 * See the file COPYING for license and usage terms.
 *
 * port.h - portability file
 */

#ifndef PORT_H
#define PORT_H

/*
 * OS issues
 * (note that a bunch of file-related issues are handled in file.h)
 */

#ifdef AG_ON_UNIX
#define stricmp strcasecmp
#define strnicmp strncasecmp
#define _MAX_PATH PATH_MAX

char *strlwr(char *string);
#endif

#ifdef AG_ON_WINDOWS
#define PATH_MAX _MAX_PATH
#endif

/*
 * Compiler issues
 */

#ifdef __GNUC__
#define PRINTFFY(a,b) __attribute__((__format__(__printf__, a, b)))
#else
#define PRINTFFY(a,b)
#endif

#ifdef __IBMCPP__
/* obsolete compiler, no snprintf */
int snprintf(char *, unsigned, const char *, ...) PRINTFFY(3,4);
#endif

/* this is some kind of function pointer weirdness, maybe dll-related */
#ifdef __IBMCPP__
#define OPTLINK _Optlink
#else
#define OPTLINK
#endif

/*
 * Nothing currently supported has a useful way to check for stack
 * overflow.
 */

//#define check_stack if (stackavail() < 0x100) bad_stack();
#define check_stack

/*
 * these are used by dict.cpp, stk.cpp, and tsd.cpp and it's not at all
 * clear why they're here, or where they should go. (XXX)
 */

#define MAX_BYTES 10000000U
#define MAX_INTS  10000000U

#endif /* PORT_H */