Randy Keup
December 16, 1999
Here are the files with the bug fixes. I would advertise this to the group.
Simone, you will need to install these files (at least CTYPE.H) on your PC.
And here are instructions covering all the problems I know about.
Patched bugs
=============
CTYPE.H is generally located in the Visual C++ include area.
Intellution included their own version of this file in the Fixtools include area with FIX additions hardwired for Visual C++ 4.0. Of course, this conflicts with Visual C++ 5.0 which is what we have. So I took the CTYPE.H file out of the VC++ area and added the FIX additions by hand and surrounded them with #ifdef _FIX_PROJECT_ #endif blocks. So in the project settings, you must add _FIX_PROJECT_ to the preprocessor definitions, and in the Fixtools include area, rename the existing CTYPE.H file something else, and then copy this version of the file to that directory.
In the Fixtools include area, you should rename string.h something else, so that it doesn't get used. There is already a string.h in the VC++ area which seems to work fine with EDA.
XSTRING is located in the Visual C++ include area and contains the class definition for the string class which is part of the STL library. There is a memory overwriting bug which is fixed in later releases of VC++, but I patched this file to fix the bug (at least it seems fixed in my case).
In the VC++ area, rename the XSTRING file and copy this one there.
Other bugs and things
======================
Another bug is in the queue class, but since the same functionality exists in the list class, I didn't bother trying to fix it. It is also a memory overwriting bug. So don't use the queue class.
You need to #include <windows.h> to compile EDA related programs (at least in my experience). Additionally, if you are creating an MFC application and you encounter bizarre compile errors relating to new and/or delete having multiple definitions, then a possible fix is to turn off precompiled headers, and make sure that you #include <stdafx.h> before anything else in every file. This forces a certain library order such that the same version of new and/or delete is used every time.
This last one is only for MFC applications though, not console apps.
I think that's everything.
Feel free to ask if something doesn't work.
Randy
--
------------------------------|------------------|----------------------------
Randy M. Thurman-Keup, Ph.D. | ____ | / \ \
mailtokeup@fnal.gov |This is | | | This is \ / __ /
http//ppl2.hep.anl.gov/~keup |your | | | your / \/\ \ \
|computer ---- | computer \ / \ \ /
/ / /| / / / |/ | ,======, | on /_(*&*&^$#(_
/__ / / |/ /__/ /| | `======' | Microsoft _*&(*&^$@%^$%^#_
------------------------------|------------------|----------------------------
/***
*ctype.h - character conversion macros and ctype macros
*
* Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
*
*Purpose
* Defines macros for character classification/conversion.
* [ANSI/System V]
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_CTYPE
#define _INC_CTYPE
/********************************************************/
/* RMTK 6/1/99 - integration of FIX stuff with VC++ 5.0 */
#ifdef _FIX_PROJECT_
#ifndef NO_NLS /*jtt021396*/
#include <pshpack1.h>
#include <nlsapi.h>
#include <poppack.h>
#endif /* NO_NLS jtt021396 */
#endif /* _FIX_PROJECT_ */
/**************************************************************/
#if !defined(_WIN32) && !defined(_MAC)
#error ERROR Only Mac or Win32 targets supported!
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Define _CRTAPI1 (for compatibility with the NT SDK) */
#ifndef _CRTAPI1
#if _MSC_VER >= 800 && _M_IX86 >= 300
#define _CRTAPI1 __cdecl
#else
#define _CRTAPI1
#endif
#endif
/* Define _CRTAPI2 (for compatibility with the NT SDK) */
#ifndef _CRTAPI2
#if _MSC_VER >= 800 && _M_IX86 >= 300
#define _CRTAPI2 __cdecl
#else
#define _CRTAPI2
#endif
#endif
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _NTSDK
/* definition compatible with NT SDK */
#define _CRTIMP
#else /* ndef _NTSDK */
/* current definition */
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _NTSDK */
#endif /* _CRTIMP */
/* Define __cdecl for non-Microsoft compilers */
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
#define __cdecl
#endif
#ifndef _WCHAR_T_DEFINED
typedef unsigned short wchar_t;
#define _WCHAR_T_DEFINED
#endif
#ifndef _MAC
#ifndef _WCTYPE_T_DEFINED
typedef wchar_t wint_t;
typedef wchar_t wctype_t;
#define _WCTYPE_T_DEFINED
#endif
#ifndef WEOF
#define WEOF (wint_t)(0xFFFF)
#endif
#endif /* ndef _MAC */
/*
* These declarations allow the user access to the ctype look-up
* array _ctype defined in ctype.obj by simply including ctype.h
*/
#ifndef _CTYPE_DISABLE_MACROS
#ifdef _NTSDK
/* Definitions and declarations compatible with the NT SDK */
#ifdef _DLL
extern unsigned short * _ctype;
#define _pctype (*_pctype_dll)
extern unsigned short **_pctype_dll;
#define _pwctype (*_pwctype_dll)
extern unsigned short **_pwctype_dll;
#else /* _DLL */
extern unsigned short _ctype[];
extern unsigned short *_pctype;
extern wctype_t *_pwctype;
#endif /* _DLL */
#else /* ndef _NTSDK */
/* Current declarations */
_CRTIMP extern unsigned short _ctype[];
#if defined(_DLL) && defined(_M_IX86)
#define _pctype (*__p__pctype())
_CRTIMP unsigned short ** __cdecl __p__pctype(void);
#define _pwctype (*__p__pwctype())
_CRTIMP wctype_t ** __cdecl ___p__pwctype(void);
#else /* !(defined(_DLL) && defined(_M_IX86)) */
_CRTIMP extern unsigned short *_pctype;
#ifndef _MAC
_CRTIMP extern wctype_t *_pwctype;
#endif /* ndef _MAC */
#endif /* defined(_DLL) && defined(_M_IX86) */
#endif /* _NTSDK */
#endif /* _CTYPE_DISABLE_MACROS */
/* set bit masks for the possible character types */
#define _UPPER 0x1 /* upper case letter */
#define _LOWER 0x2 /* lower case letter */
#define _DIGIT 0x4 /* digit[0-9] */
#define _SPACE 0x8 /* tab, carriage return, newline, */
/* vertical tab or form feed */
#define _PUNCT 0x10 /* punctuation character */
#define _CONTROL 0x20 /* control character */
#define _BLANK 0x40 /* space char */
#define _HEX 0x80 /* hexadecimal digit */
#define _LEADBYTE 0x8000 /* multibyte leadbyte */
#define _ALPHA (0x0100|_UPPER|_LOWER) /* alphabetic character */
/* character classification function prototypes */
#ifndef _CTYPE_DEFINED
_CRTIMP int __cdecl _isctype(int, int);
/********************************************************/
/* RMTK 6/1/99 - integration of FIX stuff with VC++ 5.0 */
#ifdef _FIX_PROJECT_
/*jtt021396*/
int __cdecl nlisalpha(int);
int __cdecl nlisupper(int);
int __cdecl nlislower(int);
int __cdecl nlisdigit(int);
int __cdecl isxdigit(int);
int __cdecl nlisspace(int);
int __cdecl nlispunct(int);
int __cdecl nlisalnum(int);
int __cdecl nlisprint(int);
int __cdecl nlisgraph(int);
int __cdecl nliscntrl(int);
int __cdecl nltoupper(int);
int __cdecl nltolower(int);
int __cdecl _nltolower(int);
int __cdecl _nltoupper(int);
/*jlg092194 - added the following for NLS */
int __cdecl nlDblDig2SinglDig(int, int *);
#else
_CRTIMP int __cdecl isalpha(int);
_CRTIMP int __cdecl isupper(int);
_CRTIMP int __cdecl islower(int);
_CRTIMP int __cdecl isdigit(int);
_CRTIMP int __cdecl isxdigit(int);
_CRTIMP int __cdecl isspace(int);
_CRTIMP int __cdecl ispunct(int);
_CRTIMP int __cdecl isalnum(int);
_CRTIMP int __cdecl isprint(int);
_CRTIMP int __cdecl isgraph(int);
_CRTIMP int __cdecl iscntrl(int);
_CRTIMP int __cdecl toupper(int);
_CRTIMP int __cdecl tolower(int);
_CRTIMP int __cdecl _tolower(int);
_CRTIMP int __cdecl _toupper(int);
#endif /* _FIX_PROJECT_ */
/**************************************************************/
_CRTIMP int __cdecl __isascii(int);
_CRTIMP int __cdecl __toascii(int);
_CRTIMP int __cdecl __iscsymf(int);
_CRTIMP int __cdecl __iscsym(int);
#define _CTYPE_DEFINED
#endif
#ifndef _MAC
#ifndef _WCTYPE_DEFINED
/* wide function prototypes, also declared in wchar.h */
/* character classification function prototypes */
_CRTIMP int __cdecl iswalpha(wint_t);
_CRTIMP int __cdecl iswupper(wint_t);
_CRTIMP int __cdecl iswlower(wint_t);
_CRTIMP int __cdecl iswdigit(wint_t);
_CRTIMP int __cdecl iswxdigit(wint_t);
_CRTIMP int __cdecl iswspace(wint_t);
_CRTIMP int __cdecl iswpunct(wint_t);
_CRTIMP int __cdecl iswalnum(wint_t);
_CRTIMP int __cdecl iswprint(wint_t);
_CRTIMP int __cdecl iswgraph(wint_t);
_CRTIMP int __cdecl iswcntrl(wint_t);
_CRTIMP int __cdecl iswascii(wint_t);
_CRTIMP int __cdecl isleadbyte(int);
_CRTIMP wchar_t __cdecl towupper(wchar_t);
_CRTIMP wchar_t __cdecl towlower(wchar_t);
_CRTIMP int __cdecl iswctype(wint_t, wctype_t);
/* --------- The following functions are OBSOLETE --------- */
_CRTIMP int __cdecl is_wctype(wint_t, wctype_t);
/* --------- The preceding functions are OBSOLETE --------- */
#define _WCTYPE_DEFINED
#endif
#endif /* ndef _MAC */
/* the character classification macro definitions */
#ifndef _CTYPE_DISABLE_MACROS
/*
* Maximum number of bytes in multi-byte character in the current locale
* (also defined in stdlib.h).
*/
#ifndef MB_CUR_MAX
#ifdef _NTSDK
/* definition compatible with NT SDK */
#ifdef _DLL
#define __mb_cur_max (*__mb_cur_max_dll)
#define MB_CUR_MAX (*__mb_cur_max_dll)
extern unsigned short *__mb_cur_max_dll;
#else /* ndef _DLL */
#define MB_CUR_MAX __mb_cur_max
extern unsigned short __mb_cur_max;
#endif /* _DLL */
#else /* ndef _NTSDK */
/* current definition */
#if defined(_DLL) && defined(_M_IX86)
#define MB_CUR_MAX (*__p___mb_cur_max())
_CRTIMP int * __cdecl __p___mb_cur_max(void);
#else /* !(defined(_DLL) && defined(_M_IX86)) */
#define MB_CUR_MAX __mb_cur_max
_CRTIMP extern int __mb_cur_max;
#endif /* defined(_DLL) && defined(_M_IX86) */
#endif /* _NTSDK */
#endif /* MB_CUR_MAX */
#if defined(_M_MPPC) || defined(_M_M68K)
#ifndef __cplusplus
#define isalpha(_c) ( _pctype[_c] & (_UPPER|_LOWER) )
#define isupper(_c) ( _pctype[_c] & _UPPER )
#define islower(_c) ( _pctype[_c] & _LOWER )
#define isdigit(_c) ( _pctype[_c] & _DIGIT )
#define isxdigit(_c)( _pctype[_c] & _HEX )
#define isspace(_c) ( _pctype[_c] & _SPACE )
#define ispunct(_c) ( _pctype[_c] & _PUNCT )
#define isalnum(_c) ( _pctype[_c] & (_UPPER|_LOWER|_DIGIT) )
#define isprint(_c) ( _pctype[_c] & (_BLANK|_PUNCT|_UPPER|_LOWER|_DIGIT) )
#define isgraph(_c) ( _pctype[_c] & (_PUNCT|_UPPER|_LOWER|_DIGIT) )
#define iscntrl(_c) ( _pctype[_c] & _CONTROL )
#elif 0 /* Pending ANSI C++ integration */
inline int isalpha(int _C) {return (_pctype[_C] & (_UPPER|_LOWER)); }
inline int isupper(int _C) {return (_pctype[_C] & _UPPER); }
inline int islower(int _C) {return (_pctype[_C] & _LOWER); }
inline int isdigit(int _C) {return (_pctype[_C] & _DIGIT); }
inline int isxdigit(int _C) {return (_pctype[_C] & _HEX); }
inline int isspace(int _C) {return (_pctype[_C] & _SPACE); }
inline int ispunct(int _C) {return (_pctype[_C] & _PUNCT); }
inline int isalnum(int _C) {return (_pctype[_C] & (_UPPER|_LOWER|_DIGIT)); }
inline int isprint(int _C)
{return (_pctype[_C] & (_BLANK|_PUNCT|_UPPER|_LOWER|_DIGIT)); }
inline int isgraph(int _C)
{return (_pctype[_C] & (_PUNCT|_UPPER|_LOWER|_DIGIT)); }
inline int iscntrl(int _C) {return (_pctype[_C] & _CONTROL); }
#endif /* __cplusplus */
#else /* ifdef (MPPC), etc. */
/**************************************************************/
/* RMTK 6/1/99 - Integration of FIX with VC++ 5.0 *************/
#ifdef _FIX_PROJECT_
#ifndef _NLSAPI_H /*jtt021396*/
#ifndef __cplusplus
#define isalpha(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_ALPHA) _pctype[_c] & _ALPHA)
#define isupper(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_UPPER) _pctype[_c] & _UPPER)
#define islower(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_LOWER) _pctype[_c] & _LOWER)
#define isdigit(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_DIGIT) _pctype[_c] & _DIGIT)
#define isxdigit(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_HEX) _pctype[_c] & _HEX)
#define isspace(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_SPACE) _pctype[_c] & _SPACE)
#define ispunct(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_PUNCT) _pctype[_c] & _PUNCT)
#define isalnum(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_ALPHA|_DIGIT) _pctype[_c] & (_ALPHA|_DIGIT))
#define isprint(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT) _pctype[_c] & (_BLANK|_PUNCT|_ALPHA|_DIGIT))
#define isgraph(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_PUNCT|_ALPHA|_DIGIT) _pctype[_c] & (_PUNCT|_ALPHA|_DIGIT))
#define iscntrl(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_CONTROL) _pctype[_c] & _CONTROL)
#elif 0 /* Pending ANSI C++ integration */
inline int isalpha(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_ALPHA) _pctype[_C] & _ALPHA); }
inline int isupper(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_UPPER) _pctype[_C] & _UPPER); }
inline int islower(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_LOWER) _pctype[_C] & _LOWER); }
inline int isdigit(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_DIGIT) _pctype[_C] & _DIGIT); }
inline int isxdigit(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_HEX) _pctype[_C] & _HEX); }
inline int isspace(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_SPACE) _pctype[_C] & _SPACE); }
inline int ispunct(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_PUNCT) _pctype[_C] & _PUNCT); }
inline int isalnum(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_ALPHA|_DIGIT)
_pctype[_C] & (_ALPHA|_DIGIT)); }
inline int isprint(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_BLANK|_PUNCT|_ALPHA|_DIGIT)
_pctype[_C] & (_BLANK|_PUNCT|_ALPHA|_DIGIT)); }
inline int isgraph(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_PUNCT|_ALPHA|_DIGIT)
_pctype[_C] & (_PUNCT|_ALPHA|_DIGIT)); }
inline int iscntrl(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_CONTROL)
_pctype[_C] & _CONTROL); }
#endif /* __cplusplus */
#endif /*jtt021396*/
#else
#ifndef __cplusplus
#define isalpha(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_ALPHA) _pctype[_c] & _ALPHA)
#define isupper(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_UPPER) _pctype[_c] & _UPPER)
#define islower(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_LOWER) _pctype[_c] & _LOWER)
#define isdigit(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_DIGIT) _pctype[_c] & _DIGIT)
#define isxdigit(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_HEX) _pctype[_c] & _HEX)
#define isspace(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_SPACE) _pctype[_c] & _SPACE)
#define ispunct(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_PUNCT) _pctype[_c] & _PUNCT)
#define isalnum(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_ALPHA|_DIGIT) _pctype[_c] & (_ALPHA|_DIGIT))
#define isprint(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT) _pctype[_c] & (_BLANK|_PUNCT|_ALPHA|_DIGIT))
#define isgraph(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_PUNCT|_ALPHA|_DIGIT) _pctype[_c] & (_PUNCT|_ALPHA|_DIGIT))
#define iscntrl(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_CONTROL) _pctype[_c] & _CONTROL)
#elif 0 /* Pending ANSI C++ integration */
inline int isalpha(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_ALPHA) _pctype[_C] & _ALPHA); }
inline int isupper(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_UPPER) _pctype[_C] & _UPPER); }
inline int islower(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_LOWER) _pctype[_C] & _LOWER); }
inline int isdigit(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_DIGIT) _pctype[_C] & _DIGIT); }
inline int isxdigit(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_HEX) _pctype[_C] & _HEX); }
inline int isspace(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_SPACE) _pctype[_C] & _SPACE); }
inline int ispunct(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_PUNCT) _pctype[_C] & _PUNCT); }
inline int isalnum(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_ALPHA|_DIGIT)
_pctype[_C] & (_ALPHA|_DIGIT)); }
inline int isprint(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_BLANK|_PUNCT|_ALPHA|_DIGIT)
_pctype[_C] & (_BLANK|_PUNCT|_ALPHA|_DIGIT)); }
inline int isgraph(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_PUNCT|_ALPHA|_DIGIT)
_pctype[_C] & (_PUNCT|_ALPHA|_DIGIT)); }
inline int iscntrl(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_CONTROL)
_pctype[_C] & _CONTROL); }
#endif /* __cplusplus */
#endif /* _FIX_PROJECT */
/**************************************************************/
#endif /* _M_MPPC || _M_M68K */
/**************************************************************/
/* RMTK 6/1/99 - Integration of FIX with VC++ 5.0 *************/
#ifdef _FIX_PROJECT_
#ifndef _NLSAPI_H /*jtt021396*/
#define _tolower(_c) ( (_c)-'A'+'a' )
#define _toupper(_c) ( (_c)-'a'+'A' )
#endif /*jtt021396*/
#else
#define _tolower(_c) ( (_c)-'A'+'a' )
#define _toupper(_c) ( (_c)-'a'+'A' )
#endif /* _FIX_PROJECT */
/**************************************************************/
#define __isascii(_c) ( (unsigned)(_c) < 0x80 )
#define __toascii(_c) ( (_c) & 0x7f )
#ifndef _WCTYPE_INLINE_DEFINED
#ifndef __cplusplus
#define iswalpha(_c) ( iswctype(_c,_ALPHA) )
#define iswupper(_c) ( iswctype(_c,_UPPER) )
#define iswlower(_c) ( iswctype(_c,_LOWER) )
#define iswdigit(_c) ( iswctype(_c,_DIGIT) )
#define iswxdigit(_c) ( iswctype(_c,_HEX) )
#define iswspace(_c) ( iswctype(_c,_SPACE) )
#define iswpunct(_c) ( iswctype(_c,_PUNCT) )
#define iswalnum(_c) ( iswctype(_c,_ALPHA|_DIGIT) )
#define iswprint(_c) ( iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT) )
#define iswgraph(_c) ( iswctype(_c,_PUNCT|_ALPHA|_DIGIT) )
#define iswcntrl(_c) ( iswctype(_c,_CONTROL) )
#define iswascii(_c) ( (unsigned)(_c) < 0x80 )
#define isleadbyte(_c) (_pctype[(unsigned char)(_c)] & _LEADBYTE)
#elif 0 /* __cplusplus */
inline int iswalpha(wint_t _C) {return (iswctype(_C,_ALPHA)); }
inline int iswupper(wint_t _C) {return (iswctype(_C,_UPPER)); }
inline int iswlower(wint_t _C) {return (iswctype(_C,_LOWER)); }
inline int iswdigit(wint_t _C) {return (iswctype(_C,_DIGIT)); }
inline int iswxdigit(wint_t _C) {return (iswctype(_C,_HEX)); }
inline int iswspace(wint_t _C) {return (iswctype(_C,_SPACE)); }
inline int iswpunct(wint_t _C) {return (iswctype(_C,_PUNCT)); }
inline int iswalnum(wint_t _C) {return (iswctype(_C,_ALPHA|_DIGIT)); }
inline int iswprint(wint_t _C)
{return (iswctype(_C,_BLANK|_PUNCT|_ALPHA|_DIGIT)); }
inline int iswgraph(wint_t _C)
{return (iswctype(_C,_PUNCT|_ALPHA|_DIGIT)); }
inline int iswcntrl(wint_t _C) {return (iswctype(_C,_CONTROL)); }
inline int iswascii(wint_t _C) {return ((unsigned)(_C) < 0x80); }
inline int isleadbyte(int _C)
{return (_pctype[(unsigned char)(_C)] & _LEADBYTE); }
#endif /* __cplusplus */
#define _WCTYPE_INLINE_DEFINED
#endif /* _WCTYPE_INLINE_DEFINED */
/* MS C version 2.0 extended ctype macros */
#define __iscsymf(_c) (isalpha(_c) || ((_c) == '_'))
#define __iscsym(_c) (isalnum(_c) || ((_c) == '_'))
#endif /* _CTYPE_DISABLE_MACROS */
#if !__STDC__
/* Non-ANSI names for compatibility */
#ifdef _NTSDK
#define isascii __isascii
#define toascii __toascii
#define iscsymf __iscsymf
#define iscsym __iscsym
#else /* ndef _NTSDK */
#ifndef _CTYPE_DEFINED
_CRTIMP int __cdecl isascii(int);
_CRTIMP int __cdecl toascii(int);
_CRTIMP int __cdecl iscsymf(int);
_CRTIMP int __cdecl iscsym(int);
#else
#define isascii __isascii
#define toascii __toascii
#define iscsymf __iscsymf
#define iscsym __iscsym
#endif
#endif /* _NTSDK */
#endif /* __STDC__ */
/**************************************************************/
/* RMTK 6/1/99 - Integration of FIX with VC++ 5.0 *************/
#ifdef _FIX_PROJECT_
#ifndef NO_NLS
/*
* jtt021396
* The following two functions address the issue of a literal found at
* different code points in different languages' code pages. For instance,
* '|' is at 7C in code page 874 (Thailand) and BB for code page 500 (Belgium).
* It might be difficult to get DDE to work correctly without the right
* symbol for pipe.
*
* nl_get_special
* Given the tag (see below) fetch the character associated
* from the resource string table and return it in WCHAR.
*
* nl_is_special
* Given the string pointer and a tag to identify the test character
* return TRUE if the character at szTest is the test character.
*
* The specialized macros below are for the user's convenience.
*/
WCHAR nl_get_special(unsigned int tag);
int nl_is_special(char *szTest, unsigned int tag);
void nl_read_specials(void);
/*
* These "tags" index to the correct string in the resource
* stringtable bound to nlsres.dll.
*/
#define UNDERSCORE_ID 7090
#define LSQBRACKET_ID 7091
#define RSQBRACKET_ID 7092
#define PIPE_ID 7093
#define LCURLY_BRACKET_ID 7094
#define RCURLY_BRACKET_ID 7095
#define nl_is_underscore(szTest) nl_is_special((szTest), UNDERSCORE_ID)
#define nl_is_r_sqbracket(szTest) nl_is_special((szTest), RSQBRACKET_ID)
#define nl_is_l_sqbracket(szTest) nl_is_special((szTest), LSQBRACKET_ID)
#define nl_is_lcurly_bracket(szTest) nl_is_special((szTest), LCURLY_BRACKET_ID)
#define nl_is_rcurly_bracket(szTest) nl_is_special((szTest), RCURLY_BRACKET_ID)
#define nl_is_pipe(szTest) nl_is_special((szTest), PIPE_ID)
#define nl_get_underscore() nl_get_special(UNDERSCORE_ID)
#define nl_get_r_sqbracket() nl_get_special(RSQBRACKET_ID)
#define nl_get_l_sqbracket() nl_get_special(LSQBRACKET_ID)
#define nl_get_lcurly_bracket() nl_get_special(LCURLY_BRACKET_ID)
#define nl_get_rcurly_bracket() nl_get_special(RCURLY_BRACKET_ID)
#define nl_get_pipe() nl_get_special(PIPE_ID)
#endif /* NO_NLS jtt021396 */
#endif /* _FIX_PROJECT */
/**************************************************************/
#ifdef __cplusplus
}
#endif
#endif /* _INC_CTYPE */
// xstring internal header (from <string>)
#ifndef _XSTRING_
#define _XSTRING_
#include <xmemory>
#ifdef _MSC_VER
#pragma pack(push,8)
#endif /* _MSC_VER */
#include <xutility>
_STD_BEGIN
_CRTIMP void __cdecl _Xlen();
_CRTIMP void __cdecl _Xran();
// TEMPLATE CLASS basic_string
template<class _E,
class _Tr = char_traits<_E>,
class _A = allocator<_E> >
class basic_string {
public
typedef basic_string<_E, _Tr, _A> _Myt;
typedef _Asize_type size_type;
typedef _Adifference_type difference_type;
typedef _Apointer pointer;
typedef _Aconst_pointer const_pointer;
typedef _Areference reference;
typedef _Aconst_reference const_reference;
typedef _Avalue_type value_type;
typedef _Apointer iterator;
typedef _Aconst_pointer const_iterator;
typedef reverse_iterator<const_iterator, value_type,
const_reference, const_pointer, difference_type>
const_reverse_iterator;
typedef reverse_iterator<iterator, value_type,
reference, pointer, difference_type>
reverse_iterator;
explicit basic_string(const _A& _Al = _A())
allocator(_Al) {_Tidy(); }
basic_string(const _Myt& _X)
allocator(_X.allocator)
{_Tidy(), assign(_X, 0, npos); }
basic_string(const _Myt& _X, size_type _P, size_type _M,
const _A& _Al = _A())
allocator(_Al) {_Tidy(), assign(_X, _P, _M); }
basic_string(const _E *_S, size_type _N,
const _A& _Al = _A())
allocator(_Al) {_Tidy(), assign(_S, _N); }
basic_string(const _E *_S, const _A& _Al = _A())
allocator(_Al) {_Tidy(), assign(_S); }
basic_string(size_type _N, _E _C, const _A& _Al = _A())
allocator(_Al) {_Tidy(), assign(_N, _C); }
typedef const_iterator _It;
basic_string(_It _F, _It _L, const _A& _Al = _A())
allocator(_Al) {_Tidy(); assign(_F, _L); }
~basic_string()
{_Tidy(true); }
typedef _Tr traits_type;
typedef _A allocator_type;
enum _Mref {_FROZEN = 255};
static const size_type npos;
_Myt& operator=(const _Myt& _X)
{return (assign(_X)); }
_Myt& operator=(const _E *_S)
{return (assign(_S)); }
_Myt& operator=(_E _C)
{return (assign(1, _C)); }
_Myt& operator+=(const _Myt& _X)
{return (append(_X)); }
_Myt& operator+=(const _E *_S)
{return (append(_S)); }
_Myt& operator+=(_E _C)
{return (append(1, _C)); }
_Myt& append(const _Myt& _X)
{return (append(_X, 0, npos)); }
_Myt& append(const _Myt& _X, size_type _P, size_type _M)
{if (_X.size() < _P)
_Xran();
size_type _N = _X.size() - _P;
if (_N < _M)
_M = _N;
if (npos - _Len <= _M)
_Xlen();
if (0 < _M && _Grow(_N = _Len + _M))
{_Trcopy(_Ptr + _Len, &_X.c_str()[_P], _M);
_Eos(_N); }
return (*this); }
_Myt& append(const _E *_S, size_type _M)
{if (npos - _Len <= _M)
_Xlen();
size_type _N;
if (0 < _M && _Grow(_N = _Len + _M))
{_Trcopy(_Ptr + _Len, _S, _M);
_Eos(_N); }
return (*this); }
_Myt& append(const _E *_S)
{return (append(_S, _Trlength(_S))); }
_Myt& append(size_type _M, _E _C)
{if (npos - _Len <= _M)
_Xlen();
size_type _N;
if (0 < _M && _Grow(_N = _Len + _M))
{_Trassign(_Ptr + _Len, _M, _C);
_Eos(_N); }
return (*this); }
_Myt& append(_It _F, _It _L)
{return (replace(end(), end(), _F, _L)); }
_Myt& assign(const _Myt& _X)
{return (assign(_X, 0, npos)); }
_Myt& assign(const _Myt& _X, size_type _P, size_type _M)
{if (_X.size() < _P)
_Xran();
size_type _N = _X.size() - _P;
if (_M < _N)
_N = _M;
if (this == &_X)
erase((size_type)(_P + _N)), erase(0, _P);
else if (0 < _N && _N == _X.size()
&& _Refcnt(_X.c_str()) < _FROZEN - 1
&& allocator == _X.allocator)
{_Tidy(true);
_Ptr = (_E *)_X.c_str();
_Len = _X.size();
_Res = _X.capacity();
++_Refcnt(_Ptr); }
else if (_Grow(_N, true))
{_Trcopy(_Ptr, &_X.c_str()[_P], _N);
_Eos(_N); }
return (*this); }
_Myt& assign(const _E *_S, size_type _N)
{if (_Grow(_N, true))
{_Trcopy(_Ptr, _S, _N);
_Eos(_N); }
return (*this); }
_Myt& assign(const _E *_S)
{return (assign(_S, _Trlength(_S))); }
_Myt& assign(size_type _N, _E _C)
{if (_N == npos)
_Xlen();
if (_Grow(_N, true))
{_Trassign(_Ptr, _N, _C);
_Eos(_N); }
return (*this); }
_Myt& assign(_It _F, _It _L)
{return (replace(begin(), end(), _F, _L)); }
_Myt& insert(size_type _P0, const _Myt& _X)
{return (insert(_P0, _X, 0, npos)); }
_Myt& insert(size_type _P0, const _Myt& _X, size_type _P,
size_type _M)
{if (_Len < _P0 || _X.size() < _P)
_Xran();
size_type _N = _X.size() - _P;
if (_N < _M)
_M = _N;
if (npos - _Len <= _M)
_Xlen();
if (0 < _M && _Grow(_N = _Len + _M))
{_Trmove(_Ptr + _P0 + _M, _Ptr + _P0, _Len - _P0);
_Trcopy(_Ptr + _P0, &_X.c_str()[_P], _M);
_Eos(_N); }
return (*this); }
_Myt& insert(size_type _P0, const _E *_S, size_type _M)
{if (_Len < _P0)
_Xran();
if (npos - _Len <= _M)
_Xlen();
size_type _N;
if (0 < _M && _Grow(_N = _Len + _M))
{_Trmove(_Ptr + _P0 + _M, _Ptr + _P0, _Len - _P0);
_Trcopy(_Ptr + _P0, _S, _M);
_Eos(_N); }
return (*this); }
_Myt& insert(size_type _P0, const _E *_S)
{return (insert(_P0, _S, _Trlength(_S))); }
_Myt& insert(size_type _P0, size_type _M, _E _C)
{if (_Len < _P0)
_Xran();
if (npos - _Len <= _M)
_Xlen();
size_type _N;
if (0 < _M && _Grow(_N = _Len + _M))
{_Trmove(_Ptr + _P0 + _M, _Ptr + _P0, _Len - _P0);
_Trassign(_Ptr + _P0, _M, _C);
_Eos(_N); }
return (*this); }
iterator insert(iterator _P, _E _C)
{size_type _P0 = _Pdif(_P, begin());
insert(_P0, 1, _C);
return (begin() + _P0); }
void insert(iterator _P, size_type _M, _E _C)
{size_type _P0 = _Pdif(_P, begin());
insert(_P0, _M, _C); }
void insert(iterator _P, _It _F, _It _L)
{replace(_P, _P, _F, _L); }
_Myt& erase(size_type _P0 = 0, size_type _M = npos)
{if (_Len < _P0)
_Xran();
_Split();
if (_Len - _P0 < _M)
_M = _Len - _P0;
if (0 < _M)
{_Trmove(_Ptr + _P0, _Ptr + _P0 + _M,
_Len - _P0 - _M);
size_type _N = _Len - _M;
if (_Grow(_N))
_Eos(_N); }
return (*this); }
iterator erase(iterator _P)
{size_t _M = _Pdif(_P, begin());
erase(_M, 1);
return (_Psum(_Ptr, _M)); }
iterator erase(iterator _F, iterator _L)
{size_t _M = _Pdif(_F, begin());
erase(_M, _Pdif(_L, _F));
return (_Psum(_Ptr, _M)); }
_Myt& replace(size_type _P0, size_type _N0, const _Myt& _X)
{return (replace(_P0, _N0, _X, 0, npos)); }
_Myt& replace(size_type _P0, size_type _N0, const _Myt& _X,
size_type _P, size_type _M)
{if (_Len < _P0 || _X.size() < _P)
_Xran();
if (_Len - _P0 < _N0)
_N0 = _Len - _P0;
size_type _N = _X.size() - _P;
if (_N < _M)
_M = _N;
if (npos - _M <= _Len - _N0)
_Xlen();
_Split();
size_type _Nm = _Len - _N0 - _P0;
if (_M < _N0)
_Trmove(_Ptr + _P0 + _M, _Ptr + _P0 + _N0, _Nm);
if ((0 < _M || 0 < _N0) && _Grow(_N = _Len + _M - _N0))
{if (_N0 < _M)
_Trmove(_Ptr + _P0 + _M, _Ptr + _P0 + _N0, _Nm);
_Trcopy(_Ptr + _P0, &_X.c_str()[_P], _M);
_Eos(_N); }
return (*this); }
_Myt& replace(size_type _P0, size_type _N0, const _E *_S,
size_type _M)
{if (_Len < _P0)
_Xran();
if (_Len - _P0 < _N0)
_N0 = _Len - _P0;
if (npos - _M <= _Len - _N0)
_Xlen();
_Split();
size_type _Nm = _Len - _N0 - _P0;
if (_M < _N0)
_Trmove(_Ptr + _P0 + _M, _Ptr + _P0 + _N0, _Nm);
size_type _N;
if ((0 < _M || 0 < _N0) && _Grow(_N = _Len + _M - _N0))
{if (_N0 < _M)
_Trmove(_Ptr + _P0 + _M, _Ptr + _P0 + _N0, _Nm);
_Trcopy(_Ptr + _P0, _S, _M);
_Eos(_N); }
return (*this); }
_Myt& replace(size_type _P0, size_type _N0, const _E *_S)
{return (replace(_P0, _N0, _S, _Trlength(_S))); }
_Myt& replace(size_type _P0, size_type _N0,
size_type _M, _E _C)
{if (_Len < _P0)
_Xran();
if (_Len - _P0 < _N0)
_N0 = _Len - _P0;
if (npos - _M <= _Len - _N0)
_Xlen();
_Split();
size_type _Nm = _Len - _N0 - _P0;
if (_M < _N0)
_Trmove(_Ptr + _P0 + _M, _Ptr + _P0 + _N0, _Nm);
size_type _N;
if ((0 < _M || 0 < _N0) && _Grow(_N = _Len + _M - _N0))
{if (_N0 < _M)
_Trmove(_Ptr + _P0 + _M, _Ptr + _P0 + _N0,
_Nm);
_Trassign(_Ptr + _P0, _M, _C);
_Eos(_N); }
return (*this); }
_Myt& replace(iterator _F, iterator _L, const _Myt& _X)
{return (replace(
_Pdif(_F, begin()), _Pdif(_L, _F), _X)); }
_Myt& replace(iterator _F, iterator _L, const _E *_S,
size_type _M)
{return (replace(
_Pdif(_F, begin()), _Pdif(_L, _F), _S, _M)); }
_Myt& replace(iterator _F, iterator _L, const _E *_S)
{return (replace(
_Pdif(_F, begin()), _Pdif(_L, _F), _S)); }
_Myt& replace(iterator _F, iterator _L, size_type _M, _E _C)
{return (replace(
_Pdif(_F, begin()), _Pdif(_L, _F), _M, _C)); }
_Myt& replace(iterator _F1, iterator _L1,
_It _F2, _It _L2)
{size_type _P0 = _Pdif(_F1, begin());
size_type _M = 0;
_Distance(_F2, _L2, _M);
replace(_P0, _Pdif(_L1, _F1), _M, _E(0));
for (_F1 = begin() + _P0; 0 < _M; ++_F1, ++_F2, --_M)
*_F1 = *_F2;
return (*this); }
iterator begin()
{_Freeze();
return (_Ptr); }
const_iterator begin() const
{return (_Ptr); }
iterator end()
{_Freeze();
return ((iterator)_Psum(_Ptr, _Len)); }
const_iterator end() const
{return ((const_iterator)_Psum(_Ptr, _Len)); }
reverse_iterator rbegin()
{return (reverse_iterator(end())); }
const_reverse_iterator rbegin() const
{return (const_reverse_iterator(end())); }
reverse_iterator rend()
{return (reverse_iterator(begin())); }
const_reverse_iterator rend() const
{return (const_reverse_iterator(begin())); }
reference at(size_type _P0)
{if (_Len <= _P0)
_Xran();
_Freeze();
return (_Ptr[_P0]); }
const_reference at(size_type _P0) const
{if (_Len <= _P0)
_Xran();
return (_Ptr[_P0]); }
reference operator[](size_type _P0)
{if (_Len < _P0 || _Ptr == 0)
return ((reference)*_Nullstr());
_Freeze();
return (_Ptr[_P0]); }
const_reference operator[](size_type _P0) const
{if (_Ptr == 0)
return (*_Nullstr());
else
return (_Ptr[_P0]); }
const _E *c_str() const
{return (_Ptr == 0 ? _Nullstr() _Ptr); }
const _E *data() const
{return (c_str()); }
size_type length() const
{return (_Len); }
size_type size() const
{return (_Len); }
size_type max_size() const
{size_type _N = allocator.max_size();
return (_N <= 2 ? 1 _N - 2); }
void resize(size_type _N, _E _C)
{_N <= _Len ? erase(_N) append(_N - _Len, _C); }
void resize(size_type _N)
{_N <= _Len ? erase(_N) append(_N - _Len, _E(0)); }
size_type capacity() const
{return (_Res); }
void reserve(size_type _N = 0)
{if (_Res < _N)
_Grow(_N); }
bool empty() const
{return (_Len == 0); }
size_type copy(_E *_S, size_type _N, size_type _P0 = 0) const
{if (_Len < _P0)
_Xran();
if (_Len - _P0 < _N)
_N = _Len - _P0;
if (0 < _N)
_Trcopy(_S, _Ptr + _P0, _N);
return (_N); }
void swap(_Myt& _X)
{if (allocator == _X.allocator)
{stdswap(_Ptr, _X._Ptr);
stdswap(_Len, _X._Len);
stdswap(_Res, _X._Res); }
else
{_Myt _Ts = *this; *this = _X, _X = _Ts; }}
friend void swap(_Myt& _X, _Myt& _Y)
{_X.swap(_Y); }
size_type find(const _Myt& _X, size_type _P = 0) const
{return (find(_X.c_str(), _P, _X.size())); }
size_type find(const _E *_S, size_type _P,
size_type _N) const
{if (_N == 0 && _P <= _Len)
return (_P);
size_type _Nm;
if (_P < _Len && _N <= (_Nm = _Len - _P))
{const _E *_U, *_V;
for (_Nm -= _N - 1, _V = _Ptr + _P;
(_U = _Trfind(_V, _Nm, *_S)) != 0;
_Nm -= _U - _V + 1, _V = _U + 1)
if (_Trcompare(_U, _S, _N) == 0)
return (_U - _Ptr); }
return (npos); }
size_type find(const _E *_S, size_type _P = 0) const
{return (find(_S, _P, _Trlength(_S))); }
size_type find(_E _C, size_type _P = 0) const
{return (find((const _E *)&_C, _P, 1)); }
size_type rfind(const _Myt& _X, size_type _P = npos) const
{return (rfind(_X.c_str(), _P, _X.size())); }
size_type rfind(const _E *_S, size_type _P,
size_type _N) const
{if (_N == 0)
return (_P < _Len ? _P _Len);
if (_N <= _Len)
for (const _E *_U = _Ptr +
+ (_P < _Len - _N ? _P _Len - _N); ; --_U)
if (_Treq(*_U, *_S)
&& _Trcompare(_U, _S, _N) == 0)
return (_U - _Ptr);
else if (_U == _Ptr)
break;
return (npos); }
size_type rfind(const _E *_S, size_type _P = npos) const
{return (rfind(_S, _P, _Trlength(_S))); }
size_type rfind(_E _C, size_type _P = npos) const
{return (rfind((const _E *)&_C, _P, 1)); }
size_type find_first_of(const _Myt& _X,
size_type _P = 0) const
{return (find_first_of(_X.c_str(), _P, _X.size())); }
size_type find_first_of(const _E *_S, size_type _P,
size_type _N) const
{if (0 < _N && _P < _Len)
{const _E *const _V = _Ptr + _Len;
for (const _E *_U = _Ptr + _P; _U < _V; ++_U)
if (_Trfind(_S, _N, *_U) != 0)
return (_U - _Ptr); }
return (npos); }
size_type find_first_of(const _E *_S, size_type _P = 0) const
{return (find_first_of(_S, _P, _Trlength(_S))); }
size_type find_first_of(_E _C, size_type _P = 0) const
{return (find((const _E *)&_C, _P, 1)); }
size_type find_last_of(const _Myt& _X,
size_type _P = npos) const
{return (find_last_of(_X.c_str(), _P, _X.size())); }
size_type find_last_of(const _E *_S, size_type _P,
size_type _N) const
{if (0 < _N && 0 < _Len)
for (const _E *_U = _Ptr
+ (_P < _Len ? _P _Len - 1); ; --_U)
if (_Trfind(_S, _N, *_U) != 0)
return (_U - _Ptr);
else if (_U == _Ptr)
break;
return (npos); }
size_type find_last_of(const _E *_S,
size_type _P = npos) const
{return (find_last_of(_S, _P, _Trlength(_S))); }
size_type find_last_of(_E _C, size_type _P = npos) const
{return (rfind((const _E *)&_C, _P, 1)); }
size_type find_first_not_of(const _Myt& _X,
size_type _P = 0) const
{return (find_first_not_of(_X.c_str(), _P,
_X.size())); }
size_type find_first_not_of(const _E *_S, size_type _P,
size_type _N) const
{if (_P < _Len)
{const _E *const _V = _Ptr + _Len;
for (const _E *_U = _Ptr + _P; _U < _V; ++_U)
if (_Trfind(_S, _N, *_U) == 0)
return (_U - _Ptr); }
return (npos); }
size_type find_first_not_of(const _E *_S,
size_type _P = 0) const
{return (find_first_not_of(_S, _P, _Trlength(_S))); }
size_type find_first_not_of(_E _C, size_type _P = 0) const
{return (find_first_not_of((const _E *)&_C, _P, 1)); }
size_type find_last_not_of(const _Myt& _X,
size_type _P = npos) const
{return (find_last_not_of(_X.c_str(), _P, _X.size())); }
size_type find_last_not_of(const _E *_S, size_type _P,
size_type _N) const
{if (0 < _Len)
for (const _E *_U = _Ptr
+ (_P < _Len ? _P _Len - 1); ; --_U)
if (_Trfind(_S, _N, *_U) == 0)
return (_U - _Ptr);
else if (_U == _Ptr)
break;
return (npos); }
size_type find_last_not_of(const _E *_S,
size_type _P = npos) const
{return (find_last_not_of(_S, _P, _Trlength(_S))); }
size_type find_last_not_of(_E _C, size_type _P = npos) const
{return (find_last_not_of((const _E *)&_C, _P, 1)); }
_Myt substr(size_type _P = 0, size_type _M = npos) const
{return (_Myt(*this, _P, _M)); }
int compare(const _Myt& _X) const
{return (compare(0, _Len, _X.c_str(), _X.size())); }
int compare(size_type _P0, size_type _N0,
const _Myt& _X) const
{return (compare(_P0, _N0, _X, 0, npos)); }
int compare(size_type _P0, size_type _N0, const _Myt& _X,
size_type _P, size_type _M) const
{if (_X.size() < _P)
_Xran();
if (_X._Len - _P < _M)
_M = _X._Len - _P;
return (compare(_P0, _N0, _X.c_str() + _P, _M)); }
int compare(const _E *_S) const
{return (compare(0, _Len, _S, _Trlength(_S))); }
int compare(size_type _P0, size_type _N0, const _E *_S) const
{return (compare(_P0, _N0, _S, _Trlength(_S))); }
int compare(size_type _P0, size_type _N0, const _E *_S,
size_type _M) const
{if (_Len < _P0)
_Xran();
if (_Len - _P0 < _N0)
_N0 = _Len - _P0;
size_type _Ans = _Trcompare(_Psum(_Ptr, _P0), _S,
_N0 < _M ? _N0 _M);
return (_Ans != 0 ? _Ans _N0 < _M ? -1
_N0 == _M ? 0 +1); }
_A get_allocator() const
{return (allocator); }
protected
_A allocator;
private
enum {_MIN_SIZE = sizeof (_E) <= 32 ? 31 7};
void _Copy(size_type _N)
{size_type _Ns = _N | _MIN_SIZE;
if (max_size() < _Ns)
_Ns = _N;
_E *_S;
_TRY_BEGIN
_S = allocator.allocate(_Ns + 2, (void *)0);
_CATCH_ALL
_Ns = _N;
_S = allocator.allocate(_Ns + 2, (void *)0);
_CATCH_END
//*****************************************************
// Bug fix --- RMTK
// This line copies _Len bytes which may be
// more than was allocated (_Ns) in which
// case the memory block delimiter is
// overwritten. I don't know if my fix will
// work in general, but it will fix this particular
// case.
//
// if (0 < _Len)
// _Trcopy(_S + 1, _Ptr, _Len);
//-----------------------------------------
size_type copyLength = _Len;
if (copyLength > _Ns) copyLength = _Ns;
if (0 < copyLength)
_Trcopy(_S + 1, _Ptr, copyLength);
size_type _Olen = copyLength;
//*****************************************************
_Tidy(true);
_Ptr = _S + 1;
_Refcnt(_Ptr) = 0;
_Res = _Ns;
_Eos(_Olen); }
void _Eos(size_type _N)
{_Trassign(_Ptr[_Len = _N], _E(0)); }
void _Freeze()
{if (_Ptr != 0
&& _Refcnt(_Ptr) != 0 && _Refcnt(_Ptr) != _FROZEN)
_Grow(_Len);
if (_Ptr != 0)
_Refcnt(_Ptr) = _FROZEN; }
bool _Grow(size_type _N, bool _Trim = false)
{if (max_size() < _N)
_Xlen();
if (_Ptr != 0
&& _Refcnt(_Ptr) != 0 && _Refcnt(_Ptr) != _FROZEN)
if (_N == 0)
{--_Refcnt(_Ptr), _Tidy();
return (false); }
else
{_Copy(_N);
return (true); }
if (_N == 0)
{if (_Trim)
_Tidy(true);
else if (_Ptr != 0)
_Eos(0);
return (false); }
else
{if (_Trim && (_MIN_SIZE < _Res || _Res < _N))
{_Tidy(true);
_Copy(_N); }
else if (!_Trim && _Res < _N)
_Copy(_N);
return (true); }}
static const _E *_Nullstr()
{static const _E _C = _E(0);
return (&_C); }
static size_type _Pdif(const_pointer _P2, const_pointer _P1)
{return (_P2 == 0 ? 0 _P2 - _P1); }
static const_pointer _Psum(const_pointer _P, size_type _N)
{return (_P == 0 ? 0 _P + _N); }
static pointer _Psum(pointer _P, size_type _N)
{return (_P == 0 ? 0 _P + _N); }
unsigned char& _Refcnt(const _E *_U)
{return (((unsigned char *)_U)[-1]); }
void _Split()
{if (_Ptr != 0 && _Refcnt(_Ptr) != 0 && _Refcnt(_Ptr) != _FROZEN)
{_E *_Temp = _Ptr;
_Tidy(true);
assign(_Temp); }}
void _Tidy(bool _Built = false)
{if (!_Built || _Ptr == 0)
;
else if (_Refcnt(_Ptr) == 0 || _Refcnt(_Ptr) == _FROZEN)
allocator.deallocate(_Ptr - 1, _Res + 2);
else
--_Refcnt(_Ptr);
_Ptr = 0, _Len = 0, _Res = 0; }
_E *_Ptr;
size_type _Len, _Res;
};
template<class _E, class _Tr, class _A>
const basic_string<_E, _Tr, _A>size_type
basic_string<_E, _Tr, _A>npos = -1;
#ifdef _DLL
#pragma warning(disable4231) /* the extern before template is a non-standard extension */
extern template class _CRTIMP basic_string<char, char_traits<char>, allocator<char> >;
extern template class _CRTIMP basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
#pragma warning(default4231) /* restore previous warning */
#endif
typedef basic_string<char, char_traits<char>, allocator<char> >
string;
typedef basic_string<wchar_t, char_traits<wchar_t>,
allocator<wchar_t> > wstring;
_STD_END
#ifdef _MSC_VER
#pragma pack(pop)
#endif /* _MSC_VER */
#endif /* _XSTRING */
/*
* Copyright (c) 1995 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
*/