// xlocinfo internal header
#ifndef _XLOCINFO_
#define _XLOCINFO_

#pragma info(none)
#ifndef __CHKHDR__
#  pragma report(level, E)
#endif
#pragma info(restore)

#if __IBMCPP__ < 400
#error This file to be used only with IBM VisualAge C++ v4 and later compilers.
#endif /* __IBMCPP__ */

#pragma namemangling(ansi)

   /********************************************************************/
   /*  <xlocinfo> header file                                          */
   /*                                                                  */
   /*  VisualAge C++, Version 4.0                                      */
   /*    Licensed Material - Property of IBM                           */
   /*                                                                  */
   /*  5801-AAR and Other Materials                                    */
   /*                                                                  */
   /*  (c) Copyright IBM Corp 1991, 1998. All rights reserved.         */
   /*                                                                  */
   /*                                                                  */
   /*  Licensed Materials.                                             */
   /*                                                                  */
   /*  Dinkum C++ Library                                              */
   /*  Copyright (c) 1998.  Licensed to IBM Corp. and its suppliers.   */
   /*                                                                  */
   /********************************************************************/

#include <xlocinfo.h>
#include <cstdlib>
#include <xstddef>
_STD_BEGIN

		// CLASS _Timevec
class _Timevec {
public:
	_Timevec(void *_P = 0)
		: _Ptr(_P) {}
	_Timevec(const _Timevec& _Rhs)
		{*this = _Rhs; }
	~_Timevec()
		{free(_Ptr); }
	_Timevec& operator=(const _Timevec& _Rhs)
		{_Ptr = _Rhs._Ptr;
		((_Timevec *)&_Rhs)->_Ptr = 0;
		return (*this); }
	void *_Getptr() const
		{return (_Ptr); }
private:
	void *_Ptr;
	};
		// CLASS _Locinfo
class _Locinfo {
public:
	typedef _CSTD _Collvec _Collvec;
	typedef _CSTD _Ctypevec _Ctypevec;
	typedef _CSTD _Cvtvec _Cvtvec;
	typedef std::_Timevec _Timevec;
	_Locinfo(const char * = "C");
	_Locinfo(int, const char *);
	~_Locinfo();
	_Locinfo& _Addcats(int, const char *);
	string _Getname() const
		{return (_Nname); }
	_Collvec _Getcoll() const
		{return (_CSTD _Getcoll()); }
	_Ctypevec _Getctype() const
		{return (_CSTD _Getctype()); }
	_Cvtvec _Getcvt() const
		{return (_CSTD _Getcvt()); }
	const lconv *_Getlconv() const
		{return (localeconv()); }
	_Timevec _Gettnames() const
		{return (_Timevec(_CSTD _Gettnames())); }
	const char *_Getdays() const
		{char *_S = _CSTD _Getdays();
		if (_S != 0)
			{((_Locinfo *)this)->_Days = _S, free(_S); }
		return (_Days.size() != 0 ? _Days.c_str()
				: ":Sun:Sunday:Mon:Monday:Tue:Tuesday"
				":Wed:Wednesday:Thu:Thursday:Fri:Friday"
				":Sat:Saturday"); }
	const char *_Getmonths() const
		{
		char *_S = _CSTD _Getmonths();
		if (_S != 0){
			((_Locinfo *)this)->_Months = _S, free(_S); 
		}
		return (_Months.size() != 0 ? _Months.c_str()
				: ":1:01:Jan:January:2:02:Feb:February:3:03:Mar:March"
				":4:04:Apr:April:5:05:May:May:6:06:Jun:June"
				":7:07:Jul:July:8:08:Aug:August:9:09:Sep:September"
				":10:10:Oct:October:11:11:Nov:November:12:12Dec:December"); } 
	const char *_Getfalse() const
		{return ("false"); }
	const char *_Gettrue() const
		{return ("true"); }
private:
	_Lockit _Lk;
	string _Days, _Months, _Oname, _Nname;
	};
		// TEMPLATE FUNCTIONS
template<class _E> inline
	int _LStrcoll(const _E *_F1, const _E *_L1,
		const _E *_F2, const _E *_L2, const _Locinfo::_Collvec *)
	{for (; _F1 != _L1 && _F2 != _L2; ++_F1, ++_F2)
		if (*_F1 < *_F2)
			return (-1);
		else if (*_F2 < *_F1)
			return (+1);
	return (_F2 != _L2 ? -1 : _F1 != _L1 ? +1 : 0); }
template<> inline int _LStrcoll(
	const char *_F1, const char *_L1,
	const char *_F2, const char *_L2,
	const _Locinfo::_Collvec *_V)
	{return (_Strcoll(_F1, _L1, _F2, _L2, _V)); }
template<class _E> inline
	size_t _LStrxfrm(_E *_F1, _E *_L1,
		const _E *_F2, const _E *_L2, const _Locinfo::_Collvec *)
	{size_t _N = _L2 - _F2;
	if (_N <= _L1 - _F1)
		memcpy(_F1, _F2, _N * sizeof (_E));
	return (_N); }
template<> inline size_t _LStrxfrm(
	char *_F1, char *_L1,
	const char *_F2, const char *_L2,
	const _Locinfo::_Collvec *_V)
	{return (_Strxfrm(_F1, _L1, _F2, _L2, _V)); }
_STD_END

#pragma namemangling()

#pragma info(none)
#ifndef __CHKHDR__
#  pragma report(pop)
#endif
#pragma info(restore)

#endif /* _XLOCINFO_ */

/*
 * Copyright (c) 1996 by P.J. Plauger.  ALL RIGHTS RESERVED. 
 * Consult your license regarding permissions and restrictions.
V2.2:0081 */
