c++/1659: Internal compiler error in `dwarfout_finish', at dwarfout.c:6102
jsears@touchtechnology.com
jsears@touchtechnology.com
Sun Apr 1 00:00:00 GMT 2001
>Number: 1659
>Category: c++
>Synopsis: Internal compiler error in `dwarfout_finish', at dwarfout.c:6102
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jan 15 12:16:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: John Sears
>Release: 2.95.2
>Organization:
>Environment:
x86
>Description:
Internal compiler error in `dwarfout_finish', at dwarfout.c:6102
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="CardLayer.ii"
Content-Disposition: inline; filename="CardLayer.ii"
# 1 "/home/core/Support/CardLayer/CardLayer.cpp"
# 1 "/home/core/Support/CardLayer/Includes.h" 1
# 1 "/home/core/include/tti_BaseTypes.h" 1
typedef unsigned short uint16;
typedef unsigned long uint32;
typedef unsigned char uint8;
typedef unsigned char byte;
typedef short int16;
typedef long int32;
typedef char int8;
typedef unsigned int uint;
typedef unsigned short ushort;
typedef unsigned short UINT16;
typedef unsigned long UINT32;
typedef unsigned char UINT8;
typedef unsigned char BYTE;
typedef short INT16;
typedef long INT32;
typedef char INT8;
typedef uint16 t_tag;
typedef byte tti_DevSmSerNo[8 ];
typedef const char * pcstr;
typedef char * pstr;
# 86 "/home/core/include/tti_BaseTypes.h"
typedef long long int int64;
typedef unsigned long long int uint64;
# 142 "/home/core/include/tti_BaseTypes.h"
# 22 "/home/core/Support/CardLayer/Includes.h" 2
# 1 "/home/core/include/TStringList.h" 1
# 1 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/vector" 1 3
# 1 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_algobase.h" 1 3
# 1 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_config.h" 1 3
# 148 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_config.h" 3
# 1 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../ntox86/include/_G_config.h" 1 3 4
typedef int _G_int8_t __attribute__((__mode__(__QI__)));
typedef unsigned int _G_uint8_t __attribute__((__mode__(__QI__)));
typedef int _G_int16_t __attribute__((__mode__(__HI__)));
typedef unsigned int _G_uint16_t __attribute__((__mode__(__HI__)));
typedef int _G_int32_t __attribute__((__mode__(__SI__)));
typedef unsigned int _G_uint32_t __attribute__((__mode__(__SI__)));
typedef int _G_int64_t __attribute__((__mode__(__DI__)));
typedef unsigned int _G_uint64_t __attribute__((__mode__(__DI__)));
__extension__ typedef long long _G_llong;
__extension__ typedef unsigned long long _G_ullong;
typedef unsigned int _G_clock_t;
typedef unsigned int _G_dev_t;
typedef long _G_fpos_t;
typedef int _G_gid_t;
typedef int _G_ino_t;
typedef unsigned int _G_mode_t;
typedef unsigned int _G_nlink_t;
typedef unsigned long _G_off_t;
typedef int _G_pid_t;
typedef int _G_ptrdiff_t;
typedef struct { long bits[2]; } _G_sigset_t;
typedef unsigned int _G_size_t;
typedef int _G_time_t;
typedef int _G_uid_t;
typedef unsigned short _G_wchar_t;
typedef int _G_ssize_t;
typedef unsigned short _G_wint_t;
typedef char * _G_va_list;
# 1 "/usr/include/stddef.h" 1 3 4
# 1 "/usr/include/sys/platform.h" 1 3 4
# 20 "/usr/include/sys/platform.h" 3 4
# 1 "/usr/include/sys/compiler_gnu.h" 1 3 4
# 1 "/usr/include/sys/cdefs.h" 1 3 4
# 98 "/usr/include/sys/cdefs.h" 3 4
# 27 "/usr/include/sys/compiler_gnu.h" 2 3 4
typedef int _int64 __attribute__((__mode__(__DI__),__aligned__(8)));
typedef unsigned int _uint64 __attribute__((__mode__(__DI__),__aligned__(8)));
typedef unsigned _uint32 __attribute__((__aligned__(4)));
typedef int _int32 __attribute__((__aligned__(4)));
typedef int _int16 __attribute__((__mode__(__HI__),__aligned__(2)));
typedef unsigned int _uint16 __attribute__((__mode__(__HI__),__aligned__(2)));
typedef int _int8 __attribute__((__mode__(__QI__),__aligned__(1)));
typedef unsigned int _uint8 __attribute__((__mode__(__QI__),__aligned__(1)));
typedef int _intptr __attribute__((__mode__(__pointer__)));
typedef unsigned int _uintptr __attribute__((__mode__(__pointer__)));
# 92 "/usr/include/sys/compiler_gnu.h" 3 4
# 22 "/usr/include/sys/platform.h" 2 3 4
# 1 "/usr/include/x86/platform.h" 1 3 4
typedef char *__va_list;
typedef unsigned __jmpbufalign;
# 50 "/usr/include/x86/platform.h" 3 4
# 34 "/usr/include/sys/platform.h" 2 3 4
# 54 "/usr/include/sys/platform.h" 3 4
# 1 "/usr/include/_pack64.h" 1 3 4
#pragma pack()
# 158 "/usr/include/sys/platform.h" 2 3 4
# 1 "/usr/include/sys/target_nto.h" 1 3 4
# 178 "/usr/include/sys/target_nto.h" 3 4
# 206 "/usr/include/sys/target_nto.h" 3 4
# 162 "/usr/include/sys/platform.h" 2 3 4
# 1 "/usr/include/_packpop.h" 1 3 4
#pragma pack()
# 185 "/usr/include/sys/platform.h" 2 3 4
# 13 "/usr/include/stddef.h" 2 3 4
typedef unsigned size_t;
typedef _intptr ptrdiff_t;
typedef _uint32 wchar_t;
# 86 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../ntox86/include/_G_config.h" 2 3 4
# 151 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_config.h" 2 3
# 178 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_config.h" 3
# 234 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_config.h" 3
# 248 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_config.h" 3
# 316 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_config.h" 3
# 36 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_algobase.h" 2 3
# 1 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_relops.h" 1 3
template <class _Tp>
inline bool operator!=(const _Tp& __x, const _Tp& __y) {
return !(__x == __y);
}
template <class _Tp>
inline bool operator>(const _Tp& __x, const _Tp& __y) {
return __y < __x;
}
template <class _Tp>
inline bool operator<=(const _Tp& __x, const _Tp& __y) {
return !(__y < __x);
}
template <class _Tp>
inline bool operator>=(const _Tp& __x, const _Tp& __y) {
return !(__x < __y);
}
# 39 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_algobase.h" 2 3
# 1 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_pair.h" 1 3
template <class _T1, class _T2>
struct pair {
typedef _T1 first_type;
typedef _T2 second_type;
_T1 first;
_T2 second;
pair() : first(_T1()), second(_T2()) {}
pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {}
template <class _U1, class _U2>
pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {}
};
template <class _T1, class _T2>
inline bool operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
{
return __x.first == __y.first && __x.second == __y.second;
}
template <class _T1, class _T2>
inline bool operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
{
return __x.first < __y.first ||
(!(__y.first < __x.first) && __x.second < __y.second);
}
template <class _T1, class _T2>
inline pair<_T1, _T2> make_pair(const _T1& __x, const _T2& __y)
{
return pair<_T1, _T2>(__x, __y);
}
# 42 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_algobase.h" 2 3
# 1 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/type_traits.h" 1 3
struct __true_type {
};
struct __false_type {
};
template <class _Tp>
struct __type_traits {
typedef __true_type this_dummy_member_must_be_first;
typedef __false_type has_trivial_default_constructor;
typedef __false_type has_trivial_copy_constructor;
typedef __false_type has_trivial_assignment_operator;
typedef __false_type has_trivial_destructor;
typedef __false_type is_POD_type;
};
template<> struct __type_traits<bool> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type;
};
template<> struct __type_traits<char> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type;
};
template<> struct __type_traits<signed char> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type;
};
template<> struct __type_traits<unsigned char> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type;
};
template<> struct __type_traits<wchar_t> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type;
};
template<> struct __type_traits<short> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type;
};
template<> struct __type_traits<unsigned short> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type;
};
template<> struct __type_traits<int> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type;
};
template<> struct __type_traits<unsigned int> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type;
};
template<> struct __type_traits<long> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type;
};
template<> struct __type_traits<unsigned long> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type;
};
template<> struct __type_traits<long long> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type;
};
template<> struct __type_traits<unsigned long long> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type;
};
template<> struct __type_traits<float> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type;
};
template<> struct __type_traits<double> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type;
};
template<> struct __type_traits<long double> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type;
};
template <class _Tp>
struct __type_traits<_Tp*> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type;
};
# 295 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/type_traits.h" 3
template <class _Tp> struct _Is_integer {
typedef __false_type _Integral;
};
template<> struct _Is_integer<bool> {
typedef __true_type _Integral;
};
template<> struct _Is_integer<char> {
typedef __true_type _Integral;
};
template<> struct _Is_integer<signed char> {
typedef __true_type _Integral;
};
template<> struct _Is_integer<unsigned char> {
typedef __true_type _Integral;
};
template<> struct _Is_integer<wchar_t> {
typedef __true_type _Integral;
};
template<> struct _Is_integer<short> {
typedef __true_type _Integral;
};
template<> struct _Is_integer<unsigned short> {
typedef __true_type _Integral;
};
template<> struct _Is_integer<int> {
typedef __true_type _Integral;
};
template<> struct _Is_integer<unsigned int> {
typedef __true_type _Integral;
};
template<> struct _Is_integer<long> {
typedef __true_type _Integral;
};
template<> struct _Is_integer<unsigned long> {
typedef __true_type _Integral;
};
template<> struct _Is_integer<long long> {
typedef __true_type _Integral;
};
template<> struct _Is_integer<unsigned long long> {
typedef __true_type _Integral;
};
# 45 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_algobase.h" 2 3
# 1 "/usr/include/string.h" 1 3 4
extern "C" {
extern void *memchr( const void *__s, int __c, size_t __n );
extern int memcmp( const void *__s1, const void *__s2, size_t __n );
extern void *memcpy( void *__s1, const void *__s2, size_t __n );
extern void *memmove( void *__s1, const void *__s2, size_t __n );
extern void *memset( void *__s, int __c, size_t __n );
extern char *strcat( char *__s1, const char *__s2 );
extern char *strchr( const char *__s, int __c );
extern int strcmp( const char *__s1, const char *__s2 );
extern int strcoll( const char *__s1, const char *__s2 );
extern size_t strxfrm( char *__s1, const char *__s2, size_t __n );
extern char *strcpy( char *__s1, const char *__s2 );
extern size_t strcspn( const char *__s1, const char *__s2 );
extern char *strerror( int __errnum );
extern size_t strlen( const char *__s );
extern char *strncat( char *__s1, const char *__s2, size_t __n );
extern int strncmp( const char *__s1, const char *__s2, size_t __n );
extern char *strncpy( char *__s1, const char *__s2, size_t __n );
extern char *strpbrk( const char *__s1, const char *__s2 );
extern char *strrchr( const char *__s, int __c );
extern size_t strspn( const char *__s1, const char *__s2 );
extern char *strstr( const char *__s1, const char *__s2 );
extern char *strtok( char *__s1, const char *__s2 );
extern char *strsignal(int __signo);
extern char *strtok_r( char *__s1, const char *__s2, char **__s3 );
struct iovec;
extern size_t memcpyv(const struct iovec *__dst, int __dparts, int __doff, const struct iovec *__src, int __sparts, int __soff);
extern void *memccpy( void *__s1, const void *__s2, int __c, size_t __n );
extern int memicmp( const void *__s1, const void *__s2, size_t __n );
extern int _memicmp( const void *__s1, const void *__s2, size_t __n );
extern int strcmpi( const char *__s1, const char *__s2 );
extern char *strdup( const char *__string );
extern char *_strdup( const char *__string );
extern int stricmp( const char *__s1, const char *__s2 );
extern int _stricmp( const char *__s1, const char *__s2 );
extern char *strlwr( char *__string );
extern char *_strlwr( char *__string );
extern int strnicmp( const char *__s1, const char *__s2, size_t __n );
extern int _strnicmp( const char *__s1, const char *__s2, size_t __n );
extern char *strnset( char *__string, int __c, size_t __len );
extern char *strrev( char *__string );
extern char *_strrev( char *__string );
extern char *strset( char *__string, int __c );
extern char *strupr( char *__string );
extern char *_strupr( char *__string );
extern void __strerror( int __max, int __errnum, char *__buf );
extern int straddstr(const char *__str, int __len, char **__pbuf, size_t *__pmaxbuf);
extern char *strsep(char **__stringp, const char *__delim);
# 1 "/usr/include/x86/string.h" 1 3 4
# 25 "/usr/include/x86/string.h" 3 4
# 57 "/usr/include/x86/string.h" 3 4
# 91 "/usr/include/string.h" 2 3 4
};
# 48 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_algobase.h" 2 3
# 1 "/usr/include/limits.h" 1 3 4
# 49 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_algobase.h" 2 3
# 1 "/usr/include/stdlib.h" 1 3 4
# 1 "/usr/include/sys/wait.h" 1 3 4
# 1 "/usr/include/signal.h" 1 3 4
# 1 "/usr/include/sys/siginfo.h" 1 3 4
typedef int pid_t;
typedef int uid_t;
typedef _uint32 clock_t;
typedef _int32 time_t;
struct timespec { time_t tv_sec; long tv_nsec; } ;
typedef struct sched_param { int sched_priority; int sched_curpriority; union { int reserved[8]; struct { int __ss_low_priority; int __ss_max_repl; struct timespec __ss_repl_period; struct timespec __ss_init_budget; } __ss; } __ss_un; } sched_param_t;
typedef struct _thread_attr { int flags; size_t stacksize; void *stackaddr; void (*exitfunc)(void *status); int policy; struct sched_param param; unsigned guardsize; int spare[3]; } pthread_attr_t;
enum {
SIGEV_NONE,
SIGEV_SIGNAL,
SIGEV_SIGNAL_CODE,
SIGEV_SIGNAL_THREAD,
SIGEV_PULSE,
SIGEV_UNBLOCK,
SIGEV_INTR,
SIGEV_THREAD
};
# 1 "/usr/include/_pack64.h" 1 3 4
#pragma pack()
# 70 "/usr/include/sys/siginfo.h" 2 3 4
union sigval {
int sival_int;
void *sival_ptr;
};
struct sigevent {
int sigev_notify;
union {
int __sigev_signo;
int __sigev_coid;
int __sigev_id;
void (*__sigev_notify_function)(union sigval);
} __sigev_un1;
union sigval sigev_value;
# 107 "/usr/include/sys/siginfo.h" 3 4
union {
struct {
short __sigev_code;
short __sigev_priority;
} __st;
pthread_attr_t *__sigev_notify_attributes;
} __sigev_un2;
};
typedef struct {
int si_signo;
int si_code;
int si_errno;
union {
int __pad[7];
struct {
pid_t __pid;
union {
struct {
uid_t __uid;
union sigval __value;
} __kill;
struct {
clock_t __utime;
int __status;
clock_t __stime;
} __chld;
} __pdata;
} __proc;
struct {
int __fltno;
void *__fltip;
void *__addr;
} __fault;
} __data;
} siginfo_t;
# 1 "/usr/include/_packpop.h" 1 3 4
#pragma pack()
# 303 "/usr/include/sys/siginfo.h" 2 3 4
# 18 "/usr/include/signal.h" 2 3 4
typedef _int32 pthread_t;
typedef struct { long bits[2]; } sigset_t;
typedef struct { void *ss_sp; size_t ss_size; int ss_flags; } stack_t;
typedef struct __ucontext_t ucontext_t;
# 1 "/usr/include/_pack64.h" 1 3 4
#pragma pack()
# 46 "/usr/include/signal.h" 2 3 4
typedef int sig_atomic_t;
struct sigaction {
union {
void (*_sa_handler)(int );
void (*_sa_sigaction)(int, siginfo_t *, void *);
} un;
int sa_flags;
sigset_t sa_mask;
};
struct sigstack {
int ss_onstack;
void *ss_sp;
};
struct timespec;
extern "C" {
extern int raise( int __sig );
extern void (*signal( int __sig, void (*__func)(int) ))(int);
extern int kill( pid_t __pid, int __signum );
extern int sigaction( int __signo, const struct sigaction *__act, struct sigaction *__oact );
extern int sigaddset( sigset_t *__set, int __signo );
extern int sigdelset( sigset_t *__set, int __signo );
extern int sigemptyset( sigset_t *__set );
extern int sigfillset( sigset_t *__set );
extern int sigismember( const sigset_t *__set, int __signo );
extern int sigpending( sigset_t *__set );
extern int sigprocmask( int __how, const sigset_t *__set, sigset_t *__oset );
extern int sigsuspend( const sigset_t *sigmask );
extern int sigqueue( pid_t __pid, int __signum, const union sigval __val );
extern int sigwait( const sigset_t * set, int * sig );
extern int sigwaitinfo( const sigset_t *sigmask, siginfo_t *info );
extern int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *timeout);
extern void __signalstub();
extern void (*bsd_signal(int __sig, void (*func)(int)))(int);
extern int killpg(pid_t __pgrp, int __signum);
extern int pthread_kill(pthread_t __thread, int __sig);
extern int pthread_sigmask(int __how, const sigset_t *__set, sigset_t *__oset);
extern int sigaltstack(const stack_t *__ss, stack_t *__oss);
extern int sighold(int __sig);
extern int sigignore(int __sig);
extern int siginterrupt(int __sig, int __flag);
extern int sigpause(int __sig);
extern int sigrelse(int __sig);
extern void (*sigset(int __sig, void (*__disp)(int)))(int);
extern int sigstack(struct sigstack *__ss, struct sigstack *__oss);
extern const char * const sys_siglist[];
extern const int sys_nsig;
# 1 "/usr/include/_packpop.h" 1 3 4
#pragma pack()
# 216 "/usr/include/signal.h" 2 3 4
};
# 15 "/usr/include/sys/wait.h" 2 3 4
typedef int id_t;
typedef enum {
P_ALL,
P_PID,
P_PGID
} idtype_t;
extern "C" {
extern pid_t wait(int *__stat_loc);
extern pid_t waitpid(pid_t __pid, int *__stat_loc, int __options);
struct rusage;
extern pid_t wait3(int *__stat_loc, int __options, struct rusage *__resource_usage);
extern pid_t wait4(pid_t __pid, int *__stat_loc, int __options, struct rusage *__resource_usage);
extern int waitid(idtype_t __idtype, id_t __id, siginfo_t *__infop, int __options);
};
# 21 "/usr/include/stdlib.h" 2 3 4
# 1 "/usr/include/malloc.h" 1 3 4
# 1 "/usr/include/_pack64.h" 1 3 4
#pragma pack()
# 11 "/usr/include/malloc.h" 2 3 4
# 1 "/usr/include/alloca.h" 1 3 4
extern "C" {
extern size_t __stackavail(void);
extern void *__builtin_alloca(size_t __size);
};
# 24 "/usr/include/malloc.h" 2 3 4
extern "C" {
extern void *calloc(size_t __n, size_t __size);
extern void *malloc(size_t __size);
extern void *realloc(void *__ptr, size_t __size);
extern void free(void *__ptr);
extern int posix_memalign(void **__memptr, size_t __alignment, size_t __size);
extern int cfree(void *__ptr);
extern void *_scalloc(size_t __size);
extern void *_smalloc(size_t __size);
extern void *_srealloc(void *__ptr, size_t __old_size, size_t __new_size);
extern void _sfree(void *__ptr, size_t __size);
enum malloc_opt_cmds {
MALLOC_VERIFY,
MALLOC_VERIFY_ON,
MALLOC_STATS,
MALLOC_FREE_CHECK,
MALLOC_ARENA_SIZE
};
struct malloc_stats {
unsigned m_small_freemem;
unsigned m_freemem;
unsigned m_small_overhead;
unsigned m_overhead;
unsigned m_small_allocmem;
unsigned m_allocmem;
unsigned m_coreallocs;
unsigned m_corefrees;
unsigned m_heapsize;
unsigned m_frees;
unsigned m_allocs;
unsigned m_reallocs;
};
};
# 1 "/usr/include/_packpop.h" 1 3 4
#pragma pack()
# 70 "/usr/include/malloc.h" 2 3 4
# 25 "/usr/include/stdlib.h" 2 3 4
# 1 "/usr/include/_pack64.h" 1 3 4
#pragma pack()
# 28 "/usr/include/stdlib.h" 2 3 4
typedef struct {
int quot;
int rem;
} div_t;
typedef struct {
long quot;
long rem;
} ldiv_t;
# 1 "/usr/include/_packpop.h" 1 3 4
#pragma pack()
# 66 "/usr/include/stdlib.h" 2 3 4
extern "C" {
extern void abort( void ) __attribute__((__noreturn__));
extern int abs( int __j );
extern int atexit( register void ( *__func )( void ) );
extern double atof( const char *__nptr );
extern int atoi( const char *__nptr );
extern long int atol( const char *__nptr );
extern void *bsearch( const void *__key, const void *__base,
size_t __nmemb, size_t __size,
int ( *__compar )( const void *__pkey, const void *__pbase ) );
extern div_t div( int __numer, int __denom );
extern void exit( int __status ) __attribute__((__noreturn__));
extern char *getenv( const char *__name );
extern long int labs( long int __j );
extern ldiv_t ldiv( long int __numer, long int __denom );
extern int mblen( const char *__s, size_t __n );
extern size_t mbstowcs( wchar_t *__pwcs, const char *__s, size_t __n );
extern int mbtowc( wchar_t *__pwc, const char *__s, size_t __n );
extern void qsort( void *__base, size_t __nmemb, size_t __size,
int (*__compar)( const void *, const void * ) );
extern int rand( void );
extern void srand( unsigned int __seed );
extern double strtod( const char *__nptr, char **__endptr );
extern long int strtol( const char *__nptr, char **__endptr, int __base );
extern unsigned long int strtoul( const char *__nptr, char **__endptr, int __base );
extern size_t wcstombs( char *__s, const wchar_t *__pwcs, size_t __n );
extern int wctomb( char *__s, wchar_t __wchar );
extern int system(const char *__cmd);
extern long a64l(const char *__s);
extern int getsubopt(char **__optionp, char * const *__tokens, char **__valuep);
extern int grantpt(int __fildes);
extern char *initstate(unsigned int __seed, char *__state, size_t __size);
extern long int jrand48(unsigned short int __xsubi[3]);
extern char *l64a(long __value);
extern void lcong48(unsigned short int __param[7]);
extern long int mrand48(void);
extern char *ptsname(int __fildes);
extern long random(void);
extern char *realpath(const char *__file_name, char *__resolved_name);
extern unsigned short int *seed48(unsigned short int __seed16v[3]);
extern void setkey(const char *__key);
extern char *setstate(const char *__state);
extern void srandom(unsigned int __seed);
extern int ttyslot(void);
extern int unlockpt(int __fildes);
extern void *valloc(size_t __size);
extern int rand_r(unsigned int *__seed);
extern int setenv(const char *__name, const char *__value, int __rewrite);
extern void unsetenv(const char *__name);
extern int daemon(int __nochdir, int __noclose);
extern double drand48(void);
extern double erand48(unsigned short int x[3]);
extern long int lrand48(void);
extern long int nrand48(unsigned short int x[3]);
extern void srand48(long seed);
extern int mkstemp(char *__template);
extern char * mktemp(char *__template);
extern char *ecvt( double __val, int __ndig, int *__dec, int *__sign );
extern char *fcvt( double __val, int __ndig, int *__dec, int *__sign );
extern char *gcvt( double __val, int __ndig, char *__buf );
extern int putenv(const char *__string);
extern _int64 strtoll( const char *__nptr, char **__endptr, int __base );
extern _uint64 strtoull( const char *__nptr, char **__endptr, int __base );
extern _int64 atoll( const char *__nptr );
extern char *lltoa( _int64 __value, char *__buf, int __radix );
extern char *ulltoa( _uint64 __value, char *__buf, int __radix );
int clearenv(void);
extern unsigned atoh( const char *__nptr );
extern char *itoa( int __value, char *__buf, int __radix );
extern char *ltoa( long int __value, char *__buf, int __radix );
extern char *_fullpath( char *__buf, const char *__path, size_t __size );
extern void searchenv( const char *__name, const char *__env_var, char *__buf );
extern char *ultoa( unsigned long int __value, char *__buf, int __radix );
extern char *utoa( unsigned int __value, char *__buf, int __radix );
extern unsigned _amblksiz;
};
# 50 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_algobase.h" 2 3
# 1 "/usr/lib/gcc-lib/ntox86/2.95.2/include/new.h" 1 3 4
# 1 "/usr/lib/gcc-lib/ntox86/2.95.2/include/new" 1 3 4
#pragma interface "new"
# 1 "/usr/lib/gcc-lib/ntox86/2.95.2/include/exception" 1 3 4
#pragma interface "exception"
extern "C++" {
namespace std {
class exception {
public:
exception () { }
virtual ~exception () { }
virtual const char* what () const;
};
class bad_exception : public exception {
public:
bad_exception () { }
virtual ~bad_exception () { }
};
typedef void (*terminate_handler) ();
typedef void (*unexpected_handler) ();
terminate_handler set_terminate (terminate_handler);
void terminate () __attribute__ ((__noreturn__));
unexpected_handler set_unexpected (unexpected_handler);
void unexpected () __attribute__ ((__noreturn__));
bool uncaught_exception ();
}
}
# 9 "/usr/lib/gcc-lib/ntox86/2.95.2/include/new" 2 3 4
extern "C++" {
namespace std {
class bad_alloc : public exception {
public:
virtual const char* what() const throw() { return "bad_alloc"; }
};
struct nothrow_t {};
extern const nothrow_t nothrow;
typedef void (*new_handler)();
new_handler set_new_handler (new_handler);
}
void *operator new (size_t) throw (std::bad_alloc);
void *operator new[] (size_t) throw (std::bad_alloc);
void operator delete (void *) throw();
void operator delete[] (void *) throw();
void *operator new (size_t, const std::nothrow_t&) throw();
void *operator new[] (size_t, const std::nothrow_t&) throw();
void operator delete (void *, const std::nothrow_t&) throw();
void operator delete[] (void *, const std::nothrow_t&) throw();
inline void *operator new(size_t, void *place) throw() { return place; }
inline void *operator new[](size_t, void *place) throw() { return place; }
}
# 6 "/usr/lib/gcc-lib/ntox86/2.95.2/include/new.h" 2 3 4
using std::new_handler;
using std::set_new_handler;
# 52 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_algobase.h" 2 3
# 1 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/iostream.h" 1 3
#pragma interface
# 1 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/streambuf.h" 1 3
#pragma interface
extern "C" {
# 1 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/libio.h" 1 3
# 55 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/libio.h" 3
# 67 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/libio.h" 3
# 104 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/libio.h" 3
struct _IO_jump_t; struct _IO_FILE;
# 174 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/libio.h" 3
typedef void _IO_lock_t;
struct _IO_marker {
struct _IO_marker *_next;
struct _IO_FILE *_sbuf;
int _pos;
# 207 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/libio.h" 3
};
struct _IO_FILE {
int _flags;
char* _IO_read_ptr;
char* _IO_read_end;
char* _IO_read_base;
char* _IO_write_base;
char* _IO_write_ptr;
char* _IO_write_end;
char* _IO_buf_base;
char* _IO_buf_end;
char *_IO_save_base;
char *_IO_backup_base;
char *_IO_save_end;
struct _IO_marker *_markers;
struct _IO_FILE *_chain;
int _fileno;
int _blksize;
_G_off_t _offset;
unsigned short _cur_column;
char _unused;
char _shortbuf[1];
};
struct _IO_FILE_plus;
extern struct _IO_FILE_plus _IO_stdin_, _IO_stdout_, _IO_stderr_;
typedef struct
{
_G_ssize_t (*read) (struct _IO_FILE *, void *, _G_ssize_t ) ;
_G_ssize_t (*write) (struct _IO_FILE *, const void *, _G_ssize_t ) ;
_G_fpos_t (*seek) (struct _IO_FILE *, _G_off_t , int) ;
int (*close) (struct _IO_FILE *) ;
} _IO_cookie_io_functions_t;
struct _IO_cookie_file
{
struct _IO_FILE file;
const void *vtable;
void *cookie;
_IO_cookie_io_functions_t io_functions;
};
extern "C" {
extern int __underflow (_IO_FILE *) ;
extern int __uflow (_IO_FILE *) ;
extern int __overflow (_IO_FILE *, int) ;
extern int _IO_getc (_IO_FILE *__fp) ;
extern int _IO_putc (int __c, _IO_FILE *__fp) ;
extern int _IO_feof (_IO_FILE *__fp) ;
extern int _IO_ferror (_IO_FILE *__fp) ;
extern int _IO_peekc_locked (_IO_FILE *__fp) ;
extern void _IO_flockfile (_IO_FILE *) ;
extern void _IO_funlockfile (_IO_FILE *) ;
extern int _IO_ftrylockfile (_IO_FILE *) ;
extern int _IO_vfscanf (_IO_FILE *, const char *, _G_va_list , int *) ;
extern int _IO_vfprintf (_IO_FILE *, const char *, _G_va_list ) ;
extern _G_ssize_t _IO_padn (_IO_FILE *, int, _G_ssize_t ) ;
extern _G_size_t _IO_sgetn (_IO_FILE *, void *, _G_size_t ) ;
extern _G_fpos_t _IO_seekoff (_IO_FILE *, _G_off_t , int, int) ;
extern _G_fpos_t _IO_seekpos (_IO_FILE *, _G_fpos_t , int) ;
extern void _IO_free_backup_area (_IO_FILE *) ;
}
# 36 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/streambuf.h" 2 3
}
extern "C++" {
class istream;
class ostream; class streambuf;
typedef _G_off_t streamoff;
typedef _G_fpos_t streampos;
typedef _G_ssize_t streamsize;
typedef unsigned long __fmtflags;
typedef unsigned char __iostate;
struct _ios_fields
{
streambuf *_strbuf;
ostream* _tie;
int _width;
__fmtflags _flags;
short _fill;
__iostate _state;
__iostate _exceptions;
int _precision;
void *_arrays;
};
# 124 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/streambuf.h" 3
class ios : public _ios_fields {
ios& operator=(ios&);
ios (const ios&);
public:
typedef __fmtflags fmtflags;
typedef int iostate;
typedef int openmode;
typedef _G_ssize_t streamsize;
enum io_state {
goodbit = 0 ,
eofbit = 1 ,
failbit = 2 ,
badbit = 4 };
enum open_mode {
in = 1 ,
out = 2 ,
ate = 4 ,
app = 8 ,
trunc = 16 ,
nocreate = 32 ,
noreplace = 64 ,
bin = 128 ,
binary = 128 };
enum seek_dir { beg, cur, end};
typedef enum seek_dir seekdir;
enum { skipws= 01 ,
left= 02 , right= 04 , internal= 010 ,
dec= 020 , oct= 040 , hex= 0100 ,
showbase= 0200 , showpoint= 0400 ,
uppercase= 01000 , showpos= 02000 ,
scientific= 04000 , fixed= 010000 ,
unitbuf= 020000 , stdio= 040000
};
enum {
basefield=dec+oct+hex,
floatfield = scientific+fixed,
adjustfield = left+right+internal
};
# 177 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/streambuf.h" 3
ostream* tie() const { return _tie; }
ostream* tie(ostream* val) { ostream* save=_tie; _tie=val; return save; }
short fill() const { return _fill; }
short fill(short newf)
{short oldf = _fill; _fill = newf; return oldf;}
fmtflags flags() const { return _flags; }
fmtflags flags(fmtflags new_val) {
fmtflags old_val = _flags; _flags = new_val; return old_val; }
int precision() const { return _precision; }
int precision(int newp) {
unsigned short oldp = _precision; _precision = (unsigned short)newp;
return oldp; }
fmtflags setf(fmtflags val) {
fmtflags oldbits = _flags;
_flags |= val; return oldbits; }
fmtflags setf(fmtflags val, fmtflags mask) {
fmtflags oldbits = _flags;
_flags = (_flags & ~mask) | (val & mask); return oldbits; }
fmtflags unsetf(fmtflags mask) {
fmtflags oldbits = _flags;
_flags &= ~mask; return oldbits; }
int width() const { return _width; }
int width(int val) { int save = _width; _width = val; return save; }
void _throw_failure() const { }
void clear(iostate state = 0) {
_state = _strbuf ? state : state|badbit;
if (_state & _exceptions) _throw_failure(); }
void set(iostate flag) { _state |= flag;
if (_state & _exceptions) _throw_failure(); }
void setstate(iostate flag) { _state |= flag;
if (_state & _exceptions) _throw_failure(); }
int good() const { return _state == 0; }
int eof() const { return _state & ios::eofbit; }
int fail() const { return _state & (ios::badbit|ios::failbit); }
int bad() const { return _state & ios::badbit; }
iostate rdstate() const { return _state; }
operator void*() const { return fail() ? (void*)0 : (void*)(-1); }
int operator!() const { return fail(); }
iostate exceptions() const { return _exceptions; }
void exceptions(iostate enable) {
_exceptions = enable;
if (_state & _exceptions) _throw_failure(); }
streambuf* rdbuf() const { return _strbuf; }
streambuf* rdbuf(streambuf *_s) {
streambuf *_old = _strbuf; _strbuf = _s; clear (); return _old; }
static int sync_with_stdio(int on);
static void sync_with_stdio() { sync_with_stdio(1); }
static fmtflags bitalloc();
static int xalloc();
void*& pword(int);
void* pword(int) const;
long& iword(int);
long iword(int) const;
class Init {
public:
Init () { }
};
protected:
inline ios(streambuf* sb = 0, ostream* tie_to = 0);
inline virtual ~ios();
inline void init(streambuf* sb, ostream* tie = 0);
};
typedef ios::seek_dir _seek_dir;
class streammarker : private _IO_marker {
friend class streambuf;
void set_offset(int offset) { _pos = offset; }
public:
streammarker(streambuf *sb);
~streammarker();
int saving() { return 1; }
int delta(streammarker&);
int delta();
};
struct streambuf : public _IO_FILE {
friend class ios;
friend class istream;
friend class ostream;
friend class streammarker;
const void *&_vtable() { return *(const void**)((_IO_FILE*)this + 1); }
protected:
static streambuf* _list_all;
_IO_FILE*& xchain() { return _chain; }
void _un_link();
void _link_in();
char* gptr() const
{ return _flags & 0x100 ? _IO_save_base : _IO_read_ptr; }
char* pptr() const { return _IO_write_ptr; }
char* egptr() const
{ return _flags & 0x100 ? _IO_save_end : _IO_read_end; }
char* epptr() const { return _IO_write_end; }
char* pbase() const { return _IO_write_base; }
char* eback() const
{ return _flags & 0x100 ? _IO_save_base : _IO_read_base;}
char* base() const { return _IO_buf_base; }
char* ebuf() const { return _IO_buf_end; }
int blen() const { return _IO_buf_end - _IO_buf_base; }
void xput_char(char c) { *_IO_write_ptr++ = c; }
int xflags() { return _flags ; }
int xflags(int f) {int fl = _flags ; _flags = f; return fl;}
void xsetflags(int f) { _flags |= f; }
void xsetflags(int f, int mask)
{ _flags = (_flags & ~mask) | (f & mask); }
void gbump(int n)
{ _flags & 0x100 ? (_IO_save_base+=n):(_IO_read_ptr+=n);}
void pbump(int n) { _IO_write_ptr += n; }
void setb(char* b, char* eb, int a=0);
void setp(char* p, char* ep)
{ _IO_write_base=_IO_write_ptr=p; _IO_write_end=ep; }
void setg(char* eb, char* g, char *eg) {
if (_flags & 0x100 ) _IO_free_backup_area(this);
_IO_read_base = eb; _IO_read_ptr = g; _IO_read_end = eg; }
char *shortbuf() { return _shortbuf; }
int in_backup() { return _flags & 0x100 ; }
char *Gbase() { return in_backup() ? _IO_save_base : _IO_read_base; }
char *eGptr() { return in_backup() ? _IO_save_end : _IO_read_end; }
char *Bbase() { return in_backup() ? _IO_read_base : _IO_save_base; }
char *Bptr() { return _IO_backup_base; }
char *eBptr() { return in_backup() ? _IO_read_end : _IO_save_end; }
char *Nbase() { return _IO_save_base; }
char *eNptr() { return _IO_save_end; }
int have_backup() { return _IO_save_base != 0 ; }
int have_markers() { return _markers != 0 ; }
void free_backup_area();
void unsave_markers();
int put_mode() { return _flags & 0x800 ; }
int switch_to_get_mode();
streambuf(int flags=0);
public:
static int flush_all();
static void flush_all_linebuffered();
virtual ~streambuf();
virtual int overflow(int c = (-1) );
virtual int underflow();
virtual int uflow();
virtual int pbackfail(int c);
virtual streamsize xsputn(const char* s, streamsize n);
virtual streamsize xsgetn(char* s, streamsize n);
virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
virtual streampos seekpos(streampos pos, int mode = ios::in|ios::out);
streampos pubseekoff(streamoff o, _seek_dir d, int mode=ios::in|ios::out)
{ return _IO_seekoff (this, o, d, mode); }
streampos pubseekpos(streampos pos, int mode = ios::in|ios::out)
{ return _IO_seekpos (this, pos, mode); }
streampos sseekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
streampos sseekpos(streampos pos, int mode = ios::in|ios::out);
virtual streambuf* setbuf(char* p, int len);
virtual int sync();
virtual int doallocate();
int seekmark(streammarker& mark, int delta = 0);
int sputbackc(char c);
int sungetc();
int unbuffered() { return _flags & 2 ? 1 : 0; }
int linebuffered() { return _flags & 0x200 ? 1 : 0; }
void unbuffered(int i)
{ if (i) _flags |= 2 ; else _flags &= ~2 ; }
void linebuffered(int i)
{ if (i) _flags |= 0x200 ; else _flags &= ~0x200 ; }
int allocate() {
if (base() || unbuffered()) return 0;
else return doallocate(); }
void allocbuf() { if (base() == 0 ) doallocbuf(); }
void doallocbuf();
int in_avail() { return _IO_read_end - _IO_read_ptr; }
int out_waiting() { return _IO_write_ptr - _IO_write_base; }
streamsize sputn(const char* s, streamsize n) { return xsputn(s, n); }
streamsize padn(char pad, streamsize n) { return _IO_padn(this, pad, n); }
streamsize sgetn(char* s, streamsize n) { return _IO_sgetn(this, s, n); }
int ignore(int);
int get_column();
int set_column(int);
long sgetline(char* buf, _G_size_t n, char delim, int putback_delim);
int sputc(int c) { return _IO_putc(c, this); }
int sbumpc() { return _IO_getc(this); }
int sgetc() { return (( this )->_IO_read_ptr >= ( this )->_IO_read_end && __underflow ( this ) == (-1) ? (-1) : *(unsigned char *) ( this )->_IO_read_ptr) ; }
int snextc() {
if (_IO_read_ptr >= _IO_read_end && __underflow(this) == (-1) )
return (-1) ;
else return _IO_read_ptr++, sgetc(); }
void stossc() { if (_IO_read_ptr < _IO_read_end) _IO_read_ptr++; }
int vscan(char const *fmt0, _G_va_list ap, ios* stream = 0 );
int scan(char const *fmt0 ...);
int vform(char const *fmt0, _G_va_list ap);
int form(char const *fmt0 ...);
virtual streamsize sys_read(char* buf, streamsize size);
virtual streamsize sys_write(const char*, streamsize);
virtual streampos sys_seek(streamoff, _seek_dir);
virtual int sys_close();
virtual int sys_stat(void*);
};
class filebuf : public streambuf {
protected:
void init();
public:
static const int openprot;
filebuf();
filebuf(int fd);
filebuf(int fd, char* p, int len);
~filebuf();
filebuf* attach(int fd);
filebuf* open(const char *filename, const char *mode);
filebuf* open(const char *filename, ios::openmode mode, int prot = 0664);
virtual int underflow();
virtual int overflow(int c = (-1) );
int is_open() const { return _fileno >= 0; }
int fd() const { return is_open() ? _fileno : (-1) ; }
filebuf* close();
virtual int doallocate();
virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
virtual streambuf* setbuf(char* p, int len);
streamsize xsputn(const char* s, streamsize n);
streamsize xsgetn(char* s, streamsize n);
virtual int sync();
protected:
int is_reading() { return eback() != egptr(); }
char* cur_ptr() { return is_reading() ? gptr() : pptr(); }
char* file_ptr() { return eGptr(); }
virtual streamsize sys_read(char* buf, streamsize size);
virtual streampos sys_seek(streamoff, _seek_dir);
virtual streamsize sys_write(const char*, streamsize);
virtual int sys_stat(void*);
virtual int sys_close();
};
inline void ios::init(streambuf* sb, ostream* tie_to) {
_state = sb ? ios::goodbit : ios::badbit; _exceptions=0;
_strbuf=sb; _tie = tie_to; _width=0; _fill=' ';
_flags=ios::skipws|ios::dec;
_precision=6; _arrays = 0; }
inline ios::ios(streambuf* sb, ostream* tie_to) { init(sb, tie_to); }
inline ios::~ios() {
operator delete[] (_arrays);
}
}
# 31 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/iostream.h" 2 3
extern "C++" {
class istream; class ostream;
typedef ios& (*__manip)(ios&);
typedef istream& (*__imanip)(istream&);
typedef ostream& (*__omanip)(ostream&);
extern istream& ws(istream& ins);
extern ostream& flush(ostream& outs);
extern ostream& endl(ostream& outs);
extern ostream& ends(ostream& outs);
class ostream : virtual public ios
{
void do_osfx();
public:
ostream() { }
ostream(streambuf* sb, ostream* tied= 0 );
int opfx() {
if (!good()) return 0;
else { if (_tie) _tie->flush(); ; return 1;} }
void osfx() { ;
if (flags() & (ios::unitbuf|ios::stdio))
do_osfx(); }
ostream& flush();
ostream& put(char c) { _strbuf->sputc(c); return *this; }
ostream& write(const char *s, streamsize n);
ostream& write(const unsigned char *s, streamsize n)
{ return write((const char*)s, n);}
ostream& write(const signed char *s, streamsize n)
{ return write((const char*)s, n);}
ostream& write(const void *s, streamsize n)
{ return write((const char*)s, n);}
ostream& seekp(streampos);
ostream& seekp(streamoff, _seek_dir);
streampos tellp();
ostream& form(const char *format ...);
ostream& vform(const char *format, _G_va_list args);
ostream& operator<<(char c);
ostream& operator<<(unsigned char c) { return (*this) << (char)c; }
ostream& operator<<(signed char c) { return (*this) << (char)c; }
ostream& operator<<(const char *s);
ostream& operator<<(const unsigned char *s)
{ return (*this) << (const char*)s; }
ostream& operator<<(const signed char *s)
{ return (*this) << (const char*)s; }
ostream& operator<<(const void *p);
ostream& operator<<(int n);
ostream& operator<<(unsigned int n);
ostream& operator<<(long n);
ostream& operator<<(unsigned long n);
__extension__ ostream& operator<<(long long n);
__extension__ ostream& operator<<(unsigned long long n);
ostream& operator<<(short n) {return operator<<((int)n);}
ostream& operator<<(unsigned short n) {return operator<<((unsigned int)n);}
ostream& operator<<(bool b) { return operator<<((int)b); }
ostream& operator<<(double n);
ostream& operator<<(float n) { return operator<<((double)n); }
ostream& operator<<(long double n) { return operator<<((double)n); }
ostream& operator<<(__omanip func) { return (*func)(*this); }
ostream& operator<<(__manip func) {(*func)(*this); return *this;}
ostream& operator<<(streambuf*);
};
class istream : virtual public ios
{
protected:
_G_size_t _gcount;
int _skip_ws();
public:
istream(): _gcount (0) { }
istream(streambuf* sb, ostream*tied= 0 );
istream& get(char* ptr, int len, char delim = '\n');
istream& get(unsigned char* ptr, int len, char delim = '\n')
{ return get((char*)ptr, len, delim); }
istream& get(char& c);
istream& get(unsigned char& c) { return get((char&)c); }
istream& getline(char* ptr, int len, char delim = '\n');
istream& getline(unsigned char* ptr, int len, char delim = '\n')
{ return getline((char*)ptr, len, delim); }
istream& get(signed char& c) { return get((char&)c); }
istream& get(signed char* ptr, int len, char delim = '\n')
{ return get((char*)ptr, len, delim); }
istream& getline(signed char* ptr, int len, char delim = '\n')
{ return getline((char*)ptr, len, delim); }
istream& read(char *ptr, streamsize n);
istream& read(unsigned char *ptr, streamsize n)
{ return read((char*)ptr, n); }
istream& read(signed char *ptr, streamsize n)
{ return read((char*)ptr, n); }
istream& read(void *ptr, streamsize n)
{ return read((char*)ptr, n); }
istream& get(streambuf& sb, char delim = '\n');
istream& gets(char **s, char delim = '\n');
int ipfx(int need = 0) {
if (!good()) { set(ios::failbit); return 0; }
else {
;
if (_tie && (need == 0 || rdbuf()->in_avail() < need)) _tie->flush();
if (!need && (flags() & ios::skipws)) return _skip_ws();
else return 1;
}
}
int ipfx0() {
if (!good()) { set(ios::failbit); return 0; }
else {
;
if (_tie) _tie->flush();
if (flags() & ios::skipws) return _skip_ws();
else return 1;
}
}
int ipfx1() {
if (!good()) { set(ios::failbit); return 0; }
else {
;
if (_tie && rdbuf()->in_avail() == 0) _tie->flush();
return 1;
}
}
void isfx() { ; }
int get() { if (!ipfx1()) return (-1) ;
else { int ch = _strbuf->sbumpc();
if (ch == (-1) ) set(ios::eofbit);
isfx();
return ch;
} }
int peek();
_G_size_t gcount() { return _gcount; }
istream& ignore(int n=1, int delim = (-1) );
int sync ();
istream& seekg(streampos);
istream& seekg(streamoff, _seek_dir);
streampos tellg();
istream& putback(char ch) {
if (good() && _strbuf->sputbackc(ch) == (-1) ) clear(ios::badbit);
return *this;}
istream& unget() {
if (good() && _strbuf->sungetc() == (-1) ) clear(ios::badbit);
return *this;}
istream& scan(const char *format ...);
istream& vscan(const char *format, _G_va_list args);
istream& operator>>(char*);
istream& operator>>(unsigned char* p) { return operator>>((char*)p); }
istream& operator>>(signed char*p) { return operator>>((char*)p); }
istream& operator>>(char& c);
istream& operator>>(unsigned char& c) {return operator>>((char&)c);}
istream& operator>>(signed char& c) {return operator>>((char&)c);}
istream& operator>>(int&);
istream& operator>>(long&);
__extension__ istream& operator>>(long long&);
__extension__ istream& operator>>(unsigned long long&);
istream& operator>>(short&);
istream& operator>>(unsigned int&);
istream& operator>>(unsigned long&);
istream& operator>>(unsigned short&);
istream& operator>>(bool&);
istream& operator>>(float&);
istream& operator>>(double&);
istream& operator>>(long double&);
istream& operator>>( __manip func) {(*func)(*this); return *this;}
istream& operator>>(__imanip func) { return (*func)(*this); }
istream& operator>>(streambuf*);
};
class iostream : public istream, public ostream
{
public:
iostream() { }
iostream(streambuf* sb, ostream*tied= 0 );
};
class _IO_istream_withassign : public istream {
public:
_IO_istream_withassign& operator=(istream&);
_IO_istream_withassign& operator=(_IO_istream_withassign& rhs)
{ return operator= (static_cast<istream&> (rhs)); }
};
class _IO_ostream_withassign : public ostream {
public:
_IO_ostream_withassign& operator=(ostream&);
_IO_ostream_withassign& operator=(_IO_ostream_withassign& rhs)
{ return operator= (static_cast<ostream&> (rhs)); }
};
extern _IO_istream_withassign cin;
extern _IO_ostream_withassign cout, cerr;
extern _IO_ostream_withassign clog
;
extern istream& lock(istream& ins);
extern istream& unlock(istream& ins);
extern ostream& lock(ostream& outs);
extern ostream& unlock(ostream& outs);
struct Iostream_init { } ;
inline ios& dec(ios& i)
{ i.setf(ios::dec, ios::dec|ios::hex|ios::oct); return i; }
inline ios& hex(ios& i)
{ i.setf(ios::hex, ios::dec|ios::hex|ios::oct); return i; }
inline ios& oct(ios& i)
{ i.setf(ios::oct, ios::dec|ios::hex|ios::oct); return i; }
}
# 53 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_algobase.h" 2 3
# 1 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_iterator.h" 1 3
struct input_iterator_tag {};
struct output_iterator_tag {};
struct forward_iterator_tag : public input_iterator_tag {};
struct bidirectional_iterator_tag : public forward_iterator_tag {};
struct random_access_iterator_tag : public bidirectional_iterator_tag {};
template <class _Tp, class _Distance> struct input_iterator {
typedef input_iterator_tag iterator_category;
typedef _Tp value_type;
typedef _Distance difference_type;
typedef _Tp* pointer;
typedef _Tp& reference;
};
struct output_iterator {
typedef output_iterator_tag iterator_category;
typedef void value_type;
typedef void difference_type;
typedef void pointer;
typedef void reference;
};
template <class _Tp, class _Distance> struct forward_iterator {
typedef forward_iterator_tag iterator_category;
typedef _Tp value_type;
typedef _Distance difference_type;
typedef _Tp* pointer;
typedef _Tp& reference;
};
template <class _Tp, class _Distance> struct bidirectional_iterator {
typedef bidirectional_iterator_tag iterator_category;
typedef _Tp value_type;
typedef _Distance difference_type;
typedef _Tp* pointer;
typedef _Tp& reference;
};
template <class _Tp, class _Distance> struct random_access_iterator {
typedef random_access_iterator_tag iterator_category;
typedef _Tp value_type;
typedef _Distance difference_type;
typedef _Tp* pointer;
typedef _Tp& reference;
};
# 98 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_iterator.h" 3
template <class _Iterator>
struct iterator_traits {
typedef typename _Iterator::iterator_category iterator_category;
typedef typename _Iterator::value_type value_type;
typedef typename _Iterator::difference_type difference_type;
typedef typename _Iterator::pointer pointer;
typedef typename _Iterator::reference reference;
};
template <class _Tp>
struct iterator_traits<_Tp*> {
typedef random_access_iterator_tag iterator_category;
typedef _Tp value_type;
typedef ptrdiff_t difference_type;
typedef _Tp* pointer;
typedef _Tp& reference;
};
template <class _Tp>
struct iterator_traits<const _Tp*> {
typedef random_access_iterator_tag iterator_category;
typedef _Tp value_type;
typedef ptrdiff_t difference_type;
typedef const _Tp* pointer;
typedef const _Tp& reference;
};
template <class _Iter>
inline typename iterator_traits<_Iter>::iterator_category
__iterator_category(const _Iter&)
{
typedef typename iterator_traits<_Iter>::iterator_category _Category;
return _Category();
}
template <class _Iter>
inline typename iterator_traits<_Iter>::difference_type*
__distance_type(const _Iter&)
{
return static_cast<typename iterator_traits<_Iter>::difference_type*>(0);
}
template <class _Iter>
inline typename iterator_traits<_Iter>::value_type*
__value_type(const _Iter&)
{
return static_cast<typename iterator_traits<_Iter>::value_type*>(0);
}
template <class _Iter>
inline typename iterator_traits<_Iter>::iterator_category
iterator_category(const _Iter& __i) { return __iterator_category(__i); }
template <class _Iter>
inline typename iterator_traits<_Iter>::difference_type*
distance_type(const _Iter& __i) { return __distance_type(__i); }
template <class _Iter>
inline typename iterator_traits<_Iter>::value_type*
value_type(const _Iter& __i) { return __value_type(__i); }
# 259 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_iterator.h" 3
template <class _InputIterator, class _Distance>
inline void __distance(_InputIterator __first, _InputIterator __last,
_Distance& __n, input_iterator_tag)
{
while (__first != __last) { ++__first; ++__n; }
}
template <class _RandomAccessIterator, class _Distance>
inline void __distance(_RandomAccessIterator __first,
_RandomAccessIterator __last,
_Distance& __n, random_access_iterator_tag)
{
__n += __last - __first;
}
template <class _InputIterator, class _Distance>
inline void distance(_InputIterator __first,
_InputIterator __last, _Distance& __n)
{
__distance(__first, __last, __n, iterator_category(__first));
}
template <class _InputIterator>
inline typename iterator_traits<_InputIterator>::difference_type
__distance(_InputIterator __first, _InputIterator __last, input_iterator_tag)
{
typename iterator_traits<_InputIterator>::difference_type __n = 0;
while (__first != __last) {
++__first; ++__n;
}
return __n;
}
template <class _RandomAccessIterator>
inline typename iterator_traits<_RandomAccessIterator>::difference_type
__distance(_RandomAccessIterator __first, _RandomAccessIterator __last,
random_access_iterator_tag) {
return __last - __first;
}
template <class _InputIterator>
inline typename iterator_traits<_InputIterator>::difference_type
distance(_InputIterator __first, _InputIterator __last) {
typedef typename iterator_traits<_InputIterator>::iterator_category
_Category;
return __distance(__first, __last, _Category());
}
template <class _InputIter, class _Distance>
inline void __advance(_InputIter& __i, _Distance __n, input_iterator_tag) {
while (__n--) ++__i;
}
template <class _BidirectionalIterator, class _Distance>
inline void __advance(_BidirectionalIterator& __i, _Distance __n,
bidirectional_iterator_tag) {
if (__n >= 0)
while (__n--) ++__i;
else
while (__n++) --__i;
}
template <class _RandomAccessIterator, class _Distance>
inline void __advance(_RandomAccessIterator& __i, _Distance __n,
random_access_iterator_tag) {
__i += __n;
}
template <class _InputIterator, class _Distance>
inline void advance(_InputIterator& __i, _Distance __n) {
__advance(__i, __n, iterator_category(__i));
}
template <class _Container>
class back_insert_iterator {
protected:
_Container* container;
public:
typedef _Container container_type;
typedef output_iterator_tag iterator_category;
typedef void value_type;
typedef void difference_type;
typedef void pointer;
typedef void reference;
explicit back_insert_iterator(_Container& __x) : container(&__x) {}
back_insert_iterator<_Container>&
operator=(const typename _Container::value_type& __value) {
container->push_back(__value);
return *this;
}
back_insert_iterator<_Container>& operator*() { return *this; }
back_insert_iterator<_Container>& operator++() { return *this; }
back_insert_iterator<_Container>& operator++(int) { return *this; }
};
# 378 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_iterator.h" 3
template <class _Container>
inline back_insert_iterator<_Container> back_inserter(_Container& __x) {
return back_insert_iterator<_Container>(__x);
}
template <class _Container>
class front_insert_iterator {
protected:
_Container* container;
public:
typedef _Container container_type;
typedef output_iterator_tag iterator_category;
typedef void value_type;
typedef void difference_type;
typedef void pointer;
typedef void reference;
explicit front_insert_iterator(_Container& __x) : container(&__x) {}
front_insert_iterator<_Container>&
operator=(const typename _Container::value_type& __value) {
container->push_front(__value);
return *this;
}
front_insert_iterator<_Container>& operator*() { return *this; }
front_insert_iterator<_Container>& operator++() { return *this; }
front_insert_iterator<_Container>& operator++(int) { return *this; }
};
# 417 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_iterator.h" 3
template <class _Container>
inline front_insert_iterator<_Container> front_inserter(_Container& __x) {
return front_insert_iterator<_Container>(__x);
}
template <class _Container>
class insert_iterator {
protected:
_Container* container;
typename _Container::iterator iter;
public:
typedef _Container container_type;
typedef output_iterator_tag iterator_category;
typedef void value_type;
typedef void difference_type;
typedef void pointer;
typedef void reference;
insert_iterator(_Container& __x, typename _Container::iterator __i)
: container(&__x), iter(__i) {}
insert_iterator<_Container>&
operator=(const typename _Container::value_type& __value) {
iter = container->insert(iter, __value);
++iter;
return *this;
}
insert_iterator<_Container>& operator*() { return *this; }
insert_iterator<_Container>& operator++() { return *this; }
insert_iterator<_Container>& operator++(int) { return *this; }
};
# 459 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_iterator.h" 3
template <class _Container, class _Iterator>
inline
insert_iterator<_Container> inserter(_Container& __x, _Iterator __i)
{
typedef typename _Container::iterator __iter;
return insert_iterator<_Container>(__x, __iter(__i));
}
template <class _BidirectionalIterator, class _Tp, class _Reference = _Tp&,
class _Distance = ptrdiff_t>
class reverse_bidirectional_iterator {
typedef reverse_bidirectional_iterator<_BidirectionalIterator, _Tp,
_Reference, _Distance> _Self;
protected:
_BidirectionalIterator current;
public:
typedef bidirectional_iterator_tag iterator_category;
typedef _Tp value_type;
typedef _Distance difference_type;
typedef _Tp* pointer;
typedef _Reference reference;
reverse_bidirectional_iterator() {}
explicit reverse_bidirectional_iterator(_BidirectionalIterator __x)
: current(__x) {}
_BidirectionalIterator base() const { return current; }
_Reference operator*() const {
_BidirectionalIterator __tmp = current;
return *--__tmp;
}
pointer operator->() const { return &(operator*()); }
_Self& operator++() {
--current;
return *this;
}
_Self operator++(int) {
_Self __tmp = *this;
--current;
return __tmp;
}
_Self& operator--() {
++current;
return *this;
}
_Self operator--(int) {
_Self __tmp = *this;
++current;
return __tmp;
}
};
# 550 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_iterator.h" 3
template <class _BiIter, class _Tp, class _Ref,
class _Distance>
inline bool operator==(
const reverse_bidirectional_iterator<_BiIter, _Tp, _Ref, _Distance>& __x,
const reverse_bidirectional_iterator<_BiIter, _Tp, _Ref, _Distance>& __y)
{
return __x.base() == __y.base();
}
template <class _Iterator>
class reverse_iterator
{
protected:
_Iterator current;
public:
typedef typename iterator_traits<_Iterator>::iterator_category
iterator_category;
typedef typename iterator_traits<_Iterator>::value_type
value_type;
typedef typename iterator_traits<_Iterator>::difference_type
difference_type;
typedef typename iterator_traits<_Iterator>::pointer
pointer;
typedef typename iterator_traits<_Iterator>::reference
reference;
typedef _Iterator iterator_type;
typedef reverse_iterator<_Iterator> _Self;
public:
reverse_iterator() {}
explicit reverse_iterator(iterator_type __x) : current(__x) {}
reverse_iterator(const _Self& __x) : current(__x.current) {}
template <class _Iter>
reverse_iterator(const reverse_iterator<_Iter>& __x)
: current(__x.base()) {}
iterator_type base() const { return current; }
reference operator*() const {
_Iterator __tmp = current;
return *--__tmp;
}
pointer operator->() const { return &(operator*()); }
_Self& operator++() {
--current;
return *this;
}
_Self operator++(int) {
_Self __tmp = *this;
--current;
return __tmp;
}
_Self& operator--() {
++current;
return *this;
}
_Self operator--(int) {
_Self __tmp = *this;
++current;
return __tmp;
}
_Self operator+(difference_type __n) const {
return _Self(current - __n);
}
_Self& operator+=(difference_type __n) {
current -= __n;
return *this;
}
_Self operator-(difference_type __n) const {
return _Self(current + __n);
}
_Self& operator-=(difference_type __n) {
current += __n;
return *this;
}
reference operator[](difference_type __n) const { return *(*this + __n); }
};
template <class _Iterator>
inline bool operator==(const reverse_iterator<_Iterator>& __x,
const reverse_iterator<_Iterator>& __y) {
return __x.base() == __y.base();
}
template <class _Iterator>
inline bool operator<(const reverse_iterator<_Iterator>& __x,
const reverse_iterator<_Iterator>& __y) {
return __y.base() < __x.base();
}
template <class _Iterator>
inline typename reverse_iterator<_Iterator>::difference_type
operator-(const reverse_iterator<_Iterator>& __x,
const reverse_iterator<_Iterator>& __y) {
return __y.base() - __x.base();
}
template <class _Iterator>
inline reverse_iterator<_Iterator>
operator+(typename reverse_iterator<_Iterator>::difference_type __n,
const reverse_iterator<_Iterator>& __x) {
return reverse_iterator<_Iterator>(__x.base() - __n);
}
# 805 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_iterator.h" 3
template <class _Tp, class _Dist = ptrdiff_t>
class istream_iterator {
friend bool operator== <> (const istream_iterator&,
const istream_iterator&);
protected:
istream* _M_stream;
_Tp _M_value;
bool _M_end_marker;
void _M_read() {
_M_end_marker = (*_M_stream) ? true : false;
if (_M_end_marker) *_M_stream >> _M_value;
_M_end_marker = (*_M_stream) ? true : false;
}
public:
typedef input_iterator_tag iterator_category;
typedef _Tp value_type;
typedef _Dist difference_type;
typedef const _Tp* pointer;
typedef const _Tp& reference;
istream_iterator() : _M_stream(&cin), _M_end_marker(false) {}
istream_iterator(istream& __s) : _M_stream(&__s) { _M_read(); }
reference operator*() const { return _M_value; }
pointer operator->() const { return &(operator*()); }
istream_iterator<_Tp, _Dist>& operator++() {
_M_read();
return *this;
}
istream_iterator<_Tp, _Dist> operator++(int) {
istream_iterator<_Tp, _Dist> __tmp = *this;
_M_read();
return __tmp;
}
};
# 864 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_iterator.h" 3
template <class _Tp, class _Distance>
inline bool operator==(const istream_iterator<_Tp, _Distance>& __x,
const istream_iterator<_Tp, _Distance>& __y) {
return (__x._M_stream == __y._M_stream &&
__x._M_end_marker == __y._M_end_marker) ||
__x._M_end_marker == false && __y._M_end_marker == false;
}
template <class _Tp>
class ostream_iterator {
protected:
ostream* _M_stream;
const char* _M_string;
public:
typedef output_iterator_tag iterator_category;
typedef void value_type;
typedef void difference_type;
typedef void pointer;
typedef void reference;
ostream_iterator(ostream& __s) : _M_stream(&__s), _M_string(0) {}
ostream_iterator(ostream& __s, const char* __c)
: _M_stream(&__s), _M_string(__c) {}
ostream_iterator<_Tp>& operator=(const _Tp& __value) {
*_M_stream << __value;
if (_M_string) *_M_stream << _M_string;
return *this;
}
ostream_iterator<_Tp>& operator*() { return *this; }
ostream_iterator<_Tp>& operator++() { return *this; }
ostream_iterator<_Tp>& operator++(int) { return *this; }
};
# 907 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_iterator.h" 3
# 56 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_algobase.h" 2 3
template <class _ForwardIter1, class _ForwardIter2, class _Tp>
inline void __iter_swap(_ForwardIter1 __a, _ForwardIter2 __b, _Tp*) {
_Tp __tmp = *__a;
*__a = *__b;
*__b = __tmp;
}
template <class _ForwardIter1, class _ForwardIter2>
inline void iter_swap(_ForwardIter1 __a, _ForwardIter2 __b) {
__iter_swap(__a, __b, __value_type( __a ) );
}
template <class _Tp>
inline void swap(_Tp& __a, _Tp& __b) {
_Tp __tmp = __a;
__a = __b;
__b = __tmp;
}
template <class _Tp>
inline const _Tp& min(const _Tp& __a, const _Tp& __b) {
return __b < __a ? __b : __a;
}
template <class _Tp>
inline const _Tp& max(const _Tp& __a, const _Tp& __b) {
return __a < __b ? __b : __a;
}
template <class _Tp, class _Compare>
inline const _Tp& min(const _Tp& __a, const _Tp& __b, _Compare __comp) {
return __comp(__b, __a) ? __b : __a;
}
template <class _Tp, class _Compare>
inline const _Tp& max(const _Tp& __a, const _Tp& __b, _Compare __comp) {
return __comp(__a, __b) ? __b : __a;
}
template <class _InputIter, class _OutputIter, class _Distance>
inline _OutputIter __copy(_InputIter __first, _InputIter __last,
_OutputIter __result,
input_iterator_tag, _Distance*)
{
for ( ; __first != __last; ++__result, ++__first)
*__result = *__first;
return __result;
}
template <class _RandomAccessIter, class _OutputIter, class _Distance>
inline _OutputIter
__copy(_RandomAccessIter __first, _RandomAccessIter __last,
_OutputIter __result, random_access_iterator_tag, _Distance*)
{
for (_Distance __n = __last - __first; __n > 0; --__n) {
*__result = *__first;
++__first;
++__result;
}
return __result;
}
template <class _Tp>
inline _Tp*
__copy_trivial(const _Tp* __first, const _Tp* __last, _Tp* __result) {
memmove(__result, __first, sizeof(_Tp) * (__last - __first));
return __result + (__last - __first);
}
template <class _InputIter, class _OutputIter, class _BoolType>
struct __copy_dispatch {
static _OutputIter copy(_InputIter __first, _InputIter __last,
_OutputIter __result) {
typedef typename iterator_traits<_InputIter>::iterator_category _Category;
typedef typename iterator_traits<_InputIter>::difference_type _Distance;
return __copy(__first, __last, __result, _Category(), (_Distance*) 0);
}
};
template <class _Tp>
struct __copy_dispatch<_Tp*, _Tp*, __true_type>
{
static _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) {
return __copy_trivial(__first, __last, __result);
}
};
template <class _Tp>
struct __copy_dispatch<const _Tp*, _Tp*, __true_type>
{
static _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) {
return __copy_trivial(__first, __last, __result);
}
};
template <class _InputIter, class _OutputIter>
inline _OutputIter copy(_InputIter __first, _InputIter __last,
_OutputIter __result) {
typedef typename iterator_traits<_InputIter>::value_type _Tp;
typedef typename __type_traits<_Tp>::has_trivial_assignment_operator
_Trivial;
return __copy_dispatch<_InputIter, _OutputIter, _Trivial>
::copy(__first, __last, __result);
}
# 213 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_algobase.h" 3
template <class _BidirectionalIter1, class _BidirectionalIter2,
class _Distance>
inline _BidirectionalIter2 __copy_backward(_BidirectionalIter1 __first,
_BidirectionalIter1 __last,
_BidirectionalIter2 __result,
bidirectional_iterator_tag,
_Distance*)
{
while (__first != __last)
*--__result = *--__last;
return __result;
}
template <class _RandomAccessIter, class _BidirectionalIter, class _Distance>
inline _BidirectionalIter __copy_backward(_RandomAccessIter __first,
_RandomAccessIter __last,
_BidirectionalIter __result,
random_access_iterator_tag,
_Distance*)
{
for (_Distance __n = __last - __first; __n > 0; --__n)
*--__result = *--__last;
return __result;
}
template <class _BidirectionalIter1, class _BidirectionalIter2,
class _BoolType>
struct __copy_backward_dispatch
{
typedef typename iterator_traits<_BidirectionalIter1>::iterator_category
_Cat;
typedef typename iterator_traits<_BidirectionalIter1>::difference_type
_Distance;
static _BidirectionalIter2 copy(_BidirectionalIter1 __first,
_BidirectionalIter1 __last,
_BidirectionalIter2 __result) {
return __copy_backward(__first, __last, __result, _Cat(), (_Distance*) 0);
}
};
template <class _Tp>
struct __copy_backward_dispatch<_Tp*, _Tp*, __true_type>
{
static _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) {
const ptrdiff_t _Num = __last - __first;
memmove(__result - _Num, __first, sizeof(_Tp) * _Num);
return __result - _Num;
}
};
template <class _Tp>
struct __copy_backward_dispatch<const _Tp*, _Tp*, __true_type>
{
static _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) {
return __copy_backward_dispatch<_Tp*, _Tp*, __true_type>
::copy(__first, __last, __result);
}
};
template <class _BI1, class _BI2>
inline _BI2 copy_backward(_BI1 __first, _BI1 __last, _BI2 __result) {
typedef typename __type_traits<typename iterator_traits<_BI2>::value_type>
::has_trivial_assignment_operator
_Trivial;
return __copy_backward_dispatch<_BI1, _BI2, _Trivial>
::copy(__first, __last, __result);
}
# 303 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_algobase.h" 3
template <class _InputIter, class _Size, class _OutputIter>
pair<_InputIter, _OutputIter> __copy_n(_InputIter __first, _Size __count,
_OutputIter __result,
input_iterator_tag) {
for ( ; __count > 0; --__count) {
*__result = *__first;
++__first;
++__result;
}
return pair<_InputIter, _OutputIter>(__first, __result);
}
template <class _RAIter, class _Size, class _OutputIter>
inline pair<_RAIter, _OutputIter>
__copy_n(_RAIter __first, _Size __count,
_OutputIter __result,
random_access_iterator_tag) {
_RAIter __last = __first + __count;
return pair<_RAIter, _OutputIter>(__last, copy(__first, __last, __result));
}
template <class _InputIter, class _Size, class _OutputIter>
inline pair<_InputIter, _OutputIter>
__copy_n(_InputIter __first, _Size __count, _OutputIter __result) {
return __copy_n(__first, __count, __result,
__iterator_category( __first ) );
}
template <class _InputIter, class _Size, class _OutputIter>
inline pair<_InputIter, _OutputIter>
copy_n(_InputIter __first, _Size __count, _OutputIter __result) {
return __copy_n(__first, __count, __result);
}
template <class _ForwardIter, class _Tp>
void fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __value) {
for ( ; __first != __last; ++__first)
*__first = __value;
}
template <class _OutputIter, class _Size, class _Tp>
_OutputIter fill_n(_OutputIter __first, _Size __n, const _Tp& __value) {
for ( ; __n > 0; --__n, ++__first)
*__first = __value;
return __first;
}
template <class _InputIter1, class _InputIter2>
pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1,
_InputIter1 __last1,
_InputIter2 __first2) {
while (__first1 != __last1 && *__first1 == *__first2) {
++__first1;
++__first2;
}
return pair<_InputIter1, _InputIter2>(__first1, __first2);
}
template <class _InputIter1, class _InputIter2, class _BinaryPredicate>
pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1,
_InputIter1 __last1,
_InputIter2 __first2,
_BinaryPredicate __binary_pred) {
while (__first1 != __last1 && __binary_pred(*__first1, *__first2)) {
++__first1;
++__first2;
}
return pair<_InputIter1, _InputIter2>(__first1, __first2);
}
template <class _InputIter1, class _InputIter2>
inline bool equal(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2) {
for ( ; __first1 != __last1; ++__first1, ++__first2)
if (*__first1 != *__first2)
return false;
return true;
}
template <class _InputIter1, class _InputIter2, class _BinaryPredicate>
inline bool equal(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _BinaryPredicate __binary_pred) {
for ( ; __first1 != __last1; ++__first1, ++__first2)
if (!__binary_pred(*__first1, *__first2))
return false;
return true;
}
template <class _InputIter1, class _InputIter2>
bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2) {
for ( ; __first1 != __last1 && __first2 != __last2
; ++__first1, ++__first2) {
if (*__first1 < *__first2)
return true;
if (*__first2 < *__first1)
return false;
}
return __first1 == __last1 && __first2 != __last2;
}
template <class _InputIter1, class _InputIter2, class _Compare>
bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2,
_Compare __comp) {
for ( ; __first1 != __last1 && __first2 != __last2
; ++__first1, ++__first2) {
if (__comp(*__first1, *__first2))
return true;
if (__comp(*__first2, *__first1))
return false;
}
return __first1 == __last1 && __first2 != __last2;
}
inline bool
lexicographical_compare(const unsigned char* __first1,
const unsigned char* __last1,
const unsigned char* __first2,
const unsigned char* __last2)
{
const size_t __len1 = __last1 - __first1;
const size_t __len2 = __last2 - __first2;
const int __result = memcmp(__first1, __first2, min(__len1, __len2));
return __result != 0 ? __result < 0 : __len1 < __len2;
}
inline bool lexicographical_compare(const char* __first1, const char* __last1,
const char* __first2, const char* __last2)
{
return lexicographical_compare((const signed char*) __first1,
(const signed char*) __last1,
(const signed char*) __first2,
(const signed char*) __last2);
}
template <class _InputIter1, class _InputIter2>
int __lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2)
{
while (__first1 != __last1 && __first2 != __last2) {
if (*__first1 < *__first2)
return -1;
if (*__first2 < *__first1)
return 1;
++__first1;
++__first2;
}
if (__first2 == __last2) {
return !(__first1 == __last1);
}
else {
return -1;
}
}
inline int
__lexicographical_compare_3way(const unsigned char* __first1,
const unsigned char* __last1,
const unsigned char* __first2,
const unsigned char* __last2)
{
const ptrdiff_t __len1 = __last1 - __first1;
const ptrdiff_t __len2 = __last2 - __first2;
const int __result = memcmp(__first1, __first2, min(__len1, __len2));
return __result != 0 ? __result
: (__len1 == __len2 ? 0 : (__len1 < __len2 ? -1 : 1));
}
inline int
__lexicographical_compare_3way(const char* __first1, const char* __last1,
const char* __first2, const char* __last2)
{
return __lexicographical_compare_3way(
(const signed char*) __first1,
(const signed char*) __last1,
(const signed char*) __first2,
(const signed char*) __last2);
}
template <class _InputIter1, class _InputIter2>
int lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2)
{
return __lexicographical_compare_3way(__first1, __last1, __first2, __last2);
}
# 30 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/vector" 2 3
# 1 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_alloc.h" 1 3
# 1 "/usr/include/assert.h" 1 3 4
extern "C" {
extern void __assert(int, const char *, const char *, int);
};
# 56 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_alloc.h" 2 3
# 78 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_alloc.h" 3
# 87 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_alloc.h" 3
# 97 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_alloc.h" 3
# 115 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_alloc.h" 3
template <int __inst>
class __malloc_alloc_template {
private:
static void* _S_oom_malloc(size_t);
static void* _S_oom_realloc(void*, size_t);
static void (* __malloc_alloc_oom_handler)();
public:
static void* allocate(size_t __n)
{
void* __result = malloc(__n);
if (0 == __result) __result = _S_oom_malloc(__n);
return __result;
}
static void deallocate(void* __p, size_t )
{
free(__p);
}
static void* reallocate(void* __p, size_t , size_t __new_sz)
{
void* __result = realloc(__p, __new_sz);
if (0 == __result) __result = _S_oom_realloc(__p, __new_sz);
return __result;
}
static void (* __set_malloc_handler(void (*__f)()))()
{
void (* __old)() = __malloc_alloc_oom_handler;
__malloc_alloc_oom_handler = __f;
return(__old);
}
};
template <int __inst>
void (* __malloc_alloc_template<__inst>::__malloc_alloc_oom_handler)() = 0;
template <int __inst>
void*
__malloc_alloc_template<__inst>::_S_oom_malloc(size_t __n)
{
void (* __my_malloc_handler)();
void* __result;
for (;;) {
__my_malloc_handler = __malloc_alloc_oom_handler;
if (0 == __my_malloc_handler) { cerr << "out of memory" << endl; exit(1) ; }
(*__my_malloc_handler)();
__result = malloc(__n);
if (__result) return(__result);
}
}
template <int __inst>
void* __malloc_alloc_template<__inst>::_S_oom_realloc(void* __p, size_t __n)
{
void (* __my_malloc_handler)();
void* __result;
for (;;) {
__my_malloc_handler = __malloc_alloc_oom_handler;
if (0 == __my_malloc_handler) { cerr << "out of memory" << endl; exit(1) ; }
(*__my_malloc_handler)();
__result = realloc(__p, __n);
if (__result) return(__result);
}
}
typedef __malloc_alloc_template<0> malloc_alloc;
template<class _Tp, class _Alloc>
class simple_alloc {
public:
static _Tp* allocate(size_t __n)
{ return 0 == __n ? 0 : (_Tp*) _Alloc::allocate(__n * sizeof (_Tp)); }
static _Tp* allocate(void)
{ return (_Tp*) _Alloc::allocate(sizeof (_Tp)); }
static void deallocate(_Tp* __p, size_t __n)
{ if (0 != __n) _Alloc::deallocate(__p, __n * sizeof (_Tp)); }
static void deallocate(_Tp* __p)
{ _Alloc::deallocate(__p, sizeof (_Tp)); }
};
template <class _Alloc>
class debug_alloc {
private:
enum {_S_extra = 8};
public:
static void* allocate(size_t __n)
{
char* __result = (char*)_Alloc::allocate(__n + _S_extra);
*(size_t*)__result = __n;
return __result + _S_extra;
}
static void deallocate(void* __p, size_t __n)
{
char* __real_p = (char*)__p - _S_extra;
(( *(size_t*)__real_p == __n )?(void)0:__assert(0,"*(size_t*)__real_p == __n","/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_alloc.h",263)) ;
_Alloc::deallocate(__real_p, __n + _S_extra);
}
static void* reallocate(void* __p, size_t __old_sz, size_t __new_sz)
{
char* __real_p = (char*)__p - _S_extra;
(( *(size_t*)__real_p == __old_sz )?(void)0:__assert(0,"*(size_t*)__real_p == __old_sz","/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_alloc.h",270)) ;
char* __result = (char*)
_Alloc::reallocate(__real_p, __old_sz + _S_extra, __new_sz + _S_extra);
*(size_t*)__result = __new_sz;
return __result + _S_extra;
}
};
template <bool threads, int inst>
class __default_alloc_template {
private:
enum {_ALIGN = 8};
enum {_MAX_BYTES = 128};
enum {_NFREELISTS = _MAX_BYTES/_ALIGN};
static size_t
_S_round_up(size_t __bytes)
{ return (((__bytes) + _ALIGN-1) & ~(_ALIGN - 1)); }
private :
union _Obj {
union _Obj* _M_free_list_link;
char _M_client_data[1];
};
private:
static _Obj* _S_free_list[_NFREELISTS];
static size_t _S_freelist_index(size_t __bytes) {
return (((__bytes) + _ALIGN-1)/_ALIGN - 1);
}
static void* _S_refill(size_t __n);
static char* _S_chunk_alloc(size_t __size, int& __nobjs);
static char* _S_start_free;
static char* _S_end_free;
static size_t _S_heap_size;
# 389 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_alloc.h" 3
class _Lock {
public:
_Lock() { ; }
~_Lock() { ; }
};
friend class _Lock;
public:
static void* allocate(size_t __n)
{
_Obj* * __my_free_list;
_Obj* __result;
if (__n > (size_t) _MAX_BYTES) {
return(malloc_alloc::allocate(__n));
}
__my_free_list = _S_free_list + _S_freelist_index(__n);
__result = *__my_free_list;
if (__result == 0) {
void* __r = _S_refill(_S_round_up(__n));
return __r;
}
*__my_free_list = __result -> _M_free_list_link;
return (__result);
};
static void deallocate(void* __p, size_t __n)
{
_Obj* __q = (_Obj*)__p;
_Obj* * __my_free_list;
if (__n > (size_t) _MAX_BYTES) {
malloc_alloc::deallocate(__p, __n);
return;
}
__my_free_list = _S_free_list + _S_freelist_index(__n);
__q -> _M_free_list_link = *__my_free_list;
*__my_free_list = __q;
}
static void* reallocate(void* __p, size_t __old_sz, size_t __new_sz);
} ;
typedef __default_alloc_template< false , 0> alloc;
typedef __default_alloc_template<false, 0> single_client_alloc;
template <bool __threads, int __inst>
char*
__default_alloc_template<__threads, __inst>::_S_chunk_alloc(size_t __size,
int& __nobjs)
{
char* __result;
size_t __total_bytes = __size * __nobjs;
size_t __bytes_left = _S_end_free - _S_start_free;
if (__bytes_left >= __total_bytes) {
__result = _S_start_free;
_S_start_free += __total_bytes;
return(__result);
} else if (__bytes_left >= __size) {
__nobjs = (int)(__bytes_left/__size);
__total_bytes = __size * __nobjs;
__result = _S_start_free;
_S_start_free += __total_bytes;
return(__result);
} else {
size_t __bytes_to_get =
2 * __total_bytes + _S_round_up(_S_heap_size >> 4);
if (__bytes_left > 0) {
_Obj* * __my_free_list =
_S_free_list + _S_freelist_index(__bytes_left);
((_Obj*)_S_start_free) -> _M_free_list_link = *__my_free_list;
*__my_free_list = (_Obj*)_S_start_free;
}
_S_start_free = (char*)malloc(__bytes_to_get);
if (0 == _S_start_free) {
size_t __i;
_Obj* * __my_free_list;
_Obj* __p;
for (__i = __size; __i <= _MAX_BYTES; __i += _ALIGN) {
__my_free_list = _S_free_list + _S_freelist_index(__i);
__p = *__my_free_list;
if (0 != __p) {
*__my_free_list = __p -> _M_free_list_link;
_S_start_free = (char*)__p;
_S_end_free = _S_start_free + __i;
return(_S_chunk_alloc(__size, __nobjs));
}
}
_S_end_free = 0;
_S_start_free = (char*)malloc_alloc::allocate(__bytes_to_get);
}
_S_heap_size += __bytes_to_get;
_S_end_free = _S_start_free + __bytes_to_get;
return(_S_chunk_alloc(__size, __nobjs));
}
}
template <bool __threads, int __inst>
void*
__default_alloc_template<__threads, __inst>::_S_refill(size_t __n)
{
int __nobjs = 20;
char* __chunk = _S_chunk_alloc(__n, __nobjs);
_Obj* * __my_free_list;
_Obj* __result;
_Obj* __current_obj;
_Obj* __next_obj;
int __i;
if (1 == __nobjs) return(__chunk);
__my_free_list = _S_free_list + _S_freelist_index(__n);
__result = (_Obj*)__chunk;
*__my_free_list = __next_obj = (_Obj*)(__chunk + __n);
for (__i = 1; ; __i++) {
__current_obj = __next_obj;
__next_obj = (_Obj*)((char*)__next_obj + __n);
if (__nobjs - 1 == __i) {
__current_obj -> _M_free_list_link = 0;
break;
} else {
__current_obj -> _M_free_list_link = __next_obj;
}
}
return(__result);
}
template <bool threads, int inst>
void*
__default_alloc_template<threads, inst>::reallocate(void* __p,
size_t __old_sz,
size_t __new_sz)
{
void* __result;
size_t __copy_sz;
if (__old_sz > (size_t) _MAX_BYTES && __new_sz > (size_t) _MAX_BYTES) {
return(realloc(__p, __new_sz));
}
if (_S_round_up(__old_sz) == _S_round_up(__new_sz)) return(__p);
__result = allocate(__new_sz);
__copy_sz = __new_sz > __old_sz? __old_sz : __new_sz;
memcpy(__result, __p, __copy_sz);
deallocate(__p, __old_sz);
return(__result);
}
# 602 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_alloc.h" 3
# 689 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_alloc.h" 3
template <bool __threads, int __inst>
char* __default_alloc_template<__threads, __inst>::_S_start_free = 0;
template <bool __threads, int __inst>
char* __default_alloc_template<__threads, __inst>::_S_end_free = 0;
template <bool __threads, int __inst>
size_t __default_alloc_template<__threads, __inst>::_S_heap_size = 0;
template <bool __threads, int __inst>
__default_alloc_template<__threads, __inst>::_Obj*
__default_alloc_template<__threads, __inst> ::_S_free_list[
_NFREELISTS
] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };
template <class _Tp>
class allocator {
typedef alloc _Alloc;
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef _Tp* pointer;
typedef const _Tp* const_pointer;
typedef _Tp& reference;
typedef const _Tp& const_reference;
typedef _Tp value_type;
template <class _Tp1> struct rebind {
typedef allocator<_Tp1> other;
};
allocator() throw() {}
allocator(const allocator&) throw() {}
template <class _Tp1> allocator(const allocator<_Tp1>&) throw() {}
~allocator() throw() {}
pointer address(reference __x) const { return &__x; }
const_pointer address(const_reference __x) const { return &__x; }
_Tp* allocate(size_type __n, const void* = 0) {
return __n != 0 ? static_cast<_Tp*>(_Alloc::allocate(__n * sizeof(_Tp)))
: 0;
}
void deallocate(pointer __p, size_type __n)
{ _Alloc::deallocate(__p, __n * sizeof(_Tp)); }
size_type max_size() const throw()
{ return size_t(-1) / sizeof(_Tp); }
void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); }
void destroy(pointer __p) { __p->~_Tp(); }
};
template<>
class allocator<void> {
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef void* pointer;
typedef const void* const_pointer;
typedef void value_type;
template <class _Tp1> struct rebind {
typedef allocator<_Tp1> other;
};
};
template <class _T1, class _T2>
inline bool operator==(const allocator<_T1>&, const allocator<_T2>&)
{
return true;
}
template <class _T1, class _T2>
inline bool operator!=(const allocator<_T1>&, const allocator<_T2>&)
{
return false;
}
template <class _Tp, class _Alloc>
struct __allocator {
_Alloc __underlying_alloc;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef _Tp* pointer;
typedef const _Tp* const_pointer;
typedef _Tp& reference;
typedef const _Tp& const_reference;
typedef _Tp value_type;
template <class _Tp1> struct rebind {
typedef __allocator<_Tp1, _Alloc> other;
};
__allocator() throw() {}
__allocator(const __allocator& __a) throw()
: __underlying_alloc(__a.__underlying_alloc) {}
template <class _Tp1>
__allocator(const __allocator<_Tp1, _Alloc>& __a) throw()
: __underlying_alloc(__a.__underlying_alloc) {}
~__allocator() throw() {}
pointer address(reference __x) const { return &__x; }
const_pointer address(const_reference __x) const { return &__x; }
_Tp* allocate(size_type __n, const void* = 0) {
return __n != 0
? static_cast<_Tp*>(__underlying_alloc.allocate(__n * sizeof(_Tp)))
: 0;
}
void deallocate(pointer __p, size_type __n)
{ __underlying_alloc.deallocate(__p, __n * sizeof(_Tp)); }
size_type max_size() const throw()
{ return size_t(-1) / sizeof(_Tp); }
void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); }
void destroy(pointer __p) { __p->~_Tp(); }
};
template <class _Alloc>
class __allocator<void, _Alloc> {
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef void* pointer;
typedef const void* const_pointer;
typedef void value_type;
template <class _Tp1> struct rebind {
typedef __allocator<_Tp1, _Alloc> other;
};
};
template <class _Tp, class _Alloc>
inline bool operator==(const __allocator<_Tp, _Alloc>& __a1,
const __allocator<_Tp, _Alloc>& __a2)
{
return __a1.__underlying_alloc == __a2.__underlying_alloc;
}
template <class _Tp, class _Alloc>
inline bool operator!=(const __allocator<_Tp, _Alloc>& __a1,
const __allocator<_Tp, _Alloc>& __a2)
{
return __a1.__underlying_alloc != __a2.__underlying_alloc;
}
template <int inst>
inline bool operator==(const __malloc_alloc_template<inst>&,
const __malloc_alloc_template<inst>&)
{
return true;
}
template <int __inst>
inline bool operator!=(const __malloc_alloc_template<__inst>&,
const __malloc_alloc_template<__inst>&)
{
return false;
}
template <bool __threads, int __inst>
inline bool operator==(const __default_alloc_template<__threads, __inst>&,
const __default_alloc_template<__threads, __inst>&)
{
return true;
}
template <bool __threads, int __inst>
inline bool operator!=(const __default_alloc_template<__threads, __inst>&,
const __default_alloc_template<__threads, __inst>&)
{
return false;
}
template <class _Alloc>
inline bool operator==(const debug_alloc<_Alloc>&,
const debug_alloc<_Alloc>&) {
return true;
}
template <class _Alloc>
inline bool operator!=(const debug_alloc<_Alloc>&,
const debug_alloc<_Alloc>&) {
return false;
}
template <class _Tp, class _Allocator>
struct _Alloc_traits
{
static const bool _S_instanceless = false;
typedef typename _Allocator:: rebind<_Tp>::other
allocator_type;
};
template <class _Tp, class _Allocator>
const bool _Alloc_traits<_Tp, _Allocator>::_S_instanceless;
template <class _Tp, class _Tp1>
struct _Alloc_traits<_Tp, allocator<_Tp1> >
{
static const bool _S_instanceless = true;
typedef simple_alloc<_Tp, alloc> _Alloc_type;
typedef allocator<_Tp> allocator_type;
};
template <class _Tp, int __inst>
struct _Alloc_traits<_Tp, __malloc_alloc_template<__inst> >
{
static const bool _S_instanceless = true;
typedef simple_alloc<_Tp, __malloc_alloc_template<__inst> > _Alloc_type;
typedef __allocator<_Tp, __malloc_alloc_template<__inst> > allocator_type;
};
template <class _Tp, bool __threads, int __inst>
struct _Alloc_traits<_Tp, __default_alloc_template<__threads, __inst> >
{
static const bool _S_instanceless = true;
typedef simple_alloc<_Tp, __default_alloc_template<__threads, __inst> >
_Alloc_type;
typedef __allocator<_Tp, __default_alloc_template<__threads, __inst> >
allocator_type;
};
template <class _Tp, class _Alloc>
struct _Alloc_traits<_Tp, debug_alloc<_Alloc> >
{
static const bool _S_instanceless = true;
typedef simple_alloc<_Tp, debug_alloc<_Alloc> > _Alloc_type;
typedef __allocator<_Tp, debug_alloc<_Alloc> > allocator_type;
};
template <class _Tp, class _Tp1, int __inst>
struct _Alloc_traits<_Tp,
__allocator<_Tp1, __malloc_alloc_template<__inst> > >
{
static const bool _S_instanceless = true;
typedef simple_alloc<_Tp, __malloc_alloc_template<__inst> > _Alloc_type;
typedef __allocator<_Tp, __malloc_alloc_template<__inst> > allocator_type;
};
template <class _Tp, class _Tp1, bool __thr, int __inst>
struct _Alloc_traits<_Tp,
__allocator<_Tp1,
__default_alloc_template<__thr, __inst> > >
{
static const bool _S_instanceless = true;
typedef simple_alloc<_Tp, __default_alloc_template<__thr,__inst> >
_Alloc_type;
typedef __allocator<_Tp, __default_alloc_template<__thr,__inst> >
allocator_type;
};
template <class _Tp, class _Tp1, class _Alloc>
struct _Alloc_traits<_Tp, __allocator<_Tp1, debug_alloc<_Alloc> > >
{
static const bool _S_instanceless = true;
typedef simple_alloc<_Tp, debug_alloc<_Alloc> > _Alloc_type;
typedef __allocator<_Tp, debug_alloc<_Alloc> > allocator_type;
};
# 31 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/vector" 2 3
# 1 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_construct.h" 1 3
template <class _Tp>
inline void destroy(_Tp* __pointer) {
__pointer->~_Tp();
}
template <class _T1, class _T2>
inline void construct(_T1* __p, const _T2& __value) {
new (__p) _T1(__value);
}
template <class _T1>
inline void construct(_T1* __p) {
new (__p) _T1();
}
template <class _ForwardIterator>
inline void
__destroy_aux(_ForwardIterator __first, _ForwardIterator __last, __false_type)
{
for ( ; __first != __last; ++__first)
destroy(&*__first);
}
template <class _ForwardIterator>
inline void __destroy_aux(_ForwardIterator, _ForwardIterator, __true_type) {}
template <class _ForwardIterator, class _Tp>
inline void
__destroy(_ForwardIterator __first, _ForwardIterator __last, _Tp*)
{
typedef typename __type_traits<_Tp>::has_trivial_destructor
_Trivial_destructor;
__destroy_aux(__first, __last, _Trivial_destructor());
}
template <class _ForwardIterator>
inline void destroy(_ForwardIterator __first, _ForwardIterator __last) {
__destroy(__first, __last, __value_type( __first ) );
}
inline void destroy(char*, char*) {}
inline void destroy(wchar_t*, wchar_t*) {}
# 32 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/vector" 2 3
# 1 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_uninitialized.h" 1 3
template <class _InputIter, class _ForwardIter>
inline _ForwardIter
__uninitialized_copy_aux(_InputIter __first, _InputIter __last,
_ForwardIter __result,
__true_type)
{
return copy(__first, __last, __result);
}
template <class _InputIter, class _ForwardIter>
_ForwardIter
__uninitialized_copy_aux(_InputIter __first, _InputIter __last,
_ForwardIter __result,
__false_type)
{
_ForwardIter __cur = __result;
try {
for ( ; __first != __last; ++__first, ++__cur)
construct(&*__cur, *__first);
return __cur;
}
catch(...) { destroy(__result, __cur) ; throw; } ;
}
template <class _InputIter, class _ForwardIter, class _Tp>
inline _ForwardIter
__uninitialized_copy(_InputIter __first, _InputIter __last,
_ForwardIter __result, _Tp*)
{
typedef typename __type_traits<_Tp>::is_POD_type _Is_POD;
return __uninitialized_copy_aux(__first, __last, __result, _Is_POD());
}
template <class _InputIter, class _ForwardIter>
inline _ForwardIter
uninitialized_copy(_InputIter __first, _InputIter __last,
_ForwardIter __result)
{
return __uninitialized_copy(__first, __last, __result,
__value_type( __result ) );
}
inline char* uninitialized_copy(const char* __first, const char* __last,
char* __result) {
memmove(__result, __first, __last - __first);
return __result + (__last - __first);
}
inline wchar_t*
uninitialized_copy(const wchar_t* __first, const wchar_t* __last,
wchar_t* __result)
{
memmove(__result, __first, sizeof(wchar_t) * (__last - __first));
return __result + (__last - __first);
}
template <class _InputIter, class _Size, class _ForwardIter>
pair<_InputIter, _ForwardIter>
__uninitialized_copy_n(_InputIter __first, _Size __count,
_ForwardIter __result,
input_iterator_tag)
{
_ForwardIter __cur = __result;
try {
for ( ; __count > 0 ; --__count, ++__first, ++__cur)
construct(&*__cur, *__first);
return pair<_InputIter, _ForwardIter>(__first, __cur);
}
catch(...) { destroy(__result, __cur) ; throw; } ;
}
template <class _RandomAccessIter, class _Size, class _ForwardIter>
inline pair<_RandomAccessIter, _ForwardIter>
__uninitialized_copy_n(_RandomAccessIter __first, _Size __count,
_ForwardIter __result,
random_access_iterator_tag) {
_RandomAccessIter __last = __first + __count;
return pair<_RandomAccessIter, _ForwardIter>(
__last,
uninitialized_copy(__first, __last, __result));
}
template <class _InputIter, class _Size, class _ForwardIter>
inline pair<_InputIter, _ForwardIter>
__uninitialized_copy_n(_InputIter __first, _Size __count,
_ForwardIter __result) {
return __uninitialized_copy_n(__first, __count, __result,
__iterator_category( __first ) );
}
template <class _InputIter, class _Size, class _ForwardIter>
inline pair<_InputIter, _ForwardIter>
uninitialized_copy_n(_InputIter __first, _Size __count,
_ForwardIter __result) {
return __uninitialized_copy_n(__first, __count, __result,
__iterator_category( __first ) );
}
template <class _ForwardIter, class _Tp>
inline void
__uninitialized_fill_aux(_ForwardIter __first, _ForwardIter __last,
const _Tp& __x, __true_type)
{
fill(__first, __last, __x);
}
template <class _ForwardIter, class _Tp>
void
__uninitialized_fill_aux(_ForwardIter __first, _ForwardIter __last,
const _Tp& __x, __false_type)
{
_ForwardIter __cur = __first;
try {
for ( ; __cur != __last; ++__cur)
construct(&*__cur, __x);
}
catch(...) { destroy(__first, __cur) ; throw; } ;
}
template <class _ForwardIter, class _Tp, class _Tp1>
inline void __uninitialized_fill(_ForwardIter __first,
_ForwardIter __last, const _Tp& __x, _Tp1*)
{
typedef typename __type_traits<_Tp1>::is_POD_type _Is_POD;
__uninitialized_fill_aux(__first, __last, __x, _Is_POD());
}
template <class _ForwardIter, class _Tp>
inline void uninitialized_fill(_ForwardIter __first,
_ForwardIter __last,
const _Tp& __x)
{
__uninitialized_fill(__first, __last, __x, __value_type( __first ) );
}
template <class _ForwardIter, class _Size, class _Tp>
inline _ForwardIter
__uninitialized_fill_n_aux(_ForwardIter __first, _Size __n,
const _Tp& __x, __true_type)
{
return fill_n(__first, __n, __x);
}
template <class _ForwardIter, class _Size, class _Tp>
_ForwardIter
__uninitialized_fill_n_aux(_ForwardIter __first, _Size __n,
const _Tp& __x, __false_type)
{
_ForwardIter __cur = __first;
try {
for ( ; __n > 0; --__n, ++__cur)
construct(&*__cur, __x);
return __cur;
}
catch(...) { destroy(__first, __cur) ; throw; } ;
}
template <class _ForwardIter, class _Size, class _Tp, class _Tp1>
inline _ForwardIter
__uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp& __x, _Tp1*)
{
typedef typename __type_traits<_Tp1>::is_POD_type _Is_POD;
return __uninitialized_fill_n_aux(__first, __n, __x, _Is_POD());
}
template <class _ForwardIter, class _Size, class _Tp>
inline _ForwardIter
uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp& __x)
{
return __uninitialized_fill_n(__first, __n, __x, __value_type( __first ) );
}
template <class _InputIter1, class _InputIter2, class _ForwardIter>
inline _ForwardIter
__uninitialized_copy_copy(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2,
_ForwardIter __result)
{
_ForwardIter __mid = uninitialized_copy(__first1, __last1, __result);
try {
return uninitialized_copy(__first2, __last2, __mid);
}
catch(...) { destroy(__result, __mid) ; throw; } ;
}
template <class _ForwardIter, class _Tp, class _InputIter>
inline _ForwardIter
__uninitialized_fill_copy(_ForwardIter __result, _ForwardIter __mid,
const _Tp& __x,
_InputIter __first, _InputIter __last)
{
uninitialized_fill(__result, __mid, __x);
try {
return uninitialized_copy(__first, __last, __mid);
}
catch(...) { destroy(__result, __mid) ; throw; } ;
}
template <class _InputIter, class _ForwardIter, class _Tp>
inline void
__uninitialized_copy_fill(_InputIter __first1, _InputIter __last1,
_ForwardIter __first2, _ForwardIter __last2,
const _Tp& __x)
{
_ForwardIter __mid2 = uninitialized_copy(__first1, __last1, __first2);
try {
uninitialized_fill(__mid2, __last2, __x);
}
catch(...) { destroy(__first2, __mid2) ; throw; } ;
}
# 33 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/vector" 2 3
# 1 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_vector.h" 1 3
template <class _Tp, class _Allocator, bool _IsStatic>
class _Vector_alloc_base {
public:
typedef typename _Alloc_traits<_Tp, _Allocator>::allocator_type
allocator_type;
allocator_type get_allocator() const { return _M_data_allocator; }
_Vector_alloc_base(const allocator_type& __a)
: _M_data_allocator(__a), _M_start(0), _M_finish(0), _M_end_of_storage(0)
{}
protected:
allocator_type _M_data_allocator;
_Tp* _M_start;
_Tp* _M_finish;
_Tp* _M_end_of_storage;
_Tp* _M_allocate(size_t __n)
{ return _M_data_allocator.allocate(__n); }
void _M_deallocate(_Tp* __p, size_t __n)
{ if (__p) _M_data_allocator.deallocate(__p, __n); }
};
template <class _Tp, class _Allocator>
class _Vector_alloc_base<_Tp, _Allocator, true> {
public:
typedef typename _Alloc_traits<_Tp, _Allocator>::allocator_type
allocator_type;
allocator_type get_allocator() const { return allocator_type(); }
_Vector_alloc_base(const allocator_type&)
: _M_start(0), _M_finish(0), _M_end_of_storage(0)
{}
protected:
_Tp* _M_start;
_Tp* _M_finish;
_Tp* _M_end_of_storage;
typedef typename _Alloc_traits<_Tp, _Allocator>::_Alloc_type _Alloc_type;
_Tp* _M_allocate(size_t __n)
{ return _Alloc_type::allocate(__n); }
void _M_deallocate(_Tp* __p, size_t __n)
{ _Alloc_type::deallocate(__p, __n);}
};
template <class _Tp, class _Alloc>
struct _Vector_base
: public _Vector_alloc_base<_Tp, _Alloc,
_Alloc_traits<_Tp, _Alloc>::_S_instanceless>
{
typedef _Vector_alloc_base<_Tp, _Alloc,
_Alloc_traits<_Tp, _Alloc>::_S_instanceless>
_Base;
typedef typename _Base::allocator_type allocator_type;
_Vector_base(const allocator_type& __a) : _Base(__a) {}
_Vector_base(size_t __n, const allocator_type& __a) : _Base(__a) {
_M_start = _M_allocate(__n);
_M_finish = _M_start;
_M_end_of_storage = _M_start + __n;
}
~_Vector_base() { _M_deallocate(_M_start, _M_end_of_storage - _M_start); }
};
# 150 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_vector.h" 3
template <class _Tp, class _Alloc = allocator< _Tp > >
class vector : protected _Vector_base<_Tp, _Alloc>
{
private:
typedef _Vector_base<_Tp, _Alloc> _Base;
public:
typedef _Tp value_type;
typedef value_type* pointer;
typedef const value_type* const_pointer;
typedef value_type* iterator;
typedef const value_type* const_iterator;
typedef value_type& reference;
typedef const value_type& const_reference;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef typename _Base::allocator_type allocator_type;
allocator_type get_allocator() const { return _Base::get_allocator(); }
typedef reverse_iterator<const_iterator> const_reverse_iterator;
typedef reverse_iterator<iterator> reverse_iterator;
protected:
using _Base::_M_allocate;
using _Base::_M_deallocate;
using _Base::_M_start;
using _Base::_M_finish;
using _Base::_M_end_of_storage;
protected:
void _M_insert_aux(iterator __position, const _Tp& __x);
void _M_insert_aux(iterator __position);
public:
iterator begin() { return _M_start; }
const_iterator begin() const { return _M_start; }
iterator end() { return _M_finish; }
const_iterator end() const { return _M_finish; }
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()); }
size_type size() const
{ return size_type(end() - begin()); }
size_type max_size() const
{ return size_type(-1) / sizeof(_Tp); }
size_type capacity() const
{ return size_type(_M_end_of_storage - begin()); }
bool empty() const
{ return begin() == end(); }
reference operator[](size_type __n) { return *(begin() + __n); }
const_reference operator[](size_type __n) const { return *(begin() + __n); }
explicit vector(const allocator_type& __a = allocator_type())
: _Base(__a) {}
vector(size_type __n, const _Tp& __value,
const allocator_type& __a = allocator_type())
: _Base(__n, __a)
{ _M_finish = uninitialized_fill_n(_M_start, __n, __value); }
explicit vector(size_type __n)
: _Base(__n, allocator_type())
{ _M_finish = uninitialized_fill_n(_M_start, __n, _Tp()); }
vector(const vector<_Tp, _Alloc>& __x)
: _Base(__x.size(), __x.get_allocator())
{ _M_finish = uninitialized_copy(__x.begin(), __x.end(), _M_start); }
template <class _InputIterator>
vector(_InputIterator __first, _InputIterator __last,
const allocator_type& __a = allocator_type()) : _Base(__a) {
typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
_M_initialize_aux(__first, __last, _Integral());
}
template <class _Integer>
void _M_initialize_aux(_Integer __n, _Integer __value, __true_type) {
_M_start = _M_allocate(__n);
_M_end_of_storage = _M_start + __n;
_M_finish = uninitialized_fill_n(_M_start, __n, __value);
}
template <class _InputIterator>
void _M_initialize_aux(_InputIterator __first, _InputIterator __last,
__false_type) {
_M_range_initialize(__first, __last, __iterator_category( __first ) );
}
~vector() { destroy(_M_start, _M_finish); }
vector<_Tp, _Alloc>& operator=(const vector<_Tp, _Alloc>& __x);
void reserve(size_type __n) {
if (capacity() < __n) {
const size_type __old_size = size();
iterator __tmp = _M_allocate_and_copy(__n, _M_start, _M_finish);
destroy(_M_start, _M_finish);
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
_M_start = __tmp;
_M_finish = __tmp + __old_size;
_M_end_of_storage = _M_start + __n;
}
}
void assign(size_type __n, const _Tp& __val);
template <class _InputIterator>
void assign(_InputIterator __first, _InputIterator __last) {
typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
_M_assign_dispatch(__first, __last, _Integral());
}
template <class _Integer>
void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
{ assign((size_type) __n, (_Tp) __val); }
template <class _InputIter>
void _M_assign_dispatch(_InputIter __first, _InputIter __last, __false_type)
{ _M_assign_aux(__first, __last, __iterator_category( __first ) ); }
template <class _InputIterator>
void _M_assign_aux(_InputIterator __first, _InputIterator __last,
input_iterator_tag);
template <class _ForwardIterator>
void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
forward_iterator_tag);
reference front() { return *begin(); }
const_reference front() const { return *begin(); }
reference back() { return *(end() - 1); }
const_reference back() const { return *(end() - 1); }
void push_back(const _Tp& __x) {
if (_M_finish != _M_end_of_storage) {
construct(_M_finish, __x);
++_M_finish;
}
else
_M_insert_aux(end(), __x);
}
void push_back() {
if (_M_finish != _M_end_of_storage) {
construct(_M_finish);
++_M_finish;
}
else
_M_insert_aux(end());
}
void swap(vector<_Tp, _Alloc>& __x) {
::swap(_M_start, __x._M_start);
::swap(_M_finish, __x._M_finish);
::swap(_M_end_of_storage, __x._M_end_of_storage);
}
iterator insert(iterator __position, const _Tp& __x) {
size_type __n = __position - begin();
if (_M_finish != _M_end_of_storage && __position == end()) {
construct(_M_finish, __x);
++_M_finish;
}
else
_M_insert_aux(__position, __x);
return begin() + __n;
}
iterator insert(iterator __position) {
size_type __n = __position - begin();
if (_M_finish != _M_end_of_storage && __position == end()) {
construct(_M_finish);
++_M_finish;
}
else
_M_insert_aux(__position);
return begin() + __n;
}
template <class _InputIterator>
void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
_M_insert_dispatch(__pos, __first, __last, _Integral());
}
template <class _Integer>
void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
__true_type) {
insert(__pos, (size_type) __n, (_Tp) __val);
}
template <class _InputIterator>
void _M_insert_dispatch(iterator __pos,
_InputIterator __first, _InputIterator __last,
__false_type) {
_M_range_insert(__pos, __first, __last, __iterator_category( __first ) );
}
void insert (iterator __pos, size_type __n, const _Tp& __x);
void pop_back() {
--_M_finish;
destroy(_M_finish);
}
iterator erase(iterator __position) {
if (__position + 1 != end())
copy(__position + 1, _M_finish, __position);
--_M_finish;
destroy(_M_finish);
return __position;
}
iterator erase(iterator __first, iterator __last) {
iterator __i = copy(__last, _M_finish, __first);
destroy(__i, _M_finish);
_M_finish = _M_finish - (__last - __first);
return __first;
}
void resize(size_type __new_size, const _Tp& __x) {
if (__new_size < size())
erase(begin() + __new_size, end());
else
insert(end(), __new_size - size(), __x);
}
void resize(size_type __new_size) { resize(__new_size, _Tp()); }
void clear() { erase(begin(), end()); }
protected:
template <class _ForwardIterator>
iterator _M_allocate_and_copy(size_type __n, _ForwardIterator __first,
_ForwardIterator __last)
{
iterator __result = _M_allocate(__n);
try {
uninitialized_copy(__first, __last, __result);
return __result;
}
catch(...) { _M_deallocate(__result, __n) ; throw; } ;
}
# 440 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_vector.h" 3
template <class _InputIterator>
void _M_range_initialize(_InputIterator __first,
_InputIterator __last, input_iterator_tag)
{
for ( ; __first != __last; ++__first)
push_back(*__first);
}
template <class _ForwardIterator>
void _M_range_initialize(_ForwardIterator __first,
_ForwardIterator __last, forward_iterator_tag)
{
size_type __n = 0;
distance(__first, __last, __n);
_M_start = _M_allocate(__n);
_M_end_of_storage = _M_start + __n;
_M_finish = uninitialized_copy(__first, __last, _M_start);
}
template <class _InputIterator>
void _M_range_insert(iterator __pos,
_InputIterator __first, _InputIterator __last,
input_iterator_tag);
template <class _ForwardIterator>
void _M_range_insert(iterator __pos,
_ForwardIterator __first, _ForwardIterator __last,
forward_iterator_tag);
};
template <class _Tp, class _Alloc>
inline bool
operator==(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
{
return __x.size() == __y.size() &&
equal(__x.begin(), __x.end(), __y.begin());
}
template <class _Tp, class _Alloc>
inline bool
operator<(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
{
return lexicographical_compare(__x.begin(), __x.end(),
__y.begin(), __y.end());
}
template <class _Tp, class _Alloc>
inline void swap(vector<_Tp, _Alloc>& __x, vector<_Tp, _Alloc>& __y)
{
__x.swap(__y);
}
template <class _Tp, class _Alloc>
vector<_Tp,_Alloc>&
vector<_Tp,_Alloc>::operator=(const vector<_Tp, _Alloc>& __x)
{
if (&__x != this) {
const size_type __xlen = __x.size();
if (__xlen > capacity()) {
iterator __tmp = _M_allocate_and_copy(__xlen, __x.begin(), __x.end());
destroy(_M_start, _M_finish);
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
_M_start = __tmp;
_M_end_of_storage = _M_start + __xlen;
}
else if (size() >= __xlen) {
iterator __i = copy(__x.begin(), __x.end(), begin());
destroy(__i, _M_finish);
}
else {
copy(__x.begin(), __x.begin() + size(), _M_start);
uninitialized_copy(__x.begin() + size(), __x.end(), _M_finish);
}
_M_finish = _M_start + __xlen;
}
return *this;
}
template <class _Tp, class _Alloc>
void vector<_Tp, _Alloc>::assign(size_t __n, const value_type& __val) {
if (__n > capacity()) {
vector<_Tp, _Alloc> __tmp(__n, __val, get_allocator());
__tmp.swap(*this);
}
else if (__n > size()) {
fill(begin(), end(), __val);
_M_finish = uninitialized_fill_n(_M_finish, __n - size(), __val);
}
else
erase(fill_n(begin(), __n, __val), end());
}
template <class _Tp, class _Alloc> template <class _InputIter>
void vector<_Tp, _Alloc>::_M_assign_aux(_InputIter __first, _InputIter __last,
input_iterator_tag) {
iterator __cur = begin();
for ( ; __first != __last && __cur != end(); ++__cur, ++__first)
*__cur = *__first;
if (__first == __last)
erase(__cur, end());
else
insert(end(), __first, __last);
}
template <class _Tp, class _Alloc> template <class _ForwardIter>
void
vector<_Tp, _Alloc>::_M_assign_aux(_ForwardIter __first, _ForwardIter __last,
forward_iterator_tag) {
size_type __len = 0;
distance(__first, __last, __len);
if (__len > capacity()) {
iterator __tmp = _M_allocate_and_copy(__len, __first, __last);
destroy(_M_start, _M_finish);
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
_M_start = __tmp;
_M_end_of_storage = _M_finish = _M_start + __len;
}
else if (size() >= __len) {
iterator __new_finish = copy(__first, __last, _M_start);
destroy(__new_finish, _M_finish);
_M_finish = __new_finish;
}
else {
_ForwardIter __mid = __first;
advance(__mid, size());
copy(__first, __mid, _M_start);
_M_finish = uninitialized_copy(__mid, __last, _M_finish);
}
}
template <class _Tp, class _Alloc>
void
vector<_Tp, _Alloc>::_M_insert_aux(iterator __position, const _Tp& __x)
{
if (_M_finish != _M_end_of_storage) {
construct(_M_finish, *(_M_finish - 1));
++_M_finish;
_Tp __x_copy = __x;
copy_backward(__position, _M_finish - 2, _M_finish - 1);
*__position = __x_copy;
}
else {
const size_type __old_size = size();
const size_type __len = __old_size != 0 ? 2 * __old_size : 1;
iterator __new_start = _M_allocate(__len);
iterator __new_finish = __new_start;
try {
__new_finish = uninitialized_copy(_M_start, __position, __new_start);
construct(__new_finish, __x);
++__new_finish;
__new_finish = uninitialized_copy(__position, _M_finish, __new_finish);
}
catch(...) { (destroy(__new_start,__new_finish),
_M_deallocate(__new_start,__len)) ; throw; } ;
destroy(begin(), end());
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
_M_start = __new_start;
_M_finish = __new_finish;
_M_end_of_storage = __new_start + __len;
}
}
template <class _Tp, class _Alloc>
void
vector<_Tp, _Alloc>::_M_insert_aux(iterator __position)
{
if (_M_finish != _M_end_of_storage) {
construct(_M_finish, *(_M_finish - 1));
++_M_finish;
copy_backward(__position, _M_finish - 2, _M_finish - 1);
*__position = _Tp();
}
else {
const size_type __old_size = size();
const size_type __len = __old_size != 0 ? 2 * __old_size : 1;
iterator __new_start = _M_allocate(__len);
iterator __new_finish = __new_start;
try {
__new_finish = uninitialized_copy(_M_start, __position, __new_start);
construct(__new_finish);
++__new_finish;
__new_finish = uninitialized_copy(__position, _M_finish, __new_finish);
}
catch(...) { (destroy(__new_start,__new_finish),
_M_deallocate(__new_start,__len)) ; throw; } ;
destroy(begin(), end());
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
_M_start = __new_start;
_M_finish = __new_finish;
_M_end_of_storage = __new_start + __len;
}
}
template <class _Tp, class _Alloc>
void vector<_Tp, _Alloc>::insert(iterator __position, size_type __n,
const _Tp& __x)
{
if (__n != 0) {
if (size_type(_M_end_of_storage - _M_finish) >= __n) {
_Tp __x_copy = __x;
const size_type __elems_after = _M_finish - __position;
iterator __old_finish = _M_finish;
if (__elems_after > __n) {
uninitialized_copy(_M_finish - __n, _M_finish, _M_finish);
_M_finish += __n;
copy_backward(__position, __old_finish - __n, __old_finish);
fill(__position, __position + __n, __x_copy);
}
else {
uninitialized_fill_n(_M_finish, __n - __elems_after, __x_copy);
_M_finish += __n - __elems_after;
uninitialized_copy(__position, __old_finish, _M_finish);
_M_finish += __elems_after;
fill(__position, __old_finish, __x_copy);
}
}
else {
const size_type __old_size = size();
const size_type __len = __old_size + max(__old_size, __n);
iterator __new_start = _M_allocate(__len);
iterator __new_finish = __new_start;
try {
__new_finish = uninitialized_copy(_M_start, __position, __new_start);
__new_finish = uninitialized_fill_n(__new_finish, __n, __x);
__new_finish
= uninitialized_copy(__position, _M_finish, __new_finish);
}
catch(...) { (destroy(__new_start,__new_finish),
_M_deallocate(__new_start,__len)) ; throw; } ;
destroy(_M_start, _M_finish);
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
_M_start = __new_start;
_M_finish = __new_finish;
_M_end_of_storage = __new_start + __len;
}
}
}
template <class _Tp, class _Alloc> template <class _InputIterator>
void
vector<_Tp, _Alloc>::_M_range_insert(iterator __pos,
_InputIterator __first,
_InputIterator __last,
input_iterator_tag)
{
for ( ; __first != __last; ++__first) {
__pos = insert(__pos, *__first);
++__pos;
}
}
template <class _Tp, class _Alloc> template <class _ForwardIterator>
void
vector<_Tp, _Alloc>::_M_range_insert(iterator __position,
_ForwardIterator __first,
_ForwardIterator __last,
forward_iterator_tag)
{
if (__first != __last) {
size_type __n = 0;
distance(__first, __last, __n);
if (size_type(_M_end_of_storage - _M_finish) >= __n) {
const size_type __elems_after = _M_finish - __position;
iterator __old_finish = _M_finish;
if (__elems_after > __n) {
uninitialized_copy(_M_finish - __n, _M_finish, _M_finish);
_M_finish += __n;
copy_backward(__position, __old_finish - __n, __old_finish);
copy(__first, __last, __position);
}
else {
_ForwardIterator __mid = __first;
advance(__mid, __elems_after);
uninitialized_copy(__mid, __last, _M_finish);
_M_finish += __n - __elems_after;
uninitialized_copy(__position, __old_finish, _M_finish);
_M_finish += __elems_after;
copy(__first, __mid, __position);
}
}
else {
const size_type __old_size = size();
const size_type __len = __old_size + max(__old_size, __n);
iterator __new_start = _M_allocate(__len);
iterator __new_finish = __new_start;
try {
__new_finish = uninitialized_copy(_M_start, __position, __new_start);
__new_finish = uninitialized_copy(__first, __last, __new_finish);
__new_finish
= uninitialized_copy(__position, _M_finish, __new_finish);
}
catch(...) { (destroy(__new_start,__new_finish),
_M_deallocate(__new_start,__len)) ; throw; } ;
destroy(_M_start, _M_finish);
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
_M_start = __new_start;
_M_finish = __new_finish;
_M_end_of_storage = __new_start + __len;
}
}
}
# 810 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_vector.h" 3
# 34 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/vector" 2 3
# 1 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_bvector.h" 1 3
static const int __WORD_BIT = int(8 *sizeof(unsigned int));
struct _Bit_reference {
unsigned int* _M_p;
unsigned int _M_mask;
_Bit_reference(unsigned int* __x, unsigned int __y)
: _M_p(__x), _M_mask(__y) {}
public:
_Bit_reference() : _M_p(0), _M_mask(0) {}
operator bool() const { return !(!(*_M_p & _M_mask)); }
_Bit_reference& operator=(bool __x)
{
if (__x) *_M_p |= _M_mask;
else *_M_p &= ~_M_mask;
return *this;
}
_Bit_reference& operator=(const _Bit_reference& __x)
{ return *this = bool(__x); }
bool operator==(const _Bit_reference& __x) const
{ return bool(*this) == bool(__x); }
bool operator<(const _Bit_reference& __x) const {
return !bool(*this) && bool(__x);
}
void flip() { *_M_p ^= _M_mask; }
};
inline void swap(_Bit_reference __x, _Bit_reference __y)
{
bool __tmp = __x;
__x = __y;
__y = __tmp;
}
struct _Bit_iterator : public random_access_iterator<bool, ptrdiff_t> {
typedef _Bit_reference reference;
typedef _Bit_reference* pointer;
typedef _Bit_iterator iterator;
unsigned int* _M_p;
unsigned int _M_offset;
void bump_up() {
if (_M_offset++ == __WORD_BIT - 1) {
_M_offset = 0;
++_M_p;
}
}
void bump_down() {
if (_M_offset-- == 0) {
_M_offset = __WORD_BIT - 1;
--_M_p;
}
}
_Bit_iterator() : _M_p(0), _M_offset(0) {}
_Bit_iterator(unsigned int* __x, unsigned int __y)
: _M_p(__x), _M_offset(__y) {}
reference operator*() const { return reference(_M_p, 1U << _M_offset); }
iterator& operator++() {
bump_up();
return *this;
}
iterator operator++(int) {
iterator __tmp = *this;
bump_up();
return __tmp;
}
iterator& operator--() {
bump_down();
return *this;
}
iterator operator--(int) {
iterator __tmp = *this;
bump_down();
return __tmp;
}
iterator& operator+=(difference_type __i) {
difference_type __n = __i + _M_offset;
_M_p += __n / __WORD_BIT;
__n = __n % __WORD_BIT;
if (__n < 0) {
_M_offset = (unsigned int) __n + __WORD_BIT;
--_M_p;
} else
_M_offset = (unsigned int) __n;
return *this;
}
iterator& operator-=(difference_type __i) {
*this += -__i;
return *this;
}
iterator operator+(difference_type __i) const {
iterator __tmp = *this;
return __tmp += __i;
}
iterator operator-(difference_type __i) const {
iterator __tmp = *this;
return __tmp -= __i;
}
difference_type operator-(iterator __x) const {
return __WORD_BIT * (_M_p - __x._M_p) + _M_offset - __x._M_offset;
}
reference operator[](difference_type __i) { return *(*this + __i); }
bool operator==(const iterator& __x) const {
return _M_p == __x._M_p && _M_offset == __x._M_offset;
}
bool operator!=(const iterator& __x) const {
return _M_p != __x._M_p || _M_offset != __x._M_offset;
}
bool operator<(iterator __x) const {
return _M_p < __x._M_p || (_M_p == __x._M_p && _M_offset < __x._M_offset);
}
};
struct _Bit_const_iterator
: public random_access_iterator<bool, ptrdiff_t>
{
typedef bool reference;
typedef bool const_reference;
typedef const bool* pointer;
typedef _Bit_const_iterator const_iterator;
unsigned int* _M_p;
unsigned int _M_offset;
void bump_up() {
if (_M_offset++ == __WORD_BIT - 1) {
_M_offset = 0;
++_M_p;
}
}
void bump_down() {
if (_M_offset-- == 0) {
_M_offset = __WORD_BIT - 1;
--_M_p;
}
}
_Bit_const_iterator() : _M_p(0), _M_offset(0) {}
_Bit_const_iterator(unsigned int* __x, unsigned int __y)
: _M_p(__x), _M_offset(__y) {}
_Bit_const_iterator(const _Bit_iterator& __x)
: _M_p(__x._M_p), _M_offset(__x._M_offset) {}
const_reference operator*() const {
return _Bit_reference(_M_p, 1U << _M_offset);
}
const_iterator& operator++() {
bump_up();
return *this;
}
const_iterator operator++(int) {
const_iterator __tmp = *this;
bump_up();
return __tmp;
}
const_iterator& operator--() {
bump_down();
return *this;
}
const_iterator operator--(int) {
const_iterator __tmp = *this;
bump_down();
return __tmp;
}
const_iterator& operator+=(difference_type __i) {
difference_type __n = __i + _M_offset;
_M_p += __n / __WORD_BIT;
__n = __n % __WORD_BIT;
if (__n < 0) {
_M_offset = (unsigned int) __n + __WORD_BIT;
--_M_p;
} else
_M_offset = (unsigned int) __n;
return *this;
}
const_iterator& operator-=(difference_type __i) {
*this += -__i;
return *this;
}
const_iterator operator+(difference_type __i) const {
const_iterator __tmp = *this;
return __tmp += __i;
}
const_iterator operator-(difference_type __i) const {
const_iterator __tmp = *this;
return __tmp -= __i;
}
difference_type operator-(const_iterator __x) const {
return __WORD_BIT * (_M_p - __x._M_p) + _M_offset - __x._M_offset;
}
const_reference operator[](difference_type __i) {
return *(*this + __i);
}
bool operator==(const const_iterator& __x) const {
return _M_p == __x._M_p && _M_offset == __x._M_offset;
}
bool operator!=(const const_iterator& __x) const {
return _M_p != __x._M_p || _M_offset != __x._M_offset;
}
bool operator<(const_iterator __x) const {
return _M_p < __x._M_p || (_M_p == __x._M_p && _M_offset < __x._M_offset);
}
};
template <class _Allocator, bool __is_static>
class _Bvector_alloc_base {
public:
typedef typename _Alloc_traits<bool, _Allocator>::allocator_type
allocator_type;
allocator_type get_allocator() const { return _M_data_allocator; }
_Bvector_alloc_base(const allocator_type& __a)
: _M_data_allocator(__a), _M_start(), _M_finish(), _M_end_of_storage(0) {}
protected:
unsigned int* _M_bit_alloc(size_t __n)
{ return _M_data_allocator.allocate((__n + __WORD_BIT - 1)/__WORD_BIT); }
void _M_deallocate() {
if (_M_start._M_p)
_M_data_allocator.deallocate(_M_start._M_p,
_M_end_of_storage - _M_start._M_p);
}
typename _Alloc_traits<unsigned int, _Allocator>::allocator_type
_M_data_allocator;
_Bit_iterator _M_start;
_Bit_iterator _M_finish;
unsigned int* _M_end_of_storage;
};
template <class _Allocator>
class _Bvector_alloc_base<_Allocator, true> {
public:
typedef typename _Alloc_traits<bool, _Allocator>::allocator_type
allocator_type;
allocator_type get_allocator() const { return allocator_type(); }
_Bvector_alloc_base(const allocator_type&)
: _M_start(), _M_finish(), _M_end_of_storage(0) {}
protected:
typedef typename _Alloc_traits<unsigned int, _Allocator>::_Alloc_type
_Alloc_type;
unsigned int* _M_bit_alloc(size_t __n)
{ return _Alloc_type::allocate((__n + __WORD_BIT - 1)/__WORD_BIT); }
void _M_deallocate() {
if (_M_start._M_p)
_Alloc_type::deallocate(_M_start._M_p,
_M_end_of_storage - _M_start._M_p);
}
_Bit_iterator _M_start;
_Bit_iterator _M_finish;
unsigned int* _M_end_of_storage;
};
template <class _Alloc>
class _Bvector_base
: public _Bvector_alloc_base<_Alloc,
_Alloc_traits<bool, _Alloc>::_S_instanceless>
{
typedef _Bvector_alloc_base<_Alloc,
_Alloc_traits<bool, _Alloc>::_S_instanceless>
_Base;
public:
typedef typename _Base::allocator_type allocator_type;
_Bvector_base(const allocator_type& __a) : _Base(__a) {}
~_Bvector_base() { _Base::_M_deallocate(); }
};
# 348 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_bvector.h" 3
template<class _Alloc> class vector<bool,_Alloc>
: public _Bvector_base<_Alloc>
{
typedef _Bvector_base<_Alloc> _Base;
public:
typedef bool value_type;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef _Bit_reference reference;
typedef bool const_reference;
typedef _Bit_reference* pointer;
typedef const bool* const_pointer;
typedef _Bit_iterator iterator;
typedef _Bit_const_iterator const_iterator;
typedef reverse_iterator<const_iterator> const_reverse_iterator;
typedef reverse_iterator<iterator> reverse_iterator;
typedef typename _Base::allocator_type allocator_type;
allocator_type get_allocator() const { return _Base::get_allocator(); }
protected:
protected:
void _M_initialize(size_type __n) {
unsigned int* __q = _M_bit_alloc(__n);
_M_end_of_storage = __q + (__n + __WORD_BIT - 1)/__WORD_BIT;
_M_start = iterator(__q, 0);
_M_finish = _M_start + difference_type(__n);
}
void _M_insert_aux(iterator __position, bool __x) {
if (_M_finish._M_p != _M_end_of_storage) {
copy_backward(__position, _M_finish, _M_finish + 1);
*__position = __x;
++_M_finish;
}
else {
size_type __len = size() ? 2 * size() : __WORD_BIT;
unsigned int* __q = _M_bit_alloc(__len);
iterator __i = copy(begin(), __position, iterator(__q, 0));
*__i++ = __x;
_M_finish = copy(__position, end(), __i);
_M_deallocate();
_M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT;
_M_start = iterator(__q, 0);
}
}
template <class _InputIterator>
void _M_initialize_range(_InputIterator __first, _InputIterator __last,
input_iterator_tag) {
_M_start = iterator();
_M_finish = iterator();
_M_end_of_storage = 0;
for ( ; __first != __last; ++__first)
push_back(*__first);
}
template <class _ForwardIterator>
void _M_initialize_range(_ForwardIterator __first, _ForwardIterator __last,
forward_iterator_tag) {
size_type __n = 0;
distance(__first, __last, __n);
_M_initialize(__n);
copy(__first, __last, _M_start);
}
template <class _InputIterator>
void _M_insert_range(iterator __pos,
_InputIterator __first, _InputIterator __last,
input_iterator_tag) {
for ( ; __first != __last; ++__first) {
__pos = insert(__pos, *__first);
++__pos;
}
}
template <class _ForwardIterator>
void _M_insert_range(iterator __position,
_ForwardIterator __first, _ForwardIterator __last,
forward_iterator_tag) {
if (__first != __last) {
size_type __n = 0;
distance(__first, __last, __n);
if (capacity() - size() >= __n) {
copy_backward(__position, end(), _M_finish + difference_type(__n));
copy(__first, __last, __position);
_M_finish += difference_type(__n);
}
else {
size_type __len = size() + max(size(), __n);
unsigned int* __q = _M_bit_alloc(__len);
iterator __i = copy(begin(), __position, iterator(__q, 0));
__i = copy(__first, __last, __i);
_M_finish = copy(__position, end(), __i);
_M_deallocate();
_M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT;
_M_start = iterator(__q, 0);
}
}
}
public:
iterator begin() { return _M_start; }
const_iterator begin() const { return _M_start; }
iterator end() { return _M_finish; }
const_iterator end() const { return _M_finish; }
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());
}
size_type size() const { return size_type(end() - begin()); }
size_type max_size() const { return size_type(-1); }
size_type capacity() const {
return size_type(const_iterator(_M_end_of_storage, 0) - begin());
}
bool empty() const { return begin() == end(); }
reference operator[](size_type __n) {
return *(begin() + difference_type(__n));
}
const_reference operator[](size_type __n) const {
return *(begin() + difference_type(__n));
}
explicit vector (const allocator_type& __a = allocator_type())
: _Base(__a) {}
vector (size_type __n, bool __value,
const allocator_type& __a = allocator_type())
: _Base(__a)
{
_M_initialize(__n);
fill(_M_start._M_p, _M_end_of_storage, __value ? ~0 : 0);
}
explicit vector (size_type __n)
: _Base(allocator_type())
{
_M_initialize(__n);
fill(_M_start._M_p, _M_end_of_storage, 0);
}
vector (const vector & __x) : _Base(__x.get_allocator()) {
_M_initialize(__x.size());
copy(__x.begin(), __x.end(), _M_start);
}
template <class _InputIterator>
vector (_InputIterator __first, _InputIterator __last,
const allocator_type& __a = allocator_type())
: _Base(__a)
{
typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
_M_initialize_dispatch(__first, __last, _Integral());
}
template <class _Integer>
void _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type) {
_M_initialize(__n);
fill(_M_start._M_p, _M_end_of_storage, __x ? ~0 : 0);
}
template <class _InputIterator>
void _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
__false_type) {
_M_initialize_range(__first, __last, __iterator_category( __first ) );
}
# 587 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_bvector.h" 3
~vector () { }
vector & operator=(const vector & __x) {
if (&__x == this) return *this;
if (__x.size() > capacity()) {
_M_deallocate();
_M_initialize(__x.size());
}
copy(__x.begin(), __x.end(), begin());
_M_finish = begin() + difference_type(__x.size());
return *this;
}
void assign(size_t __n, bool __x) {
if (__n > size()) {
fill(_M_start._M_p, _M_end_of_storage, __x ? ~0 : 0);
insert(end(), __n - size(), __x);
}
else {
erase(begin() + __n, end());
fill(_M_start._M_p, _M_end_of_storage, __x ? ~0 : 0);
}
}
template <class _InputIterator>
void assign(_InputIterator __first, _InputIterator __last) {
typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
_M_assign_dispatch(__first, __last, _Integral());
}
template <class _Integer>
void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
{ assign((size_t) __n, (bool) __val); }
template <class _InputIter>
void _M_assign_dispatch(_InputIter __first, _InputIter __last, __false_type)
{ _M_assign_aux(__first, __last, __iterator_category( __first ) ); }
template <class _InputIterator>
void _M_assign_aux(_InputIterator __first, _InputIterator __last,
input_iterator_tag) {
iterator __cur = begin();
for ( ; __first != __last && __cur != end(); ++__cur, ++__first)
*__cur = *__first;
if (__first == __last)
erase(__cur, end());
else
insert(end(), __first, __last);
}
template <class _ForwardIterator>
void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
forward_iterator_tag) {
size_type __len = 0;
distance(__first, __last, __len);
if (__len < size())
erase(copy(__first, __last, begin()), end());
else {
_ForwardIterator __mid = __first;
advance(__mid, size());
copy(__first, __mid, begin());
insert(end(), __mid, __last);
}
}
void reserve(size_type __n) {
if (capacity() < __n) {
unsigned int* __q = _M_bit_alloc(__n);
_M_finish = copy(begin(), end(), iterator(__q, 0));
_M_deallocate();
_M_start = iterator(__q, 0);
_M_end_of_storage = __q + (__n + __WORD_BIT - 1)/__WORD_BIT;
}
}
reference front() { return *begin(); }
const_reference front() const { return *begin(); }
reference back() { return *(end() - 1); }
const_reference back() const { return *(end() - 1); }
void push_back(bool __x) {
if (_M_finish._M_p != _M_end_of_storage)
*_M_finish++ = __x;
else
_M_insert_aux(end(), __x);
}
void swap(vector & __x) {
::swap(_M_start, __x._M_start);
::swap(_M_finish, __x._M_finish);
::swap(_M_end_of_storage, __x._M_end_of_storage);
}
iterator insert(iterator __position, bool __x = bool()) {
difference_type __n = __position - begin();
if (_M_finish._M_p != _M_end_of_storage && __position == end())
*_M_finish++ = __x;
else
_M_insert_aux(__position, __x);
return begin() + __n;
}
template <class _InputIterator>
void insert(iterator __position,
_InputIterator __first, _InputIterator __last) {
typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
_M_insert_dispatch(__position, __first, __last, _Integral());
}
template <class _Integer>
void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
__true_type) {
insert(__pos, (size_type) __n, (bool) __x);
}
template <class _InputIterator>
void _M_insert_dispatch(iterator __pos,
_InputIterator __first, _InputIterator __last,
__false_type) {
_M_insert_range(__pos, __first, __last, __iterator_category( __first ) );
}
# 761 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_bvector.h" 3
void insert(iterator __position, size_type __n, bool __x) {
if (__n == 0) return;
if (capacity() - size() >= __n) {
copy_backward(__position, end(), _M_finish + difference_type(__n));
fill(__position, __position + difference_type(__n), __x);
_M_finish += difference_type(__n);
}
else {
size_type __len = size() + max(size(), __n);
unsigned int* __q = _M_bit_alloc(__len);
iterator __i = copy(begin(), __position, iterator(__q, 0));
fill_n(__i, __n, __x);
_M_finish = copy(__position, end(), __i + difference_type(__n));
_M_deallocate();
_M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT;
_M_start = iterator(__q, 0);
}
}
void pop_back() { --_M_finish; }
iterator erase(iterator __position) {
if (__position + 1 != end())
copy(__position + 1, end(), __position);
--_M_finish;
return __position;
}
iterator erase(iterator __first, iterator __last) {
_M_finish = copy(__last, end(), __first);
return __first;
}
void resize(size_type __new_size, bool __x = bool()) {
if (__new_size < size())
erase(begin() + difference_type(__new_size), end());
else
insert(end(), __new_size - size(), __x);
}
void clear() { erase(begin(), end()); }
};
typedef vector<bool, alloc> bit_vector;
# 822 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_bvector.h" 3
# 35 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/vector" 2 3
# 4 "/home/core/include/TStringList.h" 2
# 1 "/home/core/include/TTIString.h" 1
# 1 "/usr/include/stdarg.h" 1 3 4
typedef __va_list va_list;
# 4 "/home/core/include/TTIString.h" 2
# 1 "/usr/include/assert.h" 1 3 4
extern "C" {
extern void __assert(int, const char *, const char *, int);
};
# 5 "/home/core/include/TTIString.h" 2
typedef struct {
uint32 m_Id;
char* m_String;
} StringTableEntry;
struct TCStringData
{
long nRefs;
int nDataLength;
int nAllocLength;
char* data()
{ return (char*)(this+1); }
};
class TString
{
public:
TString() { m_pchData = (*(TString*)&TafxPchNil).m_pchData; }
TString(const TString& stringSrc)
{
(( stringSrc.GetData()->nRefs != 0 )?(void)0:__assert(0,"stringSrc.GetData()->nRefs != 0","/home/core/include/TTIString.h",60)) ;
if (stringSrc.GetData()->nRefs >= 0) {
(( stringSrc.GetData() != TafxDataNil )?(void)0:__assert(0,"stringSrc.GetData() != TafxDataNil","/home/core/include/TTIString.h",62)) ;
m_pchData = stringSrc.m_pchData;
MyInterlockedIncrement(&GetData()->nRefs);
} else {
m_pchData = (*(TString*)&TafxPchNil).m_pchData;
*this = stringSrc.m_pchData;
}
}
TString(char ch, int nRepeat = 1);
TString(const char * lpsz);
TString(const char * lpch, int nLength);
TString(const unsigned char* psz);
TString(int32 Val);
TString(uint32 Val);
TString(double Val);
int GetLength() const;
bool IsEmpty() const;
void Empty();
char GetAt(int nIndex) const;
char operator[](int nIndex) const;
void SetAt(int nIndex, char ch);
operator const char *() const;
const TString& operator=(const TString& stringSrc);
const TString& operator=(char ch);
const TString& operator=(const char * lpsz);
const TString& operator=(const unsigned char *lpsz);
const TString& operator=(const wchar_t* psz);
const TString& operator+=(const TString& string);
const TString& operator+=(char ch);
const TString& operator+=(const char * lpsz);
friend TString operator+(const TString& string1, const TString& string2);
friend TString operator+(const TString& string, char ch);
friend TString operator+(char ch, const TString& string);
friend TString operator+(const TString& string, const char * lpsz);
friend TString operator+(const char * lpsz, const TString& string);
int Compare(const char * lpsz) const;
int CompareNoCase(const char * lpsz) const;
int Collate(const char * lpsz) const;
TString Mid(int nFirst, int nCount) const;
TString Mid(int nFirst) const;
TString Left(int nCount) const;
TString Right(int nCount) const;
TString SpanIncluding(const char * lpszCharSet) const;
TString SpanExcluding(const char * lpszCharSet) const;
void MakeUpper();
void MakeLower();
void MakeReverse();
void TrimRight();
void TrimLeft();
int Find(char ch) const;
int ReverseFind(char ch) const;
int FindOneOf(const char * lpszCharSet) const;
int Find(const char * lpszSub) const;
void Format(const char * lpszFormat, ...);
void Format(uint32 nFormatID, ...);
char* GetBuffer(int nMinBufLength);
void ReleaseBuffer(int nNewLength = -1);
char* GetBufferSetLength(int nNewLength);
void FreeExtra();
char * LockBuffer();
void UnlockBuffer();
bool LoadString(uint32 nID);
int Remove(char chRemove);
int Replace(const char * lpszOld, const char* lpszNew);
int Replace(char chOld, char chNew);
int Insert(int nIndex, const char * pstr);
int Insert(int nIndex, char ch);
int Delete(int nIndex, int nCount = 1 );
uint32 GetUnsigned(void) const;
int32 GetSigned(void) const;
double GetDouble(void) const;
void GetBlob(byte* Buffer, uint32& BlobLength) const;
void* GetBlob(uint32& BlobLength) const;
uint32 GetBlobLength(void) const;
bool GetBool(void) const;
void HexDump(const byte* Buffer, uint32 Length, bool fPretty = true);
void BinaryDump( const byte* p, int length, uint32 AddressStart =0 );
void FormatV(const char * lpszFormat, va_list argList);
public:
~TString();
int GetAllocLength() const;
protected:
char * m_pchData;
TCStringData* GetData() const;
void AllocCopy(TString& dest, int nCopyLen, int nCopyIndex, int nExtraLen) const;
void AllocBuffer(int nLen);
void AssignCopy(int nSrcLen, const char * lpszSrcData);
void ConcatCopy(int nSrc1Len, const char * lpszSrc1Data, int nSrc2Len, const char * lpszSrc2Data);
void ConcatInPlace(int nSrcLen, const char * lpszSrcData);
void CopyBeforeWrite();
void AllocBeforeWrite(int nLen);
void Release();
static void Release(TCStringData* pData);
static int SafeStrlen(const char * lpsz);
static const char * TafxPchNil;
static TCStringData* TafxDataNil;
static int32 MyInterlockedIncrement(int32* pVal)
{
return ++(*pVal);
}
static int32 MyInterlockedDecrement(int32* pVal)
{
return --(*pVal);
}
};
bool operator==(const TString& s1, const TString& s2);
bool operator==(const TString& s1, const char * s2);
bool operator==(const char * s1, const TString& s2);
bool operator!=(const TString& s1, const TString& s2);
bool operator!=(const TString& s1, const char * s2);
bool operator!=(const char * s1, const TString& s2);
bool operator<(const TString& s1, const TString& s2);
bool operator<(const TString& s1, const char * s2);
bool operator<(const char * s1, const TString& s2);
bool operator>(const TString& s1, const TString& s2);
bool operator>(const TString& s1, const char * s2);
bool operator>(const char * s1, const TString& s2);
bool operator<=(const TString& s1, const TString& s2);
bool operator<=(const TString& s1, const char * s2);
bool operator<=(const char * s1, const TString& s2);
bool operator>=(const TString& s1, const TString& s2);
bool operator>=(const TString& s1, const char * s2);
bool operator>=(const char * s1, const TString& s2);
inline TCStringData* TString::GetData() const
{
(( m_pchData != 0 )?(void)0:__assert(0,"m_pchData != NULL","/home/core/include/TTIString.h",282)) ;
return ((TCStringData*)m_pchData)-1;
}
inline const TString& TString::operator=(const unsigned char* lpsz)
{
*this = (const char*)lpsz;
return *this;
}
inline int TString::GetLength() const
{
return GetData()->nDataLength;
}
inline int TString::GetAllocLength() const
{
return GetData()->nAllocLength;
}
inline bool TString::IsEmpty() const
{
return GetData()->nDataLength == 0;
}
inline TString::operator const char*() const
{
return m_pchData;
}
inline int TString::SafeStrlen(const char* lpsz)
{
return (lpsz == 0 ) ? 0 : strlen(lpsz);
}
inline int TString::Compare(const char* lpsz) const
{
return strcmp(m_pchData, lpsz);
}
inline int TString::CompareNoCase(const char* lpsz) const
{
return stricmp(m_pchData, lpsz);
}
inline int TString::Collate(const char* lpsz) const
{
return Compare( lpsz );
}
inline char TString::GetAt(int nIndex) const
{
(( nIndex >= 0 )?(void)0:__assert(0,"nIndex >= 0","/home/core/include/TTIString.h",335)) ;
(( nIndex < GetData()->nDataLength )?(void)0:__assert(0,"nIndex < GetData()->nDataLength","/home/core/include/TTIString.h",336)) ;
return m_pchData[nIndex];
}
inline char TString::operator[](int nIndex) const
{
(( nIndex >= 0 )?(void)0:__assert(0,"nIndex >= 0","/home/core/include/TTIString.h",343)) ;
(( nIndex < GetData()->nDataLength )?(void)0:__assert(0,"nIndex < GetData()->nDataLength","/home/core/include/TTIString.h",344)) ;
return m_pchData[nIndex];
}
inline bool operator==(const TString& s1, const TString& s2)
{
return s1.Compare(s2) == 0;
}
inline bool operator==(const TString& s1, const char* s2)
{
return s1.Compare(s2) == 0;
}
inline bool operator==(const char* s1, const TString& s2)
{
return s2.Compare(s1) == 0;
}
inline bool operator!=(const TString& s1, const TString& s2)
{
return s1.Compare(s2) != 0;
}
inline bool operator!=(const TString& s1, const char* s2)
{
return s1.Compare(s2) != 0;
}
inline bool operator!=(const char* s1, const TString& s2)
{
return s2.Compare(s1) != 0;
}
inline bool operator<(const TString& s1, const TString& s2)
{
return s1.Compare(s2) < 0;
}
inline bool operator<(const TString& s1, const char* s2)
{
return s1.Compare(s2) < 0;
}
inline bool operator<(const char* s1, const TString& s2)
{
return s2.Compare(s1) > 0;
}
inline bool operator>(const TString& s1, const TString& s2)
{
return s1.Compare(s2) > 0;
}
inline bool operator>(const TString& s1, const char* s2)
{
return s1.Compare(s2) > 0;
}
inline bool operator>(const char* s1, const TString& s2)
{
return s2.Compare(s1) < 0;
}
inline bool operator<=(const TString& s1, const TString& s2)
{
return s1.Compare(s2) <= 0;
}
inline bool operator<=(const TString& s1, const char* s2)
{
return s1.Compare(s2) <= 0;
}
inline bool operator<=(const char* s1, const TString& s2)
{
return s2.Compare(s1) >= 0;
}
inline bool operator>=(const TString& s1, const TString& s2)
{
return s1.Compare(s2) >= 0;
}
inline bool operator>=(const TString& s1, const char* s2)
{
return s1.Compare(s2) >= 0;
}
inline bool operator>=(const char* s1, const TString& s2)
{
return s2.Compare(s1) <= 0;
}
class TTIStringException
{
public:
TTIStringException(const char * pReason);
TString m_Reason;
};
class TStringRelease
{
public:
TStringRelease(TString &rStr) : m_Str(rStr) {};
~TStringRelease()
{
m_Str.ReleaseBuffer();
}
private:
TString &m_Str;
};
extern StringTableEntry _StringTable[];
extern const int _StringTableSize;
extern const TString EmptyTString;
# 5 "/home/core/include/TStringList.h" 2
typedef std:: vector<TString> TStringList;
# 27 "/home/core/Support/CardLayer/Includes.h" 2
# 1 "/home/core/Support/CardLayer/CardLayer.cpp" 2
# 1 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/memory" 1 3
# 1 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_tempbuf.h" 1 3
template <class _Tp>
pair<_Tp*, ptrdiff_t>
__get_temporary_buffer(ptrdiff_t __len, _Tp*)
{
if (__len > ptrdiff_t(2147483647L / sizeof(_Tp)))
__len = 2147483647L / sizeof(_Tp);
while (__len > 0) {
_Tp* __tmp = (_Tp*) malloc((size_t)__len * sizeof(_Tp));
if (__tmp != 0)
return pair<_Tp*, ptrdiff_t>(__tmp, __len);
__len /= 2;
}
return pair<_Tp*, ptrdiff_t>((_Tp*)0, 0);
}
template <class _Tp>
inline pair<_Tp*, ptrdiff_t> get_temporary_buffer(ptrdiff_t __len) {
return __get_temporary_buffer(__len, (_Tp*) 0);
}
template <class _Tp>
inline pair<_Tp*, ptrdiff_t> get_temporary_buffer(ptrdiff_t __len, _Tp*) {
return __get_temporary_buffer(__len, (_Tp*) 0);
}
template <class _Tp>
void return_temporary_buffer(_Tp* __p) {
free(__p);
}
template <class _ForwardIterator, class _Tp>
class _Temporary_buffer {
private:
ptrdiff_t _M_original_len;
ptrdiff_t _M_len;
_Tp* _M_buffer;
void _M_allocate_buffer() {
_M_original_len = _M_len;
_M_buffer = 0;
if (_M_len > (ptrdiff_t)(2147483647L / sizeof(_Tp)))
_M_len = 2147483647L / sizeof(_Tp);
while (_M_len > 0) {
_M_buffer = (_Tp*) malloc(_M_len * sizeof(_Tp));
if (_M_buffer)
break;
_M_len /= 2;
}
}
void _M_initialize_buffer(const _Tp&, __true_type) {}
void _M_initialize_buffer(const _Tp& val, __false_type) {
uninitialized_fill_n(_M_buffer, _M_len, val);
}
public:
ptrdiff_t size() const { return _M_len; }
ptrdiff_t requested_size() const { return _M_original_len; }
_Tp* begin() { return _M_buffer; }
_Tp* end() { return _M_buffer + _M_len; }
_Temporary_buffer(_ForwardIterator __first, _ForwardIterator __last) {
typedef typename __type_traits<_Tp>::has_trivial_default_constructor
_Trivial;
try {
_M_len = 0;
distance(__first, __last, _M_len);
_M_allocate_buffer();
if (_M_len > 0)
_M_initialize_buffer(*__first, _Trivial());
}
catch(...) { free(_M_buffer); _M_buffer = 0; _M_len = 0 ; throw; } ;
}
~_Temporary_buffer() {
destroy(_M_buffer, _M_buffer + _M_len);
free(_M_buffer);
}
private:
_Temporary_buffer(const _Temporary_buffer&) {}
void operator=(const _Temporary_buffer&) {}
};
template <class _ForwardIterator,
class _Tp
= typename iterator_traits<_ForwardIterator>::value_type
>
struct temporary_buffer : public _Temporary_buffer<_ForwardIterator, _Tp>
{
temporary_buffer(_ForwardIterator __first, _ForwardIterator __last)
: _Temporary_buffer<_ForwardIterator, _Tp>(__first, __last) {}
~temporary_buffer() {}
};
# 21 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/memory" 2 3
# 1 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_raw_storage_iter.h" 1 3
template <class _ForwardIterator, class _Tp>
class raw_storage_iterator {
protected:
_ForwardIterator _M_iter;
public:
typedef output_iterator_tag iterator_category;
typedef void value_type;
typedef void difference_type;
typedef void pointer;
typedef void reference;
explicit raw_storage_iterator(_ForwardIterator __x) : _M_iter(__x) {}
raw_storage_iterator& operator*() { return *this; }
raw_storage_iterator& operator=(const _Tp& __element) {
construct(&*_M_iter, __element);
return *this;
}
raw_storage_iterator<_ForwardIterator, _Tp>& operator++() {
++_M_iter;
return *this;
}
raw_storage_iterator<_ForwardIterator, _Tp> operator++(int) {
raw_storage_iterator<_ForwardIterator, _Tp> __tmp = *this;
++_M_iter;
return __tmp;
}
};
# 73 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/stl_raw_storage_iter.h" 3
# 23 "/usr/lib/gcc-lib/ntox86/2.95.2/../../../../include/g++-3/memory" 2 3
template <class _Tp> class auto_ptr {
private:
_Tp* _M_ptr;
public:
typedef _Tp element_type;
explicit auto_ptr(_Tp* __p = 0) throw() : _M_ptr(__p) {}
auto_ptr(auto_ptr& __a) throw() : _M_ptr(__a.release()) {}
template <class _Tp1> auto_ptr(auto_ptr<_Tp1>& __a) throw()
: _M_ptr(__a.release()) {}
auto_ptr& operator=(auto_ptr& __a) throw() {
if (&__a != this) {
delete _M_ptr;
_M_ptr = __a.release();
}
return *this;
}
template <class _Tp1>
auto_ptr& operator=(auto_ptr<_Tp1>& __a) throw() {
if (__a.get() != this->get()) {
delete _M_ptr;
_M_ptr = __a.release();
}
return *this;
}
~auto_ptr() throw() { delete _M_ptr; }
_Tp& operator*() const throw() {
return *_M_ptr;
}
_Tp* operator->() const throw() {
return _M_ptr;
}
_Tp* get() const throw() {
return _M_ptr;
}
_Tp* release() throw() {
_Tp* __tmp = _M_ptr;
_M_ptr = 0;
return __tmp;
}
void reset(_Tp* __p = 0) throw() {
delete _M_ptr;
_M_ptr = __p;
}
private:
template<class _Tp1> struct auto_ptr_ref {
_Tp1* _M_ptr;
auto_ptr_ref(_Tp1* __p) : _M_ptr(__p) {}
};
public:
auto_ptr(auto_ptr_ref<_Tp> __ref) throw()
: _M_ptr(__ref._M_ptr) {}
template <class _Tp1> operator auto_ptr_ref<_Tp1>() throw()
{ return auto_ptr_ref<_Tp>(this->release()); }
template <class _Tp1> operator auto_ptr<_Tp1>() throw()
{ return auto_ptr<_Tp1>(this->release()); }
};
# 2 "/home/core/Support/CardLayer/CardLayer.cpp" 2
# 1 "/home/core/include/CardLayer.h" 1
# 1 "/usr/include/stdio.h" 1 3 4
# 1 "/usr/include/_pack64.h" 1 3 4
#pragma pack()
# 17 "/usr/include/stdio.h" 2 3 4
typedef _int32 off_t;
typedef struct __iobuf {
unsigned char *_ptr;
int _cnt;
unsigned char *_base;
unsigned _flag;
int _handle;
unsigned _bufsize;
unsigned char _ungotten;
unsigned char _tmpfchar;
unsigned short _count;
struct __iobuf *_next;
short _tid;
unsigned short _waiting_cnt;
} FILE;
typedef long fpos_t;
extern FILE __iob[];
# 89 "/usr/include/stdio.h" 3 4
extern int _multi_threaded;
extern "C" {
extern char *fgets( char *__s, size_t __n, FILE *__fp );
extern FILE *fopen( const char *__filename, const char *__mode );
extern FILE *freopen( const char *__filename, const char *__mode, FILE *__fp );
extern char *gets( char *__s );
extern FILE *tmpfile( void );
extern char *tmpnam( char *__s );
extern void clearerr( FILE *__fp );
extern FILE *fdopen( int __handle, const char *__mode );
extern int fclose( FILE *__fp );
extern int feof( FILE *__fp );
extern int ferror( FILE *__fp );
extern int fflush( FILE *__fp );
extern int fgetc( FILE *__fp );
extern int fgetpos( FILE *__fp, fpos_t *__pos );
extern int fprintf( FILE *__fp, const char *__format, ... );
extern int fputc( int __c, FILE *__fp );
extern int fputs( const char *__s, FILE *__fp );
extern size_t fread( void *__ptr, size_t __size, size_t __n, FILE *__fp );
extern int fscanf( FILE*__fp, const char *__format, ... );
extern int fseek( FILE *__fp, long int __offset, int __whence );
extern int fseeko(FILE *__fp, off_t __offset, int __whence);
extern int fsetpos( FILE *__fp, const fpos_t *__pos );
extern long int ftell( FILE *__fp );
extern off_t ftello(FILE *__fp);
extern size_t fwrite( const void *__ptr, size_t __size, size_t __n, FILE *__fp );
extern int getc( FILE *__fp );
extern int getchar( void );
extern void perror( const char *__s );
extern int printf( const char *__format, ... );
extern int putc( int __c, FILE *__fp );
extern int putchar( int __c );
extern int puts( const char *__s );
extern int putw(int __w, FILE *__stream);
extern int remove( const char *__filename );
extern int rename( const char *__old, const char *__new );
extern void rewind( FILE *__fp );
extern int scanf( const char *__format, ... );
extern void setbuf( FILE *__fp, char *__buf );
extern int setvbuf( FILE *__fp, char *__buf, int __mode, size_t __size );
extern int snprintf(char *__s, size_t __size, const char *__format, ...) __attribute__((format (printf, 3, 4)));
extern int sprintf( char *__s, const char *__format, ... );
extern int sscanf( const char *__s, const char *__format, ... );
extern int ungetc( int __c, FILE *__fp );
extern int vfprintf( FILE *__fp, const char *__format, __va_list __arg );
extern int vprintf( const char *__format, __va_list __arg );
extern int vsnprintf(char *__s, size_t __size, const char *__format, __va_list __arg) __attribute__((format (printf, 3, 0)));
extern int vsprintf( char *__s, const char *__format, __va_list __arg );
extern FILE *_fsopen( const char *__filename, const char *__mode, int __shflag );
extern int _grow_handles( int __new_count );
extern int fcloseall( void );
extern int fgetchar( void );
extern int flushall( void );
extern int fputchar( int __c );
extern int vfscanf( FILE *__fp, const char *__format, __va_list __arg ) __attribute__((format (scanf, 2, 0)));
extern int vscanf( const char *__format, __va_list __arg ) __attribute__((format (scanf, 1, 0)));
extern int vsscanf( const char *__s, const char *__format, __va_list __arg ) __attribute__((format (scanf, 2, 0)));
# 230 "/usr/include/stdio.h" 3 4
extern FILE *popen( const char *__filename, const char *__mode );
extern int pclose( FILE *stream );
extern char* tempnam(const char *dir, const char *pfx);
extern void flockfile(FILE *fp);
extern int ftrylockfile(FILE *fp);
extern void funlockfile(FILE *fp);
# 1 "/usr/include/_packpop.h" 1 3 4
#pragma pack()
# 287 "/usr/include/stdio.h" 2 3 4
};
# 4 "/home/core/include/CardLayer.h" 2
# 1 "/home/core/include/SmartBuffer.h" 1
class OutOfBounds
{
};
class OutOfMemory
{
};
class SmartBuffer
{
public:
SmartBuffer();
SmartBuffer(uint32 Size);
void* Allocate(uint32 Size) throw( OutOfMemory );
void Free();
~SmartBuffer();
void* GetPtr();
uint32 GetAllocatedSize(void);
private:
SmartBuffer& operator=( const SmartBuffer& );
SmartBuffer( const SmartBuffer& );
byte m_Buff[2048 ];
byte *m_ExtraBuff;
bool m_Dynamic;
uint32 m_ExtraLength;
};
class SafeArray
{
public:
SafeArray();
void Initialize( void* Address, int32 Length );
byte operator[](uint32 Index);
void Copy(void* Dest, uint32 Offset, uint32 Length);
uint16 Getuint16( uint32 Offset );
void* GetPtr(uint32 Offset, uint32 Length);
void Clear(void);
private:
byte* m_pData;
uint32 m_DataLength;
};
# 8 "/home/core/include/CardLayer.h" 2
# 1 "/home/core/include/TTIConfigList.h" 1
# 1 "/home/core/include/MsgUtil.h" 1
# 1 "/home/core/include/TLV.h" 1
# 1 "/usr/include/assert.h" 1 3 4
extern "C" {
extern void __assert(int, const char *, const char *, int);
};
# 4 "/home/core/include/TLV.h" 2
class TLVException
{
};
class TLVModeException : public TLVException
{
};
class TLVParseException : public TLVException
{
};
class TLVBuildException : public TLVException
{
};
class TLVMemoryException : public TLVException
{
};
class TLVInternalException : public TLVException
{
};
class TLV
{
public:
TLV() throw( TLVMemoryException );
virtual void SetData(uint32 iBufferSize, const byte *pData) throw( TLVMemoryException );
TLV(uint32 iInitialBufferSize, uint32 iIncrement = 100, uint32 uiThreshold = 4000) throw( TLVMemoryException );
TLV(uint32 iBufferSize, const byte *pData, uint32 uiThreshold = 4000) throw( TLVMemoryException );
virtual ~TLV();
virtual void Reset() throw( TLVMemoryException );
virtual void Reset( bool WriteMode ) = 0;
void SetInitialSize(uint32 uiSize);
uint32 GetInitialSize();
void SetIncrement(uint32 uiIncrement);
uint32 GetIncrement();
void SetThreshold(uint32 uiThreshold);
uint32 GetThreshold();
virtual bool GetNextTag(t_tag *pTag, uint32 *pLen) const = 0;
virtual void SkipDataElement() const = 0;
virtual const byte* GetRemainingData(uint32 &uiBufferLength) throw( TLVParseException );
virtual int8 GetTiny() const = 0;
virtual int16 GetShort() const = 0;
virtual int32 GetLong() const = 0;
virtual uint8 GetByte() const = 0;
virtual uint16 GetUShort() const = 0;
virtual uint32 GetULong() const = 0;
virtual float GetFloat() const = 0;
virtual double GetDouble() const = 0;
virtual void GetString(char *pStr, uint32 len) const = 0;
virtual void GetBlob(byte *pBuffer, uint32 len) const = 0;
virtual void GetExactBlob(byte *pBuffer, uint32 len) const = 0;
void GetData(int8 *pData) const { *pData = GetTiny(); }
void GetData(int16 *pData) const { *pData = GetShort(); }
void GetData(int32 *pData) const { *pData = GetLong(); }
void GetData(byte *pData) const { *pData = GetByte(); }
void GetData(uint16 *pData) const { *pData = GetUShort(); }
void GetData(uint32 *pData) const { *pData = GetULong(); }
void GetData(float *pData) const { *pData = GetFloat(); }
void GetData(double *pData) const { *pData = GetDouble(); }
void GetData(char *pStr, uint32 len) const { GetString(pStr, len); };
void GetData(byte *pBuffer, uint32 len) const { GetBlob(pBuffer, len); };
virtual void PutTiny (t_tag iTag, int8 bData) = 0;
virtual void PutShort(t_tag iTag, int16 sData) = 0;
virtual void PutLong (t_tag iTag, int32 lData) = 0;
virtual void PutByte(t_tag iTag, byte bData) = 0;
virtual void PutUShort(t_tag iTag, uint16 sData) = 0;
virtual void PutULong (t_tag iTag, uint32 lData) = 0;
virtual void PutFloat(t_tag iTag, float fData) = 0;
virtual void PutDouble(t_tag iTag, double dData) = 0;
virtual void PutString(t_tag iTag, const char *pString) = 0;
virtual void PutBlob(t_tag iTag, const byte *pBuffer, uint32 length) = 0;
void Put(t_tag iTag, int8 bData) { PutTiny(iTag, bData); }
void Put(t_tag iTag, int16 sData) { PutShort(iTag, sData); }
void Put(t_tag iTag, int32 lData) { PutLong(iTag, lData); }
void Put(t_tag iTag, byte bData) { PutByte(iTag, bData); }
void Put(t_tag iTag, uint16 sData) { PutUShort(iTag, sData); }
void Put(t_tag iTag, uint32 lData) { PutULong(iTag, lData); }
void Put(t_tag iTag, float fData) { PutFloat(iTag, fData); }
void Put(t_tag iTag, double dData) { PutDouble(iTag, dData); }
void Put(t_tag iTag, const char *pString) { PutString(iTag, pString); }
void Put(t_tag iTag, const byte * pBuffer, uint32 length) { PutBlob(iTag, pBuffer, length); }
virtual void StartBuildConstructed(t_tag iTag, uint32 MaxLength = 0x7F) = 0;
virtual void EndBuildConstructed() = 0;
virtual void StartParseConstructed() const = 0;
virtual void EndParseConstructed() const = 0;
uint32 length() const;
byte *getBuffer();
virtual void MarkENDOFTLV() = 0;
protected:
void Write(byte bData) throw( TLVMemoryException );
void Write(const byte *pData, uint32 len) throw( TLVMemoryException );
byte *ShiftDataRight(byte *pStart, uint32 cCount) throw( TLVMemoryException );
void PushWriteScope(byte numBytes) throw( TLVMemoryException );
byte *PopWriteScope(uint32 *pLen, byte *pNumBytes) throw ( TLVInternalException );
void PushReadScope(uint32 len) const throw( TLVMemoryException );
void PopReadScope() const throw( TLVInternalException );
bool Read(byte &pData) const;
bool Read(uint32 len, byte *pBuffer) const;
t_tag GetCurrentTag() const;
void SetCurrentTag(t_tag Tag) const;
uint32 GetCurrentDataLen() const;
void SetCurrentDataLen(uint32 len) const;
bool m_fComplete;
private:
class WriteScope
{
public:
uint32 m_StartIndex;
byte m_NumBytes;
};
class ReadScope
{
public:
uint32 m_EndIndex;
uint16 m_Tag;
uint32 m_DataLen;
};
byte *m_pBuffer;
mutable uint32 m_iIndex;
uint32 m_Increment;
uint32 m_Threshold;
uint32 m_InitialSize;
uint32 m_BufferSize;
uint32 m_DataSize;
WriteScope *m_pWriteStack;
uint32 m_WriteIndex;
byte m_WriteSize;
ReadScope *m_pReadStack;
mutable uint32 m_ReadIndex;
byte m_ReadSize;
mutable ReadScope *m_pCurrReadScope;
void checkWrite(uint32 numBytes) throw( TLVMemoryException );
void CreateScopes(byte MaxDepth = 20 ) throw( TLVMemoryException );
void ResetScopes(void);
TLV& operator= ( const TLV& );
TLV( const TLV& );
};
# 28 "/home/core/include/MsgUtil.h" 2
# 1 "/home/core/include/TlvAsn1.h" 1
typedef uint32 L_tag;
class TlvAsn1 : public TLV
{
public:
TlvAsn1() throw( TLVException );
TlvAsn1(uint32 iInitialBufferSize, uint32 iIncrement = 100, uint32 uiThreshold = 4000) throw( TLVException );
TlvAsn1(uint32 iBufferSize, const byte *pData, uint32 uiThreshold = 4000) throw (TLVException );
void SetData(uint32 iBufferSize, const byte *pData) throw (TLVException );
~TlvAsn1();
void Reset() throw( TLVException );
void Reset( bool WriteMode ) throw( TLVException );
bool GetNextTag(t_tag *pTag, uint32 *pLen) const throw(TLVException);
bool GetNextTagL(L_tag *pTag, uint32 *pLen) const throw(TLVException);
void SkipDataElement() const throw( TLVException ) ;
int8 GetTiny() const throw( TLVException );
int16 GetShort() const throw( TLVException );
int32 GetLong() const throw( TLVException );
uint8 GetByte() const throw( TLVException );
uint16 GetUShort() const throw( TLVException );
uint32 GetULong() const throw( TLVException );
float GetFloat() const throw( TLVException );
double GetDouble() const throw( TLVException );
void GetString(char *pStr, uint32 len) const throw( TLVException );
void GetAsciiString( char *pStr, uint32 len ) const throw( TLVException );
void GetBlob(byte *pBuffer, uint32 len) const throw( TLVException );
void GetExactBlob( byte *pBuffer, uint32 len ) const throw( TLVException );
void PutTiny (t_tag iTag, int8 bData) throw( TLVException );
void PutShort(t_tag iTag, int16 sData) throw( TLVException );
void PutLong (t_tag iTag, int32 lData) throw( TLVException );
void PutByte(t_tag iTag, byte bData) throw( TLVException );
void PutUShort(t_tag iTag, uint16 sData) throw( TLVException );
void PutULong (t_tag iTag, uint32 lData) throw( TLVException );
void PutFloat(t_tag iTag, float fData) throw( TLVException );
void PutDouble(t_tag iTag, double dData) throw( TLVException );
void PutString(t_tag iTag, const char* pString) throw( TLVException );
void PutBlob(t_tag iTag, const byte * pBuffer, uint32 length) throw( TLVException );
void PutAsciiString( t_tag iTag, const char* pString) throw( TLVException );
void PutTinyL (L_tag iTag, int8 bData) throw( TLVException );
void PutShortL(L_tag iTag, int16 sData) throw( TLVException );
void PutLongL (L_tag iTag, int32 lData) throw( TLVException );
void PutByteL(L_tag iTag, byte bData) throw( TLVException );
void PutUShortL(L_tag iTag, uint16 sData) throw( TLVException );
void PutULongL (L_tag iTag, uint32 lData) throw( TLVException );
void PutFloatL(L_tag iTag, float fData) throw( TLVException );
void PutDoubleL(L_tag iTag, double dData) throw( TLVException );
void PutStringL(L_tag iTag, const char* pString) throw( TLVException );
void PutBlobL(L_tag iTag, const byte * pBuffer, uint32 length) throw( TLVException );
void PutAsciiStringL( L_tag iTag, const char* pString) throw( TLVException );
void PutL(L_tag iTag, int8 bData) { PutTinyL(iTag, bData); }
void PutL(L_tag iTag, int16 sData) { PutShortL(iTag, sData); }
void PutL(L_tag iTag, int32 lData) { PutLongL(iTag, lData); }
void PutL(L_tag iTag, byte bData) { PutByteL(iTag, bData); }
void PutL(L_tag iTag, uint16 sData) { PutUShortL(iTag, sData); }
void PutL(L_tag iTag, uint32 lData) { PutULongL(iTag, lData); }
void PutL(L_tag iTag, float fData) { PutFloatL(iTag, fData); }
void PutL(L_tag iTag, double dData) { PutDoubleL(iTag, dData); }
void PutL(L_tag iTag, const char *pString) { PutStringL(iTag, pString); }
void PutL(L_tag iTag, const byte * pBuffer, uint32 length) { PutBlobL(iTag, pBuffer, length); }
void StartBuildConstructed(t_tag iTag, uint32 MaxLength = 0x7F) throw( TLVException );
void StartBuildConstructedL(L_tag iTag, uint32 MaxLength = 0x7F) throw( TLVException );
void EndBuildConstructed() throw( TLVException );
void StartParseConstructed() const throw( TLVException );
void EndParseConstructed() const throw( TLVException );
void MarkENDOFTLV() throw( TLVException );
private:
void PutTagOnly(t_tag iTag, bool fConstructed) throw( TLVException );
void PutTagOnlyL(L_tag iTag, bool fConstructed) throw( TLVException );
void PutLenOnly(uint32 length) throw( TLVException );
enum Mode { eBuildMode, eParseAtTag, eParseAtData };
void CheckMode( Mode mode ) const throw (TLVException );
void SetMode( Mode mode ) const;
mutable Mode tlvMode;
TlvAsn1& operator= ( const TlvAsn1& );
TlvAsn1( const TlvAsn1& );
};
# 29 "/home/core/include/MsgUtil.h" 2
# 1 "/home/core/include/MemoryBlock.h" 1
# 35 "/home/core/include/MemoryBlock.h"
#pragma pack(4)
class MemoryBlock {
public:
MemoryBlock(uint32 BlockIncrement);
MemoryBlock();
~MemoryBlock();
MemoryBlock& operator= (const MemoryBlock& src);
MemoryBlock(const MemoryBlock& src);
byte* GetPtr(void);
const byte* GetConstPtr(void) const;
uint32 GetLength(void) const;
bool operator==(const MemoryBlock& right) const
{
return ((this->GetLength() == right.GetLength()) &&
(memcmp(this->GetConstPtr(), right.GetConstPtr(), this->GetLength()) == 0));
}
bool operator!=(const MemoryBlock& right) const
{
return !(*this == right);
}
byte* AddData(const void* NewData,const uint32 Length);
byte *ReserveData(const uint32 Length);
void PreAllocate(const uint32 Length );
void RemoveData(const uint32 offset,const uint32 size);
void Clear(void);
protected:
class BufferIndirection {
public:
uint32 m_uiRefCount;
uint32 m_BufferSize;
uint32 m_DataSize;
uint32 m_BlockIncrementSize;
};
byte* m_pBufInd;
void CopyBeforeWrite( uint ExtraLength = 0 );
void ReleaseBufferIndirection( void );
void AllocateIndirection( uint BufferSize, uint IncrementSize = 256 );
byte *ReserveData(const uint32 Length, bool);
};
# 105 "/home/core/include/MemoryBlock.h"
#pragma pack()
# 30 "/home/core/include/MsgUtil.h" 2
# 1 "/home/core/include/Message.h" 1
# 1 "/usr/include/assert.h" 1 3 4
extern "C" {
extern void __assert(int, const char *, const char *, int);
};
# 22 "/home/core/include/Message.h" 2
class TLV;
class MemoryBlock;
class MessageData;
# 80 "/home/core/include/Message.h"
#pragma pack(1)
typedef struct _MessageHeader MessageHeader, *MessageHeaderPtr;
struct _MessageHeader
{
byte hdrLength;
byte hdrVersion __attribute__ ((packed));
uint16 InterfaceId __attribute__ ((packed));
uint16 MessageId __attribute__ ((packed));
byte EncodingId __attribute__ ((packed));
byte VersionId __attribute__ ((packed));
uint32 Length __attribute__ ((packed));
uint32 SessionId __attribute__ ((packed));
uint16 Status __attribute__ ((packed));
};
# 119 "/home/core/include/Message.h"
# 130 "/home/core/include/Message.h"
#pragma pack()
class MessageException
{
};
class Message
{
public:
Message();
~Message();
Message(uint16 InterfaceId,
uint16 MessageId,
byte EncodingId,
byte VersionId,
uint32 SessionId,
uint16 Status,
TLV &tlv);
Message(uint16 InterfaceId,
uint16 MessageId,
byte EncodingId,
byte VersionId,
uint32 SessionId,
uint16 Status);
Message(MessageHeaderPtr pMsgHdr, byte *pData) throw( char* );
Message(byte *pRawData, uint32 length) throw( char* );
Message(MemoryBlock *pRawData) throw( char* );
const Message& operator=(const Message& mCopy) throw( char* );
void BuildMessage(MemoryBlock *pRawData) throw( char* );
MessageHeaderPtr GetHeader();
MessageHeaderPtr GetHeaderHost()
{
return &m_MsgHdr;
}
static byte *GetData(const MessageHeaderPtr pHeader)
{
return ((byte *)pHeader) + pHeader->hdrLength;
}
byte *GetData();
byte *GetBinary(uint32 *pLength = 0 ) throw(char*);
uint32 GetBinaryLength() throw( char*);
static void ntoh_hdr(const MessageHeaderPtr pN, MessageHeaderPtr pH) throw( char* );
static void hton_hdr(const MessageHeaderPtr pH, MessageHeaderPtr pN) throw( char* );
uint32 GetDataLength() throw( char*);
static uint32 GetDataLength(const MessageHeaderPtr pNBOHdr);
static uint16 GetInterfaceId(const MessageHeaderPtr pNBOHdr);
static uint16 GetMessageId(const MessageHeaderPtr pNBOHdr);
static uint32 GetSessionId(const MessageHeaderPtr pNBOHdr);
static uint16 GetStatus(const MessageHeaderPtr pNBOHdr);
private:
Message( const Message& src );
void CheckRawData(byte *pData, uint32 uiLength) throw( char* );
MessageHeader m_MsgHdr;
MessageHeaderPtr m_pNBOMsgHdr;
byte *m_pData;
MemoryBlock *m_pRawData;
};
typedef Message TTIMessage;
# 31 "/home/core/include/MsgUtil.h" 2
# 1 "/home/core/include/MessageData.h" 1
# 1 "/usr/include/time.h" 1 3 4
typedef int timer_t;
typedef int clockid_t;
# 1 "/usr/include/_pack64.h" 1 3 4
#pragma pack()
# 46 "/usr/include/time.h" 2 3 4
extern long _sysconf(int __name);
struct itimerspec {
struct timespec it_value,
it_interval;
} ;
extern "C" {
struct sigevent;
extern int clock_getres(clockid_t __clock_id, struct timespec *__res );
extern int clock_gettime(clockid_t __clock_id, struct timespec *__tp );
extern int clock_setres(clockid_t __clock_id, struct timespec *__res );
extern int clock_settime(clockid_t __clock_id, const struct timespec *__tp );
extern int clock_getcpuclockid(pid_t __pid, clockid_t *__clock_id);
extern int nanosleep( const struct timespec *__rqtp, struct timespec *__rmtp );
extern int timer_create ( clockid_t __clock_id, struct sigevent *__evp, timer_t *__timerid );
extern int timer_delete ( timer_t __timerid );
extern int timer_getoverrun( timer_t __timerid);
extern int timer_gettime ( timer_t __timerid, struct itimerspec *__value );
extern int timer_settime ( timer_t __timerid, int __flags, struct itimerspec *__value, struct itimerspec *__ovalue );
extern int nanosleep_abs(clockid_t __clock_id, const struct timespec *__rqtp);
extern int nanosleep_rel(clockid_t __clock_id, const struct timespec *__rqtp, struct timespec *__rmtp );
extern int clock_nanosleep(clockid_t __clock_id, int __flags, const struct timespec *__rqtp, struct timespec *__rmtp );
extern int timer_getexpstatus(timer_t __timerid);
extern int nanospin_calibrate(int __disable);
extern int nanospin(const struct timespec *__rqtp);
extern void nanospin_count(unsigned long __count);
extern int nanospin_ns(unsigned long __nsec);
extern unsigned long nanospin_ns_to_count(unsigned long __nsec);
extern int timer_timeout(clockid_t __id, int __flags, const struct sigevent *__notify,
const struct timespec *__ntime, struct timespec *__otime);
extern int timer_timeout_r(clockid_t __id, int __flags, const struct sigevent *__notify,
const struct timespec *__ntime, struct timespec *__otime);
extern void nsec2timespec(struct timespec *__timespec, _uint64 __nsec);
extern _uint64 timespec2nsec(const struct timespec *__ts);
struct tm {
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year;
int tm_wday;
int tm_yday;
int tm_isdst;
long int tm_gmtoff;
const char *tm_zone;
};
extern char *asctime( const struct tm *__timeptr );
extern char *ctime( const time_t *__timer );
extern clock_t clock( void );
extern double difftime( time_t __t1, time_t __t0 );
extern struct tm *gmtime( const time_t *__timer );
extern struct tm *localtime( const time_t *__timer );
extern time_t mktime( struct tm *__timeptr );
extern size_t strftime( char *__s, size_t __maxsiz, const char *__fmt, const struct tm *__tp );
extern time_t time( time_t *__timer );
extern char *asctime_r( const struct tm *__timeptr, char *__buff );
extern char *ctime_r( const time_t *__timer, char *__buff );
extern struct tm *gmtime_r( const time_t *__timer, struct tm *__tm );
extern struct tm *localtime_r( const time_t *__timer, struct tm *__tm );
extern void tzset( void );
extern char *tzname[];
extern int daylight;
extern long int timezone;
extern struct tm *getdate(const char *__string);
extern char *strptime(const char *__buf, const char *__format, struct tm *__tm);
# 1 "/usr/include/_packpop.h" 1 3 4
#pragma pack()
# 200 "/usr/include/time.h" 2 3 4
};
# 24 "/home/core/include/MessageData.h" 2
class MessageData;
class MessageDataTracer;
class TTIXML;
typedef std:: vector<bool> BoolVector;
class MessageDataStorage
{
public:
uint32 Save(MessageData &rMDO, TLV &tlv) throw( TLVException );
uint32 Save(MessageData &rMDO, TLV &tlv, uint16 uiTag) throw( TLVException );
void Restore(MessageData &rMdo, TLV &tlv, uint32 uiLen) throw( TLVException );
bool RestoreInfo(uint32 *pLen, uint16 *pTag);
private:
virtual void WriteByte(byte uiData) = 0;
virtual byte ReadByte(bool &fEOF) = 0;
virtual void Write(byte *pData, uint32 uiLen);
virtual bool Read(byte *pData, uint32 uiLen);
};
class MessageFileDataStorage : public MessageDataStorage
{
public:
MessageFileDataStorage(FILE *pFile)
{
m_pFile = pFile;
}
private:
void WriteByte(byte uiData)
{
if (1 != fwrite(&uiData, 1, 1, m_pFile)) {
throw TLVBuildException();
}
}
byte ReadByte(bool &fEOF)
{
byte uiTemp;
fEOF = (1 != fread(&uiTemp, 1, 1, m_pFile));
return uiTemp;
}
void Write(byte *pData, uint32 uiLen)
{
if (1 != fwrite(pData, uiLen, 1, m_pFile)) {
throw TLVBuildException();
}
}
bool Read(byte *pData, uint32 uiLen)
{
bool bTemp;
bTemp = (1 == fread(pData, uiLen, 1, m_pFile));
return bTemp;
}
FILE *m_pFile;
};
class MessageDataTracer
{
public:
MessageDataTracer();
virtual void Output(const char *pString, bool fIndent = true) = 0;
void tprintf(const char *Format, ...);
MessageDataTracer &operator << (bool data);
MessageDataTracer &operator << (byte data);
MessageDataTracer &operator << (uint16 data);
MessageDataTracer &operator << (uint32 data);
MessageDataTracer &operator << (int8 data);
MessageDataTracer &operator << (int16 data);
MessageDataTracer &operator << (int32 data);
MessageDataTracer &operator << (const char *data);
MessageDataTracer &operator << (const time_t *data);
MessageDataTracer &operator << (const MessageData *data);
void Trace(const char *pTag, bool data, uint32 tag_len = 20);
void Trace(const char *pTag, byte data, uint32 tag_len = 20);
void Trace(const char *pTag, uint16 data, uint32 tag_len = 20);
void Trace(const char *pTag, uint32 data, uint32 tag_len = 20);
void Trace(const char *pTag, int8 data, uint32 tag_len = 20);
void Trace(const char *pTag, int16 data, uint32 tag_len = 20);
void Trace(const char *pTag, int32 data, uint32 tag_len = 20);
void Trace(const char *pTag, const char *data, uint32 tag_len = 20);
void Trace(const char *pTag, const byte *data, uint32 len, uint32 tag_len = 20);
void Trace(const char *pTag, const time_t *data, uint32 tag_len = 20);
void Trace(const char *pTag, float data, uint32 tag_len = 20);
void Trace(const char *pTag, double data, uint32 tag_len = 20);
void Trace(const char *pTag, const MessageData *data, uint32 tag_len = 20);
uint16 incIndent();
uint16 decIndent();
protected:
uint16 m_uiIndent;
};
class MessageDataFileTracer : public MessageDataTracer
{
public:
MessageDataFileTracer(FILE *pFile);
void Output(const char *pString, bool fIndent = true);
private:
FILE *m_pFile;
};
class MessageDataDebugTracer : public MessageDataTracer
{
public:
void Output(const char *pString, bool fIndent = true);
};
class MessageDataMissingField
{
};
class MessageDataDuplicateField
{
};
class MessageData
{
public:
MessageData();
virtual void Encode(TLV &tlv) const = 0;
virtual void Encode(TTIXML &rXML) const
{
throw "XML Encoding not implemented";
}
virtual void Decode(const TLV &tlv) = 0;
virtual void Decode(const TTIXML &rXML)
{
throw "XML Decoding not implemented";
}
virtual void Trace(MessageDataTracer &trace) const
{
trace.Output("Not implemented\n");
}
virtual const char *GetMDOName() const;
char *m_pName;
protected:
static void CheckBitSet(const uint32 rBM, const uint32 uiBit) throw( MessageDataMissingField );
static void CheckBitClear(const uint32 rBM, const uint32 uiBit) throw( MessageDataDuplicateField );
static bool GetBit(const uint32 rBM, const uint32 uiBit);
static void SetBit(uint32 &rBM, const uint32 uiBit);
static void ClearBit(uint32 &rBM, const uint32 uiBit);
static void CheckBitSet(const std:: vector<bool> rBM, const uint32 uiBit) throw( MessageDataMissingField );
static void CheckBitClear(const std:: vector<bool> rBM, const uint32 uiBit) throw( MessageDataDuplicateField );
static bool GetBit(const std:: vector<bool> &rBM, const uint32 uiBit);
static void SetBit( std:: vector<bool> &rBM, const uint32 uiBit);
static void ClearBit( std:: vector<bool> &rBM, const uint32 uiBit);
friend BoolVector operator&(const BoolVector &var1, const BoolVector &var2);
};
BoolVector operator&(const BoolVector &var1, const BoolVector &var2);
# 32 "/home/core/include/MsgUtil.h" 2
# 34 "/home/core/include/TTIConfigList.h" 2
# 1 "/home/core/include/TLVLists.h" 1
# 1 "/home/core/include/slist.h" 1
typedef int32 SListCompare(void *ptrExisting, void *ptrNew);
class SList {
public:
SList(SListCompare *ptrCompareFunction = 0);
virtual ~SList();
void Add(void* ptrElement);
void *Delete(void *ptrElement);
uint32 Length() const;
void * Head() const;
void Restart() const;
void * Tail() const;
void * Next() const;
void * Find(SListCompare *ptrCompareFunction,
void * ptrElement);
SList& operator= (SList& src);
private:
class SListNode
{
public:
SListNode *ptrNext;
void * ptrElement;
};
typedef SListNode *SListNodePtr;
SListCompare *ptrCompareFunction;
SListNodePtr ptrHead;
SListNodePtr ptrTail;
mutable SListNodePtr ptrCursor;
uint32 ulLength;
};
# 35 "/home/core/include/TLVLists.h" 2
template <class TLVListElem> class TLVListIntf
{
public:
virtual TLVListElem *Add(const TLVListElem &e) = 0;
virtual TLVListElem *Get(bool first = false) const = 0;
virtual void Clear() = 0;
virtual uint32 Count() const = 0;
TLVListIntf<TLVListElem>& operator= (const TLVListIntf<TLVListElem>& src)
{
if( this != &src ) {
Clear();
TLVListElem *pNext = src.Get(true);
while (pNext) {
Add(*pNext);
pNext = src.Get(false);
}
}
return *this;
}
};
template <class TLVListElem> class TLVSList : public SList
, public TLVListIntf<TLVListElem>
{
public:
virtual TLVListElem *Add(const TLVListElem &e)
{
TLVListElem *pCopy = new TLVListElem(e);
SList::Add(pCopy);
return pCopy;
}
virtual TLVListElem *Get(bool fFirst = false) const
{
if (fFirst) {
return (TLVListElem *)SList::Head();
} else {
return (TLVListElem *)SList::Next();
}
}
virtual void Clear()
{
TLVListElem *pNext;
for (( pNext ) = ( TLVListElem * )(( this )->Head()); ( TLVListElem * )0 != pNext ; pNext = ( TLVListElem * )(( this )->Next())) {
SList::Delete(pNext);
delete pNext;
}
}
virtual void CopyList(const TLVSList<TLVListElem> ©List)
{
const TLVListElem *pNext;
TLVSList<TLVListElem> *pTempList = (TLVSList<TLVListElem>*)©List;
Clear();
for (pNext = (TLVListElem *)pTempList->Head();
pNext != 0 ;
pNext = (TLVListElem *)pTempList->Next())
{
Add(*pNext);
}
}
TLVSList<TLVListElem>& operator= (const TLVSList<TLVListElem>& src)
{
if( this != &src ) {
Clear();
TLVListElem *pNext = src.Get(true);
while (pNext) {
Add(*pNext);
pNext = src.Get(false);
}
}
return *this;
}
virtual uint32 Count() const
{
return SList::Length();
}
virtual ~TLVSList()
{
Clear();
};
};
class TLVSListStringList : public TLVSList<char *>
{
public:
virtual char *Add(const char *pString)
{
char *pNew = new char[strlen(pString) + 1];
strcpy(pNew, pString);
SList::Add(pNew);
return pNew;
}
virtual void CopyList(const TLVSListStringList ©List)
{
const char *pNext;
TLVSListStringList *pTempList = (TLVSListStringList*)(©List);
Clear();
for (pNext = (char*)pTempList->Head(); pNext != 0 ; pNext = (char*)pTempList->Next()) {
Add(pNext);
}
}
virtual uint32 Count() const
{
return SList::Length();
}
virtual ~TLVSListStringList()
{
Clear();
};
};
typedef TLVSList<uint8> TLVSList_uint8;
typedef TLVSList<uint16> TLVSList_uint16;
typedef TLVSList<uint32> TLVSList_uint32;
typedef TLVSList<char> TLVSList_char;
typedef TLVSList<int8> TLVSList_int8;
typedef TLVSList<int16> TLVSList_int16;
typedef TLVSList<int32> TLVSList_int32;
typedef TLVSList<float> TLVSList_float;
typedef TLVSList<double> TLVSList_double;
typedef TLVSListStringList TLVSList_String;
# 35 "/home/core/include/TTIConfigList.h" 2
# 1 "/home/core/include/TTIConfigSet.h" 1
# 1 "/usr/include/float.h" 1 3 4
extern "C" {
extern unsigned _clear87(void);
extern unsigned _control87(unsigned,unsigned);
extern void _fpreset(void);
extern unsigned _status87(void);
};
# 32 "/home/core/include/TTIConfigSet.h" 2
# 1 "/home/core/include/TTIConfigElement.h" 1
# 1 "/home/core/include/TTIConfigValue.h" 1
# 1 "/usr/include/assert.h" 1 3 4
extern "C" {
extern void __assert(int, const char *, const char *, int);
};
# 32 "/home/core/include/TTIConfigValue.h" 2
class TTIConfigNTRegistryStorage;
class TTIConfigFileStorage;
class TTIConfigAsciiFileStorage;
class TTIConfigList;
class TTIConfigValue : public MessageData
{
public:
typedef enum
{
idString,
idSigned,
idUnsigned,
idChar,
idDouble,
idBlob,
idBool,
idList,
idInvalid=1000
} TTIConfigType;
TTIConfigValue();
TTIConfigValue(const TTIConfigValue &rCopy);
TTIConfigValue(const char *pStringValue);
TTIConfigValue(const int32 iSignedValue);
TTIConfigValue(const uint32 uUnsignedValue);
TTIConfigValue(const char iCharValue);
TTIConfigValue(const double dDoubleValue);
TTIConfigValue(const byte *pBlobValue, const uint32 uBlobLen);
TTIConfigValue(const bool fBoolValue);
TTIConfigValue(TTIConfigList &rConfigList);
virtual ~TTIConfigValue();
TTIConfigValue& operator=(const TTIConfigValue &rCopy);
int operator== (const TTIConfigValue &cv2) const;
int CheckMinMax( double dMin, double dMax ) const;
operator const char *() const;
void GetAscii(TString& Txt) const;
TString GetAscii() const;
void Encode(TLV &tlv) const;
void Decode(const TLV &tlv);
void Trace(MessageDataTracer &trace) const;
void SetStringValue(const char *pStringValue);
void SetSignedValue(const int32 iSignedValue);
void SetUnsignedValue(const uint32 uUnsignedValue);
void SetCharValue(const char iCharValue);
void SetDoubleValue(const double dDoubleValue);
void SetBlobValue(const byte *pBlobValue, uint32 uiBlobLen);
void SetBoolValue(const bool fBool);
void SetListValue(const TTIConfigList &rConfigList);
TTIConfigType GetType() const;
uint32 GetLength(void) const;
const char *GetStringValue() const;
int32 GetSignedValue() const;
uint32 GetUnsignedValue() const;
char GetCharValue() const;
double GetDoubleValue() const;
const byte *GetBlobValue(uint32& uiBlobLen) const;
bool GetBoolValue() const;
const TTIConfigList &GetListValue() const;
TTIConfigList &GetListValue();
void SetAscii(uint32 Type, const char * Str);
protected:
const void * GetBinary(int& size) const;
void SetBinary(uint32 Type, uint32 size, const void* Data);
friend class TTIConfigNTRegistryStorage;
friend class TTIConfigFileStorage;
friend class TTIConfigAsciiFileStorage;
private:
TTIConfigType m_uType;
TString m_pStringValue;
int32 m_iSignedValue;
uint32 m_uUnsignedValue;
char m_iCharValue;
double m_dDoubleValue;
byte *m_pBlobValue;
uint32 m_uiBlobLen;
bool m_fBoolValue;
TTIConfigList *m_pConfigList;
mutable char* m_pstrcnvbuf;
private:
void Free(byte *&pData);
void Alloc(byte *&pData, uint32 uiLen);
inline void Init(void);
void CheckType(TTIConfigType idExcpected, TTIConfigType idActual) const;
static const t_tag t_TYPE;
static const t_tag t_STRINGVALUE;
static const t_tag t_SIGNEDVALUE;
static const t_tag t_UNSIGNEDVALUE;
static const t_tag t_CHARVALUE;
static const t_tag t_DOUBLEVALUE;
static const t_tag t_BLOBVALUE;
static const t_tag t_BOOLVALUE;
static const t_tag t_LISTVALUE;
};
# 38 "/home/core/include/TTIConfigElement.h" 2
# 1 "/home/core/include/TTIConfigExceptions.h" 1
class TTIConfigException
{
public:
TTIConfigException();
TTIConfigException(const TTIConfigException& rCopy);
TTIConfigException& operator=(const TTIConfigException &rCopy);
virtual ~TTIConfigException();
void SetName(const char *m_pName);
void SetReason(const char *m_pName);
public:
TString m_pName;
TString m_pReason;
};
class TTIConfigNotFound : public TTIConfigException
{
public:
TTIConfigNotFound(const char *pName);
virtual ~TTIConfigNotFound();
};
class TTIConfigNodefault : public TTIConfigException
{
public:
TTIConfigNodefault(const char *pName);
virtual ~TTIConfigNodefault();
};
class TTIConfigTypeError : public TTIConfigException
{
public:
TTIConfigTypeError(const char *pName,
TTIConfigValue::TTIConfigType idExcpected,
TTIConfigValue::TTIConfigType idActual);
virtual ~TTIConfigTypeError();
public:
TTIConfigValue::TTIConfigType m_idExcpected;
TTIConfigValue::TTIConfigType m_idActual;
};
class TTIConfigIOError : public TTIConfigException
{
public:
TTIConfigIOError(const char *pName, const char* Reason);
virtual ~TTIConfigIOError();
};
class TTIConfigInvalidValue : public TTIConfigException
{
public:
TTIConfigInvalidValue(const char *pName, const char* Reason);
virtual ~TTIConfigInvalidValue();
};
# 39 "/home/core/include/TTIConfigElement.h" 2
class TTIConfigList;
class TTIConfigElement : public MessageData
{
public:
typedef TLVSList<TTIConfigValue> TLVSList_TTIConfigValue;
TTIConfigElement();
TTIConfigElement(const TTIConfigElement &rCopy);
TTIConfigElement(
const char *pName,
const TTIConfigValue &rValue,
const TTIConfigValue::TTIConfigType uType,
const double dMin,
const double dMax,
const TLVSList_TTIConfigValue *pEnumeration,
const char *pDescription,
const TTIConfigValue *pDefaultValue = 0 );
TTIConfigElement(
const char *pName,
const char *pDescription,
const char *pString,
const char *pDefault = 0 );
TTIConfigElement(
const char *pName,
const char *pDescription,
const uint32 uiUnsigned,
const uint32 *pDefault = 0 ,
const uint32 uiMin = 0,
const uint32 uiMax = 0);
TTIConfigElement(
const char *pName,
const char *pDescription,
const int32 iSigned,
const int32 *pDefault = 0 ,
const int32 iMin = 0,
const int32 iMax = 0);
TTIConfigElement(
const char *pName,
const char *pDescription,
const char cChar,
const char *pDefault = 0 ,
const char cMin = 'a',
const char cMax = 'a');
TTIConfigElement(
const char *pName,
const char *pDescription,
const double dDouble,
const double *pDefault = 0 ,
const double dMin = 0.0,
const double dMax = 0.0);
TTIConfigElement(
const char *pName,
const char *pDescription,
const byte *pBlob,
const uint32 uiBlobLen,
const byte *pDefault = 0 ,
const uint32 uiDefLen = 0);
TTIConfigElement(
const char *pName,
const char *pDescription,
const bool fBool,
const bool *pDefault = 0 );
TTIConfigElement(TTIConfigList &rList);
void Initialize( const char *pName,
const TTIConfigValue &rValue,
const double dMin,
const double dMax,
const char *pDescription,
const TTIConfigValue *pDefaultValue );
inline void Init(void);
virtual ~TTIConfigElement();
TTIConfigElement& operator=(const TTIConfigElement &rCopy);
void Encode(TLV &tlv) const;
void Decode(const TLV &tlv);
void Trace(MessageDataTracer &trace) const;
void SetName(const char *pName);
void SetDescription(const char *pDescription);
void SetValue(const TTIConfigValue &rValue);
void SetDefaultValue(const TTIConfigValue *pValue = 0 );
void SetType(const TTIConfigValue::TTIConfigType uType);
void SetMin(const double dMin);
void SetMax(const double dMax);
void SetEnumeration(const TLVSList_TTIConfigValue *rEnumeration);
const char *GetName() const;
const char *GetCName() const { return m_pUnderName; }
const char *GetDescription() const;
TTIConfigValue *GetValue();
const TTIConfigValue *GetValue() const;
TTIConfigValue::TTIConfigType GetType() const;
double GetMin() const;
double GetMax() const;
const TLVSList_TTIConfigValue *GetEnumeration() const;
void SetDefault(char *pString);
void SetDefault(uint32 uiUnsigned);
void SetDefault(int32 iSigned);
void SetDefault(double dDouble);
void SetDefault(char cChar);
void SetDefault(byte *pBlob, uint32 uiLen);
void SetDefault(bool fBool);
void AddEnumeration(char *pString);
void AddEnumeration(uint32 uiUnsigned);
void AddEnumeration(int32 iSigned);
void AddEnumeration(double dDouble);
void AddEnumeration(char cChar);
void AddEnumeration(byte *pBlob, uint32 uiLen);
void AddEnumeration(bool fBool);
void CheckSanity(void) const;
void SetAscii( TTIConfigValue::TTIConfigType Type, const char * Txt);
void GetAscii(TString& Txt) const;
private:
TString m_pName;
public:
TString m_pDescription;
TTIConfigValue m_Value;
TTIConfigValue *m_pDefaultValue;
TTIConfigValue::TTIConfigType m_uType;
double m_dMin;
double m_dMax;
TLVSList_TTIConfigValue *m_Enumeration;
private:
TString m_pUnderName;
private:
static const t_tag t_NAME;
static const t_tag t_VALUE;
static const t_tag t_TYPE;
static const t_tag t_MIN;
static const t_tag t_MAX;
static const t_tag t_ENUMERATION;
static const t_tag t_DESCRIPTION;
};
# 36 "/home/core/include/TTIConfigSet.h" 2
# 1 "/home/core/include/TTIConfigStatus.h" 1
class TTIConfigStatus : public MessageData
{
public:
TTIConfigStatus();
TTIConfigStatus(const TTIConfigStatus &rCopy);
TTIConfigStatus(
const bool bUpdated,
const char *pText = 0 );
virtual ~TTIConfigStatus();
TTIConfigStatus& operator=(const TTIConfigStatus &rCopy);
void Encode(TLV &tlv) const;
void Decode(const TLV &tlv);
void Trace(MessageDataTracer &trace) const;
void SetUpdated(const bool bUpdated)
{
m_bUpdated = bUpdated;
}
void SetText(const char *pText);
bool GetUpdated()
{
return m_bUpdated;
}
char *GetText()
{
return m_pText;
}
bool m_bUpdated;
char * m_pText;
private:
static const t_tag t_UPDATED;
static const t_tag t_TEXT;
};
# 38 "/home/core/include/TTIConfigSet.h" 2
class TTIConfigList;
class TTIConfigSet : public MessageData
{
public:
typedef TLVSList<TTIConfigElement> TLVSList_TTIConfigElement;
TTIConfigSet();
TTIConfigSet(const TTIConfigSet &rCopy);
TTIConfigSet(
const TLVSList_TTIConfigElement &rElements,
const char *pAppName,
const char *pDescription,
const char *pRemarks);
TTIConfigSet(
const char *pAppName,
const char *pDescription,
const char *pRemarks);
virtual ~TTIConfigSet();
TTIConfigSet& operator=(const TTIConfigSet &rCopy);
void Encode(TLV &tlv) const;
void Decode(const TLV &tlv);
void Trace(MessageDataTracer &trace) const;
void SetElements(const TLVSList_TTIConfigElement &rElements)
{
m_Elements.CopyList(rElements);
}
void SetAppName(const char *pAppName);
void SetDescription(const char *pDescription);
void SetRemarks(const char *pRemarks);
void AddElement(const TTIConfigElement &rElement);
TLVSList_TTIConfigElement *GetElements();
const TLVSList_TTIConfigElement *GetElements() const;
const char *GetAppName() const;
const char *GetDescription() const;
const char *GetRemarks() const;
virtual TTIConfigList &GetListValue(const char* ParamName) const;
virtual uint32 GetUnsignedValue(const char* ParamName) const;
virtual int32 GetSignedValue(const char* ParamName) const;
virtual bool GetBoolValue(const char* ParamName) const;
virtual double GetDoubleValue(const char* ParamName) const;
virtual char GetCharValue(const char* ParamName) const;
virtual const char* GetStringValue(const char* ParamName) const;
virtual const byte* GetBlobValue(const char* ParamName, uint32& BlobLength) const;
virtual void SetUnsignedValue(const char* ParamName, const uint32 uiVal);
virtual void SetSignedValue(const char* ParamName, const int32 iVal);
virtual void SetBoolValue(const char* ParamName, const bool bVal);
virtual void SetDoubleValue(const char* ParamName, const double dVal);
virtual void SetCharValue(const char* ParamName, const char cVal);
virtual void SetStringValue(const char* ParamName, const char *pVal);
virtual void SetBlobValue(const char* ParamName, const byte* pVal, const uint32 uiBlobLength);
virtual void GetAsciiValue(const char* ParamName, TString &rTxt) const;
virtual void SetAsciiValue(const char* ParamName, TString &rTxt);
void AddConfigList(TTIConfigList &pConfigList);
void AddString(const char* EltName, const char* EltDesc, const char* Default);
void AddStringNoDefault(const char* EltName, const char* EltDesc);
void AddUnsigned(const char* EltName, const char* EltDesc, uint32 Default, uint32 iMin=0, uint32 iMax=0xffffffffUL);
void AddUnsignedNoDefault(const char* EltName, const char* EltDesc, uint32 iMin=0, uint32 iMax=0xffffffffUL);
void AddSigned(const char* EltName, const char* EltDesc, int32 Default, int iMin=(-2147483647L - 1), int iMax=2147483647L);
void AddSignedNoDefault(const char* EltName, const char* EltDesc, int32 iMin=(-2147483647L - 1), int32 iMax=2147483647L);
void AddBoolNoDefault(const char* EltName, const char* EltDesc);
void AddBool(const char* EltName, const char* EltDesc, bool Default);
void AddCharNoDefault(const char* EltName, const char* EltDesc);
void AddChar(const char* EltName, const char* EltDesc, char Default);
void AddDoubleNoDefault(const char* EltName, const char* EltDesc, double dMin=- 1.79769313486231500e+308 , double dMax= 1.79769313486231500e+308 );
void AddDouble(const char* EltName, const char* EltDesc, double Default, double dMin=- 1.79769313486231500e+308 , double dMax= 1.79769313486231500e+308 );
void AddBlobNoDefault(const char* EltName, const char* EltDesc);
void AddBlob(const char* EltName, const char* EltDesc, byte *BlobValue, uint32 BlobLength);
void UpdateFromAsciiSet(const TTIConfigSet &rAsciiSet, TTIConfigStatus& rStatus);
const char* GetStoragePath(void) const {
return (const char *)m_FullStoragePath;
}
TLVSList_TTIConfigElement m_Elements;
char * m_pAppName;
char * m_pDescription;
char * m_pRemarks;
TTIConfigElement *FindElement(const char *pName, bool fRaiseNotFound = false) const;
TString m_FullStoragePath;
private:
static const t_tag t_ELEMENTS;
static const t_tag t_APPNAME;
static const t_tag t_DESCRIPTION;
static const t_tag t_REMARKS;
};
# 37 "/home/core/include/TTIConfigList.h" 2
class TTIConfigStorage;
class TTIConfigList : public TTIConfigSet
{
public:
typedef std:: vector<TTIConfigSet> TTIConfigSet_array;
TTIConfigList();
TTIConfigList(const TTIConfigList &rCopy);
TTIConfigList(
const TLVSList_TTIConfigElement &rElements,
const char *pAppName,
const char *pDescription,
const char *pRemarks);
TTIConfigList(
const char *pAppName,
const char *pDescription,
const char *pRemarks);
uint32 GetCount();
TTIConfigSet *GetConfigSet(uint32 uiIndex);
TTIConfigSet *AddElement(const char *pName);
void DeleteElement(TTIConfigSet *pCS, TTIConfigStorage *pStorage = 0 );
void DeleteElement(const TString &rListName, TTIConfigStorage *pStorage = 0 );
private:
TTIConfigList(
TTIConfigSet& rParent,
const TTIConfigSet_array &rValueElements);
public:
virtual ~TTIConfigList();
TTIConfigList& operator=(const TTIConfigList &rCopy);
bool operator==(const TTIConfigList &rValue) const;
bool operator!=(const TTIConfigList &rValue) const
{
return !(*this == rValue);
}
virtual void Encode(TLV &tlv) const;
virtual void Decode(const TLV &tlv);
virtual void Trace(MessageDataTracer &trace) const;
void TTIConfigList::SetValueElements(const TTIConfigSet_array &rValueElements)
{
m_ValueElements = rValueElements;
SetBit(m_SetFields, t_VALUEELEMENTS);
}
bool IsSetValueElements() const
{
return GetBit(m_SetFields, t_VALUEELEMENTS);
}
const TTIConfigList::TTIConfigSet_array& TTIConfigList::GetValueElements() const
{
CheckBitSet(m_SetFields, t_VALUEELEMENTS);
return m_ValueElements;
}
TTIConfigList::TTIConfigSet_array &TTIConfigList::GetRefValueElements()
{
SetBit(m_SetFields, t_VALUEELEMENTS);
return m_ValueElements;
}
private:
TTIConfigSet_array m_ValueElements;
static const t_tag t_VALUEELEMENTS;
static const uint32 m_REQUIREDFIELDS;
uint32 m_SetFields;
};
# 9 "/home/core/include/CardLayer.h" 2
typedef uint32 HANDLE;
# 1 "/home/core/include/CardLayerDefs.h" 1
typedef const uint16 * LPCWSTR;
typedef uint16 * LPWSTR;
typedef struct {
byte
bCla,
bIns,
bP1,
bP2,
bP3;
} SCARD_T0_COMMAND, *LPSCARD_T0_COMMAND;
typedef struct _SCARD_IO_REQUEST{
uint32 dwProtocol;
uint32 cbPciLength;
} SCARD_IO_REQUEST, *PSCARD_IO_REQUEST, *LPSCARD_IO_REQUEST;
typedef struct {
SCARD_IO_REQUEST ioRequest;
byte
bSw1,
bSw2;
union
{
SCARD_T0_COMMAND CmdBytes;
byte rgbHeader[5];
};
} SCARD_T0_REQUEST;
typedef struct {
SCARD_IO_REQUEST ioRequest;
} SCARD_T1_REQUEST;
typedef struct {
const char * szReader;
void * pvUserData;
uint32 dwCurrentState;
uint32 dwEventState;
uint32 cbAtr;
byte rgbAtr[36];
} SCARD_READERSTATE_A;
typedef struct {
LPCWSTR szReader;
void * pvUserData;
uint32 dwCurrentState;
uint32 dwEventState;
uint32 cbAtr;
byte rgbAtr[36];
} SCARD_READERSTATE_W;
typedef const byte* LPCBYTE;
typedef uint32 SCARDCONTEXT;
typedef SCARDCONTEXT *PSCARDCONTEXT, *LPSCARDCONTEXT;
typedef uint32 SCARDHANDLE;
typedef SCARDHANDLE *PSCARDHANDLE, *LPSCARDHANDLE;
typedef SCARD_READERSTATE_A *PSCARD_READERSTATE_A, *LPSCARD_READERSTATE_A;
typedef SCARD_READERSTATE_W *PSCARD_READERSTATE_W, *LPSCARD_READERSTATE_W;
typedef const SCARD_IO_REQUEST *LPCSCARD_IO_REQUEST;
typedef SCARD_T0_REQUEST *PSCARD_T0_REQUEST, *LPSCARD_T0_REQUEST;
typedef SCARD_T1_REQUEST *PSCARD_T1_REQUEST, *LPSCARD_T1_REQUEST;
extern const SCARD_IO_REQUEST g_rgSCardT0Pci;
extern const SCARD_IO_REQUEST g_rgSCardT1Pci;
extern const SCARD_IO_REQUEST g_rgSCardRawPci;
extern int32
SCardEstablishContext(
uint32 dwScope,
const void * pvReserved1,
const void * pvReserved2,
LPSCARDCONTEXT phContext);
extern int32
SCardReleaseContext(
SCARDCONTEXT hContext);
extern int32
SCardListReaderGroupsA(
SCARDCONTEXT hContext,
char * mszGroups,
uint32 * pcchGroups);
extern int32
SCardListReaderGroupsW(
SCARDCONTEXT hContext,
LPWSTR mszGroups,
uint32 * pcchGroups);
extern int32
SCardListReadersA(
SCARDCONTEXT hContext,
const char * mszGroups,
char * mszReaders,
uint32 * pcchReaders);
extern int32
SCardListReadersW(
SCARDCONTEXT hContext,
LPCWSTR mszGroups,
LPWSTR mszReaders,
uint32 * pcchReaders);
extern int32
SCardGetStatusChangeA(
SCARDCONTEXT hContext,
uint32 dwTimeout,
LPSCARD_READERSTATE_A rgReaderStates,
uint32 cReaders);
extern int32
SCardGetStatusChangeW(
SCARDCONTEXT hContext,
uint32 dwTimeout,
LPSCARD_READERSTATE_W rgReaderStates,
uint32 cReaders);
extern int32
SCardConnectA(
SCARDCONTEXT hContext,
const char * szReader,
uint32 dwShareMode,
uint32 dwPreferredProtocols,
LPSCARDHANDLE phCard,
uint32 * pdwActiveProtocol);
extern int32
SCardConnectW(
SCARDCONTEXT hContext,
LPCWSTR szReader,
uint32 dwShareMode,
uint32 dwPreferredProtocols,
LPSCARDHANDLE phCard,
uint32 * pdwActiveProtocol);
extern int32
SCardReconnect(
SCARDHANDLE hCard,
uint32 dwShareMode,
uint32 dwPreferredProtocols,
uint32 dwInitialization,
uint32 * pdwActiveProtocol);
extern int32
SCardDisconnect(
SCARDHANDLE hCard,
uint32 dwDisposition);
extern int32
SCardBeginTransaction(
SCARDHANDLE hCard);
extern int32
SCardEndTransaction(
SCARDHANDLE hCard,
uint32 dwDisposition);
extern int32
SCardState(
SCARDHANDLE hCard,
uint32 * pdwState,
uint32 * pdwProtocol,
byte * pbAtr,
uint32 * pcbAtrLen);
extern int32
SCardStatusA(
SCARDHANDLE hCard,
char * szReaderName,
uint32 * pcchReaderLen,
uint32 * pdwState,
uint32 * pdwProtocol,
byte * pbAtr,
uint32 * pcbAtrLen);
extern int32
SCardStatusW(
SCARDHANDLE hCard,
LPWSTR szReaderName,
uint32 * pcchReaderLen,
uint32 * pdwState,
uint32 * pdwProtocol,
byte * pbAtr,
uint32 * pcbAtrLen);
extern int32
SCardTransmit(
SCARDHANDLE hCard,
LPCSCARD_IO_REQUEST pioSendPci,
LPCBYTE pbSendBuffer,
uint32 cbSendLength,
LPSCARD_IO_REQUEST pioRecvPci,
byte * pbRecvBuffer,
uint32 * pcbRecvLength);
extern int32
SCardControl(
SCARDHANDLE hCard,
uint32 dwControlCode,
const void * lpInBuffer,
uint32 nInBufferSize,
void * lpOutBuffer,
uint32 nOutBufferSize,
uint32 * lpBytesReturned);
extern int32
SCardGetAttrib(
SCARDHANDLE hCard,
uint32 dwAttrId,
byte * pbAttr,
uint32 * pcbAttrLen);
extern int32
SCardSetAttrib(
SCARDHANDLE hCard,
uint32 dwAttrId,
LPCBYTE pbAttr,
uint32 cbAttrLen);
extern int32
SCardCancel(
SCARDCONTEXT hContext);
# 35 "/home/core/include/CardLayer.h" 2
int32 TTIDriver_Initialize( void* , const char* RegistryPath, uint32 * Handle );
int32 TTIDriver_Unload( void * , uint32 Handle );
int32 TTIDeviceIoControl( uint32 hDevice, uint32 dwIoControlCode, void * lpInBuffer, uint32 nInBufferSize, void * lpOutBuffer, uint32 nOutBufferSize, uint32 * lpBytesReturned, void* lpOverlapped);
class Reader;
class Card;
void AddMultiStringToTStringList(const char* pMultiString, TStringList& StringList);
void TTISCARDExplainError( TString &ErrorText, int ErrorNumber);
class DriverInterface
{
public:
DriverInterface();
virtual ~DriverInterface();
TString m_Name;
TString m_RegistryLocation;
TString m_DLLName;
uint32 m_VersionHigh;
uint32 m_VersionLow;
bool m_Initialized;
uint32 m_Handle;
int32 m_DriverProcessId;
};
class DriverInfo
{
public:
int m_DriverType;
TString m_Name;
TString m_RegistryLocation;
TString m_DLLName;
uint32 m_VersionHigh;
uint32 m_VersionLow;
};
typedef std:: vector<DriverInterface> DriverInterfaceList;
class ReaderContext
{
public:
ReaderContext();
~ReaderContext();
int32 Init( uint32 Scope );
int32 Release(void);
int32 ListReaders( const char* szGroups, TStringList& ReaderList );
int32 ListReaderGroups( TStringList& GroupList );
int32 GetStatusChange( uint32 dwTimeout, SCARD_READERSTATE_A * ReaderStates, uint32 cReaders);
int32 Cancel( void );
bool GetReaderInfo( const char* Name, DriverInfo& Ri);
friend class Reader;
protected:
int32 PCSC_Init( uint32 Scope );
int32 PCSC_Release( void );
int32 PCSC_ListReaders( const char* szGroups, TStringList& ReaderList );
int32 PCSC_ListReaderGroups( TStringList& GroupList );
int32 PCSC_GetStatusChange( uint32 dwTimeout, SCARD_READERSTATE_A * ReaderStates, uint32 cReaders);
int32 PCSC_Cancel( void );
int32 TTI_Init( uint32 Scope );
int32 TTI_Release( void );
int32 TTI_ListReaders( const char* szGroups, TStringList& ReaderList );
int32 TTI_ListReaderGroups( TStringList& GroupList );
int32 TTI_GetStatusChange( uint32 dwTimeout, SCARD_READERSTATE_A * ReaderStates, uint32 cReaders);
int32 TTI_Cancel( void );
int32 TTIInitialize( const char* Name);
bool TTI_GetReaderInfo( const char* ReaderName, DriverInfo& Di);
int32 GetReaderMode( const char * ReaderName);
int32 GetTTIReaderIndex( const char* szName );
int32 TTIGetReaderHandle( const char* Name, uint32& Handle );
int32 TTIGetReaderHandle( const char* Name, uint32& Handle, int32& Index );
int m_ReaderListFlag;
bool m_UsePCSC;
bool m_UseTTI;
bool m_InitOk;
TStringList m_PCSCReaderList;
TStringList m_TTIReaderList;
SCARDCONTEXT m_CardContext;
bool m_CardContextUsed;
TTIConfigSet m_ConfigSet;
bool m_TTIConfigOk;
DriverInterfaceList m_TTIDriverList;
};
class Reader
{
public:
Reader();
virtual ~Reader();
virtual int32 Connect( ReaderContext& ReaderCtx, const char * szReader, uint32 dwShareMode, uint32 dwPreferredProtocols,
uint32& ActiveProtocol);
virtual int32 Reconnect( uint32 dwShareMode, uint32 dwPreferredProtocols,
uint32 dwInitialization, uint32& ActiveProtocol );
virtual int32 Disconnect( uint32 dwDisposition );
virtual int32 Eject( void );
virtual int32 BeginTransaction( void );
virtual int32 EndTransaction( uint32 dwDisposition );
virtual int32 Status( TStringList& ReaderNameList, uint32& State, uint32& Protocol, byte* pAtr, uint32& AtrLength);
virtual int32 Transmit( LPCSCARD_IO_REQUEST pioSendPci, const byte* pSendBuffer, uint32 SendLength,
LPSCARD_IO_REQUEST pioRecvPci, byte* pRecvBuffer, uint32& pRecvLength);
virtual int32 Control( uint32 dwControlCode, void* pInBuffer, uint32 InBufferSize,
void* pOutBuffer, uint32 OutBufferSize, uint32& BytesReturned );
virtual int32 GetAttrib( uint32 dwAttrId, byte* pAttr, uint32& AttrLen );
virtual int32 SetAttrib( uint32 dwAttrId, const byte* pAttr, uint32 AttrLength);
ReaderContext* GetReaderContext(void) {
return m_pReaderContext;
}
protected:
TString m_ReaderName;
ReaderContext* m_pReaderContext;
int m_ReaderType;
void InitData(const char* ReaderName);
private:
SCARDHANDLE m_CardHandle;
bool m_Connected;
uint32 m_TTIHandle;
int32 m_TTIIndex;
int32 TTI_Connect( const char * szReader, uint32 dwShareMode, uint32 dwPreferredProtocols, uint32& ActiveProtocol);
int32 PCSC_Connect( const char * szReader, uint32 dwShareMode, uint32 dwPreferredProtocols, uint32& ActiveProtocol);
int32 TTI_Disconnect( uint32 dwDisposition );
int32 PCSC_Disconnect( uint32 dwDisposition );
int32 PCSC_Transmit( LPCSCARD_IO_REQUEST pioSendPci, const byte* pSendBuffer, uint32 SendLength,
LPSCARD_IO_REQUEST pioRecvPci, byte* pRecvBuffer, uint32& pRecvLength);
int32 TTI_Transmit( LPCSCARD_IO_REQUEST pioSendPci, const byte* pSendBuffer, uint32 SendLength,
LPSCARD_IO_REQUEST pioRecvPci, byte* pRecvBuffer, uint32& pRecvLength);
int32 PCSC_Control( uint32 dwControlCode, void* pInBuffer, uint32 InBufferSize,
void* pOutBuffer, uint32 OutBufferSize, uint32& BytesReturned );
int32 TTI_Control( uint32 dwControlCode, void* pInBuffer, uint32 InBufferSize,
void* pOutBuffer, uint32 OutBufferSize, uint32& BytesReturned );
int32 PCSC_Reconnect( uint32 dwShareMode, uint32 dwPreferredProtocols, uint32 dwInitialization, uint32& ActiveProtocol );
int32 TTI_Reconnect( uint32 dwShareMode, uint32 dwPreferredProtocols, uint32 dwInitialization, uint32& ActiveProtocol );
int32 PCSC_BeginTransaction( void );
int32 TTI_BeginTransaction( void );
int32 PCSC_EndTransaction( uint32 dwDisposition );
int32 TTI_EndTransaction( uint32 dwDisposition );
int32 PCSC_Status( TStringList& ReaderNameList, uint32& State, uint32& Protocol, byte* pAtr, uint32& AtrLength);
int32 TTI_Status( TStringList& ReaderNameList, uint32& State, uint32& Protocol, byte* pAtr, uint32& AtrLength);
int32 PCSC_GetAttrib( uint32 dwAttrId, byte* pAttr, uint32& AttrLen );
int32 TTI_GetAttrib( uint32 dwAttrId, byte* pAttr, uint32& AttrLen );
int32 PCSC_SetAttrib( uint32 dwAttrId, const byte* pAttr, uint32 AttrLength);
int32 TTI_SetAttrib( uint32 dwAttrId, const byte* pAttr, uint32 AttrLength);
};
class TTIReaderException
{
public:
TTIReaderException( int32 ErrorCode ) {
m_ErrorCode=ErrorCode;
}
int32 m_ErrorCode;
};
class TTIReader: public Reader
{
public:
TTIReader();
virtual ~TTIReader();
int32 Init( ReaderContext& ReaderCtx, const char * szReader );
int32 CheckCardInsertion( uint32 Timeout = 0 );
int32 Connect( ReaderContext& ReaderCtx, const char * szReader, uint32 dwShareMode, uint32 dwPreferredProtocols,
uint32& ActiveProtocol);
int32 Disconnect( uint32 dwDisposition );
virtual int32 Eject( void );
void StartTrace( HANDLE f);
void CloseTrace( void );
int32 GetLastError(void);
void EnableExceptions( int32 EnableLevel );
void ExplainError(TString &ErrorText, int ErrorNumber);
void ExplainLastError(TString &ErrorText);
int32 Abort( void );
int32 InitGetMagStripe( uint32 TrackMask, uint32 Options );
int32 GetMagStripe(int TrackId, byte* pTrackData, int BufferSize, uint32 Timeout);
int32 InitGetPIN(uint32 Options);
int32 GetPIN(byte* pPIN, int BufferSize, uint32 Timeout);
int32 DisplayString( const char* Text);
int32 DisplayChar( const char Text);
int32 GetKey(uint32 Timeout = 0 );
int32 CheckForContactlessCards (byte *ATRBuffer, uint32 lenATRBuff, uint32 Timeout = 0) ;
int32 SelectContactlessCard (const byte *CSN) ;
int32 PowerDown(void);
int32 BeginTransaction( void );
int32 EndTransaction( uint32 dwDisposition );
private:
friend class Card;
int32 Reset(byte *pAnswer= 0 );
int32 APDU( const byte *pDataIn, uint LengthIn, BYTE *pDataOut, uint LengthOut, int32& CardStatus);
void TraceAPDUIn(const BYTE *DataIn,int LengthIn );
void TraceAPDUOut(const BYTE *DataOut,int LengthOut,int Status);
void FailureTrace( int32 Result );
int32 CheckCardConnection( void );
void WriteString(const char *Txt);
int32 m_LastError;
HANDLE m_TraceFileHandle;
int32 m_ExceptionLevel;
TString m_InternalReaderName;
bool m_InitOk;
bool m_ConnectDone;
uint32 m_ShareMode;
};
class Card
{
public:
Card();
virtual ~Card();
int32 AssignReader( TTIReader& Reader );
virtual int32 Reset(byte *pAnswer= 0 ) throw( TTIReaderException );
virtual int32 APDU( const byte *pDataIn, uint LengthIn=0, BYTE *pDataOut= 0 , uint LengthOut=0) throw( TTIReaderException );
virtual int32 APDUOk( const byte *pDataIn, uint LengthIn=0, BYTE *pDataOut= 0 , uint LengthOut=0) throw( TTIReaderException );
virtual int32 GetCardStatus(void);
int32 BeginTransaction() throw( TTIReaderException );
int32 EndTransaction( uint32 dwDisposition ) throw( TTIReaderException );
int32 GetLastError(void) throw( TTIReaderException);
void EnableExceptions( int32 EnableLevel );
virtual void ExplainError(TString &ErrorText, int ErrorNumber) throw( TTIReaderException);
virtual void ExplainLastError(TString &ErrorText) throw( TTIReaderException);
virtual int ExplainCardStatus( TString &Text, int32 Sw1Sw2 );
int32 CheckStatus( int Status ) throw( TTIReaderException );
int32 GetCurrentExceptionLevel(void);
int32 m_LastError;
virtual bool GetCardInfo(uint32& CardType, uint32& Subtype, TString& RegistryPath);
virtual void TransferCardInfo( const Card& SourceCard );
protected:
int SetParameterError( void ) throw( TTIReaderException );
private:
int32 CheckState() throw( TTIReaderException );
TTIReader* m_pReader;
bool m_ReaderFlag;
int32 m_ExceptionLevel;
int32 m_LastCardStatus;
uint32 m_CardType;
uint32 m_Subtype;
TString m_RegPath;
};
class CardlayerProgressCallback
{
public:
virtual void PCallback(uint i)=0;
};
# 3 "/home/core/Support/CardLayer/CardLayer.cpp" 2
HANDLE gMyHandle;
const SCARD_IO_REQUEST g_rgSCardT0Pci= {0x00000001 , 8};
const SCARD_IO_REQUEST g_rgSCardT1Pci= {0x00000002 , 8};
const SCARD_IO_REQUEST g_rgSCardRawPci= {0x00010000 , 8};
void TRACE(const char* Format,...);
void AddMultiStringToTStringList(const char* pMultiString, TStringList& StringList)
{
TString Tmp;
while( *pMultiString != 0 ) {
Tmp=pMultiString;
StringList.push_back( Tmp );
pMultiString+= strlen( pMultiString )+1;
}
}
ReaderContext::ReaderContext()
{
m_CardContext= 0 ;
m_CardContextUsed=false;
m_ReaderListFlag=0;
m_UseTTI=true;
m_UsePCSC=true;
m_TTIConfigOk=false;
m_InitOk=false;
}
ReaderContext::~ReaderContext()
{
if( m_CardContextUsed ) {
(void) PCSC_Release( );
}
}
int32 ReaderContext::Init( uint32 Scope )
{
int32 Status= ((uint32)0x8010001DL) ;
Status=TTI_Init( Scope );
m_InitOk=true;
if( m_UsePCSC ) {
Status=PCSC_Init( Scope );
if( Status != 0 ) {
m_UsePCSC=false;
Status= 0 ;
}
}
return Status;
}
int32 ReaderContext::Release(void)
{
int32 Status= ((uint32)0x8010001DL) ;
if( m_InitOk ) {
if( m_UsePCSC ) {
Status=PCSC_Release( );
if( Status != 0 )
return Status;
}
if( m_UseTTI ) {
Status=TTI_Release( );
}
}
return Status;
}
int32 ReaderContext::Cancel( void )
{
int32 Status= ((uint32)0x8010001DL) ;
if( m_InitOk ) {
if( m_UsePCSC ) {
Status=PCSC_Cancel( );
if( Status != 0 )
return Status;
}
if( m_UseTTI ) {
Status=TTI_Cancel( );
}
}
return Status;
}
int32 ReaderContext::ListReaders( const char* szGroup, TStringList& ReaderList )
{
int32 Status= ((uint32)0x8010001DL) ;
bool ListTTI=false;
bool ListPCSC=false;
if( szGroup == 0 ) {
ListTTI=true;
ListPCSC=true;
} else {
if( *szGroup== 0 ) {
ListTTI=true;
ListPCSC=true;
} else if( stricmp(szGroup, "tti" ) == 0 ) {
ListTTI=true;
} else if( ( stricmp(szGroup, "pc/sc") == 0 ) || (stricmp(szGroup, "pcsc") == 0) ) {
ListPCSC=true;
}
}
if( m_InitOk ) {
ReaderList.clear();
if( m_UsePCSC && ListPCSC ) {
Status=PCSC_ListReaders( 0 , ReaderList );
if( Status != 0 ) {
TRACE( "ListReaders failed on PCSC_ListReaders, Status: %x\n", Status);
Status= 0 ;
}
}
if( m_UseTTI & ListTTI) {
Status=TTI_ListReaders( szGroup, ReaderList );
if( Status != 0 ) {
TRACE( "ListReaders failed on TTI_ListReaders, Status: %x\n", Status);
}
}
if( szGroup == 0 ) {
m_ReaderListFlag=1;
}
}
return Status;
}
int32 ReaderContext::ListReaderGroups( TStringList& GroupList )
{
int32 Status= ((uint32)0x8010001DL) ;
if( m_InitOk ) {
GroupList.clear();
if( m_UsePCSC ) {
Status = PCSC_ListReaderGroups( GroupList );
if( Status != 0 )
return Status;
}
if( m_UseTTI ) {
Status = TTI_ListReaderGroups( GroupList );
}
}
return Status;
}
int32 ReaderContext::GetStatusChange( uint32 dwTimeout, SCARD_READERSTATE_A * ReaderStates, uint32 cReaders)
{
int32 Status= ((uint32)0x8010001DL) ;
unsigned PCSCCount=0;
unsigned TTICount=0;
uint32 i;
bool Error=false;
if( m_InitOk ) {
std:: auto_ptr< SCARD_READERSTATE_A > pPCSCStates( new SCARD_READERSTATE_A [cReaders] );
std:: auto_ptr< SCARD_READERSTATE_A > pTTIStates( new SCARD_READERSTATE_A [cReaders] );
if( ( pPCSCStates.get() == 0 ) || ( pTTIStates.get() == 0 ) ) {
return ((uint32)0x80100006L) ;
}
for(i=0; i<cReaders; i++) {
switch( GetReaderMode( ReaderStates[i].szReader ) ) {
case 1:
memcpy( pPCSCStates.get() + PCSCCount, ReaderStates+i, sizeof(SCARD_READERSTATE_A ) );
PCSCCount++;
break;
case 2:
memcpy( pTTIStates.get() + TTICount, ReaderStates+i, sizeof(SCARD_READERSTATE_A ) );
TTICount++;
break;
default:
Error=true;
}
}
if( Error ) {
TRACE("Error in GetStatusChange\n");
return ((uint32)0x80100009L) ;
}
if( PCSCCount > 0 ) {
Status=PCSC_GetStatusChange( dwTimeout, pPCSCStates.get(), PCSCCount );
if( Status != 0 ) {
return Status;
}
}
if( TTICount > 0 ) {
Status=TTI_GetStatusChange( dwTimeout, pTTIStates.get(), TTICount );
}
PCSCCount=TTICount=0;
for(i=0; i<cReaders; i++) {
switch( GetReaderMode( ReaderStates[i].szReader ) ) {
case 1:
memcpy( ReaderStates+i, pPCSCStates.get() + PCSCCount, sizeof(SCARD_READERSTATE_A ) );
PCSCCount++;
break;
case 2:
memcpy( ReaderStates+i, pTTIStates.get() + TTICount, sizeof(SCARD_READERSTATE_A ) );
TTICount++;
break;
default:
(( 0 )?(void)0:__assert(0,"0","/home/core/Support/CardLayer/CardLayer.cpp",241)) ;
TRACE("Invalid reader mode in GetStatusChange\n");
return ((uint32)0x80100009L) ;
}
}
}
return Status;
}
int32 ReaderContext::GetReaderMode( const char * ReaderName)
{
unsigned i;
unsigned length;
if( !m_InitOk )
return ((uint32)0x8010001DL) ;
if( !m_ReaderListFlag ) {
TStringList DummyList;
if( ListReaders( 0 , DummyList) != 0 ) {
TRACE("GetReaderMode: failed to get the reader list\n");
return ((uint32)0x8010001DL) ;
}
m_ReaderListFlag=1;
}
length=m_PCSCReaderList.size();
for(i=0;i<length;i++) {
if( stricmp( ReaderName, m_PCSCReaderList[i] ) == 0 ) {
return 1;
}
}
length=m_TTIReaderList.size();
for(i=0;i<length;i++) {
if( stricmp( ReaderName, m_TTIReaderList[i] ) == 0 ) {
return 2;
}
}
TRACE("GetReaderMode: Reader %s not found\n", ReaderName);
return 0;
}
Reader::Reader()
{
m_Connected=false;
m_pReaderContext= 0 ;
m_CardHandle= 0 ;
m_TTIIndex=0;
m_TTIHandle=0;
m_ReaderType=0;
}
Reader::~Reader()
{
}
int32 Reader::Connect( ReaderContext& ReaderCtx, const char * szReader, uint32 dwShareMode, uint32 dwPreferredProtocols, uint32& ActiveProtocol )
{
int32 zStatus= ((uint32)0x8010001DL) ;
m_pReaderContext= &ReaderCtx;
m_ReaderType=ReaderCtx.GetReaderMode( szReader );
switch( m_ReaderType ) {
case 1: zStatus=PCSC_Connect( szReader, dwShareMode, dwPreferredProtocols, ActiveProtocol );
break;
case 2: zStatus=TTI_Connect( szReader, dwShareMode, dwPreferredProtocols, ActiveProtocol );
break;
default:
TRACE("Unknown reader in Connect\n");
return ((uint32)0x80100009L) ;
};
if( zStatus == 0 ) {
m_ReaderName= szReader;
m_Connected=true;
}
return zStatus;
}
int32 Reader::Disconnect( uint32 dwDisposition )
{
switch( m_ReaderType ) {
case 1: return PCSC_Disconnect( dwDisposition );
case 2:
if( dwDisposition == 3 )
Eject();
return TTI_Disconnect( dwDisposition );
default:
return ((uint32)0x80100009L) ;
}
}
int32 Reader::Transmit( LPCSCARD_IO_REQUEST pioSendPci, const byte* pSendBuffer, uint32 SendLength,
LPSCARD_IO_REQUEST pioRecvPci, byte* pRecvBuffer, uint32& pRecvLength)
{
if( !m_Connected )
return ((uint32)0x80100010L) ;
switch( m_ReaderType ) {
case 1: return PCSC_Transmit( pioSendPci, pSendBuffer, SendLength,
pioRecvPci, pRecvBuffer, pRecvLength );
case 2: return TTI_Transmit( pioSendPci, pSendBuffer, SendLength,
pioRecvPci, pRecvBuffer, pRecvLength );
default:
return ((uint32)0x80100009L) ;
}
}
int32 Reader::Control( uint32 dwControlCode, void* pInBuffer, uint32 InBufferSize,
void* pOutBuffer, uint32 OutBufferSize, uint32& BytesReturned )
{
switch( m_ReaderType ) {
case 1: return PCSC_Control( dwControlCode, pInBuffer, InBufferSize, pOutBuffer,
OutBufferSize, BytesReturned );
case 2: return TTI_Control( dwControlCode, pInBuffer, InBufferSize, pOutBuffer,
OutBufferSize, BytesReturned );
default:
return ((uint32)0x80100009L) ;
}
}
int32 Reader::Eject( void )
{
uint32 l=0;
return Control( ( (( 0x00000031 ) << 16) | (( 0 ) << 14) | (( ( 6 ) ) << 2) | ( 0 ) ) , 0 , 0, 0 , 0, l );
}
int32 Reader::Reconnect( uint32 dwShareMode, uint32 dwPreferredProtocols,
uint32 dwInitialization, uint32& pdwActiveProtocol )
{
switch( m_ReaderType ) {
case 1: return PCSC_Reconnect( dwShareMode, dwPreferredProtocols,
dwInitialization, pdwActiveProtocol );
case 2: return TTI_Reconnect( dwShareMode, dwPreferredProtocols,
dwInitialization, pdwActiveProtocol );
default:
return ((uint32)0x80100009L) ;
}
}
int32 Reader::BeginTransaction( void )
{
switch( m_ReaderType ) {
case 1: return PCSC_BeginTransaction();
case 2: return TTI_BeginTransaction();
default:
return ((uint32)0x80100009L) ;
}
}
int32 Reader::EndTransaction( uint32 dwDisposition )
{
switch( m_ReaderType ) {
case 1: return PCSC_EndTransaction( dwDisposition );
case 2: return TTI_EndTransaction( dwDisposition );
default:
return ((uint32)0x80100009L) ;
}
}
int32 Reader::Status( TStringList& ReaderNameList, uint32& State, uint32& Protocol, byte* pAtr, uint32& AtrLength)
{
switch( m_ReaderType ) {
case 1: return PCSC_Status(ReaderNameList, State, Protocol, pAtr, AtrLength);
case 2: return TTI_Status(ReaderNameList, State, Protocol, pAtr, AtrLength);
default:
return ((uint32)0x80100009L) ;
}
}
int32 Reader::GetAttrib( uint32 dwAttrId, byte* pAttr, uint32& AttrLen )
{
switch( m_ReaderType ) {
case 1: return PCSC_GetAttrib( dwAttrId, pAttr, AttrLen );
case 2: return TTI_GetAttrib( dwAttrId, pAttr, AttrLen );
default:
return ((uint32)0x80100009L) ;
}
}
int32 Reader::SetAttrib( uint32 dwAttrId, const byte* pAttr, uint32 AttrLength)
{
switch( m_ReaderType ) {
case 1: return PCSC_SetAttrib( dwAttrId, pAttr, AttrLength );
case 2: return TTI_SetAttrib( dwAttrId, pAttr, AttrLength );
default:
return ((uint32)0x80100009L) ;
}
}
void TTISCARDExplainError( TString &ErrorText, int ErrorNumber)
{
switch( ErrorNumber ) {
case 0 : ErrorText="No error"; break;
case ((uint32)0xA0100001L) : ErrorText="Unexpected card status (SW1-SW2)"; break;
case ((uint32)0xA0100002L) : ErrorText="Invalid card reply length"; break;
case ((uint32)0x80100001L) : ErrorText="An internal consistency check failed"; break;
case ((uint32)0x80100002L) : ErrorText="The action was cancelled by an SCardCancel request"; break;
case ((uint32)0x80100003L) : ErrorText="The supplied handle was invalid"; break;
case ((uint32)0x80100004L) : ErrorText="One or more of the supplied parameters could not be properly interpreted"; break;
case ((uint32)0x80100005L) : ErrorText="Registry startup information is missing or invalid"; break;
case ((uint32)0x80100006L) : ErrorText="Not enough memory available to complete this command"; break;
case ((uint32)0x80100007L) : ErrorText="An internal consistency timer has expired"; break;
case ((uint32)0x80100008L) : ErrorText="The data buffer to receive returned data is too small for the returned data"; break;
case ((uint32)0x80100009L) : ErrorText="The specified reader name is not recognized"; break;
case ((uint32)0x8010000AL) : ErrorText="The user-specified timeout value has expired"; break;
case ((uint32)0x8010000BL) : ErrorText="The smart card cannot be accessed because of other connections outstanding"; break;
case ((uint32)0x8010000CL) : ErrorText="The operation requires a Smart Card, but no Smart Card is currently in the device"; break;
case ((uint32)0x8010000DL) : ErrorText="The specified smart card name is not recognized"; break;
case ((uint32)0x8010000EL) : ErrorText="The system could not dispose of the media in the requested manner"; break;
case ((uint32)0x8010000FL) : ErrorText="The requested protocols are incompatible with the protocol currently in use with the smart card"; break;
case ((uint32)0x80100010L) : ErrorText="The reader or smart card is not ready to accept commands"; break;
case ((uint32)0x80100011L) : ErrorText="One or more of the supplied parameters values could not be properly interpreted"; break;
case ((uint32)0x80100012L) : ErrorText="The action was cancelled by the system, presumably to log off or shut down"; break;
case ((uint32)0x80100013L) : ErrorText="An internal communications error has been detected"; break;
case ((uint32)0x80100014L) : ErrorText="An internal error has been detected, but the source is unknown"; break;
case ((uint32)0x80100015L) : ErrorText="An ATR obtained from the registry is not a valid ATR string"; break;
case ((uint32)0x80100016L) : ErrorText="An attempt was made to end a non-existent transaction"; break;
case ((uint32)0x80100017L) : ErrorText="The specified reader is not currently available for use"; break;
case ((uint32)0x80100018L) : ErrorText="PRIVATE -- Internal flag to force server termination"; break;
case ((uint32)0x80100019L) : ErrorText="The PCI Receive buffer was too small"; break;
case ((uint32)0x8010001AL) : ErrorText="The reader driver does not meet minimal requirements for support"; break;
case ((uint32)0x8010001BL) : ErrorText="The reader driver did not produce a unique reader name"; break;
case ((uint32)0x8010001CL) : ErrorText="The smart card does not meet minimal requirements for support"; break;
case ((uint32)0x8010001DL) : ErrorText="The Smart card resource manager is not running"; break;
case ((uint32)0x8010001EL) : ErrorText="The Smart card resource manager has shut down"; break;
case ((uint32)0x80100065L) : ErrorText="The reader cannot communicate with the smart card, due to ATR configuration conflicts"; break;
case ((uint32)0x80100066L) : ErrorText="The smart card is not responding to a reset"; break;
case ((uint32)0x80100067L) : ErrorText="Power has been removed from the smart card, so that further communication is not possible"; break;
case ((uint32)0x80100068L) : ErrorText="The smart card has been reset, so any shared state information is invalid"; break;
case ((uint32)0x80100069L) : ErrorText="The smart card has been removed, so that further communication is not possible"; break;
case ((uint32)0xA0100003L) : ErrorText="The object isn't initialized properly"; break;
default: ErrorText.Format("Error %x", ErrorNumber );
}
}
bool ReaderContext::GetReaderInfo( const char* ReaderName, DriverInfo& Di)
{
uint i,length;
if( !m_InitOk )
return false;
if( !m_ReaderListFlag ) {
TStringList DummyList;
if( ListReaders( 0 , DummyList) != 0 ) {
TRACE("GetReaderMode: failed to get the reader list\n");
return false;
}
m_ReaderListFlag=1;
}
length=m_PCSCReaderList.size();
for(i=0;i<length;i++) {
if( stricmp( ReaderName, m_PCSCReaderList[i] ) == 0 ) {
Di.m_DriverType=0;
Di.m_Name=m_PCSCReaderList[i];
Di.m_RegistryLocation="";
Di.m_DLLName="";
Di.m_VersionHigh=0;
Di.m_VersionLow=0;
return true;
}
}
length=m_TTIReaderList.size();
for(i=0;i<length;i++) {
if( stricmp( ReaderName, m_TTIReaderList[i] ) == 0 ) {
return TTI_GetReaderInfo( ReaderName, Di );
}
}
return false;
}
More information about the Gcc-prs
mailing list