/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
See the file COPYING for copying permission.
*/
#define NDEBUG
#include <stddef.h>
#include <string.h> /* memset(), memcpy() */
#include <assert.h>
#define XML_BUILDING_EXPAT 1
#ifdef COMPILED_FROM_DSP
#include "winconfig.h"
#elif defined(MACOS_CLASSIC)
#include "macconfig.h"
#elif defined(HAVE_EXPAT_CONFIG_H)
#include <expat_config.h>
#endif /* ndef COMPILED_FROM_DSP */
#include "expat.h"
#ifdef XML_UNICODE
#define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX
#define XmlConvert XmlUtf16Convert
#define XmlGetInternalEncoding XmlGetUtf16InternalEncoding
#define XmlGetInternalEncodingNS XmlGetUtf16InternalEncodingNS
#define XmlEncode XmlUtf16Encode
#define MUST_CONVERT(enc, s) (!(enc)->isUtf16 || (((unsigned long)s) & 1))
typedef unsigned short ICHAR;
#else
#define XML_ENCODE_MAX XML_UTF8_ENCODE_MAX
#define XmlConvert XmlUtf8Convert
#define XmlGetInternalEncoding XmlGetUtf8InternalEncoding
#define XmlGetInternalEncodingNS XmlGetUtf8InternalEncodingNS
#define XmlEncode XmlUtf8Encode
#define MUST_CONVERT(enc, s) (!(enc)->isUtf8)
typedef char ICHAR;
#endif
#ifndef XML_NS
#define XmlInitEncodingNS XmlInitEncoding
#define XmlInitUnknownEncodingNS XmlInitUnknownEncoding
#undef XmlGetInternalEncodingNS
#define XmlGetInternalEncodingNS XmlGetInternalEncoding
#define XmlParseXmlDeclNS XmlParseXmlDecl
#endif
#ifdef XML_UNICODE
#ifdef XML_UNICODE_WCHAR_T
#define XML_T(x) (const wchar_t)x
#define XML_L(x) L ## x
#else
#define XML_T(x) (const unsigned short)x
#define XML_L(x) x
#endif
#else
#define XML_T(x) x
#define XML_L(x) x
#endif
/* Round up n to be a multiple of sz, where sz is a power of 2. */
#define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1))
/* Handle the case where memmove() doesn't exist. */
#ifndef HAVE_MEMMOVE
#ifdef HAVE_BCOPY
#define memmove(d,s,l) bcopy((s),(d),(l))
#else
#error memmove does not exist on this platform, nor is a substitute available
#endif /* HAVE_BCOPY */
#endif /* HAVE_MEMMOVE */
#include "internal.h"
#include "xmltok.h"
#include "xmlrole.h"
typedef const XML_Char *KEY;
typedef struct {
KEY name;
} NAMED;
typedef struct {
NAMED **v;
unsigned char power;
size_t size;
size_t used;
const XML_Memory_Handling_Suite *mem;
} HASH_TABLE;
/* Basic character hash algorithm, taken from Python's string hash:
h = h * 1000003 ^ character, the constant being a prime number.
*/
#ifdef XML_UNICODE
#define CHAR_HASH(h, c) \
(((h) * 0xF4243) ^ (unsigned short)(c))
#else
#define CHAR_HASH(h, c) \
(((h) * 0xF4243) ^ (unsigned char)(c))
#endif
/* For probing (after a collision) we need a step size relative prime
to the hash table size, which is a power of 2. We use double-hashing,
since we can calculate a second hash value cheaply by taking those bits
of the first hash value that were discarded (masked out) when the table
index was calculated: index = hash & mask, where mask = table->size - 1.
We limit the maximum step size to table->size / 4 (mask >> 2) and make
it odd, since odd numbers are always relative prime to a power of 2.
*/
#define SECOND_HASH(hash, mask, power) \
((((hash) & ~(mask)) >> ((power) - 1)) & ((mask) >> 2))
#define PROBE_STEP(hash, mask, power) \
((unsigned char)((SECOND_HASH(hash, mask, power)) | 1))
typedef struct {
NAMED **p;
NAMED **end;
} HASH_TABLE_ITER;
#define INIT_TAG_BUF_SIZE 32 /* must be a multiple of sizeof(XML_Char) */
#define INIT_DATA_BUF_SIZE 1024
#define INIT_ATTS_SIZE 16
#define INIT_ATTS_VERSION 0xFFFFFFFF
#define INIT_BLOCK_SIZE 1024
#define INIT_BUFFER_SIZE 1024
#define EXPAND_SPARE 24
typedef struct binding {
struct prefix *prefix;
struct binding *nextTagBinding;
struct binding *prevPrefixBinding;
const struct attribute_id *attId;
XML_Char *uri;
int uriLen;
int uriAlloc;
} BINDING;
typedef struct prefix {
const XML_Char *name;
BINDING *binding;
} PREFIX;
typedef struct {
const XML_Char *str;
const XML_Char *localPart;
const XML_Char *prefix;
int strLen;
int uriLen;
int prefixLen;
} TAG_NAME;
/* TAG represents an open element.
The name of the element is stored in both the document and API
encodings. The memory buffer 'buf' is a separately-allocated
memory area which stores the name. During the XML_Parse()/
XMLParseBuffer() when the element is open, the memory for the 'raw'
version of the name (in the document encoding) is shared with the
document buffer. If the element is open across calls to
XML_Parse()/XML_ParseBuffer(), the buffer is re-allocated to
contain the 'raw' name as well.
A parser re-uses these structures, maintaining a list of allocated
TAG objects in a free list.
*/
typedef struct tag {
struct tag *parent; /* parent of this element */
const char *rawName; /* tagName in the original encoding */
int rawNameLength;
TAG_NAME name; /* tagName in the API encoding */
char *buf; /* buffer for name components */
char *bufEnd; /* end of the buffer */
BINDING *bindings;
} TAG;
typedef struct {
const XML_Char *name;
const XML_Char *textPtr;
int textLen; /* length in XML_Chars */
int processed; /* # of processed bytes - when suspended */
const XML_Char *systemId;
const XML_Char *base;
const XML_Char *publicId;
const XML_Char *notation;
XML_Bool open;
XML_Bool is_param;
XML_Bool is_internal; /* true if declared in internal subset outside PE */
} ENTITY;
typedef struct {
enum XML_Content_Type type;
enum XML_Content_Quant quant;
const XML_Char * name;
int firstchild;
int lastchild;
int childcnt;
int nextsib;
} CONTENT_SCAFFOLD;
#define INIT_SCAFFOLD_ELEMENTS 32
typedef struct block {
struct block *next;
int size;
XML_Char s[1];
} BLOCK;
typedef struct {
BLOCK *blocks;
BLOCK *freeBlocks;
const XML_Char *end;
XML_Char *ptr;
XML_Char *start;
const XML_Memory_Handling_Suite *mem;
} STRING_POOL;
/* The XML_Char before the name is used to determine whether
an attribute has been specified. */
typedef struct attribute_id {
XML_Char *name;
PREFIX *prefix;
XML_Bool maybeTokenized;
XML_Bool xmlns;
} ATTRIBUTE_ID;
typedef struct {
const ATTRIBUTE_ID *id;
XML_Bool isCdata;
const XML_Char *value;
} DEFAULT_ATTRIBUTE;
typedef struct {
unsigned long version;
unsigned long hash;
const XML_Char *uriName;
} NS_ATT;
typedef struct {
const XML_Char *name;
PREFIX *prefix;
const ATTRIBUTE_ID *idAtt;
int nDefaultAtts;
int allocDefaultAtts;
DEFAULT_ATTRIBUTE *defaultAtts;
} ELEMENT_TYPE;
typedef struct {
HASH_TABLE generalEntities;
HASH_TABLE elementTypes;
HASH_TABLE attributeIds;
HASH_TABLE prefixes;
STRING_POOL pool;
STRING_POOL entityValuePool;
/* false once a parameter entity reference has been skipped */
XML_Bool keepProcessing;
/* true once an internal or external PE reference has been encountered;
this includes the reference to an external subset */
XML_Bool hasParamEntityRefs;
XML_Bool standalone;
#ifdef XML_DTD
/* indicates if external PE has been read */
XML_Bool paramEntityRead;
HASH_TABLE paramEntities;
#endif /* XML_DTD */
PREFIX defaultPrefix;
/* === scaffolding for building content model === */
XML_Bool in_eldecl;
CONTENT_SCAFFOLD *scaffold;
unsigned contentStringLen;
unsigned scaffSize;
unsigned scaffCount;
int scaffLevel;
int *scaffIndex;
} DTD;
typedef struct open_internal_entity {
const char *internalEventPtr;
const char *internalEventEndPtr;
struct open_internal_entity *next;
ENTITY *entity;
int startTagLevel;
XML_Bool betweenDecl; /* WFC: PE Between Declarations */
} OPEN_INTERNAL_ENTITY;
typedef enum XML_Error PTRCALL Processor(XML_Parser parser,
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
JSBSim运行文件+仿真结果+画图脚本 (727个子文件)
runJSBSim_withAircraft2.bat 660B
runJSBSim_withAircraft.bat 305B
runJSBSim_withscript.bat 201B
xmlparse.c 185KB
xmltok_impl.c 43KB
xmltok.c 40KB
xmlrole.c 32KB
xmltok_ns.c 3KB
README.flightmodel.c172p 0B
README.c172r 1KB
README.c182 1KB
README.c310 1KB
FGTrimAnalysis.cpp 121KB
FGInitialCondition.cpp 55KB
FGMSIS.cpp 50KB
FGMSISData.cpp 47KB
FGFDMExec.cpp 43KB
FGPropagate.cpp 41KB
FGPiston.cpp 40KB
FGFunction.cpp 33KB
FGLGear.cpp 33KB
FGGasCell.cpp 31KB
FGRotor.cpp 31KB
FGTrim.cpp 30KB
FGFCS.cpp 28KB
prep_plot.cpp 28KB
FGPropulsion.cpp 27KB
FGStandardAtmosphere.cpp 26KB
JSBSim.cpp 26KB
FGScript.cpp 25KB
FGAerodynamics.cpp 25KB
FGWinds.cpp 24KB
FGXMLElement.cpp 22KB
FGTable.cpp 22KB
FGTurbine.cpp 22KB
FGTurboProp.cpp 20KB
FGMassBalance.cpp 19KB
FGTank.cpp 19KB
FGPropeller.cpp 18KB
FGOutputTextFile.cpp 17KB
FGTrimAnalysisControl.cpp 17KB
FGAuxiliary.cpp 16KB
FGAccelerations.cpp 16KB
main.cpp 16KB
FGMatrix33.cpp 15KB
FGTrimmer.cpp 15KB
FGRocket.cpp 14KB
FGOutputFG.cpp 13KB
FGLocation.cpp 13KB
FGFilter.cpp 13KB
FGPropertyManager.cpp 13KB
FGFCSComponent.cpp 12KB
FGActuator.cpp 12KB
FGfdmSocket.cpp 12KB
FGTrimAxis.cpp 12KB
FGNelderMead.cpp 12KB
FGOutputSocket.cpp 12KB
FGSensor.cpp 11KB
FGJSBBase.cpp 11KB
FGAtmosphere.cpp 11KB
FGOutputType.cpp 11KB
FGEngine.cpp 11KB
FGOutput.cpp 10KB
FGGroundReactions.cpp 10KB
FGAircraft.cpp 9KB
FGCondition.cpp 9KB
FGExternalForce.cpp 9KB
FGPID.cpp 9KB
FGBuoyantForces.cpp 9KB
FGWaypoint.cpp 9KB
FGQuaternion.cpp 8KB
FGGain.cpp 8KB
FGInputSocket.cpp 8KB
FGSwitch.cpp 8KB
easyxml.cpp 7KB
FGTransmission.cpp 7KB
FGInput.cpp 7KB
FGKinemat.cpp 7KB
FGDistributor.cpp 7KB
FGInertial.cpp 7KB
FGAngles.cpp 7KB
FGThruster.cpp 7KB
FGRungeKutta.cpp 6KB
FGExternalReactions.cpp 6KB
FGMagnetometer.cpp 6KB
FGModelFunctions.cpp 6KB
FGModel.cpp 6KB
FGElectric.cpp 6KB
FGForce.cpp 6KB
FGStateSpace.cpp 5KB
FGDeadBand.cpp 5KB
FGSurface.cpp 5KB
plotXMLVisitor.cpp 5KB
FGAccelerometer.cpp 5KB
FGPropertyReader.cpp 5KB
FGSimplexTrim.cpp 5KB
FGNozzle.cpp 5KB
FGInputType.cpp 5KB
FGFCSFunction.cpp 5KB
FGSummer.cpp 5KB
共 727 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
- 碧树西风2019-03-24还不错! 可以运行, 但还不是我想要的
32768
- 粉丝: 78
- 资源: 10
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功