1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

nsgmls: remove nsgmls and use onsgmls contained in OpenSP.

This commit is contained in:
Liang Chang 2022-01-13 08:21:30 +08:00
parent e93b2bc626
commit 075c5db58b
304 changed files with 0 additions and 69945 deletions

View file

@ -1,127 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: Allocator.C /main/1 1996/07/29 16:45:56 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#include "splib.h"
#include "Allocator.h"
#include "macros.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
Allocator::Allocator(size_t maxSize, unsigned blocksPerSegment)
: objectSize_(maxSize),
blocksPerSegment_(blocksPerSegment),
freeList_(0),
segments_(0)
{
}
Allocator::~Allocator()
{
SegmentHeader *p = segments_;
while (p) {
SegmentHeader *tem = p->next;
if (p->liveCount == 0)
::operator delete(p);
else
p->freeList = 0;
p = tem;
}
}
void *Allocator::alloc(size_t sz)
{
if (sz > objectSize_)
tooBig(sz);
Block *tem = freeList_;
if (tem) {
tem->header.seg->liveCount += 1;
freeList_ = tem->next;
return &(tem->next);
}
else
return alloc1();
}
void *Allocator::allocSimple(size_t sz)
{
BlockHeader *p = (BlockHeader *)::operator new(sz + sizeof(BlockHeader));
p->seg = 0;
return p + 1;
}
void Allocator::free(void *p)
{
BlockHeader *b = ((BlockHeader *)p) - 1;
SegmentHeader *seg = b->seg;
if (seg == 0)
::operator delete(b);
else {
Block **freeList = seg->freeList;
if (freeList == 0) {
seg->liveCount -= 1;
if (seg->liveCount == 0)
::operator delete(seg);
}
else {
((Block *)b)->next = *freeList;
*freeList = (Block *)b;
seg->liveCount -= 1;
}
}
}
void *Allocator::alloc1()
{
SegmentHeader *seg
= (SegmentHeader *)::operator new(sizeof(SegmentHeader)
+ ((objectSize_ + sizeof(BlockHeader))
* blocksPerSegment_));
seg->next = segments_;
segments_ = seg;
seg->liveCount = 1;
seg->freeList = &freeList_;
char *p = (char *)(seg + 1);
Block *head = 0;
for (size_t n = blocksPerSegment_; n > 0; n--) {
((Block *)p)->next = head;
((Block *)p)->header.seg = seg;
head = (Block *)p;
p += sizeof(BlockHeader) + objectSize_;
}
freeList_ = head->next;
return &(head->next);
}
void Allocator::tooBig(size_t sz)
{
ASSERT(sz <= objectSize_);
}
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,90 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: Allocator.h /main/1 1996/07/29 16:46:04 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef Allocator_INCLUDED
#define Allocator_INCLUDED 1
#include <stddef.h>
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class SP_API Allocator {
public:
Allocator(size_t maxSize, unsigned blocksPerSegment);
~Allocator();
void *alloc(size_t);
static void *allocSimple(size_t);
static void free(void *);
// It would be nice to make these private, but some compilers have problems.
union ForceAlign {
unsigned long n;
struct SP_API {
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 SP_API Block {
BlockHeader header;
Block *next;
};
friend struct SegmentHeader;
struct SP_API SegmentHeader {
union {
Block **freeList;
ForceAlign align;
};
unsigned liveCount;
SegmentHeader *next;
};
private:
Allocator(const Allocator &); // undefined
Allocator &operator=(const Allocator &); // undefined
Block *freeList_;
size_t objectSize_;
unsigned blocksPerSegment_;
SegmentHeader *segments_;
void *alloc1();
void tooBig(size_t);
};
#ifdef SP_NAMESPACE
}
#endif
#endif /* not Allocator_INCLUDED */

File diff suppressed because it is too large Load diff

View file

@ -1,78 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: ArcEngine.h /main/1 1996/07/29 16:46:15 cde-hp $ */
// Copyright (c) 1996 James Clark
// See the file COPYING for copying permission.
#ifndef ArcEngine_INCLUDED
#define ArcEngine_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include "Event.h"
#include "Vector.h"
#include "SgmlParser.h"
#include <stddef.h>
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class SP_API ArcDirector {
public:
virtual EventHandler *arcEventHandler(const Notation *,
const Vector<StringC> &,
const SubstTable<Char> *) = 0;
};
class SP_API SelectOneArcDirector : public ArcDirector, public Messenger {
public:
SelectOneArcDirector(const Vector<StringC> &select, EventHandler &eh)
: select_(select), eh_(&eh) { }
EventHandler *arcEventHandler(const Notation *,
const Vector<StringC> &,
const SubstTable<Char> *);
void dispatchMessage(const Message &);
void dispatchMessage(Message &);
private:
Vector<StringC> select_;
EventHandler *eh_;
};
class SP_API ArcEngine {
public:
static void parseAll(SgmlParser &,
Messenger &,
ArcDirector &,
SP_CONST SP_VOLATILE sig_atomic_t *cancelPtr = 0);
private:
ArcEngine();
};
#ifdef SP_NAMESPACE
}
#endif
#endif /* not ArcEngine_INCLUDED */

View file

@ -1,427 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: ArcEngineMessages.h /main/1 1996/07/29 16:46:22 cde-hp $ */
// This file was automatically generated from ArcEngineMessages.msg by msggen.pl.
#include "Message.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
struct ArcEngineMessages {
// 3000
static const MessageType1 arcGenerateSystemId;
// 3001
static const MessageType1 undefinedElement;
// 3002
static const MessageType1 elementExcluded;
// 3003
static const MessageType1 invalidElement;
// 3004
static const MessageType1 documentElementNotArc;
// 3005
static const MessageType1 unfinishedElement;
// 3006
static const MessageType0 renameMissingAttName;
// 3007
static const MessageType1 renameToInvalid;
// 3008
static const MessageType1 renameToDuplicate;
// 3009
static const MessageType1 renameFromInvalid;
// 3010
static const MessageType1 missingId;
// 3011
static const MessageType0 invalidArcContent;
// 3012
static const MessageType1 invalidSuppress;
// 3013
static const MessageType1 arcDtdNotDeclared;
// 3014
static const MessageType1 arcDtdNotExternal;
// 3015
static const MessageType0 noArcDTDAtt;
// 3016
static const MessageType1 noArcDataF;
// 3017
static const MessageType1 idMismatch;
// 3018
static const MessageType1 invalidArcAuto;
// 3019
static const MessageType1 noArcNotation;
// 3020
static const MessageType0 invalidData;
// 3021
static const MessageType1 invalidIgnD;
// 3022
static const MessageType1 invalidArcIndr;
// 3023
static const MessageType1 invalidQuantity;
// 3024
static const MessageType1 missingQuantityValue;
// 3025
static const MessageType1 quantityValueTooLong;
// 3026
static const MessageType1 invalidDigit;
// 3027
static const MessageType0 arcIndrNotSupported;
};
const MessageType1 ArcEngineMessages::arcGenerateSystemId(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
3000
#ifndef SP_NO_MESSAGE_TEXT
,"no system identifier could be generated for meta-DTD for architecture %1"
#endif
);
const MessageType1 ArcEngineMessages::undefinedElement(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
3001
#ifndef SP_NO_MESSAGE_TEXT
,"element type %1 not defined in meta-DTD"
#endif
);
const MessageType1 ArcEngineMessages::elementExcluded(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
3002
#ifndef SP_NO_MESSAGE_TEXT
,"element %1 invalid in meta-DTD because excluded"
#endif
);
const MessageType1 ArcEngineMessages::invalidElement(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
3003
#ifndef SP_NO_MESSAGE_TEXT
,"meta-DTD does not allow element %1 at this point"
#endif
);
const MessageType1 ArcEngineMessages::documentElementNotArc(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
3004
#ifndef SP_NO_MESSAGE_TEXT
,"document element must be instance of %1 element type form"
#endif
);
const MessageType1 ArcEngineMessages::unfinishedElement(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
3005
#ifndef SP_NO_MESSAGE_TEXT
,"element %1 unfinished in meta-DTD"
#endif
);
const MessageType0 ArcEngineMessages::renameMissingAttName(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
3006
#ifndef SP_NO_MESSAGE_TEXT
,"missing substitute name"
#endif
);
const MessageType1 ArcEngineMessages::renameToInvalid(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
3007
#ifndef SP_NO_MESSAGE_TEXT
,"substitute for non-existent architecture attribute %1"
#endif
);
const MessageType1 ArcEngineMessages::renameToDuplicate(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
3008
#ifndef SP_NO_MESSAGE_TEXT
,"substitute name for %1 already defined"
#endif
);
const MessageType1 ArcEngineMessages::renameFromInvalid(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
3009
#ifndef SP_NO_MESSAGE_TEXT
,"substitute name %1 is not the name of an attribute"
#endif
);
const MessageType1 ArcEngineMessages::missingId(
MessageType::idrefError,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
3010
#ifndef SP_NO_MESSAGE_TEXT
,"reference in architecture to non-existent ID %1"
#endif
);
const MessageType0 ArcEngineMessages::invalidArcContent(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
3011
#ifndef SP_NO_MESSAGE_TEXT
,"architectural content specified with #ARCCONT not allowed by meta-DTD"
#endif
);
const MessageType1 ArcEngineMessages::invalidSuppress(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
3012
#ifndef SP_NO_MESSAGE_TEXT
,"invalid value %1 for ArcSupr attribute"
#endif
);
const MessageType1 ArcEngineMessages::arcDtdNotDeclared(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
3013
#ifndef SP_NO_MESSAGE_TEXT
,"no declaration for meta-DTD parameter entity %1"
#endif
);
const MessageType1 ArcEngineMessages::arcDtdNotExternal(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
3014
#ifndef SP_NO_MESSAGE_TEXT
,"meta-DTD entity %1 must be external"
#endif
);
const MessageType0 ArcEngineMessages::noArcDTDAtt(
MessageType::warning,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
3015
#ifndef SP_NO_MESSAGE_TEXT
,"no ArcDTD architecture support attribute specified"
#endif
);
const MessageType1 ArcEngineMessages::noArcDataF(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
3016
#ifndef SP_NO_MESSAGE_TEXT
,"ArcDataF notation %1 not defined in meta-DTD"
#endif
);
const MessageType1 ArcEngineMessages::idMismatch(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
3017
#ifndef SP_NO_MESSAGE_TEXT
,"ID attribute %1 in meta-DTD not declared as ID in DTD"
#endif
);
const MessageType1 ArcEngineMessages::invalidArcAuto(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
3018
#ifndef SP_NO_MESSAGE_TEXT
,"invalid value %1 for ArcAuto architectural support attribute"
#endif
);
const MessageType1 ArcEngineMessages::noArcNotation(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
3019
#ifndef SP_NO_MESSAGE_TEXT
,"no notation declaration for architecture %1"
#endif
);
const MessageType0 ArcEngineMessages::invalidData(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
3020
#ifndef SP_NO_MESSAGE_TEXT
,"meta-DTD does not allow data at this point"
#endif
);
const MessageType1 ArcEngineMessages::invalidIgnD(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
3021
#ifndef SP_NO_MESSAGE_TEXT
,"invalid value %1 for ArcIgnD attribute"
#endif
);
const MessageType1 ArcEngineMessages::invalidArcIndr(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
3022
#ifndef SP_NO_MESSAGE_TEXT
,"invalid value %1 for ArcIndr architectural support attribute"
#endif
);
const MessageType1 ArcEngineMessages::invalidQuantity(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
3023
#ifndef SP_NO_MESSAGE_TEXT
,"unrecognized quantity name %1"
#endif
);
const MessageType1 ArcEngineMessages::missingQuantityValue(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
3024
#ifndef SP_NO_MESSAGE_TEXT
,"no value specified for quantity %1"
#endif
);
const MessageType1 ArcEngineMessages::quantityValueTooLong(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
3025
#ifndef SP_NO_MESSAGE_TEXT
,"length of value %1 for quantity is too long"
#endif
);
const MessageType1 ArcEngineMessages::invalidDigit(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
3026
#ifndef SP_NO_MESSAGE_TEXT
,"invalid digit %1"
#endif
);
const MessageType0 ArcEngineMessages::arcIndrNotSupported(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
3027
#ifndef SP_NO_MESSAGE_TEXT
,"only value of nArcIndr for ArcIndr attribute supported"
#endif
);
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,239 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: ArcProcessor.h /main/1 1996/07/29 16:46:28 cde-hp $ */
// Copyright (c) 1996 James Clark
// See the file COPYING for copying permission.
#ifndef ArcProcessor_INCLUDED
#define ArcProcessor_INCLUDED 1
#include "Event.h"
#include "ContentState.h"
#include "Id.h"
#include "NamedTable.h"
#include "Vector.h"
#include "ArcEngine.h"
#include "SgmlParser.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class Allocator;
// Processor for a single architecture
class ArcProcessor : private ContentState, private AttributeContext {
public:
struct MetaMap {
MetaMap();
void clear();
const Attributed *attributed;
unsigned suppressFlags;
// #ARCCONT and #CONTENT are handled with a special index
// list of indexes into element's attlist of architectural attributes
Vector<unsigned> attMapFrom;
// corresponding list of indexes in form's attlist
Vector<unsigned> attMapTo;
};
struct MetaMapCache {
MetaMapCache();
void clear();
MetaMap map;
enum { nNoSpec = 4 };
// Prerequisites for this cached entry to be valid.
// The cache is only valid if for each member of noSpec != -1
// the attribute with that index was not specified (or current)
unsigned noSpec[nNoSpec];
unsigned suppressFlags;
const AttributeList *linkAtts;
};
ArcProcessor();
void setName(const StringC &);
void init(const EndPrologEvent &,
const ConstPtr<Sd> &,
const ConstPtr<Syntax> &,
const SgmlParser *parser,
Messenger *,
const Vector<StringC> &superName,
ArcDirector &director,
SP_CONST SP_VOLATILE sig_atomic_t *cancelPtr);
// Return 0 if the content is needed, but wasn't supplied
Boolean processStartElement(const StartElementEvent &,
const AttributeList *linkAttributes,
const Text *content,
Allocator &);
void processEndElement(const EndElementEvent &,
Allocator &);
// Return true if its architectural.
Boolean processData();
const ConstPtr<Dtd> &dtdPointer() const { return metaDtd_; }
Boolean valid() const { return valid_; }
void checkIdrefs();
const StringC &name() const { return name_; }
EventHandler &docHandler() const { return *docHandler_; }
private:
ArcProcessor(const ArcProcessor &); // undefined
void operator=(const ArcProcessor &); // undefined
const Syntax &attributeSyntax() const;
ConstPtr<Notation> getAttributeNotation(const StringC &,
const Location &);
ConstPtr<Entity> getAttributeEntity(const StringC &,
const Location &);
void noteCurrentAttribute(size_t, AttributeValue *);
ConstPtr<AttributeValue> 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<PackedBoolean> &attRenamed);
void buildAttributeMapRest(MetaMap &map,
const AttributeList &atts,
const AttributeList *linkAtts,
const Vector<PackedBoolean> &attRenamed);
Boolean matchName(const StringC &name, const char *key);
void split(const Text &text,
Char space,
Vector<StringC> &tokens,
Vector<size_t> &tokenPos);
Boolean mapAttributes(const AttributeList &from,
const AttributeList *fromLink,
const Text *content,
AttributeList &to,
ConstPtr<AttributeValue> &arcContent,
const MetaMap &map);
void initNotationSet(const Location &loc);
const Attributed *considerNotation(const AttributeList &atts,
unsigned thisSuppressFlags,
Boolean &inhibitCache,
unsigned &notAttIndex);
void supportAttributes(const AttributeList &);
void processArcOpts(const AttributeList &atts);
void processArcQuant(const Text &);
ConstPtr<Entity> 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<Dtd> docDtd_;
ConstPtr<Dtd> metaDtd_;
ConstPtr<Syntax> docSyntax_;
ConstPtr<Syntax> metaSyntax_;
ConstPtr<Sd> docSd_;
enum ReservedName {
rArcFormA,
rArcNamrA,
rArcSuprA,
rArcIgnDA,
rArcDocF,
rArcSuprF,
rArcBridF,
rArcDataF,
rArcAuto,
rArcIndr,
rArcDTD,
rArcQuant
};
enum { nReserve = rArcQuant + 1 };
StringC supportAtts_[nReserve];
Boolean arcDtdIsParam_;
Boolean arcAuto_;
Vector<StringC> arcOpts_;
StringC rniContent_;
StringC rniArcCont_;
StringC rniDefault_;
enum {
isArc = 01,
suppressForm = 02,
suppressSupr = 04,
ignoreData = 010,
condIgnoreData = 020,
// recovering from invalid data
recoverData = 040
};
Vector<unsigned> openElementFlags_;
AttributeList attributeList_;
NCVector<Owner<struct MetaMapCache> > metaMapCache_;
MetaMap noCacheMetaMap_;
NamedTable<Id> idTable_;
Vector<ConstPtr<AttributeValue> > currentAttributes_;
ConstPtr<Notation> defaultNotation_;
Boolean errorIdref_;
Boolean notationSetArch_;
ArcDirector *director_;
EventHandler *docHandler_;
Owner<EventHandler> ownEventHandler_;
size_t docIndex_;
};
#ifdef SP_NAMESPACE
}
#endif
#endif /* not ArcProcessor_INCLUDED */

File diff suppressed because it is too large Load diff

View file

@ -1,903 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: Attribute.h /main/1 1996/07/29 16:46:39 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef Attribute_INCLUDED
#define Attribute_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include <stddef.h>
#include "Resource.h"
#include "Owner.h"
#include "StringC.h"
#include "Vector.h"
#include "CopyOwner.h"
#include "Boolean.h"
#include "Text.h"
#include "Ptr.h"
#include "Message.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class Entity;
class Notation;
class DeclaredValue;
class AttributeValue;
class TokenizedAttributeValue;
class AttributeSemantics;
class AttributeContext;
class Syntax;
class SP_API 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<AttributeValue> defaultValue;
Vector<StringC> allowedValues;
// Attribute definitions whose default value type is current and
// which have the same currentIndex share current values.
size_t currentIndex;
private:
AttributeDefinitionDesc(const AttributeDefinitionDesc &); // undefined
void operator=(const AttributeDefinitionDesc &); // undefined
};
class DeclaredValue {
public:
DeclaredValue();
virtual ~DeclaredValue();
// This performs syntactic checking on the value.
virtual AttributeValue *makeValue(Text &, AttributeContext &,
const StringC &name,
unsigned &specLength) const = 0;
// This is used to avoid unnecessary syntactic checking in the
// case where the attribute name and vi have been omitted.
virtual AttributeValue *makeValueFromToken(Text &,
AttributeContext &,
const StringC &name,
unsigned &specLength) const;
// This performs semantic checking on the value.
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<StringC> *getTokens() 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;
};
class TokenizedDeclaredValue : public DeclaredValue {
public:
// must be in same order as AttributeDefinitionDesc
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<StringC> &);
Boolean containsToken(const StringC &) const;
AttributeValue *makeValue(Text &, AttributeContext &, const StringC &,
unsigned &) const;
AttributeValue *makeValueFromToken(Text &,
AttributeContext &,
const StringC &name,
unsigned &) const;
const Vector<StringC> *getTokens() const;
void buildDesc(AttributeDefinitionDesc &) const;
DeclaredValue *copy() const;
private:
Vector<StringC> allowedValues_;
};
class NameTokenGroupDeclaredValue : public GroupDeclaredValue {
public:
NameTokenGroupDeclaredValue(Vector<StringC> &);
void buildDesc(AttributeDefinitionDesc &) const;
DeclaredValue *copy() const;
};
class NotationDeclaredValue : public GroupDeclaredValue {
public:
NotationDeclaredValue(Vector<StringC> &);
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 SP_API AttributeDefinition {
public:
AttributeDefinition(const StringC &, DeclaredValue *);
virtual ~AttributeDefinition();
virtual ConstPtr<AttributeValue>
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;
Boolean containsToken(const StringC &) const;
Boolean isNotation() const;
Boolean isEntity() const;
Boolean isId() const;
Boolean isIdref() const;
void getDesc(AttributeDefinitionDesc &) const;
const Vector<StringC> *getTokens() const;
virtual AttributeDefinition *copy() const = 0;
void setDeclaredValue(DeclaredValue *);
private:
virtual void buildDesc(AttributeDefinitionDesc &) const = 0;
virtual AttributeValue *checkValue(AttributeValue *, AttributeContext &) const;
StringC name_;
CopyOwner<DeclaredValue> declaredValue_;
};
class RequiredAttributeDefinition : public AttributeDefinition {
public:
RequiredAttributeDefinition(const StringC &, DeclaredValue *);
ConstPtr<AttributeValue> makeMissingValue(AttributeContext &) const;
void buildDesc(AttributeDefinitionDesc &) const;
AttributeDefinition *copy() const;
};
class CurrentAttributeDefinition : public AttributeDefinition {
public:
CurrentAttributeDefinition(const StringC &, DeclaredValue *, size_t index);
ConstPtr<AttributeValue> 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<AttributeValue> 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<AttributeValue> 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<AttributeValue> value_;
};
class FixedAttributeDefinition : public DefaultAttributeDefinition {
public:
FixedAttributeDefinition(const StringC &, DeclaredValue *,
AttributeValue *);
// check that it's equal to the default
AttributeValue *checkValue(AttributeValue *, AttributeContext &) const;
void buildDesc(AttributeDefinitionDesc &) const;
Boolean isFixed() const;
AttributeDefinition *copy() const;
};
class SP_API AttributeDefinitionList : public Resource {
public:
AttributeDefinitionList(Vector<CopyOwner<AttributeDefinition> > &,
size_t listIndex,
Boolean anyCurrent = 0,
size_t idIndex = size_t(-1),
size_t notationIndex = size_t(-1));
size_t size() const;
AttributeDefinition *def(size_t);
const AttributeDefinition *def(size_t) const;
Boolean tokenIndex(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 append(AttributeDefinition *);
private:
Vector<CopyOwner<AttributeDefinition> > defs_;
size_t index_;
size_t idIndex_; // -1 if no ID attribute
size_t notationIndex_; // -1 if no notation attribute
Boolean anyCurrent_;
};
class AttributeSemantics {
public:
AttributeSemantics();
virtual ~AttributeSemantics();
virtual size_t nEntities() const;
virtual ConstPtr<Entity> entity(size_t) const;
virtual ConstPtr<Notation> notation() const;
virtual AttributeSemantics *copy() const = 0;
};
class EntityAttributeSemantics : public AttributeSemantics {
public:
EntityAttributeSemantics(Vector<ConstPtr<Entity> > &);
size_t nEntities() const;
ConstPtr<Entity> entity(size_t) const;
AttributeSemantics *copy() const;
private:
Vector<ConstPtr<Entity> > entity_;
};
class NotationAttributeSemantics : public AttributeSemantics {
public:
NotationAttributeSemantics(const ConstPtr<Notation> &);
ConstPtr<Notation> notation() const;
AttributeSemantics *copy() const;
private:
ConstPtr<Notation> notation_;
};
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 SP_API 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 &);
private:
Text text_;
};
class TokenizedAttributeValue : public AttributeValue {
public:
TokenizedAttributeValue(Text &, const Vector<size_t> &);
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 recoverUnquoted(const StringC &, const Location &,
AttributeContext &, const StringC &);
private:
TokenizedAttributeValue(const TokenizedAttributeValue &); // undefined
void operator=(const TokenizedAttributeValue &); // undefined
Text text_;
// index into value of each space
// length is number of tokens - 1
Vector<size_t> spaceIndex_;
};
class SP_API Attribute {
public:
Attribute();
Boolean specified() const;
size_t specIndex() const;
const AttributeValue *value() const;
const ConstPtr<AttributeValue> &valuePointer() const;
const AttributeSemantics *semantics() const;
void setSpec(size_t);
void setValue(const ConstPtr<AttributeValue> &);
void setSemantics(AttributeSemantics *);
void clear();
private:
size_t specIndexPlus_;
ConstPtr<AttributeValue> value_;
CopyOwner<AttributeSemantics> semantics_;
};
class SP_API AttributeList {
public:
AttributeList();
AttributeList(const ConstPtr<AttributeDefinitionList> &);
void init(const ConstPtr<AttributeDefinitionList> &);
// was a conref attribute specified?
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<AttributeValue> &valuePointer(unsigned) const;
const AttributeSemantics *semantics(unsigned) const;
Boolean tokenized(unsigned index) const;
Boolean tokenIndex(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;
// is the attribute #current
Boolean current(unsigned) const;
Boolean anyCurrent() const;
Boolean specified(unsigned) const;
Boolean id(unsigned) const;
Boolean idref(unsigned) const;
const Vector<StringC> *getAllowedTokens(unsigned) const;
const StringC *getId() const; // null if none
Boolean idIndex(unsigned &) const;
void noteInvalidSpec();
private:
const AttributeDefinition *def(size_t) const;
PackedBoolean conref_;
unsigned nIdrefs_;
unsigned nEntityNames_;
size_t nSpec_;
Vector<Attribute> vec_;
ConstPtr<AttributeDefinitionList> def_;
};
class SP_API 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<AttributeValue> getCurrentAttribute(size_t) const;
virtual ConstPtr<Entity> getAttributeEntity(const StringC &,
const Location &);
virtual ConstPtr<Notation> getAttributeNotation(const StringC &,
const Location &);
virtual const Syntax &attributeSyntax() const = 0;
ConstPtr<AttributeValue> makeImpliedAttributeValue();
Boolean mayDefaultAttribute() const;
protected:
Boolean mayDefaultAttribute_;
private:
ConstPtr<AttributeValue> 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<StringC> *AttributeDefinition::getTokens() const
{
return declaredValue_->getTokens();
}
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
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
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
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<AttributeValue> &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<AttributeValue> &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
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::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<StringC> *AttributeList::getAllowedTokens(unsigned i) const
{
return def(i)->getTokens();
}
inline
const AttributeValue *AttributeList::value(unsigned i) const
{
return vec_[i].value();
}
inline
const ConstPtr<AttributeValue> &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_;
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not Attribute_INCLUDED */

View file

@ -1,80 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: Attributed.h /main/1 1996/07/29 16:46:44 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef Attributed_INCLUDED
#define Attributed_INCLUDED 1
#include "Ptr.h"
#include "Attribute.h"
// This is used for things that have attribute definitions
// that notations and elements.
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class SP_API Attributed {
public:
Attributed() { }
ConstPtr<AttributeDefinitionList> attributeDef() const;
const AttributeDefinitionList *attributeDefTemp() const;
Ptr<AttributeDefinitionList> attributeDef();
void setAttributeDef(const Ptr<AttributeDefinitionList> &);
private:
Ptr<AttributeDefinitionList> attributeDef_;
};
inline
ConstPtr<AttributeDefinitionList> Attributed::attributeDef() const
{
return attributeDef_;
}
inline
const AttributeDefinitionList *Attributed::attributeDefTemp() const
{
return attributeDef_.pointer();
}
inline
Ptr<AttributeDefinitionList> Attributed::attributeDef()
{
return attributeDef_;
}
inline
void Attributed::setAttributeDef(const Ptr<AttributeDefinitionList> &def)
{
attributeDef_ = def;
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not Attributed_INCLUDED */

View file

@ -1,59 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: Boolean.h /main/1 1996/07/29 16:46:49 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef Boolean_INCLUDED
#define Boolean_INCLUDED 1
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
#ifdef SP_HAVE_BOOL
typedef bool Boolean;
typedef char PackedBoolean;
#else /* not SP_HAVE_BOOL */
typedef int Boolean;
typedef char PackedBoolean;
#endif /* not SP_HAVE_BOOL */
#ifdef SP_NAMESPACE
}
#endif
#ifndef SP_HAVE_BOOL
typedef int bool;
const int true = 1;
const int false = 0;
#endif /* not SP_HAVE_BOOL */
#endif /* not Boolean_INCLUDED */

View file

@ -1,25 +0,0 @@
Copyright (c) 1994, 1995, 1996 James Clark
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
``Software''), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL JAMES CLARK BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of James Clark shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from James Clark.

View file

@ -1,50 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: CatalogEntry.h /main/1 1996/07/29 16:46:56 cde-hp $ */
// Copyright (c) 1994, 1995 James Clark
// See the file COPYING for copying permission.
#ifndef CatalogEntry_INCLUDED
#define CatalogEntry_INCLUDED 1
#include "Location.h"
#include "StringC.h"
#include <stddef.h>
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
struct CatalogEntry {
StringC to;
Location loc;
size_t catalogNumber;
size_t baseNumber;
size_t serial;
};
#ifdef SP_NAMESPACE
}
#endif
#endif /* not CatalogEntry_INCLUDED */

View file

@ -1,203 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: CatalogMessages.h /main/1 1996/07/29 16:47:02 cde-hp $ */
// This file was automatically generated from CatalogMessages.msg by msggen.pl.
#include "Message.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
struct CatalogMessages {
// 2100
static const MessageType0 nameExpected;
// 2101
static const MessageType0 literalExpected;
// 2102
static const MessageType0 nameOrLiteralExpected;
// 2103
static const MessageType0 nulChar;
// 2104
static const MessageType0 minimumData;
// 2105
static const MessageType0 eofInComment;
// 2106
static const MessageType0 eofInLiteral;
// 2107
static const MessageType0 overrideYesOrNo;
// 2108
static const MessageType0 inLoop;
// 2109
static const MessageType0 systemShouldQuote;
// 2110
static const MessageType1 noDocumentEntry;
// 2111
static const MessageType2 noPublicEntry;
};
const MessageType0 CatalogMessages::nameExpected(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2100
#ifndef SP_NO_MESSAGE_TEXT
,"name expected"
#endif
);
const MessageType0 CatalogMessages::literalExpected(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2101
#ifndef SP_NO_MESSAGE_TEXT
,"literal expected"
#endif
);
const MessageType0 CatalogMessages::nameOrLiteralExpected(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2102
#ifndef SP_NO_MESSAGE_TEXT
,"name or literal expected"
#endif
);
const MessageType0 CatalogMessages::nulChar(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2103
#ifndef SP_NO_MESSAGE_TEXT
,"nul character"
#endif
);
const MessageType0 CatalogMessages::minimumData(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2104
#ifndef SP_NO_MESSAGE_TEXT
,"not a minimum data character"
#endif
);
const MessageType0 CatalogMessages::eofInComment(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2105
#ifndef SP_NO_MESSAGE_TEXT
,"end of entity in comment"
#endif
);
const MessageType0 CatalogMessages::eofInLiteral(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2106
#ifndef SP_NO_MESSAGE_TEXT
,"end of entity in literal"
#endif
);
const MessageType0 CatalogMessages::overrideYesOrNo(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2107
#ifndef SP_NO_MESSAGE_TEXT
,"OVERRIDE requires argument of YES or NO"
#endif
);
const MessageType0 CatalogMessages::inLoop(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2108
#ifndef SP_NO_MESSAGE_TEXT
,"CATALOG entries cause loop"
#endif
);
const MessageType0 CatalogMessages::systemShouldQuote(
MessageType::warning,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2109
#ifndef SP_NO_MESSAGE_TEXT
,"second argument for SYSTEM entry should be quoted to avoid ambiguity"
#endif
);
const MessageType1 CatalogMessages::noDocumentEntry(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2110
#ifndef SP_NO_MESSAGE_TEXT
,"no DOCUMENT entry in catalog %1"
#endif
);
const MessageType2 CatalogMessages::noPublicEntry(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2111
#ifndef SP_NO_MESSAGE_TEXT
,"no entry for public identifier %1 in catalog %2"
#endif
);
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,293 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: CharsetDecl.C /main/1 1996/07/29 16:47:07 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifdef __GNUG__
#pragma implementation
#endif
#include "splib.h"
#include "CharsetDecl.h"
#include "macros.h"
#include "ISet.h"
#include "constant.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
CharsetDeclRange::CharsetDeclRange()
: descMin_(0),
count_(0),
type_(unused),
baseMin_(0)
{
}
CharsetDeclRange::CharsetDeclRange(WideChar descMin, Number count,
WideChar baseMin)
: descMin_(descMin),
count_(count),
type_(number),
baseMin_(baseMin)
{
}
CharsetDeclRange::CharsetDeclRange(WideChar descMin, Number count)
: descMin_(descMin),
count_(count),
type_(unused),
baseMin_(0)
{
}
CharsetDeclRange::CharsetDeclRange(WideChar descMin, Number count,
const StringC &str)
: descMin_(descMin),
count_(count),
type_(string),
str_(str),
baseMin_(0)
{
}
void CharsetDeclRange::rangeDeclared(WideChar min, Number count,
ISet<WideChar> &declared) const
{
if (count > 0 && min + count > descMin_ && min < descMin_ + count_) {
WideChar commMin = (descMin_ > min) ? descMin_ : min;
WideChar commMax = min + ((min + count < descMin_ + count_
? count
: descMin_ + count_ - min) - 1);
ASSERT(commMin <= commMax);
declared.addRange(commMin, commMax);
}
}
void CharsetDeclRange::usedSet(ISet<Char> &set) const
{
if (type_ != unused && count_ > 0 && descMin_ <= charMax) {
Char max;
if (charMax - descMin_ < count_ - 1)
max = charMax;
else
max = Char(descMin_ + (count_ - 1));
set.addRange(Char(descMin_), max);
}
}
void CharsetDeclRange::stringToChar(const StringC &str, ISet<WideChar> &to)
const
{
if (type_ == string && str_ == str && count_ > 0)
to.addRange(descMin_, descMin_ + (count_ - 1));
}
void CharsetDeclRange::numberToChar(Number n, ISet<WideChar> &to,
Number &count)
const
{
if (type_ == number && n >= baseMin_ && n - baseMin_ < count_) {
Number thisCount = count_ - (n - baseMin_);
if (to.isEmpty() || thisCount < count)
count = thisCount;
to.add(descMin_ + (n - baseMin_));
}
}
Boolean CharsetDeclRange::getCharInfo(WideChar fromChar,
CharsetDeclRange::Type &type,
Number &n,
StringC &str,
Number &count) const
{
if (fromChar >= descMin_ && fromChar - descMin_ < count_) {
type = type_;
if (type == number)
n = baseMin_ + (fromChar - descMin_);
else if (type == string)
str = str_;
count = count_ - (fromChar - descMin_);
return 1;
}
else
return 0;
}
CharsetDeclSection::CharsetDeclSection()
{
}
void CharsetDeclSection::setPublicId(const PublicId &id)
{
baseset_ = id;
}
void CharsetDeclSection::addRange(const CharsetDeclRange &range)
{
ranges_.push_back(range);
}
void CharsetDeclSection::rangeDeclared(WideChar min, Number count,
ISet<WideChar> &declared) const
{
for (size_t i = 0; i < ranges_.size(); i++)
ranges_[i].rangeDeclared(min, count, declared);
}
void CharsetDeclSection::usedSet(ISet<Char> &set) const
{
for (size_t i = 0; i < ranges_.size(); i++)
ranges_[i].usedSet(set);
}
void CharsetDeclSection::stringToChar(const StringC &str, ISet<WideChar> &to)
const
{
for (size_t i = 0; i < ranges_.size(); i++)
ranges_[i].stringToChar(str, to);
}
void CharsetDeclSection::numberToChar(const PublicId *id, Number n,
ISet<WideChar> &to, Number &count) const
{
PublicId::OwnerType ownerType;
StringC seq1, seq2;
if (id->string() == baseset_.string()
// Assume that 2 ISO character sets are the same if
// their designating sequences are the same.
|| (id->getOwnerType(ownerType)
&& ownerType == PublicId::ISO
&& baseset_.getOwnerType(ownerType)
&& ownerType == PublicId::ISO
&& id->getDesignatingSequence(seq1)
&& baseset_.getDesignatingSequence(seq2)
&& seq1 == seq2)) {
for (size_t i = 0; i < ranges_.size(); i++)
ranges_[i].numberToChar(n, to, count);
}
}
Boolean CharsetDeclSection::getCharInfo(WideChar fromChar,
const PublicId *&id,
CharsetDeclRange::Type &type,
Number &n,
StringC &str,
Number &count) const
{
for (size_t i = 0; i < ranges_.size(); i++)
if (ranges_[i].getCharInfo(fromChar, type, n, str, count)) {
id = &baseset_;
return 1;
}
return 0;
}
CharsetDecl::CharsetDecl()
{
}
void CharsetDecl::addSection(const PublicId &id)
{
sections_.resize(sections_.size() + 1);
sections_.back().setPublicId(id);
}
void CharsetDecl::swap(CharsetDecl &to)
{
sections_.swap(to.sections_);
declaredSet_.swap(to.declaredSet_);
}
void CharsetDecl::clear()
{
sections_.clear();
}
void CharsetDecl::addRange(WideChar min, Number count, WideChar baseMin)
{
if (count > 0)
declaredSet_.addRange(min, min + (count - 1));
CharsetDeclRange range(min, count, baseMin);
sections_.back().addRange(range);
}
void CharsetDecl::addRange(WideChar min, Number count)
{
if (count > 0)
declaredSet_.addRange(min, min + (count - 1));
CharsetDeclRange range(min, count);
sections_.back().addRange(range);
}
void CharsetDecl::addRange(WideChar min, Number count, const StringC &str)
{
if (count > 0)
declaredSet_.addRange(min, min + (count - 1));
CharsetDeclRange range(min, count, str);
sections_.back().addRange(range);
}
void CharsetDecl::rangeDeclared(WideChar min, Number count,
ISet<WideChar> &declared) const
{
for (size_t i = 0; i < sections_.size(); i++)
sections_[i].rangeDeclared(min, count, declared);
}
void CharsetDecl::usedSet(ISet<Char> &set) const
{
for (size_t i = 0; i < sections_.size(); i++)
sections_[i].usedSet(set);
}
Boolean CharsetDecl::getCharInfo(WideChar fromChar,
const PublicId *&id,
CharsetDeclRange::Type &type,
Number &n,
StringC &str,
Number &count) const
{
for (size_t i = 0; i < sections_.size(); i++)
if (sections_[i].getCharInfo(fromChar, id, type, n, str, count))
return 1;
return 0;
}
void CharsetDecl::stringToChar(const StringC &str, ISet<WideChar> &to) const
{
for (size_t i = 0; i < sections_.size(); i++)
sections_[i].stringToChar(str, to);
}
void CharsetDecl::numberToChar(const PublicId *id, Number n,
ISet<WideChar> &to, Number &count) const
{
for (size_t i = 0; i < sections_.size(); i++)
sections_[i].numberToChar(id, n, to, count);
}
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,163 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: CharsetDecl.h /main/1 1996/07/29 16:47:13 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef CharsetDecl_INCLUDED
#define CharsetDecl_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include "types.h"
#include "Vector.h"
#include "ExternalId.h"
#include "ISet.h"
#include "Boolean.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class SP_API 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<WideChar> &declared) const;
void usedSet(ISet<Char> &) const;
Boolean getCharInfo(WideChar fromChar,
CharsetDeclRange::Type &type,
Number &n,
StringC &str,
Number &count) const;
void stringToChar(const StringC &str, ISet<WideChar> &to) const;
void numberToChar(Number n, ISet<WideChar> &to, Number &count) const;
private:
WideChar descMin_;
Number count_;
WideChar baseMin_;
Type type_;
StringC str_;
};
class SP_API CharsetDeclSection {
public:
CharsetDeclSection();
void setPublicId(const PublicId &);
void addRange(const CharsetDeclRange &);
void rangeDeclared(WideChar min, Number count,
ISet<WideChar> &declared) const;
void usedSet(ISet<Char> &) const;
Boolean getCharInfo(WideChar fromChar,
const PublicId *&id,
CharsetDeclRange::Type &type,
Number &n,
StringC &str,
Number &cout) const;
void stringToChar(const StringC &str, ISet<WideChar> &to) const;
void numberToChar(const PublicId *id, Number n,
ISet<WideChar> &to, Number &count) const;
private:
PublicId baseset_;
Vector<CharsetDeclRange> ranges_;
};
class SP_API CharsetDecl {
public:
CharsetDecl();
void addSection(const PublicId &);
void swap(CharsetDecl &);
void clear();
void usedSet(ISet<Char> &) const;
void declaredSet(ISet<WideChar> &set) const;
Boolean charDeclared(WideChar) const;
void rangeDeclared(WideChar min, Number count,
ISet<WideChar> &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<WideChar> &to) const;
void numberToChar(const PublicId *id, Number n,
ISet<WideChar> &to, Number &count) const;
void numberToChar(const PublicId *id, Number n, ISet<WideChar> &to) const;
private:
Vector<CharsetDeclSection> sections_;
ISet<WideChar> 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<WideChar> &to) const
{
Number tem;
numberToChar(id, n, to, tem);
}
inline
void CharsetDecl::declaredSet(ISet<WideChar> &set) const
{
set = declaredSet_;
}
inline
Boolean CharsetDecl::charDeclared(WideChar c) const
{
return declaredSet_.contains(c);
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not CharsetDecl_INCLUDED */

View file

@ -1,156 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: CharsetInfo.C /main/1 1996/07/29 16:47:17 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifdef __GNUG__
#pragma implementation
#endif
#include "splib.h"
#include "CharsetInfo.h"
#include "ISet.h"
#include "constant.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
CharsetInfo::CharsetInfo(const UnivCharsetDesc &desc)
: desc_(desc)
{
// FIXME remove mappings from desc for characters greater charMax
init();
}
CharsetInfo::CharsetInfo()
{
for (size_t i = 0; i < nSmall; i++) {
smallUnivValid_[i] = 0;
smallDescValid_[i] = 0;
}
}
void CharsetInfo::set(const UnivCharsetDesc &desc)
{
desc_ = desc;
init();
}
void CharsetInfo::init()
{
size_t i;
for (i = 0; i < nSmall; i++) {
smallUnivValid_[i] = 0;
smallDescValid_[i] = 0;
}
UnivCharsetDescIter iter(desc_);
WideChar descMin, descMax;
UnivChar univMin;
while (iter.next(descMin, descMax, univMin)) {
WideChar j = descMin;
do {
UnivChar k = univMin + (j - descMin);
if (k >= nSmall)
break;
if (!smallUnivValid_[k]) {
smallUnivValid_[k] = 1;
smallUnivToDesc_[k] = j;
}
else
smallUnivValid_[k] = 2;
} while (j++ != descMax);
j = descMin;
do {
if (j >= nSmall)
break;
if (!smallDescValid_[j]) {
smallDescValid_[j] = 1;
smallDescToUniv_[j] = univMin + (j - descMin);
}
} while (j++ != descMax);
}
// These are the characters that the ANSI C
// standard guarantees will be in the basic execution
// character set.
static char execChars[] =
"\t\n\r "
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789"
"!\"#%&'()*+,-./:"
";<=>?[\\]^_{|}~";
// These are the corresponding ISO 646 codes.
static char univCodes[] = {
9, 10, 13, 32,
65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
33, 34, 35, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 58,
59, 60, 61, 62, 63, 91, 92, 93, 94, 95, 123, 124, 125, 126,
};
for (i = 0; execChars[i] != '\0'; i++) {
WideChar c;
ISet<WideChar> set;
if (univToDesc(univCodes[i], c, set) > 0 && c <= Char(-1))
execToDesc_[(unsigned char)execChars[i]] = Char(c);
}
}
void CharsetInfo::getDescSet(ISet<Char> &set) const
{
UnivCharsetDescIter iter(desc_);
WideChar descMin, descMax;
UnivChar univMin;
while (iter.next(descMin, descMax, univMin)) {
if (descMin > charMax)
break;
if (descMax > charMax)
descMax = charMax;
set.addRange(Char(descMin), Char(descMax));
}
}
int CharsetInfo::digitWeight(Char c) const
{
for (int i = 0; i < 10; i++)
if (c == execToDesc('0' + i))
return i;
return -1;
}
StringC CharsetInfo::execToDesc(const char *s) const
{
StringC result;
while (*s != '\0')
result += execToDesc(*s++);
return result;
}
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,142 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: CharsetInfo.h /main/1 1996/07/29 16:47:24 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef CharsetInfo_INCLUDED
#define CharsetInfo_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include <limits.h>
#include "UnivCharsetDesc.h"
#include "Boolean.h"
#include "types.h"
#include "StringC.h"
#include "ISet.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class SP_API CharsetInfo {
public:
CharsetInfo();
CharsetInfo(const UnivCharsetDesc &);
void set(const UnivCharsetDesc &);
// Use only for characters guaranteed to me in the C basic execution
// character set and which have been verified to be in this
// character set.
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;
// Return 0 for no matches, 1 for 1, 2 for more than 1
// to gets the first character; toSet gets all the characters
// if there's more than 1.
unsigned univToDesc(UnivChar from, WideChar &to, ISet<WideChar> &toSet)
const;
unsigned univToDesc(UnivChar from, WideChar &to, ISet<WideChar> &toSet,
WideChar &count)
const;
void getDescSet(ISet<Char> &) const;
int digitWeight(Char) const;
const UnivCharsetDesc &desc() const;
private:
void init();
UnivCharsetDesc desc_;
enum { nSmall = 128 };
// 0 for no matches, 1 for 1, 2 for more than 1
unsigned smallUnivValid_[nSmall];
WideChar smallUnivToDesc_[nSmall];
PackedBoolean smallDescValid_[nSmall];
UnivChar smallDescToUniv_[nSmall];
Char execToDesc_[UCHAR_MAX + 1];
};
inline
unsigned CharsetInfo::univToDesc(UnivChar from, WideChar &to,
ISet<WideChar> &toSet)
const
{
if (from < nSmall && smallUnivValid_[from] <= 1) {
if (smallUnivValid_[from]) {
to = smallUnivToDesc_[from];
return 1;
}
else
return 0;
}
else
return desc_.univToDesc(from, to, toSet);
}
inline
Boolean CharsetInfo::descToUniv(UnivChar from, WideChar &to) const
{
if (from < nSmall) {
if (smallDescValid_[from]) {
to = smallDescToUniv_[from];
return 1;
}
else
return 0;
}
else
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
unsigned CharsetInfo::univToDesc(UnivChar from, WideChar &to,
ISet<WideChar> &toSet, WideChar &count)
const
{
return desc_.univToDesc(from, to, toSet, count);
}
inline
const UnivCharsetDesc &CharsetInfo::desc() const
{
return desc_;
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not CharsetInfo_INCLUDED */

View file

@ -1,105 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: CharsetRegistry.C /main/1 1996/07/29 16:47:29 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifdef __GNUG__
#pragma implementation
#endif
#include "splib.h"
#include "CharsetRegistry.h"
#include "ExternalId.h"
#include "CharsetInfo.h"
#include "UnivCharsetDesc.h"
#include "StringC.h"
#include "types.h"
#include "macros.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
static UnivCharsetDesc::Range iso646_irv[] = {
{ 0, 128, 0 }
};
static UnivCharsetDesc::Range iso646_C0[] = {
{ 0, 32, 0 },
{ 127, 1, 127 },
};
static struct {
const char *sequence;
const UnivCharsetDesc::Range *ranges;
size_t nRanges;
} table[] = {
{ "ESC 2/5 4/0", iso646_irv, SIZEOF(iso646_irv) },
{ "ESC 2/8 4/0", iso646_irv, SIZEOF(iso646_irv) },
{ "ESC 2/8 4/2", iso646_irv, SIZEOF(iso646_irv) }, // ASCII
{ "ESC 2/1 4/0", iso646_C0, SIZEOF(iso646_C0) },
};
Boolean CharsetRegistry::findCharset(const PublicId &id,
const CharsetInfo &charset,
UnivCharsetDesc &desc)
{
PublicId::OwnerType ownerType;
if (!id.getOwnerType(ownerType) || ownerType != PublicId::ISO)
return 0;
StringC sequence;
if (!id.getDesignatingSequence(sequence))
return 0;
// Canonicalize the escape sequence by mapping esc -> ESC,
// removing leading zeros from escape sequences, and removing
// initial spaces.
StringC s;
size_t i;
for (i = 0; i < sequence.size(); i++) {
Char c = sequence[i];
if (c == charset.execToDesc('e'))
s += charset.execToDesc('E');
else if (c == charset.execToDesc('s'))
s += charset.execToDesc('S');
else if (c == charset.execToDesc('c'))
s += charset.execToDesc('C');
else if (charset.digitWeight(c) >= 0
&& s.size() > 0
&& s[s.size() - 1] == charset.execToDesc('0')
&& (s.size() == 1
|| charset.digitWeight(s[s.size() - 2]) >= 0))
s[s.size() - 1] = c;
else if (c != charset.execToDesc(' ') || s.size() > 0)
s += c;
}
for (i = 0; i < SIZEOF(table); i++)
if (s == charset.execToDesc(table[i].sequence)) {
desc.set(table[i].ranges, table[i].nRanges);
return 1;
}
return 0;
}
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,55 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: CharsetRegistry.h /main/1 1996/07/29 16:47:35 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef CharsetRegistry_INCLUDED
#define CharsetRegistry_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include "Boolean.h"
#include "types.h"
#include "StringC.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class PublicId;
class CharsetInfo;
class UnivCharsetDesc;
class CharsetRegistry {
public:
static Boolean findCharset(const PublicId &, const CharsetInfo &,
UnivCharsetDesc &);
};
#ifdef SP_NAMESPACE
}
#endif
#endif /* not CharsetRegistry_INCLUDED */

View file

@ -1,467 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: CmdLineApp.C /main/2 1996/08/12 12:36:14 mgreess $ */
// Copyright (c) 1996 James Clark
// See the file COPYING for copying permission.
// Need option registration method that allows derived class to change
// option names.
#ifdef __GNUG__
#pragma implementation
#endif
#include "splib.h"
#include "CmdLineApp.h"
#include "CmdLineAppMessages.h"
#include "MessageArg.h"
#include "ErrnoMessageArg.h"
#include "Options.h"
#include "version.h"
#include "xnew.h"
#include "macros.h"
#include "sptchar.h"
#include "MessageTable.h"
#ifdef SP_MULTI_BYTE
#include "UTF8CodingSystem.h"
#include "Fixed2CodingSystem.h"
#include "UnicodeCodingSystem.h"
#include "EUCJPCodingSystem.h"
#include "SJISCodingSystem.h"
#include "ISO8859InputCodingSystem.h"
#ifdef WIN32
#include "Win32CodingSystem.h"
#endif
#endif /* SP_MULTI_BYTE */
#include "IdentityCodingSystem.h"
#include "ConsoleOutput.h"
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
#include <iostream>
#include <fstream>
using namespace std;
#else
#include <iostream.h>
#include <fstream.h>
#endif
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#ifdef SP_HAVE_LOCALE
#include <locale.h>
#endif
#ifdef SP_HAVE_SETMODE
#include <fcntl.h>
#include <io.h>
#endif
#ifdef SP_HAVE_SETMODE
#define IOS_BINARY ios::binary
#else
#define IOS_BINARY 0
#endif
#ifdef SP_WIDE_SYSTEM
#include <stdio.h>
#else /* not SP_WIDE_SYSTEM */
#include <sys/types.h>
#ifdef SP_INCLUDE_UNISTD_H
#include <unistd.h>
#endif
#ifdef SP_INCLUDE_IO_H
#include <io.h>
#endif
#endif /* not SP_WIDE_SYSTEM */
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
#ifdef SP_MULTI_BYTE
static UTF8CodingSystem utf8CodingSystem;
static Fixed2CodingSystem fixed2CodingSystem;
static UnicodeCodingSystem unicodeCodingSystem;
static EUCJPCodingSystem eucjpCodingSystem;
static SJISCodingSystem sjisCodingSystem;
#ifdef WIN32
static Win32CodingSystem ansiCodingSystem(Win32CodingSystem::codePageAnsi);
static Win32CodingSystem oemCodingSystem(Win32CodingSystem::codePageOEM);
static UnicodeCodingSystem maybeUnicodeCodingSystem(&ansiCodingSystem);
#endif
#endif /* SP_MULTI_BYTE */
static IdentityCodingSystem identityCodingSystem;
static struct {
const char *name;
const CodingSystem *cs;
} codingSystems[] = {
#ifdef SP_MULTI_BYTE
{ "UTF-8", &utf8CodingSystem },
{ "FIXED-2", &fixed2CodingSystem },
{ "UNICODE", &unicodeCodingSystem },
{ "EUC-JP", &eucjpCodingSystem },
{ "SJIS", &sjisCodingSystem },
#ifdef WIN32
{ "WINDOWS", &ansiCodingSystem },
{ "MS-DOS", &oemCodingSystem },
{ "WUNICODE", &maybeUnicodeCodingSystem },
#endif
#endif /* SP_MULTI_BYTE */
{ "IS8859-1", &identityCodingSystem },
{ "IDENTITY", &identityCodingSystem },
};
const CodingSystem *CmdLineApp::codingSystem_ = 0;
static const SP_TCHAR *progName = 0;
static const SP_TCHAR versionString[] = SP_VERSION;
CmdLineApp::CmdLineApp()
: errorFile_(0),
outputCodingSystem_(0),
// Colon at beginning is Posix.2ism that says to return : rather than ? for
// missing option argument.
optstr_(SP_T(":"), 1),
MessageReporter(makeStdErr())
{
registerOption('b', SP_T("bctf"));
registerOption('f', SP_T("error_file"));
registerOption('v');
}
void CmdLineApp::registerOption(AppChar c, const AppChar *argName)
{
optstr_ += c;
if (argName) {
optstr_ += SP_T(':');
optArgNames_.push_back(argName);
}
}
StringC CmdLineApp::usageString()
{
String<AppChar> result;
size_t i;
if (progName)
result.assign(progName, tcslen(progName));
PackedBoolean hadOption[128];
for (i = 0; i < 128; i++)
hadOption[i] = 0;
Boolean hadNoArgOption = 0;
for (i = 1; i < optstr_.size(); i++) {
if (optstr_[i] == 0)
break;
if (i + 1 < optstr_.size() && optstr_[i + 1] == ':')
i++;
else if (!hadOption[optstr_[i]]) {
hadOption[optstr_[i]] = 1;
if (!hadNoArgOption) {
hadNoArgOption = 1;
result.append(SP_T(" [-"), 3);
}
result += optstr_[i];
}
}
if (hadNoArgOption)
result += SP_T(']');
size_t j = 0;
for (i = 1; i < optstr_.size(); i++) {
if (i + 1 < optstr_.size() && optstr_[i + 1] == ':') {
if (!hadOption[optstr_[i]]) {
hadOption[optstr_[i]] = 1;
result += SP_T(' ');
result += SP_T('[');
result += SP_T('-');
result += optstr_[i];
result += SP_T(' ');
result.append(optArgNames_[j], tcslen(optArgNames_[j]));
result += SP_T(']');
}
i++;
j++;
}
}
result.append(SP_T(" sysid..."), tcslen(SP_T(" sysid...")));
result += 0;
return convertInput(result.data());
}
static
void ewrite(const AppChar *s)
{
#ifdef SP_WIDE_SYSTEM
fputts(s, stderr);
#else
int n = (int)strlen(s);
while (n > 0) {
int nw = write(2, s, n);
if (nw < 0)
break;
n -= nw;
s += nw;
}
#endif
}
static
#ifdef SP_FANCY_NEW_HANDLER
int outOfMemory(size_t)
#else
void outOfMemory()
#endif
{
if (progName) {
ewrite(progName);
ewrite(SP_T(": "));
}
ewrite(SP_T(": out of memory\n"));
exit(1);
#ifdef SP_FANCY_NEW_HANDLER
return 0;
#endif
}
int CmdLineApp::init(int, AppChar **argv)
{
set_new_handler(outOfMemory);
#ifdef SP_HAVE_LOCALE
setlocale(LC_ALL, "");
#endif
#ifdef SP_HAVE_SETMODE
_setmode(1, _O_BINARY);
_setmode(2, _O_BINARY);
#endif
progName = argv[0];
if (progName)
setProgramName(convertInput(progName));
#ifdef __GNUG__
// cout is a performance disaster in libg++ unless we do this.
ios::sync_with_stdio(0);
#endif
return 0;
}
int CmdLineApp::run(int argc, AppChar **argv)
{
int ret = init(argc, argv);
if (ret)
return ret;
int firstArg;
ret = processOptions(argc, argv, firstArg);
if (ret)
return ret;
ret = processArguments(argc - firstArg, argv + firstArg);
progName = 0;
return ret;
}
Boolean CmdLineApp::openFilebufWrite(filebuf &file,
const AppChar *filename)
{
#ifdef SP_WIDE_SYSTEM
int fd = _wopen(filename, _O_CREAT|_O_WRONLY|_O_TRUNC|_O_BINARY);
if (fd < 0)
return 0;
return file.attach(fd) != 0;
#else
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
return file.open(filename, ios::out|ios::trunc) != 0;
#else
return file.open(filename, ios::out|ios::trunc|IOS_BINARY) != 0;
#endif
#endif
}
int CmdLineApp::processOptions(int argc, AppChar **argv, int &nextArg)
{
AppChar ostr[2];
optstr_ += SP_T('\0');
Options<AppChar> options(argc, argv, optstr_.data());
AppChar opt;
while (options.get(opt)) {
switch (opt) {
case ':':
ostr[0] = options.opt();
ostr[1] = SP_T('\0');
message(CmdLineAppMessages::missingOptionArgError,
StringMessageArg(convertInput(ostr)));
message(CmdLineAppMessages::usage,
StringMessageArg(usageString()));
return 1;
case '?':
ostr[0] = options.opt();
ostr[1] = SP_T('\0');
message(CmdLineAppMessages::invalidOptionError,
StringMessageArg(convertInput(ostr)));
message(CmdLineAppMessages::usage,
StringMessageArg(usageString()));
return 1;
default:
processOption(opt, options.arg());
break;
}
}
nextArg = options.ind();
if (errorFile_) {
static filebuf file;
if (!openFilebufWrite(file, errorFile_)) {
message(CmdLineAppMessages::cannotOpenOutputError,
StringMessageArg(convertInput(errorFile_)),
ErrnoMessageArg(errno));
return 1;
}
setMessageStream(new IosOutputCharStream(&file, codingSystem()));
}
if (!outputCodingSystem_)
outputCodingSystem_ = codingSystem();
return 0;
}
void CmdLineApp::processOption(AppChar opt, const AppChar *arg)
{
switch (opt) {
case 'b':
outputCodingSystem_ = lookupCodingSystem(arg);
if (!outputCodingSystem_)
message(CmdLineAppMessages::unknownBctf,
StringMessageArg(convertInput(arg)));
break;
case 'f':
errorFile_ = arg;
break;
case 'v':
// print the version number
message(CmdLineAppMessages::versionInfo,
StringMessageArg(convertInput(versionString)));
break;
default:
CANNOT_HAPPEN();
}
}
Boolean CmdLineApp::getMessageText(const MessageFragment &frag,
StringC &text)
{
String<SP_TCHAR> str;
if (!MessageTable::instance()->getText(frag, str))
return 0;
#ifdef SP_WIDE_SYSTEM
text.assign((const Char *)str.data(), str.size());
#else
str += 0;
text = codingSystem()->convertIn(str.data());
#endif
return 1;
}
const CodingSystem *CmdLineApp::codingSystem()
{
if (!codingSystem_) {
const SP_TCHAR *codingName = tgetenv(SP_T("SP_BCTF"));
if (codingName)
codingSystem_ = lookupCodingSystem(codingName);
if (!codingSystem_
#ifndef SP_WIDE_SYSTEM
|| codingSystem_->fixedBytesPerChar() > 1
#endif
)
codingSystem_ = &identityCodingSystem;
}
return codingSystem_;
}
const CodingSystem *
CmdLineApp::lookupCodingSystem(const SP_TCHAR *codingName)
{
#define MAX_CS_NAME 50
if (tcslen(codingName) < MAX_CS_NAME) {
char buf[MAX_CS_NAME];
int i;
for (i = 0; codingName[i] != SP_T('\0'); i++) {
SP_TUCHAR c = totupper((SP_TUCHAR)(codingName[i]));
#ifdef SP_WIDE_SYSTEM
if (c > (unsigned char)-1)
return 0;
#endif
buf[i] = char(c);
}
buf[i] = SP_T('\0');
{
for (size_t i = 0; i < SIZEOF(codingSystems); i++)
if (strcmp(buf, codingSystems[i].name) == 0)
return codingSystems[i].cs;
}
}
return 0;
}
const CodingSystem *
CmdLineApp::codingSystem(size_t i, const char *&name)
{
if (i < SIZEOF(codingSystems)) {
name = codingSystems[i].name;
return codingSystems[i].cs;
}
return 0;
}
StringC CmdLineApp::convertInput(const SP_TCHAR *s)
{
#ifdef SP_WIDE_SYSTEM
StringC str(s, wcslen(s));
#else
StringC str(codingSystem()->convertIn(s));
#endif
for (size_t i = 0; i < str.size(); i++)
if (str[i] == '\n')
str[i] = '\r';
return str;
}
OutputCharStream *CmdLineApp::makeStdErr()
{
OutputCharStream *os = ConsoleOutput::makeOutputCharStream(2);
if (os)
return os;
return new IosOutputCharStream(cerr.rdbuf(), codingSystem());
}
OutputCharStream *CmdLineApp::makeStdOut()
{
OutputCharStream *os = ConsoleOutput::makeOutputCharStream(1);
if (os)
return os;
return new IosOutputCharStream(cout.rdbuf(), outputCodingSystem_);
}
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,102 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: CmdLineApp.h /main/1 1996/07/29 16:47:46 cde-hp $ */
// Copyright (c) 1996 James Clark
// See the file COPYING for copying permission.
#ifndef CmdLineApp_INCLUDED
#define CmdLineApp_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include "MessageReporter.h"
#include "Vector.h"
#include "StringOf.h"
#include "Boolean.h"
#include "CodingSystem.h"
#include "OutputCharStream.h"
#ifdef SP_WIDE_SYSTEM
// for wchar_t
#include <stddef.h>
#endif
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
#include <fstream>
using namespace std;
#else
class filebuf;
#endif
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class SP_API CmdLineApp : public MessageReporter {
public:
#ifdef SP_WIDE_SYSTEM
#define AppChar wchar_t
#else
#define AppChar char
#endif
CmdLineApp();
int run(int argc, AppChar **argv);
virtual int processOptions(int argc, AppChar **argv, int &nextArg);
virtual void processOption(AppChar opt, const AppChar *arg);
virtual int processArguments(int argc, AppChar **files) = 0;
static Boolean openFilebufWrite(filebuf &file, const AppChar *filename);
StringC usageString();
static const CodingSystem *codingSystem();
static const CodingSystem *lookupCodingSystem(const AppChar *);
static const CodingSystem *codingSystem(size_t, const char *&);
static StringC convertInput(const AppChar *s);
OutputCharStream *makeStdOut();
static OutputCharStream *makeStdErr();
protected:
virtual void registerOption(AppChar c, const AppChar *argName = 0);
virtual int init(int argc, AppChar **argv);
const AppChar *errorFile_;
const CodingSystem *outputCodingSystem_;
String<AppChar> optstr_;
Vector<const AppChar *> optArgNames_;
private:
Boolean getMessageText(const MessageFragment &, StringC &);
static const CodingSystem *codingSystem_;
};
#ifdef SP_WIDE_SYSTEM
#define SP_DEFINE_APP(CLASS) \
extern "C" \
wmain(int argc, wchar_t **argv) { CLASS app; return app.run(argc, argv); }
#else
#define SP_DEFINE_APP(CLASS) \
int main(int argc, char **argv) { CLASS app; return app.run(argc, argv); }
#endif
#ifdef SP_NAMESPACE
}
#endif
#endif /* not CmdLineApp_INCLUDED */

View file

@ -1,119 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: CmdLineAppMessages.h /main/1 1996/07/29 16:47:51 cde-hp $ */
// This file was automatically generated from CmdLineAppMessages.msg by msggen.pl.
#include "Message.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
struct CmdLineAppMessages {
// 4000
static const MessageType1 invalidOptionError;
// 4001
static const MessageType1 missingOptionArgError;
// 4002
static const MessageType1 usage;
// 4003
static const MessageType1 versionInfo;
// 4004
static const MessageType1 unknownBctf;
// 4005
static const MessageType2 cannotOpenOutputError;
};
const MessageType1 CmdLineAppMessages::invalidOptionError(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
4000
#ifndef SP_NO_MESSAGE_TEXT
,"invalid option %1"
#endif
);
const MessageType1 CmdLineAppMessages::missingOptionArgError(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
4001
#ifndef SP_NO_MESSAGE_TEXT
,"missing argument for option %1"
#endif
);
const MessageType1 CmdLineAppMessages::usage(
MessageType::info,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
4002
#ifndef SP_NO_MESSAGE_TEXT
,"usage is %1"
#endif
);
const MessageType1 CmdLineAppMessages::versionInfo(
MessageType::info,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
4003
#ifndef SP_NO_MESSAGE_TEXT
,"version %1"
#endif
);
const MessageType1 CmdLineAppMessages::unknownBctf(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
4004
#ifndef SP_NO_MESSAGE_TEXT
,"unknown BCTF %1"
#endif
);
const MessageType2 CmdLineAppMessages::cannotOpenOutputError(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
4005
#ifndef SP_NO_MESSAGE_TEXT
,"cannot open output file %1 (%2)"
#endif
);
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,135 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: CodingSystem.C /main/2 1996/08/08 12:10:51 mgreess $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifdef __GNUG__
#pragma implementation
#endif
#include "splib.h"
#include "CodingSystem.h"
#ifdef SP_SHORT_HEADERS
#include <strstrea.h>
#else
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
#include <strstream>
#else
#include <strstream.h>
#endif
#endif
#include <string.h>
#include <sys/param.h>
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
InputCodingSystem::~InputCodingSystem()
{
}
StringC InputCodingSystem::convertIn(const char *s) const
{
Decoder *decoder = makeDecoder();
StringC str;
str.resize(strlen(s));
str.resize(decoder->decode(&str[0], s, strlen(s), &s));
delete decoder;
return str;
}
Boolean InputCodingSystem::isIdentity() const
{
return 0;
}
OutputCodingSystem::~OutputCodingSystem()
{
}
unsigned OutputCodingSystem::fixedBytesPerChar() const
{
return 0;
}
String<char> OutputCodingSystem::convertOut(const StringC &str) const
{
Encoder *encoder = makeEncoder();
strstreambuf stream(MAXPATHLEN);
StringC copy(str);
encoder->output(copy.data(), copy.size(), &stream);
delete encoder;
char *s = stream.str();
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
String<char> result(s, stream.pcount());
#else
String<char> result(s, stream.out_waiting());
#endif
result += '\0';
stream.freeze(0);
#ifdef __lucid
// Workaround lcc bug (3.1p2 with -O -XF).
String<char> temp(result);
return temp;
#else
return result;
#endif
}
Decoder::Decoder(unsigned minBytesPerChar)
: minBytesPerChar_(minBytesPerChar)
{
}
Decoder::~Decoder()
{
}
Boolean Decoder::convertOffset(unsigned long &) const
{
return false;
}
Encoder::Encoder()
: unencodableHandler_(0)
{
}
Encoder::~Encoder()
{
}
void Encoder::output(Char *s, size_t n, streambuf *sp)
{
output((const Char *)s, n, sp);
}
void Encoder::startFile(streambuf *)
{
}
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,130 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: CodingSystem.h /main/1 1996/07/29 16:48:04 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef CodingSystem_INCLUDED
#define CodingSystem_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#ifndef SP_API
#define SP_API
#endif
#include "types.h"
#include "Boolean.h"
#include "StringC.h"
#include <stddef.h>
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
#include <streambuf>
using namespace std;
#else
class streambuf;
#endif
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class SP_API Decoder {
public:
Decoder(unsigned minBytesPerChar = 1);
virtual ~Decoder();
virtual size_t decode(Char *, const char *, size_t, const char **) = 0;
virtual Boolean convertOffset(unsigned long &offset) const;
// Decoder assumes that for every decoded Char there must be at least
// minBytesPerChar bytes
unsigned minBytesPerChar() const;
protected:
unsigned minBytesPerChar_;
};
class SP_API Encoder {
public:
class SP_API Handler {
public:
virtual void handleUnencodable(Char, streambuf *) = 0;
};
Encoder();
virtual ~Encoder();
virtual void output(const Char *, size_t, streambuf *) = 0;
// This outputs a byte order mark with Unicode.
virtual void startFile(streambuf *);
virtual void output(Char *, size_t, streambuf *);
void setUnencodableHandler(Handler *);
protected:
void handleUnencodable(Char, streambuf *);
private:
Handler *unencodableHandler_;
};
class SP_API InputCodingSystem {
public:
virtual ~InputCodingSystem();
virtual Decoder *makeDecoder() const = 0;
StringC convertIn(const char *) const;
virtual Boolean isIdentity() const;
};
class SP_API OutputCodingSystem {
public:
virtual ~OutputCodingSystem();
virtual Encoder *makeEncoder() const = 0;
virtual unsigned fixedBytesPerChar() const;
String<char> convertOut(const StringC &) const;
};
class SP_API CodingSystem : public InputCodingSystem, public OutputCodingSystem {
};
inline
unsigned Decoder::minBytesPerChar() const
{
return minBytesPerChar_;
}
inline
void Encoder::handleUnencodable(Char c, streambuf *sbufp)
{
if (unencodableHandler_)
unencodableHandler_->handleUnencodable(c, sbufp);
}
inline
void Encoder::setUnencodableHandler(Handler *handler)
{
unencodableHandler_ = handler;
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not CodingSystem_INCLUDED */

View file

@ -1,91 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: ConsoleOutput.C /main/1 1996/07/29 16:48:10 cde-hp $ */
// Copyright (c) 1996 James Clark
// See the file COPYING for copying permission.
#ifdef __GNUG__
#pragma implementation
#endif
#include "splib.h"
#include "ConsoleOutput.h"
#ifdef SP_WIDE_SYSTEM
#include <windows.h>
#include <io.h>
#endif
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
#ifdef SP_WIDE_SYSTEM
class ConsoleOutputCharStream : public OutputCharStream {
public:
ConsoleOutputCharStream(HANDLE h);
void flush();
void flushBuf(Char);
private:
HANDLE h_;
};
OutputCharStream *ConsoleOutput::makeOutputCharStream(int fd)
{
HANDLE h = (HANDLE)_get_osfhandle(fd);
DWORD flags;
if (GetConsoleMode(h, &flags))
return new ConsoleOutputCharStream(h);
else
return 0;
}
ConsoleOutputCharStream::ConsoleOutputCharStream(HANDLE h)
: h_(h)
{
}
void ConsoleOutputCharStream::flush()
{
}
void ConsoleOutputCharStream::flushBuf(Char c)
{
DWORD nWritten;
unsigned short ch = c;
WriteConsoleW(h_, &ch, 1, &nWritten, 0);
}
#else /* not SP_WIDE_SYSTEM */
OutputCharStream *ConsoleOutput::makeOutputCharStream(int)
{
return 0;
}
#endif /* not SP_WIDE_SYSTEM */
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,50 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: ConsoleOutput.h /main/1 1996/07/29 16:48:15 cde-hp $ */
// Copyright (c) 1996 James Clark
// See the file COPYING for copying permission.
#ifndef ConsoleOutput_INCLUDED
#define ConsoleOutput_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include "OutputCharStream.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class SP_API ConsoleOutput {
public:
// Returns null if fd is not a console.
static OutputCharStream *makeOutputCharStream(int fd);
};
#ifdef SP_NAMESPACE
}
#endif
#endif /* not ConsoleOutput_INCLUDED */

View file

@ -1,196 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: ContentState.C /main/1 1996/07/29 16:48:21 cde-hp $ */
// Copyright (c) 1994, 1996 James Clark
// See the file COPYING for copying permission.
#ifdef __GNUG__
#pragma implementation
#endif
#include "splib.h"
#include "ContentState.h"
#include "IListIter.h"
#include "NCVector.h"
#include "macros.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
const ShortReferenceMap ContentState::theEmptyMap;
#ifdef __GNUG__
typedef IListIter<OpenElement> Dummy_IListIter_OpenElement;
#endif
ContentState::ContentState()
: documentElementContainer_(StringC(), size_t(-1)),
totalExcludeCount_(0),
tagLevel_(0),
netEnablingCount_(0),
lastEndedElementType_(NULL)
{
}
void ContentState::startContent(const Dtd &dtd)
{
NCVector<Owner<ContentToken> > tokens(1);
tokens[0] = new ElementToken(dtd.documentElementType(),
ContentToken::none);
Owner<ModelGroup> model(new SeqModelGroup(tokens, ContentToken::none));
Owner<CompiledModelGroup> compiledModel(new CompiledModelGroup(model));
Vector<ContentModelAmbiguity> ambiguities;
Boolean pcdataUnreachable;
compiledModel->compile(dtd.nElementTypeIndex(), ambiguities,
pcdataUnreachable);
ASSERT(ambiguities.size() == 0);
ConstPtr<ElementDefinition> def
= new ElementDefinition(Location(),
0,
0,
ElementDefinition::modelGroup,
compiledModel);
documentElementContainer_.setElementDefinition(def, 0);
tagLevel_ = 0;
while (!openElements_.empty())
delete openElements_.get();
openElements_.insert(new OpenElement(&documentElementContainer_,
0,
0,
&theEmptyMap,
Location()));
includeCount_.assign(dtd.nElementTypeIndex(), 0);
excludeCount_.assign(dtd.nElementTypeIndex(), 0);
openElementCount_.assign(dtd.nElementTypeIndex(), 0);
netEnablingCount_ = 0;
totalExcludeCount_ = 0;
lastEndedElementType_ = 0;
undefinedElementTypeTable_.clear();
}
void ContentState::pushElement(OpenElement *e)
{
tagLevel_++;
openElementCount_[e->type()->index()]++;
const ElementDefinition *def = e->type()->definition();
if (def) {
size_t i;
for (i = 0; i < def->nInclusions(); i++)
includeCount_[def->inclusion(i)->index()]++;
for (i = 0; i < def->nExclusions(); i++) {
excludeCount_[def->exclusion(i)->index()]++;
totalExcludeCount_++;
}
}
if (e->netEnabling())
netEnablingCount_++;
openElements_.insert(e);
}
OpenElement *ContentState::popSaveElement()
{
ASSERT(tagLevel_ > 0);
OpenElement *e = openElements_.get();
tagLevel_--;
openElementCount_[e->type()->index()]--;
const ElementDefinition *def = e->type()->definition();
if (def) {
size_t i;
for (i = 0; i < def->nInclusions(); i++)
includeCount_[def->inclusion(i)->index()]--;
for (i = 0; i < def->nExclusions(); i++) {
excludeCount_[def->exclusion(i)->index()]--;
totalExcludeCount_--;
}
}
if (e->netEnabling())
netEnablingCount_--;
lastEndedElementType_ = e->type();
return e;
}
void ContentState::popElement()
{
delete popSaveElement();
}
Boolean ContentState::checkImplyLoop(unsigned count)
{
for (IListIter<OpenElement> iter(openElements_);
count > 0;
iter.next(), count--)
if (iter.cur()->type() == openElements_.head()->type()
// I'm not sure whether this is necessary.
&& iter.cur()->matchState() == openElements_.head()->matchState())
return 0;
return 1;
}
void ContentState::getOpenElementInfo(Vector<OpenElementInfo> &v,
const StringC &rniPcdata) const
{
v.clear();
v.resize(tagLevel_);
unsigned i = tagLevel_;
for (IListIter<OpenElement> iter(openElements_);
!iter.done() && i > 0;
iter.next()) {
OpenElementInfo &e = v[--i];
e.gi = iter.cur()->type()->name();
const LeafContentToken *token = iter.cur()->currentPosition();
if (token && !token->isInitial()) {
e.matchIndex = token->typeIndex() + 1;
const ElementType *type = token->elementType();
e.matchType = type ? type->name() : rniPcdata;
}
e.included = iter.cur()->included();
}
}
const ElementType *
ContentState::lookupCreateUndefinedElement(const StringC &name,
const Location &loc)
{
const ElementType *e = undefinedElementTypeTable_.lookup(name);
if (e)
return e;
ElementType *p = new ElementType(name,
openElementCount_.size());
p->setElementDefinition(new ElementDefinition(loc,
ElementDefinition::undefinedIndex,
(ElementDefinition::omitStart
|ElementDefinition::omitEnd),
ElementDefinition::any),
0);
undefinedElementTypeTable_.insert(p);
includeCount_.push_back(0);
excludeCount_.push_back(0);
openElementCount_.push_back(0);
return p;
}
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,140 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: ContentState.h /main/1 1996/07/29 16:48:27 cde-hp $ */
// Copyright (c) 1994, 1996 James Clark
// See the file COPYING for copying permission.
#ifndef ContentState_INCLUDED
#define ContentState_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include <stddef.h>
#include "OpenElement.h"
#include "IList.h"
#include "Vector.h"
#include "Message.h"
#include "Dtd.h"
#include "Mode.h"
#include "Boolean.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class SP_API ContentState {
public:
ContentState();
void startContent(const Dtd &);
void pushElement(OpenElement *);
OpenElement *popSaveElement();
void popElement();
OpenElement &currentElement();
const OpenElement &currentElement() const;
void getOpenElementInfo(Vector<OpenElementInfo> &,
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;
const ElementType *lookupCreateUndefinedElement(const StringC &,
const Location &);
Boolean checkImplyLoop(unsigned);
static const ShortReferenceMap theEmptyMap;
private:
IList<OpenElement> openElements_;
Vector<unsigned> openElementCount_;
Vector<unsigned> includeCount_;
Vector<unsigned> excludeCount_;
unsigned totalExcludeCount_;
unsigned tagLevel_;
unsigned netEnablingCount_;
const ElementType *lastEndedElementType_;
NamedTable<ElementType> undefinedElementTypeTable_;
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);
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not ContentState_INCLUDED */

View file

@ -1,815 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: ContentToken.C /main/2 1996/08/13 13:59:08 drk $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifdef __GNUG__
#pragma implementation
#endif
#include "splib.h"
#include <stdlib.h>
#include "ContentToken.h"
#include "macros.h"
#include "ElementType.h"
#include "Vector.h"
#include "Dtd.h"
#include "MessageArg.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
AndModelGroup::AndModelGroup(NCVector<Owner<ContentToken> > &v,
ContentToken::OccurrenceIndicator oi)
: ModelGroup(v, oi), andDepth_(0), andIndex_(0), andGroupIndex_(0),
andAncestor_(NULL)
{
}
ModelGroup::Connector AndModelGroup::connector() const
{
return andConnector;
}
OrModelGroup::OrModelGroup(NCVector<Owner<ContentToken> > &v,
ContentToken::OccurrenceIndicator oi)
: ModelGroup(v, oi)
{
setOrGroup();
}
ModelGroup::Connector OrModelGroup::connector() const
{
return orConnector;
}
SeqModelGroup::SeqModelGroup(NCVector<Owner<ContentToken> > &v,
ContentToken::OccurrenceIndicator oi)
: ModelGroup(v, oi)
{
}
ModelGroup::Connector SeqModelGroup::connector() const
{
return seqConnector;
}
ModelGroup::ModelGroup(NCVector<Owner<ContentToken> > &v,
OccurrenceIndicator oi)
: ContentToken(oi)
{
members_.swap(v);
}
unsigned long ModelGroup::grpgtcnt() const
{
unsigned long cnt = 1;
for (size_t i = 0; i < members_.size(); i++)
cnt += members_[i]->grpgtcnt();
return cnt;
}
void ModelGroup::setOrGroup()
{
for (size_t i = 0; i < members_.size(); i++)
members_[i]->setOrGroupMember();
}
const ModelGroup *ModelGroup::asModelGroup() const
{
return this;
}
ElementToken::ElementToken(const ElementType *element, OccurrenceIndicator oi)
: LeafContentToken(element, oi)
{
}
ContentToken::ContentToken(OccurrenceIndicator oi)
: occurrenceIndicator_(oi),
inherentlyOptional_(0)
{
}
unsigned long ContentToken::grpgtcnt() const
{
return 1;
}
void ContentToken::setOrGroupMember()
{
}
const ModelGroup *ContentToken::asModelGroup() const
{
return 0;
}
const LeafContentToken *ContentToken::asLeafContentToken() const
{
return 0;
}
LeafContentToken::LeafContentToken(const ElementType *element,
OccurrenceIndicator oi)
: element_(element), ContentToken(oi), isFinal_(0), orGroupMember_(0),
requiredIndex_(size_t(-1)), leafIndex_(0), typeIndex_(0), pcdataTransitionType_(0),
simplePcdataTransition_(NULL)
{
}
Boolean LeafContentToken::isInitial() const
{
return 0;
}
void LeafContentToken::setOrGroupMember()
{
orGroupMember_ = 1;
}
const LeafContentToken *LeafContentToken::asLeafContentToken() const
{
return this;
}
PcdataToken::PcdataToken()
: LeafContentToken(0, rep)
{
}
InitialPseudoToken::InitialPseudoToken()
: LeafContentToken(0, none)
{
}
Boolean InitialPseudoToken::isInitial() const
{
return 1;
}
DataTagGroup::DataTagGroup(NCVector<Owner<ContentToken> > &vec,
OccurrenceIndicator oi)
: SeqModelGroup(vec, oi)
{
}
DataTagElementToken::DataTagElementToken(const ElementType *element,
Vector<Text> &templates,
Text &paddingTemplate)
: ElementToken(element, ContentToken::none),
havePaddingTemplate_(1)
{
templates.swap(templates_);
paddingTemplate.swap(paddingTemplate_);
}
DataTagElementToken::DataTagElementToken(const ElementType *element,
Vector<Text> &templates)
: ElementToken(element, ContentToken::none),
havePaddingTemplate_(0)
{
templates.swap(templates_);
}
ContentToken::~ContentToken()
{
}
struct GroupInfo {
unsigned nextLeafIndex;
PackedBoolean containsPcdata;
unsigned andStateSize;
Vector<unsigned> nextTypeIndex;
GroupInfo(size_t);
};
GroupInfo::GroupInfo(size_t nType)
: nextTypeIndex(nType, 0), nextLeafIndex(0), containsPcdata(0), andStateSize(0)
{
}
CompiledModelGroup::CompiledModelGroup(Owner<ModelGroup> &modelGroup)
: modelGroup_(modelGroup.extract()), andStateSize_(0), containsPcdata_(false)
{
}
void CompiledModelGroup::compile(size_t nElementTypeIndex,
Vector<ContentModelAmbiguity> &ambiguities,
Boolean &pcdataUnreachable)
{
FirstSet first;
LastSet last;
GroupInfo info(nElementTypeIndex);
modelGroup_->analyze(info, 0, 0, first, last);
for (unsigned i = 0; i < last.size(); i++)
last[i]->setFinal();
andStateSize_ = info.andStateSize;
containsPcdata_ = info.containsPcdata;
initial_ = new InitialPseudoToken;
LastSet initialSet(1);
initialSet[0] = initial_.pointer();
ContentToken::addTransitions(initialSet, first, 1, 0, 0);
if (modelGroup_->inherentlyOptional())
initial_->setFinal();
pcdataUnreachable = 0;
Vector<unsigned> minAndDepth(info.nextLeafIndex);
Vector<size_t> elementTransition(nElementTypeIndex);
initial_->finish(minAndDepth, elementTransition, ambiguities,
pcdataUnreachable);
modelGroup_->finish(minAndDepth, elementTransition, ambiguities,
pcdataUnreachable);
if (!containsPcdata_)
pcdataUnreachable = 0;
}
void ModelGroup::finish(Vector<unsigned> &minAndDepth,
Vector<size_t> &elementTransition,
Vector<ContentModelAmbiguity> &ambiguities,
Boolean &pcdataUnreachable)
{
for (unsigned i = 0; i < nMembers(); i++)
member(i).finish(minAndDepth, elementTransition, ambiguities,
pcdataUnreachable);
}
void LeafContentToken::finish(Vector<unsigned> &minAndDepthVec,
Vector<size_t> &elementTransitionVec,
Vector<ContentModelAmbiguity> &ambiguities,
Boolean &pcdataUnreachable)
{
if (andInfo_) {
andFinish(minAndDepthVec, elementTransitionVec, ambiguities,
pcdataUnreachable);
return;
}
Vector<size_t>::iterator elementTransition = elementTransitionVec.begin();
Vector<unsigned>::iterator minAndDepth = minAndDepthVec.begin();
minAndDepthVec.assign(minAndDepthVec.size(), unsigned(-1));
elementTransitionVec.assign(elementTransitionVec.size(), size_t(-1));
pcdataTransitionType_ = 0;
simplePcdataTransition_ = 0;
// follow_ is in decreasing order of andDepth because of how it's
// constructed.
size_t n = follow_.size();
Vector<LeafContentToken *>::iterator follow = follow_.begin();
size_t j = 0;
for (size_t i = 0; i < n; i++) {
unsigned &minDepth = minAndDepth[follow[i]->index()];
if (minDepth) {
minDepth = 0;
if (j != i)
follow[j] = follow[i];
if (i == requiredIndex_)
requiredIndex_ = j;
const ElementType *e = follow[i]->elementType();
unsigned ei;
if (e == 0) {
if (!follow[i]->andInfo_) {
simplePcdataTransition_ = follow[i];
pcdataTransitionType_ = 1;
}
else
pcdataTransitionType_ = 2;
ei = 0;
}
else
ei = e->index();
if (elementTransition[ei] != size_t(-1)) {
const LeafContentToken *prev = follow[elementTransition[ei]];
// This might not be true: consider (a & b?)*; after the
// a there are two different ways to get to the same b,
// with the same and depth.
if (follow[i] != prev) {
ambiguities.resize(ambiguities.size() + 1);
ContentModelAmbiguity &a = ambiguities.back();
a.from = this;
a.to1 = prev;
a.to2 = follow[i];
a.andDepth = 0;
}
}
elementTransition[ei] = j;
j++;
}
}
if (pcdataTransitionType_ == 0)
pcdataUnreachable = 1;
follow_.resize(j);
}
void LeafContentToken::andFinish(Vector<unsigned> &minAndDepthVec,
Vector<size_t> &elementTransitionVec,
Vector<ContentModelAmbiguity> &ambiguities,
Boolean &pcdataUnreachable)
{
// Vector mapping element type index to index of leaf content token
// of that type to which there is a transition, which is the "worst"
// from the point of view of ambiguity.
Vector<size_t>::iterator elementTransition = elementTransitionVec.begin();
// Vector mapping index of leaf content token
// to minimum AND depth of transition to that token.
Vector<unsigned>::iterator minAndDepth = minAndDepthVec.begin();
minAndDepthVec.assign(minAndDepthVec.size(), unsigned(-1));
elementTransitionVec.assign(elementTransitionVec.size(), size_t(-1));
pcdataTransitionType_ = 0;
simplePcdataTransition_ = 0;
unsigned pcdataMinCovered = 0;
// follow_ is in decreasing order of andDepth because of how it's
// constructed.
size_t n = follow_.size();
size_t j = 0;
Vector<Transition>::iterator andFollow = andInfo_->follow.begin();
for (size_t i = 0; i < n; i++) {
unsigned &minDepth = minAndDepth[follow_[i]->index()];
// ignore transitions to the same token with the same and depth.
if (andFollow[i].andDepth < minDepth) {
minDepth = andFollow[i].andDepth;
if (j != i) {
follow_[j] = follow_[i];
andFollow[j] = andFollow[i];
}
if (i == requiredIndex_)
requiredIndex_ = j;
const ElementType *e = follow_[i]->elementType();
unsigned ei;
if (e == 0) {
if (pcdataTransitionType_ == 0) {
const AndModelGroup *andAncestor = andInfo_->andAncestor;
unsigned groupIndex = andInfo_->andGroupIndex;
do {
Boolean hasNonNull = 0;
for (unsigned k = 0; k < andAncestor->nMembers(); k++)
if (k != groupIndex
&& !andAncestor->member(k).inherentlyOptional()) {
hasNonNull = 1;
break;
}
if (hasNonNull) {
if (minDepth <= andAncestor->andDepth())
pcdataUnreachable = 1;
break;
}
groupIndex = andAncestor->andGroupIndex();
andAncestor = andAncestor->andAncestor();
} while (andAncestor);
if (andFollow[i].isolated)
pcdataMinCovered = minDepth;
pcdataTransitionType_ = 2;
}
else {
if (pcdataMinCovered > minDepth + 1)
pcdataUnreachable = 1;
pcdataMinCovered = andFollow[i].isolated ? minDepth : 0;
}
ei = 0;
}
else
ei = e->index();
// If we have transitions t1, t2, ... tN to tokens having
// the same element type, with
// and-depths d1, d2, ... dN, where d1 >= d2 >= ... >= dN,
// then there is an ambiguity unless
// d1 > d2 > ... > dN and t1, t2, ... , tN-1 are all isolated.
size_t previ = elementTransition[ei];
if (previ != size_t(-1)) {
const LeafContentToken *prev = follow_[previ];
// This might not be true: consider (a & b?)*; after the
// a there are two different ways to get to the same b,
// with the same and depth.
if (follow_[i] != prev
&& (andFollow[previ].andDepth == andFollow[i].andDepth
|| !andFollow[previ].isolated)) {
ambiguities.resize(ambiguities.size() + 1);
ContentModelAmbiguity &a = ambiguities.back();
a.from = this;
a.to1 = prev;
a.to2 = follow_[i];
a.andDepth = andFollow[i].andDepth;
}
if (andFollow[previ].isolated)
elementTransition[ei] = j;
}
else
elementTransition[ei] = j;
j++;
}
}
if (pcdataMinCovered > 0 || pcdataTransitionType_ == 0)
pcdataUnreachable = 1;
follow_.resize(j);
andInfo_->follow.resize(j);
}
void ContentToken::analyze(GroupInfo &info,
const AndModelGroup *andAncestor,
unsigned andGroupIndex,
FirstSet &first,
LastSet &last)
{
analyze1(info, andAncestor, andGroupIndex, first, last);
if (occurrenceIndicator_ & opt)
inherentlyOptional_ = 1;
if (inherentlyOptional_)
first.setNotRequired();
if (occurrenceIndicator_ & plus)
addTransitions(last, first, 0,
andIndex(andAncestor), andDepth(andAncestor));
}
void LeafContentToken::analyze1(GroupInfo &info,
const AndModelGroup *andAncestor,
unsigned andGroupIndex,
FirstSet &first,
LastSet &last)
{
leafIndex_ = info.nextLeafIndex++;
typeIndex_ = info.nextTypeIndex[element_ ? element_->index() : 0]++;
if (andAncestor) {
andInfo_ = new AndInfo;
andInfo_->andAncestor = andAncestor;
andInfo_->andGroupIndex = andGroupIndex;
}
first.init(this);
last.assign(1, this);
inherentlyOptional_ = 0;
}
void PcdataToken::analyze1(GroupInfo &info,
const AndModelGroup *andAncestor,
unsigned andGroupIndex,
FirstSet &first,
LastSet &last)
{
info.containsPcdata = 1;
LeafContentToken::analyze1(info, andAncestor, andGroupIndex, first, last);
}
void OrModelGroup::analyze1(GroupInfo &info,
const AndModelGroup *andAncestor,
unsigned andGroupIndex,
FirstSet &first,
LastSet &last)
{
member(0).analyze(info, andAncestor, andGroupIndex, first, last);
first.setNotRequired();
inherentlyOptional_ = member(0).inherentlyOptional();
for (unsigned i = 1; i < nMembers(); i++) {
FirstSet tempFirst;
LastSet tempLast;
member(i).analyze(info, andAncestor, andGroupIndex, tempFirst, tempLast);
first.append(tempFirst);
first.setNotRequired();
last.append(tempLast);
inherentlyOptional_ |= member(i).inherentlyOptional();
}
}
void SeqModelGroup::analyze1(GroupInfo &info,
const AndModelGroup *andAncestor,
unsigned andGroupIndex,
FirstSet &first,
LastSet &last)
{
member(0).analyze(info, andAncestor, andGroupIndex, first, last);
inherentlyOptional_ = member(0).inherentlyOptional();
for (unsigned i = 1; i < nMembers(); i++) {
FirstSet tempFirst;
LastSet tempLast;
member(i).analyze(info, andAncestor, andGroupIndex, tempFirst, tempLast);
addTransitions(last, tempFirst, 1,
andIndex(andAncestor), andDepth(andAncestor));
if (inherentlyOptional_)
first.append(tempFirst);
if (member(i).inherentlyOptional())
last.append(tempLast);
else
tempLast.swap(last);
inherentlyOptional_ &= member(i).inherentlyOptional();
}
}
void AndModelGroup::analyze1(GroupInfo &info,
const AndModelGroup *andAncestor,
unsigned andGroupIndex,
FirstSet &first,
LastSet &last)
{
andDepth_ = ContentToken::andDepth(andAncestor);
andIndex_ = ContentToken::andIndex(andAncestor);
andAncestor_ = andAncestor;
andGroupIndex_ = andGroupIndex;
if (andIndex_ + nMembers() > info.andStateSize)
info.andStateSize = andIndex_ + nMembers();
Vector<FirstSet> firstVec(nMembers());
Vector<LastSet> lastVec(nMembers());
member(0).analyze(info, this, 0, firstVec[0], lastVec[0]);
first = firstVec[0];
first.setNotRequired();
last = lastVec[0];
inherentlyOptional_ = member(0).inherentlyOptional();
unsigned i;
for (i = 1; i < nMembers(); i++) {
member(i).analyze(info, this, i, firstVec[i], lastVec[i]);
first.append(firstVec[i]);
first.setNotRequired();
last.append(lastVec[i]);
inherentlyOptional_ &= member(i).inherentlyOptional();
}
for (i = 0; i < nMembers(); i++) {
for (unsigned j = 0; j < nMembers(); j++)
if (j != i)
addTransitions(lastVec[i], firstVec[j], 0,
andIndex() + nMembers(),
andDepth() + 1,
!member(j).inherentlyOptional(),
andIndex() + j, andIndex() + i);
}
}
void ContentToken::addTransitions(const LastSet &from,
const FirstSet &to,
Boolean maybeRequired,
unsigned andClearIndex,
unsigned andDepth,
Boolean isolated,
unsigned requireClear,
unsigned toSet)
{
size_t length = from.size();
for (unsigned i = 0; i < length; i++)
from[i]->addTransitions(to,
maybeRequired,
andClearIndex,
andDepth,
isolated,
requireClear,
toSet);
}
void LeafContentToken::addTransitions(const FirstSet &to,
Boolean maybeRequired,
unsigned andClearIndex,
unsigned andDepth,
Boolean isolated,
unsigned requireClear,
unsigned toSet)
{
if (maybeRequired && to.requiredIndex() != size_t(-1)) {
ASSERT(requiredIndex_ == size_t(-1));
requiredIndex_ = to.requiredIndex() + follow_.size();
}
size_t length = follow_.size();
size_t n = to.size();
follow_.resize(length + n);
for (size_t i = 0; i < n; i++)
follow_[length + i] = to.token(i);
if (andInfo_) {
andInfo_->follow.resize(length + n);
for (size_t i = 0; i < n; i++) {
Transition &t = andInfo_->follow[length + i];
t.clearAndStateStartIndex = andClearIndex;
t.andDepth = andDepth;
t.isolated = isolated;
t.requireClear = requireClear;
t.toSet = toSet;
}
}
}
AndState::AndState(unsigned n)
: v_(n, PackedBoolean(0)), clearFrom_(0)
{
}
void AndState::clearFrom1(unsigned i)
{
while (clearFrom_ > i)
v_[--clearFrom_] = 0;
}
MatchState::MatchState()
: andState_(0), pos_(NULL), minAndDepth_(0)
{
}
MatchState::MatchState(const CompiledModelGroup *model)
: pos_(model ? model->initial() : 0),
andState_(model ? model->andStateSize() : 0),
minAndDepth_(0)
{
}
const LeafContentToken *MatchState::invalidExclusion(const ElementType *e)
const
{
const LeafContentToken *token = pos_->transitionToken(e, andState_,
minAndDepth_);
if (token && !token->inherentlyOptional() && !token->orGroupMember())
return token;
else
return 0;
}
Boolean MatchState::operator==(const MatchState &state) const
{
return (pos_ == state.pos_ && andState_ == state.andState_
&& minAndDepth_ == state.minAndDepth_);
}
Boolean AndState::operator==(const AndState &state) const
{
ASSERT(v_.size() == state.v_.size());
for (size_t i = 0; i < v_.size(); i++) {
if (i >= clearFrom_ && i >= state.clearFrom_)
break;
if (v_[i] != state.v_[i])
return 0;
}
return 1;
}
const LeafContentToken *
LeafContentToken::transitionToken(const ElementType *to,
const AndState &andState,
unsigned minAndDepth) const
{
Vector<LeafContentToken *>::const_iterator p = follow_.begin();
if (!andInfo_) {
for (size_t n = follow_.size(); n > 0; n--, p++)
if ((*p)->elementType() == to)
return *p;
}
else {
Vector<Transition>::const_iterator q = andInfo_->follow.begin();
for (size_t n = follow_.size(); n > 0; n--, p++, q++)
if ((*p)->elementType() == to
&& ((q->requireClear == unsigned(Transition::invalidIndex)
|| andState.isClear(q->requireClear))
&& q->andDepth >= minAndDepth))
return (*p);
}
return 0;
}
Boolean
LeafContentToken::tryTransition(const ElementType *to,
AndState &andState,
unsigned &minAndDepth,
const LeafContentToken *&newpos) const
{
Vector<LeafContentToken *>::const_iterator p = follow_.begin();
if (!andInfo_) {
for (size_t n = follow_.size(); n > 0; n--, p++) {
if ((*p)->elementType() == to) {
newpos = *p;
minAndDepth = newpos->computeMinAndDepth(andState);
return 1;
}
}
}
else {
Vector<Transition>::const_iterator q = andInfo_->follow.begin();
for (size_t n = follow_.size(); n > 0; n--, p++, q++) {
if ((*p)->elementType() == to
&& ((q->requireClear == unsigned(Transition::invalidIndex)
|| andState.isClear(q->requireClear))
&& q->andDepth >= minAndDepth)) {
if (q->toSet != unsigned(Transition::invalidIndex))
andState.set(q->toSet);
andState.clearFrom(q->clearAndStateStartIndex);
newpos = *p;
minAndDepth = newpos->computeMinAndDepth(andState);
return 1;
}
}
}
return 0;
}
void
LeafContentToken::possibleTransitions(const AndState &andState,
unsigned minAndDepth,
Vector<const ElementType *> &v) const
{
Vector<LeafContentToken *>::const_iterator p = follow_.begin();
if (!andInfo_) {
for (size_t n = follow_.size(); n > 0; n--, p++)
v.push_back((*p)->elementType());
}
else {
Vector<Transition>::const_iterator q = andInfo_->follow.begin();
for (size_t n = follow_.size(); n > 0; n--, p++, q++)
if ((q->requireClear == unsigned(Transition::invalidIndex)
|| andState.isClear(q->requireClear))
&& q->andDepth >= minAndDepth)
v.push_back((*p)->elementType());
}
}
unsigned LeafContentToken::computeMinAndDepth1(const AndState &andState) const
{
ASSERT(andInfo_);
unsigned groupIndex = andInfo_->andGroupIndex;
for (const AndModelGroup *group = andInfo_->andAncestor;
group;
groupIndex = group->andGroupIndex(), group = group->andAncestor())
for (unsigned i = 0; i < group->nMembers(); i++)
if (i != groupIndex && !group->member(i).inherentlyOptional()
&& andState.isClear(group->andIndex() + i))
return group->andDepth() + 1;
return 0;
}
const LeafContentToken *
LeafContentToken::impliedStartTag(const AndState &andState,
unsigned minAndDepth) const
{
if (requiredIndex_ != size_t(-1)) {
if (!andInfo_)
return follow_[requiredIndex_];
const Transition &t = andInfo_->follow[requiredIndex_];
if ((t.requireClear == unsigned(Transition::invalidIndex)
|| andState.isClear(t.requireClear))
&& t.andDepth >= minAndDepth)
return follow_[requiredIndex_];
}
return 0;
}
void LeafContentToken::doRequiredTransition(AndState &andState,
unsigned &minAndDepth,
const LeafContentToken *&newpos)
const
{
ASSERT(requiredIndex_ != size_t(-1));
if (andInfo_) {
const Transition &t = andInfo_->follow[requiredIndex_];
if (t.toSet != unsigned(Transition::invalidIndex))
andState.set(t.toSet);
andState.clearFrom(t.clearAndStateStartIndex);
}
newpos = follow_[requiredIndex_];
minAndDepth = newpos->computeMinAndDepth(andState);
}
FirstSet::FirstSet()
: requiredIndex_(size_t(-1))
{
}
void FirstSet::init(LeafContentToken *p)
{
v_.assign(1, p);
v_.reserve(256);
requiredIndex_ = 0;
}
void FirstSet::append(const FirstSet &set)
{
if (set.requiredIndex_ != size_t(-1)) {
ASSERT(requiredIndex_ == size_t(-1));
requiredIndex_ = set.requiredIndex_ + v_.size();
}
size_t oldSize = v_.size();
v_.resize(v_.size() + set.v_.size());
for (size_t i = 0; i < set.v_.size(); i++)
v_[oldSize + i] = set.v_[i];
}
void LastSet::append(const LastSet &set)
{
size_t oldSize = size();
resize(size() + set.size());
for (size_t i = 0; i < set.size(); i++)
(*this)[oldSize + i] = set[i];
}
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,657 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: ContentToken.h /main/1 1996/07/29 16:48:40 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef ContentToken_INCLUDED
#define ContentToken_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include "Owner.h"
#include "Text.h"
#include "Vector.h"
#include "NCVector.h"
#include "Boolean.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class LeafContentToken;
struct SP_API Transition {
Transition() { }
~Transition() { }
enum { invalidIndex = -1 };
// When performing this transition, reset all andState with index >= this.
unsigned clearAndStateStartIndex;
// This transition is possible only if all AND groups whose AND depth
// is >= this (and contains the LeafContentToken that this transition is
// from) have had all their non-nullable members matched.
unsigned andDepth;
// If this is 1, then this transition requires that the AND group
// whose AND depth is andDepth - 1 have a non-nullable member unmatched,
// and thus this transition is not ambiguous with a transition whose
// AND depth is < andDepth.
PackedBoolean isolated;
// Index in andState that must be clear for this transition to be
// allowed.
unsigned requireClear;
// Index in andState that is to be set after performing this transition.
unsigned toSet;
};
class SP_API 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<LeafContentToken *> v_;
// index of contextually required token or -1 if none
size_t requiredIndex_;
};
class SP_API LastSet : public Vector<LeafContentToken *> {
public:
LastSet() { }
LastSet(size_t n) : Vector<LeafContentToken *>(n) { }
void append(const LastSet &);
};
class ElementType;
class AndModelGroup;
struct GroupInfo;
struct SP_API ContentModelAmbiguity {
ContentModelAmbiguity () { }
~ContentModelAmbiguity () { }
const LeafContentToken *from;
const LeafContentToken *to1;
const LeafContentToken *to2;
unsigned andDepth;
};
class ModelGroup;
class SP_API 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<unsigned> &minAndDepth,
Vector<size_t> &elementTransition,
Vector<ContentModelAmbiguity> &,
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 &); // undefined
void operator=(const ContentToken &); // undefined
virtual void analyze1(GroupInfo &, const AndModelGroup *, unsigned,
FirstSet &, LastSet &) = 0;
OccurrenceIndicator occurrenceIndicator_;
};
class SP_API ModelGroup : public ContentToken {
public:
enum Connector { andConnector, orConnector, seqConnector };
ModelGroup(NCVector<Owner<ContentToken> > &, OccurrenceIndicator);
virtual Connector connector() const = 0;
unsigned nMembers() const;
void finish(Vector<unsigned> &minAndDepth,
Vector<size_t> &elementTransition,
Vector<ContentModelAmbiguity> &,
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 &); // undefined
void operator=(const ModelGroup &); // undefined
NCVector<Owner<ContentToken> > members_;
};
class AndModelGroup : public ModelGroup {
public:
AndModelGroup(NCVector<Owner<ContentToken> > &, OccurrenceIndicator);
Connector connector() const;
unsigned andDepth() const;
unsigned andIndex() const;
unsigned andGroupIndex() const;
const AndModelGroup *andAncestor() const;
private:
AndModelGroup(const AndModelGroup &); // undefined
void operator=(const AndModelGroup &); // undefined
unsigned andDepth_; // number of and groups that contain this
unsigned andIndex_;
unsigned andGroupIndex_;
const AndModelGroup *andAncestor_;
void analyze1(GroupInfo &, const AndModelGroup *, unsigned,
FirstSet &, LastSet &);
};
class OrModelGroup : public ModelGroup {
public:
OrModelGroup(NCVector<Owner<ContentToken> > &, OccurrenceIndicator);
Connector connector() const;
private:
OrModelGroup(const OrModelGroup &); // undefined
void operator=(const OrModelGroup &); // undefined
void analyze1(GroupInfo &, const AndModelGroup *, unsigned,
FirstSet &, LastSet &);
};
class SeqModelGroup : public ModelGroup {
public:
SeqModelGroup(NCVector<Owner<ContentToken> > &, OccurrenceIndicator);
Connector connector() const;
private:
SeqModelGroup(const SeqModelGroup &); // undefined
void operator=(const SeqModelGroup &); // undefined
void analyze1(GroupInfo &, const AndModelGroup *, unsigned,
FirstSet &, LastSet &);
};
class AndState;
class SP_API AndInfo {
public:
AndInfo() : andAncestor(NULL), andGroupIndex(0) { }
const AndModelGroup *andAncestor;
unsigned andGroupIndex;
Vector<Transition> follow;
private:
AndInfo(const AndInfo &); // undefined
void operator=(const AndInfo &); // undefined
};
// A LeafContentToken is not quite the same as a primitive content token.
// A data tag group is a primitive content token but not a LeafContentToken.
class SP_API 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<unsigned> &minAndDepth,
Vector<size_t> &elementTransition,
Vector<ContentModelAmbiguity> &,
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 ElementType *> &) 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 &); // undefined
void operator=(const LeafContentToken &); // undefined
void andFinish(Vector<unsigned> &minAndDepth,
Vector<size_t> &elementTransition,
Vector<ContentModelAmbiguity> &,
Boolean &pcdataUnreachable);
unsigned computeMinAndDepth1(const AndState&) const;
unsigned leafIndex_;
unsigned typeIndex_;
Vector<LeafContentToken *> follow_;
PackedBoolean isFinal_;
PackedBoolean orGroupMember_;
// 0 none, 1 yes - simple, 2 - compled
char pcdataTransitionType_;
const LeafContentToken *simplePcdataTransition_;
size_t requiredIndex_;
Owner<AndInfo> andInfo_;
};
class PcdataToken : public LeafContentToken {
public:
PcdataToken();
void analyze1(GroupInfo &, const AndModelGroup *, unsigned,
FirstSet &, LastSet &);
private:
PcdataToken(const PcdataToken &); // undefined
void operator=(const PcdataToken &); // undefined
};
class InitialPseudoToken : public LeafContentToken {
public:
InitialPseudoToken();
Boolean isInitial() const;
private:
InitialPseudoToken(const InitialPseudoToken &); // undefined
void operator=(const InitialPseudoToken &); // undefined
};
class ElementToken : public LeafContentToken {
public:
ElementToken(const ElementType *, OccurrenceIndicator);
private:
ElementToken(const ElementToken &); // undefined
void operator=(const ElementToken &); // undefined
};
class DataTagGroup : public SeqModelGroup {
public:
// first content token is a DataTagElementToken, second is PcdataToken
DataTagGroup(NCVector<Owner<ContentToken> > &, OccurrenceIndicator);
private:
DataTagGroup(const DataTagGroup &); // undefined
void operator=(const DataTagGroup &); // undefined
};
class DataTagElementToken : public ElementToken {
public:
DataTagElementToken(const ElementType *, Vector<Text> &templates);
DataTagElementToken(const ElementType *, Vector<Text> &templates,
Text &paddingTemplate);
private:
DataTagElementToken(const DataTagElementToken &); // undefined
void operator=(const DataTagElementToken &); // undefined
Vector<Text> templates_;
Boolean havePaddingTemplate_;
Text paddingTemplate_;
};
class SP_API CompiledModelGroup {
public:
CompiledModelGroup(Owner<ModelGroup> &);
void compile(size_t nElementTypeIndex,
Vector<ContentModelAmbiguity> &,
Boolean &pcdataUnreachable);
CompiledModelGroup *copy() const;
const LeafContentToken *initial() const;
unsigned andStateSize() const;
Boolean containsPcdata() const;
const ModelGroup *modelGroup() const;
private:
CompiledModelGroup(const CompiledModelGroup &); // undefined
void operator=(const CompiledModelGroup &); // undefined
Owner<ModelGroup> modelGroup_;
Owner<LeafContentToken> initial_;
unsigned andStateSize_;
Boolean containsPcdata_;
};
class SP_API 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<PackedBoolean> v_;
};
class SP_API MatchState {
public:
MatchState();
MatchState(const CompiledModelGroup *); // may be 0
Boolean tryTransition(const ElementType *);
Boolean tryTransitionPcdata();
void possibleTransitions(Vector<const ElementType *> &) 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<const ElementType *> &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);
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not ContentToken_INCLUDED */

View file

@ -1,50 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: CopyOwner.C /main/1 1996/07/29 16:48:46 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef CopyOwner_DEF_INCLUDED
#define CopyOwner_DEF_INCLUDED 1
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
template<class T>
CopyOwner<T>::CopyOwner(const CopyOwner<T> &o)
: Owner<T>(o.pointer() ? o.pointer()->copy() : 0)
{
}
template<class T>
void CopyOwner<T>::operator=(const CopyOwner<T> &o)
{
Owner<T>::operator=(o.pointer() ? o.pointer()->copy() : 0);
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not CopyOwner_DEF_INCLUDED */

View file

@ -1,54 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: CopyOwner.h /main/1 1996/07/29 16:48:51 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef CopyOwner_INCLUDED
#define CopyOwner_INCLUDED 1
#include "Owner.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
template<class T>
class CopyOwner : public Owner<T> {
public:
CopyOwner() { }
CopyOwner(T *p) : Owner<T>(p) { }
CopyOwner(const CopyOwner<T> &);
void operator=(const CopyOwner<T> &o);
void operator=(T *p) { Owner<T>::operator=(p); }
};
#ifdef SP_NAMESPACE
}
#endif
#endif /* not CopyOwner_INCLUDED */
#ifdef SP_DEFINE_TEMPLATES
#include "CopyOwner.C"
#endif

View file

@ -1,113 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: DescriptorManager.C /main/1 1996/07/29 16:48:58 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#include "splib.h"
#include "DescriptorManager.h"
#include "ListIter.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
DescriptorUser::DescriptorUser(DescriptorManager *manager)
: manager_(manager)
{
if (manager_)
manager_->addUser(this);
}
DescriptorUser::~DescriptorUser()
{
if (manager_)
manager_->removeUser(this);
}
void DescriptorUser::managerDeleted()
{
manager_ = 0;
}
Boolean DescriptorUser::suspend()
{
return 0;
}
void DescriptorUser::acquireD()
{
if (manager_)
manager_->acquireD();
}
void DescriptorUser::releaseD()
{
if (manager_)
manager_->releaseD();
}
DescriptorManager::DescriptorManager(int maxD)
: maxD_(maxD), usedD_(0)
{
}
DescriptorManager::~DescriptorManager()
{
for (ListIter<DescriptorUser *> iter(users_);
!iter.done();
iter.next())
iter.cur()->managerDeleted();
}
void DescriptorManager::addUser(DescriptorUser *p)
{
users_.insert(p);
}
void DescriptorManager::removeUser(DescriptorUser *p)
{
users_.remove(p);
}
void DescriptorManager::acquireD()
{
if (usedD_ >= maxD_) {
for (ListIter<DescriptorUser *> iter(users_);
!iter.done();
iter.next()) {
if (iter.cur()->suspend())
break;
}
}
usedD_++;
}
void DescriptorManager::releaseD()
{
usedD_--;
}
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,73 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: DescriptorManager.h /main/1 1996/07/29 16:49:04 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef DescriptorManager_INCLUDED
#define DescriptorManager_INCLUDED 1
#include "Boolean.h"
#include "List.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class DescriptorManager;
class SP_API DescriptorUser {
public:
DescriptorUser(DescriptorManager *);
virtual ~DescriptorUser();
virtual Boolean suspend();
void managerDeleted();
void acquireD();
void releaseD();
DescriptorManager *manager() const;
private:
DescriptorManager *manager_;
};
class SP_API DescriptorManager {
public:
DescriptorManager(int maxD);
~DescriptorManager();
void acquireD();
void releaseD();
void addUser(DescriptorUser *);
void removeUser(DescriptorUser *);
private:
DescriptorManager(const DescriptorManager &); // undefined
void operator=(const DescriptorManager &); // undefined
int usedD_;
int maxD_;
List<DescriptorUser *> users_;
};
#ifdef SP_NAMESPACE
}
#endif
#endif /* not DescriptorManager_INCLUDED */

View file

@ -1,113 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: Dtd.C /main/1 1996/07/29 16:49:10 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifdef __GNUG__
#pragma implementation
#endif
#include "splib.h"
#include "Dtd.h"
#include "Syntax.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
Dtd::Dtd(const StringC &name, Boolean isBase)
: name_(new StringResource<Char>(name)),
nCurrentAttribute_(0),
nElementDefinition_(0),
nAttributeDefinitionList_(0),
isBase_(isBase)
{
documentElementType_ = new ElementType(name, nElementTypeIndex());
insertElementType(documentElementType_);
}
Boolean Dtd::shortrefIndex(const StringC &str, const Syntax &syntax,
size_t &index)
{
const int *indexP = shortrefTable_.lookup(str);
if (indexP) {
index = *indexP;
return 1;
}
if (!syntax.isValidShortref(str))
return 0;
shortrefTable_.insert(str, int(shortrefs_.size()));
index = shortrefs_.size();
shortrefs_.push_back(str);
return 1;
}
void Dtd::addNeededShortref(const StringC &str)
{
if (!shortrefTable_.lookup(str)) {
shortrefTable_.insert(str, shortrefs_.size());
shortrefs_.push_back(str);
}
}
void Dtd::setDefaultEntity(const Ptr<Entity> &entity,
ParserState &parser)
{
defaultEntity_ = entity;
// If the new default entity was defined in a DTD, then
// any defaulted entities must have come from an LPD
// on the first pass, in which case we shouldn't replace them.
// Otherwise we need to replace all the defaulted entities.
if (entity->declInActiveLpd()) {
NamedResourceTable<Entity> tem;
{
EntityIter iter(generalEntityTable_);
for (;;) {
Ptr<Entity> old(iter.next());
if (old.isNull())
break;
if (old->defaulted()) {
Ptr<Entity> e(defaultEntity_->copy());
e->setDefaulted();
e->setName(old->name());
e->generateSystemId(parser);
tem.insert(e);
}
}
}
{
EntityIter iter(tem);
for (;;) {
Ptr<Entity> e(iter.next());
if (e.isNull())
break;
generalEntityTable_.insert(e, 1);
}
}
}
}
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,435 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: Dtd.h /main/1 1996/07/29 16:49:16 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef Dtd_INCLUDED
#define Dtd_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include "NamedTable.h"
#include "NamedResourceTable.h"
#include "ElementType.h"
#include "Notation.h"
#include "Entity.h"
#include "ShortReferenceMap.h"
#include "Resource.h"
#include "StringC.h"
#include "StringResource.h"
#include "Boolean.h"
#include "Vector.h"
#include "HashTable.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class Syntax;
class ParserState;
class SP_API Dtd : public Resource {
public:
typedef NamedTableIter<ElementType> ElementTypeIter;
typedef ConstNamedTableIter<ElementType> ConstElementTypeIter;
typedef NamedTableIter<ShortReferenceMap> ShortReferenceMapIter;
typedef ConstNamedResourceTableIter<Notation> ConstNotationIter;
typedef NamedResourceTableIter<Notation> NotationIter;
typedef ConstNamedResourceTableIter<Entity> ConstEntityIter;
typedef NamedResourceTableIter<Entity> EntityIter;
Dtd(const StringC &name, Boolean isBase);
ConstPtr<Entity> lookupEntity(Boolean isParameter, const StringC &) const;
const Entity *lookupEntityTemp(Boolean isParameter, const StringC &) const;
Ptr<Entity> lookupEntity(Boolean isParameter, const StringC &);
Ptr<Entity> insertEntity(const Ptr<Entity> &, Boolean replace = 0);
Ptr<Entity> removeEntity(Boolean isParameter, const StringC &);
ConstEntityIter generalEntityIter() const;
EntityIter generalEntityIter();
ConstEntityIter parameterEntityIter() const;
EntityIter parameterEntityIter();
ConstPtr<Entity> defaultEntity() const;
const Entity *defaultEntityTemp() const;
void setDefaultEntity(const Ptr<Entity> &, ParserState &);
const ConstPtr<StringResource<Char> > &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;
ConstElementTypeIter elementTypeIter() const;
ElementTypeIter elementTypeIter();
const RankStem *lookupRankStem(const StringC &) const;
RankStem *lookupRankStem(const StringC &);
RankStem *insertRankStem(RankStem *);
size_t nRankStem() const;
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<Notation> lookupNotation(const StringC &) const;
const Notation *lookupNotationTemp(const StringC &) const;
Ptr<Notation> lookupNotation(const StringC &);
Ptr<Notation> insertNotation(const Ptr<Notation> &);
Ptr<Notation> 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;
private:
Dtd(const Dtd &); // undefined
void operator=(const Dtd &); // undefined
NamedResourceTable<Entity> generalEntityTable_;
NamedResourceTable<Entity> parameterEntityTable_;
ConstPtr<Entity> defaultEntity_;
ConstPtr<StringResource<Char> > name_;
NamedTable<ElementType> elementTypeTable_;
NamedTable<RankStem> rankStemTable_;
NamedTable<ShortReferenceMap> shortReferenceMapTable_;
NamedResourceTable<Notation> notationTable_;
size_t nCurrentAttribute_;
size_t nElementDefinition_;
size_t nAttributeDefinitionList_;
ElementType *documentElementType_;
Vector<StringC> shortrefs_;
HashTable<StringC,int> shortrefTable_;
Boolean isBase_;
};
inline
ConstPtr<Entity> Dtd::lookupEntity(Boolean isParameter, const StringC &name)
const
{
return (isParameter
? &parameterEntityTable_
: &generalEntityTable_)->lookupConst(name);
}
inline
const Entity *Dtd::lookupEntityTemp(Boolean isParameter, const StringC &name)
const
{
return (isParameter
? &parameterEntityTable_
: &generalEntityTable_)->lookupTemp(name);
}
inline
Ptr<Entity> Dtd::lookupEntity(Boolean isParameter, const StringC &name)
{
return (isParameter
? &parameterEntityTable_
: &generalEntityTable_)->lookup(name);
}
inline
Ptr<Entity>
Dtd::insertEntity(const Ptr<Entity> &entity, Boolean replace)
{
return (entity->declType() == Entity::parameterEntity
? &parameterEntityTable_
: &generalEntityTable_)->insert(entity, replace);
}
inline
Ptr<Entity> Dtd::removeEntity(Boolean isParameter, const StringC &name)
{
return (isParameter
? &parameterEntityTable_
: &generalEntityTable_)->remove(name);
}
inline
Dtd::ConstEntityIter Dtd::generalEntityIter() const
{
// Avoid use of typedef to work around MSVC 2.0 bug.
return ConstNamedResourceTableIter<Entity>(generalEntityTable_);
}
inline
Dtd::EntityIter Dtd::generalEntityIter()
{
// Avoid use of typedef to work around MSVC 2.0 bug.
return NamedResourceTableIter<Entity>(generalEntityTable_);
}
inline
Dtd::ConstEntityIter Dtd::parameterEntityIter() const
{
// Avoid use of typedef to work around MSVC 2.0 bug.
return ConstNamedResourceTableIter<Entity>(parameterEntityTable_);
}
inline
Dtd::EntityIter Dtd::parameterEntityIter()
{
// Avoid use of typedef to work around MSVC 2.0 bug.
return NamedResourceTableIter<Entity>(parameterEntityTable_);
}
inline
ConstPtr<Entity> Dtd::defaultEntity() const
{
return defaultEntity_;
}
inline
const Entity *Dtd::defaultEntityTemp() const
{
return defaultEntity_.pointer();
}
inline
const ConstPtr<StringResource<Char> > &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()
{
// Avoid use of typedef to work around MSVC 2.0 bug.
return NamedTableIter<ElementType>(elementTypeTable_);
}
inline
Dtd::ConstElementTypeIter Dtd::elementTypeIter() const
{
// Avoid use of typedef to work around MSVC 2.0 bug.
return ConstNamedTableIter<ElementType>(elementTypeTable_);
}
inline
ElementType *Dtd::removeElementType(const StringC &name)
{
return elementTypeTable_.remove(name);
}
inline
size_t Dtd::nElementTypeIndex() const
{
// index 0 is reserved for #pcdata
return 1 + elementTypeTable_.count();
}
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<Notation> 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<Notation> Dtd::lookupNotation(const StringC &name)
{
return notationTable_.lookup(name);
}
inline
Ptr<Notation> Dtd::insertNotation(const Ptr<Notation> &nt)
{
return notationTable_.insert(nt);
}
inline
Dtd::ConstNotationIter Dtd::notationIter() const
{
// Avoid use of typedef to work around MSVC 2.0 bug.
return ConstNamedResourceTableIter<Notation>(notationTable_);
}
inline
Dtd::NotationIter Dtd::notationIter()
{
// Avoid use of typedef to work around MSVC 2.0 bug.
return NamedResourceTableIter<Notation>(notationTable_);
}
inline
Ptr<Notation> 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()
{
// Avoid use of typedef to work around MSVC 2.0 bug.
return NamedTableIter<ShortReferenceMap>(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];
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not Dtd_INCLUDED */

View file

@ -1,144 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: EUCJPCodingSystem.C /main/1 1996/07/29 16:49:22 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#include "splib.h"
#ifdef SP_MULTI_BYTE
#include "EUCJPCodingSystem.h"
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
#include <iostream>
#else
#include <iostream.h>
#endif
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class EUCJPDecoder : public Decoder {
public:
EUCJPDecoder() { }
size_t decode(Char *, const char *, size_t, const char **);
private:
};
class EUCJPEncoder : public Encoder {
public:
EUCJPEncoder() { }
void output(const Char *, size_t, streambuf *);
};
Decoder *EUCJPCodingSystem::makeDecoder() const
{
return new EUCJPDecoder;
}
Encoder *EUCJPCodingSystem::makeEncoder() const
{
return new EUCJPEncoder;
}
size_t EUCJPDecoder::decode(Char *to, const char *s,
size_t slen, const char **rest)
{
Char *start = to;
const unsigned char *us = (const unsigned char *)s;
while (slen > 0) {
if (!(*us & 0x80)) {
// G0
*to++ = *us++;
slen--;
}
else if (*us == 0x8e) {
// G2
if (slen < 2)
break;
slen -= 2;
++us;
*to++ = *us++ | 0x80;
}
else if (*us == 0x8f) {
// G3
if (slen < 3)
break;
slen -= 3;
++us;
unsigned short n = (*us++ | 0x80) << 8;
n |= (*us++ & ~0x80);
*to++ = n;
}
else {
// G1
if (slen < 2)
break;
slen -= 2;
unsigned short n = *us++ << 8;
n |= (*us++ | 0x80);
*to++ = n;
}
}
*rest = (const char *)us;
return to - start;
}
// FIXME handle errors from streambuf::sputc
void EUCJPEncoder::output(const Char *s, size_t n, streambuf *sb)
{
for (; n > 0; s++, n--) {
Char c = *s;
unsigned short mask = (unsigned short)(c & 0x8080);
if (mask == 0)
sb->sputc(char(c & 0xff));
else if (mask == 0x8080) {
sb->sputc(char((c >> 8) & 0xff));
sb->sputc(char(c & 0xff));
}
else if (mask == 0x0080) {
sb->sputc(0x8e);
sb->sputc(char(c & 0xff));
}
else {
// mask == 0x8000
sb->sputc(0x8f);
sb->sputc(char((c >> 8) & 0xff));
sb->sputc(char(c & 0x7f));
}
}
}
#ifdef SP_NAMESPACE
}
#endif
#else /* not SP_MULTI_BYTE */
#ifndef __GNUG__
static char non_empty_translation_unit; // sigh
#endif
#endif /* not SP_MULTI_BYTE */

View file

@ -1,46 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: EUCJPCodingSystem.h /main/1 1996/07/29 16:49:28 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef EUCJPCodingSystem_INCLUDED
#define EUCJPCodingSystem_INCLUDED 1
#include "CodingSystem.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class SP_API EUCJPCodingSystem : public CodingSystem {
public:
Decoder *makeDecoder() const;
Encoder *makeEncoder() const;
};
#ifdef SP_NAMESPACE
}
#endif
#endif /* not EUCJPCodingSystem_INCLUDED */

View file

@ -1,133 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: ElementType.C /main/1 1996/07/29 16:49:35 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifdef __GNUG__
#pragma implementation
#endif
#include "splib.h"
#include "ElementType.h"
#include "ContentToken.h"
#include "macros.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
ElementType::ElementType(const StringC &name, size_t index)
: Named(name), index_(index), map_(0), defIndex_(0)
{
}
ElementDefinition::ElementDefinition(const Location &location,
size_t index,
unsigned char omitFlags,
DeclaredContent declaredContent)
: location_(location),
index_(index),
omitFlags_(omitFlags),
declaredContent_(declaredContent)
{
computeMode();
}
ElementDefinition::ElementDefinition(const Location &location,
size_t index,
unsigned char omitFlags,
DeclaredContent declaredContent,
Owner<CompiledModelGroup> &modelGroup)
: location_(location),
index_(index),
omitFlags_(omitFlags),
declaredContent_(declaredContent),
modelGroup_(modelGroup.extract())
{
computeMode();
}
void ElementDefinition::computeMode()
{
switch (declaredContent_) {
case modelGroup:
if (!modelGroup_->containsPcdata()) {
netMode_ = econnetMode;
mode_ = econMode;
break;
}
// fall through
case any:
netMode_ = mconnetMode;
mode_ = mconMode;
break;
case cdata:
netMode_ = cconnetMode;
mode_ = cconMode;
break;
case rcdata:
netMode_ = rcconnetMode;
mode_ = rcconMode;
break;
case empty:
break;
default:
CANNOT_HAPPEN();
}
}
void ElementType::swap(ElementType &to)
{
Named::swap(to);
{
size_t tem = to.index_;
to.index_ = index_;
index_ = tem;
}
{
size_t tem = to.defIndex_;
to.defIndex_ = defIndex_;
defIndex_ = tem;
}
def_.swap(to.def_);
{
const ShortReferenceMap *tem = to.map_;
to.map_ = map_;
map_ = tem;
}
}
RankStem::RankStem(const StringC &name, size_t index)
: Named(name), index_(index)
{
}
void RankStem::addDefinition(const ConstPtr<ElementDefinition> &p)
{
def_.push_back(p);
}
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,318 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: ElementType.h /main/1 1996/07/29 16:49:41 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef ElementType_INCLUDED
#define ElementType_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include <stddef.h>
#include "Boolean.h"
#include "Vector.h"
#include "Owner.h"
#include "Location.h"
#include "Ptr.h"
#include "Named.h"
#include "Vector.h"
#include "Attributed.h"
#include "Mode.h"
#include "ContentToken.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class ElementType;
class ShortReferenceMap;
class RankStem;
class SP_API 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);
ElementDefinition(const Location &location,
size_t index,
unsigned char omitFlags,
DeclaredContent declaredContent,
Owner<CompiledModelGroup> &modelGroup);
const CompiledModelGroup *compiledModelGroup() const;
DeclaredContent declaredContent() const;
// Was the omitted tag minimization specified?
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;
void setInclusions(Vector<const ElementType *> &inclusions);
void setExclusions(Vector<const ElementType *> &exclusions);
void setRank(StringC &suffix, Vector<const RankStem *> &rankStems);
Mode mode(Boolean netEnabled) const;
private:
ElementDefinition(const ElementDefinition &); // undefined
void operator=(const ElementDefinition &); // undefined
void computeMode();
Location location_;
size_t index_;
unsigned char omitFlags_;
DeclaredContent declaredContent_;
Owner<CompiledModelGroup> modelGroup_;
Vector<const ElementType *> inclusions_;
Vector<const ElementType *> exclusions_;
// rankStems_ contains all the rank stems in the ranked group in this
// definition.
Vector<const RankStem *> rankStems_;
StringC rankSuffix_;
Mode mode_;
Mode netMode_;
};
class SP_API RankStem : public Named {
public:
RankStem(const StringC &, size_t);
size_t index() const;
void addDefinition(const ConstPtr<ElementDefinition> &);
size_t nDefinitions() const;
const ElementDefinition *definition(size_t) const;
private:
RankStem(const RankStem &); // undefined
void operator=(const RankStem &); // undefined
size_t index_;
Vector<ConstPtr<ElementDefinition> > def_;
};
class SP_API ElementType : public Named, public Attributed {
public:
ElementType(const StringC &, size_t);
void setElementDefinition(const ConstPtr<ElementDefinition> &,
size_t defIndex);
void setMap(const ShortReferenceMap *);
void setRankStem(RankStem *);
Boolean undefined() const;
const ElementDefinition *definition() const;
Boolean isRankedElement() const;
const RankStem *rankedElementRankStem() const;
size_t index() const;
const ShortReferenceMap *map() const;
void swap(ElementType &);
private:
ElementType(const ElementType &); // undefined
void operator=(const ElementType &); // undefined
size_t index_;
size_t defIndex_; // index in the group having same definition
ConstPtr<ElementDefinition> 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
void ElementDefinition::setInclusions(Vector<const ElementType *> &inclusions)
{
inclusions.swap(inclusions_);
}
inline
void ElementDefinition::setExclusions(Vector<const ElementType *> &exclusions)
{
exclusions.swap(exclusions_);
}
inline
void ElementDefinition::setRank(StringC &rankSuffix,
Vector<const RankStem *> &rankStems)
{
rankStems.swap(rankStems_);
rankSuffix.swap(rankSuffix_);
}
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<ElementDefinition> &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 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_;
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not ElementType_INCLUDED */

View file

@ -1,670 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: Entity.C /main/1 1996/07/29 16:49:46 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifdef __GNUG__
#pragma implementation
#endif
#include "splib.h"
#include "Entity.h"
#include "ParserState.h"
#include "macros.h"
#include "InternalInputSource.h"
#include "MessageArg.h"
#include "ParserMessages.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
Entity::Entity(const StringC &name, DeclType declType, DataType dataType,
const Location &defLocation)
: EntityDecl(name, declType, dataType, defLocation),
used_(0), defaulted_(0)
{
}
void Entity::generateSystemId(ParserState &)
{
}
InternalEntity::InternalEntity(const StringC &name,
DeclType declType,
DataType dataType,
const Location &defLocation,
Text &text)
: Entity(name, declType, dataType, defLocation)
{
text.swap(text_);
}
PiEntity::PiEntity(const StringC &name, DeclType declType,
const Location &defLocation, Text &text)
: InternalEntity(name, declType, pi, defLocation, text)
{
}
Entity *PiEntity::copy() const
{
return new PiEntity(*this);
}
InternalDataEntity::InternalDataEntity(const StringC &name, DataType dataType,
const Location &defLocation, Text &text)
: InternalEntity(name, generalEntity, dataType, defLocation, text)
{
}
InternalCdataEntity::InternalCdataEntity(const StringC &name,
const Location &defLocation,
Text &text)
: InternalDataEntity(name, cdata, defLocation, text)
{
}
Entity *InternalCdataEntity::copy() const
{
return new InternalCdataEntity(*this);
}
InternalSdataEntity::InternalSdataEntity(const StringC &name,
const Location &defLocation,
Text &text)
: InternalDataEntity(name, sdata, defLocation, text)
{
}
Entity *InternalSdataEntity::copy() const
{
return new InternalSdataEntity(*this);
}
InternalTextEntity::InternalTextEntity(const StringC &name, DeclType declType,
const Location &defLocation, Text &text,
Bracketed bracketed)
: InternalEntity(name, declType, sgmlText, defLocation, text),
bracketed_(bracketed)
{
}
Entity *InternalTextEntity::copy() const
{
return new InternalTextEntity(*this);
}
ExternalEntity::ExternalEntity(const StringC &name,
DeclType declType,
DataType dataType,
const Location &defLocation,
const ExternalId &id)
: Entity(name, declType, dataType, defLocation), externalId_(id)
{
}
const ExternalEntity *ExternalEntity::asExternalEntity() const
{
return this;
}
const StringC *ExternalEntity::systemIdPointer() const
{
return externalId_.systemIdString();
}
const StringC *ExternalEntity::effectiveSystemIdPointer() const
{
if (externalId_.effectiveSystemId().size() > 0)
return &externalId_.effectiveSystemId();
return 0;
}
const StringC *ExternalEntity::publicIdPointer() const
{
return externalId_.publicIdString();
}
void ExternalEntity::generateSystemId(ParserState &parser)
{
StringC str;
if (parser.entityCatalog().lookup(*this,
parser.syntax(),
parser.sd().docCharset(),
parser.messenger(),
str))
externalId_.setEffectiveSystem(str);
else if (externalId_.publicIdString())
parser.message(ParserMessages::cannotGenerateSystemIdPublic,
StringMessageArg(*externalId_.publicIdString()));
else {
switch (declType()) {
case generalEntity:
parser.message(ParserMessages::cannotGenerateSystemIdGeneral,
StringMessageArg(name()));
break;
case parameterEntity:
parser.message(ParserMessages::cannotGenerateSystemIdParameter,
StringMessageArg(name()));
break;
case doctype:
parser.message(ParserMessages::cannotGenerateSystemIdDoctype,
StringMessageArg(name()));
break;
case linktype:
parser.message(ParserMessages::cannotGenerateSystemIdLinktype,
StringMessageArg(name()));
break;
default:
CANNOT_HAPPEN();
}
}
}
ExternalTextEntity::ExternalTextEntity(const StringC &name,
DeclType declType,
const Location &defLocation,
const ExternalId &id)
: ExternalEntity(name, declType, sgmlText, defLocation, id)
{
}
Entity *ExternalTextEntity::copy() const
{
return new ExternalTextEntity(*this);
}
ExternalNonTextEntity::ExternalNonTextEntity(const StringC &name,
DataType dataType,
const Location &defLocation,
const ExternalId &id)
: ExternalEntity(name, generalEntity, dataType, defLocation, id)
{
}
ExternalDataEntity::ExternalDataEntity(const StringC &name,
DataType dataType,
const Location &defLocation,
const ExternalId &id,
const ConstPtr<Notation> &nt,
AttributeList &attributes)
: ExternalNonTextEntity(name, dataType, defLocation, id),
notation_(nt)
{
attributes.swap(attributes_);
}
void ExternalDataEntity::setNotation(const ConstPtr<Notation> &notation,
AttributeList &attributes)
{
notation_ = notation;
attributes.swap(attributes_);
}
Entity *ExternalDataEntity::copy() const
{
return new ExternalDataEntity(*this);
}
SubdocEntity::SubdocEntity(const StringC &name,
const Location &defLocation,
const ExternalId &id)
: ExternalNonTextEntity(name, subdoc, defLocation, id)
{
}
Entity *SubdocEntity::copy() const
{
return new SubdocEntity(*this);
}
Boolean Entity::isDataOrSubdoc() const
{
return 0;
}
Boolean Entity::isCharacterData() const
{
return 0;
}
const ExternalEntity *Entity::asExternalEntity() const
{
return 0;
}
const ExternalDataEntity *Entity::asExternalDataEntity() const
{
return 0;
}
const SubdocEntity *Entity::asSubdocEntity() const
{
return 0;
}
const InternalEntity *Entity::asInternalEntity() const
{
return 0;
}
void Entity::dsReference(ParserState &parser,
const Ptr<EntityOrigin> &origin)
const
{
normalReference(parser, origin, 1);
}
void Entity::declReference(ParserState &parser,
const Ptr<EntityOrigin> &origin)
const
{
normalReference(parser, origin, 0);
if (parser.currentMarkup())
parser.currentMarkup()->addEntityStart(origin);
}
void Entity::contentReference(ParserState &parser,
const Ptr<EntityOrigin> &origin)
const
{
normalReference(parser, origin, 1);
}
void Entity::rcdataReference(ParserState &parser,
const Ptr<EntityOrigin> &origin)
const
{
normalReference(parser, origin, 1);
}
void Entity::litReference(Text &, ParserState &parser,
const Ptr<EntityOrigin> &origin,
Boolean)
const
{
normalReference(parser, origin, 0);
}
const InternalEntity *InternalEntity::asInternalEntity() const
{
return this;
}
void PiEntity::litReference(Text &, ParserState &parser,
const Ptr<EntityOrigin> &,
Boolean) const
{
parser.message(ParserMessages::piEntityReference);
}
void PiEntity::normalReference(ParserState &parser,
const Ptr<EntityOrigin> &origin,
Boolean) const
{
parser.noteMarkup();
parser.eventHandler().pi(new (parser.eventAllocator())
PiEntityEvent(this, origin.pointer()));
}
void PiEntity::declReference(ParserState &parser,
const Ptr<EntityOrigin> &) const
{
parser.message(ParserMessages::piEntityReference);
}
void PiEntity::rcdataReference(ParserState &parser,
const Ptr<EntityOrigin> &) const
{
parser.message(ParserMessages::piEntityRcdata);
}
void InternalDataEntity::declReference(ParserState &parser,
const Ptr<EntityOrigin> &) const
{
parser.message(ParserMessages::internalDataEntityReference);
}
Boolean InternalDataEntity::isDataOrSubdoc() const
{
return 1;
}
void InternalCdataEntity::normalReference(ParserState &parser,
const Ptr<EntityOrigin> &origin,
Boolean) const
{
checkEntlvl(parser);
if (string().size() > 0) {
parser.noteData();
parser.eventHandler().data(new (parser.eventAllocator())
CdataEntityEvent(this, origin.pointer()));
}
}
Boolean InternalCdataEntity::isCharacterData() const
{
return string().size() > 0;
}
void InternalCdataEntity::litReference(Text &text,
ParserState &parser,
const Ptr<EntityOrigin> &origin,
Boolean squeeze) const
{
checkEntlvl(parser);
if (squeeze) {
Location loc(origin.pointer(), 0);
text.addEntityStart(loc);
text.addCharsTokenize(text_.string(), loc, parser.syntax().space());
loc += text_.size();
text.addEntityEnd(loc);
}
else
text.addCdata(this, origin.pointer());
}
void InternalSdataEntity::normalReference(ParserState &parser,
const Ptr<EntityOrigin> &origin,
Boolean) const
{
checkEntlvl(parser);
parser.noteData();
parser.eventHandler().sdataEntity(new (parser.eventAllocator())
SdataEntityEvent(this,
origin.pointer()));
}
Boolean InternalSdataEntity::isCharacterData() const
{
return 1;
}
void InternalSdataEntity::litReference(Text &text,
ParserState &parser,
const Ptr<EntityOrigin> &origin,
Boolean squeeze) const
{
checkEntlvl(parser);
if (squeeze) {
Location loc(origin.pointer(), 0);
text.addEntityStart(loc);
text.addCharsTokenize(text_.string(), loc, parser.syntax().space());
loc += text_.size();
text.addEntityEnd(loc);
}
else
text.addSdata(this, origin.pointer());
}
void InternalTextEntity::normalReference(ParserState &parser,
const Ptr<EntityOrigin> &origin,
Boolean generateEvent) const
{
checkEntlvl(parser);
if (checkNotOpen(parser)) {
if (generateEvent && parser.wantMarkup())
parser.eventHandler().entityStart(new (parser.eventAllocator())
EntityStartEvent(origin));
parser.pushInput(new (parser.internalAllocator())
InternalInputSource(text_.string(), origin.pointer()));
}
}
void InternalTextEntity::litReference(Text &text,
ParserState &parser,
const Ptr<EntityOrigin> &origin,
Boolean) const
{
text.addEntityStart(Location(origin.pointer(), 0));
normalReference(parser, origin, 0);
}
void ExternalTextEntity::normalReference(ParserState &parser,
const Ptr<EntityOrigin> &origin,
Boolean generateEvent) const
{
checkEntlvl(parser);
if (checkNotOpen(parser)) {
if (generateEvent && parser.wantMarkup())
parser.eventHandler().entityStart(new (parser.eventAllocator())
EntityStartEvent(origin));
if (externalId().effectiveSystemId().size())
parser.pushInput(parser.entityManager()
.open(externalId().effectiveSystemId(),
parser.sd().docCharset(),
origin.pointer(),
0,
parser.messenger()));
else
parser.message(ParserMessages::nonExistentEntityRef,
StringMessageArg(name()),
defLocation());
}
}
void ExternalTextEntity::litReference(Text &text,
ParserState &parser,
const Ptr<EntityOrigin> &origin,
Boolean) const
{
text.addEntityStart(Location(origin.pointer(), 0));
normalReference(parser, origin, 0);
}
const ExternalDataEntity *ExternalDataEntity::asExternalDataEntity() const
{
return this;
}
void ExternalDataEntity::contentReference(ParserState &parser,
const Ptr<EntityOrigin> &origin) const
{
checkEntlvl(parser);
parser.noteData();
parser.eventHandler().externalDataEntity(new (parser.eventAllocator())
ExternalDataEntityEvent(this, origin.pointer()));
}
Boolean ExternalNonTextEntity::isDataOrSubdoc() const
{
return 1;
}
Boolean ExternalNonTextEntity::isCharacterData() const
{
return 1;
}
void ExternalNonTextEntity::normalReference(ParserState &parser,
const Ptr<EntityOrigin> &,
Boolean) const
{
parser.message(ParserMessages::externalNonTextEntityReference);
}
void ExternalNonTextEntity::litReference(Text &,
ParserState &parser,
const Ptr<EntityOrigin> &,
Boolean) const
{
parser.message(ParserMessages::externalNonTextEntityRcdata);
}
void ExternalNonTextEntity::rcdataReference(ParserState &parser,
const Ptr<EntityOrigin> &) const
{
parser.message(ParserMessages::externalNonTextEntityRcdata);
}
void SubdocEntity::contentReference(ParserState &parser,
const Ptr<EntityOrigin> &origin) const
{
checkEntlvl(parser);
parser.noteData();
parser.eventHandler().subdocEntity(new (parser.eventAllocator())
SubdocEntityEvent(this, origin.pointer()));
}
const SubdocEntity *SubdocEntity::asSubdocEntity() const
{
return this;
}
IgnoredEntity::IgnoredEntity(const StringC &name, DeclType declType)
: Entity(name, declType, sgmlText, Location())
{
}
Entity *IgnoredEntity::copy() const
{
return new IgnoredEntity(*this);
}
void IgnoredEntity::declReference(ParserState &parser,
const Ptr<EntityOrigin> &origin)
const
{
if (parser.currentMarkup()) {
parser.currentMarkup()->addEntityStart(origin);
parser.currentMarkup()->addEntityEnd();
}
}
void IgnoredEntity::litReference(Text &text,
ParserState &,
const Ptr<EntityOrigin> &origin,
Boolean) const
{
text.addEntityStart(Location(origin.pointer(), 0));
text.addEntityEnd(Location(origin.pointer(), 0));
}
void IgnoredEntity::normalReference(ParserState &parser,
const Ptr<EntityOrigin> &origin,
Boolean generateEvent) const
{
if (generateEvent && parser.wantMarkup()) {
parser.eventHandler().entityStart(new (parser.eventAllocator())
EntityStartEvent(origin));
Location loc(origin.pointer(), 0);
parser.eventHandler().entityEnd(new (parser.eventAllocator())
EntityEndEvent(loc));
}
}
void Entity::checkEntlvl(ParserState &parser)
{
// -1 because document entity isn't counted
if (parser.inputLevel() - 1 == parser.syntax().entlvl())
parser.message(ParserMessages::entlvl);
}
Boolean Entity::checkNotOpen(ParserState &parser) const
{
if (parser.entityIsOpen(this)) {
parser.message(ParserMessages::recursiveEntityReference,
StringMessageArg(name()));
return 0;
}
return 1;
}
EntityOrigin::EntityOrigin()
: refLength_(0)
{
}
EntityOrigin::EntityOrigin(const Location &refLocation)
: InputSourceOrigin(refLocation), refLength_(0)
{
}
EntityOrigin::EntityOrigin(const ConstPtr<Entity> &entity,
const Location &refLocation)
: InputSourceOrigin(refLocation), refLength_(0), entity_(entity)
{
}
EntityOrigin::EntityOrigin(const ConstPtr<Entity> &entity,
const Location &refLocation,
Index refLength,
Owner<Markup> &markup)
: InputSourceOrigin(refLocation), refLength_(refLength), entity_(entity)
{
markup.swap(markup_);
}
EntityOrigin::~EntityOrigin()
{
}
InputSourceOrigin *EntityOrigin::copy() const
{
Owner<Markup> m;
if (markup_)
m = new Markup(*markup_);
return new EntityOrigin(entity_, parent(), refLength_, m);
}
const StringC *EntityOrigin::entityName() const
{
if (entity_.isNull())
return 0;
return entity_->namePointer();
}
Index EntityOrigin::refLength() const
{
return refLength_;
}
const EntityOrigin *EntityOrigin::asEntityOrigin() const
{
return this;
}
Boolean EntityOrigin::defLocation(Offset off, Location &loc) const
{
if (entity_.isNull())
return 0;
const InternalEntity *internal = entity_->asInternalEntity();
if (!internal)
return 0;
loc = internal->text().charLocation(off);
return 1;
}
const EntityDecl *EntityOrigin::entityDecl() const
{
return entity_.pointer();
}
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,383 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: Entity.h /main/1 1996/07/29 16:49:52 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef Entity_INCLUDED
#define Entity_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include "types.h"
#include "StringC.h"
#include "NamedResource.h"
#include "Location.h"
#include "Owner.h"
#include "Attribute.h"
#include "ExternalId.h"
#include "Text.h"
#include "SubstTable.h"
#include "StringResource.h"
#include "Allocator.h"
#include "EntityDecl.h"
#include "Markup.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
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);
// reference in a literal
virtual void litReference(Text &, ParserState &,
const Ptr<EntityOrigin> &,
Boolean squeezeSpaces)
const;
// reference in a declaration
virtual void declReference(ParserState &,
const Ptr<EntityOrigin> &)
const;
// reference in a declaration subset
virtual void dsReference(ParserState &,
const Ptr<EntityOrigin> &)
const;
// reference in content
virtual void contentReference(ParserState &,
const Ptr<EntityOrigin> &)
const;
// reference in rcdata
virtual void rcdataReference(ParserState &,
const Ptr<EntityOrigin> &)
const;
// for entity name attribute checking
virtual Boolean isDataOrSubdoc() const;
// for determining whether we need to validate as character data
virtual Boolean isCharacterData() const;
virtual const ExternalDataEntity *asExternalDataEntity() const;
virtual const SubdocEntity *asSubdocEntity() const;
virtual const InternalEntity *asInternalEntity() const;
virtual const ExternalEntity *asExternalEntity() const;
// needed for default entity
virtual Entity *copy() const = 0;
virtual void generateSystemId(ParserState &);
void setUsed();
Boolean used() const;
void setDefaulted();
Boolean defaulted() const;
protected:
static void checkEntlvl(ParserState &);
Boolean checkNotOpen(ParserState &) const;
private:
virtual void normalReference(ParserState &,
const Ptr<EntityOrigin> &,
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:
Text text_;
};
class PiEntity : public InternalEntity {
public:
PiEntity(const StringC &, DeclType, const Location &, Text &);
void litReference(Text &, ParserState &,
const Ptr<EntityOrigin> &,
Boolean) const;
void normalReference(ParserState &,
const Ptr<EntityOrigin> &,
Boolean) const;
void declReference(ParserState &,
const Ptr<EntityOrigin> &) const;
void rcdataReference(ParserState &,
const Ptr<EntityOrigin> &) const;
Entity *copy() const;
};
class InternalDataEntity : public InternalEntity {
public:
InternalDataEntity(const StringC &, DataType, const Location &, Text &);
void declReference(ParserState &,
const Ptr<EntityOrigin> &) const;
Boolean isDataOrSubdoc() const;
};
class InternalCdataEntity : public InternalDataEntity {
public:
InternalCdataEntity(const StringC &, const Location &, Text &);
void normalReference(ParserState &,
const Ptr<EntityOrigin> &,
Boolean) const;
void litReference(Text &, ParserState &,
const Ptr<EntityOrigin> &,
Boolean) const;
Entity *copy() const;
Boolean isCharacterData() const;
};
class InternalSdataEntity : public InternalDataEntity {
public:
InternalSdataEntity(const StringC &, const Location &, Text &);
void normalReference(ParserState &,
const Ptr<EntityOrigin> &,
Boolean) const;
void litReference(Text &, ParserState &,
const Ptr<EntityOrigin> &,
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<EntityOrigin> &,
Boolean) const;
void litReference(Text &, ParserState &,
const Ptr<EntityOrigin> &,
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;
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<EntityOrigin> &,
Boolean) const;
void litReference(Text &, ParserState &,
const Ptr<EntityOrigin> &,
Boolean) const;
};
class ExternalNonTextEntity : public ExternalEntity {
public:
ExternalNonTextEntity(const StringC &, DataType,
const Location &, const ExternalId &);
Boolean isDataOrSubdoc() const;
void litReference(Text &, ParserState &,
const Ptr<EntityOrigin> &,
Boolean) const;
void rcdataReference(ParserState &,
const Ptr<EntityOrigin> &) const;
void normalReference(ParserState &,
const Ptr<EntityOrigin> &,
Boolean) const;
Boolean isCharacterData() const;
};
class ExternalDataEntity : public ExternalNonTextEntity {
public:
ExternalDataEntity(const StringC &, DataType, const Location &,
const ExternalId &, const ConstPtr<Notation> &,
AttributeList &);
const AttributeList &attributes() const;
const Notation *notation() const;
const ExternalDataEntity *asExternalDataEntity() const;
Entity *copy() const;
void contentReference(ParserState &,
const Ptr<EntityOrigin> &) const;
void setNotation(const ConstPtr<Notation> &, AttributeList &);
private:
ConstPtr<Notation> 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<EntityOrigin> &) const;
private:
};
class IgnoredEntity : public Entity {
public:
IgnoredEntity(const StringC &, DeclType declType);
Entity *copy() const;
void litReference(Text &, ParserState &,
const Ptr<EntityOrigin> &,
Boolean squeezeSpaces) const;
void declReference(ParserState &,
const Ptr<EntityOrigin> &) const;
private:
void normalReference(ParserState &,
const Ptr<EntityOrigin> &,
Boolean generateEvent) const;
};
class SP_API EntityOrigin : public InputSourceOrigin {
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);
}
EntityOrigin();
EntityOrigin(const Location &refLocation);
EntityOrigin(const ConstPtr<Entity> &);
EntityOrigin(const ConstPtr<Entity> &,
const Location &refLocation);
EntityOrigin(const ConstPtr<Entity> &,
const Location &refLocation, Index refLength,
Owner<Markup> &markup);
~EntityOrigin();
InputSourceOrigin *copy() const;
const ConstPtr<Entity> &entity() const { return entity_; }
const StringC *entityName() const;
const EntityDecl *entityDecl() const;
const EntityOrigin *asEntityOrigin() const;
Boolean defLocation(Offset off, Location &loc) const;
Index refLength() const;
const Markup *markup() const;
private:
EntityOrigin(const EntityOrigin &); // undefined
void operator=(const EntityOrigin &); // undefined
ConstPtr<Entity> entity_; // 0 for document entity
// total length of reference
// (characters that were replaced by the entity)
Index refLength_;
Owner<Markup> markup_;
};
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();
}
inline
const Markup *EntityOrigin::markup() const
{
return markup_.pointer();
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not Entity_INCLUDED */

View file

@ -1,242 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: EntityApp.C /main/1 1996/07/29 16:49:57 cde-hp $ */
// Copyright (c) 1996 James Clark
// See the file COPYING for copying permission.
#ifdef __GNUG__
#pragma implementation
#endif
#include "splib.h"
#include "EntityApp.h"
#include "sptchar.h"
#include <stdlib.h>
#ifdef SP_MULTI_BYTE
#include "ISO8859InputCodingSystem.h"
#endif
#include "PosixStorage.h"
#include "URLStorage.h"
#include "LiteralStorage.h"
#include "ExtendEntityManager.h"
#include "SOEntityCatalog.h"
#include "CodingSystem.h"
#include "macros.h"
#ifndef SGML_SEARCH_PATH_DEFAULT
#define SGML_SEARCH_PATH_DEFAULT SP_T("")
#endif
#ifndef SGML_CATALOG_FILES_DEFAULT
#define SGML_CATALOG_FILES_DEFAULT SP_T("")
#endif /* not SGML_CATALOG_FILES_DEFAULT */
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
#ifdef MSDOS_FILENAMES
const Char FILE_SEP = ';';
#else
const Char FILE_SEP = ':';
#endif
#ifdef SP_MULTI_BYTE
static ISO8859InputCodingSystem iso8859_2InputCodingSystem(2);
static ISO8859InputCodingSystem iso8859_3InputCodingSystem(3);
static ISO8859InputCodingSystem iso8859_4InputCodingSystem(4);
static ISO8859InputCodingSystem iso8859_5InputCodingSystem(5);
static ISO8859InputCodingSystem iso8859_6InputCodingSystem(6);
static ISO8859InputCodingSystem iso8859_7InputCodingSystem(7);
static ISO8859InputCodingSystem iso8859_8InputCodingSystem(8);
static ISO8859InputCodingSystem iso8859_9InputCodingSystem(9);
static struct {
const char *name;
const InputCodingSystem *cs;
} inputCodingSystems[] = {
{ "IS8859-2", &iso8859_2InputCodingSystem },
{ "IS8859-3", &iso8859_3InputCodingSystem },
{ "IS8859-4", &iso8859_4InputCodingSystem },
{ "IS8859-5", &iso8859_5InputCodingSystem },
{ "IS8859-6", &iso8859_6InputCodingSystem },
{ "IS8859-7", &iso8859_7InputCodingSystem },
{ "IS8859-8", &iso8859_8InputCodingSystem },
{ "IS8859-9", &iso8859_9InputCodingSystem },
};
#endif /* SP_MULTI_BYTE */
#ifdef SP_MULTI_BYTE
static UnivCharsetDesc::Range range = { 0, 65536, 0 };
#else
static UnivCharsetDesc::Range range = { 0, 256, 0 };
#endif
EntityApp::EntityApp()
: mapCatalogDocument_(0),
systemCharset_(UnivCharsetDesc(&range, 1))
{
registerOption('c', SP_T("catalog_sysid"));
registerOption('C');
registerOption('D', SP_T("dir"));
}
void EntityApp::processOption(AppChar opt, const AppChar *arg)
{
switch (opt) {
case 'c':
catalogSysids_.push_back(arg);
break;
case 'C':
mapCatalogDocument_ = 1;
break;
case 'D':
searchDirs_.push_back(arg);
break;
default:
CmdLineApp::processOption(opt, arg);
break;
}
}
int EntityApp::processArguments(int argc, AppChar **argv)
{
StringC sysid;
if (!makeSystemId(argc, argv, sysid))
return 1;
return processSysid(sysid);
}
Boolean EntityApp::makeSystemId(int nFiles, AppChar *const *files,
StringC &result)
{
Vector<StringC> filenames(nFiles == 0 ? 1 : nFiles);
int i;
for (i = 0; i < nFiles; i++)
filenames[i] = convertInput(tcscmp(files[i], SP_T("-")) == 0
? SP_T("<OSFD>0")
: files[i]);
if (nFiles == 0)
filenames[0] = convertInput(SP_T("<OSFD>0"));
return entityManager()->mergeSystemIds(filenames,
mapCatalogDocument_,
systemCharset_,
*this,
result);
}
Ptr<ExtendEntityManager> &EntityApp::entityManager()
{
if (!entityManager_.isNull())
return entityManager_;
PosixStorageManager *sm
= new PosixStorageManager("OSFILE",
systemCharset_.desc(),
#ifndef SP_WIDE_SYSTEM
codingSystem(),
#endif
5);
size_t i;
for (i = 0; i < searchDirs_.size(); i++)
sm->addSearchDir(convertInput(searchDirs_[i]));
{
const AppChar *e = tgetenv(SP_T("SGML_SEARCH_PATH"));
if (!e)
e = SGML_SEARCH_PATH_DEFAULT;
if (*e) {
StringC str(convertInput(e));
size_t i = 0;
size_t start = 0;
for (;;) {
if (i == str.size() || str[i] == FILE_SEP) {
sm->addSearchDir(StringC(str.data() + start,
i - start));
if (i == str.size())
break;
start = ++i;
}
else
i++;
}
}
}
entityManager_ = ExtendEntityManager::make(sm, codingSystem());
entityManager_
->registerStorageManager(new PosixFdStorageManager("OSFD",
systemCharset_.desc()));
entityManager_->registerStorageManager(new URLStorageManager("URL"));
entityManager_->registerStorageManager(new LiteralStorageManager("LITERAL"));
for (i = 0;; i++) {
const char *s;
const CodingSystem *p = codingSystem(i, s);
if (!p)
break;
entityManager_->registerCodingSystem(s, p);
}
#ifdef SP_MULTI_BYTE
for (i = 0; i < SIZEOF(inputCodingSystems); i++)
entityManager_->registerCodingSystem(inputCodingSystems[i].name,
inputCodingSystems[i].cs);
#endif
Vector<StringC> v;
for (i = 0; i < catalogSysids_.size(); i++)
// filenames specified on command-line must exist
v.push_back(convertInput(catalogSysids_[i]));
{
const AppChar *e = tgetenv(SP_T("SGML_CATALOG_FILES"));
if (!e)
e = SGML_CATALOG_FILES_DEFAULT;
if (*e) {
StringC str(convertInput(e));
size_t i = 0;
size_t start = 0;
for (;;) {
if (i == str.size() || str[i] == FILE_SEP) {
v.push_back(StringC(str.data() + start,
i - start));
if (i == str.size())
break;
start = ++i;
}
else
i++;
}
}
}
entityManager_->setCatalogManager(SOCatalogManager::make(v,
catalogSysids_.size(),
systemCharset_,
systemCharset_));
return entityManager_;
}
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,71 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: EntityApp.h /main/1 1996/07/29 16:50:06 cde-hp $ */
// Copyright (c) 1996 James Clark
// See the file COPYING for copying permission.
#ifndef EntityApp_INCLUDED
#define EntityApp_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include "CmdLineApp.h"
#include "CharsetInfo.h"
#include "Boolean.h"
#include "ExtendEntityManager.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class SP_API EntityApp : public CmdLineApp {
public:
EntityApp();
void processOption(AppChar opt, const AppChar *arg);
virtual int processSysid(const StringC &) = 0;
int processArguments(int argc, AppChar **files);
Boolean makeSystemId(int nFiles, AppChar *const *files, StringC &result);
Ptr<ExtendEntityManager> &entityManager();
protected:
void clearEntityManager();
CharsetInfo systemCharset_;
private:
Vector<const AppChar *> searchDirs_;
Vector<const AppChar *> catalogSysids_;
Boolean mapCatalogDocument_;
Ptr<ExtendEntityManager> entityManager_;
};
inline
void EntityApp::clearEntityManager()
{
entityManager_.clear();
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not EntityApp_INCLUDED */

View file

@ -1,82 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: EntityCatalog.C /main/1 1996/07/29 16:50:12 cde-hp $ */
// Copyright (c) 1995 James Clark
// See the file COPYING for copying permission.
#ifdef __GNUG__
#pragma implementation
#endif
#include "splib.h"
#include "EntityCatalog.h"
#include "EntityDecl.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
EntityCatalog::~EntityCatalog()
{
}
Boolean EntityCatalog::sgmlDecl(const CharsetInfo &,
Messenger &,
StringC &) const
{
return 0;
}
Boolean EntityCatalog::lookup(const EntityDecl &decl,
const Syntax &,
const CharsetInfo &,
Messenger &,
StringC &str) const
{
const StringC *p = decl.systemIdPointer();
if (!p)
return 0;
str = *p;
return 1;
}
Boolean EntityCatalog::lookupPublic(const StringC &,
const CharsetInfo &,
Messenger &,
StringC &) const
{
return 0;
}
Boolean EntityCatalog::defaultDoctype(const CharsetInfo &,
Messenger &,
StringC &,
StringC &) const
{
return 0;
}
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,76 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: EntityCatalog.h /main/1 1996/07/29 16:50:18 cde-hp $ */
#ifndef EntityCatalog_INCLUDED
#define EntityCatalog_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include "types.h"
#include "StringC.h"
#include "Resource.h"
#include "SubstTable.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class Messenger;
class CharsetInfo;
class EntityDecl;
class SP_API EntityCatalog : public Resource {
public:
class SP_API Syntax {
public:
virtual Boolean namecaseGeneral() const = 0;
virtual Boolean namecaseEntity() const = 0;
virtual const SubstTable<Char> &upperSubstTable() const = 0;
virtual const StringC &peroDelim() const = 0;
};
virtual ~EntityCatalog();
virtual Boolean sgmlDecl(const CharsetInfo &,
Messenger &,
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 defaultDoctype(const CharsetInfo &,
Messenger &,
StringC &,
StringC &) const;
};
#ifdef SP_NAMESPACE
}
#endif
#endif /* not EntityCatalog_INCLUDED */

View file

@ -1,81 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: EntityDecl.C /main/1 1996/07/29 16:50:24 cde-hp $ */
// Copyright (c) 1995 James Clark
// See the file COPYING for copying permission.
#ifdef __GNUG__
#pragma implementation
#endif
#include "splib.h"
#include "EntityDecl.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
EntityDecl::EntityDecl(const StringC &str, DeclType declType, DataType dataType,
const Location &defLocation)
: NamedResource(str), declType_(declType), dataType_(dataType),
defLocation_(defLocation), dtdIsBase_(0), lpdIsActive_(0)
{
}
void EntityDecl::setDeclIn(const ConstPtr<StringResource<Char> > &dtdName,
Boolean dtdIsBase,
const ConstPtr<StringResource<Char> > &lpdName,
Boolean lpdIsActive)
{
dtdName_ = dtdName;
lpdName_ = lpdName;
dtdIsBase_ = dtdIsBase;
lpdIsActive_ = lpdIsActive;
}
void EntityDecl::setDeclIn(const ConstPtr<StringResource<Char> > &dtdName,
Boolean dtdIsBase)
{
dtdName_ = dtdName;
lpdName_.clear();
dtdIsBase_ = dtdIsBase;
}
const StringC *EntityDecl::systemIdPointer() const
{
return 0;
}
const StringC *EntityDecl::publicIdPointer() const
{
return 0;
}
const StringC *EntityDecl::effectiveSystemIdPointer() const
{
return 0;
}
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,130 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: EntityDecl.h /main/1 1996/07/29 16:50:29 cde-hp $ */
// Copyright (c) 1995 James Clark
// See the file COPYING for copying permission.
#ifndef EntityDecl_INCLUDED
#define EntityDecl_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include "NamedResource.h"
#include "Ptr.h"
#include "StringResource.h"
#include "Location.h"
#include "types.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class SP_API EntityDecl : public NamedResource {
public:
enum DeclType { generalEntity, parameterEntity, doctype, linktype,
notation };
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<StringResource<Char> > &dtdName,
Boolean dtdIsBase,
const ConstPtr<StringResource<Char> > &lpdName,
Boolean lpdIsActive);
void setDeclIn(const ConstPtr<StringResource<Char> > &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<StringResource<Char> > dtdName_;
ConstPtr<StringResource<Char> > 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;
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not EntityDecl_INCLUDED */

View file

@ -1,44 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: EntityManager.C /main/1 1996/07/29 16:50:33 cde-hp $ */
// Copyright (c) 1995 James Clark
// See the file COPYING for copying permission.
#ifdef __GNUG__
#pragma implementation
#endif
#include "splib.h"
#include "EntityManager.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
EntityManager::~EntityManager()
{
}
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,68 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: EntityManager.h /main/1 1996/07/29 16:50:39 cde-hp $ */
// Copyright (c) 1995 James Clark
// See the file COPYING for copying permission.
#ifndef EntityManager_INCLUDED
#define EntityManager_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include "types.h"
#include "StringC.h"
#include "Resource.h"
#include "EntityCatalog.h"
#include "Ptr.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class Messenger;
class InputSourceOrigin;
class CharsetInfo;
class InputSource;
class SP_API EntityManager : public Resource {
public:
virtual ~EntityManager();
virtual InputSource *open(const StringC &sysid,
const CharsetInfo &,
InputSourceOrigin *,
Boolean mayRewind,
Messenger &) = 0;
// Make a catalog for a document or subdocument with specified
// system identifier.
// The catalog can cause the system identifier to be replaced.
virtual ConstPtr<EntityCatalog>
makeCatalog(StringC &systemId, const CharsetInfo &, Messenger &) = 0;
};
#ifdef SP_NAMESPACE
}
#endif
#endif /* not EntityManager_INCLUDED */

View file

@ -1,301 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: EntityManagerMessages.h /main/1 1996/07/29 16:50:47 cde-hp $ */
// This file was automatically generated from EntityManagerMessages.msg by msggen.pl.
#include "Message.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
struct EntityManagerMessages {
// 2000
static const MessageType1 fsiSyntax;
// 2001
static const MessageType1 fsiMissingValue;
// 2002
static const MessageType1 fsiValueAsName;
// 2003
static const MessageType1 fsiBadSmcrd;
// 2004
static const MessageType1 fsiUnknownBctf;
// 2005
static const MessageType1 fsiUnsupportedRecords;
// 2006
static const MessageType1 fsiUnsupportedAttribute;
// 2007
static const MessageType1 fsiUnsupportedAttributeToken;
// 2008
static const MessageType1 fsiBadTracking;
// 2009
static const MessageType1 fsiDuplicateAttribute;
// 2010
static const MessageType1 fsiBadZapeof;
// 2011
static const MessageType1 fsiBadSearch;
// 2012
static const MessageType1 fsiBadFold;
// 2013
static const MessageType0 fsiFoldNotNeutral;
// 2014
static const MessageType0 fsiBctfNotApplicable;
// 2015
static const MessageType0 fsiZapeofNotApplicable;
// 2016
static const MessageType0 fsiRecordsNotApplicable;
// 2017
static const MessageType1 fsiBadIndirect;
// 2018
static const MessageType1 fsiLookupChar;
};
const MessageType1 EntityManagerMessages::fsiSyntax(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2000
#ifndef SP_NO_MESSAGE_TEXT
,"bad formal system identifier syntax in %1"
#endif
);
const MessageType1 EntityManagerMessages::fsiMissingValue(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2001
#ifndef SP_NO_MESSAGE_TEXT
,"value for attribute %1 missing in formal system identifier"
#endif
);
const MessageType1 EntityManagerMessages::fsiValueAsName(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2002
#ifndef SP_NO_MESSAGE_TEXT
,"%1 is a formal system identifier attribute value not an attribute name"
#endif
);
const MessageType1 EntityManagerMessages::fsiBadSmcrd(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2003
#ifndef SP_NO_MESSAGE_TEXT
,"value of SMCRD attribute must be a single character not %1"
#endif
);
const MessageType1 EntityManagerMessages::fsiUnknownBctf(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2004
#ifndef SP_NO_MESSAGE_TEXT
,"unknown BCTF %1"
#endif
);
const MessageType1 EntityManagerMessages::fsiUnsupportedRecords(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2005
#ifndef SP_NO_MESSAGE_TEXT
,"unsupported record boundary indicator %1"
#endif
);
const MessageType1 EntityManagerMessages::fsiUnsupportedAttribute(
MessageType::warning,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2006
#ifndef SP_NO_MESSAGE_TEXT
,"unsupported formal system identifier attribute %1"
#endif
);
const MessageType1 EntityManagerMessages::fsiUnsupportedAttributeToken(
MessageType::warning,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2007
#ifndef SP_NO_MESSAGE_TEXT
,"unsupported formal system identifier attribute value %1"
#endif
);
const MessageType1 EntityManagerMessages::fsiBadTracking(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2008
#ifndef SP_NO_MESSAGE_TEXT
,"bad value %1 for formal system identifier tracking attribute"
#endif
);
const MessageType1 EntityManagerMessages::fsiDuplicateAttribute(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2009
#ifndef SP_NO_MESSAGE_TEXT
,"duplicate specification for formal system identifier attribute %1"
#endif
);
const MessageType1 EntityManagerMessages::fsiBadZapeof(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2010
#ifndef SP_NO_MESSAGE_TEXT
,"bad value %1 for formal system identifier zapeof attribute"
#endif
);
const MessageType1 EntityManagerMessages::fsiBadSearch(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2011
#ifndef SP_NO_MESSAGE_TEXT
,"bad value %1 for formal system identifier search attribute"
#endif
);
const MessageType1 EntityManagerMessages::fsiBadFold(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2012
#ifndef SP_NO_MESSAGE_TEXT
,"bad value %1 for formal system identifier fold attribute"
#endif
);
const MessageType0 EntityManagerMessages::fsiFoldNotNeutral(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2013
#ifndef SP_NO_MESSAGE_TEXT
,"fold attribute allowed only for neutral storage manager"
#endif
);
const MessageType0 EntityManagerMessages::fsiBctfNotApplicable(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2014
#ifndef SP_NO_MESSAGE_TEXT
,"BCTF attribute not applicable to this storage manager"
#endif
);
const MessageType0 EntityManagerMessages::fsiZapeofNotApplicable(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2015
#ifndef SP_NO_MESSAGE_TEXT
,"ZAPEOF attribute not applicable to this storage manager"
#endif
);
const MessageType0 EntityManagerMessages::fsiRecordsNotApplicable(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2016
#ifndef SP_NO_MESSAGE_TEXT
,"RECORDS attribute not applicable to this storage manager"
#endif
);
const MessageType1 EntityManagerMessages::fsiBadIndirect(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2017
#ifndef SP_NO_MESSAGE_TEXT
,"bad value %1 for formal system identifier indirect attribute"
#endif
);
const MessageType1 EntityManagerMessages::fsiLookupChar(
MessageType::error,
#ifdef BUILD_LIBSP
MessageFragment::libModule,
#else
MessageFragment::appModule,
#endif
2018
#ifndef SP_NO_MESSAGE_TEXT
,"non-minimum data character (number %1) in value of formal system identifier lookup attribute"
#endif
);
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,48 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: EquivClass.h /main/1 1996/07/29 16:50:53 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef EquivClass_INCLUDED
#define EquivClass_INCLUDED 1
#include "Link.h"
#include "types.h"
#include "ISet.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
struct EquivClass : public Link {
EquivClass(unsigned in = 0) : inSets(in) { }
ISet<Char> set;
unsigned inSets;
};
#ifdef SP_NAMESPACE
}
#endif
#endif /* not EquivClass_INCLUDED */

View file

@ -1,47 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: ErrnoMessageArg.C /main/1 1996/07/29 16:50:58 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#include "splib.h"
#include "ErrnoMessageArg.h"
#include "StringOf.h"
#include "MessageBuilder.h"
#include <string.h>
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
RTTI_DEF1(ErrnoMessageArg, OtherMessageArg)
MessageArg *ErrnoMessageArg::copy() const
{
return new ErrnoMessageArg(*this);
}
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,58 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: ErrnoMessageArg.h /main/1 1996/07/29 16:51:02 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef ErrnoMessageArg_INCLUDED
#define ErrnoMessageArg_INCLUDED 1
#include "MessageArg.h"
#include "rtti.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class SP_API ErrnoMessageArg : public OtherMessageArg {
RTTI_CLASS
public:
ErrnoMessageArg(int errnum) : errno_(errnum) { }
MessageArg *copy() const;
// errno might be a macro so we must use a different name
int errnum() const;
private:
int errno_;
};
inline
int ErrnoMessageArg::errnum() const
{
return errno_;
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not ErrnoMessageArg_INCLUDED */

View file

@ -1,56 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: ErrorCountEventHandler.C /main/1 1996/07/29 16:51:07 cde-hp $ */
// Copyright (c) 1996 James Clark
// See the file COPYING for copying permission.
#ifdef __GNUG__
#pragma implementation
#endif
#include "splib.h"
#include "ErrorCountEventHandler.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
ErrorCountEventHandler::ErrorCountEventHandler(unsigned errorLimit)
: errorCount_(0), maxErrors_(errorLimit), cancel_(0)
{
}
void ErrorCountEventHandler::message(MessageEvent *event)
{
noteMessage(event->message());
delete event;
}
void ErrorCountEventHandler::noteMessage(const Message &message)
{
if (message.isError() && ++errorCount_ == maxErrors_)
cancel_ = 1;
}
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,91 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: ErrorCountEventHandler.h /main/1 1996/07/29 16:51:11 cde-hp $ */
// Copyright (c) 1996 James Clark
// See the file COPYING for copying permission.
#ifndef ErrorCountEventHandler_INCLUDED
#define ErrorCountEventHandler_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include <signal.h>
#include "Event.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class SP_API ErrorCountEventHandler : public EventHandler {
public:
ErrorCountEventHandler(unsigned errorLimit = 0);
void setErrorLimit(unsigned maxErrors);
const sig_atomic_t *cancelPtr() const;
void cancel();
Boolean cancelled() const;
unsigned errorCount() const;
void message(MessageEvent *);
void noteMessage(const Message &);
private:
unsigned maxErrors_;
unsigned errorCount_;
sig_atomic_t cancel_;
};
inline
unsigned ErrorCountEventHandler::errorCount() const
{
return errorCount_;
}
inline
const sig_atomic_t *ErrorCountEventHandler::cancelPtr() const
{
return &cancel_;
}
inline
void ErrorCountEventHandler::cancel()
{
cancel_ = 1;
}
inline
void ErrorCountEventHandler::setErrorLimit(unsigned maxErrors)
{
maxErrors_ = maxErrors;
}
inline
Boolean ErrorCountEventHandler::cancelled() const
{
return cancel_ != 0;
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not ErrorCountEventHandler_INCLUDED */

View file

@ -1,591 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: Event.C /main/1 1996/07/29 16:51:15 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifdef __GNUG__
#pragma implementation
#endif
#include "splib.h"
#include "Event.h"
#include "Entity.h"
#include "Attribute.h"
#include "EventQueue.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
void Event::copyData()
{
}
LocatedEvent::LocatedEvent(Type type, const Location &location)
: location_(location), Event(type)
{
}
MarkupEvent::MarkupEvent(Type type)
: LocatedEvent(type, Location())
{
}
MarkupEvent::MarkupEvent(Type type, const Location &loc, Markup *markup)
: LocatedEvent(type, loc)
{
if (markup)
markup->swap(markup_);
}
StartElementEvent::StartElementEvent(const ElementType *elementType,
const ConstPtr<Dtd> &dtd,
AttributeList *attributes,
const Location &startLocation,
Markup *markup)
: LocatedEvent(startElement, startLocation),
elementType_(elementType),
dtd_(dtd),
included_(0),
copied_(0),
markup_(markup),
attributes_(attributes)
{
}
StartElementEvent::~StartElementEvent()
{
if (copied_) {
delete attributes_;
delete markup_;
}
}
void StartElementEvent::copyData()
{
if (!copied_) {
{
AttributeList *p = new AttributeList;
attributes_->swap(*p);
attributes_ = p;
}
if (markup_) {
Markup *p = new Markup;
markup_->swap(*p);
markup_ = p;
}
copied_ = 1;
}
}
EndElementEvent::EndElementEvent(const ElementType *elementType,
const ConstPtr<Dtd> &dtd,
const Location &startLocation,
Markup *markup)
: LocatedEvent(endElement, startLocation),
elementType_(elementType),
dtd_(dtd),
included_(0),
copied_(0),
markup_(markup)
{
}
EndElementEvent::~EndElementEvent()
{
if (copied_)
delete markup_;
}
void EndElementEvent::copyData()
{
if (!copied_) {
if (markup_) {
Markup *p = new Markup;
markup_->swap(*p);
markup_ = p;
}
copied_ = 1;
}
}
DataEvent::DataEvent(Type type, const Char *p, size_t length,
const Location &location)
: p_(p),length_(length), LocatedEvent(type, location)
{
}
const Entity *DataEvent::entity() const
{
return 0;
}
Boolean DataEvent::isRe(unsigned long &) const
{
return 0;
}
ImmediateDataEvent::ImmediateDataEvent(Type type, const Char *p, size_t length,
const Location &location,
Boolean copy)
: DataEvent(type, p, length, location), alloc_(0)
{
if (copy)
ImmediateDataEvent::copyData();
}
ImmediateDataEvent::~ImmediateDataEvent()
{
if (alloc_)
delete [] alloc_;
}
void ImmediateDataEvent::copyData()
{
if (!alloc_) {
alloc_ = new Char[length_];
memcpy(alloc_, p_, length_*sizeof(Char));
p_ = alloc_;
}
}
ReEvent::ReEvent(const Char *p, const Location &location, unsigned long serial)
: ImmediateDataEvent(characterData, p, 1, location, 0),
serial_(serial)
{
}
Boolean ReEvent::isRe(unsigned long &serial) const
{
serial = serial_;
return 1;
}
DataEntityEvent::DataEntityEvent(Type type, const InternalEntity *entity,
const ConstPtr<Origin> &origin)
: DataEvent(type,
entity->string().data(),
entity->string().size(),
Location(origin, 0))
{
}
const Entity *DataEntityEvent::entity() const
{
return location().origin()->asEntityOrigin()->entity().pointer();
}
CdataEntityEvent::CdataEntityEvent(const InternalEntity *entity,
const ConstPtr<Origin> &origin)
: DataEntityEvent(characterData, entity, origin)
{
}
SdataEntityEvent::SdataEntityEvent(const InternalEntity *entity,
const ConstPtr<Origin> &origin)
: DataEntityEvent(sdataEntity, entity, origin)
{
}
MessageEvent::MessageEvent(const Message &m)
: Event(Event::message), message_(m)
{
}
MessageEvent::MessageEvent(Message &m)
: Event(Event::message)
{
m.swap(message_);
}
PiEvent::PiEvent(const Char *data, size_t dataLength, const Location &location)
: data_(data), dataLength_(dataLength), LocatedEvent(pi, location)
{
}
const Entity *PiEvent::entity() const
{
return 0;
}
PiEntityEvent::PiEntityEvent(const PiEntity *entity,
const ConstPtr<Origin> &origin)
: PiEvent(entity->string().data(), entity->string().size(),
Location(origin, 0))
{
}
const Entity *PiEntityEvent::entity() const
{
return location().origin()->asEntityOrigin()->entity().pointer();
}
ImmediatePiEvent::ImmediatePiEvent(StringC &str, const Location &loc)
: PiEvent(str.data(), str.size(), loc)
{
str.swap(string_);
}
ExternalEntityEvent::ExternalEntityEvent(Type type,
const ConstPtr<EntityOrigin> &origin)
: origin_(origin), Event(type)
{
}
ExternalDataEntityEvent::ExternalDataEntityEvent(const ExternalDataEntity *entity,
const ConstPtr<EntityOrigin> &origin)
: dataEntity_(entity), ExternalEntityEvent(externalDataEntity, origin)
{
}
SubdocEntityEvent::SubdocEntityEvent(const SubdocEntity *entity,
const ConstPtr<EntityOrigin> &origin)
: subdocEntity_(entity), ExternalEntityEvent(subdocEntity, origin)
{
}
AppinfoEvent::AppinfoEvent(const Location &location)
: LocatedEvent(appinfo, location), appinfoNone_(1)
{
}
AppinfoEvent::AppinfoEvent(const Text &text, const Location &location)
: LocatedEvent(appinfo, location), appinfoNone_(0), appinfo_(text)
{
}
UselinkEvent::UselinkEvent(const ConstPtr<Lpd> &lpd,
const LinkSet *linkSet,
Boolean restore,
const Location &loc,
Markup *markup)
: MarkupEvent(uselink, loc, markup),
lpd_(lpd),
linkSet_(linkSet),
restore_(restore)
{
}
UsemapEvent::UsemapEvent(const ShortReferenceMap *map,
Vector<const ElementType *> &elements,
const ConstPtr<Dtd> &dtd,
const Location &loc,
Markup *markup)
: MarkupEvent(usemap, loc, markup),
map_(map),
dtd_(dtd)
{
elements.swap(elements_);
}
StartSubsetEvent::StartSubsetEvent(Type type,
const StringC &name,
const ConstPtr<Entity> &entity,
Boolean hasInternalSubset,
const Location &loc,
Markup *markup)
: name_(name), entity_(entity), hasInternalSubset_(hasInternalSubset),
MarkupEvent(type, loc, markup)
{
}
StartDtdEvent::StartDtdEvent(const StringC &name,
const ConstPtr<Entity> &entity,
Boolean hasInternalSubset,
const Location &loc,
Markup *markup)
: StartSubsetEvent(startDtd, name, entity, hasInternalSubset, loc, markup)
{
}
StartLpdEvent::StartLpdEvent(Boolean active,
const StringC &name,
const ConstPtr<Entity> &entity,
Boolean hasInternalSubset,
const Location &loc,
Markup *markup)
: StartSubsetEvent(startLpd, name, entity, hasInternalSubset, loc, markup),
active_(active)
{
}
EndDtdEvent::EndDtdEvent(const ConstPtr<Dtd> &dtd,
const Location &loc,
Markup *markup)
: MarkupEvent(endDtd, loc, markup), dtd_(dtd)
{
}
EndLpdEvent::EndLpdEvent(const ConstPtr<Lpd> &lpd,
const Location &loc,
Markup *markup)
: MarkupEvent(endLpd, loc, markup), lpd_(lpd)
{
}
EndPrologEvent::EndPrologEvent(const ConstPtr<Dtd> &dtd,
const ConstPtr<ComplexLpd> &lpd,
Vector<StringC> &simpleLinkNames,
Vector<AttributeList> &simpleLinkAttributes,
const Location &location)
: LocatedEvent(endProlog, location), dtd_(dtd), lpd_(lpd)
{
simpleLinkAttributes.swap(simpleLinkAttributes_);
simpleLinkNames.swap(simpleLinkNames_);
}
EndPrologEvent::EndPrologEvent(const ConstPtr<Dtd> &dtd,
const Location &location)
: LocatedEvent(endProlog, location), dtd_(dtd)
{
}
SgmlDeclEvent::SgmlDeclEvent(const ConstPtr<Sd> &sd,
const ConstPtr<Syntax> &syntax)
: sd_(sd), prologSyntax_(syntax), instanceSyntax_(syntax),
nextIndex_(0), MarkupEvent(sgmlDecl)
{
}
SgmlDeclEvent::SgmlDeclEvent(const ConstPtr<Sd> &sd,
const ConstPtr<Syntax> &prologSyntax,
const ConstPtr<Syntax> &instanceSyntax,
const ConstPtr<Sd> &refSd,
const ConstPtr<Syntax> &refSyntax,
Index nextIndex,
const StringC &implySystemId,
const Location &loc,
Markup *markup)
: sd_(sd), prologSyntax_(prologSyntax), instanceSyntax_(instanceSyntax),
refSd_(refSd), refSyntax_(refSyntax),
nextIndex_(nextIndex), implySystemId_(implySystemId),
MarkupEvent(sgmlDecl, loc, markup)
{
}
CommentDeclEvent::CommentDeclEvent(const Location &loc,
Markup *markup)
: MarkupEvent(commentDecl, loc, markup)
{
}
SSepEvent::SSepEvent(const Char *p, size_t length,
const Location &location, Boolean copy)
: ImmediateDataEvent(sSep, p, length, location, copy)
{
}
IgnoredRsEvent::IgnoredRsEvent(Char c, const Location &location)
: LocatedEvent(ignoredRs, location), c_(c)
{
}
IgnoredReEvent::IgnoredReEvent(Char c, const Location &location,
unsigned long serial)
: LocatedEvent(ignoredRe, location),
c_(c),
serial_(serial)
{
}
ReOriginEvent::ReOriginEvent(Char c, const Location &location,
unsigned long serial)
: LocatedEvent(reOrigin, location), c_(c), serial_(serial)
{
}
IgnoredCharsEvent::IgnoredCharsEvent(const Char *p, size_t length,
const Location &location, Boolean copy)
: ImmediateDataEvent(ignoredChars, p, length, location, copy)
{
}
MarkedSectionEvent::MarkedSectionEvent(Type type, Status status,
const Location &loc,
Markup *markup)
: MarkupEvent(type, loc, markup),
status_(status)
{
}
MarkedSectionStartEvent::MarkedSectionStartEvent(Status status,
const Location &loc,
Markup *markup)
: MarkedSectionEvent(markedSectionStart, status, loc, markup)
{
}
MarkedSectionEndEvent::MarkedSectionEndEvent(Status status,
const Location &loc,
Markup *markup)
: MarkedSectionEvent(markedSectionEnd, status, loc, markup)
{
}
EntityStartEvent::EntityStartEvent(const ConstPtr<EntityOrigin> &origin)
: Event(entityStart), origin_(origin)
{
}
EntityEndEvent::EntityEndEvent(const Location &location)
: LocatedEvent(entityEnd, location)
{
}
EntityDeclEvent:: EntityDeclEvent(const ConstPtr<Entity> &entity,
Boolean ignored, const Location &loc,
Markup *markup)
: MarkupEvent(entityDecl, loc, markup),
entity_(entity),
ignored_(ignored)
{
}
NotationDeclEvent:: NotationDeclEvent(const ConstPtr<Notation> &notation,
const Location &loc,
Markup *markup)
: MarkupEvent(notationDecl, loc, markup), notation_(notation)
{
}
ElementDeclEvent::ElementDeclEvent(Vector<const ElementType *> &elements,
const ConstPtr<Dtd> &dtd,
const Location &loc,
Markup *markup)
: MarkupEvent(elementDecl, loc, markup), dtd_(dtd)
{
elements.swap(elements_);
}
AttlistDeclEvent::AttlistDeclEvent(Vector<const ElementType *> &elements,
const ConstPtr<Dtd> &dtd,
const Location &loc,
Markup *markup)
: MarkupEvent(attlistDecl, loc, markup), dtd_(dtd)
{
elements.swap(elements_);
}
AttlistNotationDeclEvent::AttlistNotationDeclEvent(
Vector<ConstPtr<Notation> > &notations, const Location &loc,
Markup *markup)
: MarkupEvent(attlistNotationDecl, loc, markup)
{
notations.swap(notations_);
}
LinkAttlistDeclEvent
::LinkAttlistDeclEvent(Vector<const ElementType *> &elements,
const ConstPtr<Lpd> &lpd,
const Location &loc,
Markup *markup)
: MarkupEvent(linkAttlistDecl, loc, markup), lpd_(lpd)
{
elements.swap(elements_);
}
LinkDeclEvent::LinkDeclEvent(const LinkSet *linkSet,
const ConstPtr<ComplexLpd> &lpd,
const Location &loc,
Markup *markup)
: MarkupEvent(linkDecl, loc, markup), lpd_(lpd), linkSet_(linkSet)
{
}
IdLinkDeclEvent::IdLinkDeclEvent(const ConstPtr<ComplexLpd> &lpd,
const Location &loc,
Markup *markup)
: MarkupEvent(linkDecl, loc, markup), lpd_(lpd)
{
}
ShortrefDeclEvent::ShortrefDeclEvent(const ShortReferenceMap *map,
const ConstPtr<Dtd> &dtd,
const Location &loc,
Markup *markup)
: MarkupEvent(shortrefDecl, loc, markup), map_(map), dtd_(dtd)
{
}
IgnoredMarkupEvent::IgnoredMarkupEvent(const Location &loc,
Markup *markup)
: MarkupEvent(ignoredMarkup, loc, markup)
{
}
EntityDefaultedEvent::EntityDefaultedEvent(const ConstPtr<Entity> &entity,
const Location &loc)
: LocatedEvent(entityDefaulted, loc), entity_(entity)
{
}
SgmlDeclEntityEvent:: SgmlDeclEntityEvent(const PublicId &publicId,
PublicId::TextClass entityType,
const StringC &effectiveSystemId,
const Location &loc)
: LocatedEvent(sgmlDeclEntity, loc), publicId_(publicId),
entityType_(entityType), effectiveSystemId_(effectiveSystemId)
{
}
EventHandler::~EventHandler()
{
}
EventQueue::EventQueue()
{
}
#define EVENT(c, f) \
void EventHandler::f(c *event) { delete event; } \
void EventQueue::f(c *event) { append(event); } \
void c::handle(EventHandler &handler) { handler.f(this); }
#include "events.h"
#undef EVENT
Pass1EventHandler::Pass1EventHandler()
: hadError_(0), origHandler_(0)
{
}
void Pass1EventHandler::init(EventHandler *origHandler)
{
hadError_ = 0;
origHandler_ = origHandler;
}
void Pass1EventHandler::message(MessageEvent *event)
{
if (event->message().isError()) {
hadError_ = 1;
origHandler_->message(event);
}
else
IQueue<Event>::append(event);
}
#ifdef SP_NAMESPACE
}
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,48 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: EventGenerator.C /main/1 1996/07/29 16:51:25 cde-hp $ */
// Copyright (c) 1995 James Clark
// See the file COPYING for copying permission.
#ifdef __GNUG__
#pragma implementation
#endif
#include "splib.h"
#include "Boolean.h"
#include "EventGenerator.h"
EventGenerator::~EventGenerator()
{
}
void EventGenerator::inhibitMessages(bool)
{
}
EventGenerator *
EventGenerator::makeSubdocEventGenerator(const SGMLApplication::Char *,
size_t)
{
return 0;
}

View file

@ -1,52 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: EventGenerator.h /main/1 1996/07/29 16:51:29 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef EventGenerator_INCLUDED
#define EventGenerator_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include "SGMLApplication.h"
class SP_API EventGenerator {
public:
virtual ~EventGenerator();
// Can be called at most once for any object.
// Returns number of errors.
virtual unsigned run(SGMLApplication &) = 0;
// may be called at any time
virtual void inhibitMessages(bool);
// may be called at any time, even from another thread
virtual void halt() = 0;
// called after run
virtual EventGenerator *
makeSubdocEventGenerator(const SGMLApplication::Char *systemId,
size_t systemIdLength);
};
#endif /* not EventGenerator_INCLUDED */

View file

@ -1,81 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: EventQueue.h /main/1 1996/07/29 16:51:33 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef EventQueue_INCLUDED
#define EventQueue_INCLUDED 1
#include "IQueue.h"
#include "Event.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class EventQueue : public EventHandler, public IQueue<Event> {
public:
EventQueue();
private:
#define EVENT(c, f) void f(c *);
#include "events.h"
#undef EVENT
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<Event>::append(event);
}
inline
Boolean Pass1EventHandler::hadError() const
{
return hadError_;
}
inline
EventHandler *Pass1EventHandler::origHandler() const
{
return origHandler_;
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not EventQueue_INCLUDED */

View file

@ -1,114 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: EventsWanted.h /main/1 1996/07/29 16:51:38 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef EventsWanted_INCLUDED
#define EventsWanted_INCLUDED 1
#include "Boolean.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class SP_API EventsWanted {
public:
EventsWanted();
Boolean wantInstanceMarkup() const;
Boolean wantCommentDecls() const; // in instance
Boolean wantMarkedSections() const; // in instance
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;
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not EventsWanted_INCLUDED */

File diff suppressed because it is too large Load diff

View file

@ -1,149 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: ExtendEntityManager.h /main/1 1996/07/29 16:51:47 cde-hp $ */
// Copyright (c) 1994, 1995 James Clark
// See the file COPYING for copying permission.
#ifndef ExtendEntityManager_INCLUDED
#define ExtendEntityManager_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include "EntityManager.h"
#include "CharsetInfo.h"
#include "types.h"
#include "Boolean.h"
#include "StringC.h"
#include "types.h"
#include "Vector.h"
#include "Location.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class StorageManager;
class InputCodingSystem;
class Messenger;
struct SP_API StorageObjectSpec {
StorageObjectSpec();
StorageManager *storageManager;
const char *codingSystemName;
const InputCodingSystem *codingSystem;
StringC specId; // specified id
StringC baseId; // id that specified id is relative to
StringC id; // actual id used (filled in after opening)
enum Records {
find,
cr,
lf,
crlf,
asis
};
Records records;
PackedBoolean notrack;
PackedBoolean zapEof; // zap a final Ctrl-Z
PackedBoolean search;
};
struct SP_API ParsedSystemIdMap {
enum Type {
catalogDocument,
catalogPublic
};
Type type;
StringC publicId;
};
struct SP_API ParsedSystemId : public Vector<StorageObjectSpec> {
ParsedSystemId();
void unparse(const CharsetInfo &charset, StringC &result) const;
Vector<ParsedSystemIdMap> maps;
};
struct SP_API StorageObjectLocation {
const StorageObjectSpec *storageObjectSpec;
unsigned long lineNumber;
unsigned long columnNumber;
unsigned long byteIndex;
unsigned long storageObjectOffset;
};
class SP_API ExtendEntityManager : public EntityManager {
public:
class SP_API CatalogManager {
public:
virtual ~CatalogManager();
virtual ConstPtr<EntityCatalog>
makeCatalog(StringC &systemId,
const CharsetInfo &charset,
ExtendEntityManager *,
Messenger &) const = 0;
virtual Boolean mapCatalog(ParsedSystemId &systemId,
ExtendEntityManager *em,
Messenger &mgr) const = 0;
};
virtual void registerStorageManager(StorageManager *) = 0;
virtual void registerCodingSystem(const char *, const InputCodingSystem *)
= 0;
virtual void setCatalogManager(CatalogManager *) = 0;
virtual InputSource *openIfExists(const StringC &sysid,
const CharsetInfo &,
InputSourceOrigin *,
Boolean mayRewind,
Messenger &) = 0;
virtual Boolean expandSystemId(const StringC &,
const Location &,
Boolean isNdata,
const CharsetInfo &,
const StringC *mapCatalogPublic,
Messenger &,
StringC &) = 0;
virtual Boolean mergeSystemIds(const Vector<StringC> &sysids,
Boolean mapCatalogDocument,
const CharsetInfo &,
Messenger &mgr,
StringC &) const = 0;
virtual Boolean parseSystemId(const StringC &str,
const CharsetInfo &idCharset,
Boolean isNdata,
const StorageObjectSpec *defSpec,
Messenger &mgr,
ParsedSystemId &parsedSysid) const = 0;
static Boolean externalize(const ExternalInfo *,
Offset,
StorageObjectLocation &);
static const ParsedSystemId *
externalInfoParsedSystemId(const ExternalInfo *);
static ExtendEntityManager *make(StorageManager *,
const InputCodingSystem *);
};
#ifdef SP_NAMESPACE
}
#endif
#endif /* not ExtendEntityManager_INCLUDED */

View file

@ -1,287 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: ExternalId.C /main/1 1996/07/29 16:51:51 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifdef __GNUG__
#pragma implementation
#endif
#include "splib.h"
#include "ExternalId.h"
#include "CharsetInfo.h"
#include "macros.h"
#include "ParserMessages.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
ExternalId::ExternalId()
: haveSystem_(0), havePublic_(0)
{
}
void ExternalId::setSystem(Text &text)
{
text.swap(system_);
haveSystem_ = 1;
}
Boolean ExternalId::setPublic(Text &text, const CharsetInfo &charset,
Char space, const MessageType1 *&error)
{
havePublic_ = 1;
return public_.init(text, charset, space, error);
}
void ExternalId::setLocation(const Location &loc)
{
loc_ = loc;
}
PublicId::PublicId()
: formal_(0), ownerType_(ISO), textClass_(CAPACITY), unavailable_(false), haveDisplayVersion_(false)
{
}
Boolean PublicId::init(Text &text, const CharsetInfo &charset,
Char space, const MessageType1 *&error)
{
text.swap(text_);
const StringC &str = text_.string();
formal_ = 0;
const Char *next = str.data();
const Char *lim = str.data() + str.size();
Char solidus = charset.execToDesc('/');
Char minus = charset.execToDesc('-');
Char plus = charset.execToDesc('+');
const Char *fieldStart;
size_t fieldLength;
if (!nextField(solidus, next, lim, fieldStart, fieldLength)) {
error = &ParserMessages::fpiMissingField;
return 0;
}
if (fieldLength == 1 && (*fieldStart == minus || *fieldStart == plus)) {
ownerType_ = (*fieldStart == plus ? registered : unregistered);
if (!nextField(solidus, next, lim, fieldStart, fieldLength)) {
error = &ParserMessages::fpiMissingField;
return 0;
}
}
else
ownerType_ = ISO;
owner_.assign(fieldStart, fieldLength);
if (!nextField(solidus, next, lim, fieldStart, fieldLength)) {
error = &ParserMessages::fpiMissingField;
return 0;
}
size_t i;
for (i = 0; i < fieldLength; i++)
if (fieldStart[i] == space)
break;
if (i >= fieldLength) {
error = &ParserMessages::fpiMissingTextClassSpace;
return 0;
}
StringC textClassString(fieldStart, i);
if (!lookupTextClass(textClassString, charset, textClass_)) {
error = &ParserMessages::fpiInvalidTextClass;
return 0;
}
i++; // skip the space
fieldStart += i;
fieldLength -= i;
if (fieldLength == 1 && *fieldStart == minus) {
unavailable_ = 1;
if (!nextField(solidus, next, lim, fieldStart, fieldLength)) {
error = &ParserMessages::fpiMissingField;
return 0;
}
}
else
unavailable_ = 0;
description_.assign(fieldStart, fieldLength);
if (!nextField(solidus, next, lim, fieldStart, fieldLength)) {
error = &ParserMessages::fpiMissingField;
return 0;
}
if (textClass_ != CHARSET) {
for (i = 0; i < fieldLength; i++) {
UnivChar c;
if (!charset.descToUniv(fieldStart[i], c)
|| c < UnivCharsetDesc::A || c >= UnivCharsetDesc::A + 26) {
error = &ParserMessages::fpiInvalidLanguage;
return 0;
}
}
// The public text language must be a name.
// Names cannot be empty.
if (fieldLength == 0) {
error = &ParserMessages::fpiInvalidLanguage;
return 0;
}
}
languageOrDesignatingSequence_.assign(fieldStart, fieldLength);
if (nextField(solidus, next, lim, fieldStart, fieldLength)) {
switch (textClass_) {
case CAPACITY:
case CHARSET:
case NOTATION:
case SYNTAX:
error = &ParserMessages::fpiIllegalDisplayVersion;
return 0;
default:
break;
}
haveDisplayVersion_ = 1;
displayVersion_.assign(fieldStart, fieldLength);
}
else
haveDisplayVersion_ = 0;
if (next != 0) {
error = &ParserMessages::fpiExtraField;
return 0;
}
formal_ = 1;
return 1;
}
Boolean PublicId::nextField(Char solidus,
const Char *&next,
const Char *lim,
const Char *&fieldStart,
size_t &fieldLength)
{
if (next == 0)
return 0;
fieldStart = next;
for (; next < lim; next++) {
if (next[0] == solidus && next + 1 < lim && next[1] == solidus) {
fieldLength = next - fieldStart;
next += 2;
return 1;
}
}
fieldLength = lim - fieldStart;
next = 0;
return 1;
}
const char *const PublicId::textClasses[] = {
"CAPACITY",
"CHARSET",
"DOCUMENT",
"DTD",
"ELEMENTS",
"ENTITIES",
"LPD",
"NONSGML",
"NOTATION",
"SHORTREF",
"SUBDOC",
"SYNTAX",
"TEXT",
};
Boolean PublicId::lookupTextClass(const StringC &str,
const CharsetInfo &charset,
TextClass &textClass)
{
for (size_t i = 0; i < SIZEOF(textClasses); i++)
if (str == charset.execToDesc(textClasses[i])) {
textClass = TextClass(i);
return 1;
}
return 0;
}
Boolean PublicId::getOwnerType(OwnerType &result) const
{
if (!formal_)
return 0;
result = ownerType_;
return 1;
}
Boolean PublicId::getOwner(StringC &result) const
{
if (!formal_)
return 0;
result = owner_;
return 1;
}
Boolean PublicId::getTextClass(TextClass &result) const
{
if (!formal_)
return 0;
result = textClass_;
return 1;
}
Boolean PublicId::getUnavailable(Boolean &result) const
{
if (!formal_)
return 0;
result = unavailable_;
return 1;
}
Boolean PublicId::getDescription(StringC &result) const
{
if (!formal_)
return 0;
result = description_;
return 1;
}
Boolean PublicId::getLanguage(StringC &result) const
{
if (!formal_ || textClass_ == CHARSET)
return 0;
result = languageOrDesignatingSequence_;
return 1;
}
Boolean PublicId::getDesignatingSequence(StringC &result) const
{
if (!formal_ || textClass_ != CHARSET)
return 0;
result = languageOrDesignatingSequence_;
return 1;
}
Boolean PublicId::getDisplayVersion(StringC &result) const
{
if (!formal_)
return 0;
if (haveDisplayVersion_)
result = displayVersion_;
return 1;
}
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,200 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: ExternalId.h /main/1 1996/07/29 16:51:56 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef ExternalId_INCLUDED
#define ExternalId_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include "Boolean.h"
#include "StringC.h"
#include "Text.h"
#include "types.h"
#include "Message.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class CharsetInfo;
class SP_API PublicId {
public:
enum TextClass {
CAPACITY,
CHARSET,
DOCUMENT,
DTD,
ELEMENTS,
ENTITIES,
LPD,
NONSGML,
NOTATION,
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;
// If it's not a valid formal public identifier, return 0
// and set error, otherwise return 1.
// charset describes the character set to use for parsing the
// id.
Boolean init(Text &, const CharsetInfo &, Char space,
const MessageType1 *&error);
const StringC &string() const;
const Text &text() const;
private:
static Boolean nextField(Char solidus,
const Char *&next,
const Char *lim,
const Char *&fieldStart,
size_t &fieldLength);
static Boolean lookupTextClass(const StringC &, const CharsetInfo &,
TextClass &);
static const char *const textClasses[];
PackedBoolean formal_;
OwnerType ownerType_;
StringC owner_;
TextClass textClass_;
PackedBoolean unavailable_;
StringC description_;
StringC languageOrDesignatingSequence_;
PackedBoolean haveDisplayVersion_;
StringC displayVersion_;
Text text_;
};
class SP_API 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 &);
// If it's not a valid formal public identifier, return 0
// and set error, otherwise return 1.
// charset describes the character set to use for parsing the
// id.
Boolean setPublic(Text &, const CharsetInfo &, Char space,
const MessageType1 *&error);
void setLocation(const Location &);
// location of keyword
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_);
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not ExternalId_INCLUDED */

View file

@ -1,174 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: Fixed2CodingSystem.C /main/1 1996/07/29 16:52:03 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
// This uses a big endian byte order irrespective of host byte order.
// Nothing special is done with FEFF/FFFE.
#include "splib.h"
#ifdef SP_MULTI_BYTE
#include "Fixed2CodingSystem.h"
#include "macros.h"
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
#include <iostream>
#else
#include <iostream.h>
#endif
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class Fixed2Decoder : public Decoder {
public:
Fixed2Decoder();
size_t decode(Char *to, const char *from, size_t fromLen,
const char **rest);
Boolean convertOffset(unsigned long &offset) const;
};
class Fixed2Encoder : public Encoder {
public:
Fixed2Encoder();
~Fixed2Encoder();
void output(Char *, size_t, streambuf *);
void output(const Char *, size_t, streambuf *);
private:
void allocBuf(size_t);
char *buf_;
size_t bufSize_;
};
Decoder *Fixed2CodingSystem::makeDecoder() const
{
return new Fixed2Decoder;
}
Encoder *Fixed2CodingSystem::makeEncoder() const
{
return new Fixed2Encoder;
}
unsigned Fixed2CodingSystem::fixedBytesPerChar() const
{
return 2;
}
Fixed2Decoder::Fixed2Decoder()
: Decoder(2)
{
}
size_t Fixed2Decoder::decode(Char *to, const char *from, size_t fromLen,
const char **rest)
{
#ifdef BIG_ENDIAN
if (sizeof(Char) == 2 && from == (char *)to) {
*rest = from + (fromLen & ~1);
return fromLen/2;
}
#endif
fromLen &= ~1;
*rest = from + fromLen;
for (size_t n = fromLen; n > 0; n -= 2) {
*to++ = ((unsigned char)from[0] << 8) + (unsigned char)from[1];
from += 2;
}
return fromLen/2;
}
Boolean Fixed2Decoder::convertOffset(unsigned long &n) const
{
n *= 2;
return true;
}
Fixed2Encoder::Fixed2Encoder()
: buf_(0), bufSize_(0)
{
}
Fixed2Encoder::~Fixed2Encoder()
{
delete [] buf_;
}
void Fixed2Encoder::allocBuf(size_t n)
{
if (bufSize_ < n) {
delete [] buf_;
buf_ = new char[bufSize_ = n];
}
}
// FIXME handle errors from streambuf::sputn
void Fixed2Encoder::output(Char *s, size_t n, streambuf *sb)
{
#ifdef BIG_ENDIAN
if (sizeof(Char) == 2) {
sb->sputn((char *)s, n*2);
return;
}
#endif
ASSERT(sizeof(Char) >= 2);
char *p = (char *)s;
for (size_t i = 0; i < n; i++) {
*p++ = (s[i] >> 8) & 0xff;
*p++ = s[i] & 0xff;
}
sb->sputn((char *)s, n*2);
}
void Fixed2Encoder::output(const Char *s, size_t n, streambuf *sb)
{
#ifdef BIG_ENDIAN
if (sizeof(Char) == 2) {
sb->sputn((char *)s, n*2);
return;
}
#endif
allocBuf(n*2);
for (size_t i = 0; i < n; i++) {
buf_[i*2] = (s[i] >> 8) & 0xff;
buf_[i*2 + 1] = s[i] & 0xff;
}
sb->sputn(buf_, n*2);
}
#ifdef SP_NAMESPACE
}
#endif
#else /* not SP_MULTI_BYTE */
#ifndef __GNUG__
static char non_empty_translation_unit; // sigh
#endif
#endif /* not SP_MULTI_BYTE */

View file

@ -1,47 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: Fixed2CodingSystem.h /main/1 1996/07/29 16:52:10 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef Fixed2CodingSystem_INCLUDED
#define Fixed2CodingSystem_INCLUDED 1
#include "CodingSystem.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class SP_API Fixed2CodingSystem : public CodingSystem {
public:
Decoder *makeDecoder() const;
Encoder *makeEncoder() const;
unsigned fixedBytesPerChar() const;
};
#ifdef SP_NAMESPACE
}
#endif
#endif /* not Fixed2CodingSystem_INCLUDED */

View file

@ -1,813 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: GenericEventHandler.C /main/1 1996/07/29 16:52:15 cde-hp $ */
// Copyright (c) 1996 James Clark
// See the file COPYING for copying permission.
#ifdef __GNUG__
#pragma implementation
#endif
#include "splib.h"
#include "GenericEventHandler.h"
#include "macros.h"
#include "ExtendEntityManager.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class SpOpenEntity : public SGMLApplication::OpenEntity {
public:
SpOpenEntity(const ConstPtr<Origin> &origin);
SGMLApplication::Location location(SGMLApplication::Position) const;
private:
ConstPtr<Origin> origin_;
};
inline
void *operator new(size_t n, GenericEventHandler *handler)
{
return handler->allocate(n);
}
inline
void GenericEventHandler::freeAll()
{
if (allocBlocks_)
freeAll1();
}
inline
void GenericEventHandler::clearNotation(SGMLApplication::Notation &to)
{
clearString(to.name);
}
inline
void GenericEventHandler::setLocation(SGMLApplication::Position &pos,
const Location &loc)
{
if (lastOrigin_ != loc.origin())
setLocation1(pos, loc);
else
pos = loc.index();
}
GenericEventHandler::GenericEventHandler(SGMLApplication &app,
bool generalEntities)
: app_(&app), generalEntities_(generalEntities),
freeBlocks_(0), allocBlocks_(0), firstBlockSpare_(0), firstBlockUsed_(0)
{
}
GenericEventHandler::~GenericEventHandler()
{
freeAll();
while (freeBlocks_) {
Block *tem = freeBlocks_;
freeBlocks_ = freeBlocks_->next;
delete [] tem->mem;
delete tem;
}
}
void GenericEventHandler::freeAll1()
{
Block **p;
for (p = &allocBlocks_; *p; p = &(*p)->next)
;
*p = freeBlocks_;
freeBlocks_ = allocBlocks_;
allocBlocks_ = 0;
if (freeBlocks_)
firstBlockSpare_ = freeBlocks_->size;
else
firstBlockSpare_ = 0;
firstBlockUsed_ = 0;
}
void *GenericEventHandler::allocate(size_t n)
{
if (n == 0)
return 0;
// round up to avoid alignment problems
n = (n + sizeof(char *) - 1) & ~(sizeof(char *) - 1);
enum { BIG = 1024 };
if (n > firstBlockSpare_) {
if (freeBlocks_ && firstBlockUsed_) {
Block *tem = freeBlocks_;
freeBlocks_ = freeBlocks_->next;
tem->next = allocBlocks_;
allocBlocks_ = tem;
}
if (!freeBlocks_ || freeBlocks_->size < n) {
Block *tem = new Block;
tem->size = n < BIG ? int(BIG) : n;
tem->mem = new char[tem->size];
tem->next = freeBlocks_;
freeBlocks_ = tem;
}
firstBlockUsed_ = 0;
firstBlockSpare_ = freeBlocks_->size;
}
char *tem = freeBlocks_->mem + firstBlockUsed_;
firstBlockUsed_ += n;
firstBlockSpare_ -= n;
return tem;
}
void GenericEventHandler::startElement(StartElementEvent *event)
{
SGMLApplication::StartElementEvent appEvent;
setString(appEvent.gi, event->name());
const ElementDefinition *def = event->elementType()->definition();
switch (def->declaredContent()) {
case ElementDefinition::modelGroup:
appEvent.contentType
= (def->compiledModelGroup()->containsPcdata()
? SGMLApplication::StartElementEvent::mixed
: SGMLApplication::StartElementEvent::element);
break;
case ElementDefinition::any:
appEvent.contentType = SGMLApplication::StartElementEvent::mixed;
break;
case ElementDefinition::cdata:
appEvent.contentType = SGMLApplication::StartElementEvent::cdata;
break;
case ElementDefinition::rcdata:
appEvent.contentType = SGMLApplication::StartElementEvent::rcdata;
break;
case ElementDefinition::empty:
appEvent.contentType = SGMLApplication::StartElementEvent::empty;
break;
}
appEvent.included = event->included();
appEvent.nAttributes = event->attributes().size();
if (appEvent.nAttributes != 0) {
if (event->attributes().conref())
appEvent.contentType = SGMLApplication::StartElementEvent::empty;
setAttributes(appEvent.attributes, event->attributes());
}
setLocation(appEvent.pos, event->location());
app_->startElement(appEvent);
freeAll();
delete event;
}
void GenericEventHandler::endElement(EndElementEvent *event)
{
SGMLApplication::EndElementEvent appEvent;
setString(appEvent.gi, event->name());
setLocation(appEvent.pos, event->location());
app_->endElement(appEvent);
delete event;
}
void GenericEventHandler::data(DataEvent *event)
{
SGMLApplication::DataEvent appEvent;
appEvent.data.ptr = event->data();
appEvent.data.len = event->dataLength();
setLocation(appEvent.pos, event->location());
app_->data(appEvent);
delete event;
}
void GenericEventHandler::pi(PiEvent *event)
{
SGMLApplication::PiEvent appEvent;
appEvent.data.ptr = event->data();
appEvent.data.len = event->dataLength();
const Entity *entity = event->entity();
if (entity)
setString(appEvent.entityName, entity->name());
else
appEvent.entityName.len = 0;
setLocation(appEvent.pos, event->location());
app_->pi(appEvent);
delete event;
}
void GenericEventHandler::sdataEntity(SdataEntityEvent *event)
{
SGMLApplication::SdataEvent appEvent;
appEvent.text.ptr = event->data();
appEvent.text.len = event->dataLength();
setString(appEvent.entityName, event->entity()->name());
// Don't want location of chars in entity.
setLocation(appEvent.pos, event->location().origin()->parent());
app_->sdata(appEvent);
delete event;
}
void GenericEventHandler::externalDataEntity(ExternalDataEntityEvent *event)
{
SGMLApplication::ExternalDataEntityRefEvent appEvent;
setEntity(appEvent.entity, *event->entity());
setLocation(appEvent.pos, event->location());
app_->externalDataEntityRef(appEvent);
freeAll();
delete event;
}
void GenericEventHandler::subdocEntity(SubdocEntityEvent *event)
{
SGMLApplication::SubdocEntityRefEvent appEvent;
setEntity(appEvent.entity, *event->entity());
setLocation(appEvent.pos, event->location());
app_->subdocEntityRef(appEvent);
freeAll();
delete event;
}
void GenericEventHandler::startDtd(StartDtdEvent *event)
{
SGMLApplication::StartDtdEvent appEvent;
setString(appEvent.name, event->name());
const Entity *entity = event->entity().pointer();
if (entity) {
appEvent.haveExternalId = 1;
setExternalId(appEvent.externalId,
entity->asExternalEntity()->externalId());
}
else
appEvent.haveExternalId = 0;
setLocation(appEvent.pos, event->location());
app_->startDtd(appEvent);
freeAll();
delete event;
}
void GenericEventHandler::endDtd(EndDtdEvent *event)
{
SGMLApplication::EndDtdEvent appEvent;
setString(appEvent.name, event->dtd().name());
setLocation(appEvent.pos, event->location());
app_->endDtd(appEvent);
delete event;
}
void GenericEventHandler::endProlog(EndPrologEvent *event)
{
if (generalEntities_) {
SGMLApplication::GeneralEntityEvent entityEvent;
const Dtd &dtd = event->dtd();
Dtd::ConstEntityIter iter(dtd.generalEntityIter());
for (;;) {
const Entity *entity = iter.nextTemp();
if (!entity)
break;
setEntity(entityEvent.entity, *entity);
app_->generalEntity(entityEvent);
}
freeAll();
}
SGMLApplication::EndPrologEvent appEvent;
setLocation(appEvent.pos, event->location());
app_->endProlog(appEvent);
delete event;
}
void GenericEventHandler::entityDefaulted(EntityDefaultedEvent *event)
{
if (generalEntities_) {
SGMLApplication::GeneralEntityEvent appEvent;
setEntity(appEvent.entity, event->entity());
app_->generalEntity(appEvent);
}
delete event;
}
void GenericEventHandler::appinfo(AppinfoEvent *event)
{
SGMLApplication::AppinfoEvent appEvent;
const StringC *str;
if (event->literal(str)) {
setString(appEvent.string, *str);
appEvent.none = 0;
}
else
appEvent.none = 1;
setLocation(appEvent.pos, event->location());
app_->appinfo(appEvent);
delete event;
}
void GenericEventHandler::commentDecl(CommentDeclEvent *event)
{
SGMLApplication::CommentDeclEvent appEvent;
appEvent.nComments = 0;
{
for (MarkupIter iter(event->markup()); iter.valid(); iter.advance())
if (iter.type() == Markup::comment)
appEvent.nComments++;
}
SGMLApplication::CharString *comments
= (SGMLApplication::CharString *)allocate(appEvent.nComments * 2
* sizeof(SGMLApplication::CharString));
appEvent.comments = comments;
appEvent.seps = appEvent.comments + appEvent.nComments;
size_t i = 0;
for (MarkupIter iter(event->markup()); iter.valid(); iter.advance())
switch (iter.type()) {
case Markup::comment:
comments[i].ptr = iter.charsPointer();
comments[i].len = iter.charsLength();
clearString(comments[appEvent.nComments + i]);
i++;
break;
case Markup::s:
comments[appEvent.nComments + i - 1].ptr = iter.charsPointer();
comments[appEvent.nComments + i - 1].len = iter.charsLength();
break;
default:
break;
}
setLocation(appEvent.pos, event->location());
app_->commentDecl(appEvent);
freeAll();
delete event;
}
void GenericEventHandler::markedSectionStart(MarkedSectionStartEvent *event)
{
SGMLApplication::MarkedSectionStartEvent appEvent;
unsigned depth = 0;
appEvent.nParams = 0;
{
for (MarkupIter iter(event->markup()); iter.valid(); iter.advance())
switch (iter.type()) {
case Markup::reservedName:
if (!depth)
appEvent.nParams++;
break;
case Markup::entityStart:
if (!depth)
appEvent.nParams++;
depth++;
break;
case Markup::entityEnd:
depth--;
break;
default:
break;
}
}
SGMLApplication::MarkedSectionStartEvent::Param *params
= (SGMLApplication::MarkedSectionStartEvent::Param *)
allocate(appEvent.nParams * sizeof(appEvent.params[0]));
appEvent.params = params;
size_t i = 0;
for (MarkupIter iter(event->markup()); iter.valid(); iter.advance())
switch (iter.type()) {
case Markup::reservedName:
if (!depth) {
switch (iter.reservedName()) {
case Syntax::rTEMP:
params[i].type
= SGMLApplication::MarkedSectionStartEvent::Param::temp;
break;
case Syntax::rINCLUDE:
params[i].type
= SGMLApplication::MarkedSectionStartEvent::Param::include;
break;
case Syntax::rRCDATA:
params[i].type
= SGMLApplication::MarkedSectionStartEvent::Param::rcdata;
break;
case Syntax::rCDATA:
params[i].type
= SGMLApplication::MarkedSectionStartEvent::Param::cdata;
break;
case Syntax::rIGNORE:
params[i].type
= SGMLApplication::MarkedSectionStartEvent::Param::ignore;
break;
default:
CANNOT_HAPPEN();
}
clearString(params[i].entityName);
i++;
}
break;
case Markup::entityStart:
if (!depth) {
params[i].type
= SGMLApplication::MarkedSectionStartEvent::Param::entityRef;
setString(params[i].entityName,
iter.entityOrigin()->entity()->name());
i++;
}
depth++;
break;
case Markup::entityEnd:
depth--;
break;
default:
break;
}
switch (event->status()) {
case MarkedSectionEvent::include:
appEvent.status = SGMLApplication::MarkedSectionStartEvent::include;
break;
case MarkedSectionEvent::rcdata:
appEvent.status = SGMLApplication::MarkedSectionStartEvent::rcdata;
break;
case MarkedSectionEvent::cdata:
appEvent.status = SGMLApplication::MarkedSectionStartEvent::cdata;
break;
case MarkedSectionEvent::ignore:
appEvent.status = SGMLApplication::MarkedSectionStartEvent::ignore;
break;
}
setLocation(appEvent.pos, event->location());
app_->markedSectionStart(appEvent);
freeAll();
delete event;
}
void GenericEventHandler::ignoredChars(IgnoredCharsEvent *event)
{
SGMLApplication::IgnoredCharsEvent appEvent;
appEvent.data.ptr = event->data();
appEvent.data.len = event->dataLength();
setLocation(appEvent.pos, event->location());
app_->ignoredChars(appEvent);
delete event;
}
void GenericEventHandler::markedSectionEnd(MarkedSectionEndEvent *event)
{
SGMLApplication::MarkedSectionEndEvent appEvent;
switch (event->status()) {
case MarkedSectionEvent::include:
appEvent.status = SGMLApplication::MarkedSectionEndEvent::include;
break;
case MarkedSectionEvent::rcdata:
appEvent.status = SGMLApplication::MarkedSectionEndEvent::rcdata;
break;
case MarkedSectionEvent::cdata:
appEvent.status = SGMLApplication::MarkedSectionEndEvent::cdata;
break;
case MarkedSectionEvent::ignore:
appEvent.status = SGMLApplication::MarkedSectionEndEvent::ignore;
break;
}
setLocation(appEvent.pos, event->location());
app_->markedSectionEnd(appEvent);
delete event;
}
void GenericEventHandler::message(MessageEvent *event)
{
SGMLApplication::ErrorEvent appEvent;
switch (event->message().type->severity()) {
case MessageType::quantityError:
appEvent.type = SGMLApplication::ErrorEvent::quantity;
break;
case MessageType::idrefError:
appEvent.type = SGMLApplication::ErrorEvent::idref;
break;
case MessageType::error:
appEvent.type = SGMLApplication::ErrorEvent::otherError;
break;
case MessageType::info:
appEvent.type = SGMLApplication::ErrorEvent::info;
break;
case MessageType::warning:
appEvent.type = SGMLApplication::ErrorEvent::warning;
break;
}
setLocation(appEvent.pos, event->message().loc);
StringC str;
reportMessage(event->message(), str);
setString(appEvent.message, str);
app_->error(appEvent);
ErrorCountEventHandler::message(event);
}
void GenericEventHandler::setLocation1(SGMLApplication::Position &pos,
const Location &loc)
{
const Location *locp = &loc;
for (;;) {
if (locp->origin().isNull()) {
lastOrigin_.clear();
openEntityPtr_ = (SpOpenEntity *)0;
return;
}
const InputSourceOrigin *origin = locp->origin()->asInputSourceOrigin();
if (origin && origin->externalInfo())
break;
locp = &locp->origin()->parent();
}
lastOrigin_ = locp->origin();
pos = locp->index();
openEntityPtr_ = new SpOpenEntity(locp->origin());
app_->openEntityChange(openEntityPtr_);
}
void
GenericEventHandler::setAttributes(const SGMLApplication::Attribute *&attributes,
const AttributeList &attributeList)
{
size_t nAttributes = attributeList.size();
SGMLApplication::Attribute *to
= (SGMLApplication::Attribute *)allocate(nAttributes * sizeof(*to));
attributes = to;
for (size_t i = 0; i < nAttributes; i++) {
SGMLApplication::Attribute *p = to + i;
setString(p->name, attributeList.name(i));
const AttributeValue *value = attributeList.value(i);
if (!value)
p->type = SGMLApplication::Attribute::invalid;
else {
const Text *text;
const StringC *string;
switch (value->info(text, string)) {
case AttributeValue::implied:
p->type = SGMLApplication::Attribute::implied;
break;
case AttributeValue::tokenized:
{
if (attributeList.specified(i))
p->defaulted = SGMLApplication::Attribute::specified;
else if (attributeList.current(i))
p->defaulted = SGMLApplication::Attribute::current;
else
p->defaulted = SGMLApplication::Attribute::definition;
p->type = SGMLApplication::Attribute::tokenized;
p->nEntities = 0;
p->notation.name.len = 0;
p->isId = attributeList.id(i);
p->isGroup = (attributeList.getAllowedTokens(i) != 0);
setString(p->tokens, *string);
const AttributeSemantics *semantics = attributeList.semantics(i);
if (semantics) {
ConstPtr<Notation> notation = semantics->notation();
if (!notation.isNull())
setNotation(p->notation, *notation);
else {
size_t nEntities = semantics->nEntities();
if (nEntities) {
SGMLApplication::Entity *v
= (SGMLApplication::Entity *)allocate(nEntities * sizeof(*v));
p->entities = v;
p->nEntities = nEntities;
for (size_t i = 0; i < nEntities; i++)
setEntity(v[i], *semantics->entity(i));
}
}
}
}
break;
case AttributeValue::cdata:
{
p->type = SGMLApplication::Attribute::cdata;
if (attributeList.specified(i))
p->defaulted = SGMLApplication::Attribute::specified;
else if (attributeList.current(i))
p->defaulted = SGMLApplication::Attribute::current;
else
p->defaulted = SGMLApplication::Attribute::definition;
TextItem::Type type;
const Char *s;
size_t length;
const Location *loc;
size_t nChunks = 0;
{
TextIter iter(*text);
while (iter.next(type, s, length, loc))
switch (type) {
case TextItem::data:
case TextItem::sdata:
case TextItem::cdata:
nChunks++;
break;
default:
break;
}
}
p->cdataChunks
= (SGMLApplication::Attribute::CdataChunk *)allocate(nChunks * sizeof(SGMLApplication::Attribute::CdataChunk));
p->nCdataChunks = nChunks;
{
size_t i = 0;
for (TextIter iter(*text);
iter.next(type, s, length, loc);
i++) {
switch (type) {
case TextItem::data:
case TextItem::sdata:
case TextItem::cdata:
{
SGMLApplication::Attribute::CdataChunk *chunk
= (SGMLApplication::Attribute::CdataChunk *)(p->cdataChunks + i);
if (type != TextItem::sdata)
chunk->isSdata = 0;
else {
chunk->isSdata = 1;
setString(chunk->entityName,
*loc->origin()->asInputSourceOrigin()->entityName());
}
chunk->data.ptr = s;
chunk->data.len = length;
}
break;
default:
break;
}
}
}
}
break;
}
}
}
}
void GenericEventHandler::setEntity(SGMLApplication::Entity &to,
const Entity &from)
{
setString(to.name, from.name());
switch (from.declType()) {
case Entity::generalEntity:
to.declType = SGMLApplication::Entity::general;
break;
case Entity::parameterEntity:
to.declType = SGMLApplication::Entity::parameter;
break;
case Entity::doctype:
to.declType = SGMLApplication::Entity::doctype;
break;
case Entity::linktype:
to.declType = SGMLApplication::Entity::linktype;
break;
default:
CANNOT_HAPPEN();
}
switch (from.dataType()) {
case Entity::sgmlText:
to.dataType = SGMLApplication::Entity::sgml;
break;
case Entity::cdata:
to.dataType = SGMLApplication::Entity::cdata;
break;
case Entity::sdata:
to.dataType = SGMLApplication::Entity::sdata;
break;
case Entity::ndata:
to.dataType = SGMLApplication::Entity::ndata;
break;
case Entity::subdoc:
to.dataType = SGMLApplication::Entity::subdoc;
break;
case Entity::pi:
to.dataType = SGMLApplication::Entity::pi;
break;
}
const InternalEntity *internal = from.asInternalEntity();
if (internal) {
to.isInternal = 1;
setString(to.text, internal->string());
}
else {
const ExternalEntity *external = from.asExternalEntity();
to.isInternal = 0;
setExternalId(to.externalId, external->externalId());
const ExternalDataEntity *externalData = from.asExternalDataEntity();
if (externalData) {
setNotation(to.notation, *externalData->notation());
to.nAttributes = externalData->attributes().size();
if (to.nAttributes)
setAttributes(to.attributes, externalData->attributes());
}
else {
to.notation.name.len = 0;
to.nAttributes = 0;
}
}
}
void GenericEventHandler::setNotation(SGMLApplication::Notation &to,
const Notation &from)
{
setString(to.name, from.name());
setExternalId(to.externalId, from.externalId());
}
void GenericEventHandler::setExternalId(SGMLApplication::ExternalId &to,
const ExternalId &from)
{
const StringC *str;
str = from.systemIdString();
if (str) {
to.haveSystemId = 1;
setString(to.systemId, *str);
}
else
to.haveSystemId = 0;
str = from.publicIdString();
if (str) {
to.havePublicId = 1;
setString(to.publicId, *str);
}
else
to.havePublicId = 0;
str = &from.effectiveSystemId();
if (str->size()) {
to.haveGeneratedSystemId = 1;
setString(to.generatedSystemId, *str);
}
else
to.haveGeneratedSystemId = 0;
}
MsgGenericEventHandler::MsgGenericEventHandler(SGMLApplication &app,
bool generalEntities,
MessageReporter &reporter,
const bool *messagesInhibitedPtr)
: GenericEventHandler(app, generalEntities),
reporter_(&reporter),
messagesInhibitedPtr_(messagesInhibitedPtr)
{
}
void MsgGenericEventHandler::reportMessage(const Message &msg, StringC &str)
{
WrapReporter wrap(reporter_);
reporter_->dispatchMessage(msg);
wrap.strStream.extractString(str);
if (!*messagesInhibitedPtr_)
*wrap.origStream << str;
}
SpOpenEntity::SpOpenEntity(const ConstPtr<Origin> &origin)
: origin_(origin)
{
}
SGMLApplication::Location
SpOpenEntity::location(SGMLApplication::Position pos) const
{
SGMLApplication::Location loc;
const Origin *origin = origin_.pointer();
const InputSourceOrigin *inputSourceOrigin;
const ExternalInfo *externalInfo;
Index index = Index(pos);
for (;;) {
if (!origin)
return loc;
inputSourceOrigin = origin->asInputSourceOrigin();
if (inputSourceOrigin) {
externalInfo = inputSourceOrigin->externalInfo();
if (externalInfo)
break;
}
const Location &loc = origin->parent();
index = loc.index();
origin = loc.origin().pointer();
}
const StringC *entityName = inputSourceOrigin->entityName();
if (entityName)
GenericEventHandler::setString(loc.entityName, *entityName);
Offset off = inputSourceOrigin->startOffset(index);
loc.entityOffset = off;
StorageObjectLocation soLoc;
if (!ExtendEntityManager::externalize(externalInfo, off, soLoc))
return loc;
loc.lineNumber = soLoc.lineNumber;
GenericEventHandler::setString(loc.filename, soLoc.storageObjectSpec->id);
loc.columnNumber = soLoc.columnNumber;
loc.byteOffset = soLoc.byteIndex;
loc.other = soLoc.storageObjectSpec;
return loc;
}
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,149 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: GenericEventHandler.h /main/1 1996/07/29 16:52:21 cde-hp $ */
// Copyright (c) 1995, 1996 James Clark
// See the file COPYING for copying permission.
#ifndef GenericEventHandler_INCLUDED
#define GenericEventHandler_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
// Must include Boolean.h before SGMLApplication.h.
#include "Boolean.h"
#include "SGMLApplication.h"
#include "Event.h"
#include "MessageReporter.h"
#include "ErrorCountEventHandler.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class SP_API GenericEventHandler : public ErrorCountEventHandler {
public:
GenericEventHandler(SGMLApplication &, bool generalEntities);
~GenericEventHandler();
void message(MessageEvent *);
void appinfo(AppinfoEvent *);
void startDtd(StartDtdEvent *);
void endDtd(EndDtdEvent *);
void endProlog(EndPrologEvent *);
void entityDefaulted(EntityDefaultedEvent *);
void startElement(StartElementEvent *);
void endElement(EndElementEvent *);
void data(DataEvent *);
void pi(PiEvent *);
void sdataEntity(SdataEntityEvent *);
void externalDataEntity(ExternalDataEntityEvent *);
void subdocEntity(SubdocEntityEvent *);
void commentDecl(CommentDeclEvent *);
void ignoredChars(IgnoredCharsEvent *);
void markedSectionStart(MarkedSectionStartEvent *);
void markedSectionEnd(MarkedSectionEndEvent *);
void *allocate(size_t);
void freeAll();
void freeAll1();
struct Block {
Block *next;
char *mem;
size_t size;
};
static void setString(SGMLApplication::CharString &, const StringC &);
static void clearString(SGMLApplication::CharString &);
virtual void reportMessage(const Message &msg, StringC &) = 0;
private:
GenericEventHandler(const GenericEventHandler &); // undefined
void operator=(const GenericEventHandler &); // undefined
void setLocation(SGMLApplication::Position &, const Location &);
void setLocation1(SGMLApplication::Position &, const Location &);
void setAttributes(const SGMLApplication::Attribute *&attributes,
const AttributeList &attributeList);
void setExternalId(SGMLApplication::ExternalId &to,
const ExternalId &from);
void setEntity(SGMLApplication::Entity &to, const Entity &from);
void setNotation(SGMLApplication::Notation &, const Notation &notation);
static void clearNotation(SGMLApplication::Notation &);
static void clearExternalId(SGMLApplication::ExternalId &);
ConstPtr<Origin> lastOrigin_;
SGMLApplication::OpenEntityPtr openEntityPtr_;
size_t firstBlockUsed_;
size_t firstBlockSpare_;
Block *freeBlocks_;
Block *allocBlocks_;
bool generalEntities_;
SGMLApplication *app_;
};
class SP_API MsgGenericEventHandler : public GenericEventHandler {
public:
MsgGenericEventHandler(SGMLApplication &,
bool generalEntities,
MessageReporter &reporter,
const bool *messagesInhibitedPtr);
void reportMessage(const Message &msg, StringC &);
private:
MsgGenericEventHandler(const MsgGenericEventHandler &); // undefined
void operator=(const MsgGenericEventHandler &); // undefined
struct WrapReporter {
WrapReporter(MessageReporter *r) : reporter(r), origStream(0) {
origStream = reporter->releaseMessageStream();
reporter->setMessageStream(&strStream);
}
~WrapReporter() {
if (origStream) {
reporter->releaseMessageStream();
reporter->setMessageStream(origStream);
}
}
MessageReporter *reporter;
OutputCharStream *origStream;
StrOutputCharStream strStream;
};
const bool *messagesInhibitedPtr_;
MessageReporter *reporter_;
};
inline void
GenericEventHandler::setString(SGMLApplication::CharString &to,
const StringC &from)
{
to.ptr = from.data();
to.len = from.size();
}
inline
void GenericEventHandler::clearString(SGMLApplication::CharString &to)
{
to.len = 0;
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not GenericEventHandler_INCLUDED */

View file

@ -1,187 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: Group.C /main/1 1996/07/29 16:52:27 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifdef __GNUG__
#pragma implementation
#endif
#include "splib.h"
#include "Group.h"
#include "MessageBuilder.h"
#include "ParserMessages.h"
#include "macros.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
AllowedGroupTokens::AllowedGroupTokens(GroupToken::Type t1, GroupToken::Type t2,
GroupToken::Type t3, GroupToken::Type t4)
: flags_(0)
{
allow(t1);
allow(t2);
allow(t3);
allow(t4);
}
AllowedGroupConnectors::AllowedGroupConnectors(GroupConnector::Type c1)
: flags_(0)
{
allow(c1);
}
AllowedGroupConnectors::AllowedGroupConnectors(GroupConnector::Type c1,
GroupConnector::Type c2)
: flags_(0)
{
allow(c1);
allow(c2);
}
AllowedGroupConnectors::AllowedGroupConnectors(GroupConnector::Type c1,
GroupConnector::Type c2,
GroupConnector::Type c3)
: flags_(0)
{
allow(c1);
allow(c2);
allow(c3);
}
AllowedGroupConnectors::AllowedGroupConnectors(GroupConnector::Type c1,
GroupConnector::Type c2,
GroupConnector::Type c3,
GroupConnector::Type c4)
: flags_(0)
{
allow(c1);
allow(c2);
allow(c3);
allow(c4);
}
AllowedGroupConnectorsMessageArg::AllowedGroupConnectorsMessageArg(
const AllowedGroupConnectors &allow,
const ConstPtr<Syntax> &syntax)
: allow_(allow),
syntax_(syntax)
{
}
MessageArg *AllowedGroupConnectorsMessageArg::copy() const
{
return new AllowedGroupConnectorsMessageArg(*this);
}
void AllowedGroupConnectorsMessageArg::append(MessageBuilder &builder) const
{
static GroupConnector::Type types[] = {
GroupConnector::andGC, GroupConnector::orGC, GroupConnector::seqGC,
GroupConnector::grpcGC, GroupConnector::dtgcGC
};
static Syntax::DelimGeneral delims[] = {
Syntax::dAND, Syntax::dOR, Syntax::dSEQ,
Syntax::dGRPC, Syntax::dDTGC
};
Boolean first = 1;
for (size_t i = 0; i < SIZEOF(types); i++)
if (allow_.groupConnector(types[i])) {
if (!first)
builder.appendFragment(ParserMessages::listSep);
else
first = 0;
const StringC &delim = syntax_->delimGeneral(delims[i]);
builder.appendFragment(ParserMessages::delimStart);
builder.appendChars(delim.data(), delim.size());
builder.appendFragment(ParserMessages::delimEnd);
}
}
AllowedGroupTokensMessageArg::AllowedGroupTokensMessageArg(
const AllowedGroupTokens &allow,
const ConstPtr<Syntax> &syntax)
: allow_(allow),
syntax_(syntax)
{
}
MessageArg *AllowedGroupTokensMessageArg::copy() const
{
return new AllowedGroupTokensMessageArg(*this);
}
void AllowedGroupTokensMessageArg::append(MessageBuilder &builder) const
{
const MessageFragment *fragment[4];
int nFragments = 0;
if (allow_.groupToken(GroupToken::dataTagLiteral))
fragment[nFragments++] = &ParserMessages::parameterLiteral;
if (allow_.groupToken(GroupToken::dataTagGroup))
fragment[nFragments++] = &ParserMessages::dataTagGroup;
switch (allow_.group()) {
case GroupToken::modelGroup:
fragment[nFragments++] = &ParserMessages::modelGroup;
break;
case GroupToken::dataTagTemplateGroup:
fragment[nFragments++] = &ParserMessages::dataTagTemplateGroup;
break;
default:
break;
}
switch (allow_.nameStart()) {
case GroupToken::name:
fragment[nFragments++] = &ParserMessages::name;
break;
case GroupToken::nameToken:
fragment[nFragments++] = &ParserMessages::nameToken;
break;
case GroupToken::elementToken:
fragment[nFragments++] = &ParserMessages::elementToken;
break;
default:
break;
}
Boolean first = 1;
for (int i = 0; i < nFragments; i++) {
if (!first)
builder.appendFragment(ParserMessages::listSep);
else
first = 0;
builder.appendFragment(*fragment[i]);
}
if (allow_.groupToken(GroupToken::pcdata)) {
if (!first)
builder.appendFragment(ParserMessages::listSep);
StringC pcdata(syntax_->delimGeneral(Syntax::dRNI));
pcdata += syntax_->reservedName(Syntax::rPCDATA);
builder.appendChars(pcdata.data(), pcdata.size());
}
}
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,186 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: Group.h /main/1 1996/07/29 16:52:34 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef Group_INCLUDED
#define Group_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include "Boolean.h"
#include "ContentToken.h"
#include "StringC.h"
#include "MessageArg.h"
#include "Owner.h"
#include "Syntax.h"
#include "Text.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class GroupToken {
public:
GroupToken() : type(invalid) { }
enum Type {
invalid,
nameToken,
name,
dataTagLiteral, // data tag (padding) template
dataTagGroup,
elementToken,
modelGroup,
pcdata,
dataTagTemplateGroup
};
Type type;
StringC token; // name nameToken; with substitution
Owner<ModelGroup> model;
Owner<ContentToken> contentToken; // elementToken pcdata dataTagGroup
Text text;
Vector<Text> textVector;
private:
GroupToken(const GroupToken &); // undefined
void operator=(const GroupToken &); // undefined
};
class AllowedGroupTokens {
public:
AllowedGroupTokens(GroupToken::Type,
GroupToken::Type = GroupToken::invalid,
GroupToken::Type = GroupToken::invalid,
GroupToken::Type = GroupToken::invalid);
Boolean groupToken(GroupToken::Type) const;
// modelGroup, dataTagTemplateGroup
GroupToken::Type group() const;
GroupToken::Type nameStart() const;
private:
void allow(GroupToken::Type);
unsigned flags_;
};
struct GroupConnector {
enum Type {
andGC,
orGC,
seqGC,
grpcGC,
dtgcGC
};
Type type;
};
class AllowedGroupConnectors {
public:
AllowedGroupConnectors(GroupConnector::Type);
AllowedGroupConnectors(GroupConnector::Type, GroupConnector::Type);
AllowedGroupConnectors(GroupConnector::Type, GroupConnector::Type,
GroupConnector::Type);
AllowedGroupConnectors(GroupConnector::Type, GroupConnector::Type,
GroupConnector::Type, GroupConnector::Type);
Boolean groupConnector(GroupConnector::Type) const;
private:
void allow(GroupConnector::Type);
unsigned flags_;
};
class AllowedGroupTokensMessageArg : public MessageArg {
public:
AllowedGroupTokensMessageArg(const AllowedGroupTokens &allow,
const ConstPtr<Syntax> &syntax);
MessageArg *copy() const;
void append(MessageBuilder &) const;
private:
AllowedGroupTokens allow_;
ConstPtr<Syntax> syntax_;
};
class AllowedGroupConnectorsMessageArg : public MessageArg {
public:
AllowedGroupConnectorsMessageArg(const AllowedGroupConnectors &allow,
const ConstPtr<Syntax> &syntax);
MessageArg *copy() const;
void append(MessageBuilder &) const;
private:
AllowedGroupConnectors allow_;
ConstPtr<Syntax> syntax_;
};
inline
Boolean AllowedGroupTokens::groupToken(GroupToken::Type i) const
{
return ((1 << i) & flags_) != 0;
}
inline
GroupToken::Type AllowedGroupTokens::group() const
{
if (groupToken(GroupToken::modelGroup))
return GroupToken::modelGroup;
else if (groupToken(GroupToken::dataTagTemplateGroup))
return GroupToken::dataTagTemplateGroup;
else
return GroupToken::invalid;
}
inline
GroupToken::Type AllowedGroupTokens::nameStart() const
{
if (groupToken(GroupToken::elementToken))
return GroupToken::elementToken;
else if (groupToken(GroupToken::nameToken))
return GroupToken::nameToken;
else if (groupToken(GroupToken::name))
return GroupToken::name;
else
return GroupToken::invalid;
}
inline
void AllowedGroupTokens::allow(GroupToken::Type t)
{
flags_ |= (1 << t);
}
inline
Boolean AllowedGroupConnectors::groupConnector(GroupConnector::Type c) const
{
return (flags_ & (1 << c)) != 0;
}
inline
void AllowedGroupConnectors::allow(GroupConnector::Type c)
{
flags_ |= (1 << c);
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not Group_INCLUDED */

View file

@ -1,49 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: Hash.C /main/1 1996/07/29 16:52:41 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifdef __GNUG__
#pragma implementation
#endif
#include "splib.h"
#include "Hash.h"
#include "StringC.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
unsigned long Hash::hash(const StringC &str)
{
const Char *p = str.data();
unsigned long h = 0;
for (size_t n = str.size(); n > 0; n--)
h = (h << 5) + h + *p++; // from Chris Torek
return h;
}
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,52 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: Hash.h /main/1 1996/07/29 16:52:46 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef Hash_INCLUDED
#define Hash_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include "StringC.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
#ifndef SP_API
#define SP_API /* as nothing */
#endif
class SP_API Hash {
public:
static unsigned long hash(const StringC &);
};
#ifdef SP_NAMESPACE
}
#endif
#endif /* not Hash_INCLUDED */

View file

@ -1,64 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: HashTable.C /main/1 1996/07/29 16:52:50 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef HashTable_DEF_INCLUDED
#define HashTable_DEF_INCLUDED 1
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
template<class K, class V>
void HashTable<K,V>::insert(const K &key, const V &value, Boolean replace)
{
HashTableItem<K, V> *newItem = new HashTableItem<K, V>(key, value);
HashTableItem<K, V> *tem = (HashTableItem<K, V> *)table_.insert(newItem);
if (tem) {
delete newItem;
if (replace) {
tem->key = key;
tem->value = value;
}
}
}
template<class K, class V>
HashTableItem<K,V>::HashTableItem(const K &k, const V &v)
: HashTableItemBase<K>(k), value(v)
{
}
template<class K, class V>
HashTableItemBase<K> *HashTableItem<K,V>::copy() const
{
return new HashTableItem<K, V>(*this);
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not HashTable_DEF_INCLUDED */

View file

@ -1,91 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: HashTable.h /main/1 1996/07/29 16:52:57 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef HashTable_INCLUDED
#define HashTable_INCLUDED 1
#include <stddef.h>
#include "OwnerTable.h"
#include "Hash.h"
#include "Boolean.h"
#include "HashTableItemBase.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
template<class K, class V>
class HashTableItem : public HashTableItemBase<K> {
public:
HashTableItem(const K &k, const V &v);
HashTableItemBase<K> *copy() const;
V value;
};
template<class K, class V> class HashTableIter;
template<class K, class V>
class HashTable {
public:
HashTable() { }
void insert(const K &key, const V &value, Boolean replace = 1);
const V *lookup(const K &key) const {
HashTableItem<K, V> *tem = (HashTableItem<K, V> *)table_.lookup(key);
return tem ? &tem->value : 0;
}
size_t count() const { return table_.count(); }
private:
CopyOwnerTable<HashTableItemBase<K>, K, Hash, HashTableKeyFunction<K> > table_;
friend class HashTableIter<K,V>;
};
template<class K, class V>
class HashTableIter {
public:
HashTableIter(const HashTable<K, V> &table) : iter_(table.table_) { }
Boolean next(const K *&key, const V *&value) {
HashTableItem<K, V> *p = (HashTableItem<K, V> *)iter_.next();
if (p) {
key = &p->key;
value = &p->value;
return 1;
}
else
return 0;
}
private:
OwnerTableIter<HashTableItemBase<K>, K, Hash, HashTableKeyFunction<K> > iter_;
};
#ifdef SP_NAMESPACE
}
#endif
#endif /* not HashTable_INCLUDED */
#ifdef SP_DEFINE_TEMPLATES
#include "HashTable.C"
#endif

View file

@ -1,49 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: HashTableItemBase.C /main/1 1996/07/29 16:53:04 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef HashTableItemBase_DEF_INCLUDED
#define HashTableItemBase_DEF_INCLUDED 1
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
template<class K>
HashTableItemBase<K>::~HashTableItemBase()
{
}
template<class K>
HashTableItemBase<K>::HashTableItemBase(const K &k) : key(k)
{
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not HashTableItemBase_DEF_INCLUDED */

View file

@ -1,61 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: HashTableItemBase.h /main/1 1996/07/29 16:53:09 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef HashTableItemBase_INCLUDED
#define HashTableItemBase_INCLUDED 1
// All hash tables with the same type of key share object code.
// The cost of this is a virtual dtor in HashTableItemBase.
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
template<class K>
class HashTableItemBase {
public:
HashTableItemBase(const K &k);
virtual ~HashTableItemBase();
virtual HashTableItemBase<K> *copy() const = 0;
K key;
};
template<class K>
struct HashTableKeyFunction {
static inline const K &key(const HashTableItemBase<K> &obj) {
return obj.key;
}
};
#ifdef SP_NAMESPACE
}
#endif
#endif /* not HashTableItemBase_INCLUDED */
#ifdef SP_DEFINE_TEMPLATES
#include "HashTableItemBase.C"
#endif

View file

@ -1,64 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: IList.h /main/2 1996/08/13 10:08:48 mgreess $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef IList_INCLUDED
#define IList_INCLUDED 1
#include "IListBase.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
template<class T> class IListIter;
// This owns the objects that are put in it.
template<class T>
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<T> &list) { IListBase::swap(list); }
T *head() const { return (T *)IListBase::head(); }
T *get() { return (T *)IListBase::get(); }
using IListBase::clear;
using IListBase::empty;
friend class IListIter<T>;
private:
IList(const IList<T> &) {}
IList<T> &operator=(const IList<T> &) { return *this; }
};
#ifdef SP_NAMESPACE
}
#endif
#endif /* not IList_INCLUDED */

View file

@ -1,59 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: IListBase.C /main/1 1996/07/29 16:53:20 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#include "splib.h"
#include "IListBase.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
void IListBase::append(Link *p)
{
Link **pp;
for (pp = &head_; *pp; pp = &(*pp)->next_)
;
*pp = p;
}
void IListBase::remove(Link *p)
{
for (Link **pp = &head_; *pp; pp = &(*pp)->next_)
if (*pp == p) {
*pp = p->next_;
break;
}
}
void IListBase::clear()
{
while (!empty())
delete get();
}
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,103 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: IListBase.h /main/1 1996/07/29 16:53:26 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef IListBase_INCLUDED
#define IListBase_INCLUDED 1
#include "Link.h"
#include "Boolean.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class SP_API 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;
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not IListBase_INCLUDED */

View file

@ -1,51 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: IListIter.h /main/1 1996/07/29 16:53:32 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef IListIter_INCLUDED
#define IListIter_INCLUDED 1
#include "IListIterBase.h"
#include "IList.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
template<class T>
class IListIter : private IListIterBase {
public:
IListIter(const IList<T> &list) : IListIterBase(list) { }
T *cur() { return (T *)IListIterBase::cur(); }
using IListIterBase::next;
using IListIterBase::done;
};
#ifdef SP_NAMESPACE
}
#endif
#endif /* not IListIter_INCLUDED */

View file

@ -1,74 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: IListIterBase.h /main/1 1996/07/29 16:53:38 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef IListIterBase_INCLUDED
#define IListIterBase_INCLUDED 1
#include "Link.h"
#include "IListBase.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class SP_API IListIterBase {
public:
IListIterBase(const IListBase &);
int done();
Link *cur();
void next();
private:
Link *p_;
};
inline
IListIterBase::IListIterBase(const IListBase &list) : p_(list.head_)
{
}
inline
int IListIterBase::done()
{
return p_ == 0;
}
inline
Link *IListIterBase::cur()
{
return p_;
}
inline
void IListIterBase::next()
{
p_ = p_->next_;
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not IListIterBase_INCLUDED */

View file

@ -1,45 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: IQueue.C /main/1 1996/07/29 16:53:45 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef IQueue_DEF_INCLUDED
#define IQueue_DEF_INCLUDED 1
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
template<class T>
void IQueue<T>::clear()
{
while (!empty())
delete get();
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not IQueue_DEF_INCLUDED */

View file

@ -1,88 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: IQueue.h /main/1 1996/07/29 16:53:51 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef IQueue_INCLUDED
#define IQueue_INCLUDED 1
#include "Boolean.h"
#include "Link.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
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 T>
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<T> &to) { IQueueBase::swap(to); }
};
#ifdef SP_NAMESPACE
}
#endif
#endif /* not IQueue_INCLUDED */
#ifdef SP_DEFINE_TEMPLATES
#include "IQueue.C"
#endif

View file

@ -1,338 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: ISO8859InputCodingSystem.C /main/1 1996/07/29 16:53:56 cde-hp $ */
// Copyright (c) 1995 James Clark
// See the file COPYING for copying permission.
#include "splib.h"
#ifdef SP_MULTI_BYTE
#include "ISO8859InputCodingSystem.h"
#include "macros.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
inline const Char *ISO8859InputCodingSystem::partMap(int part)
{
ASSERT(2 <= part && part <= 9);
return maps[part - 2];
}
ISO8859InputCodingSystem::ISO8859InputCodingSystem(int part)
: TranslateInputCodingSystem(partMap(part))
{
}
#define INVALID 0xFFFD
// Tables mapping ISO 8859-2 through ISO 8859-9 to ISO 10646.
// Generated from Unicode Consortium data.
const Char ISO8859InputCodingSystem::maps[8][256] = {
{
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87,
88, 89, 90, 91, 92, 93, 94, 95,
96, 97, 98, 99, 100, 101, 102, 103,
104, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 118, 119,
120, 121, 122, 123, 124, 125, 126, 127,
128, 129, 130, 131, 132, 133, 134, 135,
136, 137, 138, 139, 140, 141, 142, 143,
144, 145, 146, 147, 148, 149, 150, 151,
152, 153, 154, 155, 156, 157, 158, 159,
160, 260, 728, 321, 164, 317, 346, 167,
168, 352, 350, 356, 377, 173, 381, 379,
176, 261, 731, 322, 180, 318, 347, 711,
184, 353, 351, 357, 378, 733, 382, 380,
340, 193, 194, 258, 196, 313, 262, 199,
268, 201, 280, 203, 282, 205, 206, 270,
272, 323, 327, 211, 212, 336, 214, 215,
344, 366, 218, 368, 220, 221, 354, 223,
341, 225, 226, 259, 228, 314, 263, 231,
269, 233, 281, 235, 283, 237, 238, 271,
273, 324, 328, 243, 244, 337, 246, 247,
345, 367, 250, 369, 252, 253, 355, 729,
},
{
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87,
88, 89, 90, 91, 92, 93, 94, 95,
96, 97, 98, 99, 100, 101, 102, 103,
104, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 118, 119,
120, 121, 122, 123, 124, 125, 126, 127,
128, 129, 130, 131, 132, 133, 134, 135,
136, 137, 138, 139, 140, 141, 142, 143,
144, 145, 146, 147, 148, 149, 150, 151,
152, 153, 154, 155, 156, 157, 158, 159,
160, 294, 728, 163, 164, INVALID, 292, 167,
168, 304, 350, 286, 308, 173, INVALID, 379,
176, 295, 178, 179, 180, 181, 293, 183,
184, 305, 351, 287, 309, 189, INVALID, 380,
192, 193, 194, INVALID, 196, 266, 264, 199,
200, 201, 202, 203, 204, 205, 206, 207,
INVALID, 209, 210, 211, 212, 288, 214, 215,
284, 217, 218, 219, 220, 364, 348, 223,
224, 225, 226, INVALID, 228, 267, 265, 231,
232, 233, 234, 235, 236, 237, 238, 239,
INVALID, 241, 242, 243, 244, 289, 246, 247,
285, 249, 250, 251, 252, 365, 349, 729,
},
{
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87,
88, 89, 90, 91, 92, 93, 94, 95,
96, 97, 98, 99, 100, 101, 102, 103,
104, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 118, 119,
120, 121, 122, 123, 124, 125, 126, 127,
128, 129, 130, 131, 132, 133, 134, 135,
136, 137, 138, 139, 140, 141, 142, 143,
144, 145, 146, 147, 148, 149, 150, 151,
152, 153, 154, 155, 156, 157, 158, 159,
160, 260, 312, 342, 164, 296, 315, 167,
168, 352, 274, 290, 358, 173, 381, 175,
176, 261, 731, 343, 180, 297, 316, 711,
184, 353, 275, 291, 359, 330, 382, 331,
256, 193, 194, 195, 196, 197, 198, 302,
268, 201, 280, 203, 278, 205, 206, 298,
272, 325, 332, 310, 212, 213, 214, 215,
216, 370, 218, 219, 220, 360, 362, 223,
257, 225, 226, 227, 228, 229, 230, 303,
269, 233, 281, 235, 279, 237, 238, 299,
273, 326, 333, 311, 244, 245, 246, 247,
248, 371, 250, 251, 252, 361, 363, 729,
},
{
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87,
88, 89, 90, 91, 92, 93, 94, 95,
96, 97, 98, 99, 100, 101, 102, 103,
104, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 118, 119,
120, 121, 122, 123, 124, 125, 126, 127,
128, 129, 130, 131, 132, 133, 134, 135,
136, 137, 138, 139, 140, 141, 142, 143,
144, 145, 146, 147, 148, 149, 150, 151,
152, 153, 154, 155, 156, 157, 158, 159,
160, 1025, 1026, 1027, 1028, 1029, 1030, 1031,
1032, 1033, 1034, 1035, 1036, 173, 1038, 1039,
1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047,
1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055,
1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063,
1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071,
1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079,
1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087,
1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095,
1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103,
8470, 1105, 1106, 1107, 1108, 1109, 1110, 1111,
1112, 1113, 1114, 1115, 1116, 167, 1118, 1119,
},
{
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47,
1632, 1633, 1634, 1635, 1636, 1637, 1638, 1639,
1640, 1641, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87,
88, 89, 90, 91, 92, 93, 94, 95,
96, 97, 98, 99, 100, 101, 102, 103,
104, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 118, 119,
120, 121, 122, 123, 124, 125, 126, 127,
128, 129, 130, 131, 132, 133, 134, 135,
136, 137, 138, 139, 140, 141, 142, 143,
144, 145, 146, 147, 148, 149, 150, 151,
152, 153, 154, 155, 156, 157, 158, 159,
160, INVALID, INVALID, INVALID, 164, INVALID, INVALID, INVALID,
INVALID, INVALID, INVALID, INVALID, 1548, 173, INVALID, INVALID,
INVALID, INVALID, INVALID, INVALID, INVALID, INVALID, INVALID, INVALID,
INVALID, INVALID, INVALID, 1563, INVALID, INVALID, INVALID, 1567,
INVALID, 1569, 1570, 1571, 1572, 1573, 1574, 1575,
1576, 1577, 1578, 1579, 1580, 1581, 1582, 1583,
1584, 1585, 1586, 1587, 1588, 1589, 1590, 1591,
1592, 1593, 1594, INVALID, INVALID, INVALID, INVALID, INVALID,
1600, 1601, 1602, 1603, 1604, 1605, 1606, 1607,
1608, 1609, 1610, 1611, 1612, 1613, 1614, 1615,
1616, 1617, 1618, INVALID, INVALID, INVALID, INVALID, INVALID,
INVALID, INVALID, INVALID, INVALID, INVALID, INVALID, INVALID, INVALID,
},
{
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87,
88, 89, 90, 91, 92, 93, 94, 95,
96, 97, 98, 99, 100, 101, 102, 103,
104, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 118, 119,
120, 121, 122, 123, 124, 125, 126, 127,
128, 129, 130, 131, 132, 133, 134, 135,
136, 137, 138, 139, 140, 141, 142, 143,
144, 145, 146, 147, 148, 149, 150, 151,
152, 153, 154, 155, 156, 157, 158, 159,
160, 701, 700, 163, INVALID, INVALID, 166, 167,
168, 169, INVALID, 171, 172, 173, INVALID, 8213,
176, 177, 178, 179, 900, 901, 902, 183,
904, 905, 906, 187, 908, 189, 910, 911,
912, 913, 914, 915, 916, 917, 918, 919,
920, 921, 922, 923, 924, 925, 926, 927,
928, 929, INVALID, 931, 932, 933, 934, 935,
936, 937, 938, 939, 940, 941, 942, 943,
944, 945, 946, 947, 948, 949, 950, 951,
952, 953, 954, 955, 956, 957, 958, 959,
960, 961, 962, 963, 964, 965, 966, 967,
968, 969, 970, 971, 972, 973, 974, INVALID,
},
{
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87,
88, 89, 90, 91, 92, 93, 94, 95,
96, 97, 98, 99, 100, 101, 102, 103,
104, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 118, 119,
120, 121, 122, 123, 124, 125, 126, 127,
128, 129, 130, 131, 132, 133, 134, 135,
136, 137, 138, 139, 140, 141, 142, 143,
144, 145, 146, 147, 148, 149, 150, 151,
152, 153, 154, 155, 156, 157, 158, 159,
160, INVALID, 162, 163, 164, 165, 166, 167,
168, 169, 215, 171, 172, 173, 174, 8254,
176, 177, 178, 179, 180, 181, 182, 183,
184, 185, 247, 187, 188, 189, 190, INVALID,
INVALID, INVALID, INVALID, INVALID, INVALID, INVALID, INVALID, INVALID,
INVALID, INVALID, INVALID, INVALID, INVALID, INVALID, INVALID, INVALID,
INVALID, INVALID, INVALID, INVALID, INVALID, INVALID, INVALID, INVALID,
INVALID, INVALID, INVALID, INVALID, INVALID, INVALID, INVALID, 8215,
1488, 1489, 1490, 1491, 1492, 1493, 1494, 1495,
1496, 1497, 1498, 1499, 1500, 1501, 1502, 1503,
1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511,
1512, 1513, 1514, INVALID, INVALID, INVALID, INVALID, INVALID,
},
{
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87,
88, 89, 90, 91, 92, 93, 94, 95,
96, 97, 98, 99, 100, 101, 102, 103,
104, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 118, 119,
120, 121, 122, 123, 124, 125, 126, 127,
128, 129, 130, 131, 132, 133, 134, 135,
136, 137, 138, 139, 140, 141, 142, 143,
144, 145, 146, 147, 148, 149, 150, 151,
152, 153, 154, 155, 156, 157, 158, 159,
160, 161, 162, 163, 164, 165, 166, 167,
168, 169, 170, 171, 172, 173, 174, 175,
176, 177, 178, 179, 180, 181, 182, 183,
184, 185, 186, 187, 188, 189, 190, 191,
192, 193, 194, 195, 196, 197, 198, 199,
200, 201, 202, 203, 204, 205, 206, 207,
286, 209, 210, 211, 212, 213, 214, 215,
216, 217, 218, 219, 220, 304, 350, 223,
224, 225, 226, 227, 228, 229, 230, 231,
232, 233, 234, 235, 236, 237, 238, 239,
287, 241, 242, 243, 244, 245, 246, 247,
248, 249, 250, 251, 252, 305, 351, 255,
}
};
#ifdef SP_NAMESPACE
}
#endif
#else /* not SP_MULTI_BYTE */
#ifndef __GNUG__
static char non_empty_translation_unit; // sigh
#endif
#endif /* not SP_MULTI_BYTE */

View file

@ -1,49 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: ISO8859InputCodingSystem.h /main/1 1996/07/29 16:54:04 cde-hp $ */
// Copyright (c) 1995 James Clark
// See the file COPYING for copying permission.
#ifndef ISO8859InputCodingSystem_INCLUDED
#define ISO8859InputCodingSystem_INCLUDED 1
#include "TranslateInputCodingSystem.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class SP_API ISO8859InputCodingSystem : public TranslateInputCodingSystem {
public:
// part must be between 2 and 9
ISO8859InputCodingSystem(int part);
private:
const Char *partMap(int);
static const Char maps[8][256];
};
#ifdef SP_NAMESPACE
}
#endif
#endif /* not ISO8859InputCodingSystem_INCLUDED */

View file

@ -1,153 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: ISet.C /main/1 1996/07/29 16:54:10 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef ISet_DEF_INCLUDED
#define ISet_DEF_INCLUDED 1
#include <stdlib.h>
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
template<class T>
ISet<T>::ISet()
{
}
template<class T>
ISet<T>::~ISet()
{
}
template<class T>
ISet<T>::ISet(const T *v, size_t n)
{
for (size_t i = 0; i < n; i++)
add(v[i]);
}
template<class T>
Boolean ISet<T>::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<class T>
void ISet<T>::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--)
;
}
// r_[i - 1].max < min - 1 <= r_[i].max
if (i < r_.size() && (r_[i].min == 0 || max >= r_[i].min - 1)) {
// we can coelesce
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;
// get rid of i + 1 ... j - 1
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_[i - 1].max < min - 1
// max + 1 < r_[i].min
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<class T>
void ISet<T>::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);
// split the range
// subtracting 2 is safe since we know that the length is >= 2
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<class T>
void ISet<T>::check()
{
for (size_t i = 0; i < r_.size(); i++) {
if (r_[i].min > r_[i].max)
abort();
// adjacent ranges must be coalesced
if (i > 0 && r_[i].min - 1 <= r_[i - 1].max)
abort();
}
}
template<class T>
void ISet<T>::clear()
{
r_.resize(0);
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not ISet_DEF_INCLUDED */

View file

@ -1,83 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: ISet.h /main/1 1996/07/29 16:54:18 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef ISet_INCLUDED
#define ISet_INCLUDED
#include <stddef.h>
#include "Vector.h"
#include "Boolean.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
template<class T> class ISetIter;
template<class T>
struct ISetRange {
ISetRange() { }
~ISetRange() { }
T min;
T max;
};
template<class T>
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);
#if 0
void add(const ISet<T> &);
#endif
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<T> &x) { r_.swap(x.r_); }
friend class ISetIter<T>;
private:
Vector<ISetRange<T> > r_;
};
#ifdef SP_NAMESPACE
}
#endif
#endif /* not ISet_INCLUDED */
#ifdef SP_DEFINE_TEMPLATES
#include "ISet.C"
#endif

View file

@ -1,63 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: ISetIter.h /main/1 1996/07/29 16:54:26 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef ISetIter_INCLUDED
#define ISetIter_INCLUDED
#include <stddef.h>
#include "ISet.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
template<class T>
class ISetIter {
public:
ISetIter(const ISet<T> &s) : p_(&s), i_(0) { }
// min and max are not changed if 0 is returned.
int next(T &min, T &max)
{
if (i_ < p_->r_.size()) {
min = p_->r_[i_].min;
max = p_->r_[i_].max;
i_++;
return 1;
}
else
return 0;
}
private:
const ISet<T> *p_;
size_t i_;
};
#ifdef SP_NAMESPACE
}
#endif
#endif /* ISetIter_INCLUDED */

View file

@ -1,53 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: Id.C /main/1 1996/07/29 16:54:32 cde-hp $ */
// Copyright (c) 1996 James Clark
// See the file COPYING for copying permission.
#ifdef __GNUG__
#pragma implementation
#endif
#include "splib.h"
#include "Id.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
Id::Id(const StringC &name)
: Named(name)
{
}
void Id::define(const Location &loc)
{
defLocation_ = loc;
// release memory for pendingRefs_
Vector<Location> tem;
pendingRefs_.swap(tem);
}
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,83 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: Id.h /main/1 1996/07/29 16:54:38 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef Id_INCLUDED
#define Id_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include "Named.h"
#include "Location.h"
#include "Vector.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
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<Location> &pendingRefs() const;
private:
Location defLocation_;
Vector<Location> pendingRefs_;
};
inline
Boolean Id::defined() const
{
return !defLocation_.origin().isNull();
}
inline
const Location &Id::defLocation() const
{
return defLocation_;
}
inline
const Vector<Location> &Id::pendingRefs() const
{
return pendingRefs_;
}
inline
void Id::addPendingRef(const Location &loc)
{
pendingRefs_.push_back(loc);
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not Id_INCLUDED */

View file

@ -1,158 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: IdentityCodingSystem.C /main/1 1996/07/29 16:54:48 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#include "splib.h"
#include "IdentityCodingSystem.h"
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
#include <iostream>
#else
#include <iostream.h>
#endif
#include <limits.h>
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class IdentityDecoder : public Decoder {
public:
size_t decode(Char *to, const char *from, size_t fromLen,
const char **rest);
Boolean convertOffset(unsigned long &offset) const;
};
class IdentityEncoder : public Encoder {
public:
IdentityEncoder();
~IdentityEncoder();
void output(Char *, size_t, streambuf *);
void output(const Char *, size_t, streambuf *);
private:
void allocBuf(size_t);
char *buf_;
size_t bufSize_;
};
IdentityCodingSystem::IdentityCodingSystem()
{
}
Decoder *IdentityCodingSystem::makeDecoder() const
{
return new IdentityDecoder;
}
Encoder *IdentityCodingSystem::makeEncoder() const
{
return new IdentityEncoder;
}
Boolean IdentityCodingSystem::isIdentity() const
{
return 1;
}
size_t IdentityDecoder::decode(Char *to, const char *from, size_t fromLen,
const char **rest)
{
if (sizeof(Char) == sizeof(char) && from == (char *)to) {
*rest = from + fromLen;
return fromLen;
}
for (size_t n = fromLen; n > 0; n--)
*to++ = (unsigned char)*from++; // zero extend
*rest = from;
return fromLen;
}
Boolean IdentityDecoder::convertOffset(unsigned long &) const
{
return true;
}
IdentityEncoder::IdentityEncoder()
: buf_(0), bufSize_(0)
{
}
IdentityEncoder::~IdentityEncoder()
{
delete [] buf_;
}
void IdentityEncoder::allocBuf(size_t n)
{
if (bufSize_ < n) {
delete [] buf_;
buf_ = new char[bufSize_ = n];
}
}
// FIXME handle errors from streambuf::sputn
void IdentityEncoder::output(Char *s, size_t n, streambuf *sb)
{
char *p = (char *)s;
if (sizeof(Char) != sizeof(char)) {
size_t j = 0;
for (size_t i = 0; i < n; i++) {
if (s[i] > UCHAR_MAX) {
sb->sputn(p, j);
j = 0;
handleUnencodable(s[i], sb);
}
else
p[j++] = char(s[i]);
}
sb->sputn(p, j);
}
else
sb->sputn(p, n);
}
void IdentityEncoder::output(const Char *s, size_t n, streambuf *sb)
{
if (sizeof(Char) != sizeof(char)) {
allocBuf(n);
size_t j = 0;
for (size_t i = 0; i < n; i++) {
if (s[i] > UCHAR_MAX) {
sb->sputn(buf_, j);
j = 0;
handleUnencodable(s[i], sb);
}
else
buf_[j++] = char(s[i]);
}
sb->sputn(buf_, j);
}
else
sb->sputn((const char *)s, n);
}
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,48 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: IdentityCodingSystem.h /main/1 1996/07/29 16:54:59 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef IdentityCodingSystem_INCLUDED
#define IdentityCodingSystem_INCLUDED 1
#include "CodingSystem.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class SP_API IdentityCodingSystem : public CodingSystem {
public:
IdentityCodingSystem();
Decoder *makeDecoder() const;
Encoder *makeEncoder() const;
Boolean isIdentity() const;
};
#ifdef SP_NAMESPACE
}
#endif
#endif /* not IdentityCodingSystem_INCLUDED */

View file

@ -1,99 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: InputSource.C /main/1 1996/07/29 16:55:11 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifdef __GNUG__
#pragma implementation
#endif
#include "splib.h"
#include "InputSource.h"
#include "MarkupScan.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
InputSource::InputSource(InputSourceOrigin *origin, const Char *start,
const Char *end)
: origin_(origin), start_(start), end_(end), cur_(start), accessError_(0),
startLocation_(origin, 0), multicode_(0), scanSuppress_(0),
scanSuppressSingle_(false), scanSuppressIndex_(0)
{
}
void InputSource::reset(const Char *start,
const Char *end)
{
origin_ = origin_->copy();
start_ = start;
end_ = end;
cur_ = start_;
startLocation_ = Location(origin_.pointer(), 0);
multicode_ = 0;
scanSuppress_ = 0;
markupScanTable_.clear();
}
InputSource::~InputSource()
{
}
void InputSource::advanceStartMulticode(const Char *to)
{
while (start_ < to) {
switch (markupScanTable_[*start_]) {
case MarkupScan::normal:
break;
case MarkupScan::in:
scanSuppress_ = 0;
break;
case MarkupScan::out:
if (!scanSuppress()) {
scanSuppress_ = 1;
scanSuppressSingle_ = 0;
}
break;
case MarkupScan::suppress:
// what's the effect of MSSCHAR followed by MSSCHAR
if (!scanSuppress()) {
scanSuppress_ = 1;
scanSuppressSingle_ = 1;
scanSuppressIndex_ = startLocation_.index() + 1;
}
break;
}
start_++;
startLocation_ += 1;
}
}
void InputSource::willNotRewind()
{
}
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,299 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: InputSource.h /main/1 1996/07/29 16:55:17 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef InputSource_INCLUDED
#define InputSource_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include "types.h"
#include "Link.h"
#include "Ptr.h"
#include "Location.h"
#include "XcharMap.h"
#include <stddef.h>
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class Messenger;
class NamedCharRef;
class SP_API InputSource : public Link {
public:
enum { eE = -1 }; // end of entity signal
virtual ~InputSource();
Xchar get(Messenger &);
virtual void pushCharRef(Char ch, const NamedCharRef &) = 0;
const Location &currentLocation() const;
const Char *currentTokenStart() const;
size_t currentTokenLength() const;
const Char *currentTokenEnd() const;
Index nextIndex() const;
// Discard all but the last character of the current token.
void discardInitial();
void startToken();
void startTokenNoMulticode();
void endToken(size_t length);
Xchar tokenChar(Messenger &);
void ungetToken();
void setMarkupScanTable(const XcharMap<unsigned char> &);
Boolean scanSuppress() const;
void extendToBufferEnd();
virtual void willNotRewind();
virtual Boolean rewind(Messenger &) = 0;
Boolean accessError() const;
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 &); // undefined
void operator=(const InputSource &); // undefined
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<InputSourceOrigin> origin_;
Boolean accessError_;
Boolean scanSuppress_;
Boolean scanSuppressSingle_;
Index scanSuppressIndex_;
Boolean multicode_;
XcharMap<unsigned char> 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
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<unsigned char> &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_;
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not InputSource_INCLUDED */

View file

@ -1,83 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: InternalInputSource.C /main/1 1996/07/29 16:55:23 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifdef __GNUG__
#pragma implementation
#endif
#include "splib.h"
#include <string.h>
#include "InternalInputSource.h"
#include "macros.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
InternalInputSource::InternalInputSource(const StringC &str,
InputSourceOrigin *origin)
: InputSource(origin, str.data(), str.data() + str.size()), buf_(0),
contents_(&str)
{
}
InternalInputSource::~InternalInputSource()
{
if (buf_)
delete [] buf_;
}
Xchar InternalInputSource::fill(Messenger &)
{
return eE;
}
void InternalInputSource::pushCharRef(Char c, const NamedCharRef &ref)
{
ASSERT(cur() == start());
noteCharRef(startIndex() + (cur() - start()), ref);
if (buf_ == 0) {
buf_ = new Char[end() - start() + 1];
memcpy(buf_ + 1, cur(), (end() - start())*sizeof(Char));
changeBuffer(buf_ + 1, cur());
}
moveLeft();
*(Char *)cur() = c;
}
Boolean InternalInputSource::rewind(Messenger &)
{
reset(contents_->data(),
contents_->data() + contents_->size());
if (buf_) {
delete [] buf_;
buf_ = 0;
}
return 1;
}
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,68 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: InternalInputSource.h /main/1 1996/07/29 16:55:29 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef InternalInputSource_INCLUDED
#define InternalInputSource_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include <stddef.h>
#include "InputSource.h"
#include "Allocator.h"
#include "StringC.h"
#include "types.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
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 &);
~InternalInputSource();
private:
InternalInputSource(const InternalInputSource &); // undefined
void operator=(const InternalInputSource &); // undefined
Char *buf_;
const StringC *contents_;
};
#ifdef SP_NAMESPACE
}
#endif
#endif /* not InternalInputSource_INCLUDED */

View file

@ -1,40 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: Link.C /main/1 1996/07/29 16:55:34 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#include "splib.h"
#include "Link.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
Link::~Link()
{
}
#ifdef SP_NAMESPACE
}
#endif

View file

@ -1,65 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: Link.h /main/1 1996/07/29 16:55:39 cde-hp $ */
// Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef Link_INCLUDED
#define Link_INCLUDED 1
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
#ifndef SP_API
#define SP_API
#endif
class SP_API 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)
{
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not Link_INCLUDED */

Some files were not shown because too many files have changed in this diff Show more