# 1 "ArcEngine.cxx" # 1 "" # 1 "" # 1 "ArcEngine.cxx" #pragma implementation # 1 "splib.h" 1 # 1 "../config.h" 1 # 8 "splib.h" 2 # 10 "ArcEngine.cxx" 2 # 1 "../include/ArcEngine.h" 1 #pragma interface # 1 "../include/Event.h" 1 #pragma interface # 1 "../include/Link.h" 1 namespace OpenSP { class Link { public: Link(); Link(Link *); virtual ~Link(); private: Link *next_; friend class IListBase; friend class IListIterBase; friend class IQueueBase; }; inline Link::Link() : next_(0) { } inline Link::Link(Link *next) : next_(next) { } } # 11 "../include/Event.h" 2 # 1 "../include/Allocator.h" 1 # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 1 3 4 # 152 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 3 4 typedef long int ptrdiff_t; # 214 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 3 4 typedef long unsigned int size_t; # 8 "../include/Allocator.h" 2 namespace OpenSP { class Allocator { public: Allocator(size_t maxSize, unsigned blocksPerSegment); ~Allocator(); void *alloc(size_t); static void *allocSimple(size_t); static void free(void *); union ForceAlign { unsigned long n; struct { char c; } s; char *cp; long *lp; }; struct SegmentHeader; union BlockHeader; friend union BlockHeader; union BlockHeader { SegmentHeader *seg; ForceAlign align; }; struct Block; friend struct Block; struct Block { BlockHeader header; Block *next; }; friend struct SegmentHeader; struct SegmentHeader { union { Block **freeList; ForceAlign align; }; unsigned liveCount; SegmentHeader *next; }; private: Allocator(const Allocator &); Allocator &operator=(const Allocator &); Block *freeList_; size_t objectSize_; unsigned blocksPerSegment_; SegmentHeader *segments_; void *alloc1(); void tooBig(size_t); }; } # 12 "../include/Event.h" 2 # 1 "../include/Location.h" 1 #pragma interface # 1 "../include/types.h" 1 # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/limits.h" 1 3 4 # 11 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/limits.h" 3 4 # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/syslimits.h" 1 3 4 # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/limits.h" 1 3 4 # 122 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/limits.h" 3 4 # 1 "/usr/include/limits.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/limits.h" 1 3 4 # 26 "/usr/include/gentoo-multilib/amd64/limits.h" 3 4 # 1 "/usr/include/features.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/features.h" 1 3 4 # 309 "/usr/include/gentoo-multilib/amd64/features.h" 3 4 # 1 "/usr/include/sys/cdefs.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/sys/cdefs.h" 1 3 4 # 9 "/usr/include/sys/cdefs.h" 2 3 4 # 310 "/usr/include/gentoo-multilib/amd64/features.h" 2 3 4 # 332 "/usr/include/gentoo-multilib/amd64/features.h" 3 4 # 1 "/usr/include/gnu/stubs.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/gnu/stubs.h" 1 3 4 # 1 "/usr/include/bits/wordsize.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/bits/wordsize.h" 1 3 4 # 9 "/usr/include/bits/wordsize.h" 2 3 4 # 5 "/usr/include/gentoo-multilib/amd64/gnu/stubs.h" 2 3 4 # 1 "/usr/include/gnu/stubs-64.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/gnu/stubs-64.h" 1 3 4 # 5 "/usr/include/gnu/stubs-64.h" 2 3 4 # 10 "/usr/include/gentoo-multilib/amd64/gnu/stubs.h" 2 3 4 # 9 "/usr/include/gnu/stubs.h" 2 3 4 # 333 "/usr/include/gentoo-multilib/amd64/features.h" 2 3 4 # 9 "/usr/include/features.h" 2 3 4 # 27 "/usr/include/gentoo-multilib/amd64/limits.h" 2 3 4 # 144 "/usr/include/gentoo-multilib/amd64/limits.h" 3 4 # 1 "/usr/include/bits/posix1_lim.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/bits/posix1_lim.h" 1 3 4 # 153 "/usr/include/gentoo-multilib/amd64/bits/posix1_lim.h" 3 4 # 1 "/usr/include/bits/local_lim.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/bits/local_lim.h" 1 3 4 # 36 "/usr/include/gentoo-multilib/amd64/bits/local_lim.h" 3 4 # 1 "/usr/include/linux/limits.h" 1 3 4 # 37 "/usr/include/gentoo-multilib/amd64/bits/local_lim.h" 2 3 4 # 9 "/usr/include/bits/local_lim.h" 2 3 4 # 154 "/usr/include/gentoo-multilib/amd64/bits/posix1_lim.h" 2 3 4 # 9 "/usr/include/bits/posix1_lim.h" 2 3 4 # 145 "/usr/include/gentoo-multilib/amd64/limits.h" 2 3 4 # 1 "/usr/include/bits/posix2_lim.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/bits/posix2_lim.h" 1 3 4 # 9 "/usr/include/bits/posix2_lim.h" 2 3 4 # 149 "/usr/include/gentoo-multilib/amd64/limits.h" 2 3 4 # 1 "/usr/include/bits/xopen_lim.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/bits/xopen_lim.h" 1 3 4 # 34 "/usr/include/gentoo-multilib/amd64/bits/xopen_lim.h" 3 4 # 1 "/usr/include/bits/stdio_lim.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/bits/stdio_lim.h" 1 3 4 # 9 "/usr/include/bits/stdio_lim.h" 2 3 4 # 35 "/usr/include/gentoo-multilib/amd64/bits/xopen_lim.h" 2 3 4 # 9 "/usr/include/bits/xopen_lim.h" 2 3 4 # 153 "/usr/include/gentoo-multilib/amd64/limits.h" 2 3 4 # 9 "/usr/include/limits.h" 2 3 4 # 123 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/limits.h" 2 3 4 # 8 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/syslimits.h" 2 3 4 # 12 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/limits.h" 2 3 4 # 8 "../include/types.h" 2 # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 1 3 4 # 9 "../include/types.h" 2 namespace OpenSP { typedef unsigned int Unsigned32; typedef int Signed32; typedef Unsigned32 Number; typedef Unsigned32 Offset; typedef Unsigned32 Index; typedef Unsigned32 Char; typedef Signed32 Xchar; # 40 "../include/types.h" typedef Unsigned32 UnivChar; typedef Unsigned32 WideChar; typedef Unsigned32 SyntaxChar; typedef unsigned short CharClassIndex; typedef unsigned Token; typedef unsigned short EquivCode; } # 11 "../include/Location.h" 2 # 1 "../include/Boolean.h" 1 namespace OpenSP { typedef bool Boolean; typedef bool PackedBoolean; # 28 "../include/Boolean.h" } # 12 "../include/Location.h" 2 # 1 "../include/Ptr.h" 1 # 13 "../include/Ptr.h" namespace OpenSP { template class Ptr { public: Ptr() : ptr_(0) { } Ptr(T *ptr); ~Ptr(); Ptr(const Ptr &); Ptr &operator=(const Ptr &); Ptr &operator=(T *); T *pointer() const { return ptr_; } T *operator->() const { return ptr_; } T &operator*() const { return *ptr_; } void swap(Ptr &p) { T *tem = p.ptr_; p.ptr_ = ptr_; ptr_ = tem; } Boolean isNull() const { return ptr_ == 0; } void clear(); Boolean operator==(const Ptr &p) const { return ptr_ == p.ptr_; } Boolean operator!=(const Ptr &p) const { return ptr_ != p.ptr_; } Boolean operator==(const T *p) const { return ptr_ == p; } Boolean operator!=(const T *p) const { return ptr_ != p; } private: T *ptr_; }; template class ConstPtr : private Ptr { public: ConstPtr() { } ConstPtr(T *ptr) : Ptr(ptr) { } ConstPtr(const Ptr &p) : Ptr(p) { } ConstPtr(const ConstPtr &p) : Ptr(p) { } ConstPtr &operator=(const Ptr &p) { Ptr::operator=(p); return *this; } ConstPtr &operator=(const ConstPtr &p) { Ptr::operator=(p); return *this; } ConstPtr &operator=(T *p) { Ptr::operator=(p); return *this; } const T *pointer() const { return Ptr::pointer(); } const T *operator->() const { return Ptr::pointer(); } const T &operator*() const { return *Ptr::pointer(); } void swap(ConstPtr &p) { Ptr::swap(p); } Ptr::isNull; Ptr::clear; Boolean operator==(const Ptr &p) const { return Ptr::operator==(p); } Boolean operator!=(const Ptr &p) const { return Ptr::operator!=(p); } Boolean operator==(const ConstPtr &p) const { return Ptr::operator==(p); } Boolean operator!=(const ConstPtr &p) const { return Ptr::operator!=(p); } }; } # 1 "../include/Ptr.cxx" 1 namespace OpenSP { template Ptr::Ptr(T *ptr) : ptr_(ptr) { if (ptr_) ptr_->ref(); } template Ptr::~Ptr() { if (ptr_) { if (ptr_->unref()) delete ptr_; ptr_ = 0; } } template Ptr::Ptr(const Ptr &p) : ptr_(p.ptr_) { if (p.ptr_) p.ptr_->ref(); } template Ptr &Ptr::operator=(const Ptr &p) { if (p.ptr_) p.ptr_->ref(); if (ptr_ && ptr_->unref()) delete ptr_; ptr_ = p.ptr_; return *this; } template Ptr &Ptr::operator=(T *p) { if (p) p->ref(); if (ptr_ && ptr_->unref()) delete ptr_; ptr_ = p; return *this; } template void Ptr::clear() { if (ptr_) { if (ptr_->unref()) delete ptr_; ptr_ = 0; } } } # 92 "../include/Ptr.h" 2 # 13 "../include/Location.h" 2 # 1 "../include/Resource.h" 1 namespace OpenSP { class Resource { public: Resource(); Resource(const Resource &); int unref(); void ref(); int count() const; private: int count_; }; inline Resource::Resource() : count_(0) { } inline Resource::Resource(const Resource &) : count_(0) { } inline int Resource::count() const { return count_; } inline int Resource::unref() { return --count_ <= 0; } inline void Resource::ref() { ++count_; } } # 14 "../include/Location.h" 2 # 1 "../include/Vector.h" 1 # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 1 3 4 # 8 "../include/Vector.h" 2 # 1 "../include/xnew.h" 1 # 20 "../include/xnew.h" # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/g++-v4/new" 1 3 # 41 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/g++-v4/new" 3 # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/g++-v4/cstddef" 1 3 # 47 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/g++-v4/cstddef" 3 # 48 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/g++-v4/cstddef" 3 #pragma GCC visibility push(default) # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 1 3 4 # 51 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/g++-v4/cstddef" 2 3 namespace std { using ::ptrdiff_t; using ::size_t; } #pragma GCC visibility pop # 42 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/g++-v4/new" 2 3 # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/g++-v4/exception" 1 3 # 40 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/g++-v4/exception" 3 #pragma GCC visibility push(default) extern "C++" { namespace std { # 54 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/g++-v4/exception" 3 class exception { public: exception() throw() { } virtual ~exception() throw(); virtual const char* what() const throw(); }; class bad_exception : public exception { public: bad_exception() throw() { } virtual ~bad_exception() throw(); }; typedef void (*terminate_handler) (); typedef void (*unexpected_handler) (); terminate_handler set_terminate(terminate_handler) throw(); void terminate() __attribute__ ((__noreturn__)); unexpected_handler set_unexpected(unexpected_handler) throw(); void unexpected() __attribute__ ((__noreturn__)); # 102 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/g++-v4/exception" 3 bool uncaught_exception() throw(); } namespace __gnu_cxx { # 117 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/g++-v4/exception" 3 void __verbose_terminate_handler (); } } #pragma GCC visibility pop # 43 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/g++-v4/new" 2 3 #pragma GCC visibility push(default) extern "C++" { namespace std { class bad_alloc : public exception { public: bad_alloc() throw() { } virtual ~bad_alloc() throw(); }; struct nothrow_t { }; extern const nothrow_t nothrow; typedef void (*new_handler)(); new_handler set_new_handler(new_handler) throw(); } # 84 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/g++-v4/new" 3 void* operator new(std::size_t) throw (std::bad_alloc); void* operator new[](std::size_t) throw (std::bad_alloc); void operator delete(void*) throw(); void operator delete[](void*) throw(); void* operator new(std::size_t, const std::nothrow_t&) throw(); void* operator new[](std::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(std::size_t, void* __p) throw() { return __p; } inline void* operator new[](std::size_t, void* __p) throw() { return __p; } inline void operator delete (void*, void*) throw() { } inline void operator delete[](void*, void*) throw() { } } #pragma GCC visibility pop # 21 "../include/xnew.h" 2 # 9 "../include/Vector.h" 2 namespace OpenSP { template class Vector { public: typedef size_t size_type; typedef T *iterator; typedef const T *const_iterator; Vector() : ptr_(0), size_(0), alloc_(0) { } Vector(size_t n) : ptr_(0), size_(0), alloc_(0) { append(n); } virtual ~Vector(); void resize(size_t n) { if (n < size_) erase(ptr_ + n, ptr_ + size_); else if (n > size_) append(n - size_); } Vector(size_t, const T &); Vector(const Vector &); Vector &operator=(const Vector &); void assign(size_t, const T &); void push_back(const T &t) { reserve(size_ + 1); (void)new (ptr_ + size_) T(t); size_++; } void insert(const_iterator p, size_t n, const T &t); void insert(const_iterator p, const_iterator q1, const_iterator q2); void swap(Vector &); void clear() { erase(ptr_, ptr_ + size_); } size_t size() const { return size_; } T &operator[](size_t i) { return ptr_[i]; } const T &operator[](size_t i) const { return ptr_[i]; } iterator begin() { return ptr_; } const_iterator begin() const { return ptr_; } T &back() { return ptr_[size_ - 1]; } const T &back() const { return ptr_[size_ - 1]; } void reserve(size_t n) { if (n > alloc_) reserve1(n); } iterator erase(const_iterator, const_iterator); private: void append(size_t); void reserve1(size_t); size_t size_; T *ptr_; size_t alloc_; }; } # 1 "../include/Vector.cxx" 1 # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 1 3 4 # 8 "../include/Vector.cxx" 2 # 1 "/usr/include/string.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/string.h" 1 3 4 # 26 "/usr/include/gentoo-multilib/amd64/string.h" 3 4 # 1 "/usr/include/features.h" 1 3 4 # 27 "/usr/include/gentoo-multilib/amd64/string.h" 2 3 4 extern "C" { # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 1 3 4 # 34 "/usr/include/gentoo-multilib/amd64/string.h" 2 3 4 extern void *memcpy (void *__restrict __dest, __const void *__restrict __src, size_t __n) throw () __attribute__ ((__nonnull__ (1, 2))); extern void *memmove (void *__dest, __const void *__src, size_t __n) throw () __attribute__ ((__nonnull__ (1, 2))); extern void *memccpy (void *__restrict __dest, __const void *__restrict __src, int __c, size_t __n) throw () __attribute__ ((__nonnull__ (1, 2))); extern void *memset (void *__s, int __c, size_t __n) throw () __attribute__ ((__nonnull__ (1))); extern int memcmp (__const void *__s1, __const void *__s2, size_t __n) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern void *memchr (__const void *__s, int __c, size_t __n) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); extern void *rawmemchr (__const void *__s, int __c) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); extern void *memrchr (__const void *__s, int __c, size_t __n) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); extern char *strcpy (char *__restrict __dest, __const char *__restrict __src) throw () __attribute__ ((__nonnull__ (1, 2))); extern char *strncpy (char *__restrict __dest, __const char *__restrict __src, size_t __n) throw () __attribute__ ((__nonnull__ (1, 2))); extern char *strcat (char *__restrict __dest, __const char *__restrict __src) throw () __attribute__ ((__nonnull__ (1, 2))); extern char *strncat (char *__restrict __dest, __const char *__restrict __src, size_t __n) throw () __attribute__ ((__nonnull__ (1, 2))); extern int strcmp (__const char *__s1, __const char *__s2) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern int strncmp (__const char *__s1, __const char *__s2, size_t __n) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern int strcoll (__const char *__s1, __const char *__s2) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern size_t strxfrm (char *__restrict __dest, __const char *__restrict __src, size_t __n) throw () __attribute__ ((__nonnull__ (2))); # 1 "/usr/include/xlocale.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/xlocale.h" 1 3 4 # 28 "/usr/include/gentoo-multilib/amd64/xlocale.h" 3 4 typedef struct __locale_struct { struct locale_data *__locales[13]; const unsigned short int *__ctype_b; const int *__ctype_tolower; const int *__ctype_toupper; const char *__names[13]; } *__locale_t; # 9 "/usr/include/xlocale.h" 2 3 4 # 119 "/usr/include/gentoo-multilib/amd64/string.h" 2 3 4 extern int strcoll_l (__const char *__s1, __const char *__s2, __locale_t __l) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); extern size_t strxfrm_l (char *__dest, __const char *__src, size_t __n, __locale_t __l) throw () __attribute__ ((__nonnull__ (2, 4))); extern char *strdup (__const char *__s) throw () __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); extern char *strndup (__const char *__string, size_t __n) throw () __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1))); # 165 "/usr/include/gentoo-multilib/amd64/string.h" 3 4 extern char *strchr (__const char *__s, int __c) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); extern char *strrchr (__const char *__s, int __c) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); extern char *strchrnul (__const char *__s, int __c) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); extern size_t strcspn (__const char *__s, __const char *__reject) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern size_t strspn (__const char *__s, __const char *__accept) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern char *strpbrk (__const char *__s, __const char *__accept) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern char *strstr (__const char *__haystack, __const char *__needle) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern char *strtok (char *__restrict __s, __const char *__restrict __delim) throw () __attribute__ ((__nonnull__ (2))); extern char *__strtok_r (char *__restrict __s, __const char *__restrict __delim, char **__restrict __save_ptr) throw () __attribute__ ((__nonnull__ (2, 3))); extern char *strtok_r (char *__restrict __s, __const char *__restrict __delim, char **__restrict __save_ptr) throw () __attribute__ ((__nonnull__ (2, 3))); extern char *strcasestr (__const char *__haystack, __const char *__needle) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern void *memmem (__const void *__haystack, size_t __haystacklen, __const void *__needle, size_t __needlelen) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 3))); extern void *__mempcpy (void *__restrict __dest, __const void *__restrict __src, size_t __n) throw () __attribute__ ((__nonnull__ (1, 2))); extern void *mempcpy (void *__restrict __dest, __const void *__restrict __src, size_t __n) throw () __attribute__ ((__nonnull__ (1, 2))); extern size_t strlen (__const char *__s) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); extern size_t strnlen (__const char *__string, size_t __maxlen) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); extern char *strerror (int __errnum) throw (); # 281 "/usr/include/gentoo-multilib/amd64/string.h" 3 4 extern char *strerror_r (int __errnum, char *__buf, size_t __buflen) throw () __attribute__ ((__nonnull__ (2))); extern void __bzero (void *__s, size_t __n) throw () __attribute__ ((__nonnull__ (1))); extern void bcopy (__const void *__src, void *__dest, size_t __n) throw () __attribute__ ((__nonnull__ (1, 2))); extern void bzero (void *__s, size_t __n) throw () __attribute__ ((__nonnull__ (1))); extern int bcmp (__const void *__s1, __const void *__s2, size_t __n) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern char *index (__const char *__s, int __c) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); extern char *rindex (__const char *__s, int __c) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); extern int ffs (int __i) throw () __attribute__ ((__const__)); extern int ffsl (long int __l) throw () __attribute__ ((__const__)); __extension__ extern int ffsll (long long int __ll) throw () __attribute__ ((__const__)); extern int strcasecmp (__const char *__s1, __const char *__s2) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern int strcasecmp_l (__const char *__s1, __const char *__s2, __locale_t __loc) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3))); extern int strncasecmp_l (__const char *__s1, __const char *__s2, size_t __n, __locale_t __loc) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 4))); extern char *strsep (char **__restrict __stringp, __const char *__restrict __delim) throw () __attribute__ ((__nonnull__ (1, 2))); extern int strverscmp (__const char *__s1, __const char *__s2) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); extern char *strsignal (int __sig) throw (); extern char *__stpcpy (char *__restrict __dest, __const char *__restrict __src) throw () __attribute__ ((__nonnull__ (1, 2))); extern char *stpcpy (char *__restrict __dest, __const char *__restrict __src) throw () __attribute__ ((__nonnull__ (1, 2))); extern char *__stpncpy (char *__restrict __dest, __const char *__restrict __src, size_t __n) throw () __attribute__ ((__nonnull__ (1, 2))); extern char *stpncpy (char *__restrict __dest, __const char *__restrict __src, size_t __n) throw () __attribute__ ((__nonnull__ (1, 2))); extern char *strfry (char *__string) throw () __attribute__ ((__nonnull__ (1))); extern void *memfrob (void *__s, size_t __n) throw () __attribute__ ((__nonnull__ (1))); extern char *basename (__const char *__filename) throw () __attribute__ ((__nonnull__ (1))); # 426 "/usr/include/gentoo-multilib/amd64/string.h" 3 4 } # 9 "/usr/include/string.h" 2 3 4 # 9 "../include/Vector.cxx" 2 namespace OpenSP { template Vector::~Vector() { if (ptr_) { erase(ptr_, ptr_ + size_); ::operator delete((void *)ptr_); } } template Vector::Vector(const Vector &v) : ptr_(0), size_(0), alloc_(0) { insert(ptr_ + size_, v.ptr_, v.ptr_ + v.size_); } template Vector::Vector(size_t n, const T &t) : ptr_(0), size_(0), alloc_(0) { insert(ptr_ + size_, n, t); } template Vector &Vector::operator=(const Vector &v) { if (&v != this) { size_t n = v.size_; if (n > size_) { n = size_; insert(ptr_ + size_, v.ptr_ + size_, v.ptr_ + v.size_); } else if (n < size_) erase(ptr_ + n, ptr_ + size_); while (n-- > 0) ptr_[n] = v.ptr_[n]; } return *this; } template void Vector::assign(size_t n, const T &t) { size_t sz = n; if (n > size_) { sz = size_; insert(ptr_ + size_, n - size_, t); } else if (n < size_) erase(ptr_ + n, ptr_ + size_); while (sz-- > 0) ptr_[sz] = t; } template void Vector::insert(const T *p, size_t n, const T &t) { size_t i = p - ptr_; reserve(size_ + n); if (i != size_) memmove(ptr_ + i + n, ptr_ + i, (size_ - i)*sizeof(T)); for (T *pp = ptr_ + i; n-- > 0; pp++) { (void)new (pp) T(t); size_++; } } template void Vector::insert(const T *p, const T *q1, const T *q2) { size_t i = p - ptr_; size_t n = q2 - q1; reserve(size_ + n); if (i != size_) memmove(ptr_ + i + n, ptr_ + i, (size_ - i)*sizeof(T)); for (T *pp = ptr_ + i; q1 != q2; q1++, pp++) { (void)new (pp) T(*q1); size_++; } } template void Vector::swap(Vector &v) { { T *tem = ptr_; ptr_ = v.ptr_; v.ptr_ = tem; } { size_t tem = size_; size_ = v.size_; v.size_ = tem; } { size_t tem = alloc_; alloc_ = v.alloc_; v.alloc_ = tem; } } template void Vector::append(size_t n) { reserve(size_ + n); while (n-- > 0) (void)new (ptr_ + size_++) T; } template T *Vector::erase(const T *p1, const T *p2) { typedef T X; for (const T *p = p1; p != p2; p++) ((X *)p)->~X(); if (p2 != ptr_ + size_) memmove((T *)p1, p2, ((const T *)(ptr_ + size_) - p2)*sizeof(T)); size_ -= p2 - p1; return (T *)p1; } template void Vector::reserve1(size_t size) { size_t newAlloc = alloc_*2; if (size > newAlloc) newAlloc += size; void *p = ::operator new(newAlloc * sizeof(T)); alloc_ = newAlloc; if (ptr_) { memcpy(p, ptr_, size_*sizeof(T)); ::operator delete((void *)ptr_); } ptr_ = (T *)p; } } # 78 "../include/Vector.h" 2 # 16 "../include/Location.h" 2 # 1 "../include/Owner.h" 1 # 12 "../include/Owner.h" namespace OpenSP { template class Owner { public: Owner() : p_(0) { } Owner(T *p) : p_(p) { } virtual ~Owner(); void operator=(T *p) { if (p_) del(); p_ = p; } operator int() const { return p_ != 0; } T *pointer() const { return p_; } T *operator->() const { return p_; } T &operator*() const { return *p_; } void swap(Owner &x) { T *tem = p_; p_ = x.p_; x.p_ = tem; } T *extract() { T *tem = p_; p_ = 0; return tem; } void clear() { if (p_) { del(); p_ = 0; } } private: Owner(const Owner &); void operator=(const Owner &o); void del(); T *p_; }; } # 1 "../include/Owner.cxx" 1 namespace OpenSP { template Owner::~Owner() { if (p_) delete p_; } template void Owner::del() { delete p_; } } # 60 "../include/Owner.h" 2 # 17 "../include/Location.h" 2 # 1 "../include/StringC.h" 1 # 1 "../include/StringOf.h" 1 # 14 "../include/StringOf.h" # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 1 3 4 # 15 "../include/StringOf.h" 2 # 1 "/usr/include/string.h" 1 3 4 # 16 "../include/StringOf.h" 2 namespace OpenSP { template class String { public: typedef size_t size_type; typedef T *iterator; typedef const T *const_iterator; String(); ~String() { if (ptr_) delete [] ptr_; } String(const T *, size_t); String(const String &); String &operator=(const String &); size_t size() const { return length_; } String &assign(const T *, size_t); String &insert(size_t i, const String &s); void swap(String &str); T operator[](size_t i) const { return ptr_[i]; } T &operator[](size_t i) { return ptr_[i]; } iterator begin() { return ptr_; } const_iterator begin() const { return ptr_; } const T *data() const { return ptr_; } String &operator+=(T c) { if (length_ >= alloc_) grow(1); ptr_[length_++] = c; return *this; } String &operator+=(const String &s) { append(s.ptr_, s.length_); return *this; } String &append(const T *, size_t); Boolean operator==(const String &s) const { return (length_ == s.length_ && (length_ == 0 || (*ptr_ == *s.ptr_ && (memcmp(ptr_ + 1, s.ptr_ + 1, (length_ - 1)*sizeof(T)) == 0)))); } Boolean operator!=(const String &str) const { return !(*this == str); } void resize(size_t n); private: void grow(size_t); T *ptr_; size_t length_; size_t alloc_; }; } # 1 "../include/StringOf.cxx" 1 # 1 "/usr/include/string.h" 1 3 4 # 8 "../include/StringOf.cxx" 2 # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 1 3 4 # 9 "../include/StringOf.cxx" 2 namespace OpenSP { template String::String(const T *ptr, size_t length) : length_(length), alloc_(length) { if (length) { ptr_ = new T[length]; memcpy(ptr_, ptr, length*sizeof(T)); } else ptr_ = 0; } template String::String() : ptr_(0), length_(0), alloc_(0) { } template String::String(const String &s) : length_(s.length_), alloc_(s.length_) { if (length_) { ptr_ = new T[length_]; memcpy(ptr_, s.ptr_, length_*sizeof(T)); } else ptr_ = 0; } template String &String::operator=(const String &s) { if (&s != this) { if (s.length_ > alloc_) { T *oldPtr = ptr_; ptr_ = new T[alloc_ = s.length_]; if (oldPtr) delete [] oldPtr; } memcpy(ptr_, s.ptr_, s.length_*sizeof(T)); length_ = s.length_; } return *this; } template String &String::insert(size_t i, const String &s) { if (length_ + s.length_ > alloc_) grow(s.length_); for (size_t n = length_ - i; n > 0; n--) ptr_[i + n - 1 + s.length_] = ptr_[i + n - 1]; length_ += s.length_; memcpy(ptr_ + i, s.ptr_, s.length_*sizeof(T)); return *this; } template String &String::append(const T *p, size_t length) { if (length_ + length > alloc_) grow(length); memcpy(ptr_ + length_, p, length*sizeof(T)); length_ += length; return *this; } template void String::grow(size_t n) { size_t newAlloc = alloc_; if (alloc_ < n) newAlloc += n + 16; else newAlloc += alloc_; T *s = new T[newAlloc]; memcpy(s, ptr_, length_*sizeof(T)); delete [] ptr_; ptr_ = s; alloc_ = newAlloc; } template void String::swap(String &to) { { T *tem = to.ptr_; to.ptr_ = ptr_; ptr_ = tem; } { size_t tem = to.length_; to.length_ = length_; length_ = tem; } { size_t tem = to.alloc_; to.alloc_ = alloc_; alloc_ = tem; } } template String &String::assign(const T *p, size_t n) { if (alloc_ < n) { T *oldPtr = ptr_; ptr_ = new T[n]; alloc_ = n; if (oldPtr) delete [] oldPtr; } length_ = n; for(T *to = ptr_; n > 0; n--, to++, p++) *to = *p; return *this; } template void String::resize(size_t n) { if (alloc_ < n) { T *oldPtr = ptr_; ptr_ = new T[n]; alloc_ = n; if (length_ > 0) { memcpy(ptr_, oldPtr, length_*sizeof(T)); delete [] oldPtr; } } length_ = n; } } # 79 "../include/StringOf.h" 2 # 9 "../include/StringC.h" 2 namespace OpenSP { typedef String StringC; } # 18 "../include/Location.h" 2 # 1 "../include/rtti.h" 1 # 19 "../include/Location.h" 2 namespace OpenSP { class ExternalInfo; class EntityOrigin; class InputSourceOrigin; class Entity; class EntityDecl; class Location; class Markup; class Text; class NamedCharRef; class Origin : public Resource { public: virtual ~Origin(); virtual const EntityOrigin *asEntityOrigin() const; virtual const InputSourceOrigin *asInputSourceOrigin() const; virtual const Location &parent() const = 0; virtual Index refLength() const; virtual Boolean origChars(const Char *&) const; virtual Boolean inBracketedTextOpenDelim() const; virtual Boolean inBracketedTextCloseDelim() const; virtual Boolean isNumericCharRef(const Markup *&markup) const; virtual Boolean isNamedCharRef(Index ind, NamedCharRef &ref) const; virtual const EntityDecl *entityDecl() const; virtual Boolean defLocation(Offset off, const Origin *&, Index &) const; virtual const Markup *markup() const; virtual const Entity *entity() const; virtual const ExternalInfo *externalInfo() const; virtual Offset startOffset(Index ind) const; const StringC *entityName() const; }; class ProxyOrigin : public Origin { public: ProxyOrigin(const Origin *origin); const EntityOrigin *asEntityOrigin() const; const InputSourceOrigin *asInputSourceOrigin() const; const Location &parent() const; Index refLength() const; Boolean origChars(const Char *&) const; Boolean inBracketedTextOpenDelim() const; Boolean inBracketedTextCloseDelim() const; Boolean isNumericCharRef(const Markup *&markup) const; Boolean isNamedCharRef(Index ind, NamedCharRef &ref) const; const EntityDecl *entityDecl() const; Boolean defLocation(Offset off, const Origin *&, Index &) const; const Markup *markup() const; const Entity *entity() const; const ExternalInfo *externalInfo() const; Offset startOffset(Index ind) const; private: const Origin *origin_; }; class Location { public: Location(); Location(Origin *, Index); Location(ConstPtr, Index); void operator+=(Index i) { index_ += i; } void operator-=(Index i) { index_ -= i; } Index index() const { return index_; } const ConstPtr &origin() const { return origin_; } void clear() { origin_.clear(); } void swap(Location &to) { origin_.swap(to.origin_); Index tem = to.index_; to.index_ = index_; index_ = tem; } private: ConstPtr origin_; Index index_; }; class ExternalInfo { public: virtual ~ExternalInfo(); }; class NamedCharRef { public: enum RefEndType { endOmitted, endRE, endRefc }; NamedCharRef(); NamedCharRef(Index, RefEndType, const StringC &); Index refStartIndex() const; RefEndType refEndType() const; const StringC &origName() const; void set(Index, RefEndType, const Char *, size_t); private: Index refStartIndex_; RefEndType refEndType_; StringC origName_; }; struct InputSourceOriginNamedCharRef { Index replacementIndex; size_t origNameOffset; Index refStartIndex; NamedCharRef::RefEndType refEndType; }; class InputSourceOrigin : public Origin { public: virtual void noteCharRef(Index replacementIndex, const NamedCharRef &) = 0; virtual void setExternalInfo(ExternalInfo *) = 0; virtual InputSourceOrigin *copy() const = 0; static InputSourceOrigin *make(); static InputSourceOrigin *make(const Location &refLocation); }; class BracketOrigin : public Origin { public: enum Position { open, close }; BracketOrigin(const Location &, Position); const Location &parent() const; Boolean inBracketedTextOpenDelim() const; Boolean inBracketedTextCloseDelim() const; private: Position pos_; Location loc_; }; class ReplacementOrigin : public Origin { public: ReplacementOrigin(const Location &, Char origChar); const Location &parent() const; Boolean origChars(const Char *&) const; private: Location loc_; Char origChar_; }; class MultiReplacementOrigin : public Origin { public: MultiReplacementOrigin(const Location &, StringC &origChars); const Location &parent() const; Boolean origChars(const Char *&) const; private: Location loc_; StringC origChars_; }; inline Index NamedCharRef::refStartIndex() const { return refStartIndex_; } inline NamedCharRef::RefEndType NamedCharRef::refEndType() const { return refEndType_; } inline const StringC &NamedCharRef::origName() const { return origName_; } } # 13 "../include/Event.h" 2 # 1 "../include/Vector.h" 1 # 14 "../include/Event.h" 2 # 1 "../include/Owner.h" 1 # 15 "../include/Event.h" 2 # 1 "../include/Ptr.h" 1 # 18 "../include/Event.h" 2 # 1 "../include/Notation.h" 1 #pragma interface # 1 "../include/Owner.h" 1 # 11 "../include/Notation.h" 2 # 1 "../include/NamedResource.h" 1 # 1 "../include/Named.h" 1 # 10 "../include/Named.h" namespace OpenSP { class Named { public: Named(const StringC &name) : name_(name) { } virtual ~Named() { } const StringC &name() const { return name_; } const StringC *namePointer() const { return &name_; } void setName(const StringC &name) { name_ = name; } void swap(Named &to) { name_.swap(to.name_); } private: StringC name_; }; } # 8 "../include/NamedResource.h" 2 namespace OpenSP { class NamedResource : public Named, public Resource { public: NamedResource(const StringC &str) : Named(str) { } }; } # 13 "../include/Notation.h" 2 # 1 "../include/Ptr.h" 1 # 15 "../include/Notation.h" 2 # 1 "../include/ExternalId.h" 1 #pragma interface # 1 "../include/Text.h" 1 #pragma interface # 1 "../include/Vector.h" 1 # 13 "../include/Text.h" 2 # 1 "../include/SubstTable.h" 1 # 9 "../include/SubstTable.h" # 1 "../include/Vector.h" 1 # 10 "../include/SubstTable.h" 2 namespace OpenSP { class SubstTable { public: SubstTable(); void addSubst(Char from, Char to); void subst(Char &) const; void subst(StringC &) const; Char operator[](Char from) const; void sort() const; Char at(Char from) const; StringC inverse(Char to) const; void inverseTable(SubstTable &) const; struct Pair { Pair() {} Pair(Char f, Char t) : from(f), to(t) {} Char from; Char to; }; private: Char lo_[256]; mutable Vector map_; mutable bool isSorted_; }; inline void SubstTable::subst(StringC &str) const { for (size_t i = 0; i < str.size(); i++) subst(str[i]); } inline Char SubstTable::operator[](Char t) const { if (t < 256) return lo_[t]; else return at(t); } inline void SubstTable::subst(Char &c) const { c = operator[](c); } } # 15 "../include/Text.h" 2 # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 1 3 4 # 16 "../include/Text.h" 2 namespace OpenSP { struct TextItem { TextItem(); enum Type { data, cdata, sdata, nonSgml, entityStart, entityEnd, startDelim, endDelim, endDelimA, ignore }; Type type; Char c; Location loc; size_t index; }; class Text { public: Text(); ~Text(); void clear(); void swap(Text &to); void addChar(Char c, const Location &); void addChars(const StringC &, const Location &); void addChars(const Char *, size_t, const Location &); void insertChars(const StringC &, const Location &); void ignoreChar(Char, const Location &); void ignoreLastChar(); void addNonSgmlChar(Char c, const Location &); void addEntityStart(const Location &); void addEntityEnd(const Location &); void addCdata(const StringC &, const ConstPtr &); void addSdata(const StringC &, const ConstPtr &); void addStartDelim(const Location &loc); void addEndDelim(const Location &loc, Boolean lita); void subst(const SubstTable &, Char space); void addCharsTokenize(const Char *, size_t, const Location &loc, Char space); void addCharsTokenize(const StringC &, const Location &loc, Char space); void tokenize(Char space, Text &text) const; Location charLocation(size_t i) const; Boolean charLocation(size_t, const Origin *&, Index &) const; Boolean charLocation(size_t i, const ConstPtr *&, Index &) const; size_t size() const; Char lastChar() const; const StringC &string() const; size_t normalizedLength(size_t normsep) const; Boolean fixedEqual(const Text &) const; Boolean startDelimLocation(Location &) const; Boolean endDelimLocation(Location &) const; Boolean delimType(Boolean &lita) const; private: void addSimple(TextItem::Type, const Location &); StringC chars_; Vector items_; friend class TextIter; }; class TextIter { public: TextIter(const Text &); void rewind(); Boolean next(TextItem::Type &, const Char *&, size_t &, const Location *&); Boolean valid() const; void advance(); TextItem::Type type() const; const Location &location() const; const Char *chars(size_t &length) const; private: const TextItem *ptr_; const Text *text_; }; inline size_t Text::size() const { return chars_.size(); } inline Char Text::lastChar() const { return chars_[chars_.size() - 1]; } inline const StringC &Text::string() const { return chars_; } inline void Text::addEntityStart(const Location &loc) { addSimple(TextItem::entityStart, loc); } inline void Text::addEntityEnd(const Location &loc) { addSimple(TextItem::entityEnd, loc); } inline void Text::addChars(const StringC &s, const Location &loc) { addChars(s.data(), s.size(), loc); } inline void Text::addStartDelim(const Location &loc) { addSimple(TextItem::startDelim, loc); } inline void Text::addEndDelim(const Location &loc, Boolean lita) { addSimple(lita ? TextItem::endDelimA : TextItem::endDelim, loc); } inline void Text::addCharsTokenize(const StringC &str, const Location &loc, Char space) { addCharsTokenize(str.data(), str.size(), loc, space); } inline Location Text::charLocation(size_t i) const { const ConstPtr *originP; Index index; if (charLocation(i, originP, index)) return Location(*originP, index); else return Location(); } inline Boolean Text::charLocation(size_t i, const Origin *&origin, Index &index) const { const ConstPtr *originP; if (charLocation(i, originP, index)) { origin = originP->pointer(); return 1; } else return 0; } inline void TextIter::rewind() { ptr_ = text_->items_.begin(); } inline void TextIter::advance() { ptr_++; } inline Boolean TextIter::valid() const { return ptr_ != (text_->items_.begin() + text_->items_.size()); } inline const Location &TextIter::location() const { return ptr_->loc; } inline TextItem::Type TextIter::type() const { return ptr_->type; } } # 13 "../include/ExternalId.h" 2 # 1 "../include/Message.h" 1 #pragma interface # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 1 3 4 # 12 "../include/Message.h" 2 # 1 "../include/Vector.h" 1 # 14 "../include/Message.h" 2 # 1 "../include/CopyOwner.h" 1 # 1 "../include/Owner.h" 1 # 8 "../include/CopyOwner.h" 2 namespace OpenSP { template class CopyOwner : public Owner { public: CopyOwner() { } CopyOwner(T *p) : Owner(p) { } CopyOwner(const CopyOwner &); void operator=(const CopyOwner &o); void operator=(T *p) { Owner::operator=(p); } }; } # 1 "../include/CopyOwner.cxx" 1 namespace OpenSP { template CopyOwner::CopyOwner(const CopyOwner &o) : Owner(o.pointer() ? o.pointer()->copy() : 0) { } template void CopyOwner::operator=(const CopyOwner &o) { Owner::operator=(o.pointer() ? o.pointer()->copy() : 0); } } # 31 "../include/CopyOwner.h" 2 # 15 "../include/Message.h" 2 # 1 "../include/MessageArg.h" 1 #pragma interface # 1 "../include/Vector.h" 1 # 12 "../include/MessageArg.h" 2 namespace OpenSP { class MessageBuilder; class MessageArg { public: MessageArg(); virtual ~MessageArg(); virtual MessageArg *copy() const = 0; virtual void append(MessageBuilder &) const = 0; }; class StringMessageArg : public MessageArg { public: StringMessageArg(const StringC &); MessageArg *copy() const; void append(MessageBuilder &) const; private: StringC s_; }; class NumberMessageArg : public MessageArg { public: NumberMessageArg(unsigned long); MessageArg *copy() const; void append(MessageBuilder &) const; private: unsigned long n_; }; class OrdinalMessageArg : public MessageArg { public: OrdinalMessageArg(unsigned long); MessageArg *copy() const; void append(MessageBuilder &) const; private: unsigned long n_; }; class OtherMessageArg : public MessageArg { public: OtherMessageArg(); void append(MessageBuilder &) const; }; class StringVectorMessageArg : public MessageArg { public: StringVectorMessageArg(const Vector &); MessageArg *copy() const; void append(MessageBuilder &) const; private: Vector v_; }; } # 18 "../include/Message.h" 2 namespace OpenSP { class MessageModule; extern MessageModule libModule; extern MessageModule appModule; class MessageFragment { public: MessageFragment(const MessageModule *module, unsigned number, const char *text = 0); const MessageModule *module() const; unsigned number() const; const char *text() const; private: unsigned short number_; const MessageModule * module_; protected: unsigned char spare_; private: const char *text_; }; class MessageType : public MessageFragment { public: enum Severity { info, warning, quantityError, idrefError, error }; MessageType(Severity = info, const MessageModule *module = &libModule, unsigned number = unsigned(-1), const char *text = 0, const char *clauses = 0, const char *auxText = 0); Severity severity() const; MessageFragment auxFragment() const; Boolean isError() const; const char *clauses() const; private: const char *clauses_; const char *auxText_; }; class MessageType0 : public MessageType { public: MessageType0(Severity = info, const MessageModule *module = &libModule, unsigned number = unsigned(-1), const char *text = 0, const char *clauses = 0); }; class MessageType1 : public MessageType { public: MessageType1(Severity = info, const MessageModule *module = &libModule, unsigned number = unsigned(-1), const char *text = 0, const char *clauses = 0); }; class MessageType2 : public MessageType { public: MessageType2(Severity = info, const MessageModule *module = &libModule, unsigned number = unsigned(-1), const char *text = 0, const char *clauses = 0); }; class MessageType3 : public MessageType { public: MessageType3(Severity = info, const MessageModule *module = &libModule, unsigned number = unsigned(-1), const char *text = 0, const char *clauses = 0); }; class MessageType4 : public MessageType { public: MessageType4(Severity = info, const MessageModule *module = &libModule, unsigned number = unsigned(-1), const char *text = 0, const char *clauses = 0); }; class MessageType5 : public MessageType { public: MessageType5(Severity = info, const MessageModule *module = &libModule, unsigned number = unsigned(-1), const char *text = 0, const char *clauses = 0); }; class MessageType6 : public MessageType { public: MessageType6(Severity = info, const MessageModule *module = &libModule, unsigned number = unsigned(-1), const char *text = 0, const char *clauses = 0); }; class MessageType0L : public MessageType { public: MessageType0L(Severity = info, const MessageModule *module = &libModule, unsigned number = unsigned(-1), const char *text = 0, const char *clauses = 0, const char *auxText = 0); }; class MessageType1L : public MessageType { public: MessageType1L(Severity = info, const MessageModule *module = &libModule, unsigned number = unsigned(-1), const char *text = 0, const char *clauses = 0, const char *auxText = 0); }; class OpenElementInfo { public: OpenElementInfo(); PackedBoolean included; StringC gi; StringC matchType; unsigned matchIndex; }; class Message { public: Message(); Message(int nArgs); const MessageType *type; Location loc; Location auxLoc; Vector > args; Vector openElementInfo; void swap(Message &); Boolean isError() const; }; class Messenger { public: Messenger(); virtual ~Messenger(); void message(const MessageType0 &); void message(const MessageType1 &, const MessageArg &); void message(const MessageType2 &, const MessageArg &, const MessageArg &); void message(const MessageType3 &, const MessageArg &, const MessageArg &, const MessageArg &); void message(const MessageType4 &, const MessageArg &, const MessageArg &, const MessageArg &, const MessageArg &); void message(const MessageType5 &, const MessageArg &, const MessageArg &, const MessageArg &, const MessageArg &, const MessageArg &); void message(const MessageType6 &, const MessageArg &, const MessageArg &, const MessageArg &, const MessageArg &, const MessageArg &, const MessageArg &); void message(const MessageType0L &, const Location &); void message(const MessageType1L &, const MessageArg &, const Location &); void setNextLocation(const Location &); virtual void initMessage(Message &); virtual void dispatchMessage(const Message &) = 0; virtual void dispatchMessage(Message &); private: void doInitMessage(Message &); Boolean haveNextLocation_; Location nextLocation_; }; class ForwardingMessenger : public Messenger { public: ForwardingMessenger(Messenger &); void dispatchMessage(const Message &); void dispatchMessage(Message &); void initMessage(Message &); private: Messenger *to_; }; class ParentLocationMessenger : public ForwardingMessenger { public: ParentLocationMessenger(Messenger &); void initMessage(Message &); }; class NullMessenger : public Messenger { public: NullMessenger(); void dispatchMessage(const Message &); }; inline const MessageModule *MessageFragment::module() const { return module_; } inline unsigned MessageFragment::number() const { return number_; } inline const char *MessageFragment::text() const { return text_; } inline MessageType::Severity MessageType::severity() const { return Severity(spare_); } inline MessageFragment MessageType::auxFragment() const { return MessageFragment(module(), number() + 1, auxText_ ); } inline Boolean MessageType::isError() const { return severity() != info && severity() != warning; } inline const char *MessageType::clauses() const { return clauses_; } inline Boolean Message::isError() const { return type->isError(); } } # 15 "../include/ExternalId.h" 2 namespace OpenSP { class CharsetInfo; class PublicId { public: enum Type { informal, fpi, urn }; enum TextClass { CAPACITY, CHARSET, DOCUMENT, DTD, ELEMENTS, ENTITIES, LPD, NONSGML, NOTATION, SD, SHORTREF, SUBDOC, SYNTAX, TEXT }; enum OwnerType { ISO, registered, unregistered }; PublicId(); Boolean getOwnerType(OwnerType &) const; Boolean getOwner(StringC &) const; Boolean getTextClass(TextClass &) const; Boolean getUnavailable(Boolean &) const; Boolean getDescription(StringC &) const; Boolean getLanguage(StringC &) const; Boolean getDesignatingSequence(StringC &) const; Boolean getDisplayVersion(StringC &) const; Boolean getNamespaceIdentifier(StringC &) const; Boolean getNamespaceSpecificString(StringC &) const; Type init(Text &, const CharsetInfo &, Char space, const MessageType1 *&fpierror, const MessageType1 *&urnerror); const StringC &string() const; const Text &text() const; const Type type() const { return type_; } private: Boolean initFpi(const StringC &, const CharsetInfo &, Char, const MessageType1 *&); Boolean initUrn(const StringC &, const CharsetInfo &, Char, const MessageType1 *&); static Boolean nextField(Char solidus, const Char *&next, const Char *lim, const Char *&fieldStart, size_t &fieldLength, Boolean dup = 1); static Boolean lookupTextClass(const StringC &, const CharsetInfo &, TextClass &); static const char *const textClasses[]; Type type_; OwnerType ownerType_; StringC owner_; TextClass textClass_; PackedBoolean unavailable_; StringC description_; StringC languageOrDesignatingSequence_; PackedBoolean haveDisplayVersion_; StringC displayVersion_; Text text_; StringC nid_; StringC nss_; }; class ExternalId { public: ExternalId(); const StringC *systemIdString() const; const StringC *publicIdString() const; const StringC &effectiveSystemId() const; const Text *systemIdText() const; const Text *publicIdText() const; const PublicId *publicId() const; void setSystem(Text &); void setEffectiveSystem(StringC &); PublicId::Type setPublic(Text &, const CharsetInfo &, Char space, const MessageType1 *&fpierror, const MessageType1 *&urnerror); void setLocation(const Location &); const Location &location() const; private: PackedBoolean haveSystem_; PackedBoolean havePublic_; Text system_; PublicId public_; Location loc_; StringC effectiveSystem_; }; inline const StringC &PublicId::string() const { return text_.string(); } inline const Text &PublicId::text() const { return text_; } inline const StringC *ExternalId::systemIdString() const { return haveSystem_ ? &system_.string() : 0; } inline const StringC *ExternalId::publicIdString() const { return havePublic_ ? &public_.string() : 0; } inline const Text *ExternalId::systemIdText() const { return haveSystem_ ? &system_ : 0; } inline const Text *ExternalId::publicIdText() const { return havePublic_ ? &public_.text() : 0; } inline const PublicId *ExternalId::publicId() const { return havePublic_ ? &public_ : 0; } inline const Location &ExternalId::location() const { return loc_; } inline const StringC &ExternalId::effectiveSystemId() const { return effectiveSystem_; } inline void ExternalId::setEffectiveSystem(StringC &str) { str.swap(effectiveSystem_); } } # 16 "../include/Notation.h" 2 # 1 "../include/Attributed.h" 1 # 1 "../include/Ptr.h" 1 # 8 "../include/Attributed.h" 2 # 1 "../include/Attribute.h" 1 #pragma interface # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 1 3 4 # 11 "../include/Attribute.h" 2 # 1 "../include/Owner.h" 1 # 13 "../include/Attribute.h" 2 # 1 "../include/Vector.h" 1 # 15 "../include/Attribute.h" 2 # 1 "../include/CopyOwner.h" 1 # 16 "../include/Attribute.h" 2 # 1 "../include/Ptr.h" 1 # 19 "../include/Attribute.h" 2 namespace OpenSP { class Entity; class Notation; class DeclaredValue; class AttributeValue; class TokenizedAttributeValue; class AttributeSemantics; class AttributeContext; class Syntax; class AttributeValue : public Resource { public: enum Type { implied, cdata, tokenized }; AttributeValue(); virtual ~AttributeValue(); virtual AttributeSemantics *makeSemantics(const DeclaredValue *, AttributeContext &, const StringC &, unsigned &, unsigned &) const; virtual Type info(const Text *&, const StringC *&) const = 0; virtual const Text *text() const; virtual Boolean recoverUnquoted(const StringC &, const Location &, AttributeContext &, const StringC &); static Boolean handleAsUnterminated(const Text &, AttributeContext &); }; class AttributeDefinitionDesc { public: AttributeDefinitionDesc() { } enum DeclaredValue { cdata, name, number, nmtoken, nutoken, entity, idref, names, numbers, nmtokens, nutokens, entities, idrefs, id, notation, nameTokenGroup }; DeclaredValue declaredValue; enum DefaultValueType { required, current, implied, conref, defaulted, fixed }; DefaultValueType defaultValueType; ConstPtr defaultValue; Vector allowedValues; Vector origAllowedValues; size_t currentIndex; private: AttributeDefinitionDesc(const AttributeDefinitionDesc &); void operator=(const AttributeDefinitionDesc &); }; class DeclaredValue { public: DeclaredValue(); virtual ~DeclaredValue(); virtual AttributeValue *makeValue(Text &, AttributeContext &, const StringC &name, unsigned &specLength) const = 0; virtual AttributeValue *makeValueFromToken(Text &, AttributeContext &, const StringC &name, unsigned &specLength) const; virtual AttributeSemantics *makeSemantics(const TokenizedAttributeValue &, AttributeContext &, const StringC &, unsigned &nIdrefs, unsigned &nEntityNames) const; virtual Boolean containsToken(const StringC &) const; virtual Boolean tokenized() const = 0; virtual Boolean isNotation() const; virtual Boolean isEntity() const; virtual Boolean isId() const; virtual Boolean isIdref() const; virtual const Vector *getTokens() const; virtual const Vector *getOrigTokens() const; virtual void buildDesc(AttributeDefinitionDesc &) const = 0; virtual DeclaredValue *copy() const = 0; }; class CdataDeclaredValue : public DeclaredValue { public: CdataDeclaredValue(); Boolean tokenized() const; AttributeValue *makeValue(Text &, AttributeContext &, const StringC &, unsigned &) const; void buildDesc(AttributeDefinitionDesc &) const; DeclaredValue *copy() const; protected: void checkNormalizedLength(Text &, AttributeContext &, unsigned &) const; }; class TokenizedDeclaredValue : public DeclaredValue { public: enum TokenType { name, number, nameToken, numberToken, entityName }; TokenizedDeclaredValue(TokenType type, Boolean isList); AttributeValue *makeValue(Text &, AttributeContext &, const StringC &, unsigned &) const; TokenizedAttributeValue *makeTokenizedValue(Text &, AttributeContext &, const StringC &, unsigned &) const; Boolean tokenized() const; void buildDesc(AttributeDefinitionDesc &) const; DeclaredValue *copy() const; private: TokenType type_; Boolean isList_; unsigned initialCategories_; unsigned subsequentCategories_; }; class GroupDeclaredValue : public TokenizedDeclaredValue { public: GroupDeclaredValue(TokenType, Vector &); Boolean containsToken(const StringC &) const; AttributeValue *makeValue(Text &, AttributeContext &, const StringC &, unsigned &) const; AttributeValue *makeValueFromToken(Text &, AttributeContext &, const StringC &name, unsigned &) const; const Vector *getTokens() const; const Vector *getOrigTokens() const; void buildDesc(AttributeDefinitionDesc &) const; DeclaredValue *copy() const; void setOrigAllowedValues(Vector &origAllowedValues); private: Vector allowedValues_; Vector origAllowedValues_; }; class NameTokenGroupDeclaredValue : public GroupDeclaredValue { public: NameTokenGroupDeclaredValue(Vector &); void buildDesc(AttributeDefinitionDesc &) const; DeclaredValue *copy() const; }; class NotationDeclaredValue : public GroupDeclaredValue { public: NotationDeclaredValue(Vector &); AttributeSemantics *makeSemantics(const TokenizedAttributeValue &, AttributeContext &, const StringC &, unsigned &nIdrefs, unsigned &nEntityNames) const; Boolean isNotation() const; void buildDesc(AttributeDefinitionDesc &) const; DeclaredValue *copy() const; }; class EntityDeclaredValue : public TokenizedDeclaredValue { public: EntityDeclaredValue(Boolean isList); AttributeSemantics *makeSemantics(const TokenizedAttributeValue &, AttributeContext &, const StringC &, unsigned &nIdrefs, unsigned &nEntityNames) const; Boolean isEntity() const; DeclaredValue *copy() const; }; class IdDeclaredValue : public TokenizedDeclaredValue { public: IdDeclaredValue(); AttributeSemantics *makeSemantics(const TokenizedAttributeValue &, AttributeContext &, const StringC &, unsigned &nIdrefs, unsigned &nEntityNames) const; Boolean isId() const; void buildDesc(AttributeDefinitionDesc &) const; DeclaredValue *copy() const; }; class IdrefDeclaredValue : public TokenizedDeclaredValue { public: IdrefDeclaredValue(Boolean isList); AttributeSemantics *makeSemantics(const TokenizedAttributeValue &, AttributeContext &, const StringC &, unsigned &nIdrefs, unsigned &nEntityNames) const; Boolean isIdref() const; void buildDesc(AttributeDefinitionDesc &) const; DeclaredValue *copy() const; }; class AttributeDefinition { public: AttributeDefinition(const StringC &, DeclaredValue *); virtual ~AttributeDefinition(); virtual ConstPtr makeMissingValue(AttributeContext &) const = 0; virtual Boolean missingValueWouldMatch(const Text &, const AttributeContext &) const; virtual const AttributeValue * defaultValue(const AttributeValue *impliedValue) const; AttributeValue *makeValue(Text &, AttributeContext &, unsigned &) const; AttributeValue *makeValueFromToken(Text &, AttributeContext &, unsigned &) const; virtual Boolean isConref() const; virtual Boolean isCurrent() const; virtual Boolean isFixed() const; AttributeSemantics *makeSemantics(const AttributeValue *, AttributeContext &, unsigned &nIdrefs, unsigned &nEntityNames) const; Boolean tokenized() const; const StringC &name() const; const StringC &origName() const; Boolean containsToken(const StringC &) const; Boolean isNotation() const; Boolean isEntity() const; Boolean isId() const; Boolean isIdref() const; void getDesc(AttributeDefinitionDesc &) const; const Vector *getTokens() const; const Vector *getOrigTokens() const; virtual AttributeDefinition *copy() const = 0; void setDeclaredValue(DeclaredValue *); void setSpecified(Boolean implicit); Boolean isSpecified(Boolean &implicit); void setOrigName(StringC &origName); private: virtual void buildDesc(AttributeDefinitionDesc &) const = 0; virtual AttributeValue *checkValue(AttributeValue *, AttributeContext &) const; PackedBoolean implicit_; PackedBoolean all_; StringC name_; StringC origName_; CopyOwner declaredValue_; }; class RequiredAttributeDefinition : public AttributeDefinition { public: RequiredAttributeDefinition(const StringC &, DeclaredValue *); ConstPtr makeMissingValue(AttributeContext &) const; void buildDesc(AttributeDefinitionDesc &) const; AttributeDefinition *copy() const; }; class CurrentAttributeDefinition : public AttributeDefinition { public: CurrentAttributeDefinition(const StringC &, DeclaredValue *, size_t index); ConstPtr makeMissingValue(AttributeContext &) const; Boolean missingValueWouldMatch(const Text &, const AttributeContext &) const; AttributeValue *checkValue(AttributeValue *, AttributeContext &) const; void buildDesc(AttributeDefinitionDesc &) const; Boolean isCurrent() const; AttributeDefinition *copy() const; private: size_t currentIndex_; }; class ImpliedAttributeDefinition : public AttributeDefinition { public: ImpliedAttributeDefinition(const StringC &, DeclaredValue *); ConstPtr makeMissingValue(AttributeContext &) const; const AttributeValue *defaultValue(const AttributeValue *) const; void buildDesc(AttributeDefinitionDesc &) const; AttributeDefinition *copy() const; }; class ConrefAttributeDefinition : public ImpliedAttributeDefinition { public: ConrefAttributeDefinition(const StringC &, DeclaredValue *); Boolean isConref() const; void buildDesc(AttributeDefinitionDesc &) const; AttributeDefinition *copy() const; }; class DefaultAttributeDefinition : public AttributeDefinition { public: DefaultAttributeDefinition(const StringC &, DeclaredValue *, AttributeValue *); ConstPtr makeMissingValue(AttributeContext &) const; Boolean missingValueWouldMatch(const Text &, const AttributeContext &) const; void buildDesc(AttributeDefinitionDesc &) const; AttributeDefinition *copy() const; const AttributeValue *defaultValue(const AttributeValue *) const; private: ConstPtr value_; }; class FixedAttributeDefinition : public DefaultAttributeDefinition { public: FixedAttributeDefinition(const StringC &, DeclaredValue *, AttributeValue *); AttributeValue *checkValue(AttributeValue *, AttributeContext &) const; void buildDesc(AttributeDefinitionDesc &) const; Boolean isFixed() const; AttributeDefinition *copy() const; }; class AttributeDefinitionList : public Resource { public: AttributeDefinitionList(Vector > &, size_t listIndex, Boolean anyCurrent = 0, size_t idIndex = size_t(-1), size_t notationIndex = size_t(-1)); AttributeDefinitionList(const ConstPtr &); size_t size() const; AttributeDefinition *def(size_t); const AttributeDefinition *def(size_t) const; Boolean tokenIndex(const StringC &, unsigned &) const; Boolean tokenIndexUnique(const StringC &, unsigned) const; Boolean attributeIndex(const StringC &, unsigned &) const; size_t index() const; size_t idIndex() const; size_t notationIndex() const; Boolean anyCurrent() const; void setIndex(size_t); void append(AttributeDefinition *); private: Vector > defs_; size_t index_; size_t idIndex_; size_t notationIndex_; Boolean anyCurrent_; ConstPtr prev_; }; class AttributeSemantics { public: AttributeSemantics(); virtual ~AttributeSemantics(); virtual size_t nEntities() const; virtual ConstPtr entity(size_t) const; virtual ConstPtr notation() const; virtual AttributeSemantics *copy() const = 0; }; class EntityAttributeSemantics : public AttributeSemantics { public: EntityAttributeSemantics(Vector > &); size_t nEntities() const; ConstPtr entity(size_t) const; AttributeSemantics *copy() const; private: Vector > entity_; }; class NotationAttributeSemantics : public AttributeSemantics { public: NotationAttributeSemantics(const ConstPtr &); ConstPtr notation() const; AttributeSemantics *copy() const; private: ConstPtr notation_; }; class ImpliedAttributeValue : public AttributeValue { public: ImpliedAttributeValue(); Type info(const Text *&, const StringC *&) const; }; class CdataAttributeValue : public AttributeValue { public: CdataAttributeValue(Text &); Type info(const Text *&, const StringC *&) const; const Text *text() const; Boolean recoverUnquoted(const StringC &, const Location &, AttributeContext &, const StringC &); virtual const Notation *notation() const; private: Text text_; }; class TokenizedAttributeValue : public AttributeValue { public: TokenizedAttributeValue(Text &, const Vector &); size_t nTokens() const; AttributeSemantics *makeSemantics(const DeclaredValue *, AttributeContext &, const StringC &, unsigned &, unsigned &) const; Type info(const Text *&, const StringC *&) const; const Text *text() const; const StringC &string() const; StringC token(size_t) const; void token(size_t, const Char *&, size_t &) const; Location tokenLocation(size_t) const; Boolean tokenLocation(size_t, const ConstPtr *&, Index &) const; Boolean recoverUnquoted(const StringC &, const Location &, AttributeContext &, const StringC &); private: TokenizedAttributeValue(const TokenizedAttributeValue &); void operator=(const TokenizedAttributeValue &); Text text_; Vector spaceIndex_; }; class Attribute { public: Attribute(); Boolean specified() const; size_t specIndex() const; const AttributeValue *value() const; const ConstPtr &valuePointer() const; const AttributeSemantics *semantics() const; void setSpec(size_t); void setValue(const ConstPtr &); void setSemantics(AttributeSemantics *); void clear(); private: size_t specIndexPlus_; ConstPtr value_; CopyOwner semantics_; }; class AttributeList { public: AttributeList(); AttributeList(const ConstPtr &); void init(const ConstPtr &); Boolean conref() const; size_t size() const; const StringC &name(unsigned) const; const AttributeValue *value(unsigned) const; size_t specIndex(size_t) const; const ConstPtr &valuePointer(unsigned) const; const AttributeSemantics *semantics(unsigned) const; Boolean tokenized(unsigned index) const; Boolean tokenIndex(const StringC &, unsigned &) const; Boolean tokenIndexUnique(const StringC &, unsigned) const; Boolean attributeIndex(const StringC &, unsigned &) const; void finish(AttributeContext &); Boolean setValue(unsigned index, Text &, AttributeContext &, unsigned &specLength); void setValueToken(unsigned index, Text &, AttributeContext &, unsigned &specLength); void setSpec(unsigned index, AttributeContext &); Boolean recoverUnquoted(const StringC &, const Location &, AttributeContext &); Boolean handleAsUnterminated(AttributeContext &context); void swap(AttributeList &); size_t nSpec() const; size_t defIndex() const; Boolean current(unsigned) const; Boolean anyCurrent() const; Boolean specified(unsigned) const; Boolean id(unsigned) const; Boolean idref(unsigned) const; const Vector *getAllowedTokens(unsigned) const; const StringC *getId() const; Boolean idIndex(unsigned &) const; void noteInvalidSpec(); void changeDef(const ConstPtr &); const ConstPtr &def() const; private: const AttributeDefinition *def(size_t) const; PackedBoolean conref_; unsigned nIdrefs_; unsigned nEntityNames_; size_t nSpec_; Vector vec_; ConstPtr def_; }; class DataDeclaredValue : public CdataDeclaredValue { public: DataDeclaredValue(const ConstPtr &, AttributeList &); AttributeValue *makeValue(Text &, AttributeContext &, const StringC &, unsigned &) const; DeclaredValue *copy() const; private: ConstPtr notation_; AttributeList attributes_; }; class DataAttributeValue : public CdataAttributeValue { public: DataAttributeValue(Text &, const ConstPtr &, const AttributeList &); const AttributeList &attributes() const; const Notation *notation() const; private: const ConstPtr notation_; const AttributeList *attributes_; }; class AttributeContext : public Messenger { public: AttributeContext(); virtual ~AttributeContext(); virtual Boolean defineId(const StringC &, const Location &, Location &); virtual void noteIdref(const StringC &, const Location &); virtual void noteCurrentAttribute(size_t, AttributeValue *); virtual ConstPtr getCurrentAttribute(size_t) const; virtual ConstPtr getAttributeEntity(const StringC &, const Location &); virtual ConstPtr getAttributeNotation(const StringC &, const Location &); virtual const Syntax &attributeSyntax() const = 0; ConstPtr makeImpliedAttributeValue(); Boolean mayDefaultAttribute() const; Boolean validate() const; protected: Boolean mayDefaultAttribute_; Boolean validate_; private: ConstPtr impliedAttributeValue_; }; inline Boolean AttributeDefinition::tokenized() const { return declaredValue_->tokenized(); } inline Boolean AttributeDefinition::isNotation() const { return declaredValue_->isNotation(); } inline Boolean AttributeDefinition::isEntity() const { return declaredValue_->isEntity(); } inline Boolean AttributeDefinition::isId() const { return declaredValue_->isId(); } inline Boolean AttributeDefinition::isIdref() const { return declaredValue_->isIdref(); } inline const Vector *AttributeDefinition::getTokens() const { return declaredValue_->getTokens(); } inline const Vector *AttributeDefinition::getOrigTokens() const { return declaredValue_->getOrigTokens(); } inline AttributeSemantics * AttributeDefinition::makeSemantics(const AttributeValue *value, AttributeContext &context, unsigned &nIdrefs, unsigned &nEntityNames) const { return value->makeSemantics(declaredValue_.pointer(), context, name_, nIdrefs, nEntityNames); } inline AttributeValue *AttributeDefinition::makeValue(Text &text, AttributeContext &context, unsigned &specLength) const { return checkValue(declaredValue_->makeValue(text, context, name_, specLength), context); } inline AttributeValue * AttributeDefinition::makeValueFromToken(Text &text, AttributeContext &context, unsigned &specLength) const { return checkValue(declaredValue_->makeValueFromToken(text, context, name_, specLength), context); } inline Boolean AttributeDefinition::containsToken(const StringC &token) const { return declaredValue_->containsToken(token); } inline const StringC &AttributeDefinition::name() const { return name_; } inline const StringC &AttributeDefinition::origName() const { return origName_; } inline void AttributeDefinition::setDeclaredValue(DeclaredValue *declaredValue) { declaredValue_ = declaredValue; } inline size_t AttributeDefinitionList::size() const { return defs_.size(); } inline size_t AttributeDefinitionList::index() const { return index_; } inline void AttributeDefinitionList::setIndex(size_t index) { index_ = index; } inline size_t AttributeDefinitionList::idIndex() const { return idIndex_; } inline size_t AttributeDefinitionList::notationIndex() const { return notationIndex_; } inline Boolean AttributeDefinitionList::anyCurrent() const { return anyCurrent_; } inline AttributeDefinition *AttributeDefinitionList::def(size_t i) { return defs_[i].pointer(); } inline const AttributeDefinition *AttributeDefinitionList::def(size_t i) const { return defs_[i].pointer(); } inline size_t TokenizedAttributeValue::nTokens() const { return spaceIndex_.size() + 1; } inline const StringC &TokenizedAttributeValue::string() const { return text_.string(); } inline void TokenizedAttributeValue::token(size_t i, const Char *&ptr, size_t &len) const { size_t startIndex = i == 0 ? 0 : spaceIndex_[i - 1] + 1; ptr = text_.string().data() + startIndex; len = (i == spaceIndex_.size() ? text_.size() : spaceIndex_[i]) - startIndex; } inline StringC TokenizedAttributeValue::token(size_t i) const { const Char *ptr; size_t len; token(i, ptr, len); return StringC(ptr, len); } inline Location TokenizedAttributeValue::tokenLocation(size_t i) const { return text_.charLocation(i == 0 ? 0 : spaceIndex_[i - 1] + 1); } inline Boolean TokenizedAttributeValue::tokenLocation(size_t i, const ConstPtr *&origin, Index &index) const { return text_.charLocation(i == 0 ? 0 : spaceIndex_[i - 1] + 1, origin, index); } inline size_t Attribute::specIndex() const { return specIndexPlus_ - 1; } inline Boolean Attribute::specified() const { return specIndexPlus_ != 0; } inline const AttributeValue *Attribute::value() const { return value_.pointer(); } inline const ConstPtr &Attribute::valuePointer() const { return value_; } inline const AttributeSemantics *Attribute::semantics() const { return semantics_.pointer(); } inline void Attribute::setSpec(size_t index) { specIndexPlus_ = index + 1; } inline void Attribute::setValue(const ConstPtr &value) { value_ = value; } inline void Attribute::setSemantics(AttributeSemantics *semantics) { semantics_ = semantics; } inline size_t AttributeList::size() const { return vec_.size(); } inline const AttributeDefinition *AttributeList::def(size_t i) const { return def_->def(i); } inline const ConstPtr &AttributeList::def() const { return def_; } inline Boolean AttributeList::tokenized(unsigned i) const { return def(i)->tokenized(); } inline Boolean AttributeList::tokenIndex(const StringC &name, unsigned &index) const { return !def_.isNull() && def_->tokenIndex(name, index); } inline Boolean AttributeList::tokenIndexUnique(const StringC &name, unsigned index) const { return def_->tokenIndexUnique(name, index); } inline Boolean AttributeList::attributeIndex(const StringC &name, unsigned &index) const { return !def_.isNull() && def_->attributeIndex(name, index); } inline const StringC &AttributeList::name(unsigned i) const { return def(i)->name(); } inline const Vector *AttributeList::getAllowedTokens(unsigned i) const { return def(i)->getTokens(); } inline const AttributeValue *AttributeList::value(unsigned i) const { return vec_[i].value(); } inline const ConstPtr &AttributeList::valuePointer(unsigned i) const { return vec_[i].valuePointer(); } inline const AttributeSemantics *AttributeList::semantics(unsigned i) const { return vec_[i].semantics(); } inline size_t AttributeList::specIndex(size_t i) const { return vec_[i].specIndex(); } inline size_t AttributeList::nSpec() const { return nSpec_; } inline Boolean AttributeList::conref() const { return conref_; } inline size_t AttributeList::defIndex() const { return def_.isNull() ? size_t(-1) : def_->index(); } inline Boolean AttributeList::current(unsigned i) const { return def(i)->isCurrent(); } inline Boolean AttributeList::anyCurrent() const { return !def_.isNull() && def_->anyCurrent(); } inline const AttributeValue * DefaultAttributeDefinition::defaultValue(const AttributeValue *) const { return value_.pointer(); } inline Boolean AttributeList::idIndex(unsigned &ind) const { if (def_.isNull() || def_->idIndex() == size_t(-1)) return 0; else { ind = def_->idIndex(); return 1; } } inline Boolean AttributeList::id(unsigned i) const { return def(i)->isId(); } inline Boolean AttributeList::idref(unsigned i) const { return def(i)->isIdref(); } inline Boolean AttributeList::specified(unsigned i) const { return vec_[i].specified(); } inline Boolean AttributeContext::mayDefaultAttribute() const { return mayDefaultAttribute_; } inline Boolean AttributeContext::validate() const { return validate_; } } # 9 "../include/Attributed.h" 2 namespace OpenSP { class Attributed { public: Attributed() { } ConstPtr attributeDef() const; const AttributeDefinitionList *attributeDefTemp() const; Ptr attributeDef(); void setAttributeDef(const Ptr &); private: Ptr attributeDef_; }; inline ConstPtr Attributed::attributeDef() const { return attributeDef_; } inline const AttributeDefinitionList *Attributed::attributeDefTemp() const { return attributeDef_.pointer(); } inline Ptr Attributed::attributeDef() { return attributeDef_; } inline void Attributed::setAttributeDef(const Ptr &def) { attributeDef_ = def; } } # 18 "../include/Notation.h" 2 # 1 "../include/StringResource.h" 1 # 1 "../include/StringOf.h" 1 # 8 "../include/StringResource.h" 2 namespace OpenSP { template class StringResource : public String, public Resource { public: StringResource(const String &s) : String(s) { } }; } # 19 "../include/Notation.h" 2 # 1 "../include/EntityDecl.h" 1 #pragma interface # 1 "../include/Ptr.h" 1 # 13 "../include/EntityDecl.h" 2 namespace OpenSP { class EntityDecl : public NamedResource { public: enum DeclType { generalEntity, parameterEntity, doctype, linktype, notation, sgml }; enum DataType { sgmlText, pi, cdata, sdata, ndata, subdoc }; EntityDecl(const StringC &, DeclType declType, DataType dataType, const Location &defLocation); DataType dataType() const; DeclType declType() const; const Location &defLocation() const; Boolean declInDtdIsBase() const; Boolean declInActiveLpd() const; const StringC *declInDtdNamePointer() const; const StringC *declInLpdNamePointer() const; void setDeclIn(const ConstPtr > &dtdName, Boolean dtdIsBase, const ConstPtr > &lpdName, Boolean lpdIsActive); void setDeclIn(const ConstPtr > &dtdName, Boolean dtdIsBase); void setDefLocation(const Location &); virtual const StringC *systemIdPointer() const; virtual const StringC *publicIdPointer() const; virtual const StringC *effectiveSystemIdPointer() const; private: DeclType declType_; DataType dataType_; PackedBoolean dtdIsBase_; PackedBoolean lpdIsActive_; Location defLocation_; ConstPtr > dtdName_; ConstPtr > lpdName_; }; inline const Location &EntityDecl::defLocation() const { return defLocation_; } inline EntityDecl::DeclType EntityDecl::declType() const { return declType_; } inline EntityDecl::DataType EntityDecl::dataType() const { return dataType_; } inline const StringC *EntityDecl::declInDtdNamePointer() const { return dtdName_.pointer(); } inline const StringC *EntityDecl::declInLpdNamePointer() const { return lpdName_.pointer(); } inline Boolean EntityDecl::declInDtdIsBase() const { return dtdIsBase_; } inline Boolean EntityDecl::declInActiveLpd() const { return lpdIsActive_; } inline void EntityDecl::setDefLocation(const Location &loc) { defLocation_ = loc; } } # 20 "../include/Notation.h" 2 namespace OpenSP { class ParserState; class Notation : public EntityDecl, public Attributed { public: Notation(const StringC &, const ConstPtr > &dtdName, Boolean dtdIsBase); void setExternalId(const ExternalId &, const Location &); const ExternalId &externalId() const; Boolean defined() const; void generateSystemId(ParserState &); const StringC *systemIdPointer() const; const StringC *publicIdPointer() const; private: Notation(const Notation &); void operator=(const Notation &); PackedBoolean defined_; ExternalId externalId_; }; inline const ExternalId &Notation::externalId() const { return externalId_; } inline Boolean Notation::defined() const { return defined_; } } # 20 "../include/Event.h" 2 # 1 "../include/Sd.h" 1 #pragma interface # 1 "../include/CharsetInfo.h" 1 #pragma interface # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/limits.h" 1 3 4 # 11 "../include/CharsetInfo.h" 2 # 1 "../include/UnivCharsetDesc.h" 1 #pragma interface # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 1 3 4 # 11 "../include/UnivCharsetDesc.h" 2 # 1 "../include/CharMap.h" 1 # 11 "../include/CharMap.h" namespace OpenSP { class CharMapBits { public: enum { level0 = 5, level1 = 8, level2 = 4, level3 = 4 }; enum { planes = (1 << CharMapBits::level0) , pagesPerPlane = (1 << CharMapBits::level1), columnsPerPage = (1 << CharMapBits::level2), cellsPerColumn = (1 << CharMapBits::level3), planeSize = (1 << (CharMapBits::level1 + CharMapBits::level2 + CharMapBits::level3)), pageSize = (1 << (CharMapBits::level2 + CharMapBits::level3)), columnSize = (1 << CharMapBits::level3) }; static size_t planeIndex(size_t c) { return (c >> (CharMapBits::level1 + CharMapBits::level2 + CharMapBits::level3)); } static size_t pageIndex(size_t c) { return ((c >> (CharMapBits::level2 + CharMapBits::level3)) & (pagesPerPlane - 1)); } static size_t columnIndex(size_t c) { return ((c >> CharMapBits::level3) & (columnsPerPage - 1)); } static size_t cellIndex(size_t c) { return (c & (cellsPerColumn - 1)); } static size_t maxInPlane(size_t c) { return (c | (planeSize - 1)); } static size_t maxInPage(size_t c) { return (c | (pageSize - 1)); } static size_t maxInColumn(size_t c) { return (c | (columnSize - 1)); } }; # 73 "../include/CharMap.h" template class CharMapColumn { public: CharMapColumn(); CharMapColumn(const CharMapColumn &); void operator=(const CharMapColumn &); ~CharMapColumn(); T *values; T value; }; template class CharMapPage { public: CharMapPage(); CharMapPage(const CharMapPage &); void operator=(const CharMapPage &); ~CharMapPage(); void swap(CharMapPage &); CharMapColumn *values; T value; }; template class CharMapPlane { public: CharMapPlane(); CharMapPlane(const CharMapPlane &); void operator=(const CharMapPlane &); ~CharMapPlane(); void swap(CharMapPlane &); CharMapPage *values; T value; }; template class CharMap { public: CharMap(); CharMap(T); T operator[](Char) const; T getRange(Char from, Char &to) const; void swap(CharMap &); void setChar(Char, T); void setRange(Char from, Char to, T val); void setAll(T); private: CharMapPlane values_[CharMapBits::planes]; T lo_[256]; }; template class CharMapResource : public CharMap, public Resource { public: CharMapResource() { } CharMapResource(T t) : CharMap(t) { } }; template inline T CharMap::operator[](Char c) const { if (c < 256) return lo_[c]; const CharMapPlane &pl = values_[CharMapBits::planeIndex(c)]; if (pl.values) { const CharMapPage &pg = pl.values[CharMapBits::pageIndex(c)]; if (pg.values) { const CharMapColumn &column = pg.values[CharMapBits::columnIndex(c)]; if (column.values) return column.values[CharMapBits::cellIndex(c)]; else return column.value; } else return pg.value; } else return pl.value; } template inline T CharMap::getRange(Char c, Char &max) const { if (c < 256) { max = c; return lo_[c]; } const CharMapPlane &pl = values_[CharMapBits::planeIndex(c)]; if (pl.values) { const CharMapPage &pg = pl.values[CharMapBits::pageIndex(c)]; if (pg.values) { const CharMapColumn &column = pg.values[CharMapBits::columnIndex(c)]; if (column.values) { max = c; return column.values[CharMapBits::cellIndex(c)]; } else { max = CharMapBits::maxInColumn(c); return column.value; } } else { max = CharMapBits::maxInPage(c); return pg.value; } } else { max = CharMapBits::maxInPlane(c); return pl.value; } } # 222 "../include/CharMap.h" } # 1 "../include/CharMap.cxx" 1 namespace OpenSP { template CharMap::CharMap() { } template CharMap::CharMap(T dflt) { for (size_t i = 0; i < 256; i++) lo_[i] = dflt; for (size_t i = 0; i < CharMapBits::planes; i++) values_[i].value = dflt; } template void CharMap::setAll(T val) { for (size_t i = 0; i < 256; i++) lo_[i] = val; for (size_t i = 0; i < CharMapBits::planes; i++) { values_[i].value = val; delete [] values_[i].values; values_[i].values = 0; } } template void CharMap::swap(CharMap &map) { for (size_t i = 0; i < 256; i++) { T tem(lo_[i]); lo_[i] = map.lo_[i]; map.lo_[i] = tem; } for (size_t i = 0; i < CharMapBits::planes; i++) values_[i].swap(map.values_[i]); } template void CharMap::setChar(Char c, T val) { if (c < 256) { lo_[c] = val; return; } CharMapPlane &pl = values_[CharMapBits::planeIndex(c)]; if (pl.values) { CharMapPage &pg = pl.values[CharMapBits::pageIndex(c)]; if (pg.values) { CharMapColumn &column = pg.values[CharMapBits::columnIndex(c)]; if (column.values) column.values[CharMapBits::cellIndex(c)] = val; else if (val != column.value) { column.values = new T[CharMapBits::columnSize]; for (size_t i = 0; i < CharMapBits::columnSize; i++) column.values[i] = column.value; column.values[CharMapBits::cellIndex(c)] = val; } } else if (val != pg.value) { pg.values = new CharMapColumn[CharMapBits::columnsPerPage]; for (size_t i = 0; i < CharMapBits::columnsPerPage; i++) pg.values[i].value = pg.value; CharMapColumn &column = pg.values[CharMapBits::columnIndex(c)]; column.values = new T[CharMapBits::cellsPerColumn]; for (size_t i = 0; i < CharMapBits::cellsPerColumn; i++) column.values[i] = column.value; column.values[CharMapBits::cellIndex(c)] = val; } } else if (val != pl.value) { pl.values = new CharMapPage[CharMapBits::pagesPerPlane]; for (size_t i = 0; i < CharMapBits::pagesPerPlane; i++) pl.values[i].value = pl.value; CharMapPage &page = pl.values[CharMapBits::pageIndex(c)]; page.values = new CharMapColumn[CharMapBits::columnsPerPage]; for (size_t i = 0; i < CharMapBits::columnsPerPage; i++) page.values[i].value = page.value; CharMapColumn &column = page.values[CharMapBits::columnIndex(c)]; column.values = new T[CharMapBits::cellsPerColumn]; for (size_t i = 0; i < CharMapBits::cellsPerColumn; i++) column.values[i] = column.value; column.values[CharMapBits::cellIndex(c)] = val; } } template void CharMap::setRange(Char from, Char to, T val) { for (; from < 256; from++) { lo_[from] = val; if (from == to) return; } do { if ((from & (CharMapBits::columnSize - 1)) == 0 && to - from >= CharMapBits::columnSize - 1) { if ((from & (CharMapBits::pageSize - 1)) == 0 && to - from >= CharMapBits::pageSize - 1) { if ((from & (CharMapBits::planeSize - 1)) == 0 && to - from >= CharMapBits::planeSize - 1) { CharMapPlane &pl = values_[CharMapBits::planeIndex(from)]; pl.value = val; delete [] pl.values; pl.values = 0; from += CharMapBits::planeSize - 1; } else { CharMapPlane &pl = values_[CharMapBits::planeIndex(from)]; if (pl.values) { CharMapPage &pg = pl.values[CharMapBits::pageIndex(from)]; pg.value = val; delete [] pg.values; pg.values = 0; } else if (val != pl.value) { pl.values = new CharMapPage[CharMapBits::pagesPerPlane]; for (size_t i = 0; i < CharMapBits::pagesPerPlane; i++) pl.values[i].value = pl.value; CharMapPage &page = pl.values[CharMapBits::pageIndex(from)]; page.value = val; } from += CharMapBits::pageSize - 1; } } else { CharMapPlane &pl = values_[CharMapBits::planeIndex(from)]; if (pl.values) { CharMapPage &pg = pl.values[CharMapBits::pageIndex(from)]; if (pg.values) { CharMapColumn &column = pg.values[CharMapBits::columnIndex(from)]; column.value = val; delete [] column.values; column.values = 0; } else if (val != pg.value) { pg.values = new CharMapColumn[CharMapBits::columnsPerPage]; for (size_t i = 0; i < CharMapBits::columnsPerPage; i++) pg.values[i].value = pg.value; CharMapColumn &column = pg.values[CharMapBits::columnIndex(from)]; column.value = val; } } else if (val != pl.value) { pl.values = new CharMapPage[CharMapBits::pagesPerPlane]; for (size_t i = 0; i < CharMapBits::pagesPerPlane; i++) pl.values[i].value = pl.value; CharMapPage &pg = pl.values[CharMapBits::pageIndex(from)]; pg.value = val; pg.values = new CharMapColumn[CharMapBits::columnsPerPage]; for (size_t i = 0; i < CharMapBits::columnsPerPage; i++) pg.values[i].value = pg.value; CharMapColumn &column = pg.values[CharMapBits::columnIndex(from)]; column.value = val; } from += CharMapBits::columnSize - 1; } } else setChar(from, val); } while (from++ != to); } template CharMapPlane::CharMapPlane() : values(0) { } template CharMapPlane::CharMapPlane(const CharMapPlane &pl) { if (pl.values) { values = new CharMapPage[CharMapBits::pagesPerPlane]; for (size_t i = 0; i < CharMapBits::pagesPerPlane; i++) values[i] = pl.values[i]; } else { value = pl.value; values = 0; } } template void CharMapPlane::operator=(const CharMapPlane &pl) { if (pl.values) { if (!values) values = new CharMapPage[CharMapBits::pagesPerPlane]; for (size_t i = 0; i < CharMapBits::pagesPerPlane; i++) values[i] = pl.values[i]; } else { if (values) { delete [] values; values = 0; } value = pl.value; } } template CharMapPlane::~CharMapPlane() { delete [] values; } template void CharMapPlane::swap(CharMapPlane &pl) { { CharMapPage *tem = values; values = pl.values; pl.values = tem; } { T tem(value); value = pl.value; pl.value = tem; } } template CharMapPage::CharMapPage() : values(0) { } template CharMapPage::CharMapPage(const CharMapPage &pg) { if (pg.values) { values = new CharMapColumn[CharMapBits::columnsPerPage]; for (size_t i = 0; i < CharMapBits::columnsPerPage; i++) values[i] = pg.values[i]; } else { value = pg.value; values = 0; } } template void CharMapPage::operator=(const CharMapPage &pg) { if (pg.values) { if (!values) values = new CharMapColumn[CharMapBits::columnsPerPage]; for (size_t i = 0; i < CharMapBits::columnsPerPage; i++) values[i] = pg.values[i]; } else { if (values) { delete [] values; values = 0; } value = pg.value; } } template CharMapPage::~CharMapPage() { delete [] values; } template void CharMapPage::swap(CharMapPage &pg) { { CharMapColumn *tem = values; values = pg.values; pg.values = tem; } { T tem(value); value = pg.value; pg.value = tem; } } template CharMapColumn::CharMapColumn() : values(0) { } template CharMapColumn::CharMapColumn(const CharMapColumn &col) { if (col.values) { values = new T[CharMapBits::cellsPerColumn]; for (size_t i = 0; i < CharMapBits::cellsPerColumn; i++) values[i] = col.values[i]; } else { values = 0; value = col.value; } } template void CharMapColumn::operator=(const CharMapColumn &col) { if (col.values) { if (!values) values = new T[CharMapBits::cellsPerColumn]; for (size_t i = 0; i < CharMapBits::cellsPerColumn; i++) values[i] = col.values[i]; } else { if (values) { delete [] values; values = 0; } value = col.value; } } template CharMapColumn::~CharMapColumn() { delete [] values; } # 387 "../include/CharMap.cxx" } # 229 "../include/CharMap.h" 2 # 13 "../include/UnivCharsetDesc.h" 2 # 1 "../include/RangeMap.h" 1 # 1 "../include/Vector.h" 1 # 8 "../include/RangeMap.h" 2 # 1 "../include/ISet.h" 1 # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 1 3 4 # 9 "../include/ISet.h" 2 # 1 "../include/Vector.h" 1 # 10 "../include/ISet.h" 2 namespace OpenSP { template class ISetIter; template struct ISetRange { T min; T max; }; template class ISet { public: ISet(); ISet(const T *, size_t); ~ISet(); Boolean contains(T) const; void remove(T); void add(T x) { addRange(x, x); } void addRange(T, T); void check(); void operator+=(T x) { addRange(x, x); } void clear(); Boolean isSingleton() const { return r_.size() == 1 && r_[0].min == r_[0].max; } Boolean isEmpty() const { return r_.size() == 0; } void swap(ISet &x) { r_.swap(x.r_); } friend class ISetIter; private: Vector > r_; }; } # 1 "../include/ISet.cxx" 1 # 1 "/usr/include/stdlib.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/stdlib.h" 1 3 4 # 25 "/usr/include/gentoo-multilib/amd64/stdlib.h" 3 4 # 1 "/usr/include/features.h" 1 3 4 # 26 "/usr/include/gentoo-multilib/amd64/stdlib.h" 2 3 4 # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 1 3 4 # 34 "/usr/include/gentoo-multilib/amd64/stdlib.h" 2 3 4 extern "C" { # 1 "/usr/include/bits/waitflags.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/bits/waitflags.h" 1 3 4 # 9 "/usr/include/bits/waitflags.h" 2 3 4 # 43 "/usr/include/gentoo-multilib/amd64/stdlib.h" 2 3 4 # 1 "/usr/include/bits/waitstatus.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/bits/waitstatus.h" 1 3 4 # 65 "/usr/include/gentoo-multilib/amd64/bits/waitstatus.h" 3 4 # 1 "/usr/include/endian.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/endian.h" 1 3 4 # 22 "/usr/include/gentoo-multilib/amd64/endian.h" 3 4 # 1 "/usr/include/features.h" 1 3 4 # 23 "/usr/include/gentoo-multilib/amd64/endian.h" 2 3 4 # 37 "/usr/include/gentoo-multilib/amd64/endian.h" 3 4 # 1 "/usr/include/bits/endian.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/bits/endian.h" 1 3 4 # 9 "/usr/include/bits/endian.h" 2 3 4 # 38 "/usr/include/gentoo-multilib/amd64/endian.h" 2 3 4 # 9 "/usr/include/endian.h" 2 3 4 # 66 "/usr/include/gentoo-multilib/amd64/bits/waitstatus.h" 2 3 4 union wait { int w_status; struct { unsigned int __w_termsig:7; unsigned int __w_coredump:1; unsigned int __w_retcode:8; unsigned int:16; } __wait_terminated; struct { unsigned int __w_stopval:8; unsigned int __w_stopsig:8; unsigned int:16; } __wait_stopped; }; # 9 "/usr/include/bits/waitstatus.h" 2 3 4 # 44 "/usr/include/gentoo-multilib/amd64/stdlib.h" 2 3 4 # 96 "/usr/include/gentoo-multilib/amd64/stdlib.h" 3 4 typedef struct { int quot; int rem; } div_t; typedef struct { long int quot; long int rem; } ldiv_t; __extension__ typedef struct { long long int quot; long long int rem; } lldiv_t; # 140 "/usr/include/gentoo-multilib/amd64/stdlib.h" 3 4 extern size_t __ctype_get_mb_cur_max (void) throw () ; extern double atof (__const char *__nptr) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; extern int atoi (__const char *__nptr) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; extern long int atol (__const char *__nptr) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; __extension__ extern long long int atoll (__const char *__nptr) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; extern double strtod (__const char *__restrict __nptr, char **__restrict __endptr) throw () __attribute__ ((__nonnull__ (1))) ; extern float strtof (__const char *__restrict __nptr, char **__restrict __endptr) throw () __attribute__ ((__nonnull__ (1))) ; extern long double strtold (__const char *__restrict __nptr, char **__restrict __endptr) throw () __attribute__ ((__nonnull__ (1))) ; extern long int strtol (__const char *__restrict __nptr, char **__restrict __endptr, int __base) throw () __attribute__ ((__nonnull__ (1))) ; extern unsigned long int strtoul (__const char *__restrict __nptr, char **__restrict __endptr, int __base) throw () __attribute__ ((__nonnull__ (1))) ; __extension__ extern long long int strtoq (__const char *__restrict __nptr, char **__restrict __endptr, int __base) throw () __attribute__ ((__nonnull__ (1))) ; __extension__ extern unsigned long long int strtouq (__const char *__restrict __nptr, char **__restrict __endptr, int __base) throw () __attribute__ ((__nonnull__ (1))) ; __extension__ extern long long int strtoll (__const char *__restrict __nptr, char **__restrict __endptr, int __base) throw () __attribute__ ((__nonnull__ (1))) ; __extension__ extern unsigned long long int strtoull (__const char *__restrict __nptr, char **__restrict __endptr, int __base) throw () __attribute__ ((__nonnull__ (1))) ; # 236 "/usr/include/gentoo-multilib/amd64/stdlib.h" 3 4 # 1 "/usr/include/xlocale.h" 1 3 4 # 237 "/usr/include/gentoo-multilib/amd64/stdlib.h" 2 3 4 extern long int strtol_l (__const char *__restrict __nptr, char **__restrict __endptr, int __base, __locale_t __loc) throw () __attribute__ ((__nonnull__ (1, 4))) ; extern unsigned long int strtoul_l (__const char *__restrict __nptr, char **__restrict __endptr, int __base, __locale_t __loc) throw () __attribute__ ((__nonnull__ (1, 4))) ; __extension__ extern long long int strtoll_l (__const char *__restrict __nptr, char **__restrict __endptr, int __base, __locale_t __loc) throw () __attribute__ ((__nonnull__ (1, 4))) ; __extension__ extern unsigned long long int strtoull_l (__const char *__restrict __nptr, char **__restrict __endptr, int __base, __locale_t __loc) throw () __attribute__ ((__nonnull__ (1, 4))) ; extern double strtod_l (__const char *__restrict __nptr, char **__restrict __endptr, __locale_t __loc) throw () __attribute__ ((__nonnull__ (1, 3))) ; extern float strtof_l (__const char *__restrict __nptr, char **__restrict __endptr, __locale_t __loc) throw () __attribute__ ((__nonnull__ (1, 3))) ; extern long double strtold_l (__const char *__restrict __nptr, char **__restrict __endptr, __locale_t __loc) throw () __attribute__ ((__nonnull__ (1, 3))) ; extern double __strtod_internal (__const char *__restrict __nptr, char **__restrict __endptr, int __group) throw () __attribute__ ((__nonnull__ (1))) ; extern float __strtof_internal (__const char *__restrict __nptr, char **__restrict __endptr, int __group) throw () __attribute__ ((__nonnull__ (1))) ; extern long double __strtold_internal (__const char *__restrict __nptr, char **__restrict __endptr, int __group) throw () __attribute__ ((__nonnull__ (1))) ; extern long int __strtol_internal (__const char *__restrict __nptr, char **__restrict __endptr, int __base, int __group) throw () __attribute__ ((__nonnull__ (1))) ; extern unsigned long int __strtoul_internal (__const char *__restrict __nptr, char **__restrict __endptr, int __base, int __group) throw () __attribute__ ((__nonnull__ (1))) ; __extension__ extern long long int __strtoll_internal (__const char *__restrict __nptr, char **__restrict __endptr, int __base, int __group) throw () __attribute__ ((__nonnull__ (1))) ; __extension__ extern unsigned long long int __strtoull_internal (__const char * __restrict __nptr, char **__restrict __endptr, int __base, int __group) throw () __attribute__ ((__nonnull__ (1))) ; extern __inline double strtod (__const char *__restrict __nptr, char **__restrict __endptr) throw () { return __strtod_internal (__nptr, __endptr, 0); } extern __inline long int strtol (__const char *__restrict __nptr, char **__restrict __endptr, int __base) throw () { return __strtol_internal (__nptr, __endptr, __base, 0); } extern __inline unsigned long int strtoul (__const char *__restrict __nptr, char **__restrict __endptr, int __base) throw () { return __strtoul_internal (__nptr, __endptr, __base, 0); } extern __inline float strtof (__const char *__restrict __nptr, char **__restrict __endptr) throw () { return __strtof_internal (__nptr, __endptr, 0); } extern __inline long double strtold (__const char *__restrict __nptr, char **__restrict __endptr) throw () { return __strtold_internal (__nptr, __endptr, 0); } __extension__ extern __inline long long int strtoq (__const char *__restrict __nptr, char **__restrict __endptr, int __base) throw () { return __strtoll_internal (__nptr, __endptr, __base, 0); } __extension__ extern __inline unsigned long long int strtouq (__const char *__restrict __nptr, char **__restrict __endptr, int __base) throw () { return __strtoull_internal (__nptr, __endptr, __base, 0); } __extension__ extern __inline long long int strtoll (__const char *__restrict __nptr, char **__restrict __endptr, int __base) throw () { return __strtoll_internal (__nptr, __endptr, __base, 0); } __extension__ extern __inline unsigned long long int strtoull (__const char * __restrict __nptr, char **__restrict __endptr, int __base) throw () { return __strtoull_internal (__nptr, __endptr, __base, 0); } extern __inline double atof (__const char *__nptr) throw () { return strtod (__nptr, (char **) __null); } extern __inline int atoi (__const char *__nptr) throw () { return (int) strtol (__nptr, (char **) __null, 10); } extern __inline long int atol (__const char *__nptr) throw () { return strtol (__nptr, (char **) __null, 10); } __extension__ extern __inline long long int atoll (__const char *__nptr) throw () { return strtoll (__nptr, (char **) __null, 10); } # 427 "/usr/include/gentoo-multilib/amd64/stdlib.h" 3 4 extern char *l64a (long int __n) throw () ; extern long int a64l (__const char *__s) throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ; # 1 "/usr/include/sys/types.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/sys/types.h" 1 3 4 # 27 "/usr/include/gentoo-multilib/amd64/sys/types.h" 3 4 # 1 "/usr/include/features.h" 1 3 4 # 28 "/usr/include/gentoo-multilib/amd64/sys/types.h" 2 3 4 extern "C" { # 1 "/usr/include/bits/types.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/bits/types.h" 1 3 4 # 27 "/usr/include/gentoo-multilib/amd64/bits/types.h" 3 4 # 1 "/usr/include/features.h" 1 3 4 # 28 "/usr/include/gentoo-multilib/amd64/bits/types.h" 2 3 4 # 1 "/usr/include/bits/wordsize.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/bits/wordsize.h" 1 3 4 # 9 "/usr/include/bits/wordsize.h" 2 3 4 # 29 "/usr/include/gentoo-multilib/amd64/bits/types.h" 2 3 4 # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 1 3 4 # 32 "/usr/include/gentoo-multilib/amd64/bits/types.h" 2 3 4 typedef unsigned char __u_char; typedef unsigned short int __u_short; typedef unsigned int __u_int; typedef unsigned long int __u_long; typedef signed char __int8_t; typedef unsigned char __uint8_t; typedef signed short int __int16_t; typedef unsigned short int __uint16_t; typedef signed int __int32_t; typedef unsigned int __uint32_t; typedef signed long int __int64_t; typedef unsigned long int __uint64_t; typedef long int __quad_t; typedef unsigned long int __u_quad_t; # 134 "/usr/include/gentoo-multilib/amd64/bits/types.h" 3 4 # 1 "/usr/include/bits/typesizes.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/bits/typesizes.h" 1 3 4 # 9 "/usr/include/bits/typesizes.h" 2 3 4 # 135 "/usr/include/gentoo-multilib/amd64/bits/types.h" 2 3 4 typedef unsigned long int __dev_t; typedef unsigned int __uid_t; typedef unsigned int __gid_t; typedef unsigned long int __ino_t; typedef unsigned long int __ino64_t; typedef unsigned int __mode_t; typedef unsigned long int __nlink_t; typedef long int __off_t; typedef long int __off64_t; typedef int __pid_t; typedef struct { int __val[2]; } __fsid_t; typedef long int __clock_t; typedef unsigned long int __rlim_t; typedef unsigned long int __rlim64_t; typedef unsigned int __id_t; typedef long int __time_t; typedef unsigned int __useconds_t; typedef long int __suseconds_t; typedef int __daddr_t; typedef long int __swblk_t; typedef int __key_t; typedef int __clockid_t; typedef void * __timer_t; typedef long int __blksize_t; typedef long int __blkcnt_t; typedef long int __blkcnt64_t; typedef unsigned long int __fsblkcnt_t; typedef unsigned long int __fsblkcnt64_t; typedef unsigned long int __fsfilcnt_t; typedef unsigned long int __fsfilcnt64_t; typedef long int __ssize_t; typedef __off64_t __loff_t; typedef __quad_t *__qaddr_t; typedef char *__caddr_t; typedef long int __intptr_t; typedef unsigned int __socklen_t; # 9 "/usr/include/bits/types.h" 2 3 4 # 32 "/usr/include/gentoo-multilib/amd64/sys/types.h" 2 3 4 typedef __u_char u_char; typedef __u_short u_short; typedef __u_int u_int; typedef __u_long u_long; typedef __quad_t quad_t; typedef __u_quad_t u_quad_t; typedef __fsid_t fsid_t; typedef __loff_t loff_t; typedef __ino_t ino_t; typedef __ino64_t ino64_t; typedef __dev_t dev_t; typedef __gid_t gid_t; typedef __mode_t mode_t; typedef __nlink_t nlink_t; typedef __uid_t uid_t; typedef __off_t off_t; typedef __off64_t off64_t; typedef __pid_t pid_t; typedef __id_t id_t; typedef __ssize_t ssize_t; typedef __daddr_t daddr_t; typedef __caddr_t caddr_t; typedef __key_t key_t; # 133 "/usr/include/gentoo-multilib/amd64/sys/types.h" 3 4 # 1 "/usr/include/time.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/time.h" 1 3 4 # 56 "/usr/include/gentoo-multilib/amd64/time.h" 3 4 # 1 "/usr/include/bits/types.h" 1 3 4 # 57 "/usr/include/gentoo-multilib/amd64/time.h" 2 3 4 typedef __clock_t clock_t; # 72 "/usr/include/gentoo-multilib/amd64/time.h" 3 4 # 1 "/usr/include/bits/types.h" 1 3 4 # 73 "/usr/include/gentoo-multilib/amd64/time.h" 2 3 4 typedef __time_t time_t; # 89 "/usr/include/gentoo-multilib/amd64/time.h" 3 4 # 1 "/usr/include/bits/types.h" 1 3 4 # 90 "/usr/include/gentoo-multilib/amd64/time.h" 2 3 4 typedef __clockid_t clockid_t; # 101 "/usr/include/gentoo-multilib/amd64/time.h" 3 4 # 1 "/usr/include/bits/types.h" 1 3 4 # 102 "/usr/include/gentoo-multilib/amd64/time.h" 2 3 4 typedef __timer_t timer_t; # 9 "/usr/include/time.h" 2 3 4 # 134 "/usr/include/gentoo-multilib/amd64/sys/types.h" 2 3 4 typedef __useconds_t useconds_t; typedef __suseconds_t suseconds_t; # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 1 3 4 # 148 "/usr/include/gentoo-multilib/amd64/sys/types.h" 2 3 4 typedef unsigned long int ulong; typedef unsigned short int ushort; typedef unsigned int uint; # 191 "/usr/include/gentoo-multilib/amd64/sys/types.h" 3 4 typedef int int8_t __attribute__ ((__mode__ (__QI__))); typedef int int16_t __attribute__ ((__mode__ (__HI__))); typedef int int32_t __attribute__ ((__mode__ (__SI__))); typedef int int64_t __attribute__ ((__mode__ (__DI__))); typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__))); typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__))); typedef int register_t __attribute__ ((__mode__ (__word__))); # 213 "/usr/include/gentoo-multilib/amd64/sys/types.h" 3 4 # 1 "/usr/include/endian.h" 1 3 4 # 214 "/usr/include/gentoo-multilib/amd64/sys/types.h" 2 3 4 # 1 "/usr/include/sys/select.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/sys/select.h" 1 3 4 # 25 "/usr/include/gentoo-multilib/amd64/sys/select.h" 3 4 # 1 "/usr/include/features.h" 1 3 4 # 26 "/usr/include/gentoo-multilib/amd64/sys/select.h" 2 3 4 # 1 "/usr/include/bits/types.h" 1 3 4 # 29 "/usr/include/gentoo-multilib/amd64/sys/select.h" 2 3 4 # 1 "/usr/include/bits/select.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/bits/select.h" 1 3 4 # 9 "/usr/include/bits/select.h" 2 3 4 # 32 "/usr/include/gentoo-multilib/amd64/sys/select.h" 2 3 4 # 1 "/usr/include/bits/sigset.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/bits/sigset.h" 1 3 4 # 23 "/usr/include/gentoo-multilib/amd64/bits/sigset.h" 3 4 typedef int __sig_atomic_t; typedef struct { unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; } __sigset_t; # 9 "/usr/include/bits/sigset.h" 2 3 4 # 35 "/usr/include/gentoo-multilib/amd64/sys/select.h" 2 3 4 typedef __sigset_t sigset_t; # 1 "/usr/include/time.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/time.h" 1 3 4 # 118 "/usr/include/gentoo-multilib/amd64/time.h" 3 4 struct timespec { __time_t tv_sec; long int tv_nsec; }; # 9 "/usr/include/time.h" 2 3 4 # 45 "/usr/include/gentoo-multilib/amd64/sys/select.h" 2 3 4 # 1 "/usr/include/bits/time.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/bits/time.h" 1 3 4 # 65 "/usr/include/gentoo-multilib/amd64/bits/time.h" 3 4 # 1 "/usr/include/bits/types.h" 1 3 4 # 66 "/usr/include/gentoo-multilib/amd64/bits/time.h" 2 3 4 struct timeval { __time_t tv_sec; __suseconds_t tv_usec; }; # 9 "/usr/include/bits/time.h" 2 3 4 # 47 "/usr/include/gentoo-multilib/amd64/sys/select.h" 2 3 4 # 55 "/usr/include/gentoo-multilib/amd64/sys/select.h" 3 4 typedef long int __fd_mask; # 67 "/usr/include/gentoo-multilib/amd64/sys/select.h" 3 4 typedef struct { __fd_mask fds_bits[1024 / (8 * sizeof (__fd_mask))]; } fd_set; typedef __fd_mask fd_mask; # 99 "/usr/include/gentoo-multilib/amd64/sys/select.h" 3 4 extern "C" { # 109 "/usr/include/gentoo-multilib/amd64/sys/select.h" 3 4 extern int select (int __nfds, fd_set *__restrict __readfds, fd_set *__restrict __writefds, fd_set *__restrict __exceptfds, struct timeval *__restrict __timeout); # 121 "/usr/include/gentoo-multilib/amd64/sys/select.h" 3 4 extern int pselect (int __nfds, fd_set *__restrict __readfds, fd_set *__restrict __writefds, fd_set *__restrict __exceptfds, const struct timespec *__restrict __timeout, const __sigset_t *__restrict __sigmask); } # 9 "/usr/include/sys/select.h" 2 3 4 # 217 "/usr/include/gentoo-multilib/amd64/sys/types.h" 2 3 4 # 1 "/usr/include/sys/sysmacros.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/sys/sysmacros.h" 1 3 4 # 23 "/usr/include/gentoo-multilib/amd64/sys/sysmacros.h" 3 4 # 1 "/usr/include/features.h" 1 3 4 # 24 "/usr/include/gentoo-multilib/amd64/sys/sysmacros.h" 2 3 4 __extension__ extern __inline unsigned int gnu_dev_major (unsigned long long int __dev) throw (); __extension__ extern __inline unsigned int gnu_dev_minor (unsigned long long int __dev) throw (); __extension__ extern __inline unsigned long long int gnu_dev_makedev (unsigned int __major, unsigned int __minor) throw (); __extension__ extern __inline unsigned int gnu_dev_major (unsigned long long int __dev) throw () { return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff); } __extension__ extern __inline unsigned int gnu_dev_minor (unsigned long long int __dev) throw () { return (__dev & 0xff) | ((unsigned int) (__dev >> 12) & ~0xff); } __extension__ extern __inline unsigned long long int gnu_dev_makedev (unsigned int __major, unsigned int __minor) throw () { return ((__minor & 0xff) | ((__major & 0xfff) << 8) | (((unsigned long long int) (__minor & ~0xff)) << 12) | (((unsigned long long int) (__major & ~0xfff)) << 32)); } # 9 "/usr/include/sys/sysmacros.h" 2 3 4 # 220 "/usr/include/gentoo-multilib/amd64/sys/types.h" 2 3 4 typedef __blksize_t blksize_t; typedef __blkcnt_t blkcnt_t; typedef __fsblkcnt_t fsblkcnt_t; typedef __fsfilcnt_t fsfilcnt_t; # 258 "/usr/include/gentoo-multilib/amd64/sys/types.h" 3 4 typedef __blkcnt64_t blkcnt64_t; typedef __fsblkcnt64_t fsblkcnt64_t; typedef __fsfilcnt64_t fsfilcnt64_t; # 1 "/usr/include/bits/pthreadtypes.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/bits/pthreadtypes.h" 1 3 4 # 23 "/usr/include/gentoo-multilib/amd64/bits/pthreadtypes.h" 3 4 # 1 "/usr/include/bits/wordsize.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/bits/wordsize.h" 1 3 4 # 9 "/usr/include/bits/wordsize.h" 2 3 4 # 24 "/usr/include/gentoo-multilib/amd64/bits/pthreadtypes.h" 2 3 4 # 50 "/usr/include/gentoo-multilib/amd64/bits/pthreadtypes.h" 3 4 typedef unsigned long int pthread_t; typedef union { char __size[56]; long int __align; } pthread_attr_t; typedef union { struct { int __lock; unsigned int __count; int __owner; unsigned int __nusers; int __kind; int __spins; } __data; char __size[40]; long int __align; } pthread_mutex_t; typedef union { char __size[4]; int __align; } pthread_mutexattr_t; typedef union { struct { int __lock; unsigned int __futex; __extension__ unsigned long long int __total_seq; __extension__ unsigned long long int __wakeup_seq; __extension__ unsigned long long int __woken_seq; void *__mutex; unsigned int __nwaiters; unsigned int __broadcast_seq; } __data; char __size[48]; __extension__ long long int __align; } pthread_cond_t; typedef union { char __size[4]; int __align; } pthread_condattr_t; typedef unsigned int pthread_key_t; typedef int pthread_once_t; typedef union { struct { int __lock; unsigned int __nr_readers; unsigned int __readers_wakeup; unsigned int __writer_wakeup; unsigned int __nr_readers_queued; unsigned int __nr_writers_queued; int __writer; int __pad1; unsigned long int __pad2; unsigned long int __pad3; unsigned int __flags; } __data; # 162 "/usr/include/gentoo-multilib/amd64/bits/pthreadtypes.h" 3 4 char __size[56]; long int __align; } pthread_rwlock_t; typedef union { char __size[8]; long int __align; } pthread_rwlockattr_t; typedef volatile int pthread_spinlock_t; typedef union { char __size[32]; long int __align; } pthread_barrier_t; typedef union { char __size[4]; int __align; } pthread_barrierattr_t; # 9 "/usr/include/bits/pthreadtypes.h" 2 3 4 # 267 "/usr/include/gentoo-multilib/amd64/sys/types.h" 2 3 4 } # 9 "/usr/include/sys/types.h" 2 3 4 # 437 "/usr/include/gentoo-multilib/amd64/stdlib.h" 2 3 4 extern long int random (void) throw (); extern void srandom (unsigned int __seed) throw (); extern char *initstate (unsigned int __seed, char *__statebuf, size_t __statelen) throw () __attribute__ ((__nonnull__ (2))); extern char *setstate (char *__statebuf) throw () __attribute__ ((__nonnull__ (1))); struct random_data { int32_t *fptr; int32_t *rptr; int32_t *state; int rand_type; int rand_deg; int rand_sep; int32_t *end_ptr; }; extern int random_r (struct random_data *__restrict __buf, int32_t *__restrict __result) throw () __attribute__ ((__nonnull__ (1, 2))); extern int srandom_r (unsigned int __seed, struct random_data *__buf) throw () __attribute__ ((__nonnull__ (2))); extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, size_t __statelen, struct random_data *__restrict __buf) throw () __attribute__ ((__nonnull__ (2, 4))); extern int setstate_r (char *__restrict __statebuf, struct random_data *__restrict __buf) throw () __attribute__ ((__nonnull__ (1, 2))); extern int rand (void) throw (); extern void srand (unsigned int __seed) throw (); extern int rand_r (unsigned int *__seed) throw (); extern double drand48 (void) throw (); extern double erand48 (unsigned short int __xsubi[3]) throw () __attribute__ ((__nonnull__ (1))); extern long int lrand48 (void) throw (); extern long int nrand48 (unsigned short int __xsubi[3]) throw () __attribute__ ((__nonnull__ (1))); extern long int mrand48 (void) throw (); extern long int jrand48 (unsigned short int __xsubi[3]) throw () __attribute__ ((__nonnull__ (1))); extern void srand48 (long int __seedval) throw (); extern unsigned short int *seed48 (unsigned short int __seed16v[3]) throw () __attribute__ ((__nonnull__ (1))); extern void lcong48 (unsigned short int __param[7]) throw () __attribute__ ((__nonnull__ (1))); struct drand48_data { unsigned short int __x[3]; unsigned short int __old_x[3]; unsigned short int __c; unsigned short int __init; unsigned long long int __a; }; extern int drand48_r (struct drand48_data *__restrict __buffer, double *__restrict __result) throw () __attribute__ ((__nonnull__ (1, 2))); extern int erand48_r (unsigned short int __xsubi[3], struct drand48_data *__restrict __buffer, double *__restrict __result) throw () __attribute__ ((__nonnull__ (1, 2))); extern int lrand48_r (struct drand48_data *__restrict __buffer, long int *__restrict __result) throw () __attribute__ ((__nonnull__ (1, 2))); extern int nrand48_r (unsigned short int __xsubi[3], struct drand48_data *__restrict __buffer, long int *__restrict __result) throw () __attribute__ ((__nonnull__ (1, 2))); extern int mrand48_r (struct drand48_data *__restrict __buffer, long int *__restrict __result) throw () __attribute__ ((__nonnull__ (1, 2))); extern int jrand48_r (unsigned short int __xsubi[3], struct drand48_data *__restrict __buffer, long int *__restrict __result) throw () __attribute__ ((__nonnull__ (1, 2))); extern int srand48_r (long int __seedval, struct drand48_data *__buffer) throw () __attribute__ ((__nonnull__ (2))); extern int seed48_r (unsigned short int __seed16v[3], struct drand48_data *__buffer) throw () __attribute__ ((__nonnull__ (1, 2))); extern int lcong48_r (unsigned short int __param[7], struct drand48_data *__buffer) throw () __attribute__ ((__nonnull__ (1, 2))); extern void *malloc (size_t __size) throw () __attribute__ ((__malloc__)) ; extern void *calloc (size_t __nmemb, size_t __size) throw () __attribute__ ((__malloc__)) ; extern void *realloc (void *__ptr, size_t __size) throw () __attribute__ ((__malloc__)) __attribute__ ((__warn_unused_result__)); extern void free (void *__ptr) throw (); extern void cfree (void *__ptr) throw (); # 1 "/usr/include/alloca.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/alloca.h" 1 3 4 # 22 "/usr/include/gentoo-multilib/amd64/alloca.h" 3 4 # 1 "/usr/include/features.h" 1 3 4 # 23 "/usr/include/gentoo-multilib/amd64/alloca.h" 2 3 4 # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 1 3 4 # 26 "/usr/include/gentoo-multilib/amd64/alloca.h" 2 3 4 extern "C" { extern void *alloca (size_t __size) throw (); } # 9 "/usr/include/alloca.h" 2 3 4 # 611 "/usr/include/gentoo-multilib/amd64/stdlib.h" 2 3 4 extern void *valloc (size_t __size) throw () __attribute__ ((__malloc__)) ; extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) throw () __attribute__ ((__nonnull__ (1))) ; extern void abort (void) throw () __attribute__ ((__noreturn__)); extern int atexit (void (*__func) (void)) throw () __attribute__ ((__nonnull__ (1))); extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) throw () __attribute__ ((__nonnull__ (1))); extern void exit (int __status) throw () __attribute__ ((__noreturn__)); extern void _Exit (int __status) throw () __attribute__ ((__noreturn__)); extern char *getenv (__const char *__name) throw () __attribute__ ((__nonnull__ (1))) ; extern char *__secure_getenv (__const char *__name) throw () __attribute__ ((__nonnull__ (1))) ; extern int putenv (char *__string) throw () __attribute__ ((__nonnull__ (1))); extern int setenv (__const char *__name, __const char *__value, int __replace) throw () __attribute__ ((__nonnull__ (2))); extern int unsetenv (__const char *__name) throw (); extern int clearenv (void) throw (); # 696 "/usr/include/gentoo-multilib/amd64/stdlib.h" 3 4 extern char *mktemp (char *__template) throw () __attribute__ ((__nonnull__ (1))) ; # 707 "/usr/include/gentoo-multilib/amd64/stdlib.h" 3 4 extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ; # 717 "/usr/include/gentoo-multilib/amd64/stdlib.h" 3 4 extern int mkstemp64 (char *__template) __attribute__ ((__nonnull__ (1))) ; # 727 "/usr/include/gentoo-multilib/amd64/stdlib.h" 3 4 extern char *mkdtemp (char *__template) throw () __attribute__ ((__nonnull__ (1))) ; extern int system (__const char *__command) ; extern char *canonicalize_file_name (__const char *__name) throw () __attribute__ ((__nonnull__ (1))) ; # 755 "/usr/include/gentoo-multilib/amd64/stdlib.h" 3 4 extern char *realpath (__const char *__restrict __name, char *__restrict __resolved) throw () ; typedef int (*__compar_fn_t) (__const void *, __const void *); typedef __compar_fn_t comparison_fn_t; extern void *bsearch (__const void *__key, __const void *__base, size_t __nmemb, size_t __size, __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 2, 5))) ; extern void qsort (void *__base, size_t __nmemb, size_t __size, __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4))); extern int abs (int __x) throw () __attribute__ ((__const__)) ; extern long int labs (long int __x) throw () __attribute__ ((__const__)) ; __extension__ extern long long int llabs (long long int __x) throw () __attribute__ ((__const__)) ; extern div_t div (int __numer, int __denom) throw () __attribute__ ((__const__)) ; extern ldiv_t ldiv (long int __numer, long int __denom) throw () __attribute__ ((__const__)) ; __extension__ extern lldiv_t lldiv (long long int __numer, long long int __denom) throw () __attribute__ ((__const__)) ; # 820 "/usr/include/gentoo-multilib/amd64/stdlib.h" 3 4 extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign) throw () __attribute__ ((__nonnull__ (3, 4))) ; extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign) throw () __attribute__ ((__nonnull__ (3, 4))) ; extern char *gcvt (double __value, int __ndigit, char *__buf) throw () __attribute__ ((__nonnull__ (3))) ; extern char *qecvt (long double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign) throw () __attribute__ ((__nonnull__ (3, 4))) ; extern char *qfcvt (long double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign) throw () __attribute__ ((__nonnull__ (3, 4))) ; extern char *qgcvt (long double __value, int __ndigit, char *__buf) throw () __attribute__ ((__nonnull__ (3))) ; extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign, char *__restrict __buf, size_t __len) throw () __attribute__ ((__nonnull__ (3, 4, 5))); extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign, char *__restrict __buf, size_t __len) throw () __attribute__ ((__nonnull__ (3, 4, 5))); extern int qecvt_r (long double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign, char *__restrict __buf, size_t __len) throw () __attribute__ ((__nonnull__ (3, 4, 5))); extern int qfcvt_r (long double __value, int __ndigit, int *__restrict __decpt, int *__restrict __sign, char *__restrict __buf, size_t __len) throw () __attribute__ ((__nonnull__ (3, 4, 5))); extern int mblen (__const char *__s, size_t __n) throw () ; extern int mbtowc (wchar_t *__restrict __pwc, __const char *__restrict __s, size_t __n) throw () ; extern int wctomb (char *__s, wchar_t __wchar) throw () ; extern size_t mbstowcs (wchar_t *__restrict __pwcs, __const char *__restrict __s, size_t __n) throw (); extern size_t wcstombs (char *__restrict __s, __const wchar_t *__restrict __pwcs, size_t __n) throw (); extern int rpmatch (__const char *__response) throw () __attribute__ ((__nonnull__ (1))) ; # 908 "/usr/include/gentoo-multilib/amd64/stdlib.h" 3 4 extern int getsubopt (char **__restrict __optionp, char *__const *__restrict __tokens, char **__restrict __valuep) throw () __attribute__ ((__nonnull__ (1, 2, 3))) ; extern void setkey (__const char *__key) throw () __attribute__ ((__nonnull__ (1))); extern int posix_openpt (int __oflag) ; extern int grantpt (int __fd) throw (); extern int unlockpt (int __fd) throw (); extern char *ptsname (int __fd) throw () ; extern int ptsname_r (int __fd, char *__buf, size_t __buflen) throw () __attribute__ ((__nonnull__ (2))); extern int getpt (void); extern int getloadavg (double __loadavg[], int __nelem) throw () __attribute__ ((__nonnull__ (1))); # 973 "/usr/include/gentoo-multilib/amd64/stdlib.h" 3 4 } # 9 "/usr/include/stdlib.h" 2 3 4 # 8 "../include/ISet.cxx" 2 namespace OpenSP { template ISet::ISet() { } template ISet::~ISet() { } template ISet::ISet(const T *v, size_t n) { for (size_t i = 0; i < n; i++) add(v[i]); } template Boolean ISet::contains(T x) const { for (size_t i = 0; i < r_.size(); i++) if (r_[i].max >= x) return r_[i].min <= x ? 1 : 0; return 0; } template void ISet::addRange(T min, T max) { size_t i; if (min == 0) i = 0; else { for (i = r_.size(); i > 0 && min - 1 <= r_[i - 1].max; i--) ; } if (i < r_.size() && (r_[i].min == 0 || max >= r_[i].min - 1)) { if (min < r_[i].min) r_[i].min = min; if (max > r_[i].max) { r_[i].max = max; size_t j; for (j = i + 1; j < r_.size() && r_[i].max >= r_[j].min - 1; j++) r_[i].max = r_[j].max; if (j > i + 1) { for (size_t k = j; k < r_.size(); k++) r_[k - (j - i - 1)] = r_[k]; r_.resize(r_.size() - (j - i - 1)); } } } else { r_.resize(r_.size() + 1); for (size_t j = r_.size() - 1; j > i; j--) r_[j] = r_[j - 1]; r_[i].max = max; r_[i].min = min; } } template void ISet::remove(T c) { for (size_t i = 0; i < r_.size(); i++) if (r_[i].max >= c) { if (r_[i].min <= c) { if (r_[i].min == r_[i].max) { while (++i < r_.size()) r_[i - 1] = r_[i]; r_.resize(r_.size() - 1); } else if (c == r_[i].min) r_[i].min += 1; else if (c == r_[i].max) r_[i].max -= 1; else { r_.resize(r_.size() + 1); for (size_t j = r_.size() - 2; j > i; j--) r_[j + 1] = r_[j]; r_[i + 1].max = r_[i].max; r_[i + 1].min = c + 1; r_[i].max = c - 1; } } break; } } template void ISet::check() { for (size_t i = 0; i < r_.size(); i++) { if (r_[i].min > r_[i].max) abort(); if (i > 0 && r_[i].min - 1 <= r_[i - 1].max) abort(); } } template void ISet::clear() { r_.resize(0); } } # 58 "../include/ISet.h" 2 # 10 "../include/RangeMap.h" 2 # 1 "../include/constant.h" 1 namespace OpenSP { const Char charMax = 0x10ffff; const WideChar wideCharMax = WideChar(-1); const UnivChar univCharMax = UnivChar(-1); const SyntaxChar syntaxCharMax = SyntaxChar(-1); } # 12 "../include/RangeMap.h" 2 # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 1 3 4 # 13 "../include/RangeMap.h" 2 namespace OpenSP { template struct RangeMapRange { From fromMin; From fromMax; To toMin; }; template class RangeMapIter; template class RangeMap { public: RangeMap(); Boolean map(From, To &, From &alsoMax) const; unsigned inverseMap(To, From &, ISet &, WideChar &count) const; void addRange(From, From, To); private: Vector > ranges_; friend class RangeMapIter; }; template class RangeMapIter { public: RangeMapIter(const RangeMap &map); Boolean next(From &fromMin, From &fromMax, To &toMin) { if (!count_) return 0; else { fromMin = ptr_->fromMin; fromMax = ptr_->fromMax; toMin = ptr_->toMin; ptr_++; count_--; return 1; } } private: size_t count_; typename Vector >::const_iterator ptr_; }; } # 1 "../include/RangeMap.cxx" 1 # 1 "../include/RangeMap.h" 1 # 68 "../include/RangeMap.h" # 1 "../include/RangeMap.cxx" 1 # 69 "../include/RangeMap.h" 2 # 8 "../include/RangeMap.cxx" 2 # 1 "../include/ISet.h" 1 # 9 "../include/RangeMap.cxx" 2 namespace OpenSP { template RangeMap::RangeMap() { } template Boolean RangeMap::map(From from, To &to, From &alsoMax) const { for (size_t i = 0; i < ranges_.size(); i++) { const RangeMapRange &r = ranges_[i]; if (r.fromMin <= from && from <= r.fromMax) { to = r.toMin + (from - r.fromMin); alsoMax = r.fromMax; return 1; } if (r.fromMin > from) { alsoMax = r.fromMin - 1; return 0; } } alsoMax = From(-1); return 0; } typedef ISet RangeMap_dummy; template unsigned RangeMap::inverseMap(To to, From &from, ISet &fromSet, WideChar &count) const { unsigned ret = 0; count = wideCharMax; for (size_t i = 0; i < ranges_.size(); i++) { const RangeMapRange &r = ranges_[i]; if (r.toMin <= to && to <= r.toMin + (r.fromMax - r.fromMin)) { From n = r.fromMin + (to - r.toMin); WideChar thisCount = r.fromMax - n + 1; if (ret > 1) { fromSet.add(n); if (thisCount < count) count = thisCount; } else if (ret == 1) { fromSet.add(from); fromSet.add(n); ret = 2; if (thisCount < count) count = thisCount; } else { count = thisCount; from = n; ret = 1; } } else if (ret == 0 && r.toMin > to && (r.toMin - to < count)) count = r.toMin - to; } return ret; } template RangeMapIter::RangeMapIter(const RangeMap &map) : count_(map.ranges_.size()), ptr_(map.ranges_.begin()) { } template void RangeMap::addRange(From fromMin, From fromMax, To toMin) { size_t i; for (i = ranges_.size(); i > 0; i--) if (fromMin > ranges_[i - 1].fromMax) break; Boolean coalesced = 0; if (i > 0 && ranges_[i - 1].fromMax + 1 == fromMin && ranges_[i - 1].toMin + (fromMin - ranges_[i - 1].fromMin) == toMin) { ranges_[i - 1].fromMax = fromMax; i--; coalesced = 1; } else if (i < ranges_.size() && fromMax >= ranges_[i].fromMin - 1) { if (fromMin <= ranges_[i].fromMin) { if (toMin + (ranges_[i].fromMin - fromMin) == ranges_[i].toMin) { ranges_[i].fromMin = fromMin; if (fromMax <= ranges_[i].fromMax) return; ranges_[i].fromMax = fromMax; coalesced = 1; } } else { if (ranges_[i].toMin + (fromMin - ranges_[i].fromMin) == toMin) { if (fromMax < ranges_[i].fromMax) return; ranges_[i].fromMax = fromMax; coalesced = 1; } } } if (!coalesced) { ranges_.resize(ranges_.size() + 1); for (size_t j = ranges_.size() - 1; j > i; j--) ranges_[j] = ranges_[j - 1]; ranges_[i].fromMin = fromMin; ranges_[i].fromMax = fromMax; ranges_[i].toMin = toMin; } size_t j; for (j = i + 1; j < ranges_.size(); j++) { if (fromMax < ranges_[j].fromMax) { if (fromMax >= ranges_[j].fromMin) ranges_[j].fromMin = fromMax + 1; break; } } if (j > i + 1) { size_t count = ranges_.size() - j; for (size_t k = 0; k < count; k++) ranges_[i + 1 + count] = ranges_[j + count]; ranges_.resize(ranges_.size() - (j - (i + 1))); } } } # 69 "../include/RangeMap.h" 2 # 14 "../include/UnivCharsetDesc.h" 2 # 1 "../include/ISet.h" 1 # 16 "../include/UnivCharsetDesc.h" 2 namespace OpenSP { class UnivCharsetDesc { public: struct Range { WideChar descMin; unsigned long count; UnivChar univMin; }; enum { zero = 48, A = 65, a = 97, tab = 9, rs = 10, re = 13, space = 32, exclamation = 33, lessThan = 60, greaterThan = 62 }; UnivCharsetDesc(); UnivCharsetDesc(const Range *, size_t); void set(const Range *, size_t); Boolean descToUniv(WideChar from, UnivChar &to) const; Boolean descToUniv(WideChar from, UnivChar &to, WideChar &alsoMax) const; unsigned univToDesc(UnivChar from, WideChar &to, ISet &toSet) const; unsigned univToDesc(UnivChar from, WideChar &to, ISet &toSet, WideChar &count) const; void addRange(WideChar descMin, WideChar descMax, UnivChar univMin); void addBaseRange(const UnivCharsetDesc &baseSet, WideChar descMin, WideChar descMax, WideChar baseMin, ISet &baseMissing); private: static Boolean noDesc(Unsigned32 n) { return (n & (unsigned(1) << 31)); } static UnivChar extractChar(Unsigned32 n, Char ch) { return UnivChar((n + ch) & ((unsigned(1) << 31) - 1)); } static Unsigned32 wrapChar(UnivChar univ, Char ch) { return Unsigned32((univ - ch) & ((unsigned(1) << 31) - 1)); } CharMap charMap_; RangeMap rangeMap_; friend class UnivCharsetDescIter; }; class UnivCharsetDescIter { public: UnivCharsetDescIter(const UnivCharsetDesc &); Boolean next(WideChar &descMin, WideChar &descMax, UnivChar &univMin); void skipTo(WideChar); private: const CharMap *charMap_; Char nextChar_; Boolean doneCharMap_; RangeMapIter rangeMapIter_; }; inline Boolean UnivCharsetDesc::descToUniv(WideChar from, UnivChar &to) const { if (from > charMax) { WideChar tem; return rangeMap_.map(from, to, tem); } else { Unsigned32 tem = charMap_[from]; if (noDesc(tem)) return 0; else { to = extractChar(tem, from); return 1; } } } inline Boolean UnivCharsetDesc::descToUniv(WideChar from, UnivChar &to, WideChar &alsoMax) const { if (from > charMax) return rangeMap_.map(from, to, alsoMax); else { Char max; Unsigned32 tem = charMap_.getRange(from, max); alsoMax = max; if (noDesc(tem)) return 0; else { to = extractChar(tem, from); return 1; } } } inline unsigned UnivCharsetDesc::univToDesc(UnivChar from, WideChar &to, ISet &toSet) const { WideChar tem; return univToDesc(from, to, toSet, tem); } inline void UnivCharsetDescIter::skipTo(WideChar ch) { if (ch > charMax) doneCharMap_ = 1; else nextChar_ = ch; } } # 12 "../include/CharsetInfo.h" 2 # 1 "../include/ISet.h" 1 # 16 "../include/CharsetInfo.h" 2 # 1 "../include/CharMap.h" 1 # 17 "../include/CharsetInfo.h" 2 namespace OpenSP { class CharsetInfo { public: CharsetInfo(); CharsetInfo(const UnivCharsetDesc &); void set(const UnivCharsetDesc &); Char execToDesc(char) const; StringC execToDesc(const char *s) const; Boolean descToUniv(WideChar from, UnivChar &to) const; Boolean descToUniv(WideChar from, UnivChar &to, WideChar &alsoMax) const; unsigned univToDesc(UnivChar from, WideChar &to, ISet &toSet) const; unsigned univToDesc(UnivChar from, WideChar &to, ISet &toSet, WideChar &count) const; void getDescSet(ISet &) const; int digitWeight(Char) const; int hexDigitWeight(Char) const; const UnivCharsetDesc &desc() const; private: void init(); UnivCharsetDesc desc_; CharMap inverse_; Char execToDesc_[(127 * 2 + 1) + 1]; }; inline unsigned CharsetInfo::univToDesc(UnivChar from, WideChar &to, ISet &toSet) const { if (from <= charMax) { Unsigned32 n = inverse_[from]; if (n == Unsigned32(-1)) return 0; if (n != Unsigned32(-2)) { to = ((n + from) & ((Unsigned32(1) << 31) - 1)); return 1; } } return desc_.univToDesc(from, to, toSet); } inline unsigned CharsetInfo::univToDesc(UnivChar from, WideChar &to, ISet &toSet, WideChar &count) const { if (from <= charMax) { Char fromMax; Unsigned32 n = inverse_.getRange(from, fromMax); if (n == Unsigned32(-1)) { count = (fromMax - from) + 1; return 0; } if (n != Unsigned32(-2)) { to = ((n + from) & ((Unsigned32(1) << 31) - 1)); count = (fromMax - from) + 1; return 1; } } return desc_.univToDesc(from, to, toSet, count); } inline Boolean CharsetInfo::descToUniv(UnivChar from, WideChar &to) const { return desc_.descToUniv(from, to); } inline Char CharsetInfo::execToDesc(char c) const { return execToDesc_[(unsigned char)c]; } inline Boolean CharsetInfo::descToUniv(WideChar from, UnivChar &to, WideChar &alsoMax) const { return desc_.descToUniv(from, to, alsoMax); } inline const UnivCharsetDesc &CharsetInfo::desc() const { return desc_; } } # 14 "../include/Sd.h" 2 # 1 "../include/ISet.h" 1 # 16 "../include/Sd.h" 2 # 1 "../include/Syntax.h" 1 #pragma interface # 1 "../include/ISet.h" 1 # 13 "../include/Syntax.h" 2 # 1 "../include/HashTable.h" 1 # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 1 3 4 # 8 "../include/HashTable.h" 2 # 1 "../include/OwnerTable.h" 1 # 1 "../include/PointerTable.h" 1 # 1 "../include/Vector.h" 1 # 8 "../include/PointerTable.h" 2 # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 1 3 4 # 10 "../include/PointerTable.h" 2 namespace OpenSP { template class PointerTableIter; template class PointerTable { void constraints() { P p(0); const K &key = KF::key(*p); unsigned long n = HF::hash(key); n = 0; } public: PointerTable(); P insert(P, Boolean replace = 0); const P &lookup(const K &) const; P remove(const K &); size_t count() const { return used_; } void clear(); void swap(PointerTable &); protected: size_t used_; size_t usedLimit_; Vector

vec_; P null_; size_t startIndex(const K &k) const { return size_t(HF::hash(k) & (vec_.size() - 1)); } size_t nextIndex(size_t i) const { return i == 0 ? vec_.size() - 1 : i - 1; } friend class PointerTableIter; }; template class PointerTableIter { public: PointerTableIter(const PointerTable &); const P &next(); private: const PointerTable *tablePtr_; size_t i_; }; } # 1 "../include/PointerTable.cxx" 1 # 1 "/usr/include/stdlib.h" 1 3 4 # 8 "../include/PointerTable.cxx" 2 namespace OpenSP { template PointerTable::PointerTable() : used_(0), usedLimit_(0), null_(0) { } template void PointerTable::clear() { vec_.clear(); used_ = 0; usedLimit_ = 0; } template P PointerTable::insert(P p, Boolean replace) { size_t h; if (vec_.size() == 0) { vec_.assign(8, P(0)); usedLimit_ = 4; h = startIndex(KF::key(*p)); } else { for (h = startIndex(KF::key(*p)); vec_[h] != 0 ; h = nextIndex(h)) if (KF::key(*vec_[h]) == KF::key(*p)) { if (replace) { P tem(vec_[h]); vec_[h] = p; return tem; } else return vec_[h]; } if (used_ >= usedLimit_) { if (vec_.size() > size_t(-1)/2) { if (usedLimit_ == vec_.size() - 1) abort(); else usedLimit_ = vec_.size() - 1; } else { Vector

oldVec(vec_.size()*2, P(0)); vec_.swap(oldVec); usedLimit_ = vec_.size() / 2; for (size_t i = 0; i < oldVec.size(); i++) if (oldVec[i] != 0) { size_t j; for (j = startIndex(KF::key(*oldVec[i])); vec_[j] != 0; j = nextIndex(j)) ; vec_[j] = oldVec[i]; } for (h = startIndex(KF::key(*p)); vec_[h] != 0; h = nextIndex(h)) ; } } } used_++; vec_[h] = p; return 0; } template const P &PointerTable::lookup(const K &k) const { if (used_ > 0) { for (size_t i = startIndex(k); vec_[i] != 0; i = nextIndex(i)) if (KF::key(*vec_[i]) == k) return vec_[i]; } return null_; } template P PointerTable::remove(const K &k) { if (used_ > 0) { for (size_t i = startIndex(k); vec_[i] != 0; i = nextIndex(i)) if (KF::key(*vec_[i]) == k) { P p = vec_[i]; do { vec_[i] = P(0); size_t j = i; size_t r; do { i = nextIndex(i); if (vec_[i] == 0) break; r = startIndex(KF::key(*vec_[i])); } while ((i <= r && r < j) || (r < j && j < i) || (j < i && i <= r)); vec_[j] = vec_[i]; } while (vec_[i] != 0); --used_; return p; } } return 0; } template void PointerTable::swap(PointerTable &to) { vec_.swap(to.vec_); size_t tem = to.used_; to.used_ = used_; used_ = tem; tem = to.usedLimit_; to.usedLimit_ = usedLimit_; usedLimit_ = tem; } template PointerTableIter::PointerTableIter(const PointerTable &table) : tablePtr_(&table), i_(0) { } template const P &PointerTableIter::next() { for (; i_ < tablePtr_->vec_.size(); i_++) if (tablePtr_->vec_[i_] != 0) return tablePtr_->vec_[i_++]; return tablePtr_->null_; } } # 68 "../include/PointerTable.h" 2 # 8 "../include/OwnerTable.h" 2 namespace OpenSP { template class OwnerTable : public PointerTable { public: OwnerTable() { } ~OwnerTable(); void clear(); void swap(OwnerTable &x) { PointerTable::swap(x); } private: OwnerTable(const OwnerTable &); void operator=(const OwnerTable &); }; template class OwnerTableIter : public PointerTableIter { public: OwnerTableIter(const OwnerTable &table) : PointerTableIter(table) { } }; template class CopyOwnerTable : public OwnerTable { public: CopyOwnerTable() { } CopyOwnerTable(const CopyOwnerTable &tab) { *this = tab; } void operator=(const CopyOwnerTable &tab); }; } # 1 "../include/OwnerTable.cxx" 1 namespace OpenSP { template OwnerTable::~OwnerTable() { for (size_t i = 0; i < this->vec_.size(); i++) delete this->vec_[i]; } template void OwnerTable::clear() { for (size_t i = 0; i < this->vec_.size(); i++) delete this->vec_[i]; PointerTable::clear(); } template void CopyOwnerTable::operator=(const CopyOwnerTable &t) { this->clear(); PointerTable::operator=(t); for (size_t i = 0; i < this->vec_.size(); i++) if (this->vec_[i]) this->vec_[i] = this->vec_[i]->copy(); } } # 50 "../include/OwnerTable.h" 2 # 9 "../include/HashTable.h" 2 # 1 "../include/Hash.h" 1 #pragma interface namespace OpenSP { class Hash { public: static unsigned long hash(const StringC &); }; } # 10 "../include/HashTable.h" 2 # 1 "../include/HashTableItemBase.h" 1 # 11 "../include/HashTableItemBase.h" namespace OpenSP { template class HashTableItemBase { public: HashTableItemBase(const K &k); virtual ~HashTableItemBase(); virtual HashTableItemBase *copy() const = 0; K key; }; template struct HashTableKeyFunction { static inline const K &key(const HashTableItemBase &obj) { return obj.key; } }; } # 1 "../include/HashTableItemBase.cxx" 1 namespace OpenSP { template HashTableItemBase::~HashTableItemBase() { } template HashTableItemBase::HashTableItemBase(const K &k) : key(k) { } } # 38 "../include/HashTableItemBase.h" 2 # 12 "../include/HashTable.h" 2 namespace OpenSP { template class HashTableItem : public HashTableItemBase { public: HashTableItem(const K &k, const V &v); HashTableItemBase *copy() const; V value; }; template class HashTableIter; template class HashTable { public: HashTable() { } void insert(const K &key, const V &value, Boolean replace = 1); const V *lookup(const K &key) const { HashTableItem *tem = (HashTableItem *)table_.lookup(key); return tem ? &tem->value : 0; } size_t count() const { return table_.count(); } private: CopyOwnerTable, K, Hash, HashTableKeyFunction > table_; friend class HashTableIter; }; template class HashTableIter { public: HashTableIter(const HashTable &table) : iter_(table.table_) { } Boolean next(const K *&key, const V *&value) { HashTableItem *p = (HashTableItem *)iter_.next(); if (p) { key = &p->key; value = &p->value; return 1; } else return 0; } private: OwnerTableIter, K, Hash, HashTableKeyFunction > iter_; }; } # 1 "../include/HashTable.cxx" 1 namespace OpenSP { template void HashTable::insert(const K &key, const V &value, Boolean replace) { HashTableItem *newItem = new HashTableItem(key, value); HashTableItem *tem = (HashTableItem *)table_.insert(newItem); if (tem) { delete newItem; if (replace) { tem->key = key; tem->value = value; } } } template HashTableItem::HashTableItem(const K &k, const V &v) : HashTableItemBase(k), value(v) { } template HashTableItemBase *HashTableItem::copy() const { return new HashTableItem(*this); } } # 68 "../include/HashTable.h" 2 # 16 "../include/Syntax.h" 2 # 1 "../include/Vector.h" 1 # 17 "../include/Syntax.h" 2 # 1 "../include/XcharMap.h" 1 # 9 "../include/XcharMap.h" # 1 "../include/Ptr.h" 1 # 10 "../include/XcharMap.h" 2 # 1 "../include/CharMap.h" 1 # 12 "../include/XcharMap.h" 2 namespace OpenSP { template class SharedXcharMap : public Resource { public: SharedXcharMap(); SharedXcharMap(T defaultValue); T *ptr() { return v + 1; } private: T v[2 + 0xffff]; }; template class XcharMap { public: XcharMap(); XcharMap(T defaultValue); T operator[](Xchar c) const; void setRange(Char min, Char max, T val); void setChar(Char c, T val); void setEe(T val); void clear(); private: T *ptr_; Ptr > sharedMap_; Ptr > hiMap_; }; template inline T XcharMap::operator[](Xchar c) const { if (c > 0xffff) return hiMap_->operator[]((Char)c); return ptr_[c]; } template inline void XcharMap::setChar(Char c, T val) { if (c > 0xffff) { hiMap_->setChar(c, val); return; } ptr_[c] = val; } template inline void XcharMap::setEe(T val) { ptr_[-1] = val; } template inline void XcharMap::clear() { ptr_ = 0; sharedMap_.clear(); hiMap_.clear(); } } # 1 "../include/XcharMap.cxx" 1 # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 1 3 4 # 8 "../include/XcharMap.cxx" 2 namespace OpenSP { template SharedXcharMap::SharedXcharMap() { } template SharedXcharMap::SharedXcharMap(T defaultValue) { for (size_t i = 0; i < sizeof(v)/sizeof(v[0]); i++) v[i] = defaultValue; } template XcharMap::XcharMap() : ptr_(0) { } template XcharMap::XcharMap(T defaultValue) : sharedMap_(new SharedXcharMap(defaultValue)) , hiMap_(new CharMapResource(defaultValue)) { ptr_ = sharedMap_->ptr(); } template void XcharMap::setRange(Char min, Char max, T val) { if (min <= max) { if (min <= 0xffff) { Char m = max <= 0xffff ? max : 0xffff; do { ptr_[min] = val; } while (min++ != m); } if (max >= 0x10000) hiMap_->setRange(min < 0x10000 ? 0x10000 : min, max, val); } } } # 100 "../include/XcharMap.h" 2 # 19 "../include/Syntax.h" 2 # 1 "../include/EntityCatalog.h" 1 #pragma interface # 14 "../include/EntityCatalog.h" namespace OpenSP { class Messenger; class CharsetInfo; class EntityDecl; class EntityCatalog : public Resource { public: class Syntax { public: virtual Boolean namecaseGeneral() const = 0; virtual Boolean namecaseEntity() const = 0; virtual const SubstTable &upperSubstTable() const = 0; virtual const StringC &peroDelim() const = 0; }; virtual ~EntityCatalog(); virtual Boolean sgmlDecl(const CharsetInfo &, Messenger &, const StringC &, StringC &) const; virtual Boolean lookup(const EntityDecl &, const Syntax &, const CharsetInfo &, Messenger &, StringC &) const; virtual Boolean lookupPublic(const StringC &, const CharsetInfo &, Messenger &, StringC &) const; virtual Boolean lookupChar(const StringC &, const CharsetInfo &, Messenger &, UnivChar &) const; }; } # 20 "../include/Syntax.h" 2 namespace OpenSP { class Sd; class CharsetInfo; class Syntax : public Resource, public EntityCatalog::Syntax { public: enum ReservedName { rALL, rANY, rATTLIST, rCDATA, rCONREF, rCURRENT, rDATA, rDEFAULT, rDOCTYPE, rELEMENT, rEMPTY, rENDTAG, rENTITIES, rENTITY, rFIXED, rID, rIDLINK, rIDREF, rIDREFS, rIGNORE, rIMPLICIT, rIMPLIED, rINCLUDE, rINITIAL, rLINK, rLINKTYPE, rMD, rMS, rNAME, rNAMES, rNDATA, rNMTOKEN, rNMTOKENS, rNOTATION, rNUMBER, rNUMBERS, rNUTOKEN, rNUTOKENS, rO, rPCDATA, rPI, rPOSTLINK, rPUBLIC, rRCDATA, rRE, rREQUIRED, rRESTORE, rRS, rSDATA, rSHORTREF, rSIMPLE, rSPACE, rSTARTTAG, rSUBDOC, rSYSTEM, rTEMP, rUSELINK, rUSEMAP }; enum { nNames = rUSEMAP + 1 }; enum Quantity { qATTCNT, qATTSPLEN, qBSEQLEN, qDTAGLEN, qDTEMPLEN, qENTLVL, qGRPCNT, qGRPGTCNT, qGRPLVL, qLITLEN, qNAMELEN, qNORMSEP, qPILEN, qTAGLEN, qTAGLVL }; enum { nQuantity = qTAGLVL + 1 }; enum { unlimited = 100000000 }; enum DelimGeneral { dAND, dCOM, dCRO, dDSC, dDSO, dDTGC, dDTGO, dERO, dETAGO, dGRPC, dGRPO, dHCRO, dLIT, dLITA, dMDC, dMDO, dMINUS, dMSC, dNET, dNESTC, dOPT, dOR, dPERO, dPIC, dPIO, dPLUS, dREFC, dREP, dRNI, dSEQ, dSTAGO, dTAGC, dVI }; enum { nDelimGeneral = dVI + 1 }; enum StandardFunction { fRE, fRS, fSPACE }; enum FunctionClass { cFUNCHAR, cSEPCHAR, cMSOCHAR, cMSICHAR, cMSSCHAR }; enum Set { nameStart, digit, hexDigit, nmchar, s, blank, sepchar, minimumData, significant, functionChar, sgmlChar }; enum { nSet = sgmlChar + 1 }; enum Category { otherCategory = 0, sCategory = 01, nameStartCategory = 02, digitCategory = 04, otherNameCategory = 010 }; Syntax(const Sd &); Boolean lookupFunctionChar(const StringC &, Char *) const; HashTableIter functionIter() const; Boolean charFunctionName(Char c, const StringC *&name) const; Boolean lookupReservedName(const StringC &, ReservedName *) const; const StringC &reservedName(ReservedName) const; StringC rniReservedName(ReservedName) const; Number quantity(Quantity) const; Char standardFunction(int) const; Boolean getStandardFunction(int, Char &) const; const StringC &delim() const; const ISet *charSet(int i) const; const SubstTable *generalSubstTable() const; const SubstTable *entitySubstTable() const; const SubstTable &upperSubstTable() const; Boolean namecaseGeneral() const; Boolean namecaseEntity() const; const StringC &peroDelim() const; const StringC &delimGeneral(int) const; const StringC &delimShortrefComplex(size_t) const; const ISet &delimShortrefSimple() const; int nDelimShortrefComplex() const; Boolean isValidShortref(const StringC &) const; Boolean hasShortrefs() const; Boolean isNameCharacter(Xchar) const; Boolean isNameStartCharacter(Xchar) const; Boolean isDigit(Xchar) const; Boolean isHexDigit(Xchar) const; Boolean isS(Xchar) const; Boolean isB(Xchar c) const; Category charCategory(Xchar) const; Boolean isSgmlChar(Xchar) const; size_t attcnt() const; size_t attsplen() const; size_t namelen() const; size_t penamelen() const; size_t litlen() const; size_t normsep() const; size_t dtemplen() const; size_t grpcnt() const; size_t grpgtcnt() const; size_t grplvl() const; size_t taglvl() const; size_t taglen() const; size_t entlvl() const; size_t pilen() const; Char space() const; void setStandardFunction(StandardFunction, Char); void enterStandardFunctionNames(); void addFunctionChar(const StringC &, FunctionClass, Char); void setNamecaseGeneral(Boolean); void setNamecaseEntity(Boolean); void setDelimGeneral(int, const StringC &); void addDelimShortref(const StringC &, const CharsetInfo &); void addDelimShortrefs(const ISet &shortrefChars, const CharsetInfo &charset); void addNameCharacters(const ISet &); void addNameStartCharacters(const ISet &); void addSubst(Char lc, Char uc); void addShunchar(Char); void setShuncharControls(); void setQuantity(int, Number); void setName(int, const StringC &); void setSgmlChar(const ISet &); void implySgmlChar(const Sd &); void checkSgmlChar(const Sd &, const ::OpenSP:: Syntax *otherSyntax, Boolean invalidUseDocumentCharset, ISet &invalid) const; static int referenceQuantity(Quantity); const XcharMap &markupScanTable() const; Boolean multicode() const; void addEntity(const StringC &, Char); size_t nEntities() const; const StringC &entityName(size_t) const; Char entityChar(size_t) const; private: void subst(Char, Char); void checkUnivControlChar(UnivChar univChar, const CharsetInfo &docCharset, const ::OpenSP:: Syntax *otherSyntax, ISet &invalid) const; ISet shunchar_; PackedBoolean shuncharControls_; ISet set_[nSet]; Char standardFunction_[3]; PackedBoolean standardFunctionValid_[3]; Boolean namecaseGeneral_; Boolean namecaseEntity_; StringC delimGeneral_[nDelimGeneral]; Vector delimShortrefComplex_; ISet delimShortrefSimple_; StringC names_[nNames]; Number quantity_[nQuantity]; HashTable nameTable_; HashTable functionTable_; SubstTable upperSubst_; SubstTable identitySubst_; const SubstTable *generalSubst_; const SubstTable *entitySubst_; XcharMap categoryTable_; Boolean multicode_; XcharMap markupScanTable_; Boolean hasMarkupScanTable_; Vector entityNames_; StringC entityChars_; static const int referenceQuantity_[]; }; inline Number Syntax::quantity(Quantity q) const { return quantity_[q]; } inline void Syntax::setQuantity(int i, Number n) { quantity_[i] = n; } inline const SubstTable *Syntax::generalSubstTable() const { return generalSubst_; } inline const SubstTable *Syntax::entitySubstTable() const { return entitySubst_; } inline int Syntax::nDelimShortrefComplex() const { return int(delimShortrefComplex_.size()); } inline const StringC &Syntax::delimGeneral(int i) const { return delimGeneral_[i]; } inline const StringC &Syntax::delimShortrefComplex(size_t i) const { return delimShortrefComplex_[i]; } inline const ISet &Syntax::delimShortrefSimple() const { return delimShortrefSimple_; } inline Boolean Syntax::hasShortrefs() const { return delimShortrefComplex_.size() > 0 || !delimShortrefSimple_.isEmpty(); } inline Char Syntax::standardFunction(int i) const { return standardFunction_[i]; } inline Boolean Syntax::getStandardFunction(int i, Char &result) const { if (standardFunctionValid_[i]) { result = standardFunction_[i]; return 1; } else return 0; } inline const ISet *Syntax::charSet(int i) const { return &set_[i]; } inline Boolean Syntax::isNameCharacter(Xchar c) const { return categoryTable_[c] >= nameStartCategory; } inline Boolean Syntax::isNameStartCharacter(Xchar c) const { return categoryTable_[c] == nameStartCategory; } inline Boolean Syntax::isDigit(Xchar c) const { return categoryTable_[c] == digitCategory; } inline Boolean Syntax::isS(Xchar c) const { return categoryTable_[c] == sCategory; } inline Boolean Syntax::isB(Xchar c) const { return (categoryTable_[c] == sCategory && !(standardFunctionValid_[fRE] && c == standardFunction_[fRE]) && !(standardFunctionValid_[fRS] && c == standardFunction_[fRS])); } inline Syntax::Category Syntax::charCategory(Xchar c) const { return Category(categoryTable_[c]); } inline Boolean Syntax::isSgmlChar(Xchar c) const { return c >= 0 && set_[sgmlChar].contains(Char(c)); } inline const StringC &Syntax::reservedName(ReservedName i) const { return names_[i]; } inline size_t Syntax::attcnt() const { return quantity(Syntax::qATTCNT); } inline size_t Syntax::attsplen() const { return quantity(Syntax::qATTSPLEN); } inline size_t Syntax::namelen() const { return quantity(Syntax::qNAMELEN); } inline size_t Syntax::penamelen() const { return quantity(Syntax::qNAMELEN) - delimGeneral(Syntax::dPERO).size(); } inline size_t Syntax::litlen() const { return quantity(Syntax::qLITLEN); } inline size_t Syntax::normsep() const { return quantity(Syntax::qNORMSEP); } inline size_t Syntax::dtemplen() const { return quantity(Syntax::qDTEMPLEN); } inline size_t Syntax::grpcnt() const { return quantity(Syntax::qGRPCNT); } inline size_t Syntax::grpgtcnt() const { return quantity(Syntax::qGRPGTCNT); } inline size_t Syntax::grplvl() const { return quantity(Syntax::qGRPLVL); } inline size_t Syntax::taglvl() const { return quantity(Syntax::qTAGLVL); } inline size_t Syntax::taglen() const { return quantity(Syntax::qTAGLEN); } inline size_t Syntax::entlvl() const { return quantity(Syntax::qENTLVL); } inline size_t Syntax::pilen() const { return quantity(Syntax::qPILEN); } inline Char Syntax::space() const { return standardFunction(Syntax::fSPACE); } inline void Syntax::setSgmlChar(const ISet &set) { set_[sgmlChar] = set; } inline int Syntax::referenceQuantity(Quantity i) { return referenceQuantity_[i]; } inline void Syntax::setShuncharControls() { shuncharControls_ = 1; } inline const XcharMap &Syntax::markupScanTable() const { return markupScanTable_; } inline Boolean Syntax::multicode() const { return multicode_; } inline Boolean Syntax::namecaseGeneral() const { return namecaseGeneral_; } inline Boolean Syntax::namecaseEntity() const { return namecaseEntity_; } inline size_t Syntax::nEntities() const { return entityNames_.size(); } inline const StringC &Syntax::entityName(size_t i) const { return entityNames_[i]; } inline Char Syntax::entityChar(size_t i) const { return entityChars_[i]; } } # 17 "../include/Sd.h" 2 # 1 "../include/CharsetDecl.h" 1 #pragma interface # 1 "../include/Vector.h" 1 # 12 "../include/CharsetDecl.h" 2 # 1 "../include/ISet.h" 1 # 14 "../include/CharsetDecl.h" 2 namespace OpenSP { class CharsetDeclRange { public: enum Type { number, string, unused }; CharsetDeclRange(); CharsetDeclRange(WideChar, Number, WideChar); CharsetDeclRange(WideChar, Number); CharsetDeclRange(WideChar, Number, const StringC &); void rangeDeclared(WideChar min, Number count, ISet &declared) const; void usedSet(ISet &) const; Boolean getCharInfo(WideChar fromChar, CharsetDeclRange::Type &type, Number &n, StringC &str, Number &count) const; void stringToChar(const StringC &str, ISet &to) const; void numberToChar(Number n, ISet &to, Number &count) const; private: WideChar descMin_; Number count_; WideChar baseMin_; Type type_; StringC str_; }; class CharsetDeclSection { public: CharsetDeclSection(); void setPublicId(const PublicId &); void addRange(const CharsetDeclRange &); void rangeDeclared(WideChar min, Number count, ISet &declared) const; void usedSet(ISet &) const; Boolean getCharInfo(WideChar fromChar, const PublicId *&id, CharsetDeclRange::Type &type, Number &n, StringC &str, Number &cout) const; void stringToChar(const StringC &str, ISet &to) const; void numberToChar(const PublicId *id, Number n, ISet &to, Number &count) const; private: PublicId baseset_; Vector ranges_; }; class CharsetDecl { public: CharsetDecl(); void addSection(const PublicId &); void swap(CharsetDecl &); void clear(); void usedSet(ISet &) const; void declaredSet(ISet &set) const; Boolean charDeclared(WideChar) const; void rangeDeclared(WideChar min, Number count, ISet &declared) const; void addRange(WideChar, Number, WideChar); void addRange(WideChar, Number); void addRange(WideChar, Number, const StringC &); Boolean getCharInfo(WideChar fromChar, const PublicId *&id, CharsetDeclRange::Type &type, Number &n, StringC &str) const; Boolean getCharInfo(WideChar fromChar, const PublicId *&id, CharsetDeclRange::Type &type, Number &n, StringC &str, Number &count) const; void stringToChar(const StringC &str, ISet &to) const; void numberToChar(const PublicId *id, Number n, ISet &to, Number &count) const; void numberToChar(const PublicId *id, Number n, ISet &to) const; private: Vector sections_; ISet declaredSet_; }; inline Boolean CharsetDecl::getCharInfo(WideChar fromChar, const PublicId *&id, CharsetDeclRange::Type &type, Number &n, StringC &str) const { Number tem; return getCharInfo(fromChar, id, type, n, str, tem); } inline void CharsetDecl::numberToChar(const PublicId *id, Number n, ISet &to) const { Number tem; numberToChar(id, n, to, tem); } inline void CharsetDecl::declaredSet(ISet &set) const { set = declaredSet_; } inline Boolean CharsetDecl::charDeclared(WideChar c) const { return declaredSet_.contains(c); } } # 18 "../include/Sd.h" 2 # 1 "../include/HashTable.h" 1 # 19 "../include/Sd.h" 2 # 1 "../include/EntityManager.h" 1 #pragma interface # 1 "../include/Ptr.h" 1 # 16 "../include/EntityManager.h" 2 namespace OpenSP { class Messenger; class InputSourceOrigin; class CharsetInfo; class InputSource; class EntityManager : public Resource { public: enum { mayRewind = 01, maySetDocCharset = 02 }; virtual ~EntityManager(); virtual Boolean internalCharsetIsDocCharset() const = 0; virtual const CharsetInfo &charset() const = 0; virtual InputSource *open(const StringC &sysid, const CharsetInfo &docCharset, InputSourceOrigin *, unsigned flags, Messenger &) = 0; virtual ConstPtr makeCatalog(StringC &systemId, const CharsetInfo &, Messenger &) = 0; }; } # 20 "../include/Sd.h" 2 # 1 "../include/Ptr.h" 1 # 21 "../include/Sd.h" 2 namespace OpenSP { class Sd : public Resource { public: enum BooleanFeature { fDATATAG, fOMITTAG, fRANK, fSTARTTAGEMPTY, fSTARTTAGUNCLOSED, fENDTAGEMPTY, fENDTAGUNCLOSED, fATTRIBDEFAULT, fATTRIBOMITNAME, fATTRIBVALUE, fEMPTYNRM, fIMPLYDEFATTLIST, fIMPLYDEFDOCTYPE, fIMPLYDEFENTITY, fIMPLYDEFNOTATION, fIMPLICIT, fFORMAL, fURN, fKEEPRSRE }; enum { nBooleanFeature = fKEEPRSRE + 1, fSHORTTAG_FIRST = fSTARTTAGEMPTY, fSHORTTAG_LAST = fATTRIBVALUE }; enum NumberFeature { fSIMPLE, fEXPLICIT, fCONCUR, fSUBDOC }; enum { nNumberFeature = fSUBDOC + 1 }; enum NetEnable { netEnableNo, netEnableImmednet, netEnableAll }; enum EntityRef { entityRefAny, entityRefInternal, entityRefNone }; enum ImplydefElement { implydefElementNo, implydefElementYes, implydefElementAnyother }; enum ReservedName { rALL, rANY, rANYOTHER, rAPPINFO, rATTLIST, rATTRIB, rBASESET, rCAPACITY, rCHARSET, rCONCUR, rCONTROLS, rDATATAG, rDEFAULT, rDELIM, rDESCSET, rDOCTYPE, rDOCUMENT, rELEMENT, rEMPTY, rEMPTYNRM, rENDTAG, rENTITIES, rENTITY, rEXPLICIT, rFEATURES, rFORMAL, rFUNCHAR, rFUNCTION, rGENERAL, rIMMEDNET, rIMPLICIT, rIMPLYDEF, rINSTANCE, rINTEGRAL, rINTERNAL, rKEEPRSRE, rLCNMCHAR, rLCNMSTRT, rLINK, rMINIMIZE, rMSICHAR, rMSOCHAR, rMSSCHAR, rNAMECASE, rNAMECHAR, rNAMES, rNAMESTRT, rNAMING, rNETENABL, rNO, rNOASSERT, rNONE, rNOTATION, rOMITNAME, rOMITTAG, rOTHER, rPUBLIC, rQUANTITY, rRANK, rRE, rREF, rRS, rSCOPE, rSEEALSO, rSEPCHAR, rSGML, rSGMLREF, rSHORTREF, rSHORTTAG, rSHUNCHAR, rSIMPLE, rSPACE, rSTARTTAG, rSUBDOC, rSWITCHES, rSYNTAX, rSYSTEM, rTYPE, rUCNMCHAR, rUCNMSTRT, rUNCLOSED, rUNUSED, rURN, rVALIDITY, rVALUE, rYES }; enum Capacity { TOTALCAP, ENTCAP, ENTCHCAP, ELEMCAP, GRPCAP, EXGRPCAP, EXNMCAP, ATTCAP, ATTCHCAP, AVGRPCAP, NOTCAP, NOTCHCAP, IDCAP, IDREFCAP, MAPCAP, LKSETCAP, LKNMCAP }; enum { nCapacity = LKNMCAP + 1 }; Sd(const Ptr &); void setDocCharsetDesc(const UnivCharsetDesc &); Boolean matchesReservedName(const StringC &, ReservedName) const; int digitWeight(Char) const; int hexDigitWeight(Char) const; Boolean link() const; Number simpleLink() const; Boolean implicitLink() const; Number explicitLink() const; Boolean startTagEmpty() const; Boolean startTagUnclosed() const; NetEnable startTagNetEnable() const; void setStartTagNetEnable(NetEnable); Boolean endTagEmpty() const; Boolean endTagUnclosed() const; Boolean attributeDefault() const; Boolean attributeValueNotLiteral() const; Boolean attributeOmitName() const; Boolean emptyElementNormal() const; Boolean implydefAttlist() const; Boolean implydefDoctype() const; ImplydefElement implydefElement() const; void setImplydefElement(ImplydefElement); Boolean implydefEntity() const; Boolean implydefNotation() const; Number concur() const; Boolean omittag() const; Boolean rank() const; Boolean datatag() const; Boolean formal() const; Boolean urn() const; Boolean keeprsre() const; Number subdoc() const; StringC reservedName(int) const; Boolean lookupQuantityName(const StringC &, Syntax::Quantity &) const; Boolean lookupGeneralDelimiterName(const StringC &, Syntax::DelimGeneral &) const; Boolean lookupCapacityName(const StringC &, Sd::Capacity &) const; StringC quantityName(Syntax::Quantity) const; Boolean internalCharsetIsDocCharset() const; const CharsetInfo &internalCharset() const; const CharsetInfo &docCharset() const; Char execToInternal(char) const; StringC execToInternal(const char *) const; Number capacity(int) const; void setCapacity(int, Number); StringC capacityName(int) const; Boolean scopeInstance() const; void setScopeInstance(); void setDocCharsetDecl(CharsetDecl &); const CharsetDecl &docCharsetDecl() const; void setBooleanFeature(BooleanFeature, Boolean); void setShorttag(Boolean); void setNumberFeature(NumberFeature, Number); StringC generalDelimiterName(Syntax::DelimGeneral) const; UnivChar nameToUniv(const StringC &); Boolean www() const; void setWww(Boolean); EntityRef entityRef() const; void setEntityRef(EntityRef); Boolean typeValid() const; void setTypeValid(Boolean); Boolean integrallyStored() const; void setIntegrallyStored(Boolean); private: PackedBoolean booleanFeature_[nBooleanFeature]; Number numberFeature_[nNumberFeature]; Number capacity_[nCapacity]; PackedBoolean internalCharsetIsDocCharset_; const CharsetInfo *internalCharsetPtr_; CharsetInfo docCharset_; CharsetDecl docCharsetDecl_; Boolean scopeInstance_; Boolean www_; NetEnable netEnable_; EntityRef entityRef_; ImplydefElement implydefElement_; Boolean typeValid_; Boolean integrallyStored_; HashTable namedCharTable_; Ptr entityManager_; static const char *const reservedName_[]; static const char *const generalDelimiterName_[]; static const char *const capacityName_[]; static const char *const quantityName_[]; }; inline Boolean Sd::link() const { return (numberFeature_[fSIMPLE] || booleanFeature_[fIMPLICIT] || numberFeature_[fEXPLICIT]); } inline Number Sd::explicitLink() const { return numberFeature_[fEXPLICIT]; } inline Boolean Sd::implicitLink() const { return booleanFeature_[fIMPLICIT]; } inline Number Sd::simpleLink() const { return numberFeature_[fSIMPLE]; } inline Boolean Sd::startTagEmpty() const { return booleanFeature_[fSTARTTAGEMPTY]; } inline Boolean Sd::startTagUnclosed() const { return booleanFeature_[fSTARTTAGUNCLOSED]; } inline Sd::NetEnable Sd::startTagNetEnable() const { return netEnable_; } inline void Sd::setStartTagNetEnable(NetEnable e) { netEnable_ = e; } inline Boolean Sd::endTagEmpty() const { return booleanFeature_[fENDTAGEMPTY]; } inline Boolean Sd::endTagUnclosed() const { return booleanFeature_[fENDTAGUNCLOSED]; } inline Boolean Sd::attributeDefault() const { return booleanFeature_[fATTRIBDEFAULT]; } inline Boolean Sd::attributeValueNotLiteral() const { return booleanFeature_[fATTRIBVALUE]; } inline Boolean Sd::attributeOmitName() const { return booleanFeature_[fATTRIBOMITNAME]; } inline Boolean Sd::emptyElementNormal() const { return booleanFeature_[fEMPTYNRM]; } inline Boolean Sd::implydefAttlist() const { return booleanFeature_[fIMPLYDEFATTLIST]; } inline Boolean Sd::implydefDoctype() const { return booleanFeature_[fIMPLYDEFDOCTYPE]; } inline Sd::ImplydefElement Sd::implydefElement() const { return implydefElement_; } inline void Sd::setImplydefElement(ImplydefElement i) { implydefElement_ = i; } inline Boolean Sd::implydefEntity() const { return booleanFeature_[fIMPLYDEFENTITY]; } inline Boolean Sd::implydefNotation() const { return booleanFeature_[fIMPLYDEFNOTATION]; } inline Number Sd::concur() const { return numberFeature_[fCONCUR]; } inline Number Sd::subdoc() const { return numberFeature_[fSUBDOC]; } inline Boolean Sd::omittag() const { return booleanFeature_[fOMITTAG]; } inline Boolean Sd::rank() const { return booleanFeature_[fRANK]; } inline Boolean Sd::datatag() const { return booleanFeature_[fDATATAG]; } inline Boolean Sd::formal() const { return booleanFeature_[fFORMAL]; } inline Boolean Sd::urn() const { return booleanFeature_[fURN]; } inline Boolean Sd::keeprsre() const { return booleanFeature_[fKEEPRSRE]; } inline const CharsetInfo &Sd::internalCharset() const { return internalCharsetPtr_ ? *internalCharsetPtr_ : docCharset_; } inline Char Sd::execToInternal(char c) const { return internalCharset().execToDesc(c); } inline StringC Sd::execToInternal(const char *s) const { return internalCharset().execToDesc(s); } inline StringC Sd::reservedName(int i) const { return execToInternal(reservedName_[i]); } inline Boolean Sd::internalCharsetIsDocCharset() const { return internalCharsetIsDocCharset_; } inline const CharsetInfo &Sd::docCharset() const { return docCharset_; } inline int Sd::digitWeight(Char c) const { return internalCharset().digitWeight(c); } inline int Sd::hexDigitWeight(Char c) const { return internalCharset().hexDigitWeight(c); } inline Number Sd::capacity(int i) const { return capacity_[i]; } inline void Sd::setCapacity(int i, Number n) { capacity_[i] = n; } inline StringC Sd::capacityName(int i) const { return execToInternal(capacityName_[i]); } inline Boolean Sd::scopeInstance() const { return scopeInstance_; } inline void Sd::setScopeInstance() { scopeInstance_ = 1; } inline void Sd::setDocCharsetDecl(CharsetDecl &decl) { decl.swap(docCharsetDecl_); } inline const CharsetDecl &Sd::docCharsetDecl() const { return docCharsetDecl_; } inline void Sd::setBooleanFeature(BooleanFeature i, Boolean b) { booleanFeature_[i] = b; } inline void Sd::setNumberFeature(NumberFeature i, Number n) { numberFeature_[i] = n; } inline Boolean Sd::www() const { return www_; } inline void Sd::setWww(Boolean b) { www_ = b; } inline Sd::EntityRef Sd::entityRef() const { return entityRef_; } inline void Sd::setEntityRef(EntityRef r) { entityRef_ = r; } inline Boolean Sd::typeValid() const { return typeValid_; } inline void Sd::setTypeValid(Boolean b) { typeValid_ = b; } inline Boolean Sd::integrallyStored() const { return integrallyStored_; } inline void Sd::setIntegrallyStored(Boolean b) { integrallyStored_ = b; } } # 21 "../include/Event.h" 2 # 1 "../include/Dtd.h" 1 #pragma interface # 1 "../include/NamedTable.h" 1 # 10 "../include/NamedTable.h" # 1 "../include/OwnerTable.h" 1 # 11 "../include/NamedTable.h" 2 namespace OpenSP { class NamedTableKeyFunction { public: static inline const StringC &key(const Named &obj) { return obj.name(); } }; template class NamedTableIter; template class ConstNamedTableIter; template class NamedTable { public: NamedTable() { } T *insert(T *p) { return (T *)table_.insert(p); } T *lookup(const StringC &str) const { return (T *)table_.lookup(str); } T *remove(const StringC &str) { return (T *)table_.remove(str); } size_t count() const { return table_.count(); } void clear() { table_.clear(); } void swap(NamedTable &to) { table_.swap(to.table_); } private: NamedTable(const NamedTable &); void operator=(const NamedTable &); OwnerTable table_; friend class NamedTableIter; friend class ConstNamedTableIter; }; template class NamedTableIter { public: NamedTableIter(const NamedTable &table) : iter_(table.table_) { } T *next() { return (T *)iter_.next(); } private: OwnerTableIter iter_; }; template class ConstNamedTableIter { public: ConstNamedTableIter(const NamedTable &table) : iter_(table.table_) { } const T *next() { return (T *)iter_.next(); } private: OwnerTableIter iter_; }; } # 11 "../include/Dtd.h" 2 # 1 "../include/NamedResourceTable.h" 1 # 1 "../include/PointerTable.h" 1 # 9 "../include/NamedResourceTable.h" 2 # 1 "../include/Ptr.h" 1 # 12 "../include/NamedResourceTable.h" 2 namespace OpenSP { struct NamedResourceKeyFunction { static inline const StringC &key(const NamedResource &p) { return p.name(); } }; template class NamedResourceTableIter; template class ConstNamedResourceTableIter; template class NamedResourceTable { public: NamedResourceTable() { } Ptr insert(const Ptr &p, Boolean replace = 0) { return (T *)table_.insert((NamedResource *)p.pointer(), replace).pointer(); } Ptr lookup(const StringC &str) const { return (T *)table_.lookup(str).pointer(); } ConstPtr lookupConst(const StringC &str) const { return (T *)table_.lookup(str).pointer(); } const T *lookupTemp(const StringC &str) const { return (const T *)table_.lookup(str).pointer(); } Ptr remove(const StringC &str) { return (T *)table_.remove(str).pointer(); } size_t count() const { return table_.count(); } void clear() { table_.clear(); } void swap(NamedResourceTable &to) { table_.swap(to.table_); } private: PointerTable, StringC, Hash, NamedResourceKeyFunction> table_; friend class NamedResourceTableIter; friend class ConstNamedResourceTableIter; }; template class NamedResourceTableIter { public: NamedResourceTableIter(const NamedResourceTable &table) : iter_(table.table_) { } Ptr next() { return (T *)iter_.next().pointer(); } private: PointerTableIter, StringC, Hash, NamedResourceKeyFunction> iter_; }; template class ConstNamedResourceTableIter { public: ConstNamedResourceTableIter(const NamedResourceTable &table) : iter_(table.table_) { } ConstPtr next() { return (T *)iter_.next().pointer(); } const T *nextTemp() { return (const T *)iter_.next().pointer(); } private: PointerTableIter, StringC, Hash, NamedResourceKeyFunction> iter_; }; } # 12 "../include/Dtd.h" 2 # 1 "../include/ElementType.h" 1 #pragma interface # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 1 3 4 # 11 "../include/ElementType.h" 2 # 1 "../include/Vector.h" 1 # 13 "../include/ElementType.h" 2 # 1 "../include/Owner.h" 1 # 14 "../include/ElementType.h" 2 # 1 "../include/Ptr.h" 1 # 16 "../include/ElementType.h" 2 # 1 "../include/Vector.h" 1 # 18 "../include/ElementType.h" 2 # 1 "../include/Mode.h" 1 namespace OpenSP { enum Mode { grpMode, alitMode, alitaMode, aliteMode, talitMode, talitaMode, taliteMode, mdMode, mdMinusMode, mdPeroMode, sdMode, comMode, sdcomMode, piMode, refMode, imsMode, cmsMode, rcmsMode, proMode, dsMode, dsiMode, plitMode, plitaMode, pliteMode, sdplitMode, sdplitaMode, grpsufMode, mlitMode, mlitaMode, asMode, piPasMode, slitMode, slitaMode, sdslitMode, sdslitaMode, cconMode, rcconMode, cconnetMode, rcconnetMode, rcconeMode, tagMode, econMode, mconMode, econnetMode, mconnetMode }; const int nModes = mconnetMode + 1; const int minShortrefMode = econMode; } # 20 "../include/ElementType.h" 2 # 1 "../include/ContentToken.h" 1 #pragma interface # 1 "../include/Owner.h" 1 # 11 "../include/ContentToken.h" 2 # 1 "../include/Vector.h" 1 # 13 "../include/ContentToken.h" 2 # 1 "../include/NCVector.h" 1 # 12 "../include/NCVector.h" # 1 "../include/Vector.h" 1 # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 1 3 4 # 8 "../include/Vector.h" 2 namespace OpenSP { template class NCVector { public: typedef size_t size_type; typedef T *iterator; typedef const T *const_iterator; NCVector() : ptr_(0), size_(0), alloc_(0) { } NCVector(size_t n) : ptr_(0), size_(0), alloc_(0) { append(n); } virtual ~NCVector(); void resize(size_t n) { if (n < size_) erase(ptr_ + n, ptr_ + size_); else if (n > size_) append(n - size_); } # 46 "../include/Vector.h" void swap(NCVector &); void clear() { erase(ptr_, ptr_ + size_); } size_t size() const { return size_; } T &operator[](size_t i) { return ptr_[i]; } const T &operator[](size_t i) const { return ptr_[i]; } iterator begin() { return ptr_; } const_iterator begin() const { return ptr_; } T &back() { return ptr_[size_ - 1]; } const T &back() const { return ptr_[size_ - 1]; } void reserve(size_t n) { if (n > alloc_) reserve1(n); } iterator erase(const_iterator, const_iterator); private: NCVector(const NCVector &); void operator=(const NCVector &); void append(size_t); void reserve1(size_t); size_t size_; T *ptr_; size_t alloc_; }; } # 13 "../include/NCVector.h" 2 # 48 "../include/NCVector.h" # 1 "../include/Vector.cxx" 1 # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 1 3 4 # 8 "../include/Vector.cxx" 2 # 1 "/usr/include/string.h" 1 3 4 # 9 "../include/Vector.cxx" 2 namespace OpenSP { template NCVector::~NCVector() { if (ptr_) { erase(ptr_, ptr_ + size_); ::operator delete((void *)ptr_); } } # 99 "../include/Vector.cxx" template void NCVector::swap(NCVector &v) { { T *tem = ptr_; ptr_ = v.ptr_; v.ptr_ = tem; } { size_t tem = size_; size_ = v.size_; v.size_ = tem; } { size_t tem = alloc_; alloc_ = v.alloc_; v.alloc_ = tem; } } template void NCVector::append(size_t n) { reserve(size_ + n); while (n-- > 0) (void)new (ptr_ + size_++) T; } template T *NCVector::erase(const T *p1, const T *p2) { typedef T X; for (const T *p = p1; p != p2; p++) ((X *)p)->~X(); if (p2 != ptr_ + size_) memmove((T *)p1, p2, ((const T *)(ptr_ + size_) - p2)*sizeof(T)); size_ -= p2 - p1; return (T *)p1; } template void NCVector::reserve1(size_t size) { size_t newAlloc = alloc_*2; if (size > newAlloc) newAlloc += size; void *p = ::operator new(newAlloc * sizeof(T)); alloc_ = newAlloc; if (ptr_) { memcpy(p, ptr_, size_*sizeof(T)); ::operator delete((void *)ptr_); } ptr_ = (T *)p; } } # 49 "../include/NCVector.h" 2 # 14 "../include/ContentToken.h" 2 namespace OpenSP { class LeafContentToken; struct Transition { enum { invalidIndex = -1 }; unsigned clearAndStateStartIndex; unsigned andDepth; PackedBoolean isolated; unsigned requireClear; unsigned toSet; }; class FirstSet { public: FirstSet(); void init(LeafContentToken *); void append(const FirstSet &); size_t size() const; LeafContentToken *token(size_t i) const; size_t requiredIndex() const; void setNotRequired(); private: Vector v_; size_t requiredIndex_; }; class LastSet : public Vector { public: LastSet() { } LastSet(size_t n) : Vector(n) { } void append(const LastSet &); }; class ElementType; class AndModelGroup; struct GroupInfo; struct ContentModelAmbiguity { const LeafContentToken *from; const LeafContentToken *to1; const LeafContentToken *to2; unsigned andDepth; }; class ModelGroup; class ContentToken { public: enum OccurrenceIndicator { none = 0, opt = 01, plus = 02, rep = 03 }; ContentToken(OccurrenceIndicator); virtual ~ContentToken(); OccurrenceIndicator occurrenceIndicator() const; Boolean inherentlyOptional() const; static unsigned andDepth(const AndModelGroup *); static unsigned andIndex(const AndModelGroup *); void analyze(GroupInfo &, const AndModelGroup *, unsigned, FirstSet &, LastSet &); static void addTransitions(const LastSet &from, const FirstSet &to, Boolean maybeRequired, unsigned andClearIndex, unsigned andDepth, Boolean isolated = 0, unsigned requireClear = (unsigned)Transition::invalidIndex, unsigned toSet = (unsigned)Transition::invalidIndex); virtual void finish(Vector &minAndDepth, Vector &elementTransition, Vector &, Boolean &pcdataUnreachable) = 0; virtual unsigned long grpgtcnt() const; virtual void setOrGroupMember(); unsigned andGroupIndex() const; virtual const ModelGroup *asModelGroup() const; virtual const LeafContentToken *asLeafContentToken() const; protected: PackedBoolean inherentlyOptional_; private: ContentToken(const ContentToken &); void operator=(const ContentToken &); virtual void analyze1(GroupInfo &, const AndModelGroup *, unsigned, FirstSet &, LastSet &) = 0; OccurrenceIndicator occurrenceIndicator_; }; class ModelGroup : public ContentToken { public: enum Connector { andConnector, orConnector, seqConnector }; ModelGroup(NCVector > &, OccurrenceIndicator); virtual Connector connector() const = 0; unsigned nMembers() const; void finish(Vector &minAndDepth, Vector &elementTransition, Vector &, Boolean &pcdataUnreachable); ContentToken &member(unsigned i); const ContentToken &member(unsigned i) const; unsigned long grpgtcnt() const; const ModelGroup *asModelGroup() const; protected: void setOrGroup(); private: ModelGroup(const ModelGroup &); void operator=(const ModelGroup &); NCVector > members_; }; class AndModelGroup : public ModelGroup { public: AndModelGroup(NCVector > &, OccurrenceIndicator); Connector connector() const; unsigned andDepth() const; unsigned andIndex() const; unsigned andGroupIndex() const; const AndModelGroup *andAncestor() const; private: AndModelGroup(const AndModelGroup &); void operator=(const AndModelGroup &); unsigned andDepth_; unsigned andIndex_; unsigned andGroupIndex_; const AndModelGroup *andAncestor_; void analyze1(GroupInfo &, const AndModelGroup *, unsigned, FirstSet &, LastSet &); }; class OrModelGroup : public ModelGroup { public: OrModelGroup(NCVector > &, OccurrenceIndicator); Connector connector() const; private: OrModelGroup(const OrModelGroup &); void operator=(const OrModelGroup &); void analyze1(GroupInfo &, const AndModelGroup *, unsigned, FirstSet &, LastSet &); }; class SeqModelGroup : public ModelGroup { public: SeqModelGroup(NCVector > &, OccurrenceIndicator); Connector connector() const; private: SeqModelGroup(const SeqModelGroup &); void operator=(const SeqModelGroup &); void analyze1(GroupInfo &, const AndModelGroup *, unsigned, FirstSet &, LastSet &); }; class AndState; class AndInfo { public: AndInfo() { } const AndModelGroup *andAncestor; unsigned andGroupIndex; Vector follow; private: AndInfo(const AndInfo &); void operator=(const AndInfo &); }; class LeafContentToken : public ContentToken { public: LeafContentToken(const ElementType *, OccurrenceIndicator); unsigned index() const; unsigned typeIndex() const; const ElementType *elementType() const; virtual Boolean isInitial() const; void addTransitions(const FirstSet &to, Boolean maybeRequired, unsigned andClearIndex, unsigned andDepth, Boolean isolated, unsigned requireClear, unsigned toSet); void setFinal(); void finish(Vector &minAndDepth, Vector &elementTransition, Vector &, Boolean &pcdataUnreachable); Boolean isFinal() const; Boolean tryTransition(const ElementType *, AndState &, unsigned &minAndDepth, const LeafContentToken *&newpos) const; Boolean tryTransitionPcdata(AndState &, unsigned &minAndDepth, const LeafContentToken *&newpos) const; void possibleTransitions(const AndState &, unsigned minAndDepth, Vector &) const; const LeafContentToken *impliedStartTag(const AndState &andpos, unsigned minAndDepth) const; const LeafContentToken *transitionToken(const ElementType *to, const AndState &andState, unsigned minAndDepth) const; void doRequiredTransition(AndState &andState, unsigned &minAndDepth, const LeafContentToken *&newpos) const; unsigned computeMinAndDepth(const AndState&) const; Boolean orGroupMember() const; void setOrGroupMember(); const AndModelGroup *andAncestor() const; unsigned andDepth() const; const LeafContentToken *asLeafContentToken() const; protected: void analyze1(GroupInfo &, const AndModelGroup *, unsigned, FirstSet &, LastSet &); const ElementType *element_; private: LeafContentToken(const LeafContentToken &); void operator=(const LeafContentToken &); void andFinish(Vector &minAndDepth, Vector &elementTransition, Vector &, Boolean &pcdataUnreachable); unsigned computeMinAndDepth1(const AndState&) const; unsigned leafIndex_; unsigned typeIndex_; Vector follow_; PackedBoolean isFinal_; PackedBoolean orGroupMember_; char pcdataTransitionType_; const LeafContentToken *simplePcdataTransition_; size_t requiredIndex_; Owner andInfo_; }; class PcdataToken : public LeafContentToken { public: PcdataToken(); void analyze1(GroupInfo &, const AndModelGroup *, unsigned, FirstSet &, LastSet &); private: PcdataToken(const PcdataToken &); void operator=(const PcdataToken &); }; class InitialPseudoToken : public LeafContentToken { public: InitialPseudoToken(); Boolean isInitial() const; private: InitialPseudoToken(const InitialPseudoToken &); void operator=(const InitialPseudoToken &); }; class ElementToken : public LeafContentToken { public: ElementToken(const ElementType *, OccurrenceIndicator); private: ElementToken(const ElementToken &); void operator=(const ElementToken &); }; class DataTagGroup : public SeqModelGroup { public: DataTagGroup(NCVector > &, OccurrenceIndicator); private: DataTagGroup(const DataTagGroup &); void operator=(const DataTagGroup &); }; class DataTagElementToken : public ElementToken { public: DataTagElementToken(const ElementType *, Vector &templates); DataTagElementToken(const ElementType *, Vector &templates, Text &paddingTemplate); private: DataTagElementToken(const DataTagElementToken &); void operator=(const DataTagElementToken &); Vector templates_; Boolean havePaddingTemplate_; Text paddingTemplate_; }; class CompiledModelGroup { public: CompiledModelGroup(Owner &); void compile(size_t nElementTypeIndex, Vector &, Boolean &pcdataUnreachable); CompiledModelGroup *copy() const; const LeafContentToken *initial() const; unsigned andStateSize() const; Boolean containsPcdata() const; const ModelGroup *modelGroup() const; private: CompiledModelGroup(const CompiledModelGroup &); void operator=(const CompiledModelGroup &); Owner modelGroup_; Owner initial_; unsigned andStateSize_; Boolean containsPcdata_; }; class AndState { public: AndState(unsigned); Boolean isClear(unsigned) const; void clearFrom(unsigned); void set(unsigned); Boolean operator==(const AndState &) const; Boolean operator!=(const AndState &) const; private: void clearFrom1(unsigned); unsigned clearFrom_; Vector v_; }; class MatchState { public: MatchState(); MatchState(const CompiledModelGroup *); Boolean tryTransition(const ElementType *); Boolean tryTransitionPcdata(); void possibleTransitions(Vector &) const; Boolean isFinished() const; const LeafContentToken *impliedStartTag() const; const LeafContentToken *invalidExclusion(const ElementType *) const; void doRequiredTransition(); const LeafContentToken *currentPosition() const; Boolean operator==(const MatchState &) const; Boolean operator!=(const MatchState &) const; private: const LeafContentToken *pos_; AndState andState_; unsigned minAndDepth_; }; inline ContentToken::OccurrenceIndicator ContentToken::occurrenceIndicator() const { return occurrenceIndicator_; } inline unsigned LeafContentToken::index() const { return leafIndex_; } inline unsigned LeafContentToken::typeIndex() const { return typeIndex_; } inline Boolean ContentToken::inherentlyOptional() const { return inherentlyOptional_; } inline const ElementType *LeafContentToken::elementType() const { return element_; } inline unsigned AndModelGroup::andDepth() const { return andDepth_; } inline unsigned AndModelGroup::andIndex() const { return andIndex_; } inline unsigned ModelGroup::nMembers() const { return members_.size(); } inline unsigned ContentToken::andDepth(const AndModelGroup *andAncestor) { return andAncestor ? andAncestor->andDepth() + 1 : 0; } inline unsigned ContentToken::andIndex(const AndModelGroup *andAncestor) { return (andAncestor ? andAncestor->andIndex() + andAncestor->nMembers() : 0); } inline ContentToken &ModelGroup::member(unsigned i) { return *members_[i]; } inline const ContentToken &ModelGroup::member(unsigned i) const { return *members_[i]; } inline void LeafContentToken::setFinal() { isFinal_ = 1; } inline Boolean LeafContentToken::isFinal() const { return isFinal_; } inline Boolean LeafContentToken::orGroupMember() const { return orGroupMember_; } inline unsigned CompiledModelGroup::andStateSize() const { return andStateSize_; } inline Boolean CompiledModelGroup::containsPcdata() const { return containsPcdata_; } inline const AndModelGroup *AndModelGroup::andAncestor() const { return andAncestor_; } inline unsigned AndModelGroup::andGroupIndex() const { return andGroupIndex_; } inline const LeafContentToken *CompiledModelGroup::initial() const { return initial_.pointer(); } inline const ModelGroup *CompiledModelGroup::modelGroup() const { return modelGroup_.pointer(); } inline const AndModelGroup *LeafContentToken::andAncestor() const { return andInfo_ ? andInfo_->andAncestor : 0; } inline unsigned LeafContentToken::andDepth() const { return andInfo_ ? ContentToken::andDepth(andInfo_->andAncestor) : 0; } inline unsigned LeafContentToken::computeMinAndDepth(const AndState &andState) const { return andInfo_ ? computeMinAndDepth1(andState) : 0; } inline Boolean LeafContentToken::tryTransitionPcdata(AndState &andState, unsigned &minAndDepth, const LeafContentToken *&newpos) const { if (pcdataTransitionType_ == 1) { newpos = simplePcdataTransition_; return 1; } else if (pcdataTransitionType_ == 0) return 0; else return tryTransition(0, andState, minAndDepth, newpos); } inline Boolean MatchState::tryTransition(const ElementType *to) { return pos_->tryTransition(to, andState_, minAndDepth_, pos_); } inline Boolean MatchState::tryTransitionPcdata() { return pos_->tryTransitionPcdata(andState_, minAndDepth_, pos_); } inline void MatchState::possibleTransitions(Vector &v) const { pos_->possibleTransitions(andState_, minAndDepth_, v); } inline Boolean MatchState::isFinished() const { return pos_->isFinal() && minAndDepth_ == 0; } inline const LeafContentToken * MatchState::impliedStartTag() const { return pos_->impliedStartTag(andState_, minAndDepth_); } inline void MatchState::doRequiredTransition() { pos_->doRequiredTransition(andState_, minAndDepth_, pos_); } inline const LeafContentToken *MatchState::currentPosition() const { return pos_; } inline Boolean MatchState::operator!=(const MatchState &state) const { return !(*this == state); } inline Boolean AndState::isClear(unsigned i) const { return v_[i] == 0; } inline void AndState::set(unsigned i) { v_[i] = 1; if (i >= clearFrom_) clearFrom_ = i + 1; } inline void AndState::clearFrom(unsigned i) { if (i < clearFrom_) clearFrom1(i); } inline Boolean AndState::operator!=(const AndState &state) const { return !(*this == state); } inline size_t FirstSet::size() const { return v_.size(); } inline LeafContentToken *FirstSet::token(size_t i) const { return v_[i]; } inline size_t FirstSet::requiredIndex() const { return requiredIndex_; } inline void FirstSet::setNotRequired() { requiredIndex_ = size_t(-1); } } # 21 "../include/ElementType.h" 2 namespace OpenSP { class ElementType; class ShortReferenceMap; class RankStem; class ElementDefinition : public Resource { public: enum DeclaredContent { modelGroup, any, cdata, rcdata, empty }; enum OmitFlags { omitStart = 01, omitEnd = 02, omitSpec = 04 }; enum { undefinedIndex = -1 }; ElementDefinition(const Location &location, size_t index, unsigned char omitFlags, DeclaredContent declaredContent, Boolean allowImmediateRecursion = 1); ElementDefinition(const Location &location, size_t index, unsigned char omitFlags, DeclaredContent declaredContent, Owner &modelGroup); const CompiledModelGroup *compiledModelGroup() const; DeclaredContent declaredContent() const; Boolean omittedTagSpec() const; Boolean canOmitStartTag() const; Boolean canOmitEndTag() const; size_t nRankStems() const; const RankStem *rankStem(size_t i) const; const StringC &rankSuffix() const; size_t nInclusions() const; const ElementType *inclusion(size_t) const; size_t nExclusions() const; const ElementType *exclusion(size_t) const; Boolean undefined() const; Boolean allowImmediateRecursion() const; void setInclusions(Vector &inclusions); void setExclusions(Vector &exclusions); void setRank(StringC &suffix, Vector &rankStems); Mode mode(Boolean netEnabled) const; const Location &location() const; private: ElementDefinition(const ElementDefinition &); void operator=(const ElementDefinition &); void computeMode(); Location location_; size_t index_; unsigned char omitFlags_; DeclaredContent declaredContent_; Boolean allowImmediateRecursion_; Owner modelGroup_; Vector inclusions_; Vector exclusions_; Vector rankStems_; StringC rankSuffix_; Mode mode_; Mode netMode_; }; class RankStem : public Named { public: RankStem(const StringC &, size_t); size_t index() const; void addDefinition(const ConstPtr &); size_t nDefinitions() const; const ElementDefinition *definition(size_t) const; private: RankStem(const RankStem &); void operator=(const RankStem &); size_t index_; Vector > def_; }; class ElementType : public Named, public Attributed { public: ElementType(const StringC &, size_t); void setElementDefinition(const ConstPtr &, size_t defIndex); void setMap(const ShortReferenceMap *); void setRankStem(RankStem *); Boolean undefined() const; void setOrigName(StringC &origName); const ElementDefinition *definition() const; Boolean isRankedElement() const; const RankStem *rankedElementRankStem() const; size_t index() const; const ShortReferenceMap *map() const; void swap(ElementType &); const StringC &origName() const; private: StringC origName_; ElementType(const ElementType &); void operator=(const ElementType &); size_t index_; size_t defIndex_; ConstPtr def_; const ShortReferenceMap *map_; }; inline const CompiledModelGroup *ElementDefinition::compiledModelGroup() const { return modelGroup_.pointer(); } inline ElementDefinition::DeclaredContent ElementDefinition::declaredContent() const { return declaredContent_; } inline Boolean ElementDefinition::canOmitStartTag() const { return (omitFlags_ & omitStart) != 0; } inline Boolean ElementDefinition::canOmitEndTag() const { return (omitFlags_ & omitEnd) != 0; } inline Boolean ElementDefinition::omittedTagSpec() const { return (omitFlags_ & omitSpec) != 0; } inline size_t ElementDefinition::nRankStems() const { return rankStems_.size(); } inline const StringC &ElementDefinition::rankSuffix() const { return rankSuffix_; } inline const RankStem *ElementDefinition::rankStem(size_t i) const { return rankStems_[i]; } inline const ElementType *ElementDefinition::inclusion(size_t i) const { return inclusions_[i]; } inline size_t ElementDefinition::nInclusions() const { return inclusions_.size(); } inline const ElementType *ElementDefinition::exclusion(size_t i) const { return exclusions_[i]; } inline size_t ElementDefinition::nExclusions() const { return exclusions_.size(); } inline Boolean ElementDefinition::undefined() const { return index_ == size_t(undefinedIndex); } inline Boolean ElementDefinition::allowImmediateRecursion() const { return allowImmediateRecursion_; } inline const Location &ElementDefinition::location() const { return location_; } inline void ElementDefinition::setInclusions(Vector &inclusions) { inclusions.swap(inclusions_); } inline void ElementDefinition::setExclusions(Vector &exclusions) { exclusions.swap(exclusions_); } inline void ElementDefinition::setRank(StringC &rankSuffix, Vector &rankStems) { rankStems.swap(rankStems_); rankSuffix.swap(rankSuffix_); } inline void ElementType::setOrigName(StringC &origName) { origName.swap(origName_); } inline Boolean ElementType::undefined() const { return def_->undefined(); } inline Boolean ElementType::isRankedElement() const { return def_->nRankStems() > 0; } inline const ElementDefinition *ElementType::definition() const { return def_.pointer(); } inline void ElementType::setElementDefinition(const ConstPtr &def, size_t defIndex) { def_ = def; defIndex_ = defIndex; } inline size_t ElementType::index() const { return index_; } inline const RankStem *ElementType::rankedElementRankStem() const { return def_->rankStem(defIndex_); } inline void ElementType::setMap(const ShortReferenceMap *map) { map_ = map; } inline const StringC &ElementType::origName() const { return origName_; } inline const ShortReferenceMap *ElementType::map() const { return map_; } inline size_t RankStem::index() const { return index_; } inline size_t RankStem::nDefinitions() const { return def_.size(); } inline const ElementDefinition *RankStem::definition(size_t i) const { return def_[i].pointer(); } inline Mode ElementDefinition::mode(Boolean netEnabled) const { return netEnabled ? netMode_ : mode_; } } # 13 "../include/Dtd.h" 2 # 1 "../include/Entity.h" 1 #pragma interface # 1 "../include/Owner.h" 1 # 15 "../include/Entity.h" 2 # 1 "../include/Markup.h" 1 #pragma interface # 1 "../include/Vector.h" 1 # 15 "../include/Markup.h" 2 # 1 "../include/SdText.h" 1 #pragma interface # 1 "../include/StringOf.h" 1 # 13 "../include/SdText.h" 2 # 1 "../include/Vector.h" 1 # 14 "../include/SdText.h" 2 # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 1 3 4 # 16 "../include/SdText.h" 2 namespace OpenSP { struct SdTextItem { SdTextItem(); Location loc; size_t index; }; class SdText { public: SdText(); SdText(const Location &loc, Boolean lita); void swap(SdText &); void addChar(SyntaxChar, const Location &); const String &string() const; Boolean lita() const; Location endDelimLocation() const; private: Boolean lita_; String chars_; Vector items_; friend class SdTextIter; }; class SdTextIter { public: SdTextIter(const SdText &); Boolean next(const SyntaxChar *&, size_t &, Location &); private: const SdText *ptr_; size_t itemIndex_; }; inline Boolean SdText::lita() const { return lita_; } inline const String &SdText::string() const { return chars_; } } # 17 "../include/Markup.h" 2 namespace OpenSP { class EntityOrigin; struct MarkupItem { MarkupItem(); MarkupItem(const MarkupItem &); ~MarkupItem(); void operator=(const MarkupItem &); unsigned char type; unsigned char index; union { size_t nChars; ConstPtr *origin; Text *text; SdText *sdText; }; }; class InputSource; class Markup { public: enum Type { reservedName, sdReservedName, name, nameToken, attributeValue, number, comment, s, shortref, delimiter, refEndRe, entityStart, entityEnd, literal, sdLiteral }; Markup(); size_t size() const; void clear(); void resize(size_t); void addDelim(Syntax::DelimGeneral); void addReservedName(Syntax::ReservedName, const InputSource *); void addReservedName(Syntax::ReservedName, const StringC &); void addSdReservedName(Sd::ReservedName, const InputSource *); void addSdReservedName(Sd::ReservedName, const Char *, size_t); void addS(Char); void addS(const InputSource *); void addRefEndRe(); void addShortref(const InputSource *); void addCommentStart(); void addCommentChar(Char); void addName(const InputSource *); void addName(const Char *, size_t); void addNameToken(const InputSource *); void addNumber(const InputSource *); void addAttributeValue(const InputSource *); void addEntityStart(const Ptr &); void addEntityEnd(); void addLiteral(const Text &); void addSdLiteral(const SdText &); void changeToAttributeValue(size_t index); void changeToSdReservedName(size_t index, Sd::ReservedName); void swap(Markup &); private: StringC chars_; Vector items_; friend class MarkupIter; }; class Location; class MarkupIter { public: MarkupIter(const Markup &); Markup::Type type() const; Boolean valid() const; void advance(); void advance(Location &, const ConstPtr &); size_t index() const; const Char *charsPointer() const; size_t charsLength() const; const Text &text() const; const EntityOrigin *entityOrigin() const; const SdText &sdText() const; Syntax::DelimGeneral delimGeneral() const; Syntax::ReservedName reservedName() const; Sd::ReservedName sdReservedName() const; private: const Char *chars_; Vector::const_iterator items_; size_t nItems_; size_t index_; size_t charIndex_; }; inline void Markup::clear() { chars_.resize(0); items_.resize(0); } inline size_t Markup::size() const { return items_.size(); } inline Boolean MarkupIter::valid() const { return index_ < nItems_; } inline size_t MarkupIter::index() const { return index_; } inline Markup::Type MarkupIter::type() const { return Markup::Type(items_[index_].type); } inline const EntityOrigin *MarkupIter::entityOrigin() const { return (*items_[index_].origin)->asEntityOrigin(); } inline const Char *MarkupIter::charsPointer() const { return chars_ + charIndex_; } inline size_t MarkupIter::charsLength() const { return items_[index_].nChars; } inline const Text &MarkupIter::text() const { return *items_[index_].text; } inline const SdText &MarkupIter::sdText() const { return *items_[index_].sdText; } inline Syntax::DelimGeneral MarkupIter::delimGeneral() const { return Syntax::DelimGeneral(items_[index_].index); } inline Syntax::ReservedName MarkupIter::reservedName() const { return Syntax::ReservedName(items_[index_].index); } inline Sd::ReservedName MarkupIter::sdReservedName() const { return Sd::ReservedName(items_[index_].index); } } # 23 "../include/Entity.h" 2 namespace OpenSP { class Messenger; class InputSource; class EntityOrigin; class ParserState; class ExternalEntity; class ExternalDataEntity; class SubdocEntity; class InternalEntity; class Notation; class Entity : public EntityDecl { public: Entity(const StringC &name, DeclType declType, DataType dataType, const Location &defLocation); virtual void litReference(Text &, ParserState &, const Ptr &, Boolean squeezeSpaces) const; virtual void declReference(ParserState &, const Ptr &) const; virtual void dsReference(ParserState &, const Ptr &) const; virtual void contentReference(ParserState &, const Ptr &) const; virtual void rcdataReference(ParserState &, const Ptr &) const; virtual Boolean isDataOrSubdoc() const; virtual Boolean isCharacterData() const; virtual const ExternalDataEntity *asExternalDataEntity() const; virtual const SubdocEntity *asSubdocEntity() const; virtual const InternalEntity *asInternalEntity() const; virtual const ExternalEntity *asExternalEntity() const; virtual Entity *copy() const = 0; virtual void generateSystemId(ParserState &); void setUsed(); Boolean used() const; void setDefaulted(); Boolean defaulted() const; protected: virtual void checkRef(ParserState &) const; static void checkEntlvl(ParserState &); Boolean checkNotOpen(ParserState &) const; private: virtual void normalReference(ParserState &, const Ptr &, Boolean generateEvent) const = 0; PackedBoolean used_; PackedBoolean defaulted_; }; class InternalEntity : public Entity { public: InternalEntity(const StringC &, DeclType declType, DataType dataType, const Location &, Text &); const StringC &string() const; const Text &text() const; const InternalEntity *asInternalEntity() const; protected: void checkRef(ParserState &) const; Text text_; }; class PiEntity : public InternalEntity { public: PiEntity(const StringC &, DeclType, const Location &, Text &); void litReference(Text &, ParserState &, const Ptr &, Boolean) const; void normalReference(ParserState &, const Ptr &, Boolean) const; void declReference(ParserState &, const Ptr &) const; void rcdataReference(ParserState &, const Ptr &) const; Entity *copy() const; }; class InternalDataEntity : public InternalEntity { public: InternalDataEntity(const StringC &, DataType, const Location &, Text &); void declReference(ParserState &, const Ptr &) const; Boolean isDataOrSubdoc() const; }; class InternalCdataEntity : public InternalDataEntity { public: InternalCdataEntity(const StringC &, const Location &, Text &); void normalReference(ParserState &, const Ptr &, Boolean) const; void litReference(Text &, ParserState &, const Ptr &, Boolean) const; Entity *copy() const; Boolean isCharacterData() const; }; class PredefinedEntity : public InternalCdataEntity { public: PredefinedEntity(const StringC &s, const Location &l, Text &t) : InternalCdataEntity(s,l,t) { } protected: void checkRef(ParserState &) const; }; class InternalSdataEntity : public InternalDataEntity { public: InternalSdataEntity(const StringC &, const Location &, Text &); void normalReference(ParserState &, const Ptr &, Boolean) const; void litReference(Text &, ParserState &, const Ptr &, Boolean) const; Entity *copy() const; Boolean isCharacterData() const; }; class InternalTextEntity : public InternalEntity { public: enum Bracketed { none, starttag, endtag, ms, md }; InternalTextEntity(const StringC &, DeclType, const Location &, Text &, Bracketed); Entity *copy() const; private: void normalReference(ParserState &, const Ptr &, Boolean) const; void litReference(Text &, ParserState &, const Ptr &, Boolean) const; Bracketed bracketed_; }; class ExternalEntity : public Entity { public: ExternalEntity(const StringC &, DeclType, DataType, const Location &, const ExternalId &); const ExternalId &externalId() const; const ExternalEntity *asExternalEntity() const; void generateSystemId(ParserState &); const StringC *systemIdPointer() const; const StringC *effectiveSystemIdPointer() const; const StringC *publicIdPointer() const; protected: void checkRef(ParserState &) const; private: ExternalId externalId_; }; class ExternalTextEntity : public ExternalEntity { public: ExternalTextEntity(const StringC &, DeclType, const Location &, const ExternalId &); Entity *copy() const; private: void normalReference(ParserState &, const Ptr &, Boolean) const; void litReference(Text &, ParserState &, const Ptr &, Boolean) const; }; class ExternalNonTextEntity : public ExternalEntity { public: ExternalNonTextEntity(const StringC &, DeclType, DataType, const Location &, const ExternalId &); Boolean isDataOrSubdoc() const; void litReference(Text &, ParserState &, const Ptr &, Boolean) const; void rcdataReference(ParserState &, const Ptr &) const; void normalReference(ParserState &, const Ptr &, Boolean) const; void dsReference(ParserState &, const Ptr &) const; Boolean isCharacterData() const; }; class ExternalDataEntity : public ExternalNonTextEntity { public: ExternalDataEntity(const StringC &, DataType, const Location &, const ExternalId &, const ConstPtr &, AttributeList &, DeclType = generalEntity); const AttributeList &attributes() const; const Notation *notation() const; const ExternalDataEntity *asExternalDataEntity() const; Entity *copy() const; void contentReference(ParserState &, const Ptr &) const; void setNotation(const ConstPtr &, AttributeList &); private: ConstPtr notation_; AttributeList attributes_; }; class SubdocEntity : public ExternalNonTextEntity { public: SubdocEntity(const StringC &, const Location &, const ExternalId &); const SubdocEntity *asSubdocEntity() const; Entity *copy() const; void contentReference(ParserState &, const Ptr &) const; private: }; class IgnoredEntity : public Entity { public: IgnoredEntity(const StringC &, DeclType declType); Entity *copy() const; void litReference(Text &, ParserState &, const Ptr &, Boolean squeezeSpaces) const; void declReference(ParserState &, const Ptr &) const; private: void normalReference(ParserState &, const Ptr &, Boolean generateEvent) const; }; class EntityOrigin : public InputSourceOrigin { public: static EntityOrigin *make(Allocator &, const ConstPtr &); static EntityOrigin *make(Allocator &, const ConstPtr &, const Location &refLocation); static EntityOrigin *make(Allocator &, const ConstPtr &, const Location &refLocation, Index refLength, Owner &markup); static EntityOrigin *make(const ConstPtr &, const Location &refLocation, Index refLength, Owner &markup); static EntityOrigin *make(const ConstPtr &, const Location &refLocation); static const size_t allocSize; }; inline Boolean Entity::used() const { return used_; } inline void Entity::setUsed() { used_ = 1; } inline Boolean Entity::defaulted() const { return defaulted_; } inline void Entity::setDefaulted() { defaulted_ = 1; } inline const StringC &InternalEntity::string() const { return text_.string(); } inline const Text &InternalEntity::text() const { return text_; } inline const ExternalId &ExternalEntity::externalId() const { return externalId_; } inline const AttributeList &ExternalDataEntity::attributes() const { return attributes_; } inline const Notation *ExternalDataEntity::notation() const { return notation_.pointer(); } } # 15 "../include/Dtd.h" 2 # 1 "../include/ShortReferenceMap.h" 1 #pragma interface # 1 "../include/Vector.h" 1 # 11 "../include/ShortReferenceMap.h" 2 # 1 "../include/Vector.h" 1 # 12 "../include/ShortReferenceMap.h" 2 # 1 "../include/Ptr.h" 1 # 17 "../include/ShortReferenceMap.h" 2 namespace OpenSP { class ShortReferenceMap : public Named { public: ShortReferenceMap(); ShortReferenceMap(const StringC &); Boolean defined() const; void setNameMap(Vector &map); void setEntityMap(Vector > &map); Boolean lookup(int i, const StringC *&) const; const StringC *entityName(size_t i) const; const ConstPtr &entity(size_t i) const; Boolean used() const; void setUsed(); const Location &defLocation() const; void setDefLocation(const Location &); private: ShortReferenceMap(const ShortReferenceMap &); void operator=(const ShortReferenceMap &); Vector nameMap_; Vector > entityMap_; ConstPtr nullEntity_; Boolean used_; Location defLocation_; }; inline Boolean ShortReferenceMap::defined() const { return nameMap_.size() > 0; } inline const StringC *ShortReferenceMap::entityName(size_t i) const { if (i < nameMap_.size() && nameMap_[i].size() != 0) return &nameMap_[i]; else return 0; } inline const ConstPtr &ShortReferenceMap::entity(size_t i) const { if (i < entityMap_.size()) return entityMap_[i]; else return nullEntity_; } inline void ShortReferenceMap::setEntityMap(Vector > &map) { map.swap(entityMap_); } inline Boolean ShortReferenceMap::used() const { return used_; } inline void ShortReferenceMap::setUsed() { used_ = 1; } inline void ShortReferenceMap::setDefLocation(const Location &loc) { defLocation_ = loc; } inline const Location &ShortReferenceMap::defLocation() const { return defLocation_; } } # 16 "../include/Dtd.h" 2 # 1 "../include/Vector.h" 1 # 21 "../include/Dtd.h" 2 # 1 "../include/HashTable.h" 1 # 22 "../include/Dtd.h" 2 namespace OpenSP { class Syntax; class ParserState; class Dtd : public Resource { public: typedef NamedTableIter ElementTypeIter; typedef ConstNamedTableIter ConstElementTypeIter; typedef NamedTableIter RankStemIter; typedef ConstNamedTableIter ConstRankStemIter; typedef NamedTableIter ShortReferenceMapIter; typedef ConstNamedResourceTableIter ConstNotationIter; typedef NamedResourceTableIter NotationIter; typedef ConstNamedResourceTableIter ConstEntityIter; typedef NamedResourceTableIter EntityIter; Dtd(const StringC &name, Boolean isBase); ConstPtr lookupEntity(Boolean isParameter, const StringC &) const; const Entity *lookupEntityTemp(Boolean isParameter, const StringC &) const; Ptr lookupEntity(Boolean isParameter, const StringC &); Ptr insertEntity(const Ptr &, Boolean replace = 0); Ptr removeEntity(Boolean isParameter, const StringC &); ConstEntityIter generalEntityIter() const; EntityIter generalEntityIter(); ConstEntityIter parameterEntityIter() const; EntityIter parameterEntityIter(); ConstPtr defaultEntity() const; const Entity *defaultEntityTemp() const; void setDefaultEntity(const Ptr &, ParserState &); const ConstPtr > &namePointer() const; const StringC &name() const; const ElementType *lookupElementType(const StringC &) const; ElementType *lookupElementType(const StringC &); ElementType *removeElementType(const StringC &); ElementType *insertElementType(ElementType *); size_t nElementTypeIndex() const; size_t allocElementTypeIndex(); ConstElementTypeIter elementTypeIter() const; ElementTypeIter elementTypeIter(); const RankStem *lookupRankStem(const StringC &) const; RankStem *lookupRankStem(const StringC &); RankStem *insertRankStem(RankStem *); size_t nRankStem() const; ConstRankStemIter rankStemIter() const; RankStemIter rankStemIter(); const ShortReferenceMap *lookupShortReferenceMap(const StringC &) const; ShortReferenceMap *lookupShortReferenceMap(const StringC &); ShortReferenceMap *insertShortReferenceMap(ShortReferenceMap *); ShortReferenceMapIter shortReferenceMapIter(); Boolean shortrefIndex(const StringC &, const Syntax &, size_t &index); size_t nShortref() const; const StringC &shortref(size_t i) const; void addNeededShortref(const StringC &); ConstPtr lookupNotation(const StringC &) const; const Notation *lookupNotationTemp(const StringC &) const; Ptr lookupNotation(const StringC &); Ptr insertNotation(const Ptr &); Ptr removeNotation(const StringC &); ConstNotationIter notationIter() const; NotationIter notationIter(); size_t allocCurrentAttributeIndex(); size_t nCurrentAttribute() const; size_t allocElementDefinitionIndex(); size_t nElementDefinition() const; size_t allocAttributeDefinitionListIndex(); size_t nAttributeDefinitionList() const; const ElementType *documentElementType() const; Boolean isBase() const; Boolean isInstantiated() const; void instantiate(); Ptr &implicitElementAttributeDef(); void setImplicitElementAttributeDef(const Ptr &); Ptr &implicitNotationAttributeDef(); void setImplicitNotationAttributeDef(const Ptr &); private: Dtd(const Dtd &); void operator=(const Dtd &); NamedResourceTable generalEntityTable_; NamedResourceTable parameterEntityTable_; ConstPtr defaultEntity_; ConstPtr > name_; NamedTable elementTypeTable_; NamedTable rankStemTable_; NamedTable shortReferenceMapTable_; NamedResourceTable notationTable_; size_t nCurrentAttribute_; size_t nElementDefinition_; size_t nAttributeDefinitionList_; size_t nElementType_; ElementType *documentElementType_; Vector shortrefs_; HashTable shortrefTable_; Boolean isBase_; Boolean isInstantitated_; Ptr implicitElementAttributeDef_; Ptr implicitNotationAttributeDef_; }; inline ConstPtr Dtd::lookupEntity(Boolean isParameter, const StringC &name) const { return (isParameter ? ¶meterEntityTable_ : &generalEntityTable_)->lookupConst(name); } inline const Entity *Dtd::lookupEntityTemp(Boolean isParameter, const StringC &name) const { return (isParameter ? ¶meterEntityTable_ : &generalEntityTable_)->lookupTemp(name); } inline Ptr Dtd::lookupEntity(Boolean isParameter, const StringC &name) { return (isParameter ? ¶meterEntityTable_ : &generalEntityTable_)->lookup(name); } inline Ptr Dtd::insertEntity(const Ptr &entity, Boolean replace) { return ((entity->declType() == Entity::parameterEntity || entity->declType() == Entity::doctype) ? ¶meterEntityTable_ : &generalEntityTable_)->insert(entity, replace); } inline Ptr Dtd::removeEntity(Boolean isParameter, const StringC &name) { return (isParameter ? ¶meterEntityTable_ : &generalEntityTable_)->remove(name); } inline Dtd::ConstEntityIter Dtd::generalEntityIter() const { return ConstNamedResourceTableIter(generalEntityTable_); } inline Dtd::EntityIter Dtd::generalEntityIter() { return NamedResourceTableIter(generalEntityTable_); } inline Dtd::ConstEntityIter Dtd::parameterEntityIter() const { return ConstNamedResourceTableIter(parameterEntityTable_); } inline Dtd::EntityIter Dtd::parameterEntityIter() { return NamedResourceTableIter(parameterEntityTable_); } inline ConstPtr Dtd::defaultEntity() const { return defaultEntity_; } inline const Entity *Dtd::defaultEntityTemp() const { return defaultEntity_.pointer(); } inline const ConstPtr > &Dtd::namePointer() const { return name_; } inline const StringC &Dtd::name() const { return *name_; } inline size_t Dtd::allocCurrentAttributeIndex() { return nCurrentAttribute_++; } inline size_t Dtd::nCurrentAttribute() const { return nCurrentAttribute_; } inline size_t Dtd::allocElementDefinitionIndex() { return nElementDefinition_++; } inline size_t Dtd::nElementDefinition() const { return nElementDefinition_; } inline size_t Dtd::allocAttributeDefinitionListIndex() { return nAttributeDefinitionList_++; } inline size_t Dtd::nAttributeDefinitionList() const { return nAttributeDefinitionList_; } inline const ElementType *Dtd::lookupElementType(const StringC &name) const { return elementTypeTable_.lookup(name); } inline ElementType *Dtd::lookupElementType(const StringC &name) { return elementTypeTable_.lookup(name); } inline ElementType *Dtd::insertElementType(ElementType *e) { return elementTypeTable_.insert(e); } inline Dtd::ElementTypeIter Dtd::elementTypeIter() { return NamedTableIter(elementTypeTable_); } inline Dtd::ConstElementTypeIter Dtd::elementTypeIter() const { return ConstNamedTableIter(elementTypeTable_); } inline Dtd::RankStemIter Dtd::rankStemIter() { return NamedTableIter(rankStemTable_); } inline Dtd::ConstRankStemIter Dtd::rankStemIter() const { return ConstNamedTableIter(rankStemTable_); } inline ElementType *Dtd::removeElementType(const StringC &name) { return elementTypeTable_.remove(name); } inline size_t Dtd::nElementTypeIndex() const { return 1 + nElementType_; } inline size_t Dtd::allocElementTypeIndex() { return 1 + nElementType_++; } inline const RankStem *Dtd::lookupRankStem(const StringC &name) const { return rankStemTable_.lookup(name); } inline RankStem *Dtd::lookupRankStem(const StringC &name) { return rankStemTable_.lookup(name); } inline RankStem *Dtd::insertRankStem(RankStem *e) { return rankStemTable_.insert(e); } inline size_t Dtd::nRankStem() const { return rankStemTable_.count(); } inline ConstPtr Dtd::lookupNotation(const StringC &name) const { return notationTable_.lookupConst(name); } inline const Notation *Dtd::lookupNotationTemp(const StringC &name) const { return notationTable_.lookupTemp(name); } inline Ptr Dtd::lookupNotation(const StringC &name) { return notationTable_.lookup(name); } inline Ptr Dtd::insertNotation(const Ptr &nt) { return notationTable_.insert(nt); } inline Dtd::ConstNotationIter Dtd::notationIter() const { return ConstNamedResourceTableIter(notationTable_); } inline Dtd::NotationIter Dtd::notationIter() { return NamedResourceTableIter(notationTable_); } inline Ptr Dtd::removeNotation(const StringC &name) { return notationTable_.remove(name); } inline const ElementType *Dtd::documentElementType() const { return documentElementType_; } inline const ShortReferenceMap *Dtd::lookupShortReferenceMap(const StringC &name) const { return shortReferenceMapTable_.lookup(name); } inline ShortReferenceMap *Dtd::lookupShortReferenceMap(const StringC &name) { return shortReferenceMapTable_.lookup(name); } inline ShortReferenceMap *Dtd::insertShortReferenceMap(ShortReferenceMap *map) { return shortReferenceMapTable_.insert(map); } inline Dtd::ShortReferenceMapIter Dtd::shortReferenceMapIter() { return NamedTableIter(shortReferenceMapTable_); } inline Boolean Dtd::isBase() const { return isBase_; } inline size_t Dtd::nShortref() const { return shortrefs_.size(); } inline const StringC &Dtd::shortref(size_t i) const { return shortrefs_[i]; } inline Ptr &Dtd::implicitElementAttributeDef() { return implicitElementAttributeDef_; } inline void Dtd::setImplicitElementAttributeDef(const Ptr &def) { implicitElementAttributeDef_ = def; } inline Ptr &Dtd::implicitNotationAttributeDef() { return implicitNotationAttributeDef_; } inline void Dtd::setImplicitNotationAttributeDef(const Ptr &def) { implicitNotationAttributeDef_ = def; } inline Boolean Dtd::isInstantiated() const { return isInstantitated_; } inline void Dtd::instantiate() { isInstantitated_ = 1; } } # 23 "../include/Event.h" 2 # 1 "../include/Lpd.h" 1 #pragma interface # 1 "../include/Ptr.h" 1 # 13 "../include/Lpd.h" 2 # 22 "../include/Lpd.h" namespace OpenSP { class ElementType; struct ResultElementSpec { ResultElementSpec(); const ElementType *elementType; AttributeList attributeList; void swap(ResultElementSpec &); }; class Lpd : public Resource { public: enum Type { simpleLink, implicitLink, explicitLink }; Lpd(const StringC &, Type, const Location &, const Ptr &sourceDtd); virtual ~Lpd(); Type type() const; const Location &location() const; const Ptr &sourceDtd(); ConstPtr sourceDtd() const; Boolean active() const; void activate(); const ConstPtr > &namePointer() const; const StringC &name() const; private: Lpd(const Lpd &); void operator=(const Lpd &); Type type_; Location location_; Boolean active_; Ptr sourceDtd_; ConstPtr > name_; }; class SimpleLpd : public Lpd, public Attributed { public: SimpleLpd(const StringC &, const Location &, const Ptr &sourceDtd); private: SimpleLpd(const SimpleLpd &); void operator=(const SimpleLpd &); }; class LinkSet; class SourceLinkRule { public: SourceLinkRule(); void setLinkAttributes(AttributeList &); void setResult(const ElementType *, AttributeList &); void setUselink(const LinkSet *); void setPostlink(const LinkSet *); void setPostlinkRestore(); void swap(SourceLinkRule &); const AttributeList &attributes() const; const ResultElementSpec &resultElementSpec() const; const LinkSet *uselink() const; const LinkSet *postlink() const; Boolean postlinkRestore() const; private: const LinkSet *uselink_; const LinkSet *postlink_; Boolean postlinkRestore_; AttributeList linkAttributes_; ResultElementSpec resultElementSpec_; }; class SourceLinkRuleResource : public Resource, public SourceLinkRule { public: SourceLinkRuleResource(); }; class LinkSet : public Named { public: LinkSet(const StringC &, const Dtd *); void setDefined(); Boolean defined() const; void addImplied(const ElementType *, AttributeList &); size_t nLinkRules(const ElementType *) const; const SourceLinkRule &linkRule(const ElementType *, size_t) const; void addLinkRule(const ElementType *, const ConstPtr &); size_t nImpliedLinkRules() const; const ResultElementSpec &impliedLinkRule(size_t) const; Boolean impliedResultAttributes(const ElementType *, const AttributeList *&); private: LinkSet(const LinkSet &); void operator=(const LinkSet &); Boolean defined_; Vector > > linkRules_; Vector impliedSourceLinkRules_; }; class IdLinkRule : public SourceLinkRule { public: IdLinkRule(); Boolean isAssociatedWith(const ElementType *) const; void setAssocElementTypes(Vector &); void swap(IdLinkRule &); private: Vector assocElementTypes_; }; class IdLinkRuleGroup : public Named { public: IdLinkRuleGroup(const StringC &); size_t nLinkRules() const; const IdLinkRule &linkRule(size_t) const; void addLinkRule(IdLinkRule &); private: IdLinkRuleGroup(const IdLinkRuleGroup &); void operator=(const IdLinkRuleGroup &); Vector linkRules_; }; class ComplexLpd : public Lpd { public: typedef ConstNamedTableIter ConstLinkSetIter; ComplexLpd(const StringC &, Type, const Location &, const Syntax &syntax, const Ptr &sourceDtd, const Ptr &resultDtd); size_t allocAttributeDefinitionListIndex(); size_t nAttributeDefinitionList() const; LinkSet *initialLinkSet(); const LinkSet *initialLinkSet() const; const LinkSet *emptyLinkSet() const; const LinkSet *lookupLinkSet(const StringC &) const; const IdLinkRuleGroup *lookupIdLink(const StringC &) const; IdLinkRuleGroup *lookupCreateIdLink(const StringC &); void insertIdLink(IdLinkRuleGroup *); ConstLinkSetIter linkSetIter() const; Boolean hadIdLinkSet() const; void setHadIdLinkSet(); LinkSet *lookupLinkSet(const StringC &); LinkSet *insertLinkSet(LinkSet *); const Ptr &resultDtd(); ConstPtr resultDtd() const; const ConstPtr & attributeDef(const ElementType *) const; void setAttributeDef(const ElementType *, const ConstPtr &); private: ComplexLpd(const ComplexLpd &); void operator=(const ComplexLpd &); Ptr resultDtd_; Vector > linkAttributeDefs_; NamedTable linkSetTable_; LinkSet initialLinkSet_; LinkSet emptyLinkSet_; Boolean hadIdLinkSet_; NamedTable idLinkTable_; size_t nAttributeDefinitionList_; }; inline Lpd::Type Lpd::type() const { return type_; } inline const Location &Lpd::location() const { return location_; } inline Boolean Lpd::active() const { return active_; } inline void Lpd::activate() { active_ = 1; } inline ConstPtr Lpd::sourceDtd() const { return sourceDtd_; } inline const Ptr &Lpd::sourceDtd() { return sourceDtd_; } inline const ConstPtr > &Lpd::namePointer() const { return name_; } inline const StringC &Lpd::name() const { return *name_; } inline void SourceLinkRule::setLinkAttributes(AttributeList &attributes) { attributes.swap(linkAttributes_); } inline const AttributeList &SourceLinkRule::attributes() const { return linkAttributes_; } inline void SourceLinkRule::setResult(const ElementType *element, AttributeList &attributes) { resultElementSpec_.elementType = element; attributes.swap(resultElementSpec_.attributeList); } inline const ResultElementSpec &SourceLinkRule::resultElementSpec() const { return resultElementSpec_; } inline void SourceLinkRule::setUselink(const LinkSet *linkSet) { uselink_ = linkSet; } inline void SourceLinkRule::setPostlink(const LinkSet *linkSet) { postlink_ = linkSet; } inline void SourceLinkRule::setPostlinkRestore() { postlinkRestore_ = 1; } inline const LinkSet *SourceLinkRule::uselink() const { return uselink_; } inline const LinkSet *SourceLinkRule::postlink() const { return postlink_; } inline Boolean SourceLinkRule::postlinkRestore() const { return postlinkRestore_; } inline Boolean LinkSet::defined() const { return defined_; } inline void LinkSet::setDefined() { defined_ = 1; } inline const SourceLinkRule &LinkSet::linkRule(const ElementType *e, size_t i) const { return *linkRules_[e->index()][i]; } inline size_t LinkSet::nImpliedLinkRules() const { return impliedSourceLinkRules_.size(); } inline const ResultElementSpec &LinkSet::impliedLinkRule(size_t i) const { return impliedSourceLinkRules_[i]; } inline const Ptr &ComplexLpd::resultDtd() { return resultDtd_; } inline ConstPtr ComplexLpd::resultDtd() const { return resultDtd_; } inline LinkSet *ComplexLpd::initialLinkSet() { return &initialLinkSet_; } inline const LinkSet *ComplexLpd::initialLinkSet() const { return &initialLinkSet_; } inline const LinkSet *ComplexLpd::emptyLinkSet() const { return &emptyLinkSet_; } inline const LinkSet *ComplexLpd::lookupLinkSet(const StringC &name) const { return linkSetTable_.lookup(name); } inline LinkSet *ComplexLpd::lookupLinkSet(const StringC &name) { return linkSetTable_.lookup(name); } inline LinkSet *ComplexLpd::insertLinkSet(LinkSet *e) { return linkSetTable_.insert(e); } inline size_t ComplexLpd::nAttributeDefinitionList() const { return nAttributeDefinitionList_; } inline size_t ComplexLpd::allocAttributeDefinitionListIndex() { return nAttributeDefinitionList_++; } inline ComplexLpd::ConstLinkSetIter ComplexLpd::linkSetIter() const { return ConstNamedTableIter(linkSetTable_); } inline const ConstPtr & ComplexLpd::attributeDef(const ElementType *e) const { return linkAttributeDefs_[e->index()]; } inline void ComplexLpd::setAttributeDef(const ElementType *e, const ConstPtr &attdef) { linkAttributeDefs_[e->index()] = attdef; } inline Boolean ComplexLpd::hadIdLinkSet() const { return hadIdLinkSet_; } inline void ComplexLpd::setHadIdLinkSet() { hadIdLinkSet_ = 1; } inline const IdLinkRuleGroup *ComplexLpd::lookupIdLink(const StringC &id) const { return idLinkTable_.lookup(id); } inline size_t IdLinkRuleGroup::nLinkRules() const { return linkRules_.size(); } inline const IdLinkRule &IdLinkRuleGroup::linkRule(size_t i) const { return linkRules_[i]; } } # 26 "../include/Event.h" 2 namespace OpenSP { class EventHandler; class Event : public Link { public: enum Type { message, characterData, startElement, endElement, pi, sdataEntity, externalDataEntity, subdocEntity, nonSgmlChar, appinfo, startDtd, endDtd, startLpd, endLpd, endProlog, sgmlDecl, uselink, usemap, commentDecl, sSep, ignoredRs, ignoredRe, reOrigin, ignoredChars, markedSectionStart, markedSectionEnd, entityStart, entityEnd, notationDecl, entityDecl, elementDecl, attlistDecl, attlistNotationDecl, linkAttlistDecl, linkDecl, idLinkDecl, shortrefDecl, ignoredMarkup, entityDefaulted, sgmlDeclEntity }; Event(Type); virtual void handle(EventHandler &) = 0; virtual void copyData(); void *operator new(size_t sz, Allocator &alloc) { return alloc.alloc(sz); } void *operator new(size_t sz) { return Allocator::allocSimple(sz); } void operator delete(void *p) { Allocator::free(p); } Type type() const; private: Event(const Event &); void operator=(const Event &); Type type_; }; class LocatedEvent : public Event { public: LocatedEvent(Type type, const Location &); const Location &location() const; private: LocatedEvent(const LocatedEvent &); void operator=(const LocatedEvent &); Location location_; }; class MarkupEvent : public LocatedEvent { public: MarkupEvent(Type type); MarkupEvent(Type type, const Location &, Markup *); const Markup &markup() const; private: MarkupEvent(const MarkupEvent &); void operator=(const MarkupEvent &); Markup markup_; }; class MessageEvent : public Event { public: MessageEvent(Message &); MessageEvent(const Message &); const Message &message() const; void handle(EventHandler &); private: MessageEvent(const MessageEvent &); void operator=(const MessageEvent &); Message message_; }; class AttributeList; class StartElementEvent : public LocatedEvent { public: StartElementEvent(const ElementType *, const ConstPtr &, AttributeList *, const Location &, Markup *); ~StartElementEvent(); void handle(EventHandler &); Boolean mustOmitEnd() const; void setIncluded(); Boolean included() const; const StringC &name() const; const ElementType *elementType() const; const Markup *markupPtr() const; const AttributeList &attributes() const; void copyData(); private: StartElementEvent(const StartElementEvent &); void operator=(const StartElementEvent &); const ElementType *elementType_; ConstPtr dtd_; PackedBoolean included_; PackedBoolean copied_; Markup *markup_; AttributeList *attributes_; }; class EndElementEvent : public LocatedEvent { public: EndElementEvent(const ElementType *, const ConstPtr &, const Location &, Markup *); ~EndElementEvent(); void handle(EventHandler &); void setIncluded(); Boolean included() const; const StringC &name() const; const ElementType *elementType() const; const Markup *markupPtr() const; void copyData(); private: EndElementEvent(const EndElementEvent &); void operator=(const EndElementEvent &); const ElementType *elementType_; ConstPtr dtd_; PackedBoolean included_; PackedBoolean copied_; Markup *markup_; }; class DataEvent : public LocatedEvent { public: DataEvent(Type, const Char *, size_t, const Location &); void handle(EventHandler &); const Char *data() const; size_t dataLength() const; virtual Boolean isRe(unsigned long &serial) const; virtual const Entity *entity() const; protected: const Char *p_; size_t length_; private: DataEvent(const DataEvent &); void operator=(const DataEvent &); }; class ImmediateDataEvent : public DataEvent { public: ImmediateDataEvent(Type type, const Char *, size_t, const Location &, Boolean copy); ~ImmediateDataEvent(); void copyData(); private: ImmediateDataEvent(const ImmediateDataEvent &); void operator=(const ImmediateDataEvent &); Char *alloc_; }; class InternalDataEntity; class DataEntityEvent : public DataEvent { public: DataEntityEvent(Type type, const InternalEntity *, const ConstPtr &); const Entity *entity() const; private: DataEntityEvent(const DataEntityEvent &); void operator=(const DataEntityEvent &); }; class InternalCdataEntity; class CdataEntityEvent : public DataEntityEvent { public: CdataEntityEvent(const InternalEntity *, const ConstPtr &); private: CdataEntityEvent(const CdataEntityEvent &); void operator=(const CdataEntityEvent &); }; class InternalSdataEntity; class SdataEntityEvent : public DataEntityEvent { public: SdataEntityEvent(const InternalEntity *, const ConstPtr &); void handle(EventHandler &); private: SdataEntityEvent(const SdataEntityEvent &); void operator=(const SdataEntityEvent &); }; class PiEntity; class PiEvent : public LocatedEvent { public: PiEvent(const Char *, size_t, const Location &); const Char *data() const; size_t dataLength() const; virtual const Entity *entity() const; void handle(EventHandler &); private: PiEvent(const PiEvent &); void operator=(const PiEvent &); const Char *data_; size_t dataLength_; }; class ImmediatePiEvent : public PiEvent { public: ImmediatePiEvent(StringC &, const Location &); private: ImmediatePiEvent(const ImmediatePiEvent &); void operator=(const ImmediatePiEvent &); StringC string_; }; class PiEntityEvent : public PiEvent { public: PiEntityEvent(const PiEntity *entity, const ConstPtr &origin); const Entity *entity() const; private: PiEntityEvent(const PiEntityEvent &); void operator=(const PiEntityEvent &); }; class ExternalNonTextEntity; class ExternalDataEntity; class SubdocEntity; class ExternalEntityEvent : public Event { public: ExternalEntityEvent(Type type, const ConstPtr &); const ConstPtr &entityOrigin() const; const Location &location() const; private: ExternalEntityEvent(const ExternalEntityEvent &); void operator=(const ExternalEntityEvent &); ConstPtr origin_; }; class ExternalDataEntityEvent : public ExternalEntityEvent { public: ExternalDataEntityEvent(const ExternalDataEntity *, const ConstPtr &); void handle(EventHandler &); const ExternalDataEntity *entity() const; private: ExternalDataEntityEvent(const ExternalDataEntityEvent &); void operator=(const ExternalDataEntityEvent &); const ExternalDataEntity *dataEntity_; }; class SubdocEntityEvent : public ExternalEntityEvent { public: SubdocEntityEvent(const SubdocEntity *, const ConstPtr &); void handle(EventHandler &); const SubdocEntity *entity() const; private: SubdocEntityEvent(const SubdocEntityEvent &); void operator=(const SubdocEntityEvent &); const SubdocEntity *subdocEntity_; }; class NonSgmlCharEvent : public LocatedEvent { public: NonSgmlCharEvent(Char c, const Location &); Char character() const; void handle(EventHandler &); private: NonSgmlCharEvent(const NonSgmlCharEvent &); void operator=(const NonSgmlCharEvent &); Char c_; }; class AppinfoEvent : public LocatedEvent { public: AppinfoEvent(const Location &); AppinfoEvent(const Text &, const Location &); void handle(EventHandler &); Boolean literal(const StringC *&) const; private: AppinfoEvent(const AppinfoEvent &); void operator=(const AppinfoEvent &); Boolean appinfoNone_; Text appinfo_; }; class UselinkEvent : public MarkupEvent { public: UselinkEvent(const ConstPtr &, const LinkSet *, Boolean restore, const Location &, Markup *); void handle(EventHandler &); const ConstPtr &lpd() const; const LinkSet *linkSet() const; Boolean restore() const; private: UselinkEvent(const UselinkEvent &); void operator=(const UselinkEvent &); ConstPtr lpd_; const LinkSet *linkSet_; Boolean restore_; }; class UsemapEvent : public MarkupEvent { public: UsemapEvent(const ShortReferenceMap *, Vector &, const ConstPtr &, const Location &, Markup *); void handle(EventHandler &); const ShortReferenceMap *map() const; const Vector &elements() const; private: UsemapEvent(const UsemapEvent &); void operator=(const UsemapEvent &); ConstPtr dtd_; Vector elements_; const ShortReferenceMap *map_; }; class StartSubsetEvent : public MarkupEvent { public: StartSubsetEvent(Type, const StringC &, const ConstPtr &entity, Boolean hasInternalSubset, const Location &, Markup *); const StringC &name() const; const ConstPtr &entity() const; Boolean hasInternalSubset() const; private: StartSubsetEvent(const StartSubsetEvent &); void operator=(const StartSubsetEvent &); StringC name_; ConstPtr entity_; Boolean hasInternalSubset_; }; class StartDtdEvent : public StartSubsetEvent { public: StartDtdEvent(const StringC &, const ConstPtr &entity, Boolean hasInternalSubset, const Location &, Markup *); void handle(EventHandler &); private: StartDtdEvent(const StartDtdEvent &); void operator=(const StartDtdEvent &); }; class StartLpdEvent : public StartSubsetEvent { public: StartLpdEvent(Boolean active, const StringC &, const ConstPtr &entity, Boolean hasInternalSubset, const Location &, Markup *); void handle(EventHandler &); Boolean active() const; private: StartLpdEvent(const StartLpdEvent &); void operator=(const StartLpdEvent &); Boolean active_; }; class EndDtdEvent : public MarkupEvent { public: EndDtdEvent(const ConstPtr &, const Location &, Markup *); void handle(EventHandler &); const Dtd &dtd() const; const ConstPtr &dtdPointer() const; private: EndDtdEvent(const EndDtdEvent &); void operator=(const EndDtdEvent &); ConstPtr dtd_; }; class EndLpdEvent : public MarkupEvent { public: EndLpdEvent(const ConstPtr &, const Location &, Markup *); void handle(EventHandler &); const Lpd &lpd() const; const ConstPtr &lpdPointer() const; private: EndLpdEvent(const EndLpdEvent &); void operator=(const EndLpdEvent &); ConstPtr lpd_; }; class EndPrologEvent : public LocatedEvent { public: EndPrologEvent(const ConstPtr &dtd, const ConstPtr &lpd, Vector &simpleLinkNames, Vector &simpleLinkAttributes, const Location &); EndPrologEvent(const ConstPtr &dtd, const Location &); void handle(EventHandler &); const Dtd &dtd() const; const ConstPtr &dtdPointer() const; const ConstPtr &lpdPointer() const; const Vector &simpleLinkNames() const; const Vector &simpleLinkAttributes() const; private: EndPrologEvent(const EndPrologEvent &); void operator=(const EndPrologEvent &); ConstPtr dtd_; ConstPtr lpd_; Vector simpleLinkNames_; Vector simpleLinkAttributes_; }; class SgmlDeclEvent : public MarkupEvent { public: SgmlDeclEvent(const ConstPtr &, const ConstPtr &syntax); SgmlDeclEvent(const ConstPtr &, const ConstPtr &syntax, const ConstPtr &instanceSyntax, const ConstPtr &refSd, const ConstPtr &refSyntax, Index nextIndex, const StringC &implySystemId, const Location &, Markup *); void handle(EventHandler &); const Sd &sd() const; const ConstPtr &sdPointer() const; const Syntax &prologSyntax() const; const ConstPtr &prologSyntaxPointer() const; const Syntax &instanceSyntax() const; const ConstPtr &instanceSyntaxPointer() const; const ConstPtr &refSdPointer() const; const ConstPtr &refSyntaxPointer() const; const StringC &implySystemId() const; private: SgmlDeclEvent(const SgmlDeclEvent &); void operator=(const SgmlDeclEvent &); ConstPtr sd_; ConstPtr prologSyntax_; ConstPtr instanceSyntax_; ConstPtr refSd_; ConstPtr refSyntax_; Index nextIndex_; StringC implySystemId_; }; class CommentDeclEvent : public MarkupEvent { public: CommentDeclEvent(const Location &, Markup *); void handle(EventHandler &); private: CommentDeclEvent(const CommentDeclEvent &); void operator=(const CommentDeclEvent &); }; class SSepEvent : public ImmediateDataEvent { public: SSepEvent(const Char *, size_t, const Location &, Boolean copy); void handle(EventHandler &); private: SSepEvent(const SSepEvent &); void operator=(const SSepEvent &); }; class IgnoredRsEvent : public LocatedEvent { public: IgnoredRsEvent(Char c, const Location &); void handle(EventHandler &); Char rs() const; private: IgnoredRsEvent(const IgnoredRsEvent &); void operator=(const IgnoredRsEvent &); Char c_; }; class IgnoredReEvent : public LocatedEvent { public: IgnoredReEvent(Char c, const Location &, unsigned long serial); void handle(EventHandler &); Char re() const; unsigned long serial() const; private: IgnoredReEvent(const IgnoredReEvent &); void operator=(const IgnoredReEvent &); unsigned long serial_; Char c_; }; class ReEvent : public ImmediateDataEvent { public: ReEvent(const Char *, const Location &, unsigned long serial); Boolean isRe(unsigned long &serial) const; private: ReEvent(const ReEvent &); void operator=(const ReEvent &); unsigned long serial_; }; class ReOriginEvent : public LocatedEvent { public: ReOriginEvent(Char c, const Location &, unsigned long serial); void handle(EventHandler &); Char re() const; unsigned long serial() const; private: ReOriginEvent(const ReOriginEvent &); void operator=(const ReOriginEvent &); unsigned long serial_; Char c_; }; class IgnoredCharsEvent : public ImmediateDataEvent { public: IgnoredCharsEvent(const Char *, size_t, const Location &, Boolean copy); void handle(EventHandler &); private: IgnoredCharsEvent(const IgnoredCharsEvent &); void operator=(const IgnoredCharsEvent &); }; class MarkedSectionEvent : public MarkupEvent { public: enum Status { include, rcdata, cdata, ignore }; MarkedSectionEvent(Type, Status, const Location &, Markup *); Status status() const; private: MarkedSectionEvent(const MarkedSectionEvent &); void operator=(const MarkedSectionEvent &); Status status_; }; class MarkedSectionStartEvent : public MarkedSectionEvent { public: MarkedSectionStartEvent(Status, const Location &, Markup *); void handle(EventHandler &); private: MarkedSectionStartEvent(const MarkedSectionStartEvent &); void operator=(const MarkedSectionStartEvent &); }; class MarkedSectionEndEvent : public MarkedSectionEvent { public: MarkedSectionEndEvent(Status, const Location &, Markup *); void handle(EventHandler &); private: MarkedSectionEndEvent(const MarkedSectionEndEvent &); void operator=(const MarkedSectionEndEvent &); }; class EntityStartEvent : public Event { public: EntityStartEvent(const ConstPtr &origin); void handle(EventHandler &); const Entity *entity() const; const ConstPtr &entityOrigin() const; private: EntityStartEvent(const EntityStartEvent &); void operator=(const EntityStartEvent &); ConstPtr origin_; }; class EntityEndEvent : public LocatedEvent { public: EntityEndEvent(const Location &); void handle(EventHandler &); private: EntityEndEvent(const EntityEndEvent &); void operator=(const EntityEndEvent &); }; class EntityDeclEvent : public MarkupEvent { public: EntityDeclEvent(const ConstPtr &, Boolean ignored, const Location &, Markup *); void handle(EventHandler &); const Entity &entity() const; const ConstPtr &entityPointer() const; Boolean ignored() const; private: Boolean ignored_; ConstPtr entity_; }; class NotationDeclEvent : public MarkupEvent { public: NotationDeclEvent(const ConstPtr &, const Location &, Markup *); void handle(EventHandler &); const Notation ¬ation() const; const ConstPtr ¬ationPointer() const; private: NotationDeclEvent(const NotationDeclEvent &); void operator=(const NotationDeclEvent &); ConstPtr notation_; }; class ElementDeclEvent : public MarkupEvent { public: ElementDeclEvent(Vector &elements, const ConstPtr &, const Location &, Markup *); void handle(EventHandler &); const Vector &elements() const; private: ElementDeclEvent(const ElementDeclEvent &); void operator=(const ElementDeclEvent &); Vector elements_; ConstPtr dtd_; }; class AttlistDeclEvent : public MarkupEvent { public: AttlistDeclEvent(Vector &elements, const ConstPtr &, const Location &, Markup *); void handle(EventHandler &); const Vector &elements() const; private: AttlistDeclEvent(const AttlistDeclEvent &); void operator=(const AttlistDeclEvent &); Vector elements_; ConstPtr dtd_; }; class AttlistNotationDeclEvent : public MarkupEvent { public: AttlistNotationDeclEvent(Vector > ¬ations, const Location &, Markup *); void handle(EventHandler &); const Vector > ¬ations() const; private: AttlistNotationDeclEvent(const AttlistNotationDeclEvent &); void operator=(const AttlistDeclEvent &); Vector > notations_; }; class LinkAttlistDeclEvent : public MarkupEvent { public: LinkAttlistDeclEvent(Vector &elements, const ConstPtr &, const Location &, Markup *); void handle(EventHandler &); const Vector &elements() const; const Lpd &lpd() const; private: LinkAttlistDeclEvent(const LinkAttlistDeclEvent &); void operator=(const LinkAttlistDeclEvent &); Vector elements_; ConstPtr lpd_; }; class LinkDeclEvent : public MarkupEvent { public: LinkDeclEvent(const LinkSet *linkSet, const ConstPtr &, const Location &, Markup *); void handle(EventHandler &); const LinkSet *linkSet() const; const ComplexLpd &lpd() const; private: LinkDeclEvent(const LinkDeclEvent &); void operator=(const LinkDeclEvent &); const LinkSet *linkSet_; ConstPtr lpd_; }; class IdLinkDeclEvent : public MarkupEvent { public: IdLinkDeclEvent(const ConstPtr &, const Location &, Markup *); void handle(EventHandler &); const ComplexLpd &lpd() const; private: IdLinkDeclEvent(const IdLinkDeclEvent &); void operator=(const IdLinkDeclEvent &); ConstPtr lpd_; }; class ShortrefDeclEvent : public MarkupEvent { public: ShortrefDeclEvent(const ShortReferenceMap *, const ConstPtr &, const Location &, Markup *); void handle(EventHandler &); const ShortReferenceMap *map() const; private: ShortrefDeclEvent(const ShortrefDeclEvent &); void operator=(const ShortrefDeclEvent &); const ShortReferenceMap *map_; ConstPtr dtd_; }; class IgnoredMarkupEvent : public MarkupEvent { public: IgnoredMarkupEvent(const Location &, Markup *); void handle(EventHandler &); private: IgnoredMarkupEvent(const IgnoredMarkupEvent &); void operator=(const IgnoredMarkupEvent &); }; class EntityDefaultedEvent : public LocatedEvent { public: EntityDefaultedEvent(const ConstPtr &, const Location &); void handle(EventHandler &); const Entity &entity() const; const ConstPtr &entityPointer() const; private: EntityDefaultedEvent(const EntityDefaultedEvent &); void operator=(const EntityDefaultedEvent &); ConstPtr entity_; }; class SgmlDeclEntityEvent : public LocatedEvent { public: SgmlDeclEntityEvent(const PublicId &publicId, PublicId::TextClass entityType, const StringC &effectiveSystemId, const Location &); void handle(EventHandler &); const PublicId &publicId() const; PublicId::TextClass entityType() const; const StringC &effectiveSystemId() const; private: SgmlDeclEntityEvent(const SgmlDeclEntityEvent &); void operator=(const SgmlDeclEntityEvent &); PublicId publicId_; PublicId::TextClass entityType_; StringC effectiveSystemId_; }; class EventHandler { public: virtual ~EventHandler(); virtual void message(MessageEvent *) = 0; virtual void data(DataEvent *); virtual void startElement(StartElementEvent *); virtual void endElement(EndElementEvent *); virtual void pi(PiEvent *); virtual void sdataEntity(SdataEntityEvent *); virtual void externalDataEntity(ExternalDataEntityEvent *); virtual void subdocEntity(SubdocEntityEvent *); virtual void nonSgmlChar(NonSgmlCharEvent *); virtual void appinfo(AppinfoEvent *); virtual void uselink(UselinkEvent *); virtual void usemap(UsemapEvent *); virtual void startDtd(StartDtdEvent *); virtual void endDtd(EndDtdEvent *); virtual void startLpd(StartLpdEvent *); virtual void endLpd(EndLpdEvent *); virtual void endProlog(EndPrologEvent *); virtual void sgmlDecl(SgmlDeclEvent *); virtual void commentDecl(CommentDeclEvent *); virtual void sSep(SSepEvent *); virtual void ignoredRs(IgnoredRsEvent *); virtual void ignoredRe(IgnoredReEvent *); virtual void reOrigin(ReOriginEvent *); virtual void ignoredChars(IgnoredCharsEvent *); virtual void markedSectionStart(MarkedSectionStartEvent *); virtual void markedSectionEnd(MarkedSectionEndEvent *); virtual void entityStart(EntityStartEvent *); virtual void entityEnd(EntityEndEvent *); virtual void notationDecl(NotationDeclEvent *); virtual void entityDecl(EntityDeclEvent *); virtual void elementDecl(ElementDeclEvent *); virtual void attlistDecl(AttlistDeclEvent *); virtual void linkAttlistDecl(LinkAttlistDeclEvent *); virtual void attlistNotationDecl(AttlistNotationDeclEvent *); virtual void linkDecl(LinkDeclEvent *); virtual void idLinkDecl(IdLinkDeclEvent *); virtual void shortrefDecl(ShortrefDeclEvent *); virtual void ignoredMarkup(IgnoredMarkupEvent *); virtual void entityDefaulted(EntityDefaultedEvent *); virtual void inputClosed(InputSource *in); virtual void inputOpened(InputSource *in); virtual void sgmlDeclEntity(SgmlDeclEntityEvent *); }; inline Event::Event(Type type) : type_(type) { } inline Event::Type Event::type() const { return type_; } inline const Location &LocatedEvent::location() const { return location_; } inline const Markup &MarkupEvent::markup() const { return markup_; } inline const Message &MessageEvent::message() const { return message_; } inline const ElementType *StartElementEvent::elementType() const { return elementType_; } inline const StringC &StartElementEvent::name() const { return elementType_->name(); } inline void StartElementEvent::setIncluded() { included_ = 1; } inline Boolean StartElementEvent::included() const { return included_; } inline const Markup *StartElementEvent::markupPtr() const { return markup_; } inline const AttributeList &StartElementEvent::attributes() const { return *attributes_; } inline Boolean StartElementEvent::mustOmitEnd() const { return ((elementType()->definition()->declaredContent() == ElementDefinition::empty) || attributes_->conref()); } inline const ElementType *EndElementEvent::elementType() const { return elementType_; } inline const StringC &EndElementEvent::name() const { return elementType_->name(); } inline void EndElementEvent::setIncluded() { included_ = 1; } inline Boolean EndElementEvent::included() const { return included_; } inline const Markup *EndElementEvent::markupPtr() const { return markup_; } inline const Char *DataEvent::data() const { return p_; } inline size_t DataEvent::dataLength() const { return length_; } inline const Char *PiEvent::data() const { return data_; } inline size_t PiEvent::dataLength() const { return dataLength_; } inline const ConstPtr & ExternalEntityEvent::entityOrigin() const { return origin_; } inline const Location &ExternalEntityEvent::location() const { return origin_->parent(); } inline const ExternalDataEntity *ExternalDataEntityEvent::entity() const { return dataEntity_; } inline const SubdocEntity *SubdocEntityEvent::entity() const { return subdocEntity_; } inline Char NonSgmlCharEvent::character() const { return c_; } inline Boolean AppinfoEvent::literal(const StringC *&p) const { if (appinfoNone_) return 0; p = &appinfo_.string(); return 1; } inline const ConstPtr &UselinkEvent::lpd() const { return lpd_; } inline const LinkSet *UselinkEvent::linkSet() const { return linkSet_; } inline Boolean UselinkEvent::restore() const { return restore_; } inline const ShortReferenceMap *UsemapEvent::map() const { return map_; } inline const StringC &StartSubsetEvent::name() const { return name_; } inline const ConstPtr &StartSubsetEvent::entity() const { return entity_; } inline Boolean StartSubsetEvent::hasInternalSubset() const { return hasInternalSubset_; } inline Boolean StartLpdEvent::active() const { return active_; } inline const Dtd &EndDtdEvent::dtd() const { return *dtd_; } inline const ConstPtr &EndDtdEvent::dtdPointer() const { return dtd_; } inline const Lpd &EndLpdEvent::lpd() const { return *lpd_; } inline const ConstPtr &EndLpdEvent::lpdPointer() const { return lpd_; } inline const Dtd &EndPrologEvent::dtd() const { return *dtd_; } inline const ConstPtr &EndPrologEvent::dtdPointer() const { return dtd_; } inline const ConstPtr &EndPrologEvent::lpdPointer() const { return lpd_; } inline const Vector &EndPrologEvent::simpleLinkNames() const { return simpleLinkNames_; } inline const Vector &EndPrologEvent::simpleLinkAttributes() const { return simpleLinkAttributes_; } inline const Sd &SgmlDeclEvent::sd() const { return *sd_; } inline const ConstPtr &SgmlDeclEvent::sdPointer() const { return sd_; } inline const ConstPtr &SgmlDeclEvent::refSdPointer() const { return refSd_; } inline const Syntax &SgmlDeclEvent::prologSyntax() const { return *prologSyntax_; } inline const ConstPtr &SgmlDeclEvent::prologSyntaxPointer() const { return prologSyntax_; } inline const Syntax &SgmlDeclEvent::instanceSyntax() const { return *instanceSyntax_; } inline const ConstPtr &SgmlDeclEvent::instanceSyntaxPointer() const { return instanceSyntax_; } inline const ConstPtr &SgmlDeclEvent::refSyntaxPointer() const { return refSyntax_; } inline const StringC &SgmlDeclEvent::implySystemId() const { return implySystemId_; } inline Char IgnoredRsEvent::rs() const { return c_; } inline Char IgnoredReEvent::re() const { return c_; } inline unsigned long IgnoredReEvent::serial() const { return serial_; } inline Char ReOriginEvent::re() const { return c_; } inline unsigned long ReOriginEvent::serial() const { return serial_; } inline MarkedSectionEvent::Status MarkedSectionEvent::status() const { return status_; } inline const Entity *EntityStartEvent::entity() const { return origin_->entity(); } inline const ConstPtr & EntityStartEvent::entityOrigin() const { return origin_; } inline const ConstPtr &EntityDeclEvent::entityPointer() const { return entity_; } inline const Entity &EntityDeclEvent::entity() const { return *entity_; } inline Boolean EntityDeclEvent::ignored() const { return ignored_; } inline const Notation &NotationDeclEvent::notation() const { return *notation_; } inline const ConstPtr &NotationDeclEvent::notationPointer() const { return notation_; } inline const Vector &ElementDeclEvent::elements() const { return elements_; } inline const Vector &AttlistDeclEvent::elements() const { return elements_; } inline const Vector &LinkAttlistDeclEvent::elements() const { return elements_; } inline const Lpd &LinkAttlistDeclEvent::lpd() const { return *lpd_; } inline const LinkSet *LinkDeclEvent::linkSet() const { return linkSet_; } inline const ComplexLpd &LinkDeclEvent::lpd() const { return *lpd_; } inline const ComplexLpd &IdLinkDeclEvent::lpd() const { return *lpd_; } inline const Vector > & AttlistNotationDeclEvent::notations() const { return notations_; } inline const ShortReferenceMap *ShortrefDeclEvent::map() const { return map_; } inline const Entity &EntityDefaultedEvent::entity() const { return *entity_; } inline const ConstPtr &EntityDefaultedEvent::entityPointer() const { return entity_; } inline const PublicId &SgmlDeclEntityEvent::publicId() const { return publicId_; } inline PublicId::TextClass SgmlDeclEntityEvent::entityType() const { return entityType_; } inline const StringC &SgmlDeclEntityEvent::effectiveSystemId() const { return effectiveSystemId_; } } # 12 "../include/ArcEngine.h" 2 # 1 "../include/Vector.h" 1 # 13 "../include/ArcEngine.h" 2 # 1 "../include/SgmlParser.h" 1 #pragma interface # 1 "../include/Ptr.h" 1 # 13 "../include/SgmlParser.h" 2 # 1 "/usr/include/signal.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/signal.h" 1 3 4 # 29 "/usr/include/gentoo-multilib/amd64/signal.h" 3 4 # 1 "/usr/include/features.h" 1 3 4 # 30 "/usr/include/gentoo-multilib/amd64/signal.h" 2 3 4 extern "C" { # 1 "/usr/include/bits/sigset.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/bits/sigset.h" 1 3 4 # 103 "/usr/include/gentoo-multilib/amd64/bits/sigset.h" 3 4 extern int __sigismember (__const __sigset_t *, int); extern int __sigaddset (__sigset_t *, int); extern int __sigdelset (__sigset_t *, int); # 117 "/usr/include/gentoo-multilib/amd64/bits/sigset.h" 3 4 extern __inline int __sigismember (__const __sigset_t *__set, int __sig) { unsigned long int __mask = (((unsigned long int) 1) << (((__sig) - 1) % (8 * sizeof (unsigned long int)))); unsigned long int __word = (((__sig) - 1) / (8 * sizeof (unsigned long int))); return (__set->__val[__word] & __mask) ? 1 : 0; } extern __inline int __sigaddset ( __sigset_t *__set, int __sig) { unsigned long int __mask = (((unsigned long int) 1) << (((__sig) - 1) % (8 * sizeof (unsigned long int)))); unsigned long int __word = (((__sig) - 1) / (8 * sizeof (unsigned long int))); return ((__set->__val[__word] |= __mask), 0); } extern __inline int __sigdelset ( __sigset_t *__set, int __sig) { unsigned long int __mask = (((unsigned long int) 1) << (((__sig) - 1) % (8 * sizeof (unsigned long int)))); unsigned long int __word = (((__sig) - 1) / (8 * sizeof (unsigned long int))); return ((__set->__val[__word] &= ~__mask), 0); } # 9 "/usr/include/bits/sigset.h" 2 3 4 # 34 "/usr/include/gentoo-multilib/amd64/signal.h" 2 3 4 typedef __sig_atomic_t sig_atomic_t; # 57 "/usr/include/gentoo-multilib/amd64/signal.h" 3 4 # 1 "/usr/include/bits/types.h" 1 3 4 # 58 "/usr/include/gentoo-multilib/amd64/signal.h" 2 3 4 # 1 "/usr/include/bits/signum.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/bits/signum.h" 1 3 4 # 9 "/usr/include/bits/signum.h" 2 3 4 # 59 "/usr/include/gentoo-multilib/amd64/signal.h" 2 3 4 # 75 "/usr/include/gentoo-multilib/amd64/signal.h" 3 4 typedef void (*__sighandler_t) (int); extern __sighandler_t __sysv_signal (int __sig, __sighandler_t __handler) throw (); extern __sighandler_t sysv_signal (int __sig, __sighandler_t __handler) throw (); extern __sighandler_t signal (int __sig, __sighandler_t __handler) throw (); # 104 "/usr/include/gentoo-multilib/amd64/signal.h" 3 4 extern __sighandler_t bsd_signal (int __sig, __sighandler_t __handler) throw (); extern int kill (__pid_t __pid, int __sig) throw (); extern int killpg (__pid_t __pgrp, int __sig) throw (); extern int raise (int __sig) throw (); extern __sighandler_t ssignal (int __sig, __sighandler_t __handler) throw (); extern int gsignal (int __sig) throw (); extern void psignal (int __sig, __const char *__s); # 153 "/usr/include/gentoo-multilib/amd64/signal.h" 3 4 extern int __sigpause (int __sig_or_mask, int __is_sig); # 162 "/usr/include/gentoo-multilib/amd64/signal.h" 3 4 extern int sigpause (int __sig) __asm__ ("__xpg_sigpause"); # 181 "/usr/include/gentoo-multilib/amd64/signal.h" 3 4 extern int sigblock (int __mask) throw () __attribute__ ((__deprecated__)); extern int sigsetmask (int __mask) throw () __attribute__ ((__deprecated__)); extern int siggetmask (void) throw () __attribute__ ((__deprecated__)); # 196 "/usr/include/gentoo-multilib/amd64/signal.h" 3 4 typedef __sighandler_t sighandler_t; typedef __sighandler_t sig_t; # 1 "/usr/include/time.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/time.h" 1 3 4 # 9 "/usr/include/time.h" 2 3 4 # 210 "/usr/include/gentoo-multilib/amd64/signal.h" 2 3 4 # 1 "/usr/include/bits/siginfo.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/bits/siginfo.h" 1 3 4 # 25 "/usr/include/gentoo-multilib/amd64/bits/siginfo.h" 3 4 # 1 "/usr/include/bits/wordsize.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/bits/wordsize.h" 1 3 4 # 9 "/usr/include/bits/wordsize.h" 2 3 4 # 26 "/usr/include/gentoo-multilib/amd64/bits/siginfo.h" 2 3 4 typedef union sigval { int sival_int; void *sival_ptr; } sigval_t; # 51 "/usr/include/gentoo-multilib/amd64/bits/siginfo.h" 3 4 typedef struct siginfo { int si_signo; int si_errno; int si_code; union { int _pad[((128 / sizeof (int)) - 4)]; struct { __pid_t si_pid; __uid_t si_uid; } _kill; struct { int si_tid; int si_overrun; sigval_t si_sigval; } _timer; struct { __pid_t si_pid; __uid_t si_uid; sigval_t si_sigval; } _rt; struct { __pid_t si_pid; __uid_t si_uid; int si_status; __clock_t si_utime; __clock_t si_stime; } _sigchld; struct { void *si_addr; } _sigfault; struct { long int si_band; int si_fd; } _sigpoll; } _sifields; } siginfo_t; # 129 "/usr/include/gentoo-multilib/amd64/bits/siginfo.h" 3 4 enum { SI_ASYNCNL = -60, SI_TKILL = -6, SI_SIGIO, SI_ASYNCIO, SI_MESGQ, SI_TIMER, SI_QUEUE, SI_USER, SI_KERNEL = 0x80 }; enum { ILL_ILLOPC = 1, ILL_ILLOPN, ILL_ILLADR, ILL_ILLTRP, ILL_PRVOPC, ILL_PRVREG, ILL_COPROC, ILL_BADSTK }; enum { FPE_INTDIV = 1, FPE_INTOVF, FPE_FLTDIV, FPE_FLTOVF, FPE_FLTUND, FPE_FLTRES, FPE_FLTINV, FPE_FLTSUB }; enum { SEGV_MAPERR = 1, SEGV_ACCERR }; enum { BUS_ADRALN = 1, BUS_ADRERR, BUS_OBJERR }; enum { TRAP_BRKPT = 1, TRAP_TRACE }; enum { CLD_EXITED = 1, CLD_KILLED, CLD_DUMPED, CLD_TRAPPED, CLD_STOPPED, CLD_CONTINUED }; enum { POLL_IN = 1, POLL_OUT, POLL_MSG, POLL_ERR, POLL_PRI, POLL_HUP }; # 273 "/usr/include/gentoo-multilib/amd64/bits/siginfo.h" 3 4 typedef struct sigevent { sigval_t sigev_value; int sigev_signo; int sigev_notify; union { int _pad[((64 / sizeof (int)) - 4)]; __pid_t _tid; struct { void (*_function) (sigval_t); void *_attribute; } _sigev_thread; } _sigev_un; } sigevent_t; enum { SIGEV_SIGNAL = 0, SIGEV_NONE, SIGEV_THREAD, SIGEV_THREAD_ID = 4 }; # 9 "/usr/include/bits/siginfo.h" 2 3 4 # 213 "/usr/include/gentoo-multilib/amd64/signal.h" 2 3 4 extern int sigemptyset (sigset_t *__set) throw () __attribute__ ((__nonnull__ (1))); extern int sigfillset (sigset_t *__set) throw () __attribute__ ((__nonnull__ (1))); extern int sigaddset (sigset_t *__set, int __signo) throw () __attribute__ ((__nonnull__ (1))); extern int sigdelset (sigset_t *__set, int __signo) throw () __attribute__ ((__nonnull__ (1))); extern int sigismember (__const sigset_t *__set, int __signo) throw () __attribute__ ((__nonnull__ (1))); extern int sigisemptyset (__const sigset_t *__set) throw () __attribute__ ((__nonnull__ (1))); extern int sigandset (sigset_t *__set, __const sigset_t *__left, __const sigset_t *__right) throw () __attribute__ ((__nonnull__ (1, 2, 3))); extern int sigorset (sigset_t *__set, __const sigset_t *__left, __const sigset_t *__right) throw () __attribute__ ((__nonnull__ (1, 2, 3))); # 1 "/usr/include/bits/sigaction.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/bits/sigaction.h" 1 3 4 # 25 "/usr/include/gentoo-multilib/amd64/bits/sigaction.h" 3 4 struct sigaction { union { __sighandler_t sa_handler; void (*sa_sigaction) (int, siginfo_t *, void *); } __sigaction_handler; __sigset_t sa_mask; int sa_flags; void (*sa_restorer) (void); }; # 9 "/usr/include/bits/sigaction.h" 2 3 4 # 247 "/usr/include/gentoo-multilib/amd64/signal.h" 2 3 4 extern int sigprocmask (int __how, __const sigset_t *__restrict __set, sigset_t *__restrict __oset) throw (); extern int sigsuspend (__const sigset_t *__set) __attribute__ ((__nonnull__ (1))); extern int sigaction (int __sig, __const struct sigaction *__restrict __act, struct sigaction *__restrict __oact) throw (); extern int sigpending (sigset_t *__set) throw () __attribute__ ((__nonnull__ (1))); extern int sigwait (__const sigset_t *__restrict __set, int *__restrict __sig) __attribute__ ((__nonnull__ (1, 2))); extern int sigwaitinfo (__const sigset_t *__restrict __set, siginfo_t *__restrict __info) __attribute__ ((__nonnull__ (1))); extern int sigtimedwait (__const sigset_t *__restrict __set, siginfo_t *__restrict __info, __const struct timespec *__restrict __timeout) __attribute__ ((__nonnull__ (1))); extern int sigqueue (__pid_t __pid, int __sig, __const union sigval __val) throw (); # 304 "/usr/include/gentoo-multilib/amd64/signal.h" 3 4 extern __const char *__const _sys_siglist[65]; extern __const char *__const sys_siglist[65]; struct sigvec { __sighandler_t sv_handler; int sv_mask; int sv_flags; }; # 328 "/usr/include/gentoo-multilib/amd64/signal.h" 3 4 extern int sigvec (int __sig, __const struct sigvec *__vec, struct sigvec *__ovec) throw (); # 1 "/usr/include/bits/sigcontext.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/bits/sigcontext.h" 1 3 4 # 26 "/usr/include/gentoo-multilib/amd64/bits/sigcontext.h" 3 4 # 1 "/usr/include/bits/wordsize.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/bits/wordsize.h" 1 3 4 # 9 "/usr/include/bits/wordsize.h" 2 3 4 # 27 "/usr/include/gentoo-multilib/amd64/bits/sigcontext.h" 2 3 4 struct _fpreg { unsigned short significand[4]; unsigned short exponent; }; struct _fpxreg { unsigned short significand[4]; unsigned short exponent; unsigned short padding[3]; }; struct _xmmreg { __uint32_t element[4]; }; # 101 "/usr/include/gentoo-multilib/amd64/bits/sigcontext.h" 3 4 struct _fpstate { __uint16_t cwd; __uint16_t swd; __uint16_t ftw; __uint16_t fop; __uint64_t rip; __uint64_t rdp; __uint32_t mxcsr; __uint32_t mxcr_mask; struct _fpxreg _st[8]; struct _xmmreg _xmm[16]; __uint32_t padding[24]; }; struct sigcontext { unsigned long r8; unsigned long r9; unsigned long r10; unsigned long r11; unsigned long r12; unsigned long r13; unsigned long r14; unsigned long r15; unsigned long rdi; unsigned long rsi; unsigned long rbp; unsigned long rbx; unsigned long rdx; unsigned long rax; unsigned long rcx; unsigned long rsp; unsigned long rip; unsigned long eflags; unsigned short cs; unsigned short gs; unsigned short fs; unsigned short __pad0; unsigned long err; unsigned long trapno; unsigned long oldmask; unsigned long cr2; struct _fpstate * fpstate; unsigned long __reserved1 [8]; }; # 9 "/usr/include/bits/sigcontext.h" 2 3 4 # 334 "/usr/include/gentoo-multilib/amd64/signal.h" 2 3 4 extern int sigreturn (struct sigcontext *__scp) throw (); # 346 "/usr/include/gentoo-multilib/amd64/signal.h" 3 4 extern int siginterrupt (int __sig, int __interrupt) throw (); # 1 "/usr/include/bits/sigstack.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/bits/sigstack.h" 1 3 4 # 26 "/usr/include/gentoo-multilib/amd64/bits/sigstack.h" 3 4 struct sigstack { void *ss_sp; int ss_onstack; }; enum { SS_ONSTACK = 1, SS_DISABLE }; # 50 "/usr/include/gentoo-multilib/amd64/bits/sigstack.h" 3 4 typedef struct sigaltstack { void *ss_sp; int ss_flags; size_t ss_size; } stack_t; # 9 "/usr/include/bits/sigstack.h" 2 3 4 # 349 "/usr/include/gentoo-multilib/amd64/signal.h" 2 3 4 # 1 "/usr/include/sys/ucontext.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/sys/ucontext.h" 1 3 4 # 22 "/usr/include/gentoo-multilib/amd64/sys/ucontext.h" 3 4 # 1 "/usr/include/features.h" 1 3 4 # 23 "/usr/include/gentoo-multilib/amd64/sys/ucontext.h" 2 3 4 # 1 "/usr/include/signal.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/signal.h" 1 3 4 # 9 "/usr/include/signal.h" 2 3 4 # 24 "/usr/include/gentoo-multilib/amd64/sys/ucontext.h" 2 3 4 # 1 "/usr/include/bits/wordsize.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/bits/wordsize.h" 1 3 4 # 9 "/usr/include/bits/wordsize.h" 2 3 4 # 25 "/usr/include/gentoo-multilib/amd64/sys/ucontext.h" 2 3 4 # 1 "/usr/include/bits/sigcontext.h" 1 3 4 # 29 "/usr/include/gentoo-multilib/amd64/sys/ucontext.h" 2 3 4 typedef long int greg_t; typedef greg_t gregset_t[23]; enum { REG_R8 = 0, REG_R9, REG_R10, REG_R11, REG_R12, REG_R13, REG_R14, REG_R15, REG_RDI, REG_RSI, REG_RBP, REG_RBX, REG_RDX, REG_RAX, REG_RCX, REG_RSP, REG_RIP, REG_EFL, REG_CSGSFS, REG_ERR, REG_TRAPNO, REG_OLDMASK, REG_CR2 }; struct _libc_fpxreg { unsigned short int significand[4]; unsigned short int exponent; unsigned short int padding[3]; }; struct _libc_xmmreg { __uint32_t element[4]; }; struct _libc_fpstate { __uint16_t cwd; __uint16_t swd; __uint16_t ftw; __uint16_t fop; __uint64_t rip; __uint64_t rdp; __uint32_t mxcsr; __uint32_t mxcr_mask; struct _libc_fpxreg _st[8]; struct _libc_xmmreg _xmm[16]; __uint32_t padding[24]; }; typedef struct _libc_fpstate *fpregset_t; typedef struct { gregset_t gregs; fpregset_t fpregs; unsigned long __reserved1 [8]; } mcontext_t; typedef struct ucontext { unsigned long int uc_flags; struct ucontext *uc_link; stack_t uc_stack; mcontext_t uc_mcontext; __sigset_t uc_sigmask; struct _libc_fpstate __fpregs_mem; } ucontext_t; # 9 "/usr/include/sys/ucontext.h" 2 3 4 # 352 "/usr/include/gentoo-multilib/amd64/signal.h" 2 3 4 extern int sigstack (struct sigstack *__ss, struct sigstack *__oss) throw () __attribute__ ((__deprecated__)); extern int sigaltstack (__const struct sigaltstack *__restrict __ss, struct sigaltstack *__restrict __oss) throw (); extern int sighold (int __sig) throw (); extern int sigrelse (int __sig) throw (); extern int sigignore (int __sig) throw (); extern __sighandler_t sigset (int __sig, __sighandler_t __disp) throw (); # 1 "/usr/include/bits/pthreadtypes.h" 1 3 4 # 387 "/usr/include/gentoo-multilib/amd64/signal.h" 2 3 4 # 1 "/usr/include/bits/sigthread.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/bits/sigthread.h" 1 3 4 # 31 "/usr/include/gentoo-multilib/amd64/bits/sigthread.h" 3 4 extern int pthread_sigmask (int __how, __const __sigset_t *__restrict __newmask, __sigset_t *__restrict __oldmask)throw (); extern int pthread_kill (pthread_t __threadid, int __signo) throw (); # 9 "/usr/include/bits/sigthread.h" 2 3 4 # 388 "/usr/include/gentoo-multilib/amd64/signal.h" 2 3 4 extern int __libc_current_sigrtmin (void) throw (); extern int __libc_current_sigrtmax (void) throw (); } # 9 "/usr/include/signal.h" 2 3 4 # 17 "../include/SgmlParser.h" 2 namespace OpenSP { class Event; class Parser; class UnivCharsetDesc; class EventHandler; struct ParserOptions; template class Ptr; template class ConstPtr; class InputSourceOrigin; class Sd; class Syntax; class Dtd; class SgmlParser { public: struct Params { enum EntityType { document, subdoc, dtd }; Params(); EntityType entityType; StringC sysid; Ptr origin; Ptr entityManager; const SgmlParser *parent; ConstPtr sd; ConstPtr prologSyntax; ConstPtr instanceSyntax; unsigned subdocLevel; const ParserOptions *options; PackedBoolean subdocInheritActiveLinkTypes; PackedBoolean subdocReferenced; StringC doctypeName; }; SgmlParser(); SgmlParser(const Params ¶ms); void init(const Params ¶ms); ~SgmlParser(); Event *nextEvent(); void parseAll(EventHandler &, const volatile sig_atomic_t *cancelPtr = 0); ConstPtr sd() const; ConstPtr instanceSyntax() const; ConstPtr prologSyntax() const; EntityManager &entityManager() const; const EntityCatalog &entityCatalog() const; const ParserOptions &options() const; Ptr baseDtd(); void activateLinkType(const StringC &); void allLinkTypesActivated(); void swap(SgmlParser &); friend class Parser; friend class PiAttspecParser; private: SgmlParser(const SgmlParser &); void operator=(const SgmlParser &); Parser *parser_; }; } # 14 "../include/ArcEngine.h" 2 # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 1 3 4 # 15 "../include/ArcEngine.h" 2 namespace OpenSP { class ArcDirector { public: virtual EventHandler *arcEventHandler(const StringC *arcPublicId, const Notation *, const Vector &, const SubstTable *) = 0; }; class SelectOneArcDirector : public ArcDirector, public Messenger { public: SelectOneArcDirector(const Vector &select, EventHandler &eh) : select_(select), eh_(&eh) { } EventHandler *arcEventHandler(const StringC *, const Notation *, const Vector &, const SubstTable *); void dispatchMessage(const Message &); void dispatchMessage(Message &); private: Vector select_; EventHandler *eh_; }; class ArcEngine { public: static void parseAll(SgmlParser &, Messenger &, ArcDirector &, const volatile sig_atomic_t *cancelPtr = 0); private: ArcEngine(); }; } # 11 "ArcEngine.cxx" 2 # 1 "ArcProcessor.h" 1 # 1 "../include/Event.h" 1 # 8 "ArcProcessor.h" 2 # 1 "../include/ContentState.h" 1 #pragma interface # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 1 3 4 # 12 "../include/ContentState.h" 2 # 1 "../include/OpenElement.h" 1 #pragma interface # 19 "../include/OpenElement.h" namespace OpenSP { class OpenElement : public Link { public: void *operator new(size_t sz, Allocator &alloc) { return alloc.alloc(sz); } void *operator new(size_t sz) { return Allocator::allocSimple(sz); } void operator delete(void *p) { Allocator::free(p); } OpenElement(const ElementType *, Boolean net, Boolean included, const ShortReferenceMap *currentMap, const Location &startLocation); Boolean isFinished() const; Boolean tryTransition(const ElementType *); const LeafContentToken *invalidExclusion(const ElementType *) const; Boolean tryTransitionPcdata(); const LeafContentToken *impliedStartTag() const; void doRequiredTransition(); const ElementType *type() const; Boolean netEnabling() const; Boolean included() const; const MatchState &matchState() const; void setMatchState(const MatchState &); Mode mode(Boolean netEnabled) const; const ShortReferenceMap *map() const; void setMap(const ShortReferenceMap *); Boolean requiresSpecialParse() const; const Location &startLocation() const; const LeafContentToken *currentPosition() const; Boolean declaredEmpty() const; void setConref(); unsigned long index() const; void setIndex(unsigned long); private: OpenElement(const OpenElement &); void operator=(const OpenElement &); const ElementType *elementType_; PackedBoolean netEnabling_; PackedBoolean included_; MatchState matchState_; ElementDefinition::DeclaredContent declaredContent_; const ShortReferenceMap *map_; Location startLocation_; unsigned long index_; }; inline const ElementType *OpenElement::type() const { return elementType_; } inline Boolean OpenElement::netEnabling() const { return netEnabling_; } inline Boolean OpenElement::included() const { return included_; } inline const MatchState &OpenElement::matchState() const { return matchState_; } inline void OpenElement::setMatchState(const MatchState &state) { matchState_ = state; } inline Boolean OpenElement::isFinished() const { return (declaredContent_ != ElementDefinition::modelGroup || matchState_.isFinished()); } inline Boolean OpenElement::tryTransition(const ElementType *e) { switch (declaredContent_) { case ElementDefinition::modelGroup: return matchState_.tryTransition(e); case ElementDefinition::any: return (e != elementType_) || e->definition()->allowImmediateRecursion(); default: return 0; } } inline Boolean OpenElement::tryTransitionPcdata() { return (declaredContent_ == ElementDefinition::modelGroup ? matchState_.tryTransitionPcdata() : 1); } inline const LeafContentToken *OpenElement::invalidExclusion(const ElementType *e) const { return (declaredContent_ == ElementDefinition::modelGroup ? matchState_.invalidExclusion(e) : 0); } inline void OpenElement::doRequiredTransition() { matchState_.doRequiredTransition(); } inline const LeafContentToken *OpenElement::impliedStartTag() const { return (declaredContent_ == ElementDefinition::modelGroup ? matchState_.impliedStartTag() : 0); } inline const ShortReferenceMap *OpenElement::map() const { return map_; } inline void OpenElement::setMap(const ShortReferenceMap *map) { map_ = map; } inline Boolean OpenElement::requiresSpecialParse() const { return (declaredContent_ == ElementDefinition::cdata || declaredContent_ == ElementDefinition::rcdata); } inline Mode OpenElement::mode(Boolean netEnabled) const { return elementType_->definition()->mode(netEnabled); } inline const Location &OpenElement::startLocation() const { return startLocation_; } inline const LeafContentToken *OpenElement::currentPosition() const { return (declaredContent_ == ElementDefinition::modelGroup ? matchState_.currentPosition() : 0); } inline Boolean OpenElement::declaredEmpty() const { return declaredContent_ == ElementDefinition::empty; } inline void OpenElement::setConref() { declaredContent_ = ElementDefinition::empty; } inline unsigned long OpenElement::index() const { return index_; } inline void OpenElement::setIndex(unsigned long index) { index_ = index; } } # 13 "../include/ContentState.h" 2 # 1 "../include/IList.h" 1 # 1 "../include/IListBase.h" 1 # 11 "../include/IListBase.h" namespace OpenSP { class IListBase { public: IListBase(); IListBase(Link *); void append(Link *); void insert(Link *); Link *head() const; Boolean empty() const; Link *get(); void remove(Link *); void swap(IListBase &); void clear(); private: Link *head_; friend class IListIterBase; }; inline IListBase::IListBase() : head_(0) { } inline IListBase::IListBase(Link *head) : head_(head) { } inline void IListBase::insert(Link *p) { p->next_ = head_; head_ = p; } inline Link *IListBase::head() const { return head_; } inline Boolean IListBase::empty() const { return head_ == 0; } inline Link *IListBase::get() { Link *tem = head_; head_ = head_->next_; return tem; } inline void IListBase::swap(IListBase &list) { Link *tem = head_; head_ = list.head_; list.head_ = tem; } } # 8 "../include/IList.h" 2 namespace OpenSP { template class IListIter; template class IList : private IListBase { public: IList() { } IList(T *p) : IListBase(p) { } ~IList() { clear(); } void append(T *p) { IListBase::append(p); } void insert(T *p) { IListBase::insert(p); } void remove(T *p) { IListBase::remove(p); } void swap(IList &list) { IListBase::swap(list); } T *head() const { return (T *)IListBase::head(); } T *get() { return (T *)IListBase::get(); } IListBase::clear; IListBase::empty; friend class IListIter; private: IList(const IList &); IList &operator=(const IList &); }; } # 14 "../include/ContentState.h" 2 # 1 "../include/Vector.h" 1 # 15 "../include/ContentState.h" 2 namespace OpenSP { class ContentState { public: ContentState(); void startContent(const Dtd &); void pushElement(OpenElement *); OpenElement *popSaveElement(); void popElement(); OpenElement ¤tElement(); const OpenElement ¤tElement() const; void getOpenElementInfo(Vector &, const StringC &rniPcdata) const; unsigned tagLevel() const; Boolean elementIsIncluded(const ElementType *) const; Boolean elementIsExcluded(const ElementType *) const; Boolean elementIsOpen(const ElementType *) const; Boolean afterDocumentElement() const; const ElementType *lastEndedElementType() const; Mode contentMode() const; ElementType *lookupCreateUndefinedElement(const StringC &, const Location &, Dtd &, Boolean allowImmediateRecursion = 1); Boolean checkImplyLoop(unsigned); static const ShortReferenceMap theEmptyMap; private: IList openElements_; Vector openElementCount_; Vector includeCount_; Vector excludeCount_; unsigned totalExcludeCount_; unsigned tagLevel_; unsigned netEnablingCount_; unsigned long nextIndex_; const ElementType *lastEndedElementType_; ElementType documentElementContainer_; }; inline OpenElement &ContentState::currentElement() { return *openElements_.head(); } inline const OpenElement &ContentState::currentElement() const { return *openElements_.head(); } inline Boolean ContentState::elementIsOpen(const ElementType *e) const { return openElementCount_[e->index()] != 0; } inline Boolean ContentState::elementIsIncluded(const ElementType *e) const { return includeCount_[e->index()] != 0 && excludeCount_[e->index()] == 0; } inline Boolean ContentState::elementIsExcluded(const ElementType *e) const { return excludeCount_[e->index()] != 0; } inline const ElementType *ContentState::lastEndedElementType() const { return lastEndedElementType_; } inline unsigned ContentState::tagLevel() const { return tagLevel_; } inline Boolean ContentState::afterDocumentElement() const { return tagLevel() == 0 && currentElement().isFinished(); } inline Mode ContentState::contentMode() const { return openElements_.head()->mode(netEnablingCount_ > 0); } } # 9 "ArcProcessor.h" 2 # 1 "Id.h" 1 #pragma interface # 1 "../include/Named.h" 1 # 12 "Id.h" 2 # 1 "../include/Location.h" 1 # 13 "Id.h" 2 # 1 "../include/Vector.h" 1 # 14 "Id.h" 2 namespace OpenSP { class Id : public Named { public: Id(const StringC &); void define(const Location &); void addPendingRef(const Location &); Boolean defined() const; const Location &defLocation() const; const Vector &pendingRefs() const; private: Location defLocation_; Vector pendingRefs_; }; inline Boolean Id::defined() const { return !defLocation_.origin().isNull(); } inline const Location &Id::defLocation() const { return defLocation_; } inline const Vector &Id::pendingRefs() const { return pendingRefs_; } inline void Id::addPendingRef(const Location &loc) { pendingRefs_.push_back(loc); } } # 10 "ArcProcessor.h" 2 # 1 "../include/NamedTable.h" 1 # 11 "ArcProcessor.h" 2 # 1 "../include/Vector.h" 1 # 12 "ArcProcessor.h" 2 # 1 "../include/SgmlParser.h" 1 # 14 "ArcProcessor.h" 2 namespace OpenSP { class Allocator; class ArcProcessor : private ContentState, private AttributeContext { public: struct MetaMap { MetaMap(); void clear(); const Attributed *attributed; unsigned suppressFlags; Vector attMapFrom; Vector attMapTo; Vector attTokenMapBase; Vector tokenMapFrom; Vector tokenMapTo; }; struct MetaMapCache { MetaMapCache(); void clear(); MetaMap map; enum { nNoSpec = 4 }; unsigned noSpec[nNoSpec]; unsigned suppressFlags; const AttributeList *linkAtts; }; ArcProcessor(); void setName(const StringC &, const Location &); void init(const EndPrologEvent &, const ConstPtr &, const ConstPtr &, const SgmlParser *parser, Messenger *, const Vector &superName, const NCVector &arcProcessors, ArcDirector &director, const volatile sig_atomic_t *cancelPtr); Boolean processStartElement(const StartElementEvent &, const AttributeList *linkAttributes, const Text *content, Allocator &); void processEndElement(const EndElementEvent &, Allocator &); Boolean processData(); ConstPtr dtdPointer() const { return metaDtd_; } Boolean valid() const { return valid_; } void checkIdrefs(); const StringC &name() const { return name_; } Boolean piDecl() const { return piDecl_; } EventHandler &docHandler() const { return *docHandler_; } void setPiDecl(const Location &loc, const StringC &attspecText, Index attspecIndex, const ConstPtr &archPiAttributeDefs); private: ArcProcessor(const ArcProcessor &); void operator=(const ArcProcessor &); const Syntax &attributeSyntax() const; ConstPtr getAttributeNotation(const StringC &, const Location &); ConstPtr getAttributeEntity(const StringC &, const Location &); void noteCurrentAttribute(size_t, AttributeValue *); ConstPtr getCurrentAttribute(size_t) const; Boolean defineId(const StringC &, const Location &, Location &); void noteIdref(const StringC &, const Location &); Id *lookupCreateId(const StringC &); void dispatchMessage(const Message &); void dispatchMessage(Message &); void initMessage(Message &); const MetaMap &buildMetaMap(const ElementType *, const Notation *, const AttributeList &, const AttributeList *linkAtts, unsigned suppressFlags); void considerSupr(const AttributeList &atts, const AttributeList *linkAtts, unsigned &thisSuppressFlags, unsigned &newSuppressFlags, Boolean &inhibitCache, unsigned &arcSuprIndex); void considerIgnD(const AttributeList &atts, const AttributeList *linkAtts, unsigned thisSuppressFlags, unsigned &newSuppressFlags, Boolean &inhibitCache, unsigned &arcSuprIndex); const Attributed *considerForm(const AttributeList &atts, const AttributeList *linkAtts, const StringC &name, Boolean isNotation, unsigned thisSuppressFlags, unsigned &newSuppressFlags, Boolean &inhibitCache, unsigned &arcFormIndex); const Attributed *autoForm(const AttributeList &atts, const StringC &name, Boolean isNotation, unsigned thisSuppressFlags, unsigned &newSuppressFlags, Boolean &inhibitCache, unsigned &idIndex); const Text *considerNamer(const AttributeList &atts, Boolean &inhibitCache, unsigned &arcNamerIndex); void buildAttributeMapRename(MetaMap &map, const Text &rename, const AttributeList &atts, const AttributeList *linkAtts, Vector &attRenamed, Vector &attSubstituted, Boolean isNotation); void buildAttributeMapRest(MetaMap &map, const AttributeList &atts, const AttributeList *linkAtts, const Vector &attRenamed); Boolean matchName(const StringC &name, const char *key); void split(const Text &text, Char space, Vector &tokens, Vector &tokenPos); Boolean mapAttributes(const AttributeList &from, const AttributeList *fromLink, const Text *content, AttributeList &to, ConstPtr &arcContent, const MetaMap &map); void supportAttributes(const AttributeList &, Boolean piDecl); void processArcOpts(const AttributeList &atts, Boolean piDecl); void processArcQuant(const Text &); ConstPtr makeDtdEntity(const Notation *); void mungeMetaDtd(Dtd &metaDtd, const Dtd &docDtd); Boolean mungeDataEntity(ExternalDataEntity &entity); void emitArcContent(const Text &text, EventHandler &handler, Allocator &allocator); Boolean valid_; StringC name_; Messenger *mgr_; ConstPtr docDtd_; Ptr metaDtd_; ConstPtr docSyntax_; ConstPtr metaSyntax_; ConstPtr docSd_; enum ReservedName { rArcName, rArcPubid, rArcFormA, rArcNamrA, rArcSuprA, rArcIgnDA, rArcDocF, rArcSuprF, rArcBridF, rArcDataF, rArcAuto, rArcDTD, rArcDtdPubid, rArcDtdSysid, rArcQuant }; enum { nReserve = rArcQuant + 1 }; StringC supportAtts_[nReserve]; const Text *supportAttsText_[nReserve]; Boolean piDecl_; Location declLoc_; StringC piDeclAttspecText_; Index piDeclAttspecIndex_; ConstPtr archPiAttributeDefs_; Boolean arcDtdIsParam_; Boolean arcAuto_; Vector arcOpts_; StringC rniContent_; StringC rniArcCont_; StringC rniDefault_; StringC rniMaptoken_; enum { isArc = 01, suppressForm = 02, suppressSupr = 04, ignoreData = 010, condIgnoreData = 020, recoverData = 040 }; Vector openElementFlags_; AttributeList attributeList_; NCVector > metaMapCache_; MetaMap noCacheMetaMap_; NamedTable idTable_; Vector > currentAttributes_; ConstPtr defaultNotation_; Boolean errorIdref_; ArcDirector *director_; EventHandler *docHandler_; Owner ownEventHandler_; size_t docIndex_; }; } # 12 "ArcEngine.cxx" 2 # 1 "../include/Vector.h" 1 # 13 "ArcEngine.cxx" 2 # 1 "../include/NCVector.h" 1 # 14 "ArcEngine.cxx" 2 # 1 "../include/IQueue.h" 1 # 11 "../include/IQueue.h" namespace OpenSP { class IQueueBase { public: IQueueBase() : last_(0) { } ~IQueueBase() { } Boolean empty() const { return last_ == 0; } Link *get() { Link *tem = last_->next_; if (tem == last_) last_ = 0; else last_->next_ = tem->next_; return tem; } void append(Link *p) { if (last_) { p->next_ = last_->next_; last_ = last_->next_ = p; } else last_ = p->next_ = p; } void swap(IQueueBase &with) { Link *tem = last_; last_ = with.last_; with.last_ = tem; } private: Link *last_; }; template class IQueue : private IQueueBase { public: IQueue() { } ~IQueue() { clear(); } void clear(); T *get() { return (T *)IQueueBase::get(); } void append(T *p) { IQueueBase::append(p); } Boolean empty() const { return IQueueBase::empty(); } void swap(IQueue &to) { IQueueBase::swap(to); } }; } # 1 "../include/IQueue.cxx" 1 namespace OpenSP { template void IQueue::clear() { while (!empty()) delete get(); } } # 65 "../include/IQueue.h" 2 # 15 "ArcEngine.cxx" 2 # 1 "ArcEngineMessages.h" 1 # 1 "../include/Message.h" 1 # 3 "ArcEngineMessages.h" 2 namespace OpenSP { struct ArcEngineMessages { static const MessageType1 arcGenerateSystemId; static const MessageType1 undefinedElement; static const MessageType1 elementExcluded; static const MessageType1 invalidElement; static const MessageType1 documentElementNotArc; static const MessageType1 unfinishedElement; static const MessageType0 renameMissingAttName; static const MessageType1 renameToInvalid; static const MessageType1 renameToDuplicate; static const MessageType1 renameFromInvalid; static const MessageType1 missingId; static const MessageType0 invalidArcContent; static const MessageType1 invalidSuppress; static const MessageType1 arcDtdNotDeclaredParameter; static const MessageType1 arcDtdNotDeclaredGeneral; static const MessageType1 arcDtdNotExternal; static const MessageType0 noArcDTDAtt; static const MessageType1 noArcDataF; static const MessageType1 idMismatch; static const MessageType1 invalidArcAuto; static const MessageType1 noArcNotation; static const MessageType0 invalidData; static const MessageType1 invalidIgnD; static const MessageType1 invalidQuantity; static const MessageType1 missingQuantityValue; static const MessageType1 quantityValueTooLong; static const MessageType1 invalidDigit; static const MessageType0 arcIndrNotSupported; static const MessageType0 arcContDuplicate; static const MessageType1 arcContInvalid; static const MessageType1 renameFromDuplicate; static const MessageType0 contentDuplicate; static const MessageType0 is10744PiKeywordMissing; static const MessageType1 is10744PiKeywordInvalid; static const MessageType1L duplicateArcDecl; static const MessageType1L ignoringPiArcDecl; static const MessageType1L ignoringArcBaseArcDecl; }; extern MessageModule libModule; const MessageType1 ArcEngineMessages::arcGenerateSystemId( MessageType::error, &libModule, 3000 ,"no system identifier could be generated for meta-DTD for architecture %1" ); const MessageType1 ArcEngineMessages::undefinedElement( MessageType::error, &libModule, 3001 ,"element type %1 not defined in meta-DTD" ); const MessageType1 ArcEngineMessages::elementExcluded( MessageType::error, &libModule, 3002 ,"element %1 invalid in meta-DTD because excluded" ); const MessageType1 ArcEngineMessages::invalidElement( MessageType::error, &libModule, 3003 ,"meta-DTD does not allow element %1 at this point" ); const MessageType1 ArcEngineMessages::documentElementNotArc( MessageType::error, &libModule, 3004 ,"document element must be instance of %1 element type form" ); const MessageType1 ArcEngineMessages::unfinishedElement( MessageType::error, &libModule, 3005 ,"element %1 unfinished in meta-DTD" ); const MessageType0 ArcEngineMessages::renameMissingAttName( MessageType::error, &libModule, 3006 ,"missing substitute name" ); const MessageType1 ArcEngineMessages::renameToInvalid( MessageType::error, &libModule, 3007 ,"substitute for non-existent architecture attribute %1" ); const MessageType1 ArcEngineMessages::renameToDuplicate( MessageType::error, &libModule, 3008 ,"substitute name for %1 already defined" ); const MessageType1 ArcEngineMessages::renameFromInvalid( MessageType::error, &libModule, 3009 ,"substitute name %1 is not the name of an attribute" ); const MessageType1 ArcEngineMessages::missingId( MessageType::idrefError, &libModule, 3010 ,"reference in architecture to non-existent ID %1" ); const MessageType0 ArcEngineMessages::invalidArcContent( MessageType::error, &libModule, 3011 ,"architectural content specified with #ARCCONT not allowed by meta-DTD" ); const MessageType1 ArcEngineMessages::invalidSuppress( MessageType::error, &libModule, 3012 ,"invalid value %1 for ArcSupr attribute" ,"ISO/IEC 10744:1997 A3.5.3" ); const MessageType1 ArcEngineMessages::arcDtdNotDeclaredParameter( MessageType::error, &libModule, 3013 ,"no declaration for meta-DTD parameter entity %1" ,"ISO/IEC 10744:1997 A3.4.2" ); const MessageType1 ArcEngineMessages::arcDtdNotDeclaredGeneral( MessageType::error, &libModule, 3014 ,"no declaration for meta-DTD general entity %1" ,"ISO/IEC 10744:1997 A3.4.2" ); const MessageType1 ArcEngineMessages::arcDtdNotExternal( MessageType::error, &libModule, 3015 ,"meta-DTD entity %1 must be external" ,"ISO/IEC 10744:1997 A3.4.2" ); const MessageType0 ArcEngineMessages::noArcDTDAtt( MessageType::warning, &libModule, 3016 ,"no ArcDTD architecture support attribute specified" ,"ISO/IEC 10744:1997 A3.4.2" ); const MessageType1 ArcEngineMessages::noArcDataF( MessageType::error, &libModule, 3017 ,"ArcDataF notation %1 not defined in meta-DTD" ,"ISO/IEC 10744:1997 A3.4.2" ); const MessageType1 ArcEngineMessages::idMismatch( MessageType::error, &libModule, 3018 ,"ID attribute %1 in meta-DTD not declared as ID in DTD" ,"ISO/IEC 10744:1997 A3.6.4" ); const MessageType1 ArcEngineMessages::invalidArcAuto( MessageType::error, &libModule, 3019 ,"invalid value %1 for ArcAuto architectural support attribute" ,"ISO/IEC 10744:1997 A3.4.2" ); const MessageType1 ArcEngineMessages::noArcNotation( MessageType::error, &libModule, 3020 ,"no notation declaration for architecture %1" ,"ISO/IEC 10744:1997 A3.4.1" ); const MessageType0 ArcEngineMessages::invalidData( MessageType::error, &libModule, 3021 ,"meta-DTD does not allow data at this point" ); const MessageType1 ArcEngineMessages::invalidIgnD( MessageType::error, &libModule, 3022 ,"invalid value %1 for ArcIgnD attribute" ,"ISO/IEC 10744:1997 A3.5.4" ); const MessageType1 ArcEngineMessages::invalidQuantity( MessageType::error, &libModule, 3024 ,"unrecognized quantity name %1" ); const MessageType1 ArcEngineMessages::missingQuantityValue( MessageType::error, &libModule, 3025 ,"no value specified for quantity %1" ); const MessageType1 ArcEngineMessages::quantityValueTooLong( MessageType::error, &libModule, 3026 ,"length of value %1 for quantity is too long" ); const MessageType1 ArcEngineMessages::invalidDigit( MessageType::error, &libModule, 3027 ,"invalid digit %1" ); const MessageType0 ArcEngineMessages::arcIndrNotSupported( MessageType::error, &libModule, 3028 ,"only value of nArcIndr for ArcIndr attribute supported" ); const MessageType0 ArcEngineMessages::arcContDuplicate( MessageType::error, &libModule, 3029 ,"#ARCCONT attribute already specified" ,"ISO/IEC 10744:1997 A3.5.2" ); const MessageType1 ArcEngineMessages::arcContInvalid( MessageType::error, &libModule, 3030 ,"invalid value %1 for #ARCCONT" ,"ISO/IEC 10744:1997 A3.5.2" ); const MessageType1 ArcEngineMessages::renameFromDuplicate( MessageType::error, &libModule, 3031 ,"%1 already used as a substitute name" ,"ISO/IEC 10744:1997 A3.5.2" ); const MessageType0 ArcEngineMessages::contentDuplicate( MessageType::error, &libModule, 3032 ,"substitute name #CONTENT already specified" ,"ISO/IEC 10744:1997 A3.5.2" ); const MessageType0 ArcEngineMessages::is10744PiKeywordMissing( MessageType::error, &libModule, 3033 ,"IS10744 PI keyword missing" ); const MessageType1 ArcEngineMessages::is10744PiKeywordInvalid( MessageType::error, &libModule, 3034 ,"invalid IS10744 PI keyword %1" ); const MessageType1L ArcEngineMessages::duplicateArcDecl( MessageType::error, &libModule, 3035 ,"architecture %1 already defined" ,0 ,"the first definition" ); const MessageType1L ArcEngineMessages::ignoringPiArcDecl( MessageType::warning, &libModule, 3037 ,"ignoring PI declaration of architecture %1" ,0 ,"the ArcBase definition" ); const MessageType1L ArcEngineMessages::ignoringArcBaseArcDecl( MessageType::warning, &libModule, 3039 ,"ignoring ArcBase declaration of architecture %1" ,0 ,"the PI definition" ); } # 16 "ArcEngine.cxx" 2 # 1 "ParserMessages.h" 1 #pragma interface namespace OpenSP { struct ParserMessages { static const MessageType1 nameLength; static const MessageType1 parameterEntityNameLength; static const MessageType1 numberLength; static const MessageType1 attributeValueLength; static const MessageType0 peroGrpoProlog; static const MessageType0 groupLevel; static const MessageType2 groupCharacter; static const MessageType0 psRequired; static const MessageType2 markupDeclarationCharacter; static const MessageType0 declarationLevel; static const MessageType0 groupEntityEnd; static const MessageType1 invalidToken; static const MessageType0 groupEntityReference; static const MessageType1 duplicateGroupToken; static const MessageType1 groupCount; static const MessageType0 literalLevel; static const MessageType1 literalMinimumData; static const MessageType0 dataTagPatternNonSgml; static const MessageType0 dataTagPatternFunction; static const MessageType0 eroGrpoStartTag; static const MessageType0 eroGrpoProlog; static const MessageType1 functionName; static const MessageType1 characterNumber; static const MessageType1 parameterEntityUndefined; static const MessageType1 entityUndefined; static const MessageType0 rniNameStart; static const MessageType0L commentEntityEnd; static const MessageType0 mixedConnectors; static const MessageType1 noSuchReservedName; static const MessageType1 invalidReservedName; static const MessageType1 minimumLiteralLength; static const MessageType1 tokenizedAttributeValueLength; static const MessageType1 systemIdentifierLength; static const MessageType1 parameterLiteralLength; static const MessageType1 dataTagPatternLiteralLength; static const MessageType0 literalClosingDelimiter; static const MessageType2 paramInvalidToken; static const MessageType2 groupTokenInvalidToken; static const MessageType2 connectorInvalidToken; static const MessageType1 noSuchDeclarationType; static const MessageType1 dtdSubsetDeclaration; static const MessageType1 declSubsetCharacter; static const MessageType0 documentEndDtdSubset; static const MessageType1 prologCharacter; static const MessageType0 documentEndProlog; static const MessageType1 prologDeclaration; static const MessageType1 rankStemGenericIdentifier; static const MessageType0 missingTagMinimization; static const MessageType1 duplicateElementDefinition; static const MessageType0 entityApplicableDtd; static const MessageType1L commentDeclInvalidToken; static const MessageType1 instanceDeclaration; static const MessageType0 contentNonSgml; static const MessageType1 noCurrentRank; static const MessageType1 duplicateAttlistNotation; static const MessageType1 duplicateAttlistElement; static const MessageType0 endTagEntityEnd; static const MessageType1 endTagCharacter; static const MessageType1 endTagInvalidToken; static const MessageType0 pcdataNotAllowed; static const MessageType1 elementNotAllowed; static const MessageType2 missingElementMultiple; static const MessageType2 missingElementInferred; static const MessageType1 startTagEmptyElement; static const MessageType1L omitEndTagDeclare; static const MessageType1L omitEndTagOmittag; static const MessageType1 omitStartTagDeclaredContent; static const MessageType1 elementEndTagNotFinished; static const MessageType1 omitStartTagDeclare; static const MessageType1 taglvlOpenElements; static const MessageType1 undefinedElement; static const MessageType0 emptyEndTagNoOpenElements; static const MessageType1 elementNotFinished; static const MessageType1 elementNotOpen; static const MessageType1 internalParameterDataEntity; static const MessageType1 attributeSpecCharacter; static const MessageType0 unquotedAttributeValue; static const MessageType0 attributeSpecEntityEnd; static const MessageType1 externalParameterDataSubdocEntity; static const MessageType1 duplicateEntityDeclaration; static const MessageType1 duplicateParameterEntityDeclaration; static const MessageType0 piEntityReference; static const MessageType0 internalDataEntityReference; static const MessageType0 externalNonTextEntityReference; static const MessageType0 externalNonTextEntityRcdata; static const MessageType1 entlvl; static const MessageType0 piEntityRcdata; static const MessageType1 recursiveEntityReference; static const MessageType1 undefinedShortrefMapInstance; static const MessageType0 usemapAssociatedElementTypeDtd; static const MessageType0 usemapAssociatedElementTypeInstance; static const MessageType2 undefinedShortrefMapDtd; static const MessageType1 unknownShortrefDelim; static const MessageType1 delimDuplicateMap; static const MessageType0 noDocumentElement; static const MessageType0 processingInstructionEntityEnd; static const MessageType1 processingInstructionLength; static const MessageType0 processingInstructionClose; static const MessageType0 attributeSpecNameTokenExpected; static const MessageType1 noSuchAttributeToken; static const MessageType0 attributeNameShorttag; static const MessageType1 noSuchAttribute; static const MessageType0 attributeValueExpected; static const MessageType1 nameTokenLength; static const MessageType0 attributeSpecLiteral; static const MessageType1 duplicateAttributeSpec; static const MessageType1 duplicateAttributeDef; static const MessageType0 emptyDataAttributeSpec; static const MessageType0 markedSectionEnd; static const MessageType1 markedSectionLevel; static const MessageType0L unclosedMarkedSection; static const MessageType0 specialParseEntityEnd; static const MessageType2 normalizedAttributeValueLength; static const MessageType0 attributeValueSyntax; static const MessageType2 attributeValueChar; static const MessageType1 attributeValueMultiple; static const MessageType2 attributeValueNumberToken; static const MessageType2 attributeValueName; static const MessageType1 attributeMissing; static const MessageType1 requiredAttributeMissing; static const MessageType1 currentAttributeMissing; static const MessageType1 invalidNotationAttribute; static const MessageType1 invalidEntityAttribute; static const MessageType3 attributeValueNotInGroup; static const MessageType1 notDataOrSubdocEntity; static const MessageType3 ambiguousModelInitial; static const MessageType5 ambiguousModel; static const MessageType5 ambiguousModelSingleAnd; static const MessageType6 ambiguousModelMultipleAnd; static const MessageType1L commentDeclarationCharacter; static const MessageType1 nonSgmlCharacter; static const MessageType0 dataMarkedSectionDeclSubset; static const MessageType1L duplicateId; static const MessageType1 notFixedValue; static const MessageType1 sdCommentSignificant; static const MessageType1 standardVersion; static const MessageType1 namingBeforeLcnmstrt; static const MessageType1 sdEntityEnd; static const MessageType2 sdInvalidNameToken; static const MessageType1 numberTooBig; static const MessageType1 sdLiteralSignificant; static const MessageType1 syntaxCharacterNumber; static const MessageType0 sdParameterEntity; static const MessageType2 sdParamInvalidToken; static const MessageType0 giveUp; static const MessageType1 sdMissingCharacters; static const MessageType1 missingMinimumChars; static const MessageType1 duplicateCharNumbers; static const MessageType1 codeSetHoles; static const MessageType1 basesetCharsMissing; static const MessageType1 documentCharMax; static const MessageType1 fpiMissingField; static const MessageType1 fpiMissingTextClassSpace; static const MessageType1 fpiInvalidTextClass; static const MessageType1 fpiInvalidLanguage; static const MessageType1 fpiIllegalDisplayVersion; static const MessageType1 fpiExtraField; static const MessageType0 notationIdentifierTextClass; static const MessageType1 unknownBaseset; static const MessageType2 lexicalAmbiguity; static const MessageType1 missingSignificant; static const MessageType1 translateSyntaxCharDoc; static const MessageType1 translateSyntaxCharInternal; static const MessageType1 missingSyntaxChar; static const MessageType1 unknownCapacitySet; static const MessageType1 duplicateCapacity; static const MessageType1 capacityExceedsTotalcap; static const MessageType1 unknownPublicSyntax; static const MessageType0 nmstrtLength; static const MessageType0 nmcharLength; static const MessageType1 subdocLevel; static const MessageType1 subdocEntity; static const MessageType0 parameterEntityNotEnded; static const MessageType1 missingId; static const MessageType1 dtdUndefinedElement; static const MessageType1 elementNotFinishedDocumentEnd; static const MessageType0 subdocGiveUp; static const MessageType0 noDtd; static const MessageType0 noDtdSubset; static const MessageType0 notSgml; static const MessageType1 taglen; static const MessageType0 groupParameterEntityNotEnded; static const MessageType1 invalidSgmlChar; static const MessageType1 translateDocChar; static const MessageType1 attributeValueLengthNeg; static const MessageType1 tokenizedAttributeValueLengthNeg; static const MessageType1 scopeInstanceQuantity; static const MessageType1 basesetTextClass; static const MessageType1 capacityTextClass; static const MessageType1 syntaxTextClass; static const MessageType0 msocharRequiresMsichar; static const MessageType1 switchNotMarkup; static const MessageType1 switchNotInCharset; static const MessageType1 ambiguousDocCharacter; static const MessageType1 oneFunction; static const MessageType1 duplicateFunctionName; static const MessageType1 missingSignificant646; static const MessageType1 generalDelimAllFunction; static const MessageType1 nmcharLetter; static const MessageType1 nmcharDigit; static const MessageType1 nmcharRe; static const MessageType1 nmcharRs; static const MessageType1 nmcharSpace; static const MessageType1 nmcharSepchar; static const MessageType1 switchLetterDigit; static const MessageType0 zeroNumberOfCharacters; static const MessageType1 nameReferenceReservedName; static const MessageType1 ambiguousReservedName; static const MessageType1 duplicateReservedName; static const MessageType1 reservedNameSyntax; static const MessageType1 multipleBSequence; static const MessageType1 blankAdjacentBSequence; static const MessageType2 delimiterLength; static const MessageType2 reservedNameLength; static const MessageType1 nmcharNmstrt; static const MessageType0 scopeInstanceSyntaxCharset; static const MessageType0 emptyOmitEndTag; static const MessageType1 conrefOmitEndTag; static const MessageType1 conrefEmpty; static const MessageType1 notationEmpty; static const MessageType0 dataAttributeDeclaredValue; static const MessageType0 dataAttributeDefaultValue; static const MessageType2 attcnt; static const MessageType0 idDeclaredValue; static const MessageType1 multipleIdAttributes; static const MessageType1 multipleNotationAttributes; static const MessageType1 duplicateAttributeToken; static const MessageType1 notationNoAttributes; static const MessageType2 entityNotationUndefined; static const MessageType2 mapEntityUndefined; static const MessageType1 attlistNotationUndefined; static const MessageType1 bracketedLitlen; static const MessageType1 genericIdentifierLength; static const MessageType0 instanceStartOmittag; static const MessageType1 grplvl; static const MessageType1 grpgtcnt; static const MessageType0 unclosedStartTagShorttag; static const MessageType0 netEnablingStartTagShorttag; static const MessageType0 unclosedEndTagShorttag; static const MessageType0 multipleDtds; static const MessageType0 afterDocumentElementEntityEnd; static const MessageType1 declarationAfterDocumentElement; static const MessageType0 characterReferenceAfterDocumentElement; static const MessageType0 entityReferenceAfterDocumentElement; static const MessageType0 markedSectionAfterDocumentElement; static const MessageType3 requiredElementExcluded; static const MessageType3 invalidExclusion; static const MessageType0 attributeValueShorttag; static const MessageType0 conrefNotation; static const MessageType1 duplicateNotationDeclaration; static const MessageType1L duplicateShortrefDeclaration; static const MessageType1 duplicateDelimGeneral; static const MessageType1 idrefGrpcnt; static const MessageType1 entityNameGrpcnt; static const MessageType2 attsplen; static const MessageType1 duplicateDelimShortref; static const MessageType1 duplicateDelimShortrefSet; static const MessageType1 defaultEntityInAttribute; static const MessageType1 defaultEntityReference; static const MessageType2 mapDefaultEntity; static const MessageType1 noSuchDtd; static const MessageType1 noLpdSubset; static const MessageType0 assocElementDifferentAtts; static const MessageType1 duplicateLinkSet; static const MessageType0 emptyResultAttributeSpec; static const MessageType1 noSuchSourceElement; static const MessageType1 noSuchResultElement; static const MessageType0 documentEndLpdSubset; static const MessageType1 lpdSubsetDeclaration; static const MessageType0 idlinkDeclSimple; static const MessageType0 linkDeclSimple; static const MessageType1 simpleLinkAttlistElement; static const MessageType0 shortrefOnlyInBaseDtd; static const MessageType0 usemapOnlyInBaseDtd; static const MessageType0 linkAttributeDefaultValue; static const MessageType0 linkAttributeDeclaredValue; static const MessageType0 simpleLinkFixedAttribute; static const MessageType0 duplicateIdLinkSet; static const MessageType1 noInitialLinkSet; static const MessageType1 notationUndefinedSourceDtd; static const MessageType0 simpleLinkResultNotImplied; static const MessageType0 simpleLinkFeature; static const MessageType0 implicitLinkFeature; static const MessageType0 explicitLinkFeature; static const MessageType0 lpdBeforeBaseDtd; static const MessageType0 dtdAfterLpd; static const MessageType1 unstableLpdGeneralEntity; static const MessageType1 unstableLpdParameterEntity; static const MessageType1 multipleIdLinkRuleAttribute; static const MessageType1 multipleLinkRuleAttribute; static const MessageType2 uselinkBadLinkSet; static const MessageType1 uselinkSimpleLpd; static const MessageType1 uselinkBadLinkType; static const MessageType1 duplicateDtdLpd; static const MessageType1 duplicateLpd; static const MessageType1 duplicateDtd; static const MessageType1 undefinedLinkSet; static const MessageType1 duplicateImpliedResult; static const MessageType1 simpleLinkCount; static const MessageType0 duplicateExplicitChain; static const MessageType1 explicit1RequiresSourceTypeBase; static const MessageType0 oneImplicitLink; static const MessageType1 sorryLink; static const MessageType0 entityReferenceMissingName; static const MessageType1 explicitNoRequiresSourceTypeBase; static const MessageType0 linkActivateTooLate; static const MessageType0 pass2Ee; static const MessageType2 idlinkElementType; static const MessageType0 datatagNotImplemented; static const MessageType0 startTagMissingName; static const MessageType0 endTagMissingName; static const MessageType0 startTagGroupNet; static const MessageType0 documentElementUndefined; static const MessageType0 badDefaultSgmlDecl; static const MessageType1L nonExistentEntityRef; static const MessageType0 pcdataUnreachable; static const MessageType0 sdRangeNotSingleChar; static const MessageType0 sdInvalidRange; static const MessageType0 sdEmptyDelimiter; static const MessageType0 tooManyCharsMinimumLiteral; static const MessageType1 defaultedEntityDefined; static const MessageType0 emptyStartTag; static const MessageType0 emptyEndTag; static const MessageType1 unusedMap; static const MessageType1 unusedParamEntity; static const MessageType1 cannotGenerateSystemIdPublic; static const MessageType1 cannotGenerateSystemIdGeneral; static const MessageType1 cannotGenerateSystemIdParameter; static const MessageType1 cannotGenerateSystemIdDoctype; static const MessageType1 cannotGenerateSystemIdLinktype; static const MessageType1 cannotGenerateSystemIdNotation; static const MessageType1 excludeIncludeSame; static const MessageType1 implyingDtd; static const MessageType1 afdrVersion; static const MessageType0 missingAfdrDecl; static const MessageType0 enrRequired; static const MessageType1 numericCharRefLiteralNonSgml; static const MessageType2 numericCharRefUnknownDesc; static const MessageType3 numericCharRefUnknownBase; static const MessageType1 numericCharRefBadInternal; static const MessageType1 numericCharRefNoInternal; static const MessageType0 wwwRequired; static const MessageType1 attributeTokenNotUnique; static const MessageType1 hexNumberLength; static const MessageType1 entityNameSyntax; static const MessageType0 cdataContent; static const MessageType0 rcdataContent; static const MessageType0 inclusion; static const MessageType0 exclusion; static const MessageType0 numberDeclaredValue; static const MessageType0 nameDeclaredValue; static const MessageType0 nutokenDeclaredValue; static const MessageType0 conrefAttribute; static const MessageType0 currentAttribute; static const MessageType0 tempMarkedSection; static const MessageType0 instanceIncludeMarkedSection; static const MessageType0 instanceIgnoreMarkedSection; static const MessageType0 rcdataMarkedSection; static const MessageType0 piEntity; static const MessageType0 bracketEntity; static const MessageType0 internalCdataEntity; static const MessageType0 internalSdataEntity; static const MessageType0 externalCdataEntity; static const MessageType0 externalSdataEntity; static const MessageType0 dataAttributes; static const MessageType0 rank; static const MessageType0 missingSystemId; static const MessageType0 psComment; static const MessageType0 namedCharRef; static const MessageType0 andGroup; static const MessageType0 attributeValueNotLiteral; static const MessageType0 missingAttributeName; static const MessageType0 elementGroupDecl; static const MessageType0 attlistGroupDecl; static const MessageType0 emptyCommentDecl; static const MessageType0 commentDeclS; static const MessageType0 commentDeclMultiple; static const MessageType0 missingStatusKeyword; static const MessageType0 multipleStatusKeyword; static const MessageType0 instanceParamEntityRef; static const MessageType0 current; static const MessageType0 minimizationParam; static const MessageType0 refc; static const MessageType0 pcdataNotFirstInGroup; static const MessageType0 pcdataInSeqGroup; static const MessageType0 pcdataInNestedModelGroup; static const MessageType0 pcdataGroupNotRep; static const MessageType0 nameGroupNotOr; static const MessageType0 piMissingName; static const MessageType0 instanceStatusKeywordSpecS; static const MessageType0 externalDataEntityRef; static const MessageType0 attributeValueExternalEntityRef; static const MessageType1 dataCharDelim; static const MessageType0 explicitSgmlDecl; static const MessageType0 internalSubsetMarkedSection; static const MessageType0 nestcWithoutNet; static const MessageType0 contentAsyncEntityRef; static const MessageType0 immednetRequiresEmptynrm; static const MessageType0 nonSgmlCharRef; static const MessageType0 defaultEntityDecl; static const MessageType0 internalSubsetPsParamEntityRef; static const MessageType0 internalSubsetTsParamEntityRef; static const MessageType0 internalSubsetLiteralParamEntityRef; static const MessageType0 cannotGenerateSystemIdSgml; static const MessageType1 sdTextClass; static const MessageType0 sgmlDeclRefRequiresWww; static const MessageType0 pcdataGroupMemberOccurrenceIndicator; static const MessageType0 pcdataGroupMemberModelGroup; static const MessageType0 entityRefNone; static const MessageType0 entityRefInternal; static const MessageType0 implydefEntityDefault; static const MessageType0 sorryActiveDoctypes; static const MessageType0 activeDocLink; static const MessageType1 concurrentInstances; static const MessageType0 datatagBaseDtd; static const MessageType0 emptyStartTagBaseDtd; static const MessageType0 emptyEndTagBaseDtd; static const MessageType0 immediateRecursion; static const MessageType1 urnMissingField; static const MessageType1 urnMissingPrefix; static const MessageType1 urnInvalidNid; static const MessageType1 urnInvalidNss; static const MessageType1 urnExtraField; static const MessageType0 omittedProlog; static const MessageType0 impliedDocumentElement; static const MessageType0 impliedDoctypeConcurLink; static const MessageType0 sorryImpliedDoctype; static const MessageType0 dtdDataEntityReference; static const MessageType2 parameterEntityNotationUndefined; static const MessageType1 dsEntityNotationUndefined; static const MessageType1 specifiedAttributeRedeclared; static const MessageType1 notationMustNotBeDeclared; static const MessageType0 peroGrpoStartTag; static const MessageType0 peroGrpoEndTag; static const MessageType0 notationConref; static const MessageType0 sorryAllImplicit; static const MessageFragment delimStart; static const MessageFragment digit; static const MessageFragment nameStartCharacter; static const MessageFragment sepchar; static const MessageFragment separator; static const MessageFragment nameCharacter; static const MessageFragment dataCharacter; static const MessageFragment minimumDataCharacter; static const MessageFragment significantCharacter; static const MessageFragment recordEnd; static const MessageFragment recordStart; static const MessageFragment space; static const MessageFragment listSep; static const MessageFragment rangeSep; static const MessageFragment parameterLiteral; static const MessageFragment dataTagGroup; static const MessageFragment modelGroup; static const MessageFragment dataTagTemplateGroup; static const MessageFragment name; static const MessageFragment nameToken; static const MessageFragment elementToken; static const MessageFragment inclusions; static const MessageFragment exclusions; static const MessageFragment minimumLiteral; static const MessageFragment attributeValueLiteral; static const MessageFragment systemIdentifier; static const MessageFragment number; static const MessageFragment attributeValue; static const MessageFragment capacityName; static const MessageFragment generalDelimiteRoleName; static const MessageFragment referenceReservedName; static const MessageFragment quantityName; static const MessageFragment entityEnd; static const MessageFragment shortrefDelim; }; } # 17 "ArcEngine.cxx" 2 # 1 "../include/MessageArg.h" 1 # 18 "ArcEngine.cxx" 2 # 1 "../include/ParserOptions.h" 1 #pragma interface # 1 "../include/EventsWanted.h" 1 # 10 "../include/EventsWanted.h" namespace OpenSP { class EventsWanted { public: EventsWanted(); Boolean wantInstanceMarkup() const; Boolean wantCommentDecls() const; Boolean wantMarkedSections() const; Boolean wantPrologMarkup() const; void addInstanceMarkup(); void addCommentDecls(); void addMarkedSections(); void addPrologMarkup(); private: PackedBoolean instanceMarkup_; PackedBoolean commentDecls_; PackedBoolean markedSections_; PackedBoolean prologMarkup_; }; inline EventsWanted::EventsWanted() : instanceMarkup_(0), commentDecls_(0), markedSections_(0), prologMarkup_(0) { } inline Boolean EventsWanted::wantInstanceMarkup() const { return instanceMarkup_; } inline void EventsWanted::addInstanceMarkup() { instanceMarkup_ = 1; commentDecls_ = 1; markedSections_ = 1; } inline Boolean EventsWanted::wantCommentDecls() const { return commentDecls_; } inline void EventsWanted::addCommentDecls() { commentDecls_ = 1; } inline Boolean EventsWanted::wantMarkedSections() const { return markedSections_; } inline void EventsWanted::addMarkedSections() { markedSections_ = 1; } inline Boolean EventsWanted::wantPrologMarkup() const { return prologMarkup_; } inline void EventsWanted::addPrologMarkup() { prologMarkup_ = 1; } } # 12 "../include/ParserOptions.h" 2 # 1 "../include/Vector.h" 1 # 13 "../include/ParserOptions.h" 2 namespace OpenSP { struct Warnings { Warnings(); PackedBoolean warnSgmlDecl; PackedBoolean warnDuplicateEntity; PackedBoolean warnShould; PackedBoolean warnUndefinedElement; PackedBoolean warnDefaultEntityReference; PackedBoolean warnMixedContent; PackedBoolean warnEmptyTag; PackedBoolean warnUnusedMap; PackedBoolean warnUnusedParam; PackedBoolean warnNotationSystemId; PackedBoolean warnInclusion; PackedBoolean warnExclusion; PackedBoolean warnRcdataContent; PackedBoolean warnCdataContent; PackedBoolean warnPsComment; PackedBoolean warnElementGroupDecl; PackedBoolean warnAttlistGroupDecl; PackedBoolean warnPiEntity; PackedBoolean warnInternalSdataEntity; PackedBoolean warnInternalCdataEntity; PackedBoolean warnExternalSdataEntity; PackedBoolean warnExternalCdataEntity; PackedBoolean warnBracketEntity; PackedBoolean warnDataAttributes; PackedBoolean warnMissingSystemId; PackedBoolean warnConref; PackedBoolean warnCurrent; PackedBoolean warnNutokenDeclaredValue; PackedBoolean warnNumberDeclaredValue; PackedBoolean warnNameDeclaredValue; PackedBoolean warnNamedCharRef; PackedBoolean warnRefc; PackedBoolean warnTempMarkedSection; PackedBoolean warnRcdataMarkedSection; PackedBoolean warnInstanceIncludeMarkedSection; PackedBoolean warnInstanceIgnoreMarkedSection; PackedBoolean warnAndGroup; PackedBoolean warnRank; PackedBoolean warnEmptyCommentDecl; PackedBoolean warnAttributeValueNotLiteral; PackedBoolean warnMissingAttributeName; PackedBoolean warnCommentDeclS; PackedBoolean warnCommentDeclMultiple; PackedBoolean warnMissingStatusKeyword; PackedBoolean warnMultipleStatusKeyword; PackedBoolean warnInstanceParamEntityRef; PackedBoolean warnMinimizationParam; PackedBoolean warnMixedContentRepOrGroup; PackedBoolean warnNameGroupNotOr; PackedBoolean warnPiMissingName; PackedBoolean warnInstanceStatusKeywordSpecS; PackedBoolean warnExternalDataEntityRef; PackedBoolean warnAttributeValueExternalEntityRef; PackedBoolean warnDataDelim; PackedBoolean warnExplicitSgmlDecl; PackedBoolean warnInternalSubsetMarkedSection; PackedBoolean warnDefaultEntityDecl; PackedBoolean warnNonSgmlCharRef; PackedBoolean warnInternalSubsetPsParamEntityRef; PackedBoolean warnInternalSubsetTsParamEntityRef; PackedBoolean warnInternalSubsetLiteralParamEntityRef; PackedBoolean warnImmediateRecursion; }; struct ParserOptions : public Warnings { ParserOptions(); EventsWanted eventsWanted; PackedBoolean datatag; PackedBoolean omittag; PackedBoolean rank; PackedBoolean shorttag; PackedBoolean emptynrm; Number linkSimple; PackedBoolean linkImplicit; Number linkExplicit; Number concur; Number subdoc; PackedBoolean formal; PackedBoolean shortref; enum { sgmlDeclTypeValid = -1 }; short typeValid; enum Quantity { ATTCNT, ATTSPLEN, BSEQLEN, DTAGLEN, DTEMPLEN, ENTLVL, GRPCNT, GRPGTCNT, GRPLVL, LITLEN, NAMELEN, NORMSEP, PILEN, TAGLEN, TAGLVL }; enum { nQuantity = TAGLVL + 1 }; Number quantity[nQuantity]; PackedBoolean errorIdref; PackedBoolean errorSignificant; PackedBoolean errorAfdr; PackedBoolean noUnclosedTag; PackedBoolean noNet; PackedBoolean fullyDeclared; PackedBoolean fullyTagged; PackedBoolean amplyTagged; PackedBoolean amplyTaggedAnyother; PackedBoolean valid; PackedBoolean entityRef; PackedBoolean externalEntityRef; PackedBoolean integral; Vector includes; }; } # 19 "ArcEngine.cxx" 2 # 1 "../include/InternalInputSource.h" 1 #pragma interface # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 1 3 4 # 11 "../include/InternalInputSource.h" 2 # 1 "../include/InputSource.h" 1 #pragma interface # 1 "../include/Ptr.h" 1 # 13 "../include/InputSource.h" 2 # 1 "../include/XcharMap.h" 1 # 15 "../include/InputSource.h" 2 # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 1 3 4 # 16 "../include/InputSource.h" 2 namespace OpenSP { class Messenger; class NamedCharRef; class CharsetInfo; class InternalInputSource; class InputSource : public Link { public: enum { eE = -1 }; virtual ~InputSource(); Xchar get(Messenger &); virtual void pushCharRef(Char ch, const NamedCharRef &) = 0; const Location ¤tLocation() const; const Char *currentTokenStart() const; size_t currentTokenLength() const; const Char *currentTokenEnd() const; Index nextIndex() const; void discardInitial(); void startToken(); void startTokenNoMulticode(); void endToken(size_t length); Xchar tokenChar(Messenger &); Xchar tokenCharInBuffer(Messenger &); void ungetToken(); void setMarkupScanTable(const XcharMap &); Boolean scanSuppress() const; void extendToBufferEnd(); virtual void willNotRewind(); virtual Boolean rewind(Messenger &) = 0; Boolean accessError() const; virtual void setDocCharset(const CharsetInfo &docCharset, const CharsetInfo &emCharset); virtual void willNotSetDocCharset(); virtual InternalInputSource *asInternalInputSource(); protected: InputSource(InputSourceOrigin *origin, const Char *start, const Char *end); void reset(const Char *start, const Char *end); InputSourceOrigin *inputSourceOrigin(); void noteCharRef(Index replacementIndex, const NamedCharRef &); const Char *cur(); const Char *start(); const Char *end(); Index startIndex(); void changeBuffer(const Char *newBase, const Char *oldBase); void advanceEnd(const Char *newEnd); void moveLeft(); void moveStart(const Char *newStart); Char nextChar(); void setAccessError(); private: InputSource(const InputSource &); void operator=(const InputSource &); virtual Xchar fill(Messenger &) = 0; void advanceStart(const Char *to); void advanceStartMulticode(const Char *to); const Char *cur_; const Char *start_; const Char *end_; Location startLocation_; Ptr origin_; Boolean accessError_; Boolean scanSuppress_; Boolean scanSuppressSingle_; Index scanSuppressIndex_; Boolean multicode_; XcharMap markupScanTable_; }; inline void InputSource::advanceStart(const Char *to) { if (multicode_) advanceStartMulticode(to); else { startLocation_ += to - start_; start_ = to; } } inline Xchar InputSource::get(Messenger &mgr) { advanceStart(cur_); return cur_ < end_ ? *cur_++ : fill(mgr); } inline void InputSource::startTokenNoMulticode() { startLocation_ += cur_ - start_; start_ = cur_; } inline void InputSource::startToken() { advanceStart(cur_); } inline void InputSource::endToken(size_t length) { cur_ = start_ + length; } inline Xchar InputSource::tokenChar(Messenger &mgr) { return cur_ < end_ ? *cur_++ : fill(mgr); } inline Xchar InputSource::tokenCharInBuffer(Messenger &mgr) { return cur_ < end_ ? (Xchar)*cur_++ : eE; } inline void InputSource::extendToBufferEnd() { cur_ = end_; } inline const Char *InputSource::cur() { return cur_; } inline const Char *InputSource::start() { return start_; } inline const Char *InputSource::end() { return end_; } inline void InputSource::changeBuffer(const Char *newBase, const Char *oldBase) { cur_ = newBase + (cur_ - oldBase); start_ = newBase + (start_ - oldBase); end_ = newBase + (end_ - oldBase); } inline void InputSource::moveStart(const Char *newStart) { cur_ = newStart + (cur_ - start_); end_ = newStart + (end_ - start_); start_ = newStart; } inline void InputSource::advanceEnd(const Char *newEnd) { end_ = newEnd; } inline Char InputSource::nextChar() { return *cur_++; } inline Index InputSource::startIndex() { return startLocation_.index(); } inline void InputSource::moveLeft() { start_--; cur_--; } inline void InputSource::noteCharRef(Index replacementIndex, const NamedCharRef &ref) { origin_->noteCharRef(replacementIndex, ref); } inline const Location &InputSource::currentLocation() const { return startLocation_; } inline const Char *InputSource::currentTokenStart() const { return start_; } inline size_t InputSource::currentTokenLength() const { return cur_ - start_; } inline Index InputSource::nextIndex() const { return startLocation_.index() + (cur_ - start_); } inline const Char *InputSource::currentTokenEnd() const { return cur_; } inline void InputSource::discardInitial() { advanceStart(cur_ - 1); } inline void InputSource::ungetToken() { cur_ = start_; } inline void InputSource::setMarkupScanTable(const XcharMap &table) { markupScanTable_ = table; multicode_ = 1; } inline Boolean InputSource::scanSuppress() const { return scanSuppress_ && (!scanSuppressSingle_ || startLocation_.index() == scanSuppressIndex_); } inline InputSourceOrigin *InputSource::inputSourceOrigin() { return origin_.pointer(); } inline void InputSource::setAccessError() { accessError_ = 1; } inline Boolean InputSource::accessError() const { return accessError_; } } # 12 "../include/InternalInputSource.h" 2 namespace OpenSP { class InputSourceOrigin; class Messenger; class NamedCharRef; class InternalInputSource : public InputSource { public: void *operator new(size_t sz, Allocator &alloc) { return alloc.alloc(sz); } void *operator new(size_t sz) { return Allocator::allocSimple(sz); } void operator delete(void *p) { Allocator::free(p); } InternalInputSource(const StringC &, InputSourceOrigin *); Xchar fill(Messenger &); void pushCharRef(Char ch, const NamedCharRef &); Boolean rewind(Messenger &); const StringC *contents(); InternalInputSource *InternalInputSource::asInternalInputSource(); ~InternalInputSource(); private: InternalInputSource(const InternalInputSource &); void operator=(const InternalInputSource &); Char *buf_; const StringC *contents_; }; } # 21 "ArcEngine.cxx" 2 # 1 "Parser.h" 1 #pragma interface # 1 "../include/types.h" 1 # 12 "Parser.h" 2 # 1 "../include/Attribute.h" 1 # 13 "Parser.h" 2 # 1 "../include/Attributed.h" 1 # 14 "Parser.h" 2 # 1 "../include/Boolean.h" 1 # 15 "Parser.h" 2 # 1 "../include/StringC.h" 1 # 16 "Parser.h" 2 # 1 "../include/ElementType.h" 1 # 17 "Parser.h" 2 # 1 "../include/Entity.h" 1 # 18 "Parser.h" 2 # 1 "../include/IList.h" 1 # 20 "Parser.h" 2 # 1 "../include/ISet.h" 1 # 21 "Parser.h" 2 # 1 "../include/Owner.h" 1 # 23 "Parser.h" 2 # 1 "ParserState.h" 1 #pragma interface # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/stddef.h" 1 3 4 # 11 "ParserState.h" 2 # 1 "/usr/include/signal.h" 1 3 4 # 12 "ParserState.h" 2 # 1 "../include/Allocator.h" 1 # 13 "ParserState.h" 2 # 1 "../include/Vector.h" 1 # 16 "ParserState.h" 2 # 1 "../include/Dtd.h" 1 # 18 "ParserState.h" 2 # 1 "../include/EntityCatalog.h" 1 # 20 "ParserState.h" 2 # 1 "../include/EntityManager.h" 1 # 21 "ParserState.h" 2 # 1 "EventQueue.h" 1 # 1 "../include/IQueue.h" 1 # 8 "EventQueue.h" 2 namespace OpenSP { class EventQueue : public EventHandler, public IQueue { public: EventQueue(); private: # 1 "events.h" 1 void message(MessageEvent *); void data(DataEvent *); void startElement(StartElementEvent *); void endElement(EndElementEvent *); void pi(PiEvent *); void sdataEntity(SdataEntityEvent *); void externalDataEntity(ExternalDataEntityEvent *); void subdocEntity(SubdocEntityEvent *); void nonSgmlChar(NonSgmlCharEvent *); void appinfo(AppinfoEvent *); void uselink(UselinkEvent *); void usemap(UsemapEvent *); void startDtd(StartDtdEvent *); void endDtd(EndDtdEvent *); void startLpd(StartLpdEvent *); void endLpd(EndLpdEvent *); void endProlog(EndPrologEvent *); void sgmlDecl(SgmlDeclEvent *); void commentDecl(CommentDeclEvent *); void sSep(SSepEvent *); void ignoredRe(IgnoredReEvent *); void reOrigin(ReOriginEvent *); void ignoredRs(IgnoredRsEvent *); void ignoredChars(IgnoredCharsEvent *); void markedSectionStart(MarkedSectionStartEvent *); void markedSectionEnd(MarkedSectionEndEvent *); void entityStart(EntityStartEvent *); void entityEnd(EntityEndEvent *); void entityDecl(EntityDeclEvent *); void notationDecl(NotationDeclEvent *); void elementDecl(ElementDeclEvent *); void attlistDecl(AttlistDeclEvent *); void linkAttlistDecl(LinkAttlistDeclEvent *); void attlistNotationDecl(AttlistNotationDeclEvent *); void linkDecl(LinkDeclEvent *); void idLinkDecl(IdLinkDeclEvent *); void shortrefDecl(ShortrefDeclEvent *); void ignoredMarkup(IgnoredMarkupEvent *); void entityDefaulted(EntityDefaultedEvent *); void sgmlDeclEntity(SgmlDeclEntityEvent *); # 20 "EventQueue.h" 2 void append(Event *); }; class Pass1EventHandler : public EventQueue { public: Pass1EventHandler(); void init(EventHandler *origHandler); void message(MessageEvent *); Boolean hadError() const; EventHandler *origHandler() const; private: Boolean hadError_; EventHandler *origHandler_; }; inline void EventQueue::append(Event *event) { IQueue::append(event); } inline Boolean Pass1EventHandler::hadError() const { return hadError_; } inline EventHandler *Pass1EventHandler::origHandler() const { return origHandler_; } } # 23 "ParserState.h" 2 # 1 "../include/InputSource.h" 1 # 25 "ParserState.h" 2 # 1 "../include/IQueue.h" 1 # 27 "ParserState.h" 2 # 1 "../include/Mode.h" 1 # 30 "ParserState.h" 2 # 1 "../include/OpenElement.h" 1 # 31 "ParserState.h" 2 # 1 "OutputState.h" 1 #pragma interface # 1 "../include/Link.h" 1 # 13 "OutputState.h" 2 # 1 "../include/EventsWanted.h" 1 # 16 "OutputState.h" 2 namespace OpenSP { struct OutputStateLevel : public Link { OutputStateLevel(); Boolean hasPendingRe() const; char state; unsigned long reSerial; Location reLocation; }; class EventHandler; class Allocator; class OutputState { public: OutputState(); void init(); void handleRe(EventHandler &, Allocator &, const EventsWanted &, Char, const Location &); void noteRs(EventHandler &, Allocator &, const EventsWanted &); void noteMarkup(EventHandler &, Allocator &, const EventsWanted &); void noteData(EventHandler &, Allocator &, const EventsWanted &); void noteStartElement(Boolean included, EventHandler &, Allocator &, const EventsWanted &); void noteEndElement(Boolean included, EventHandler &, Allocator &, const EventsWanted &); private: OutputState(const OutputState &); void operator=(const OutputState &); enum State { afterStartTag, afterRsOrRe, afterData, pendingAfterRsOrRe, pendingAfterMarkup }; IList stack_; OutputStateLevel &top(); Char re_; unsigned long nextSerial_; friend struct OutputStateLevel; }; inline Boolean OutputStateLevel::hasPendingRe() const { return int(state) >= int(OutputState::pendingAfterRsOrRe); } inline OutputStateLevel &OutputState::top() { return *stack_.head(); } } # 32 "ParserState.h" 2 # 1 "../include/Ptr.h" 1 # 34 "ParserState.h" 2 # 1 "Recognizer.h" 1 #pragma interface # 1 "../include/Resource.h" 1 # 11 "Recognizer.h" 2 # 1 "../include/Owner.h" 1 # 12 "Recognizer.h" 2 # 1 "../include/XcharMap.h" 1 # 13 "Recognizer.h" 2 # 1 "../include/Vector.h" 1 # 15 "Recognizer.h" 2 # 1 "Trie.h" 1 # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/limits.h" 1 3 4 # 8 "Trie.h" 2 # 1 "../include/Vector.h" 1 # 11 "Trie.h" 2 # 1 "../include/CopyOwner.h" 1 # 12 "Trie.h" 2 # 1 "Priority.h" 1 # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/limits.h" 1 3 4 # 8 "Priority.h" 2 namespace OpenSP { class Priority { public: typedef unsigned char Type; enum { data = 0, dataDelim = 1, function = 2, delim = (127 * 2 + 1) }; static inline Type blank(int n) { return Priority::Type(n + function); } static inline Boolean isBlank(Type t) { return function < t && t < delim; } }; } # 13 "Trie.h" 2 namespace OpenSP { class BlankTrie; class Trie { public: Trie() : next_(0), nCodes_(0) { } Trie(const Trie &); ~Trie(); Trie &operator=(const Trie &); const Trie *next(int i) const { return &next_[i]; } Boolean hasNext() const { return next_ != 0; } Token token() const { return token_; } int tokenLength() const { return tokenLength_; } const BlankTrie *blank() const; Boolean includeBlanks() const { return Priority::isBlank(priority_); } friend class TrieBuilder; private: Trie *next_; int nCodes_; unsigned short token_; unsigned char tokenLength_; Priority::Type priority_; CopyOwner blank_; }; class BlankTrie : public Trie { public: BlankTrie() { } Boolean codeIsBlank(EquivCode c) const { return codeIsBlank_[c]; } size_t maxBlanksToScan() const { return maxBlanksToScan_; } int additionalLength() const { return additionalLength_; } BlankTrie *copy() const { return new BlankTrie(*this); } private: unsigned char additionalLength_; size_t maxBlanksToScan_; Vector codeIsBlank_; friend class TrieBuilder; }; inline const BlankTrie *Trie::blank() const { return blank_.pointer(); } } # 16 "Recognizer.h" 2 namespace OpenSP { class Messenger; class InputSource; class Recognizer : public Resource { public: Recognizer(Trie *, const XcharMap &); Recognizer(Trie *, const XcharMap &, Vector &); Token recognize(InputSource *, Messenger &) const; private: Recognizer(const Recognizer &); void operator=(const Recognizer &); Boolean multicode_; Owner trie_; XcharMap map_; Vector suppressTokens_; }; } # 35 "ParserState.h" 2 # 1 "../include/Sd.h" 1 # 36 "ParserState.h" 2 # 1 "../include/Syntax.h" 1 # 37 "ParserState.h" 2 # 1 "../include/NCVector.h" 1 # 38 "ParserState.h" 2 # 1 "../include/Owner.h" 1 # 39 "ParserState.h" 2 # 1 "../include/Lpd.h" 1 # 40 "ParserState.h" 2 # 1 "LpdEntityRef.h" 1 # 9 "LpdEntityRef.h" # 1 "../include/Ptr.h" 1 # 10 "LpdEntityRef.h" 2 namespace OpenSP { struct LpdEntityRef { ConstPtr entity; PackedBoolean lookedAtDefault; PackedBoolean foundInPass1Dtd; static inline const LpdEntityRef &key(const LpdEntityRef &r) { return r; } static inline unsigned long hash(const LpdEntityRef &r) { return Hash::hash(r.entity->name()); } }; inline Boolean operator==(const LpdEntityRef &r1, const LpdEntityRef &r2) { return (r1.entity == r2.entity && r1.foundInPass1Dtd == r2.foundInPass1Dtd && r1.lookedAtDefault == r2.lookedAtDefault); } inline Boolean operator!=(const LpdEntityRef &r1, const LpdEntityRef &r2) { return !(r1 == r2); } } # 41 "ParserState.h" 2 # 1 "../include/Markup.h" 1 # 42 "ParserState.h" 2 namespace OpenSP { class ParserState : public ContentState, public AttributeContext { public: enum Phase { noPhase, initPhase, prologPhase, declSubsetPhase, instanceStartPhase, contentPhase }; ParserState(const Ptr &, const ParserOptions &, unsigned subdocLevel, Phase finalPhase); void setHandler(EventHandler *, const volatile sig_atomic_t *cancelPtr); void unsetHandler(); Boolean inInstance() const; Boolean inTag(Boolean &start) const; void enterTag(Boolean start); void leaveTag(); Boolean hadDtd() const; void allDone(); void startDtd(const StringC &); void endDtd(); void startInstance(); unsigned subdocLevel() const; Boolean haveDefLpd() const; Dtd &defDtd(); const Ptr &defDtdPointer() const; Boolean haveCurrentDtd() const; const Dtd ¤tDtd() const; Dtd ¤tDtdNonConst() const; const ConstPtr ¤tDtdPointer() const; void startLpd(Ptr &lpd); void endLpd(); Lpd &defLpd(); Ptr &defLpdPointer(); Ptr defComplexLpdPointer(); size_t nActiveLink() const; const Lpd &activeLpd(size_t i) const; ComplexLpd &defComplexLpd(); Ptr lookupDtd(const StringC &name); unsigned instantiateDtd(Ptr &dtd); Ptr baseDtd(); void activateLinkType(const StringC &); void allLinkTypesActivated(); void setResultAttributeSpecMode(); void clearResultAttributeSpecMode(); Boolean haveApplicableDtd() const; Boolean hadLpd() const; Boolean pass2() const; void setPass2Start(); Boolean maybeStartPass2(); void checkEntityStability(); void noteReferencedEntity(const ConstPtr &entity, Boolean, Boolean); ConstPtr lookupLpd(const StringC &name) const; Boolean shouldActivateLink(const StringC &) const; Char currentChar() const; const Location ¤tLocation() const; InputSource *currentInput() const; EntityManager &entityManager() const; Ptr entityManagerPtr() const; const EntityCatalog &entityCatalog() const; ConstPtr entityCatalogPtr() const; void setEntityCatalog(const ConstPtr &); void setSyntax(ConstPtr); void setSyntaxes(ConstPtr, ConstPtr); void setSd(ConstPtr); const Syntax &syntax() const; const Syntax &instanceSyntax() const; const ConstPtr &syntaxPointer() const; const ConstPtr &prologSyntaxPointer() const; const ConstPtr &instanceSyntaxPointer() const; const Sd &sd() const; const ConstPtr &sdPointer() const; void setPhase(Phase phase); Phase phase() const; Phase finalPhase() const; Mode currentMode() const; void setRecognizer(Mode, ConstPtr); void setNormalMap(const XcharMap &); const XcharMap &normalMap() const; Xchar getChar(); void skipChar(); Token getToken(Mode mode); StringC currentToken() const; void getCurrentToken(StringC &) const; void getCurrentToken(const SubstTable *, StringC &) const; unsigned inputLevel() const; unsigned specialParseInputLevel() const; unsigned markedSectionLevel() const; unsigned markedSectionSpecialLevel() const; unsigned currentInputElementIndex() const; const Location ¤tMarkedSectionStartLocation() const; Boolean entityIsOpen(const EntityDecl *) const; void popInputStack(); void pushInput(InputSource *); Boolean referenceDsEntity(const Location &); void setDsEntity(const ConstPtr &); const ConstPtr &dsEntity() const; Boolean eventQueueEmpty() const; Event *eventQueueGet(); EventHandler &eventHandler(); void pushElement(OpenElement *); OpenElement *popSaveElement(); void popElement(); void pcdataRecover(); Boolean pcdataRecovering() const; ConstPtr lookupEntity(Boolean isParameter, const StringC &name, const Location &, Boolean referenced); ConstPtr createUndefinedEntity(const StringC &, const Location &); Boolean appendCurrentRank(StringC &, const RankStem *) const; void setCurrentRank(const RankStem *, const StringC &); void startMarkedSection(const Location &); void startSpecialMarkedSection(Mode, const Location &); void endMarkedSection(); void queueRe(const Location &); void noteMarkup(); void noteData(); void noteRs(); void noteStartElement(Boolean included); void noteEndElement(Boolean included); Allocator &eventAllocator(); Allocator &internalAllocator(); AttributeList *allocAttributeList(const ConstPtr &, unsigned i); static void freeEvent(void *); Boolean wantMarkup() const; const EventsWanted &eventsWanted() const; StringC &nameBuffer(); typedef NamedTableIter IdTableIter; IdTableIter idTableIter(); const ParserOptions &options() const; void enableImplydef(); Sd::ImplydefElement implydefElement(); Boolean implydefAttlist(); void keepMessages(); void releaseKeptMessages(); void discardKeptMessages(); Messenger &messenger(); Markup *currentMarkup(); const Location &markupLocation() const; Markup *startMarkup(Boolean, const Location &); void inheritActiveLinkTypes(const ParserState &parent); Boolean cancelled() const; void setHadAfdrDecl(); Boolean hadAfdrDecl() const; Boolean defineId(const StringC &, const Location &, Location &); void noteIdref(const StringC &, const Location &); void noteCurrentAttribute(size_t, AttributeValue *); ConstPtr getCurrentAttribute(size_t) const; ConstPtr getAttributeEntity(const StringC &, const Location &); ConstPtr getAttributeNotation(const StringC &, const Location &); const Syntax &attributeSyntax() const; friend class PiAttspecParser; private: ParserState(const ParserState &); void operator=(const ParserState &); void dispatchMessage(Message &); void dispatchMessage(const Message &); void initMessage(Message &); void queueMessage(MessageEvent *); Id *lookupCreateId(const StringC &); ParserOptions options_; EventHandler *handler_; Pass1EventHandler pass1Handler_; Boolean allowPass2_; Offset pass2StartOffset_; Boolean hadPass2Start_; EventQueue eventQueue_; OutputState outputState_; ConstPtr prologSyntax_; ConstPtr instanceSyntax_; ConstPtr sd_; unsigned subdocLevel_; Ptr entityManager_; ConstPtr entityCatalog_; Phase phase_; Phase finalPhase_; Boolean inInstance_; Boolean inStartTag_; Boolean inEndTag_; Ptr defDtd_; Ptr defLpd_; Vector > allLpd_; Vector > lpd_; mutable Vector activeLinkTypes_; mutable Boolean activeLinkTypesSubsted_; Boolean hadLpd_; Boolean resultAttributeSpecMode_; Boolean pass2_; typedef OwnerTable LpdEntityRefSet; typedef OwnerTableIter LpdEntityRefSetIter; LpdEntityRefSet lpdEntityRefs_; ConstPtr dsEntity_; Allocator eventAllocator_; Allocator internalAllocator_; NCVector > attributeLists_; StringC nameBuffer_; Boolean keepingMessages_; IQueue keptMessages_; Mode currentMode_; Boolean pcdataRecovering_; unsigned specialParseInputLevel_; Mode specialParseMode_; unsigned markedSectionLevel_; unsigned markedSectionSpecialLevel_; Vector markedSectionStartLocation_; ConstPtr recognizers_[nModes]; XcharMap normalMap_; unsigned inputLevel_; IList inputStack_; Vector inputLevelElementIndex_; Ptr currentDtd_; ConstPtr currentDtdConst_; Vector > dtd_; Ptr pass1Dtd_; unsigned instantiatedDtds_; ConstPtr syntax_; Vector currentRank_; NamedTable idTable_; NamedResourceTable instanceDefaultedEntityTable_; NamedResourceTable undefinedEntityTable_; Vector > currentAttributes_; Markup *currentMarkup_; Markup markup_; Location markupLocation_; Boolean hadAfdrDecl_; Sd::ImplydefElement implydefElement_; Boolean implydefAttlist_; const volatile sig_atomic_t *cancelPtr_; static sig_atomic_t dummyCancel_; static const Location nullLocation_; }; inline Messenger &ParserState::messenger() { return *this; } inline Boolean ParserState::wantMarkup() const { return (inInstance_ ? options_.eventsWanted.wantInstanceMarkup() : options_.eventsWanted.wantPrologMarkup()); } inline const EventsWanted &ParserState::eventsWanted() const { return options_.eventsWanted; } inline InputSource *ParserState::currentInput() const { return inputStack_.head(); } inline const Location &ParserState::currentLocation() const { InputSource *in = currentInput(); return in ? in->currentLocation() : nullLocation_; } inline Boolean ParserState::pcdataRecovering() const { return pcdataRecovering_; } inline unsigned ParserState::inputLevel() const { return inputLevel_; } inline unsigned ParserState::specialParseInputLevel() const { return specialParseInputLevel_; } inline unsigned ParserState::markedSectionLevel() const { return markedSectionLevel_; } inline unsigned ParserState::markedSectionSpecialLevel() const { return markedSectionSpecialLevel_; } inline const Location &ParserState::currentMarkedSectionStartLocation() const { return markedSectionStartLocation_.back(); } inline unsigned ParserState::currentInputElementIndex() const { return inputLevelElementIndex_.back(); } inline Char ParserState::currentChar() const { return currentInput()->currentTokenStart()[0]; } inline StringC ParserState::currentToken() const { return StringC(currentInput()->currentTokenStart(), currentInput()->currentTokenLength()); } inline void ParserState::getCurrentToken(StringC &str) const { InputSource *in = currentInput(); str.assign(in->currentTokenStart(), in->currentTokenLength()); } inline void ParserState::setRecognizer(Mode mode, ConstPtr p) { recognizers_[mode] = p; } inline void ParserState::setNormalMap(const XcharMap &map) { normalMap_ = map; } inline const XcharMap &ParserState::normalMap() const { return normalMap_; } inline Boolean ParserState::haveDefLpd() const { return !defLpd_.isNull(); } inline Boolean ParserState::haveCurrentDtd() const { return !currentDtd_.isNull(); } inline Dtd &ParserState::defDtd() { return *defDtd_; } inline const Dtd &ParserState::currentDtd() const { return *currentDtd_; } inline Dtd &ParserState::currentDtdNonConst() const { return *currentDtd_; } inline const Ptr &ParserState::defDtdPointer() const { return defDtd_; } inline const ConstPtr &ParserState::currentDtdPointer() const { return currentDtdConst_; } inline Boolean ParserState::inInstance() const { return inInstance_; } inline const Syntax &ParserState::syntax() const { return *syntax_; } inline const Syntax &ParserState::instanceSyntax() const { return *instanceSyntax_; } inline const ConstPtr &ParserState::syntaxPointer() const { return syntax_; } inline const ConstPtr &ParserState::instanceSyntaxPointer() const { return instanceSyntax_; } inline const ConstPtr &ParserState::prologSyntaxPointer() const { return prologSyntax_; } inline const Sd &ParserState::sd() const { return *sd_; } inline const ConstPtr &ParserState::sdPointer() const { return sd_; } inline void ParserState::setPhase(Phase phase) { phase_ = phase; } inline Mode ParserState::currentMode() const { return currentMode_; } inline Xchar ParserState::getChar() { return inputStack_.head()->get(messenger()); } inline void ParserState::skipChar() { (void)getChar(); } inline Token ParserState::getToken(Mode mode) { return recognizers_[mode]->recognize(inputStack_.head(), messenger()); } inline Boolean ParserState::hadDtd() const { return dtd_.size() > 0; } inline Boolean ParserState::eventQueueEmpty() const { return eventQueue_.empty(); } inline Event *ParserState::eventQueueGet() { return eventQueue_.get(); } inline ParserState::Phase ParserState::phase() const { return phase_; } inline ParserState::Phase ParserState::finalPhase() const { return finalPhase_; } inline EntityManager &ParserState::entityManager() const { return *entityManager_; } inline Ptr ParserState::entityManagerPtr() const { return entityManager_; } inline const EntityCatalog &ParserState::entityCatalog() const { return *entityCatalog_; } inline ConstPtr ParserState::entityCatalogPtr() const { return entityCatalog_; } inline void ParserState::setEntityCatalog(const ConstPtr &catalog) { entityCatalog_ = catalog; } inline void ParserState::setDsEntity(const ConstPtr &entity) { dsEntity_ = entity; } inline Allocator &ParserState::eventAllocator() { return eventAllocator_; } inline Allocator &ParserState::internalAllocator() { return internalAllocator_; } inline StringC &ParserState::nameBuffer() { return nameBuffer_; } inline void ParserState::setHandler(EventHandler *handler, const volatile sig_atomic_t *cancelPtr) { handler_ = handler; cancelPtr_ = cancelPtr ? cancelPtr : &dummyCancel_; } inline void ParserState::unsetHandler() { handler_ = &eventQueue_; cancelPtr_ = &dummyCancel_; } inline void ParserState::queueRe(const Location &location) { outputState_.handleRe(*handler_, eventAllocator_, options_.eventsWanted, syntax().standardFunction(Syntax::fRE), location); } inline void ParserState::noteMarkup() { if (inInstance_) outputState_.noteMarkup(*handler_, eventAllocator_, options_.eventsWanted); } inline void ParserState::noteRs() { outputState_.noteRs(*handler_, eventAllocator_, options_.eventsWanted); } inline void ParserState::noteStartElement(Boolean included) { outputState_.noteStartElement(included, *handler_, eventAllocator_, options_.eventsWanted); } inline void ParserState::noteEndElement(Boolean included) { outputState_.noteEndElement(included, *handler_, eventAllocator_, options_.eventsWanted); } inline void ParserState::noteData() { outputState_.noteData(*handler_, eventAllocator_, options_.eventsWanted); } inline unsigned ParserState::subdocLevel() const { return subdocLevel_; } inline EventHandler &ParserState::eventHandler() { return *handler_; } inline ParserState::IdTableIter ParserState::idTableIter() { return NamedTableIter(idTable_); } inline const ParserOptions &ParserState::options() const { return options_; } inline Sd::ImplydefElement ParserState::implydefElement() { return implydefElement_; } inline Boolean ParserState::implydefAttlist() { return implydefAttlist_; } inline void ParserState::enableImplydef() { implydefElement_ = Sd::implydefElementYes; implydefAttlist_ = 1; } inline void ParserState::keepMessages() { keepingMessages_ = 1; } inline Boolean ParserState::haveApplicableDtd() const { return !currentDtd_.isNull(); } inline Boolean ParserState::hadLpd() const { return hadLpd_; } inline Boolean ParserState::pass2() const { return pass2_; } inline size_t ParserState::nActiveLink() const { return lpd_.size(); } inline const Lpd &ParserState::activeLpd(size_t i) const { return *lpd_[i]; } inline Lpd &ParserState::defLpd() { return *defLpd_; } inline Ptr &ParserState::defLpdPointer() { return defLpd_; } inline Ptr ParserState::defComplexLpdPointer() { return (ComplexLpd *)defLpd_.pointer(); } inline ComplexLpd &ParserState::defComplexLpd() { return (ComplexLpd &)defLpd(); } inline Ptr ParserState::baseDtd() { if (dtd_.size() > 0) return dtd_[0]; else return Ptr(); } inline void ParserState::setResultAttributeSpecMode() { resultAttributeSpecMode_ = 1; } inline void ParserState::clearResultAttributeSpecMode() { resultAttributeSpecMode_ = 0; } inline Markup *ParserState::currentMarkup() { return currentMarkup_; } inline const Location &ParserState::markupLocation() const { return markupLocation_; } inline Markup *ParserState::startMarkup(Boolean storing, const Location &loc) { markupLocation_ = loc; if (storing) { markup_.clear(); return currentMarkup_ = &markup_; } else return currentMarkup_ = 0; } inline Boolean ParserState::cancelled() const { return *cancelPtr_ != 0; } inline void ParserState::setHadAfdrDecl() { hadAfdrDecl_ = 1; } inline Boolean ParserState::hadAfdrDecl() const { return hadAfdrDecl_; } inline const ConstPtr &ParserState::dsEntity() const { return dsEntity_; } } # 24 "Parser.h" 2 # 1 "../include/Ptr.h" 1 # 25 "Parser.h" 2 # 1 "../include/StringOf.h" 1 # 27 "Parser.h" 2 # 1 "Undo.h" 1 #pragma interface # 1 "../include/ContentToken.h" 1 # 12 "Undo.h" 2 namespace OpenSP { class ParserState; class Event; class Undo : public Link { public: void *operator new(size_t sz, Allocator &alloc) { return alloc.alloc(sz); } void *operator new(size_t sz) { return Allocator::allocSimple(sz); } void operator delete(void *p) { Allocator::free(p); } Undo(); virtual ~Undo(); virtual void undo(ParserState *) = 0; private: Undo(const Undo &); void operator=(const Undo &); }; class UndoTransition : public Undo { public: UndoTransition(const MatchState &); void undo(ParserState *); private: UndoTransition(const UndoTransition &); void operator=(const UndoTransition &); MatchState state_; }; class UndoStartTag : public Undo { public: UndoStartTag(); void undo(ParserState *); private: UndoStartTag(const UndoStartTag &); void operator=(const UndoStartTag &); }; class UndoEndTag : public Undo { public: UndoEndTag(OpenElement *); void undo(ParserState *); private: UndoEndTag(const UndoEndTag &); void operator=(const UndoEndTag &); Owner element_; }; } # 28 "Parser.h" 2 # 1 "../include/Vector.h" 1 # 29 "Parser.h" 2 namespace OpenSP { class AllowedParams; class Param; class ExternalId; class PublicId; class GroupToken; class AllowedGroupTokens; struct GroupConnector; class AllowedGroupConnectors; class AllowedSdParams; class Text; class AttributeList; class AttributeDefinition; class AttributeDefinitionList; class UnivCharsetDesc; class CharsetInfo; class CharsetDecl; class DeclaredValue; struct SdBuilder; struct SdParam; class Syntax; class ElementDefinition; class CharSwitcher; struct StandardSyntaxSpec; class Undo; class Decl; class Parser : private ParserState { public: Parser(const SgmlParser::Params &); Event *nextEvent(); void parseAll(EventHandler &, const volatile sig_atomic_t *cancelPtr); ParserState::sdPointer; ParserState::instanceSyntaxPointer; ParserState::prologSyntaxPointer; ParserState::activateLinkType; ParserState::allLinkTypesActivated; ParserState::entityManager; ParserState::entityCatalog; ParserState::baseDtd; ParserState::options; ParserState::instantiateDtd; friend class PiAttspecParser; private: Parser(const Parser &); void operator=(const Parser &); Boolean setStandardSyntax(Syntax &syn, const StandardSyntaxSpec &, const CharsetInfo &docCharset, CharSwitcher &, Boolean www); Boolean addRefDelimShortref(Syntax &syntax, const CharsetInfo &syntaxCharset, const CharsetInfo &docCharset, CharSwitcher &switcher); Boolean setRefDelimGeneral(Syntax &syntax, const CharsetInfo &syntaxCharset, const CharsetInfo &docCharset, CharSwitcher &switcher); void setRefNames(Syntax &syntax, const CharsetInfo &docCharset, Boolean www); void giveUp(); void compileSdModes(); void compilePrologModes(); void compileInstanceModes(); void addNeededShortrefs(Dtd &, const Syntax &); Boolean shortrefCanPreemptDelim(const StringC &sr, const StringC &d, Boolean dIsSr, const Syntax &); void compileModes(const Mode *modes, int n, const Dtd *); void compileNormalMap(); void doInit(); void doProlog(); void doDeclSubset(); void doInstanceStart(); void doContent(); void extendNameToken(size_t, const MessageType1 &); void extendNumber(size_t, const MessageType1 &); void extendHexNumber(); void extendData(); void extendS(); void extendContentS(); void declSubsetRecover(unsigned startLevel); void prologRecover(); void skipDeclaration(unsigned startLevel); Boolean parseElementDecl(); Boolean parseAttlistDecl(); Boolean parseNotationDecl(); Boolean parseEntityDecl(); Boolean parseShortrefDecl(); Boolean parseUsemapDecl(); Boolean parseUselinkDecl(); Boolean parseDoctypeDeclStart(); Boolean parseDoctypeDeclEnd(Boolean fake = 0); Boolean parseMarkedSectionDeclStart(); void handleMarkedSectionEnd(); Boolean parseCommentDecl(); void emptyCommentDecl(); Boolean parseExternalId(const AllowedParams &, const AllowedParams &, Boolean, unsigned, Param &, ExternalId &); Boolean parseParam(const AllowedParams &, unsigned, Param &); Boolean parseMinimumLiteral(Boolean, Text &); Boolean parseAttributeValueLiteral(Boolean, Text &); Boolean parseTokenizedAttributeValueLiteral(Boolean, Text &); Boolean parseSystemIdentifier(Boolean, Text &); Boolean parseParameterLiteral(Boolean, Text &); Boolean parseDataTagParameterLiteral(Boolean, Text &); enum { literalSingleSpace = 01, literalDataTag = 02, literalMinimumData = 04, literalDelimInfo = 010, literalNoProcess = 020, literalNonSgml = 040 }; Boolean parseLiteral(Mode litMode, Mode liteMode, size_t maxLength, const MessageType1 &tooLongMessage, unsigned flags, Text &text); Boolean parseGroupToken(const AllowedGroupTokens &allow, unsigned nestingLevel, unsigned declInputLevel, unsigned groupInputLevel, GroupToken >); Boolean parseGroupConnector(const AllowedGroupConnectors &allow, unsigned declInputLevel, unsigned groupInputLevel, GroupConnector &gc); Boolean parseGroup(const AllowedGroupTokens &allowToken, unsigned declInputLevel, Param &parm); Boolean parseModelGroup(unsigned nestingLevel, unsigned declInputLevel, ModelGroup *&, Mode); Boolean parseNameGroup(unsigned declInputLevel, Param &); Boolean parseNameTokenGroup(unsigned declInputLevel, Param &); Boolean parseDataTagGroup(unsigned nestingLevel, unsigned declInputLevel, GroupToken &); Boolean parseDataTagTemplateGroup(unsigned nestingLevel, unsigned declInputLevel, GroupToken &); Boolean parseElementNameGroup(unsigned declInputLevel, Param &); Boolean parseReservedName(const AllowedParams &allow, Param &parm); Boolean parseIndicatedReservedName(const AllowedParams &allow, Param &parm); Boolean getReservedName(Syntax::ReservedName *); Boolean getIndicatedReservedName(Syntax::ReservedName *); Boolean parseAttributeValueParam(Param &parm); Boolean parseEntityReference(Boolean isParameter, int ignoreLevel, ConstPtr &entity, Ptr &origin); ContentToken::OccurrenceIndicator getOccurrenceIndicator(Mode); Boolean parseComment(Mode); Boolean parseNamedCharRef(); Boolean parseNumericCharRef(Boolean isHex, Char &, Location &); Boolean translateNumericCharRef(Char &ch, Boolean &isSgmlChar); Boolean parseDeclarationName(Syntax::ReservedName *, Boolean allowAfdr = 0); void paramInvalidToken(Token, const AllowedParams &); void groupTokenInvalidToken(Token, const AllowedGroupTokens &); void groupConnectorInvalidToken(Token, const AllowedGroupConnectors &); ElementType *lookupCreateElement(const StringC &); RankStem *lookupCreateRankStem(const StringC &); Boolean parseExceptions(unsigned declInputLevel, Ptr &def); void parsePcdata(); void parseStartTag(); ElementType *completeRankStem(const StringC &); void handleRankedElement(const ElementType *); void parseEmptyStartTag(); void acceptPcdata(const Location &); void acceptStartTag(const ElementType *, StartElementEvent *, Boolean netEnabling); void handleBadStartTag(const ElementType *, StartElementEvent *, Boolean netEnabling); void undo(IList &); Boolean tryStartTag(const ElementType *, StartElementEvent *, Boolean netEnabling, IList &); void checkExclusion(const ElementType *e); Boolean tryImplyTag(const Location &, unsigned &, unsigned &, IList &, IList &); void pushElementCheck(const ElementType *, StartElementEvent *, Boolean netEnabling); void pushElementCheck(const ElementType *, StartElementEvent *, IList &, IList &); void queueElementEvents(IList &); Boolean parseAttributeSpec(Mode mode, AttributeList &, Boolean &netEnabling, Ptr &); Boolean handleAttributeNameToken(Text &text, AttributeList &, unsigned &specLength); struct AttributeParameter { enum Type { end, name, nameToken, vi, recoverUnquoted }; }; Boolean parseAttributeParameter(Mode mode, Boolean allowVi, AttributeParameter::Type &result, Boolean &netEnabling); void extendUnquotedAttributeValue(); Boolean parseAttributeValueSpec(Mode mode, const StringC &name, AttributeList &atts, unsigned &specLength, Ptr &newAttDefList); EndElementEvent *parseEndTag(); void parseEndTagClose(); void parseEmptyEndTag(); void parseNullEndTag(); void endAllElements(); void acceptEndTag(EndElementEvent *); void endTagEmptyElement(const ElementType *, Boolean netEnabling, Boolean included, const Location &startLoc); void implyCurrentElementEnd(const Location &); void implyEmptyElementEnd(const ElementType *, Boolean included, const Location &); void maybeDefineEntity(const Ptr &entity); Notation *lookupCreateNotation(const StringC &name); Boolean parseExternalEntity(StringC &name, Entity::DeclType declType, unsigned declInputLevel, Param &parm); ShortReferenceMap *lookupCreateMap(const StringC &); StringC prettifyDelim(const StringC &delim); void handleShortref(int index); Boolean parseProcessingInstruction(); Boolean parseAttributed(unsigned declInputLevel, Param &parm, Vector &attributed, Boolean &isNotation); Boolean parseDeclaredValue(unsigned declInputLevel, Boolean isNotation, Param &parm, Owner &value); Boolean parseDefaultValue(unsigned declInputLevel, Boolean isNotation, Param &parm, const StringC &attributeName, Owner &declaredValue, Owner &def, Boolean &anyCurrent); Boolean reportNonSgmlCharacter(); void endInstance(); Boolean implySgmlDecl(); Boolean scanForSgmlDecl(const CharsetInfo &initCharset); void findMissingMinimum(const CharsetInfo &charset, ISet &); Boolean parseSgmlDecl(); Boolean sdParseSgmlDeclRef(SdBuilder &, SdParam &, ExternalId &); Boolean sdParseDocumentCharset(SdBuilder &sdBuilder, SdParam &parm); Boolean sdParseCapacity(SdBuilder &sdBuilder, SdParam &parm); Boolean sdParseScope(SdBuilder &sdBuilder, SdParam &parm); Boolean sdParseSyntax(SdBuilder &sdBuilder, SdParam &parm); Boolean sdParseExplicitSyntax(SdBuilder &sdBuilder, SdParam &parm); Boolean sdParseSyntaxCharset(SdBuilder &sdBuilder, SdParam &parm); Boolean sdParseShunchar(SdBuilder &sdBuilder, SdParam &parm); Boolean sdParseFunction(SdBuilder &sdBuilder, SdParam &parm); Boolean sdParseNaming(SdBuilder &sdBuilder, SdParam &parm); Boolean sdParseDelim(SdBuilder &sdBuilder, SdParam &parm); Boolean sdParseNames(SdBuilder &sdBuilder, SdParam &parm); Boolean sdParseQuantity(SdBuilder &sdBuilder, SdParam &parm); Boolean sdParseEntities(SdBuilder &sdBuilder, SdParam &parm); Boolean sdParseFeatures(SdBuilder &sd, SdParam &parm); Boolean sdParseAppinfo(SdBuilder &sd, SdParam &parm); Boolean sdParseSeealso(SdBuilder &sd, SdParam &parm); void requireWWW(SdBuilder &sdBuilder); Boolean parseSdParam(const AllowedSdParams &allow, SdParam &); Boolean parseSdParamLiteral(Boolean lita, String &str); Boolean parseSdSystemIdentifier(Boolean lita, Text &); Boolean stringToNumber(const Char *s, size_t length, unsigned long &); void sdParamConvertToLiteral(SdParam &parm); void sdParamInvalidToken(Token token, const AllowedSdParams &); Boolean sdParseCharset(SdBuilder &sdBuilder, SdParam &parm, Boolean isDocument, CharsetDecl &, UnivCharsetDesc &); Boolean sdParseExternalCharset(Sd &, UnivCharsetDesc &desc); UnivChar charNameToUniv(Sd &sd, const StringC &name); Boolean translateSyntax(CharSwitcher &switcher, const CharsetInfo &syntaxCharset, const CharsetInfo &docCharset, WideChar syntaxChar, Char &docChar); Boolean translateSyntax(SdBuilder &sdBuilder, WideChar syntaxChar, Char &docChar); Boolean translateSyntax(SdBuilder &sdBuilder, const String &syntaxString, StringC &docString); Boolean translateSyntaxNoSwitch(SdBuilder &sdBuilder, WideChar syntaxChar, Char &docChar, Number &count); Boolean translateName(SdBuilder &sdBuilder, const StringC &name, StringC &str); void translateRange(SdBuilder &sdBuilder, SyntaxChar start, SyntaxChar end, ISet &chars); UnivChar translateUniv(UnivChar univChar, CharSwitcher &switcher, const CharsetInfo &syntaxCharset); Boolean univToDescCheck(const CharsetInfo &charset, UnivChar from, Char &to); Boolean univToDescCheck(const CharsetInfo &charset, UnivChar from, Char &to, WideChar &count); void translateDocSet(const CharsetInfo &fromCharset, const CharsetInfo &toCharset, const ISet &fromSet, ISet &toSet); Boolean checkNotFunction(const Syntax &syn, Char c); Boolean checkGeneralDelim(const Syntax &syn, const StringC &delim); Boolean checkShortrefDelim(const Syntax &syn, const CharsetInfo &charset, const StringC &delim); Boolean checkNmchars(const ISet &set, const Syntax &syntax); void intersectCharSets(const ISet &s1, const ISet &s2, ISet &inter); Boolean checkSwitches(CharSwitcher &switcher, const CharsetInfo &syntaxCharset); Boolean checkSwitchesMarkup(CharSwitcher &switcher); const StandardSyntaxSpec *lookupSyntax(const PublicId &id); Boolean referencePublic(const PublicId &id, PublicId::TextClass, Boolean &givenError); void checkIdrefs(); void checkTaglen(Index tagStartIndex); void checkSyntaxNamelen(const Syntax &syn); void checkSyntaxNames(const Syntax &syn); void checkElementAttribute(const ElementType *e, size_t checkFrom = 0); void checkDtd(Dtd &dtd); Boolean maybeStatusKeyword(const Entity &entity); void reportAmbiguity(const LeafContentToken *from, const LeafContentToken *to1, const LeafContentToken *to2, unsigned ambigAndDepth); Boolean parseLinktypeDeclStart(); Boolean parseLinktypeDeclEnd(); Boolean parseLinkDecl(); Boolean parseIdlinkDecl(); Boolean parseLinkSet(Boolean idlink); void addIdLinkRule(const StringC &id, IdLinkRule &rule); void addLinkRule(LinkSet *linkSet, const ElementType *sourceElement, const ConstPtr &linkRule); Boolean parseResultElementSpec(unsigned declInputLevel, Param &parm, Boolean idlink, Boolean &implied, const ElementType *&resultType, AttributeList &attributes); LinkSet *lookupCreateLinkSet(const StringC &name); ElementType *lookupResultElementType(const StringC &name); void endProlog(); Boolean parseEntityReferenceNameGroup(Boolean &ignore); Boolean parseTagNameGroup(Boolean &active, Boolean start); void parseGroupStartTag(); void parseGroupEndTag(); StartElementEvent *doParseStartTag(Boolean &netEnabling); EndElementEvent *doParseEndTag(); Boolean skipAttributeSpec(); Boolean lookingAtStartTag(StringC &gi); void implyDtd(const StringC &gi); void findMissingTag(const ElementType *e, Vector &); unsigned paramsSubdocLevel(const SgmlParser::Params &); void addCommonAttributes(Dtd &dtd); Boolean parseAfdrDecl(); void setSdOverrides(Sd &sd); StringC sysid_; }; } # 22 "ArcEngine.cxx" 2 # 1 "../include/LinkProcess.h" 1 #pragma interface # 1 "../include/Vector.h" 1 # 14 "../include/LinkProcess.h" 2 # 1 "../include/Vector.h" 1 # 15 "../include/LinkProcess.h" 2 # 1 "../include/Ptr.h" 1 # 16 "../include/LinkProcess.h" 2 namespace OpenSP { class Messenger; struct LinkProcessOpenElement : public Link { LinkProcessOpenElement(const LinkSet *current, const SourceLinkRule &); LinkProcessOpenElement(const LinkSet *current); const LinkSet *current; const LinkSet *restore; const LinkSet *post; Boolean postRestore; }; class LinkProcess { public: LinkProcess(); void init(const ConstPtr &lpd); Boolean startElement(const ElementType *, const AttributeList &attributes, const Location &location, Messenger &, const AttributeList *&linkAttributes, const ResultElementSpec *&resultElementSpec); void endElement(); void uselink(const LinkSet *linkSet, Boolean restore, const Lpd *); virtual Boolean selectLinkRule(const Vector &, const Location &location, size_t &selected); size_t nImpliedLinkRules() const; const ResultElementSpec &impliedLinkRule(size_t) const; const StringC &name() const; Boolean isExplicit() const; void clear(); void swap(LinkProcess &); private: LinkProcess(const LinkProcess &); void operator=(const LinkProcess &); IList open_; ConstPtr lpd_; Vector > activeLpds_; Vector linkAttributes_; }; inline const StringC &LinkProcess::name() const { return lpd_->name(); } inline Boolean LinkProcess::isExplicit() const { return lpd_->type() == Lpd::explicitLink; } } # 24 "ArcEngine.cxx" 2 # 1 "../include/macros.h" 1 # 35 "../include/macros.h" # 1 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/g++-v4/cassert" 1 3 # 46 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/g++-v4/cassert" 3 # 47 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/g++-v4/cassert" 3 #pragma GCC visibility push(default) # 1 "/usr/include/assert.h" 1 3 4 # 1 "/usr/include/gentoo-multilib/amd64/assert.h" 1 3 4 # 36 "/usr/include/gentoo-multilib/amd64/assert.h" 3 4 # 1 "/usr/include/features.h" 1 3 4 # 37 "/usr/include/gentoo-multilib/amd64/assert.h" 2 3 4 # 65 "/usr/include/gentoo-multilib/amd64/assert.h" 3 4 extern "C" { extern void __assert_fail (__const char *__assertion, __const char *__file, unsigned int __line, __const char *__function) throw () __attribute__ ((__noreturn__)); extern void __assert_perror_fail (int __errnum, __const char *__file, unsigned int __line, __const char *__function) throw () __attribute__ ((__noreturn__)); extern void __assert (const char *__assertion, const char *__file, int __line) throw () __attribute__ ((__noreturn__)); } # 9 "/usr/include/assert.h" 2 3 4 # 50 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.0.2/include/g++-v4/cassert" 2 3 #pragma GCC visibility pop # 36 "../include/macros.h" 2 # 25 "ArcEngine.cxx" 2 namespace OpenSP { static const size_t sizes[] = { sizeof(StartElementEvent), sizeof(EndElementEvent), sizeof(ImmediateDataEvent), sizeof(SdataEntityEvent), sizeof(EndPrologEvent), sizeof(CdataEntityEvent), sizeof(SdataEntityEvent), sizeof(ExternalDataEntityEvent), sizeof(OpenElement) }; static size_t maxSize(const size_t *v, size_t n) { size_t max = 0; for (size_t i = 0; i < n; i++) { if (v[i] > max) max = v[i]; } return max; } const unsigned invalidAtt = unsigned(-1); const unsigned contentPseudoAtt = unsigned(-2); class DelegateEventHandler : public EventHandler { public: # 1 "events.h" 1 void message(MessageEvent *ev) { delegateTo_->message(ev); } void data(DataEvent *ev) { delegateTo_->data(ev); } void startElement(StartElementEvent *ev) { delegateTo_->startElement(ev); } void endElement(EndElementEvent *ev) { delegateTo_->endElement(ev); } void pi(PiEvent *ev) { delegateTo_->pi(ev); } void sdataEntity(SdataEntityEvent *ev) { delegateTo_->sdataEntity(ev); } void externalDataEntity(ExternalDataEntityEvent *ev) { delegateTo_->externalDataEntity(ev); } void subdocEntity(SubdocEntityEvent *ev) { delegateTo_->subdocEntity(ev); } void nonSgmlChar(NonSgmlCharEvent *ev) { delegateTo_->nonSgmlChar(ev); } void appinfo(AppinfoEvent *ev) { delegateTo_->appinfo(ev); } void uselink(UselinkEvent *ev) { delegateTo_->uselink(ev); } void usemap(UsemapEvent *ev) { delegateTo_->usemap(ev); } void startDtd(StartDtdEvent *ev) { delegateTo_->startDtd(ev); } void endDtd(EndDtdEvent *ev) { delegateTo_->endDtd(ev); } void startLpd(StartLpdEvent *ev) { delegateTo_->startLpd(ev); } void endLpd(EndLpdEvent *ev) { delegateTo_->endLpd(ev); } void endProlog(EndPrologEvent *ev) { delegateTo_->endProlog(ev); } void sgmlDecl(SgmlDeclEvent *ev) { delegateTo_->sgmlDecl(ev); } void commentDecl(CommentDeclEvent *ev) { delegateTo_->commentDecl(ev); } void sSep(SSepEvent *ev) { delegateTo_->sSep(ev); } void ignoredRe(IgnoredReEvent *ev) { delegateTo_->ignoredRe(ev); } void reOrigin(ReOriginEvent *ev) { delegateTo_->reOrigin(ev); } void ignoredRs(IgnoredRsEvent *ev) { delegateTo_->ignoredRs(ev); } void ignoredChars(IgnoredCharsEvent *ev) { delegateTo_->ignoredChars(ev); } void markedSectionStart(MarkedSectionStartEvent *ev) { delegateTo_->markedSectionStart(ev); } void markedSectionEnd(MarkedSectionEndEvent *ev) { delegateTo_->markedSectionEnd(ev); } void entityStart(EntityStartEvent *ev) { delegateTo_->entityStart(ev); } void entityEnd(EntityEndEvent *ev) { delegateTo_->entityEnd(ev); } void entityDecl(EntityDeclEvent *ev) { delegateTo_->entityDecl(ev); } void notationDecl(NotationDeclEvent *ev) { delegateTo_->notationDecl(ev); } void elementDecl(ElementDeclEvent *ev) { delegateTo_->elementDecl(ev); } void attlistDecl(AttlistDeclEvent *ev) { delegateTo_->attlistDecl(ev); } void linkAttlistDecl(LinkAttlistDeclEvent *ev) { delegateTo_->linkAttlistDecl(ev); } void attlistNotationDecl(AttlistNotationDeclEvent *ev) { delegateTo_->attlistNotationDecl(ev); } void linkDecl(LinkDeclEvent *ev) { delegateTo_->linkDecl(ev); } void idLinkDecl(IdLinkDeclEvent *ev) { delegateTo_->idLinkDecl(ev); } void shortrefDecl(ShortrefDeclEvent *ev) { delegateTo_->shortrefDecl(ev); } void ignoredMarkup(IgnoredMarkupEvent *ev) { delegateTo_->ignoredMarkup(ev); } void entityDefaulted(EntityDefaultedEvent *ev) { delegateTo_->entityDefaulted(ev); } void sgmlDeclEntity(SgmlDeclEntityEvent *ev) { delegateTo_->sgmlDeclEntity(ev); } # 60 "ArcEngine.cxx" 2 protected: EventHandler *delegateTo_; }; class QueueEventHandler : public EventHandler, public IQueue { public: # 1 "events.h" 1 void message(MessageEvent *ev) { ev->copyData(); append(ev); } void data(DataEvent *ev) { ev->copyData(); append(ev); } void startElement(StartElementEvent *ev) { ev->copyData(); append(ev); } void endElement(EndElementEvent *ev) { ev->copyData(); append(ev); } void pi(PiEvent *ev) { ev->copyData(); append(ev); } void sdataEntity(SdataEntityEvent *ev) { ev->copyData(); append(ev); } void externalDataEntity(ExternalDataEntityEvent *ev) { ev->copyData(); append(ev); } void subdocEntity(SubdocEntityEvent *ev) { ev->copyData(); append(ev); } void nonSgmlChar(NonSgmlCharEvent *ev) { ev->copyData(); append(ev); } void appinfo(AppinfoEvent *ev) { ev->copyData(); append(ev); } void uselink(UselinkEvent *ev) { ev->copyData(); append(ev); } void usemap(UsemapEvent *ev) { ev->copyData(); append(ev); } void startDtd(StartDtdEvent *ev) { ev->copyData(); append(ev); } void endDtd(EndDtdEvent *ev) { ev->copyData(); append(ev); } void startLpd(StartLpdEvent *ev) { ev->copyData(); append(ev); } void endLpd(EndLpdEvent *ev) { ev->copyData(); append(ev); } void endProlog(EndPrologEvent *ev) { ev->copyData(); append(ev); } void sgmlDecl(SgmlDeclEvent *ev) { ev->copyData(); append(ev); } void commentDecl(CommentDeclEvent *ev) { ev->copyData(); append(ev); } void sSep(SSepEvent *ev) { ev->copyData(); append(ev); } void ignoredRe(IgnoredReEvent *ev) { ev->copyData(); append(ev); } void reOrigin(ReOriginEvent *ev) { ev->copyData(); append(ev); } void ignoredRs(IgnoredRsEvent *ev) { ev->copyData(); append(ev); } void ignoredChars(IgnoredCharsEvent *ev) { ev->copyData(); append(ev); } void markedSectionStart(MarkedSectionStartEvent *ev) { ev->copyData(); append(ev); } void markedSectionEnd(MarkedSectionEndEvent *ev) { ev->copyData(); append(ev); } void entityStart(EntityStartEvent *ev) { ev->copyData(); append(ev); } void entityEnd(EntityEndEvent *ev) { ev->copyData(); append(ev); } void entityDecl(EntityDeclEvent *ev) { ev->copyData(); append(ev); } void notationDecl(NotationDeclEvent *ev) { ev->copyData(); append(ev); } void elementDecl(ElementDeclEvent *ev) { ev->copyData(); append(ev); } void attlistDecl(AttlistDeclEvent *ev) { ev->copyData(); append(ev); } void linkAttlistDecl(LinkAttlistDeclEvent *ev) { ev->copyData(); append(ev); } void attlistNotationDecl(AttlistNotationDeclEvent *ev) { ev->copyData(); append(ev); } void linkDecl(LinkDeclEvent *ev) { ev->copyData(); append(ev); } void idLinkDecl(IdLinkDeclEvent *ev) { ev->copyData(); append(ev); } void shortrefDecl(ShortrefDeclEvent *ev) { ev->copyData(); append(ev); } void ignoredMarkup(IgnoredMarkupEvent *ev) { ev->copyData(); append(ev); } void entityDefaulted(EntityDefaultedEvent *ev) { ev->copyData(); append(ev); } void sgmlDeclEntity(SgmlDeclEntityEvent *ev) { ev->copyData(); append(ev); } # 69 "ArcEngine.cxx" 2 }; class NullEventHandler : public EventHandler { public: NullEventHandler(Messenger &mgr) : mgr_(&mgr) { } void message(MessageEvent *event) { mgr_->dispatchMessage(event->message()); delete event; } private: Messenger *mgr_; }; class ArcEngineImpl : public DelegateEventHandler, private Messenger { public: ArcEngineImpl(Messenger &mgr, const SgmlParser *parser, ArcDirector &director, const volatile sig_atomic_t *cancelPtr, const StringC *arcPublicId, const Notation *, const Vector &name, const SubstTable *table); ~ArcEngineImpl(); void sgmlDecl(SgmlDeclEvent *); void appinfo(AppinfoEvent *); void startElement(StartElementEvent *); void endElement(EndElementEvent *); void data(DataEvent *); void sdataEntity(SdataEntityEvent *); void externalDataEntity(ExternalDataEntityEvent *); void pi(PiEvent *); void endProlog(EndPrologEvent *); void startDtd(StartDtdEvent *); void endDtd(EndDtdEvent *); void startLpd(StartLpdEvent *); void endLpd(EndLpdEvent *); void uselink(UselinkEvent *); size_t nBases() const { return arcProcessors_.size(); } EventHandler *delegateHandler() { return eventHandler_; } private: void dispatchMessage(const Message &); void dispatchMessage(Message &); void initMessage(Message &); EventHandler *eventHandler_; NCVector arcProcessors_; ConstPtr sd_; ConstPtr syntax_; StringC is10744_; StringC arcBase_; StringC namespaceDelim_; StringC arch_; StringC uselex_; ConstPtr archPiAttributeDefs_; int stage_; QueueEventHandler eventQueue_; NullEventHandler nullHandler_; const SgmlParser *parser_; Location currentLocation_; unsigned gatheringContent_; Text content_; unsigned startAgain_; Allocator alloc_; StringC appinfo_; const AttributeList *linkAttributes_; LinkProcess linkProcess_; Boolean haveLinkProcess_; Vector docName_; ArcDirector *director_; Messenger *mgr_; const volatile sig_atomic_t *cancelPtr_; }; void ArcEngine::parseAll(SgmlParser &parser, Messenger &mgr, ArcDirector &director, const volatile sig_atomic_t *cancelPtr) { ArcEngineImpl wrap(mgr, &parser, director, cancelPtr, 0, 0, Vector(), 0); parser.parseAll(wrap, cancelPtr); } EventHandler * SelectOneArcDirector::arcEventHandler(const StringC *, const Notation *, const Vector &name, const SubstTable *table) { if (name.size() != select_.size()) return 0; for (size_t i = 0; i < name.size(); i++) { StringC tem(select_[i]); table->subst(tem); if (name[i] != tem) return 0; } return eh_; } void SelectOneArcDirector::dispatchMessage(const Message &msg) { eh_->message(new MessageEvent(msg)); } void SelectOneArcDirector::dispatchMessage(Message &msg) { eh_->message(new MessageEvent(msg)); } ArcEngineImpl::ArcEngineImpl(Messenger &mgr, const SgmlParser *parser, ArcDirector &director, const volatile sig_atomic_t *cancelPtr, const StringC *arcPublicId, const Notation *notation, const Vector &docName, const SubstTable *table) : director_(&director), mgr_(&mgr), cancelPtr_(cancelPtr), parser_(parser), stage_(0), gatheringContent_(0), startAgain_(0), haveLinkProcess_(0), alloc_(maxSize(sizes, (sizeof(sizes)/sizeof(sizes[0]))), 50), nullHandler_(mgr), docName_(docName) { eventHandler_ = director.arcEventHandler(arcPublicId, notation, docName, table); if (!eventHandler_) eventHandler_ = &nullHandler_; delegateTo_ = eventHandler_; } ArcEngineImpl::~ArcEngineImpl() { for (size_t i = 0; i < arcProcessors_.size(); i++) if (arcProcessors_[i].valid()) arcProcessors_[i].checkIdrefs(); } void ArcEngineImpl::appinfo(AppinfoEvent *event) { const StringC *str; if (event->literal(str)) appinfo_ = *str; DelegateEventHandler::appinfo(event); } void ArcEngineImpl::pi(PiEvent *event) { currentLocation_ = event->location(); if (stage_ == 1 && event->dataLength() > is10744_.size() + 1) { Boolean match = 1; size_t i = 0; for (size_t j = 0; j < is10744_.size() && match; i++, j++) if ((*syntax_->generalSubstTable())[event->data()[i]] != is10744_[j]) match = 0; if (match) { if ((event->dataLength() - i) < namespaceDelim_.size()) match = 0; else { for (size_t j = 0; j < namespaceDelim_.size() && match; j++) if ((*syntax_->generalSubstTable())[event->data()[i+j]] != namespaceDelim_[j]) match = 0; } if (match || syntax_->isS(event->data()[i])) { if (match) i += namespaceDelim_.size(); else { do { i++; } while (i < event->dataLength() && syntax_->isS(event->data()[i])); } if (i >= event->dataLength()) { Location loc(event->location()); loc += i; setNextLocation(loc); Messenger::message(ArcEngineMessages::is10744PiKeywordMissing); } else { StringC token; do { token += (*syntax_->generalSubstTable())[event->data()[i++]]; } while (i < event->dataLength() && !syntax_->isS(event->data()[i])); if (!match && token == arcBase_) { size_t dataLength = event->dataLength(); const Char *data = event->data(); for (;;) { while (i < dataLength && syntax_->isS(data[i])) i++; if (i >= dataLength) break; size_t start = i++; while (i < dataLength && !syntax_->isS(data[i])) i++; StringC name(data + start, i - start); syntax_->generalSubstTable()->subst(name); arcProcessors_.resize(arcProcessors_.size() + 1); Location loc(event->location()); loc += start; arcProcessors_.back().setName(name, loc); } } else if (token == arch_) { if (archPiAttributeDefs_.isNull()) { const char *const autoTokens[] = { "ArcAuto", "nArcAuto", 0 }; struct AttdefData { const char *name; Boolean required; enum { dvName, dvNameTokenGroup, dvCdata } declaredValue; const char *const *allowedTokens; } const attdefData[] = { { "name", 1, AttdefData::dvName, 0 }, { "public-id", 0, AttdefData::dvCdata, 0 }, { "dtd-public-id", 0, AttdefData::dvCdata, 0 }, { "dtd-system-id", 0, AttdefData::dvCdata, 0 }, { "form-att", 0, AttdefData::dvName, 0 }, { "renamer-att", 0, AttdefData::dvName, 0 }, { "suppressor-att", 0, AttdefData::dvName, 0 }, { "ignore-data-att", 0, AttdefData::dvName, 0 }, { "doc-elem-form", 0, AttdefData::dvCdata, 0 }, { "bridge-form", 0, AttdefData::dvCdata, 0 }, { "data-form", 0, AttdefData::dvCdata, 0 }, { "auto", 0, AttdefData::dvNameTokenGroup, autoTokens }, { "options", 0, AttdefData::dvCdata, 0 }, { "quantity", 0, AttdefData::dvCdata, 0 } }; Vector > attdefs; for (size_t i = 0; i < (sizeof(attdefData)/sizeof(attdefData[0])); i++) { StringC attName(sd_->execToInternal(attdefData[i].name)); syntax_->generalSubstTable()->subst(attName); DeclaredValue *declaredValue; switch (attdefData[i].declaredValue) { case AttdefData::dvName: declaredValue = new TokenizedDeclaredValue(TokenizedDeclaredValue::name, 0); break; case AttdefData::dvCdata: declaredValue = new CdataDeclaredValue(); break; case AttdefData::dvNameTokenGroup: { Vector allowedTokens; for (const char *const *allowedToken = attdefData[i].allowedTokens; *allowedToken; allowedToken++) { allowedTokens.push_back(sd_->execToInternal(*allowedToken)); syntax_->generalSubstTable()->subst(allowedTokens.back()); } declaredValue = new NameTokenGroupDeclaredValue(allowedTokens); break; } default: (static_cast ((0) ? 0 : (__assert_fail ("0", "ArcEngine.cxx", 325, __PRETTY_FUNCTION__), 0))); } if (attdefData[i].required) attdefs.push_back(new RequiredAttributeDefinition(attName, declaredValue)); else attdefs.push_back(new ImpliedAttributeDefinition(attName, declaredValue)); } archPiAttributeDefs_ = new AttributeDefinitionList(attdefs, 0); } arcProcessors_.resize(arcProcessors_.size() + 1); arcProcessors_.back().setPiDecl(event->location(), StringC(event->data() + i, event->dataLength() - i), i, archPiAttributeDefs_); } else if (match || token != uselex_) { Location loc(event->location()); loc += i - token.size(); setNextLocation(loc); Messenger::message(ArcEngineMessages::is10744PiKeywordInvalid, StringMessageArg(token)); } } } } } DelegateEventHandler::pi(event); } void ArcEngineImpl::endProlog(EndPrologEvent *event) { currentLocation_ = event->location(); for (size_t i = 0; i < arcProcessors_.size(); i++) arcProcessors_[i].init(*event, sd_, syntax_, parser_, this, docName_, arcProcessors_, *director_, cancelPtr_); if (!event->lpdPointer().isNull()) { haveLinkProcess_ = 1; linkProcess_.init(event->lpdPointer()); } DelegateEventHandler::endProlog(event); } void ArcEngineImpl::startDtd(StartDtdEvent *event) { stage_++; DelegateEventHandler::startDtd(event); } void ArcEngineImpl::endDtd(EndDtdEvent *event) { stage_++; DelegateEventHandler::endDtd(event); } void ArcEngineImpl::startLpd(StartLpdEvent *event) { if (event->active()) stage_ = 1; DelegateEventHandler::startLpd(event); } void ArcEngineImpl::endLpd(EndLpdEvent *event) { stage_++; DelegateEventHandler::endLpd(event); } void ArcEngineImpl::sgmlDecl(SgmlDeclEvent *event) { currentLocation_ = event->location(); sd_ = event->sdPointer(); syntax_ = event->instanceSyntaxPointer(); arcBase_ = sd_->execToInternal("ArcBase"); syntax_->generalSubstTable()->subst(arcBase_); is10744_ = sd_->execToInternal("IS10744"); arch_ = sd_->execToInternal("arch"); syntax_->generalSubstTable()->subst(arch_); uselex_ = sd_->execToInternal("USELEX"); namespaceDelim_ = sd_->execToInternal(":"); Boolean atStart = 1; for (size_t i = 0; i < appinfo_.size(); i++) if (syntax_->isS(appinfo_[i])) atStart = 1; else if (atStart) { if (i + 7 > appinfo_.size()) break; StringC tem(appinfo_.data() + i, 7); syntax_->generalSubstTable()->subst(tem); if (tem == arcBase_) { if (i + 7 == appinfo_.size() || syntax_->isS(appinfo_[i + 7])) break; if (appinfo_[i + 7] == sd_->execToInternal('=')) { arcBase_.resize(0); for (size_t j = i + 7; j < appinfo_.size(); j++) { if (syntax_->isS(appinfo_[j])) break; arcBase_ += appinfo_[j]; } if (arcBase_.size() > 2 && (arcBase_[0] == sd_->execToInternal('"') || arcBase_[0] == sd_->execToInternal('\'')) && arcBase_[arcBase_.size() - 1] == arcBase_[0]) { for (size_t j = 0; j < arcBase_.size() - 2; j++) arcBase_[j] = arcBase_[j + 1]; arcBase_.resize(arcBase_.size() - 2); } syntax_->generalSubstTable()->subst(arcBase_); break; } } atStart = 0; } DelegateEventHandler::sgmlDecl(event); } void ArcEngineImpl::startElement(StartElementEvent *event) { if (gatheringContent_) { gatheringContent_++; DelegateEventHandler::startElement(event); return; } currentLocation_ = event->location(); const Text *contentP; size_t start; if (startAgain_) { start = startAgain_ - 1; contentP = &content_; startAgain_ = 0; } else { contentP = 0; start = 0; if (haveLinkProcess_) { const ResultElementSpec *resultElementSpec; linkProcess_.startElement(event->elementType(), event->attributes(), event->location(), *this, linkAttributes_, resultElementSpec); } else linkAttributes_ = 0; } for (size_t i = start; i < arcProcessors_.size(); i++) { if (arcProcessors_[i].valid()) { if (!arcProcessors_[i].processStartElement(*event, linkAttributes_, contentP, alloc_)) { (static_cast ((contentP == 0) ? 0 : (__assert_fail ("contentP == 0", "ArcEngine.cxx", 483, __PRETTY_FUNCTION__), 0))); startAgain_ = i + 1; gatheringContent_ = 1; delegateTo_ = &eventQueue_; DelegateEventHandler::startElement(event); return; } } } content_.clear(); DelegateEventHandler::startElement(event); } void ArcEngineImpl::data(DataEvent *event) { const Entity *entity = event->entity(); if (gatheringContent_) { if (entity) content_.addCdata(entity->asInternalEntity()->string(), event->location().origin()); else { Location loc(event->location()); for (size_t i = 0; i < event->dataLength(); i++, loc += 1) { Char ch = event->data()[i]; if (syntax_->isS(ch) && ch != syntax_->space()) { if (ch == syntax_->standardFunction(Syntax::fRS)) content_.ignoreChar(ch, loc); else content_.addChar(syntax_->space(), Location(new ReplacementOrigin(loc, ch), 0)); } else content_.addChar(ch, loc); } } } else { currentLocation_ = event->location(); for (size_t i = 0; i < arcProcessors_.size(); i++) { if (arcProcessors_[i].valid() && arcProcessors_[i].processData()) { if (entity) arcProcessors_[i].docHandler() .data(new (alloc_) CdataEntityEvent(entity->asInternalEntity(), event->location().origin())); else arcProcessors_[i].docHandler() .data(new (alloc_) ImmediateDataEvent(event->type(), event->data(), event->dataLength(), event->location(), 0)); } } } DelegateEventHandler::data(event); } void ArcEngineImpl::sdataEntity(SdataEntityEvent *event) { if (gatheringContent_) { content_.addSdata(event->entity()->asInternalEntity()->string(), event->location().origin()); return; } else { currentLocation_ = event->location(); for (size_t i = 0; i < arcProcessors_.size(); i++) { if (arcProcessors_[i].valid() && arcProcessors_[i].processData()) { const Entity *entity = event->entity(); arcProcessors_[i].docHandler() .sdataEntity(new (alloc_) SdataEntityEvent(entity->asInternalEntity(), event->location().origin())); } } } DelegateEventHandler::sdataEntity(event); } void ArcEngineImpl::externalDataEntity(ExternalDataEntityEvent *event) { if (!gatheringContent_) { currentLocation_ = event->location(); for (size_t i = 0; i < arcProcessors_.size(); i++) { if (arcProcessors_[i].valid() && arcProcessors_[i].processData()) { ConstPtr entity = arcProcessors_[i].dtdPointer() ->lookupEntity(0, event->entity()->name()); if (!entity.isNull()) { ConstPtr oldOrigin = event->entityOrigin(); Owner markup; if (oldOrigin->markup()) markup = new Markup(*oldOrigin->markup()); ConstPtr newOrigin = EntityOrigin::make(entity, oldOrigin->parent(), oldOrigin->refLength(), markup); arcProcessors_[i].docHandler() .externalDataEntity(new (alloc_) ExternalDataEntityEvent(entity->asExternalDataEntity(), newOrigin)); } } } } DelegateEventHandler::externalDataEntity(event); } void ArcEngineImpl::endElement(EndElementEvent *event) { while (gatheringContent_) { if (--gatheringContent_ > 0) { DelegateEventHandler::endElement(event); return; } delegateTo_ = delegateHandler(); IQueue tem; tem.swap(eventQueue_); while (!tem.empty()) tem.get()->handle(*this); } currentLocation_ = event->location(); for (size_t i = 0; i < arcProcessors_.size(); i++) if (arcProcessors_[i].valid()) arcProcessors_[i].processEndElement(*event, alloc_); DelegateEventHandler::endElement(event); if (haveLinkProcess_) linkProcess_.endElement(); } void ArcEngineImpl::uselink(UselinkEvent *event) { if (!gatheringContent_) linkProcess_.uselink(event->linkSet(), event->restore(), event->lpd().pointer()); DelegateEventHandler::uselink(event); } void ArcEngineImpl::dispatchMessage(const Message &msg) { mgr_->dispatchMessage(msg); } void ArcEngineImpl::dispatchMessage(Message &msg) { mgr_->dispatchMessage(msg); } void ArcEngineImpl::initMessage(Message &msg) { mgr_->initMessage(msg); msg.loc = currentLocation_; } ArcProcessor::ArcProcessor() : errorIdref_(1), docHandler_(0), arcAuto_(1), arcDtdIsParam_(0) { } void ArcProcessor::setName(const StringC &name, const Location &loc) { piDecl_ = 0; name_ = name; declLoc_ = loc; } const Syntax &ArcProcessor::attributeSyntax() const { return *docSyntax_; } ConstPtr ArcProcessor::getAttributeNotation(const StringC &name, const Location &) { if (!metaDtd_.isNull()) return metaDtd_->lookupNotation(name); return 0; } ConstPtr ArcProcessor::getAttributeEntity(const StringC &name, const Location &) { if (!metaDtd_.isNull()) return metaDtd_->lookupEntity(0, name); return 0; } void ArcProcessor::noteCurrentAttribute(size_t i, AttributeValue *value) { if (valid_) currentAttributes_[i] = value; } ConstPtr ArcProcessor::getCurrentAttribute(size_t i) const { return currentAttributes_[i]; } Boolean ArcProcessor::defineId(const StringC &str, const Location &loc, Location &prevLoc) { if (!valid_) return 1; Id *id = lookupCreateId(str); if (id->defined()) { prevLoc = id->defLocation(); return 0; } id->define(loc); return 1; } void ArcProcessor::noteIdref(const StringC &str, const Location &loc) { if (!valid_ || !errorIdref_) return; Id *id = lookupCreateId(str); if (!id->defined()) id->addPendingRef(loc); } Id *ArcProcessor::lookupCreateId(const StringC &name) { Id *id = idTable_.lookup(name); if (!id) { id = new Id(name); idTable_.insert(id); } return id; } void ArcProcessor::checkIdrefs() { NamedTableIter iter(idTable_); Id *id; while ((id = iter.next()) != 0) { for (size_t i = 0; i < id->pendingRefs().size(); i++) { Messenger::setNextLocation(id->pendingRefs()[i]); message(ArcEngineMessages::missingId, StringMessageArg(id->name())); } } } void ArcProcessor::setPiDecl(const Location &loc, const StringC &attspecText, Index attspecIndex, const ConstPtr &archPiAttributeDefs) { piDecl_ = 1; declLoc_ = loc; piDeclAttspecText_ = attspecText; piDeclAttspecIndex_ = attspecIndex; archPiAttributeDefs_ = archPiAttributeDefs; } class PiAttspecParser { public: PiAttspecParser(const SgmlParser *parser) : parser_(parser->parser_) {} Boolean parsePiAttributeSpec(const StringC &text, const Location &loc, AttributeList &attributeList); private: Parser *parser_; }; Boolean PiAttspecParser:: parsePiAttributeSpec(const StringC &text, const Location &loc, AttributeList &attributeList) { Markup *savedCurrentMarkup = parser_->currentMarkup_; parser_->currentMarkup_ = 0; parser_->pushInput(new InternalInputSource(text, InputSourceOrigin::make(loc))); Boolean netEnabling; Ptr newAttDefs; Boolean result = parser_->parseAttributeSpec(piPasMode, attributeList, netEnabling, newAttDefs); parser_->popInputStack(); parser_->currentMarkup_ = savedCurrentMarkup; return result; } void ArcProcessor::init(const EndPrologEvent &event, const ConstPtr &sd, const ConstPtr &syntax, const SgmlParser *parentParser, Messenger *mgr, const Vector &superName, const NCVector &arcProcessors, ArcDirector &director, const volatile sig_atomic_t *cancelPtr) { director_ = &director; mgr_ = mgr; docSyntax_ = syntax; docSd_ = sd; mgr_ = mgr; valid_ = 0; docDtd_ = event.dtdPointer(); metaSyntax_ = docSyntax_; mayDefaultAttribute_ = 1; ConstPtr notation; PiAttspecParser piAttspecParser(parentParser); if (!piDecl()) docSyntax_->generalSubstTable()->subst(name_); else { attributeList_.init(archPiAttributeDefs_); Location loc(declLoc_); loc += piDeclAttspecIndex_; if (!piAttspecParser.parsePiAttributeSpec(piDeclAttspecText_, loc, attributeList_)) return; supportAttributes(attributeList_, 1); if (name_.size() == 0) return; } const ArcProcessor *first = 0; for (const ArcProcessor *p = arcProcessors.begin(); p != this; p++) if (name_ == p->name()) { if ((piDecl() && p->piDecl()) || (!piDecl() && !p->piDecl())) { setNextLocation(declLoc_); message(ArcEngineMessages::duplicateArcDecl, StringMessageArg(name_), p->declLoc_); return; } else { first = p; } } if (first) { if (piDecl()) { setNextLocation(declLoc_); message(ArcEngineMessages::ignoringPiArcDecl, StringMessageArg(name_), first->declLoc_); } else { setNextLocation(declLoc_); message(ArcEngineMessages::ignoringArcBaseArcDecl, StringMessageArg(name_), first->declLoc_); } return; } const StringC *arcPublicId = 0; if (piDecl()) { if (supportAttsText_[rArcPubid]) arcPublicId = &supportAtts_[rArcPubid]; } else { notation = docDtd_->lookupNotation(name_); if (!notation.isNull()) { ConstPtr notAttDef = notation->attributeDef(); attributeList_.init(notAttDef); attributeList_.finish(*this); supportAttributes(attributeList_, 0); arcPublicId = notation->publicIdPointer(); } else { setNextLocation(declLoc_); message(ArcEngineMessages::noArcNotation, StringMessageArg(name_)); } } Vector docName(superName); docName.push_back(name_); ArcEngineImpl *engine = new ArcEngineImpl(*mgr, parentParser, director, cancelPtr, arcPublicId, notation.pointer(), docName, docSyntax_->generalSubstTable()); docHandler_ = engine; ownEventHandler_ = engine; if (supportAtts_[rArcDocF].size() == 0) supportAtts_[rArcDocF] = name_; if (supportAtts_[rArcFormA].size() == 0) supportAtts_[rArcFormA] = name_; rniContent_ = docSyntax_->delimGeneral(Syntax::dRNI); rniContent_ += sd->execToInternal("CONTENT"); rniDefault_ = docSyntax_->delimGeneral(Syntax::dRNI); rniDefault_ += docSyntax_->reservedName(Syntax::rDEFAULT); rniArcCont_ = metaSyntax_->delimGeneral(Syntax::dRNI); rniArcCont_ += sd->execToInternal("ARCCONT"); rniMaptoken_ = metaSyntax_->delimGeneral(Syntax::dRNI); rniMaptoken_ += sd->execToInternal("MAPTOKEN"); ConstPtr dtdent = makeDtdEntity(notation.pointer()); if (dtdent.isNull()) return; StringC sysid = dtdent->asExternalEntity()->externalId().effectiveSystemId(); if (sysid.size() == 0 && !parentParser->entityCatalog().lookup(*dtdent, *docSyntax_, sd->internalCharset(), *mgr_, sysid)) { setNextLocation(dtdent->defLocation()); message(ArcEngineMessages::arcGenerateSystemId, StringMessageArg(name_)); return; } docHandler_->sgmlDecl(new SgmlDeclEvent(sd, syntax)); docHandler_->startDtd(new StartDtdEvent(dtdent->name(), dtdent, 0, event.location(), 0)); SgmlParser::Params params; params.entityType = SgmlParser::Params::dtd; params.sysid = sysid; params.parent = parentParser; ParserOptions options = parentParser->options(); errorIdref_ = options.errorIdref; options.errorAfdr = 0; options.includes = arcOpts_; params.options = &options; params.sd = docSd_; if (metaSyntax_->reservedName(Syntax::rALL).size() == 0) { Ptr tem(new Syntax(*metaSyntax_)); tem->setName(Syntax::rALL, docSd_->execToInternal("ALL")); metaSyntax_ = tem; } params.prologSyntax = metaSyntax_; params.instanceSyntax = metaSyntax_; params.doctypeName = dtdent->name(); params.origin = InputSourceOrigin::make(dtdent->defLocation()); SgmlParser parser(params); parser.parseAll(*docHandler_, cancelPtr); Ptr baseDtd = parser.baseDtd(); if (baseDtd.isNull() || baseDtd->documentElementType()->definition()->undefined()) return; metaDtd_ = baseDtd; metaMapCache_.resize(docDtd_->nElementTypeIndex()); mungeMetaDtd(*baseDtd, *docDtd_); docHandler_->endDtd(new EndDtdEvent(metaDtd_, event.location(), 0)); startContent(*metaDtd_); currentAttributes_.resize(metaDtd_->nCurrentAttribute()); valid_ = 1; docHandler_->endProlog(new EndPrologEvent(metaDtd_, event.location())); if (engine->nBases() == 0) docHandler_ = engine->delegateHandler(); } void ArcProcessor::mungeMetaDtd(Dtd &metaDtd, const Dtd &docDtd) { if (supportAtts_[rArcDataF].size() > 0 && metaDtd.lookupNotation(supportAtts_[rArcDataF]).isNull()) { setNextLocation(supportAttsText_[rArcDataF]->charLocation(0)); Messenger::message(ArcEngineMessages::noArcDataF, StringMessageArg(supportAtts_[rArcDataF])); metaDtd.insertNotation(new Notation(supportAtts_[rArcDataF], metaDtd.namePointer(), metaDtd.isBase())); } Dtd::ConstEntityIter iter(docDtd.generalEntityIter()); for (;;) { ConstPtr ent = iter.next(); if (ent.isNull()) break; Ptr copy(ent->copy()); if (!copy->asExternalDataEntity() || mungeDataEntity(*(ExternalDataEntity *)copy.pointer())) metaDtd.insertEntity(copy, 1); } } Boolean ArcProcessor::mungeDataEntity(ExternalDataEntity &entity) { const MetaMap &map = buildMetaMap(0, entity.notation(), entity.attributes(), 0, 0); if (!map.attributed) return 0; AttributeList atts; const Notation *notation = (const Notation *)map.attributed; ConstPtr arcContent; if (mapAttributes(entity.attributes(), 0, 0, atts, arcContent, map)) { entity.setNotation((Notation *)notation, atts); return 1; } return 0; } ConstPtr ArcProcessor::makeDtdEntity(const Notation *notation) { ExternalId externalId; Location defLocation; if (notation) { if (!supportAtts_[rArcDTD].size()) { mgr_->setNextLocation(notation->defLocation()); mgr_->message(ArcEngineMessages::noArcDTDAtt); return 0; } ConstPtr entity = docDtd_->lookupEntity(arcDtdIsParam_, supportAtts_[rArcDTD]); if (entity.isNull()) { mgr_->setNextLocation(supportAttsText_[rArcDTD]->charLocation(0)); mgr_->message(arcDtdIsParam_ ? ArcEngineMessages::arcDtdNotDeclaredParameter : ArcEngineMessages::arcDtdNotDeclaredGeneral, StringMessageArg(supportAtts_[rArcDTD])); return 0; } if (!entity->asExternalEntity()) { mgr_->setNextLocation(entity->defLocation()); mgr_->message(ArcEngineMessages::arcDtdNotExternal, StringMessageArg(supportAtts_[rArcDTD])); return 0; } externalId = entity->asExternalEntity()->externalId(); defLocation = entity->defLocation(); } else { if (supportAttsText_[rArcDtdPubid]) { Text pubidText(*supportAttsText_[rArcDtdPubid]); const MessageType1 *fpierr; const MessageType1 *urnerr; switch (externalId.setPublic(pubidText, docSd_->internalCharset(), docSyntax_->space(), fpierr, urnerr)) { case PublicId::fpi: { PublicId::TextClass textClass; if (docSd_->formal() && externalId.publicId()->getTextClass(textClass) && textClass == PublicId::SD) { mgr_->setNextLocation(externalId.publicIdText()->charLocation(0)); mgr_->message(ParserMessages::wwwRequired); } if (docSd_->urn() && !docSd_->formal()) { mgr_->setNextLocation(externalId.publicIdText()->charLocation(0)); mgr_->message(*urnerr, StringMessageArg(*externalId.publicIdString())); } } break; case PublicId::urn: if (docSd_->formal() && !docSd_->urn()) { mgr_->setNextLocation(externalId.publicIdText()->charLocation(0)); mgr_->message(*fpierr, StringMessageArg(*externalId.publicIdString())); } break; case PublicId::informal: if (docSd_->formal()) { mgr_->setNextLocation(externalId.publicIdText()->charLocation(0)); mgr_->message(*fpierr, StringMessageArg(*externalId.publicIdString())); } if (docSd_->urn()) { mgr_->setNextLocation(externalId.publicIdText()->charLocation(0)); mgr_->message(*urnerr, StringMessageArg(*externalId.publicIdString())); } break; } } if (supportAttsText_[rArcDtdSysid]) { Text sysidText(*supportAttsText_[rArcDtdSysid]); externalId.setSystem(sysidText); } defLocation = declLoc_; } # 1087 "ArcEngine.cxx" return new ExternalTextEntity(supportAtts_[rArcDocF], Entity::doctype, defLocation, externalId); } void ArcProcessor::supportAttributes(const AttributeList &atts, Boolean piDecl) { static const char *const s[][2] = { { 0, "name" }, { 0, "public-id" }, { "ArcFormA", "form-att" }, { "ArcNamrA", "renamer-att" }, { "ArcSuprA", "suppressor-att" }, { "ArcIgnDA", "ignore-data-att" }, { "ArcDocF", "doc-elem-form" }, { "ArcSuprF", 0 }, { "ArcBridF", "bridge-form" }, { "ArcDataF", "data-form" }, { "ArcAuto", "auto" }, { "ArcDTD", 0 }, { 0, "dtd-public-id" }, { 0, "dtd-system-id" }, { "ArcQuant", "quantity" } }; int column = piDecl ? 1 : 0; for (size_t i = 0; i < nReserve; i++) supportAttsText_[i] = 0; for (size_t i = 0; i < (sizeof(s)/sizeof(s[0])); i++) if (s[i][column]) { StringC attName(docSd_->execToInternal(s[i][column])); docSyntax_->generalSubstTable()->subst(attName); unsigned ind; if (atts.attributeIndex(attName, ind)) { const AttributeValue *value = atts.value(ind); if (value) { const Text *textP = value->text(); if (textP) { supportAttsText_[i] = textP; supportAtts_[i] = textP->string(); switch (i) { case rArcName: name_ = supportAtts_[i]; break; case rArcQuant: processArcQuant(*textP); break; case rArcAuto: { if (!piDecl) docSyntax_->generalSubstTable()->subst(supportAtts_[i]); StringC ArcAuto(docSd_->execToInternal("ArcAuto")); docSyntax_->generalSubstTable()->subst(ArcAuto); if (supportAtts_[i] == ArcAuto) arcAuto_ = 1; else { StringC nArcAuto(docSd_->execToInternal("nArcAuto")); docSyntax_->generalSubstTable()->subst(nArcAuto); if (supportAtts_[i] == nArcAuto) arcAuto_ = 0; else if (!piDecl) { setNextLocation(textP->charLocation(0)); Messenger::message(ArcEngineMessages::invalidArcAuto, StringMessageArg(supportAtts_[i])); } } break; } case rArcFormA: case rArcNamrA: case rArcSuprA: case rArcIgnDA: if (!piDecl) docSyntax_->generalSubstTable()->subst(supportAtts_[i]); break; case rArcDocF: case rArcSuprF: case rArcBridF: case rArcDataF: metaSyntax_->generalSubstTable()->subst(supportAtts_[i]); break; case rArcDTD: { const StringC &pero = docSyntax_->delimGeneral(Syntax::dPERO); if (supportAtts_[i].size() >= pero.size()) { StringC tem(supportAtts_[i].data(), pero.size()); docSyntax_->generalSubstTable()->subst(tem); if (tem == pero) { arcDtdIsParam_ = 1; tem.assign(supportAtts_[i].data() + pero.size(), supportAtts_[i].size() - pero.size()); tem.swap(supportAtts_[i]); } } docSyntax_->entitySubstTable()->subst(supportAtts_[i]); } break; } } } } } processArcOpts(atts, piDecl); } void ArcProcessor::processArcOpts(const AttributeList &atts, Boolean piDecl) { Vector arcOptA; unsigned ind; if (piDecl) arcOptA.push_back(docSd_->execToInternal("options")); else { StringC attName(docSd_->execToInternal("ArcOptSA")); docSyntax_->generalSubstTable()->subst(attName); Vector arcOptAPos; const Text *arcOptAText = 0; if (atts.attributeIndex(attName, ind)) { const AttributeValue *value = atts.value(ind); if (value) { arcOptAText = value->text(); if (arcOptAText) split(*arcOptAText, docSyntax_->space(), arcOptA, arcOptAPos); } } if (!arcOptAText) arcOptA.push_back(docSd_->execToInternal("ArcOpt")); } for (size_t i = 0; i < arcOptA.size(); i++) { docSyntax_->generalSubstTable()->subst(arcOptA[i]); if (atts.attributeIndex(arcOptA[i], ind)) { const AttributeValue *value = atts.value(ind); if (value) { const Text *textP = value->text(); if (textP) { Vector opts; Vector optsPos; split(*textP, docSyntax_->space(), opts, optsPos); arcOpts_.insert(arcOpts_.begin(), opts.begin(), opts.begin() + opts.size()); } } } } } void ArcProcessor::processArcQuant(const Text &text) { Ptr newMetaSyntax; Vector tokens; Vector tokensPos; split(text, docSyntax_->space(), tokens, tokensPos); for (size_t i = 0; i < tokens.size(); i++) { docSyntax_->generalSubstTable()->subst(tokens[i]); Syntax::Quantity quantityName; if (!docSd_->lookupQuantityName(tokens[i], quantityName)) { setNextLocation(text.charLocation(tokensPos[i])); Messenger::message(ArcEngineMessages::invalidQuantity, StringMessageArg(tokens[i])); } else if (i + 1 >= tokens.size()) { setNextLocation(text.charLocation(tokensPos[i])); Messenger::message(ArcEngineMessages::missingQuantityValue, StringMessageArg(tokens[i])); } else { i++; unsigned long val = 0; if (tokens[i].size() > 8) { setNextLocation(text.charLocation(tokensPos[i] + 8)); Messenger::message(ArcEngineMessages::quantityValueTooLong, StringMessageArg(tokens[i])); tokens[i].resize(8); } for (size_t j = 0; j < tokens[i].size(); j++) { int weight = docSd_->digitWeight(tokens[i][j]); if (weight < 0) { setNextLocation(text.charLocation(tokensPos[i] + j)); Char c = tokens[i][j]; Messenger::message(ArcEngineMessages::invalidDigit, StringMessageArg(StringC(&c, 1))); val = 0; break; } else { val *= 10; val += weight; } } if (val > docSyntax_->quantity(quantityName)) { if (newMetaSyntax.isNull()) newMetaSyntax = new Syntax(*docSyntax_); newMetaSyntax->setQuantity(quantityName, val); } } } if (!newMetaSyntax.isNull()) metaSyntax_ = newMetaSyntax; } Boolean ArcProcessor::processStartElement(const StartElementEvent &event, const AttributeList *linkAttributes, const Text *content, Allocator &alloc) { unsigned suppressFlags = (openElementFlags_.size() > 0 ? (openElementFlags_.back() & ~isArc) : (unsigned)condIgnoreData); if ((suppressFlags & suppressForm) && (suppressFlags & suppressSupr)) { openElementFlags_.push_back(suppressFlags); return 1; } const AttributeList &atts = event.attributes(); const MetaMap &map = buildMetaMap(event.elementType(), 0, atts, linkAttributes, suppressFlags); const ElementType *metaType; ConstPtr arcContent; if (map.attributed == 0) { if (!(tagLevel() == 0 && !currentElement().isFinished())) { if (!arcContent.isNull() && (currentElement().declaredEmpty() || !currentElement().tryTransitionPcdata())) Messenger::message(ArcEngineMessages::invalidArcContent); openElementFlags_.push_back(map.suppressFlags); return 1; } metaType = metaDtd_->documentElementType(); mgr_->message(ArcEngineMessages::documentElementNotArc, StringMessageArg(metaType->name())); attributeList_.init(metaType->attributeDef()); attributeList_.finish(*this); } else { if (!mapAttributes(atts, linkAttributes, content, attributeList_, arcContent, map)) return 0; metaType = (const ElementType *)map.attributed; suppressFlags = map.suppressFlags; } StartElementEvent *genEvent = new (alloc) StartElementEvent(metaType, metaDtd_, &attributeList_, event.location(), 0); if (metaType->definition()->undefined()) Messenger::message(ArcEngineMessages::undefinedElement, StringMessageArg(metaType->name())); else if (elementIsExcluded(metaType)) Messenger::message(ArcEngineMessages::elementExcluded, StringMessageArg(metaType->name())); else if (elementIsIncluded(metaType)) genEvent->setIncluded(); else if (!currentElement().tryTransition(metaType)) Messenger::message(ArcEngineMessages::invalidElement, StringMessageArg(metaType->name())); pushElement(new (alloc) OpenElement(metaType, 0, genEvent->included(), 0, event.location())); docHandler_->startElement(genEvent); if (attributeList_.conref()) currentElement().setConref(); if (!arcContent.isNull() && arcContent->text() != 0) { if (currentElement().declaredEmpty() || !currentElement().tryTransitionPcdata()) Messenger::message(ArcEngineMessages::invalidArcContent); else emitArcContent(*arcContent->text(), docHandler(), alloc); suppressFlags |= (suppressForm|suppressSupr|ignoreData); } suppressFlags &= ~recoverData; openElementFlags_.push_back(suppressFlags | isArc); return 1; } void ArcProcessor::emitArcContent(const Text &text, EventHandler &handler, Allocator &alloc) { TextIter iter(text); TextItem::Type type; const Char *s; size_t n; const Location *loc; while (iter.next(type, s, n, loc)) switch (type) { case TextItem::data: case TextItem::cdata: if (type == TextItem::data) handler.data(new (alloc) ImmediateDataEvent(Event::characterData, s, n, *loc, 0)); else handler.data(new (alloc) CdataEntityEvent(loc->origin()->asEntityOrigin() ->entity()->asInternalEntity(), loc->origin())); break; case TextItem::sdata: handler.sdataEntity(new (alloc) SdataEntityEvent(loc->origin()->asEntityOrigin() ->entity()->asInternalEntity(), loc->origin())); break; default: break; } } Boolean ArcProcessor::processData() { if (openElementFlags_.size() > 0 && (openElementFlags_.back() & ignoreData)) return 0; if (!currentElement().declaredEmpty() && currentElement().tryTransitionPcdata()) return 1; else if (openElementFlags_.size() > 0 && (openElementFlags_.back() & condIgnoreData)) return 0; else { if (openElementFlags_.size() > 0) { if (openElementFlags_.back() & recoverData) return 1; openElementFlags_.back() |= recoverData; } Messenger::message(ArcEngineMessages::invalidData); return 1; } } Boolean ArcProcessor::mapAttributes(const AttributeList &from, const AttributeList *fromLink, const Text *content, AttributeList &to, ConstPtr &arcContent, const MetaMap &map) { arcContent = 0; if (map.attributed) to.init(map.attributed->attributeDef()); for (size_t i = 0; i < map.attMapFrom.size(); i++) { unsigned fromIndex = map.attMapFrom[i]; const AttributeList *fromList = &from; if (fromIndex != contentPseudoAtt && fromIndex >= fromList->size()) { fromList = fromLink; fromIndex -= from.size(); } if (map.attMapTo[i] == contentPseudoAtt) arcContent = fromList->valuePointer(fromIndex); else { const Text *fromText = 0; Boolean fromTextTokenized = 0; if (map.attMapFrom[i] == contentPseudoAtt) { if (!content) return 0; fromText = content; if (arcContent.isNull()) { Text empty; arcContent = new CdataAttributeValue(empty); } } else { const AttributeValue *value = fromList->value(fromIndex); if (value) { fromText = value->text(); fromTextTokenized = fromList->tokenized(fromIndex); if (fromText && fromList == &from && !from.specified(fromIndex) && (map.attributed->attributeDef()->def(map.attMapTo[i]) ->missingValueWouldMatch(*fromText, *this))) fromText = 0; } } if (fromText) { unsigned specLength = 0; Text tem1; if (map.attTokenMapBase[i] < map.attTokenMapBase[i + 1]) { Vector tokens; Vector tokensPos; split(*fromText, docSyntax_->space(), tokens, tokensPos); Boolean replaced = 0; for (size_t k = 0; k < tokens.size(); k++) for (size_t l = map.attTokenMapBase[i]; l < map.attTokenMapBase[i + 1]; l++) if (tokens[k] == map.tokenMapFrom[l]) { tokens[k] = map.tokenMapTo[l]; replaced = 1; break; } if (replaced) { for (size_t k = 0; k < tokens.size(); k++) { if (k > 0) tem1.addChar(docSyntax_->space(), fromText->charLocation(tokensPos[k + 1] - 1)); tem1.addChars(tokens[k].data(), tokens[k].size(), fromText->charLocation(tokensPos[k])); } fromText = &tem1; fromTextTokenized = 1; } } Text tem; if (!fromTextTokenized && to.tokenized(map.attMapTo[i])) fromText->tokenize(docSyntax_->space(), tem); else tem = *fromText; to.setSpec(map.attMapTo[i], *this); to.setValue(map.attMapTo[i], tem, *this, specLength); } } } if (map.attributed) to.finish(*this); return 1; } const ArcProcessor::MetaMap & ArcProcessor::buildMetaMap(const ElementType *docElementType, const Notation *notation, const AttributeList &atts, const AttributeList *linkAtts, unsigned suppressFlags) { Boolean isNotation; const Attributed *attributed = docElementType; const StringC *nameP; if (!attributed) { attributed = notation; isNotation = 1; nameP = ¬ation->name(); } else { isNotation = 0; nameP = &docElementType->name(); } Boolean inhibitCache = 0; size_t cacheIndex; if (isNotation || docElementType->definition()->undefined()) { inhibitCache = 1; cacheIndex = (unsigned)-1; } else { cacheIndex = docElementType->index(); const MetaMapCache *cache = metaMapCache_[cacheIndex].pointer(); if (cache && cache->suppressFlags == suppressFlags && cache->linkAtts == linkAtts) { for (int i = 0;; i++) { if (i == MetaMapCache::nNoSpec) return cache->map; unsigned attIndex = cache->noSpec[i]; if (attIndex != invalidAtt && atts.specified(attIndex)) break; } } } unsigned oldSuppressFlags = suppressFlags; unsigned newSuppressFlags = suppressFlags; unsigned arcSuprIndex; if (!isNotation) considerSupr(atts, linkAtts, suppressFlags, newSuppressFlags, inhibitCache, arcSuprIndex); else arcSuprIndex = invalidAtt; unsigned arcIgnDIndex; if (!isNotation) considerIgnD(atts, linkAtts, suppressFlags, newSuppressFlags, inhibitCache, arcIgnDIndex); else arcIgnDIndex = invalidAtt; unsigned arcFormIndex; const Attributed *metaAttributed = considerForm(atts, linkAtts, *nameP, isNotation, suppressFlags, newSuppressFlags, inhibitCache, arcFormIndex); unsigned arcNamerIndex; const Text *namerText; if (metaAttributed) namerText = considerNamer(atts, inhibitCache, arcNamerIndex); else { arcNamerIndex = invalidAtt; namerText = 0; } MetaMap *mapP; if (inhibitCache) { noCacheMetaMap_.clear(); mapP = &noCacheMetaMap_; } else { MetaMapCache *cache = metaMapCache_[cacheIndex].pointer(); if (cache) cache->clear(); else { cache = new MetaMapCache; metaMapCache_[cacheIndex] = cache; } cache->noSpec[0] = arcFormIndex; cache->noSpec[1] = arcNamerIndex; cache->noSpec[2] = arcSuprIndex; cache->noSpec[3] = arcIgnDIndex; cache->suppressFlags = oldSuppressFlags; cache->linkAtts = linkAtts; mapP = &cache->map; } mapP->attributed = metaAttributed; mapP->suppressFlags = newSuppressFlags; if (metaAttributed) { ConstPtr metaAttDef = metaAttributed->attributeDef(); Vector renamed(metaAttDef.isNull() ? 1 : metaAttDef->size() + 1, PackedBoolean(0)); Vector substituted((atts.def().isNull() ? 1 : atts.def()->size() + 1) + (linkAtts && !linkAtts->def().isNull() ? linkAtts->def()->size() : 0), PackedBoolean(0)); if (linkAtts) { Boolean specified; unsigned index; const Text *linkNamerText = considerNamer(*linkAtts, specified, index); if (linkNamerText) buildAttributeMapRename(*mapP, *linkNamerText, atts, linkAtts, renamed, substituted, isNotation); } if (namerText) buildAttributeMapRename(*mapP, *namerText, atts, 0, renamed, substituted, isNotation); buildAttributeMapRest(*mapP, atts, linkAtts, renamed); } return *mapP; } void ArcProcessor::considerSupr(const AttributeList &atts, const AttributeList *linkAtts, unsigned &thisSuppressFlags, unsigned &newSuppressFlags, Boolean &inhibitCache, unsigned &arcSuprIndex) { arcSuprIndex = invalidAtt; if (thisSuppressFlags & suppressSupr) return; if (!supportAtts_[rArcSuprA].size()) return; const AttributeValue *val; unsigned tem; if (linkAtts && linkAtts->attributeIndex(supportAtts_[rArcSuprA], tem)) val = linkAtts->value(tem); else if (atts.attributeIndex(supportAtts_[rArcSuprA], arcSuprIndex)) { if (atts.current(arcSuprIndex) || atts.specified(arcSuprIndex)) inhibitCache = 1; val = atts.value(arcSuprIndex); } else return; if (!val) return; const Text *textP = val->text(); if (!textP) return; StringC token = textP->string(); docSyntax_->generalSubstTable()->subst(token); thisSuppressFlags &= ~suppressForm; newSuppressFlags &= ~(suppressForm|suppressSupr); if (matchName(token, "sArcForm")) newSuppressFlags |= suppressForm; else if (matchName(token, "sArcAll")) newSuppressFlags |= (suppressSupr|suppressForm); else if (!matchName(token, "sArcNone")) { Messenger::setNextLocation(textP->charLocation(0)); Messenger::message(ArcEngineMessages::invalidSuppress, StringMessageArg(token)); } } void ArcProcessor::considerIgnD(const AttributeList &atts, const AttributeList *linkAtts, unsigned thisSuppressFlags, unsigned &newSuppressFlags, Boolean &inhibitCache, unsigned &arcIgnDIndex) { arcIgnDIndex = invalidAtt; if (thisSuppressFlags & suppressSupr) return; if (!supportAtts_[rArcIgnDA].size()) return; const AttributeValue *val; unsigned tem; if (linkAtts && linkAtts->attributeIndex(supportAtts_[rArcIgnDA], tem)) val = linkAtts->value(tem); else if (atts.attributeIndex(supportAtts_[rArcIgnDA], arcIgnDIndex)) { if (atts.current(arcIgnDIndex) || atts.specified(arcIgnDIndex)) inhibitCache = 1; val = atts.value(arcIgnDIndex); } else return; if (!val) return; const Text *textP = val->text(); if (!textP) return; StringC token = textP->string(); docSyntax_->generalSubstTable()->subst(token); newSuppressFlags &= ~(ignoreData|condIgnoreData); if (matchName(token, "ArcIgnD")) newSuppressFlags |= ignoreData; else if (matchName(token, "cArcIgnD")) newSuppressFlags |= condIgnoreData; else if (!matchName(token, "nArcIgnD")) { Messenger::setNextLocation(textP->charLocation(0)); Messenger::message(ArcEngineMessages::invalidIgnD, StringMessageArg(token)); } } const Attributed * ArcProcessor::considerForm(const AttributeList &atts, const AttributeList *linkAtts, const StringC &name, Boolean isNotation, unsigned thisSuppressFlags, unsigned &newSuppressFlags, Boolean &inhibitCache, unsigned &arcFormIndex) { arcFormIndex = invalidAtt; if ((thisSuppressFlags & suppressForm) && (supportAtts_[rArcSuprF].size() == 0 || (thisSuppressFlags & suppressSupr) || isNotation)) return 0; unsigned tem; const AttributeValue *val; if (linkAtts && linkAtts->attributeIndex(supportAtts_[rArcFormA], tem)) val = linkAtts->value(tem); else if (atts.attributeIndex(supportAtts_[rArcFormA], arcFormIndex)) { if (atts.current(arcFormIndex) || atts.specified(arcFormIndex)) inhibitCache = 1; val = atts.value(arcFormIndex); } else return autoForm(atts, name, isNotation, thisSuppressFlags, newSuppressFlags, inhibitCache, arcFormIndex); if (!val) return 0; const Text *textP = val->text(); if (!textP) return 0; StringC metaName; metaName = textP->string(); metaSyntax_->generalSubstTable()->subst(metaName); if (!isNotation) { const Attributed *metaAttributed = metaDtd_->lookupElementType(metaName); if (!metaAttributed) metaAttributed = lookupCreateUndefinedElement(metaName, Location(), *metaDtd_); if (metaName == supportAtts_[rArcSuprF]) { newSuppressFlags |= suppressForm; return metaAttributed; } if (thisSuppressFlags & suppressForm) return 0; return metaAttributed; } else return metaDtd_->lookupNotation(metaName).pointer(); } const Attributed * ArcProcessor::autoForm(const AttributeList &atts, const StringC &name, Boolean isNotation, unsigned thisSuppressFlags, unsigned &newSuppressFlags, Boolean &inhibitCache, unsigned &idIndex) { if (!isNotation) { const Attributed *metaAttributed; if (openElementFlags_.size() == 0) { metaAttributed = metaDtd_->documentElementType(); inhibitCache = 1; } else { metaAttributed = 0; if (arcAuto_) metaAttributed = metaDtd_->lookupElementType(name); if (!metaAttributed && supportAtts_[rArcBridF].size() > 0 && atts.idIndex(idIndex) && atts.specified(idIndex)) { inhibitCache = 1; metaAttributed = metaDtd_->lookupElementType(supportAtts_[rArcBridF]); } } if (metaAttributed && name == supportAtts_[rArcSuprF]) { newSuppressFlags = suppressForm|ignoreData; } else if (thisSuppressFlags & suppressForm) return 0; return metaAttributed; } else if (thisSuppressFlags & suppressForm) return 0; else { const Attributed *metaAttributed = 0; if (arcAuto_) metaAttributed = metaDtd_->lookupNotation(name).pointer(); if (!metaAttributed && supportAtts_[rArcDataF].size() > 0) metaAttributed = metaDtd_->lookupNotation(supportAtts_[rArcDataF]).pointer(); return metaAttributed; } } const Text * ArcProcessor::considerNamer(const AttributeList &atts, Boolean &inhibitCache, unsigned &arcNamerIndex) { arcNamerIndex = invalidAtt; if (supportAtts_[rArcNamrA].size() == 0 || !atts.attributeIndex(supportAtts_[rArcNamrA], arcNamerIndex)) return 0; if (atts.current(arcNamerIndex) || atts.specified(arcNamerIndex)) inhibitCache = 1; const AttributeValue *val = atts.value(arcNamerIndex); if (!val) return 0; return val->text(); } void ArcProcessor::buildAttributeMapRename(MetaMap &map, const Text &rename, const AttributeList &atts, const AttributeList *linkAtts, Vector &attRenamed, Vector &attSubstituted, Boolean isNotation) { Vector tokens; Vector tokensPos; split(rename, docSyntax_->space(), tokens, tokensPos); ConstPtr metaAttDef; if (map.attributed) metaAttDef = map.attributed->attributeDef(); for (size_t i = 0; i < tokens.size(); i += 2) { unsigned fromIndex = invalidAtt; unsigned toIndex = invalidAtt; metaSyntax_->generalSubstTable()->subst(tokens[i]); if (!isNotation && tokens[i] == rniArcCont_) { if (attRenamed[0]) { setNextLocation(rename.charLocation(tokensPos[i])); Messenger::message(ArcEngineMessages::arcContDuplicate); } else toIndex = contentPseudoAtt; } else if (metaAttDef.isNull() || !metaAttDef->attributeIndex(tokens[i], toIndex)) { setNextLocation(rename.charLocation(tokensPos[i])); Messenger::message(ArcEngineMessages::renameToInvalid, StringMessageArg(tokens[i])); } else if (attRenamed[toIndex + 1]) { toIndex = invalidAtt; setNextLocation(rename.charLocation(tokensPos[i])); Messenger::message(ArcEngineMessages::renameToDuplicate, StringMessageArg(tokens[i])); } if (i + 1 >= tokens.size()) { setNextLocation(rename.charLocation(tokensPos[i])); Messenger::message(ArcEngineMessages::renameMissingAttName); } else { docSyntax_->generalSubstTable()->subst(tokens[i + 1]); if (!isNotation && tokens[i + 1] == rniContent_) { if (toIndex == contentPseudoAtt) { setNextLocation(rename.charLocation(tokensPos[i + 1])); Messenger::message(ArcEngineMessages::arcContInvalid, StringMessageArg(tokens[i + 1])); } else if (attSubstituted[0]) { setNextLocation(rename.charLocation(tokensPos[i + 1])); Messenger::message(ArcEngineMessages::contentDuplicate); } else fromIndex = contentPseudoAtt; } else if (tokens[i + 1] == rniDefault_) { if (toIndex == contentPseudoAtt) { setNextLocation(rename.charLocation(tokensPos[i + 1])); Messenger::message(ArcEngineMessages::arcContInvalid, StringMessageArg(tokens[i + 1])); } else if (toIndex != invalidAtt) attRenamed[toIndex + 1] = 1; } else if (linkAtts && linkAtts->attributeIndex(tokens[i + 1], fromIndex)) { fromIndex += atts.size(); if (attSubstituted[fromIndex + 1]) { fromIndex = invalidAtt; setNextLocation(rename.charLocation(tokensPos[i + 1])); Messenger::message(ArcEngineMessages::renameFromDuplicate, StringMessageArg(tokens[i + 1])); } } else if (!atts.attributeIndex(tokens[i + 1], fromIndex)) { setNextLocation(rename.charLocation(tokensPos[i + 1])); Messenger::message(ArcEngineMessages::renameFromInvalid, StringMessageArg(tokens[i + 1])); } else if (attSubstituted[fromIndex + 1]) { fromIndex = invalidAtt; setNextLocation(rename.charLocation(tokensPos[i + 1])); Messenger::message(ArcEngineMessages::renameFromDuplicate, StringMessageArg(tokens[i + 1])); } } if (fromIndex != invalidAtt && toIndex != invalidAtt) { map.attMapFrom.push_back(fromIndex); map.attMapTo.push_back(toIndex); attRenamed[toIndex + 1] = 1; attSubstituted[fromIndex + 1] = 1; if (toIndex != contentPseudoAtt) { if (metaAttDef->def(toIndex)->isId() && (fromIndex >= atts.size() || !atts.id(fromIndex))) Messenger::message(ArcEngineMessages::idMismatch, StringMessageArg(metaAttDef->def(toIndex) ->name())); for (;i + 4 < tokens.size(); i += 3) { docSyntax_->generalSubstTable()->subst(tokens[i + 2]); if (tokens[i + 2] != rniMaptoken_) break; map.tokenMapTo.push_back(tokens[i + 3]); map.tokenMapFrom.push_back(tokens[i + 4]); } } map.attTokenMapBase.push_back(map.tokenMapFrom.size()); } } } void ArcProcessor::buildAttributeMapRest(MetaMap &map, const AttributeList &atts, const AttributeList *linkAtts, const Vector &attRenamed) { ConstPtr metaAttDef = map.attributed->attributeDef(); if (metaAttDef.isNull()) return; for (unsigned i = 0; i < metaAttDef->size(); i++) if (!attRenamed[i + 1]) { unsigned fromIndex; if (metaAttDef->def(i)->isId()) { for (unsigned j = 0; j < atts.size(); j++) if (atts.id(j)) { map.attMapFrom.push_back(j); map.attMapTo.push_back(i); map.attTokenMapBase.push_back(map.tokenMapFrom.size()); break; } } else if (linkAtts && linkAtts->attributeIndex(metaAttDef->def(i)->name(), fromIndex)) { map.attMapFrom.push_back(fromIndex + atts.size()); map.attMapTo.push_back(i); map.attTokenMapBase.push_back(map.tokenMapFrom.size()); } else if (atts.attributeIndex(metaAttDef->def(i)->name(), fromIndex)) { map.attMapFrom.push_back(fromIndex); map.attMapTo.push_back(i); map.attTokenMapBase.push_back(map.tokenMapFrom.size()); } } } Boolean ArcProcessor::matchName(const StringC &name, const char *key) { if (name.size() != strlen(key)) return 0; StringC tem(docSd_->execToInternal(key)); docSyntax_->generalSubstTable()->subst(tem); return name == tem; } void ArcProcessor::split(const Text &text, Char space, Vector &tokens, Vector &tokensPos) { const StringC &str = text.string(); for (size_t i = 0;;) { for (; i < str.size() && str[i] == space; i++) ; if (i >= str.size()) break; size_t start = i; for (; i < str.size() && str[i] != space; i++) ; tokens.push_back(StringC(str.data() + start, i - start)); tokensPos.push_back(start); } } void ArcProcessor::processEndElement(const EndElementEvent &event, Allocator &alloc) { Boolean wasArc = (openElementFlags_.back() & isArc); openElementFlags_.resize(openElementFlags_.size() - 1); if (wasArc) { EndElementEvent *genEvent = new (alloc) EndElementEvent(currentElement().type(), metaDtd_, event.location(), 0); if (currentElement().included()) genEvent->setIncluded(); docHandler_->endElement(genEvent); if (!currentElement().isFinished()) Messenger::message(ArcEngineMessages::unfinishedElement, StringMessageArg(currentElement().type()->name())); popElement(); } } void ArcProcessor::dispatchMessage(Message &msg) { mgr_->dispatchMessage(msg); } void ArcProcessor::dispatchMessage(const Message &msg) { mgr_->dispatchMessage(msg); } void ArcProcessor::initMessage(Message &msg) { mgr_->initMessage(msg); if (valid_) { StringC rniPcdata = metaSyntax_->delimGeneral(Syntax::dRNI); rniPcdata += metaSyntax_->reservedName(Syntax::rPCDATA); getOpenElementInfo(msg.openElementInfo, rniPcdata); } } ArcProcessor::MetaMapCache::MetaMapCache() { for (int i = 0; i < nNoSpec; i++) noSpec[i] = invalidAtt; linkAtts = 0; } void ArcProcessor::MetaMapCache::clear() { for (int i = 0; i < nNoSpec; i++) noSpec[i] = invalidAtt; linkAtts = 0; map.clear(); } ArcProcessor::MetaMap::MetaMap() : attributed(0) { attTokenMapBase.push_back(0); } void ArcProcessor::MetaMap::clear() { attMapFrom.clear(); attMapTo.clear(); attTokenMapBase.clear(); tokenMapFrom.clear(); tokenMapTo.clear(); attributed = 0; attTokenMapBase.push_back(0); } }